@@ -519,6 +519,9 @@ PHP does not have an \"enum\"-like keyword."
519519(c-lang-defconst c-lambda-kwds
520520 php '(" function" " use" ))
521521
522+ (c-lang-defconst c-inexpr-block-kwds
523+ php '(" match" ))
524+
522525(c-lang-defconst c-other-block-decl-kwds
523526 php '(" namespace" ))
524527
@@ -643,6 +646,23 @@ but only if the setting is enabled"
643646 (beginning-of-line )
644647 (if (looking-at-p " \\ s-*->" ) '+ nil ))))
645648
649+ (defun php-c-looking-at-or-maybe-in-bracelist (&optional containing-sexp lim )
650+ " Replace `c-looking-at-or-maybe-in-bracelist' .
651+
652+ CONTAINING-SEXP is the position of the brace/paren/bracket enclosing
653+ POINT, or nil if there is no such position, or we do not know it. LIM is
654+ a backward search limit."
655+ (cond
656+ ((looking-at-p " {" )
657+ (save-excursion
658+ (c-backward-token-2 2 t lim)
659+ ; ; PHP 8.0 match expression
660+ ; ; echo match ($var) |{
661+ ; ; ↑ matches ↑ initial position
662+ (when (looking-at-p (eval-when-compile (rx symbol-start " match" symbol-end)))
663+ (cons (point ) t ))))
664+ (t nil )))
665+
646666(c-add-style
647667 " php"
648668 `((c-basic-offset . 4 )
@@ -1186,6 +1206,10 @@ After setting the stylevars run hooks according to STYLENAME
11861206 (setq-local add-log-current-defun-function nil )
11871207 (setq-local add-log-current-defun-header-regexp php-beginning-of-defun-regexp)
11881208
1209+ (when (fboundp #'c-looking-at-or-maybe-in-bracelist )
1210+ (advice-add #'c-looking-at-or-maybe-in-bracelist
1211+ :override 'php-c-looking-at-or-maybe-in-bracelist ))
1212+
11891213 (when (>= emacs-major-version 25 )
11901214 (with-silent-modifications
11911215 (save-excursion
0 commit comments