Skip to content

[HttpKernel] Add #[AsController] attribute for declaring standalone controllers on PHP 8 #40555

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 1 commit into from
Mar 23, 2021

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Mar 23, 2021

Q A
Branch? 5.x
Bug fix? no
New feature? yes
Deprecations? no
Tickets -
License MIT
Doc PR -

This PR adds an #[AsController] attribute to allow autoconfiguring controllers even when they don't extend AbstractController. This should allow removing the line about controller.service_arguments in services.yaml to cover this need (but that is noise to most.)

@nicolas-grekas nicolas-grekas added this to the 5.x milestone Mar 23, 2021
@nicolas-grekas nicolas-grekas requested a review from chalasr as a code owner March 23, 2021 17:29
@nicolas-grekas nicolas-grekas changed the title [HttpKernel] Add #[AsController] attribute for declaring listeners on PHP 8 [HttpKernel] Add #[AsController] attribute for declaring controllers on PHP 8 Mar 23, 2021
@nicolas-grekas nicolas-grekas changed the title [HttpKernel] Add #[AsController] attribute for declaring controllers on PHP 8 [HttpKernel] Add #[AsController] attribute for declaring standalone controllers on PHP 8 Mar 23, 2021
@stof
Copy link
Member

stof commented Mar 23, 2021

I think the renaming of other attributes at least deserves being in its own commit rather than being bundled in a commit saying Add AsController attribute in the git history.

Copy link
Member

@yceruto yceruto left a comment

Choose a reason for hiding this comment

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

I really like the As prefix for all attributes, it offers us consistency and as you said better IDE autocompletion.

@stof
Copy link
Member

stof commented Mar 23, 2021

@yceruto for all autoconfiguration attributes, I agree. I would not describe that as for all attributes. The routing and validator usages don't make sense if prefixed with As

@nicolas-grekas
Copy link
Member Author

@stof works for me, see #40556

Copy link
Member

@weaverryan weaverryan left a comment

Choose a reason for hiding this comment

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

I like the As prefix also 👍

@yceruto
Copy link
Member

yceruto commented Mar 23, 2021

for all autoconfiguration attributes

@stof my bad, but that's what I meant 😄 !

@chalasr
Copy link
Member

chalasr commented Mar 23, 2021

Thank you @nicolas-grekas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants