diff --git a/src/Collection.php b/src/Collection.php index 01f861b6f..24ea4e3bf 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -368,7 +368,7 @@ public function duplicate(): CollectionInterface return $this->run(Duplicate::of()); } - public static function empty(): Collection + public static function empty(): CollectionInterface { return new self(); } @@ -438,7 +438,7 @@ public function frequency(): CollectionInterface return $this->run(Frequency::of()); } - public static function fromCallable(callable $callable, ...$parameters): Collection + public static function fromCallable(callable $callable, ...$parameters): CollectionInterface { return new self( static function (callable $callable, array $parameters): Generator { @@ -449,7 +449,7 @@ static function (callable $callable, array $parameters): Generator { ); } - public static function fromFile(string $filepath): Collection + public static function fromFile(string $filepath): CollectionInterface { return new self( static function (string $filepath): Generator { @@ -459,7 +459,7 @@ static function (string $filepath): Generator { ); } - public static function fromIterable(iterable $iterable): Collection + public static function fromIterable(iterable $iterable): CollectionInterface { return new self( static function (iterable $iterable): Generator { @@ -469,7 +469,7 @@ static function (iterable $iterable): Generator { ); } - public static function fromResource($resource): Collection + public static function fromResource($resource): CollectionInterface { return new self( /** @@ -484,7 +484,7 @@ static function ($resource): Generator { ); } - public static function fromString(string $string, string $delimiter = ''): Collection + public static function fromString(string $string, string $delimiter = ''): CollectionInterface { return new self( /** @@ -843,7 +843,7 @@ public function window(int $size): CollectionInterface return $this->run(Window::of()($size)); } - public static function with($data = [], ...$parameters): Collection + public static function with($data = [], ...$parameters): CollectionInterface { return new self($data, ...$parameters); } diff --git a/src/Contract/Collection.php b/src/Contract/Collection.php index c4f04687d..898f18330 100644 --- a/src/Contract/Collection.php +++ b/src/Contract/Collection.php @@ -310,9 +310,9 @@ interface Collection extends * @psalm-template NewTKey of array-key * @psalm-template NewT * - * @psalm-return \loophp\collection\Collection + * @psalm-return \loophp\collection\Contract\Collection */ - public static function empty(): \loophp\collection\Collection; + public static function empty(): Collection; /** * @psalm-template NewTKey @@ -321,9 +321,14 @@ public static function empty(): \loophp\collection\Collection; * * @param mixed ...$parameters * - * @psalm-return \loophp\collection\Collection + * @psalm-return \loophp\collection\Contract\Collection */ - public static function fromCallable(callable $callable, ...$parameters): \loophp\collection\Collection; + public static function fromCallable(callable $callable, ...$parameters): Collection; + + /** + * @psalm-return \loophp\collection\Contract\Collection + */ + public static function fromFile(string $filepath): Collection; /** * @psalm-template NewTKey @@ -333,21 +338,21 @@ public static function fromCallable(callable $callable, ...$parameters): \loophp * @param iterable $iterable * @psalm-param iterable $iterable * - * @psalm-return \loophp\collection\Collection + * @psalm-return \loophp\collection\Contract\Collection */ - public static function fromIterable(iterable $iterable): \loophp\collection\Collection; + public static function fromIterable(iterable $iterable): Collection; /** * @param resource $resource * - * @psalm-return \loophp\collection\Collection + * @psalm-return \loophp\collection\Contract\Collection */ - public static function fromResource($resource): \loophp\collection\Collection; + public static function fromResource($resource): Collection; /** - * @psalm-return \loophp\collection\Collection + * @psalm-return \loophp\collection\Contract\Collection */ - public static function fromString(string $string, string $delimiter = ''): \loophp\collection\Collection; + public static function fromString(string $string, string $delimiter = ''): Collection; /** * @psalm-return \loophp\collection\Iterator\ClosureIterator @@ -364,7 +369,7 @@ public function getIterator(): ClosureIterator; * @param mixed $data * @param mixed ...$parameters * - * @psalm-return \loophp\collection\Collection + * @psalm-return \loophp\collection\Contract\Collection */ - public static function with($data = [], ...$parameters): \loophp\collection\Collection; + public static function with($data = [], ...$parameters): Collection; }