|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-03-06 04:19 UTC] cgili at yahoo dot com
[2012-10-26 16:26 UTC] dagguh at gmail dot com
[2013-01-08 23:31 UTC] jon at langevin dot me
[2015-05-06 16:53 UTC] nikic@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: nikic
[2015-05-06 16:53 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 07:00:01 2025 UTC |
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; } }