Skip to content

Commit

Permalink
Allow numbers in error identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jul 17, 2023
1 parent 9882693 commit ba374e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Analyser/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public static function __set_state(array $properties): self

public static function validateIdentifier(string $identifier): bool
{
return Strings::match($identifier, '~^[a-zA-Z]([a-zA-Z\\.]*[a-zA-Z])?$~') !== null;
return Strings::match($identifier, '~^[a-zA-Z0-9]([a-zA-Z0-9\\.]*[a-zA-Z0-9])?$~') !== null;
}

}
4 changes: 3 additions & 1 deletion tests/PHPStan/Analyser/ErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public function dataValidIdentifier(): iterable
yield ['phpstan.alwaysFail'];
yield ['Phpstan.alwaysFail'];
yield ['phpstan.internal.foo'];
yield ['foo2.test'];
yield ['phpstan123'];
yield ['3m.blah'];
}

/**
Expand All @@ -38,7 +41,6 @@ public function dataInvalidIdentifier(): iterable
{
yield [''];
yield [' '];
yield ['phpstan123'];
yield ['phpstan '];
yield [' phpstan'];
yield ['.phpstan'];
Expand Down

0 comments on commit ba374e4

Please sign in to comment.