Skip to content

Commit 27441da

Browse files
committed
Update PHPStan
1 parent 476c6a2 commit 27441da

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
},
1515
"require-dev": {
1616
"phpunit/phpunit": "^9.0 || ^10.0 || ^11.0",
17-
"phpstan/phpstan": "~1.10.3",
17+
"phpstan/phpstan": "2.1.0",
1818
"phpstan/extension-installer": "^1.0",
19-
"phpstan/phpstan-strict-rules": "^1.0"
19+
"phpstan/phpstan-strict-rules": "^2.0"
2020
},
2121
"replace": {
2222
"daverandom/callback-validator": "*"

src/CallbackType.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace DaveRandom\CallbackValidator;
44

5+
use function is_object;
6+
use function is_string;
7+
58
final class CallbackType
69
{
710
/**
@@ -30,7 +33,12 @@ private static function reflectCallable($target)
3033
return new \ReflectionFunction($target);
3134
}
3235

33-
if (\is_array($target) && isset($target[0], $target[1])) {
36+
if (
37+
\is_array($target) &&
38+
isset($target[0], $target[1]) &&
39+
(is_object($target[0]) || is_string($target[0])) &&
40+
is_string($target[1])
41+
) {
3442
return new \ReflectionMethod($target[0], $target[1]);
3543
}
3644

0 commit comments

Comments
 (0)