Skip to content

Commit

Permalink
fix: update constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Nov 13, 2022
1 parent d74d4f8 commit c49e62b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ parameters:
path: src/Collection.php

-
message: "#^Method loophp\\\\collection\\\\Collection\\:\\:partition\\(\\) should return loophp\\\\collection\\\\Contract\\\\Collection\\<int, loophp\\\\collection\\\\Contract\\\\Collection\\<TKey, T\\>\\> but returns loophp\\\\collection\\\\Contract\\\\Collection\\<mixed, loophp\\\\collection\\\\Collection\\<mixed, mixed\\>\\>\\.$#"
message: "#^Method loophp\\\\collection\\\\Collection\\:\\:partition\\(\\) should return loophp\\\\collection\\\\Contract\\\\Collection\\<int, loophp\\\\collection\\\\Contract\\\\Collection\\<TKey, T\\>\\> but returns loophp\\\\collection\\\\Contract\\\\Collection\\<mixed, loophp\\\\collection\\\\Contract\\\\Collection\\<mixed, mixed\\>\\>\\.$#"
count: 1
path: src/Collection.php

-
message: "#^Method loophp\\\\collection\\\\Collection\\:\\:span\\(\\) should return loophp\\\\collection\\\\Contract\\\\Collection\\<int, loophp\\\\collection\\\\Contract\\\\Collection\\<TKey, T\\>\\> but returns loophp\\\\collection\\\\Contract\\\\Collection\\<mixed, loophp\\\\collection\\\\Collection\\<mixed, mixed\\>\\>\\.$#"
message: "#^Method loophp\\\\collection\\\\Collection\\:\\:span\\(\\) should return loophp\\\\collection\\\\Contract\\\\Collection\\<int, loophp\\\\collection\\\\Contract\\\\Collection\\<TKey, T\\>\\> but returns loophp\\\\collection\\\\Contract\\\\Collection\\<mixed, loophp\\\\collection\\\\Contract\\\\Collection\\<mixed, mixed\\>\\>\\.$#"
count: 1
path: src/Collection.php

Expand Down
24 changes: 12 additions & 12 deletions src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,17 +450,17 @@ public function frequency(): CollectionInterface
* @param callable(mixed ...$parameters): iterable<NewTKey, NewT> $callable
* @param iterable<int, mixed> $parameters
*
* @return self<NewTKey, NewT>
* @return CollectionInterface<NewTKey, NewT>
*/
public static function fromCallable(callable $callable, iterable $parameters = []): self
public static function fromCallable(callable $callable, iterable $parameters = []): CollectionInterface
{
return new self($callable, $parameters);
}

/**
* @return self<int, string>
* @return CollectionInterface<int, string>
*/
public static function fromFile(string $filepath): self
public static function fromFile(string $filepath): CollectionInterface
{
return new self(
static fn (): Generator => yield from new ResourceIteratorAggregate(fopen($filepath, 'rb'), true),
Expand All @@ -473,9 +473,9 @@ public static function fromFile(string $filepath): self
*
* @param Generator<NewTKey, NewT> $generator
*
* @return self<NewTKey, NewT>
* @return CollectionInterface<NewTKey, NewT>
*/
public static function fromGenerator(Generator $generator): self
public static function fromGenerator(Generator $generator): CollectionInterface
{
return new self(static fn (): Generator => yield from new NoRewindIterator($generator));
}
Expand All @@ -486,27 +486,27 @@ public static function fromGenerator(Generator $generator): self
*
* @param iterable<NewTKey, NewT> $iterable
*
* @return self<NewTKey, NewT>
* @return CollectionInterface<NewTKey, NewT>
*/
public static function fromIterable(iterable $iterable): self
public static function fromIterable(iterable $iterable): CollectionInterface
{
return new self(static fn (): Generator => yield from new IterableIteratorAggregate($iterable));
}

/**
* @param resource $resource
*
* @return self<int, string>
* @return CollectionInterface<int, string>
*/
public static function fromResource($resource): self
public static function fromResource($resource): CollectionInterface
{
return new self(static fn (): Generator => yield from new ResourceIteratorAggregate($resource));
}

/**
* @return self<int, string>
* @return CollectionInterface<int, string>
*/
public static function fromString(string $string, string $delimiter = ''): self
public static function fromString(string $string, string $delimiter = ''): CollectionInterface
{
return new self(static fn (): Generator => yield from new StringIteratorAggregate($string, $delimiter));
}
Expand Down

0 comments on commit c49e62b

Please sign in to comment.