mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-15 18:23:26 +03:00
Merge pull request #645 from skipperbent/v5-development
Version 5.2.0.0
This commit is contained in:
@@ -9,37 +9,37 @@ class InputFile implements IInputItem
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $index;
|
||||
public string $index;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $name;
|
||||
public string $name;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
public $filename;
|
||||
public ?string $filename = null;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
public $size;
|
||||
public ?int $size = null;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
* @var string|null
|
||||
*/
|
||||
public $type;
|
||||
public ?string $type = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $errors;
|
||||
public int $errors = 0;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
public $tmpName;
|
||||
public ?string $tmpName = null;
|
||||
|
||||
public function __construct(string $index)
|
||||
{
|
||||
@@ -74,7 +74,7 @@ class InputFile implements IInputItem
|
||||
'error' => null,
|
||||
];
|
||||
|
||||
return (new static($values['index']))
|
||||
return (new self($values['index']))
|
||||
->setSize((int)$values['size'])
|
||||
->setError((int)$values['error'])
|
||||
->setType($values['type'])
|
||||
@@ -104,9 +104,9 @@ class InputFile implements IInputItem
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return int
|
||||
*/
|
||||
public function getSize(): string
|
||||
public function getSize(): ?int
|
||||
{
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
@@ -10,40 +10,40 @@ class InputHandler
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $get = [];
|
||||
protected array $get = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $post = [];
|
||||
protected array $post = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $file = [];
|
||||
protected array $file = [];
|
||||
|
||||
/**
|
||||
* @var Request
|
||||
*/
|
||||
protected $request;
|
||||
protected Request $request;
|
||||
|
||||
/**
|
||||
* Original post variables
|
||||
* @var array
|
||||
*/
|
||||
protected $originalPost = [];
|
||||
protected array $originalPost = [];
|
||||
|
||||
/**
|
||||
* Original get/params variables
|
||||
* @var array
|
||||
*/
|
||||
protected $originalParams = [];
|
||||
protected array $originalParams = [];
|
||||
|
||||
/**
|
||||
* Get original file variables
|
||||
* @var array
|
||||
*/
|
||||
protected $originalFile = [];
|
||||
protected array $originalFile = [];
|
||||
|
||||
/**
|
||||
* Input constructor.
|
||||
|
||||
@@ -8,10 +8,18 @@ use IteratorAggregate;
|
||||
|
||||
class InputItem implements ArrayAccess, IInputItem, IteratorAggregate
|
||||
{
|
||||
public $index;
|
||||
public $name;
|
||||
public string $index;
|
||||
public string $name;
|
||||
|
||||
/**
|
||||
* @var mixed|null
|
||||
*/
|
||||
public $value;
|
||||
|
||||
/**
|
||||
* @param string $index
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __construct(string $index, $value = null)
|
||||
{
|
||||
$this->index = $index;
|
||||
|
||||
@@ -17,18 +17,18 @@ class BaseCsrfVerifier implements IMiddleware
|
||||
* For example: /admin/*
|
||||
* @var array|null
|
||||
*/
|
||||
protected $except;
|
||||
protected ?array $except = null;
|
||||
|
||||
/**
|
||||
* Urls to include. Can be used to include urls from a certain path.
|
||||
* @var array|null
|
||||
*/
|
||||
protected $include;
|
||||
protected ?array $include = null;
|
||||
|
||||
/**
|
||||
* @var ITokenProvider
|
||||
*/
|
||||
protected $tokenProvider;
|
||||
protected ITokenProvider $tokenProvider;
|
||||
|
||||
/**
|
||||
* BaseCsrfVerifier constructor.
|
||||
|
||||
@@ -7,8 +7,8 @@ use Pecee\SimpleRouter\Exceptions\HttpException;
|
||||
|
||||
abstract class IpRestrictAccess implements IMiddleware
|
||||
{
|
||||
protected $ipBlacklist = [];
|
||||
protected $ipWhitelist = [];
|
||||
protected array $ipBlacklist = [];
|
||||
protected array $ipWhitelist = [];
|
||||
|
||||
protected function validate(string $ip): bool
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ class Request
|
||||
* All request-types
|
||||
* @var string[]
|
||||
*/
|
||||
public static $requestTypes = [
|
||||
public static array $requestTypes = [
|
||||
self::REQUEST_TYPE_GET,
|
||||
self::REQUEST_TYPE_POST,
|
||||
self::REQUEST_TYPE_PUT,
|
||||
@@ -43,7 +43,7 @@ class Request
|
||||
* Post request-types.
|
||||
* @var string[]
|
||||
*/
|
||||
public static $requestTypesPost = [
|
||||
public static array $requestTypesPost = [
|
||||
self::REQUEST_TYPE_POST,
|
||||
self::REQUEST_TYPE_PUT,
|
||||
self::REQUEST_TYPE_PATCH,
|
||||
@@ -55,65 +55,65 @@ class Request
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $data = [];
|
||||
private array $data = [];
|
||||
|
||||
/**
|
||||
* Server headers
|
||||
* @var array
|
||||
*/
|
||||
protected $headers = [];
|
||||
protected array $headers = [];
|
||||
|
||||
/**
|
||||
* Request ContentType
|
||||
* @var string
|
||||
*/
|
||||
protected $contentType;
|
||||
protected string $contentType;
|
||||
|
||||
/**
|
||||
* Request host
|
||||
* @var string
|
||||
* @var string|null
|
||||
*/
|
||||
protected $host;
|
||||
protected ?string $host;
|
||||
|
||||
/**
|
||||
* Current request url
|
||||
* @var Url
|
||||
*/
|
||||
protected $url;
|
||||
protected Url $url;
|
||||
|
||||
/**
|
||||
* Request method
|
||||
* @var string
|
||||
*/
|
||||
protected $method;
|
||||
protected string $method;
|
||||
|
||||
/**
|
||||
* Input handler
|
||||
* @var InputHandler
|
||||
*/
|
||||
protected $inputHandler;
|
||||
protected InputHandler $inputHandler;
|
||||
|
||||
/**
|
||||
* Defines if request has pending rewrite
|
||||
* @var bool
|
||||
*/
|
||||
protected $hasPendingRewrite = false;
|
||||
protected bool $hasPendingRewrite = false;
|
||||
|
||||
/**
|
||||
* @var ILoadableRoute|null
|
||||
*/
|
||||
protected $rewriteRoute;
|
||||
protected ?ILoadableRoute $rewriteRoute = null;
|
||||
|
||||
/**
|
||||
* Rewrite url
|
||||
* @var string|null
|
||||
*/
|
||||
protected $rewriteUrl;
|
||||
protected ?string $rewriteUrl = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $loadedRoutes = [];
|
||||
protected array $loadedRoutes = [];
|
||||
|
||||
/**
|
||||
* Request constructor.
|
||||
@@ -224,15 +224,17 @@ class Request
|
||||
*/
|
||||
public function getIp(bool $safeMode = false): ?string
|
||||
{
|
||||
$headers = ['remote-addr'];
|
||||
$headers = [];
|
||||
if($safeMode === false) {
|
||||
$headers = array_merge($headers, [
|
||||
$headers = [
|
||||
'http-cf-connecting-ip',
|
||||
'http-client-ip',
|
||||
'http-x-forwarded-for',
|
||||
]);
|
||||
];
|
||||
}
|
||||
|
||||
$headers[] = 'remote-addr';
|
||||
|
||||
return $this->getFirstHeader($headers);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use Pecee\Exceptions\InvalidArgumentException;
|
||||
|
||||
class Response
|
||||
{
|
||||
protected $request;
|
||||
protected Request $request;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
@@ -39,9 +39,6 @@ class Response
|
||||
$this->httpCode($httpCode);
|
||||
}
|
||||
|
||||
// Gracefully end session (avoid any changes being lost)
|
||||
session_write_close();
|
||||
|
||||
$this->header('location: ' . $url);
|
||||
exit(0);
|
||||
}
|
||||
@@ -68,7 +65,6 @@ class Response
|
||||
|
||||
public function cache(string $eTag, int $lastModifiedTime = 2592000): self
|
||||
{
|
||||
|
||||
$this->headers([
|
||||
'Cache-Control: public',
|
||||
sprintf('Last-Modified: %s GMT', gmdate('D, d M Y H:i:s', $lastModifiedTime)),
|
||||
|
||||
@@ -12,12 +12,12 @@ class CookieTokenProvider implements ITokenProvider
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $token;
|
||||
protected ?string $token = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $cookieTimeoutMinutes = 120;
|
||||
protected int $cookieTimeoutMinutes = 120;
|
||||
|
||||
/**
|
||||
* CookieTokenProvider constructor.
|
||||
|
||||
@@ -10,53 +10,53 @@ class Url implements JsonSerializable
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $originalUrl;
|
||||
private ?string $originalUrl = null;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $scheme;
|
||||
private ?string $scheme = null;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $host;
|
||||
private ?string $host = null;
|
||||
|
||||
/**
|
||||
* @var int|null
|
||||
*/
|
||||
private $port;
|
||||
private ?int $port = null;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $username;
|
||||
private ?string $username = null;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $password;
|
||||
private ?string $password = null;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $path;
|
||||
private ?string $path = null;
|
||||
|
||||
/**
|
||||
* Original path with no sanitization to ending slash
|
||||
* @var string|null
|
||||
*/
|
||||
private $originalPath;
|
||||
private ?string $originalPath = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $params = [];
|
||||
private array $params = [];
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $fragment;
|
||||
private ?string $fragment = null;
|
||||
|
||||
/**
|
||||
* Url constructor.
|
||||
|
||||
@@ -27,7 +27,7 @@ class ClassLoader implements IClassLoader
|
||||
* @param object $class
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return object
|
||||
* @return mixed
|
||||
*/
|
||||
public function loadClassMethod($class, string $method, array $parameters)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ interface IClassLoader
|
||||
* @param object $class
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return object
|
||||
* @return mixed
|
||||
*/
|
||||
public function loadClassMethod($class, string $method, array $parameters);
|
||||
|
||||
|
||||
@@ -12,17 +12,17 @@ class EventArgument implements IEventArgument
|
||||
* Event name
|
||||
* @var string
|
||||
*/
|
||||
protected $eventName;
|
||||
protected string $eventName;
|
||||
|
||||
/**
|
||||
* @var Router
|
||||
*/
|
||||
protected $router;
|
||||
protected Router $router;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $arguments = [];
|
||||
protected array $arguments = [];
|
||||
|
||||
public function __construct(string $eventName, Router $router, array $arguments = [])
|
||||
{
|
||||
|
||||
@@ -9,12 +9,12 @@ class ClassNotFoundHttpException extends NotFoundHttpException
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $class;
|
||||
protected string $class;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $method;
|
||||
protected ?string $method = null;
|
||||
|
||||
public function __construct(string $class, ?string $method = null, string $message = "", int $code = 0, Throwable $previous = null)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ class CallbackExceptionHandler implements IExceptionHandler
|
||||
/**
|
||||
* @var Closure
|
||||
*/
|
||||
protected $callback;
|
||||
protected Closure $callback;
|
||||
|
||||
public function __construct(Closure $callback)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ class DebugEventHandler implements IEventHandler
|
||||
* Debug callback
|
||||
* @var Closure
|
||||
*/
|
||||
protected $callback;
|
||||
protected Closure $callback;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -97,7 +97,7 @@ class EventHandler implements IEventHandler
|
||||
* All available events
|
||||
* @var array
|
||||
*/
|
||||
public static $events = [
|
||||
public static array $events = [
|
||||
self::EVENT_ALL,
|
||||
self::EVENT_INIT,
|
||||
self::EVENT_LOAD,
|
||||
@@ -120,7 +120,7 @@ class EventHandler implements IEventHandler
|
||||
* List of all registered events
|
||||
* @var array
|
||||
*/
|
||||
private $registeredEvents = [];
|
||||
private array $registeredEvents = [];
|
||||
|
||||
/**
|
||||
* Register new event
|
||||
|
||||
@@ -12,17 +12,17 @@ abstract class LoadableRoute extends Route implements ILoadableRoute
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $url;
|
||||
protected string $url;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
protected ?string $name = null;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
protected $regex;
|
||||
protected ?string $regex = null;
|
||||
|
||||
/**
|
||||
* Loads and renders middlewares-classes
|
||||
@@ -195,7 +195,7 @@ abstract class LoadableRoute extends Route implements ILoadableRoute
|
||||
*/
|
||||
public function hasName(string $name): bool
|
||||
{
|
||||
return strtolower((string)$this->name) === strtolower((string)$name);
|
||||
return strtolower((string)$this->name) === strtolower($name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,37 +18,37 @@ abstract class Route implements IRoute
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $filterEmptyParams = true;
|
||||
protected bool $filterEmptyParams = true;
|
||||
|
||||
/**
|
||||
* If true the last parameter of the route will include ending trail/slash.
|
||||
* @var bool
|
||||
*/
|
||||
protected $slashParameterEnabled = false;
|
||||
protected bool $slashParameterEnabled = false;
|
||||
|
||||
/**
|
||||
* Default regular expression used for parsing parameters.
|
||||
* @var string|null
|
||||
*/
|
||||
protected $defaultParameterRegex;
|
||||
protected $paramModifiers = '{}';
|
||||
protected $paramOptionalSymbol = '?';
|
||||
protected $urlRegex = '/^%s\/?$/u';
|
||||
protected $group;
|
||||
protected $parent;
|
||||
protected ?string $defaultParameterRegex = null;
|
||||
protected string $paramModifiers = '{}';
|
||||
protected string $paramOptionalSymbol = '?';
|
||||
protected string $urlRegex = '/^%s\/?$/u';
|
||||
protected ?IGroupRoute $group = null;
|
||||
protected ?IRoute $parent = null;
|
||||
/**
|
||||
* @var string|callable|null
|
||||
*/
|
||||
protected $callback;
|
||||
protected $defaultNamespace;
|
||||
protected ?string $defaultNamespace = null;
|
||||
|
||||
/* Default options */
|
||||
protected $namespace;
|
||||
protected $requestMethods = [];
|
||||
protected $where = [];
|
||||
protected $parameters = [];
|
||||
protected $originalParameters = [];
|
||||
protected $middlewares = [];
|
||||
protected ?string $namespace = null;
|
||||
protected array $requestMethods = [];
|
||||
protected array $where = [];
|
||||
protected array $parameters = [];
|
||||
protected array $originalParameters = [];
|
||||
protected array $middlewares = [];
|
||||
|
||||
/**
|
||||
* Render route
|
||||
|
||||
@@ -6,10 +6,10 @@ use Pecee\Http\Request;
|
||||
|
||||
class RouteController extends LoadableRoute implements IControllerRoute
|
||||
{
|
||||
protected $defaultMethod = 'index';
|
||||
protected $controller;
|
||||
protected $method;
|
||||
protected $names = [];
|
||||
protected string $defaultMethod = 'index';
|
||||
protected string $controller;
|
||||
protected ?string $method = null;
|
||||
protected array $names = [];
|
||||
|
||||
public function __construct($url, $controller)
|
||||
{
|
||||
|
||||
@@ -7,12 +7,12 @@ use Pecee\SimpleRouter\Handlers\IExceptionHandler;
|
||||
|
||||
class RouteGroup extends Route implements IGroupRoute
|
||||
{
|
||||
protected $urlRegex = '/^%s\/?/u';
|
||||
protected $prefix;
|
||||
protected $name;
|
||||
protected $domains = [];
|
||||
protected $exceptionHandlers = [];
|
||||
protected $mergeExceptionHandlers = true;
|
||||
protected string $urlRegex = '/^%s\/?/u';
|
||||
protected ?string $prefix = null;
|
||||
protected ?string $name = null;
|
||||
protected array $domains = [];
|
||||
protected array $exceptionHandlers = [];
|
||||
protected bool $mergeExceptionHandlers = true;
|
||||
|
||||
/**
|
||||
* Method called to check if a domain matches
|
||||
@@ -22,7 +22,7 @@ class RouteGroup extends Route implements IGroupRoute
|
||||
*/
|
||||
public function matchDomain(Request $request): bool
|
||||
{
|
||||
if ($this->domains === null || count($this->domains) === 0) {
|
||||
if (count($this->domains) === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ use Pecee\Http\Request;
|
||||
|
||||
class RouteResource extends LoadableRoute implements IControllerRoute
|
||||
{
|
||||
protected $urls = [
|
||||
protected array $urls = [
|
||||
'index' => '',
|
||||
'create' => 'create',
|
||||
'store' => '',
|
||||
@@ -16,7 +16,7 @@ class RouteResource extends LoadableRoute implements IControllerRoute
|
||||
'destroy' => '',
|
||||
];
|
||||
|
||||
protected $methodNames = [
|
||||
protected array $methodNames = [
|
||||
'index' => 'index',
|
||||
'create' => 'create',
|
||||
'store' => 'store',
|
||||
@@ -26,8 +26,8 @@ class RouteResource extends LoadableRoute implements IControllerRoute
|
||||
'destroy' => 'destroy',
|
||||
];
|
||||
|
||||
protected $names = [];
|
||||
protected $controller;
|
||||
protected array $names = [];
|
||||
protected string $controller;
|
||||
|
||||
public function __construct($url, $controller)
|
||||
{
|
||||
|
||||
@@ -28,56 +28,56 @@ class Router
|
||||
* Current request
|
||||
* @var Request
|
||||
*/
|
||||
protected $request;
|
||||
protected Request $request;
|
||||
|
||||
/**
|
||||
* Defines if a route is currently being processed.
|
||||
* @var bool
|
||||
*/
|
||||
protected $isProcessingRoute;
|
||||
protected bool $isProcessingRoute;
|
||||
|
||||
/**
|
||||
* Defines all data from current processing route.
|
||||
* @var ILoadableRoute
|
||||
*/
|
||||
protected $currentProcessingRoute;
|
||||
protected ILoadableRoute $currentProcessingRoute;
|
||||
|
||||
/**
|
||||
* All added routes
|
||||
* @var array
|
||||
*/
|
||||
protected $routes = [];
|
||||
protected array $routes = [];
|
||||
|
||||
/**
|
||||
* List of processed routes
|
||||
* @var array|ILoadableRoute[]
|
||||
*/
|
||||
protected $processedRoutes = [];
|
||||
protected array $processedRoutes = [];
|
||||
|
||||
/**
|
||||
* Stack of routes used to keep track of sub-routes added
|
||||
* when a route is being processed.
|
||||
* @var array
|
||||
*/
|
||||
protected $routeStack = [];
|
||||
protected array$routeStack = [];
|
||||
|
||||
/**
|
||||
* List of added bootmanagers
|
||||
* @var array
|
||||
*/
|
||||
protected $bootManagers = [];
|
||||
protected array $bootManagers = [];
|
||||
|
||||
/**
|
||||
* Csrf verifier class
|
||||
* @var BaseCsrfVerifier|null
|
||||
*/
|
||||
protected $csrfVerifier;
|
||||
protected ?BaseCsrfVerifier $csrfVerifier;
|
||||
|
||||
/**
|
||||
* Get exception handlers
|
||||
* @var array
|
||||
*/
|
||||
protected $exceptionHandlers = [];
|
||||
protected array $exceptionHandlers = [];
|
||||
|
||||
/**
|
||||
* List of loaded exception that has been loaded.
|
||||
@@ -85,44 +85,44 @@ class Router
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $loadedExceptionHandlers = [];
|
||||
protected array $loadedExceptionHandlers = [];
|
||||
|
||||
/**
|
||||
* Enable or disabled debugging
|
||||
* @var bool
|
||||
*/
|
||||
protected $debugEnabled = false;
|
||||
protected bool $debugEnabled = false;
|
||||
|
||||
/**
|
||||
* The start time used when debugging is enabled
|
||||
* @var float
|
||||
*/
|
||||
protected $debugStartTime;
|
||||
protected float $debugStartTime;
|
||||
|
||||
/**
|
||||
* List containing all debug messages
|
||||
* @var array
|
||||
*/
|
||||
protected $debugList = [];
|
||||
protected array $debugList = [];
|
||||
|
||||
/**
|
||||
* Contains any registered event-handler.
|
||||
* @var array
|
||||
*/
|
||||
protected $eventHandlers = [];
|
||||
protected array $eventHandlers = [];
|
||||
|
||||
/**
|
||||
* Class loader instance
|
||||
* @var IClassLoader
|
||||
*/
|
||||
protected $classLoader;
|
||||
protected IClassLoader $classLoader;
|
||||
|
||||
/**
|
||||
* When enabled the router will render all routes that matches.
|
||||
* When disabled the router will stop execution when first route is found.
|
||||
* @var bool
|
||||
*/
|
||||
protected $renderMultipleRoutes = false;
|
||||
protected bool $renderMultipleRoutes = false;
|
||||
|
||||
/**
|
||||
* Router constructor.
|
||||
@@ -345,7 +345,7 @@ class Router
|
||||
try {
|
||||
/* Verify csrf token for request */
|
||||
$this->csrfVerifier->handle($this->request);
|
||||
} catch(\Exception $e) {
|
||||
} catch(Exception $e) {
|
||||
$this->handleException($e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,19 +37,19 @@ class SimpleRouter
|
||||
* Default namespace added to all routes
|
||||
* @var string|null
|
||||
*/
|
||||
protected static $defaultNamespace;
|
||||
protected static ?string $defaultNamespace = null;
|
||||
|
||||
/**
|
||||
* The response object
|
||||
* @var Response
|
||||
*/
|
||||
protected static $response;
|
||||
protected static Response $response;
|
||||
|
||||
/**
|
||||
* Router instance
|
||||
* @var Router
|
||||
*/
|
||||
protected static $router;
|
||||
protected static ?Router $router = null;
|
||||
|
||||
/**
|
||||
* Start routing
|
||||
@@ -493,7 +493,7 @@ class SimpleRouter
|
||||
* Prepends the default namespace to all new routes added.
|
||||
*
|
||||
* @param ILoadableRoute|IRoute $route
|
||||
* @return IRoute
|
||||
* @return IRoute|ILoadableRoute
|
||||
*/
|
||||
public static function addDefaultNamespace(IRoute $route): IRoute
|
||||
{
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
class DummyCsrfVerifier extends \Pecee\Http\Middleware\BaseCsrfVerifier {
|
||||
|
||||
protected $except = [
|
||||
protected ?array $except = [
|
||||
'/exclude-page',
|
||||
'/exclude-all/*',
|
||||
];
|
||||
|
||||
protected $include = [
|
||||
protected ?array $include = [
|
||||
'/exclude-all/include-page',
|
||||
];
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
class IpRestrictMiddleware extends \Pecee\Http\Middleware\IpRestrictAccess {
|
||||
|
||||
protected $ipBlacklist = [
|
||||
protected array $ipBlacklist = [
|
||||
'5.5.5.5',
|
||||
'8.8.*',
|
||||
];
|
||||
|
||||
protected $ipWhitelist = [
|
||||
protected array $ipWhitelist = [
|
||||
'8.8.2.2',
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user