|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-07-28 16:26 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 07:00:01 2025 UTC |
Description: ------------ In my example type hinting in method foo() in child class is incompatible with same method in parent class. But it still working with E_STRICT. Reproduce code: --------------- error_reporting(E_ALL | E_STRICT); class A {} abstract class B { protected $bar; public function foo($bar) { $this->bar = $bar; echo "some\n"; return $this; } } class C extends B { public function foo(A $bar) { $this->bar = $bar; echo "not expected\n"; return $this; } } $c = new C; $c->foo(new A); Expected result: ---------------- Fatal error: Declaration of C::foo() must be compatible with that of B::foo() Actual result: -------------- not expected