Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace test;
- abstract class A
- {
- //public function foo()
- protected function foo()
- {
- echo 'AA';
- }
- }
- class B extends A
- {
- public function foo()
- {
- echo 'BB';
- }
- }
- function bar(A $x)
- {
- $x->foo();
- }
- $b = new B;
- bar($b);// BB expected, but if "foo" access modifier change to protected in parent class then
- // PhpStorm suppose an error(underlined with a red wavy line),
- // but, naturally, runtime error will not occurred
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement