mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-11 21:22:17 +00:00
Fixed deprecated notice when using class type hinting (issue: #538)
This commit is contained in:
@@ -165,7 +165,7 @@ class InputFile implements IInputItem
|
|||||||
* @param string $name
|
* @param string $name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setFilename($name): IInputItem
|
public function setFilename(string $name): IInputItem
|
||||||
{
|
{
|
||||||
$this->filename = $name;
|
$this->filename = $name;
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ class InputFile implements IInputItem
|
|||||||
* @param string $destination
|
* @param string $destination
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function move($destination): bool
|
public function move(string $destination): bool
|
||||||
{
|
{
|
||||||
return move_uploaded_file($this->tmpName, $destination);
|
return move_uploaded_file($this->tmpName, $destination);
|
||||||
}
|
}
|
||||||
@@ -226,10 +226,10 @@ class InputFile implements IInputItem
|
|||||||
/**
|
/**
|
||||||
* Set error
|
* Set error
|
||||||
*
|
*
|
||||||
* @param int $error
|
* @param int|null $error
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setError($error): IInputItem
|
public function setError(?int $error): IInputItem
|
||||||
{
|
{
|
||||||
$this->errors = (int)$error;
|
$this->errors = (int)$error;
|
||||||
|
|
||||||
@@ -249,7 +249,7 @@ class InputFile implements IInputItem
|
|||||||
* @param string $name
|
* @param string $name
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setTmpName($name): IInputItem
|
public function setTmpName(string $name): IInputItem
|
||||||
{
|
{
|
||||||
$this->tmpName = $name;
|
$this->tmpName = $name;
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ class InputFile implements IInputItem
|
|||||||
return $this->getTmpName();
|
return $this->getTmpName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getValue()
|
public function getValue(): string
|
||||||
{
|
{
|
||||||
return $this->getFilename();
|
return $this->getFilename();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ class InputHandler
|
|||||||
* @param array|null $original
|
* @param array|null $original
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function rearrangeFile(array $values, &$index, $original): array
|
protected function rearrangeFile(array $values, array &$index, ?array $original): array
|
||||||
{
|
{
|
||||||
$originalIndex = $index[0];
|
$originalIndex = $index[0];
|
||||||
array_shift($index);
|
array_shift($index);
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ abstract class LoadableRoute extends Route implements ILoadableRoute
|
|||||||
public function matchRegex(Request $request, $url): ?bool
|
public function matchRegex(Request $request, $url): ?bool
|
||||||
{
|
{
|
||||||
/* Match on custom defined regular expression */
|
/* Match on custom defined regular expression */
|
||||||
|
|
||||||
if ($this->regex === null) {
|
if ($this->regex === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,11 @@ abstract class Route implements IRoute
|
|||||||
if (is_callable($callback) === true) {
|
if (is_callable($callback) === true) {
|
||||||
$router->debug('Executing callback');
|
$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 */
|
/* When the callback is a function */
|
||||||
return $router->getClassLoader()->loadClosure($callback, $parameters);
|
return $router->getClassLoader()->loadClosure($callback, $parameters);
|
||||||
}
|
}
|
||||||
@@ -244,6 +249,7 @@ abstract class Route implements IRoute
|
|||||||
$this->group = $group;
|
$this->group = $group;
|
||||||
|
|
||||||
/* Add/merge parent settings with child */
|
/* Add/merge parent settings with child */
|
||||||
|
|
||||||
return $this->setSettings($group->toArray(), true);
|
return $this->setSettings($group->toArray(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -576,6 +582,7 @@ abstract class Route implements IRoute
|
|||||||
public function setFilterEmptyParams(bool $enabled): IRoute
|
public function setFilterEmptyParams(bool $enabled): IRoute
|
||||||
{
|
{
|
||||||
$this->filterEmptyParams = $enabled;
|
$this->filterEmptyParams = $enabled;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user