diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 87def26..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.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 }} 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/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); } 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; } 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