Skip to content

Commit 33fc446

Browse files
authored
Merge branch '4.x' into dependabot/composer/phpstan/phpstan-tw-1.11
2 parents d2e7707 + 45ffce3 commit 33fc446

41 files changed

Lines changed: 165 additions & 12 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Slim/App.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131

3232
use function strtoupper;
3333

34+
/**
35+
* @api
36+
* @template TContainerInterface of (ContainerInterface|null)
37+
* @template-extends RouteCollectorProxy<TContainerInterface>
38+
*/
3439
class App extends RouteCollectorProxy implements RequestHandlerInterface
3540
{
3641
/**
@@ -44,6 +49,9 @@ class App extends RouteCollectorProxy implements RequestHandlerInterface
4449

4550
protected MiddlewareDispatcherInterface $middlewareDispatcher;
4651

52+
/**
53+
* @param TContainerInterface $container
54+
*/
4755
public function __construct(
4856
ResponseFactoryInterface $responseFactory,
4957
?ContainerInterface $container = null,
@@ -89,6 +97,7 @@ public function getMiddlewareDispatcher(): MiddlewareDispatcherInterface
8997

9098
/**
9199
* @param MiddlewareInterface|string|callable $middleware
100+
* @return App<TContainerInterface>
92101
*/
93102
public function add($middleware): self
94103
{
@@ -98,6 +107,7 @@ public function add($middleware): self
98107

99108
/**
100109
* @param MiddlewareInterface $middleware
110+
* @return App<TContainerInterface>
101111
*/
102112
public function addMiddleware(MiddlewareInterface $middleware): self
103113
{

Slim/CallableResolver.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,19 @@
2626
use function preg_match;
2727
use function sprintf;
2828

29+
/**
30+
* @template TContainerInterface of (ContainerInterface|null)
31+
*/
2932
final class CallableResolver implements AdvancedCallableResolverInterface
3033
{
3134
public static string $callablePattern = '!^([^\:]+)\:([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$!';
3235

36+
/** @var TContainerInterface $container */
3337
private ?ContainerInterface $container;
3438

39+
/**
40+
* @param TContainerInterface $container
41+
*/
3542
public function __construct(?ContainerInterface $container = null)
3643
{
3744
$this->container = $container;
@@ -120,11 +127,10 @@ private function isMiddleware($toResolve): bool
120127
*/
121128
private function resolveSlimNotation(string $toResolve): array
122129
{
130+
/** @psalm-suppress ArgumentTypeCoercion */
123131
preg_match(CallableResolver::$callablePattern, $toResolve, $matches);
124132
[$class, $method] = $matches ? [$matches[1], $matches[2]] : [$toResolve, null];
125133

126-
/** @var string $class */
127-
/** @var string|null $method */
128134
if ($this->container && $this->container->has($class)) {
129135
$instance = $this->container->get($class);
130136
if (!is_object($instance)) {

Slim/Error/Renderers/HtmlErrorRenderer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ private function renderExceptionFragment(Throwable $exception): string
3939
{
4040
$html = sprintf('<div><strong>Type:</strong> %s</div>', get_class($exception));
4141

42-
/** @var int|string $code */
4342
$code = $exception->getCode();
4443
$html .= sprintf('<div><strong>Code:</strong> %s</div>', $code);
4544

Slim/Error/Renderers/JsonErrorRenderer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public function __invoke(Throwable $exception, bool $displayErrorDetails): strin
4343
*/
4444
private function formatExceptionFragment(Throwable $exception): array
4545
{
46-
/** @var int|string $code */
4746
$code = $exception->getCode();
4847
return [
4948
'type' => get_class($exception),

Slim/Error/Renderers/PlainTextErrorRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private function formatExceptionFragment(Throwable $exception): string
4343
$text = sprintf("Type: %s\n", get_class($exception));
4444

4545
$code = $exception->getCode();
46-
/** @var int|string $code */
46+
4747
$text .= sprintf("Code: %s\n", $code);
4848

4949
$text .= sprintf("Message: %s\n", $exception->getMessage());

Slim/Exception/HttpBadRequestException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
namespace Slim\Exception;
1212

13+
/** @api */
1314
class HttpBadRequestException extends HttpSpecializedException
1415
{
1516
/**

Slim/Exception/HttpException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Throwable;
1616

1717
/**
18+
* @api
1819
* @method int getCode()
1920
*/
2021
class HttpException extends RuntimeException

Slim/Exception/HttpForbiddenException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
namespace Slim\Exception;
1212

13+
/** @api */
1314
class HttpForbiddenException extends HttpSpecializedException
1415
{
1516
/**

Slim/Exception/HttpGoneException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
namespace Slim\Exception;
1212

13+
/** @api */
1314
class HttpGoneException extends HttpSpecializedException
1415
{
1516
/**

Slim/Exception/HttpInternalServerErrorException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
namespace Slim\Exception;
1212

13+
/** @api */
1314
class HttpInternalServerErrorException extends HttpSpecializedException
1415
{
1516
/**

0 commit comments

Comments
 (0)