Skip to content

Commit

Permalink
Minor code changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Aug 13, 2019
1 parent 7677b5d commit d645d47
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public function prepend(...$items): CollectionInterface
*/
public static function range(int $start = 0, $end = INF, $step = 1): CollectionInterface
{
return (new static())->run(Range::with($start, $end, $step));
return self::withArray([])->run(Range::with($start, $end, $step));
}

/**
Expand Down Expand Up @@ -376,13 +376,9 @@ public static function with($data = []): CollectionInterface
*/
public static function withArray(array $data): CollectionInterface
{
$instance = new static();

$instance->source = static function () use ($data) {
return self::withClosure(static function () use ($data) {
yield from $data;
};

return $instance;
});
}

/**
Expand Down

0 comments on commit d645d47

Please sign in to comment.