Late defined classes
| From: | Paul Tarjan | Date: | Fri, 20 Mar 2009 01:28:39 +0000 |
| Subject: | Late defined classes | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-43421@lists.php.net to get a copy of this message | ||
Hi all,
This works (albeit with an abstract class error):
---
class Result implements Countable { }
$result = new Result();
---
Switching their order:
---
$result = new Result();
class Result implements Countable { }
---
gives :
---
Fatal error: Class 'Result' not found in /tmp/not_defined.php on line 2
---
If I remove the interface, everything is peachy:
---
$result = new Result();
class Result { }
---
So as a user of PHP I was quite surprised that a class with an interface
must be in the code flow to be defined.
Is there anything (easy) that we can do to support this case?
Thanks
Paul