Skip to content

Commit 876c5ae

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 <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>
1 parent e0e1e1f commit 876c5ae

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

Model/Address.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class Address implements Location
8787
* @param Country|null $country
8888
* @param string|null $timezone
8989
*/
90-
public function __construct(
90+
final public function __construct(
9191
string $providedBy,
9292
AdminLevelCollection $adminLevels,
9393
Coordinates $coordinates = null,

ProviderAggregator.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ public function __construct(callable $decider = null, int $limit = Geocoder::DEF
6060
*/
6161
public function geocodeQuery(GeocodeQuery $query): Collection
6262
{
63-
if (null === $query->getLimit()) {
64-
$query = $query->withLimit($this->limit);
65-
}
66-
6763
return call_user_func($this->decider, $query, $this->providers, $this->provider)->geocodeQuery($query);
6864
}
6965

@@ -72,10 +68,6 @@ public function geocodeQuery(GeocodeQuery $query): Collection
7268
*/
7369
public function reverseQuery(ReverseQuery $query): Collection
7470
{
75-
if (null === $query->getLimit()) {
76-
$query = $query->withLimit($this->limit);
77-
}
78-
7971
return call_user_func($this->decider, $query, $this->providers, $this->provider)->reverseQuery($query);
8072
}
8173

StatefulGeocoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function geocode(string $value): Collection
6565
$query = $query->withLocale($this->locale);
6666
}
6767

68-
if (!empty($this->bounds)) {
68+
if (null !== $this->bounds) {
6969
$query = $query->withBounds($this->bounds);
7070
}
7171

Tests/TimedGeocoderTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Geocoder\Model\AddressCollection;
1616
use Geocoder\Provider\Provider;
1717
use Geocoder\TimedGeocoder;
18+
use PHPUnit\Framework\MockObject\MockObject;
1819
use PHPUnit\Framework\TestCase;
1920
use Symfony\Component\Stopwatch\Stopwatch;
2021

@@ -26,7 +27,7 @@ class TimedGeocoderTest extends TestCase
2627
private $stopwatch;
2728

2829
/**
29-
* @var Provider|\PHPUnit_Framework_MockObject_MockObject
30+
* @var Provider&MockObject
3031
*/
3132
private $delegate;
3233

0 commit comments

Comments
 (0)