rector/src/Util/ArrayChecker.php
Tomas Votruba 11b6f003b8 Updated Rector to commit a94a11a157b69172d32dbdd6de3328d313f9f5ce
a94a11a157 [Utils] Add ArrayChecker util to verify first data found on given array (#3262)
2023-01-02 12:05:00 +00:00

23 lines
471 B
PHP

<?php
declare (strict_types=1);
namespace Rector\Core\Util;
final class ArrayChecker
{
/**
* @param mixed[] $elements
* @param callable(mixed $element): bool $callable
*/
public function doesExist(array $elements, callable $callable) : bool
{
foreach ($elements as $element) {
$isFound = $callable($element);
if ($isFound) {
return \true;
}
}
return \false;
}
}