Skip to content

Commit

Permalink
Update Cycle operation
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Aug 27, 2020
1 parent fc5baa6 commit a5388d2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public function count(): int
return $this->transform(new Count());
}

public function cycle(?int $length = null): CollectionInterface
public function cycle(int $length = 0): CollectionInterface
{
return $this->run(new Cycle($length));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Contract/Operation/Cycleable.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ interface Cycleable
/**
* @psalm-return \loophp\collection\Contract\Collection<TKey, T>
*/
public function cycle(?int $length = null): Collection;
public function cycle(int $length = 0): Collection;
}
4 changes: 2 additions & 2 deletions src/Operation/Cycle.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
final class Cycle extends AbstractOperation implements Operation
{
public function __construct(?int $length = null)
public function __construct(int $length)
{
$this->storage['length'] = $length ?? 0;
$this->storage['length'] = $length;
}

public function __invoke(): Closure
Expand Down

0 comments on commit a5388d2

Please sign in to comment.