Req #71271 [Opn->Wfx]: Allow final abstract class {}
| From: | requinix@php.net | Date: | Mon, 04 Jan 2016 05:31:19 +0000 |
| Subject: | Req #71271 [Opn->Wfx]: Allow final abstract class {} | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-198390@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71271&edit=1
ID: 71271
Updated by: requinix@php.net
Reported by: andreas at dqxtech dot net
Summary: Allow final abstract class {}
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: Class/Object related
PHP Version: 7.0.2RC1
Block user comment: N
Private report: N
New Comment:
The idea was considered and declined. https://wiki.php.net/rfc/abstract_final_class
Previous Comments:
------------------------------------------------------------------------
[2016-01-04 05:21:15] andreas at dqxtech dot net
Description:
------------
It should be allowed to make a class both final and abstract, to make it a place for static methods.
There is no good reason to not allow this.
It is already possible to achieve the same or a similar effect with final + a private constructor.
But this is unnecessarily verbose.
Test script:
---------------
<?php
abstract final class C {
static function foo() {}
}
Expected result:
----------------
should work just fine.
Actual result:
--------------
Fatal error: Cannot use the final modifier on an abstract class
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71271&edit=1