Fix minor issues found by Psalm

This commit is contained in:
PJ Dietz 2020-08-09 11:08:33 -04:00
parent a7b08ad8a3
commit e9fb474eb7
2 changed files with 10 additions and 3 deletions

View File

@ -29,7 +29,7 @@ class TemplateRoute extends Route
* Examines a request target to see if it is a match for the route.
*
* @param string $requestTarget
* @return boolean
* @return bool
*/
public function matchesRequestTarget($requestTarget)
{
@ -49,9 +49,16 @@ class TemplateRoute extends Route
return false;
}
/**
* @param $requestTarget
* @return bool
*/
private function matchesStartOfRequestTarget($requestTarget)
{
$firstVarPos = strpos($this->target, "{");
if ($firstVarPos === false) {
return $requestTarget === $this->target;
}
return (substr($requestTarget, 0, $firstVarPos) === substr($this->target, 0, $firstVarPos));
}

View File

@ -12,7 +12,7 @@ use WellRESTed\Routing\Route\RouteInterface;
class Router
{
/** @var string attribute name for matched path variables */
/** @var string|null Attribute name for matched path variables */
private $pathVariablesAttributeName;
/** @var DispatcherInterface */
private $dispatcher;
@ -42,7 +42,7 @@ class Router
* stored with the name. The value will be an array containing all of the
* path variables.
*
* @param DispatcherInterface $dispatcher
* @param DispatcherInterface|null $dispatcher
* Instance to use for dispatching middleware and handlers.
* @param string|null $pathVariablesAttributeName
* Attribute name for matched path variables. A null value sets