Skip to content

Commit cc050df

Browse files
author
Demis Balbach
committed
Change method faces to not collide with property faces; Add property access face
1 parent 3ddbffa commit cc050df

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

php-face.el

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,16 @@
246246
:group 'php-faces
247247
:tag "PHP Property Access")
248248

249+
(defface php-property-const '((t (:inherit php-keyword)))
250+
"Face used to highlight const keyword in property declaration."
251+
:group 'php-faces
252+
:tag "PHP Property Const")
253+
254+
(defface php-property-static '((t (:inherit php-keyword)))
255+
"Face used to highlight static keyword in property declaration."
256+
:group 'php-faces
257+
:tag "PHP Property Static")
258+
249259
(define-obsolete-face-alias 'php-annotations-annotation-face 'php-doc-annotation-tag "1.19.0")
250260

251261
(provide 'php-face)

php-mode.el

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,16 +1556,23 @@ a completion list."
15561556
("\\(abstract\\|final\\)[[:space:]]\\(?:class\\)" (1 'php-class-modifiers))
15571557

15581558
;; Method modifiers (abstract, final)
1559-
("\\(abstract\\|final\\)[[:space:]]\\(?:static\\|public\\|private\\|protected\\|function\\)" (1 'php-method-modifiers))
1559+
("\\(abstract\\|final\\)\\(?:[[:space:]]static\\|[[:space:]]public\\|[[:space:]]private\\|[[:space:]]protected\\)*\\(?:[[:space:]]function\\)" (1 'php-method-modifiers))
15601560

15611561
;; Method access protection (public, protected, private)
1562-
("\\(private\\|protected\\|public\\)[[:space:]]\\(?:static\\|function\\|abstract|\\final\\)" (1 'php-method-access))
1562+
("\\(private\\|protected\\|public\\)\\(?:[[:space:]]static\\|[[:space:]]final\\|[[:space:]]abstract\\)*\\(?:[[:space:]]function\\)" (1 'php-method-access))
15631563

15641564
;; Method static modifier
1565-
("\\(static\\)[[:space:]]\\(?:public\\|protected\\|private\\|function\\|abstract\\|final\\)" (1 'php-method-static))
1565+
("\\(static\\)\\(?:[[:space:]]private\\|[[:space:]]protected\\|[[:space:]]public\\|[[:space:]]final\\|[[:space:]]abstract\\)*\\(?:[[:space:]]function\\)" (1 'php-method-static))
1566+
1567+
;; Property constants
1568+
("\\(const\\)[[:space:]]\\(?:[^\$][[:word:]]\\)" (1 'php-property-const))
15661569

15671570
;; Property access protection
1568-
;("\\(private\\|protected\\|public\\)\\(?:[[:space:]]const[[:space:]][[:word:]]\\|[[:space:]]\$[[:word:]]\\)" (1 'php-property-access))
1571+
("\\(private\\|protected\\|public\\)\\(?:[[:space:]]static\\|[[:space:]]const\\)?\\(?:[[:space:]]\$?[[:word:]]+\\)\\(?:[[:space:]]*=[[:space:]]*[^;]+\\)?\\(?:;\\)" (1 'php-property-access))
1572+
;("\\(private\\|protected\\|public\\)[[:space:]]\\(?:const[[:space:]][^\$][[:word:]]\\|\$[[:word:]]\\)" (1 'php-property-access))
1573+
1574+
;; Property static modifier
1575+
;;("\\(static\\)[[:space:]]\\(?:public\\|protected\\|private\\)" (1 'php-property-static))
15691576

15701577
;; Highlight variables, e.g. 'var' in '$var' and '$obj->var', but
15711578
;; not in $obj->var()

0 commit comments

Comments
 (0)