Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
fail-fast: false
matrix:
php_version:
- '8.2'
- '8.3'
- '8.4'
- '8.5'
- '8.6'
dependency-versions:
- 'lowest'
- 'default'
Expand All @@ -29,7 +29,7 @@ jobs:
tools: composer:v2

- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
show-progress: false

Expand All @@ -49,7 +49,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [8.2, 8.4]
php: [8.4, 8.6]
steps:
- uses: actions/checkout@v7

Expand All @@ -76,7 +76,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
php-version: "8.4"
ini-values: "zend.exception_ignore_args=Off"
coverage: none

Expand All @@ -95,7 +95,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
php-version: "8.4"
ini-values: "zend.exception_ignore_args=Off"
coverage: none

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
Thumbs.db
thumbs.db
/composer.lock
/patches.lock.json
.phpunit.result.cache
.php-cs-fixer.cache
4 changes: 2 additions & 2 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
use PhpCsFixer\Config;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;

$finder = (new Finder())
$finder = new Finder()
->in(__DIR__)
;

return (new Config())
return new Config()
->setParallelConfig(ParallelConfigFactory::detect())
->setRules([
'@Symfony' => true,
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
### Unreleased

* Support PHP 8.5 & 8.6
* Drop support for PHP 8.2 & 8.3
* Drop support for psr/log 1.x and 2.x.
* BREAKING: AbstractArrayRepository::getEntityBaseClass() is now abstract.
* Refactored ConsistentStringScrambler to use Randomizer rather than mt_rand.
Expand Down
14 changes: 9 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@
],
"require": {
"ext-json": "*",
"ext-mbstring": "~8.2.0 || ~8.3.0 || ~8.4.0",
"ext-pdo": "~8.2.0 || ~8.3.0 || ~8.4.0",
"ext-sodium": "~8.2.0 || ~8.3.0 || ~8.4.0",
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
"ext-mbstring": "~8.4.0 || ~8.5.0 || ~8.6.0",
"ext-pdo": "~8.4.0 || ~8.5.0 || ~8.6.0",
"ext-sodium": "~8.4.0 || ~8.5.0 || ~8.6.0",
"php": "~8.4.0 || ~8.5.0 || ~8.6.0",
"psr/log": "^3.0",
"rector/rector": "2.8.1"
},
"require-dev": {
"mikey179/vfsstream": "^1.6.12",
"phpunit/phpunit": "^11.5",
"ergebnis/phpunit-slow-test-detector": "^2.15",
"cweagans/composer-patches": "~2.0",
"php-cs-fixer/shim": "3.95.27",
"phpstan/phpstan": "2.3.2"
},
Expand All @@ -45,7 +46,10 @@
}
},
"config": {
"preferred-install": "dist"
"preferred-install": "dist",
"allow-plugins": {
"cweagans/composer-patches": true
Comment thread
acoulton marked this conversation as resolved.
Resolved
}
},
"scripts": {
"cs": "php-cs-fixer fix --dry-run --verbose --diff",
Expand Down
7 changes: 7 additions & 0 deletions patches.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"patches": {
"mikey179/vfsstream": {
"Replace deprecated in 8.6 spl_object_hash with spl_object_id": "patches/fix-spl-object-hash.txt"
}
}
}
13 changes: 13 additions & 0 deletions patches/fix-spl-object-hash.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/main/php/org/bovigo/vfs/vfsStreamFile.php b/src/main/php/org/bovigo/vfs/vfsStreamFile.php
index 406252a..3deb270 100644
--- a/src/main/php/org/bovigo/vfs/vfsStreamFile.php
+++ b/src/main/php/org/bovigo/vfs/vfsStreamFile.php
@@ -371,7 +371,7 @@ class vfsStreamFile extends vfsStreamAbstractContent
$resource = $data['wrapper_data'];
}

- return spl_object_hash($resource);
+ return (string) spl_object_id($resource);
}

/**
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
privatization: true,
phpunitCodeQuality: true
)
->withPhpSets(php82: true)
->withPhpSets(php84: true)
->withSkip([
// Don't make whole classes read-only in libraries, it makes BC awkward
ReadOnlyClassRector::class,
Expand Down
6 changes: 3 additions & 3 deletions src/CSV/CSVWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class CSVWriter
{
final public const UTF8_BOM = "\xEF\xBB\xBF";
final public const string UTF8_BOM = "\xEF\xBB\xBF";

/**
* @var resource|null
Expand Down Expand Up @@ -89,7 +89,7 @@ public function write(array $row): void
if (!$this->isResourceOpen()) {
throw new LogicException('Cannot write to a closed file');
}
fputcsv($this->resource, $row, eol: $this->options['eol']);
fputcsv($this->resource, $row, escape: '\\', eol: $this->options['eol']);
}

/**
Expand Down Expand Up @@ -122,7 +122,7 @@ private function writeHeaders(array $keys): void
if (!$this->isResourceOpen()) {
throw new LogicException('Cannot write to a closed file');
}
fputcsv($this->resource, $keys, eol: $this->options['eol']);
fputcsv($this->resource, $keys, escape: '\\', eol: $this->options['eol']);
} else {
array_walk(
$keys,
Expand Down
2 changes: 1 addition & 1 deletion src/DateTime/DateIntervalUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class DateIntervalUtils
{
private const SUPPORTED_HUMAN_COMPONENTS = [
private const array SUPPORTED_HUMAN_COMPONENTS = [
'y' => 'year',
'm' => 'month',
'd' => 'day',
Expand Down
14 changes: 7 additions & 7 deletions src/DeploymentConfig/DeploymentConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

final class DeploymentConfig
{
public const ANY = '*';
public const STANDALONE = 'standalone';
public const DEV = 'dev';
public const CI = 'ci';
public const PRODUCTION = 'production';
public const QA = 'qa';
public const LOADTEST = 'loadtest';
public const string ANY = '*';
public const string STANDALONE = 'standalone';
public const string DEV = 'dev';
public const string CI = 'ci';
public const string PRODUCTION = 'production';
public const string QA = 'qa';
public const string LOADTEST = 'loadtest';

private string $config_dir = '/etc/ingenerator/conf';

Expand Down
8 changes: 4 additions & 4 deletions src/Logging/DeviceIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ public static function get(): string
return $i->getValue();
}

public const CLI_ID = 'cli-------------------';
public const COOKIE_LIFETIME = 'P5Y';
public const VALID_REGEX = '/^[a-zA-Z0-9\-_=]{22}$/';
public const string CLI_ID = 'cli-------------------';
public const string COOKIE_LIFETIME = 'P5Y';
public const string VALID_REGEX = '/^[a-zA-Z0-9\-_=]{22}$/';

private ?string $id = null;

Expand Down Expand Up @@ -130,7 +130,7 @@ public function init(): void
private function assignNewIdAndSetCookies(): void
{
$this->id = Base64Url::encode(random_bytes(16));
$expire = (new DateTimeImmutable())->add(new DateInterval(self::COOKIE_LIFETIME));
$expire = new DateTimeImmutable()->add(new DateInterval(self::COOKIE_LIFETIME));

// The cookies are set with httponly=false to allow access from JS (though generally it is
// preferred to render it server-side and inject into javascript through data attributes /
Expand Down
8 changes: 1 addition & 7 deletions src/Logging/ExternalCallSiteFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ public function findExternalCall(array $trace, array $ignore_classes): array
/** @param list<class-string> $ignore_classes */
protected function isIgnoredClass(string $class, array $ignore_classes): bool
{
foreach ($ignore_classes as $ignored_class) {
if (is_a($ignored_class, $class, true)) {
return true;
}
}

return false;
return array_any($ignore_classes, fn (string $ignored_class): bool => is_a($ignored_class, $class, true));
}
}
2 changes: 1 addition & 1 deletion test/unit/DateTime/Clock/StoppedMockClockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testItIsInitialisableAtFixedMicrotime(): void
public function testItIsInitialisableAtADateIntervalInThePast(): void
{
$clock = StoppedMockClock::atTimeAgo('P3D');
$ago = (new DateTimeImmutable())->sub(new DateInterval('P3D'));
$ago = new DateTimeImmutable()->sub(new DateInterval('P3D'));
$this->assertEqualsWithDelta($ago, $clock->getDateTime(), 1, 'Time is at correct interval');
}

Expand Down
2 changes: 1 addition & 1 deletion test/unit/DateTime/DateIntervalUtilsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testItCanParseToHumanString(string $interval_string, string $exp

public static function provider_unsupported_human_intervals(): Iterator
{
$diff = fn (string $dt1, string $dt2) => (new DateTimeImmutable($dt1))->diff(new DateTimeImmutable($dt2));
$diff = fn (string $dt1, string $dt2) => new DateTimeImmutable($dt1)->diff(new DateTimeImmutable($dt2));
yield 'with micros e.g. from a diff' => [$diff('now', 'now')];
yield 'negative' => [$diff('2022-01-01 10:03:03', '2021-03-02 10:02:03')];
}
Expand Down
8 changes: 4 additions & 4 deletions test/unit/Object/ConstantDirectoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
*/
final class ConstantDirectoryTest extends TestCase
{
public const TEST_ONE = 'any';
public const TEST_TWO = 'two';
public const TESTTHREE = 'three';
public const ANYTHING = 'another';
public const string TEST_ONE = 'any';
public const string TEST_TWO = 'two';
public const string TESTTHREE = 'three';
public const string ANYTHING = 'another';

public function testItIsInitialisable(): void
{
Expand Down
Loading