diff --git a/php-mode-test.el b/php-mode-test.el index 654ddddd..ac9973fb 100644 --- a/php-mode-test.el +++ b/php-mode-test.el @@ -721,7 +721,12 @@ style from Drupal." (search-forward "SpaceName") (goto-char (match-beginning 0)) (should (eq 'php-constant - (get-text-property (point) 'face))))) + (get-text-property (point) 'face))) + (search-forward-regexp "\\\\My_\\(Class\\)") + (should (eq 'php-constant + (get-text-property (match-beginning 0) 'face))) + (should (eq 'php-constant + (get-text-property (match-beginning 1) 'face))))) (ert-deftest php-mode-test-variables() "Proper highlighting for variables." diff --git a/php-mode.el b/php-mode.el index 9bb3a1ee..6b7074a1 100644 --- a/php-mode.el +++ b/php-mode.el @@ -1565,8 +1565,8 @@ a completion list." (")\\s-*:\\s-*\\??\\(array\\)\\b" 1 font-lock-type-face) ;; namespaces - ("\\(\\([a-zA-Z0-9]+\\\\\\)+[a-zA-Z0-9]+\\|\\(\\\\[a-zA-Z0-9]+\\)+\\)[^:a-zA-Z0-9\\\\]" 1 'font-lock-type-face) - ("\\(\\([a-zA-Z0-9]+\\\\\\)+[a-zA-Z0-9]+\\|\\(\\\\[a-zA-Z0-9]+\\)+\\)::" 1 'php-constant) + ("\\(\\([a-zA-Z0-9_]+\\\\\\)+[a-zA-Z0-9_]+\\|\\(\\\\[a-zA-Z0-9_]+\\)+\\)[^:a-zA-Z0-9_\\\\]" 1 'font-lock-type-face) + ("\\(\\([a-zA-Z0-9_]+\\\\\\)+[a-zA-Z0-9_]+\\|\\(\\\\[a-zA-Z0-9_]+\\)+\\)::" 1 'php-constant) ;; Support the ::class constant in PHP5.6 ("\\sw+\\(::\\)\\(class\\)\\b" (1 'php-paamayim-nekudotayim) (2 'php-constant))) diff --git a/tests/identifiers.php b/tests/identifiers.php index ed0a6a6a..06299cd5 100644 --- a/tests/identifiers.php +++ b/tests/identifiers.php @@ -12,4 +12,5 @@ // When calling a method, the class name should be highlighted with // the constant face. Just like c++-mode "NS::Class::method()" ClassName::method(); -\SpaceName\ClassName::method(); \ No newline at end of file +\SpaceName\ClassName::method(); +\My_Class::method();