Skip to content

Commit

Permalink
still have some work but this is the basic idea
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaEstes committed Sep 4, 2024
1 parent efd539d commit 6bf2061
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/SonsOfPHP/Component/Assert/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,19 @@ public static function false($value, ?string $message = null): bool
return true;
}

public static function __callStatic($method, $args)
public static function __callStatic(string $method, array $args)
{
if (str_starts_with((string) $method, 'nullOr')) {
if (str_starts_with($method, 'nullOr')) {
if (null !== $args[0]) {
$method = lcfirst(substr((string) $method, 6));
$method = lcfirst(substr($method, 6));
call_user_func_array([static::class, $method], $args);
}

return true;
}

if (str_starts_with((string) $method, 'all')) {
$method = lcfirst(substr((string) $method, 3));
if (str_starts_with($method, 'all')) {
$method = lcfirst(substr($method, 3));
$values = array_shift($args);
foreach ($values as $value) {
call_user_func_array([static::class, $method], array_merge([$value], $args));
Expand All @@ -201,8 +201,8 @@ public static function __callStatic($method, $args)
return true;
}

if (str_starts_with((string) $method, 'not')) {
$method = lcfirst(substr((string) $method, 3));
if (str_starts_with($method, 'not')) {
$method = lcfirst(substr($method, 3));

try {
$ret = call_user_func_array([static::class, $method], $args);
Expand Down

0 comments on commit 6bf2061

Please sign in to comment.