Skip to content

Commit 1921274

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 ec67050 commit 1921274

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

IpInfoDb.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ public function getName(): string
123123

124124
/**
125125
* @param string $url
126-
*
127-
* @return Collection
128126
*/
129127
private function executeQuery(string $url): AddressCollection
130128
{

Tests/IntegrationTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@
2121
*/
2222
class IntegrationTest extends ProviderIntegrationTest
2323
{
24-
protected $testAddress = false;
24+
protected bool $testAddress = false;
2525

26-
protected $testReverse = false;
26+
protected bool $testReverse = false;
2727

28-
protected $testIpv6 = false;
28+
protected bool $testIpv6 = false;
2929

3030
protected function createProvider(ClientInterface $httpClient)
3131
{
3232
return new IpInfoDb($httpClient, $this->getApiKey());
3333
}
3434

35-
protected function getCacheDir()
35+
protected function getCacheDir(): string
3636
{
3737
return __DIR__.'/.cached_responses';
3838
}
3939

40-
protected function getApiKey()
40+
protected function getApiKey(): string
4141
{
4242
return $_SERVER['IPINFODB_API_KEY'];
4343
}

Tests/IpInfoDbTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ public function testGeocodeWithRealIPv4()
118118
/** @var Location $result */
119119
$result = $results->first();
120120
$this->assertInstanceOf('\Geocoder\Model\Address', $result);
121-
$this->assertEquals(36.154, $result->getCoordinates()->getLatitude(), '', 0.001);
122-
$this->assertEquals(-95.9928, $result->getCoordinates()->getLongitude(), '', 0.001);
121+
$this->assertEqualsWithDelta(36.154, $result->getCoordinates()->getLatitude(), 0.001);
122+
$this->assertEqualsWithDelta(-95.9928, $result->getCoordinates()->getLongitude(), 0.001);
123123
$this->assertEquals(74101, $result->getPostalCode());
124124
$this->assertEquals('Tulsa', $result->getLocality());
125125
$this->assertCount(1, $result->getAdminLevels());

0 commit comments

Comments
 (0)