Skip to content

Commit 5caee6a

Browse files
committed
refactor: more preg_match() and empty string only check
1 parent 2e191e8 commit 5caee6a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

system/Router/RouteCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ protected function fillRouteParams(string $from, ?array $params = null): string
13291329
$patterns = $matches[0];
13301330

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

system/Test/CIUnitTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ public function assertLogContains(string $level, string $logMessage, string $mes
374374
{
375375
$this->assertTrue(
376376
TestLogger::didLog($level, $logMessage, false),
377-
$message !== '' && $message !== '0' ? $message : sprintf(
377+
$message !== '' ? $message : sprintf(
378378
'Failed asserting that logs have a record of message containing "%s" with level "%s".',
379379
$logMessage,
380380
$level

0 commit comments

Comments
 (0)