#6418 [Com]: Multiple class extends ordering error
| From: | scallop at iki dot fi | Date: | Mon, 09 Sep 2002 14:04:36 +0000 |
| Subject: | #6418 [Com]: Multiple class extends ordering error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-18789@lists.php.net to get a copy of this message | ||
ID: 6418
Comment by: scallop@iki.fi
Reported By: nathan@cjhunter.com
Status: Open
Bug Type: Feature/Change Request
Operating System: Linux 2.0.36
PHP Version: 4.0.1pl2
New Comment:
Yes, this is a feature that is definately needed in PHP.
I am currently working on a project which has very complex class
hierarchy (dozens of classes extending each other). Due to complex
class hierarchy and the huge amount of code, I am developing classes so
that each class is in it's own file. And to make it all simple, I use a
small script to combine all this classes into one huge file.
It is always possible to create a system that checks class dependencies
and creates a combined classfile with classes in proper order.
However, I think this is a feature that _should_ be provided by php.
(tested on versions 4.2.3, 4.3.0 - still not implemented)
I hope I explained my self clear enough.
See my report (marked as duplicate):
http://bugs.php.net/bug.php?id=19312
Previous Comments:
------------------------------------------------------------------------
[2000-08-31 08:48:21] stas@php.net
Yes, you cannot do this in PHP. In fact, you even shouldn't try doing
this - why would you need to define class without knowing what it
extends? I move it to feature request in the meantime, in case
something will explain why this could be useful.
------------------------------------------------------------------------
[2000-08-29 12:20:10] nathan@cjhunter.com
Multiple class extends creates ordering error
The below..
<?
class c extends b {}
class b extends a {}
class a {}
?>
gives an error 'Fatal error: Class c: Cannot inherit from undefined
class b in test.html on line 4',
but..
<?
class b extends a {}
class a {}
// class c moved to bottom
class c extends b {}
?>
works fine.
I imagine this could be fixed by first ordering the classes by their
given dependencies and then process them one by one.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=6418&edit=1