Is it good to have logic inside __constructor?
__constructor
public class someClass { public function __construct() { //some logic here }
Until now, I thought that everything was in order; however, this reddit comment points to the opposite.
As @Barry wrote , one of the reasons is unit testing, but this is just a side effect.
: "", (, , ). ... ? , - , , , . . .
: , , . .
" " - . , , -- (, ). , , .
, / . (, , PoLA. , , , , . , .
: " ". (, eval() ), .
eval()
, . "" , , . , , , .
, (google tech talk by Misko Hevery) https://www.youtube.com/watch?v=RlfLCWKxHJ0
, , , __construct - , , ? , . Symfony Response - , , . - - ( )...
, , - ...
SOLID ...