Re: Attributes and constructor property promotion
| From: | Markus Fischer | Date: | Wed, 07 Oct 2020 07:22:06 +0000 |
| Subject: | Re: Attributes and constructor property promotion | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112020@lists.php.net to get a copy of this message | ||
Hi!
On 06.10.20 17:15, Sara Golemon wrote:
My opinion on constructor property promotion (CPP) is that it's something for small value object classes and should probably be regarded as code-smell on larger classes. At the same time, annotations belong with more complex objects and not so much with small "struct-like" classes.Just wanted to chime in on this: I can foresee already the impact CPP will have on dependency injection: sometimes you just have complex business logic with lots of (auto-wired) dependencies and have to pull in n+1 classes into the constructor. Currently 5+ deps create 3*(5+) codelines for not much value. My point is that I see much more value _outside_ of "value object classes" with auto-wiring, reducing boilerplate _a lot_. That said: I err on the side of forbidding it, if we've no clear consensus how to do it! thanks, - Makrs