Skip to content

Commit 353ab0d

Browse files
committed
Fix for static variable-variables
Corrects issue with the following: static::${$test} = 'test';
1 parent d438e12 commit 353ab0d

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Syntaxes/PHP.plist

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,16 @@
14901490
</dict>
14911491
<dict>
14921492
<key>begin</key>
1493-
<string>(?i)(?=[a-z_0-9$\\]*(::))</string>
1493+
<string>(?xi)(?=
1494+
[a-z_0-9$\\]*(::)
1495+
(?:
1496+
([a-z_][a-z_0-9]*)\s*\(
1497+
|
1498+
((\$+)[a-z_\x{7f}-\x{ff}][a-z0-9_\x{7f}-\x{ff}]*)
1499+
|
1500+
([a-z_\x{7f}-\x{ff}][a-z0-9_\x{7f}-\x{ff}]*)
1501+
)?
1502+
)</string>
14941503
<key>end</key>
14951504
<string>(?x)(::)
14961505
(?:
@@ -1499,7 +1508,7 @@
14991508
((\$+)[a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)
15001509
|
15011510
([a-zA-Z_\x{7f}-\x{ff}][a-zA-Z0-9_\x{7f}-\x{ff}]*)
1502-
)</string>
1511+
)?</string>
15031512
<key>endCaptures</key>
15041513
<dict>
15051514
<key>1</key>

Tests/test-cases.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,11 @@ function &test(stdClass $foo = invalid)
245245
$foo = self::$bar;
246246
$foo = static::$bar;
247247
248+
static::${$test} = 'test';
249+
Blah::${$test} = 'test';
250+
\foo\Blah::${$test} = 'test';
251+
${$test} = 'test';
252+
248253
new self(); // `self` should highlight differently
249254
new static(); // `static` should highlight differently
250255
new Blah();

0 commit comments

Comments
 (0)