diff options
author | William Desportes <williamdes@wdes.fr> | 2021-04-29 00:46:22 +0300 |
---|---|---|
committer | William Desportes <williamdes@wdes.fr> | 2021-04-29 00:48:27 +0300 |
commit | c51af5a0034dcd4d2d65a3c34e98b55f20943574 (patch) | |
tree | 18152d7db24cb4bd90c7ae0d6690ce14124926e9 /test/classes | |
parent | 6649d9951724ade7da41b0c8523d6af398f92590 (diff) |
Fix phpstan reported errors
Signed-off-by: William Desportes <williamdes@wdes.fr>
Diffstat (limited to 'test/classes')
-rw-r--r-- | test/classes/Gis/GisGeomTestCase.php | 18 | ||||
-rw-r--r-- | test/classes/Stubs/DbiDummy.php | 10 |
2 files changed, 20 insertions, 8 deletions
diff --git a/test/classes/Gis/GisGeomTestCase.php b/test/classes/Gis/GisGeomTestCase.php index df170e0393..4ab3ebfc90 100644 --- a/test/classes/Gis/GisGeomTestCase.php +++ b/test/classes/Gis/GisGeomTestCase.php @@ -7,6 +7,8 @@ declare(strict_types=1); namespace PhpMyAdmin\Tests\Gis; +use PhpMyAdmin\Gis\GisGeometry; +use PhpMyAdmin\Gis\GisPolygon; use PhpMyAdmin\Tests\AbstractTestCase; use function imagesx; @@ -16,7 +18,7 @@ use function imagesx; */ abstract class GisGeomTestCase extends AbstractTestCase { - /** @var object */ + /** @var GisGeometry */ protected $object; /** @@ -35,12 +37,16 @@ abstract class GisGeomTestCase extends AbstractTestCase $params, $this->object->generateParams($wkt) ); - } else { - $this->assertEquals( - $params, - $this->object->generateParams($wkt, $index) - ); + + return; } + + /** @var GisPolygon $obj or another GisGeometry that supports this definition */ + $obj = $this->object; + $this->assertEquals( + $params, + $obj->generateParams($wkt, $index) + ); } /** diff --git a/test/classes/Stubs/DbiDummy.php b/test/classes/Stubs/DbiDummy.php index 6b2468fb73..d16350b13f 100644 --- a/test/classes/Stubs/DbiDummy.php +++ b/test/classes/Stubs/DbiDummy.php @@ -18,6 +18,7 @@ use function addslashes; use function count; use function is_array; use function is_bool; +use function is_int; use function preg_replace; use function str_replace; use function trim; @@ -462,12 +463,17 @@ class DbiDummy implements DbiExtension /** * Return query data for ID * - * @param object $result result set identifier + * @param object|int $result result set identifier * * @return array */ - private function &getQueryData($result) + private function &getQueryData($result): array { + if (! is_int($result)) { + // This never happens + return []; + } + if ($result >= self::OFFSET_GLOBAL) { return $GLOBALS['dummy_queries'][$result - self::OFFSET_GLOBAL]; } |