Skip to content

Commit

Permalink
[Util]: Use instanceof instead of is_a() (rectorphp#3723)
Browse files Browse the repository at this point in the history
is_a() is a runtime concept which should not be used in static analysis context
  • Loading branch information
staabm committed May 1, 2023
1 parent f6972de commit 495c51f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Util/MultiInstanceofChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ final class MultiInstanceofChecker
/**
* @param array<class-string> $types
*/
public function isInstanceOf(object | string $object, array $types): bool
public function isInstanceOf(object $object, array $types): bool
{
foreach ($types as $type) {
if (is_a($object, $type, true)) {
if ($object instanceof $type) {
return true;
}
}
Expand Down

0 comments on commit 495c51f

Please sign in to comment.