Private methods cannot be final as they are never overridden by other classes¶
Description¶
Final methods are only available in the class where they are defined. If such a method is defined in one of the child class, it is considered a distinct method. As such, the final keyword doesn’t apply, and even is misleading.
Example¶
<?php
class X {
private final function foo() {}
}
?>
Solutions¶
Remove the final keyword in the method definition.
Change the visibility to protected to public.