Adopt variadic methods throughout because it enforces types. DX

Open
#954 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
php
Domain
backend

Research direction

Start by locating the Geocoder\ProviderAggregator class and its registerProviders method. Review the current array-based signature and calls, then identify the other methods covered by “throughout.” Done means the affected methods accept typed variadic providers and their calls support individual providers and unpacked arrays as described.

Written by the indexing model from the issue text.

Description

improvement

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);

Dominant language
PHP
Stars
4k
Forks
525
Avg merge
8m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from geocoder-php/Geocoder

All issues in geocoder-php/Geocoder

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.