Fix minor issues found by Psalm
This commit is contained in:
parent
a7b08ad8a3
commit
e9fb474eb7
|
|
@ -29,7 +29,7 @@ class TemplateRoute extends Route
|
||||||
* Examines a request target to see if it is a match for the route.
|
* Examines a request target to see if it is a match for the route.
|
||||||
*
|
*
|
||||||
* @param string $requestTarget
|
* @param string $requestTarget
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function matchesRequestTarget($requestTarget)
|
public function matchesRequestTarget($requestTarget)
|
||||||
{
|
{
|
||||||
|
|
@ -49,9 +49,16 @@ class TemplateRoute extends Route
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $requestTarget
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
private function matchesStartOfRequestTarget($requestTarget)
|
private function matchesStartOfRequestTarget($requestTarget)
|
||||||
{
|
{
|
||||||
$firstVarPos = strpos($this->target, "{");
|
$firstVarPos = strpos($this->target, "{");
|
||||||
|
if ($firstVarPos === false) {
|
||||||
|
return $requestTarget === $this->target;
|
||||||
|
}
|
||||||
return (substr($requestTarget, 0, $firstVarPos) === substr($this->target, 0, $firstVarPos));
|
return (substr($requestTarget, 0, $firstVarPos) === substr($this->target, 0, $firstVarPos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ use WellRESTed\Routing\Route\RouteInterface;
|
||||||
|
|
||||||
class Router
|
class Router
|
||||||
{
|
{
|
||||||
/** @var string attribute name for matched path variables */
|
/** @var string|null Attribute name for matched path variables */
|
||||||
private $pathVariablesAttributeName;
|
private $pathVariablesAttributeName;
|
||||||
/** @var DispatcherInterface */
|
/** @var DispatcherInterface */
|
||||||
private $dispatcher;
|
private $dispatcher;
|
||||||
|
|
@ -42,7 +42,7 @@ class Router
|
||||||
* stored with the name. The value will be an array containing all of the
|
* stored with the name. The value will be an array containing all of the
|
||||||
* path variables.
|
* path variables.
|
||||||
*
|
*
|
||||||
* @param DispatcherInterface $dispatcher
|
* @param DispatcherInterface|null $dispatcher
|
||||||
* Instance to use for dispatching middleware and handlers.
|
* Instance to use for dispatching middleware and handlers.
|
||||||
* @param string|null $pathVariablesAttributeName
|
* @param string|null $pathVariablesAttributeName
|
||||||
* Attribute name for matched path variables. A null value sets
|
* Attribute name for matched path variables. A null value sets
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue