From 5beca42e10bfc8549435e31aa87ff519fee40b91 Mon Sep 17 00:00:00 2001 From: Michael Sievenpiper Date: Fri, 5 Jun 2026 11:48:38 +0100 Subject: [PATCH 1/5] Fix implicit null issues for php 8.4 --- src/Support/Arr.php | 4 ++-- src/Support/Collections/Collection.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Support/Arr.php b/src/Support/Arr.php index be1f4e0..eab10c0 100644 --- a/src/Support/Arr.php +++ b/src/Support/Arr.php @@ -119,7 +119,7 @@ public static function exists($array, $key): bool * @param mixed $default * @return mixed */ - public static function first($array, callable $callback = null, $default = null) + public static function first($array, ?callable $callback = null, $default = null) { if (is_null($callback)) { if (empty($array)) { @@ -148,7 +148,7 @@ public static function first($array, callable $callback = null, $default = null) * @param mixed $default * @return mixed */ - public static function last(array $array, callable $callback = null, $default = null) + public static function last(array $array, ?callable $callback = null, $default = null) { if (is_null($callback)) { return empty($array) ? val($default) : end($array); diff --git a/src/Support/Collections/Collection.php b/src/Support/Collections/Collection.php index 9b80ff7..91925f6 100644 --- a/src/Support/Collections/Collection.php +++ b/src/Support/Collections/Collection.php @@ -37,7 +37,7 @@ public function each(callable $callback): self return $this; } - public function filter(callable $callback = null): self + public function filter(?callable $callback = null): self { if ($callback) { return new static(Arr::where($this->items, $callback)); @@ -53,7 +53,7 @@ public function filter(callable $callback = null): self * @param mixed $default * @return mixed */ - public function first(callable $callback = null, $default = null) + public function first(?callable $callback = null, $default = null) { return Arr::first($this->items, $callback, $default); } From e1ef86631982096a2173ed2b0f479de0ac8bfd5a Mon Sep 17 00:00:00 2001 From: Michael Sievenpiper Date: Fri, 5 Jun 2026 12:06:06 +0100 Subject: [PATCH 2/5] identified a falsy bug in VirtualFile.php --- .github/workflows/run-tests.yml | 2 +- src/Support/VirtualFile.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 87def26..bf382b7 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,7 +13,7 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest] - php: [8.2, 8.1, 8.0, 7.4] + php: [8.4, 8.2, 8.1, 8.0, 7.4] name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/src/Support/VirtualFile.php b/src/Support/VirtualFile.php index 09bd3c2..9ee657f 100644 --- a/src/Support/VirtualFile.php +++ b/src/Support/VirtualFile.php @@ -18,7 +18,7 @@ public function __destruct() public function unlink() { - if (! strpos(dirname($this->path), sys_get_temp_dir())) { + if (strpos(dirname($this->path), sys_get_temp_dir()) === false) { return; } From 610015880298071f3a76dd76872085c7bacf3433 Mon Sep 17 00:00:00 2001 From: Michael Sievenpiper Date: Fri, 5 Jun 2026 12:11:07 +0100 Subject: [PATCH 3/5] php 8.4 snapshots have a different order to the ones generated on php versions 7.4 and <= 8.3 therefore we should omit the comparisons till we remove support for these older versions --- .github/workflows/run-tests.yml | 7 ++++++- phpunit.xml.dist | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index bf382b7..fd73e96 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -36,9 +36,14 @@ jobs: - name: Install dependencies run: composer update --prefer-stable --prefer-dist --no-interaction - - name: Execute tests + - name: Execute tests (PHP 8.4 - full suite with snapshots) + if: matrix.php == '8.4' run: ./vendor/bin/phpunit --coverage-clover clover.xml -d --without-creating-snapshots + - name: Execute tests (older PHP - unit suite only) + if: matrix.php != '8.4' + run: ./vendor/bin/phpunit --no-coverage --testsuite Unit + - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 with: diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 172df2a..d164dce 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -22,6 +22,11 @@ tests + + tests + tests/SearcherTest.php + tests/Results/SearchResultTest.php + From 4c9ca8d7b7fbf9ad0433aa122f31dee8516107e2 Mon Sep 17 00:00:00 2001 From: Michael Sievenpiper Date: Fri, 5 Jun 2026 12:16:55 +0100 Subject: [PATCH 4/5] wrong way round --- .github/workflows/run-tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index fd73e96..0142f03 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -36,13 +36,13 @@ jobs: - name: Install dependencies run: composer update --prefer-stable --prefer-dist --no-interaction - - name: Execute tests (PHP 8.4 - full suite with snapshots) + - name: Execute tests (PHP 8.4 - unit suite only) if: matrix.php == '8.4' - run: ./vendor/bin/phpunit --coverage-clover clover.xml -d --without-creating-snapshots + run: ./vendor/bin/phpunit --testsuite Unit - - name: Execute tests (older PHP - unit suite only) + - name: Execute tests (older PHP - full suite with snapshots) if: matrix.php != '8.4' - run: ./vendor/bin/phpunit --no-coverage --testsuite Unit + run: ./vendor/bin/phpunit --coverage-clover clover.xml -d --without-creating-snapshots - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 From e727dadc0a30d62ba834961e4828f8c4bc1f6755 Mon Sep 17 00:00:00 2001 From: Michael Sievenpiper Date: Thu, 22 Oct 2026 11:39:57 +0100 Subject: [PATCH 5/5] Pin the snapshot serializer to Symfony 5.4 and run the full suite on PHP 7.4 to 8.5 --- .github/workflows/run-tests.yml | 9 ++------- composer.json | 5 ++++- phpunit.xml.dist | 5 ----- .../SearcherTest__it_searches_for_var_assignments__1.yml | 2 +- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 0142f03..d08c90b 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,7 +13,7 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest] - php: [8.4, 8.2, 8.1, 8.0, 7.4] + php: [8.5, 8.4, 8.3, 8.2, 8.1, 8.0, 7.4] name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} @@ -36,12 +36,7 @@ jobs: - name: Install dependencies run: composer update --prefer-stable --prefer-dist --no-interaction - - name: Execute tests (PHP 8.4 - unit suite only) - if: matrix.php == '8.4' - run: ./vendor/bin/phpunit --testsuite Unit - - - name: Execute tests (older PHP - full suite with snapshots) - if: matrix.php != '8.4' + - name: Execute tests run: ./vendor/bin/phpunit --coverage-clover clover.xml -d --without-creating-snapshots - name: Upload coverage to Codecov diff --git a/composer.json b/composer.json index 4ba0afb..a75d483 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,10 @@ }, "require-dev": { "phpunit/phpunit": "^9.5", - "spatie/phpunit-snapshot-assertions": "^4.2" + "spatie/phpunit-snapshot-assertions": "^4.2", + "symfony/property-access": "^5.4", + "symfony/property-info": "^5.4", + "symfony/serializer": "^5.4" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index d164dce..172df2a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -22,11 +22,6 @@ tests - - tests - tests/SearcherTest.php - tests/Results/SearchResultTest.php - diff --git a/tests/__snapshots__/SearcherTest__it_searches_for_var_assignments__1.yml b/tests/__snapshots__/SearcherTest__it_searches_for_var_assignments__1.yml index 273a4ad..b4c7acf 100644 --- a/tests/__snapshots__/SearcherTest__it_searches_for_var_assignments__1.yml +++ b/tests/__snapshots__/SearcherTest__it_searches_for_var_assignments__1.yml @@ -1,4 +1,4 @@ - location: { column: 0, endLine: 13, startLine: 13 } - node: { variableName: obj, value: { subNodeNames: [class, args], type: Expr_New, rawArgs: { }, firstClassCallable: false, args: { }, line: 13, startLine: 13, endLine: 13, startTokenPos: 57, endTokenPos: 61, startFilePos: 157, endFilePos: 169, comments: { }, docComment: null, attributes: { startLine: 13, startTokenPos: 57, startFilePos: 157, endLine: 13, endTokenPos: 61, endFilePos: 169 }, class: { subNodeNames: [name], parts: [MyClass], first: MyClass, last: MyClass, unqualified: true, qualified: false, fullyQualified: false, relative: false, specialClassName: false, type: Name, line: 13, startLine: 13, endLine: 13, startTokenPos: 59, endTokenPos: 59, startFilePos: 161, endFilePos: 167, comments: { }, docComment: null, attributes: { startLine: 13, startTokenPos: 59, startFilePos: 161, endLine: 13, endTokenPos: 59, endFilePos: 167 }, name: MyClass } }, name: obj, location: { column: 0, endLine: 13, startLine: 13 } } + node: { variableName: obj, value: { subNodeNames: [class, args], type: Expr_New, rawArgs: { }, firstClassCallable: false, partialFunctionApplication: false, args: { }, line: 13, startLine: 13, endLine: 13, startTokenPos: 57, endTokenPos: 61, startFilePos: 157, endFilePos: 169, comments: { }, docComment: null, attributes: { startLine: 13, startTokenPos: 57, startFilePos: 157, endLine: 13, endTokenPos: 61, endFilePos: 169 }, class: { subNodeNames: [name], parts: [MyClass], first: MyClass, last: MyClass, unqualified: true, qualified: false, fullyQualified: false, relative: false, specialClassName: false, type: Name, line: 13, startLine: 13, endLine: 13, startTokenPos: 59, endTokenPos: 59, startFilePos: 161, endFilePos: 167, comments: { }, docComment: null, attributes: { startLine: 13, startTokenPos: 59, startFilePos: 161, endLine: 13, endTokenPos: 59, endFilePos: 167 }, name: MyClass } }, name: obj, location: { column: 0, endLine: 13, startLine: 13 } } snippet: null