On Tue, Mar 16, 2021 at 11:06 AM Harm Smits <harmsmits...@gmail.com> wrote:
>
> Hey,
>
> First time ever replying so hope all went well.
>
> I believe the `autoload_set_classmap` function's signature should change
> rather to something like this:
>
> ```
> /**
>  * Sets the internal autoloader to use the given classmap.
>  *
>  * @param $mapping key value pair of classes;
>  * @param $merge A boolean value indicating whether it should *merge* with
> an already defined classmap or override in its interity;
>  * @param $merge_override Whether existing keys in the classmap will be
> overridden.
>  *
>  * @return void
>  */
> autoload_set_classmap(array $mapping, bool $merge = true, bool
> $merge_override = false): void {}
> ```
>
> It makes more sense as some projects might have multiple composer projects
> loaded (think about modules in e.g. wordpress), where there can be multiple
> autoloaders. Hence the *$merge* and *$merge_override* variables. I don't
> know whether we should rather use flags for this, but considering named
> arguments are here now, I'd say it makes no sense to use them anymore
> (except for maybe consistency). Not sure about the implementation, but the
> features should be there for sure.
>
> Kind regards,
> Harm Smits

The proposed API allows users to fetch the current map and set a new
map. In other words, the callers can choose these decisions among
others (merge some keys, override others).

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

Reply via email to