Skip to content

Commit b99f0ea

Browse files
authored
Add PHP Coding Standards Fixer in CI (#1196)
* Update composer.json * Update .gitignore * Update php.yml * Apply PHPCSFixer fixes * Switch to php-cs-fixer/shim * Create .php-cs-fixer.dist.php
1 parent 4531c29 commit b99f0ea

File tree

4 files changed

+17
-90
lines changed

4 files changed

+17
-90
lines changed

Here.php

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
use Geocoder\Model\AddressCollection;
2323
use Geocoder\Provider\Here\Model\HereAddress;
2424
use Geocoder\Provider\Provider;
25-
use Geocoder\Query\Query;
2625
use Geocoder\Query\GeocodeQuery;
26+
use Geocoder\Query\Query;
2727
use Geocoder\Query\ReverseQuery;
2828
use Psr\Http\Client\ClientInterface;
2929

@@ -35,47 +35,47 @@ final class Here extends AbstractHttpProvider implements Provider
3535
/**
3636
* @var string
3737
*/
38-
const GEOCODE_ENDPOINT_URL_API_KEY = 'https://geocoder.ls.hereapi.com/6.2/geocode.json';
38+
public const GEOCODE_ENDPOINT_URL_API_KEY = 'https://geocoder.ls.hereapi.com/6.2/geocode.json';
3939

4040
/**
4141
* @var string
4242
*/
43-
const GEOCODE_ENDPOINT_URL_APP_CODE = 'https://geocoder.api.here.com/6.2/geocode.json';
43+
public const GEOCODE_ENDPOINT_URL_APP_CODE = 'https://geocoder.api.here.com/6.2/geocode.json';
4444

4545
/**
4646
* @var string
4747
*/
48-
const GEOCODE_CIT_ENDPOINT_API_KEY = 'https:/geocoder.sit.ls.hereapi.com/6.2/geocode.json';
48+
public const GEOCODE_CIT_ENDPOINT_API_KEY = 'https:/geocoder.sit.ls.hereapi.com/6.2/geocode.json';
4949

5050
/**
5151
* @var string
5252
*/
53-
const GEOCODE_CIT_ENDPOINT_APP_CODE = 'https://geocoder.cit.api.here.com/6.2/geocode.json';
53+
public const GEOCODE_CIT_ENDPOINT_APP_CODE = 'https://geocoder.cit.api.here.com/6.2/geocode.json';
5454

5555
/**
5656
* @var string
5757
*/
58-
const REVERSE_ENDPOINT_URL_API_KEY = 'https://reverse.geocoder.ls.hereapi.com/6.2/reversegeocode.json';
58+
public const REVERSE_ENDPOINT_URL_API_KEY = 'https://reverse.geocoder.ls.hereapi.com/6.2/reversegeocode.json';
5959

6060
/**
6161
* @var string
6262
*/
63-
const REVERSE_ENDPOINT_URL_APP_CODE = 'https://reverse.geocoder.api.here.com/6.2/reversegeocode.json';
63+
public const REVERSE_ENDPOINT_URL_APP_CODE = 'https://reverse.geocoder.api.here.com/6.2/reversegeocode.json';
6464

6565
/**
6666
* @var string
6767
*/
68-
const REVERSE_CIT_ENDPOINT_URL_API_KEY = 'https://reverse.geocoder.sit.ls.hereapi.com/6.2/reversegeocode.json';
68+
public const REVERSE_CIT_ENDPOINT_URL_API_KEY = 'https://reverse.geocoder.sit.ls.hereapi.com/6.2/reversegeocode.json';
6969

7070
/**
7171
* @var string
7272
*/
73-
const REVERSE_CIT_ENDPOINT_URL_APP_CODE = 'https://reverse.geocoder.cit.api.here.com/6.2/reversegeocode.json';
73+
public const REVERSE_CIT_ENDPOINT_URL_APP_CODE = 'https://reverse.geocoder.cit.api.here.com/6.2/reversegeocode.json';
7474

7575
/**
7676
* @var array
7777
*/
78-
const GEOCODE_ADDITIONAL_DATA_PARAMS = [
78+
public const GEOCODE_ADDITIONAL_DATA_PARAMS = [
7979
'CrossingStreets',
8080
'PreserveUnitDesignators',
8181
'Country2',
@@ -138,9 +138,6 @@ public static function createUsingApiKey(ClientInterface $client, string $apiKey
138138
return $client;
139139
}
140140

141-
/**
142-
* {@inheritdoc}
143-
*/
144141
public function geocodeQuery(GeocodeQuery $query): Collection
145142
{
146143
// This API doesn't handle IPs
@@ -177,9 +174,6 @@ public function geocodeQuery(GeocodeQuery $query): Collection
177174
return $this->executeQuery(sprintf('%s?%s', $this->getBaseUrl($query), http_build_query($queryParams)), $query->getLimit());
178175
}
179176

180-
/**
181-
* {@inheritdoc}
182-
*/
183177
public function reverseQuery(ReverseQuery $query): Collection
184178
{
185179
$coordinates = $query->getCoordinates();
@@ -194,12 +188,6 @@ public function reverseQuery(ReverseQuery $query): Collection
194188
return $this->executeQuery(sprintf('%s?%s', $this->getBaseUrl($query), http_build_query($queryParams)), $query->getLimit());
195189
}
196190

197-
/**
198-
* @param string $url
199-
* @param int $limit
200-
*
201-
* @return Collection
202-
*/
203191
private function executeQuery(string $url, int $limit): Collection
204192
{
205193
$content = $this->getUrlContents($url);
@@ -269,20 +257,13 @@ private function executeQuery(string $url, int $limit): Collection
269257
return new AddressCollection($results);
270258
}
271259

272-
/**
273-
* {@inheritdoc}
274-
*/
275260
public function getName(): string
276261
{
277262
return 'Here';
278263
}
279264

280265
/**
281266
* Get serialized additional data param.
282-
*
283-
* @param GeocodeQuery $query
284-
*
285-
* @return string
286267
*/
287268
private function getAdditionalDataParam(GeocodeQuery $query): string
288269
{
@@ -301,16 +282,12 @@ private function getAdditionalDataParam(GeocodeQuery $query): string
301282

302283
/**
303284
* Add API credentials to query params.
304-
*
305-
* @param array $queryParams
306-
*
307-
* @return array
308285
*/
309286
private function withApiCredentials(array $queryParams): array
310287
{
311288
if (
312-
empty($this->apiKey) &&
313-
(empty($this->appId) || empty($this->appCode))
289+
empty($this->apiKey)
290+
&& (empty($this->appId) || empty($this->appCode))
314291
) {
315292
throw new InvalidCredentials('Invalid or missing api key.');
316293
}
@@ -346,10 +323,6 @@ public function getBaseUrl(Query $query): string
346323

347324
/**
348325
* Serialize the component query parameter.
349-
*
350-
* @param array $components
351-
*
352-
* @return string
353326
*/
354327
private function serializeComponents(array $components): string
355328
{

Model/HereAddress.php

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ public function getLocationId()
5252
return $this->locationId;
5353
}
5454

55-
/**
56-
* @param string|null $locationId
57-
*
58-
* @return HereAddress
59-
*/
6055
public function withLocationId(string $locationId = null): self
6156
{
6257
$new = clone $this;
@@ -73,11 +68,6 @@ public function getLocationType()
7368
return $this->locationType;
7469
}
7570

76-
/**
77-
* @param string|null $locationType
78-
*
79-
* @return HereAddress
80-
*/
8171
public function withLocationType(string $locationType = null): self
8272
{
8373
$new = clone $this;
@@ -94,11 +84,6 @@ public function getLocationName()
9484
return $this->locationName;
9585
}
9686

97-
/**
98-
* @param string|null $locationName
99-
*
100-
* @return HereAddress
101-
*/
10287
public function withLocationName(string $locationName = null): self
10388
{
10489
$new = clone $this;
@@ -115,11 +100,6 @@ public function getAdditionalData()
115100
return $this->additionalData;
116101
}
117102

118-
/**
119-
* @param array|null $additionalData
120-
*
121-
* @return HereAddress
122-
*/
123103
public function withAdditionalData(array $additionalData = null): self
124104
{
125105
$new = clone $this;
@@ -132,10 +112,7 @@ public function withAdditionalData(array $additionalData = null): self
132112
}
133113

134114
/**
135-
* @param string $name
136115
* @param mixed|null $value
137-
*
138-
* @return HereAddress
139116
*/
140117
public function addAdditionalData(string $name, $value = null): self
141118
{
@@ -146,10 +123,7 @@ public function addAdditionalData(string $name, $value = null): self
146123
}
147124

148125
/**
149-
* @param string $name
150126
* @param mixed|null $default
151-
*
152-
* @return mixed
153127
*/
154128
public function getAdditionalDataValue(string $name, $default = null)
155129
{
@@ -160,21 +134,11 @@ public function getAdditionalDataValue(string $name, $default = null)
160134
return $default;
161135
}
162136

163-
/**
164-
* @param string $name
165-
*
166-
* @return bool
167-
*/
168137
public function hasAdditionalDataValue(string $name): bool
169138
{
170139
return array_key_exists($name, $this->additionalData);
171140
}
172141

173-
/**
174-
* @param array|null $shape
175-
*
176-
* @return HereAddress
177-
*/
178142
public function withShape(array $shape = null): self
179143
{
180144
$new = clone $this;
@@ -189,10 +153,7 @@ public function withShape(array $shape = null): self
189153
}
190154

191155
/**
192-
* @param string $name
193156
* @param mixed|null $value
194-
*
195-
* @return HereAddress
196157
*/
197158
public function addShape(string $name, $value = null): self
198159
{
@@ -211,11 +172,6 @@ public function getShapeValue(string $name, $default = null)
211172
return $default;
212173
}
213174

214-
/**
215-
* @param string $name
216-
*
217-
* @return bool
218-
*/
219175
public function hasShapeValue(string $name): bool
220176
{
221177
return array_key_exists($name, $this->shape);

Tests/HereTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818

1919
use Geocoder\IntegrationTest\BaseTestCase;
2020
use Geocoder\Location;
21-
use Geocoder\Query\GeocodeQuery;
22-
use Geocoder\Query\ReverseQuery;
2321
use Geocoder\Provider\Here\Here;
2422
use Geocoder\Provider\Here\Model\HereAddress;
23+
use Geocoder\Query\GeocodeQuery;
24+
use Geocoder\Query\ReverseQuery;
2525

2626
class HereTest extends BaseTestCase
2727
{

Tests/IntegrationTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010

1111
namespace Geocoder\Provider\Here\Tests;
1212

13-
use Geocoder\IntegrationTest\ProviderIntegrationTest;
14-
use Geocoder\IntegrationTest\CachedResponseClient;
15-
use Geocoder\Provider\Here\Here;
1613
use Geocoder\Collection;
14+
use Geocoder\IntegrationTest\CachedResponseClient;
15+
use Geocoder\IntegrationTest\ProviderIntegrationTest;
1716
use Geocoder\Location;
1817
use Geocoder\Model\AdminLevelCollection;
1918
use Geocoder\Model\Bounds;
2019
use Geocoder\Model\Coordinates;
2120
use Geocoder\Model\Country;
21+
use Geocoder\Provider\Here\Here;
2222
use Geocoder\Query\GeocodeQuery;
2323
use Geocoder\Query\ReverseQuery;
2424
use Http\Discovery\Psr18ClientDiscovery;
@@ -199,8 +199,6 @@ public function testReverseQueryWithNoResults(): void
199199
/**
200200
* Make sure that a result for a Geocoder is well formatted. Be aware that even
201201
* a Location with no data may be well formatted.
202-
*
203-
* @param $result
204202
*/
205203
private function assertWellFormattedResult(Collection $result)
206204
{

0 commit comments

Comments
 (0)