|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2015-01-03 16:17 UTC] kassner@php.net
[2017-05-24 15:44 UTC] nikic@php.net
-Status: Open
+Status: Closed
-Type: Bug
+Type: Feature/Change Request
-Assigned To:
+Assigned To: nikic
[2017-05-24 15:44 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 13:00:01 2025 UTC |
Description: ------------ It is impossible to override an abstract method with another abstract method. This is useful if you are trying to indicate (to both IDE and other developers) that the overriden method returns type is expected to be a subclass of the inherited method return type. PS. Java allows it and it is generally a more restrictive language than PHP. Test script: --------------- abstract class RuntimeExceptionReporter extends ExceptionReporter { /** * @return RuntimeException */ public abstract function getExceptionToReport(); // ... some operations specific to RuntimeException } abstract class ExceptionReporter { /** * @return Exception */ public abstract function getExceptionToReport(); // ... some operations on an Exception } Expected result: ---------------- Correct inheritance Actual result: -------------- Fatal error: Can't inherit abstract function ExceptionReporter::getExceptionToReport() (previously declared abstract in RuntimeExceptionReporter) in xxx on line yyy