Skip to content

Commit

Permalink
refactor: more preg_match() and empty string only check
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Dec 27, 2024
1 parent 2e191e8 commit 5caee6a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion system/Router/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ protected function fillRouteParams(string $from, ?array $params = null): string
$patterns = $matches[0];

foreach ($patterns as $index => $pattern) {
if (in_array(preg_match('#^' . $pattern . '$#u', $params[$index]), [0, false], true)) {
if (preg_match('#^' . $pattern . '$#u', $params[$index]) !== 1) {
throw RouterException::forInvalidParameterType();
}

Expand Down
2 changes: 1 addition & 1 deletion system/Test/CIUnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public function assertLogContains(string $level, string $logMessage, string $mes
{
$this->assertTrue(
TestLogger::didLog($level, $logMessage, false),
$message !== '' && $message !== '0' ? $message : sprintf(
$message !== '' ? $message : sprintf(
'Failed asserting that logs have a record of message containing "%s" with level "%s".',
$logMessage,
$level
Expand Down

0 comments on commit 5caee6a

Please sign in to comment.