mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-15 18:23:26 +03:00
Merge pull request #541 from skipperbent/v4-development
Version 4.3.2.3
This commit is contained in:
@@ -165,7 +165,7 @@ class InputFile implements IInputItem
|
||||
* @param string $name
|
||||
* @return static
|
||||
*/
|
||||
public function setFilename($name): IInputItem
|
||||
public function setFilename(string $name): IInputItem
|
||||
{
|
||||
$this->filename = $name;
|
||||
|
||||
@@ -188,7 +188,7 @@ class InputFile implements IInputItem
|
||||
* @param string $destination
|
||||
* @return bool
|
||||
*/
|
||||
public function move($destination): bool
|
||||
public function move(string $destination): bool
|
||||
{
|
||||
return move_uploaded_file($this->tmpName, $destination);
|
||||
}
|
||||
@@ -226,10 +226,10 @@ class InputFile implements IInputItem
|
||||
/**
|
||||
* Set error
|
||||
*
|
||||
* @param int $error
|
||||
* @param int|null $error
|
||||
* @return static
|
||||
*/
|
||||
public function setError($error): IInputItem
|
||||
public function setError(?int $error): IInputItem
|
||||
{
|
||||
$this->errors = (int)$error;
|
||||
|
||||
@@ -249,7 +249,7 @@ class InputFile implements IInputItem
|
||||
* @param string $name
|
||||
* @return static
|
||||
*/
|
||||
public function setTmpName($name): IInputItem
|
||||
public function setTmpName(string $name): IInputItem
|
||||
{
|
||||
$this->tmpName = $name;
|
||||
|
||||
@@ -261,7 +261,7 @@ class InputFile implements IInputItem
|
||||
return $this->getTmpName();
|
||||
}
|
||||
|
||||
public function getValue()
|
||||
public function getValue(): string
|
||||
{
|
||||
return $this->getFilename();
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ class InputHandler
|
||||
* @param array|null $original
|
||||
* @return array
|
||||
*/
|
||||
protected function rearrangeFile(array $values, &$index, $original): array
|
||||
protected function rearrangeFile(array $values, array &$index, ?array $original): array
|
||||
{
|
||||
$originalIndex = $index[0];
|
||||
array_shift($index);
|
||||
|
||||
@@ -55,7 +55,6 @@ abstract class LoadableRoute extends Route implements ILoadableRoute
|
||||
public function matchRegex(Request $request, $url): ?bool
|
||||
{
|
||||
/* Match on custom defined regular expression */
|
||||
|
||||
if ($this->regex === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -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