Skip to content

Commit 76617c5

Browse files
committed
Suppress callable issues
1 parent a1bf603 commit 76617c5

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎src/Assert.php‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,19 +479,23 @@ public static function __callStatic(string $name, array $arguments): void
479479
return;
480480
} elseif (preg_match('/^nullOr(.+)$/i', $name, $matches)) {
481481
$method = lcfirst($matches[1]);
482+
/** @var callable-array $callable */
483+
$callable = [static::class, 'nullOr'];
482484
if (method_exists(Webmozart::class, $method)) {
483-
call_user_func_array([static::class, 'nullOr'], [[Webmozart::class, $method], $arguments]);
485+
call_user_func_array($callable, [[Webmozart::class, $method], $arguments]);
484486
} elseif (method_exists(static::class, $method)) {
485-
call_user_func_array([static::class, 'nullOr'], [[static::class, $method], $arguments]);
487+
call_user_func_array($callable, [[static::class, $method], $arguments]);
486488
} else {
487489
throw new BadMethodCallException(sprintf("Assertion named `%s` does not exists.", $method));
488490
}
489491
} elseif (preg_match('/^all(.+)$/i', $name, $matches)) {
490492
$method = lcfirst($matches[1]);
493+
/** @var callable-array $callable */
494+
$callable = [static::class, 'all'];
491495
if (method_exists(Webmozart::class, $method)) {
492-
call_user_func_array([static::class, 'all'], [[Webmozart::class, $method], $arguments]);
496+
call_user_func_array($callable, [[Webmozart::class, $method], $arguments]);
493497
} elseif (method_exists(static::class, $method)) {
494-
call_user_func_array([static::class, 'all'], [[static::class, $method], $arguments]);
498+
call_user_func_array($callable, [[static::class, $method], $arguments]);
495499
} else {
496500
throw new BadMethodCallException(sprintf("Assertion named `%s` does not exists.", $method));
497501
}

0 commit comments

Comments
 (0)