On 08.08.2013 10:34, Leigh wrote:
> I'm not sure what problem this is really trying to solve, the boilerplate
> code you mention is very explicit and it is very clear to the reader what
> is being done. Each property documented with its type, purpose and
> visibility in a common place for easy reference (at the top of the class).
> Each property that takes a value from the constructor assigned in the
> constructor. Very clear.

I for one am pretty tired of writing this boilerplate in every second
class I write. Using dependency injection you end up having to write a
LOT of those usually, and constructors typically only contain assignments.

Adding a property means: declaring the property, adding the ctor arg,
adding the assignment in the ctor. You have to write the property name 4
times. With this RFC in it'd come down to writing it once, and would
avoid having undeclared properties because someone forgot.

I am very supportive the idea, although I see that it could be confusing
to some. Maybe the syntax needs to change, but the overall change is
much welcome.

Cheers

-- 
Jordi Boggiano
@seldaek - http://nelm.io/jordi

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to