Hi internals,

I want to put up for discussion an RFC (
https://wiki.php.net/rfc/inheritance_private_methods) that proposes to
remove some inappropriate signature checks that are still done on private
methods. Namely, those checks are:

- When a method has the same name as a parent's final private method
- When a method has the same name as a parent's static private method and
the child's method is non-static, or vice-versa
- When a method has the same name as a parent's concrete private method and
the child's method is abstract

I have 2 open issues on the RFC that I would like to hear some opinions on.
- Whether or not to issue a compiler warning whenever "final private
function" is used, to alert the user that it will not achieve what that
construct is currently used for. The disadvantage of introducing it is the
BC break.
- Whether or not to make an exception to this rule for magic methods. Given
that this is widely to restrict object instantiation and cloning, it could
make sense to still allow the use on those cases. However, I think that the
similar effect that can be achieved with "final protected function" would
cover most of the cases. And if we open up that exception for magic
methods, for the sake of clarity maybe we should just keep the "final
private" behavior on all methods and just change the static and the
abstract behaviors. Some discussion on this subject can be found on the PR (
https://github.com/php/php-src/pull/5401) for this RFC.

Regards,
Pedro Magalhães

Reply via email to