Skip to content

Commit

Permalink
Use correct syntax for assertions
Browse files Browse the repository at this point in the history
The previous syntax resulted in assertions having an impact on both
cases when true and false were returned.
Let us switch to equality assertions when we cannot deduce anything for
the other case, and to a single assertion when we can deduce something
in both cases.

See https://psalm.dev/docs/annotating_code/assertion_syntax/#equality-assertions
See vimeo/psalm#8896
  • Loading branch information
greg0ire committed Dec 13, 2022
1 parent 49e0c1c commit 7788860
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/AbstractLexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function getInputUntilPosition($position)
*
* @return bool
*
* @psalm-assert-if-true !null $this->lookahead
* @psalm-assert-if-true !=null $this->lookahead
*/
public function isNextToken($type)
{
Expand All @@ -162,7 +162,7 @@ public function isNextToken($type)
*
* @return bool
*
* @psalm-assert-if-true !null $this->lookahead
* @psalm-assert-if-true !=null $this->lookahead
*/
public function isNextTokenAny(array $types)
{
Expand All @@ -175,7 +175,6 @@ public function isNextTokenAny(array $types)
* @return bool
*
* @psalm-assert-if-true !null $this->lookahead
* @psalm-assert-if-false null $this->lookahead
*/
public function moveNext()
{
Expand Down

0 comments on commit 7788860

Please sign in to comment.