Skip to content

Commit

Permalink
PHP: Added match keyword (PHP 8.0) (#2574)
Browse files Browse the repository at this point in the history
PHP introduces a new [`match` keyword in PHP 8.0](https://php.watch/versions/8.0/match-expression).
  • Loading branch information
Ayesh committed Oct 5, 2020
1 parent 8ae6a4b commit 1761513
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/prism-php.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
(function (Prism) {
Prism.languages.php = Prism.languages.extend('clike', {
'keyword': /\b(?:__halt_compiler|abstract|and|array|as|break|callable|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|finally|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|namespace|new|or|parent|print|private|protected|public|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor|yield)\b/i,
'keyword': /\b(?:__halt_compiler|abstract|and|array|as|break|callable|case|catch|class|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|eval|exit|extends|final|finally|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|new|or|parent|print|private|protected|public|require|require_once|return|static|switch|throw|trait|try|unset|use|var|while|xor|yield)\b/i,
'boolean': {
pattern: /\b(?:false|true)\b/i,
alias: 'constant'
Expand Down
2 changes: 1 addition & 1 deletion components/prism-php.min.js

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

2 changes: 2 additions & 0 deletions tests/languages/php/keyword_feature.test
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ insteadof
interface;
isset
list
match
namespace;
new;
or
Expand Down Expand Up @@ -116,6 +117,7 @@ yield
["keyword", "interface"], ["punctuation", ";"],
["keyword", "isset"],
["keyword", "list"],
["keyword", "match"],
["keyword", "namespace"], ["punctuation", ";"],
["keyword", "new"], ["punctuation", ";"],
["keyword", "or"],
Expand Down

0 comments on commit 1761513

Please sign in to comment.