From:
Operating system:
PHP version: 5.3.5
Package: Class/Object related
Bug Type: Feature/Change Request
Bug description:re-enable abstract static methods
Description:
------------
hi, please read carefully my request before trash this
since static inheritance is now implemented in php, enabling this again can
provide an awesome natural feature of the language
I talked with some php hackers, and they agree with me, but in past, I did
not have good news about this:
I'm sure my example makes totally sense, and this should stay disabled only
if there are technical limitations that do not matter with the good logic
of my example
in practice, I can understand WONT FIX, but not BOGUS
abstract class AFileSystemItem
{
public static function getIfValid ($fullPath)
{
// i use static::isValid to get the method defined in the called
class
if(static::isValid($fullPath)) return new static($fullPath);
}
protected function __construct ($fp){}
// i want to force real classes to implement a way to check a path
before instance an object
protected abstract static function isValid ($fullPath); //
abstract declaration
}
class Dir extends AFileSystemItem
{
protected static function isValid ($fullPath) //
implementation
{
return is_dir($fullPath);
}
}
class File extends AFileSystemItem
{
protected static function isValid ($fullPath) //
implementation
{
return is_file($fullPath);
}
}
class Image extends File
{
protected static function isValid ($fullPath) //
implementation with override
{
if(parent::isValid($fullPath) AND (bool)getimagesize($fullPath))
return true; return false;
}
}
--
Edit bug report at http://bugs.php.net/bug.php?id=54003&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=54003&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=54003&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=54003&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=54003&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=54003&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=54003&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=54003&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=54003&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=54003&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=54003&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=54003&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=54003&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=54003&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=54003&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54003&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54003&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=54003&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=54003&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=54003&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=54003&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=54003&r=mysqlcfg