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

 ID:                 65809
 User updated by:    spam at krol dot me
 Reported by:        spam at krol dot me
 Summary:            interface, abstract static function
 Status:             Open
 Type:               Bug
 Package:            Class/Object related
-PHP Version:        Irrelevant
+PHP Version:        5.3.15
 Block user comment: N
 Private report:     N

 New Comment:

I changed PHP version as it IS revelant

According to this

http://php.net/manual/en/migration52.incompatible.php

Dropped abstract static class functions. Due to an oversight, PHP 5.0.x and 
5.1.x allowed abstract static functions in classes. As of PHP 5.2.x, only 
interfaces can have them.


Previous Comments:
------------------------------------------------------------------------
[2013-10-02 23:43:36] phpmpan at mpan dot pl

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

------------------------------------------------------------------------
[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