Skip to content

Commit d49e9fb

Browse files
committed
Add :: as another separator for composed identifiers in PHP. Fixes #749, #653.
1 parent 5e12a7a commit d49e9fb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/languages/php.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ function(hljs) {
7272
PREPROCESSOR,
7373
VARIABLE,
7474
{
75-
// swallow class members to avoid parsing them as keywords
76-
begin: /->+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/
75+
// swallow composed identifiers to avoid parsing them as keywords
76+
begin: /(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/
7777
},
7878
{
7979
className: 'function',

test/detect/php/default.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ line description';
3535
}
3636

3737
$this->var = 0 - self::$st;
38-
$this->list = list(Array("1"=> 2, 2=>self::ME));
38+
$this->list = list(Array("1"=> 2, 2=>self::ME, 3 => \Location\Web\URI::class));
3939

4040
return [
4141
'uri' => $uri,

0 commit comments

Comments
 (0)