Skip to content

Commit 1761513

Browse files
authored
PHP: Added match keyword (PHP 8.0) (#2574)
PHP introduces a new [`match` keyword in PHP 8.0](https://php.watch/versions/8.0/match-expression).
1 parent 8ae6a4b commit 1761513

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

components/prism-php.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
(function (Prism) {
1414
Prism.languages.php = Prism.languages.extend('clike', {
15-
'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,
15+
'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,
1616
'boolean': {
1717
pattern: /\b(?:false|true)\b/i,
1818
alias: 'constant'

components/prism-php.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/languages/php/keyword_feature.test

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ insteadof
4444
interface;
4545
isset
4646
list
47+
match
4748
namespace;
4849
new;
4950
or
@@ -116,6 +117,7 @@ yield
116117
["keyword", "interface"], ["punctuation", ";"],
117118
["keyword", "isset"],
118119
["keyword", "list"],
120+
["keyword", "match"],
119121
["keyword", "namespace"], ["punctuation", ";"],
120122
["keyword", "new"], ["punctuation", ";"],
121123
["keyword", "or"],

0 commit comments

Comments
 (0)