zeb's avatar

Zebulan

zeb

Member since

65

Total Reputation

2

Total Arguments

3

Total Votes for Arguments

Arguments and votes

1

This feels a lot nicer than the __get/__set weirdness I currently have to deal with. The ability to define properties as part of an interface contract is something that would have been nice to have in some projects I've previously worked on.

This proposal reduces boilerplate, simplifies developer API contracts, reduces the need for refactors when revising existing code, and aids static analysis tools. The benefits definitely outweigh the cost of the additional syntax to learn and the oddities of said syntax (namely $field), if you ask me.

I had some issues with the syntax in earlier versions of the RFC (namely the number and implementation of shorthand syntax), but most of those have since been addressed, and the only notable one left ($field) is acceptable given the lack of better alternatives.

Share:
Read the RFC: Property Hooks zeb avatar
zeb
voted yes
4

JavaScript has this, and I've never found the lack of parentheses confusing there. If anything, I think the currently-required wrapper parentheses in PHP add cognitive load when parsing out a statement.

Share:
Read the RFC: new MyClass()->method() without parentheses zeb avatar
zeb
voted yes
12

Every time I find myself typing new MyClass() and than returning back and adding those parentheses. It would be good to reduce this friction and make PHP coding flow smoother.

Share:
Read the RFC: new MyClass()->method() without parentheses pronskiy avatar
pronskiy
voted yes
RSS Feed Contribute Watch on YouTube Our License
© 2024 RFC Vote. This project is open source. Contribute and collaborate with us!