1--TEST-- 2Ensure private methods with the same name are not checked for inheritance rules - final 3--FILE-- 4<?php 5class A { 6 function callYourPrivates() { 7 $this->normalPrivate(); 8 $this->finalPrivate(); 9 } 10 function notOverridden_callYourPrivates() { 11 $this->normalPrivate(); 12 $this->finalPrivate(); 13 } 14 private function normalPrivate() { 15 echo __METHOD__ . PHP_EOL; 16 } 17 final private function finalPrivate() { 18 echo __METHOD__ . PHP_EOL; 19 } 20} 21class B extends A { 22 function callYourPrivates() { 23 $this->normalPrivate(); 24 $this->finalPrivate(); 25 } 26 private function normalPrivate() { 27 echo __METHOD__ . PHP_EOL; 28 } 29 final private function finalPrivate() { 30 echo __METHOD__ . PHP_EOL; 31 } 32} 33$a = new A(); 34$a->callYourPrivates(); 35$a->notOverridden_callYourPrivates(); 36$b = new B(); 37$b->callYourPrivates(); 38$b->notOverridden_callYourPrivates(); 39?> 40--EXPECTF-- 41Warning: Private methods cannot be final as they are never overridden by other classes %s 42 43Warning: Private methods cannot be final as they are never overridden by other classes %s 44A::normalPrivate 45A::finalPrivate 46A::normalPrivate 47A::finalPrivate 48B::normalPrivate 49B::finalPrivate 50A::normalPrivate 51A::finalPrivate 52