Skip to content

Commit 17ed6ae

Browse files
authored
Bugfix/Wrong constructor typehint. (#15)
1 parent f166d00 commit 17ed6ae

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/FilterGroup.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
*
1414
* @author Unay Santisteban <usantisteban@othercode.io>
1515
* @package ComplexHeart\Domain\Criteria
16+
*
17+
* @extends TypedCollection<int, Filter>
1618
*/
1719
final class FilterGroup extends TypedCollection
1820
{
@@ -23,23 +25,27 @@ final class FilterGroup extends TypedCollection
2325
/**
2426
* FilterGroup constructor.
2527
*
26-
* @param array<Filter> $items
28+
* @param array<int, Filter> $items
2729
*/
2830
public function __construct(array $items = [])
2931
{
3032
parent::__construct(array_unique($items));
3133
}
3234

33-
public static function create(Filter ...$filters): self
35+
/**
36+
* @param Filter ...$filters
37+
* @return FilterGroup
38+
*/
39+
public static function create(Filter ...$filters): FilterGroup
3440
{
35-
return new self($filters);
41+
return new self(array_values($filters));
3642
}
3743

3844
/**
39-
* @param array<string, scalar>|array<int, array<int, string>> $filters
40-
* @return self
45+
* @param array<int, array<int|string, mixed>> $filters
46+
* @return FilterGroup
4147
*/
42-
public static function createFromArray(array $filters): self
48+
public static function createFromArray(array $filters): FilterGroup
4349
{
4450
return self::create(
4551
...map(fn(array $filter): Filter => Filter::createFromArray($filter), $filters)

0 commit comments

Comments
 (0)