Skip to content

[DependencyInjection] Use constructor property promotion (CPP) #18049

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 15, 2023

Conversation

OskarStark
Copy link
Contributor

No description provided.

@OskarStark OskarStark self-assigned this Mar 11, 2023
@carsonbot carsonbot changed the title Use CPP [DependencyInjection] Use CPP Mar 11, 2023
@OskarStark OskarStark requested a review from xabbuh as a code owner March 12, 2023 06:54
@OskarStark OskarStark changed the title [DependencyInjection] Use CPP Use constructor property promotion (CPP) Mar 13, 2023
@carsonbot carsonbot changed the title Use constructor property promotion (CPP) [DependencyInjection] Use constructor property promotion (CPP) Mar 13, 2023
Copy link
Member

@javiereguiluz javiereguiluz 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 CPP a lot ... the only thing I dislike is that I put the arguments in one line when the constructor only has one argument. But I guess this is just a matter of personal taste, so let's merge this!

Thanks Oskar.

@alexislefebvre
Copy link
Contributor

alexislefebvre commented Mar 15, 2023

Since Symfony 6.2 requires PHP 8.1+, the readonly keyword is available. Is there a reason not to use it in these examples?

Example:

- private MailerInterface $mailer,
+ private readonly MailerInterface $mailer,

@OskarStark
Copy link
Contributor Author

Can you please open a separate issue about this topic? Thanks

@OskarStark OskarStark merged commit 706fb1a into symfony:6.2 Mar 15, 2023
@OskarStark
Copy link
Contributor Author

I merged and upmerged this PR

@OskarStark OskarStark deleted the feature/use-cpp branch March 15, 2023 15:57
@javiereguiluz
Copy link
Member

Thanks for merging and solving all conflicts 🙏

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.

5 participants