Silberengel @Silberengel - 2mo
Getters and setters, or nah? https://media.tenor.com/Pt-gRP6TeMoAAAAC/yes-im-old-school-cass-dekennessy.gif #devs
The code I'm finding online never seem to use them. Have they gone out of style?
The Fishcake🐶🐾 @The Fishcake🐶🐾 - 2mo
It depends if you need to perform validation and transformation. Also if you variables are private or not
The thing is... I might, later, and I don't want to have to decide now, so my internal refactoring-hater is like, just make all class properties private and get/set everything and then it's the same everywhere and you can put the decision off. 😅
I think I picked up the habit from working with Doctrine and Symfony. I think they they're strict about that.
Just found this, in an article: "Non private attributes does not only allow to change the state from outside, there is also the possibility to update attribute values from classes that inherit."
You mean, as you can access over the __construct() ?
Hmm. I don't think PHP does that.