Skip to content

Commit f769695

Browse files
committed
fix: phpstan
1 parent 6cc50c8 commit f769695

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

src/Descriptors/Resolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trait Resolver
1111
* @param \Illuminate\Http\Request $request
1212
* @param iterable<mixed>|null $values
1313
*
14-
* @return array<mixed>|null
14+
* @return array<array-key, mixed>|null
1515
*/
1616
protected function resolveValues(Request $request, ?iterable $values): ?array
1717
{

src/Descriptors/Values.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ protected function enum(null|string|Closure $attribute = null): ValueEnum
101101
}
102102

103103
/**
104-
* @param Closure(T):iterable<string, \Closure|mixed>|iterable<array-key, \Ark4ne\JsonApi\Descriptors\Values\Value> $attribute
104+
* @param Closure(T):iterable<string, mixed|\Closure|\Ark4ne\JsonApi\Descriptors\Values\Value> $attribute
105105
*
106106
* @return \Ark4ne\JsonApi\Descriptors\Values\ValueStruct<T>
107107
*/
108-
protected function struct(Closure $attribute = null): ValueStruct
108+
protected function struct(Closure $attribute): ValueStruct
109109
{
110110
return new ValueStruct($attribute);
111111
}

src/Descriptors/Values/ValueStruct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function resolveFor(Request $request, mixed $model, string $field): mixed
3131
}
3232

3333
/**
34-
* @param mixed $of
34+
* @param iterable<array-key, mixed> $of
3535
* @param Request $request
3636
*
3737
* @return array<array-key, mixed>

src/Resources/Concerns/Attributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ trait Attributes
1515
*
1616
* @param \Illuminate\Http\Request $request
1717
*
18-
* @return iterable<string, \Closure|mixed>|iterable<array-key, \Ark4ne\JsonApi\Descriptors\Values\Value>
18+
* @return iterable<array-key, mixed|\Closure|\Ark4ne\JsonApi\Descriptors\Values\Value>
1919
*
2020
* ```
2121
* return [

src/Resources/Concerns/Schema.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ private static function new(): static
9494

9595
private static function structFields(mixed $resource, string $key, ValueStruct $struct, null|string $prefix = null): Collection
9696
{
97-
return (new Collection(Values::mergeValues(($struct->retriever())($resource, $key))))
97+
/** @var array<array-key, mixed> $attributes */
98+
$attributes = ($struct->retriever())($resource, $key);
99+
100+
return (new Collection(Values::mergeValues($attributes)))
98101
->flatMap(function($value, $key) use ($resource, $prefix) {
99102
$prefixed = Describer::retrieveName($value, $key, $prefix);
100103

0 commit comments

Comments
 (0)