diff --git a/module/Core/test/Config/BasePathPrefixerTest.php b/module/Core/test/Config/BasePathPrefixerTest.php index fe4c7940..0e08fa89 100644 --- a/module/Core/test/Config/BasePathPrefixerTest.php +++ b/module/Core/test/Config/BasePathPrefixerTest.php @@ -9,8 +9,7 @@ use Shlinkio\Shlink\Core\Config\BasePathPrefixer; class BasePathPrefixerTest extends TestCase { - /** @var BasePathPrefixer */ - private $prefixer; + private BasePathPrefixer $prefixer; public function setUp(): void { diff --git a/module/Core/test/Config/DeprecatedConfigParserTest.php b/module/Core/test/Config/DeprecatedConfigParserTest.php index be76ba80..3d6d4815 100644 --- a/module/Core/test/Config/DeprecatedConfigParserTest.php +++ b/module/Core/test/Config/DeprecatedConfigParserTest.php @@ -11,8 +11,7 @@ use function array_merge; class DeprecatedConfigParserTest extends TestCase { - /** @var DeprecatedConfigParser */ - private $postProcessor; + private DeprecatedConfigParser $postProcessor; public function setUp(): void { diff --git a/module/Core/test/Domain/Resolver/PersistenceDomainResolverTest.php b/module/Core/test/Domain/Resolver/PersistenceDomainResolverTest.php index 4ba796ab..d3769af9 100644 --- a/module/Core/test/Domain/Resolver/PersistenceDomainResolverTest.php +++ b/module/Core/test/Domain/Resolver/PersistenceDomainResolverTest.php @@ -13,10 +13,8 @@ use Shlinkio\Shlink\Core\Entity\Domain; class PersistenceDomainResolverTest extends TestCase { - /** @var PersistenceDomainResolver */ - private $domainResolver; - /** @var ObjectProphecy */ - private $em; + private PersistenceDomainResolver $domainResolver; + private ObjectProphecy $em; public function setUp(): void { diff --git a/module/Core/test/Domain/Resolver/SimpleDomainResolverTest.php b/module/Core/test/Domain/Resolver/SimpleDomainResolverTest.php index 4fe4f74f..a0fa4bf1 100644 --- a/module/Core/test/Domain/Resolver/SimpleDomainResolverTest.php +++ b/module/Core/test/Domain/Resolver/SimpleDomainResolverTest.php @@ -10,8 +10,7 @@ use Shlinkio\Shlink\Core\Entity\Domain; class SimpleDomainResolverTest extends TestCase { - /** @var SimpleDomainResolver */ - private $domainResolver; + private SimpleDomainResolver $domainResolver; public function setUp(): void { diff --git a/module/Core/test/ErrorHandler/NotFoundRedirectHandlerTest.php b/module/Core/test/ErrorHandler/NotFoundRedirectHandlerTest.php index b7796e61..7672fbab 100644 --- a/module/Core/test/ErrorHandler/NotFoundRedirectHandlerTest.php +++ b/module/Core/test/ErrorHandler/NotFoundRedirectHandlerTest.php @@ -19,10 +19,8 @@ use Zend\Expressive\Router\RouteResult; class NotFoundRedirectHandlerTest extends TestCase { - /** @var NotFoundRedirectHandler */ - private $middleware; - /** @var NotFoundRedirectOptions */ - private $redirectOptions; + private NotFoundRedirectHandler $middleware; + private NotFoundRedirectOptions $redirectOptions; public function setUp(): void { diff --git a/module/Core/test/ErrorHandler/NotFoundTemplateHandlerTest.php b/module/Core/test/ErrorHandler/NotFoundTemplateHandlerTest.php index 7d763448..a9e2c4af 100644 --- a/module/Core/test/ErrorHandler/NotFoundTemplateHandlerTest.php +++ b/module/Core/test/ErrorHandler/NotFoundTemplateHandlerTest.php @@ -17,10 +17,8 @@ use Zend\Expressive\Template\TemplateRendererInterface; class NotFoundTemplateHandlerTest extends TestCase { - /** @var NotFoundTemplateHandler */ - private $handler; - /** @var ObjectProphecy */ - private $renderer; + private NotFoundTemplateHandler $handler; + private ObjectProphecy $renderer; public function setUp(): void { diff --git a/module/Core/test/EventDispatcher/LocateShortUrlVisitTest.php b/module/Core/test/EventDispatcher/LocateShortUrlVisitTest.php index a451ddea..0d79539e 100644 --- a/module/Core/test/EventDispatcher/LocateShortUrlVisitTest.php +++ b/module/Core/test/EventDispatcher/LocateShortUrlVisitTest.php @@ -27,18 +27,12 @@ use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface; class LocateShortUrlVisitTest extends TestCase { - /** @var LocateShortUrlVisit */ - private $locateVisit; - /** @var ObjectProphecy */ - private $ipLocationResolver; - /** @var ObjectProphecy */ - private $em; - /** @var ObjectProphecy */ - private $logger; - /** @var ObjectProphecy */ - private $dbUpdater; - /** @var ObjectProphecy */ - private $eventDispatcher; + private LocateShortUrlVisit $locateVisit; + private ObjectProphecy $ipLocationResolver; + private ObjectProphecy $em; + private ObjectProphecy $logger; + private ObjectProphecy $dbUpdater; + private ObjectProphecy $eventDispatcher; public function setUp(): void { diff --git a/module/Core/test/Middleware/QrCodeCacheMiddlewareTest.php b/module/Core/test/Middleware/QrCodeCacheMiddlewareTest.php index a11f9b0d..6bda041f 100644 --- a/module/Core/test/Middleware/QrCodeCacheMiddlewareTest.php +++ b/module/Core/test/Middleware/QrCodeCacheMiddlewareTest.php @@ -16,10 +16,8 @@ use Zend\Diactoros\Uri; class QrCodeCacheMiddlewareTest extends TestCase { - /** @var QrCodeCacheMiddleware */ - private $middleware; - /** @var Cache */ - private $cache; + private QrCodeCacheMiddleware $middleware; + private Cache $cache; public function setUp(): void { diff --git a/module/Core/test/Paginator/Adapter/ShortUrlRepositoryAdapterTest.php b/module/Core/test/Paginator/Adapter/ShortUrlRepositoryAdapterTest.php index 8bf69faf..f5192fde 100644 --- a/module/Core/test/Paginator/Adapter/ShortUrlRepositoryAdapterTest.php +++ b/module/Core/test/Paginator/Adapter/ShortUrlRepositoryAdapterTest.php @@ -13,8 +13,7 @@ use Shlinkio\Shlink\Core\Repository\ShortUrlRepositoryInterface; class ShortUrlRepositoryAdapterTest extends TestCase { - /** @var ObjectProphecy */ - private $repo; + private ObjectProphecy $repo; public function setUp(): void { diff --git a/module/Core/test/Service/ShortUrl/DeleteShortUrlServiceTest.php b/module/Core/test/Service/ShortUrl/DeleteShortUrlServiceTest.php index cbb99c57..22dddcb5 100644 --- a/module/Core/test/Service/ShortUrl/DeleteShortUrlServiceTest.php +++ b/module/Core/test/Service/ShortUrl/DeleteShortUrlServiceTest.php @@ -23,10 +23,8 @@ use function sprintf; class DeleteShortUrlServiceTest extends TestCase { - /** @var ObjectProphecy */ - private $em; - /** @var string */ - private $shortCode; + private ObjectProphecy $em; + private string $shortCode; public function setUp(): void { diff --git a/module/Core/test/Service/ShortUrlServiceTest.php b/module/Core/test/Service/ShortUrlServiceTest.php index 3dae00a7..d1f8697b 100644 --- a/module/Core/test/Service/ShortUrlServiceTest.php +++ b/module/Core/test/Service/ShortUrlServiceTest.php @@ -21,10 +21,8 @@ use function count; class ShortUrlServiceTest extends TestCase { - /** @var ShortUrlService */ - private $service; - /** @var ObjectProphecy|EntityManagerInterface */ - private $em; + private ShortUrlService $service; + private ObjectProphecy $em; public function setUp(): void { diff --git a/module/Core/test/Service/Tag/TagServiceTest.php b/module/Core/test/Service/Tag/TagServiceTest.php index d7e5b631..b8c9d59b 100644 --- a/module/Core/test/Service/Tag/TagServiceTest.php +++ b/module/Core/test/Service/Tag/TagServiceTest.php @@ -17,10 +17,8 @@ use Shlinkio\Shlink\Core\Service\Tag\TagService; class TagServiceTest extends TestCase { - /** @var TagService */ - private $service; - /** @var ObjectProphecy */ - private $em; + private TagService $service; + private ObjectProphecy $em; public function setUp(): void { diff --git a/module/Core/test/Service/UrlShortenerTest.php b/module/Core/test/Service/UrlShortenerTest.php index 1995c921..25720671 100644 --- a/module/Core/test/Service/UrlShortenerTest.php +++ b/module/Core/test/Service/UrlShortenerTest.php @@ -27,12 +27,9 @@ use function array_map; class UrlShortenerTest extends TestCase { - /** @var UrlShortener */ - private $urlShortener; - /** @var ObjectProphecy */ - private $em; - /** @var ObjectProphecy */ - private $urlValidator; + private UrlShortener $urlShortener; + private ObjectProphecy $em; + private ObjectProphecy $urlValidator; public function setUp(): void { diff --git a/module/Core/test/Service/VisitServiceTest.php b/module/Core/test/Service/VisitServiceTest.php index e7983254..42b201b2 100644 --- a/module/Core/test/Service/VisitServiceTest.php +++ b/module/Core/test/Service/VisitServiceTest.php @@ -28,10 +28,8 @@ use function sprintf; class VisitServiceTest extends TestCase { - /** @var VisitService */ - private $visitService; - /** @var ObjectProphecy */ - private $em; + private VisitService $visitService; + private ObjectProphecy $em; public function setUp(): void { diff --git a/module/Core/test/Service/VisitsTrackerTest.php b/module/Core/test/Service/VisitsTrackerTest.php index a59429fb..0cb4d205 100644 --- a/module/Core/test/Service/VisitsTrackerTest.php +++ b/module/Core/test/Service/VisitsTrackerTest.php @@ -23,12 +23,9 @@ use Zend\Stdlib\ArrayUtils; class VisitsTrackerTest extends TestCase { - /** @var VisitsTracker */ - private $visitsTracker; - /** @var ObjectProphecy */ - private $em; - /** @var EventDispatcherInterface */ - private $eventDispatcher; + private VisitsTracker $visitsTracker; + private ObjectProphecy $em; + private ObjectProphecy $eventDispatcher; public function setUp(): void { diff --git a/module/Core/test/Transformer/ShortUrlDataTransformerTest.php b/module/Core/test/Transformer/ShortUrlDataTransformerTest.php index 92f2c848..094e09d6 100644 --- a/module/Core/test/Transformer/ShortUrlDataTransformerTest.php +++ b/module/Core/test/Transformer/ShortUrlDataTransformerTest.php @@ -14,8 +14,7 @@ use function random_int; class ShortUrlDataTransformerTest extends TestCase { - /** @var ShortUrlDataTransformer */ - private $transformer; + private ShortUrlDataTransformer $transformer; public function setUp(): void { diff --git a/module/Core/test/Util/UrlValidatorTest.php b/module/Core/test/Util/UrlValidatorTest.php index 3a6880ea..e437c8e7 100644 --- a/module/Core/test/Util/UrlValidatorTest.php +++ b/module/Core/test/Util/UrlValidatorTest.php @@ -17,10 +17,8 @@ use Zend\Diactoros\Response; class UrlValidatorTest extends TestCase { - /** @var UrlValidator */ - private $urlValidator; - /** @var ObjectProphecy */ - private $httpClient; + private UrlValidator $urlValidator; + private ObjectProphecy $httpClient; public function setUp(): void { diff --git a/module/Rest/src/Action/AbstractRestAction.php b/module/Rest/src/Action/AbstractRestAction.php index 8eb9ceb4..826290b7 100644 --- a/module/Rest/src/Action/AbstractRestAction.php +++ b/module/Rest/src/Action/AbstractRestAction.php @@ -17,8 +17,7 @@ abstract class AbstractRestAction implements RequestHandlerInterface, RequestMet protected const ROUTE_PATH = ''; protected const ROUTE_ALLOWED_METHODS = []; - /** @var LoggerInterface */ - protected $logger; + protected LoggerInterface $logger; public function __construct(?LoggerInterface $logger = null) { diff --git a/module/Rest/src/Action/HealthAction.php b/module/Rest/src/Action/HealthAction.php index ac548fde..eeec763d 100644 --- a/module/Rest/src/Action/HealthAction.php +++ b/module/Rest/src/Action/HealthAction.php @@ -21,10 +21,8 @@ class HealthAction extends AbstractRestAction protected const ROUTE_PATH = '/health'; protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; - /** @var AppOptions */ - private $options; - /** @var Connection */ - private $conn; + private AppOptions $options; + private Connection $conn; public function __construct(Connection $conn, AppOptions $options, ?LoggerInterface $logger = null) { diff --git a/module/Rest/src/Action/ShortUrl/AbstractCreateShortUrlAction.php b/module/Rest/src/Action/ShortUrl/AbstractCreateShortUrlAction.php index af392067..d6deae27 100644 --- a/module/Rest/src/Action/ShortUrl/AbstractCreateShortUrlAction.php +++ b/module/Rest/src/Action/ShortUrl/AbstractCreateShortUrlAction.php @@ -16,10 +16,8 @@ use Zend\Diactoros\Response\JsonResponse; abstract class AbstractCreateShortUrlAction extends AbstractRestAction { - /** @var UrlShortenerInterface */ - private $urlShortener; - /** @var array */ - private $domainConfig; + private UrlShortenerInterface $urlShortener; + private array $domainConfig; public function __construct( UrlShortenerInterface $urlShortener, diff --git a/module/Rest/src/Action/ShortUrl/DeleteShortUrlAction.php b/module/Rest/src/Action/ShortUrl/DeleteShortUrlAction.php index ba39ec82..d7a18007 100644 --- a/module/Rest/src/Action/ShortUrl/DeleteShortUrlAction.php +++ b/module/Rest/src/Action/ShortUrl/DeleteShortUrlAction.php @@ -16,8 +16,7 @@ class DeleteShortUrlAction extends AbstractRestAction protected const ROUTE_PATH = '/short-urls/{shortCode}'; protected const ROUTE_ALLOWED_METHODS = [self::METHOD_DELETE]; - /** @var DeleteShortUrlServiceInterface */ - private $deleteShortUrlService; + private DeleteShortUrlServiceInterface $deleteShortUrlService; public function __construct(DeleteShortUrlServiceInterface $deleteShortUrlService, ?LoggerInterface $logger = null) { diff --git a/module/Rest/src/Action/ShortUrl/EditShortUrlAction.php b/module/Rest/src/Action/ShortUrl/EditShortUrlAction.php index 33796f7d..f7c87d0d 100644 --- a/module/Rest/src/Action/ShortUrl/EditShortUrlAction.php +++ b/module/Rest/src/Action/ShortUrl/EditShortUrlAction.php @@ -17,8 +17,7 @@ class EditShortUrlAction extends AbstractRestAction protected const ROUTE_PATH = '/short-urls/{shortCode}'; protected const ROUTE_ALLOWED_METHODS = [self::METHOD_PATCH, self::METHOD_PUT]; - /** @var ShortUrlServiceInterface */ - private $shortUrlService; + private ShortUrlServiceInterface $shortUrlService; public function __construct(ShortUrlServiceInterface $shortUrlService, ?LoggerInterface $logger = null) { diff --git a/module/Rest/src/Action/ShortUrl/EditShortUrlTagsAction.php b/module/Rest/src/Action/ShortUrl/EditShortUrlTagsAction.php index 208be169..4fe61e4c 100644 --- a/module/Rest/src/Action/ShortUrl/EditShortUrlTagsAction.php +++ b/module/Rest/src/Action/ShortUrl/EditShortUrlTagsAction.php @@ -17,8 +17,7 @@ class EditShortUrlTagsAction extends AbstractRestAction protected const ROUTE_PATH = '/short-urls/{shortCode}/tags'; protected const ROUTE_ALLOWED_METHODS = [self::METHOD_PUT]; - /** @var ShortUrlServiceInterface */ - private $shortUrlService; + private ShortUrlServiceInterface $shortUrlService; public function __construct(ShortUrlServiceInterface $shortUrlService, ?LoggerInterface $logger = null) { diff --git a/module/Rest/src/Action/ShortUrl/ListShortUrlsAction.php b/module/Rest/src/Action/ShortUrl/ListShortUrlsAction.php index 87e7930b..98b48dc5 100644 --- a/module/Rest/src/Action/ShortUrl/ListShortUrlsAction.php +++ b/module/Rest/src/Action/ShortUrl/ListShortUrlsAction.php @@ -23,10 +23,8 @@ class ListShortUrlsAction extends AbstractRestAction protected const ROUTE_PATH = '/short-urls'; protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; - /** @var ShortUrlServiceInterface */ - private $shortUrlService; - /** @var array */ - private $domainConfig; + private ShortUrlServiceInterface $shortUrlService; + private array $domainConfig; public function __construct( ShortUrlServiceInterface $shortUrlService, diff --git a/module/Rest/src/Action/ShortUrl/ResolveShortUrlAction.php b/module/Rest/src/Action/ShortUrl/ResolveShortUrlAction.php index e041f4dc..5089ff22 100644 --- a/module/Rest/src/Action/ShortUrl/ResolveShortUrlAction.php +++ b/module/Rest/src/Action/ShortUrl/ResolveShortUrlAction.php @@ -18,10 +18,8 @@ class ResolveShortUrlAction extends AbstractRestAction protected const ROUTE_PATH = '/short-urls/{shortCode}'; protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; - /** @var UrlShortenerInterface */ - private $urlShortener; - /** @var array */ - private $domainConfig; + private UrlShortenerInterface $urlShortener; + private array $domainConfig; public function __construct( UrlShortenerInterface $urlShortener, diff --git a/module/Rest/src/Action/ShortUrl/SingleStepCreateShortUrlAction.php b/module/Rest/src/Action/ShortUrl/SingleStepCreateShortUrlAction.php index 834c6b12..8a11d1d5 100644 --- a/module/Rest/src/Action/ShortUrl/SingleStepCreateShortUrlAction.php +++ b/module/Rest/src/Action/ShortUrl/SingleStepCreateShortUrlAction.php @@ -17,8 +17,7 @@ class SingleStepCreateShortUrlAction extends AbstractCreateShortUrlAction protected const ROUTE_PATH = '/short-urls/shorten'; protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; - /** @var ApiKeyServiceInterface */ - private $apiKeyService; + private ApiKeyServiceInterface $apiKeyService; public function __construct( UrlShortenerInterface $urlShortener, diff --git a/module/Rest/src/Action/Tag/CreateTagsAction.php b/module/Rest/src/Action/Tag/CreateTagsAction.php index c26e274b..645de78d 100644 --- a/module/Rest/src/Action/Tag/CreateTagsAction.php +++ b/module/Rest/src/Action/Tag/CreateTagsAction.php @@ -16,8 +16,7 @@ class CreateTagsAction extends AbstractRestAction protected const ROUTE_PATH = '/tags'; protected const ROUTE_ALLOWED_METHODS = [self::METHOD_POST]; - /** @var TagServiceInterface */ - private $tagService; + private TagServiceInterface $tagService; public function __construct(TagServiceInterface $tagService, ?LoggerInterface $logger = null) { diff --git a/module/Rest/src/Action/Tag/DeleteTagsAction.php b/module/Rest/src/Action/Tag/DeleteTagsAction.php index 3d22d8dc..941e51df 100644 --- a/module/Rest/src/Action/Tag/DeleteTagsAction.php +++ b/module/Rest/src/Action/Tag/DeleteTagsAction.php @@ -16,8 +16,7 @@ class DeleteTagsAction extends AbstractRestAction protected const ROUTE_PATH = '/tags'; protected const ROUTE_ALLOWED_METHODS = [self::METHOD_DELETE]; - /** @var TagServiceInterface */ - private $tagService; + private TagServiceInterface $tagService; public function __construct(TagServiceInterface $tagService, ?LoggerInterface $logger = null) { diff --git a/module/Rest/src/Action/Tag/ListTagsAction.php b/module/Rest/src/Action/Tag/ListTagsAction.php index 22c85fb1..78f507e6 100644 --- a/module/Rest/src/Action/Tag/ListTagsAction.php +++ b/module/Rest/src/Action/Tag/ListTagsAction.php @@ -16,8 +16,7 @@ class ListTagsAction extends AbstractRestAction protected const ROUTE_PATH = '/tags'; protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; - /** @var TagServiceInterface */ - private $tagService; + private TagServiceInterface $tagService; public function __construct(TagServiceInterface $tagService, ?LoggerInterface $logger = null) { diff --git a/module/Rest/src/Action/Tag/UpdateTagAction.php b/module/Rest/src/Action/Tag/UpdateTagAction.php index 175ed0a0..b1a3a4b6 100644 --- a/module/Rest/src/Action/Tag/UpdateTagAction.php +++ b/module/Rest/src/Action/Tag/UpdateTagAction.php @@ -17,8 +17,7 @@ class UpdateTagAction extends AbstractRestAction protected const ROUTE_PATH = '/tags'; protected const ROUTE_ALLOWED_METHODS = [self::METHOD_PUT]; - /** @var TagServiceInterface */ - private $tagService; + private TagServiceInterface $tagService; public function __construct(TagServiceInterface $tagService, ?LoggerInterface $logger = null) { diff --git a/module/Rest/src/Action/Visit/GetVisitsAction.php b/module/Rest/src/Action/Visit/GetVisitsAction.php index ca8c2838..7483f9d2 100644 --- a/module/Rest/src/Action/Visit/GetVisitsAction.php +++ b/module/Rest/src/Action/Visit/GetVisitsAction.php @@ -20,8 +20,7 @@ class GetVisitsAction extends AbstractRestAction protected const ROUTE_PATH = '/short-urls/{shortCode}/visits'; protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; - /** @var VisitsTrackerInterface */ - private $visitsTracker; + private VisitsTrackerInterface $visitsTracker; public function __construct(VisitsTrackerInterface $visitsTracker, ?LoggerInterface $logger = null) { diff --git a/module/Rest/src/Authentication/Plugin/ApiKeyHeaderPlugin.php b/module/Rest/src/Authentication/Plugin/ApiKeyHeaderPlugin.php index 14735f9a..bf28748f 100644 --- a/module/Rest/src/Authentication/Plugin/ApiKeyHeaderPlugin.php +++ b/module/Rest/src/Authentication/Plugin/ApiKeyHeaderPlugin.php @@ -13,8 +13,7 @@ class ApiKeyHeaderPlugin implements AuthenticationPluginInterface { public const HEADER_NAME = 'X-Api-Key'; - /** @var ApiKeyServiceInterface */ - private $apiKeyService; + private ApiKeyServiceInterface $apiKeyService; public function __construct(ApiKeyServiceInterface $apiKeyService) { diff --git a/module/Rest/src/Authentication/RequestToHttpAuthPlugin.php b/module/Rest/src/Authentication/RequestToHttpAuthPlugin.php index c10c0321..9496ceff 100644 --- a/module/Rest/src/Authentication/RequestToHttpAuthPlugin.php +++ b/module/Rest/src/Authentication/RequestToHttpAuthPlugin.php @@ -20,8 +20,7 @@ class RequestToHttpAuthPlugin implements RequestToHttpAuthPluginInterface Plugin\AuthorizationHeaderPlugin::HEADER_NAME, ]; - /** @var AuthenticationPluginManagerInterface */ - private $authPluginManager; + private AuthenticationPluginManagerInterface $authPluginManager; public function __construct(AuthenticationPluginManagerInterface $authPluginManager) { diff --git a/module/Rest/src/ConfigProvider.php b/module/Rest/src/ConfigProvider.php index 0c0e99a5..8624ad66 100644 --- a/module/Rest/src/ConfigProvider.php +++ b/module/Rest/src/ConfigProvider.php @@ -4,6 +4,8 @@ declare(strict_types=1); namespace Shlinkio\Shlink\Rest; +use Closure; + use function Shlinkio\Shlink\Common\loadConfigFromGlob; use function sprintf; @@ -11,14 +13,11 @@ class ConfigProvider { private const ROUTES_PREFIX = '/rest/v{version:1|2}'; - /** @var callable */ - private $loadConfig; + private Closure $loadConfig; public function __construct(?callable $loadConfig = null) { - $this->loadConfig = $loadConfig ?? function (string $glob) { - return loadConfigFromGlob($glob); - }; + $this->loadConfig = Closure::fromCallable($loadConfig ?? fn (string $glob) => loadConfigFromGlob($glob)); } public function __invoke() diff --git a/module/Rest/src/Entity/ApiKey.php b/module/Rest/src/Entity/ApiKey.php index 887768d1..8c6d3aeb 100644 --- a/module/Rest/src/Entity/ApiKey.php +++ b/module/Rest/src/Entity/ApiKey.php @@ -12,12 +12,9 @@ class ApiKey extends AbstractEntity { use StringUtilsTrait; - /** @var string */ - private $key; - /** @var Chronos|null */ - private $expirationDate; - /** @var bool */ - private $enabled; + private string $key; + private ?Chronos $expirationDate; + private bool $enabled; public function __construct(?Chronos $expirationDate = null) { diff --git a/module/Rest/src/Middleware/AuthenticationMiddleware.php b/module/Rest/src/Middleware/AuthenticationMiddleware.php index 4fd44bcf..caa2a6f4 100644 --- a/module/Rest/src/Middleware/AuthenticationMiddleware.php +++ b/module/Rest/src/Middleware/AuthenticationMiddleware.php @@ -17,10 +17,8 @@ use function Functional\contains; class AuthenticationMiddleware implements MiddlewareInterface, StatusCodeInterface, RequestMethodInterface { - /** @var array */ - private $routesWhitelist; - /** @var RequestToHttpAuthPluginInterface */ - private $requestToAuthPlugin; + private array $routesWhitelist; + private RequestToHttpAuthPluginInterface $requestToAuthPlugin; public function __construct(RequestToHttpAuthPluginInterface $requestToAuthPlugin, array $routesWhitelist) { diff --git a/module/Rest/src/Middleware/BackwardsCompatibleProblemDetailsMiddleware.php b/module/Rest/src/Middleware/BackwardsCompatibleProblemDetailsMiddleware.php index 0812c7e0..65bd12b0 100644 --- a/module/Rest/src/Middleware/BackwardsCompatibleProblemDetailsMiddleware.php +++ b/module/Rest/src/Middleware/BackwardsCompatibleProblemDetailsMiddleware.php @@ -22,10 +22,8 @@ class BackwardsCompatibleProblemDetailsMiddleware implements MiddlewareInterface 'message' => 'detail', ]; - /** @var array */ - private $defaultTypeFallbacks; - /** @var int */ - private $jsonFlags; + private array $defaultTypeFallbacks; + private int $jsonFlags; public function __construct(array $defaultTypeFallbacks, int $jsonFlags) { diff --git a/module/Rest/src/Service/ApiKeyService.php b/module/Rest/src/Service/ApiKeyService.php index 030957fd..baa545c0 100644 --- a/module/Rest/src/Service/ApiKeyService.php +++ b/module/Rest/src/Service/ApiKeyService.php @@ -13,8 +13,7 @@ use function sprintf; class ApiKeyService implements ApiKeyServiceInterface { - /** @var EntityManagerInterface */ - private $em; + private EntityManagerInterface $em; public function __construct(EntityManagerInterface $em) { diff --git a/module/Rest/test/Action/AuthenticateActionTest.php b/module/Rest/test/Action/AuthenticateActionTest.php index eb4ca6dc..84aa8fbe 100644 --- a/module/Rest/test/Action/AuthenticateActionTest.php +++ b/module/Rest/test/Action/AuthenticateActionTest.php @@ -15,6 +15,7 @@ use Zend\Diactoros\ServerRequest; use function strpos; +/** @deprecated */ class AuthenticateActionTest extends TestCase { /** @var AuthenticateAction */ diff --git a/module/Rest/test/Action/HealthActionTest.php b/module/Rest/test/Action/HealthActionTest.php index a52b7d5e..23d7dd88 100644 --- a/module/Rest/test/Action/HealthActionTest.php +++ b/module/Rest/test/Action/HealthActionTest.php @@ -15,10 +15,8 @@ use Zend\Diactoros\ServerRequest; class HealthActionTest extends TestCase { - /** @var HealthAction */ - private $action; - /** @var ObjectProphecy */ - private $conn; + private HealthAction $action; + private ObjectProphecy $conn; public function setUp(): void { diff --git a/module/Rest/test/Action/ShortUrl/CreateShortUrlActionTest.php b/module/Rest/test/Action/ShortUrl/CreateShortUrlActionTest.php index 37f737f9..5dd76142 100644 --- a/module/Rest/test/Action/ShortUrl/CreateShortUrlActionTest.php +++ b/module/Rest/test/Action/ShortUrl/CreateShortUrlActionTest.php @@ -26,10 +26,8 @@ class CreateShortUrlActionTest extends TestCase 'hostname' => 'foo.com', ]; - /** @var CreateShortUrlAction */ - private $action; - /** @var ObjectProphecy */ - private $urlShortener; + private CreateShortUrlAction $action; + private ObjectProphecy $urlShortener; public function setUp(): void { diff --git a/module/Rest/test/Action/ShortUrl/DeleteShortUrlActionTest.php b/module/Rest/test/Action/ShortUrl/DeleteShortUrlActionTest.php index 782181ce..df0cde37 100644 --- a/module/Rest/test/Action/ShortUrl/DeleteShortUrlActionTest.php +++ b/module/Rest/test/Action/ShortUrl/DeleteShortUrlActionTest.php @@ -13,10 +13,8 @@ use Zend\Diactoros\ServerRequest; class DeleteShortUrlActionTest extends TestCase { - /** @var DeleteShortUrlAction */ - private $action; - /** @var ObjectProphecy */ - private $service; + private DeleteShortUrlAction $action; + private ObjectProphecy $service; public function setUp(): void { diff --git a/module/Rest/test/Action/ShortUrl/EditShortUrlActionTest.php b/module/Rest/test/Action/ShortUrl/EditShortUrlActionTest.php index ff86117e..e85c2f04 100644 --- a/module/Rest/test/Action/ShortUrl/EditShortUrlActionTest.php +++ b/module/Rest/test/Action/ShortUrl/EditShortUrlActionTest.php @@ -15,10 +15,8 @@ use Zend\Diactoros\ServerRequest; class EditShortUrlActionTest extends TestCase { - /** @var EditShortUrlAction */ - private $action; - /** @var ObjectProphecy */ - private $shortUrlService; + private EditShortUrlAction $action; + private ObjectProphecy $shortUrlService; public function setUp(): void { diff --git a/module/Rest/test/Action/ShortUrl/EditShortUrlTagsActionTest.php b/module/Rest/test/Action/ShortUrl/EditShortUrlTagsActionTest.php index 17293f05..e8a398fb 100644 --- a/module/Rest/test/Action/ShortUrl/EditShortUrlTagsActionTest.php +++ b/module/Rest/test/Action/ShortUrl/EditShortUrlTagsActionTest.php @@ -14,10 +14,8 @@ use Zend\Diactoros\ServerRequest; class EditShortUrlTagsActionTest extends TestCase { - /** @var EditShortUrlTagsAction */ - private $action; - /** @var ObjectProphecy */ - private $shortUrlService; + private EditShortUrlTagsAction $action; + private ObjectProphecy $shortUrlService; public function setUp(): void { diff --git a/module/Rest/test/Action/ShortUrl/ListShortUrlsActionTest.php b/module/Rest/test/Action/ShortUrl/ListShortUrlsActionTest.php index 1dfdc258..1e083eb9 100644 --- a/module/Rest/test/Action/ShortUrl/ListShortUrlsActionTest.php +++ b/module/Rest/test/Action/ShortUrl/ListShortUrlsActionTest.php @@ -18,12 +18,9 @@ use Zend\Paginator\Paginator; class ListShortUrlsActionTest extends TestCase { - /** @var ListShortUrlsAction */ - private $action; - /** @var ObjectProphecy */ - private $service; - /** @var ObjectProphecy */ - private $logger; + private ListShortUrlsAction $action; + private ObjectProphecy $service; + private ObjectProphecy $logger; public function setUp(): void { diff --git a/module/Rest/test/Action/ShortUrl/ResolveShortUrlActionTest.php b/module/Rest/test/Action/ShortUrl/ResolveShortUrlActionTest.php index b77a6e45..3fcc8e75 100644 --- a/module/Rest/test/Action/ShortUrl/ResolveShortUrlActionTest.php +++ b/module/Rest/test/Action/ShortUrl/ResolveShortUrlActionTest.php @@ -15,10 +15,8 @@ use function strpos; class ResolveShortUrlActionTest extends TestCase { - /** @var ResolveShortUrlAction */ - private $action; - /** @var ObjectProphecy */ - private $urlShortener; + private ResolveShortUrlAction $action; + private ObjectProphecy $urlShortener; public function setUp(): void { diff --git a/module/Rest/test/Action/ShortUrl/SingleStepCreateShortUrlActionTest.php b/module/Rest/test/Action/ShortUrl/SingleStepCreateShortUrlActionTest.php index b0d8c65d..fe95b6ea 100644 --- a/module/Rest/test/Action/ShortUrl/SingleStepCreateShortUrlActionTest.php +++ b/module/Rest/test/Action/ShortUrl/SingleStepCreateShortUrlActionTest.php @@ -19,12 +19,9 @@ use Zend\Diactoros\ServerRequest; class SingleStepCreateShortUrlActionTest extends TestCase { - /** @var SingleStepCreateShortUrlAction */ - private $action; - /** @var ObjectProphecy */ - private $urlShortener; - /** @var ObjectProphecy */ - private $apiKeyService; + private SingleStepCreateShortUrlAction $action; + private ObjectProphecy $urlShortener; + private ObjectProphecy $apiKeyService; public function setUp(): void { diff --git a/module/Rest/test/Action/Tag/CreateTagsActionTest.php b/module/Rest/test/Action/Tag/CreateTagsActionTest.php index c210d97c..e87dc163 100644 --- a/module/Rest/test/Action/Tag/CreateTagsActionTest.php +++ b/module/Rest/test/Action/Tag/CreateTagsActionTest.php @@ -13,10 +13,8 @@ use Zend\Diactoros\ServerRequest; class CreateTagsActionTest extends TestCase { - /** @var CreateTagsAction */ - private $action; - /** @var ObjectProphecy */ - private $tagService; + private CreateTagsAction $action; + private ObjectProphecy $tagService; public function setUp(): void { diff --git a/module/Rest/test/Action/Tag/DeleteTagsActionTest.php b/module/Rest/test/Action/Tag/DeleteTagsActionTest.php index 69df8938..98535056 100644 --- a/module/Rest/test/Action/Tag/DeleteTagsActionTest.php +++ b/module/Rest/test/Action/Tag/DeleteTagsActionTest.php @@ -12,10 +12,8 @@ use Zend\Diactoros\ServerRequest; class DeleteTagsActionTest extends TestCase { - /** @var DeleteTagsAction */ - private $action; - /** @var ObjectProphecy */ - private $tagService; + private DeleteTagsAction $action; + private ObjectProphecy $tagService; public function setUp(): void { diff --git a/module/Rest/test/Action/Tag/ListTagsActionTest.php b/module/Rest/test/Action/Tag/ListTagsActionTest.php index 03546fdb..5209ba02 100644 --- a/module/Rest/test/Action/Tag/ListTagsActionTest.php +++ b/module/Rest/test/Action/Tag/ListTagsActionTest.php @@ -15,10 +15,8 @@ use function Shlinkio\Shlink\Common\json_decode; class ListTagsActionTest extends TestCase { - /** @var ListTagsAction */ - private $action; - /** @var ObjectProphecy */ - private $tagService; + private ListTagsAction $action; + private ObjectProphecy $tagService; public function setUp(): void { diff --git a/module/Rest/test/Action/Tag/UpdateTagActionTest.php b/module/Rest/test/Action/Tag/UpdateTagActionTest.php index 3b068add..2a050c6c 100644 --- a/module/Rest/test/Action/Tag/UpdateTagActionTest.php +++ b/module/Rest/test/Action/Tag/UpdateTagActionTest.php @@ -14,10 +14,8 @@ use Zend\Diactoros\ServerRequest; class UpdateTagActionTest extends TestCase { - /** @var UpdateTagAction */ - private $action; - /** @var ObjectProphecy */ - private $tagService; + private UpdateTagAction $action; + private ObjectProphecy $tagService; public function setUp(): void { diff --git a/module/Rest/test/Action/Visit/GetVisitsActionTest.php b/module/Rest/test/Action/Visit/GetVisitsActionTest.php index 80e06085..767d095c 100644 --- a/module/Rest/test/Action/Visit/GetVisitsActionTest.php +++ b/module/Rest/test/Action/Visit/GetVisitsActionTest.php @@ -18,10 +18,8 @@ use Zend\Paginator\Paginator; class GetVisitsActionTest extends TestCase { - /** @var GetVisitsAction */ - private $action; - /** @var ObjectProphecy */ - private $visitsTracker; + private GetVisitsAction $action; + private ObjectProphecy $visitsTracker; public function setUp(): void { diff --git a/module/Rest/test/Authentication/AuthenticationPluginManagerFactoryTest.php b/module/Rest/test/Authentication/AuthenticationPluginManagerFactoryTest.php index 15beefc0..71bcfe9c 100644 --- a/module/Rest/test/Authentication/AuthenticationPluginManagerFactoryTest.php +++ b/module/Rest/test/Authentication/AuthenticationPluginManagerFactoryTest.php @@ -12,8 +12,7 @@ use Zend\ServiceManager\ServiceManager; class AuthenticationPluginManagerFactoryTest extends TestCase { - /** @var AuthenticationPluginManagerFactory */ - private $factory; + private AuthenticationPluginManagerFactory $factory; public function setUp(): void { diff --git a/module/Rest/test/Authentication/JWTServiceTest.php b/module/Rest/test/Authentication/JWTServiceTest.php index ab416ca0..76375fdc 100644 --- a/module/Rest/test/Authentication/JWTServiceTest.php +++ b/module/Rest/test/Authentication/JWTServiceTest.php @@ -13,6 +13,7 @@ use Shlinkio\Shlink\Rest\Exception\AuthenticationException; use function time; +/** @deprecated */ class JWTServiceTest extends TestCase { /** @var JWTService */ diff --git a/module/Rest/test/Authentication/Plugin/ApiKeyHeaderPluginTest.php b/module/Rest/test/Authentication/Plugin/ApiKeyHeaderPluginTest.php index 65cedcfc..36210918 100644 --- a/module/Rest/test/Authentication/Plugin/ApiKeyHeaderPluginTest.php +++ b/module/Rest/test/Authentication/Plugin/ApiKeyHeaderPluginTest.php @@ -15,10 +15,8 @@ use Zend\Diactoros\ServerRequest; class ApiKeyHeaderPluginTest extends TestCase { - /** @var ApiKeyHeaderPlugin */ - private $plugin; - /** @var ObjectProphecy */ - private $apiKeyService; + private ApiKeyHeaderPlugin $plugin; + private ObjectProphecy $apiKeyService; public function setUp(): void { diff --git a/module/Rest/test/Authentication/Plugin/AuthorizationHeaderPluginTest.php b/module/Rest/test/Authentication/Plugin/AuthorizationHeaderPluginTest.php index 0bd03e8a..71d6eb20 100644 --- a/module/Rest/test/Authentication/Plugin/AuthorizationHeaderPluginTest.php +++ b/module/Rest/test/Authentication/Plugin/AuthorizationHeaderPluginTest.php @@ -14,6 +14,7 @@ use Zend\Diactoros\ServerRequest; use function sprintf; +/** @deprecated */ class AuthorizationHeaderPluginTest extends TestCase { /** @var AuthorizationHeaderPlugin */ diff --git a/module/Rest/test/Authentication/RequestToAuthPluginTest.php b/module/Rest/test/Authentication/RequestToAuthPluginTest.php index a49a4e19..d4de01a8 100644 --- a/module/Rest/test/Authentication/RequestToAuthPluginTest.php +++ b/module/Rest/test/Authentication/RequestToAuthPluginTest.php @@ -19,10 +19,8 @@ use function sprintf; class RequestToAuthPluginTest extends TestCase { - /** @var RequestToHttpAuthPlugin */ - private $requestToPlugin; - /** @var ObjectProphecy */ - private $pluginManager; + private RequestToHttpAuthPlugin $requestToPlugin; + private ObjectProphecy $pluginManager; public function setUp(): void { diff --git a/module/Rest/test/ConfigProviderTest.php b/module/Rest/test/ConfigProviderTest.php index 2922faad..f914edf6 100644 --- a/module/Rest/test/ConfigProviderTest.php +++ b/module/Rest/test/ConfigProviderTest.php @@ -9,8 +9,7 @@ use Shlinkio\Shlink\Rest\ConfigProvider; class ConfigProviderTest extends TestCase { - /** @var ConfigProvider */ - private $configProvider; + private ConfigProvider $configProvider; public function setUp(): void { diff --git a/module/Rest/test/EventDispatcher/NotifyVisitToWebHooksTest.php b/module/Rest/test/EventDispatcher/NotifyVisitToWebHooksTest.php index 305f2e23..bb043e66 100644 --- a/module/Rest/test/EventDispatcher/NotifyVisitToWebHooksTest.php +++ b/module/Rest/test/EventDispatcher/NotifyVisitToWebHooksTest.php @@ -28,12 +28,9 @@ use function Functional\contains; class NotifyVisitToWebHooksTest extends TestCase { - /** @var ObjectProphecy */ - private $httpClient; - /** @var ObjectProphecy */ - private $em; - /** @var ObjectProphecy */ - private $logger; + private ObjectProphecy $httpClient; + private ObjectProphecy $em; + private ObjectProphecy $logger; public function setUp(): void { diff --git a/module/Rest/test/Middleware/AuthenticationMiddlewareTest.php b/module/Rest/test/Middleware/AuthenticationMiddlewareTest.php index 36dfaeee..8f9e8052 100644 --- a/module/Rest/test/Middleware/AuthenticationMiddlewareTest.php +++ b/module/Rest/test/Middleware/AuthenticationMiddlewareTest.php @@ -26,12 +26,9 @@ use function Zend\Stratigility\middleware; class AuthenticationMiddlewareTest extends TestCase { - /** @var AuthenticationMiddleware */ - private $middleware; - /** @var ObjectProphecy */ - private $requestToPlugin; - /** @var ObjectProphecy */ - private $logger; + private AuthenticationMiddleware $middleware; + private ObjectProphecy $requestToPlugin; + private ObjectProphecy $logger; public function setUp(): void { diff --git a/module/Rest/test/Middleware/BackwardsCompatibleProblemDetailsMiddlewareTest.php b/module/Rest/test/Middleware/BackwardsCompatibleProblemDetailsMiddlewareTest.php index 4d47c4cb..5f58e7eb 100644 --- a/module/Rest/test/Middleware/BackwardsCompatibleProblemDetailsMiddlewareTest.php +++ b/module/Rest/test/Middleware/BackwardsCompatibleProblemDetailsMiddlewareTest.php @@ -14,10 +14,8 @@ use Zend\Diactoros\Uri; class BackwardsCompatibleProblemDetailsMiddlewareTest extends TestCase { - /** @var BackwardsCompatibleProblemDetailsMiddleware */ - private $middleware; - /** @var ObjectProphecy */ - private $handler; + private BackwardsCompatibleProblemDetailsMiddleware $middleware; + private ObjectProphecy $handler; public function setUp(): void { diff --git a/module/Rest/test/Middleware/BodyParserMiddlewareTest.php b/module/Rest/test/Middleware/BodyParserMiddlewareTest.php index 829b4b59..ba8f27ef 100644 --- a/module/Rest/test/Middleware/BodyParserMiddlewareTest.php +++ b/module/Rest/test/Middleware/BodyParserMiddlewareTest.php @@ -18,8 +18,7 @@ use function array_shift; class BodyParserMiddlewareTest extends TestCase { - /** @var BodyParserMiddleware */ - private $middleware; + private BodyParserMiddleware $middleware; public function setUp(): void { diff --git a/module/Rest/test/Middleware/CrossDomainMiddlewareTest.php b/module/Rest/test/Middleware/CrossDomainMiddlewareTest.php index 1716c19e..735338ca 100644 --- a/module/Rest/test/Middleware/CrossDomainMiddlewareTest.php +++ b/module/Rest/test/Middleware/CrossDomainMiddlewareTest.php @@ -20,10 +20,8 @@ use function Zend\Stratigility\middleware; class CrossDomainMiddlewareTest extends TestCase { - /** @var CrossDomainMiddleware */ - private $middleware; - /** @var ObjectProphecy */ - private $handler; + private CrossDomainMiddleware $middleware; + private ObjectProphecy $handler; public function setUp(): void { diff --git a/module/Rest/test/Middleware/EmptyResponseImplicitOptionsMiddlewareFactoryTest.php b/module/Rest/test/Middleware/EmptyResponseImplicitOptionsMiddlewareFactoryTest.php index 23dc7983..fed1e1f8 100644 --- a/module/Rest/test/Middleware/EmptyResponseImplicitOptionsMiddlewareFactoryTest.php +++ b/module/Rest/test/Middleware/EmptyResponseImplicitOptionsMiddlewareFactoryTest.php @@ -12,8 +12,7 @@ use Zend\Expressive\Router\Middleware\ImplicitOptionsMiddleware; class EmptyResponseImplicitOptionsMiddlewareFactoryTest extends TestCase { - /** @var EmptyResponseImplicitOptionsMiddlewareFactory */ - private $factory; + private EmptyResponseImplicitOptionsMiddlewareFactory $factory; public function setUp(): void { diff --git a/module/Rest/test/Middleware/PathVersionMiddlewareTest.php b/module/Rest/test/Middleware/PathVersionMiddlewareTest.php index 887b8fbf..98e6698d 100644 --- a/module/Rest/test/Middleware/PathVersionMiddlewareTest.php +++ b/module/Rest/test/Middleware/PathVersionMiddlewareTest.php @@ -18,8 +18,7 @@ use function array_shift; class PathVersionMiddlewareTest extends TestCase { - /** @var PathVersionMiddleware */ - private $middleware; + private PathVersionMiddleware $middleware; public function setUp(): void { @@ -27,7 +26,7 @@ class PathVersionMiddlewareTest extends TestCase } /** @test */ - public function whenVersionIsProvidedRequestRemainsUnchanged() + public function whenVersionIsProvidedRequestRemainsUnchanged(): void { $request = (new ServerRequest())->withUri(new Uri('/v2/foo')); @@ -40,7 +39,7 @@ class PathVersionMiddlewareTest extends TestCase } /** @test */ - public function versionOneIsPrependedWhenNoVersionIsDefined() + public function versionOneIsPrependedWhenNoVersionIsDefined(): void { $request = (new ServerRequest())->withUri(new Uri('/bar/baz')); diff --git a/module/Rest/test/Middleware/ShortUrl/CreateShortUrlContentNegotiationMiddlewareTest.php b/module/Rest/test/Middleware/ShortUrl/CreateShortUrlContentNegotiationMiddlewareTest.php index 83903b82..bfcb2bcc 100644 --- a/module/Rest/test/Middleware/ShortUrl/CreateShortUrlContentNegotiationMiddlewareTest.php +++ b/module/Rest/test/Middleware/ShortUrl/CreateShortUrlContentNegotiationMiddlewareTest.php @@ -6,6 +6,7 @@ namespace ShlinkioTest\Shlink\Rest\Middleware\ShortUrl; use PHPUnit\Framework\TestCase; use Prophecy\Argument; +use Prophecy\Prophecy\ObjectProphecy; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; use Shlinkio\Shlink\Rest\Middleware\ShortUrl\CreateShortUrlContentNegotiationMiddleware; @@ -15,10 +16,8 @@ use Zend\Diactoros\ServerRequest; class CreateShortUrlContentNegotiationMiddlewareTest extends TestCase { - /** @var CreateShortUrlContentNegotiationMiddleware */ - private $middleware; - /** @var RequestHandlerInterface */ - private $requestHandler; + private CreateShortUrlContentNegotiationMiddleware $middleware; + private ObjectProphecy $requestHandler; public function setUp(): void {