不从被覆盖的方法中调用父方法是不是一个坏兆头?

Is it a bad sign not to call the parent's method from the overridden method?

class A
{
    public function getName()
    {
        return 'First class';
    }
}

class B extends A
{
    public function getName()
    {
        return 'Second class';
    }
}

Phpstorm 然后警告我并强调 B::getName() 我错过了调用它的父级:parent::getName(); 我故意不调用它。但这让我得出结论,这是不好的迹象。

检查位于可能存在的错误 检查组中 - 这意味着这不是错误,也不是 IDE 确定的错误。默认情况下,检查本身是禁用的,您可能已自行启用它。本次检查的思路描述为here

Generally, when you override a method (especially a constructor), you want to call the parent method in it. An info inspection for lack of parent:: call could be handy