Skip to content

Commit 0b21c5c

Browse files
committed
Optimize isWhitespace
Signed-off-by: Kamil Tekiela <[email protected]>
1 parent 0e979c8 commit 0b21c5c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Context.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,12 @@ public static function isOperator(string $string): int|null
372372
/**
373373
* Checks if the given character is a whitespace.
374374
*/
375-
public static function isWhitespace(string $string): bool
375+
public static function isWhitespace(string $character): bool
376376
{
377-
return $string === ' ' || $string === "\r" || $string === "\n" || $string === "\t";
377+
return match ($character) {
378+
' ', "\r", "\n", "\t" => true,
379+
default => false,
380+
};
378381
}
379382

380383
/**

0 commit comments

Comments
 (0)