From 848f4f41c84a465be1e6fbddfa971ae68fab3831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20B=C3=A1thory?= Date: Wed, 15 Apr 2020 18:00:48 +0200 Subject: [PATCH] resolve some PHPStan issue --- .travis.yml | 3 +-- phpstan-baseline.neon | 15 --------------- phpstan.neon.dist | 3 ++- src/Adapter/GoogleGeocode.php | 2 +- src/Geometry/Geometry.php | 2 +- 5 files changed, 5 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index b16770cd..f1c513cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,11 +66,10 @@ jobs: - stage: Test php: 7.4 - - stage: Allowed Failures - php: nightly +# FIXME: allow_failures doesn't appear to work with stages defined. How to solve that? allow_failures: - - stage: Allowed Failures - php: nightly fast_finish: true diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e7d040b9..5d7e0cba 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -75,11 +75,6 @@ parameters: count: 1 path: src/Adapter/GeoRSS.php - - - message: "#^Call to function is_array\\(\\) with string will always evaluate to false\\.$#" - count: 1 - path: src/Adapter/GoogleGeocode.php - - message: "#^Method geoPHP\\\\Adapter\\\\GoogleGeocode\\:\\:read\\(\\) should return geoPHP\\\\Geometry\\\\Geometry but returns null\\.$#" count: 1 @@ -270,16 +265,6 @@ parameters: count: 1 path: src/Geometry/MultiPolygon.php - - - message: "#^Result of \\|\\| is always false\\.$#" - count: 1 - path: src/Geometry/Point.php - - - - message: "#^Return type \\(null\\) of method geoPHP\\\\Geometry\\\\Point\\:\\:explode\\(\\) should be compatible with return type \\(array\\\\|geoPHP\\\\Geometry\\\\LineString\\>\\) of method geoPHP\\\\Geometry\\\\Geometry\\:\\:explode\\(\\)$#" - count: 1 - path: src/Geometry/Point.php - - message: "#^Parameter \\#2 \\$allowEmptyComponents of method geoPHP\\\\Geometry\\\\Surface\\:\\:__construct\\(\\) expects bool, null given\\.$#" count: 1 diff --git a/phpstan.neon.dist b/phpstan.neon.dist index e17f7684..1658e010 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -7,4 +7,5 @@ parameters: - tests/unit ignoreErrors: - "#^Unsafe usage of new static\\(\\)\\.$#" - inferPrivatePropertyTypeFromConstructor: true \ No newline at end of file + inferPrivatePropertyTypeFromConstructor: true + treatPhpDocTypesAsCertain: false \ No newline at end of file diff --git a/src/Adapter/GoogleGeocode.php b/src/Adapter/GoogleGeocode.php index cdb15984..0af7150e 100644 --- a/src/Adapter/GoogleGeocode.php +++ b/src/Adapter/GoogleGeocode.php @@ -35,7 +35,7 @@ class GoogleGeocode implements GeoAdapter /** * Makes a geocoding (lat/lon lookup) with an address string or array geometry objects * - * @param string $address Address to geocode + * @param string|string[] $address Address to geocode * @param string $apiKey Your application's Google Maps Geocoding API key * @param string $returnType Type of Geometry to return. Can either be 'points' or 'bounds' (polygon) * @param array|bool|Geometry $bounds Limit the search area to within this region. diff --git a/src/Geometry/Geometry.php b/src/Geometry/Geometry.php index c7184c17..06d843bc 100644 --- a/src/Geometry/Geometry.php +++ b/src/Geometry/Geometry.php @@ -221,7 +221,7 @@ abstract public function invertXY(); * Get all line segments * @param bool $toArray return segments as LineString or array of start and end points. Explode(true) is faster * - * @return LineString[] | Point[][] + * @return LineString[] | Point[][] | null */ abstract public function explode($toArray = false);