Skip to content
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

Update best practices doc to mention Constructor Property Promotion #865

Open
francislavoie opened this issue Oct 18, 2023 · 1 comment
Open

Comments

@francislavoie
Copy link

I think now that v7 requires PHP 8.0+, the https://github.com/PHP-DI/PHP-DI/blob/master/doc/best-practices.md doc should be updated to cover recommending Constructor Property Promotion.

For example, it mentions "This is painful when you have more than 5 dependencies, and your constructor is 15 lines of boilerplate code". This is no longer true using CPP because it keeps it only 5 lines long.

Also, the services example can be simplified by using CPP for its constructor.

@mnapoli
Copy link
Member

mnapoli commented Oct 18, 2023

That's a very good point!

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

No branches or pull requests

2 participants