From e0d20bf8ffbac868a6226ce26276dc7ba2af820f Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 5 Oct 2019 17:26:10 +0200 Subject: [PATCH] Updated to coding styles v2 --- composer.json | 2 +- config/autoload/app_options.global.php | 1 + config/autoload/client-detection.global.php | 1 + config/autoload/common.global.php | 1 + config/autoload/delete_short_urls.global.php | 1 + config/autoload/dependencies.global.php | 1 + config/autoload/entity-manager.global.php | 1 + config/autoload/geolite2.global.php | 1 + config/autoload/installer.global.php | 1 + config/autoload/locks.global.php | 1 + config/autoload/logger.global.php | 1 + config/autoload/middleware-pipeline.global.php | 1 + config/autoload/preview-generation.global.php | 3 ++- config/autoload/router.global.php | 1 + config/autoload/swoole.global.php | 1 + config/autoload/templates.global.php | 1 + config/autoload/url-shortener.global.php | 1 + config/autoload/wkhtmltopdf.global.php | 1 + config/cli-config.php | 11 +++++++---- config/config.php | 1 + config/container.php | 1 + config/test/bootstrap_api_tests.php | 1 + config/test/bootstrap_db_tests.php | 1 + config/test/test_config.global.php | 1 + data/migrations/Version20160819142757.php | 1 + data/migrations/Version20160820191203.php | 1 + data/migrations/Version20171021093246.php | 1 + data/migrations/Version20171022064541.php | 1 + data/migrations/Version20180801183328.php | 1 + data/migrations/Version20180913205455.php | 1 + data/migrations/Version20180915110857.php | 1 + data/migrations/Version20181020060559.php | 1 + data/migrations/Version20181020065148.php | 1 + data/migrations/Version20181110175521.php | 1 + data/migrations/Version20190824075137.php | 1 + data/migrations/Version20190930165521.php | 1 + data/migrations/Version20191001201532.php | 1 + docker/config/shlink_in_docker.local.php | 1 + module/CLI/config/cli.config.php | 1 + module/CLI/config/dependencies.config.php | 1 + module/CLI/src/Command/Api/DisableKeyCommand.php | 1 + module/CLI/src/Command/Api/GenerateKeyCommand.php | 1 + module/CLI/src/Command/Api/ListKeysCommand.php | 1 + .../src/Command/Config/GenerateCharsetCommand.php | 1 + .../src/Command/Config/GenerateSecretCommand.php | 1 + .../CLI/src/Command/Db/AbstractDatabaseCommand.php | 1 + .../CLI/src/Command/Db/CreateDatabaseCommand.php | 1 + .../CLI/src/Command/Db/MigrateDatabaseCommand.php | 1 + .../src/Command/ShortUrl/DeleteShortUrlCommand.php | 1 + .../Command/ShortUrl/GeneratePreviewCommand.php | 1 + .../Command/ShortUrl/GenerateShortUrlCommand.php | 1 + .../CLI/src/Command/ShortUrl/GetVisitsCommand.php | 1 + .../src/Command/ShortUrl/ListShortUrlsCommand.php | 1 + .../CLI/src/Command/ShortUrl/ResolveUrlCommand.php | 1 + module/CLI/src/Command/Tag/CreateTagCommand.php | 1 + module/CLI/src/Command/Tag/DeleteTagsCommand.php | 1 + module/CLI/src/Command/Tag/ListTagsCommand.php | 1 + module/CLI/src/Command/Tag/RenameTagCommand.php | 1 + .../CLI/src/Command/Util/AbstractLockedCommand.php | 1 + .../CLI/src/Command/Util/LockedCommandConfig.php | 1 + .../CLI/src/Command/Visit/LocateVisitsCommand.php | 1 + module/CLI/src/Command/Visit/UpdateDbCommand.php | 1 + module/CLI/src/ConfigProvider.php | 1 + module/CLI/src/Exception/ExceptionInterface.php | 1 + .../GeolocationDbUpdateFailedException.php | 1 + module/CLI/src/Factory/ApplicationFactory.php | 1 + module/CLI/src/Util/ExitCodes.php | 1 + module/CLI/src/Util/GeolocationDbUpdater.php | 1 + .../CLI/src/Util/GeolocationDbUpdaterInterface.php | 1 + module/CLI/src/Util/ShlinkTable.php | 1 + .../CLI/test/Command/Api/DisableKeyCommandTest.php | 1 + .../test/Command/Api/GenerateKeyCommandTest.php | 1 + .../CLI/test/Command/Api/ListKeysCommandTest.php | 1 + .../Command/Config/GenerateCharsetCommandTest.php | 1 + .../test/Command/Db/CreateDatabaseCommandTest.php | 1 + .../test/Command/Db/MigrateDatabaseCommandTest.php | 1 + .../Command/ShortUrl/DeleteShortUrlCommandTest.php | 1 + .../ShortUrl/GeneratePreviewCommandTest.php | 1 + .../ShortUrl/GenerateShortUrlCommandTest.php | 1 + .../test/Command/ShortUrl/GetVisitsCommandTest.php | 1 + .../Command/ShortUrl/ListShortUrlsCommandTest.php | 1 + .../Command/ShortUrl/ResolveUrlCommandTest.php | 1 + .../CLI/test/Command/Tag/CreateTagCommandTest.php | 1 + .../CLI/test/Command/Tag/DeleteTagsCommandTest.php | 1 + .../CLI/test/Command/Tag/ListTagsCommandTest.php | 1 + .../CLI/test/Command/Tag/RenameTagCommandTest.php | 1 + .../test/Command/Visit/LocateVisitsCommandTest.php | 1 + .../CLI/test/Command/Visit/UpdateDbCommandTest.php | 1 + module/CLI/test/ConfigProviderTest.php | 1 + .../GeolocationDbUpdateFailedExceptionTest.php | 1 + module/CLI/test/Factory/ApplicationFactoryTest.php | 1 + module/CLI/test/Util/GeolocationDbUpdaterTest.php | 1 + module/CLI/test/Util/ShlinkTableTest.php | 1 + module/Core/config/app_options.config.php | 1 + module/Core/config/dependencies.config.php | 1 + .../Shlinkio.Shlink.Core.Entity.Domain.php | 3 ++- .../Shlinkio.Shlink.Core.Entity.ShortUrl.php | 3 ++- .../Shlinkio.Shlink.Core.Entity.Tag.php | 3 ++- .../Shlinkio.Shlink.Core.Entity.Visit.php | 3 ++- .../Shlinkio.Shlink.Core.Entity.VisitLocation.php | 3 ++- module/Core/config/entity-manager.config.php | 1 + module/Core/config/event_dispatcher.config.php | 1 + module/Core/config/routes.config.php | 1 + module/Core/config/templates.config.php | 1 + module/Core/config/zend-expressive.config.php | 1 + module/Core/src/Action/AbstractTrackingAction.php | 1 + module/Core/src/Action/PixelAction.php | 1 + module/Core/src/Action/PreviewAction.php | 1 + module/Core/src/Action/QrCodeAction.php | 1 + module/Core/src/Action/RedirectAction.php | 1 + .../src/Action/Util/ErrorResponseBuilderTrait.php | 1 + module/Core/src/Config/BasePathPrefixer.php | 1 + module/Core/src/Config/SimplifiedConfigParser.php | 1 + module/Core/src/ConfigProvider.php | 1 + .../Domain/Resolver/DomainResolverInterface.php | 1 + .../Domain/Resolver/PersistenceDomainResolver.php | 1 + .../src/Domain/Resolver/SimpleDomainResolver.php | 1 + module/Core/src/Entity/Domain.php | 1 + module/Core/src/Entity/ShortUrl.php | 1 + module/Core/src/Entity/Tag.php | 1 + module/Core/src/Entity/Visit.php | 1 + module/Core/src/Entity/VisitLocation.php | 1 + .../src/EventDispatcher/LocateShortUrlVisit.php | 1 + .../Core/src/EventDispatcher/ShortUrlVisited.php | 1 + .../Core/src/Exception/DeleteShortUrlException.php | 1 + .../src/Exception/EntityDoesNotExistException.php | 1 + module/Core/src/Exception/ExceptionInterface.php | 1 + .../src/Exception/InvalidArgumentException.php | 1 + .../src/Exception/InvalidShortCodeException.php | 1 + module/Core/src/Exception/InvalidUrlException.php | 1 + .../src/Exception/IpCannotBeLocatedException.php | 1 + .../Core/src/Exception/NonUniqueSlugException.php | 1 + module/Core/src/Exception/RuntimeException.php | 1 + module/Core/src/Exception/ValidationException.php | 1 + .../Core/src/Middleware/QrCodeCacheMiddleware.php | 1 + module/Core/src/Model/CreateShortUrlData.php | 1 + module/Core/src/Model/ShortUrlMeta.php | 1 + module/Core/src/Model/Visitor.php | 1 + module/Core/src/Model/VisitsParams.php | 1 + module/Core/src/Options/AppOptions.php | 1 + module/Core/src/Options/DeleteShortUrlsOptions.php | 1 + .../Core/src/Options/NotFoundShortUrlOptions.php | 1 + module/Core/src/Options/UrlShortenerOptions.php | 1 + .../Adapter/ShortUrlRepositoryAdapter.php | 1 + .../Paginator/Adapter/VisitsPaginatorAdapter.php | 1 + module/Core/src/Repository/ShortUrlRepository.php | 3 ++- .../src/Repository/ShortUrlRepositoryInterface.php | 1 + module/Core/src/Repository/TagRepository.php | 1 + .../Core/src/Repository/TagRepositoryInterface.php | 1 + module/Core/src/Repository/VisitRepository.php | 1 + .../src/Repository/VisitRepositoryInterface.php | 1 + module/Core/src/Response/NotFoundHandler.php | 1 + .../src/Service/ShortUrl/DeleteShortUrlService.php | 1 + .../ShortUrl/DeleteShortUrlServiceInterface.php | 1 + .../src/Service/ShortUrl/FindShortCodeTrait.php | 1 + module/Core/src/Service/ShortUrlService.php | 1 + .../Core/src/Service/ShortUrlServiceInterface.php | 1 + module/Core/src/Service/Tag/TagService.php | 1 + .../Core/src/Service/Tag/TagServiceInterface.php | 1 + module/Core/src/Service/UrlShortener.php | 1 + module/Core/src/Service/UrlShortenerInterface.php | 1 + module/Core/src/Service/VisitService.php | 1 + module/Core/src/Service/VisitServiceInterface.php | 1 + module/Core/src/Service/VisitsTracker.php | 1 + module/Core/src/Service/VisitsTrackerInterface.php | 1 + .../src/Transformer/ShortUrlDataTransformer.php | 1 + module/Core/src/Util/TagManagerTrait.php | 1 + .../src/Validation/ShortUrlMetaInputFilter.php | 1 + .../Core/src/Visit/Model/UnknownVisitLocation.php | 1 + .../src/Visit/Model/VisitLocationInterface.php | 1 + .../test-db/Repository/ShortUrlRepositoryTest.php | 1 + .../Core/test-db/Repository/TagRepositoryTest.php | 1 + .../test-db/Repository/VisitRepositoryTest.php | 1 + module/Core/test/Action/PixelActionTest.php | 1 + module/Core/test/Action/PreviewActionTest.php | 1 + module/Core/test/Action/QrCodeActionTest.php | 1 + module/Core/test/Action/RedirectActionTest.php | 1 + module/Core/test/Config/BasePathPrefixerTest.php | 1 + .../test/Config/SimplifiedConfigParserTest.php | 1 + module/Core/test/ConfigProviderTest.php | 1 + .../Resolver/PersistenceDomainResolverTest.php | 1 + .../Domain/Resolver/SimpleDomainResolverTest.php | 1 + module/Core/test/Entity/TagTest.php | 1 + module/Core/test/Entity/VisitLocationTest.php | 1 + module/Core/test/Entity/VisitTest.php | 1 + .../EventDispatcher/LocateShortUrlVisitTest.php | 1 + .../test/Exception/DeleteShortUrlExceptionTest.php | 1 + .../Exception/InvalidShortCodeExceptionTest.php | 1 + .../test/Exception/InvalidUrlExceptionTest.php | 1 + .../Exception/IpCannotBeLocatedExceptionTest.php | 1 + .../test/Exception/NonUniqueSlugExceptionTest.php | 1 + .../test/Exception/ValidationExceptionTest.php | 1 + .../test/Middleware/QrCodeCacheMiddlewareTest.php | 1 + module/Core/test/Model/ShortUrlMetaTest.php | 1 + module/Core/test/Model/VisitorTest.php | 1 + .../Adapter/ShortUrlRepositoryAdapterTest.php | 1 + module/Core/test/Response/NotFoundHandlerTest.php | 1 + .../Service/ShortUrl/DeleteShortUrlServiceTest.php | 1 + module/Core/test/Service/ShortUrlServiceTest.php | 1 + module/Core/test/Service/Tag/TagServiceTest.php | 1 + module/Core/test/Service/UrlShortenerTest.php | 1 + module/Core/test/Service/VisitServiceTest.php | 1 + module/Core/test/Service/VisitsTrackerTest.php | 1 + .../Transformer/ShortUrlDataTransformerTest.php | 1 + .../config/dependencies.config.php | 1 + module/PreviewGenerator/src/ConfigProvider.php | 1 + .../src/Exception/PreviewGenerationException.php | 1 + module/PreviewGenerator/src/Image/ImageBuilder.php | 1 + .../src/Image/ImageBuilderFactory.php | 1 + .../src/Image/ImageBuilderInterface.php | 1 + module/PreviewGenerator/src/Image/ImageFactory.php | 1 + .../src/Service/PreviewGenerator.php | 1 + .../src/Service/PreviewGeneratorInterface.php | 1 + .../PreviewGenerator/test/ConfigProviderTest.php | 1 + .../test/Image/ImageBuilderFactoryTest.php | 1 + .../test/Image/ImageFactoryTest.php | 1 + .../test/Service/PreviewGeneratorTest.php | 1 + module/Rest/config/auth.config.php | 1 + module/Rest/config/dependencies.config.php | 1 + .../Shlinkio.Shlink.Rest.Entity.ApiKey.php | 4 +++- module/Rest/config/entity-manager.config.php | 1 + module/Rest/config/error-handler.config.php | 1 + module/Rest/config/routes.config.php | 1 + module/Rest/src/Action/AbstractRestAction.php | 1 + module/Rest/src/Action/AuthenticateAction.php | 1 + module/Rest/src/Action/HealthAction.php | 1 + module/Rest/src/Action/HealthActionFactory.php | 1 + .../ShortUrl/AbstractCreateShortUrlAction.php | 1 + .../src/Action/ShortUrl/CreateShortUrlAction.php | 1 + .../src/Action/ShortUrl/DeleteShortUrlAction.php | 1 + .../src/Action/ShortUrl/EditShortUrlAction.php | 1 + .../src/Action/ShortUrl/EditShortUrlTagsAction.php | 1 + .../src/Action/ShortUrl/ListShortUrlsAction.php | 1 + .../src/Action/ShortUrl/ResolveShortUrlAction.php | 1 + .../ShortUrl/SingleStepCreateShortUrlAction.php | 1 + module/Rest/src/Action/Tag/CreateTagsAction.php | 1 + module/Rest/src/Action/Tag/DeleteTagsAction.php | 1 + module/Rest/src/Action/Tag/ListTagsAction.php | 1 + module/Rest/src/Action/Tag/UpdateTagAction.php | 1 + module/Rest/src/Action/Visit/GetVisitsAction.php | 1 + .../Authentication/AuthenticationPluginManager.php | 1 + .../AuthenticationPluginManagerFactory.php | 1 + .../AuthenticationPluginManagerInterface.php | 1 + module/Rest/src/Authentication/JWTService.php | 1 + .../src/Authentication/JWTServiceInterface.php | 1 + .../Authentication/Plugin/ApiKeyHeaderPlugin.php | 1 + .../Plugin/AuthenticationPluginInterface.php | 1 + .../Plugin/AuthorizationHeaderPlugin.php | 1 + .../src/Authentication/RequestToHttpAuthPlugin.php | 1 + .../RequestToHttpAuthPluginInterface.php | 1 + module/Rest/src/ConfigProvider.php | 1 + module/Rest/src/Entity/ApiKey.php | 1 + .../ErrorHandler/JsonErrorResponseGenerator.php | 1 + .../Rest/src/Exception/AuthenticationException.php | 1 + module/Rest/src/Exception/ExceptionInterface.php | 1 + .../src/Exception/NoAuthenticationException.php | 1 + module/Rest/src/Exception/RuntimeException.php | 1 + .../Exception/VerifyAuthenticationException.php | 1 + .../src/Middleware/AuthenticationMiddleware.php | 4 +++- .../Rest/src/Middleware/BodyParserMiddleware.php | 14 +++++++++----- .../Rest/src/Middleware/CrossDomainMiddleware.php | 1 + ...ptyResponseImplicitOptionsMiddlewareFactory.php | 1 + .../Rest/src/Middleware/PathVersionMiddleware.php | 1 + .../CreateShortUrlContentNegotiationMiddleware.php | 1 + .../ShortUrl/ShortCodePathMiddleware.php | 1 + module/Rest/src/Service/ApiKeyService.php | 1 + module/Rest/src/Service/ApiKeyServiceInterface.php | 1 + module/Rest/src/Util/RestUtils.php | 1 + .../test-api/Action/CreateShortUrlActionTest.php | 1 + module/Rest/test-api/Action/ListShortUrlsTest.php | 1 + module/Rest/test-api/Fixtures/ApiKeyFixture.php | 1 + module/Rest/test-api/Fixtures/ShortUrlsFixture.php | 1 + module/Rest/test-api/Fixtures/TagsFixture.php | 1 + module/Rest/test-api/Fixtures/VisitsFixture.php | 1 + .../test-api/Middleware/AuthenticationTest.php | 1 + .../test-api/Middleware/ImplicitOptionsTest.php | 1 + module/Rest/test/Action/AuthenticateActionTest.php | 1 + .../Rest/test/Action/HealthActionFactoryTest.php | 1 + module/Rest/test/Action/HealthActionTest.php | 1 + .../Action/ShortUrl/CreateShortUrlActionTest.php | 1 + .../Action/ShortUrl/DeleteShortUrlActionTest.php | 1 + .../Action/ShortUrl/EditShortUrlActionTest.php | 1 + .../Action/ShortUrl/EditShortUrlTagsActionTest.php | 1 + .../Action/ShortUrl/ListShortUrlsActionTest.php | 1 + .../Action/ShortUrl/ResolveShortUrlActionTest.php | 1 + .../SingleStepCreateShortUrlActionTest.php | 1 + .../Rest/test/Action/Tag/CreateTagsActionTest.php | 1 + .../Rest/test/Action/Tag/DeleteTagsActionTest.php | 1 + module/Rest/test/Action/Tag/ListTagsActionTest.php | 1 + .../Rest/test/Action/Tag/UpdateTagActionTest.php | 1 + .../Rest/test/Action/Visit/GetVisitsActionTest.php | 1 + .../AuthenticationPluginManagerFactoryTest.php | 1 + module/Rest/test/Authentication/JWTServiceTest.php | 1 + .../Plugin/ApiKeyHeaderPluginTest.php | 1 + .../Plugin/AuthorizationHeaderPluginTest.php | 1 + .../Authentication/RequestToAuthPluginTest.php | 1 + module/Rest/test/ConfigProviderTest.php | 1 + .../JsonErrorResponseGeneratorTest.php | 1 + .../test/Exception/AuthenticationExceptionTest.php | 1 + .../VerifyAuthenticationExceptionTest.php | 1 + .../Middleware/AuthenticationMiddlewareTest.php | 7 +++++-- .../test/Middleware/BodyParserMiddlewareTest.php | 1 + .../test/Middleware/CrossDomainMiddlewareTest.php | 1 + ...esponseImplicitOptionsMiddlewareFactoryTest.php | 1 + .../test/Middleware/PathVersionMiddlewareTest.php | 1 + ...ateShortUrlContentNegotiationMiddlewareTest.php | 1 + .../ShortUrl/ShortCodePathMiddlewareTest.php | 1 + module/Rest/test/Service/ApiKeyServiceTest.php | 1 + module/Rest/test/Util/RestUtilsTest.php | 1 + phpstan.neon | 1 - public/index.php | 9 ++++++--- 311 files changed, 344 insertions(+), 25 deletions(-) diff --git a/composer.json b/composer.json index 4a312ec2..1515cfeb 100644 --- a/composer.json +++ b/composer.json @@ -64,7 +64,7 @@ "phpunit/phpcov": "^6.0", "phpunit/phpunit": "^8.3", "roave/security-advisories": "dev-master", - "shlinkio/php-coding-standard": "~1.2.2", + "shlinkio/php-coding-standard": "~2.0.0", "shlinkio/shlink-test-utils": "^1.0", "symfony/dotenv": "^4.3", "symfony/var-dumper": "^4.3", diff --git a/config/autoload/app_options.global.php b/config/autoload/app_options.global.php index 9b363f1f..e10f1b20 100644 --- a/config/autoload/app_options.global.php +++ b/config/autoload/app_options.global.php @@ -1,4 +1,5 @@ [ diff --git a/config/autoload/router.global.php b/config/autoload/router.global.php index 24f40e71..7ab1cc82 100644 --- a/config/autoload/router.global.php +++ b/config/autoload/router.global.php @@ -1,4 +1,5 @@ get(EntityManager::class); +return (function () { + /** @var ContainerInterface|ServiceManager $container */ + $container = include __DIR__ . '/container.php'; + $em = $container->get(EntityManager::class); -return ConsoleRunner::createHelperSet($em); + return ConsoleRunner::createHelperSet($em); +})(); diff --git a/config/config.php b/config/config.php index 3a44fb17..ed04d037 100644 --- a/config/config.php +++ b/config/config.php @@ -1,4 +1,5 @@ setTable('domains'); diff --git a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.ShortUrl.php b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.ShortUrl.php index 47bc9d10..8dd6dc49 100644 --- a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.ShortUrl.php +++ b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.ShortUrl.php @@ -1,4 +1,5 @@ setTable('short_urls') diff --git a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Tag.php b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Tag.php index b8a4ac33..8ecaa2c6 100644 --- a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Tag.php +++ b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Tag.php @@ -1,4 +1,5 @@ setTable('tags') diff --git a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Visit.php b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Visit.php index f16cf147..c30b83c9 100644 --- a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Visit.php +++ b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.Visit.php @@ -1,4 +1,5 @@ setTable('visits') diff --git a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.VisitLocation.php b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.VisitLocation.php index 762e5e13..073214d3 100644 --- a/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.VisitLocation.php +++ b/module/Core/config/entities-mappings/Shlinkio.Shlink.Core.Entity.VisitLocation.php @@ -1,4 +1,5 @@ setTable('visit_locations'); diff --git a/module/Core/config/entity-manager.config.php b/module/Core/config/entity-manager.config.php index 4d331494..d7af7ac5 100644 --- a/module/Core/config/entity-manager.config.php +++ b/module/Core/config/entity-manager.config.php @@ -1,4 +1,5 @@ getEntityManager()->getConnection()->getDatabasePlatform()->getName(); $ordering = $dbPlatform === 'postgresql' ? 'ASC' : 'DESC'; - $dql= <<setTable('api_keys'); diff --git a/module/Rest/config/entity-manager.config.php b/module/Rest/config/entity-manager.config.php index 4d331494..d7af7ac5 100644 --- a/module/Rest/config/entity-manager.config.php +++ b/module/Rest/config/entity-manager.config.php @@ -1,4 +1,5 @@ getAttribute(RouteResult::class); - if ($routeResult === null + if ( + $routeResult === null || $routeResult->isFailure() || $request->getMethod() === self::METHOD_OPTIONS || contains($this->routesWhitelist, $routeResult->getMatchedRouteName()) diff --git a/module/Rest/src/Middleware/BodyParserMiddleware.php b/module/Rest/src/Middleware/BodyParserMiddleware.php index 79ae52ee..5814753e 100644 --- a/module/Rest/src/Middleware/BodyParserMiddleware.php +++ b/module/Rest/src/Middleware/BodyParserMiddleware.php @@ -1,4 +1,5 @@ getParsedBody(); // In requests that do not allow body or if the body has already been parsed, continue to next middleware - if (! empty($currentParams) || contains([ - self::METHOD_GET, - self::METHOD_HEAD, - self::METHOD_OPTIONS, - ], $method)) { + if ( + ! empty($currentParams) + || contains([ + self::METHOD_GET, + self::METHOD_HEAD, + self::METHOD_OPTIONS, + ], $method) + ) { return $handler->handle($request); } diff --git a/module/Rest/src/Middleware/CrossDomainMiddleware.php b/module/Rest/src/Middleware/CrossDomainMiddleware.php index 9ebc84e7..aacda9fc 100644 --- a/module/Rest/src/Middleware/CrossDomainMiddleware.php +++ b/module/Rest/src/Middleware/CrossDomainMiddleware.php @@ -1,4 +1,5 @@ [new class extends Exception implements ContainerExceptionInterface { - }]; + $containerException = new class extends Exception implements ContainerExceptionInterface { + }; + + yield 'container exception' => [$containerException]; yield 'authentication exception' => [NoAuthenticationException::fromExpectedTypes([])]; } diff --git a/module/Rest/test/Middleware/BodyParserMiddlewareTest.php b/module/Rest/test/Middleware/BodyParserMiddlewareTest.php index df1216cd..fb69c695 100644 --- a/module/Rest/test/Middleware/BodyParserMiddlewareTest.php +++ b/module/Rest/test/Middleware/BodyParserMiddlewareTest.php @@ -1,4 +1,5 @@ get(Application::class)->run(); +(function () { + /** @var ContainerInterface $container */ + $container = include __DIR__ . '/../config/container.php'; + $container->get(Application::class)->run(); +})();