Re:PHP Annotations Are a Horrible Idea
by EugeneOZ on Wednesday October 17, 2012 @09:41AM
(#4664328)
"It's a static property because it applies to all object of the class, not an individual object"
Why? if you will have 3 databases, each will have same password?
"And how is making the property public a bad idea?"
Because it's breaks encapsulation.
Also, there is two kind of "class" usages in PHP: as Object and as Structure. If your class is just Structure (contain no methods at all), then, of course, public properties is what we need. But when your class is an Object, which should have instances, API, then keep all properties encapsulated.
And how is making the property public a bad idea? The configuration system that parses it will need to read the property, no? And a method like getUsername() should be reserved for actually getting the value of that field, not its config.