mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix #934 - allow numbers in class constant enums
This commit is contained in:
parent
226aa27686
commit
55be2c3ce4
@ -465,7 +465,7 @@ class ParseTree
|
||||
case '::':
|
||||
$nexter_token = $i + 2 < $c ? $type_tokens[$i + 2] : null;
|
||||
|
||||
if (!$nexter_token || !preg_match('/^[A-Z_]+$/', $nexter_token)) {
|
||||
if (!$nexter_token || !preg_match('/^[A-Z_0-9]+$/', $nexter_token)) {
|
||||
throw new TypeParseTreeException(
|
||||
'Invalid class constant ' . $nexter_token
|
||||
);
|
||||
|
@ -60,10 +60,10 @@ class EnumTest extends TestCase
|
||||
namespace Ns;
|
||||
|
||||
class C {
|
||||
const A = "bat";
|
||||
const A1 = "bat";
|
||||
const B = "baz";
|
||||
}
|
||||
/** @psalm-param "foo"|"bar"|C::A|C::B $s */
|
||||
/** @psalm-param "foo"|"bar"|C::A1|C::B $s */
|
||||
function foo($s) : void {}
|
||||
foo("foo");
|
||||
foo("bar");
|
||||
|
Loading…
Reference in New Issue
Block a user