Previously in PHP we would have to define properties, then constructor params, and then assign the params to the properties...so that's 3 different places you'd have to write code 😭
Promoted properties streamline the way in which you can set property values in the constructor so that those three code locations are reduced to one 🦾
You will need PHP8 + in order to use them.
Branch: https://github.com/GaryClarke/learn-oophp/tree/6-promoted-properties
2 comments