geocoder-php / Geocoder

The most featured Geocoder library written in PHP.
https://geocoder-php.org
MIT License
3.94k stars 515 forks source link

Adopt variadic methods throughout because it enforces types. DX #954

Open chriscalip opened 5 years ago

chriscalip commented 5 years ago

example adoption:

From BeforeAdoption. a.) class: Geocoder\ProviderAggregator b.) method def: registerProviders(array $providers = []); c.) sample method call: $geocoder->registerProviders([new \Geocoder\Provider\GoogleMaps\GoogleMaps($adapter), new \Geocoder\Provider\Yandex\Yandex($adapter),]);

To AfterAdoption. a.) class: Geocoder\ProviderAggregator b.) method def: registerProviders(Providers ...$providers); c.) method call: $geocoder->registerProviders(new \Geocoder\Provider\GoogleMaps\GoogleMaps($adapter)); d.) method call: $geocoder->registerProviders(new \Geocoder\Provider\GoogleMaps\GoogleMaps($adapter), new XXProvider); e.) method call:$providers = [new \Geocoder\Provider\GoogleMaps\GoogleMaps($adapter), new \Geocoder\Provider\Yandex\Yandex($adapter),]; $geocoder->registerProviders(... $providers);

chriscalip commented 5 years ago

who wants it? will this fly warranting a patch?

chriscalip commented 5 years ago

Throwing it out there that this issue is BC and thus is fair to punt to a future discussion.

atymic commented 5 years ago

I guess this would have to be a 5.x.x feature due to the BC break. Maybe worth revisiting if/when works begins on it?