From b42de67ed88b80f08e42a96eeffbc3c3793499dc Mon Sep 17 00:00:00 2001 From: Sergei Filatov Date: Mon, 23 Oct 2023 15:04:44 +0300 Subject: [PATCH] added #[\ReturnTypeWillChange] --- Slim/App.php | 25 ++++++++++ Slim/CallableResolver.php | 4 ++ Slim/CallableResolverAwareTrait.php | 1 + Slim/Collection.php | 14 ++++++ Slim/Container.php | 4 ++ Slim/DefaultServicesProvider.php | 1 + Slim/DeferredCallable.php | 2 + Slim/Exception/InvalidMethodException.php | 1 + Slim/Exception/MethodNotAllowedException.php | 1 + Slim/Exception/SlimException.php | 2 + Slim/Handlers/AbstractError.php | 3 ++ Slim/Handlers/AbstractHandler.php | 1 + Slim/Handlers/Error.php | 7 +++ Slim/Handlers/NotAllowed.php | 5 ++ Slim/Handlers/NotFound.php | 5 ++ Slim/Handlers/PhpError.php | 6 +++ Slim/Handlers/Strategies/RequestResponse.php | 1 + .../Strategies/RequestResponseArgs.php | 1 + Slim/Http/Cookies.php | 5 ++ Slim/Http/Environment.php | 1 + Slim/Http/Headers.php | 11 ++++- Slim/Http/Message.php | 11 +++++ Slim/Http/NonBufferedBody.php | 10 ++++ Slim/Http/Request.php | 46 +++++++++++++++++++ Slim/Http/Response.php | 19 ++++++++ Slim/Http/Stream.php | 18 ++++++++ Slim/Http/UploadedFile.php | 9 ++++ Slim/Http/Uri.php | 26 +++++++++++ Slim/Interfaces/CallableResolverInterface.php | 1 + Slim/Interfaces/CollectionInterface.php | 5 ++ Slim/Interfaces/Http/CookiesInterface.php | 4 ++ Slim/Interfaces/Http/EnvironmentInterface.php | 1 + Slim/Interfaces/Http/HeadersInterface.php | 1 + .../InvocationStrategyInterface.php | 1 + Slim/Interfaces/RouteGroupInterface.php | 2 + Slim/Interfaces/RouteInterface.php | 12 +++++ Slim/Interfaces/RouterInterface.php | 8 ++++ Slim/MiddlewareAwareTrait.php | 3 ++ Slim/Routable.php | 5 ++ Slim/Route.php | 16 +++++++ Slim/RouteGroup.php | 1 + Slim/Router.php | 20 ++++++++ 42 files changed, 319 insertions(+), 1 deletion(-) diff --git a/Slim/App.php b/Slim/App.php index 21cfa5d6..47157f07 100644 --- a/Slim/App.php +++ b/Slim/App.php @@ -71,6 +71,7 @@ public function __construct($container = []) * * @return ContainerInterface */ + #[\ReturnTypeWillChange] public function getContainer() { return $this->container; @@ -85,6 +86,7 @@ public function getContainer() * * @return static */ + #[\ReturnTypeWillChange] public function add($callable) { return $this->addMiddleware(new DeferredCallable($callable, $this->container)); @@ -101,6 +103,7 @@ public function add($callable) * * @throws BadMethodCallException */ + #[\ReturnTypeWillChange] public function __call($method, $args) { if ($this->container->has($method)) { @@ -121,6 +124,7 @@ public function __call($method, $args) * * @return RouteInterface */ + #[\ReturnTypeWillChange] public function get($pattern, $callable) { return $this->map(['GET'], $pattern, $callable); @@ -134,6 +138,7 @@ public function get($pattern, $callable) * * @return RouteInterface */ + #[\ReturnTypeWillChange] public function post($pattern, $callable) { return $this->map(['POST'], $pattern, $callable); @@ -147,6 +152,7 @@ public function post($pattern, $callable) * * @return RouteInterface */ + #[\ReturnTypeWillChange] public function put($pattern, $callable) { return $this->map(['PUT'], $pattern, $callable); @@ -160,6 +166,7 @@ public function put($pattern, $callable) * * @return RouteInterface */ + #[\ReturnTypeWillChange] public function patch($pattern, $callable) { return $this->map(['PATCH'], $pattern, $callable); @@ -173,6 +180,7 @@ public function patch($pattern, $callable) * * @return RouteInterface */ + #[\ReturnTypeWillChange] public function delete($pattern, $callable) { return $this->map(['DELETE'], $pattern, $callable); @@ -186,6 +194,7 @@ public function delete($pattern, $callable) * * @return RouteInterface */ + #[\ReturnTypeWillChange] public function options($pattern, $callable) { return $this->map(['OPTIONS'], $pattern, $callable); @@ -199,6 +208,7 @@ public function options($pattern, $callable) * * @return RouteInterface */ + #[\ReturnTypeWillChange] public function any($pattern, $callable) { return $this->map(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], $pattern, $callable); @@ -213,6 +223,7 @@ public function any($pattern, $callable) * * @return RouteInterface */ + #[\ReturnTypeWillChange] public function map(array $methods, $pattern, $callable) { if ($callable instanceof Closure) { @@ -240,6 +251,7 @@ public function map(array $methods, $pattern, $callable) * * @return RouteInterface */ + #[\ReturnTypeWillChange] public function redirect($from, $to, $status = 302) { $handler = function ($request, ResponseInterface $response) use ($to, $status) { @@ -261,6 +273,7 @@ public function redirect($from, $to, $status = 302) * * @return RouteGroupInterface */ + #[\ReturnTypeWillChange] public function group($pattern, $callable) { /** @var RouterInterface $router */ @@ -288,6 +301,7 @@ public function group($pattern, $callable) * @throws Exception * @throws Throwable */ + #[\ReturnTypeWillChange] public function run($silent = false) { $response = $this->container->get('response'); @@ -338,6 +352,7 @@ public function run($silent = false) * * @throws ContainerException */ + #[\ReturnTypeWillChange] protected function processInvalidMethod(ServerRequestInterface $request, ResponseInterface $response) { $router = $this->container->get('router'); @@ -373,6 +388,7 @@ protected function processInvalidMethod(ServerRequestInterface $request, Respons * @throws Exception * @throws Throwable */ + #[\ReturnTypeWillChange] public function process(ServerRequestInterface $request, ResponseInterface $response) { // Ensure basePath is set @@ -404,6 +420,7 @@ public function process(ServerRequestInterface $request, ResponseInterface $resp * * @param ResponseInterface $response */ + #[\ReturnTypeWillChange] public function respond(ResponseInterface $response) { // Send response @@ -484,6 +501,7 @@ public function respond(ResponseInterface $response) * @throws MethodNotAllowedException * @throws NotFoundException */ + #[\ReturnTypeWillChange] public function __invoke(ServerRequestInterface $request, ResponseInterface $response) { // Get the route info @@ -540,6 +558,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res * @throws MethodNotAllowedException * @throws NotFoundException */ + #[\ReturnTypeWillChange] public function subRequest( $method, $path, @@ -573,6 +592,7 @@ public function subRequest( * * @return ServerRequestInterface */ + #[\ReturnTypeWillChange] protected function dispatchRouterAndPrepareRoute(ServerRequestInterface $request, RouterInterface $router) { $routeInfo = $router->dispatch($request); @@ -604,6 +624,7 @@ protected function dispatchRouterAndPrepareRoute(ServerRequestInterface $request * * @throws RuntimeException */ + #[\ReturnTypeWillChange] protected function finalize(ResponseInterface $response) { // stop PHP sending a Content-Type automatically @@ -645,6 +666,7 @@ protected function finalize(ResponseInterface $response) * * @return bool */ + #[\ReturnTypeWillChange] protected function isEmptyResponse(ResponseInterface $response) { if (method_exists($response, 'isEmpty')) { @@ -661,6 +683,7 @@ protected function isEmptyResponse(ResponseInterface $response) * * @return bool */ + #[\ReturnTypeWillChange] protected function isHeadRequest(RequestInterface $request) { $method = $request->getMethod(); @@ -679,6 +702,7 @@ protected function isHeadRequest(RequestInterface $request) * * @throws Exception If a handler is needed and not found */ + #[\ReturnTypeWillChange] protected function handleException(Exception $e, ServerRequestInterface $request, ResponseInterface $response) { if ($e instanceof MethodNotAllowedException) { @@ -718,6 +742,7 @@ protected function handleException(Exception $e, ServerRequestInterface $request * * @throws Throwable */ + #[\ReturnTypeWillChange] protected function handlePhpError(Throwable $e, ServerRequestInterface $request, ResponseInterface $response) { $handler = 'phpErrorHandler'; diff --git a/Slim/CallableResolver.php b/Slim/CallableResolver.php index 577e9df2..206c6ba7 100644 --- a/Slim/CallableResolver.php +++ b/Slim/CallableResolver.php @@ -45,6 +45,7 @@ public function __construct(ContainerInterface $container) * @throws RuntimeException If the callable does not exist * @throws RuntimeException If the callable is not resolvable */ + #[\ReturnTypeWillChange] public function resolve($toResolve) { if (is_callable($toResolve)) { @@ -69,6 +70,7 @@ public function resolve($toResolve) * * @return array */ + #[\ReturnTypeWillChange] protected function parseCallable($toResolve) { if (preg_match(self::CALLABLE_PATTERN, $toResolve, $matches)) { @@ -89,6 +91,7 @@ protected function parseCallable($toResolve) * * @throws RuntimeException if the callable does not exist */ + #[\ReturnTypeWillChange] protected function resolveCallable($class, $method) { if ($this->container->has($class)) { @@ -107,6 +110,7 @@ protected function resolveCallable($class, $method) * * @throws RuntimeException if the callable is not resolvable */ + #[\ReturnTypeWillChange] protected function assertCallable($callable) { if (!is_callable($callable)) { diff --git a/Slim/CallableResolverAwareTrait.php b/Slim/CallableResolverAwareTrait.php index cdf7367b..0a1e5630 100644 --- a/Slim/CallableResolverAwareTrait.php +++ b/Slim/CallableResolverAwareTrait.php @@ -29,6 +29,7 @@ trait CallableResolverAwareTrait * * @throws RuntimeException If the string cannot be resolved as a callable */ + #[\ReturnTypeWillChange] protected function resolveCallable($callable) { if (!$this->container instanceof ContainerInterface) { diff --git a/Slim/Collection.php b/Slim/Collection.php index 2eaec44a..18adfd4e 100644 --- a/Slim/Collection.php +++ b/Slim/Collection.php @@ -37,6 +37,7 @@ public function __construct(array $items = []) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function set($key, $value) { $this->data[$key] = $value; @@ -45,6 +46,7 @@ public function set($key, $value) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function get($key, $default = null) { return $this->has($key) ? $this->data[$key] : $default; @@ -53,6 +55,7 @@ public function get($key, $default = null) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function replace(array $items) { foreach ($items as $key => $value) { @@ -63,6 +66,7 @@ public function replace(array $items) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function all() { return $this->data; @@ -73,6 +77,7 @@ public function all() * * @return array The collection's source data keys */ + #[\ReturnTypeWillChange] public function keys() { return array_keys($this->data); @@ -81,6 +86,7 @@ public function keys() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function has($key) { return array_key_exists($key, $this->data); @@ -89,6 +95,7 @@ public function has($key) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function remove($key) { unset($this->data[$key]); @@ -97,6 +104,7 @@ public function remove($key) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function clear() { $this->data = []; @@ -109,6 +117,7 @@ public function clear() * * @return bool */ + #[\ReturnTypeWillChange] public function offsetExists($key) { return $this->has($key); @@ -121,6 +130,7 @@ public function offsetExists($key) * * @return mixed The key's value, or the default value */ + #[\ReturnTypeWillChange] public function offsetGet($key) { return $this->get($key); @@ -132,6 +142,7 @@ public function offsetGet($key) * @param string $key The data key * @param mixed $value The data value */ + #[\ReturnTypeWillChange] public function offsetSet($key, $value) { $this->set($key, $value); @@ -142,6 +153,7 @@ public function offsetSet($key, $value) * * @param string $key The data key */ + #[\ReturnTypeWillChange] public function offsetUnset($key) { $this->remove($key); @@ -152,6 +164,7 @@ public function offsetUnset($key) * * @return int */ + #[\ReturnTypeWillChange] public function count() { return count($this->data); @@ -162,6 +175,7 @@ public function count() * * @return ArrayIterator */ + #[\ReturnTypeWillChange] public function getIterator() { return new ArrayIterator($this->data); diff --git a/Slim/Container.php b/Slim/Container.php index 01a592fc..29c1c876 100644 --- a/Slim/Container.php +++ b/Slim/Container.php @@ -70,6 +70,7 @@ public function __construct(array $values = []) * * @return void */ + #[\ReturnTypeWillChange] private function registerDefaultServices($userSettings) { $defaultSettings = $this->defaultSettings; @@ -100,6 +101,7 @@ private function registerDefaultServices($userSettings) * @throws ContainerValueNotFoundException No entry was found for this identifier. * @throws ContainerExceptionInterface Error while retrieving the entry. */ + #[\ReturnTypeWillChange] public function get($id) { if (!$this->offsetExists($id)) { @@ -128,6 +130,7 @@ public function get($id) * * @return bool */ + #[\ReturnTypeWillChange] private function exceptionThrownByContainer(InvalidArgumentException $exception) { $trace = $exception->getTrace()[0]; @@ -143,6 +146,7 @@ private function exceptionThrownByContainer(InvalidArgumentException $exception) * * @return boolean */ + #[\ReturnTypeWillChange] public function has($id) { return $this->offsetExists($id); diff --git a/Slim/DefaultServicesProvider.php b/Slim/DefaultServicesProvider.php index 48a8d6e0..087abf82 100644 --- a/Slim/DefaultServicesProvider.php +++ b/Slim/DefaultServicesProvider.php @@ -29,6 +29,7 @@ class DefaultServicesProvider * * @param Container $container A DI container implementing ArrayAccess and psr/container. */ + #[\ReturnTypeWillChange] public function register($container) { if (!isset($container['environment'])) { diff --git a/Slim/DeferredCallable.php b/Slim/DeferredCallable.php index 5f335841..0b3542f3 100644 --- a/Slim/DeferredCallable.php +++ b/Slim/DeferredCallable.php @@ -37,6 +37,7 @@ public function __construct($callable, ContainerInterface $container = null) /** * @return callable|string */ + #[\ReturnTypeWillChange] public function getCallable() { return $this->callable; @@ -45,6 +46,7 @@ public function getCallable() /** * @return mixed */ + #[\ReturnTypeWillChange] public function __invoke() { $callable = $this->resolveCallable($this->callable); diff --git a/Slim/Exception/InvalidMethodException.php b/Slim/Exception/InvalidMethodException.php index 7bbc3fd8..7e5b006f 100644 --- a/Slim/Exception/InvalidMethodException.php +++ b/Slim/Exception/InvalidMethodException.php @@ -30,6 +30,7 @@ public function __construct(ServerRequestInterface $request, $method) /** * @return ServerRequestInterface */ + #[\ReturnTypeWillChange] public function getRequest() { return $this->request; diff --git a/Slim/Exception/MethodNotAllowedException.php b/Slim/Exception/MethodNotAllowedException.php index 20d38248..aee7e155 100644 --- a/Slim/Exception/MethodNotAllowedException.php +++ b/Slim/Exception/MethodNotAllowedException.php @@ -31,6 +31,7 @@ public function __construct(ServerRequestInterface $request, ResponseInterface $ /** * @return string[] */ + #[\ReturnTypeWillChange] public function getAllowedMethods() { return $this->allowedMethods; diff --git a/Slim/Exception/SlimException.php b/Slim/Exception/SlimException.php index 5b15a4a0..0a883c02 100644 --- a/Slim/Exception/SlimException.php +++ b/Slim/Exception/SlimException.php @@ -37,6 +37,7 @@ public function __construct(ServerRequestInterface $request, ResponseInterface $ /** * @return ServerRequestInterface */ + #[\ReturnTypeWillChange] public function getRequest() { return $this->request; @@ -45,6 +46,7 @@ public function getRequest() /** * @return ResponseInterface */ + #[\ReturnTypeWillChange] public function getResponse() { return $this->response; diff --git a/Slim/Handlers/AbstractError.php b/Slim/Handlers/AbstractError.php index 256062f7..cf510eb8 100644 --- a/Slim/Handlers/AbstractError.php +++ b/Slim/Handlers/AbstractError.php @@ -32,6 +32,7 @@ public function __construct($displayErrorDetails = false) * * @return void */ + #[\ReturnTypeWillChange] protected function writeToErrorLog($throwable) { if ($this->displayErrorDetails) { @@ -57,6 +58,7 @@ protected function writeToErrorLog($throwable) * * @return string */ + #[\ReturnTypeWillChange] protected function renderThrowableAsText($throwable) { $text = sprintf('Type: %s' . PHP_EOL, get_class($throwable)); @@ -89,6 +91,7 @@ protected function renderThrowableAsText($throwable) * * @param string $message */ + #[\ReturnTypeWillChange] protected function logError($message) { error_log($message); diff --git a/Slim/Handlers/AbstractHandler.php b/Slim/Handlers/AbstractHandler.php index 5ace9a0f..2fd2cd6c 100644 --- a/Slim/Handlers/AbstractHandler.php +++ b/Slim/Handlers/AbstractHandler.php @@ -34,6 +34,7 @@ abstract class AbstractHandler * * @return string */ + #[\ReturnTypeWillChange] protected function determineContentType(ServerRequestInterface $request) { $acceptHeader = $request->getHeaderLine('Accept'); diff --git a/Slim/Handlers/Error.php b/Slim/Handlers/Error.php index 50ece965..1f123394 100644 --- a/Slim/Handlers/Error.php +++ b/Slim/Handlers/Error.php @@ -25,6 +25,7 @@ class Error extends AbstractError * * @throws UnexpectedValueException */ + #[\ReturnTypeWillChange] public function __invoke(ServerRequestInterface $request, ResponseInterface $response, Exception $exception) { $contentType = $this->determineContentType($request); @@ -64,6 +65,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res * * @return string */ + #[\ReturnTypeWillChange] protected function renderHtmlErrorMessage(Exception $exception) { $title = 'Slim Application Error'; @@ -103,6 +105,7 @@ protected function renderHtmlErrorMessage(Exception $exception) * * @return string */ + #[\ReturnTypeWillChange] protected function renderHtmlException(Exception $exception) { return $this->renderHtmlExceptionOrError($exception); @@ -117,6 +120,7 @@ protected function renderHtmlException(Exception $exception) * * @throws RuntimeException */ + #[\ReturnTypeWillChange] protected function renderHtmlExceptionOrError($exception) { if (!$exception instanceof Exception && !$exception instanceof \Error) { @@ -156,6 +160,7 @@ protected function renderHtmlExceptionOrError($exception) * * @return string */ + #[\ReturnTypeWillChange] protected function renderJsonErrorMessage(Exception $exception) { $error = [ @@ -187,6 +192,7 @@ protected function renderJsonErrorMessage(Exception $exception) * * @return string */ + #[\ReturnTypeWillChange] protected function renderXmlErrorMessage(Exception $exception) { $xml = "\n Slim Application Error\n"; @@ -214,6 +220,7 @@ protected function renderXmlErrorMessage(Exception $exception) * * @return string */ + #[\ReturnTypeWillChange] private function createCdataSection($content) { return sprintf('', str_replace(']]>', ']]]]>', $content)); diff --git a/Slim/Handlers/NotAllowed.php b/Slim/Handlers/NotAllowed.php index 5eba80be..3b80376d 100644 --- a/Slim/Handlers/NotAllowed.php +++ b/Slim/Handlers/NotAllowed.php @@ -23,6 +23,7 @@ class NotAllowed extends AbstractHandler * * @throws UnexpectedValueException */ + #[\ReturnTypeWillChange] public function __invoke(ServerRequestInterface $request, ResponseInterface $response, array $methods) { if ($request->getMethod() === 'OPTIONS') { @@ -68,6 +69,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res * * @return string */ + #[\ReturnTypeWillChange] protected function renderPlainOptionsMessage($methods) { $allow = implode(', ', $methods); @@ -82,6 +84,7 @@ protected function renderPlainOptionsMessage($methods) * * @return string */ + #[\ReturnTypeWillChange] protected function renderJsonNotAllowedMessage($methods) { $allow = implode(', ', $methods); @@ -96,6 +99,7 @@ protected function renderJsonNotAllowedMessage($methods) * * @return string */ + #[\ReturnTypeWillChange] protected function renderXmlNotAllowedMessage($methods) { $allow = implode(', ', $methods); @@ -110,6 +114,7 @@ protected function renderXmlNotAllowedMessage($methods) * * @return string */ + #[\ReturnTypeWillChange] protected function renderHtmlNotAllowedMessage($methods) { $allow = implode(', ', $methods); diff --git a/Slim/Handlers/NotFound.php b/Slim/Handlers/NotFound.php index f0d013c6..49090d48 100644 --- a/Slim/Handlers/NotFound.php +++ b/Slim/Handlers/NotFound.php @@ -22,6 +22,7 @@ class NotFound extends AbstractHandler * * @throws UnexpectedValueException */ + #[\ReturnTypeWillChange] public function __invoke(ServerRequestInterface $request, ResponseInterface $response) { if ($request->getMethod() === 'OPTIONS') { @@ -61,6 +62,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res * * @return string */ + #[\ReturnTypeWillChange] protected function renderPlainNotFoundOutput() { return 'Not found'; @@ -71,6 +73,7 @@ protected function renderPlainNotFoundOutput() * * @return string */ + #[\ReturnTypeWillChange] protected function renderJsonNotFoundOutput() { return '{"message":"Not found"}'; @@ -81,6 +84,7 @@ protected function renderJsonNotFoundOutput() * * @return string */ + #[\ReturnTypeWillChange] protected function renderXmlNotFoundOutput() { return 'Not found'; @@ -93,6 +97,7 @@ protected function renderXmlNotFoundOutput() * * @return string */ + #[\ReturnTypeWillChange] protected function renderHtmlNotFoundOutput(ServerRequestInterface $request) { $homeUrl = (string)($request->getUri()->withPath('')->withQuery('')->withFragment('')); diff --git a/Slim/Handlers/PhpError.php b/Slim/Handlers/PhpError.php index 28c74162..839a8f65 100644 --- a/Slim/Handlers/PhpError.php +++ b/Slim/Handlers/PhpError.php @@ -24,6 +24,7 @@ class PhpError extends AbstractError * * @throws UnexpectedValueException */ + #[\ReturnTypeWillChange] public function __invoke(ServerRequestInterface $request, ResponseInterface $response, Throwable $error) { $contentType = $this->determineContentType($request); @@ -62,6 +63,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res * * @return string */ + #[\ReturnTypeWillChange] protected function renderHtmlErrorMessage(Throwable $error) { $title = 'Slim Application Error'; @@ -99,6 +101,7 @@ protected function renderHtmlErrorMessage(Throwable $error) * * @return string */ + #[\ReturnTypeWillChange] protected function renderHtmlError(Throwable $error) { $html = sprintf('
Type: %s
', get_class($error)); @@ -134,6 +137,7 @@ protected function renderHtmlError(Throwable $error) * * @return string */ + #[\ReturnTypeWillChange] protected function renderJsonErrorMessage(Throwable $error) { $json = [ @@ -165,6 +169,7 @@ protected function renderJsonErrorMessage(Throwable $error) * * @return string */ + #[\ReturnTypeWillChange] protected function renderXmlErrorMessage(Throwable $error) { $xml = "\n Slim Application Error\n"; @@ -192,6 +197,7 @@ protected function renderXmlErrorMessage(Throwable $error) * * @return string */ + #[\ReturnTypeWillChange] private function createCdataSection($content) { return sprintf('', str_replace(']]>', ']]]]>', $content)); diff --git a/Slim/Handlers/Strategies/RequestResponse.php b/Slim/Handlers/Strategies/RequestResponse.php index d91b05ae..4d0d804e 100644 --- a/Slim/Handlers/Strategies/RequestResponse.php +++ b/Slim/Handlers/Strategies/RequestResponse.php @@ -27,6 +27,7 @@ class RequestResponse implements InvocationStrategyInterface * * @return ResponseInterface */ + #[\ReturnTypeWillChange] public function __invoke( callable $callable, ServerRequestInterface $request, diff --git a/Slim/Handlers/Strategies/RequestResponseArgs.php b/Slim/Handlers/Strategies/RequestResponseArgs.php index d0729145..92db3dc9 100644 --- a/Slim/Handlers/Strategies/RequestResponseArgs.php +++ b/Slim/Handlers/Strategies/RequestResponseArgs.php @@ -28,6 +28,7 @@ class RequestResponseArgs implements InvocationStrategyInterface * * @return ResponseInterface */ + #[\ReturnTypeWillChange] public function __invoke( callable $callable, ServerRequestInterface $request, diff --git a/Slim/Http/Cookies.php b/Slim/Http/Cookies.php index db73a7d8..05a06a42 100644 --- a/Slim/Http/Cookies.php +++ b/Slim/Http/Cookies.php @@ -55,6 +55,7 @@ public function __construct(array $cookies = []) * * @param array $settings */ + #[\ReturnTypeWillChange] public function setDefaults(array $settings) { $this->defaults = array_replace($this->defaults, $settings); @@ -71,6 +72,7 @@ public function get($name, $default = null) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function set($name, $value) { if (!is_array($value)) { @@ -82,6 +84,7 @@ public function set($name, $value) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function toHeaders() { $headers = []; @@ -100,6 +103,7 @@ public function toHeaders() * * @return string */ + #[\ReturnTypeWillChange] protected function toHeader($name, array $properties) { $result = urlencode($name) . '=' . urlencode($properties['value']); @@ -147,6 +151,7 @@ protected function toHeader($name, array $properties) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public static function parseHeader($header) { if (is_array($header) === true) { diff --git a/Slim/Http/Environment.php b/Slim/Http/Environment.php index 11089d98..39fa65e4 100644 --- a/Slim/Http/Environment.php +++ b/Slim/Http/Environment.php @@ -20,6 +20,7 @@ class Environment extends Collection implements EnvironmentInterface /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public static function mock(array $settings = []) { //Validates if default protocol is HTTPS to set default port 443 diff --git a/Slim/Http/Headers.php b/Slim/Http/Headers.php index f2eec7ce..cece701a 100644 --- a/Slim/Http/Headers.php +++ b/Slim/Http/Headers.php @@ -44,6 +44,7 @@ class Headers extends Collection implements HeadersInterface * * @return self */ + #[\ReturnTypeWillChange] public static function createFromEnvironment(Environment $environment) { $data = []; @@ -67,7 +68,7 @@ public static function createFromEnvironment(Environment $environment) * * @return Environment */ - + #[\ReturnTypeWillChange] public static function determineAuthorization(Environment $environment) { $authorization = $environment->get('HTTP_AUTHORIZATION'); @@ -94,6 +95,7 @@ public static function determineAuthorization(Environment $environment) * * @return array */ + #[\ReturnTypeWillChange] public function all() { $all = parent::all(); @@ -114,6 +116,7 @@ public function all() * @param string $key The case-insensitive header name * @param array|string $value The header value */ + #[\ReturnTypeWillChange] public function set($key, $value) { if (!is_array($value)) { @@ -133,6 +136,7 @@ public function set($key, $value) * * @return string[] */ + #[\ReturnTypeWillChange] public function get($key, $default = null) { if ($this->has($key)) { @@ -150,6 +154,7 @@ public function get($key, $default = null) * * @return string */ + #[\ReturnTypeWillChange] public function getOriginalKey($key, $default = null) { if ($this->has($key)) { @@ -162,6 +167,7 @@ public function getOriginalKey($key, $default = null) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function add($key, $value) { $oldValues = $this->get($key, []); @@ -176,6 +182,7 @@ public function add($key, $value) * * @return bool */ + #[\ReturnTypeWillChange] public function has($key) { return parent::has($this->normalizeKey($key)); @@ -186,6 +193,7 @@ public function has($key) * * @param string $key The case-insensitive header name */ + #[\ReturnTypeWillChange] public function remove($key) { parent::remove($this->normalizeKey($key)); @@ -194,6 +202,7 @@ public function remove($key) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function normalizeKey($key) { $key = strtr(strtolower($key), '_', '-'); diff --git a/Slim/Http/Message.php b/Slim/Http/Message.php index 0dc7b4d6..442cef57 100644 --- a/Slim/Http/Message.php +++ b/Slim/Http/Message.php @@ -64,6 +64,7 @@ public function __set($name, $value) * * @return string */ + #[\ReturnTypeWillChange] public function getProtocolVersion() { return $this->protocolVersion; @@ -85,6 +86,7 @@ public function getProtocolVersion() * * @throws InvalidArgumentException if the http version is an invalid number */ + #[\ReturnTypeWillChange] public function withProtocolVersion($version) { if (!isset(self::$validProtocolVersions[$version])) { @@ -125,6 +127,7 @@ public function withProtocolVersion($version) * * @return array */ + #[\ReturnTypeWillChange] public function getHeaders() { return $this->headers->all(); @@ -140,6 +143,7 @@ public function getHeaders() * * @return bool */ + #[\ReturnTypeWillChange] public function hasHeader($name) { return $this->headers->has($name); @@ -158,6 +162,7 @@ public function hasHeader($name) * * @return string[] */ + #[\ReturnTypeWillChange] public function getHeader($name) { return $this->headers->get($name, []); @@ -181,6 +186,7 @@ public function getHeader($name) * * @return string */ + #[\ReturnTypeWillChange] public function getHeaderLine($name) { return implode(',', $this->headers->get($name, [])); @@ -201,6 +207,7 @@ public function getHeaderLine($name) * * @return static */ + #[\ReturnTypeWillChange] public function withHeader($name, $value) { $clone = clone $this; @@ -225,6 +232,7 @@ public function withHeader($name, $value) * * @return static */ + #[\ReturnTypeWillChange] public function withAddedHeader($name, $value) { $clone = clone $this; @@ -250,6 +258,7 @@ public function withAddedHeader($name, $value) * * @return static */ + #[\ReturnTypeWillChange] public function withoutHeader($name) { $clone = clone $this; @@ -267,6 +276,7 @@ public function withoutHeader($name) * * @return StreamInterface Returns the body as a stream. */ + #[\ReturnTypeWillChange] public function getBody() { return $this->body; @@ -285,6 +295,7 @@ public function getBody() * * @return static */ + #[\ReturnTypeWillChange] public function withBody(StreamInterface $body) { $clone = clone $this; diff --git a/Slim/Http/NonBufferedBody.php b/Slim/Http/NonBufferedBody.php index 352ff590..c57815a0 100644 --- a/Slim/Http/NonBufferedBody.php +++ b/Slim/Http/NonBufferedBody.php @@ -41,6 +41,7 @@ public function detach() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getSize() { return null; @@ -49,6 +50,7 @@ public function getSize() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function tell() { return 0; @@ -57,6 +59,7 @@ public function tell() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function eof() { return true; @@ -65,6 +68,7 @@ public function eof() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function isSeekable() { return false; @@ -73,6 +77,7 @@ public function isSeekable() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function seek($offset, $whence = SEEK_SET) { } @@ -87,6 +92,7 @@ public function rewind() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function isWritable() { return true; @@ -95,6 +101,7 @@ public function isWritable() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function write($string) { $buffered = ''; @@ -112,6 +119,7 @@ public function write($string) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function isReadable() { return false; @@ -120,6 +128,7 @@ public function isReadable() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function read($length) { return ''; @@ -128,6 +137,7 @@ public function read($length) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getContents() { return ''; diff --git a/Slim/Http/Request.php b/Slim/Http/Request.php index 1ae17716..e527b243 100644 --- a/Slim/Http/Request.php +++ b/Slim/Http/Request.php @@ -131,6 +131,7 @@ class Request extends Message implements ServerRequestInterface * * @return static */ + #[\ReturnTypeWillChange] public static function createFromEnvironment(Environment $environment) { $method = $environment['REQUEST_METHOD']; @@ -257,6 +258,7 @@ public function __clone() * * @return string */ + #[\ReturnTypeWillChange] public function getMethod() { if ($this->method === null) { @@ -287,6 +289,7 @@ public function getMethod() * * @return string */ + #[\ReturnTypeWillChange] public function getOriginalMethod() { return $this->originalMethod; @@ -309,6 +312,7 @@ public function getOriginalMethod() * * @throws InvalidArgumentException for invalid HTTP methods. */ + #[\ReturnTypeWillChange] public function withMethod($method) { $method = $this->filterMethod($method); @@ -328,6 +332,7 @@ public function withMethod($method) * * @throws InvalidArgumentException on invalid HTTP method. */ + #[\ReturnTypeWillChange] protected function filterMethod($method) { if ($method === null) { @@ -358,6 +363,7 @@ protected function filterMethod($method) * * @return bool */ + #[\ReturnTypeWillChange] public function isMethod($method) { return $this->getMethod() === $method; @@ -370,6 +376,7 @@ public function isMethod($method) * * @return bool */ + #[\ReturnTypeWillChange] public function isGet() { return $this->isMethod('GET'); @@ -382,6 +389,7 @@ public function isGet() * * @return bool */ + #[\ReturnTypeWillChange] public function isPost() { return $this->isMethod('POST'); @@ -394,6 +402,7 @@ public function isPost() * * @return bool */ + #[\ReturnTypeWillChange] public function isPut() { return $this->isMethod('PUT'); @@ -406,6 +415,7 @@ public function isPut() * * @return bool */ + #[\ReturnTypeWillChange] public function isPatch() { return $this->isMethod('PATCH'); @@ -418,6 +428,7 @@ public function isPatch() * * @return bool */ + #[\ReturnTypeWillChange] public function isDelete() { return $this->isMethod('DELETE'); @@ -430,6 +441,7 @@ public function isDelete() * * @return bool */ + #[\ReturnTypeWillChange] public function isHead() { return $this->isMethod('HEAD'); @@ -442,6 +454,7 @@ public function isHead() * * @return bool */ + #[\ReturnTypeWillChange] public function isOptions() { return $this->isMethod('OPTIONS'); @@ -454,6 +467,7 @@ public function isOptions() * * @return bool */ + #[\ReturnTypeWillChange] public function isXhr() { return $this->getHeaderLine('X-Requested-With') === 'XMLHttpRequest'; @@ -475,6 +489,7 @@ public function isXhr() * * @return string */ + #[\ReturnTypeWillChange] public function getRequestTarget() { if ($this->requestTarget) { @@ -523,6 +538,7 @@ public function getRequestTarget() * * @throws InvalidArgumentException if the request target is invalid */ + #[\ReturnTypeWillChange] public function withRequestTarget($requestTarget) { if (preg_match('#\s#', $requestTarget)) { @@ -545,6 +561,7 @@ public function withRequestTarget($requestTarget) * * @return UriInterface */ + #[\ReturnTypeWillChange] public function getUri() { return $this->uri; @@ -582,6 +599,7 @@ public function getUri() * * @return static */ + #[\ReturnTypeWillChange] public function withUri(UriInterface $uri, $preserveHost = false) { $clone = clone $this; @@ -607,6 +625,7 @@ public function withUri(UriInterface $uri, $preserveHost = false) * * @return string|null */ + #[\ReturnTypeWillChange] public function getContentType() { $result = $this->getHeader('Content-Type'); @@ -621,6 +640,7 @@ public function getContentType() * * @return string|null */ + #[\ReturnTypeWillChange] public function getMediaType() { $contentType = $this->getContentType(); @@ -640,6 +660,7 @@ public function getMediaType() * * @return string[] */ + #[\ReturnTypeWillChange] public function getMediaTypeParams() { $contentType = $this->getContentType(); @@ -663,6 +684,7 @@ public function getMediaTypeParams() * * @return string|null */ + #[\ReturnTypeWillChange] public function getContentCharset() { $mediaTypeParams = $this->getMediaTypeParams(); @@ -680,6 +702,7 @@ public function getContentCharset() * * @return int|null */ + #[\ReturnTypeWillChange] public function getContentLength() { $result = $this->headers->get('Content-Length'); @@ -696,6 +719,7 @@ public function getContentLength() * * @return array */ + #[\ReturnTypeWillChange] public function getCookieParams() { return $this->cookies; @@ -711,6 +735,7 @@ public function getCookieParams() * * @return mixed */ + #[\ReturnTypeWillChange] public function getCookieParam($key, $default = null) { $cookies = $this->getCookieParams(); @@ -740,6 +765,7 @@ public function getCookieParam($key, $default = null) * * @return static */ + #[\ReturnTypeWillChange] public function withCookieParams(array $cookies) { $clone = clone $this; @@ -760,6 +786,7 @@ public function withCookieParams(array $cookies) * * @return array */ + #[\ReturnTypeWillChange] public function getQueryParams() { if (is_array($this->queryParams)) { @@ -798,6 +825,7 @@ public function getQueryParams() * * @return static */ + #[\ReturnTypeWillChange] public function withQueryParams(array $query) { $clone = clone $this; @@ -817,6 +845,7 @@ public function withQueryParams(array $query) * * @return array */ + #[\ReturnTypeWillChange] public function getUploadedFiles() { return $this->uploadedFiles; @@ -835,6 +864,7 @@ public function getUploadedFiles() * * @throws InvalidArgumentException if an invalid structure is provided. */ + #[\ReturnTypeWillChange] public function withUploadedFiles(array $uploadedFiles) { $clone = clone $this; @@ -852,6 +882,7 @@ public function withUploadedFiles(array $uploadedFiles) * * @return array */ + #[\ReturnTypeWillChange] public function getServerParams() { return $this->serverParams; @@ -867,6 +898,7 @@ public function getServerParams() * * @return mixed */ + #[\ReturnTypeWillChange] public function getServerParam($key, $default = null) { $serverParams = $this->getServerParams(); @@ -885,6 +917,7 @@ public function getServerParam($key, $default = null) * * @return array */ + #[\ReturnTypeWillChange] public function getAttributes() { return $this->attributes->all(); @@ -907,6 +940,7 @@ public function getAttributes() * * @return mixed */ + #[\ReturnTypeWillChange] public function getAttribute($name, $default = null) { return $this->attributes->get($name, $default); @@ -929,6 +963,7 @@ public function getAttribute($name, $default = null) * * @return static */ + #[\ReturnTypeWillChange] public function withAttribute($name, $value) { $clone = clone $this; @@ -953,6 +988,7 @@ public function withAttribute($name, $value) * * @return static */ + #[\ReturnTypeWillChange] public function withAttributes(array $attributes) { $clone = clone $this; @@ -977,6 +1013,7 @@ public function withAttributes(array $attributes) * * @return static */ + #[\ReturnTypeWillChange] public function withoutAttribute($name) { $clone = clone $this; @@ -1001,6 +1038,7 @@ public function withoutAttribute($name) * * @throws RuntimeException if the request body media type parser returns an invalid value */ + #[\ReturnTypeWillChange] public function getParsedBody() { if ($this->bodyParsed !== false) { @@ -1067,6 +1105,7 @@ public function getParsedBody() * @throws InvalidArgumentException if an unsupported argument type is * provided. */ + #[\ReturnTypeWillChange] public function withParsedBody($data) { if (!is_null($data) && !is_object($data) && !is_array($data)) { @@ -1086,6 +1125,7 @@ public function withParsedBody($data) * * @return $this */ + #[\ReturnTypeWillChange] public function reparseBody() { $this->bodyParsed = false; @@ -1101,6 +1141,7 @@ public function reparseBody() * @param string $mediaType A HTTP media type (excluding content-type params). * @param callable $callable A callable that returns parsed contents for media type. */ + #[\ReturnTypeWillChange] public function registerMediaTypeParser($mediaType, callable $callable) { if ($callable instanceof Closure) { @@ -1119,6 +1160,7 @@ public function registerMediaTypeParser($mediaType, callable $callable) * * @return mixed */ + #[\ReturnTypeWillChange] public function getParam($key, $default = null) { $postParams = $this->getParsedBody(); @@ -1145,6 +1187,7 @@ public function getParam($key, $default = null) * * @return mixed */ + #[\ReturnTypeWillChange] public function getParsedBodyParam($key, $default = null) { $postParams = $this->getParsedBody(); @@ -1168,6 +1211,7 @@ public function getParsedBodyParam($key, $default = null) * * @return mixed */ + #[\ReturnTypeWillChange] public function getQueryParam($key, $default = null) { $getParams = $this->getQueryParams(); @@ -1188,6 +1232,7 @@ public function getQueryParam($key, $default = null) * * @return mixed[] */ + #[\ReturnTypeWillChange] public function getParams(array $only = null) { $params = $this->getQueryParams(); @@ -1209,6 +1254,7 @@ public function getParams(array $only = null) return $params; } + #[\ReturnTypeWillChange] private static function disableXmlEntityLoader($disable) { if (\LIBXML_VERSION >= 20900) { diff --git a/Slim/Http/Response.php b/Slim/Http/Response.php index 4f572240..1f8e4aa7 100644 --- a/Slim/Http/Response.php +++ b/Slim/Http/Response.php @@ -158,6 +158,7 @@ public function __clone() * * @return int */ + #[\ReturnTypeWillChange] public function getStatusCode() { return $this->status; @@ -186,6 +187,7 @@ public function getStatusCode() * * @throws InvalidArgumentException For invalid status code arguments. */ + #[\ReturnTypeWillChange] public function withStatus($code, $reasonPhrase = '') { $code = $this->filterStatus($code); @@ -218,6 +220,7 @@ public function withStatus($code, $reasonPhrase = '') * * @throws InvalidArgumentException If an invalid HTTP status code is provided. */ + #[\ReturnTypeWillChange] protected function filterStatus($status) { if (!is_integer($status) || @@ -244,6 +247,7 @@ protected function filterStatus($status) * * @return string Reason phrase; must return an empty string if none present. */ + #[\ReturnTypeWillChange] public function getReasonPhrase() { if ($this->reasonPhrase) { @@ -268,6 +272,7 @@ public function getReasonPhrase() * * @throws InvalidArgumentException For invalid header names or values. */ + #[\ReturnTypeWillChange] public function withHeader($name, $value) { $clone = clone $this; @@ -295,6 +300,7 @@ public function withHeader($name, $value) * * @return static */ + #[\ReturnTypeWillChange] public function write($data) { $this->getBody()->write($data); @@ -315,6 +321,7 @@ public function write($data) * * @return static */ + #[\ReturnTypeWillChange] public function withRedirect($url, $status = null) { $responseWithRedirect = $this->withHeader('Location', (string)$url); @@ -346,6 +353,7 @@ public function withRedirect($url, $status = null) * * @throws RuntimeException */ + #[\ReturnTypeWillChange] public function withJson($data, $status = null, $encodingOptions = 0) { $response = $this->withBody(new Body(fopen('php://temp', 'r+'))); @@ -370,6 +378,7 @@ public function withJson($data, $status = null, $encodingOptions = 0) * * @return bool */ + #[\ReturnTypeWillChange] public function isEmpty() { return in_array( @@ -385,6 +394,7 @@ public function isEmpty() * * @return bool */ + #[\ReturnTypeWillChange] public function isInformational() { return $this->getStatusCode() >= StatusCode::HTTP_CONTINUE && $this->getStatusCode() < StatusCode::HTTP_OK; @@ -397,6 +407,7 @@ public function isInformational() * * @return bool */ + #[\ReturnTypeWillChange] public function isOk() { return $this->getStatusCode() === StatusCode::HTTP_OK; @@ -409,6 +420,7 @@ public function isOk() * * @return bool */ + #[\ReturnTypeWillChange] public function isSuccessful() { return $this->getStatusCode() >= StatusCode::HTTP_OK && @@ -422,6 +434,7 @@ public function isSuccessful() * * @return bool */ + #[\ReturnTypeWillChange] public function isRedirect() { return in_array( @@ -443,6 +456,7 @@ public function isRedirect() * * @return bool */ + #[\ReturnTypeWillChange] public function isRedirection() { return $this->getStatusCode() >= StatusCode::HTTP_MULTIPLE_CHOICES && @@ -456,6 +470,7 @@ public function isRedirection() * * @return bool */ + #[\ReturnTypeWillChange] public function isForbidden() { return $this->getStatusCode() === StatusCode::HTTP_FORBIDDEN; @@ -468,6 +483,7 @@ public function isForbidden() * * @return bool */ + #[\ReturnTypeWillChange] public function isNotFound() { return $this->getStatusCode() === StatusCode::HTTP_NOT_FOUND; @@ -480,6 +496,7 @@ public function isNotFound() * * @return bool */ + #[\ReturnTypeWillChange] public function isBadRequest() { return $this->getStatusCode() === StatusCode::HTTP_BAD_REQUEST; @@ -492,6 +509,7 @@ public function isBadRequest() * * @return bool */ + #[\ReturnTypeWillChange] public function isClientError() { return $this->getStatusCode() >= StatusCode::HTTP_BAD_REQUEST && @@ -505,6 +523,7 @@ public function isClientError() * * @return bool */ + #[\ReturnTypeWillChange] public function isServerError() { return $this->getStatusCode() >= StatusCode::HTTP_INTERNAL_SERVER_ERROR && $this->getStatusCode() < 600; diff --git a/Slim/Http/Stream.php b/Slim/Http/Stream.php index f405dc71..b930b815 100644 --- a/Slim/Http/Stream.php +++ b/Slim/Http/Stream.php @@ -108,6 +108,7 @@ public function __construct($stream) * provided. Returns a specific key value if a key is provided and the * value is found, or null if the key is not found. */ + #[\ReturnTypeWillChange] public function getMetadata($key = null) { $this->meta = stream_get_meta_data($this->stream); @@ -125,6 +126,7 @@ public function getMetadata($key = null) * * @return bool */ + #[\ReturnTypeWillChange] protected function isAttached() { return is_resource($this->stream); @@ -139,6 +141,7 @@ protected function isAttached() * * @throws InvalidArgumentException If argument is not a valid PHP resource. */ + #[\ReturnTypeWillChange] protected function attach($newStream) { if (is_resource($newStream) === false) { @@ -159,6 +162,7 @@ protected function attach($newStream) * * @return resource|null Underlying PHP stream, if any */ + #[\ReturnTypeWillChange] public function detach() { $oldResource = $this->stream; @@ -188,6 +192,7 @@ public function detach() * * @return string */ + #[\ReturnTypeWillChange] public function __toString() { if (!$this->isAttached()) { @@ -205,6 +210,7 @@ public function __toString() /** * Closes the stream and any underlying resources. */ + #[\ReturnTypeWillChange] public function close() { if ($this->isAttached() === true) { @@ -223,6 +229,7 @@ public function close() * * @return int|null Returns the size in bytes if known, or null if unknown. */ + #[\ReturnTypeWillChange] public function getSize() { if (!$this->size && $this->isAttached() === true) { @@ -240,6 +247,7 @@ public function getSize() * * @throws RuntimeException on error. */ + #[\ReturnTypeWillChange] public function tell() { if (!$this->isAttached() || ($position = ftell($this->stream)) === false || $this->isPipe()) { @@ -254,6 +262,7 @@ public function tell() * * @return bool */ + #[\ReturnTypeWillChange] public function eof() { return $this->isAttached() ? feof($this->stream) : true; @@ -264,6 +273,7 @@ public function eof() * * @return bool */ + #[\ReturnTypeWillChange] public function isReadable() { if ($this->readable === null) { @@ -291,6 +301,7 @@ public function isReadable() * * @return bool */ + #[\ReturnTypeWillChange] public function isWritable() { if ($this->writable === null) { @@ -314,6 +325,7 @@ public function isWritable() * * @return bool */ + #[\ReturnTypeWillChange] public function isSeekable() { if ($this->seekable === null) { @@ -341,6 +353,7 @@ public function isSeekable() * * @throws RuntimeException If stream is not seekable */ + #[\ReturnTypeWillChange] public function seek($offset, $whence = SEEK_SET) { // Note that fseek returns 0 on success! @@ -361,6 +374,7 @@ public function seek($offset, $whence = SEEK_SET) * * @throws RuntimeException on failure. */ + #[\ReturnTypeWillChange] public function rewind() { if (!$this->isSeekable() || rewind($this->stream) === false) { @@ -379,6 +393,7 @@ public function rewind() * * @throws RuntimeException if an error occurs. */ + #[\ReturnTypeWillChange] public function read($length) { if (!$this->isReadable() || ($data = fread($this->stream, $length)) === false) { @@ -397,6 +412,7 @@ public function read($length) * * @throws RuntimeException If stream is not writable */ + #[\ReturnTypeWillChange] public function write($string) { if (!$this->isWritable() || ($written = fwrite($this->stream, $string)) === false) { @@ -416,6 +432,7 @@ public function write($string) * * @throws RuntimeException If stream is not readable */ + #[\ReturnTypeWillChange] public function getContents() { if (!$this->isReadable() || ($contents = stream_get_contents($this->stream)) === false) { @@ -430,6 +447,7 @@ public function getContents() * * @return bool */ + #[\ReturnTypeWillChange] public function isPipe() { if ($this->isPipe === null) { diff --git a/Slim/Http/UploadedFile.php b/Slim/Http/UploadedFile.php index 401440db..f7a0021d 100644 --- a/Slim/Http/UploadedFile.php +++ b/Slim/Http/UploadedFile.php @@ -87,6 +87,7 @@ class UploadedFile implements UploadedFileInterface * * @return array|null */ + #[\ReturnTypeWillChange] public static function createFromEnvironment(Environment $env) { if (is_array($env['slim.files']) && $env->has('slim.files')) { @@ -107,6 +108,7 @@ public static function createFromEnvironment(Environment $env) * * @return array */ + #[\ReturnTypeWillChange] private static function parseUploadedFiles(array $uploadedFiles) { $parsed = []; @@ -154,6 +156,7 @@ private static function parseUploadedFiles(array $uploadedFiles) * @param int $error The UPLOAD_ERR_XXX code representing the status of the upload. * @param bool $sapi Indicates if the upload is in a SAPI environment. */ + #[\ReturnTypeWillChange] public function __construct($file, $name = null, $type = null, $size = null, $error = UPLOAD_ERR_OK, $sapi = false) { $this->file = $file; @@ -180,6 +183,7 @@ public function __construct($file, $name = null, $type = null, $size = null, $er * * @throws RuntimeException in cases when no stream is available or can be created. */ + #[\ReturnTypeWillChange] public function getStream() { if ($this->moved) { @@ -225,6 +229,7 @@ public function getStream() * @throws InvalidArgumentException If the $path specified is invalid. * @throws RuntimeException On any error during the move operation or on the second subsequent call to the method. */ + #[\ReturnTypeWillChange] public function moveTo($targetPath) { if ($this->moved) { @@ -275,6 +280,7 @@ public function moveTo($targetPath) * * @return int */ + #[\ReturnTypeWillChange] public function getError() { return $this->error; @@ -292,6 +298,7 @@ public function getError() * * @return string|null */ + #[\ReturnTypeWillChange] public function getClientFilename() { return $this->name; @@ -309,6 +316,7 @@ public function getClientFilename() * * @return string|null */ + #[\ReturnTypeWillChange] public function getClientMediaType() { return $this->type; @@ -323,6 +331,7 @@ public function getClientMediaType() * * @return int|null */ + #[\ReturnTypeWillChange] public function getSize() { return $this->size; diff --git a/Slim/Http/Uri.php b/Slim/Http/Uri.php index b5181bae..fc392304 100644 --- a/Slim/Http/Uri.php +++ b/Slim/Http/Uri.php @@ -132,6 +132,7 @@ public function __construct( * * @return self */ + #[\ReturnTypeWillChange] public static function createFromString($uri) { if (!is_string($uri) && (!is_object($uri) || !method_exists($uri, '__toString'))) { @@ -158,6 +159,7 @@ public static function createFromString($uri) * * @return self */ + #[\ReturnTypeWillChange] public static function createFromEnvironment(Environment $env) { // Scheme @@ -246,6 +248,7 @@ public static function createFromEnvironment(Environment $env) * * @return string The URI scheme. */ + #[\ReturnTypeWillChange] public function getScheme() { return $this->scheme; @@ -268,6 +271,7 @@ public function getScheme() * * @throws InvalidArgumentException for invalid or unsupported schemes. */ + #[\ReturnTypeWillChange] public function withScheme($scheme) { $scheme = $this->filterScheme($scheme); @@ -286,6 +290,7 @@ public function withScheme($scheme) * @throws InvalidArgumentException If the Uri scheme is not a string. * @throws InvalidArgumentException If Uri scheme is not "", "https", or "http". */ + #[\ReturnTypeWillChange] protected function filterScheme($scheme) { static $valid = [ @@ -325,6 +330,7 @@ protected function filterScheme($scheme) * * @return string The URI authority, in "[user-info@]host[:port]" format. */ + #[\ReturnTypeWillChange] public function getAuthority() { $userInfo = $this->getUserInfo(); @@ -349,6 +355,7 @@ public function getAuthority() * * @return string The URI user information, in "username[:password]" format. */ + #[\ReturnTypeWillChange] public function getUserInfo() { return (isset($this->user) ? $this->user : '') . ($this->password !== '' ? ':' . $this->password : ''); @@ -369,6 +376,7 @@ public function getUserInfo() * * @return self A new instance with the specified user information. */ + #[\ReturnTypeWillChange] public function withUserInfo($user, $password = null) { $clone = clone $this; @@ -389,6 +397,7 @@ public function withUserInfo($user, $password = null) * * @return string The percent-encoded query string. */ + #[\ReturnTypeWillChange] protected function filterUserInfo($query) { return preg_replace_callback( @@ -412,6 +421,7 @@ function ($match) { * * @return string The URI host. */ + #[\ReturnTypeWillChange] public function getHost() { return isset($this->host) ? $this->host : ''; @@ -429,6 +439,7 @@ public function getHost() * * @return self A new instance with the specified host. */ + #[\ReturnTypeWillChange] public function withHost($host) { $clone = clone $this; @@ -452,6 +463,7 @@ public function withHost($host) * * @return null|int The URI port. */ + #[\ReturnTypeWillChange] public function getPort() { return $this->port && !$this->hasStandardPort() ? $this->port : null; @@ -474,6 +486,7 @@ public function getPort() * * @return self A new instance with the specified port. */ + #[\ReturnTypeWillChange] public function withPort($port) { $port = $this->filterPort($port); @@ -488,6 +501,7 @@ public function withPort($port) * * @return bool */ + #[\ReturnTypeWillChange] protected function hasStandardPort() { return ($this->scheme === 'http' && $this->port === 80) || ($this->scheme === 'https' && $this->port === 443); @@ -501,6 +515,7 @@ protected function hasStandardPort() * * @throws InvalidArgumentException If the port is invalid. */ + #[\ReturnTypeWillChange] protected function filterPort($port) { if (is_null($port) || (is_integer($port) && ($port >= 1 && $port <= 65535))) { @@ -536,6 +551,7 @@ protected function filterPort($port) * * @return string The URI path. */ + #[\ReturnTypeWillChange] public function getPath() { return $this->path; @@ -564,6 +580,7 @@ public function getPath() * * @throws InvalidArgumentException For invalid paths. */ + #[\ReturnTypeWillChange] public function withPath($path) { if (!is_string($path)) { @@ -591,6 +608,7 @@ public function withPath($path) * * @return string The base path segment of the URI. */ + #[\ReturnTypeWillChange] public function getBasePath() { return $this->basePath; @@ -605,6 +623,7 @@ public function getBasePath() * * @return static */ + #[\ReturnTypeWillChange] public function withBasePath($basePath) { if (!is_string($basePath)) { @@ -638,6 +657,7 @@ public function withBasePath($basePath) * * @link http://www.faqs.org/rfcs/rfc3986.html */ + #[\ReturnTypeWillChange] protected function filterPath($path) { return preg_replace_callback( @@ -670,6 +690,7 @@ function ($match) { * * @return string */ + #[\ReturnTypeWillChange] public function getQuery() { return $this->query; @@ -692,6 +713,7 @@ public function getQuery() * * @throws InvalidArgumentException For invalid query strings. */ + #[\ReturnTypeWillChange] public function withQuery($query) { if (!is_string($query) && (!is_object($query) || !method_exists($query, '__toString'))) { @@ -711,6 +733,7 @@ public function withQuery($query) * * @return string The percent-encoded query string. */ + #[\ReturnTypeWillChange] protected function filterQuery($query) { return preg_replace_callback( @@ -739,6 +762,7 @@ function ($match) { * * @return string The URI fragment. */ + #[\ReturnTypeWillChange] public function getFragment() { return $this->fragment; @@ -759,6 +783,7 @@ public function getFragment() * * @return static A new instance with the specified fragment. */ + #[\ReturnTypeWillChange] public function withFragment($fragment) { if (!is_string($fragment) && (!is_object($fragment) || !method_exists($fragment, '__toString'))) { @@ -822,6 +847,7 @@ public function __toString() * * @return string */ + #[\ReturnTypeWillChange] public function getBaseUrl() { $scheme = $this->getScheme(); diff --git a/Slim/Interfaces/CallableResolverInterface.php b/Slim/Interfaces/CallableResolverInterface.php index b3fd3fa9..7fae7c5d 100644 --- a/Slim/Interfaces/CallableResolverInterface.php +++ b/Slim/Interfaces/CallableResolverInterface.php @@ -20,5 +20,6 @@ interface CallableResolverInterface * * @throws RuntimeException */ + #[\ReturnTypeWillChange] public function resolve($toResolve); } diff --git a/Slim/Interfaces/CollectionInterface.php b/Slim/Interfaces/CollectionInterface.php index 9af58902..d77d5c22 100644 --- a/Slim/Interfaces/CollectionInterface.php +++ b/Slim/Interfaces/CollectionInterface.php @@ -29,6 +29,7 @@ public function set($key, $value); * * @return mixed The key's value, or the default value */ + #[\ReturnTypeWillChange] public function get($key, $default = null); /** @@ -36,6 +37,7 @@ public function get($key, $default = null); * * @param array $items Key-value array of data to append to this collection */ + #[\ReturnTypeWillChange] public function replace(array $items); /** @@ -43,6 +45,7 @@ public function replace(array $items); * * @return array The collection's source data */ + #[\ReturnTypeWillChange] public function all(); /** @@ -52,6 +55,7 @@ public function all(); * * @return bool */ + #[\ReturnTypeWillChange] public function has($key); /** @@ -59,6 +63,7 @@ public function has($key); * * @param string $key The data key */ + #[\ReturnTypeWillChange] public function remove($key); /** diff --git a/Slim/Interfaces/Http/CookiesInterface.php b/Slim/Interfaces/Http/CookiesInterface.php index a1673a18..aa293013 100644 --- a/Slim/Interfaces/Http/CookiesInterface.php +++ b/Slim/Interfaces/Http/CookiesInterface.php @@ -19,6 +19,7 @@ interface CookiesInterface * * @return mixed Cookie value if present, else default */ + #[\ReturnTypeWillChange] public function get($name, $default = null); /** @@ -27,6 +28,7 @@ public function get($name, $default = null); * @param string $name Cookie name * @param string|array $value Cookie value, or cookie properties */ + #[\ReturnTypeWillChange] public function set($name, $value); /** @@ -34,6 +36,7 @@ public function set($name, $value); * * @return string[] */ + #[\ReturnTypeWillChange] public function toHeaders(); /** @@ -45,5 +48,6 @@ public function toHeaders(); * * @throws InvalidArgumentException if the cookie data cannot be parsed */ + #[\ReturnTypeWillChange] public static function parseHeader($header); } diff --git a/Slim/Interfaces/Http/EnvironmentInterface.php b/Slim/Interfaces/Http/EnvironmentInterface.php index 49eae5b6..aa39a194 100644 --- a/Slim/Interfaces/Http/EnvironmentInterface.php +++ b/Slim/Interfaces/Http/EnvironmentInterface.php @@ -16,5 +16,6 @@ interface EnvironmentInterface * * @return static */ + #[\ReturnTypeWillChange] public static function mock(array $settings = []); } diff --git a/Slim/Interfaces/Http/HeadersInterface.php b/Slim/Interfaces/Http/HeadersInterface.php index f86cab5e..2fab0e7d 100644 --- a/Slim/Interfaces/Http/HeadersInterface.php +++ b/Slim/Interfaces/Http/HeadersInterface.php @@ -34,5 +34,6 @@ public function add($key, $value); * * @return string Normalized header name */ + #[\ReturnTypeWillChange] public function normalizeKey($key); } diff --git a/Slim/Interfaces/InvocationStrategyInterface.php b/Slim/Interfaces/InvocationStrategyInterface.php index 0e73a42d..16e7424e 100644 --- a/Slim/Interfaces/InvocationStrategyInterface.php +++ b/Slim/Interfaces/InvocationStrategyInterface.php @@ -20,6 +20,7 @@ interface InvocationStrategyInterface * * @return ResponseInterface|string */ + #[\ReturnTypeWillChange] public function __invoke( callable $callable, ServerRequestInterface $request, diff --git a/Slim/Interfaces/RouteGroupInterface.php b/Slim/Interfaces/RouteGroupInterface.php index 31340b13..876e4e70 100644 --- a/Slim/Interfaces/RouteGroupInterface.php +++ b/Slim/Interfaces/RouteGroupInterface.php @@ -16,6 +16,7 @@ interface RouteGroupInterface * * @return string */ + #[\ReturnTypeWillChange] public function getPattern(); /** @@ -25,6 +26,7 @@ public function getPattern(); * * @return RouteGroupInterface */ + #[\ReturnTypeWillChange] public function add($callable); /** diff --git a/Slim/Interfaces/RouteInterface.php b/Slim/Interfaces/RouteInterface.php index 8d0f4f05..caae2ea6 100644 --- a/Slim/Interfaces/RouteInterface.php +++ b/Slim/Interfaces/RouteInterface.php @@ -21,6 +21,7 @@ interface RouteInterface * * @return string|null */ + #[\ReturnTypeWillChange] public function getArgument($name, $default = null); /** @@ -28,6 +29,7 @@ public function getArgument($name, $default = null); * * @return string[] */ + #[\ReturnTypeWillChange] public function getArguments(); /** @@ -35,6 +37,7 @@ public function getArguments(); * * @return null|string */ + #[\ReturnTypeWillChange] public function getName(); /** @@ -42,6 +45,7 @@ public function getName(); * * @return string */ + #[\ReturnTypeWillChange] public function getPattern(); /** @@ -52,6 +56,7 @@ public function getPattern(); * * @return RouteInterface */ + #[\ReturnTypeWillChange] public function setArgument($name, $value); /** @@ -61,6 +66,7 @@ public function setArgument($name, $value); * * @return RouteInterface */ + #[\ReturnTypeWillChange] public function setArguments(array $arguments); /** @@ -72,6 +78,7 @@ public function setArguments(array $arguments); * * @throws InvalidArgumentException If an unknown buffering mode is specified */ + #[\ReturnTypeWillChange] public function setOutputBuffering($mode); /** @@ -83,6 +90,7 @@ public function setOutputBuffering($mode); * * @throws InvalidArgumentException if the route name is not a string */ + #[\ReturnTypeWillChange] public function setName($name); /** @@ -94,6 +102,7 @@ public function setName($name); * * @return RouteInterface */ + #[\ReturnTypeWillChange] public function add($callable); /** @@ -102,6 +111,7 @@ public function add($callable); * @param ServerRequestInterface $request * @param array $arguments */ + #[\ReturnTypeWillChange] public function prepare(ServerRequestInterface $request, array $arguments); /** @@ -116,6 +126,7 @@ public function prepare(ServerRequestInterface $request, array $arguments); * * @return ResponseInterface */ + #[\ReturnTypeWillChange] public function run(ServerRequestInterface $request, ResponseInterface $response); /** @@ -130,5 +141,6 @@ public function run(ServerRequestInterface $request, ResponseInterface $response * * @return ResponseInterface */ + #[\ReturnTypeWillChange] public function __invoke(ServerRequestInterface $request, ResponseInterface $response); } diff --git a/Slim/Interfaces/RouterInterface.php b/Slim/Interfaces/RouterInterface.php index 767699a6..612a2b44 100644 --- a/Slim/Interfaces/RouterInterface.php +++ b/Slim/Interfaces/RouterInterface.php @@ -28,6 +28,7 @@ interface RouterInterface * * @return RouteInterface */ + #[\ReturnTypeWillChange] public function map($methods, $pattern, $handler); /** @@ -39,6 +40,7 @@ public function map($methods, $pattern, $handler); * * @link https://github.com/nikic/FastRoute/blob/master/src/Dispatcher.php */ + #[\ReturnTypeWillChange] public function dispatch(ServerRequestInterface $request); /** @@ -49,6 +51,7 @@ public function dispatch(ServerRequestInterface $request); * * @return RouteGroupInterface */ + #[\ReturnTypeWillChange] public function pushGroup($pattern, $callable); /** @@ -56,6 +59,7 @@ public function pushGroup($pattern, $callable); * * @return bool True if successful, else False */ + #[\ReturnTypeWillChange] public function popGroup(); /** @@ -67,6 +71,7 @@ public function popGroup(); * * @throws RuntimeException If named route does not exist */ + #[\ReturnTypeWillChange] public function getNamedRoute($name); /** @@ -74,6 +79,7 @@ public function getNamedRoute($name); * * @return RouteInterface */ + #[\ReturnTypeWillChange] public function lookupRoute($identifier); /** @@ -88,6 +94,7 @@ public function lookupRoute($identifier); * @throws RuntimeException If named route does not exist * @throws InvalidArgumentException If required data not provided */ + #[\ReturnTypeWillChange] public function relativePathFor($name, array $data = [], array $queryParams = []); /** @@ -102,5 +109,6 @@ public function relativePathFor($name, array $data = [], array $queryParams = [] * @throws RuntimeException If named route does not exist * @throws InvalidArgumentException If required data not provided */ + #[\ReturnTypeWillChange] public function pathFor($name, array $data = [], array $queryParams = []); } diff --git a/Slim/MiddlewareAwareTrait.php b/Slim/MiddlewareAwareTrait.php index 3f323661..d124bb14 100644 --- a/Slim/MiddlewareAwareTrait.php +++ b/Slim/MiddlewareAwareTrait.php @@ -50,6 +50,7 @@ trait MiddlewareAwareTrait * @throws RuntimeException If middleware is added while the stack is dequeuing * @throws UnexpectedValueException If the middleware doesn't return a Psr\Http\Message\ResponseInterface */ + #[\ReturnTypeWillChange] protected function addMiddleware(callable $callable) { if ($this->middlewareLock) { @@ -87,6 +88,7 @@ protected function addMiddleware(callable $callable) * * @throws RuntimeException if the stack is seeded more than once */ + #[\ReturnTypeWillChange] protected function seedMiddlewareStack(callable $kernel = null) { if (!is_null($this->tip)) { @@ -106,6 +108,7 @@ protected function seedMiddlewareStack(callable $kernel = null) * * @return ResponseInterface */ + #[\ReturnTypeWillChange] public function callMiddlewareStack(ServerRequestInterface $request, ResponseInterface $response) { if (is_null($this->tip)) { diff --git a/Slim/Routable.php b/Slim/Routable.php index 2563e053..86f8a476 100644 --- a/Slim/Routable.php +++ b/Slim/Routable.php @@ -56,6 +56,7 @@ public function __construct($pattern, $callable) * * @return callable[] */ + #[\ReturnTypeWillChange] public function getMiddleware() { return $this->middleware; @@ -66,6 +67,7 @@ public function getMiddleware() * * @return string */ + #[\ReturnTypeWillChange] public function getPattern() { return $this->pattern; @@ -78,6 +80,7 @@ public function getPattern() * * @return static */ + #[\ReturnTypeWillChange] public function setContainer(ContainerInterface $container) { $this->container = $container; @@ -91,6 +94,7 @@ public function setContainer(ContainerInterface $container) * * @return static */ + #[\ReturnTypeWillChange] public function add($callable) { $this->middleware[] = new DeferredCallable($callable, $this->container); @@ -102,6 +106,7 @@ public function add($callable) * * @param string $newPattern */ + #[\ReturnTypeWillChange] public function setPattern($newPattern) { $this->pattern = $newPattern; diff --git a/Slim/Route.php b/Slim/Route.php index 7af218cc..110a0d6f 100644 --- a/Slim/Route.php +++ b/Slim/Route.php @@ -87,6 +87,7 @@ public function __construct($methods, $pattern, $callable, $groups = [], $identi $this->identifier = 'route' . $identifier; } + #[\ReturnTypeWillChange] public function finalize() { if ($this->finalized) { @@ -112,6 +113,7 @@ public function finalize() * * @return callable */ + #[\ReturnTypeWillChange] public function getCallable() { return $this->callable; @@ -122,6 +124,7 @@ public function getCallable() * * @param string|Closure $callable */ + #[\ReturnTypeWillChange] public function setCallable($callable) { $this->callable = $callable; @@ -132,6 +135,7 @@ public function setCallable($callable) * * @return string[] */ + #[\ReturnTypeWillChange] public function getMethods() { return $this->methods; @@ -142,6 +146,7 @@ public function getMethods() * * @return RouteGroup[] */ + #[\ReturnTypeWillChange] public function getGroups() { return $this->groups; @@ -150,6 +155,7 @@ public function getGroups() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getName() { return $this->name; @@ -160,6 +166,7 @@ public function getName() * * @return string */ + #[\ReturnTypeWillChange] public function getIdentifier() { return $this->identifier; @@ -170,6 +177,7 @@ public function getIdentifier() * * @return boolean|string */ + #[\ReturnTypeWillChange] public function getOutputBuffering() { return $this->outputBuffering; @@ -178,6 +186,7 @@ public function getOutputBuffering() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function setOutputBuffering($mode) { if (!in_array($mode, [false, 'prepend', 'append'], true)) { @@ -190,6 +199,7 @@ public function setOutputBuffering($mode) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function setName($name) { if (!is_string($name)) { @@ -202,6 +212,7 @@ public function setName($name) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function setArgument($name, $value, $includeInSavedArguments = true) { if ($includeInSavedArguments) { @@ -214,6 +225,7 @@ public function setArgument($name, $value, $includeInSavedArguments = true) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function setArguments(array $arguments, $includeInSavedArguments = true) { if ($includeInSavedArguments) { @@ -226,6 +238,7 @@ public function setArguments(array $arguments, $includeInSavedArguments = true) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getArguments() { return $this->arguments; @@ -245,6 +258,7 @@ public function getArgument($name, $default = null) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function prepare(ServerRequestInterface $request, array $arguments) { // Remove temp arguments @@ -259,6 +273,7 @@ public function prepare(ServerRequestInterface $request, array $arguments) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function run(ServerRequestInterface $request, ResponseInterface $response) { // Finalise route now that we are about to run it @@ -271,6 +286,7 @@ public function run(ServerRequestInterface $request, ResponseInterface $response /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function __invoke(ServerRequestInterface $request, ResponseInterface $response) { $this->callable = $this->resolveCallable($this->callable); diff --git a/Slim/RouteGroup.php b/Slim/RouteGroup.php index 26fe5c07..b440b499 100644 --- a/Slim/RouteGroup.php +++ b/Slim/RouteGroup.php @@ -15,6 +15,7 @@ class RouteGroup extends Routable implements RouteGroupInterface /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function __invoke(App $app = null) { $callable = $this->resolveCallable($this->callable); diff --git a/Slim/Router.php b/Slim/Router.php index 08a95018..dfb68eed 100644 --- a/Slim/Router.php +++ b/Slim/Router.php @@ -96,6 +96,7 @@ public function __construct(RouteParser $parser = null) * @return static * @throws InvalidArgumentException */ + #[\ReturnTypeWillChange] public function setBasePath($basePath) { if (!is_string($basePath)) { @@ -112,6 +113,7 @@ public function setBasePath($basePath) * * @return string */ + #[\ReturnTypeWillChange] public function getBasePath() { return $this->basePath; @@ -127,6 +129,7 @@ public function getBasePath() * @throws InvalidArgumentException If cacheFile is not a string or not false * @throws RuntimeException If cacheFile directory is not writable */ + #[\ReturnTypeWillChange] public function setCacheFile($cacheFile) { if (!is_string($cacheFile) && $cacheFile !== false) { @@ -152,6 +155,7 @@ public function setCacheFile($cacheFile) /** * @param ContainerInterface $container */ + #[\ReturnTypeWillChange] public function setContainer(ContainerInterface $container) { $this->container = $container; @@ -160,6 +164,7 @@ public function setContainer(ContainerInterface $container) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function map($methods, $pattern, $handler) { if (!is_string($pattern)) { @@ -186,6 +191,7 @@ public function map($methods, $pattern, $handler) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function dispatch(ServerRequestInterface $request) { $uri = '/' . ltrim($request->getUri()->getPath(), '/'); @@ -205,6 +211,7 @@ public function dispatch(ServerRequestInterface $request) * * @return RouteInterface */ + #[\ReturnTypeWillChange] protected function createRoute($methods, $pattern, $callable) { $route = new Route($methods, $pattern, $callable, $this->routeGroups, $this->routeCounter); @@ -218,6 +225,7 @@ protected function createRoute($methods, $pattern, $callable) /** * @return Dispatcher */ + #[\ReturnTypeWillChange] protected function createDispatcher() { if ($this->dispatcher) { @@ -247,6 +255,7 @@ protected function createDispatcher() /** * @param Dispatcher $dispatcher */ + #[\ReturnTypeWillChange] public function setDispatcher(Dispatcher $dispatcher) { $this->dispatcher = $dispatcher; @@ -257,6 +266,7 @@ public function setDispatcher(Dispatcher $dispatcher) * * @return Route[] */ + #[\ReturnTypeWillChange] public function getRoutes() { return $this->routes; @@ -265,6 +275,7 @@ public function getRoutes() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function getNamedRoute($name) { foreach ($this->routes as $route) { @@ -282,6 +293,7 @@ public function getNamedRoute($name) * * @throws RuntimeException If named route does not exist */ + #[\ReturnTypeWillChange] public function removeNamedRoute($name) { $route = $this->getNamedRoute($name); @@ -295,6 +307,7 @@ public function removeNamedRoute($name) * * @return string A group pattern to prefix routes with */ + #[\ReturnTypeWillChange] protected function processGroups() { $pattern = ""; @@ -307,6 +320,7 @@ protected function processGroups() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function pushGroup($pattern, $callable) { $group = new RouteGroup($pattern, $callable); @@ -317,6 +331,7 @@ public function pushGroup($pattern, $callable) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function popGroup() { $group = array_pop($this->routeGroups); @@ -326,6 +341,7 @@ public function popGroup() /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function lookupRoute($identifier) { if (!isset($this->routes[$identifier])) { @@ -337,6 +353,7 @@ public function lookupRoute($identifier) /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function relativePathFor($name, array $data = [], array $queryParams = []) { $route = $this->getNamedRoute($name); @@ -396,6 +413,7 @@ public function relativePathFor($name, array $data = [], array $queryParams = [] /** * {@inheritdoc} */ + #[\ReturnTypeWillChange] public function pathFor($name, array $data = [], array $queryParams = []) { return $this->urlFor($name, $data, $queryParams); @@ -413,6 +431,7 @@ public function pathFor($name, array $data = [], array $queryParams = []) * @throws RuntimeException If named route does not exist * @throws InvalidArgumentException If required data not provided */ + #[\ReturnTypeWillChange] public function urlFor($name, array $data = [], array $queryParams = []) { $url = $this->relativePathFor($name, $data, $queryParams); @@ -437,6 +456,7 @@ public function urlFor($name, array $data = [], array $queryParams = []) * @throws RuntimeException If named route does not exist * @throws InvalidArgumentException If required data not provided */ + #[\ReturnTypeWillChange] public function fullUrlFor(UriInterface $uri, $routeName, array $data = [], array $queryParams = []) { $path = $this->urlFor($routeName, $data, $queryParams);