Skip to content

Commit 742bf04

Browse files
committed
Remove redundant checks already covered by is_callable()
Before this change, the array callable branches included explicit isset(), is_string(), and is_object() checks to narrow the type for static analysis. After updating PHPStan, it now understands that is_callable() on an array already guarantees those conditions, making the extra checks dead code that adds noise without providing safety. Assisted-by: Claude Code (claude-sonnet-4-6)
1 parent 291b624 commit 742bf04

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Handlers/CallableHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ public function handle(mixed $raw, int $depth): string|null
6262
return $this->buildMethod(new ReflectionMethod($raw, '__invoke'), $raw, $depth);
6363
}
6464

65-
if (is_array($raw) && isset($raw[0], $raw[1]) && is_object($raw[0]) && is_string($raw[1])) {
65+
if (is_array($raw) && is_object($raw[0])) {
6666
return $this->buildMethod(new ReflectionMethod($raw[0], $raw[1]), $raw[0], $depth);
6767
}
6868

69-
if (is_array($raw) && isset($raw[0], $raw[1]) && is_string($raw[0]) && is_string($raw[1])) {
69+
if (is_array($raw)) {
7070
return $this->buildStaticMethod(new ReflectionMethod($raw[0], $raw[1]), $depth);
7171
}
7272

0 commit comments

Comments
 (0)