|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-04-06 13:56 UTC] dmitry@php.net
-Status: Open
+Status: Assigned
-Assigned To:
+Assigned To: dmitry
[2016-04-06 14:20 UTC] dmitry@php.net
[2016-04-06 14:20 UTC] dmitry@php.net
-Status: Assigned
+Status: Closed
[2016-07-20 11:32 UTC] davey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 23:00:02 2025 UTC |
Description: ------------ Children classes may override methods with different argument types. This leads to Warning. However if the same methods in addition have the same return type PHP emits "Fatal Error" instead of "Warning" Test script: --------------- <?php class A { function foo(int $a) {} } class B extends A { function foo(string $a) {} } class A1 { function foo(int $a): int {} } class B1 extends A1 { function foo(string $a): int {} } ?> Expected result: ---------------- Warning: Declaration of B::foo(string $a) should be compatible with A::foo(int $a) in %s on line %d Warning: Declaration of B1::foo(string $a): int should be compatible with A1::foo(int $a): int in %s on line %d Actual result: -------------- Warning: Declaration of B::foo(string $a) should be compatible with A::foo(int $a) in %s on line %d Fatal Error: Declaration of B1::foo(string $a): int must be compatible with A1::foo(int $a): int in %s on line %d