Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 7382930

Browse files
Fix multiple modifiers with non-typed property (#417)
1 parent 9b703d8 commit 7382930

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

grammars/php.cson

+1-1
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@
697697
}
698698
{
699699
'match': '''(?xi)
700-
((?:(?:public|private|protected|static)(?:\\s+|(?=\\?)))+) # At least one modifier
700+
((?:(?:public|private|protected|static)(?:\\s+|(?=\\?)))++) # At least one modifier
701701
(
702702
(?:\\?\\s*)? [a-z0-9_\\x{7f}-\\x{7fffffff}\\\\]+ | # nullable type
703703
[a-z0-9_\\x{7f}-\\x{7fffffff}\\\\]+ (?: \\s*\\|\\s* [a-z0-9_\\x{7f}-\\x{7fffffff}\\\\]+)+ # union type

spec/php-spec.coffee

+12
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,18 @@ describe 'PHP grammar', ->
731731
expect(lines[1][2]).toEqual value: '?', scopes: ["source.php", "meta.class.php", "meta.class.body.php", "keyword.operator.nullable-type.php"]
732732
expect(lines[1][4]).toEqual value: 'string', scopes: ["source.php", "meta.class.php", "meta.class.body.php", "storage.type.php"]
733733

734+
it 'tokenizes 2 modifiers correctly', ->
735+
lines = grammar.tokenizeLines '''
736+
class Foo {
737+
public static $bar = 'baz';
738+
}
739+
'''
740+
741+
expect(lines[1][1]).toEqual value: 'public', scopes: ['source.php', 'meta.class.php', 'meta.class.body.php', 'storage.modifier.php']
742+
expect(lines[1][3]).toEqual value: 'static', scopes: ['source.php', 'meta.class.php', 'meta.class.body.php', 'storage.modifier.php']
743+
expect(lines[1][5]).toEqual value: '$', scopes: ['source.php', 'meta.class.php', 'meta.class.body.php', 'variable.other.php', 'punctuation.definition.variable.php']
744+
expect(lines[1][6]).toEqual value: 'bar', scopes: ['source.php', 'meta.class.php', 'meta.class.body.php', 'variable.other.php']
745+
734746
it 'tokenizes namespaces', ->
735747
lines = grammar.tokenizeLines '''
736748
class A {

0 commit comments

Comments
 (0)