Doc #66688 [Opn->Sus]: Direct invokation of a static method inside an abstract class

From: Date: Sun, 08 Apr 2018 17:45:33 +0000
Subject: Doc #66688 [Opn->Sus]: Direct invokation of a static method inside an abstract class
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15594@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66688&edit=1 ID: 66688 Updated by: cmb@php.net Reported by: nikola at petkanski dot com Summary: Direct invokation of a static method inside an abstract class -Status: Open +Status: Suspended Type: Documentation Problem Package: Class/Object related PHP Version: 5.4.25 Block user comment: N Private report: N New Comment: This appears to be rather a feature request than a doc bug. However, changing this behavior[1] would require the RFC process[2] due to huge BC break. Please go ahead and start it! For the time being I'm suspending this ticket. [1] <https://3v4l.org/QSTTv> [2] <https://wiki.php.net/rfc/howto> Previous Comments: ------------------------------------------------------------------------ [2014-02-10 18:51:41] nikola at petkanski dot com Description: ------------ --- From manual page: http://www.php.net/language.oop5.abstract --- Invoking static method of abstract class should be removed. What interfaces are? - A mean to ensure all implementation have the same methods implemented. What is an abstract class? - It is a interface that can also include some concrete methods. Is it right for the developer to be able to invoke a static method of an interface? - I think not. The GoF teach us to rely on abstract classes and interfaces to hide differences between subclasses from clients. - Interface defines an object’s use (protocol) - Implementation defines particular policy I don't think one should be able to call some abstract logic that is defined inside an abstract class, without even inheriting the class itself. This post from the mailing list seem relevant: - http://marc.info/?l=php-internals&m=114120699223033&w=2 Perhaps there are some reasons behind this behavior. However, the language evolves and I think it is time for this one to go. Test script: --------------- http://pastebin.com/a5bG6hww Expected result: ---------------- It should display an error that one cannot invoke abstract class methods. Actual result: -------------- It just works, while it should not. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66688&edit=1

« previous php.doc.bugs (#15594) next »