mirror of
https://github.com/dannyvankooten/AltoRouter.git
synced 2025-08-04 23:47:30 +02:00
type-hint array in constructor parameter too
This commit is contained in:
@@ -49,13 +49,13 @@ class AltoRouter
|
|||||||
* @param array $matchTypes
|
* @param array $matchTypes
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function __construct(array $routes = [], $basePath = '', $matchTypes = [])
|
public function __construct(array $routes = [], $basePath = '', array $matchTypes = [])
|
||||||
{
|
{
|
||||||
$this->addRoutes($routes);
|
$this->addRoutes($routes);
|
||||||
$this->setBasePath($basePath);
|
$this->setBasePath($basePath);
|
||||||
$this->addMatchTypes($matchTypes);
|
$this->addMatchTypes($matchTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all routes.
|
* Retrieves all routes.
|
||||||
* Useful if you want to process or display routes.
|
* Useful if you want to process or display routes.
|
||||||
@@ -152,7 +152,7 @@ class AltoRouter
|
|||||||
|
|
||||||
// Replace named parameters
|
// Replace named parameters
|
||||||
$route = $this->namedRoutes[$routeName];
|
$route = $this->namedRoutes[$routeName];
|
||||||
|
|
||||||
// prepend base path to route url again
|
// prepend base path to route url again
|
||||||
$url = $this->basePath . $route;
|
$url = $this->basePath . $route;
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ class AltoRouter
|
|||||||
}
|
}
|
||||||
|
|
||||||
$optional = $optional !== '' ? '?' : null;
|
$optional = $optional !== '' ? '?' : null;
|
||||||
|
|
||||||
//Older versions of PCRE require the 'P' in (?P<named>)
|
//Older versions of PCRE require the 'P' in (?P<named>)
|
||||||
$pattern = '(?:'
|
$pattern = '(?:'
|
||||||
. ($pre !== '' ? $pre : null)
|
. ($pre !== '' ? $pre : null)
|
||||||
|
Reference in New Issue
Block a user