Skip to content

Commit

Permalink
Support PHP attributes (#2347)
Browse files Browse the repository at this point in the history
  • Loading branch information
rvanvelzen committed Feb 21, 2023
1 parent 4cfd3fd commit b4e9027
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions pygments/lexers/php.py
Expand Up @@ -192,6 +192,7 @@ class PhpLexer(RegexLexer):
bygroups(String, String, String.Delimiter, String, String.Delimiter,
Punctuation, Text)),
(r'\s+', Text),
(r'#\[', Punctuation),
(r'#.*?\n', Comment.Single),
(r'//.*?\n', Comment.Single),
# put the empty comment here, it is otherwise seen as
Expand Down
4 changes: 4 additions & 0 deletions tests/examplefiles/php/test.php
Expand Up @@ -542,3 +542,7 @@ public function nonMagic() {

?>

<?php
#[Attribute]
class Extra {}
?>
18 changes: 18 additions & 0 deletions tests/examplefiles/php/test.php.output

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b4e9027

Please sign in to comment.