Hi!

> Currently spl_autoload_register() pass the name of the class entity to the
> first *Callable* argument​, but there is now way (as i far i know) to know
> what kind of entity we're looking for.
> -Class ?
> -Interface ?
> -Trait?

I'm not sure it would be very useful for the engine. It is obviously
useful for your particular naming scheme, but most people do not use
this scheme, so this is not very common use case. I'd even argue it
usually not the best practice, as class and interface names may be used
interchangeably in typed parameters, return types, instanceof checks,
etc. and one could convert class to interface easily without breaking
anything (except your naming scheme).

Also, while in the many common cases it is known which entity is
required, there's no guarantee it is known in all cases and I'm pretty
sure there could be cases where it's not known - in fact,
zend_lookup_class() API has only the name as its input.

-- 
Stas Malyshev
smalys...@gmail.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to