mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-31 00:10:51 +00:00
28c719d1fb
8961d20f56
[DX] Localize multi instance checker and privates accessor from Symplify + bump to PHPStan 1.8.3 (#2883)
22 lines
430 B
PHP
22 lines
430 B
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\Core\Util;
|
|
|
|
final class MultiInstanceofChecker
|
|
{
|
|
/**
|
|
* @param array<class-string> $types
|
|
* @param object|string $object
|
|
*/
|
|
public function isInstanceOf($object, array $types) : bool
|
|
{
|
|
foreach ($types as $type) {
|
|
if (\is_a($object, $type, \true)) {
|
|
return \true;
|
|
}
|
|
}
|
|
return \false;
|
|
}
|
|
}
|