Skip to content

Commit

Permalink
Merge pull request #566 from emacs-php/fix/phpdoc-inheritdoc
Browse files Browse the repository at this point in the history
Support PHPDoc {@inheritdoc} tag
  • Loading branch information
zonuexe authored Aug 26, 2019
2 parents bfc5b7d + 01569d9 commit e28eada
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion php-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,7 @@ a completion list."
"return" "throws" "var"))

(defconst php-phpdoc-font-lock-doc-comments
`(("{@[-[:alpha:]]+\\s-\\([^}]*\\)}" ; "{@foo ...}" markup.
`(("{@[-[:alpha:]]+\\s-*\\([^}]*\\)}" ; "{@foo ...}" markup.
(0 'php-doc-annotation-tag prepend nil)
(1 'php-string prepend nil))
(,(rx (group "$") (group (in "A-Za-z_") (* (in "0-9A-Za-z_"))))
Expand Down
5 changes: 5 additions & 0 deletions tests/doc-comment/inheritdoc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

/**
* {@inheritdoc}
*/
7 changes: 7 additions & 0 deletions tests/doc-comment/inheritdoc.php.faces
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
;; -*- mode: emacs-lisp -*-
(("<?php" . php-php-tag)
("\n\n")
("/**\n * " . font-lock-doc-face)
("{@inheritdoc}" php-doc-annotation-tag font-lock-doc-face)
("\n */" . font-lock-doc-face)
("\n"))
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion tests/php-mode-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,8 @@ Meant for `php-mode-test-issue-503'."
:faces (cond ((eq emacs-major-version 24) ".24.faces")
((version<= "27" emacs-version) ".27.faces")
(t t))))
(with-php-mode-test ("doc-comment-return-type.php" :faces t))
(with-php-mode-test ("doc-comment/return-type.php" :faces t))
(with-php-mode-test ("doc-comment/inheritdoc.php" :faces t))
(with-php-mode-test ("lang/types/cast.php" :faces t))
(with-php-mode-test ("lang/types/function.php" :faces t))
(with-php-mode-test ("lang/types/keywords.php" :faces t))
Expand Down

0 comments on commit e28eada

Please sign in to comment.