Hi,

Le 18/02/2016 13:41, Nikita Popov a écrit :

This RFC is incomplete -- I'm posting it now so people can suggest other
things that should be deprecated. I expect it to grow over time and don't
plan to vote on it in the immediate future.

May I suggest to remove the second argument of spl_autoload() ?

spl_autoload() is typically called from the PHP core only, and the core never sets this argument. File extensions to consider are set using spl_autoload_extensions(). So, the 2nd argument of spl_autoload() is useless and probably never used anywhere.

The problem with this argument is that it creates an annoying issue when thinking about a way to extend autoloading to other symbol types (namely functions and constants). The easiest way to extend autoloading to other types is to add an optional second argument to autoloaders. For a perfect BC, the core would call an autoloader for non-class symbols only if the function accepts 2 arguments. This way, we can achieve full backwards and forward compatibility with existing autoloaders. The pre-requisite is that currently existing autoloaders take only one arg, hence my suggestion to remove the second argument of spl_autoload() (spl_autoload() will remain a class-only autoloader).

Regards

François

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

Reply via email to