adding parameters to overridden method E_STRICT observation

前端 未结 2 981
独厮守ぢ
独厮守ぢ 2021-01-17 23:52

It appears (PHP 5.3) that if you are overriding a class method, it is okay to you can add additional parameters, as long as they have default values.

For

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-18 00:18

    This is not a bug and is acceptable PHP programming practise.

    Please note that multiple overrides can cause programmer headaches though and should be avoided where possible.

    Alternatively I usually either have a single extended class to override per class or just overload a class method within the actual class itself.

提交回复
热议问题