Skip to content

Commit

Permalink
Add PHPStan in CI (#1193)
Browse files Browse the repository at this point in the history
* 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 <norkunas.tom@gmail.com>

* Update src/Provider/Cache/Tests/ProviderCacheTest.php

Co-authored-by: Tomas Norkūnas <norkunas.tom@gmail.com>

* Update src/Provider/Cache/Tests/ProviderCacheTest.php

Co-authored-by: Tomas Norkūnas <norkunas.tom@gmail.com>

* Update src/Provider/GeoIP2/Tests/GeoIP2Test.php

Co-authored-by: Tomas Norkūnas <norkunas.tom@gmail.com>

* 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 <norkunas.tom@gmail.com>

* Update src/Plugin/PluginProvider.php

Co-authored-by: Tomas Norkūnas <norkunas.tom@gmail.com>

* Use PHPStan baseline instead of ignore

See https://phpstan.org/user-guide/baseline

---------

Co-authored-by: Tomas Norkūnas <norkunas.tom@gmail.com>
  • Loading branch information
jbelien and norkunas authored Jul 16, 2023
1 parent cb342ca commit 982eee4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Model/YandexAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function withName(string $name = null): self
/**
* @return string|null
*/
public function getKind(): string
public function getKind()
{
return $this->kind;
}
Expand Down
16 changes: 8 additions & 8 deletions Tests/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@
*/
class IntegrationTest extends ProviderIntegrationTest
{
protected $skippedTests = [
protected array $skippedTests = [
'testGeocodeQuery' => 'Wrong cords',
'testReverseQueryWithNoResults' => 'Has Result',
];

protected $testAddress = true;
protected bool $testAddress = true;

protected $testReverse = true;
protected bool $testReverse = true;

protected $testIpv4 = false;
protected bool $testIpv4 = false;

protected $testIpv6 = false;
protected bool $testIpv6 = false;

protected function createProvider(ClientInterface $httpClient)
{
return new Yandex($httpClient);
}

protected function getCacheDir()
protected function getCacheDir(): string
{
return __DIR__.'/.cached_responses';
}

protected function getApiKey()
protected function getApiKey(): string
{
return null;
return '';
}
}
2 changes: 1 addition & 1 deletion Tests/YandexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ public function testReverseMetroStationToGetName()
$provider = new Yandex($this->getHttpClient(), 'metro');
$results = $provider->reverseQuery(ReverseQuery::fromCoordinates(60.036843, 30.324285));

/** @var YandexAddress $first */
/** @var YandexAddress $result */
$result = $results->first();
$this->assertInstanceOf('Geocoder\Provider\Yandex\Model\YandexAddress', $result);
$this->assertEquals('other', $result->getPrecision());
Expand Down

0 comments on commit 982eee4

Please sign in to comment.