Skip to content

Commit 06fdd6c

Browse files
committed
Upgrade to PHPStan 2.0
1 parent 233ee91 commit 06fdd6c

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

app/Foundation/Hooks/Hook.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use function gettype;
1515
use function is_array;
1616
use function is_callable;
17+
use function is_object;
1718
use function is_string;
1819
use function preg_match;
1920
use function spl_object_hash;
@@ -271,7 +272,13 @@ private function getNativeId(callable $callback): string
271272
}
272273

273274
if (is_array($callback)) {
274-
return get_class($callback[0]) . '::' . $callback[1];
275+
if (isset($callback[0]) && is_object($callback[0])) {
276+
return get_class($callback[0]) . '::' . $callback[1];
277+
}
278+
279+
if (isset($callback[0]) && is_string($callback[0])) {
280+
return $callback[0] . '::' . $callback[1];
281+
}
275282
}
276283

277284
return spl_object_hash(Closure::fromCallable($callback));

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@
4242
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
4343
"phpcompatibility/php-compatibility": "^9.3",
4444
"phpstan/extension-installer": "^1.4",
45-
"phpstan/phpstan": "^1.12",
46-
"phpstan/phpstan-phpunit": "^1.4",
47-
"phpstan/phpstan-strict-rules": "^1.6",
45+
"phpstan/phpstan": "^2.0",
46+
"phpstan/phpstan-phpunit": "^2.0",
47+
"phpstan/phpstan-strict-rules": "^2.0",
4848
"phpunit/phpunit": "^9.6",
4949
"roots/wordpress": "^6.6",
5050
"symfony/var-dumper": "^5.4",
5151
"syntatis/coding-standard": "^1.4",
52-
"szepeviktor/phpstan-wordpress": "^1.3",
52+
"szepeviktor/phpstan-wordpress": "^2.0",
5353
"wp-phpunit/wp-phpunit": "^6.6",
5454
"yoast/phpunit-polyfills": "^3.0"
5555
},

0 commit comments

Comments
 (0)