Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Slim/CallableResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function resolveMiddleware($toResolve): callable
}

/**
* @param string|callable $toResolve
* @param callable|array{class-string, string}|string $toResolve
*
* @throws RuntimeException
*/
Expand Down Expand Up @@ -180,8 +180,9 @@ private function bindToContainer(callable $callable): callable
}

/**
* @param string|callable $toResolve
* @return string|callable
* @param callable|string|array{class-string, string}|mixed $toResolve
*
* @return callable|string|array{class-string, string}|mixed
*/
private function prepareToResolve($toResolve)
{
Expand Down
4 changes: 2 additions & 2 deletions Slim/Interfaces/AdvancedCallableResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ interface AdvancedCallableResolverInterface extends CallableResolverInterface
/**
* Resolve $toResolve into a callable
*
* @param string|callable $toResolve
* @param callable|array{class-string, string}|string $toResolve
*/
public function resolveRoute($toResolve): callable;

/**
* Resolve $toResolve into a callable
*
* @param string|callable $toResolve
* @param callable|array{class-string, string}|string $toResolve
*/
public function resolveMiddleware($toResolve): callable;
}
2 changes: 1 addition & 1 deletion Slim/Interfaces/CallableResolverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface CallableResolverInterface
/**
* Resolve $toResolve into a callable
*
* @param string|callable $toResolve
* @param callable|array{class-string, string}|string $toResolve
*/
public function resolve($toResolve): callable;
}
6 changes: 3 additions & 3 deletions Slim/Interfaces/RouteCollectorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ public function group(string $pattern, $callable): RouteGroupInterface;
/**
* Add route
*
* @param string[] $methods Array of HTTP methods
* @param string $pattern The route pattern
* @param callable|string $handler The route callable
* @param string[] $methods Array of HTTP methods
* @param string $pattern The route pattern
* @param callable|array{class-string, string}|string $handler The route callable
*/
public function map(array $methods, string $pattern, $handler): RouteInterface;
}
34 changes: 17 additions & 17 deletions Slim/Interfaces/RouteCollectorProxyInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,65 +45,65 @@ public function setBasePath(string $basePath): RouteCollectorProxyInterface;
/**
* Add GET route
*
* @param string $pattern The route URI pattern
* @param callable|string $callable The route callback routine
* @param string $pattern The route URI pattern
* @param callable|array{class-string, string}|string $callable The route callback routine
*/
public function get(string $pattern, $callable): RouteInterface;

/**
* Add POST route
*
* @param string $pattern The route URI pattern
* @param callable|string $callable The route callback routine
* @param string $pattern The route URI pattern
* @param callable|array{class-string, string}|string $callable The route callback routine
*/
public function post(string $pattern, $callable): RouteInterface;

/**
* Add PUT route
*
* @param string $pattern The route URI pattern
* @param callable|string $callable The route callback routine
* @param string $pattern The route URI pattern
* @param callable|array{class-string, string}|string $callable The route callback routine
*/
public function put(string $pattern, $callable): RouteInterface;

/**
* Add PATCH route
*
* @param string $pattern The route URI pattern
* @param callable|string $callable The route callback routine
* @param string $pattern The route URI pattern
* @param callable|array{class-string, string}|string $callable The route callback routine
*/
public function patch(string $pattern, $callable): RouteInterface;

/**
* Add DELETE route
*
* @param string $pattern The route URI pattern
* @param callable|string $callable The route callback routine
* @param string $pattern The route URI pattern
* @param callable|array{class-string, string}|string $callable The route callback routine
*/
public function delete(string $pattern, $callable): RouteInterface;

/**
* Add OPTIONS route
*
* @param string $pattern The route URI pattern
* @param callable|string $callable The route callback routine
* @param string $pattern The route URI pattern
* @param callable|array{class-string, string}|string $callable The route callback routine
*/
public function options(string $pattern, $callable): RouteInterface;

/**
* Add route for any HTTP method
*
* @param string $pattern The route URI pattern
* @param callable|string $callable The route callback routine
* @param string $pattern The route URI pattern
* @param callable|array{class-string, string}|string $callable The route callback routine
*/
public function any(string $pattern, $callable): RouteInterface;

/**
* Add route with multiple methods
*
* @param string[] $methods Numeric array of HTTP method names
* @param string $pattern The route URI pattern
* @param callable|string $callable The route callback routine
* @param string[] $methods Numeric array of HTTP method names
* @param string $pattern The route URI pattern
* @param callable|array{class-string, string}|string $callable The route callback routine
*/
public function map(array $methods, string $pattern, $callable): RouteInterface;

Expand Down
4 changes: 2 additions & 2 deletions Slim/Interfaces/RouteInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ public function setPattern(string $pattern): RouteInterface;
/**
* Get route callable
*
* @return callable|string
* @return callable|array{class-string, string}|string
*/
public function getCallable();

/**
* Set route callable
*
* @param callable|string $callable
* @param callable|array{class-string, string}|string $callable
*/
public function setCallable($callable): RouteInterface;

Expand Down
19 changes: 9 additions & 10 deletions Slim/Routing/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Route implements RouteInterface, RequestHandlerInterface
/**
* Route callable
*
* @var callable|string
* @var callable|array{class-string, string}|string
*/
protected $callable;

Expand All @@ -107,15 +107,15 @@ class Route implements RouteInterface, RequestHandlerInterface
protected bool $groupMiddlewareAppended = false;

/**
* @param string[] $methods The route HTTP methods
* @param string $pattern The route pattern
* @param callable|string $callable The route callable
* @param ResponseFactoryInterface $responseFactory
* @param CallableResolverInterface $callableResolver
* @param TContainerInterface $container
* @param string[] $methods The route HTTP methods
* @param string $pattern The route pattern
* @param callable|array{class-string, string}|string $callable The route callable
* @param ResponseFactoryInterface $responseFactory
* @param CallableResolverInterface $callableResolver
* @param TContainerInterface $container
* @param InvocationStrategyInterface|null $invocationStrategy
* @param RouteGroupInterface[] $groups The parent route groups
* @param int $identifier The route identifier
* @param RouteGroupInterface[] $groups The parent route groups
* @param int $identifier The route identifier
*/
public function __construct(
array $methods,
Expand Down Expand Up @@ -348,7 +348,6 @@ public function handle(ServerRequestInterface $request): ResponseInterface
}
$strategy = $this->invocationStrategy;

/** @var string[] $strategyImplements */
$strategyImplements = class_implements($strategy);

if (
Expand Down
6 changes: 3 additions & 3 deletions Slim/Routing/RouteCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
use function array_pop;
use function dirname;
use function file_exists;
use function sprintf;
use function is_readable;
use function is_writable;
use function sprintf;

/**
* RouteCollector is used to collect routes and route groups
Expand Down Expand Up @@ -282,8 +282,8 @@ public function map(array $methods, string $pattern, $handler): RouteInterface
}

/**
* @param string[] $methods
* @param callable|string $callable
* @param string[] $methods
* @param callable|array{class-string, string}|string $callable
*/
protected function createRoute(array $methods, string $pattern, $callable): RouteInterface
{
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
},
"require-dev": {
"ext-simplexml": "*",
"adriansuter/php-autoload-override": "^1.4",
"adriansuter/php-autoload-override": "^1.4 || ^2",
"guzzlehttp/psr7": "^2.6",
"httpsoft/http-message": "^1.1",
"httpsoft/http-server-request": "^1.1",
Expand All @@ -69,7 +69,7 @@
"slim/http": "^1.3",
"slim/psr7": "^1.6",
"squizlabs/php_codesniffer": "^3.10",
"vimeo/psalm": "^5.26.1"
"vimeo/psalm": "^5 || ^6"
},
"autoload": {
"psr-4": {
Expand Down