rector/src/Util/MultiInstanceofChecker.php
Tomas Votruba 28c719d1fb Updated Rector to commit 8961d20f56fa4b39bb21feec1f24422398f13dba
8961d20f56 [DX] Localize multi instance checker and privates accessor from Symplify + bump to PHPStan 1.8.3 (#2883)
2022-09-01 19:30:48 +00:00

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;
}
}