Open ghost opened 14 years ago
How about this? I agree that the standard autoloader should not make assumptions on how the developer wants to name classes.
The autoloader will make assumptions in any case. If you don't lowercase, then you assume that files are named in the same fashion as the are referred in code.
Granted, the de-facto standard (PEAR and ZF inclusive) use a mixed case for file names. I have used all lower case for a long time, because class names are case insensitive in PHP, thus there is no guarantee that a user has typed a class name in the same case in every place. It's not that I want to impose any particular style really - Konstrukt it self doesn't rely on autoload functionality, so perhaps the right thing to do would be to simply remove the autoloader from the library and leave it to user land to implement this functionality.
It is difficult, I think. If you include the autoloader, I think it should work according to the standard (PEAR and ZF). Otherwise it will confuse too many users.
I think I concur.
I propose creating $filename like so in k_autoload:
The existing autoloader makes everything lower-case, and this instead leaves the last part of the underscore-separated class path alone: "Path_To_SomeClass" becomes "path/to/SomeClass.php".