Route : phpstan

This commit is contained in:
2022-07-27 08:40:10 +02:00
parent bbcb816ff6
commit e5d407960e

View File

@@ -337,8 +337,9 @@ class Route
return $_POST["_METHOD"];
}
if (!isset ($_SERVER["REQUEST_METHOD"]))
if (!isset ($_SERVER["REQUEST_METHOD"])) {
$this->error (new \Exception ("No REQUEST_METHOD", 415));
}
if ($_SERVER["REQUEST_METHOD"] === "GET" ||
$_SERVER["REQUEST_METHOD"] === "POST" ||
$_SERVER["REQUEST_METHOD"] === "PUT" ||
@@ -350,6 +351,7 @@ class Route
}
$this->error (new \Exception ("Invalid REQUEST_METHOD", 406));
return "";
}
/** Return the mached route search
@@ -554,7 +556,6 @@ class Route
$regex = str_replace ("}", ">.+)", $regex);
else
$regex = str_replace ("}", ">[^/]+)", $regex);
unset ($matches);
$rcRegex = @preg_match ($regex, $url, $matches);
if ($rcRegex === false)
{