Skip to content

Commit dc1cb26

Browse files
alamiraultfabpot
authored andcommitted
Remove usage of empty function when possible
1 parent 3bf90ae commit dc1cb26

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Lexer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function tokenize(string $expression): TokenStream
5454
++$cursor;
5555
} elseif (str_contains(')]}', $expression[$cursor])) {
5656
// closing bracket
57-
if (empty($brackets)) {
57+
if (!$brackets) {
5858
throw new SyntaxError(sprintf('Unexpected "%s".', $expression[$cursor]), $cursor, $expression);
5959
}
6060

@@ -97,7 +97,7 @@ public function tokenize(string $expression): TokenStream
9797

9898
$tokens[] = new Token(Token::EOF_TYPE, null, $cursor + 1);
9999

100-
if (!empty($brackets)) {
100+
if ($brackets) {
101101
[$expect, $cur] = array_pop($brackets);
102102
throw new SyntaxError(sprintf('Unclosed "%s".', $expect), $cur, $expression);
103103
}

Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ public function parseArguments()
404404
$args = [];
405405
$this->stream->expect(Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis');
406406
while (!$this->stream->current->test(Token::PUNCTUATION_TYPE, ')')) {
407-
if (!empty($args)) {
407+
if ($args) {
408408
$this->stream->expect(Token::PUNCTUATION_TYPE, ',', 'Arguments must be separated by a comma');
409409
}
410410

0 commit comments

Comments
 (0)