JFIF x x C C " } !1AQa "q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w !1AQ aq"2B #3Rbr{
File "Polyfill.php"
Full Path: /home/u735268861/domains/palsarh.in/public_html/vendor/cuyz/valinor/src/Utility/Polyfill.php
File size: 1.21 KB
MIME-type: text/x-php
Charset: utf-8
<?php
declare(strict_types=1);
namespace CuyZ\Valinor\Utility;
/** @internal */
final class Polyfill
{
/**
* PHP8.4 use native function `array_all` instead.
*
* @param array<mixed> $array
*/
public static function array_all(array $array, callable $callback): bool
{
foreach ($array as $key => $value) {
if (! $callback($value, $key)) {
return false;
}
}
return true;
}
/**
* PHP8.4 use native function `array_find` instead.
*
* @param array<mixed> $array
*/
public static function array_any(array $array, callable $callback): bool
{
foreach ($array as $key => $value) {
if ($callback($value, $key)) {
return true;
}
}
return false;
}
/**
* PHP8.4 use native function `array_find` instead.
*
* @infection-ignore-all
* @param array<mixed> $array
*/
public static function array_find(array $array, callable $callback): mixed
{
foreach ($array as $key => $value) {
if ($callback($value, $key)) {
return $value;
}
}
return null;
}
}