Skip to content

Specify anonymous class attributes - #136

Merged
Crell merged 2 commits into
php-fig:masterfrom
KorvinSzanto:feature/anonymous-class-attributes
Feb 11, 2026
Merged

Crell merged 2 commits into
php-fig:masterfrom
KorvinSzanto:feature/anonymous-class-attributes

Conversation

@KorvinSzanto

Copy link
Copy Markdown
Contributor

See #135

This PR adds to the anonymous class section information about how to handle attributes on anonymous classes.

@Crell

Crell commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

Oh geez. Attributes on anon classes are wild. :-) Putting the attribute between the new and class feels gross, but it's a parse error otherwise, so, eh.

I'm OK with this. Tagging @jrfnl for confirmation we're not creating any new problems.

@jrfnl jrfnl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Crell Thanks for the ping. The wording seems clear, though I left one small suggestion.

Comment thread spec.md Outdated
Co-authored-by: Juliette <663378+jrfnl@users.noreply.github.com>
@KorvinSzanto

KorvinSzanto commented Feb 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Oh geez. Attributes on anon classes are wild. :-) Putting the attribute between the new and class feels gross, but it's a parse error otherwise, so, eh.

Yeah I figure there really isn't an optimal place to put it other than maybe before the $example = , but that could be big trouble if PHP ever adds variable level attributes.

@Crell

Crell commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator

It's also a syntax error at present. I tried. 😄

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.

4 participants