Skip to content

Add enum and readonly class modifier to imenu #802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 8 additions & 2 deletions lisp/php.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading