Skip to content

Commit

Permalink
Update the ::times() operation.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Jan 6, 2020
1 parent f57c286 commit 7737e07
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,9 @@ public function tail(int $length = 1): BaseInterface
*
* @return \loophp\collection\Contract\Collection
*/
public static function times(int $number, ?callable $callback = null): CollectionInterface
public static function times($number = INF, ?callable $callback = null): CollectionInterface
{
return (new Collection())->run(new Times($number, $callback));
return (new self())->run(new Times($number, $callback));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Contract/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ public static function range(int $start = 0, $end = INF, $step = 1): Collection;
/**
* Create a new instance by invoking the callback a given amount of times.
*
* @param int $number
* @param float|int $number
* @param callable $callback
*
* @return \loophp\collection\Contract\Collection<mixed>
*/
public static function times(int $number, ?callable $callback = null): Collection;
public static function times($number = INF, ?callable $callback = null): Collection;

/**
* TODO.
Expand Down
6 changes: 3 additions & 3 deletions src/Operation/Times.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ final class Times implements Operation
private $callback;

/**
* @var int
* @var float|int
*/
private $number;

/**
* Times constructor.
*
* @param int $number
* @param float|int $number
* @param callable|null $callback
*/
public function __construct(int $number, ?callable $callback = null)
public function __construct($number, ?callable $callback = null)
{
$this->number = $number;
$this->callback = $callback;
Expand Down

0 comments on commit 7737e07

Please sign in to comment.