You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2f23ec6
Browse filesBrowse the repository at this point in the historyBrowse files
feat: print PHP 8.4 property hooks and property modifiers
php-parser 3.7 parses property hooks into `property.hooks` (kind
`propertyhook`), but the printer never printed them, so formatting a
hooked property silently dropped the hooks and left a plain property
behind (exit code 0). A comment inside a hook made it fail with
"Comment was not printed" instead.
Print hooks following PER-CS 4.9:
- the opening brace stays on the property line, one hook per line,
a single blank line between hooks is preserved;
- `get => expr;` breaks like an assignment, `get { ... }` keeps the
brace on the hook line, `get;` / `set;` declarations (interfaces,
abstract classes) stay on one line: `public string $x { get; set; }`;
- `final`, `&get`, `set(Type $value)` and attributes on hooks;
- hooks on promoted constructor parameters.
A hooked property statement ends with its closing brace, so it no
longer gets a trailing semicolon.
Property statements also lost `abstract`, `final` and the asymmetric
set visibility (`public private(set)`), which the parser exposes as
`isAbstract`, `isFinal` and `visibilitySet`; print those too.
Guard `handleFunctionParameter` against a missing preceding node,
which a comment right after `set(` reaches.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
0 commit comments