diff --git a/composer.json b/composer.json index 8ea9dc7..70e3e11 100755 --- a/composer.json +++ b/composer.json @@ -74,7 +74,7 @@ "@phpcs" ], "style:phpstan": [ - "@phpstan -l 8" + "@phpstan -l 9" ], "style:check": [ "@style:phpcs", diff --git a/src/Convertor.php b/src/Convertor.php index e6efc64..21d7ad0 100644 --- a/src/Convertor.php +++ b/src/Convertor.php @@ -37,6 +37,9 @@ public static function toArray(mixed $data, ?int $limit = null): array return self::toArrayWithDepth($data, $limit ?? PHP_INT_MAX, 1); } + /** + * @return ($depth is 1 ? array<mixed> : mixed) + */ private static function toArrayWithDepth(mixed $data, int $limit, int $depth): mixed { if ($limit <= 0) { diff --git a/tests/BaseModelTest.php b/tests/BaseModelTest.php index 68ff86a..b884d0b 100644 --- a/tests/BaseModelTest.php +++ b/tests/BaseModelTest.php @@ -12,9 +12,11 @@ final class BaseModelTest extends TestCase { /** + * @param array<mixed> $data + * * @dataProvider providesToArray */ - public function testJsonSerialize(mixed $data, string|Throwable $result): void + public function testJsonSerialize(array $data, string|Throwable $result): void { if ($result instanceof Throwable) { self::expectException($result::class);