PeeHaaLib / Autoloader

PSR-0 autoloader
0 stars 0 forks source link

Not PSR-4 compliant #1

Open DaveRandom opened 10 years ago

DaveRandom commented 10 years ago

PSR-4 #2.4:

Autoloader implementations MUST NOT throw exceptions, MUST NOT raise errors of any level, and SHOULD NOT return a value.

(emphasis mine)

PeeHaa commented 10 years ago

Looks like their own example is not PSR-4 compliant in that case: https://github.com/php-fig/fig-standards/blob/master/proposed/psr-4-autoloader/psr-4-autoloader-examples.md

Or is it about register() and unregister()?

DaveRandom commented 10 years ago

According to their own spec, public function loadClass($class) should not return false; (although it is a "should" and not a "must").

ircmaxell pointed out that while return values in SPL registered autoloaders are inspected, their use is redundant - what matters is whether the class is added to the symbol table.

I am going to raise this as an issue with fig, although they'll probably just say "shoud not must, fuck off".

Personally I'd prefer not to logically decide whether I found a class or not - if there's a typo in a class name in a file I loaded, I might think I loaded it but actually I didn't. Better to let PHP determine whether it actually has a usable class definition IMO.