|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-05-17 10:43 UTC] cmb@php.net
-Status: Open
+Status: Not a bug
-Assigned To:
+Assigned To: cmb
[2021-05-17 10:43 UTC] cmb@php.net
[2021-05-17 12:58 UTC] sh-ya at ya dot ru
[2021-05-17 13:13 UTC] cmb@php.net
-Status: Not a bug
+Status: Open
-Type: Documentation Problem
+Type: Bug
-Package: Documentation problem
+Package: Scripting Engine problem
-Assigned To: cmb
+Assigned To:
[2021-05-17 13:13 UTC] cmb@php.net
[2021-05-17 13:54 UTC] nikic@php.net
-Type: Bug
+Type: Documentation Problem
[2021-05-17 13:54 UTC] nikic@php.net
[2021-05-27 08:29 UTC] nikic@php.net
-Summary: the variance and traits
+Summary: Early binding limitations insufficiently documented
[2022-11-30 05:16 UTC] austinpatrick711 at gmail dot com
[2022-12-22 06:15 UTC] bay23erruff at gmail dot com
[2022-12-26 11:17 UTC] Megan885Mershon at gmail dot com
[2024-04-23 18:53 UTC] lawleitl22 at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 21:00:01 2025 UTC |
Description: ------------ using the variance requires pre-definition of classes that use traits Test script: --------------- interface Animal { public function eat(AnimalFood $food); } class Dog implements Animal { public function eat(Food $food) {} } trait SomeTrait { public $b = true; } class Food { use SomeTrait; public $i = 0; } class AnimalFood extends Food {} var_dump(new AnimalFood); Expected result: ---------------- object(AnimalFood)#1 (2) { ["i"]=> int(0) ["b"]=> bool(true) } Actual result: -------------- Fatal error: Could not check compatibility between Dog::eat(Food $food) and Animal::eat(AnimalFood $food), because class AnimalFood is not available in ...