Skip to content

Commit 06bad13

Browse files
committed
Match a prefix, not just a word
1 parent 9dac1c2 commit 06bad13

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Assert.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ public static function __callStatic(string $name, array $arguments): void
357357
} elseif (method_exists(static::class, $name)) {
358358
call_user_func_array([static::class, $name], $arguments);
359359
return;
360-
} elseif (preg_match('/^nullOr(.*)$/i', $name, $matches)) {
360+
} elseif (preg_match('/^nullOr(.+)$/i', $name, $matches)) {
361361
$method = lcfirst($matches[1]);
362362
if (method_exists(Webmozart::class, $method)) {
363363
call_user_func_array([static::class, 'nullOr'], [[Webmozart::class, $method], $arguments]);
@@ -366,7 +366,7 @@ public static function __callStatic(string $name, array $arguments): void
366366
} else {
367367
throw new BadMethodCallException(sprintf("Assertion named `%s` does not exists.", $method));
368368
}
369-
} elseif (preg_match('/^all(.*)$/i', $name, $matches)) {
369+
} elseif (preg_match('/^all(.+)$/i', $name, $matches)) {
370370
$method = lcfirst($matches[1]);
371371
if (method_exists(Webmozart::class, $method)) {
372372
call_user_func_array([static::class, 'all'], [[Webmozart::class, $method], $arguments]);

0 commit comments

Comments
 (0)