Edit report at https://bugs.php.net/bug.php?id=65809&edit=1

 ID:                 65809
 Comment by:         phpmpan at mpan dot pl
 Reported by:        spam at krol dot me
 Summary:            interface, abstract static function
 Status:             Open
 Type:               Bug
 Package:            Class/Object related
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Abstract static methods are allowed. Abstract static *constructors* aren't.


Previous Comments:
------------------------------------------------------------------------
[2013-10-02 10:58:34] spam at krol dot me

Description:
------------
abstract static function in class isn't allowed,
but you can define static function in interface

This leads to funny inconsistency where you can create abstract static function 
using interfaces



Test script:
---------------
//abstract class A { abstract static function a(); } //invalid

interface I { static function i(); } //valid
abstract class B implements I {} //valid
//class C extends B{} // invalid
//Fatal error: Class C contains 1 abstract method and must therefore be 
declared abstract or implement the remaining methods (I::i) in php shell code 
on line 1

class D extends B{
static function i(){echo "I have to be implemented"; }
}



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65809&edit=1

Reply via email to