Skip to content

Commit

Permalink
disable cache on psalm and enable unused code auditing
Browse files Browse the repository at this point in the history
  • Loading branch information
limarkxx committed May 14, 2024
1 parent 542c05f commit 3ab597e
Show file tree
Hide file tree
Showing 36 changed files with 33 additions and 8 deletions.
1 change: 1 addition & 0 deletions Slim/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use function strtoupper;

/**
* @api
* @template TContainerInterface of (ContainerInterface|null)
* @template-extends RouteCollectorProxy<TContainerInterface>
*/
Expand Down
2 changes: 0 additions & 2 deletions Slim/CallableResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ private function resolveSlimNotation(string $toResolve): array
preg_match(CallableResolver::$callablePattern, $toResolve, $matches);
[$class, $method] = $matches ? [$matches[1], $matches[2]] : [$toResolve, null];

/** @var string $class */
/** @var string|null $method */
if ($this->container && $this->container->has($class)) {
$instance = $this->container->get($class);
if (!is_object($instance)) {
Expand Down
1 change: 0 additions & 1 deletion Slim/Error/Renderers/HtmlErrorRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ private function renderExceptionFragment(Throwable $exception): string
{
$html = sprintf('<div><strong>Type:</strong> %s</div>', get_class($exception));

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

Expand Down
1 change: 0 additions & 1 deletion Slim/Error/Renderers/JsonErrorRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public function __invoke(Throwable $exception, bool $displayErrorDetails): strin
*/
private function formatExceptionFragment(Throwable $exception): array
{
/** @var int|string $code */
$code = $exception->getCode();
return [
'type' => get_class($exception),
Expand Down
2 changes: 1 addition & 1 deletion Slim/Error/Renderers/PlainTextErrorRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private function formatExceptionFragment(Throwable $exception): string
$text = sprintf("Type: %s\n", get_class($exception));

$code = $exception->getCode();
/** @var int|string $code */

$text .= sprintf("Code: %s\n", $code);

$text .= sprintf("Message: %s\n", $exception->getMessage());
Expand Down
1 change: 1 addition & 0 deletions Slim/Exception/HttpBadRequestException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Slim\Exception;

/** @api */
class HttpBadRequestException extends HttpSpecializedException
{
/**
Expand Down
1 change: 1 addition & 0 deletions Slim/Exception/HttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Throwable;

/**
* @api
* @method int getCode()
*/
class HttpException extends RuntimeException
Expand Down
1 change: 1 addition & 0 deletions Slim/Exception/HttpForbiddenException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Slim\Exception;

/** @api */
class HttpForbiddenException extends HttpSpecializedException
{
/**
Expand Down
1 change: 1 addition & 0 deletions Slim/Exception/HttpGoneException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Slim\Exception;

/** @api */
class HttpGoneException extends HttpSpecializedException
{
/**
Expand Down
1 change: 1 addition & 0 deletions Slim/Exception/HttpInternalServerErrorException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Slim\Exception;

/** @api */
class HttpInternalServerErrorException extends HttpSpecializedException
{
/**
Expand Down
1 change: 1 addition & 0 deletions Slim/Exception/HttpNotImplementedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Slim\Exception;

/** @api */
class HttpNotImplementedException extends HttpSpecializedException
{
/**
Expand Down
1 change: 1 addition & 0 deletions Slim/Exception/HttpTooManyRequestsException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Slim\Exception;

/** @api */
class HttpTooManyRequestsException extends HttpSpecializedException
{
/**
Expand Down
1 change: 1 addition & 0 deletions Slim/Exception/HttpUnauthorizedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Slim\Exception;

/** @api */
class HttpUnauthorizedException extends HttpSpecializedException
{
/**
Expand Down
1 change: 1 addition & 0 deletions Slim/Factory/AppFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Slim\Interfaces\RouteCollectorInterface;
use Slim\Interfaces\RouteResolverInterface;

/** @api */
class AppFactory
{
protected static ?Psr17FactoryProviderInterface $psr17FactoryProvider = null;
Expand Down
1 change: 1 addition & 0 deletions Slim/Factory/ServerRequestCreatorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Slim\Interfaces\Psr17FactoryProviderInterface;
use Slim\Interfaces\ServerRequestCreatorInterface;

/** @api */
class ServerRequestCreatorFactory
{
protected static ?Psr17FactoryProviderInterface $psr17FactoryProvider = null;
Expand Down
1 change: 1 addition & 0 deletions Slim/Handlers/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
*
* It outputs the error message and diagnostic information in one of the following formats:
* JSON, XML, Plain Text or HTML based on the Accept header.
* @api
*/
class ErrorHandler implements ErrorHandlerInterface
{
Expand Down
1 change: 1 addition & 0 deletions Slim/Handlers/Strategies/RequestResponseArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

/**
* Route callback strategy with route parameters as individual arguments.
* @api
*/
class RequestResponseArgs implements InvocationStrategyInterface
{
Expand Down
1 change: 1 addition & 0 deletions Slim/Handlers/Strategies/RequestResponseNamedArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

/**
* Route callback strategy with route parameters as individual arguments.
* @api
*/
class RequestResponseNamedArgs implements InvocationStrategyInterface
{
Expand Down
1 change: 1 addition & 0 deletions Slim/Interfaces/MiddlewareDispatcherInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;

/** @api */
interface MiddlewareDispatcherInterface extends RequestHandlerInterface
{
/**
Expand Down
1 change: 1 addition & 0 deletions Slim/Interfaces/Psr17FactoryProviderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Slim\Interfaces;

/** @api */
interface Psr17FactoryProviderInterface
{
/**
Expand Down
1 change: 1 addition & 0 deletions Slim/Interfaces/RouteCollectorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use InvalidArgumentException;
use RuntimeException;

/** @api */
interface RouteCollectorInterface
{
/**
Expand Down
1 change: 1 addition & 0 deletions Slim/Interfaces/RouteCollectorProxyInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Psr\Http\Message\UriInterface;

/**
* @api
* @template TContainerInterface of (ContainerInterface|null)
*/
interface RouteCollectorProxyInterface
Expand Down
1 change: 1 addition & 0 deletions Slim/Interfaces/RouteGroupInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Psr\Http\Server\MiddlewareInterface;
use Slim\MiddlewareDispatcher;

/** @api */
interface RouteGroupInterface
{
public function collectRoutes(): RouteGroupInterface;
Expand Down
1 change: 1 addition & 0 deletions Slim/Interfaces/RouteInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;

/** @api */
interface RouteInterface
{
/**
Expand Down
1 change: 1 addition & 0 deletions Slim/Interfaces/RouteParserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Psr\Http\Message\UriInterface;
use RuntimeException;

/** @api */
interface RouteParserInterface
{
/**
Expand Down
1 change: 1 addition & 0 deletions Slim/Middleware/BodyParsingMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

use const LIBXML_VERSION;

/** @api */
class BodyParsingMiddleware implements MiddlewareInterface
{
/**
Expand Down
1 change: 1 addition & 0 deletions Slim/Middleware/ContentLengthMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;

/** @api */
class ContentLengthMiddleware implements MiddlewareInterface
{
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
Expand Down
1 change: 1 addition & 0 deletions Slim/Middleware/ErrorMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use function get_class;
use function is_subclass_of;

/** @api */
class ErrorMiddleware implements MiddlewareInterface
{
protected CallableResolverInterface $callableResolver;
Expand Down
1 change: 1 addition & 0 deletions Slim/Middleware/MethodOverrideMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use function is_array;
use function strtoupper;

/** @api */
class MethodOverrideMiddleware implements MiddlewareInterface
{
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
Expand Down
1 change: 1 addition & 0 deletions Slim/Middleware/OutputBufferingMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use function ob_get_clean;
use function ob_start;

/** @api */
class OutputBufferingMiddleware implements MiddlewareInterface
{
public const APPEND = 'append';
Expand Down
1 change: 1 addition & 0 deletions Slim/MiddlewareDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use function sprintf;

/**
* @api
* @template TContainerInterface of (ContainerInterface|null)
*/
class MiddlewareDispatcher implements MiddlewareDispatcherInterface
Expand Down
2 changes: 1 addition & 1 deletion Slim/Routing/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
use function is_array;

/**
* @api
* @template TContainerInterface of (ContainerInterface|null)
*/
class Route implements RouteInterface, RequestHandlerInterface
Expand Down Expand Up @@ -328,7 +329,6 @@ protected function appendGroupMiddlewareToRoute(): void
$inner = $this->middlewareDispatcher;
$this->middlewareDispatcher = new MiddlewareDispatcher($inner, $this->callableResolver, $this->container);

/** @var RouteGroupInterface $group */
foreach (array_reverse($this->groups) as $group) {
$group->appendMiddlewareToDispatcher($this->middlewareDispatcher);
}
Expand Down
1 change: 1 addition & 0 deletions Slim/Routing/RouteContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Slim\Interfaces\RouteInterface;
use Slim\Interfaces\RouteParserInterface;

/** @api */
final class RouteContext
{
public const ROUTE = '__route__';
Expand Down
1 change: 1 addition & 0 deletions Slim/Routing/RoutingResults.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use function rawurldecode;

/** @api */
class RoutingResults
{
public const NOT_FOUND = 0;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"phpunit": "phpunit",
"phpcs": "phpcs",
"phpstan": "phpstan --memory-limit=-1",
"psalm": "psalm"
"psalm": "psalm --no-cache"
},
"suggest": {
"ext-simplexml": "Needed to support XML format in BodyParsingMiddleware",
Expand Down
2 changes: 1 addition & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="false"
findUnusedCode="true"
>
<projectFiles>
<directory name="Slim" />
Expand Down

0 comments on commit 3ab597e

Please sign in to comment.