Bug #72993 [Opn->Nab]: abstract class with abstract static methods: valid or not?

From: Date: Thu, 01 Sep 2016 22:27:12 +0000
Subject: Bug #72993 [Opn->Nab]: abstract class with abstract static methods: valid or not?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203737@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72993&edit=1 ID: 72993 Updated by: requinix@php.net Reported by: mlocati at gmail dot com Summary: abstract class with abstract static methods: valid or not? -Status: Open +Status: Not a bug Type: Bug Package: Class/Object related PHP Version: 7.0.10 Block user comment: N Private report: N New Comment: https://wiki.php.net/rfc/reclassify_e_strict#abstract_static_methods Abstract static methods are now deliberately supported in classes for consistency with allowing static methods in interfaces. Previous Comments: ------------------------------------------------------------------------ [2016-09-01 13:24:55] mlocati at gmail dot com Renamed subject from abstract class with static methods: valid or not? to abstract class with abstract static methods: valid or not? ------------------------------------------------------------------------ [2016-09-01 13:17:45] mlocati at gmail dot com Description: ------------ Consider this code: abstract class AbstractClass { abstract public static function Method(); } class ReadClass extends AbstractClass { public static function Method() { } } is this valid? See for instance https://3v4l.org/nSsLg - from PHP 5.0 to PHP 5.1: it was valid - from PHP 5.2 to PHP 5.6: we have this warning: Strict Standards: Static function AbstractClass::Method() should not be abstract - from PHP 7.0: it is again valid So... is this a wanted change? Or is it a bug in the 7.x series? PS: I'm not saying that it shouldn't be valid (indeed I'd prefer it's a legal approach) Related bugs: - https://bugs.php.net/bug.php?id=65809 There we just say that "The strict standards notice no longer exists in PHP 7", but does not say anything about the validity of abstract static methods in abstract classes - https://bugs.php.net/bug.php?id=66688 There the reporter suggests to remove static methods from abstract classes (why PHP should force this? It's a philosophy approach, subject to developers mind, and the language shouldn't force developers to not do something - people who think it's wrong can simply avoid that approach) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72993&edit=1

« previous php.bugs (#203737) next »