Skip to content

Commit

Permalink
Updated router's setCollection to accept closure & route collection
Browse files Browse the repository at this point in the history
  • Loading branch information
divineniiquaye committed Dec 7, 2022
1 parent ad62669 commit 8824413
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ public function __construct(RouteCompilerInterface $compiler = null, string $cac
/**
* Set a route collection instance into Router in order to use addRoute method.
*
* @param \Closure|RouteCollection|null $collection
* @param null|string $cache file path to store compiled routes
*/
public static function withCollection(
\Closure|RouteCollection $collection = null,
\Closure|RouteCollection|null $collection = null,
RouteCompilerInterface $compiler = null,
string $cache = null
): static {
Expand Down Expand Up @@ -157,11 +158,11 @@ public function pipes(string $name, MiddlewareInterface ...$middlewares): void
/**
* Sets the RouteCollection instance associated with this Router.
*
* @param (callable(RouteCollection): void) $routeDefinitionCallback takes only one parameter of route collection
* @param \Closure|RouteCollection $collection
*/
public function setCollection(callable $routeDefinitionCallback): void
public function setCollection(\Closure|RouteCollection $collection): void
{
$this->collection = $routeDefinitionCallback;
$this->collection = $collection;
}

/**
Expand Down

0 comments on commit 8824413

Please sign in to comment.