|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2017-01-24 14:29 UTC] requinix@php.net
 
-Status: Open
+Status: Duplicate
  [2017-01-24 14:29 UTC] requinix@php.net
 | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 22:00:01 2025 UTC | 
Description: ------------ Return type of the child must match the parent: This code leads to "Fatal error: Declaration of B::test(): string must be compatible with A::test(): int" <?php class A { function test(): int {} } class B extends A { function test(): string {} } ?> But it's okay, if I add interface: <?php interface I { function test(); } class A implements I { function test(): int {} } class B extends A { function test(): string {} } ?> Expected result: ---------------- Fatal error: Declaration of B::test(): string must be compatible with A::test(): int Actual result: -------------- no error