|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2017-05-19 15:00 UTC] levim@php.net
[2017-06-02 22:26 UTC] nikic@php.net
[2017-06-02 22:26 UTC] nikic@php.net
-Status: Open
+Status: Closed
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 02:00:01 2025 UTC |
Description: ------------ When inheriting from an abstract class, a method implemented by a trait does not allow adding a return type. This is allowed when the method is implemented directly in the child class. On the current master (7.2) the same happens when omitting a type-hint. With interfaces the behavior is consistent with or without traits. Test script: --------------- <?php abstract class L1{ abstract function m3($x); } trait L2t{ function m3($x): int{} } class L2 extends L1{ use L2t; } Expected result: ---------------- N/A Actual result: -------------- Fatal error: Declaration of L2t::m3($x): int must be compatible with L1::m3($x) in ...