Skip to content

Commit

Permalink
Fix phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-novotny committed Jul 4, 2022
1 parent c856bd1 commit ff3bbf0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@phpcs"
],
"style:phpstan": [
"@phpstan -l 8"
"@phpstan -l 9"
],
"style:check": [
"@style:phpcs",
Expand Down
3 changes: 3 additions & 0 deletions src/Convertor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion tests/BaseModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ff3bbf0

Please sign in to comment.