Do you think guys that configurable classes should use public properties? Why it’s bad? For me it’s not safe casting we can push to set (string) (int) whatever of course we configure this class but sometimes you can forget which type it’s use.Additionaly it’s bad OOP design. What do you think?
If you care of the proper types pushed into the class variables then using public isnt’t a good choice. In general you should use setters for that and operate on private/proteced properties. It will allow you to check, filter, etc. the data coming as the value.
Hope it helps
Yes, i know but if we will go to the core yii2 there is a a lotof public without setter / getters. It’s making me frustrate beacuse it damage to encapsulation OOP paradigm
You know, the Guide says the following in "What is Yii"(https://www.yiiframework.com/doc/guide/2.0/en/intro-yii):
Writing setter and getter for each and every public properties won’t help you much in real world development, I think.
On configuration yes it’s true but with transfer data it’s huge problem.