Skip to content

Commit 6abc996

Browse files
committed
Add PHPStan and Psalm type names to php-phpdoc-type-keywords
1 parent 29bbf49 commit 6abc996

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

lisp/php-mode.el

+9-1
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,15 @@ for \\[find-tag] (which see)."
12791279
(list "string" "integer" "int" "boolean" "bool" "float"
12801280
"double" "object" "mixed" "array" "resource"
12811281
"void" "null" "false" "true" "self" "static"
1282-
"callable" "iterable" "number"))
1282+
"callable" "iterable" "number"
1283+
;; PHPStan and Psalm types
1284+
"array-key" "associative-array" "callable-array" "callable-object"
1285+
"callable-string" "class-string" "empty" "enum-string" "list"
1286+
"literal-string" "negative-int" "non-positive-int" "non-negative-int"
1287+
"never" "never-return" "never-returns" "no-return" "non-empty-array"
1288+
"non-empty-list" "non-empty-string" "non-falsy-string"
1289+
"numeric" "numeric-string" "positive-int" "scalar"
1290+
"trait-string" "truthy-string"))
12831291

12841292
(defconst php-phpdoc-type-tags
12851293
(list "package" "param" "property" "property-read" "property-write"

tests/lang/doc-comment/return-type.php.faces

+15-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
(" " . font-lock-doc-face)
3333
("int" font-lock-type-face php-string font-lock-doc-face)
3434
("[]" php-string font-lock-doc-face)
35-
(" A list of " . font-lock-doc-face)
35+
(" A " . font-lock-doc-face)
36+
("list" font-lock-type-face font-lock-doc-face)
37+
(" of " . font-lock-doc-face)
3638
("integer" font-lock-type-face font-lock-doc-face)
3739
(" values */" . font-lock-doc-face)
3840
("\n\n\n")
@@ -59,7 +61,9 @@
5961
("@return" php-doc-annotation-tag font-lock-doc-face)
6062
(" " . font-lock-doc-face)
6163
("DateTime[]" php-string font-lock-doc-face)
62-
(" A list of DateTime " . font-lock-doc-face)
64+
(" A " . font-lock-doc-face)
65+
("list" font-lock-type-face font-lock-doc-face)
66+
(" of DateTime " . font-lock-doc-face)
6367
("object" font-lock-type-face font-lock-doc-face)
6468
(" values */" . font-lock-doc-face)
6569
("\n\n\n")
@@ -86,7 +90,9 @@
8690
("@return" php-doc-annotation-tag font-lock-doc-face)
8791
(" " . font-lock-doc-face)
8892
("stdClass[]" php-string font-lock-doc-face)
89-
(" A list of stdClass " . font-lock-doc-face)
93+
(" A " . font-lock-doc-face)
94+
("list" font-lock-type-face font-lock-doc-face)
95+
(" of stdClass " . font-lock-doc-face)
9096
("object" font-lock-type-face font-lock-doc-face)
9197
(" values */" . font-lock-doc-face)
9298
("\n\n")
@@ -113,7 +119,9 @@
113119
("@return" php-doc-annotation-tag font-lock-doc-face)
114120
(" " . font-lock-doc-face)
115121
("\\App\\User[]" php-string font-lock-doc-face)
116-
(" A list of \\App\\User " . font-lock-doc-face)
122+
(" A " . font-lock-doc-face)
123+
("list" font-lock-type-face font-lock-doc-face)
124+
(" of \\App\\User " . font-lock-doc-face)
117125
("object" font-lock-type-face font-lock-doc-face)
118126
(" values */" . font-lock-doc-face)
119127
("\n\n")
@@ -138,7 +146,9 @@
138146
("int" font-lock-type-face php-string font-lock-doc-face)
139147
("[]|" php-string font-lock-doc-face)
140148
("string" font-lock-type-face php-string font-lock-doc-face)
141-
(" Multiple types by list of " . font-lock-doc-face)
149+
(" Multiple types by " . font-lock-doc-face)
150+
("list" font-lock-type-face font-lock-doc-face)
151+
(" of " . font-lock-doc-face)
142152
("int" font-lock-type-face font-lock-doc-face)
143153
(" and " . font-lock-doc-face)
144154
("string" font-lock-type-face font-lock-doc-face)

0 commit comments

Comments
 (0)