Skip to content

Commit 4531c29

Browse files
jbeliennorkunas
andauthored
Add PHPStan in CI (#1193)
* Add PHPStan * Update php.yml * Update composer.json * Fix PHPStan level 0 * Fix PHPStan level 1 * Update phpstan.neon * Fix PHPStan level 2 * Update composer.json * Fix PHPStan level 3 * Fix tests * Fix PHPStan level 4 * Update src/Common/Tests/TimedGeocoderTest.php Co-authored-by: Tomas Norkūnas <[email protected]> * Update src/Provider/Cache/Tests/ProviderCacheTest.php Co-authored-by: Tomas Norkūnas <[email protected]> * Update src/Provider/Cache/Tests/ProviderCacheTest.php Co-authored-by: Tomas Norkūnas <[email protected]> * Update src/Provider/GeoIP2/Tests/GeoIP2Test.php Co-authored-by: Tomas Norkūnas <[email protected]> * Fix PHPStan level 5 * Normalize composer.json * Rename analyse script * Update composer.json * Update IntegrationTest * Update AlgoliaPlacesTest * Update composer.json * Update RequestInterface vs. getParsedResponse() * Update src/Plugin/PluginProvider.php Co-authored-by: Tomas Norkūnas <[email protected]> * Update src/Plugin/PluginProvider.php Co-authored-by: Tomas Norkūnas <[email protected]> * Use PHPStan baseline instead of ignore See https://phpstan.org/user-guide/baseline --------- Co-authored-by: Tomas Norkūnas <[email protected]>
1 parent 9e40406 commit 4531c29

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

Model/HereAddress.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function getLocationId()
5353
}
5454

5555
/**
56-
* @param string|null $LocationId
56+
* @param string|null $locationId
5757
*
5858
* @return HereAddress
5959
*/
@@ -74,7 +74,7 @@ public function getLocationType()
7474
}
7575

7676
/**
77-
* @param string|null $LocationType
77+
* @param string|null $locationType
7878
*
7979
* @return HereAddress
8080
*/
@@ -95,7 +95,7 @@ public function getLocationName()
9595
}
9696

9797
/**
98-
* @param string|null $LocationName
98+
* @param string|null $locationName
9999
*
100100
* @return HereAddress
101101
*/

Tests/HereTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Geocoder\Query\GeocodeQuery;
2222
use Geocoder\Query\ReverseQuery;
2323
use Geocoder\Provider\Here\Here;
24+
use Geocoder\Provider\Here\Model\HereAddress;
2425

2526
class HereTest extends BaseTestCase
2627
{
@@ -81,7 +82,7 @@ public function testGeocodeWithDefaultAdditionalData()
8182
$this->assertInstanceOf('Geocoder\Model\AddressCollection', $results);
8283
$this->assertCount(1, $results);
8384

84-
/** @var Location $result */
85+
/** @var HereAddress $result */
8586
$result = $results->first();
8687

8788
$this->assertInstanceOf('\Geocoder\Model\Address', $result);
@@ -127,7 +128,7 @@ public function testGeocodeWithAdditionalData()
127128
$this->assertInstanceOf('Geocoder\Model\AddressCollection', $results);
128129
$this->assertCount(1, $results);
129130

130-
/** @var Location $result */
131+
/** @var HereAddress $result */
131132
$result = $results->first();
132133
$this->assertInstanceOf('\Geocoder\Model\Address', $result);
133134
$this->assertEqualsWithDelta(41.37854, $result->getCoordinates()->getLatitude(), 0.01);
@@ -250,7 +251,9 @@ public function testGeocodeWithExtraFilterCounty()
250251
$this->assertInstanceOf('Geocoder\Model\AddressCollection', $resultsRegion1);
251252
$this->assertInstanceOf('Geocoder\Model\AddressCollection', $resultsRegion2);
252253

254+
/** @var HereAddress $resultRegion1 */
253255
$resultRegion1 = $resultsRegion1->first();
256+
/** @var HereAddress $resultRegion2 */
254257
$resultRegion2 = $resultsRegion2->first();
255258

256259
$this->assertEquals('Cabanes', $resultRegion1->getLocality());

Tests/IntegrationTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@
2929
*/
3030
class IntegrationTest extends ProviderIntegrationTest
3131
{
32-
protected $testIpv4 = false;
32+
protected bool $testIpv4 = false;
3333

34-
protected $testIpv6 = false;
34+
protected bool $testIpv6 = false;
3535

3636
protected function createProvider(ClientInterface $httpClient, bool $useCIT = false)
3737
{
3838
return Here::createUsingApiKey($httpClient, $this->getApiKey(), $useCIT);
3939
}
4040

41-
protected function getCacheDir()
41+
protected function getCacheDir(): string
4242
{
4343
return __DIR__.'/.cached_responses';
4444
}
@@ -64,25 +64,25 @@ private function getCachedHttpClient()
6464
return new CachedResponseClient($client, $this->getCacheDir(), $this->getApiKey());
6565
}
6666

67-
protected function getApiKey()
67+
protected function getApiKey(): string
6868
{
6969
return $_SERVER['HERE_APP_ID'];
7070
}
7171

72-
protected function getAppId()
72+
protected function getAppId(): string
7373
{
7474
return $_SERVER['HERE_APP_ID'];
7575
}
7676

7777
/**
7878
* @return string the Here AppCode or substring to be removed from cache
7979
*/
80-
protected function getAppCode()
80+
protected function getAppCode(): string
8181
{
8282
return $_SERVER['HERE_APP_CODE'];
8383
}
8484

85-
public function testGeocodeQuery()
85+
public function testGeocodeQuery(): void
8686
{
8787
if (isset($this->skippedTests[__FUNCTION__])) {
8888
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
@@ -107,7 +107,7 @@ public function testGeocodeQuery()
107107
}
108108
}
109109

110-
public function testGeocodeQueryCIT()
110+
public function testGeocodeQueryCIT(): void
111111
{
112112
if (isset($this->skippedTests[__FUNCTION__])) {
113113
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
@@ -132,7 +132,7 @@ public function testGeocodeQueryCIT()
132132
}
133133
}
134134

135-
public function testGeocodeQueryWithNoResults()
135+
public function testGeocodeQueryWithNoResults(): void
136136
{
137137
if (isset($this->skippedTests[__FUNCTION__])) {
138138
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
@@ -148,7 +148,7 @@ public function testGeocodeQueryWithNoResults()
148148
$this->assertEquals(0, $result->count());
149149
}
150150

151-
public function testReverseQuery()
151+
public function testReverseQuery(): void
152152
{
153153
if (isset($this->skippedTests[__FUNCTION__])) {
154154
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
@@ -164,7 +164,7 @@ public function testReverseQuery()
164164
$this->assertWellFormattedResult($result);
165165
}
166166

167-
public function testReverseQueryCIT()
167+
public function testReverseQueryCIT(): void
168168
{
169169
if (isset($this->skippedTests[__FUNCTION__])) {
170170
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
@@ -180,7 +180,7 @@ public function testReverseQueryCIT()
180180
$this->assertWellFormattedResult($result);
181181
}
182182

183-
public function testReverseQueryWithNoResults()
183+
public function testReverseQueryWithNoResults(): void
184184
{
185185
if (isset($this->skippedTests[__FUNCTION__])) {
186186
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);

0 commit comments

Comments
 (0)