FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Feature(8.4): property hooks by jorgsowa · Pull Request #1204 · glayzzle/php-parser · GitHub

Feature(8.4): property hooks - #1204

Merged
czosel merged 4 commits into
mainfrom
feature/property-hooks
Mar 22, 2026
Merged

Feature(8.4): property hooks#1204
czosel merged 4 commits into
mainfrom
feature/property-hooks

Conversation

jorgsowa commented Mar 16, 2026
edited
Loading

Copy link
Copy Markdown
Collaborator

Supersedes original feature implementation #1143

Additional improvements:

  • hooks defaults to []

Missing features implemented

  • Constructor property promotion with hooks - __construct(public string $name { set => strtolower($value); })
  • Attributes on hooks #[SomeAttr] get => ... and set(#[SensitiveParameter] int $value)

Bug fixes:

  • Semicolon early return - abstract/interface hooks (get;, set;) now return immediately instead of falling through and potentially parsing the next hook's name as a body expression
  • EOF guard - read_property_hooks loop checks for EOF to prevent infinite loops on malformed input
  • Error message — fixed "Typed Class Constants requires PHP 8.4+" → "Property hooks require PHP 8.4+"
  • minor typos

Fixes: #1142

jorgsowa and others added 2 commits March 16, 2026 23:44
Implements parsing for PHP 8.4 property hooks (get/set) including
short arrow expressions, block bodies, by-ref, final, abstract,
setter parameters, and interface support.

Co-Authored-By: Thomas Genin <xt6.thomas.genin@gmail.com>
jorgsowa force-pushed the feature/property-hooks branch from 7e2b4d3 to f9f79bc Compare March 16, 2026 23:26
jorgsowa marked this pull request as ready for review March 16, 2026 23:35

Copy link
Copy Markdown
Collaborator

/cc @czosel please take a look

czosel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM, awesome work!

czosel merged commit 9c71643 into main Mar 22, 2026
6 checks passed

czosel commented Mar 22, 2026

Copy link
Copy Markdown
Collaborator

Released in v3.5.0 🎉

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8.4: property hooks

3 participants


Back | FazBrowse Home | New Git URL