Skip to content

Commit 3d24f04

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 b5a8033 commit 3d24f04

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

Tests/IntegrationTest.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,15 @@
2121
*/
2222
class IntegrationTest extends ProviderIntegrationTest
2323
{
24-
protected $skippedTests = [
25-
];
24+
protected array $skippedTests = [];
2625

27-
protected $testAddress = false;
26+
protected bool $testAddress = false;
2827

29-
protected $testReverse = false;
28+
protected bool $testReverse = false;
3029

31-
protected $testIpv6 = false;
30+
protected bool $testIpv6 = false;
3231

33-
protected $testHttpProvider = false;
32+
protected bool $testHttpProvider = false;
3433

3534
public static function setUpBeforeClass(): void
3635
{
@@ -50,13 +49,13 @@ protected function createProvider(ClientInterface $httpClient)
5049
return new MaxMindBinary(__DIR__.'/fixtures/GeoLiteCity.dat');
5150
}
5251

53-
protected function getCacheDir()
52+
protected function getCacheDir(): string
5453
{
5554
return __DIR__.'/.cached_responses';
5655
}
5756

58-
protected function getApiKey()
57+
protected function getApiKey(): string
5958
{
60-
return null;
59+
return '';
6160
}
6261
}

Tests/MaxMindBinaryTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ public function testLocationResultContainsExpectedFieldsForAnAmericanIp()
7272
$result = $results->first();
7373
$this->assertInstanceOf('\Geocoder\Model\Address', $result);
7474

75-
$this->assertEquals('43.089200000000005', $result->getCoordinates()->getLatitude(), '', 0.001);
76-
$this->assertEquals('-76.025000000000006', $result->getCoordinates()->getLongitude(), '', 0.001);
75+
$this->assertEqualsWithDelta(43.089200000000005, $result->getCoordinates()->getLatitude(), 0.001);
76+
$this->assertEqualsWithDelta(-76.025000000000006, $result->getCoordinates()->getLongitude(), 0.001);
7777
$this->assertNull($result->getBounds());
7878
$this->assertNull($result->getStreetNumber());
7979
$this->assertNull($result->getStreetName());
@@ -100,8 +100,8 @@ public function testLocationResultContainsExpectedFieldsForASpanishIp()
100100
$result = $results->first();
101101
$this->assertInstanceOf('\Geocoder\Model\Address', $result);
102102

103-
$this->assertEquals('41.543299999999988', $result->getCoordinates()->getLatitude(), '', 0.001);
104-
$this->assertEquals('2.1093999999999937', $result->getCoordinates()->getLongitude(), '', 0.001);
103+
$this->assertEqualsWithDelta(41.543299999999988, $result->getCoordinates()->getLatitude(), 0.001);
104+
$this->assertEqualsWithDelta(2.1093999999999937, $result->getCoordinates()->getLongitude(), 0.001);
105105
$this->assertNull($result->getBounds());
106106
$this->assertNull($result->getStreetNumber());
107107
$this->assertNull($result->getStreetName());

0 commit comments

Comments
 (0)