diff --git a/CHANGELOG.md b/CHANGELOG.md index cd522ba1..1cccfd13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,13 +8,20 @@ All notable changes of the PHP Mode 1.19.1 release series are documented in this * **New feature: `php-complete`** * Add `php-complete-complete-function` to autocomplete function names ([#708]) - * Supports PHPDoc tags and types for static analysis tools ([#710]) + * Supports PHPDoc tags and types for static analysis tools ([#710], [#715], [#716], [#717], thanks to [@takeokunn]) + * Please refer to the article below + * PHPStan: [PHPDoc Types](https://phpstan.org/writing-php-code/phpdoc-types) + * PHPStan: [PHPDocs Basics](https://phpstan.org/writing-php-code/phpdocs-basics) + * Psalm: [Atomic Type Reference](https://psalm.dev/docs/annotating_code/type_syntax/atomic_types/) + * Psalm: [Supported Annotations](https://psalm.dev/docs/annotating_code/supported_annotations/) + * Psalm: [Template Annotations](https://psalm.dev/docs/annotating_code/templated_annotations/) ### Changed * Make continued expressions inside lists (arguments and arrays, etc.) have the same indent width as outside the list ([#703]) * (internal) Improved readability of test failures about indentation ([#707]) * `php-doc-annotation-tag` inherits `font-lock-doc-markup-face` if defined in Emacs 28 ([#711]) + * Change `php-phpdoc-type-keywords` to `php-phpdoc-type-names` to avoid confusion ([#717]) ### Fixed @@ -26,6 +33,9 @@ All notable changes of the PHP Mode 1.19.1 release series are documented in this [#708]: https://github.com/emacs-php/php-mode/pull/708 [#710]: https://github.com/emacs-php/php-mode/pull/710 [#711]: https://github.com/emacs-php/php-mode/pull/711 +[#715]: https://github.com/emacs-php/php-mode/pull/715 +[#716]: https://github.com/emacs-php/php-mode/pull/716 +[#717]: https://github.com/emacs-php/php-mode/pull/717 ## [1.24.1] - 2022-10-08 diff --git a/lisp/php-mode.el b/lisp/php-mode.el index 37f2ba60..5e5b66e7 100644 --- a/lisp/php-mode.el +++ b/lisp/php-mode.el @@ -1275,7 +1275,7 @@ for \\[find-tag] (which see)." (message "Unknown function: %s" tagname)))) ;; Font Lock -(defconst php-phpdoc-type-keywords +(defconst php-phpdoc-type-names (list "string" "integer" "int" "boolean" "bool" "float" "double" "object" "mixed" "array" "resource" "void" "null" "false" "true" "self" "static" @@ -1287,11 +1287,18 @@ for \\[find-tag] (which see)." "never" "never-return" "never-returns" "no-return" "non-empty-array" "non-empty-list" "non-empty-string" "non-falsy-string" "numeric" "numeric-string" "positive-int" "scalar" - "trait-string" "truthy-string" "key-of" "value-of")) + "trait-string" "truthy-string" "key-of" "value-of") + "A list of type and pseudotype names that can be used in PHPDoc.") + +(make-obsolete-variable 'php-phpdoc-type-keywords 'php-phpdoc-type-names "1.24.2") (defconst php-phpdoc-type-tags (list "package" "param" "property" "property-read" "property-write" - "return" "throws" "var" "self-out" "this-out" "param-out")) + "return" "throws" "var" "self-out" "this-out" "param-out" + "type" "extends" "require-extends" "implemtents" "require-implements" + "template" "template-covariant" "template-extends" "template-implements" + "assert" "assert-if-true" "assert-if-false" "if-this-is") + "A list of tags specifying type names.") (defconst php-phpdoc-font-lock-doc-comments `(("{@[-[:alpha:]]+\\s-*\\([^}]*\\)}" ; "{@foo ...}" markup. @@ -1301,11 +1308,11 @@ for \\[find-tag] (which see)." (1 'php-doc-variable-sigil prepend nil) (2 'php-variable-name prepend nil)) ("\\(\\$\\)\\(this\\)\\>" (1 'php-doc-$this-sigil prepend nil) (2 'php-doc-$this prepend nil)) - (,(concat "\\s-@" (rx (? (or "phpstan" "psalm") "-")) (regexp-opt php-phpdoc-type-tags) "\\s-+" + (,(concat "\\s-@" (rx (? (or "phan" "phpstan" "psalm") "-")) (regexp-opt php-phpdoc-type-tags) "\\s-+" "\\(" (rx (+ (? "?") (? "\\") (+ (in "0-9A-Z_a-z")) (? "[]") (? "|"))) "\\)+") 1 'php-string prepend nil) (,(concat "\\(?:|\\|\\?\\|\\s-\\)\\(" - (regexp-opt php-phpdoc-type-keywords 'words) + (regexp-opt php-phpdoc-type-names 'words) "\\)") 1 font-lock-type-face prepend nil) ("https?://[^\n\t ]+"