Updated getParameter method hints in Router (#4908)
This commit is contained in:
parent
8eb045f2d1
commit
1fac424f71
|
|
@ -300,15 +300,14 @@ class Router
|
|||
|
||||
/**
|
||||
* Returns a routing parameter.
|
||||
* @return array
|
||||
* @param string $name
|
||||
* @param string|null $default
|
||||
* @return string|null
|
||||
*/
|
||||
public function getParameter($name, $default = null)
|
||||
public function getParameter(string $name, string $default = null)
|
||||
{
|
||||
if (isset($this->parameters[$name]) && ($this->parameters[$name] === '0' || !empty($this->parameters[$name]))) {
|
||||
return $this->parameters[$name];
|
||||
}
|
||||
|
||||
return $default;
|
||||
$value = $this->parameters[$name] ?? '';
|
||||
return $value !== '' ? $value : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue