mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
Fixed deprecated notice when using class type hinting (issue: #538)
This commit is contained in:
@@ -76,6 +76,11 @@ abstract class Route implements IRoute
|
||||
if (is_callable($callback) === true) {
|
||||
$router->debug('Executing callback');
|
||||
|
||||
/* Load class from type hinting */
|
||||
if (is_array($callback) === true && isset($callback[0], $callback[1]) === true) {
|
||||
$callback[0] = $router->getClassLoader()->loadClass($callback[0]);
|
||||
}
|
||||
|
||||
/* When the callback is a function */
|
||||
return $router->getClassLoader()->loadClosure($callback, $parameters);
|
||||
}
|
||||
@@ -160,7 +165,7 @@ abstract class Route implements IRoute
|
||||
foreach ((array)$parameters[1] as $name) {
|
||||
|
||||
// Ignore parent parameters
|
||||
if(isset($groupParameters[$name]) === true) {
|
||||
if (isset($groupParameters[$name]) === true) {
|
||||
$lastParams[$name] = $matches[$name];
|
||||
continue;
|
||||
}
|
||||
@@ -244,6 +249,7 @@ abstract class Route implements IRoute
|
||||
$this->group = $group;
|
||||
|
||||
/* Add/merge parent settings with child */
|
||||
|
||||
return $this->setSettings($group->toArray(), true);
|
||||
}
|
||||
|
||||
@@ -576,6 +582,7 @@ abstract class Route implements IRoute
|
||||
public function setFilterEmptyParams(bool $enabled): IRoute
|
||||
{
|
||||
$this->filterEmptyParams = $enabled;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user