diff --git a/src/Common/Exception/InvalidServerResponse.php b/src/Common/Exception/InvalidServerResponse.php index 19f38e0b9..3c2dc5190 100644 --- a/src/Common/Exception/InvalidServerResponse.php +++ b/src/Common/Exception/InvalidServerResponse.php @@ -25,7 +25,7 @@ final class InvalidServerResponse extends \RuntimeException implements Exception * * @return InvalidServerResponse */ - public static function create(string $query, int $code = 0): InvalidServerResponse + public static function create(string $query, int $code = 0): self { return new self(sprintf('The geocoder server returned an invalid response (%d) for query "%s". We could not parse it.', $code, $query)); } @@ -35,7 +35,7 @@ public static function create(string $query, int $code = 0): InvalidServerRespon * * @return InvalidServerResponse */ - public static function emptyResponse(string $query): InvalidServerResponse + public static function emptyResponse(string $query): self { return new self(sprintf('The geocoder server returned an empty response for query "%s".', $query)); } diff --git a/src/Common/Query/GeocodeQuery.php b/src/Common/Query/GeocodeQuery.php index 277b31707..46be7ed1c 100644 --- a/src/Common/Query/GeocodeQuery.php +++ b/src/Common/Query/GeocodeQuery.php @@ -65,7 +65,7 @@ private function __construct(string $text) * * @return GeocodeQuery */ - public static function create(string $text): GeocodeQuery + public static function create(string $text): self { return new self($text); } @@ -75,7 +75,7 @@ public static function create(string $text): GeocodeQuery * * @return GeocodeQuery */ - public function withText(string $text): GeocodeQuery + public function withText(string $text): self { $new = clone $this; $new->text = $text; @@ -88,7 +88,7 @@ public function withText(string $text): GeocodeQuery * * @return GeocodeQuery */ - public function withBounds(Bounds $bounds): GeocodeQuery + public function withBounds(Bounds $bounds): self { $new = clone $this; $new->bounds = $bounds; @@ -101,7 +101,7 @@ public function withBounds(Bounds $bounds): GeocodeQuery * * @return GeocodeQuery */ - public function withLocale(string $locale): GeocodeQuery + public function withLocale(string $locale): self { $new = clone $this; $new->locale = $locale; @@ -114,7 +114,7 @@ public function withLocale(string $locale): GeocodeQuery * * @return GeocodeQuery */ - public function withLimit(int $limit): GeocodeQuery + public function withLimit(int $limit): self { $new = clone $this; $new->limit = $limit; @@ -128,7 +128,7 @@ public function withLimit(int $limit): GeocodeQuery * * @return GeocodeQuery */ - public function withData(string $name, $value): GeocodeQuery + public function withData(string $name, $value): self { $new = clone $this; $new->data[$name] = $value; diff --git a/src/Common/Query/ReverseQuery.php b/src/Common/Query/ReverseQuery.php index 7c23c2a7e..548867ad4 100644 --- a/src/Common/Query/ReverseQuery.php +++ b/src/Common/Query/ReverseQuery.php @@ -64,7 +64,7 @@ public static function create(Coordinates $coordinates) * * @return ReverseQuery */ - public static function fromCoordinates($latitude, $longitude): ReverseQuery + public static function fromCoordinates($latitude, $longitude): self { return new self(new Coordinates($latitude, $longitude)); } @@ -74,7 +74,7 @@ public static function fromCoordinates($latitude, $longitude): ReverseQuery * * @return ReverseQuery */ - public function withCoordinates(Coordinates $coordinates): ReverseQuery + public function withCoordinates(Coordinates $coordinates): self { $new = clone $this; $new->coordinates = $coordinates; @@ -87,7 +87,7 @@ public function withCoordinates(Coordinates $coordinates): ReverseQuery * * @return ReverseQuery */ - public function withLimit(int $limit): ReverseQuery + public function withLimit(int $limit): self { $new = clone $this; $new->limit = $limit; @@ -100,7 +100,7 @@ public function withLimit(int $limit): ReverseQuery * * @return ReverseQuery */ - public function withLocale(string $locale): ReverseQuery + public function withLocale(string $locale): self { $new = clone $this; $new->locale = $locale; @@ -114,7 +114,7 @@ public function withLocale(string $locale): ReverseQuery * * @return ReverseQuery */ - public function withData(string $name, $value): ReverseQuery + public function withData(string $name, $value): self { $new = clone $this; $new->data[$name] = $value; diff --git a/src/Provider/FreeGeoIp/FreeGeoIp.php b/src/Provider/FreeGeoIp/FreeGeoIp.php index 52d582601..538a332b1 100644 --- a/src/Provider/FreeGeoIp/FreeGeoIp.php +++ b/src/Provider/FreeGeoIp/FreeGeoIp.php @@ -65,7 +65,7 @@ public function geocodeQuery(GeocodeQuery $query): Collection $builder->addAdminLevel(1, $data['region_name'], $data['region_code'] ?? null); } - if ($data['latitude'] !== 0 || $data['longitude'] !== 0) { + if (0 !== $data['latitude'] || 0 !== $data['longitude']) { $builder->setCoordinates($data['latitude'] ?? null, $data['longitude'] ?? null); } $builder->setLocality(empty($data['city']) ? null : $data['city']); diff --git a/src/Provider/GoogleMaps/GoogleMaps.php b/src/Provider/GoogleMaps/GoogleMaps.php index c546d3520..5709bf294 100644 --- a/src/Provider/GoogleMaps/GoogleMaps.php +++ b/src/Provider/GoogleMaps/GoogleMaps.php @@ -370,7 +370,7 @@ private function signQuery(string $query): string private function validateResponse(string $url, $content) { // Throw exception if invalid clientID and/or privateKey used with GoogleMapsBusinessProvider - if (strpos($content, "Provided 'signature' is not valid for the provided client ID") !== false) { + if (false !== strpos($content, "Provided 'signature' is not valid for the provided client ID")) { throw new InvalidCredentials(sprintf('Invalid client ID / API Key %s', $url)); } diff --git a/src/Provider/Mapzen/Mapzen.php b/src/Provider/Mapzen/Mapzen.php index 23925ca91..0b00310ba 100644 --- a/src/Provider/Mapzen/Mapzen.php +++ b/src/Provider/Mapzen/Mapzen.php @@ -116,7 +116,7 @@ private function executeQuery(string $url): AddressCollection } } - if (!isset($json['type']) || $json['type'] !== 'FeatureCollection' || !isset($json['features']) || count($json['features']) === 0) { + if (!isset($json['type']) || 'FeatureCollection' !== $json['type'] || !isset($json['features']) || 0 === count($json['features'])) { return new AddressCollection([]); } diff --git a/src/Provider/OpenCage/OpenCage.php b/src/Provider/OpenCage/OpenCage.php index c64687b0a..dd64d7e69 100644 --- a/src/Provider/OpenCage/OpenCage.php +++ b/src/Provider/OpenCage/OpenCage.php @@ -124,7 +124,7 @@ private function executeQuery(string $url, string $locale = null): AddressCollec } } - if (!isset($json['total_results']) || $json['total_results'] == 0) { + if (!isset($json['total_results']) || 0 == $json['total_results']) { return new AddressCollection([]); } diff --git a/src/Provider/Yandex/Model/YandexAddress.php b/src/Provider/Yandex/Model/YandexAddress.php index 31bb83670..2a8a8612e 100644 --- a/src/Provider/Yandex/Model/YandexAddress.php +++ b/src/Provider/Yandex/Model/YandexAddress.php @@ -44,7 +44,7 @@ public function getPrecision() * * @return YandexAddress */ - public function withPrecision(string $precision = null): YandexAddress + public function withPrecision(string $precision = null): self { $new = clone $this; $new->precision = $precision; @@ -65,7 +65,7 @@ public function getName() * * @return YandexAddress */ - public function withName(string $name = null): YandexAddress + public function withName(string $name = null): self { $new = clone $this; $new->name = $name;