Skip to content

Commit 547a31d

Browse files
authored
Merge pull request #611 from emacs-php/miniknN-php-faces
Improve class faces
2 parents 431ea53 + e8a8266 commit 547a31d

12 files changed

+19
-15
lines changed

php-face.el

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@
201201
:group 'php-faces
202202
:tag "PHPDoc Class Name")
203203

204+
(defface php-class-declaration '((t (:inherit php-keyword)))
205+
"Face used to class declarations."
206+
:group 'php-faces
207+
:tag "PHP Class Declaration")
208+
204209
(define-obsolete-face-alias 'php-annotations-annotation-face 'php-doc-annotation-tag "1.19.0")
205210

206211
(provide 'php-face)

php-mode.el

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,6 +1533,8 @@ a completion list."
15331533
1 'php-class)
15341534
;; Support the ::class constant in PHP5.6
15351535
("\\sw+\\(::\\)\\(class\\)\\b" (1 'php-paamayim-nekudotayim) (2 'php-magical-constant))
1536+
;; Class declaration keywords (class, trait, interface)
1537+
("\\_<\\(class\\|trait\\|interface\\)\\_>" . 'php-class-declaration)
15361538

15371539
;; Highlight static method calls as such. This is necessary for method
15381540
;; names which are identical to keywords to be highlighted correctly.

tests/7.4/typed-property.php.faces

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
;; -*- mode: emacs-lisp -*-
22
(("<?php" . php-php-tag)
33
("\n\n")
4-
("class" . php-keyword)
4+
("class" . php-class-declaration)
55
(" ")
66
("Typed" . font-lock-type-face)
77
("\n{\n ")

tests/issue-136.php.faces

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
("\n")
6565
("final" . php-keyword)
6666
(" ")
67-
("class" . php-keyword)
67+
("class" . php-class-declaration)
6868
(" ")
6969
("SampleClass" . font-lock-type-face)
7070
("\n{\n ")

tests/lang/class/anonymous-class.php.faces

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
(" ")
99
("new" . php-keyword)
1010
(" ")
11-
("class" . php-keyword)
11+
("class" . php-class-declaration)
1212
(" () ")
1313
("extends" . php-keyword)
1414
(" ")
@@ -21,12 +21,12 @@
2121
("(1, ")
2222
("new" . php-keyword)
2323
(" ")
24-
("class" . php-keyword)
24+
("class" . php-class-declaration)
2525
(" () ")
2626
("extends" . php-keyword)
2727
(" ")
2828
("IteratorAggregate" . font-lock-type-face)
2929
(" {\n ")
3030
("// " . font-lock-comment-delimiter-face)
3131
("###php-mode-test### ((indent 4))\n" . font-lock-comment-face)
32-
("});\n"))
32+
("});\n"))

tests/lang/doc-comment/annotation.php.faces

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
("@MyProject\\Annotations\\Foobarable" php-doc-annotation-tag font-lock-doc-face)
88
("\n */" . font-lock-doc-face)
99
("\n")
10-
("class" . php-keyword)
10+
("class" . php-class-declaration)
1111
(" ")
1212
("User" . font-lock-type-face)
1313
("\n{\n}\n\n")
@@ -20,7 +20,7 @@
2020
("myProperty" php-variable-name font-lock-doc-face)
2121
("\n */" . font-lock-doc-face)
2222
("\n")
23-
("class" . php-keyword)
23+
("class" . php-class-declaration)
2424
(" ")
2525
("Child" . font-lock-type-face)
2626
(" ")

tests/lang/doc-comment/comments.php.24.faces

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
("\n")
6565
("final" . php-keyword)
6666
(" ")
67-
("class" . php-keyword)
67+
("class" . php-class-declaration)
6868
(" ")
6969
("SampleClass" . font-lock-type-face)
7070
("\n{\n ")

tests/lang/doc-comment/comments.php.27.faces

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
("\n")
6666
("final" . php-keyword)
6767
(" ")
68-
("class" . php-keyword)
68+
("class" . php-class-declaration)
6969
(" ")
7070
("SampleClass" . font-lock-type-face)
7171
("\n{\n ")

tests/lang/doc-comment/comments.php.faces

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
("\n")
6565
("final" . php-keyword)
6666
(" ")
67-
("class" . php-keyword)
67+
("class" . php-class-declaration)
6868
(" ")
6969
("SampleClass" . font-lock-type-face)
7070
("\n{\n ")

tests/lang/doc-comment/issue-8.php.faces

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
("@ORM\\Table" php-doc-annotation-tag font-lock-doc-face)
1212
("(name=\"product\")\n */" . font-lock-doc-face)
1313
("\n")
14-
("class" . php-keyword)
14+
("class" . php-class-declaration)
1515
(" ")
1616
("Product" . font-lock-type-face)
1717
("\n{\n ")

tests/language-constructs.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
break;
2020
case;
2121
catch;
22-
class ClassName;
2322
clone;
2423
const;
2524
continue;
@@ -53,7 +52,6 @@ function;
5352
include_once;
5453
instanceof ClassName;
5554
insteadof ClassName;
56-
interface ClassName;
5755
isset();
5856
list();
5957
namespace ClassName;
@@ -68,7 +66,6 @@ interface ClassName;
6866
static;
6967
switch;
7068
throw;
71-
trait ClassName;
7269
try;
7370
unset();
7471
use ClassName;

tests/type-hints.php.faces

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
;; -*- mode: emacs-lisp -*-
22
(("<?php" . php-php-tag)
33
("\n\n")
4-
("class" . php-keyword)
4+
("class" . php-class-declaration)
55
(" ")
66
("SomeClass" . font-lock-type-face)
77
("\n{\n ")

0 commit comments

Comments
 (0)