Skip to content

Commit 1ef4542

Browse files
authored
Merge branch 'master' into feature/fix-warning-for-tests
2 parents 40e7654 + 01c44f0 commit 1ef4542

File tree

87 files changed

+179
-179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+179
-179
lines changed

.github/workflows/dependency-review.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ jobs:
1717
- name: 'Checkout Repository'
1818
uses: actions/checkout@v4
1919
- name: 'Dependency Review'
20-
uses: actions/dependency-review-action@v3
20+
uses: actions/dependency-review-action@v4

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
"phpstan/extension-installer": "^1.3",
4242
"phpstan/phpstan": "^1.10",
4343
"phpstan/phpstan-phpunit": "^1.3",
44-
"phpunit/phpunit": "^9.5",
45-
"symfony/http-client": "^5.4 || ^6.3",
46-
"symfony/stopwatch": "~2.5 || ~5.0"
44+
"phpunit/phpunit": "^9.6",
45+
"symfony/http-client": "^5.4 || ^6.4 || ^7.0",
46+
"symfony/stopwatch": "^5.4 || ^6.4 || ^7.0"
4747
},
4848
"suggest": {
4949
"ext-geoip": "Enabling the geoip extension allows you to use the MaxMindProvider.",

src/Common/.github/workflows/component.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
matrix:
1616
php-version: ['8.0', '8.1', '8.2']
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- name: Use PHP ${{ matrix.php-version }}
2020
uses: shivammathur/setup-php@v2
2121
with:

src/Common/Collection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function isEmpty(): bool;
3535
/**
3636
* @return Location[]
3737
*/
38-
public function slice(int $offset, int $length = null);
38+
public function slice(int $offset, ?int $length = null);
3939

4040
public function has(int $index): bool;
4141

src/Common/Geocoder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ interface Geocoder extends Provider
3434
/**
3535
* Geocodes a given value.
3636
*
37-
* @throws \Geocoder\Exception\Exception
37+
* @throws Exception\Exception
3838
*/
3939
public function geocode(string $value): Collection;
4040

4141
/**
4242
* Reverses geocode given latitude and longitude values.
4343
*
44-
* @throws \Geocoder\Exception\Exception
44+
* @throws Exception\Exception
4545
*/
4646
public function reverse(float $latitude, float $longitude): Collection;
4747
}

src/Common/Model/Address.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ class Address implements Location
7777
final public function __construct(
7878
string $providedBy,
7979
AdminLevelCollection $adminLevels,
80-
Coordinates $coordinates = null,
81-
Bounds $bounds = null,
82-
string $streetNumber = null,
83-
string $streetName = null,
84-
string $postalCode = null,
85-
string $locality = null,
86-
string $subLocality = null,
87-
Country $country = null,
88-
string $timezone = null
80+
?Coordinates $coordinates = null,
81+
?Bounds $bounds = null,
82+
?string $streetNumber = null,
83+
?string $streetName = null,
84+
?string $postalCode = null,
85+
?string $locality = null,
86+
?string $subLocality = null,
87+
?Country $country = null,
88+
?string $timezone = null
8989
) {
9090
$this->providedBy = $providedBy;
9191
$this->adminLevels = $adminLevels;

src/Common/Model/AddressBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function setCoordinates($latitude, $longitude): self
152152
return $this;
153153
}
154154

155-
public function addAdminLevel(int $level, string $name, string $code = null): self
155+
public function addAdminLevel(int $level, string $name, ?string $code = null): self
156156
{
157157
$this->adminLevels[] = new AdminLevel($level, $name, $code);
158158

src/Common/Model/AddressCollection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function isEmpty(): bool
5959
/**
6060
* @return Location[]
6161
*/
62-
public function slice(int $offset, int $length = null)
62+
public function slice(int $offset, ?int $length = null)
6363
{
6464
return array_slice($this->locations, $offset, $length);
6565
}

src/Common/Model/AdminLevel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ final class AdminLevel
3232
*/
3333
private $code;
3434

35-
public function __construct(int $level, string $name, string $code = null)
35+
public function __construct(int $level, string $name, ?string $code = null)
3636
{
3737
$this->level = $level;
3838
$this->name = $name;

src/Common/Model/AdminLevelCollection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function first(): AdminLevel
7777
/**
7878
* @return AdminLevel[]
7979
*/
80-
public function slice(int $offset, int $length = null): array
80+
public function slice(int $offset, ?int $length = null): array
8181
{
8282
return array_slice($this->adminLevels, $offset, $length, true);
8383
}

src/Common/Model/Country.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class Country
3131
*/
3232
private $code;
3333

34-
public function __construct(string $name = null, string $code = null)
34+
public function __construct(?string $name = null, ?string $code = null)
3535
{
3636
if (null === $name && null === $code) {
3737
throw new InvalidArgument('A country must have either a name or a code');

src/Common/ProviderAggregator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ProviderAggregator implements Geocoder
4545
*/
4646
private $decider;
4747

48-
public function __construct(callable $decider = null, int $limit = Geocoder::DEFAULT_RESULT_LIMIT)
48+
public function __construct(?callable $decider = null, int $limit = Geocoder::DEFAULT_RESULT_LIMIT)
4949
{
5050
$this->limit = $limit;
5151
$this->decider = $decider ?? __CLASS__.'::getProvider';
@@ -134,7 +134,7 @@ public function getProviders(): array
134134
*
135135
* @throws ProviderNotRegistered
136136
*/
137-
private static function getProvider($query, array $providers, Provider $currentProvider = null): Provider
137+
private static function getProvider($query, array $providers, ?Provider $currentProvider = null): Provider
138138
{
139139
if (null !== $currentProvider) {
140140
return $currentProvider;

src/Common/StatefulGeocoder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ final class StatefulGeocoder implements Geocoder
4242
*/
4343
private $provider;
4444

45-
public function __construct(Provider $provider, string $locale = null)
45+
public function __construct(Provider $provider, ?string $locale = null)
4646
{
4747
$this->provider = $provider;
4848
$this->locale = $locale;

src/Http/.github/workflows/component.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
matrix:
1616
php-version: ['8.0', '8.1', '8.2']
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- name: Use PHP ${{ matrix.php-version }}
2020
uses: shivammathur/setup-php@v2
2121
with:

src/Http/Provider/AbstractHttpProvider.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ abstract class AbstractHttpProvider extends AbstractProvider
4646
/**
4747
* @param Psr17Factory|MessageFactory|null $factory Passing a MessageFactory is @deprecated
4848
*/
49-
public function __construct(ClientInterface $client, MessageFactory|Psr17Factory $factory = null)
49+
public function __construct(ClientInterface $client, MessageFactory|Psr17Factory|null $factory = null)
5050
{
5151
$this->client = $client;
5252
$this->messageFactory = $factory ?? ($client instanceof RequestFactoryInterface && $client instanceof StreamFactoryInterface ? $client : new Psr17Factory());
@@ -72,7 +72,7 @@ protected function getRequest(string $url): RequestInterface
7272
/**
7373
* @param array<string,string|string[]> $headers
7474
*/
75-
protected function createRequest(string $method, string $uri, array $headers = [], string $body = null): RequestInterface
75+
protected function createRequest(string $method, string $uri, array $headers = [], ?string $body = null): RequestInterface
7676
{
7777
if ($this->messageFactory instanceof MessageFactory) {
7878
return $this->messageFactory->createRequest($method, $uri, $headers, $body);

src/Plugin/.github/workflows/component.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
matrix:
1616
php-version: ['8.0', '8.1', '8.2']
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- name: Use PHP ${{ matrix.php-version }}
2020
uses: shivammathur/setup-php@v2
2121
with:

src/Plugin/Plugin/CachePlugin.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CachePlugin implements Plugin
4242
*/
4343
private $precision;
4444

45-
public function __construct(CacheInterface $cache, int $lifetime = null, int $precision = null)
45+
public function __construct(CacheInterface $cache, ?int $lifetime = null, ?int $precision = null)
4646
{
4747
$this->cache = $cache;
4848
$this->lifetime = $lifetime;

src/Plugin/Promise/GeocoderFulfilledPromise.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function __construct(Collection $collection)
3030
$this->collection = $collection;
3131
}
3232

33-
public function then(callable $onFulfilled = null, callable $onRejected = null): Promise
33+
public function then(?callable $onFulfilled = null, ?callable $onRejected = null): Promise
3434
{
3535
if (null === $onFulfilled) {
3636
return $this;

src/Plugin/Promise/GeocoderRejectedPromise.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct(Exception $exception)
2929
$this->exception = $exception;
3030
}
3131

32-
public function then(callable $onFulfilled = null, callable $onRejected = null): Promise
32+
public function then(?callable $onFulfilled = null, ?callable $onRejected = null): Promise
3333
{
3434
if (null === $onRejected) {
3535
return $this;

src/Provider/AlgoliaPlaces/.github/workflows/provider.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
matrix:
1616
php-version: ['8.0', '8.1', '8.2']
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- name: Use PHP ${{ matrix.php-version }}
2020
uses: shivammathur/setup-php@v2
2121
with:

src/Provider/AlgoliaPlaces/AlgoliaPlaces.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class AlgoliaPlaces extends AbstractHttpProvider implements Provider
5353
/** @var GeocodeQuery */
5454
private $query;
5555

56-
public function __construct(ClientInterface $client, string $apiKey = null, string $appId = null)
56+
public function __construct(ClientInterface $client, ?string $apiKey = null, ?string $appId = null)
5757
{
5858
parent::__construct($client);
5959

@@ -180,7 +180,7 @@ private function buildHeaders(): array
180180
/**
181181
* @param array<string, mixed> $jsonResponse
182182
*/
183-
private function buildResult(array $jsonResponse, string $locale = null): AddressCollection
183+
private function buildResult(array $jsonResponse, ?string $locale = null): AddressCollection
184184
{
185185
$results = [];
186186

@@ -227,7 +227,7 @@ private function buildResult(array $jsonResponse, string $locale = null): Addres
227227
*
228228
* @return string|int|float
229229
*/
230-
private function getResultAttribute(array $result, string $attribute, string $locale = null)
230+
private function getResultAttribute(array $result, string $attribute, ?string $locale = null)
231231
{
232232
if (!is_array($result[$attribute])) {
233233
return $result[$attribute];

src/Provider/AlgoliaPlaces/Tests/AlgoliaPlacesTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected function getCacheDir(): string
3333
/**
3434
* Get a real HTTP client. If a cache dir is set to a path it will use cached responses.
3535
*/
36-
protected function getHttpClient(string $apiKey = null, string $appCode = null): ClientInterface
36+
protected function getHttpClient(?string $apiKey = null, ?string $appCode = null): ClientInterface
3737
{
3838
return new CachedResponseClient(new Psr18Client(), $this->getCacheDir(), $apiKey, $appCode);
3939
}

src/Provider/ArcGISOnline/.github/workflows/provider.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
matrix:
1616
php-version: ['8.0', '8.1', '8.2']
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- name: Use PHP ${{ matrix.php-version }}
2020
uses: shivammathur/setup-php@v2
2121
with:

src/Provider/ArcGISOnline/ArcGISOnline.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ final class ArcGISOnline extends AbstractHttpProvider implements Provider
7171
public static function token(
7272
ClientInterface $client,
7373
string $token,
74-
string $sourceCountry = null
74+
?string $sourceCountry = null
7575
) {
7676
$provider = new self($client, $sourceCountry, $token);
7777

@@ -84,7 +84,7 @@ public static function token(
8484
* @param string $token ArcGIS World Geocoding Service token
8585
* Required for the geocodeAddresses endpoint
8686
*/
87-
public function __construct(ClientInterface $client, string $sourceCountry = null, string $token = null)
87+
public function __construct(ClientInterface $client, ?string $sourceCountry = null, ?string $token = null)
8888
{
8989
parent::__construct($client);
9090

src/Provider/AzureMaps/.github/workflows/provider.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
matrix:
1616
php-version: ['8.0', '8.1', '8.2']
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- name: Use PHP ${{ matrix.php-version }}
2020
uses: shivammathur/setup-php@v2
2121
with:

src/Provider/AzureMaps/Tests/IntegrationTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ class IntegrationTest extends ProviderIntegrationTest
1818
];
1919

2020
/**
21-
* @return \Geocoder\Provider\Provider that is used in the tests
21+
* @return Geocoder\Provider\Provider that is used in the tests
2222
*/
2323
protected function createProvider(ClientInterface $httpClient)
2424
{
25-
return new \Geocoder\Provider\AzureMaps\AzureMaps($httpClient, $_SERVER['AZURE_MAPS_SUBSCRIPTION_KEY']);
25+
return new Geocoder\Provider\AzureMaps\AzureMaps($httpClient, $_SERVER['AZURE_MAPS_SUBSCRIPTION_KEY']);
2626
}
2727

2828
/**

src/Provider/BingMaps/.github/workflows/provider.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
matrix:
1616
php-version: ['8.0', '8.1', '8.2']
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- name: Use PHP ${{ matrix.php-version }}
2020
uses: shivammathur/setup-php@v2
2121
with:

src/Provider/BingMaps/BingMaps.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function getName(): string
8282
return 'bing_maps';
8383
}
8484

85-
private function executeQuery(string $url, string $locale = null, int $limit): Collection
85+
private function executeQuery(string $url, ?string $locale = null, int $limit): Collection
8686
{
8787
if (null !== $locale) {
8888
$url = sprintf('%s&culture=%s', $url, str_replace('_', '-', $locale));

0 commit comments

Comments
 (0)