например, фатальная ошибка возникает только в конструкторе в классе testCLSFatal():
Код: Выделить всё
class testCLS
{
public bool $isVar;
public function __construct()
{
$this->isVar = self::func1() || self::func2( );
}
static function func1( )
{
return 0;
}
static function func2()
{
return ['some_val'];
}
}
class testCLSFatal
{
public bool $isVar;
public function __construct()
{
$this->isVar = self::func2( );
}
static function func2()
{
return ['some_val' ];
}
}
$obj = new testCLS();
var_dump($obj->isVar);
$obj2 = new testCLSFatal();
var_dump($obj2->isVar);
Подробнее здесь: https://stackoverflow.com/questions/791 ... e-checking