Re: RFC: spl_autoload_register() should provide kind of entity to load

From: Date: Sat, 18 Apr 2015 21:15:36 +0000
Subject: Re: RFC: spl_autoload_register() should provide kind of entity to load
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-85865@lists.php.net to get a copy of this message
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 smalyshev@gmail.com

« previous php.internals (#85865) next »