branch: elpa/php-mode
commit df830a1894ad9e17f4cd9803c0353942179bfdcb
Merge: 5b6cc1c068 4a42c293d7
Author: USAMI Kenta <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #802 from emacs-php/feature/support-readonly-and-enum
Add enum and readonly class modifier to imenu
---
CHANGELOG.md | 10 +++++++++-
lisp/php.el | 10 ++++++++--
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1aa2e9cc6e..feb711f9ed 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,15 @@
All notable changes of the PHP Mode 1.19.1 release series are documented in
this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
-<!-- ## Unreleased -->
+## Unreleased
+
+### Changed
+
+ * Add `readonly` class modifier to [Imenu] ([#802])
+ * Add `enum` support to `php-current-class` ([#802])
+
+[Imenu]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Imenu.html
+[#802]: https://github.com/emacs-php/php-mode/pull/802
## [1.27.0] - 2024-12-20
diff --git a/lisp/php.el b/lisp/php.el
index 2e05d2a5f9..6a2f40f8f3 100644
--- a/lisp/php.el
+++ b/lisp/php.el
@@ -325,12 +325,18 @@ can be used to match against definitions for that
classlike."
;; First see if 'abstract' or 'final' appear, although really these
;; are not valid for all values of `type' that the function
;; accepts.
- "^\\s-*\\(?:\\(?:abstract\\|final\\)\\s-+\\)?"
+ (eval-when-compile
+ (rx line-start
+ (* (syntax whitespace))
+ (? (or "abstract" "final" "readonly")
+ (+ (syntax whitespace)))))
;; The classlike type
type
;; Its name, which is the first captured group in the regexp. We
;; allow backslashes in the name to handle namespaces, but again
;; this is not necessarily correct for all values of `type'.
+ ;; (rx (+ (syntax whitespace))
+ ;; (group (+ (or (syntax word) "\\" (syntax symbol)))))
"\\s-+\\(\\(?:\\sw\\|\\\\\\|\\s_\\)+\\)")))
(defconst php-imenu-generic-expression-default
@@ -465,7 +471,7 @@ can be used to match against definitions for that
classlike."
(defconst php--re-classlike-pattern
(eval-when-compile
- (php-create-regexp-for-classlike (regexp-opt '("class" "interface"
"trait")))))
+ (php-create-regexp-for-classlike (regexp-opt '("class" "interface" "trait"
"enum")))))
(defvar php--analysis-syntax-table
(eval-when-compile