Page MenuHomePhabricator

D16967.diff
No OneTemporary

D16967.diff

diff --git a/src/lexer/PhutilTypeLexer.php b/src/lexer/PhutilTypeLexer.php
--- a/src/lexer/PhutilTypeLexer.php
+++ b/src/lexer/PhutilTypeLexer.php
@@ -19,7 +19,7 @@
array('map', 'map'),
array('list', 'list'),
array('int|float|bool|string|null|callable|wild|regex', 'k'),
- array('[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*', 'k'),
+ array('\\\\?[a-zA-Z_\x7f-\xff]+(\\\\[a-zA-Z_\x7f-\xff]+)*', 'k'),
array('\\(', '(', 'comment'),
),
'comment' => array(
diff --git a/src/parser/__tests__/PhutilTypeSpecTestCase.php b/src/parser/__tests__/PhutilTypeSpecTestCase.php
--- a/src/parser/__tests__/PhutilTypeSpecTestCase.php
+++ b/src/parser/__tests__/PhutilTypeSpecTestCase.php
@@ -18,6 +18,10 @@
'optional int? (minimum 300)',
'list<wild>',
'list<list<list<map<string, string>>>> (easy)',
+ '\\SomeClass',
+ '\\Namespace\\SomeClass',
+ '\\NamespaceA\\NamespaceB\\NamespaceC',
+ 'NamespaceA\\NamespaceB\\NamespaceC',
);
$bad = array(
@@ -29,6 +33,10 @@
'(derp)',
'list<string (capital letters), string>',
'int?|string',
+ '\\',
+ '\\\\',
+ '\\SomeClass\\',
+ 'SomeClass\\',
);
$good = array_fill_keys($good, true);

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 5, 8:20 AM (13 h, 15 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6824997
Default Alt Text
D16967.diff (1 KB)

Event Timeline