|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-06-28 13:32 UTC] derick@php.net
-Status: Open
+Status: Not a bug
[2020-06-28 13:32 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 20:00:01 2025 UTC |
Description: ------------ Since mixed type indicates the absence of a type then one would assume that omitting a return type in a child class's method that returns mixed type in a parent class is fine! but PHP refuses to compile Test script: --------------- class Foo { function fun(): mixed { return 33; } } class Bar extends Foo { function fun() { return 33; } } Expected result: ---------------- The expected is to compile with no error Actual result: -------------- Fatal error: Declaration of Bar::fun() must be compatible with Foo::fun(): mixed