diff --git a/src/bundle/Core/ApiLoader/CacheFactory.php b/src/bundle/Core/ApiLoader/CacheFactory.php index 39af86f7de..cfaf1ab429 100644 --- a/src/bundle/Core/ApiLoader/CacheFactory.php +++ b/src/bundle/Core/ApiLoader/CacheFactory.php @@ -27,7 +27,7 @@ class CacheFactory implements ContainerAwareInterface * * @return \Symfony\Component\Cache\Adapter\TagAwareAdapterInterface */ - public function getCachePool(ConfigResolverInterface $configResolver) + public function getCachePool(ConfigResolverInterface $configResolver): TagAwareAdapterInterface|TagAwareAdapter { /** @var \Symfony\Component\Cache\Adapter\AdapterInterface $cacheService */ $cacheService = $this->container->get($configResolver->getParameter('cache_service_name')); diff --git a/src/bundle/Core/ApiLoader/RepositoryFactory.php b/src/bundle/Core/ApiLoader/RepositoryFactory.php index 55a2d3af4c..2b026ef77c 100644 --- a/src/bundle/Core/ApiLoader/RepositoryFactory.php +++ b/src/bundle/Core/ApiLoader/RepositoryFactory.php @@ -39,21 +39,16 @@ */ class RepositoryFactory { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; /** * Map of system configured policies. - * - * @var array */ - private $policyMap; + private array $policyMap; - /** @var \Psr\Log\LoggerInterface */ - private $logger; + private LoggerInterface $logger; - /** @var \Ibexa\Contracts\Core\Repository\LanguageResolver */ - private $languageResolver; + private LanguageResolver $languageResolver; public function __construct( ConfigResolverInterface $configResolver, diff --git a/src/bundle/Core/ApiLoader/SearchEngineFactory.php b/src/bundle/Core/ApiLoader/SearchEngineFactory.php index 85debbdbb1..b12524b181 100644 --- a/src/bundle/Core/ApiLoader/SearchEngineFactory.php +++ b/src/bundle/Core/ApiLoader/SearchEngineFactory.php @@ -37,7 +37,7 @@ public function __construct( * @param \Ibexa\Contracts\Core\Search\Handler $searchHandler * @param string $searchEngineIdentifier */ - public function registerSearchEngine(SearchHandler $searchHandler, $searchEngineIdentifier) + public function registerSearchEngine(SearchHandler $searchHandler, $searchEngineIdentifier): void { $this->searchEngines[$searchEngineIdentifier] = $searchHandler; } diff --git a/src/bundle/Core/ApiLoader/SearchEngineIndexerFactory.php b/src/bundle/Core/ApiLoader/SearchEngineIndexerFactory.php index 3f879135c3..837353fe0c 100644 --- a/src/bundle/Core/ApiLoader/SearchEngineIndexerFactory.php +++ b/src/bundle/Core/ApiLoader/SearchEngineIndexerFactory.php @@ -38,7 +38,7 @@ public function __construct( * @param \Ibexa\Core\Search\Common\Indexer $searchEngineIndexer * @param string $searchEngineIdentifier */ - public function registerSearchEngineIndexer(SearchEngineIndexer $searchEngineIndexer, $searchEngineIdentifier) + public function registerSearchEngineIndexer(SearchEngineIndexer $searchEngineIndexer, $searchEngineIdentifier): void { $this->searchEngineIndexers[$searchEngineIdentifier] = $searchEngineIndexer; } diff --git a/src/bundle/Core/Cache/Warmer/ProxyCacheWarmer.php b/src/bundle/Core/Cache/Warmer/ProxyCacheWarmer.php index 58f4b054ea..1d7c84d7dc 100644 --- a/src/bundle/Core/Cache/Warmer/ProxyCacheWarmer.php +++ b/src/bundle/Core/Cache/Warmer/ProxyCacheWarmer.php @@ -34,8 +34,7 @@ final class ProxyCacheWarmer implements CacheWarmerInterface Thumbnail::class, ]; - /** @var \Ibexa\Core\Repository\ProxyFactory\ProxyGeneratorInterface */ - private $proxyGenerator; + private ProxyGeneratorInterface $proxyGenerator; public function __construct(ProxyGeneratorInterface $proxyGenerator) { diff --git a/src/bundle/Core/Command/CheckURLsCommand.php b/src/bundle/Core/Command/CheckURLsCommand.php index 5b918c25f7..efd01e4d2c 100644 --- a/src/bundle/Core/Command/CheckURLsCommand.php +++ b/src/bundle/Core/Command/CheckURLsCommand.php @@ -32,17 +32,13 @@ class CheckURLsCommand extends Command private const DEFAULT_ITERATION_COUNT = 50; private const DEFAULT_REPOSITORY_USER = 'admin'; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ - private $userService; + private UserService $userService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\URLService */ - private $urlService; + private URLService $urlService; - /** @var \Ibexa\Bundle\Core\URLChecker\URLCheckerInterface */ - private $urlChecker; + private URLCheckerInterface $urlChecker; public function __construct( UserService $userService, diff --git a/src/bundle/Core/Command/CleanupVersionsCommand.php b/src/bundle/Core/Command/CleanupVersionsCommand.php index 99c08c070d..64219b2d62 100644 --- a/src/bundle/Core/Command/CleanupVersionsCommand.php +++ b/src/bundle/Core/Command/CleanupVersionsCommand.php @@ -243,7 +243,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int * * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException */ - protected function getObjectsIds($keep, $status, $excludedContentTypes = []) + protected function getObjectsIds($keep, $status, $excludedContentTypes = []): array { $query = $this->connection->createQueryBuilder() ->select('c.id') @@ -286,7 +286,7 @@ protected function getObjectsIds($keep, $status, $excludedContentTypes = []) * * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException */ - private function mapStatusToVersionInfoStatus($status) + private function mapStatusToVersionInfoStatus($status): int { if (array_key_exists($status, self::VERSION_STATUS)) { return self::VERSION_STATUS[$status]; diff --git a/src/bundle/Core/Command/DebugConfigResolverCommand.php b/src/bundle/Core/Command/DebugConfigResolverCommand.php index fae5cc7f40..d12d6d0cb8 100644 --- a/src/bundle/Core/Command/DebugConfigResolverCommand.php +++ b/src/bundle/Core/Command/DebugConfigResolverCommand.php @@ -25,11 +25,9 @@ )] class DebugConfigResolverCommand extends Command { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ - private $siteAccess; + private SiteAccess $siteAccess; public function __construct( ConfigResolverInterface $configResolver, @@ -44,7 +42,7 @@ public function __construct( /** * {@inheritdoc}. */ - public function configure() + public function configure(): void { $this->addArgument( 'parameter', diff --git a/src/bundle/Core/Command/DeleteContentTranslationCommand.php b/src/bundle/Core/Command/DeleteContentTranslationCommand.php index c9bcaabdf4..0e158de4a3 100644 --- a/src/bundle/Core/Command/DeleteContentTranslationCommand.php +++ b/src/bundle/Core/Command/DeleteContentTranslationCommand.php @@ -29,17 +29,14 @@ )] class DeleteContentTranslationCommand extends Command { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - private $repository; + private Repository $repository; /** @var \Ibexa\Contracts\Core\Repository\ContentService */ private $contentService; - /** @var \Symfony\Component\Console\Input\InputInterface */ - private $input; + private ?InputInterface $input = null; - /** @var \Symfony\Component\Console\Output\OutputInterface */ - private $output; + private ?OutputInterface $output = null; /** @var \Symfony\Component\Console\Helper\QuestionHelper */ private $questionHelper; @@ -159,7 +156,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int */ private function promptUserForMainLanguageChange( ContentInfo $contentInfo, - $languageCode, + string $languageCode, array $lastVersionLanguageCodes ) { $contentName = "#{$contentInfo->id} ($contentInfo->name)"; diff --git a/src/bundle/Core/Command/NormalizeImagesPathsCommand.php b/src/bundle/Core/Command/NormalizeImagesPathsCommand.php index a9125de330..af1ef7701c 100644 --- a/src/bundle/Core/Command/NormalizeImagesPathsCommand.php +++ b/src/bundle/Core/Command/NormalizeImagesPathsCommand.php @@ -9,6 +9,7 @@ namespace Ibexa\Bundle\Core\Command; use Doctrine\DBAL\Driver\Connection; +use Ibexa\Core\FieldType\Image\ImageStorage\Gateway; use Ibexa\Core\FieldType\Image\ImageStorage\Gateway as ImageStorageGateway; use Ibexa\Core\IO\Exception\BinaryFileNotFoundException; use Ibexa\Core\IO\FilePathNormalizerInterface; @@ -42,17 +43,13 @@ final class NormalizeImagesPathsCommand extends Command private const SKIP_HASHING_COMMAND_PARAMETER = 'no-hash'; - /** @var \Ibexa\Core\FieldType\Image\ImageStorage\Gateway */ - private $imageGateway; + private Gateway $imageGateway; - /** @var \Ibexa\Core\IO\FilePathNormalizerInterface */ - private $filePathNormalizer; + private FilePathNormalizerInterface $filePathNormalizer; - /** @var \Doctrine\DBAL\Driver\Connection */ - private $connection; + private Connection $connection; - /** @var \Ibexa\Core\IO\IOServiceInterface */ - private $ioService; + private IOServiceInterface $ioService; /** @var bool */ private $skipHashing; @@ -71,7 +68,7 @@ public function __construct( $this->ioService = $ioService; } - protected function configure() + protected function configure(): void { $beforeRunningHints = self::BEFORE_RUNNING_HINTS; @@ -205,7 +202,7 @@ private function updateImagePath( } protected function updateImagePathsToNormalize( - $imageData, + array $imageData, array $imagePathsToNormalize ): array { $filePath = $imageData['filepath']; diff --git a/src/bundle/Core/Command/RegenerateUrlAliasesCommand.php b/src/bundle/Core/Command/RegenerateUrlAliasesCommand.php index 9e0acb2c95..15ab0dddbc 100644 --- a/src/bundle/Core/Command/RegenerateUrlAliasesCommand.php +++ b/src/bundle/Core/Command/RegenerateUrlAliasesCommand.php @@ -41,11 +41,9 @@ class RegenerateUrlAliasesCommand extends Command - Manually clear HTTP cache after running this command. EOT; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - private $repository; + private Repository $repository; - /** @var \Psr\Log\LoggerInterface */ - private $logger; + private LoggerInterface $logger; /** * @param \Ibexa\Contracts\Core\Repository\Repository $repository @@ -167,7 +165,7 @@ static function (Repository $repository): int { * * @return \Symfony\Component\Console\Helper\ProgressBar */ - protected function getProgressBar($maxSteps, OutputInterface $output) + protected function getProgressBar($maxSteps, OutputInterface $output): ProgressBar { $progressBar = new ProgressBar($output, $maxSteps); $progressBar->setFormat( @@ -186,7 +184,7 @@ protected function getProgressBar($maxSteps, OutputInterface $output) private function processLocations(array $locations, ProgressBar $progressBar): void { $contentList = $this->repository->sudo( - static function (Repository $repository) use ($locations) { + static function (Repository $repository) use ($locations): iterable { $contentInfoList = array_map( static function (Location $location) { return $location->contentInfo; @@ -211,7 +209,7 @@ static function (Location $location) { } $this->repository->sudo( - static function (Repository $repository) use ($location) { + static function (Repository $repository) use ($location): void { $repository->getURLAliasService()->refreshSystemUrlAliasesForLocation( $location ); @@ -247,7 +245,7 @@ static function (Repository $repository) use ($location) { private function loadAllLocations(int $offset, int $iterationCount): array { return $this->repository->sudo( - static function (Repository $repository) use ($offset, $iterationCount) { + static function (Repository $repository) use ($offset, $iterationCount): array { return $repository->getLocationService()->loadAllLocations($offset, $iterationCount); } ); @@ -267,7 +265,7 @@ private function loadSpecificLocations(array $locationIds, int $offset, int $ite $locationIds = array_slice($locationIds, $offset, $iterationCount); return $this->repository->sudo( - static function (Repository $repository) use ($locationIds) { + static function (Repository $repository) use ($locationIds): iterable { return $repository->getLocationService()->loadLocationList($locationIds); } ); @@ -283,7 +281,7 @@ static function (Repository $repository) use ($locationIds) { private function getFilteredLocationList(array $locationIds): array { $locations = $this->repository->sudo( - static function (Repository $repository) use ($locationIds) { + static function (Repository $repository) use ($locationIds): iterable { $locationService = $repository->getLocationService(); return $locationService->loadLocationList($locationIds); diff --git a/src/bundle/Core/Command/ReindexCommand.php b/src/bundle/Core/Command/ReindexCommand.php index f0d124359e..4b162f9adc 100644 --- a/src/bundle/Core/Command/ReindexCommand.php +++ b/src/bundle/Core/Command/ReindexCommand.php @@ -36,32 +36,24 @@ class ReindexCommand extends Command private const string IBEXA_CLOUD_CONFIG_FILE = '/run/config.json'; private const string LINUX_CPUINFO_FILE = '/proc/cpuinfo'; - /** @var \Ibexa\Core\Search\Common\Indexer|\Ibexa\Core\Search\Common\IncrementalIndexer */ - private $searchIndexer; + private Indexer $searchIndexer; - /** @var string */ - private $phpPath; + private string|null|bool $phpPath = null; - /** @var \Psr\Log\LoggerInterface */ - private $logger; + private LoggerInterface $logger; /** @var string */ private $siteaccess; - /** @var string */ - private $env; + private string $env; - /** @var bool */ - private $isDebug; + private bool $isDebug; - /** @var string */ - private $projectDir; + private string $projectDir; - /** @var \Ibexa\Contracts\Core\Search\Content\IndexerGateway */ - private $gateway; + private IndexerGateway $gateway; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Location\Handler */ - private $locationHandler; + private Handler $locationHandler; private ContentIdListGeneratorStrategyInterface $contentIdListGeneratorStrategy; @@ -97,7 +89,7 @@ public function __construct( * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output */ - public function initialize(InputInterface $input, OutputInterface $output) + public function initialize(InputInterface $input, OutputInterface $output): void { parent::initialize($input, $output); if (!$this->searchIndexer instanceof Indexer) { diff --git a/src/bundle/Core/Command/ResizeOriginalImagesCommand.php b/src/bundle/Core/Command/ResizeOriginalImagesCommand.php index 4ad67d87ee..360a32224f 100644 --- a/src/bundle/Core/Command/ResizeOriginalImagesCommand.php +++ b/src/bundle/Core/Command/ResizeOriginalImagesCommand.php @@ -43,32 +43,23 @@ class ResizeOriginalImagesCommand extends Command public const DEFAULT_ITERATION_COUNT = 25; public const DEFAULT_REPOSITORY_USER = 'admin'; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ - private $userService; + private UserService $userService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - private $contentTypeService; + private ContentTypeService $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ - private $searchService; + private SearchService $searchService; - /** @var \Liip\ImagineBundle\Imagine\Filter\FilterManager */ - private $filterManager; + private FilterManager $filterManager; - /** @var \Ibexa\Core\IO\IOServiceInterface */ - private $ioService; + private IOServiceInterface $ioService; - /** @var \Symfony\Component\Mime\MimeTypesInterface */ - private $mimeTypes; + private MimeTypesInterface $mimeTypes; - /** @var \Imagine\Image\ImagineInterface */ - private $imagine; + private ImagineInterface $imagine; public function __construct( PermissionResolver $permissionResolver, diff --git a/src/bundle/Core/Command/SetSystemContentTypeGroupCommand.php b/src/bundle/Core/Command/SetSystemContentTypeGroupCommand.php index 6d0fb9d1e9..eeffcc038d 100644 --- a/src/bundle/Core/Command/SetSystemContentTypeGroupCommand.php +++ b/src/bundle/Core/Command/SetSystemContentTypeGroupCommand.php @@ -31,14 +31,11 @@ final class SetSystemContentTypeGroupCommand extends Command { private const DEFAULT_REPOSITORY_USER = 'admin'; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - private $contentTypeService; + private ContentTypeService $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ - private $userService; + private UserService $userService; public function __construct( ContentTypeService $contentTypeService, @@ -52,7 +49,7 @@ public function __construct( $this->userService = $userService; } - protected function configure() + protected function configure(): void { $this ->addArgument('content-type-group-identifier', InputArgument::REQUIRED, 'ContentTypGroup identifier') diff --git a/src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php b/src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php index 4df1cdd56f..8678218b9b 100644 --- a/src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php +++ b/src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php @@ -48,17 +48,13 @@ class UpdateTimestampsToUTCCommand extends Command /** @var string */ private $mode; - /** @var string */ - private $from; + private ?int $from = null; - /** @var string */ - private $to; + private ?int $to = null; - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; - /** @var string */ - private $phpPath; + private string|bool|null $phpPath = null; /** @var bool */ private $dryRun; @@ -441,7 +437,7 @@ protected function validateTimezone($timezone, OutputInterface $output) * * @return \Symfony\Component\Console\Helper\ProgressBar */ - protected function getProgressBar($maxSteps, OutputInterface $output) + protected function getProgressBar($maxSteps, OutputInterface $output): ProgressBar { $progressBar = new ProgressBar($output, $maxSteps); $progressBar->setFormat( diff --git a/src/bundle/Core/Command/VirtualFieldDuplicateFixCommand.php b/src/bundle/Core/Command/VirtualFieldDuplicateFixCommand.php index 134c86acec..74ebc3f41a 100644 --- a/src/bundle/Core/Command/VirtualFieldDuplicateFixCommand.php +++ b/src/bundle/Core/Command/VirtualFieldDuplicateFixCommand.php @@ -30,8 +30,7 @@ final class VirtualFieldDuplicateFixCommand extends Command private const DEFAULT_SLEEP = 0; - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; public function __construct( Connection $connection diff --git a/src/bundle/Core/DependencyInjection/Compiler/BinaryContentDownloadPass.php b/src/bundle/Core/DependencyInjection/Compiler/BinaryContentDownloadPass.php index be62d4d949..295d4d20ea 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/BinaryContentDownloadPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/BinaryContentDownloadPass.php @@ -19,7 +19,7 @@ */ class BinaryContentDownloadPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->has(ContentDownloadUrlGenerator::class)) { return; @@ -31,7 +31,7 @@ public function process(ContainerBuilder $container) $this->addCall($container, $downloadUrlReference, BinaryFileStorage::class); } - private function addCall(ContainerBuilder $container, Reference $reference, $targetServiceName) + private function addCall(ContainerBuilder $container, Reference $reference, string $targetServiceName): void { if (!$container->has($targetServiceName)) { return; diff --git a/src/bundle/Core/DependencyInjection/Compiler/ChainConfigResolverPass.php b/src/bundle/Core/DependencyInjection/Compiler/ChainConfigResolverPass.php index 9093bede65..1acf4a1e74 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/ChainConfigResolverPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/ChainConfigResolverPass.php @@ -21,7 +21,7 @@ class ChainConfigResolverPass implements CompilerPassInterface /** * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition(ChainConfigResolver::class)) { return; diff --git a/src/bundle/Core/DependencyInjection/Compiler/ChainRoutingPass.php b/src/bundle/Core/DependencyInjection/Compiler/ChainRoutingPass.php index 5d9c517ddd..af032adef7 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/ChainRoutingPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/ChainRoutingPass.php @@ -22,7 +22,7 @@ class ChainRoutingPass implements CompilerPassInterface /** * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition(ChainRouter::class)) { return; diff --git a/src/bundle/Core/DependencyInjection/Compiler/ConsoleCacheWarmupPass.php b/src/bundle/Core/DependencyInjection/Compiler/ConsoleCacheWarmupPass.php index af65886591..b1ca64f2ad 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/ConsoleCacheWarmupPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/ConsoleCacheWarmupPass.php @@ -18,7 +18,7 @@ */ class ConsoleCacheWarmupPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { // This pass is CLI only as CLI class cache warmup conflicts with web access, see EZP-29034 if (\PHP_SAPI !== 'cli' || diff --git a/src/bundle/Core/DependencyInjection/Compiler/ConsoleCommandPass.php b/src/bundle/Core/DependencyInjection/Compiler/ConsoleCommandPass.php index 471937ade6..bb7185db59 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/ConsoleCommandPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/ConsoleCommandPass.php @@ -14,7 +14,7 @@ final class ConsoleCommandPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { foreach ($container->findTaggedServiceIds('console.command') as $id => $attributes) { $definition = $container->getDefinition($id); diff --git a/src/bundle/Core/DependencyInjection/Compiler/FieldTypeParameterProviderRegistryPass.php b/src/bundle/Core/DependencyInjection/Compiler/FieldTypeParameterProviderRegistryPass.php index 351b49e537..f8492afbcb 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/FieldTypeParameterProviderRegistryPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/FieldTypeParameterProviderRegistryPass.php @@ -24,7 +24,7 @@ class FieldTypeParameterProviderRegistryPass implements CompilerPassInterface * * @throws \LogicException */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition(ParameterProviderRegistry::class)) { return; diff --git a/src/bundle/Core/DependencyInjection/Compiler/ImaginePass.php b/src/bundle/Core/DependencyInjection/Compiler/ImaginePass.php index f21605b412..25ff50e796 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/ImaginePass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/ImaginePass.php @@ -19,7 +19,7 @@ class ImaginePass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition('liip_imagine.filter.configuration')) { return; @@ -38,7 +38,7 @@ public function process(ContainerBuilder $container) } } - private function processReduceNoiseFilter(ContainerBuilder $container, $driver) + private function processReduceNoiseFilter(ContainerBuilder $container, string $driver): void { if ($driver === 'imagick') { $container->setAlias('ibexa.image_alias.imagine.filter.reduce_noise', new Alias(ImagickReduceNoiseFilter::class)); @@ -47,7 +47,7 @@ private function processReduceNoiseFilter(ContainerBuilder $container, $driver) } } - private function processSwirlFilter(ContainerBuilder $container, $driver) + private function processSwirlFilter(ContainerBuilder $container, string $driver): void { if ($driver === 'imagick') { $container->setAlias('ibexa.image_alias.imagine.filter.swirl', new Alias(ImagickSwirlFilter::class)); diff --git a/src/bundle/Core/DependencyInjection/Compiler/InjectEntityManagerMappingsPass.php b/src/bundle/Core/DependencyInjection/Compiler/InjectEntityManagerMappingsPass.php index 9044a3cde7..767c428103 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/InjectEntityManagerMappingsPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/InjectEntityManagerMappingsPass.php @@ -64,7 +64,7 @@ public function process(ContainerBuilder $container): void } } - private function createMetadataDriverDefinition($driverType, $driverPaths): Definition + private function createMetadataDriverDefinition(int|string $driverType, $driverPaths): Definition { $metadataDriver = new Definition("%doctrine.orm.metadata.{$driverType}.class%"); $arguments = []; diff --git a/src/bundle/Core/DependencyInjection/Compiler/NotificationRendererPass.php b/src/bundle/Core/DependencyInjection/Compiler/NotificationRendererPass.php index bb9f90d91e..6c79354ffa 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/NotificationRendererPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/NotificationRendererPass.php @@ -18,7 +18,7 @@ class NotificationRendererPass implements CompilerPassInterface public const TAG_NAME = 'ibexa.notification.renderer'; public const REGISTRY_DEFINITION_ID = 'notification.renderer.registry'; - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->has(self::REGISTRY_DEFINITION_ID)) { return; diff --git a/src/bundle/Core/DependencyInjection/Compiler/PlaceholderProviderPass.php b/src/bundle/Core/DependencyInjection/Compiler/PlaceholderProviderPass.php index 59d317a6cd..18490fcdbd 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/PlaceholderProviderPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/PlaceholderProviderPass.php @@ -18,7 +18,7 @@ class PlaceholderProviderPass implements CompilerPassInterface public const TAG_NAME = 'ibexa.media.images.placeholder.provider'; public const REGISTRY_DEFINITION_ID = PlaceholderProviderRegistry::class; - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition(self::REGISTRY_DEFINITION_ID)) { return; diff --git a/src/bundle/Core/DependencyInjection/Compiler/RegisterSearchEngineIndexerPass.php b/src/bundle/Core/DependencyInjection/Compiler/RegisterSearchEngineIndexerPass.php index d5b2d6d372..92c0460218 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/RegisterSearchEngineIndexerPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/RegisterSearchEngineIndexerPass.php @@ -36,7 +36,7 @@ class RegisterSearchEngineIndexerPass implements CompilerPassInterface * * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition($this->factoryId)) { return; diff --git a/src/bundle/Core/DependencyInjection/Compiler/RegisterSearchEnginePass.php b/src/bundle/Core/DependencyInjection/Compiler/RegisterSearchEnginePass.php index 99075e7f7b..681940bd79 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/RegisterSearchEnginePass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/RegisterSearchEnginePass.php @@ -36,7 +36,7 @@ class RegisterSearchEnginePass implements CompilerPassInterface * * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition($this->factoryId)) { return; diff --git a/src/bundle/Core/DependencyInjection/Compiler/RegisterStorageEnginePass.php b/src/bundle/Core/DependencyInjection/Compiler/RegisterStorageEnginePass.php index 34adfbacf1..d931d3e6ee 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/RegisterStorageEnginePass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/RegisterStorageEnginePass.php @@ -30,7 +30,7 @@ class RegisterStorageEnginePass implements CompilerPassInterface * * @throws \LogicException */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition(StorageEngineFactory::class)) { return; diff --git a/src/bundle/Core/DependencyInjection/Compiler/RouterPass.php b/src/bundle/Core/DependencyInjection/Compiler/RouterPass.php index 51cc81949f..66d84e32a6 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/RouterPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/RouterPass.php @@ -19,7 +19,7 @@ */ class RouterPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition('router.default')) { return; diff --git a/src/bundle/Core/DependencyInjection/Compiler/SessionConfigurationPass.php b/src/bundle/Core/DependencyInjection/Compiler/SessionConfigurationPass.php index 2177d6b712..d95e0c6a78 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/SessionConfigurationPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/SessionConfigurationPass.php @@ -23,7 +23,7 @@ */ final class SessionConfigurationPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $handlerId = $container->hasParameter('ibexa.session.handler_id') ? $container->getParameter('ibexa.session.handler_id') diff --git a/src/bundle/Core/DependencyInjection/Compiler/SlugConverterConfigurationPass.php b/src/bundle/Core/DependencyInjection/Compiler/SlugConverterConfigurationPass.php index 935d0004e5..7ce284b964 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/SlugConverterConfigurationPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/SlugConverterConfigurationPass.php @@ -20,12 +20,12 @@ class SlugConverterConfigurationPass implements CompilerPassInterface /** * {@inheritdoc} */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { - if (!$container->has(\Ibexa\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter::class)) { + if (!$container->has(SlugConverter::class)) { return; } - $slugConverterDefinition = $container->getDefinition(\Ibexa\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter::class); + $slugConverterDefinition = $container->getDefinition(SlugConverter::class); $parameterConfiguration = $slugConverterDefinition->getArgument(1); $semanticConfiguration = $container->getParameter('ibexa.url_alias.slug_converter'); diff --git a/src/bundle/Core/DependencyInjection/Compiler/StorageConnectionPass.php b/src/bundle/Core/DependencyInjection/Compiler/StorageConnectionPass.php index 4974ebfa15..85c081032a 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/StorageConnectionPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/StorageConnectionPass.php @@ -17,7 +17,7 @@ */ class StorageConnectionPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $taggedServiceIds = $container->findTaggedServiceIds( RegisterStorageEnginePass::STORAGE_ENGINE_TAG diff --git a/src/bundle/Core/DependencyInjection/Compiler/TranslationCollectorPass.php b/src/bundle/Core/DependencyInjection/Compiler/TranslationCollectorPass.php index 243a7062b4..4e837dcfb9 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/TranslationCollectorPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/TranslationCollectorPass.php @@ -36,7 +36,7 @@ class TranslationCollectorPass implements CompilerPassInterface 'ru_RU' => 'ru', ]; - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition('translator.default')) { return; diff --git a/src/bundle/Core/DependencyInjection/Compiler/URLHandlerPass.php b/src/bundle/Core/DependencyInjection/Compiler/URLHandlerPass.php index e02fedab63..253309471f 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/URLHandlerPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/URLHandlerPass.php @@ -21,7 +21,7 @@ class URLHandlerPass implements CompilerPassInterface /** * {@inheritdoc} */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition(URLHandlerRegistry::class)) { return; diff --git a/src/bundle/Core/DependencyInjection/Compiler/ViewProvidersPass.php b/src/bundle/Core/DependencyInjection/Compiler/ViewProvidersPass.php index ca0bb62309..4ab49e8f40 100644 --- a/src/bundle/Core/DependencyInjection/Compiler/ViewProvidersPass.php +++ b/src/bundle/Core/DependencyInjection/Compiler/ViewProvidersPass.php @@ -25,7 +25,7 @@ class ViewProvidersPass implements CompilerPassInterface /** * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $rawViewProviders = []; foreach ($container->findTaggedServiceIds(self::VIEW_PROVIDER_TAG) as $serviceId => $tags) { diff --git a/src/bundle/Core/DependencyInjection/Configuration.php b/src/bundle/Core/DependencyInjection/Configuration.php index 57dc11ae77..e0fa827d4a 100644 --- a/src/bundle/Core/DependencyInjection/Configuration.php +++ b/src/bundle/Core/DependencyInjection/Configuration.php @@ -12,23 +12,21 @@ use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\Configuration as SiteAccessConfiguration; use Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorInterface; use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; +use Symfony\Component\Config\Definition\Builder\NodeDefinition; use Symfony\Component\Config\Definition\Builder\TreeBuilder; class Configuration extends SiteAccessConfiguration { public const CUSTOM_TAG_ATTRIBUTE_TYPES = ['number', 'string', 'boolean', 'choice']; - /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\ParserInterface */ - private $mainSiteAccessConfigParser; + private ParserInterface $mainSiteAccessConfigParser; - /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\RepositoryConfigParserInterface */ - private $mainRepositoryConfigParser; + private RepositoryConfigParserInterface $mainRepositoryConfigParser; - /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorInterface */ - private $suggestionCollector; + private SuggestionCollectorInterface $suggestionCollector; /** @var \Ibexa\Bundle\Core\SiteAccess\SiteAccessConfigurationFilter[] */ - private $siteAccessConfigurationFilters; + private ?array $siteAccessConfigurationFilters = null; public function __construct( ParserInterface $mainConfigParser, @@ -40,7 +38,7 @@ public function __construct( $this->suggestionCollector = $suggestionCollector; } - public function setSiteAccessConfigurationFilters(array $filters) + public function setSiteAccessConfigurationFilters(array $filters): void { $this->siteAccessConfigurationFilters = $filters; } @@ -73,7 +71,7 @@ public function getConfigTreeBuilder(): TreeBuilder return $treeBuilder; } - public function addRepositoriesSection(ArrayNodeDefinition $rootNode) + public function addRepositoriesSection(ArrayNodeDefinition $rootNode): void { $repositoriesNode = $rootNode ->children() @@ -153,7 +151,7 @@ static function ($v) { ); } - public function addSiteaccessSection(ArrayNodeDefinition $rootNode) + public function addSiteaccessSection(ArrayNodeDefinition $rootNode): void { $rootNode ->children() @@ -204,7 +202,7 @@ public function addSiteaccessSection(ArrayNodeDefinition $rootNode) ->useAttributeAsKey('key') ->beforeNormalization() ->always( - static function ($v) { + static function ($v): array { // Value passed to the matcher should always be an array. // If value is not an array, we transform it to a hash, with 'value' as key. if (!is_array($v)) { @@ -253,7 +251,7 @@ static function ($v) { ->end(); } - private function addImageMagickSection(ArrayNodeDefinition $rootNode) + private function addImageMagickSection(ArrayNodeDefinition $rootNode): void { $filtersInfo = <<end(); } - private function addHttpCacheSection(ArrayNodeDefinition $rootNode) + private function addHttpCacheSection(ArrayNodeDefinition $rootNode): void { $purgeTypeInfo = <<end(); } - private function addRouterSection(ArrayNodeDefinition $rootNode) + private function addRouterSection(ArrayNodeDefinition $rootNode): void { $nonSAAwareInfo = <<children() @@ -466,7 +464,7 @@ private function addUrlAliasSection(ArrayNodeDefinition $rootNode) * * @return \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition */ - private function addUrlWildcardsSection($rootNode): ArrayNodeDefinition + private function addUrlWildcardsSection(NodeDefinition $rootNode): ArrayNodeDefinition { return $rootNode ->children() @@ -501,7 +499,7 @@ private function addUrlWildcardsSection($rootNode): ArrayNodeDefinition * * @return \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition */ - private function addOrmSection($rootNode): ArrayNodeDefinition + private function addOrmSection(NodeDefinition $rootNode): ArrayNodeDefinition { return $rootNode ->children() @@ -546,7 +544,7 @@ private function addOrmSection($rootNode): ArrayNodeDefinition * * @param \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition $rootNode */ - private function addUITranslationsSection($rootNode): ArrayNodeDefinition + private function addUITranslationsSection(NodeDefinition $rootNode): ArrayNodeDefinition { return $rootNode ->children() diff --git a/src/bundle/Core/DependencyInjection/Configuration/ChainConfigResolver.php b/src/bundle/Core/DependencyInjection/Configuration/ChainConfigResolver.php index ffdb5e1c9b..42a6c2a3aa 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/ChainConfigResolver.php +++ b/src/bundle/Core/DependencyInjection/Configuration/ChainConfigResolver.php @@ -25,7 +25,7 @@ class ChainConfigResolver implements ConfigResolverInterface * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $resolver * @param int $priority */ - public function addResolver(ConfigResolverInterface $resolver, $priority = 0) + public function addResolver(ConfigResolverInterface $resolver, $priority = 0): void { $priority = (int)$priority; if (!isset($this->resolvers[$priority])) { @@ -54,7 +54,7 @@ public function getAllResolvers() * * @return \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface[] */ - protected function sortResolvers() + protected function sortResolvers(): array { $sortedResolvers = []; krsort($this->resolvers); diff --git a/src/bundle/Core/DependencyInjection/Configuration/ComplexSettings/ComplexSettingParser.php b/src/bundle/Core/DependencyInjection/Configuration/ComplexSettings/ComplexSettingParser.php index 29f5380c6f..fb02f438c5 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/ComplexSettings/ComplexSettingParser.php +++ b/src/bundle/Core/DependencyInjection/Configuration/ComplexSettings/ComplexSettingParser.php @@ -13,10 +13,8 @@ class ComplexSettingParser extends DynamicSettingParser implements ComplexSettin { /** * Regular expression that matches a dynamic variable. - * - * @var string */ - private $dynamicSettingRegex; + private string $dynamicSettingRegex; public function __construct() { diff --git a/src/bundle/Core/DependencyInjection/Configuration/ConfigParser.php b/src/bundle/Core/DependencyInjection/Configuration/ConfigParser.php index bc5661c4b6..7e0c2b55b0 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/ConfigParser.php +++ b/src/bundle/Core/DependencyInjection/Configuration/ConfigParser.php @@ -18,7 +18,7 @@ class ConfigParser implements ParserInterface { /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\ParserInterface[] */ - private $configParsers; + private array $configParsers; public function __construct(array $configParsers = []) { @@ -38,7 +38,7 @@ public function __construct(array $configParsers = []) /** * @param \Ibexa\Bundle\Core\DependencyInjection\Configuration\ParserInterface[] $configParsers */ - public function setConfigParsers($configParsers) + public function setConfigParsers($configParsers): void { $this->configParsers = $configParsers; } @@ -51,28 +51,28 @@ public function getConfigParsers() return $this->configParsers; } - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) + public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void { foreach ($this->configParsers as $parser) { $parser->mapConfig($scopeSettings, $currentScope, $contextualizer); } } - public function preMap(array $config, ContextualizerInterface $contextualizer) + public function preMap(array $config, ContextualizerInterface $contextualizer): void { foreach ($this->configParsers as $parser) { $parser->preMap($config, $contextualizer); } } - public function postMap(array $config, ContextualizerInterface $contextualizer) + public function postMap(array $config, ContextualizerInterface $contextualizer): void { foreach ($this->configParsers as $parser) { $parser->postMap($config, $contextualizer); } } - public function addSemanticConfig(NodeBuilder $nodeBuilder) + public function addSemanticConfig(NodeBuilder $nodeBuilder): void { $fieldTypeNodeBuilder = $nodeBuilder ->arrayNode('fieldtypes') diff --git a/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver.php b/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver.php index a3a609a558..35f41665a3 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver.php +++ b/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver.php @@ -47,11 +47,10 @@ class ConfigResolver implements VersatileScopeInterface, SiteAccessAware, Contai /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ protected $siteAccess; - /** @var \Psr\Log\LoggerInterface */ - protected $logger; + protected LoggerInterface $logger; /** @var array Siteaccess groups, indexed by siteaccess name */ - protected $groupsBySiteAccess; + protected array $groupsBySiteAccess; /** @var string */ protected $defaultNamespace; @@ -63,7 +62,7 @@ class ConfigResolver implements VersatileScopeInterface, SiteAccessAware, Contai protected $undefinedStrategy; /** @var array[] List of blame => [params] loaded while siteAccess->matchingType was 'uninitialized' */ - private $tooEarlyLoadedList = []; + private array $tooEarlyLoadedList = []; /** * @param \Psr\Log\LoggerInterface|null $logger @@ -86,7 +85,7 @@ public function __construct( $this->undefinedStrategy = $undefinedStrategy; } - public function setSiteAccess(SiteAccess $siteAccess = null) + public function setSiteAccess(SiteAccess $siteAccess = null): void { $this->siteAccess = $siteAccess; } @@ -101,7 +100,7 @@ public function setSiteAccess(SiteAccess $siteAccess = null) * * @param int $undefinedStrategy */ - public function setUndefinedStrategy($undefinedStrategy) + public function setUndefinedStrategy($undefinedStrategy): void { $this->undefinedStrategy = $undefinedStrategy; } @@ -228,7 +227,7 @@ public function setDefaultScope(string $scope): void } } - private function warnAboutTooEarlyLoadedParams() + private function warnAboutTooEarlyLoadedParams(): void { if (empty($this->tooEarlyLoadedList)) { return; @@ -254,7 +253,7 @@ private function warnAboutTooEarlyLoadedParams() * * @return string */ - private function logTooEarlyLoadedListIfNeeded($paramName) + private function logTooEarlyLoadedListIfNeeded(string $paramName): void { if ($this->container instanceof ContainerBuilder) { return; diff --git a/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/ContainerConfigResolver.php b/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/ContainerConfigResolver.php index aaaf388d46..14f9633ead 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/ContainerConfigResolver.php +++ b/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/ContainerConfigResolver.php @@ -17,11 +17,9 @@ abstract class ContainerConfigResolver implements ConfigResolverInterface, Conta { use ContainerAwareTrait; - /** @var string */ - private $scope; + private string $scope; - /** @var string */ - private $defaultNamespace; + private string $defaultNamespace; public function __construct(string $scope, string $defaultNamespace) { diff --git a/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/SiteAccessConfigResolver.php b/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/SiteAccessConfigResolver.php index 1ca3e12d83..e52d8b5176 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/SiteAccessConfigResolver.php +++ b/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/SiteAccessConfigResolver.php @@ -12,11 +12,11 @@ use Ibexa\Core\MVC\Symfony\Configuration\VersatileScopeInterface; use Ibexa\Core\MVC\Symfony\SiteAccess; use Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessAware; +use Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessProviderInterface; abstract class SiteAccessConfigResolver implements VersatileScopeInterface, SiteAccessAware { - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessProviderInterface */ - protected $siteAccessProvider; + protected SiteAccessProviderInterface $siteAccessProvider; /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ protected $currentSiteAccess; @@ -24,11 +24,10 @@ abstract class SiteAccessConfigResolver implements VersatileScopeInterface, Site /** @var string */ protected $defaultScope; - /** @var string */ - protected $defaultNamespace; + protected string $defaultNamespace; public function __construct( - SiteAccess\SiteAccessProviderInterface $siteAccessProvider, + SiteAccessProviderInterface $siteAccessProvider, string $defaultNamespace ) { $this->siteAccessProvider = $siteAccessProvider; diff --git a/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/SiteAccessGroupConfigResolver.php b/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/SiteAccessGroupConfigResolver.php index 5040aa9dd1..13346f314a 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/SiteAccessGroupConfigResolver.php +++ b/src/bundle/Core/DependencyInjection/Configuration/ConfigResolver/SiteAccessGroupConfigResolver.php @@ -23,7 +23,7 @@ class SiteAccessGroupConfigResolver extends SiteAccessConfigResolver use ContainerAwareTrait; /** @var string[][] */ - protected $siteAccessGroups; + protected array $siteAccessGroups; public function __construct( SiteAccess\SiteAccessProviderInterface $siteAccessProvider, diff --git a/src/bundle/Core/DependencyInjection/Configuration/ContainerConfigBuilder.php b/src/bundle/Core/DependencyInjection/Configuration/ContainerConfigBuilder.php index c5a3451a45..e6a17c1256 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/ContainerConfigBuilder.php +++ b/src/bundle/Core/DependencyInjection/Configuration/ContainerConfigBuilder.php @@ -11,8 +11,7 @@ abstract class ContainerConfigBuilder implements ConfigBuilderInterface { - /** @var \Symfony\Component\DependencyInjection\ContainerBuilder */ - protected $containerBuilder; + protected ContainerBuilder $containerBuilder; public function __construct(ContainerBuilder $containerBuilder) { diff --git a/src/bundle/Core/DependencyInjection/Configuration/Parser/AbstractFieldTypeParser.php b/src/bundle/Core/DependencyInjection/Configuration/Parser/AbstractFieldTypeParser.php index ddaf1fc56c..ab4626ee93 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Parser/AbstractFieldTypeParser.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Parser/AbstractFieldTypeParser.php @@ -22,7 +22,7 @@ abstract class AbstractFieldTypeParser extends AbstractParser implements FieldTy * * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.. */ - public function addSemanticConfig(NodeBuilder $nodeBuilder) + public function addSemanticConfig(NodeBuilder $nodeBuilder): void { $fieldTypeNodeBuilder = $nodeBuilder->arrayNode($this->getFieldTypeIdentifier())->children(); diff --git a/src/bundle/Core/DependencyInjection/Configuration/Parser/Common.php b/src/bundle/Core/DependencyInjection/Configuration/Parser/Common.php index 39466ee876..ffedeba47a 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Parser/Common.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Parser/Common.php @@ -102,12 +102,12 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder): void ->end(); } - public function preMap(array $config, ContextualizerInterface $contextualizer) + public function preMap(array $config, ContextualizerInterface $contextualizer): void { $contextualizer->mapConfigArray('session', $config); } - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) + public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void { if (isset($scopeSettings['repository'])) { $contextualizer->setContextualParameter('repository', $currentScope, $scopeSettings['repository']); diff --git a/src/bundle/Core/DependencyInjection/Configuration/Parser/Content.php b/src/bundle/Core/DependencyInjection/Configuration/Parser/Content.php index 629ec24275..fc86ce6ece 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Parser/Content.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Parser/Content.php @@ -21,7 +21,7 @@ class Content extends AbstractParser * * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system. */ - public function addSemanticConfig(NodeBuilder $nodeBuilder) + public function addSemanticConfig(NodeBuilder $nodeBuilder): void { $nodeBuilder ->arrayNode('content') @@ -48,7 +48,7 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) ->end(); } - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) + public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void { if (!empty($scopeSettings['content'])) { if (isset($scopeSettings['content']['view_cache'])) { diff --git a/src/bundle/Core/DependencyInjection/Configuration/Parser/IO.php b/src/bundle/Core/DependencyInjection/Configuration/Parser/IO.php index 8c1c422b48..a4cacb3c3d 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Parser/IO.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Parser/IO.php @@ -15,15 +15,14 @@ class IO extends AbstractParser { - /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\ComplexSettings\ComplexSettingParserInterface */ - private $complexSettingParser; + private ComplexSettingParserInterface $complexSettingParser; public function __construct(ComplexSettingParserInterface $complexSettingParser) { $this->complexSettingParser = $complexSettingParser; } - public function addSemanticConfig(NodeBuilder $nodeBuilder) + public function addSemanticConfig(NodeBuilder $nodeBuilder): void { $nodeBuilder ->arrayNode('io') @@ -56,7 +55,7 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) ->end(); } - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) + public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void { if (!isset($scopeSettings['io'])) { return; @@ -85,7 +84,7 @@ public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerIn /** * Post process configuration to add io_root_dir and io_prefix. */ - public function postMap(array $config, ContextualizerInterface $contextualizer) + public function postMap(array $config, ContextualizerInterface $contextualizer): void { $container = $contextualizer->getContainer(); @@ -100,7 +99,7 @@ public function postMap(array $config, ContextualizerInterface $contextualizer) /** * Applies dependencies of complex $parameter in $scope. */ - private function addComplexParametersDependencies($parameter, $scope, ContainerBuilder $container) + private function addComplexParametersDependencies(string $parameter, $scope, ContainerBuilder $container): void { // The complex setting exists in this scope, we don't need to do anything if ($container->hasParameter("ibexa.site_access.config.$scope.$parameter")) { diff --git a/src/bundle/Core/DependencyInjection/Configuration/Parser/Image.php b/src/bundle/Core/DependencyInjection/Configuration/Parser/Image.php index f58a18bd94..c44b3f8ea3 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Parser/Image.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Parser/Image.php @@ -21,7 +21,7 @@ class Image extends AbstractParser * * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system. */ - public function addSemanticConfig(NodeBuilder $nodeBuilder) + public function addSemanticConfig(NodeBuilder $nodeBuilder): void { $nodeBuilder ->arrayNode('image_variations') @@ -75,7 +75,7 @@ static function ($v): bool { } ) ->then( - static function ($v) { + static function (array $v) { // If we have the "params" key, just use the value. return $v['params']; } @@ -105,7 +105,7 @@ static function ($v) { ->end(); } - public function preMap(array $config, ContextualizerInterface $contextualizer) + public function preMap(array $config, ContextualizerInterface $contextualizer): void { $contextualizer->mapConfigArray('image_variations', $config); $contextualizer->mapSetting('image_host', $config); diff --git a/src/bundle/Core/DependencyInjection/Configuration/Parser/Languages.php b/src/bundle/Core/DependencyInjection/Configuration/Parser/Languages.php index c0779fea1f..3ffd44a0a1 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Parser/Languages.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Parser/Languages.php @@ -20,7 +20,7 @@ class Languages extends AbstractParser * * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system. */ - public function addSemanticConfig(NodeBuilder $nodeBuilder) + public function addSemanticConfig(NodeBuilder $nodeBuilder): void { $nodeBuilder ->arrayNode('languages') @@ -36,7 +36,7 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) ->end(); } - public function preMap(array $config, ContextualizerInterface $contextualizer) + public function preMap(array $config, ContextualizerInterface $contextualizer): void { $contextualizer->mapConfigArray('languages', $config, ContextualizerInterface::UNIQUE); $contextualizer->mapConfigArray('translation_siteaccesses', $config, ContextualizerInterface::UNIQUE); @@ -47,7 +47,7 @@ public function preMap(array $config, ContextualizerInterface $contextualizer) } } - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) + public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void { $container = $contextualizer->getContainer(); if ($container->hasParameter("ibexa.site_access.config.$currentScope.languages")) { @@ -59,7 +59,7 @@ public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerIn } } - public function postMap(array $config, ContextualizerInterface $contextualizer) + public function postMap(array $config, ContextualizerInterface $contextualizer): void { $contextualizer->getContainer()->setParameter( 'ibexa.site_access.by_language', diff --git a/src/bundle/Core/DependencyInjection/Configuration/Parser/LocationView.php b/src/bundle/Core/DependencyInjection/Configuration/Parser/LocationView.php index b7b13c07a8..4b0264a3a1 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Parser/LocationView.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Parser/LocationView.php @@ -15,7 +15,7 @@ class LocationView extends View public const NODE_KEY = 'location_view'; public const INFO = 'Template selection settings when displaying a location. Deprecated from 5.4.5/2015.09, use content_view instead.'; - public function preMap(array $config, ContextualizerInterface $contextualizer) + public function preMap(array $config, ContextualizerInterface $contextualizer): void { $scopes = array_merge( [ConfigResolver::SCOPE_GLOBAL], diff --git a/src/bundle/Core/DependencyInjection/Configuration/Parser/Templates.php b/src/bundle/Core/DependencyInjection/Configuration/Parser/Templates.php index b287780e67..0e5bc95271 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Parser/Templates.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Parser/Templates.php @@ -18,7 +18,7 @@ class Templates extends AbstractParser * * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system. */ - public function addSemanticConfig(NodeBuilder $nodeBuilder) + public function addSemanticConfig(NodeBuilder $nodeBuilder): void { $nodeBuilder ->arrayNode(static::NODE_KEY) @@ -37,7 +37,7 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) ->end(); } - public function preMap(array $config, ContextualizerInterface $contextualizer) + public function preMap(array $config, ContextualizerInterface $contextualizer): void { foreach ($config['siteaccess']['groups'] as $group => $saArray) { if (!empty($config[$contextualizer->getSiteAccessNodeName()][$group][static::NODE_KEY])) { @@ -52,7 +52,7 @@ public function preMap(array $config, ContextualizerInterface $contextualizer) $contextualizer->mapConfigArray(static::NODE_KEY, $config); } - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) + public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void { // Nothing to do here. } diff --git a/src/bundle/Core/DependencyInjection/Configuration/Parser/TwigVariablesParser.php b/src/bundle/Core/DependencyInjection/Configuration/Parser/TwigVariablesParser.php index 17109a37e0..27e9dc5150 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Parser/TwigVariablesParser.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Parser/TwigVariablesParser.php @@ -14,7 +14,7 @@ final class TwigVariablesParser extends AbstractParser { - public function addSemanticConfig(NodeBuilder $nodeBuilder) + public function addSemanticConfig(NodeBuilder $nodeBuilder): void { $nodeBuilder ->arrayNode('twig_variables') @@ -36,7 +36,7 @@ public function mapConfig( array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer - ) { + ): void { if (!empty($scopeSettings['twig_variables'])) { $settings = $scopeSettings['twig_variables']; diff --git a/src/bundle/Core/DependencyInjection/Configuration/Parser/UrlChecker.php b/src/bundle/Core/DependencyInjection/Configuration/Parser/UrlChecker.php index 52432524a4..e399d3f675 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Parser/UrlChecker.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Parser/UrlChecker.php @@ -13,7 +13,7 @@ class UrlChecker extends AbstractParser { - public function addSemanticConfig(NodeBuilder $nodeBuilder) + public function addSemanticConfig(NodeBuilder $nodeBuilder): void { $nodeBuilder ->arrayNode('url_checker') @@ -27,7 +27,7 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) ->end(); } - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) + public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void { if (isset($scopeSettings['url_checker']) && !empty($scopeSettings['url_checker']['handlers'])) { foreach ($scopeSettings['url_checker']['handlers'] as $name => $options) { diff --git a/src/bundle/Core/DependencyInjection/Configuration/Parser/UserContentTypeIdentifier.php b/src/bundle/Core/DependencyInjection/Configuration/Parser/UserContentTypeIdentifier.php index c3a60c72b8..d72a2bd91f 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Parser/UserContentTypeIdentifier.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Parser/UserContentTypeIdentifier.php @@ -32,7 +32,7 @@ final class UserContentTypeIdentifier extends AbstractParser * * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system. */ - public function addSemanticConfig(NodeBuilder $nodeBuilder) + public function addSemanticConfig(NodeBuilder $nodeBuilder): void { $nodeBuilder ->arrayNode('user_content_type_identifier') diff --git a/src/bundle/Core/DependencyInjection/Configuration/Parser/View.php b/src/bundle/Core/DependencyInjection/Configuration/Parser/View.php index 485c51ab0e..19fe302a8e 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Parser/View.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Parser/View.php @@ -18,7 +18,7 @@ class View extends AbstractParser * * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system. */ - public function addSemanticConfig(NodeBuilder $nodeBuilder) + public function addSemanticConfig(NodeBuilder $nodeBuilder): void { $nodeBuilder ->arrayNode(static::NODE_KEY) @@ -69,12 +69,12 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) ->end(); } - public function preMap(array $config, ContextualizerInterface $contextualizer) + public function preMap(array $config, ContextualizerInterface $contextualizer): void { $contextualizer->mapConfigArray(static::NODE_KEY, $config, ContextualizerInterface::MERGE_FROM_SECOND_LEVEL); } - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) + public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void { // Nothing to do here. } diff --git a/src/bundle/Core/DependencyInjection/Configuration/RepositoryConfigParser.php b/src/bundle/Core/DependencyInjection/Configuration/RepositoryConfigParser.php index d0954f0a86..a8649186f9 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/RepositoryConfigParser.php +++ b/src/bundle/Core/DependencyInjection/Configuration/RepositoryConfigParser.php @@ -14,7 +14,7 @@ final class RepositoryConfigParser implements RepositoryConfigParserInterface { /** @var iterable<\Ibexa\Bundle\Core\DependencyInjection\Configuration\RepositoryConfigParserInterface> */ - private $configParsers; + private iterable $configParsers; /** * @param \Ibexa\Bundle\Core\DependencyInjection\Configuration\RepositoryConfigParserInterface[] $configParsers diff --git a/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/Configuration.php b/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/Configuration.php index eb7aeaeaa3..d6faaf30c6 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/Configuration.php +++ b/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/Configuration.php @@ -40,7 +40,7 @@ abstract class Configuration implements ConfigurationInterface * * @return \Symfony\Component\Config\Definition\Builder\NodeBuilder */ - public function generateScopeBaseNode(ArrayNodeDefinition $rootNode, $scopeNodeName = 'system') + public function generateScopeBaseNode(ArrayNodeDefinition $rootNode, string $scopeNodeName = 'system') { $contextNode = $rootNode ->children() diff --git a/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/ConfigurationProcessor.php b/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/ConfigurationProcessor.php index f08c94117f..b3c8d89309 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/ConfigurationProcessor.php +++ b/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/ConfigurationProcessor.php @@ -61,7 +61,7 @@ public function __construct(ContainerInterface $containerBuilder, $namespace, $s * * @param string[] $availableSiteAccesses */ - public static function setAvailableSiteAccesses(array $availableSiteAccesses) + public static function setAvailableSiteAccesses(array $availableSiteAccesses): void { static::$availableSiteAccesses = $availableSiteAccesses; } @@ -74,7 +74,7 @@ public static function setAvailableSiteAccesses(array $availableSiteAccesses) * * @param array $groupsBySiteAccess Registered scope groups names, indexed by scope. */ - public static function setGroupsBySiteAccess(array $groupsBySiteAccess) + public static function setGroupsBySiteAccess(array $groupsBySiteAccess): void { static::$groupsBySiteAccess = $groupsBySiteAccess; } @@ -83,7 +83,7 @@ public static function setGroupsBySiteAccess(array $groupsBySiteAccess) * @param array> $availableSiteAccessGroups keys are Site Access group names and values are * an array of Site Access name which belongs to this group */ - public static function setAvailableSiteAccessGroups(array $availableSiteAccessGroups) + public static function setAvailableSiteAccessGroups(array $availableSiteAccessGroups): void { static::$availableSiteAccessGroups = $availableSiteAccessGroups; } @@ -102,7 +102,7 @@ public static function setAvailableSiteAccessGroups(array $availableSiteAccessGr * * @throws \InvalidArgumentException */ - public function mapConfig(array $config, $mapper) + public function mapConfig(array $config, $mapper): void { $mapperCallable = is_callable($mapper); if (!$mapperCallable && !$mapper instanceof ConfigurationMapperInterface) { @@ -135,7 +135,7 @@ public function mapConfig(array $config, $mapper) * @param string $id Id of the setting to map. * @param array $config Full semantic configuration array for current bundle. */ - public function mapSetting($id, array $config) + public function mapSetting($id, array $config): void { $this->contextualizer->mapSetting($id, $config); } @@ -149,7 +149,7 @@ public function mapSetting($id, array $config) * @param array $config Full semantic configuration array for current bundle. * @param int $options Bit mask of options (See constants of `ContextualizerInterface`) */ - public function mapConfigArray($id, array $config, $options = 0) + public function mapConfigArray($id, array $config, $options = 0): void { $this->contextualizer->mapConfigArray($id, $config, $options); } @@ -165,7 +165,7 @@ public function mapConfigArray($id, array $config, $options = 0) * * @return \Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface */ - protected function buildContextualizer(ContainerInterface $containerBuilder, $namespace, $siteAccessNodeName) + protected function buildContextualizer(ContainerInterface $containerBuilder, $namespace, $siteAccessNodeName): Contextualizer { return new Contextualizer( $containerBuilder, @@ -180,7 +180,7 @@ protected function buildContextualizer(ContainerInterface $containerBuilder, $na /** * @param \Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface $contextualizer */ - public function setContextualizer(ContextualizerInterface $contextualizer) + public function setContextualizer(ContextualizerInterface $contextualizer): void { $this->contextualizer = $contextualizer; } diff --git a/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/Contextualizer.php b/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/Contextualizer.php index 1ab945571d..4d1829cf1c 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/Contextualizer.php +++ b/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/Contextualizer.php @@ -12,8 +12,7 @@ class Contextualizer implements ContextualizerInterface { - /** @var \Symfony\Component\DependencyInjection\ContainerInterface */ - private $container; + private ContainerInterface $container; /** @var string */ private $namespace; @@ -25,14 +24,11 @@ class Contextualizer implements ContextualizerInterface */ private $siteAccessNodeName; - /** @var array */ - private $availableSiteAccesses; + private array $availableSiteAccesses; - /** @var array */ - private $availableSiteAccessGroups; + private array $availableSiteAccessGroups; - /** @var array */ - private $groupsBySiteAccess; + private array $groupsBySiteAccess; public function __construct( ContainerInterface $containerBuilder, @@ -50,12 +46,12 @@ public function __construct( $this->groupsBySiteAccess = $groupsBySiteAccess; } - public function setContextualParameter($parameterName, $scope, $value) + public function setContextualParameter($parameterName, $scope, $value): void { $this->container->setParameter("$this->namespace.$scope.$parameterName", $value); } - public function mapSetting($id, array $config) + public function mapSetting($id, array $config): void { foreach ($config[$this->siteAccessNodeName] as $currentScope => $scopeSettings) { if (isset($scopeSettings[$id])) { @@ -64,7 +60,7 @@ public function mapSetting($id, array $config) } } - public function mapConfigArray($id, array $config, $options = 0) + public function mapConfigArray($id, array $config, $options = 0): void { $this->mapReservedScopeArray($id, $config, ConfigResolver::SCOPE_DEFAULT); $this->mapReservedScopeArray($id, $config, ConfigResolver::SCOPE_GLOBAL); @@ -157,7 +153,7 @@ protected function getContainerParameter($id, $default = null) * * @return array */ - private function groupsArraySetting(array $groups, $id, array $config, $options = 0) + private function groupsArraySetting(array $groups, $id, array $config, int $options = 0): array { $groupsSettings = []; sort($groups); @@ -197,7 +193,7 @@ private function groupsArraySetting(array $groups, $id, array $config, $options * @param string $id * @param string $scope */ - private function mapReservedScopeArray($id, array $config, $scope) + private function mapReservedScopeArray($id, array $config, string $scope): void { if ( isset($config[$this->siteAccessNodeName][$scope][$id]) @@ -215,7 +211,7 @@ private function mapReservedScopeArray($id, array $config, $scope) } } - public function setContainer(ContainerInterface $container) + public function setContainer(ContainerInterface $container): void { $this->container = $container; } @@ -225,7 +221,7 @@ public function getContainer() return $this->container; } - public function setSiteAccessNodeName($scopeNodeName) + public function setSiteAccessNodeName($scopeNodeName): void { $this->siteAccessNodeName = $scopeNodeName; } @@ -235,7 +231,7 @@ public function getSiteAccessNodeName() return $this->siteAccessNodeName; } - public function setNamespace($namespace) + public function setNamespace($namespace): void { $this->namespace = $namespace; } @@ -245,7 +241,7 @@ public function getNamespace() return $this->namespace; } - public function setAvailableSiteAccesses(array $availableSiteAccesses) + public function setAvailableSiteAccesses(array $availableSiteAccesses): void { $this->availableSiteAccesses = $availableSiteAccesses; } @@ -255,7 +251,7 @@ public function getAvailableSiteAccesses() return $this->availableSiteAccesses; } - public function setGroupsBySiteAccess(array $groupsBySiteAccess) + public function setGroupsBySiteAccess(array $groupsBySiteAccess): void { $this->groupsBySiteAccess = $groupsBySiteAccess; } diff --git a/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/DynamicSettingParser.php b/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/DynamicSettingParser.php index cc8a5d3cb2..10f4e79cb9 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/DynamicSettingParser.php +++ b/src/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/DynamicSettingParser.php @@ -11,7 +11,7 @@ class DynamicSettingParser implements DynamicSettingParserInterface { - public function isDynamicSetting($setting) + public function isDynamicSetting($setting): bool { // Checks if $setting begins and ends with appropriate delimiter. return @@ -22,7 +22,7 @@ public function isDynamicSetting($setting) && substr_count($setting, static::INNER_DELIMITER) <= 2; } - public function parseDynamicSetting($setting) + public function parseDynamicSetting($setting): array { $params = explode(static::INNER_DELIMITER, $this->removeBoundaryDelimiter($setting)); if (count($params) > 3) { diff --git a/src/bundle/Core/DependencyInjection/Configuration/Suggestion/Collector/SuggestionCollector.php b/src/bundle/Core/DependencyInjection/Configuration/Suggestion/Collector/SuggestionCollector.php index c6c98e949d..6dc8b1b961 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Suggestion/Collector/SuggestionCollector.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Suggestion/Collector/SuggestionCollector.php @@ -12,14 +12,14 @@ class SuggestionCollector implements SuggestionCollectorInterface { /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\ConfigSuggestion[] */ - private $suggestions = []; + private array $suggestions = []; /** * Adds a config suggestion to the list. * * @param \Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\ConfigSuggestion $suggestion */ - public function addSuggestion(ConfigSuggestion $suggestion) + public function addSuggestion(ConfigSuggestion $suggestion): void { $this->suggestions[] = $suggestion; } diff --git a/src/bundle/Core/DependencyInjection/Configuration/Suggestion/ConfigSuggestion.php b/src/bundle/Core/DependencyInjection/Configuration/Suggestion/ConfigSuggestion.php index f64c5ca1cd..065a0376cb 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Suggestion/ConfigSuggestion.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Suggestion/ConfigSuggestion.php @@ -24,10 +24,8 @@ class ConfigSuggestion /** * Suggested semantic configuration. * Hash as been used with Symfony Config component. - * - * @var array */ - private $suggestion; + private array $suggestion; /** @var bool */ private $mandatory; @@ -42,7 +40,7 @@ public function __construct($message = null, array $suggestion = [], $mandatory /** * @param string $message */ - public function setMessage($message) + public function setMessage($message): void { $this->message = $message; } @@ -58,7 +56,7 @@ public function getMessage() /** * @param array $suggestion */ - public function setSuggestion(array $suggestion) + public function setSuggestion(array $suggestion): void { $this->suggestion = $suggestion; } @@ -74,7 +72,7 @@ public function getSuggestion() /** * @param bool $mandatory */ - public function setMandatory($mandatory) + public function setMandatory($mandatory): void { $this->mandatory = $mandatory; } diff --git a/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php b/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php index 9a152a16c1..c6f4f79ebd 100644 --- a/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php +++ b/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php @@ -50,34 +50,29 @@ class IbexaCoreExtension extends Extension implements PrependExtensionInterface private const DEBUG_PARAM = 'kernel.debug'; - /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollector */ - private $suggestionCollector; + private SuggestionCollector $suggestionCollector; - /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\ParserInterface */ - private $mainConfigParser; + private ?ConfigParser $mainConfigParser = null; - /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\RepositoryConfigParser */ - private $mainRepositoryConfigParser; + private ?RepositoryConfigParser $mainRepositoryConfigParser = null; /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\ParserInterface[] */ - private $siteAccessConfigParsers; + private array $siteAccessConfigParsers; /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\RepositoryConfigParserInterface[] */ - private $repositoryConfigParsers = []; + private array $repositoryConfigParsers = []; /** @var \Ibexa\Bundle\Core\DependencyInjection\Security\PolicyProvider\PolicyProviderInterface[] */ - private $policyProviders = []; + private array $policyProviders = []; /** * Holds a collection of YAML files, as an array with directory path as a * key to the array of contained file names. - * - * @var array */ - private $defaultSettingsCollection = []; + private array $defaultSettingsCollection = []; /** @var \Ibexa\Bundle\Core\SiteAccess\SiteAccessConfigurationFilter[] */ - private $siteaccessConfigurationFilters = []; + private array $siteaccessConfigurationFilters = []; public function __construct(array $siteAccessConfigParsers = [], array $repositoryConfigParsers = []) { @@ -249,7 +244,7 @@ private function handleDefaultSettingsLoading(ContainerBuilder $container): void } } - private function registerRepositoriesConfiguration(array $config, ContainerBuilder $container) + private function registerRepositoriesConfiguration(array $config, ContainerBuilder $container): void { if (!isset($config['repositories'])) { $config['repositories'] = []; @@ -264,7 +259,7 @@ private function registerRepositoriesConfiguration(array $config, ContainerBuild $container->setParameter('ibexa.repositories', $config['repositories']); } - private function registerSiteAccessConfiguration(array $config, ContainerBuilder $container) + private function registerSiteAccessConfiguration(array $config, ContainerBuilder $container): void { if (!isset($config['siteaccess'])) { $config['siteaccess'] = []; @@ -318,7 +313,7 @@ private function registerUITranslationsConfiguration(array $config, ContainerBui * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container * @param \Symfony\Component\DependencyInjection\Loader\FileLoader $loader */ - private function handleRouting(array $config, ContainerBuilder $container, FileLoader $loader) + private function handleRouting(array $config, ContainerBuilder $container, FileLoader $loader): void { $loader->load('routing.yml'); $container->setAlias('router', ChainRouter::class); @@ -395,7 +390,7 @@ private function handleApiLoading(ContainerBuilder $container, FileLoader $loade * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container * @param \Symfony\Component\DependencyInjection\Loader\FileLoader $loader */ - private function handleTemplating(ContainerBuilder $container, FileLoader $loader) + private function handleTemplating(ContainerBuilder $container, FileLoader $loader): void { $loader->load('templating.yml'); } @@ -406,7 +401,7 @@ private function handleTemplating(ContainerBuilder $container, FileLoader $loade * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container * @param \Symfony\Component\DependencyInjection\Loader\FileLoader $loader */ - private function handleSessionLoading(ContainerBuilder $container, FileLoader $loader) + private function handleSessionLoading(ContainerBuilder $container, FileLoader $loader): void { $loader->load('session.yml'); } @@ -420,7 +415,7 @@ private function handleSessionLoading(ContainerBuilder $container, FileLoader $l * * @throws \InvalidArgumentException */ - private function handleCache(array $config, ContainerBuilder $container, FileLoader $loader) + private function handleCache(array $config, ContainerBuilder $container, FileLoader $loader): void { $loader->load('cache.yml'); @@ -446,7 +441,7 @@ private function handleCache(array $config, ContainerBuilder $container, FileLoa * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container * @param \Symfony\Component\DependencyInjection\Loader\FileLoader $loader */ - private function handleLocale(array $config, ContainerBuilder $container, FileLoader $loader) + private function handleLocale(array $config, ContainerBuilder $container, FileLoader $loader): void { $loader->load('locale.yml'); $container->setParameter( @@ -462,7 +457,7 @@ private function handleLocale(array $config, ContainerBuilder $container, FileLo * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container * @param \Symfony\Component\DependencyInjection\Loader\FileLoader $loader */ - private function handleHelpers(array $config, ContainerBuilder $container, FileLoader $loader) + private function handleHelpers(array $config, ContainerBuilder $container, FileLoader $loader): void { $loader->load('helpers.yml'); } @@ -472,7 +467,7 @@ private function handleHelpers(array $config, ContainerBuilder $container, FileL * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container * @param \Symfony\Component\DependencyInjection\Loader\FileLoader $loader */ - private function handleImage(array $config, ContainerBuilder $container, FileLoader $loader) + private function handleImage(array $config, ContainerBuilder $container, FileLoader $loader): void { $loader->load('image.yml'); @@ -490,12 +485,12 @@ private function handleImage(array $config, ContainerBuilder $container, FileLoa $container->setParameter('ibexa.io.images.alias.placeholder_provider', $providers); } - private function handleUrlChecker($config, ContainerBuilder $container, FileLoader $loader) + private function handleUrlChecker(array $config, ContainerBuilder $container, FileLoader $loader): void { $loader->load('url_checker.yml'); } - private function buildPolicyMap(ContainerBuilder $container) + private function buildPolicyMap(ContainerBuilder $container): void { $policiesBuilder = new PoliciesConfigBuilder($container); foreach ($this->policyProviders as $provider) { @@ -519,7 +514,7 @@ private function buildPolicyMap(ContainerBuilder $container) * * @param \Ibexa\Bundle\Core\DependencyInjection\Security\PolicyProvider\PolicyProviderInterface $policyProvider */ - public function addPolicyProvider(PolicyProviderInterface $policyProvider) + public function addPolicyProvider(PolicyProviderInterface $policyProvider): void { $this->policyProviders[] = $policyProvider; } @@ -540,7 +535,7 @@ public function addPolicyProvider(PolicyProviderInterface $policyProvider) * * @param \Ibexa\Bundle\Core\DependencyInjection\Configuration\ParserInterface $configParser */ - public function addConfigParser(ParserInterface $configParser) + public function addConfigParser(ParserInterface $configParser): void { $this->siteAccessConfigParsers[] = $configParser; } @@ -570,12 +565,12 @@ public function addRepositoryConfigParser(RepositoryConfigParserInterface $confi * @param string $fileLocation * @param array $files */ - public function addDefaultSettings($fileLocation, array $files) + public function addDefaultSettings($fileLocation, array $files): void { $this->defaultSettingsCollection[$fileLocation] = $files; } - public function addSiteAccessConfigurationFilter(SiteAccessConfigurationFilter $filter) + public function addSiteAccessConfigurationFilter(SiteAccessConfigurationFilter $filter): void { $this->siteaccessConfigurationFilters[] = $filter; } @@ -584,7 +579,7 @@ public function addSiteAccessConfigurationFilter(SiteAccessConfigurationFilter $ * @param array $config * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - private function registerUrlAliasConfiguration(array $config, ContainerBuilder $container) + private function registerUrlAliasConfiguration(array $config, ContainerBuilder $container): void { if (!isset($config['url_alias'])) { $config['url_alias'] = ['slug_converter' => []]; @@ -596,7 +591,7 @@ private function registerUrlAliasConfiguration(array $config, ContainerBuilder $ /** * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - private function prependTranslatorConfiguration(ContainerBuilder $container) + private function prependTranslatorConfiguration(ContainerBuilder $container): void { if (!$container->hasExtension('framework')) { return; @@ -679,7 +674,7 @@ private function registerUrlWildcardsConfiguration(array $config, ContainerBuild * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container * @param \Symfony\Component\DependencyInjection\Loader\FileLoader $loader */ - private function handleUrlWildcards(array $config, ContainerBuilder $container, Loader\YamlFileLoader $loader) + private function handleUrlWildcards(array $config, ContainerBuilder $container, Loader\YamlFileLoader $loader): void { if ($container->getParameter('ibexa.url_wildcards.enabled')) { $loader->load('url_wildcard.yml'); diff --git a/src/bundle/Core/DependencyInjection/Security/PolicyProvider/PoliciesConfigBuilder.php b/src/bundle/Core/DependencyInjection/Security/PolicyProvider/PoliciesConfigBuilder.php index 3cff590d2a..cbab1ce842 100644 --- a/src/bundle/Core/DependencyInjection/Security/PolicyProvider/PoliciesConfigBuilder.php +++ b/src/bundle/Core/DependencyInjection/Security/PolicyProvider/PoliciesConfigBuilder.php @@ -12,7 +12,7 @@ class PoliciesConfigBuilder extends ContainerConfigBuilder { - public function addConfig(array $config) + public function addConfig(array $config): void { $previousPolicyMap = []; @@ -39,7 +39,7 @@ public function addConfig(array $config) ); } - public function addResource(ResourceInterface $resource) + public function addResource(ResourceInterface $resource): void { $this->containerBuilder->addResource($resource); } @@ -53,7 +53,7 @@ public function addResource(ResourceInterface $resource) * * @return bool */ - private function policyExists(array $policyMap, $module, $function): bool + private function policyExists(array $policyMap, int|string $module, $function): bool { return array_key_exists($module, $policyMap) && array_key_exists($function, $policyMap[$module]); } diff --git a/src/bundle/Core/DependencyInjection/Security/PolicyProvider/YamlPolicyProvider.php b/src/bundle/Core/DependencyInjection/Security/PolicyProvider/YamlPolicyProvider.php index 53c2160ac5..858b2d082c 100644 --- a/src/bundle/Core/DependencyInjection/Security/PolicyProvider/YamlPolicyProvider.php +++ b/src/bundle/Core/DependencyInjection/Security/PolicyProvider/YamlPolicyProvider.php @@ -16,7 +16,7 @@ */ abstract class YamlPolicyProvider implements PolicyProviderInterface { - public function addPolicies(ConfigBuilderInterface $configBuilder) + public function addPolicies(ConfigBuilderInterface $configBuilder): void { $policiesConfig = []; foreach ($this->getFiles() as $file) { diff --git a/src/bundle/Core/EventListener/BackgroundIndexingTerminateListener.php b/src/bundle/Core/EventListener/BackgroundIndexingTerminateListener.php index 5301a1a020..398ee3311c 100644 --- a/src/bundle/Core/EventListener/BackgroundIndexingTerminateListener.php +++ b/src/bundle/Core/EventListener/BackgroundIndexingTerminateListener.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Persistence\Content\ContentInfo; use Ibexa\Contracts\Core\Persistence\Content\Location; +use Ibexa\Contracts\Core\Persistence\Handler; use Ibexa\Contracts\Core\Persistence\Handler as PersistenceHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Search\Handler as SearchHandler; @@ -26,11 +27,9 @@ class BackgroundIndexingTerminateListener implements BackgroundIndexerInterface, { use LoggerAwareTrait; - /** @var \Ibexa\Contracts\Core\Persistence\Handler */ - protected $persistenceHandler; + protected Handler $persistenceHandler; - /** @var \Ibexa\Contracts\Core\Search\Handler */ - protected $searchHandler; + protected SearchHandler $searchHandler; /** @var \Ibexa\Contracts\Core\Persistence\Content\ContentInfo[] */ protected $contentInfo = []; @@ -56,7 +55,7 @@ public static function getSubscribedEvents(): array /** * {@inheritdoc} */ - public function registerContent(ContentInfo $contentInfo) + public function registerContent(ContentInfo $contentInfo): void { $this->contentInfo[] = $contentInfo; } @@ -64,12 +63,12 @@ public function registerContent(ContentInfo $contentInfo) /** * {@inheritdoc} */ - public function registerLocation(Location $location) + public function registerLocation(Location $location): void { $this->locations[] = $location; } - public function reindex() + public function reindex(): void { $contentHandler = $this->persistenceHandler->contentHandler(); $contentIndexed = []; diff --git a/src/bundle/Core/EventListener/CacheViewResponseListener.php b/src/bundle/Core/EventListener/CacheViewResponseListener.php index 07104ce4a7..ef7d0b4e94 100644 --- a/src/bundle/Core/EventListener/CacheViewResponseListener.php +++ b/src/bundle/Core/EventListener/CacheViewResponseListener.php @@ -20,8 +20,7 @@ */ class CacheViewResponseListener implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; public function __construct(ConfigResolverInterface $configResolver) { @@ -33,7 +32,7 @@ public static function getSubscribedEvents(): array return [KernelEvents::RESPONSE => 'configureCache']; } - public function configureCache(ResponseEvent $event) + public function configureCache(ResponseEvent $event): void { if (!($view = $event->getRequest()->attributes->get('view')) instanceof CachableView) { return; diff --git a/src/bundle/Core/EventListener/ConfigScopeListener.php b/src/bundle/Core/EventListener/ConfigScopeListener.php index f9c9088a47..bd381605c9 100644 --- a/src/bundle/Core/EventListener/ConfigScopeListener.php +++ b/src/bundle/Core/EventListener/ConfigScopeListener.php @@ -18,13 +18,13 @@ class ConfigScopeListener implements EventSubscriberInterface, ConfigScopeChangeSubscriber { /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface[] */ - private $configResolvers; + private iterable $configResolvers; /** @var \Ibexa\Core\MVC\Symfony\View\ViewManagerInterface|\Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessAware */ - private $viewManager; + private ViewManagerInterface $viewManager; /** @var \Ibexa\Core\MVC\Symfony\View\ViewProvider[]|\Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessAware[] */ - private $viewProviders; + private ?array $viewProviders = null; public function __construct( iterable $configResolvers, @@ -66,7 +66,7 @@ public function onConfigScopeChange(ScopeChangeEvent $event): void /** * Sets the complete list of view providers. */ - public function setViewProviders(array $viewProviders) + public function setViewProviders(array $viewProviders): void { $this->viewProviders = $viewProviders; } diff --git a/src/bundle/Core/EventListener/ConsoleCommandListener.php b/src/bundle/Core/EventListener/ConsoleCommandListener.php index a1b4cfba7b..f57b4e8f0a 100644 --- a/src/bundle/Core/EventListener/ConsoleCommandListener.php +++ b/src/bundle/Core/EventListener/ConsoleCommandListener.php @@ -12,6 +12,7 @@ use Ibexa\Core\MVC\Symfony\MVCEvents; use Ibexa\Core\MVC\Symfony\SiteAccess; use Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessAware; +use Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessProviderInterface; use Symfony\Component\Console\ConsoleEvents; use Symfony\Component\Console\Event\ConsoleCommandEvent; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -19,24 +20,19 @@ class ConsoleCommandListener implements EventSubscriberInterface, SiteAccessAware { - /** @var string */ - private $defaultSiteAccessName; + private string $defaultSiteAccessName; - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessProviderInterface */ - private $siteAccessProvider; + private SiteAccessProviderInterface $siteAccessProvider; - /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ - private $eventDispatcher; + private EventDispatcherInterface $eventDispatcher; - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess|null */ - private $siteAccess; + private ?SiteAccess $siteAccess = null; - /** @var bool */ - private $debug; + private bool $debug; public function __construct( string $defaultSiteAccessName, - SiteAccess\SiteAccessProviderInterface $siteAccessProvider, + SiteAccessProviderInterface $siteAccessProvider, EventDispatcherInterface $eventDispatcher, bool $debug = false ) { @@ -55,7 +51,7 @@ public static function getSubscribedEvents(): array ]; } - public function onConsoleCommand(ConsoleCommandEvent $event) + public function onConsoleCommand(ConsoleCommandEvent $event): void { $this->siteAccess->name = $event->getInput()->getParameterOption('--siteaccess', $this->defaultSiteAccessName); $this->siteAccess->matchingType = 'cli'; @@ -72,12 +68,12 @@ public function onConsoleCommand(ConsoleCommandEvent $event) $this->eventDispatcher->dispatch(new ScopeChangeEvent($this->siteAccess), MVCEvents::CONFIG_SCOPE_CHANGE); } - public function setSiteAccess(SiteAccess $siteAccess = null) + public function setSiteAccess(SiteAccess $siteAccess = null): void { $this->siteAccess = $siteAccess; } - public function setDebug($debug = false) + public function setDebug($debug = false): void { $this->debug = $debug; } diff --git a/src/bundle/Core/EventListener/ContentDownloadRouteReferenceListener.php b/src/bundle/Core/EventListener/ContentDownloadRouteReferenceListener.php index 16e269c4f1..46f2e17077 100644 --- a/src/bundle/Core/EventListener/ContentDownloadRouteReferenceListener.php +++ b/src/bundle/Core/EventListener/ContentDownloadRouteReferenceListener.php @@ -29,8 +29,7 @@ class ContentDownloadRouteReferenceListener implements EventSubscriberInterface public const OPT_SITEACCESS = 'siteaccess'; public const OPT_VERSION = 'version'; - /** @var \Ibexa\Core\Helper\TranslationHelper */ - private $translationHelper; + private TranslationHelper $translationHelper; public function __construct(TranslationHelper $translationHelper) { @@ -47,7 +46,7 @@ public static function getSubscribedEvents(): array /** * @throws \InvalidArgumentException If the required arguments are not correct */ - public function onRouteReferenceGeneration(RouteReferenceGenerationEvent $event) + public function onRouteReferenceGeneration(RouteReferenceGenerationEvent $event): void { $routeReference = $event->getRouteReference(); diff --git a/src/bundle/Core/EventListener/ExceptionListener.php b/src/bundle/Core/EventListener/ExceptionListener.php index 9691d314c7..7df73d16a9 100644 --- a/src/bundle/Core/EventListener/ExceptionListener.php +++ b/src/bundle/Core/EventListener/ExceptionListener.php @@ -26,8 +26,7 @@ class ExceptionListener implements EventSubscriberInterface { - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ - private $translator; + private TranslatorInterface $translator; public function __construct(TranslatorInterface $translator) { @@ -41,7 +40,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelException(ExceptionEvent $event) + public function onKernelException(ExceptionEvent $event): void { $exception = $event->getThrowable(); diff --git a/src/bundle/Core/EventListener/IndexRequestListener.php b/src/bundle/Core/EventListener/IndexRequestListener.php index 3b76b42207..bbc09ffe14 100644 --- a/src/bundle/Core/EventListener/IndexRequestListener.php +++ b/src/bundle/Core/EventListener/IndexRequestListener.php @@ -15,8 +15,7 @@ class IndexRequestListener implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - protected $configResolver; + protected ConfigResolverInterface $configResolver; public function __construct(ConfigResolverInterface $configResolver) { @@ -38,7 +37,7 @@ public static function getSubscribedEvents(): array * * @param \Symfony\Component\HttpKernel\Event\RequestEvent $event */ - public function onKernelRequestIndex(RequestEvent $event) + public function onKernelRequestIndex(RequestEvent $event): void { $request = $event->getRequest(); $semanticPathinfo = $request->attributes->get('semanticPathinfo') ?: '/'; diff --git a/src/bundle/Core/EventListener/LocaleListener.php b/src/bundle/Core/EventListener/LocaleListener.php index 89ce7b6864..9d5b9ff8a6 100644 --- a/src/bundle/Core/EventListener/LocaleListener.php +++ b/src/bundle/Core/EventListener/LocaleListener.php @@ -20,14 +20,11 @@ */ class LocaleListener implements EventSubscriberInterface { - /** @var \Symfony\Component\HttpKernel\EventListener\LocaleListener */ - private $innerListener; + private BaseLocaleListener $innerListener; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; - /** @var \Ibexa\Core\MVC\Symfony\Locale\LocaleConverterInterface */ - private $localeConverter; + private LocaleConverterInterface $localeConverter; public function __construct(BaseLocaleListener $innerListener, ConfigResolverInterface $configResolver, LocaleConverterInterface $localeConverter) { diff --git a/src/bundle/Core/EventListener/OriginalRequestListener.php b/src/bundle/Core/EventListener/OriginalRequestListener.php index 1dc2f5b5fe..03c43bff49 100644 --- a/src/bundle/Core/EventListener/OriginalRequestListener.php +++ b/src/bundle/Core/EventListener/OriginalRequestListener.php @@ -26,7 +26,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { if ($event->getRequestType() !== HttpKernelInterface::MAIN_REQUEST) { return; diff --git a/src/bundle/Core/EventListener/PreviewRequestListener.php b/src/bundle/Core/EventListener/PreviewRequestListener.php index 2b752f1dd8..6dbfd51e00 100644 --- a/src/bundle/Core/EventListener/PreviewRequestListener.php +++ b/src/bundle/Core/EventListener/PreviewRequestListener.php @@ -16,8 +16,7 @@ class PreviewRequestListener implements EventSubscriberInterface { - /** @var \Symfony\Component\HttpFoundation\RequestStack */ - private $requestStack; + private RequestStack $requestStack; public function __construct(RequestStack $requestStack) { diff --git a/src/bundle/Core/EventListener/RejectExplicitFrontControllerRequestsListener.php b/src/bundle/Core/EventListener/RejectExplicitFrontControllerRequestsListener.php index e16dc3c4b1..af222c4abe 100644 --- a/src/bundle/Core/EventListener/RejectExplicitFrontControllerRequestsListener.php +++ b/src/bundle/Core/EventListener/RejectExplicitFrontControllerRequestsListener.php @@ -29,7 +29,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { if ($event->getRequestType() !== HttpKernelInterface::MAIN_REQUEST) { return; diff --git a/src/bundle/Core/EventListener/RequestEventListener.php b/src/bundle/Core/EventListener/RequestEventListener.php index 2e9b1ca58a..8ca2bee848 100644 --- a/src/bundle/Core/EventListener/RequestEventListener.php +++ b/src/bundle/Core/EventListener/RequestEventListener.php @@ -22,17 +22,14 @@ class RequestEventListener implements EventSubscriberInterface { - /** @var \Psr\Log\LoggerInterface */ - private $logger; + private ?LoggerInterface $logger; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; /** @var string */ private $defaultSiteAccess; - /** @var \Symfony\Component\Routing\RouterInterface */ - private $router; + private RouterInterface $router; public function __construct(ConfigResolverInterface $configResolver, RouterInterface $router, $defaultSiteAccess, LoggerInterface $logger = null) { @@ -55,7 +52,7 @@ public static function getSubscribedEvents(): array /** * @param \Symfony\Component\HttpKernel\Event\RequestEvent $event */ - public function onKernelRequestForward(RequestEvent $event) + public function onKernelRequestForward(RequestEvent $event): void { if ($event->getRequestType() === HttpKernelInterface::MAIN_REQUEST) { $request = $event->getRequest(); @@ -106,7 +103,7 @@ public function onKernelRequestForward(RequestEvent $event) * * @see \Ibexa\Core\MVC\Symfony\Routing\UrlAliasRouter */ - public function onKernelRequestRedirect(RequestEvent $event) + public function onKernelRequestRedirect(RequestEvent $event): void { if ($event->getRequestType() == HttpKernelInterface::MAIN_REQUEST) { $request = $event->getRequest(); diff --git a/src/bundle/Core/EventListener/RoutingListener.php b/src/bundle/Core/EventListener/RoutingListener.php index 4bd5f241de..540561d556 100644 --- a/src/bundle/Core/EventListener/RoutingListener.php +++ b/src/bundle/Core/EventListener/RoutingListener.php @@ -19,14 +19,11 @@ */ class RoutingListener implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; - /** @var \Symfony\Component\Routing\RouterInterface */ - private $urlAliasRouter; + private RouterInterface $urlAliasRouter; - /** @var \Ibexa\Core\MVC\Symfony\Routing\Generator */ - private $urlAliasGenerator; + private Generator $urlAliasGenerator; public function __construct(ConfigResolverInterface $configResolver, RouterInterface $urlAliasRouter, Generator $urlAliasGenerator) { @@ -42,7 +39,7 @@ public static function getSubscribedEvents(): array ]; } - public function onSiteAccessMatch(PostSiteAccessMatchEvent $event) + public function onSiteAccessMatch(PostSiteAccessMatchEvent $event): void { $rootLocationId = $this->configResolver->getParameter('content.tree_root.location_id'); $this->urlAliasRouter->setRootLocationId($rootLocationId); diff --git a/src/bundle/Core/EventListener/SessionInitByPostListener.php b/src/bundle/Core/EventListener/SessionInitByPostListener.php index ecd7df18ce..d92888e382 100644 --- a/src/bundle/Core/EventListener/SessionInitByPostListener.php +++ b/src/bundle/Core/EventListener/SessionInitByPostListener.php @@ -25,7 +25,7 @@ public static function getSubscribedEvents(): array ]; } - public function onSiteAccessMatch(PostSiteAccessMatchEvent $event) + public function onSiteAccessMatch(PostSiteAccessMatchEvent $event): void { $request = $event->getRequest(); $session = null; diff --git a/src/bundle/Core/EventListener/SiteAccessListener.php b/src/bundle/Core/EventListener/SiteAccessListener.php index 07b70100e6..ae2d76a95a 100644 --- a/src/bundle/Core/EventListener/SiteAccessListener.php +++ b/src/bundle/Core/EventListener/SiteAccessListener.php @@ -18,8 +18,7 @@ */ class SiteAccessListener implements EventSubscriberInterface { - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ - private $siteaccess; + private SiteAccess $siteaccess; public function __construct( SiteAccess $siteaccess diff --git a/src/bundle/Core/EventListener/ViewControllerListener.php b/src/bundle/Core/EventListener/ViewControllerListener.php index 35a7d5a2a9..5886ec2f5d 100644 --- a/src/bundle/Core/EventListener/ViewControllerListener.php +++ b/src/bundle/Core/EventListener/ViewControllerListener.php @@ -21,17 +21,14 @@ class ViewControllerListener implements EventSubscriberInterface { - /** @var \Symfony\Component\HttpKernel\Controller\ControllerResolverInterface */ - private $controllerResolver; + private ControllerResolverInterface $controllerResolver; - /** @var \Psr\Log\LoggerInterface */ - private $logger; + private LoggerInterface $logger; - /** @var \Ibexa\Core\MVC\Symfony\View\Builder\ViewBuilderRegistry */ - private $viewBuilderRegistry; + private ViewBuilderRegistry $viewBuilderRegistry; /** @var \Symfony\Component\EventDispatcher\EventDispatcher */ - private $eventDispatcher; + private EventDispatcherInterface $eventDispatcher; public function __construct( ControllerResolverInterface $controllerResolver, @@ -57,7 +54,7 @@ public static function getSubscribedEvents(): array * * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException */ - public function getController(ControllerEvent $event) + public function getController(ControllerEvent $event): void { $request = $event->getRequest(); diff --git a/src/bundle/Core/EventListener/ViewRendererListener.php b/src/bundle/Core/EventListener/ViewRendererListener.php index 0693f9082b..dba047bd5b 100644 --- a/src/bundle/Core/EventListener/ViewRendererListener.php +++ b/src/bundle/Core/EventListener/ViewRendererListener.php @@ -7,6 +7,7 @@ namespace Ibexa\Bundle\Core\EventListener; +use Ibexa\Core\MVC\Symfony\View\Renderer; use Ibexa\Core\MVC\Symfony\View\Renderer as ViewRenderer; use Ibexa\Core\MVC\Symfony\View\View; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -16,8 +17,7 @@ class ViewRendererListener implements EventSubscriberInterface { - /** @var \Ibexa\Core\MVC\Symfony\View\Renderer */ - private $viewRenderer; + private Renderer $viewRenderer; public function __construct(ViewRenderer $viewRenderer) { @@ -29,7 +29,7 @@ public static function getSubscribedEvents(): array return [KernelEvents::VIEW => 'renderView']; } - public function renderView(ViewEvent $event) + public function renderView(ViewEvent $event): void { if (!($view = $event->getControllerResult()) instanceof View) { return; diff --git a/src/bundle/Core/EventSubscriber/CrowdinRequestLocaleSubscriber.php b/src/bundle/Core/EventSubscriber/CrowdinRequestLocaleSubscriber.php index de2e7ce860..cc8616a105 100644 --- a/src/bundle/Core/EventSubscriber/CrowdinRequestLocaleSubscriber.php +++ b/src/bundle/Core/EventSubscriber/CrowdinRequestLocaleSubscriber.php @@ -26,7 +26,7 @@ public static function getSubscribedEvents(): array ]; } - public function setInContextAcceptLanguage(RequestEvent $e) + public function setInContextAcceptLanguage(RequestEvent $e): void { if (!$e->getRequest()->cookies->has('ez_in_context_translation')) { return; diff --git a/src/bundle/Core/Features/Context/BasicContentContext.php b/src/bundle/Core/Features/Context/BasicContentContext.php index 1f8af9d624..1d9c2d5fa9 100644 --- a/src/bundle/Core/Features/Context/BasicContentContext.php +++ b/src/bundle/Core/Features/Context/BasicContentContext.php @@ -26,16 +26,13 @@ class BasicContentContext implements Context /** * Content path mapping. */ - private $contentPaths = []; + private array $contentPaths = []; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - private $contentTypeService; + private ContentTypeService $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - private $repository; + private Repository $repository; public function __construct( Repository $repository, @@ -68,7 +65,7 @@ public function createContent($contentType, $fields, $parentLocationId) /** * Publishes a content draft. */ - public function publishDraft(Content $content) + public function publishDraft(Content $content): void { $this->contentService->publishVersion($content->versionInfo->id); } @@ -83,7 +80,7 @@ public function publishDraft(Content $content) * * @return \Ibexa\Core\Repository\Values\Content\Content an unpublished Content draft */ - public function createContentDraft($parentLocationId, $contentTypeIdentifier, $fields, $languageCode = null) + public function createContentDraft(int $parentLocationId, $contentTypeIdentifier, array $fields, $languageCode = null): \Ibexa\Contracts\Core\Repository\Values\Content\Content { $languageCode = $languageCode ?: self::DEFAULT_LANGUAGE; $locationCreateStruct = $this->repository->getLocationService()->newLocationCreateStruct($parentLocationId); @@ -137,7 +134,7 @@ public function getContentPath($name) /** * Maps the path of the content to it's name for later use. */ - private function mapContentPath($path) + private function mapContentPath(string $path): void { $contentNames = explode('/', $path); $this->contentPaths[end($contentNames)] = $path; diff --git a/src/bundle/Core/Features/Context/ConsoleContext.php b/src/bundle/Core/Features/Context/ConsoleContext.php index b5a4b0df6a..87ce8b6ee2 100644 --- a/src/bundle/Core/Features/Context/ConsoleContext.php +++ b/src/bundle/Core/Features/Context/ConsoleContext.php @@ -15,16 +15,14 @@ class ConsoleContext implements Context { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; /** @var string[] */ - private $siteaccessList; + private array $siteaccessList; - /** @var string */ - private $defaultSiteaccess; + private string $defaultSiteaccess; - private $scriptOutput = null; + private ?string $scriptOutput = null; /** * Elements referenced by 'it' in sentences. @@ -51,7 +49,7 @@ public function __construct( /** * @When I run a console script without specifying a siteaccess */ - public function iRunAConsoleScript() + public function iRunAConsoleScript(): void { $this->iRunTheCommand('ibexa:behat:test-siteaccess'); } @@ -59,7 +57,7 @@ public function iRunAConsoleScript() /** * @When I run a console script with the siteaccess option :siteaccessOption */ - public function iRunAConsoleScriptWithSiteaccess($siteaccessOption) + public function iRunAConsoleScriptWithSiteaccess($siteaccessOption): void { $this->iRunTheCommand('ibexa:behat:test-siteaccess', $siteaccessOption); } @@ -67,7 +65,7 @@ public function iRunAConsoleScriptWithSiteaccess($siteaccessOption) /** * @Then It is executed with the siteaccess :siteaccess */ - public function iExpectItToBeExecutedWithTheSiteaccess($siteaccess) + public function iExpectItToBeExecutedWithTheSiteaccess($siteaccess): void { $actualSiteaccess = trim($this->scriptOutput); Assertion::assertEquals( @@ -82,7 +80,7 @@ public function iExpectItToBeExecutedWithTheSiteaccess($siteaccess) * * default one: default siteaccess. */ - public function iExpectItToBeExecutedWithTheDefaultOne() + public function iExpectItToBeExecutedWithTheDefaultOne(): void { $this->iExpectItToBeExecutedWithTheSiteaccess($this->getDefaultSiteaccessName()); } @@ -90,7 +88,7 @@ public function iExpectItToBeExecutedWithTheDefaultOne() /** * @Given /^that there is a "([^"]*)" siteaccess$/ */ - public function thereIsASiteaccess($expectedSiteaccessName, $default = false) + public function thereIsASiteaccess($expectedSiteaccessName, $default = false): void { $found = false; @@ -108,7 +106,7 @@ public function thereIsASiteaccess($expectedSiteaccessName, $default = false) /** * @Given /^that there is a default "([^"]*)" siteaccess$/ */ - public function thereIsADefaultSiteaccess($expectedSiteaccessName) + public function thereIsADefaultSiteaccess($expectedSiteaccessName): void { $this->thereIsASiteaccess($expectedSiteaccessName, true); Assertion::assertEquals( @@ -122,7 +120,7 @@ public function thereIsADefaultSiteaccess($expectedSiteaccessName) * * it: the siteaccess referenced above. */ - public function iRunAConsoleScriptWithIt() + public function iRunAConsoleScriptWithIt(): void { $this->iRunTheCommand( 'ibexa:behat:test-siteaccess', @@ -131,7 +129,7 @@ public function iRunAConsoleScriptWithIt() $this->it['siteaccess'] = $this->scriptOutput; } - private function iRunTheCommand($command, $siteaccess = null) + private function iRunTheCommand(string $command, $siteaccess = null): void { $phpFinder = new PhpExecutableFinder(); if (!$phpPath = $phpFinder->find(false)) { @@ -164,7 +162,7 @@ private function iRunTheCommand($command, $siteaccess = null) /** * @Given /^that there is a siteaccess that is not the default one$/ */ - public function thereIsASiteaccessThatIsNotTheDefaultOne() + public function thereIsASiteaccessThatIsNotTheDefaultOne(): void { $siteaccessName = $this->getNonDefaultSiteaccessName(); Assertion::assertNotNull($siteaccessName, 'There is no siteaccess other than the default one'); @@ -174,7 +172,7 @@ public function thereIsASiteaccessThatIsNotTheDefaultOne() /** * @Then /^I expect it to be executed with it$/ */ - public function iExpectItToBeExecutedWithIt() + public function iExpectItToBeExecutedWithIt(): void { Assertion::assertEquals($this->it['siteaccess'], $this->scriptOutput); } diff --git a/src/bundle/Core/Features/Context/ContentContext.php b/src/bundle/Core/Features/Context/ContentContext.php index c35ffd6d7a..7b47d69c49 100644 --- a/src/bundle/Core/Features/Context/ContentContext.php +++ b/src/bundle/Core/Features/Context/ContentContext.php @@ -21,8 +21,7 @@ class ContentContext implements Context, SnippetAcceptingContext /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ private $currentDraft; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - private $repository; + private Repository $repository; public function __construct(Repository $repository) { @@ -32,7 +31,7 @@ public function __construct(Repository $repository) /** * @Given /^I create an folder draft$/ */ - public function iCreateAnFolderDraft() + public function iCreateAnFolderDraft(): void { $this->currentDraft = $this->createDraft( 'folder', @@ -46,7 +45,7 @@ public function iCreateAnFolderDraft() /** * @Given /^I create a draft of an existing content item$/ */ - public function iCreateADraftOfAnExistingContentItem() + public function iCreateADraftOfAnExistingContentItem(): void { $this->currentContent = $this->createContentItem( 'folder', @@ -128,7 +127,7 @@ public function updateDraft($fields) * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content the created draft. */ - public function createDraft($contentTypeIdentifier, array $fields) + public function createDraft(string $contentTypeIdentifier, array $fields) { $contentService = $this->repository->getContentService(); diff --git a/src/bundle/Core/Features/Context/ContentPreviewContext.php b/src/bundle/Core/Features/Context/ContentPreviewContext.php index 3cca9f2984..d08f57d714 100644 --- a/src/bundle/Core/Features/Context/ContentPreviewContext.php +++ b/src/bundle/Core/Features/Context/ContentPreviewContext.php @@ -18,7 +18,7 @@ class ContentPreviewContext extends RawMinkContext private $contentContext; /** @BeforeScenario */ - public function gatherContexts(BeforeScenarioScope $scope) + public function gatherContexts(BeforeScenarioScope $scope): void { $environment = $scope->getEnvironment(); @@ -28,7 +28,7 @@ public function gatherContexts(BeforeScenarioScope $scope) /** * @Given /^I create a draft for a content type that uses a custom location controller$/ */ - public function iCreateDraftOfContentTypeWithCustomLocationController() + public function iCreateDraftOfContentTypeWithCustomLocationController(): void { $this->contentContext->createDraft( 'blog_post', @@ -42,7 +42,7 @@ public function iCreateDraftOfContentTypeWithCustomLocationController() /** * @When /^I preview this draft$/ */ - public function iPreviewThisDraft() + public function iPreviewThisDraft(): void { $this->getSession()->getDriver()->visit($this->mapToVersionViewUri($this->contentContext->getCurrentDraft()->versionInfo)); } @@ -63,7 +63,7 @@ private function mapToVersionViewUri(VersionInfo $version): string /** * @Then /^the output is valid$/ */ - public function theOutputIsValid() + public function theOutputIsValid(): void { $this->checkForExceptions(); } @@ -93,7 +93,7 @@ protected function checkForExceptions() /** * @Then /^I see a preview of this draft$/ */ - public function iSeeAPreviewOfTheCurrentDraft() + public function iSeeAPreviewOfTheCurrentDraft(): void { $this->assertSession()->elementContains( 'xpath', @@ -107,7 +107,7 @@ public function iSeeAPreviewOfTheCurrentDraft() * * @Given /^I modify a field from the draft$/ */ - public function iModifyAFieldFromTheDraft() + public function iModifyAFieldFromTheDraft(): void { $this->contentContext->updateDraft( ['name' => 'MODIFIED - ' . $this->contentContext->getCurrentDraft()->getFieldValue('name')->text] diff --git a/src/bundle/Core/Features/Context/ContentTypeContext.php b/src/bundle/Core/Features/Context/ContentTypeContext.php index 7d3dda7fef..a2f9debc2d 100644 --- a/src/bundle/Core/Features/Context/ContentTypeContext.php +++ b/src/bundle/Core/Features/Context/ContentTypeContext.php @@ -11,6 +11,8 @@ use Behat\Gherkin\Node\TableNode; use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\Exceptions as ApiExceptions; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup; use PHPUnit\Framework\Assert as Assertion; /** @@ -28,8 +30,7 @@ class ContentTypeContext implements Context */ public const DEFAULT_LANGUAGE = 'eng-GB'; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - protected $contentTypeService; + protected ContentTypeService $contentTypeService; public function __construct(ContentTypeService $contentTypeService) { @@ -66,7 +67,7 @@ public function ensureContentTypeWithIndentifier( * Makes sure a content type with $identifier does not exist. * If it exists deletes it. */ - public function ensureContentTypeDoesntExist($identifier) + public function ensureContentTypeDoesntExist($identifier): void { $contentType = $this->loadContentTypeByIdentifier($identifier, false); if ($contentType) { @@ -79,7 +80,7 @@ public function ensureContentTypeDoesntExist($identifier) * * Verifies that a content type with $identifier exists. */ - public function assertContentTypeExistsByIdentifier($identifier) + public function assertContentTypeExistsByIdentifier($identifier): void { Assertion::assertTrue( $this->checkContentTypeExistenceByIdentifier($identifier), @@ -92,7 +93,7 @@ public function assertContentTypeExistsByIdentifier($identifier) * * Verifies that a content type with $identifier does not exist. */ - public function assertContentTypeDoesntExistsByIdentifier($identifier) + public function assertContentTypeDoesntExistsByIdentifier($identifier): void { Assertion::assertFalse( $this->checkContentTypeExistenceByIdentifier($identifier), @@ -105,7 +106,7 @@ public function assertContentTypeDoesntExistsByIdentifier($identifier) * * Verifies that a content type with $identifier exists in group with identifier $groupIdentifier. */ - public function assertContentTypeExistsByIdentifierOnGroup($identifier, $groupIdentifier) + public function assertContentTypeExistsByIdentifierOnGroup($identifier, $groupIdentifier): void { Assertion::assertTrue( $this->checkContentTypeExistenceByIdentifier($identifier, $groupIdentifier), @@ -121,7 +122,7 @@ public function assertContentTypeExistsByIdentifierOnGroup($identifier, $groupId * * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup|null */ - protected function loadContentTypeByIdentifier($identifier, $throwIfNotFound = true) + protected function loadContentTypeByIdentifier(string $identifier, $throwIfNotFound = true) { $contentType = null; try { @@ -147,7 +148,7 @@ protected function loadContentTypeByIdentifier($identifier, $throwIfNotFound = t * * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ - public function createContentType($groupIdentifier, $identifier, $fields) + public function createContentType(string $groupIdentifier, string $identifier, $fields) { $contentTypeService = $this->contentTypeService; $contentTypeGroup = $contentTypeService->loadContentTypeGroupByIdentifier($groupIdentifier); @@ -195,7 +196,7 @@ public function createContentType($groupIdentifier, $identifier, $fields) * * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType */ - protected function removeContentType($contentType) + protected function removeContentType(ContentType $contentType) { try { $this->contentTypeService->deleteContentType($contentType); @@ -208,7 +209,7 @@ protected function removeContentType($contentType) * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup */ - protected function assignContentGroupTypeToContentType($contentType, $contentTypeGroup) + protected function assignContentGroupTypeToContentType(ContentType $contentType, ContentTypeGroup $contentTypeGroup) { try { $this->contentTypeService->assignContentTypeGroup($contentType, $contentTypeGroup); diff --git a/src/bundle/Core/Features/Context/ExceptionContext.php b/src/bundle/Core/Features/Context/ExceptionContext.php index 101dbf6fdc..f4d277941a 100644 --- a/src/bundle/Core/Features/Context/ExceptionContext.php +++ b/src/bundle/Core/Features/Context/ExceptionContext.php @@ -17,7 +17,7 @@ class ExceptionContext extends RawMinkContext implements Context, SnippetAccepti /** * @Given /^that I am not logged in$/ */ - public function iAmNotLoggedIn() + public function iAmNotLoggedIn(): void { $this->visitPath('/logout'); } @@ -25,7 +25,7 @@ public function iAmNotLoggedIn() /** * @Given /^that I am logged in$/ */ - public function iAmLoggedIn() + public function iAmLoggedIn(): void { $this->visitPath('/login'); $this->getSession()->getPage()->fillField('Username', 'admin'); @@ -36,7 +36,7 @@ public function iAmLoggedIn() /** * @When /^a repository UnauthorizedException is thrown during an HTTP request$/ */ - public function anExceptionIsThrownDuringAnHTTPRequest() + public function anExceptionIsThrownDuringAnHTTPRequest(): void { $this->visitPath('/platform-behat/exceptions/repository-unauthorized'); } @@ -44,7 +44,7 @@ public function anExceptionIsThrownDuringAnHTTPRequest() /** * @Then /^it is converted to a Symfony Security AccessDeniedException$/ */ - public function itIsConvertedToAnSymfonyComponentSecurityCoreExceptionAccessDeniedException() + public function itIsConvertedToAnSymfonyComponentSecurityCoreExceptionAccessDeniedException(): void { // unsure how to assert this :) } @@ -52,7 +52,7 @@ public function itIsConvertedToAnSymfonyComponentSecurityCoreExceptionAccessDeni /** * @Given /^the login form is shown$/ */ - public function theLoginFormIsShown() + public function theLoginFormIsShown(): void { $this->assertSession()->addressEquals('/login'); } @@ -60,7 +60,7 @@ public function theLoginFormIsShown() /** * @Then /^(?:a|an) ([\w\\]+Exception) is displayed$/ */ - public function anAccessDeniedExceptionIsThrown($exceptionString) + public function anAccessDeniedExceptionIsThrown($exceptionString): void { $this->assertSession()->elementExists('xpath', "//abbr[@title='$exceptionString']"); } diff --git a/src/bundle/Core/Features/Context/FieldTypeContext.php b/src/bundle/Core/Features/Context/FieldTypeContext.php index c1628862e2..2166036b73 100644 --- a/src/bundle/Core/Features/Context/FieldTypeContext.php +++ b/src/bundle/Core/Features/Context/FieldTypeContext.php @@ -45,28 +45,25 @@ class FieldTypeContext implements Context ]; /** @var array Stores Internal mapping of the fieldType names */ - private $fieldTypeInternalIdentifier = [ + private array $fieldTypeInternalIdentifier = [ 'integer' => 'ezinteger', ]; /** @var array Maps the validator of the fieldtypes */ - private $validatorMappings = [ + private array $validatorMappings = [ 'integer' => 'IntegerValue', ]; /** @var array Maps the default values of the fieldtypes */ - private $defaultValues = [ + private array $defaultValues = [ 'integer' => 1, ]; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - private $contentTypeService; + private ContentTypeService $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - private $locationService; + private LocationService $locationService; public function __construct( ContentTypeService $contentTypeService, @@ -109,7 +106,7 @@ public function getFieldValidator($field) * @param string $name Name of the field, optional, if not specified $fieldType is used * @param bool $required True if the is the field required, optional */ - public function createField($fieldType, $name = null, $required = false) + public function createField($fieldType, $name = null, $required = false): void { $fieldPosition = $this->getActualFieldPosition(); $name = ($name == null ? $fieldType : $name); @@ -132,7 +129,7 @@ public function createField($fieldType, $name = null, $required = false) * @param string $value Value of the constraint * @param string $constraint Constraint name */ - public function addValueConstraint($fieldType, $value, $constraint) + public function addValueConstraint($fieldType, $value, string $constraint): void { $validatorName = $this->getFieldValidator($fieldType); $validatorParent = $validatorName . 'Validator'; @@ -153,7 +150,7 @@ public function addValueConstraint($fieldType, $value, $constraint) * @param string $field Name of the field * @param mixed $value Value of the field */ - public function createContent($field, $value) + public function createContent($field, $value): void { $this->setFieldContentState(self::CONTENT_PUBLISHED, $field, $value); } @@ -166,7 +163,7 @@ public function createContent($field, $value) * @param string $field Name of the field, optional * @param mixed $value Value of the field, optional */ - public function setFieldContentState($stateFlag, $field = null, $value = null) + public function setFieldContentState($stateFlag, $field = null, $value = null): void { if ($stateFlag <= $this->fieldConstructionObject['objectState'] || $stateFlag < self::FIELD_TYPE_NOT_CREATED @@ -208,7 +205,7 @@ public function getFieldContentState() * @param string The field name * @param mixed The field value */ - private function createAndPublishContent($field, $value) + private function createAndPublishContent($field, $value): void { $languageCode = self::DEFAULT_LANGUAGE; @@ -230,7 +227,7 @@ private function createAndPublishContent($field, $value) /** * Associates the stored fieldtype to the stored contenttype. */ - private function associateFieldToContentType() + private function associateFieldToContentType(): void { $fieldCreateStruct = $this->fieldConstructionObject['fieldType']; $this->fieldConstructionObject['contentType']->addFieldDefinition($fieldCreateStruct); @@ -240,7 +237,7 @@ private function associateFieldToContentType() /** * Publishes the stored contenttype. */ - private function publishContentType() + private function publishContentType(): void { $contentTypeGroup = $this->contentTypeService->loadContentTypeGroupByIdentifier('Content'); $contentTypeCreateStruct = $this->fieldConstructionObject['contentType']; @@ -314,7 +311,7 @@ public function getThisContentId() /** * Creates an instance of a contenttype and stores it for later publishing. */ - private function createContentType() + private function createContentType(): void { $name = $this->fieldConstructionObject['fieldType']->identifier; $name = uniqid($name . '#', true); @@ -330,7 +327,7 @@ private function createContentType() /** * Getter method for the position of the field, relative to other possible fields. */ - private function getActualFieldPosition() + private function getActualFieldPosition(): int|float { if ($this->fieldConstructionObject['fieldType'] == null) { return 10; @@ -376,7 +373,7 @@ public function createContentOfThisType($field = null, $value = null) * @Given a content type with an :fieldType field exists with Properties: * @Given a content type with an :fieldType field with name :name exists with Properties: */ - public function createContentOfThisTypeWithProperties($fieldType, TableNode $properties, $name = null) + public function createContentOfThisTypeWithProperties($fieldType, TableNode $properties, $name = null): void { $this->createField($fieldType, $name); foreach ($properties as $property) { diff --git a/src/bundle/Core/Features/Context/QueryControllerContext.php b/src/bundle/Core/Features/Context/QueryControllerContext.php index 64667f2023..e86e46841d 100644 --- a/src/bundle/Core/Features/Context/QueryControllerContext.php +++ b/src/bundle/Core/Features/Context/QueryControllerContext.php @@ -15,7 +15,7 @@ class QueryControllerContext extends RawMinkContext /** * @Given /^the Query results are assigned to the "([^"]*)" twig variable$/ */ - public function theQueryResultsAreAssignedToTheTwigVariable($twigVariableName) + public function theQueryResultsAreAssignedToTheTwigVariable($twigVariableName): void { $variableTypes = $this->getVariableTypesFromTemplate(); @@ -25,7 +25,7 @@ public function theQueryResultsAreAssignedToTheTwigVariable($twigVariableName) /** * @Then the Query results assigned to the :arg1 twig variable is a :arg2 object */ - public function theQueryResultsAssignedToTheTwigVariableIsAObject($twigVariableName, $className) + public function theQueryResultsAssignedToTheTwigVariableIsAObject($twigVariableName, $className): void { $variableTypes = $this->getVariableTypesFromTemplate(); @@ -36,7 +36,7 @@ public function theQueryResultsAssignedToTheTwigVariableIsAObject($twigVariableN /** * @Then the Query results assigned to the twig variable is a Pagerfanta object and has limit :arg1 and selected page :arg2 */ - public function theQueryResultsAssignedToTheTwigVariableIsAObjectAndHasLimitAndCountParams($pageLimit, $pageValue) + public function theQueryResultsAssignedToTheTwigVariableIsAObjectAndHasLimitAndCountParams($pageLimit, $pageValue): void { $pageLimitFound = false; $currentPageFound = false; diff --git a/src/bundle/Core/Features/Context/RoleContext.php b/src/bundle/Core/Features/Context/RoleContext.php index 595a505a1a..2bbabc789f 100644 --- a/src/bundle/Core/Features/Context/RoleContext.php +++ b/src/bundle/Core/Features/Context/RoleContext.php @@ -17,8 +17,7 @@ */ class RoleContext implements Context { - /** @var \Ibexa\Contracts\Core\Repository\roleService */ - protected $roleService; + protected RoleService $roleService; public function __construct(RoleService $roleService) { @@ -32,7 +31,7 @@ public function __construct(RoleService $roleService) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Role */ - public function ensureRoleExists($name) + public function ensureRoleExists(string $name) { try { $role = $this->roleService->loadRoleByIdentifier($name); @@ -53,7 +52,7 @@ public function ensureRoleExists($name) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Role */ - public function getRole($identifier) + public function getRole(string $identifier) { $role = null; try { @@ -82,7 +81,7 @@ public function iHaveRole($name) * * Verifies that a role with $name exists. */ - public function iSeeRole($name) + public function iSeeRole($name): void { $role = $this->getRole($name); Assertion::assertNotNull( @@ -94,7 +93,7 @@ public function iSeeRole($name) /** * @Given :name do not have any assigned policies */ - public function noAssginedPolicies($name) + public function noAssginedPolicies($name): void { $role = $this->getRole($name); Assertion::assertNotNull( @@ -108,7 +107,7 @@ public function noAssginedPolicies($name) /** * @Given :name do not have any assigned Users and groups */ - public function noAssigneGroups($name) + public function noAssigneGroups($name): void { $role = $this->getRole($name); Assertion::assertNotNull( @@ -124,7 +123,7 @@ public function noAssigneGroups($name) * * Verifies that a role with $name exists. */ - public function iDontSeeRole($name) + public function iDontSeeRole($name): void { $role = $this->getRole($name); Assertion::assertNull( diff --git a/src/bundle/Core/Features/Context/UserContext.php b/src/bundle/Core/Features/Context/UserContext.php index 7146119724..ef4c076bd5 100644 --- a/src/bundle/Core/Features/Context/UserContext.php +++ b/src/bundle/Core/Features/Context/UserContext.php @@ -9,12 +9,12 @@ use Behat\Behat\Context\Context; use Behat\Gherkin\Node\TableNode; -use Ibexa\Contracts\Core\Repository\Exceptions as ApiExceptions; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\SearchService; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\User\UserGroup; use PHPUnit\Framework\Assert as Assertion; /** @@ -34,11 +34,9 @@ class UserContext implements Context public const USERGROUP_ROOT_SUBTREE = '/1/5/'; public const USERGROUP_CONTENT_IDENTIFIER = 'user_group'; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ - protected $userService; + protected UserService $userService; - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ - protected $searchService; + protected SearchService $searchService; public function __construct(UserService $userService, SearchService $searchService) { @@ -54,11 +52,11 @@ public function __construct(UserService $userService, SearchService $searchServi * * @return \Ibexa\Core\Repository\Values\User\User found */ - public function searchUserByLogin($username, $parentGroupId = null) + public function searchUserByLogin(string $username, $parentGroupId = null) { try { $user = $this->userService->loadUserByLogin($username); - } catch (ApiExceptions\NotFoundException $e) { + } catch (NotFoundException $e) { return null; } @@ -115,7 +113,7 @@ public function searchUserGroups(string $name, ?int $parentLocationId = null): a * * @return \Ibexa\Contracts\Core\Repository\Values\User\User */ - protected function createUser($username, $email, $password, $parentGroup = null, $fields = []) + protected function createUser($username, string $email, string $password, $parentGroup = null, $fields = []) { $userCreateStruct = $this->userService->newUserCreateStruct( $username, @@ -154,7 +152,7 @@ protected function createUser($username, $email, $password, $parentGroup = null, * * @return \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - public function createUserGroup($name, $parentGroup = null) + public function createUserGroup($name, $parentGroup = null): UserGroup { if (!$parentGroup) { $parentGroup = $this->userService->loadUserGroup(self::USERGROUP_ROOT_CONTENT_ID); @@ -221,7 +219,7 @@ public function ensureUserExists($username, $email, $password, $parentGroupName * @param string $username User name * @param string $parentGroupName (optional) name of the parent group to check */ - public function ensureUserDoesntExist($username, $parentGroupName = null) + public function ensureUserDoesntExist($username, $parentGroupName = null): void { $user = null; if ($parentGroupName) { @@ -240,14 +238,14 @@ public function ensureUserDoesntExist($username, $parentGroupName = null) } else { try { $user = $this->userService->loadUserByLogin($username); - } catch (ApiExceptions\NotFoundException $e) { + } catch (NotFoundException $e) { // nothing to do } } if ($user) { try { $this->userService->deleteUser($user); - } catch (ApiExceptions\NotFoundException $e) { + } catch (NotFoundException $e) { // nothing to do } } @@ -287,7 +285,7 @@ public function checkUserExistenceByUsername($username, $parentGroupName = null) * * @return bool true if it exists, false if not */ - public function checkUserExistenceByEmail($email, $parentGroupName = null): bool + public function checkUserExistenceByEmail(string $email, $parentGroupName = null): bool { $existingUsers = $this->userService->loadUsersByEmail($email); if (count($existingUsers) == 0) { @@ -334,7 +332,7 @@ public function createPasswordHash($login, $password, $type) * * @return \Ibexa\Contracts\Core\Repository\Values\User\User */ - public function iHaveUser($username) + public function iHaveUser($username): void { $email = $this->findNonExistingUserEmail($username); $password = $username; @@ -348,7 +346,7 @@ public function iHaveUser($username) * * @return \Ibexa\Contracts\Core\Repository\Values\User\User */ - public function iHaveUserWithUsernameEmailAndPassword($username, $email, $password) + public function iHaveUserWithUsernameEmailAndPassword($username, $email, $password): void { $this->ensureUserExists($username, $email, $password); } @@ -360,7 +358,7 @@ public function iHaveUserWithUsernameEmailAndPassword($username, $email, $passwo * * @return \Ibexa\Contracts\Core\Repository\Values\User\User */ - public function iHaveUserInGroup($username, $parentGroupName) + public function iHaveUserInGroup($username, $parentGroupName): void { $email = $this->findNonExistingUserEmail($username); $password = $username; @@ -384,7 +382,7 @@ public function iHaveUserWithUsernameEmailAndPasswordInGroup($username, $email, * * Makes sure a user with username ':username' doesn't exist, removing it if necessary. */ - public function iDontHaveUser($username) + public function iDontHaveUser($username): void { $this->ensureUserDoesntExist($username); } @@ -394,7 +392,7 @@ public function iDontHaveUser($username) * * Makes sure a user with username ':username' doesn't exist as a chield of group ':parentGroup', removing it if necessary. */ - public function iDontHaveUserInGroup($username, $parentGroup) + public function iDontHaveUserInGroup($username, $parentGroup): void { $this->ensureUserDoesntExist($username, $parentGroup); } @@ -408,7 +406,7 @@ public function iDontHaveUserInGroup($username, $parentGroup) * | testUser2 | Editors | * | testUser3 | NewParent | # Both user and group should be created */ - public function iHaveTheFollowingUsers(TableNode $table) + public function iHaveTheFollowingUsers(TableNode $table): void { $users = $table->getTable(); array_shift($users); @@ -425,7 +423,7 @@ public function iHaveTheFollowingUsers(TableNode $table) * * Checks that user ':username' exists. */ - public function assertUserWithNameExists($username) + public function assertUserWithNameExists($username): void { Assertion::assertTrue( $this->checkUserExistenceByUsername($username), @@ -438,7 +436,7 @@ public function assertUserWithNameExists($username) * * Checks that user ':username' does not exist. */ - public function assertUserWithNameDoesntExist($username) + public function assertUserWithNameDoesntExist($username): void { Assertion::assertFalse( $this->checkUserExistenceByUsername($username), @@ -452,7 +450,7 @@ public function assertUserWithNameDoesntExist($username) * * Checks that user ':username' exists as a child of group ':parentGroup'. */ - public function assertUserWithNameExistsInGroup($username, $parentGroup) + public function assertUserWithNameExistsInGroup($username, $parentGroup): void { Assertion::assertTrue( $this->checkUserExistenceByUsername($username, $parentGroup), @@ -466,7 +464,7 @@ public function assertUserWithNameExistsInGroup($username, $parentGroup) * * Checks that user ':username' does not exist as a child of group ':parentGroup'. */ - public function assertUserWithNameDoesntExistInGroup($username, $parentGroup) + public function assertUserWithNameDoesntExistInGroup($username, $parentGroup): void { Assertion::assertFalse( $this->checkUserExistenceByUsername($username, $parentGroup), @@ -484,7 +482,7 @@ public function assertUserWithNameDoesntExistInGroup($username, $parentGroup) * | Editors | * | Administrator users | */ - public function assertUserWithNameDoesntExistInGroups($username, TableNode $table) + public function assertUserWithNameDoesntExistInGroups($username, TableNode $table): void { $groups = $table->getTable(); array_shift($groups); @@ -508,7 +506,7 @@ public function assertUserWithNameDoesntExistInGroups($username, TableNode $tabl * | first_name | Test | * | last_name | User | */ - public function assertUserWithNameExistsWithFields($username, TableNode $table) + public function assertUserWithNameExistsWithFields($username, TableNode $table): void { Assertion::assertTrue( $this->checkUserExistenceByUsername($username), @@ -547,7 +545,7 @@ public function assertUserWithNameExistsWithFields($username, TableNode $table) * * @throws \Exception Possible endless loop */ - private function findNonExistingUserEmail($username = 'User') + private function findNonExistingUserEmail($username = 'User'): string { $email = "{$username}@ibexa.co"; if ($this->checkUserExistenceByEmail($email)) { @@ -571,7 +569,7 @@ private function findNonExistingUserEmail($username = 'User') * * @throws \Exception Possible endless loop */ - private function findNonExistingUserName() + private function findNonExistingUserName(): string { for ($i = 0; $i < 20; ++$i) { $username = uniqid('User#', true); diff --git a/src/bundle/Core/Features/Context/YamlConfigurationContext.php b/src/bundle/Core/Features/Context/YamlConfigurationContext.php index c0a0d4922c..1426158fc1 100644 --- a/src/bundle/Core/Features/Context/YamlConfigurationContext.php +++ b/src/bundle/Core/Features/Context/YamlConfigurationContext.php @@ -22,17 +22,16 @@ */ class YamlConfigurationContext implements Context { - /** @var \Symfony\Component\HttpKernel\KernelInterface */ - private $kernel; + private KernelInterface $kernel; - private static $platformConfigurationFilePath = 'config/packages/%env%/ezplatform.yaml'; + private static string $platformConfigurationFilePath = 'config/packages/%env%/ezplatform.yaml'; public function __construct(KernelInterface $kernel) { $this->kernel = $kernel; } - public function addConfiguration(array $configuration) + public function addConfiguration(array $configuration): void { $env = $this->getEnvironment(); diff --git a/src/bundle/Core/Fragment/DirectFragmentRenderer.php b/src/bundle/Core/Fragment/DirectFragmentRenderer.php index 563c2c01cd..244f85d48c 100644 --- a/src/bundle/Core/Fragment/DirectFragmentRenderer.php +++ b/src/bundle/Core/Fragment/DirectFragmentRenderer.php @@ -27,23 +27,17 @@ class DirectFragmentRenderer extends InlineFragmentRenderer implements FragmentR { public const NAME = 'direct'; - /** @var \Symfony\Component\HttpKernel\KernelInterface */ - protected $kernel; + protected KernelInterface $kernel; - /** @var \Ibexa\Bundle\Core\EventListener\ViewControllerListener */ - protected $controllerListener; + protected ViewControllerListener $controllerListener; - /** @var \Symfony\Component\HttpKernel\Controller\ControllerResolverInterface */ - protected $controllerResolver; + protected ControllerResolverInterface $controllerResolver; - /** @var \Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactoryInterface */ - protected $argumentMetadataFactory; + protected ArgumentMetadataFactoryInterface $argumentMetadataFactory; - /** @var \Symfony\Component\HttpKernel\Controller\ValueResolverInterface */ - protected $argumentValueResolver; + protected ValueResolverInterface $argumentValueResolver; - /** @var \Ibexa\Core\MVC\Symfony\View\Renderer\TemplateRenderer */ - protected $viewTemplateRenderer; + protected TemplateRenderer $viewTemplateRenderer; public function __construct( FragmentRendererInterface $innerRenderer, diff --git a/src/bundle/Core/Fragment/FragmentListenerFactory.php b/src/bundle/Core/Fragment/FragmentListenerFactory.php index a3be5b9d4f..0405707e72 100644 --- a/src/bundle/Core/Fragment/FragmentListenerFactory.php +++ b/src/bundle/Core/Fragment/FragmentListenerFactory.php @@ -18,7 +18,7 @@ class FragmentListenerFactory { use RequestStackAware; - public function buildFragmentListener(UriSigner $uriSigner, $fragmentPath, $fragmentListenerClass) + public function buildFragmentListener(UriSigner $uriSigner, $fragmentPath, $fragmentListenerClass): ?object { // no request when executing over CLI if (!$request = $this->getCurrentRequest()) { diff --git a/src/bundle/Core/Imagine/AliasCleaner.php b/src/bundle/Core/Imagine/AliasCleaner.php index 78ff42b9cf..809b2f27ae 100644 --- a/src/bundle/Core/Imagine/AliasCleaner.php +++ b/src/bundle/Core/Imagine/AliasCleaner.php @@ -12,15 +12,14 @@ class AliasCleaner implements AliasCleanerInterface { - /** @var \Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface */ - private $aliasResolver; + private ResolverInterface $aliasResolver; public function __construct(ResolverInterface $aliasResolver) { $this->aliasResolver = $aliasResolver; } - public function removeAliases($originalPath) + public function removeAliases($originalPath): void { $this->aliasResolver->remove([$originalPath], []); } diff --git a/src/bundle/Core/Imagine/AliasGenerator.php b/src/bundle/Core/Imagine/AliasGenerator.php index 41f51896ec..ef59b3e345 100644 --- a/src/bundle/Core/Imagine/AliasGenerator.php +++ b/src/bundle/Core/Imagine/AliasGenerator.php @@ -36,25 +36,19 @@ class AliasGenerator implements VariationHandler { public const ALIAS_ORIGINAL = 'original'; - /** @var \Psr\Log\LoggerInterface */ - private $logger; + private LoggerInterface $logger; /** * Loader used to retrieve the original image. * DataManager is not used to remain independent from ImagineBundle configuration. - * - * @var \Liip\ImagineBundle\Binary\Loader\LoaderInterface */ - private $dataLoader; + private LoaderInterface $dataLoader; - /** @var \Liip\ImagineBundle\Imagine\Filter\FilterManager */ - private $filterManager; + private FilterManager $filterManager; - /** @var \Liip\ImagineBundle\Imagine\Filter\FilterConfiguration */ - private $filterConfiguration; + private FilterConfiguration $filterConfiguration; - /** @var \Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface */ - private $ioResolver; + private ResolverInterface $ioResolver; public function __construct( LoaderInterface $dataLoader, @@ -77,7 +71,7 @@ public function __construct( * @throws \Ibexa\Core\MVC\Exception\SourceImageNotFoundException If source image cannot be found. * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidVariationException If a problem occurs with generated variation. */ - public function getVariation(Field $field, VersionInfo $versionInfo, $variationName, array $parameters = []) + public function getVariation(Field $field, VersionInfo $versionInfo, $variationName, array $parameters = []): ImageVariation { /** @var \Ibexa\Core\FieldType\Image\Value $imageValue */ $imageValue = $field->value; diff --git a/src/bundle/Core/Imagine/BinaryLoader.php b/src/bundle/Core/Imagine/BinaryLoader.php index 48d7cf755a..5c35098581 100644 --- a/src/bundle/Core/Imagine/BinaryLoader.php +++ b/src/bundle/Core/Imagine/BinaryLoader.php @@ -22,11 +22,9 @@ */ class BinaryLoader implements LoaderInterface { - /** @var \Ibexa\Core\IO\IOServiceInterface */ - private $ioService; + private IOServiceInterface $ioService; - /** @var \Symfony\Component\Mime\MimeTypesInterface */ - private $mimeTypes; + private MimeTypesInterface $mimeTypes; public function __construct(IOServiceInterface $ioService, MimeTypesInterface $mimeTypes) { diff --git a/src/bundle/Core/Imagine/Cache/AliasGeneratorDecorator.php b/src/bundle/Core/Imagine/Cache/AliasGeneratorDecorator.php index f786489239..999cd37c14 100644 --- a/src/bundle/Core/Imagine/Cache/AliasGeneratorDecorator.php +++ b/src/bundle/Core/Imagine/Cache/AliasGeneratorDecorator.php @@ -29,20 +29,15 @@ class AliasGeneratorDecorator implements VariationHandler, SiteAccessAware private const CONTENT_IDENTIFIER = 'content'; private const CONTENT_VERSION_IDENTIFIER = 'content_version'; - /** @var \Ibexa\Contracts\Core\Variation\VariationHandler */ - private $aliasGenerator; + private VariationHandler $aliasGenerator; - /** @var \Symfony\Component\Cache\Adapter\TagAwareAdapterInterface */ - private $cache; + private TagAwareAdapterInterface $cache; - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ - private $siteAccess; + private ?SiteAccess $siteAccess = null; - /** @var \Symfony\Component\Routing\RequestContext */ - private $requestContext; + private RequestContext $requestContext; - /** @var \Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierGeneratorInterface */ - private $cacheIdentifierGenerator; + private CacheIdentifierGeneratorInterface $cacheIdentifierGenerator; /** * @param \Ibexa\Contracts\Core\Variation\VariationHandler $aliasGenerator @@ -89,7 +84,7 @@ public function getVariation(Field $field, VersionInfo $versionInfo, $variationN /** * @param \Ibexa\Core\MVC\Symfony\SiteAccess|null $siteAccess */ - public function setSiteAccess(SiteAccess $siteAccess = null) + public function setSiteAccess(SiteAccess $siteAccess = null): void { $this->siteAccess = $siteAccess; } diff --git a/src/bundle/Core/Imagine/Cache/ResolverFactory.php b/src/bundle/Core/Imagine/Cache/ResolverFactory.php index d6666ffa4e..dc7538908d 100644 --- a/src/bundle/Core/Imagine/Cache/ResolverFactory.php +++ b/src/bundle/Core/Imagine/Cache/ResolverFactory.php @@ -12,11 +12,9 @@ class ResolverFactory { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; - /** @var \Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface */ - private $resolver; + private ResolverInterface $resolver; /** @var string|null */ private $resolverDecoratorClass; diff --git a/src/bundle/Core/Imagine/Filter/AbstractFilter.php b/src/bundle/Core/Imagine/Filter/AbstractFilter.php index 2a0956a27f..55aa7c2dd8 100644 --- a/src/bundle/Core/Imagine/Filter/AbstractFilter.php +++ b/src/bundle/Core/Imagine/Filter/AbstractFilter.php @@ -12,15 +12,14 @@ */ abstract class AbstractFilter implements FilterInterface { - /** @var array */ - private $options; + private array $options; public function __construct(array $options = []) { $this->options = $options; } - public function setOption($optionName, $value) + public function setOption($optionName, $value): void { $this->options[$optionName] = $value; } @@ -35,7 +34,7 @@ public function hasOption($optionName) return isset($this->options[$optionName]); } - public function setOptions(array $options) + public function setOptions(array $options): void { $this->options = $options; } diff --git a/src/bundle/Core/Imagine/Filter/FilterConfiguration.php b/src/bundle/Core/Imagine/Filter/FilterConfiguration.php index 22ab6b5596..cc0048df87 100644 --- a/src/bundle/Core/Imagine/Filter/FilterConfiguration.php +++ b/src/bundle/Core/Imagine/Filter/FilterConfiguration.php @@ -12,13 +12,12 @@ class FilterConfiguration extends BaseFilterConfiguration { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ?ConfigResolverInterface $configResolver = null; /** * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver */ - public function setConfigResolver(ConfigResolverInterface $configResolver) + public function setConfigResolver(ConfigResolverInterface $configResolver): void { $this->configResolver = $configResolver; } @@ -57,7 +56,7 @@ public function all() * * @return array */ - private function getVariationFilters($variationName, array $configuredVariations) + private function getVariationFilters(string $variationName, array $configuredVariations) { if (!isset($configuredVariations[$variationName]['filters']) && !isset($this->filters[$variationName]['filters'])) { return []; @@ -85,7 +84,7 @@ private function getVariationFilters($variationName, array $configuredVariations * * @return array */ - private function getVariationPostProcessors($variationName, array $configuredVariations) + private function getVariationPostProcessors(string $variationName, array $configuredVariations) { if (isset($configuredVariations[$variationName]['post_processors'])) { return $configuredVariations[$variationName]['post_processors']; diff --git a/src/bundle/Core/Imagine/Filter/Loader/FilterLoaderWrapped.php b/src/bundle/Core/Imagine/Filter/Loader/FilterLoaderWrapped.php index 5aa4c68170..68f4f9bc68 100644 --- a/src/bundle/Core/Imagine/Filter/Loader/FilterLoaderWrapped.php +++ b/src/bundle/Core/Imagine/Filter/Loader/FilterLoaderWrapped.php @@ -17,7 +17,7 @@ abstract class FilterLoaderWrapped implements LoaderInterface /** * @param \Liip\ImagineBundle\Imagine\Filter\Loader\LoaderInterface $innerLoader */ - public function setInnerLoader(LoaderInterface $innerLoader) + public function setInnerLoader(LoaderInterface $innerLoader): void { $this->innerLoader = $innerLoader; } diff --git a/src/bundle/Core/Imagine/Filter/Loader/ReduceNoiseFilterLoader.php b/src/bundle/Core/Imagine/Filter/Loader/ReduceNoiseFilterLoader.php index 427fea0744..929de6ae26 100644 --- a/src/bundle/Core/Imagine/Filter/Loader/ReduceNoiseFilterLoader.php +++ b/src/bundle/Core/Imagine/Filter/Loader/ReduceNoiseFilterLoader.php @@ -22,8 +22,7 @@ class ReduceNoiseFilterLoader implements LoaderInterface { public const IDENTIFIER = 'filter/noise'; - /** @var \Ibexa\Bundle\Core\Imagine\Filter\FilterInterface */ - private $filter; + private FilterInterface $filter; public function __construct(FilterInterface $filter) { diff --git a/src/bundle/Core/Imagine/Filter/Loader/SwirlFilterLoader.php b/src/bundle/Core/Imagine/Filter/Loader/SwirlFilterLoader.php index 918bd250d3..72735c4467 100644 --- a/src/bundle/Core/Imagine/Filter/Loader/SwirlFilterLoader.php +++ b/src/bundle/Core/Imagine/Filter/Loader/SwirlFilterLoader.php @@ -15,8 +15,7 @@ class SwirlFilterLoader implements LoaderInterface { public const IDENTIFIER = 'filter/swirl'; - /** @var \Ibexa\Bundle\Core\Imagine\Filter\FilterInterface */ - private $filter; + private FilterInterface $filter; public function __construct(FilterInterface $filter) { diff --git a/src/bundle/Core/Imagine/IORepositoryResolver.php b/src/bundle/Core/Imagine/IORepositoryResolver.php index a4d2241ad3..216fcd07cf 100644 --- a/src/bundle/Core/Imagine/IORepositoryResolver.php +++ b/src/bundle/Core/Imagine/IORepositoryResolver.php @@ -26,14 +26,11 @@ class IORepositoryResolver extends PathResolver implements ResolverInterface { public const VARIATION_ORIGINAL = 'original'; - /** @var \Ibexa\Core\IO\IOServiceInterface */ - private $ioService; + private IOServiceInterface $ioService; - /** @var \Liip\ImagineBundle\Imagine\Filter\FilterConfiguration */ - private $filterConfiguration; + private FilterConfiguration $filterConfiguration; - /** @var \Ibexa\Contracts\Core\Variation\VariationPurger */ - private $variationPurger; + private VariationPurger $variationPurger; public function __construct( IOServiceInterface $ioService, @@ -88,7 +85,7 @@ public function resolve($path, $filter): string * * {@inheritdoc} */ - public function store(BinaryInterface $binary, $path, $filter) + public function store(BinaryInterface $binary, $path, $filter): void { $tmpFile = tmpfile(); fwrite($tmpFile, $binary->getContent()); @@ -105,7 +102,7 @@ public function store(BinaryInterface $binary, $path, $filter) * @param string[] $paths The paths where the original files are expected to be. * @param string[] $filters The imagine filters in effect. */ - public function remove(array $paths, array $filters) + public function remove(array $paths, array $filters): void { if (empty($filters)) { $filters = array_keys($this->filterConfiguration->all()); diff --git a/src/bundle/Core/Imagine/ImageAsset/AliasGenerator.php b/src/bundle/Core/Imagine/ImageAsset/AliasGenerator.php index 148d594baf..a300108ac3 100644 --- a/src/bundle/Core/Imagine/ImageAsset/AliasGenerator.php +++ b/src/bundle/Core/Imagine/ImageAsset/AliasGenerator.php @@ -22,14 +22,11 @@ */ class AliasGenerator implements VariationHandler { - /** @var \Ibexa\Contracts\Core\Variation\VariationHandler */ - private $innerAliasGenerator; + private VariationHandler $innerAliasGenerator; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\Core\FieldType\ImageAsset\AssetMapper */ - private $assetMapper; + private AssetMapper $assetMapper; /** * @param \Ibexa\Contracts\Core\Variation\VariationHandler $innerAliasGenerator diff --git a/src/bundle/Core/Imagine/PlaceholderAliasGenerator.php b/src/bundle/Core/Imagine/PlaceholderAliasGenerator.php index 4de8618e25..bcb2120293 100644 --- a/src/bundle/Core/Imagine/PlaceholderAliasGenerator.php +++ b/src/bundle/Core/Imagine/PlaceholderAliasGenerator.php @@ -21,23 +21,17 @@ class PlaceholderAliasGenerator implements VariationHandler { - /** @var \Ibexa\Contracts\Core\Variation\VariationHandler */ - private $aliasGenerator; + private VariationHandler $aliasGenerator; - /** @var \Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface */ - private $ioResolver; + private ResolverInterface $ioResolver; - /** @var \Ibexa\Core\IO\IOServiceInterface */ - private $ioService; + private IOServiceInterface $ioService; - /** @var \Ibexa\Bundle\Core\Imagine\PlaceholderProvider|null */ - private $placeholderProvider; + private ?PlaceholderProvider $placeholderProvider = null; - /** @var array */ - private $placeholderOptions = []; + private array $placeholderOptions = []; - /** @var bool */ - private $verifyBinaryDataAvailability = false; + private bool $verifyBinaryDataAvailability = false; public function __construct( VariationHandler $aliasGenerator, @@ -74,7 +68,7 @@ public function getVariation(Field $field, VersionInfo $versionInfo, $variationN return $this->aliasGenerator->getVariation($field, $versionInfo, $variationName, $parameters); } - public function setPlaceholderProvider(PlaceholderProvider $provider, array $options = []) + public function setPlaceholderProvider(PlaceholderProvider $provider, array $options = []): void { $this->placeholderProvider = $provider; $this->placeholderOptions = $options; diff --git a/src/bundle/Core/Imagine/PlaceholderAliasGeneratorConfigurator.php b/src/bundle/Core/Imagine/PlaceholderAliasGeneratorConfigurator.php index a8a3b6d894..938bedceb3 100644 --- a/src/bundle/Core/Imagine/PlaceholderAliasGeneratorConfigurator.php +++ b/src/bundle/Core/Imagine/PlaceholderAliasGeneratorConfigurator.php @@ -11,14 +11,11 @@ class PlaceholderAliasGeneratorConfigurator { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; - /** @var \Ibexa\Bundle\Core\Imagine\PlaceholderProviderRegistry */ - private $providerRegistry; + private PlaceholderProviderRegistry $providerRegistry; - /** @var array */ - private $providersConfig; + private array $providersConfig; public function __construct( ConfigResolverInterface $configResolver, @@ -30,7 +27,7 @@ public function __construct( $this->providersConfig = $providersConfig; } - public function configure(PlaceholderAliasGenerator $generator) + public function configure(PlaceholderAliasGenerator $generator): void { $binaryHandlerName = $this->configResolver->getParameter('io.binarydata_handler'); diff --git a/src/bundle/Core/Imagine/PlaceholderProvider/GenericProvider.php b/src/bundle/Core/Imagine/PlaceholderProvider/GenericProvider.php index ca397bcd99..9bc5d69b7c 100644 --- a/src/bundle/Core/Imagine/PlaceholderProvider/GenericProvider.php +++ b/src/bundle/Core/Imagine/PlaceholderProvider/GenericProvider.php @@ -15,8 +15,7 @@ class GenericProvider implements PlaceholderProvider { - /** @var \Imagine\Image\ImagineInterface */ - private $imagine; + private ImagineInterface $imagine; /** * GenericProvider constructor. diff --git a/src/bundle/Core/Imagine/PlaceholderProviderRegistry.php b/src/bundle/Core/Imagine/PlaceholderProviderRegistry.php index 3ef89d4ff8..b26297949e 100644 --- a/src/bundle/Core/Imagine/PlaceholderProviderRegistry.php +++ b/src/bundle/Core/Imagine/PlaceholderProviderRegistry.php @@ -12,7 +12,7 @@ class PlaceholderProviderRegistry { /** @var \Ibexa\Bundle\Core\Imagine\PlaceholderProvider */ - private $providers; + private array $providers; /** * PlaceholderProviderRegistry constructor. @@ -24,7 +24,7 @@ public function __construct(array $providers = []) $this->providers = $providers; } - public function addProvider(string $type, PlaceholderProvider $provider) + public function addProvider(string $type, PlaceholderProvider $provider): void { $this->providers[$type] = $provider; } diff --git a/src/bundle/Core/Imagine/Variation/ImagineAwareAliasGenerator.php b/src/bundle/Core/Imagine/Variation/ImagineAwareAliasGenerator.php index 7e9fd7a11a..65a493e1f7 100644 --- a/src/bundle/Core/Imagine/Variation/ImagineAwareAliasGenerator.php +++ b/src/bundle/Core/Imagine/Variation/ImagineAwareAliasGenerator.php @@ -22,20 +22,16 @@ */ class ImagineAwareAliasGenerator implements VariationHandler { - /** @var \Ibexa\Contracts\Core\Variation\VariationHandler */ - private $aliasGenerator; + private VariationHandler $aliasGenerator; - /** @var \Ibexa\Contracts\Core\Variation\VariationPathGenerator */ - private $variationPathGenerator; + private VariationPathGenerator $variationPathGenerator; - /** @var \Ibexa\Core\IO\IOServiceInterface */ - private $ioService; + private IOServiceInterface $ioService; /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ private $configResolver; - /** @var \Imagine\Image\ImagineInterface */ - private $imagine; + private ImagineInterface $imagine; public function __construct( VariationHandler $aliasGenerator, diff --git a/src/bundle/Core/Imagine/VariationPurger/IOVariationPurger.php b/src/bundle/Core/Imagine/VariationPurger/IOVariationPurger.php index f4d67a314e..61709b2d54 100644 --- a/src/bundle/Core/Imagine/VariationPurger/IOVariationPurger.php +++ b/src/bundle/Core/Imagine/VariationPurger/IOVariationPurger.php @@ -20,17 +20,13 @@ */ class IOVariationPurger implements VariationPurger { - /** @var \Ibexa\Core\IO\IOServiceInterface */ - private $io; + private IOServiceInterface $io; - /** @var \Symfony\Component\Cache\Adapter\TagAwareAdapterInterface */ - private $cache; + private TagAwareAdapterInterface $cache; - /** @var \Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierGeneratorInterface */ - private $cacheIdentifierGenerator; + private CacheIdentifierGeneratorInterface $cacheIdentifierGenerator; - /** @var \Ibexa\Bundle\Core\Imagine\Cache\AliasGeneratorDecorator */ - private $aliasGeneratorDecorator; + private AliasGeneratorDecorator $aliasGeneratorDecorator; /** @var \Psr\Log\LoggerInterface */ private $logger; @@ -50,12 +46,12 @@ public function __construct( /** * @param \Psr\Log\LoggerInterface $logger */ - public function setLogger($logger) + public function setLogger($logger): void { $this->logger = $logger; } - public function purge(array $aliasNames) + public function purge(array $aliasNames): void { $variationNameTag = $this->aliasGeneratorDecorator->getVariationNameTag(); diff --git a/src/bundle/Core/Imagine/VariationPurger/ImageFileVariationPurger.php b/src/bundle/Core/Imagine/VariationPurger/ImageFileVariationPurger.php index 0159672668..d8a10f9c53 100644 --- a/src/bundle/Core/Imagine/VariationPurger/ImageFileVariationPurger.php +++ b/src/bundle/Core/Imagine/VariationPurger/ImageFileVariationPurger.php @@ -21,13 +21,11 @@ class ImageFileVariationPurger implements VariationPurger { /** @var ImageFileList */ - private $imageFileList; + private Iterator $imageFileList; - /** @var \Ibexa\Core\IO\IOServiceInterface */ - private $ioService; + private IOServiceInterface $ioService; - /** @var \Ibexa\Contracts\Core\Variation\VariationPathGenerator */ - private $variationPathGenerator; + private VariationPathGenerator $variationPathGenerator; /** @var \Psr\Log\LoggerInterface */ private $logger; @@ -44,7 +42,7 @@ public function __construct(Iterator $imageFileList, IOServiceInterface $ioServi * * @param array $aliasNames */ - public function purge(array $aliasNames) + public function purge(array $aliasNames): void { foreach ($this->imageFileList as $originalImageId) { foreach ($aliasNames as $aliasName) { @@ -65,7 +63,7 @@ public function purge(array $aliasNames) /** * @param \Psr\Log\LoggerInterface $logger */ - public function setLogger($logger) + public function setLogger($logger): void { $this->logger = $logger; } diff --git a/src/bundle/Core/Imagine/VariationPurger/LegacyStorageImageFileList.php b/src/bundle/Core/Imagine/VariationPurger/LegacyStorageImageFileList.php index 6809724625..305ed41084 100644 --- a/src/bundle/Core/Imagine/VariationPurger/LegacyStorageImageFileList.php +++ b/src/bundle/Core/Imagine/VariationPurger/LegacyStorageImageFileList.php @@ -26,23 +26,17 @@ class LegacyStorageImageFileList implements ImageFileList /** * Iteration cursor on $statement. - * - * @var int */ - private $cursor; + private ?int $cursor = null; /** * Used to get ezimagefile rows. - * - * @var \Ibexa\Bundle\Core\Imagine\VariationPurger\ImageFileRowReader */ - private $rowReader; + private ImageFileRowReader $rowReader; - /** @var \Ibexa\Core\IO\IOConfigProvider */ - private $ioConfigResolver; + private IOConfigProvider $ioConfigResolver; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; public function __construct( ImageFileRowReader $rowReader, diff --git a/src/bundle/Core/Imagine/VariationPurger/LegacyStorageImageFileRowReader.php b/src/bundle/Core/Imagine/VariationPurger/LegacyStorageImageFileRowReader.php index c4a4810ef7..32ac88afa2 100644 --- a/src/bundle/Core/Imagine/VariationPurger/LegacyStorageImageFileRowReader.php +++ b/src/bundle/Core/Imagine/VariationPurger/LegacyStorageImageFileRowReader.php @@ -11,8 +11,7 @@ class LegacyStorageImageFileRowReader implements ImageFileRowReader { - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; /** @var \Doctrine\DBAL\Driver\Statement */ private $statement; @@ -22,7 +21,7 @@ public function __construct(Connection $connection) $this->connection = $connection; } - public function init() + public function init(): void { $selectQuery = $this->connection->createQueryBuilder(); $selectQuery->select('filepath')->from('ezimagefile'); diff --git a/src/bundle/Core/Matcher/ViewMatcherRegistry.php b/src/bundle/Core/Matcher/ViewMatcherRegistry.php index 7fbbae6a85..5a380767fd 100644 --- a/src/bundle/Core/Matcher/ViewMatcherRegistry.php +++ b/src/bundle/Core/Matcher/ViewMatcherRegistry.php @@ -18,7 +18,7 @@ final class ViewMatcherRegistry implements ViewMatcherRegistryInterface { /** @var \Ibexa\Core\MVC\Symfony\Matcher\ViewMatcherInterface[] */ - private $matchers; + private array $matchers; /** * @param iterable<\Ibexa\Core\MVC\Symfony\Matcher\ViewMatcherInterface> $matchers diff --git a/src/bundle/Core/SiteAccess/Config/ComplexConfigProcessor.php b/src/bundle/Core/SiteAccess/Config/ComplexConfigProcessor.php index 5329e4dffc..c3294a6c77 100644 --- a/src/bundle/Core/SiteAccess/Config/ComplexConfigProcessor.php +++ b/src/bundle/Core/SiteAccess/Config/ComplexConfigProcessor.php @@ -19,14 +19,11 @@ final class ComplexConfigProcessor implements ConfigProcessor { private const DEFAULT_NAMESPACE = 'ibexa.site_access.config'; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessService */ - private $siteAccessService; + private SiteAccessService $siteAccessService; - /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\ComplexSettings\ComplexSettingParserInterface */ - private $complexSettingParser; + private ComplexSettingParser $complexSettingParser; public function __construct( ConfigResolverInterface $configResolver, diff --git a/src/bundle/Core/SiteAccess/Config/IOConfigResolver.php b/src/bundle/Core/SiteAccess/Config/IOConfigResolver.php index 4ee9d9b377..ea1bf69828 100644 --- a/src/bundle/Core/SiteAccess/Config/IOConfigResolver.php +++ b/src/bundle/Core/SiteAccess/Config/IOConfigResolver.php @@ -15,8 +15,7 @@ */ final class IOConfigResolver implements IOConfigProvider { - /** @var \Ibexa\Bundle\Core\SiteAccess\Config\ComplexConfigProcessor */ - private $complexConfigProcessor; + private ComplexConfigProcessor $complexConfigProcessor; public function __construct( ComplexConfigProcessor $complexConfigProcessor diff --git a/src/bundle/Core/SiteAccess/LanguageResolver.php b/src/bundle/Core/SiteAccess/LanguageResolver.php index 374f6ea837..8004590bb6 100644 --- a/src/bundle/Core/SiteAccess/LanguageResolver.php +++ b/src/bundle/Core/SiteAccess/LanguageResolver.php @@ -15,8 +15,7 @@ */ final class LanguageResolver extends AbstractLanguageResolver { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; public function __construct( ConfigResolverInterface $configResolver, diff --git a/src/bundle/Core/SiteAccess/MatcherBuilder.php b/src/bundle/Core/SiteAccess/MatcherBuilder.php index db8e23ed23..98004a0ed4 100644 --- a/src/bundle/Core/SiteAccess/MatcherBuilder.php +++ b/src/bundle/Core/SiteAccess/MatcherBuilder.php @@ -15,8 +15,7 @@ */ final class MatcherBuilder extends BaseMatcherBuilder { - /** @var \Ibexa\Bundle\Core\SiteAccess\SiteAccessMatcherRegistryInterface */ - protected $siteAccessMatcherRegistry; + protected SiteAccessMatcherRegistryInterface $siteAccessMatcherRegistry; public function __construct(SiteAccessMatcherRegistryInterface $siteAccessMatcherRegistry) { diff --git a/src/bundle/Core/SiteAccess/SiteAccessMatcherRegistry.php b/src/bundle/Core/SiteAccess/SiteAccessMatcherRegistry.php index 6bcca7c216..791fb92db1 100644 --- a/src/bundle/Core/SiteAccess/SiteAccessMatcherRegistry.php +++ b/src/bundle/Core/SiteAccess/SiteAccessMatcherRegistry.php @@ -13,7 +13,7 @@ final class SiteAccessMatcherRegistry implements SiteAccessMatcherRegistryInterface { /** @var \Ibexa\Bundle\Core\SiteAccess\Matcher[] */ - private $matchers; + private array $matchers; /** * @param \Ibexa\Bundle\Core\SiteAccess\Matcher[] $matchers diff --git a/src/bundle/Core/Templating/Twig/ContextAwareTwigVariablesExtension.php b/src/bundle/Core/Templating/Twig/ContextAwareTwigVariablesExtension.php index d3442193b7..9124a3fd9e 100644 --- a/src/bundle/Core/Templating/Twig/ContextAwareTwigVariablesExtension.php +++ b/src/bundle/Core/Templating/Twig/ContextAwareTwigVariablesExtension.php @@ -14,8 +14,7 @@ final class ContextAwareTwigVariablesExtension extends AbstractExtension implements GlobalsInterface { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; public function __construct( ConfigResolverInterface $configResolver diff --git a/src/bundle/Core/Translation/GlobCollector.php b/src/bundle/Core/Translation/GlobCollector.php index 2e04d7e6bb..e399d49ab4 100644 --- a/src/bundle/Core/Translation/GlobCollector.php +++ b/src/bundle/Core/Translation/GlobCollector.php @@ -14,13 +14,12 @@ */ class GlobCollector implements Collector { - /** @var string */ - private $tranlationPattern; + private string $tranlationPattern; /** * @param string $kernelRootDir */ - public function __construct($kernelRootDir) + public function __construct(string $kernelRootDir) { $this->tranlationPattern = $kernelRootDir . sprintf('%1$svendor%1$sibexa%1$si18n%1$stranslations%1$s*%1$s*%1$s*.xlf', DIRECTORY_SEPARATOR); } @@ -28,7 +27,7 @@ public function __construct($kernelRootDir) /** * @return array */ - public function collect() + public function collect(): array { $meta = []; foreach (glob($this->tranlationPattern) as $file) { diff --git a/src/bundle/Core/URLChecker/Handler/AbstractConfigResolverBasedURLHandler.php b/src/bundle/Core/URLChecker/Handler/AbstractConfigResolverBasedURLHandler.php index 8ec374a82d..cf3d81814b 100644 --- a/src/bundle/Core/URLChecker/Handler/AbstractConfigResolverBasedURLHandler.php +++ b/src/bundle/Core/URLChecker/Handler/AbstractConfigResolverBasedURLHandler.php @@ -15,17 +15,13 @@ */ abstract class AbstractConfigResolverBasedURLHandler extends AbstractURLHandler { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - protected $configResolver; + protected ConfigResolverInterface $configResolver; - /** @var string */ - private $parameterName; + private string $parameterName; - /** @var string|null */ - private $namespace; + private ?string $namespace; - /** @var string|null */ - private $scope; + private ?string $scope; public function __construct( URLService $urlService, diff --git a/src/bundle/Core/URLChecker/Handler/AbstractURLHandler.php b/src/bundle/Core/URLChecker/Handler/AbstractURLHandler.php index a683598f56..434e95bc66 100644 --- a/src/bundle/Core/URLChecker/Handler/AbstractURLHandler.php +++ b/src/bundle/Core/URLChecker/Handler/AbstractURLHandler.php @@ -20,8 +20,7 @@ abstract class AbstractURLHandler implements URLHandlerInterface { use LoggerAwareTrait; - /** @var \Ibexa\Contracts\Core\Repository\URLService */ - protected $urlService; + protected URLService $urlService; public function __construct(URLService $urlService) { diff --git a/src/bundle/Core/URLChecker/Handler/HTTPHandler.php b/src/bundle/Core/URLChecker/Handler/HTTPHandler.php index a121c2c2af..7e261af48c 100644 --- a/src/bundle/Core/URLChecker/Handler/HTTPHandler.php +++ b/src/bundle/Core/URLChecker/Handler/HTTPHandler.php @@ -19,7 +19,7 @@ class HTTPHandler extends AbstractConfigResolverBasedURLHandler * * Based on https://www.onlineaspect.com/2009/01/26/how-to-use-curl_multi-without-blocking/ */ - public function validate(array $urls) + public function validate(array $urls): void { $options = $this->getOptions(); @@ -149,12 +149,12 @@ private function createCurlHandlerForUrl(URL $url, array &$handlers, int $connec * @param \Ibexa\Contracts\Core\Repository\Values\URL\URL $url * @param resource $handler CURL handler */ - private function doValidate(URL $url, $handler) + private function doValidate(URL $url, $handler): void { $this->setUrlStatus($url, $this->isSuccessful(curl_getinfo($handler, CURLINFO_HTTP_CODE))); } - private function isSuccessful($statusCode): bool + private function isSuccessful(int $statusCode): bool { return $statusCode >= 200 && $statusCode < 300; } diff --git a/src/bundle/Core/URLChecker/Handler/MailToHandler.php b/src/bundle/Core/URLChecker/Handler/MailToHandler.php index d8a44142b2..f549495589 100644 --- a/src/bundle/Core/URLChecker/Handler/MailToHandler.php +++ b/src/bundle/Core/URLChecker/Handler/MailToHandler.php @@ -25,7 +25,7 @@ public function __construct( /** * {@inheritdoc} */ - public function validate(array $urls) + public function validate(array $urls): void { $options = $this->getOptions(); diff --git a/src/bundle/Core/URLChecker/URLChecker.php b/src/bundle/Core/URLChecker/URLChecker.php index 852dbd58c0..be5d8de521 100644 --- a/src/bundle/Core/URLChecker/URLChecker.php +++ b/src/bundle/Core/URLChecker/URLChecker.php @@ -7,6 +7,7 @@ namespace Ibexa\Bundle\Core\URLChecker; +use Ibexa\Contracts\Core\Repository\URLService; use Ibexa\Contracts\Core\Repository\URLService as URLServiceInterface; use Ibexa\Contracts\Core\Repository\Values\URL\SearchResult; use Ibexa\Contracts\Core\Repository\Values\URL\URLQuery; @@ -17,11 +18,9 @@ class URLChecker implements URLCheckerInterface { use LoggerAwareTrait; - /** @var \Ibexa\Contracts\Core\Repository\URLService */ - protected $urlService; + protected URLService $urlService; - /** @var \Ibexa\Bundle\Core\URLChecker\URLHandlerRegistryInterface */ - protected $handlerRegistry; + protected URLHandlerRegistryInterface $handlerRegistry; /** * URLChecker constructor. @@ -41,7 +40,7 @@ public function __construct( /** * {@inheritdoc} */ - public function check(URLQuery $query) + public function check(URLQuery $query): void { $grouped = $this->fetchUrls($query); foreach ($grouped as $scheme => $urls) { @@ -76,7 +75,7 @@ protected function fetchUrls(URLQuery $query) * * @return array */ - private function groupByScheme(SearchResult $urls) + private function groupByScheme(SearchResult $urls): array { $grouped = []; diff --git a/src/bundle/Core/URLChecker/URLHandlerRegistry.php b/src/bundle/Core/URLChecker/URLHandlerRegistry.php index b34b6e98aa..f6d5414df7 100644 --- a/src/bundle/Core/URLChecker/URLHandlerRegistry.php +++ b/src/bundle/Core/URLChecker/URLHandlerRegistry.php @@ -12,7 +12,7 @@ class URLHandlerRegistry implements URLHandlerRegistryInterface { /** @var \Ibexa\Bundle\Core\URLChecker\URLHandlerInterface[] */ - private $handlers = []; + private array $handlers = []; /** * URLHandlerRegistry constructor. @@ -25,7 +25,7 @@ public function __construct() /** * {@inheritdoc} */ - public function addHandler($scheme, URLHandlerInterface $handler) + public function addHandler($scheme, URLHandlerInterface $handler): void { $this->handlers[$scheme] = $handler; } diff --git a/src/bundle/Core/View/Provider/Configured.php b/src/bundle/Core/View/Provider/Configured.php index 5f2293f110..b47c423d4f 100644 --- a/src/bundle/Core/View/Provider/Configured.php +++ b/src/bundle/Core/View/Provider/Configured.php @@ -18,7 +18,7 @@ class Configured extends BaseConfigured implements SiteAccessAware * * @param \Ibexa\Core\MVC\Symfony\SiteAccess $siteAccess */ - public function setSiteAccess(SiteAccess $siteAccess = null) + public function setSiteAccess(SiteAccess $siteAccess = null): void { if ($this->matcherFactory instanceof SiteAccessAware) { $this->matcherFactory->setSiteAccess($siteAccess); diff --git a/src/bundle/Debug/Collector/IbexaCoreCollector.php b/src/bundle/Debug/Collector/IbexaCoreCollector.php index 5500125642..f7062fd9cb 100644 --- a/src/bundle/Debug/Collector/IbexaCoreCollector.php +++ b/src/bundle/Debug/Collector/IbexaCoreCollector.php @@ -20,7 +20,7 @@ public function __construct() $this->reset(); } - public function collect(Request $request, Response $response, \Throwable $exception = null) + public function collect(Request $request, Response $response, \Throwable $exception = null): void { /** @var \Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface $innerCollector */ foreach ($this->data['collectors'] as $innerCollector) { @@ -36,7 +36,7 @@ public function getName(): string /** * @param \Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface $collector */ - public function addCollector(DataCollectorInterface $collector, $panelTemplate = null, $toolbarTemplate = null) + public function addCollector(DataCollectorInterface $collector, $panelTemplate = null, $toolbarTemplate = null): void { $name = $collector->getName(); $this->data['collectors'][$name] = $collector; @@ -103,7 +103,7 @@ public function getPanelTemplate($collectorName) /** * {@inheritdoc} */ - public function reset() + public function reset(): void { $this->data = [ 'collectors' => [], diff --git a/src/bundle/Debug/Collector/PersistenceCacheCollector.php b/src/bundle/Debug/Collector/PersistenceCacheCollector.php index 2231f202d1..159b222a0c 100644 --- a/src/bundle/Debug/Collector/PersistenceCacheCollector.php +++ b/src/bundle/Debug/Collector/PersistenceCacheCollector.php @@ -17,15 +17,14 @@ */ class PersistenceCacheCollector extends DataCollector { - /** @var \Ibexa\Core\Persistence\Cache\PersistenceLogger */ - private $logger; + private PersistenceLogger $logger; public function __construct(PersistenceLogger $logger) { $this->logger = $logger; } - public function collect(Request $request, Response $response, \Throwable $exception = null) + public function collect(Request $request, Response $response, \Throwable $exception = null): void { $this->data = [ 'stats' => $this->logger->getStats(), @@ -69,7 +68,7 @@ public function getCallsLoggingEnabled() * * @return array */ - public function getCalls() + public function getCalls(): array { if (empty($this->data['calls'])) { return []; @@ -110,7 +109,7 @@ public function getCalls() * * @return array */ - public function getHandlers() + public function getHandlers(): array { $handlers = []; foreach ($this->data['handlers'] as $handler => $count) { diff --git a/src/bundle/Debug/Collector/SiteAccessCollector.php b/src/bundle/Debug/Collector/SiteAccessCollector.php index 9f10a20dc3..0985107878 100644 --- a/src/bundle/Debug/Collector/SiteAccessCollector.php +++ b/src/bundle/Debug/Collector/SiteAccessCollector.php @@ -17,7 +17,7 @@ */ class SiteAccessCollector extends DataCollector { - public function collect(Request $request, Response $response, \Throwable $exception = null) + public function collect(Request $request, Response $response, \Throwable $exception = null): void { $this->data = [ 'siteAccess' => $request->attributes->get('siteaccess'), diff --git a/src/bundle/Debug/DependencyInjection/Compiler/DataCollectorPass.php b/src/bundle/Debug/DependencyInjection/Compiler/DataCollectorPass.php index beaeb405f5..b247e15ed0 100644 --- a/src/bundle/Debug/DependencyInjection/Compiler/DataCollectorPass.php +++ b/src/bundle/Debug/DependencyInjection/Compiler/DataCollectorPass.php @@ -14,7 +14,7 @@ class DataCollectorPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition(IbexaCoreCollector::class)) { return; diff --git a/src/bundle/IO/ApiLoader/HandlerRegistry.php b/src/bundle/IO/ApiLoader/HandlerRegistry.php index 76aa227d72..906ed3cb80 100644 --- a/src/bundle/IO/ApiLoader/HandlerRegistry.php +++ b/src/bundle/IO/ApiLoader/HandlerRegistry.php @@ -21,7 +21,7 @@ class HandlerRegistry */ private $handlersMap = []; - public function setHandlersMap($handlersMap) + public function setHandlersMap($handlersMap): void { $this->handlersMap = $handlersMap; } diff --git a/src/bundle/IO/Command/MigrateFilesCommand.php b/src/bundle/IO/Command/MigrateFilesCommand.php index df20bfdf49..39228b4a59 100644 --- a/src/bundle/IO/Command/MigrateFilesCommand.php +++ b/src/bundle/IO/Command/MigrateFilesCommand.php @@ -24,19 +24,17 @@ final class MigrateFilesCommand extends Command { /** @var mixed Configuration for metadata handlers */ - private $configuredMetadataHandlers; + private array $configuredMetadataHandlers; /** @var mixed Configuration for binary data handlers */ - private $configuredBinarydataHandlers; + private array $configuredBinarydataHandlers; - /** @var \Ibexa\Bundle\IO\Migration\FileListerRegistry */ - private $fileListerRegistry; + private FileListerRegistry $fileListerRegistry; /** @var \Ibexa\Bundle\IO\Migration\FileListerInterface[] */ - private $fileListers; + private ?array $fileListers = null; - /** @var \Ibexa\Bundle\IO\Migration\FileMigratorInterface */ - private $fileMigrator; + private FileMigratorInterface $fileMigrator; public function __construct( array $configuredMetadataHandlers, @@ -63,7 +61,7 @@ public function __construct( parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->addOption('from', null, InputOption::VALUE_REQUIRED, 'Migrate from ,') @@ -192,7 +190,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int * * @param \Symfony\Component\Console\Output\OutputInterface $output */ - protected function outputConfiguredHandlers(OutputInterface $output) + protected function outputConfiguredHandlers(OutputInterface $output): void { $output->writeln( 'Configured metadata handlers: ' . implode(', ', array_keys($this->configuredMetadataHandlers)) @@ -261,7 +259,7 @@ protected function migrateFiles( $bulkCount, $dryRun, OutputInterface $output - ) { + ): void { $progress = new ProgressBar($output, $totalFileCount); if ($totalFileCount) { $progress->setFormat("%message%\n %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%"); diff --git a/src/bundle/IO/DependencyInjection/Compiler/IOConfigurationPass.php b/src/bundle/IO/DependencyInjection/Compiler/IOConfigurationPass.php index db23094834..6f722dced6 100644 --- a/src/bundle/IO/DependencyInjection/Compiler/IOConfigurationPass.php +++ b/src/bundle/IO/DependencyInjection/Compiler/IOConfigurationPass.php @@ -24,10 +24,10 @@ class IOConfigurationPass implements CompilerPassInterface { /** @var \Ibexa\Bundle\IO\DependencyInjection\ConfigurationFactory[]|\ArrayObject */ - private $metadataHandlerFactories; + private ?ArrayObject $metadataHandlerFactories; /** @var \Ibexa\Bundle\IO\DependencyInjection\ConfigurationFactory[]|\ArrayObject */ - private $binarydataHandlerFactories; + private ?ArrayObject $binarydataHandlerFactories; public function __construct( ArrayObject $metadataHandlerFactories = null, @@ -42,7 +42,7 @@ public function __construct( * * @throws \LogicException */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $ioMetadataHandlers = $container->hasParameter('ibexa.io.metadata_handlers') ? $container->getParameter('ibexa.io.metadata_handlers') : diff --git a/src/bundle/IO/DependencyInjection/Compiler/MigrationFileListerPass.php b/src/bundle/IO/DependencyInjection/Compiler/MigrationFileListerPass.php index 3bf3bf324f..1e208b6499 100644 --- a/src/bundle/IO/DependencyInjection/Compiler/MigrationFileListerPass.php +++ b/src/bundle/IO/DependencyInjection/Compiler/MigrationFileListerPass.php @@ -19,7 +19,7 @@ final class MigrationFileListerPass implements CompilerPassInterface * * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->has(ConfigurableRegistry::class)) { return; diff --git a/src/bundle/IO/DependencyInjection/Configuration.php b/src/bundle/IO/DependencyInjection/Configuration.php index d3f4e09a85..f628b1bdb2 100644 --- a/src/bundle/IO/DependencyInjection/Configuration.php +++ b/src/bundle/IO/DependencyInjection/Configuration.php @@ -20,12 +20,12 @@ class Configuration implements ConfigurationInterface /** @var ConfigurationFactory[]|\ArrayObject */ private $binarydataHandlerFactories = []; - public function setMetadataHandlerFactories(ArrayObject $factories) + public function setMetadataHandlerFactories(ArrayObject $factories): void { $this->metadataHandlerFactories = $factories; } - public function setBinarydataHandlerFactories(ArrayObject $factories) + public function setBinarydataHandlerFactories(ArrayObject $factories): void { $this->binarydataHandlerFactories = $factories; } @@ -60,7 +60,7 @@ public function getConfigTreeBuilder(): TreeBuilder * @param string $info block info line * @param ConfigurationFactory[]|\ArrayObject $factories */ - private function addHandlersSection(NodeDefinition $node, $name, $info, ArrayObject $factories) + private function addHandlersSection(NodeDefinition $node, string $name, string $info, ArrayObject $factories): void { $handlersNodeBuilder = $node ->children() diff --git a/src/bundle/IO/DependencyInjection/ConfigurationFactory/Flysystem.php b/src/bundle/IO/DependencyInjection/ConfigurationFactory/Flysystem.php index a44a8f4243..175bb4f60e 100644 --- a/src/bundle/IO/DependencyInjection/ConfigurationFactory/Flysystem.php +++ b/src/bundle/IO/DependencyInjection/ConfigurationFactory/Flysystem.php @@ -26,7 +26,7 @@ abstract class Flysystem implements ConfigurationFactory, ContainerAwareInterfac { use ContainerAwareTrait; - public function addConfiguration(ArrayNodeDefinition $node) + public function addConfiguration(ArrayNodeDefinition $node): void { $node ->info( @@ -45,7 +45,7 @@ public function addConfiguration(ArrayNodeDefinition $node) ->end(); } - public function configureHandler(ServiceDefinition $definition, array $config) + public function configureHandler(ServiceDefinition $definition, array $config): void { $filesystemId = $this->createFilesystem($this->container, $config['name'], $config['adapter']); $definition->replaceArgument(0, new Reference($filesystemId)); diff --git a/src/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSCluster.php b/src/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSCluster.php index 5d37b68e20..5aafa7ee74 100644 --- a/src/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSCluster.php +++ b/src/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSCluster.php @@ -19,12 +19,12 @@ public function getParentServiceId(): string return \Ibexa\Core\IO\IOMetadataHandler\LegacyDFSCluster::class; } - public function configureHandler(ServiceDefinition $definition, array $config) + public function configureHandler(ServiceDefinition $definition, array $config): void { $definition->replaceArgument(0, new Reference($config['connection'])); } - public function addConfiguration(ArrayNodeDefinition $node) + public function addConfiguration(ArrayNodeDefinition $node): void { $node ->info( diff --git a/src/bundle/IO/EventListener/StreamFileListener.php b/src/bundle/IO/EventListener/StreamFileListener.php index 0a8a740c86..7388133bfe 100644 --- a/src/bundle/IO/EventListener/StreamFileListener.php +++ b/src/bundle/IO/EventListener/StreamFileListener.php @@ -22,11 +22,9 @@ */ class StreamFileListener implements EventSubscriberInterface { - /** @var \Ibexa\Core\IO\IOServiceInterface */ - private $ioService; + private IOServiceInterface $ioService; - /** @var \Ibexa\Core\IO\IOConfigProvider */ - private $ioConfigResolver; + private IOConfigProvider $ioConfigResolver; public function __construct(IOServiceInterface $ioService, IOConfigProvider $ioConfigResolver) { @@ -41,7 +39,7 @@ public static function getSubscribedEvents(): array ]; } - public function onKernelRequest(RequestEvent $event) + public function onKernelRequest(RequestEvent $event): void { if ($event->getRequestType() !== HttpKernelInterface::MAIN_REQUEST) { return; @@ -82,7 +80,7 @@ public function onKernelRequest(RequestEvent $event) * * @return bool */ - private function isIoUri($uri, $urlPrefix): bool + private function isIoUri(string $uri, $urlPrefix): bool { return strpos(ltrim($uri, '/'), $urlPrefix) === 0; } diff --git a/src/bundle/IO/Migration/FileLister/BinaryFileLister.php b/src/bundle/IO/Migration/FileLister/BinaryFileLister.php index c040beef7d..16871dbaad 100644 --- a/src/bundle/IO/Migration/FileLister/BinaryFileLister.php +++ b/src/bundle/IO/Migration/FileLister/BinaryFileLister.php @@ -18,7 +18,7 @@ class BinaryFileLister extends MigrationHandler implements FileListerInterface { /** @var \Ibexa\Bundle\IO\Migration\FileLister\FileIteratorInterface */ - private $fileList; + private Iterator $fileList; /** @var string Directory where files are stored, within the storage dir. Example: 'original' */ private $filesDir; @@ -50,7 +50,10 @@ public function countFiles(): int return count($this->fileList); } - public function loadMetadataList($limit = null, $offset = null) + /** + * @return mixed[] + */ + public function loadMetadataList($limit = null, $offset = null): array { $metadataList = []; $fileLimitList = new LimitIterator($this->fileList, $offset, $limit); diff --git a/src/bundle/IO/Migration/FileLister/FileIterator/LegacyStorageFileIterator.php b/src/bundle/IO/Migration/FileLister/FileIterator/LegacyStorageFileIterator.php index d50e0cf5b5..daf7e7f555 100644 --- a/src/bundle/IO/Migration/FileLister/FileIterator/LegacyStorageFileIterator.php +++ b/src/bundle/IO/Migration/FileLister/FileIterator/LegacyStorageFileIterator.php @@ -21,10 +21,10 @@ final class LegacyStorageFileIterator implements FileIteratorInterface private $item; /** @var int Iteration cursor on statement. */ - private $cursor; + private ?int $cursor = null; /** @var \Ibexa\Bundle\IO\Migration\FileLister\FileRowReaderInterface Used to get file rows. */ - private $rowReader; + private FileRowReaderInterface $rowReader; /** * @param \Ibexa\Bundle\IO\Migration\FileLister\FileRowReaderInterface $rowReader @@ -71,7 +71,7 @@ public function count(): int /** * Fetches the next item from the resultset and moves the cursor forward. */ - private function fetchRow() + private function fetchRow(): void { ++$this->cursor; $fileId = $this->rowReader->getRow(); diff --git a/src/bundle/IO/Migration/FileLister/FileRowReader/LegacyStorageFileRowReader.php b/src/bundle/IO/Migration/FileLister/FileRowReader/LegacyStorageFileRowReader.php index c68d4bf697..b99ee1051b 100644 --- a/src/bundle/IO/Migration/FileLister/FileRowReader/LegacyStorageFileRowReader.php +++ b/src/bundle/IO/Migration/FileLister/FileRowReader/LegacyStorageFileRowReader.php @@ -12,8 +12,7 @@ abstract class LegacyStorageFileRowReader implements FileRowReaderInterface { - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; /** @var \Doctrine\DBAL\Driver\Statement */ private $statement; @@ -23,7 +22,7 @@ public function __construct(Connection $connection) $this->connection = $connection; } - final public function init() + final public function init(): void { $selectQuery = $this->connection->createQueryBuilder(); $selectQuery @@ -59,7 +58,7 @@ final public function getCount() * * @return string */ - private function prependMimeToPath($path, $mimeType): string + private function prependMimeToPath(string $path, $mimeType): string { return substr($mimeType, 0, strpos($mimeType, '/')) . '/' . $path; } diff --git a/src/bundle/IO/Migration/FileLister/ImageFileLister.php b/src/bundle/IO/Migration/FileLister/ImageFileLister.php index da3e9c02e8..36e6a4a726 100644 --- a/src/bundle/IO/Migration/FileLister/ImageFileLister.php +++ b/src/bundle/IO/Migration/FileLister/ImageFileLister.php @@ -20,13 +20,11 @@ class ImageFileLister extends MigrationHandler implements FileListerInterface { /** @var \Ibexa\Bundle\Core\Imagine\VariationPurger\ImageFileList */ - private $imageFileList; + private Iterator $imageFileList; - /** @var \Ibexa\Contracts\Core\Variation\VariationPathGenerator */ - private $variationPathGenerator; + private VariationPathGenerator $variationPathGenerator; - /** @var \Liip\ImagineBundle\Imagine\Filter\FilterConfiguration */ - private $filterConfiguration; + private FilterConfiguration $filterConfiguration; /** @var string Directory where images are stored, within the storage dir. Example: 'images' */ private $imagesDir; @@ -64,7 +62,10 @@ public function countFiles(): int return count($this->imageFileList); } - public function loadMetadataList($limit = null, $offset = null) + /** + * @return mixed[] + */ + public function loadMetadataList($limit = null, $offset = null): array { $metadataList = []; $imageLimitList = new LimitIterator($this->imageFileList, $offset, $limit); diff --git a/src/bundle/IO/Migration/FileListerRegistry/ConfigurableRegistry.php b/src/bundle/IO/Migration/FileListerRegistry/ConfigurableRegistry.php index f1518b998a..b218f183e6 100644 --- a/src/bundle/IO/Migration/FileListerRegistry/ConfigurableRegistry.php +++ b/src/bundle/IO/Migration/FileListerRegistry/ConfigurableRegistry.php @@ -16,7 +16,7 @@ final class ConfigurableRegistry implements FileListerRegistry { /** @var \Ibexa\Bundle\IO\Migration\FileListerInterface[] */ - private $registry = []; + private array $registry; /** * @param \Ibexa\Bundle\IO\Migration\FileListerInterface[] $items Hash of FileListerInterfaces, with identifier string as key. diff --git a/src/bundle/IO/Migration/MigrationHandler.php b/src/bundle/IO/Migration/MigrationHandler.php index 2a6a0cabd3..9c174b1c67 100644 --- a/src/bundle/IO/Migration/MigrationHandler.php +++ b/src/bundle/IO/Migration/MigrationHandler.php @@ -15,14 +15,11 @@ */ abstract class MigrationHandler implements MigrationHandlerInterface { - /** @var \Ibexa\Bundle\IO\ApiLoader\HandlerRegistry */ - private $metadataHandlerRegistry; + private HandlerRegistry $metadataHandlerRegistry; - /** @var \Ibexa\Bundle\IO\ApiLoader\HandlerRegistry */ - private $binarydataHandlerRegistry; + private HandlerRegistry $binarydataHandlerRegistry; - /** @var \Psr\Log\LoggerInterface */ - private $logger; + private ?LoggerInterface $logger; /** @var \Ibexa\Core\IO\IOMetadataHandler */ protected $fromMetadataHandler; @@ -60,14 +57,14 @@ public function setIODataHandlersByIdentifiers( return $this; } - final protected function logError($message) + final protected function logError(string|\Stringable $message) { if (isset($this->logger)) { $this->logger->error($message); } } - final protected function logInfo($message) + final protected function logInfo(string|\Stringable $message) { if (isset($this->logger)) { $this->logger->info($message); diff --git a/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php b/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php index 240b971bc1..8e2ac9ebb4 100644 --- a/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php +++ b/src/bundle/RepositoryInstaller/Command/InstallPlatformCommand.php @@ -29,20 +29,16 @@ final class InstallPlatformCommand extends Command public const int EXIT_UNKNOWN_INSTALL_TYPE = 6; public const int EXIT_MISSING_PERMISSIONS = 7; - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; - /** @var \Symfony\Component\Console\Output\OutputInterface */ - private $output; + private ?OutputInterface $output = null; - /** @var \Psr\Cache\CacheItemPoolInterface */ - private $cachePool; + private CacheItemPoolInterface $cachePool; - /** @var string */ - private $environment; + private string $environment; /** @var \Ibexa\Bundle\RepositoryInstaller\Installer\Installer[] */ - private $installers = []; + private array $installers; private RepositoryConfigurationProviderInterface $repositoryConfigurationProvider; @@ -61,7 +57,7 @@ public function __construct( parent::__construct(); } - protected function configure() + protected function configure(): void { $this->addArgument( 'type', @@ -117,7 +113,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return self::SUCCESS; } - private function checkPermissions() + private function checkPermissions(): void { // @todo should take var-dir etc. from composer config or fallback to flex directory scheme if (!is_writable('public') && !is_writable('public/var')) { @@ -126,7 +122,7 @@ private function checkPermissions() } } - private function checkParameters() + private function checkParameters(): void { // @todo doesn't make sense to check for parameters.yml in sf4 and flex return; @@ -137,7 +133,7 @@ private function checkParameters() } } - private function checkCreateDatabase(OutputInterface $output) + private function checkCreateDatabase(OutputInterface $output): void { $output->writeln( sprintf( @@ -169,7 +165,7 @@ private function checkCreateDatabase(OutputInterface $output) * * @param \Symfony\Component\Console\Output\OutputInterface $output */ - private function cacheClear(OutputInterface $output) + private function cacheClear(OutputInterface $output): void { $this->cachePool->clear(); } @@ -186,7 +182,7 @@ private function cacheClear(OutputInterface $output) * @param \Symfony\Component\Console\Output\OutputInterface $output * @param string|null $siteaccess */ - private function indexData(OutputInterface $output, $siteaccess = null) + private function indexData(OutputInterface $output, $siteaccess = null): void { $output->writeln( sprintf('Search engine re-indexing, executing command ibexa:reindex') @@ -226,7 +222,7 @@ private function getInstaller($type) * Escape any user provided arguments, like: 'assets:install '.escapeshellarg($webDir) * @param int $timeout */ - private function executeCommand(OutputInterface $output, $cmd, $timeout = 300) + private function executeCommand(OutputInterface $output, string $cmd, $timeout = 300): void { $phpFinder = new PhpExecutableFinder(); if (!$phpPath = $phpFinder->find(false)) { @@ -267,7 +263,7 @@ private function executeCommand(OutputInterface $output, $cmd, $timeout = 300) $timeout ); - $process->run(static function ($type, $buffer) use ($output) { $output->write($buffer, false); }); + $process->run(static function ($type, $buffer) use ($output): void { $output->write($buffer, false); }); if (!$process->getExitCode() === 1) { throw new \RuntimeException(sprintf('An error occurred when executing the "%s" command.', escapeshellarg($cmd))); } diff --git a/src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php b/src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php index cc8eadff76..24762fdb38 100644 --- a/src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php +++ b/src/bundle/RepositoryInstaller/Command/ValidatePasswordHashesCommand.php @@ -17,11 +17,9 @@ #[AsCommand(name: 'ibexa:user:validate-password-hashes')] final class ValidatePasswordHashesCommand extends Command { - /** @var \Ibexa\Core\FieldType\User\UserStorage */ - private $userStorage; + private UserStorage $userStorage; - /** @var \Ibexa\Contracts\Core\Repository\PasswordHashService */ - private $passwordHashService; + private PasswordHashService $passwordHashService; public function __construct( UserStorage $userStorage, diff --git a/src/bundle/RepositoryInstaller/DependencyInjection/Compiler/InstallerTagPass.php b/src/bundle/RepositoryInstaller/DependencyInjection/Compiler/InstallerTagPass.php index b3d46c96cb..673c033dfb 100644 --- a/src/bundle/RepositoryInstaller/DependencyInjection/Compiler/InstallerTagPass.php +++ b/src/bundle/RepositoryInstaller/DependencyInjection/Compiler/InstallerTagPass.php @@ -21,7 +21,7 @@ class InstallerTagPass implements CompilerPassInterface { public const INSTALLER_TAG = 'ibexa.installer'; - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition(InstallPlatformCommand::class)) { return; diff --git a/src/bundle/RepositoryInstaller/Event/Subscriber/BuildSchemaSubscriber.php b/src/bundle/RepositoryInstaller/Event/Subscriber/BuildSchemaSubscriber.php index 46ee5f4437..be63f90716 100644 --- a/src/bundle/RepositoryInstaller/Event/Subscriber/BuildSchemaSubscriber.php +++ b/src/bundle/RepositoryInstaller/Event/Subscriber/BuildSchemaSubscriber.php @@ -14,8 +14,7 @@ class BuildSchemaSubscriber implements EventSubscriberInterface { - /** @var string */ - private $schemaFilePath; + private string $schemaFilePath; /** * @param string $schemaFilePath Path to Yaml schema definition supported by SchemaBuilder diff --git a/src/bundle/RepositoryInstaller/Installer/CoreInstaller.php b/src/bundle/RepositoryInstaller/Installer/CoreInstaller.php index 6351c6cc62..269c1e575a 100644 --- a/src/bundle/RepositoryInstaller/Installer/CoreInstaller.php +++ b/src/bundle/RepositoryInstaller/Installer/CoreInstaller.php @@ -19,8 +19,7 @@ */ class CoreInstaller extends DbBasedInstaller implements Installer { - /** @var \Ibexa\Contracts\DoctrineSchema\Builder\SchemaBuilderInterface */ - protected $schemaBuilder; + protected SchemaBuilderInterface $schemaBuilder; /** * @param \Doctrine\DBAL\Connection $db @@ -43,7 +42,7 @@ public function __construct(Connection $db, SchemaBuilderInterface $schemaBuilde * * @throws \Doctrine\DBAL\DBALException */ - public function importSchema() + public function importSchema(): void { // note: schema is built using Schema Builder event-driven API $schema = $this->schemaBuilder->buildSchema(); @@ -82,7 +81,7 @@ public function importSchema() * @throws \Doctrine\DBAL\DBALException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ - public function importData() + public function importData(): void { $this->runQueriesFromFile($this->getKernelSQLFileForDBMS('cleandata.sql')); } diff --git a/src/bundle/RepositoryInstaller/Installer/DbBasedInstaller.php b/src/bundle/RepositoryInstaller/Installer/DbBasedInstaller.php index 9188a527f0..ebbae03ca7 100644 --- a/src/bundle/RepositoryInstaller/Installer/DbBasedInstaller.php +++ b/src/bundle/RepositoryInstaller/Installer/DbBasedInstaller.php @@ -13,14 +13,12 @@ class DbBasedInstaller { - /** @var \Doctrine\DBAL\Connection */ - protected $db; + protected Connection $db; /** @var \Symfony\Component\Console\Output\OutputInterface */ protected $output; - /** @var string */ - protected $baseDataDir; + protected string $baseDataDir; public function __construct(Connection $db) { @@ -32,7 +30,7 @@ public function __construct(Connection $db) /** * @param \Symfony\Component\Console\Output\OutputInterface $output */ - public function setOutput($output) + public function setOutput($output): void { $this->output = $output; } @@ -43,7 +41,7 @@ public function setOutput($output) * @param string $source * @param string $target */ - protected function copyConfigurationFile($source, $target) + protected function copyConfigurationFile(string $source, string $target) { $fs = new Filesystem(); $fs->copy($source, $target, true); diff --git a/src/contracts/Event/View/PostBuildViewEvent.php b/src/contracts/Event/View/PostBuildViewEvent.php index a4636f570d..9cbb7006a1 100644 --- a/src/contracts/Event/View/PostBuildViewEvent.php +++ b/src/contracts/Event/View/PostBuildViewEvent.php @@ -13,8 +13,7 @@ final class PostBuildViewEvent extends Event { - /** @var \Ibexa\Core\MVC\Symfony\View\View */ - private $view; + private View $view; public function __construct(View $view) { diff --git a/src/contracts/FieldType/GatewayBasedStorage.php b/src/contracts/FieldType/GatewayBasedStorage.php index d0e55dab37..9487c420a4 100644 --- a/src/contracts/FieldType/GatewayBasedStorage.php +++ b/src/contracts/FieldType/GatewayBasedStorage.php @@ -20,11 +20,10 @@ abstract class GatewayBasedStorage implements FieldStorage /** * Field Type External Storage Gateway. * - * @var \Ibexa\Contracts\Core\FieldType\StorageGatewayInterface * * @phpstan-var T */ - protected $gateway; + protected StorageGatewayInterface $gateway; /** * @param \Ibexa\Contracts\Core\FieldType\StorageGatewayInterface $gateway diff --git a/src/contracts/FieldType/Generic/Type.php b/src/contracts/FieldType/Generic/Type.php index 0af7c518e5..6a276133fe 100644 --- a/src/contracts/FieldType/Generic/Type.php +++ b/src/contracts/FieldType/Generic/Type.php @@ -23,11 +23,9 @@ abstract class Type extends FieldType { - /** @var \Ibexa\Contracts\Core\FieldType\ValueSerializerInterface */ - protected $serializer; + protected ValueSerializerInterface $serializer; - /** @var \Symfony\Component\Validator\Validator\ValidatorInterface */ - protected $validator; + protected ValidatorInterface $validator; public function __construct(ValueSerializerInterface $serializer, ValidatorInterface $validator) { diff --git a/src/contracts/FieldType/Generic/ValidationError/ConstraintViolationAdapter.php b/src/contracts/FieldType/Generic/ValidationError/ConstraintViolationAdapter.php index 54a73434ca..c9c2430cae 100644 --- a/src/contracts/FieldType/Generic/ValidationError/ConstraintViolationAdapter.php +++ b/src/contracts/FieldType/Generic/ValidationError/ConstraintViolationAdapter.php @@ -21,18 +21,15 @@ */ final class ConstraintViolationAdapter implements ValidationErrorInterface { - /** @var \Symfony\Component\Validator\ConstraintViolationInterface */ - private $violation; + private ConstraintViolationInterface $violation; /** * Element on which the error occurred * e.g. property name or property path compatible with Symfony PropertyAccess component. * * Example: StringLengthValidator[minStringLength] - * - * @var string */ - private $target; + private string $target; public function __construct(ConstraintViolationInterface $violation) { diff --git a/src/contracts/FieldType/ValidationError/AbstractValidationError.php b/src/contracts/FieldType/ValidationError/AbstractValidationError.php index ba7bf17c7b..b2aff3c027 100644 --- a/src/contracts/FieldType/ValidationError/AbstractValidationError.php +++ b/src/contracts/FieldType/ValidationError/AbstractValidationError.php @@ -17,21 +17,17 @@ */ abstract class AbstractValidationError implements ValidationError { - /** @var string */ - protected $message; + protected string $message; - /** @var array */ - protected $parameters; + protected array $parameters; /** * Element on which the error occurred * e.g. property name or property path compatible with Symfony PropertyAccess component. * * Example: StringLengthValidator[minStringLength] - * - * @var string */ - protected $target; + protected string $target; public function __construct(string $message, array $parameters, string $target) { diff --git a/src/contracts/IO/BinaryFileCreateStruct.php b/src/contracts/IO/BinaryFileCreateStruct.php index 01621157a1..d4799f6da5 100644 --- a/src/contracts/IO/BinaryFileCreateStruct.php +++ b/src/contracts/IO/BinaryFileCreateStruct.php @@ -62,7 +62,7 @@ public function getInputStream() * * @param resource $inputStream */ - public function setInputStream($inputStream) + public function setInputStream($inputStream): void { $this->inputStream = $inputStream; } diff --git a/src/contracts/Limitation/Target/Builder/VersionBuilder.php b/src/contracts/Limitation/Target/Builder/VersionBuilder.php index 5b870b5fed..240493218d 100644 --- a/src/contracts/Limitation/Target/Builder/VersionBuilder.php +++ b/src/contracts/Limitation/Target/Builder/VersionBuilder.php @@ -20,8 +20,7 @@ */ final class VersionBuilder { - /** @var array */ - private $targetVersionProperties = []; + private array $targetVersionProperties = []; public function build(): Target\Version { diff --git a/src/contracts/Limitation/Target/DestinationLocation.php b/src/contracts/Limitation/Target/DestinationLocation.php index 31bd9269b6..7f183d63c0 100644 --- a/src/contracts/Limitation/Target/DestinationLocation.php +++ b/src/contracts/Limitation/Target/DestinationLocation.php @@ -17,11 +17,9 @@ */ final class DestinationLocation extends ValueObject implements Target { - /** @var int */ - private $locationId; + private int $locationId; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $targetContentInfo; + private ContentInfo $targetContentInfo; public function __construct(int $locationId, ContentInfo $targetContentInfo, array $properties = []) { diff --git a/src/contracts/Limitation/Target/Version.php b/src/contracts/Limitation/Target/Version.php index 388a368342..5cef02732e 100644 --- a/src/contracts/Limitation/Target/Version.php +++ b/src/contracts/Limitation/Target/Version.php @@ -78,7 +78,7 @@ final class Version extends ValueObject implements Target * * @var string[] */ - private $translationsToDelete = []; + private array $translationsToDelete = []; /** * @param string[] $translationsToDelete List of language codes of translations to delete diff --git a/src/contracts/MVC/Templating/BaseRenderStrategy.php b/src/contracts/MVC/Templating/BaseRenderStrategy.php index a317356242..f19ba3bc8d 100644 --- a/src/contracts/MVC/Templating/BaseRenderStrategy.php +++ b/src/contracts/MVC/Templating/BaseRenderStrategy.php @@ -18,14 +18,11 @@ abstract class BaseRenderStrategy implements RenderStrategy /** @var \Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface[] */ protected $fragmentRenderers; - /** @var string */ - protected $defaultRenderer; + protected string $defaultRenderer; - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ - protected $siteAccess; + protected SiteAccess $siteAccess; - /** @var \Symfony\Component\HttpFoundation\RequestStack */ - protected $requestStack; + protected RequestStack $requestStack; public function __construct( iterable $fragmentRenderers, diff --git a/src/contracts/Persistence/Content/ContentItem.php b/src/contracts/Persistence/Content/ContentItem.php index 2870797717..ba8c0dba57 100644 --- a/src/contracts/Persistence/Content/ContentItem.php +++ b/src/contracts/Persistence/Content/ContentItem.php @@ -20,14 +20,11 @@ */ final class ContentItem extends ValueObject { - /** @var \Ibexa\Contracts\Core\Persistence\Content */ - protected $content; + protected Content $content; - /** @var \Ibexa\Contracts\Core\Persistence\Content\ContentInfo */ - protected $contentInfo; + protected ContentInfo $contentInfo; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Type */ - protected $type; + protected Type $type; /** * @internal for internal use by Repository Storage abstraction diff --git a/src/contracts/Persistence/Content/LocationWithContentInfo.php b/src/contracts/Persistence/Content/LocationWithContentInfo.php index d792da8928..5fcfa21900 100644 --- a/src/contracts/Persistence/Content/LocationWithContentInfo.php +++ b/src/contracts/Persistence/Content/LocationWithContentInfo.php @@ -19,11 +19,9 @@ */ class LocationWithContentInfo extends ValueObject { - /** @var \Ibexa\Contracts\Core\Persistence\Content\Location */ - protected $location; + protected Location $location; - /** @var \Ibexa\Contracts\Core\Persistence\Content\ContentInfo */ - protected $contentInfo; + protected ContentInfo $contentInfo; /** * @internal for internal use by Repository Storage abstraction diff --git a/src/contracts/Persistence/Filter/LazyListIterator.php b/src/contracts/Persistence/Filter/LazyListIterator.php index 8f341d2fcf..de74d1c459 100644 --- a/src/contracts/Persistence/Filter/LazyListIterator.php +++ b/src/contracts/Persistence/Filter/LazyListIterator.php @@ -19,11 +19,9 @@ */ abstract class LazyListIterator implements IteratorAggregate { - /** @var int */ - private $totalCount; + private int $totalCount; - /** @var iterable|null */ - private $iterator; + private ?iterable $iterator; /** @var callable|null */ private $iterationCallback; diff --git a/src/contracts/Repository/Decorator/BookmarkServiceDecorator.php b/src/contracts/Repository/Decorator/BookmarkServiceDecorator.php index c8b0574f18..628f879c7f 100644 --- a/src/contracts/Repository/Decorator/BookmarkServiceDecorator.php +++ b/src/contracts/Repository/Decorator/BookmarkServiceDecorator.php @@ -14,8 +14,7 @@ abstract class BookmarkServiceDecorator implements BookmarkService { - /** @var \Ibexa\Contracts\Core\Repository\BookmarkService */ - protected $innerService; + protected BookmarkService $innerService; public function __construct(BookmarkService $innerService) { diff --git a/src/contracts/Repository/Decorator/ContentServiceDecorator.php b/src/contracts/Repository/Decorator/ContentServiceDecorator.php index fdf280423d..5a87d05ed7 100644 --- a/src/contracts/Repository/Decorator/ContentServiceDecorator.php +++ b/src/contracts/Repository/Decorator/ContentServiceDecorator.php @@ -29,8 +29,7 @@ abstract class ContentServiceDecorator implements ContentService { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - protected $innerService; + protected ContentService $innerService; public function __construct(ContentService $innerService) { diff --git a/src/contracts/Repository/Decorator/ContentTypeServiceDecorator.php b/src/contracts/Repository/Decorator/ContentTypeServiceDecorator.php index 61fbe8f220..432c480842 100644 --- a/src/contracts/Repository/Decorator/ContentTypeServiceDecorator.php +++ b/src/contracts/Repository/Decorator/ContentTypeServiceDecorator.php @@ -23,8 +23,7 @@ abstract class ContentTypeServiceDecorator implements ContentTypeService { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - protected $innerService; + protected ContentTypeService $innerService; public function __construct(ContentTypeService $innerService) { diff --git a/src/contracts/Repository/Decorator/FieldTypeServiceDecorator.php b/src/contracts/Repository/Decorator/FieldTypeServiceDecorator.php index 689fdcd564..d0c6921878 100644 --- a/src/contracts/Repository/Decorator/FieldTypeServiceDecorator.php +++ b/src/contracts/Repository/Decorator/FieldTypeServiceDecorator.php @@ -13,8 +13,7 @@ abstract class FieldTypeServiceDecorator implements FieldTypeService { - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ - protected $innerService; + protected FieldTypeService $innerService; public function __construct(FieldTypeService $innerService) { diff --git a/src/contracts/Repository/Decorator/LanguageServiceDecorator.php b/src/contracts/Repository/Decorator/LanguageServiceDecorator.php index ac07957a68..3511dcb599 100644 --- a/src/contracts/Repository/Decorator/LanguageServiceDecorator.php +++ b/src/contracts/Repository/Decorator/LanguageServiceDecorator.php @@ -14,8 +14,7 @@ abstract class LanguageServiceDecorator implements LanguageService { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ - protected $innerService; + protected LanguageService $innerService; public function __construct(LanguageService $innerService) { diff --git a/src/contracts/Repository/Decorator/LocationServiceDecorator.php b/src/contracts/Repository/Decorator/LocationServiceDecorator.php index 7afa5f436b..9cdf51d075 100644 --- a/src/contracts/Repository/Decorator/LocationServiceDecorator.php +++ b/src/contracts/Repository/Decorator/LocationServiceDecorator.php @@ -19,8 +19,7 @@ abstract class LocationServiceDecorator implements LocationService { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - protected $innerService; + protected LocationService $innerService; public function __construct(LocationService $innerService) { diff --git a/src/contracts/Repository/Decorator/NotificationServiceDecorator.php b/src/contracts/Repository/Decorator/NotificationServiceDecorator.php index b39e0a83cc..fcd4cfec1d 100644 --- a/src/contracts/Repository/Decorator/NotificationServiceDecorator.php +++ b/src/contracts/Repository/Decorator/NotificationServiceDecorator.php @@ -15,8 +15,7 @@ abstract class NotificationServiceDecorator implements NotificationService { - /** @var \Ibexa\Contracts\Core\Repository\NotificationService */ - protected $innerService; + protected NotificationService $innerService; public function __construct(NotificationService $innerService) { diff --git a/src/contracts/Repository/Decorator/ObjectStateServiceDecorator.php b/src/contracts/Repository/Decorator/ObjectStateServiceDecorator.php index 24f73bb0e5..9a2e0b34ea 100644 --- a/src/contracts/Repository/Decorator/ObjectStateServiceDecorator.php +++ b/src/contracts/Repository/Decorator/ObjectStateServiceDecorator.php @@ -19,8 +19,7 @@ abstract class ObjectStateServiceDecorator implements ObjectStateService { - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ - protected $innerService; + protected ObjectStateService $innerService; public function __construct(ObjectStateService $innerService) { diff --git a/src/contracts/Repository/Decorator/RoleServiceDecorator.php b/src/contracts/Repository/Decorator/RoleServiceDecorator.php index eca74f1274..0e3f48185b 100644 --- a/src/contracts/Repository/Decorator/RoleServiceDecorator.php +++ b/src/contracts/Repository/Decorator/RoleServiceDecorator.php @@ -29,8 +29,7 @@ abstract class RoleServiceDecorator implements RoleService { - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ - protected $innerService; + protected RoleService $innerService; public function __construct(RoleService $innerService) { diff --git a/src/contracts/Repository/Decorator/SearchServiceDecorator.php b/src/contracts/Repository/Decorator/SearchServiceDecorator.php index ba9478a8cb..3b9d41fbe6 100644 --- a/src/contracts/Repository/Decorator/SearchServiceDecorator.php +++ b/src/contracts/Repository/Decorator/SearchServiceDecorator.php @@ -17,8 +17,7 @@ abstract class SearchServiceDecorator implements SearchService { - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ - protected $innerService; + protected SearchService $innerService; public function __construct(SearchService $innerService) { diff --git a/src/contracts/Repository/Decorator/SectionServiceDecorator.php b/src/contracts/Repository/Decorator/SectionServiceDecorator.php index 7927170989..def11a465d 100644 --- a/src/contracts/Repository/Decorator/SectionServiceDecorator.php +++ b/src/contracts/Repository/Decorator/SectionServiceDecorator.php @@ -21,8 +21,7 @@ abstract class SectionServiceDecorator implements SectionService { - /** @var \Ibexa\Contracts\Core\Repository\SectionService */ - protected $innerService; + protected SectionService $innerService; public function __construct(SectionService $innerService) { diff --git a/src/contracts/Repository/Decorator/SettingServiceDecorator.php b/src/contracts/Repository/Decorator/SettingServiceDecorator.php index 6174be9137..4f8f91a259 100644 --- a/src/contracts/Repository/Decorator/SettingServiceDecorator.php +++ b/src/contracts/Repository/Decorator/SettingServiceDecorator.php @@ -15,8 +15,7 @@ abstract class SettingServiceDecorator implements SettingService { - /** @var \Ibexa\Contracts\Core\Repository\SettingService */ - protected $innerService; + protected SettingService $innerService; public function __construct( SettingService $innerService diff --git a/src/contracts/Repository/Decorator/TranslationServiceDecorator.php b/src/contracts/Repository/Decorator/TranslationServiceDecorator.php index 47617365ce..4a8d49bc89 100644 --- a/src/contracts/Repository/Decorator/TranslationServiceDecorator.php +++ b/src/contracts/Repository/Decorator/TranslationServiceDecorator.php @@ -13,8 +13,7 @@ abstract class TranslationServiceDecorator implements TranslationService { - /** @var \Ibexa\Contracts\Core\Repository\TranslationService */ - protected $innerService; + protected TranslationService $innerService; public function __construct(TranslationService $innerService) { diff --git a/src/contracts/Repository/Decorator/TrashServiceDecorator.php b/src/contracts/Repository/Decorator/TrashServiceDecorator.php index 8dc21bdea2..f38902e4cc 100644 --- a/src/contracts/Repository/Decorator/TrashServiceDecorator.php +++ b/src/contracts/Repository/Decorator/TrashServiceDecorator.php @@ -18,8 +18,7 @@ abstract class TrashServiceDecorator implements TrashService { - /** @var \Ibexa\Contracts\Core\Repository\TrashService */ - protected $innerService; + protected TrashService $innerService; public function __construct(TrashService $innerService) { diff --git a/src/contracts/Repository/Decorator/URLAliasServiceDecorator.php b/src/contracts/Repository/Decorator/URLAliasServiceDecorator.php index 3b90f711ee..5df6b33bbb 100644 --- a/src/contracts/Repository/Decorator/URLAliasServiceDecorator.php +++ b/src/contracts/Repository/Decorator/URLAliasServiceDecorator.php @@ -14,8 +14,7 @@ abstract class URLAliasServiceDecorator implements URLAliasService { - /** @var \Ibexa\Contracts\Core\Repository\URLAliasService */ - protected $innerService; + protected URLAliasService $innerService; public function __construct(URLAliasService $innerService) { diff --git a/src/contracts/Repository/Decorator/URLServiceDecorator.php b/src/contracts/Repository/Decorator/URLServiceDecorator.php index a7dd0562d2..70f7027da7 100644 --- a/src/contracts/Repository/Decorator/URLServiceDecorator.php +++ b/src/contracts/Repository/Decorator/URLServiceDecorator.php @@ -17,8 +17,7 @@ abstract class URLServiceDecorator implements URLService { - /** @var \Ibexa\Contracts\Core\Repository\URLService */ - protected $innerService; + protected URLService $innerService; public function __construct(URLService $innerService) { diff --git a/src/contracts/Repository/Decorator/URLWildcardServiceDecorator.php b/src/contracts/Repository/Decorator/URLWildcardServiceDecorator.php index 8c68f43dc2..261f42d6db 100644 --- a/src/contracts/Repository/Decorator/URLWildcardServiceDecorator.php +++ b/src/contracts/Repository/Decorator/URLWildcardServiceDecorator.php @@ -17,8 +17,7 @@ abstract class URLWildcardServiceDecorator implements URLWildcardService { - /** @var \Ibexa\Contracts\Core\Repository\URLWildcardService */ - protected $innerService; + protected URLWildcardService $innerService; public function __construct(URLWildcardService $innerService) { @@ -29,7 +28,7 @@ public function create( string $sourceUrl, string $destinationUrl, bool $forward = false - ): UrlWildcard { + ): URLWildcard { return $this->innerService->create($sourceUrl, $destinationUrl, $forward); } @@ -45,7 +44,7 @@ public function remove(URLWildcard $urlWildcard): void $this->innerService->remove($urlWildcard); } - public function load(int $id): UrlWildcard + public function load(int $id): URLWildcard { return $this->innerService->load($id); } diff --git a/src/contracts/Repository/Decorator/UserPreferenceServiceDecorator.php b/src/contracts/Repository/Decorator/UserPreferenceServiceDecorator.php index 15ad6068b7..04cfaef6e3 100644 --- a/src/contracts/Repository/Decorator/UserPreferenceServiceDecorator.php +++ b/src/contracts/Repository/Decorator/UserPreferenceServiceDecorator.php @@ -14,8 +14,7 @@ abstract class UserPreferenceServiceDecorator implements UserPreferenceService { - /** @var \Ibexa\Contracts\Core\Repository\UserPreferenceService */ - protected $innerService; + protected UserPreferenceService $innerService; public function __construct(UserPreferenceService $innerService) { diff --git a/src/contracts/Repository/Decorator/UserServiceDecorator.php b/src/contracts/Repository/Decorator/UserServiceDecorator.php index 0e7ba27413..dc6b80e640 100644 --- a/src/contracts/Repository/Decorator/UserServiceDecorator.php +++ b/src/contracts/Repository/Decorator/UserServiceDecorator.php @@ -27,8 +27,7 @@ abstract class UserServiceDecorator implements UserService { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ - protected $innerService; + protected UserService $innerService; public function __construct(UserService $innerService) { diff --git a/src/contracts/Repository/Events/Bookmark/BeforeCreateBookmarkEvent.php b/src/contracts/Repository/Events/Bookmark/BeforeCreateBookmarkEvent.php index 5dd37d081f..129ab4352a 100644 --- a/src/contracts/Repository/Events/Bookmark/BeforeCreateBookmarkEvent.php +++ b/src/contracts/Repository/Events/Bookmark/BeforeCreateBookmarkEvent.php @@ -13,8 +13,7 @@ final class BeforeCreateBookmarkEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; public function __construct(Location $location) { diff --git a/src/contracts/Repository/Events/Bookmark/BeforeDeleteBookmarkEvent.php b/src/contracts/Repository/Events/Bookmark/BeforeDeleteBookmarkEvent.php index def4418944..cd338b6a44 100644 --- a/src/contracts/Repository/Events/Bookmark/BeforeDeleteBookmarkEvent.php +++ b/src/contracts/Repository/Events/Bookmark/BeforeDeleteBookmarkEvent.php @@ -13,8 +13,7 @@ final class BeforeDeleteBookmarkEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; public function __construct(Location $location) { diff --git a/src/contracts/Repository/Events/Bookmark/CreateBookmarkEvent.php b/src/contracts/Repository/Events/Bookmark/CreateBookmarkEvent.php index 6117d15ab1..9c3f0dbe1b 100644 --- a/src/contracts/Repository/Events/Bookmark/CreateBookmarkEvent.php +++ b/src/contracts/Repository/Events/Bookmark/CreateBookmarkEvent.php @@ -13,8 +13,7 @@ final class CreateBookmarkEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; public function __construct(Location $location) { diff --git a/src/contracts/Repository/Events/Bookmark/DeleteBookmarkEvent.php b/src/contracts/Repository/Events/Bookmark/DeleteBookmarkEvent.php index 72fee09b22..b1d462f9d8 100644 --- a/src/contracts/Repository/Events/Bookmark/DeleteBookmarkEvent.php +++ b/src/contracts/Repository/Events/Bookmark/DeleteBookmarkEvent.php @@ -13,8 +13,7 @@ final class DeleteBookmarkEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; public function __construct(Location $location) { diff --git a/src/contracts/Repository/Events/Content/AddRelationEvent.php b/src/contracts/Repository/Events/Content/AddRelationEvent.php index 7bbc561cde..f6baa24fa8 100644 --- a/src/contracts/Repository/Events/Content/AddRelationEvent.php +++ b/src/contracts/Repository/Events/Content/AddRelationEvent.php @@ -15,14 +15,11 @@ final class AddRelationEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Relation */ - private $relation; + private Relation $relation; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ - private $sourceVersion; + private VersionInfo $sourceVersion; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $destinationContent; + private ContentInfo $destinationContent; public function __construct( Relation $relation, diff --git a/src/contracts/Repository/Events/Content/BeforeAddRelationEvent.php b/src/contracts/Repository/Events/Content/BeforeAddRelationEvent.php index 4a5ce76e67..c593d16128 100644 --- a/src/contracts/Repository/Events/Content/BeforeAddRelationEvent.php +++ b/src/contracts/Repository/Events/Content/BeforeAddRelationEvent.php @@ -16,14 +16,11 @@ final class BeforeAddRelationEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ - private $sourceVersion; + private VersionInfo $sourceVersion; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $destinationContent; + private ContentInfo $destinationContent; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Relation|null */ - private $relation; + private ?Relation $relation = null; public function __construct(VersionInfo $sourceVersion, ContentInfo $destinationContent) { diff --git a/src/contracts/Repository/Events/Content/BeforeCopyContentEvent.php b/src/contracts/Repository/Events/Content/BeforeCopyContentEvent.php index e4833b4275..b049dcff38 100644 --- a/src/contracts/Repository/Events/Content/BeforeCopyContentEvent.php +++ b/src/contracts/Repository/Events/Content/BeforeCopyContentEvent.php @@ -17,17 +17,13 @@ final class BeforeCopyContentEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct */ - private $destinationLocationCreateStruct; + private LocationCreateStruct $destinationLocationCreateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ - private $versionInfo; + private ?VersionInfo $versionInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content|null */ - private $content; + private ?Content $content = null; public function __construct( ContentInfo $contentInfo, diff --git a/src/contracts/Repository/Events/Content/BeforeCreateContentDraftEvent.php b/src/contracts/Repository/Events/Content/BeforeCreateContentDraftEvent.php index 47afdbbe6e..e91cf7153e 100644 --- a/src/contracts/Repository/Events/Content/BeforeCreateContentDraftEvent.php +++ b/src/contracts/Repository/Events/Content/BeforeCreateContentDraftEvent.php @@ -18,20 +18,15 @@ final class BeforeCreateContentDraftEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ - private $versionInfo; + private ?VersionInfo $versionInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $creator; + private ?User $creator; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null */ - private $language; + private ?Language $language; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content|null */ - private $contentDraft; + private ?Content $contentDraft = null; public function __construct( ContentInfo $contentInfo, diff --git a/src/contracts/Repository/Events/Content/BeforeCreateContentEvent.php b/src/contracts/Repository/Events/Content/BeforeCreateContentEvent.php index 4c57ca3b9b..0258bd19a4 100644 --- a/src/contracts/Repository/Events/Content/BeforeCreateContentEvent.php +++ b/src/contracts/Repository/Events/Content/BeforeCreateContentEvent.php @@ -15,17 +15,14 @@ final class BeforeCreateContentEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct */ - private $contentCreateStruct; + private ContentCreateStruct $contentCreateStruct; - /** @var array */ - private $locationCreateStructs; + private array $locationCreateStructs; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content|null */ - private $content; + private ?Content $content = null; /** @var string[]|null */ - private $fieldIdentifiersToValidate; + private ?array $fieldIdentifiersToValidate; public function __construct( ContentCreateStruct $contentCreateStruct, diff --git a/src/contracts/Repository/Events/Content/BeforeDeleteContentEvent.php b/src/contracts/Repository/Events/Content/BeforeDeleteContentEvent.php index 953ee3f6f3..3edf7f242a 100644 --- a/src/contracts/Repository/Events/Content/BeforeDeleteContentEvent.php +++ b/src/contracts/Repository/Events/Content/BeforeDeleteContentEvent.php @@ -14,11 +14,9 @@ final class BeforeDeleteContentEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; - /** @var array|null */ - private $locations; + private ?array $locations = null; public function __construct(ContentInfo $contentInfo) { diff --git a/src/contracts/Repository/Events/Content/BeforeDeleteRelationEvent.php b/src/contracts/Repository/Events/Content/BeforeDeleteRelationEvent.php index c628f72c19..e566d656a5 100644 --- a/src/contracts/Repository/Events/Content/BeforeDeleteRelationEvent.php +++ b/src/contracts/Repository/Events/Content/BeforeDeleteRelationEvent.php @@ -14,11 +14,9 @@ final class BeforeDeleteRelationEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ - private $sourceVersion; + private VersionInfo $sourceVersion; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $destinationContent; + private ContentInfo $destinationContent; public function __construct(VersionInfo $sourceVersion, ContentInfo $destinationContent) { diff --git a/src/contracts/Repository/Events/Content/BeforeDeleteTranslationEvent.php b/src/contracts/Repository/Events/Content/BeforeDeleteTranslationEvent.php index 61c9763837..208724f112 100644 --- a/src/contracts/Repository/Events/Content/BeforeDeleteTranslationEvent.php +++ b/src/contracts/Repository/Events/Content/BeforeDeleteTranslationEvent.php @@ -13,8 +13,7 @@ final class BeforeDeleteTranslationEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; private $languageCode; diff --git a/src/contracts/Repository/Events/Content/BeforeDeleteVersionEvent.php b/src/contracts/Repository/Events/Content/BeforeDeleteVersionEvent.php index fa7245ad7a..9d2f5c782f 100644 --- a/src/contracts/Repository/Events/Content/BeforeDeleteVersionEvent.php +++ b/src/contracts/Repository/Events/Content/BeforeDeleteVersionEvent.php @@ -13,8 +13,7 @@ final class BeforeDeleteVersionEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ - private $versionInfo; + private VersionInfo $versionInfo; public function __construct(VersionInfo $versionInfo) { diff --git a/src/contracts/Repository/Events/Content/BeforeHideContentEvent.php b/src/contracts/Repository/Events/Content/BeforeHideContentEvent.php index 5d60bb8f5f..a8e0d262d6 100644 --- a/src/contracts/Repository/Events/Content/BeforeHideContentEvent.php +++ b/src/contracts/Repository/Events/Content/BeforeHideContentEvent.php @@ -13,8 +13,7 @@ final class BeforeHideContentEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; public function __construct(ContentInfo $contentInfo) { diff --git a/src/contracts/Repository/Events/Content/BeforePublishVersionEvent.php b/src/contracts/Repository/Events/Content/BeforePublishVersionEvent.php index 130c2d802e..de6f50abd5 100644 --- a/src/contracts/Repository/Events/Content/BeforePublishVersionEvent.php +++ b/src/contracts/Repository/Events/Content/BeforePublishVersionEvent.php @@ -15,14 +15,12 @@ final class BeforePublishVersionEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ - private $versionInfo; + private VersionInfo $versionInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content|null */ - private $content; + private ?Content $content = null; /** @var string[] */ - private $translations; + private array $translations; public function __construct(VersionInfo $versionInfo, array $translations) { diff --git a/src/contracts/Repository/Events/Content/BeforeRevealContentEvent.php b/src/contracts/Repository/Events/Content/BeforeRevealContentEvent.php index 197b3baf8a..c394b1b7be 100644 --- a/src/contracts/Repository/Events/Content/BeforeRevealContentEvent.php +++ b/src/contracts/Repository/Events/Content/BeforeRevealContentEvent.php @@ -13,8 +13,7 @@ final class BeforeRevealContentEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; public function __construct(ContentInfo $contentInfo) { diff --git a/src/contracts/Repository/Events/Content/BeforeUpdateContentEvent.php b/src/contracts/Repository/Events/Content/BeforeUpdateContentEvent.php index cac5490729..cbe677e35b 100644 --- a/src/contracts/Repository/Events/Content/BeforeUpdateContentEvent.php +++ b/src/contracts/Repository/Events/Content/BeforeUpdateContentEvent.php @@ -16,17 +16,14 @@ final class BeforeUpdateContentEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ - private $versionInfo; + private VersionInfo $versionInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentUpdateStruct */ - private $contentUpdateStruct; + private ContentUpdateStruct $contentUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content|null */ - private $content; + private ?Content $content = null; /** @var string[]|null */ - private $fieldIdentifiersToValidate; + private ?array $fieldIdentifiersToValidate; public function __construct( VersionInfo $versionInfo, diff --git a/src/contracts/Repository/Events/Content/BeforeUpdateContentMetadataEvent.php b/src/contracts/Repository/Events/Content/BeforeUpdateContentMetadataEvent.php index f940a44da8..18f12d5b02 100644 --- a/src/contracts/Repository/Events/Content/BeforeUpdateContentMetadataEvent.php +++ b/src/contracts/Repository/Events/Content/BeforeUpdateContentMetadataEvent.php @@ -16,14 +16,11 @@ final class BeforeUpdateContentMetadataEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentMetadataUpdateStruct */ - private $contentMetadataUpdateStruct; + private ContentMetadataUpdateStruct $contentMetadataUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content|null */ - private $content; + private ?Content $content = null; public function __construct(ContentInfo $contentInfo, ContentMetadataUpdateStruct $contentMetadataUpdateStruct) { diff --git a/src/contracts/Repository/Events/Content/CopyContentEvent.php b/src/contracts/Repository/Events/Content/CopyContentEvent.php index e63a5c9e85..baa1b107e1 100644 --- a/src/contracts/Repository/Events/Content/CopyContentEvent.php +++ b/src/contracts/Repository/Events/Content/CopyContentEvent.php @@ -16,17 +16,13 @@ final class CopyContentEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - private $content; + private Content $content; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct */ - private $destinationLocationCreateStruct; + private LocationCreateStruct $destinationLocationCreateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ - private $versionInfo; + private ?VersionInfo $versionInfo; public function __construct( Content $content, diff --git a/src/contracts/Repository/Events/Content/CreateContentDraftEvent.php b/src/contracts/Repository/Events/Content/CreateContentDraftEvent.php index 3955565119..16766cb9f4 100644 --- a/src/contracts/Repository/Events/Content/CreateContentDraftEvent.php +++ b/src/contracts/Repository/Events/Content/CreateContentDraftEvent.php @@ -17,20 +17,15 @@ final class CreateContentDraftEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - private $contentDraft; + private Content $contentDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ - private $versionInfo; + private ?VersionInfo $versionInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $creator; + private ?User $creator; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null */ - private $language; + private ?Language $language; public function __construct( Content $contentDraft, diff --git a/src/contracts/Repository/Events/Content/CreateContentEvent.php b/src/contracts/Repository/Events/Content/CreateContentEvent.php index 5a7d2fb3e1..65f36c67fa 100644 --- a/src/contracts/Repository/Events/Content/CreateContentEvent.php +++ b/src/contracts/Repository/Events/Content/CreateContentEvent.php @@ -14,17 +14,14 @@ final class CreateContentEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct */ - private $contentCreateStruct; + private ContentCreateStruct $contentCreateStruct; - /** @var array */ - private $locationCreateStructs; + private array $locationCreateStructs; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - private $content; + private Content $content; /** @var string[]|null */ - private $fieldIdentifiersToValidate; + private ?array $fieldIdentifiersToValidate; public function __construct( Content $content, diff --git a/src/contracts/Repository/Events/Content/DeleteContentEvent.php b/src/contracts/Repository/Events/Content/DeleteContentEvent.php index 41e2599e33..feef592b5a 100644 --- a/src/contracts/Repository/Events/Content/DeleteContentEvent.php +++ b/src/contracts/Repository/Events/Content/DeleteContentEvent.php @@ -13,11 +13,9 @@ final class DeleteContentEvent extends AfterEvent { - /** @var array */ - private $locations; + private array $locations; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; public function __construct( array $locations, diff --git a/src/contracts/Repository/Events/Content/DeleteRelationEvent.php b/src/contracts/Repository/Events/Content/DeleteRelationEvent.php index 8252930efa..4b3f1cf79a 100644 --- a/src/contracts/Repository/Events/Content/DeleteRelationEvent.php +++ b/src/contracts/Repository/Events/Content/DeleteRelationEvent.php @@ -14,11 +14,9 @@ final class DeleteRelationEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ - private $sourceVersion; + private VersionInfo $sourceVersion; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $destinationContent; + private ContentInfo $destinationContent; public function __construct( VersionInfo $sourceVersion, diff --git a/src/contracts/Repository/Events/Content/DeleteTranslationEvent.php b/src/contracts/Repository/Events/Content/DeleteTranslationEvent.php index 16c2372409..3f03e4b493 100644 --- a/src/contracts/Repository/Events/Content/DeleteTranslationEvent.php +++ b/src/contracts/Repository/Events/Content/DeleteTranslationEvent.php @@ -13,8 +13,7 @@ final class DeleteTranslationEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; private $languageCode; diff --git a/src/contracts/Repository/Events/Content/DeleteVersionEvent.php b/src/contracts/Repository/Events/Content/DeleteVersionEvent.php index 29cb76beb7..cc03953e87 100644 --- a/src/contracts/Repository/Events/Content/DeleteVersionEvent.php +++ b/src/contracts/Repository/Events/Content/DeleteVersionEvent.php @@ -13,8 +13,7 @@ final class DeleteVersionEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ - private $versionInfo; + private VersionInfo $versionInfo; public function __construct(VersionInfo $versionInfo) { diff --git a/src/contracts/Repository/Events/Content/HideContentEvent.php b/src/contracts/Repository/Events/Content/HideContentEvent.php index 6cf729721f..829d9e72ac 100644 --- a/src/contracts/Repository/Events/Content/HideContentEvent.php +++ b/src/contracts/Repository/Events/Content/HideContentEvent.php @@ -13,8 +13,7 @@ final class HideContentEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; public function __construct(ContentInfo $contentInfo) { diff --git a/src/contracts/Repository/Events/Content/PublishVersionEvent.php b/src/contracts/Repository/Events/Content/PublishVersionEvent.php index abd18bca8f..95d677896e 100644 --- a/src/contracts/Repository/Events/Content/PublishVersionEvent.php +++ b/src/contracts/Repository/Events/Content/PublishVersionEvent.php @@ -14,14 +14,12 @@ final class PublishVersionEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - private $content; + private Content $content; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ - private $versionInfo; + private VersionInfo $versionInfo; /** @var string[] */ - private $translations; + private array $translations; public function __construct( Content $content, diff --git a/src/contracts/Repository/Events/Content/RevealContentEvent.php b/src/contracts/Repository/Events/Content/RevealContentEvent.php index e53d4d00bf..19784d57fd 100644 --- a/src/contracts/Repository/Events/Content/RevealContentEvent.php +++ b/src/contracts/Repository/Events/Content/RevealContentEvent.php @@ -13,8 +13,7 @@ final class RevealContentEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; public function __construct(ContentInfo $contentInfo) { diff --git a/src/contracts/Repository/Events/Content/UpdateContentEvent.php b/src/contracts/Repository/Events/Content/UpdateContentEvent.php index 004809882b..68ba907c76 100644 --- a/src/contracts/Repository/Events/Content/UpdateContentEvent.php +++ b/src/contracts/Repository/Events/Content/UpdateContentEvent.php @@ -15,17 +15,14 @@ final class UpdateContentEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - private $content; + private Content $content; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ - private $versionInfo; + private VersionInfo $versionInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentUpdateStruct */ - private $contentUpdateStruct; + private ContentUpdateStruct $contentUpdateStruct; /** @var string[]|null */ - private $fieldIdentifiersToValidate; + private ?array $fieldIdentifiersToValidate; public function __construct( Content $content, diff --git a/src/contracts/Repository/Events/Content/UpdateContentMetadataEvent.php b/src/contracts/Repository/Events/Content/UpdateContentMetadataEvent.php index a48047e1fa..12f64c5ccc 100644 --- a/src/contracts/Repository/Events/Content/UpdateContentMetadataEvent.php +++ b/src/contracts/Repository/Events/Content/UpdateContentMetadataEvent.php @@ -15,14 +15,11 @@ final class UpdateContentMetadataEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - private $content; + private Content $content; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentMetadataUpdateStruct */ - private $contentMetadataUpdateStruct; + private ContentMetadataUpdateStruct $contentMetadataUpdateStruct; public function __construct( Content $content, diff --git a/src/contracts/Repository/Events/ContentType/AddFieldDefinitionEvent.php b/src/contracts/Repository/Events/ContentType/AddFieldDefinitionEvent.php index 6985436851..19e29678c0 100644 --- a/src/contracts/Repository/Events/ContentType/AddFieldDefinitionEvent.php +++ b/src/contracts/Repository/Events/ContentType/AddFieldDefinitionEvent.php @@ -14,11 +14,9 @@ final class AddFieldDefinitionEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ - private $contentTypeDraft; + private ContentTypeDraft $contentTypeDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionCreateStruct */ - private $fieldDefinitionCreateStruct; + private FieldDefinitionCreateStruct $fieldDefinitionCreateStruct; public function __construct( ContentTypeDraft $contentTypeDraft, diff --git a/src/contracts/Repository/Events/ContentType/AssignContentTypeGroupEvent.php b/src/contracts/Repository/Events/ContentType/AssignContentTypeGroupEvent.php index dc73297169..cad1cf24e9 100644 --- a/src/contracts/Repository/Events/ContentType/AssignContentTypeGroupEvent.php +++ b/src/contracts/Repository/Events/ContentType/AssignContentTypeGroupEvent.php @@ -14,11 +14,9 @@ final class AssignContentTypeGroupEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ - private $contentType; + private ContentType $contentType; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup */ - private $contentTypeGroup; + private ContentTypeGroup $contentTypeGroup; public function __construct( ContentType $contentType, diff --git a/src/contracts/Repository/Events/ContentType/BeforeAddFieldDefinitionEvent.php b/src/contracts/Repository/Events/ContentType/BeforeAddFieldDefinitionEvent.php index 3d343a1450..5c2a9f9dec 100644 --- a/src/contracts/Repository/Events/ContentType/BeforeAddFieldDefinitionEvent.php +++ b/src/contracts/Repository/Events/ContentType/BeforeAddFieldDefinitionEvent.php @@ -14,11 +14,9 @@ final class BeforeAddFieldDefinitionEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ - private $contentTypeDraft; + private ContentTypeDraft $contentTypeDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionCreateStruct */ - private $fieldDefinitionCreateStruct; + private FieldDefinitionCreateStruct $fieldDefinitionCreateStruct; public function __construct(ContentTypeDraft $contentTypeDraft, FieldDefinitionCreateStruct $fieldDefinitionCreateStruct) { diff --git a/src/contracts/Repository/Events/ContentType/BeforeAssignContentTypeGroupEvent.php b/src/contracts/Repository/Events/ContentType/BeforeAssignContentTypeGroupEvent.php index c01983125e..9ef82d3087 100644 --- a/src/contracts/Repository/Events/ContentType/BeforeAssignContentTypeGroupEvent.php +++ b/src/contracts/Repository/Events/ContentType/BeforeAssignContentTypeGroupEvent.php @@ -14,11 +14,9 @@ final class BeforeAssignContentTypeGroupEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ - private $contentType; + private ContentType $contentType; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup */ - private $contentTypeGroup; + private ContentTypeGroup $contentTypeGroup; public function __construct(ContentType $contentType, ContentTypeGroup $contentTypeGroup) { diff --git a/src/contracts/Repository/Events/ContentType/BeforeCopyContentTypeEvent.php b/src/contracts/Repository/Events/ContentType/BeforeCopyContentTypeEvent.php index 2a706ed4a0..403c12cd4f 100644 --- a/src/contracts/Repository/Events/ContentType/BeforeCopyContentTypeEvent.php +++ b/src/contracts/Repository/Events/ContentType/BeforeCopyContentTypeEvent.php @@ -15,14 +15,11 @@ final class BeforeCopyContentTypeEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ - private $contentType; + private ContentType $contentType; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $creator; + private ?User $creator; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|null */ - private $contentTypeCopy; + private ?ContentType $contentTypeCopy = null; public function __construct(ContentType $contentType, ?User $creator = null) { diff --git a/src/contracts/Repository/Events/ContentType/BeforeCreateContentTypeDraftEvent.php b/src/contracts/Repository/Events/ContentType/BeforeCreateContentTypeDraftEvent.php index 0d6d39e9b4..d724924f89 100644 --- a/src/contracts/Repository/Events/ContentType/BeforeCreateContentTypeDraftEvent.php +++ b/src/contracts/Repository/Events/ContentType/BeforeCreateContentTypeDraftEvent.php @@ -15,11 +15,9 @@ final class BeforeCreateContentTypeDraftEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ - private $contentType; + private ContentType $contentType; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft|null */ - private $contentTypeDraft; + private ?ContentTypeDraft $contentTypeDraft = null; public function __construct(ContentType $contentType) { diff --git a/src/contracts/Repository/Events/ContentType/BeforeCreateContentTypeEvent.php b/src/contracts/Repository/Events/ContentType/BeforeCreateContentTypeEvent.php index f4706b7389..86737c47f7 100644 --- a/src/contracts/Repository/Events/ContentType/BeforeCreateContentTypeEvent.php +++ b/src/contracts/Repository/Events/ContentType/BeforeCreateContentTypeEvent.php @@ -15,14 +15,11 @@ final class BeforeCreateContentTypeEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeCreateStruct */ - private $contentTypeCreateStruct; + private ContentTypeCreateStruct $contentTypeCreateStruct; - /** @var array */ - private $contentTypeGroups; + private array $contentTypeGroups; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft|null */ - private $contentTypeDraft; + private ?ContentTypeDraft $contentTypeDraft = null; public function __construct(ContentTypeCreateStruct $contentTypeCreateStruct, array $contentTypeGroups) { diff --git a/src/contracts/Repository/Events/ContentType/BeforeCreateContentTypeGroupEvent.php b/src/contracts/Repository/Events/ContentType/BeforeCreateContentTypeGroupEvent.php index d0ea49b65b..ef37f3a65a 100644 --- a/src/contracts/Repository/Events/ContentType/BeforeCreateContentTypeGroupEvent.php +++ b/src/contracts/Repository/Events/ContentType/BeforeCreateContentTypeGroupEvent.php @@ -15,11 +15,9 @@ final class BeforeCreateContentTypeGroupEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroupCreateStruct */ - private $contentTypeGroupCreateStruct; + private ContentTypeGroupCreateStruct $contentTypeGroupCreateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup|null */ - private $contentTypeGroup; + private ?ContentTypeGroup $contentTypeGroup = null; public function __construct(ContentTypeGroupCreateStruct $contentTypeGroupCreateStruct) { diff --git a/src/contracts/Repository/Events/ContentType/BeforeDeleteContentTypeEvent.php b/src/contracts/Repository/Events/ContentType/BeforeDeleteContentTypeEvent.php index 8258fbaa1b..2974c108ff 100644 --- a/src/contracts/Repository/Events/ContentType/BeforeDeleteContentTypeEvent.php +++ b/src/contracts/Repository/Events/ContentType/BeforeDeleteContentTypeEvent.php @@ -13,8 +13,7 @@ final class BeforeDeleteContentTypeEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ - private $contentType; + private ContentType $contentType; public function __construct(ContentType $contentType) { diff --git a/src/contracts/Repository/Events/ContentType/BeforeDeleteContentTypeGroupEvent.php b/src/contracts/Repository/Events/ContentType/BeforeDeleteContentTypeGroupEvent.php index effb3812aa..108a8675f7 100644 --- a/src/contracts/Repository/Events/ContentType/BeforeDeleteContentTypeGroupEvent.php +++ b/src/contracts/Repository/Events/ContentType/BeforeDeleteContentTypeGroupEvent.php @@ -13,8 +13,7 @@ final class BeforeDeleteContentTypeGroupEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup */ - private $contentTypeGroup; + private ContentTypeGroup $contentTypeGroup; public function __construct(ContentTypeGroup $contentTypeGroup) { diff --git a/src/contracts/Repository/Events/ContentType/BeforePublishContentTypeDraftEvent.php b/src/contracts/Repository/Events/ContentType/BeforePublishContentTypeDraftEvent.php index 601c560f4b..c7f30e558a 100644 --- a/src/contracts/Repository/Events/ContentType/BeforePublishContentTypeDraftEvent.php +++ b/src/contracts/Repository/Events/ContentType/BeforePublishContentTypeDraftEvent.php @@ -13,8 +13,7 @@ final class BeforePublishContentTypeDraftEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ - private $contentTypeDraft; + private ContentTypeDraft $contentTypeDraft; public function __construct(ContentTypeDraft $contentTypeDraft) { diff --git a/src/contracts/Repository/Events/ContentType/BeforeRemoveContentTypeTranslationEvent.php b/src/contracts/Repository/Events/ContentType/BeforeRemoveContentTypeTranslationEvent.php index a85344d48e..e3492461bf 100644 --- a/src/contracts/Repository/Events/ContentType/BeforeRemoveContentTypeTranslationEvent.php +++ b/src/contracts/Repository/Events/ContentType/BeforeRemoveContentTypeTranslationEvent.php @@ -14,14 +14,11 @@ final class BeforeRemoveContentTypeTranslationEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ - private $contentTypeDraft; + private ContentTypeDraft $contentTypeDraft; - /** @var string */ - private $languageCode; + private string $languageCode; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft|null */ - private $newContentTypeDraft; + private ?ContentTypeDraft $newContentTypeDraft = null; public function __construct(ContentTypeDraft $contentTypeDraft, string $languageCode) { diff --git a/src/contracts/Repository/Events/ContentType/BeforeRemoveFieldDefinitionEvent.php b/src/contracts/Repository/Events/ContentType/BeforeRemoveFieldDefinitionEvent.php index 87d8288921..059ca83557 100644 --- a/src/contracts/Repository/Events/ContentType/BeforeRemoveFieldDefinitionEvent.php +++ b/src/contracts/Repository/Events/ContentType/BeforeRemoveFieldDefinitionEvent.php @@ -14,11 +14,9 @@ final class BeforeRemoveFieldDefinitionEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ - private $contentTypeDraft; + private ContentTypeDraft $contentTypeDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition */ - private $fieldDefinition; + private FieldDefinition $fieldDefinition; public function __construct(ContentTypeDraft $contentTypeDraft, FieldDefinition $fieldDefinition) { diff --git a/src/contracts/Repository/Events/ContentType/BeforeUnassignContentTypeGroupEvent.php b/src/contracts/Repository/Events/ContentType/BeforeUnassignContentTypeGroupEvent.php index ba712fccc5..289441c756 100644 --- a/src/contracts/Repository/Events/ContentType/BeforeUnassignContentTypeGroupEvent.php +++ b/src/contracts/Repository/Events/ContentType/BeforeUnassignContentTypeGroupEvent.php @@ -14,11 +14,9 @@ final class BeforeUnassignContentTypeGroupEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ - private $contentType; + private ContentType $contentType; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup */ - private $contentTypeGroup; + private ContentTypeGroup $contentTypeGroup; public function __construct(ContentType $contentType, ContentTypeGroup $contentTypeGroup) { diff --git a/src/contracts/Repository/Events/ContentType/BeforeUpdateContentTypeDraftEvent.php b/src/contracts/Repository/Events/ContentType/BeforeUpdateContentTypeDraftEvent.php index 27f66aeecd..c336f8a49c 100644 --- a/src/contracts/Repository/Events/ContentType/BeforeUpdateContentTypeDraftEvent.php +++ b/src/contracts/Repository/Events/ContentType/BeforeUpdateContentTypeDraftEvent.php @@ -14,11 +14,9 @@ final class BeforeUpdateContentTypeDraftEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ - private $contentTypeDraft; + private ContentTypeDraft $contentTypeDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeUpdateStruct */ - private $contentTypeUpdateStruct; + private ContentTypeUpdateStruct $contentTypeUpdateStruct; public function __construct(ContentTypeDraft $contentTypeDraft, ContentTypeUpdateStruct $contentTypeUpdateStruct) { diff --git a/src/contracts/Repository/Events/ContentType/BeforeUpdateContentTypeGroupEvent.php b/src/contracts/Repository/Events/ContentType/BeforeUpdateContentTypeGroupEvent.php index 085a83041b..3c51894ee9 100644 --- a/src/contracts/Repository/Events/ContentType/BeforeUpdateContentTypeGroupEvent.php +++ b/src/contracts/Repository/Events/ContentType/BeforeUpdateContentTypeGroupEvent.php @@ -14,11 +14,9 @@ final class BeforeUpdateContentTypeGroupEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup */ - private $contentTypeGroup; + private ContentTypeGroup $contentTypeGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroupUpdateStruct */ - private $contentTypeGroupUpdateStruct; + private ContentTypeGroupUpdateStruct $contentTypeGroupUpdateStruct; public function __construct(ContentTypeGroup $contentTypeGroup, ContentTypeGroupUpdateStruct $contentTypeGroupUpdateStruct) { diff --git a/src/contracts/Repository/Events/ContentType/BeforeUpdateFieldDefinitionEvent.php b/src/contracts/Repository/Events/ContentType/BeforeUpdateFieldDefinitionEvent.php index dc1b874ccd..32340c5878 100644 --- a/src/contracts/Repository/Events/ContentType/BeforeUpdateFieldDefinitionEvent.php +++ b/src/contracts/Repository/Events/ContentType/BeforeUpdateFieldDefinitionEvent.php @@ -15,14 +15,11 @@ final class BeforeUpdateFieldDefinitionEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ - private $contentTypeDraft; + private ContentTypeDraft $contentTypeDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition */ - private $fieldDefinition; + private FieldDefinition $fieldDefinition; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionUpdateStruct */ - private $fieldDefinitionUpdateStruct; + private FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct; public function __construct( ContentTypeDraft $contentTypeDraft, diff --git a/src/contracts/Repository/Events/ContentType/CopyContentTypeEvent.php b/src/contracts/Repository/Events/ContentType/CopyContentTypeEvent.php index a64a2be0ce..5e0f3ccdfc 100644 --- a/src/contracts/Repository/Events/ContentType/CopyContentTypeEvent.php +++ b/src/contracts/Repository/Events/ContentType/CopyContentTypeEvent.php @@ -14,14 +14,11 @@ final class CopyContentTypeEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ - private $contentTypeCopy; + private ContentType $contentTypeCopy; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ - private $contentType; + private ContentType $contentType; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $creator; + private ?User $creator; public function __construct( ContentType $contentTypeCopy, diff --git a/src/contracts/Repository/Events/ContentType/CreateContentTypeDraftEvent.php b/src/contracts/Repository/Events/ContentType/CreateContentTypeDraftEvent.php index 4084795a14..386ea3db66 100644 --- a/src/contracts/Repository/Events/ContentType/CreateContentTypeDraftEvent.php +++ b/src/contracts/Repository/Events/ContentType/CreateContentTypeDraftEvent.php @@ -14,11 +14,9 @@ final class CreateContentTypeDraftEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ - private $contentTypeDraft; + private ContentTypeDraft $contentTypeDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ - private $contentType; + private ContentType $contentType; public function __construct( ContentTypeDraft $contentTypeDraft, diff --git a/src/contracts/Repository/Events/ContentType/CreateContentTypeEvent.php b/src/contracts/Repository/Events/ContentType/CreateContentTypeEvent.php index bd39572c64..cbf7a11adb 100644 --- a/src/contracts/Repository/Events/ContentType/CreateContentTypeEvent.php +++ b/src/contracts/Repository/Events/ContentType/CreateContentTypeEvent.php @@ -14,14 +14,11 @@ final class CreateContentTypeEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ - private $contentTypeDraft; + private ContentTypeDraft $contentTypeDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeCreateStruct */ - private $contentTypeCreateStruct; + private ContentTypeCreateStruct $contentTypeCreateStruct; - /** @var array */ - private $contentTypeGroups; + private array $contentTypeGroups; public function __construct( ContentTypeDraft $contentTypeDraft, diff --git a/src/contracts/Repository/Events/ContentType/CreateContentTypeGroupEvent.php b/src/contracts/Repository/Events/ContentType/CreateContentTypeGroupEvent.php index 0d3d537974..0a8614834f 100644 --- a/src/contracts/Repository/Events/ContentType/CreateContentTypeGroupEvent.php +++ b/src/contracts/Repository/Events/ContentType/CreateContentTypeGroupEvent.php @@ -14,11 +14,9 @@ final class CreateContentTypeGroupEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup */ - private $contentTypeGroup; + private ContentTypeGroup $contentTypeGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroupCreateStruct */ - private $contentTypeGroupCreateStruct; + private ContentTypeGroupCreateStruct $contentTypeGroupCreateStruct; public function __construct( ContentTypeGroup $contentTypeGroup, diff --git a/src/contracts/Repository/Events/ContentType/DeleteContentTypeEvent.php b/src/contracts/Repository/Events/ContentType/DeleteContentTypeEvent.php index e3fc0a907d..2d1e7af824 100644 --- a/src/contracts/Repository/Events/ContentType/DeleteContentTypeEvent.php +++ b/src/contracts/Repository/Events/ContentType/DeleteContentTypeEvent.php @@ -13,8 +13,7 @@ final class DeleteContentTypeEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ - private $contentType; + private ContentType $contentType; public function __construct(ContentType $contentType) { diff --git a/src/contracts/Repository/Events/ContentType/DeleteContentTypeGroupEvent.php b/src/contracts/Repository/Events/ContentType/DeleteContentTypeGroupEvent.php index 4941f4c66b..d64db21eb2 100644 --- a/src/contracts/Repository/Events/ContentType/DeleteContentTypeGroupEvent.php +++ b/src/contracts/Repository/Events/ContentType/DeleteContentTypeGroupEvent.php @@ -13,8 +13,7 @@ final class DeleteContentTypeGroupEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup */ - private $contentTypeGroup; + private ContentTypeGroup $contentTypeGroup; public function __construct(ContentTypeGroup $contentTypeGroup) { diff --git a/src/contracts/Repository/Events/ContentType/PublishContentTypeDraftEvent.php b/src/contracts/Repository/Events/ContentType/PublishContentTypeDraftEvent.php index e19b5b0f6c..449b63f575 100644 --- a/src/contracts/Repository/Events/ContentType/PublishContentTypeDraftEvent.php +++ b/src/contracts/Repository/Events/ContentType/PublishContentTypeDraftEvent.php @@ -13,8 +13,7 @@ final class PublishContentTypeDraftEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ - private $contentTypeDraft; + private ContentTypeDraft $contentTypeDraft; public function __construct(ContentTypeDraft $contentTypeDraft) { diff --git a/src/contracts/Repository/Events/ContentType/RemoveContentTypeTranslationEvent.php b/src/contracts/Repository/Events/ContentType/RemoveContentTypeTranslationEvent.php index a6d78df42d..a27d5b2af8 100644 --- a/src/contracts/Repository/Events/ContentType/RemoveContentTypeTranslationEvent.php +++ b/src/contracts/Repository/Events/ContentType/RemoveContentTypeTranslationEvent.php @@ -13,14 +13,11 @@ final class RemoveContentTypeTranslationEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ - private $newContentTypeDraft; + private ContentTypeDraft $newContentTypeDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ - private $contentTypeDraft; + private ContentTypeDraft $contentTypeDraft; - /** @var string */ - private $languageCode; + private string $languageCode; public function __construct( ContentTypeDraft $newContentTypeDraft, diff --git a/src/contracts/Repository/Events/ContentType/RemoveFieldDefinitionEvent.php b/src/contracts/Repository/Events/ContentType/RemoveFieldDefinitionEvent.php index 43196645d8..c89e039e2d 100644 --- a/src/contracts/Repository/Events/ContentType/RemoveFieldDefinitionEvent.php +++ b/src/contracts/Repository/Events/ContentType/RemoveFieldDefinitionEvent.php @@ -14,11 +14,9 @@ final class RemoveFieldDefinitionEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ - private $contentTypeDraft; + private ContentTypeDraft $contentTypeDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition */ - private $fieldDefinition; + private FieldDefinition $fieldDefinition; public function __construct( ContentTypeDraft $contentTypeDraft, diff --git a/src/contracts/Repository/Events/ContentType/UnassignContentTypeGroupEvent.php b/src/contracts/Repository/Events/ContentType/UnassignContentTypeGroupEvent.php index 9adc7dd415..3b110cb95b 100644 --- a/src/contracts/Repository/Events/ContentType/UnassignContentTypeGroupEvent.php +++ b/src/contracts/Repository/Events/ContentType/UnassignContentTypeGroupEvent.php @@ -14,11 +14,9 @@ final class UnassignContentTypeGroupEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ - private $contentType; + private ContentType $contentType; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup */ - private $contentTypeGroup; + private ContentTypeGroup $contentTypeGroup; public function __construct( ContentType $contentType, diff --git a/src/contracts/Repository/Events/ContentType/UpdateContentTypeDraftEvent.php b/src/contracts/Repository/Events/ContentType/UpdateContentTypeDraftEvent.php index 00d8e74246..0fe72ef50b 100644 --- a/src/contracts/Repository/Events/ContentType/UpdateContentTypeDraftEvent.php +++ b/src/contracts/Repository/Events/ContentType/UpdateContentTypeDraftEvent.php @@ -14,11 +14,9 @@ final class UpdateContentTypeDraftEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ - private $contentTypeDraft; + private ContentTypeDraft $contentTypeDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeUpdateStruct */ - private $contentTypeUpdateStruct; + private ContentTypeUpdateStruct $contentTypeUpdateStruct; public function __construct( ContentTypeDraft $contentTypeDraft, diff --git a/src/contracts/Repository/Events/ContentType/UpdateContentTypeGroupEvent.php b/src/contracts/Repository/Events/ContentType/UpdateContentTypeGroupEvent.php index 65493292c5..27c9a047d7 100644 --- a/src/contracts/Repository/Events/ContentType/UpdateContentTypeGroupEvent.php +++ b/src/contracts/Repository/Events/ContentType/UpdateContentTypeGroupEvent.php @@ -14,11 +14,9 @@ final class UpdateContentTypeGroupEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup */ - private $contentTypeGroup; + private ContentTypeGroup $contentTypeGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroupUpdateStruct */ - private $contentTypeGroupUpdateStruct; + private ContentTypeGroupUpdateStruct $contentTypeGroupUpdateStruct; public function __construct( ContentTypeGroup $contentTypeGroup, diff --git a/src/contracts/Repository/Events/ContentType/UpdateFieldDefinitionEvent.php b/src/contracts/Repository/Events/ContentType/UpdateFieldDefinitionEvent.php index 0368061b75..12ce634271 100644 --- a/src/contracts/Repository/Events/ContentType/UpdateFieldDefinitionEvent.php +++ b/src/contracts/Repository/Events/ContentType/UpdateFieldDefinitionEvent.php @@ -15,14 +15,11 @@ final class UpdateFieldDefinitionEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ - private $contentTypeDraft; + private ContentTypeDraft $contentTypeDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition */ - private $fieldDefinition; + private FieldDefinition $fieldDefinition; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionUpdateStruct */ - private $fieldDefinitionUpdateStruct; + private FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct; public function __construct( ContentTypeDraft $contentTypeDraft, diff --git a/src/contracts/Repository/Events/Language/BeforeCreateLanguageEvent.php b/src/contracts/Repository/Events/Language/BeforeCreateLanguageEvent.php index 04291b8a4a..fb9c35db10 100644 --- a/src/contracts/Repository/Events/Language/BeforeCreateLanguageEvent.php +++ b/src/contracts/Repository/Events/Language/BeforeCreateLanguageEvent.php @@ -15,11 +15,9 @@ final class BeforeCreateLanguageEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\LanguageCreateStruct */ - private $languageCreateStruct; + private LanguageCreateStruct $languageCreateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null */ - private $language; + private ?Language $language = null; public function __construct(LanguageCreateStruct $languageCreateStruct) { diff --git a/src/contracts/Repository/Events/Language/BeforeDeleteLanguageEvent.php b/src/contracts/Repository/Events/Language/BeforeDeleteLanguageEvent.php index cbbdb0e44d..34afe9ed56 100644 --- a/src/contracts/Repository/Events/Language/BeforeDeleteLanguageEvent.php +++ b/src/contracts/Repository/Events/Language/BeforeDeleteLanguageEvent.php @@ -13,8 +13,7 @@ final class BeforeDeleteLanguageEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ - private $language; + private Language $language; public function __construct(Language $language) { diff --git a/src/contracts/Repository/Events/Language/BeforeDisableLanguageEvent.php b/src/contracts/Repository/Events/Language/BeforeDisableLanguageEvent.php index 58d35fe568..ed0341e024 100644 --- a/src/contracts/Repository/Events/Language/BeforeDisableLanguageEvent.php +++ b/src/contracts/Repository/Events/Language/BeforeDisableLanguageEvent.php @@ -14,11 +14,9 @@ final class BeforeDisableLanguageEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ - private $language; + private Language $language; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null */ - private $disabledLanguage; + private ?Language $disabledLanguage = null; public function __construct(Language $language) { diff --git a/src/contracts/Repository/Events/Language/BeforeEnableLanguageEvent.php b/src/contracts/Repository/Events/Language/BeforeEnableLanguageEvent.php index cef3f53404..d3c70e399f 100644 --- a/src/contracts/Repository/Events/Language/BeforeEnableLanguageEvent.php +++ b/src/contracts/Repository/Events/Language/BeforeEnableLanguageEvent.php @@ -14,11 +14,9 @@ final class BeforeEnableLanguageEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ - private $language; + private Language $language; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null */ - private $enabledLanguage; + private ?Language $enabledLanguage = null; public function __construct(Language $language) { diff --git a/src/contracts/Repository/Events/Language/BeforeUpdateLanguageNameEvent.php b/src/contracts/Repository/Events/Language/BeforeUpdateLanguageNameEvent.php index 550e53609f..9fdfc31d14 100644 --- a/src/contracts/Repository/Events/Language/BeforeUpdateLanguageNameEvent.php +++ b/src/contracts/Repository/Events/Language/BeforeUpdateLanguageNameEvent.php @@ -14,14 +14,11 @@ final class BeforeUpdateLanguageNameEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ - private $language; + private Language $language; - /** @var string */ - private $newName; + private string $newName; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null */ - private $updatedLanguage; + private ?Language $updatedLanguage = null; public function __construct(Language $language, string $newName) { diff --git a/src/contracts/Repository/Events/Language/CreateLanguageEvent.php b/src/contracts/Repository/Events/Language/CreateLanguageEvent.php index fb1c6efd96..0c242cc972 100644 --- a/src/contracts/Repository/Events/Language/CreateLanguageEvent.php +++ b/src/contracts/Repository/Events/Language/CreateLanguageEvent.php @@ -14,11 +14,9 @@ final class CreateLanguageEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ - private $language; + private Language $language; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\LanguageCreateStruct */ - private $languageCreateStruct; + private LanguageCreateStruct $languageCreateStruct; public function __construct( Language $language, diff --git a/src/contracts/Repository/Events/Language/DeleteLanguageEvent.php b/src/contracts/Repository/Events/Language/DeleteLanguageEvent.php index 5186d48cbd..f2a2b228d7 100644 --- a/src/contracts/Repository/Events/Language/DeleteLanguageEvent.php +++ b/src/contracts/Repository/Events/Language/DeleteLanguageEvent.php @@ -13,8 +13,7 @@ final class DeleteLanguageEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ - private $language; + private Language $language; public function __construct(Language $language) { diff --git a/src/contracts/Repository/Events/Language/DisableLanguageEvent.php b/src/contracts/Repository/Events/Language/DisableLanguageEvent.php index 0da88b89ae..4774d6e798 100644 --- a/src/contracts/Repository/Events/Language/DisableLanguageEvent.php +++ b/src/contracts/Repository/Events/Language/DisableLanguageEvent.php @@ -13,11 +13,9 @@ final class DisableLanguageEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ - private $disabledLanguage; + private Language $disabledLanguage; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ - private $language; + private Language $language; public function __construct( Language $disabledLanguage, diff --git a/src/contracts/Repository/Events/Language/EnableLanguageEvent.php b/src/contracts/Repository/Events/Language/EnableLanguageEvent.php index 3fa5468948..7dbed14a5b 100644 --- a/src/contracts/Repository/Events/Language/EnableLanguageEvent.php +++ b/src/contracts/Repository/Events/Language/EnableLanguageEvent.php @@ -13,11 +13,9 @@ final class EnableLanguageEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ - private $enabledLanguage; + private Language $enabledLanguage; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ - private $language; + private Language $language; public function __construct( Language $enabledLanguage, diff --git a/src/contracts/Repository/Events/Language/UpdateLanguageNameEvent.php b/src/contracts/Repository/Events/Language/UpdateLanguageNameEvent.php index 0e0d02adbb..78a6e38752 100644 --- a/src/contracts/Repository/Events/Language/UpdateLanguageNameEvent.php +++ b/src/contracts/Repository/Events/Language/UpdateLanguageNameEvent.php @@ -13,14 +13,11 @@ final class UpdateLanguageNameEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ - private $updatedLanguage; + private Language $updatedLanguage; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ - private $language; + private Language $language; - /** @var string */ - private $newName; + private string $newName; public function __construct( Language $updatedLanguage, diff --git a/src/contracts/Repository/Events/Location/BeforeCopySubtreeEvent.php b/src/contracts/Repository/Events/Location/BeforeCopySubtreeEvent.php index dc04dc4b5e..7aeb4478ad 100644 --- a/src/contracts/Repository/Events/Location/BeforeCopySubtreeEvent.php +++ b/src/contracts/Repository/Events/Location/BeforeCopySubtreeEvent.php @@ -14,14 +14,11 @@ final class BeforeCopySubtreeEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $subtree; + private Location $subtree; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $targetParentLocation; + private Location $targetParentLocation; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ - private $location; + private ?Location $location = null; public function __construct(Location $subtree, Location $targetParentLocation) { diff --git a/src/contracts/Repository/Events/Location/BeforeCreateLocationEvent.php b/src/contracts/Repository/Events/Location/BeforeCreateLocationEvent.php index 9b47d301c9..4840474ac5 100644 --- a/src/contracts/Repository/Events/Location/BeforeCreateLocationEvent.php +++ b/src/contracts/Repository/Events/Location/BeforeCreateLocationEvent.php @@ -16,14 +16,11 @@ final class BeforeCreateLocationEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct */ - private $locationCreateStruct; + private LocationCreateStruct $locationCreateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ - private $location; + private ?Location $location = null; public function __construct(ContentInfo $contentInfo, LocationCreateStruct $locationCreateStruct) { diff --git a/src/contracts/Repository/Events/Location/BeforeDeleteLocationEvent.php b/src/contracts/Repository/Events/Location/BeforeDeleteLocationEvent.php index 316c903d37..a5a40aa658 100644 --- a/src/contracts/Repository/Events/Location/BeforeDeleteLocationEvent.php +++ b/src/contracts/Repository/Events/Location/BeforeDeleteLocationEvent.php @@ -13,8 +13,7 @@ final class BeforeDeleteLocationEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; public function __construct(Location $location) { diff --git a/src/contracts/Repository/Events/Location/BeforeHideLocationEvent.php b/src/contracts/Repository/Events/Location/BeforeHideLocationEvent.php index d108669424..fdf6b8d9b1 100644 --- a/src/contracts/Repository/Events/Location/BeforeHideLocationEvent.php +++ b/src/contracts/Repository/Events/Location/BeforeHideLocationEvent.php @@ -14,11 +14,9 @@ final class BeforeHideLocationEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ - private $hiddenLocation; + private ?Location $hiddenLocation = null; public function __construct(Location $location) { diff --git a/src/contracts/Repository/Events/Location/BeforeMoveSubtreeEvent.php b/src/contracts/Repository/Events/Location/BeforeMoveSubtreeEvent.php index 2dfa9dc116..b3a2c283a9 100644 --- a/src/contracts/Repository/Events/Location/BeforeMoveSubtreeEvent.php +++ b/src/contracts/Repository/Events/Location/BeforeMoveSubtreeEvent.php @@ -13,11 +13,9 @@ final class BeforeMoveSubtreeEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $newParentLocation; + private Location $newParentLocation; public function __construct(Location $location, Location $newParentLocation) { diff --git a/src/contracts/Repository/Events/Location/BeforeSwapLocationEvent.php b/src/contracts/Repository/Events/Location/BeforeSwapLocationEvent.php index e84e903a31..3b4119f6cc 100644 --- a/src/contracts/Repository/Events/Location/BeforeSwapLocationEvent.php +++ b/src/contracts/Repository/Events/Location/BeforeSwapLocationEvent.php @@ -13,11 +13,9 @@ final class BeforeSwapLocationEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location1; + private Location $location1; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location2; + private Location $location2; public function __construct(Location $location1, Location $location2) { diff --git a/src/contracts/Repository/Events/Location/BeforeUnhideLocationEvent.php b/src/contracts/Repository/Events/Location/BeforeUnhideLocationEvent.php index 081eb4889a..497188178a 100644 --- a/src/contracts/Repository/Events/Location/BeforeUnhideLocationEvent.php +++ b/src/contracts/Repository/Events/Location/BeforeUnhideLocationEvent.php @@ -14,11 +14,9 @@ final class BeforeUnhideLocationEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ - private $revealedLocation; + private ?Location $revealedLocation = null; public function __construct(Location $location) { diff --git a/src/contracts/Repository/Events/Location/BeforeUpdateLocationEvent.php b/src/contracts/Repository/Events/Location/BeforeUpdateLocationEvent.php index 455d84b4ab..c4add31f7d 100644 --- a/src/contracts/Repository/Events/Location/BeforeUpdateLocationEvent.php +++ b/src/contracts/Repository/Events/Location/BeforeUpdateLocationEvent.php @@ -15,14 +15,11 @@ final class BeforeUpdateLocationEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\LocationUpdateStruct */ - private $locationUpdateStruct; + private LocationUpdateStruct $locationUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ - private $updatedLocation; + private ?Location $updatedLocation = null; public function __construct(Location $location, LocationUpdateStruct $locationUpdateStruct) { diff --git a/src/contracts/Repository/Events/Location/CopySubtreeEvent.php b/src/contracts/Repository/Events/Location/CopySubtreeEvent.php index e52bb3c734..700a09bde4 100644 --- a/src/contracts/Repository/Events/Location/CopySubtreeEvent.php +++ b/src/contracts/Repository/Events/Location/CopySubtreeEvent.php @@ -13,14 +13,11 @@ final class CopySubtreeEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $subtree; + private Location $subtree; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $targetParentLocation; + private Location $targetParentLocation; public function __construct( Location $location, diff --git a/src/contracts/Repository/Events/Location/CreateLocationEvent.php b/src/contracts/Repository/Events/Location/CreateLocationEvent.php index fff974a204..ce2dd1f705 100644 --- a/src/contracts/Repository/Events/Location/CreateLocationEvent.php +++ b/src/contracts/Repository/Events/Location/CreateLocationEvent.php @@ -15,14 +15,11 @@ final class CreateLocationEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct */ - private $locationCreateStruct; + private LocationCreateStruct $locationCreateStruct; public function __construct( Location $location, diff --git a/src/contracts/Repository/Events/Location/DeleteLocationEvent.php b/src/contracts/Repository/Events/Location/DeleteLocationEvent.php index eae70e86ef..5d8d5c23bf 100644 --- a/src/contracts/Repository/Events/Location/DeleteLocationEvent.php +++ b/src/contracts/Repository/Events/Location/DeleteLocationEvent.php @@ -13,8 +13,7 @@ final class DeleteLocationEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; public function __construct(Location $location) { diff --git a/src/contracts/Repository/Events/Location/HideLocationEvent.php b/src/contracts/Repository/Events/Location/HideLocationEvent.php index 7518436127..e6dae2e93d 100644 --- a/src/contracts/Repository/Events/Location/HideLocationEvent.php +++ b/src/contracts/Repository/Events/Location/HideLocationEvent.php @@ -13,11 +13,9 @@ final class HideLocationEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $hiddenLocation; + private Location $hiddenLocation; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; public function __construct( Location $hiddenLocation, diff --git a/src/contracts/Repository/Events/Location/MoveSubtreeEvent.php b/src/contracts/Repository/Events/Location/MoveSubtreeEvent.php index 02a668d525..d221f97650 100644 --- a/src/contracts/Repository/Events/Location/MoveSubtreeEvent.php +++ b/src/contracts/Repository/Events/Location/MoveSubtreeEvent.php @@ -13,11 +13,9 @@ final class MoveSubtreeEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $newParentLocation; + private Location $newParentLocation; public function __construct( Location $location, diff --git a/src/contracts/Repository/Events/Location/SwapLocationEvent.php b/src/contracts/Repository/Events/Location/SwapLocationEvent.php index c60df93659..48976902ae 100644 --- a/src/contracts/Repository/Events/Location/SwapLocationEvent.php +++ b/src/contracts/Repository/Events/Location/SwapLocationEvent.php @@ -13,11 +13,9 @@ final class SwapLocationEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location1; + private Location $location1; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location2; + private Location $location2; public function __construct( Location $location1, diff --git a/src/contracts/Repository/Events/Location/UnhideLocationEvent.php b/src/contracts/Repository/Events/Location/UnhideLocationEvent.php index 37b511c41f..b27d959cdd 100644 --- a/src/contracts/Repository/Events/Location/UnhideLocationEvent.php +++ b/src/contracts/Repository/Events/Location/UnhideLocationEvent.php @@ -13,11 +13,9 @@ final class UnhideLocationEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $revealedLocation; + private Location $revealedLocation; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; public function __construct( Location $revealedLocation, diff --git a/src/contracts/Repository/Events/Location/UpdateLocationEvent.php b/src/contracts/Repository/Events/Location/UpdateLocationEvent.php index 642073f96c..df6dcef0fd 100644 --- a/src/contracts/Repository/Events/Location/UpdateLocationEvent.php +++ b/src/contracts/Repository/Events/Location/UpdateLocationEvent.php @@ -14,14 +14,11 @@ final class UpdateLocationEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $updatedLocation; + private Location $updatedLocation; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\LocationUpdateStruct */ - private $locationUpdateStruct; + private LocationUpdateStruct $locationUpdateStruct; public function __construct( Location $updatedLocation, diff --git a/src/contracts/Repository/Events/Notification/BeforeCreateNotificationEvent.php b/src/contracts/Repository/Events/Notification/BeforeCreateNotificationEvent.php index 1b3827c413..5d6fcff99b 100644 --- a/src/contracts/Repository/Events/Notification/BeforeCreateNotificationEvent.php +++ b/src/contracts/Repository/Events/Notification/BeforeCreateNotificationEvent.php @@ -15,11 +15,9 @@ final class BeforeCreateNotificationEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Notification\CreateStruct */ - private $createStruct; + private CreateStruct $createStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\Notification\Notification|null */ - private $notification; + private ?Notification $notification = null; public function __construct(CreateStruct $createStruct) { diff --git a/src/contracts/Repository/Events/Notification/BeforeDeleteNotificationEvent.php b/src/contracts/Repository/Events/Notification/BeforeDeleteNotificationEvent.php index bec89d4137..a2d22f4f80 100644 --- a/src/contracts/Repository/Events/Notification/BeforeDeleteNotificationEvent.php +++ b/src/contracts/Repository/Events/Notification/BeforeDeleteNotificationEvent.php @@ -13,8 +13,7 @@ final class BeforeDeleteNotificationEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Notification\Notification */ - private $notification; + private Notification $notification; public function __construct(Notification $notification) { diff --git a/src/contracts/Repository/Events/Notification/BeforeMarkNotificationAsReadEvent.php b/src/contracts/Repository/Events/Notification/BeforeMarkNotificationAsReadEvent.php index 98cd8baf1f..2641376c14 100644 --- a/src/contracts/Repository/Events/Notification/BeforeMarkNotificationAsReadEvent.php +++ b/src/contracts/Repository/Events/Notification/BeforeMarkNotificationAsReadEvent.php @@ -13,8 +13,7 @@ final class BeforeMarkNotificationAsReadEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Notification\Notification */ - private $notification; + private Notification $notification; public function __construct(Notification $notification) { diff --git a/src/contracts/Repository/Events/Notification/CreateNotificationEvent.php b/src/contracts/Repository/Events/Notification/CreateNotificationEvent.php index a5c0294e04..46c1aa4a7f 100644 --- a/src/contracts/Repository/Events/Notification/CreateNotificationEvent.php +++ b/src/contracts/Repository/Events/Notification/CreateNotificationEvent.php @@ -14,11 +14,9 @@ final class CreateNotificationEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Notification\Notification */ - private $notification; + private Notification $notification; - /** @var \Ibexa\Contracts\Core\Repository\Values\Notification\CreateStruct */ - private $createStruct; + private CreateStruct $createStruct; public function __construct( Notification $notification, diff --git a/src/contracts/Repository/Events/Notification/DeleteNotificationEvent.php b/src/contracts/Repository/Events/Notification/DeleteNotificationEvent.php index 3c300612d7..63ca728092 100644 --- a/src/contracts/Repository/Events/Notification/DeleteNotificationEvent.php +++ b/src/contracts/Repository/Events/Notification/DeleteNotificationEvent.php @@ -13,8 +13,7 @@ final class DeleteNotificationEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Notification\Notification */ - private $notification; + private Notification $notification; public function __construct(Notification $notification) { diff --git a/src/contracts/Repository/Events/Notification/MarkNotificationAsReadEvent.php b/src/contracts/Repository/Events/Notification/MarkNotificationAsReadEvent.php index 1c45771144..0f74cdc60d 100644 --- a/src/contracts/Repository/Events/Notification/MarkNotificationAsReadEvent.php +++ b/src/contracts/Repository/Events/Notification/MarkNotificationAsReadEvent.php @@ -13,8 +13,7 @@ final class MarkNotificationAsReadEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Notification\Notification */ - private $notification; + private Notification $notification; public function __construct(Notification $notification) { diff --git a/src/contracts/Repository/Events/ObjectState/BeforeCreateObjectStateEvent.php b/src/contracts/Repository/Events/ObjectState/BeforeCreateObjectStateEvent.php index d0393f2163..258e67186d 100644 --- a/src/contracts/Repository/Events/ObjectState/BeforeCreateObjectStateEvent.php +++ b/src/contracts/Repository/Events/ObjectState/BeforeCreateObjectStateEvent.php @@ -16,14 +16,11 @@ final class BeforeCreateObjectStateEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup */ - private $objectStateGroup; + private ObjectStateGroup $objectStateGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateCreateStruct */ - private $objectStateCreateStruct; + private ObjectStateCreateStruct $objectStateCreateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState|null */ - private $objectState; + private ?ObjectState $objectState = null; public function __construct(ObjectStateGroup $objectStateGroup, ObjectStateCreateStruct $objectStateCreateStruct) { diff --git a/src/contracts/Repository/Events/ObjectState/BeforeCreateObjectStateGroupEvent.php b/src/contracts/Repository/Events/ObjectState/BeforeCreateObjectStateGroupEvent.php index 03965101ef..4efa0e7ded 100644 --- a/src/contracts/Repository/Events/ObjectState/BeforeCreateObjectStateGroupEvent.php +++ b/src/contracts/Repository/Events/ObjectState/BeforeCreateObjectStateGroupEvent.php @@ -15,11 +15,9 @@ final class BeforeCreateObjectStateGroupEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroupCreateStruct */ - private $objectStateGroupCreateStruct; + private ObjectStateGroupCreateStruct $objectStateGroupCreateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup|null */ - private $objectStateGroup; + private ?ObjectStateGroup $objectStateGroup = null; public function __construct(ObjectStateGroupCreateStruct $objectStateGroupCreateStruct) { diff --git a/src/contracts/Repository/Events/ObjectState/BeforeDeleteObjectStateEvent.php b/src/contracts/Repository/Events/ObjectState/BeforeDeleteObjectStateEvent.php index 719a8e60da..48fe94f3a2 100644 --- a/src/contracts/Repository/Events/ObjectState/BeforeDeleteObjectStateEvent.php +++ b/src/contracts/Repository/Events/ObjectState/BeforeDeleteObjectStateEvent.php @@ -13,8 +13,7 @@ final class BeforeDeleteObjectStateEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState */ - private $objectState; + private ObjectState $objectState; public function __construct(ObjectState $objectState) { diff --git a/src/contracts/Repository/Events/ObjectState/BeforeDeleteObjectStateGroupEvent.php b/src/contracts/Repository/Events/ObjectState/BeforeDeleteObjectStateGroupEvent.php index 25486cefa9..c24fae92f7 100644 --- a/src/contracts/Repository/Events/ObjectState/BeforeDeleteObjectStateGroupEvent.php +++ b/src/contracts/Repository/Events/ObjectState/BeforeDeleteObjectStateGroupEvent.php @@ -13,8 +13,7 @@ final class BeforeDeleteObjectStateGroupEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup */ - private $objectStateGroup; + private ObjectStateGroup $objectStateGroup; public function __construct(ObjectStateGroup $objectStateGroup) { diff --git a/src/contracts/Repository/Events/ObjectState/BeforeSetContentStateEvent.php b/src/contracts/Repository/Events/ObjectState/BeforeSetContentStateEvent.php index 42bc078d59..505a130ccc 100644 --- a/src/contracts/Repository/Events/ObjectState/BeforeSetContentStateEvent.php +++ b/src/contracts/Repository/Events/ObjectState/BeforeSetContentStateEvent.php @@ -15,14 +15,11 @@ final class BeforeSetContentStateEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup */ - private $objectStateGroup; + private ObjectStateGroup $objectStateGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState */ - private $objectState; + private ObjectState $objectState; public function __construct(ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup, ObjectState $objectState) { diff --git a/src/contracts/Repository/Events/ObjectState/BeforeSetPriorityOfObjectStateEvent.php b/src/contracts/Repository/Events/ObjectState/BeforeSetPriorityOfObjectStateEvent.php index d3c9cd3bad..4640399d05 100644 --- a/src/contracts/Repository/Events/ObjectState/BeforeSetPriorityOfObjectStateEvent.php +++ b/src/contracts/Repository/Events/ObjectState/BeforeSetPriorityOfObjectStateEvent.php @@ -13,8 +13,7 @@ final class BeforeSetPriorityOfObjectStateEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState */ - private $objectState; + private ObjectState $objectState; private $priority; diff --git a/src/contracts/Repository/Events/ObjectState/BeforeUpdateObjectStateEvent.php b/src/contracts/Repository/Events/ObjectState/BeforeUpdateObjectStateEvent.php index 3df199026c..248e75deb2 100644 --- a/src/contracts/Repository/Events/ObjectState/BeforeUpdateObjectStateEvent.php +++ b/src/contracts/Repository/Events/ObjectState/BeforeUpdateObjectStateEvent.php @@ -15,14 +15,11 @@ final class BeforeUpdateObjectStateEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState */ - private $objectState; + private ObjectState $objectState; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateUpdateStruct */ - private $objectStateUpdateStruct; + private ObjectStateUpdateStruct $objectStateUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState|null */ - private $updatedObjectState; + private ?ObjectState $updatedObjectState = null; public function __construct(ObjectState $objectState, ObjectStateUpdateStruct $objectStateUpdateStruct) { diff --git a/src/contracts/Repository/Events/ObjectState/BeforeUpdateObjectStateGroupEvent.php b/src/contracts/Repository/Events/ObjectState/BeforeUpdateObjectStateGroupEvent.php index f2411eac80..2d0835c218 100644 --- a/src/contracts/Repository/Events/ObjectState/BeforeUpdateObjectStateGroupEvent.php +++ b/src/contracts/Repository/Events/ObjectState/BeforeUpdateObjectStateGroupEvent.php @@ -15,14 +15,11 @@ final class BeforeUpdateObjectStateGroupEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup */ - private $objectStateGroup; + private ObjectStateGroup $objectStateGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroupUpdateStruct */ - private $objectStateGroupUpdateStruct; + private ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup|null */ - private $updatedObjectStateGroup; + private ?ObjectStateGroup $updatedObjectStateGroup = null; public function __construct(ObjectStateGroup $objectStateGroup, ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct) { diff --git a/src/contracts/Repository/Events/ObjectState/CreateObjectStateEvent.php b/src/contracts/Repository/Events/ObjectState/CreateObjectStateEvent.php index 80c9087190..6236675313 100644 --- a/src/contracts/Repository/Events/ObjectState/CreateObjectStateEvent.php +++ b/src/contracts/Repository/Events/ObjectState/CreateObjectStateEvent.php @@ -15,14 +15,11 @@ final class CreateObjectStateEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState */ - private $objectState; + private ObjectState $objectState; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup */ - private $objectStateGroup; + private ObjectStateGroup $objectStateGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateCreateStruct */ - private $objectStateCreateStruct; + private ObjectStateCreateStruct $objectStateCreateStruct; public function __construct( ObjectState $objectState, diff --git a/src/contracts/Repository/Events/ObjectState/CreateObjectStateGroupEvent.php b/src/contracts/Repository/Events/ObjectState/CreateObjectStateGroupEvent.php index e90555a34b..b9815b750b 100644 --- a/src/contracts/Repository/Events/ObjectState/CreateObjectStateGroupEvent.php +++ b/src/contracts/Repository/Events/ObjectState/CreateObjectStateGroupEvent.php @@ -14,11 +14,9 @@ final class CreateObjectStateGroupEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup */ - private $objectStateGroup; + private ObjectStateGroup $objectStateGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroupCreateStruct */ - private $objectStateGroupCreateStruct; + private ObjectStateGroupCreateStruct $objectStateGroupCreateStruct; public function __construct( ObjectStateGroup $objectStateGroup, diff --git a/src/contracts/Repository/Events/ObjectState/DeleteObjectStateEvent.php b/src/contracts/Repository/Events/ObjectState/DeleteObjectStateEvent.php index 469bdfa662..9f0ecaed6a 100644 --- a/src/contracts/Repository/Events/ObjectState/DeleteObjectStateEvent.php +++ b/src/contracts/Repository/Events/ObjectState/DeleteObjectStateEvent.php @@ -13,8 +13,7 @@ final class DeleteObjectStateEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState */ - private $objectState; + private ObjectState $objectState; public function __construct(ObjectState $objectState) { diff --git a/src/contracts/Repository/Events/ObjectState/DeleteObjectStateGroupEvent.php b/src/contracts/Repository/Events/ObjectState/DeleteObjectStateGroupEvent.php index 02b8994fdc..fc68106df3 100644 --- a/src/contracts/Repository/Events/ObjectState/DeleteObjectStateGroupEvent.php +++ b/src/contracts/Repository/Events/ObjectState/DeleteObjectStateGroupEvent.php @@ -13,8 +13,7 @@ final class DeleteObjectStateGroupEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup */ - private $objectStateGroup; + private ObjectStateGroup $objectStateGroup; public function __construct(ObjectStateGroup $objectStateGroup) { diff --git a/src/contracts/Repository/Events/ObjectState/SetContentStateEvent.php b/src/contracts/Repository/Events/ObjectState/SetContentStateEvent.php index f30e5dffc7..42c41ae19a 100644 --- a/src/contracts/Repository/Events/ObjectState/SetContentStateEvent.php +++ b/src/contracts/Repository/Events/ObjectState/SetContentStateEvent.php @@ -15,14 +15,11 @@ final class SetContentStateEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup */ - private $objectStateGroup; + private ObjectStateGroup $objectStateGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState */ - private $objectState; + private ObjectState $objectState; public function __construct( ContentInfo $contentInfo, diff --git a/src/contracts/Repository/Events/ObjectState/SetPriorityOfObjectStateEvent.php b/src/contracts/Repository/Events/ObjectState/SetPriorityOfObjectStateEvent.php index 78499fbee3..57c2ad829d 100644 --- a/src/contracts/Repository/Events/ObjectState/SetPriorityOfObjectStateEvent.php +++ b/src/contracts/Repository/Events/ObjectState/SetPriorityOfObjectStateEvent.php @@ -13,8 +13,7 @@ final class SetPriorityOfObjectStateEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState */ - private $objectState; + private ObjectState $objectState; private $priority; diff --git a/src/contracts/Repository/Events/ObjectState/UpdateObjectStateEvent.php b/src/contracts/Repository/Events/ObjectState/UpdateObjectStateEvent.php index d327ff383d..a2134be4ba 100644 --- a/src/contracts/Repository/Events/ObjectState/UpdateObjectStateEvent.php +++ b/src/contracts/Repository/Events/ObjectState/UpdateObjectStateEvent.php @@ -14,14 +14,11 @@ final class UpdateObjectStateEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState */ - private $updatedObjectState; + private ObjectState $updatedObjectState; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState */ - private $objectState; + private ObjectState $objectState; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateUpdateStruct */ - private $objectStateUpdateStruct; + private ObjectStateUpdateStruct $objectStateUpdateStruct; public function __construct( ObjectState $updatedObjectState, diff --git a/src/contracts/Repository/Events/ObjectState/UpdateObjectStateGroupEvent.php b/src/contracts/Repository/Events/ObjectState/UpdateObjectStateGroupEvent.php index 46ae8b3eca..cbfa4553e6 100644 --- a/src/contracts/Repository/Events/ObjectState/UpdateObjectStateGroupEvent.php +++ b/src/contracts/Repository/Events/ObjectState/UpdateObjectStateGroupEvent.php @@ -14,14 +14,11 @@ final class UpdateObjectStateGroupEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup */ - private $updatedObjectStateGroup; + private ObjectStateGroup $updatedObjectStateGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup */ - private $objectStateGroup; + private ObjectStateGroup $objectStateGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroupUpdateStruct */ - private $objectStateGroupUpdateStruct; + private ObjectStateGroupUpdateStruct $objectStateGroupUpdateStruct; public function __construct( ObjectStateGroup $updatedObjectStateGroup, diff --git a/src/contracts/Repository/Events/Role/AddPolicyByRoleDraftEvent.php b/src/contracts/Repository/Events/Role/AddPolicyByRoleDraftEvent.php index 24af78f65e..df94d9ea62 100644 --- a/src/contracts/Repository/Events/Role/AddPolicyByRoleDraftEvent.php +++ b/src/contracts/Repository/Events/Role/AddPolicyByRoleDraftEvent.php @@ -14,13 +14,11 @@ final class AddPolicyByRoleDraftEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - private $roleDraft; + private RoleDraft $roleDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\PolicyCreateStruct */ - private $policyCreateStruct; + private PolicyCreateStruct $policyCreateStruct; - private $updatedRoleDraft; + private RoleDraft $updatedRoleDraft; public function __construct( RoleDraft $updatedRoleDraft, diff --git a/src/contracts/Repository/Events/Role/AssignRoleToUserEvent.php b/src/contracts/Repository/Events/Role/AssignRoleToUserEvent.php index bfbb85861c..07610df0ff 100644 --- a/src/contracts/Repository/Events/Role/AssignRoleToUserEvent.php +++ b/src/contracts/Repository/Events/Role/AssignRoleToUserEvent.php @@ -15,14 +15,11 @@ final class AssignRoleToUserEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role */ - private $role; + private Role $role; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $user; + private User $user; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Limitation\RoleLimitation */ - private $roleLimitation; + private ?RoleLimitation $roleLimitation; public function __construct( Role $role, diff --git a/src/contracts/Repository/Events/Role/AssignRoleToUserGroupEvent.php b/src/contracts/Repository/Events/Role/AssignRoleToUserGroupEvent.php index 558caf61e3..cd6573cb1f 100644 --- a/src/contracts/Repository/Events/Role/AssignRoleToUserGroupEvent.php +++ b/src/contracts/Repository/Events/Role/AssignRoleToUserGroupEvent.php @@ -15,14 +15,11 @@ final class AssignRoleToUserGroupEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role */ - private $role; + private Role $role; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $userGroup; + private UserGroup $userGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Limitation\RoleLimitation */ - private $roleLimitation; + private ?RoleLimitation $roleLimitation; public function __construct( Role $role, diff --git a/src/contracts/Repository/Events/Role/BeforeAddPolicyByRoleDraftEvent.php b/src/contracts/Repository/Events/Role/BeforeAddPolicyByRoleDraftEvent.php index 2b2cf734d2..22d2423a0c 100644 --- a/src/contracts/Repository/Events/Role/BeforeAddPolicyByRoleDraftEvent.php +++ b/src/contracts/Repository/Events/Role/BeforeAddPolicyByRoleDraftEvent.php @@ -15,14 +15,11 @@ final class BeforeAddPolicyByRoleDraftEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - private $roleDraft; + private RoleDraft $roleDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\PolicyCreateStruct */ - private $policyCreateStruct; + private PolicyCreateStruct $policyCreateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft|null */ - private $updatedRoleDraft; + private ?RoleDraft $updatedRoleDraft = null; public function __construct(RoleDraft $roleDraft, PolicyCreateStruct $policyCreateStruct) { diff --git a/src/contracts/Repository/Events/Role/BeforeAssignRoleToUserEvent.php b/src/contracts/Repository/Events/Role/BeforeAssignRoleToUserEvent.php index 79e845cf98..eb204bd545 100644 --- a/src/contracts/Repository/Events/Role/BeforeAssignRoleToUserEvent.php +++ b/src/contracts/Repository/Events/Role/BeforeAssignRoleToUserEvent.php @@ -15,14 +15,11 @@ final class BeforeAssignRoleToUserEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role */ - private $role; + private Role $role; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $user; + private User $user; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Limitation\RoleLimitation */ - private $roleLimitation; + private ?RoleLimitation $roleLimitation; public function __construct(Role $role, User $user, ?RoleLimitation $roleLimitation = null) { diff --git a/src/contracts/Repository/Events/Role/BeforeAssignRoleToUserGroupEvent.php b/src/contracts/Repository/Events/Role/BeforeAssignRoleToUserGroupEvent.php index 6e3468cd96..f100d0789c 100644 --- a/src/contracts/Repository/Events/Role/BeforeAssignRoleToUserGroupEvent.php +++ b/src/contracts/Repository/Events/Role/BeforeAssignRoleToUserGroupEvent.php @@ -15,14 +15,11 @@ final class BeforeAssignRoleToUserGroupEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role */ - private $role; + private Role $role; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $userGroup; + private UserGroup $userGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Limitation\RoleLimitation */ - private $roleLimitation; + private ?RoleLimitation $roleLimitation; public function __construct(Role $role, UserGroup $userGroup, ?RoleLimitation $roleLimitation = null) { diff --git a/src/contracts/Repository/Events/Role/BeforeCopyRoleEvent.php b/src/contracts/Repository/Events/Role/BeforeCopyRoleEvent.php index 88112c8770..d527e709c0 100644 --- a/src/contracts/Repository/Events/Role/BeforeCopyRoleEvent.php +++ b/src/contracts/Repository/Events/Role/BeforeCopyRoleEvent.php @@ -15,14 +15,11 @@ final class BeforeCopyRoleEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role */ - private $role; + private Role $role; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleCopyStruct */ - private $roleCopyStruct; + private RoleCopyStruct $roleCopyStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role|null */ - private $copiedRole; + private ?Role $copiedRole = null; public function __construct(Role $role, RoleCopyStruct $roleCopyStruct) { diff --git a/src/contracts/Repository/Events/Role/BeforeCreateRoleDraftEvent.php b/src/contracts/Repository/Events/Role/BeforeCreateRoleDraftEvent.php index 831b32ba30..a47457055c 100644 --- a/src/contracts/Repository/Events/Role/BeforeCreateRoleDraftEvent.php +++ b/src/contracts/Repository/Events/Role/BeforeCreateRoleDraftEvent.php @@ -15,11 +15,9 @@ final class BeforeCreateRoleDraftEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role */ - private $role; + private Role $role; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft|null */ - private $roleDraft; + private ?RoleDraft $roleDraft = null; public function __construct(Role $role) { diff --git a/src/contracts/Repository/Events/Role/BeforeCreateRoleEvent.php b/src/contracts/Repository/Events/Role/BeforeCreateRoleEvent.php index 76953db37b..1a8168e949 100644 --- a/src/contracts/Repository/Events/Role/BeforeCreateRoleEvent.php +++ b/src/contracts/Repository/Events/Role/BeforeCreateRoleEvent.php @@ -15,11 +15,9 @@ final class BeforeCreateRoleEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleCreateStruct */ - private $roleCreateStruct; + private RoleCreateStruct $roleCreateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft|null */ - private $roleDraft; + private ?RoleDraft $roleDraft = null; public function __construct(RoleCreateStruct $roleCreateStruct) { diff --git a/src/contracts/Repository/Events/Role/BeforeDeletePolicyEvent.php b/src/contracts/Repository/Events/Role/BeforeDeletePolicyEvent.php index 3e4e8089f4..184db86875 100644 --- a/src/contracts/Repository/Events/Role/BeforeDeletePolicyEvent.php +++ b/src/contracts/Repository/Events/Role/BeforeDeletePolicyEvent.php @@ -13,8 +13,7 @@ final class BeforeDeletePolicyEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Policy */ - private $policy; + private Policy $policy; public function __construct(Policy $policy) { diff --git a/src/contracts/Repository/Events/Role/BeforeDeleteRoleDraftEvent.php b/src/contracts/Repository/Events/Role/BeforeDeleteRoleDraftEvent.php index 9e979aa701..aac19bc60f 100644 --- a/src/contracts/Repository/Events/Role/BeforeDeleteRoleDraftEvent.php +++ b/src/contracts/Repository/Events/Role/BeforeDeleteRoleDraftEvent.php @@ -13,8 +13,7 @@ final class BeforeDeleteRoleDraftEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - private $roleDraft; + private RoleDraft $roleDraft; public function __construct(RoleDraft $roleDraft) { diff --git a/src/contracts/Repository/Events/Role/BeforeDeleteRoleEvent.php b/src/contracts/Repository/Events/Role/BeforeDeleteRoleEvent.php index 4509d9a224..c5e3d3a90e 100644 --- a/src/contracts/Repository/Events/Role/BeforeDeleteRoleEvent.php +++ b/src/contracts/Repository/Events/Role/BeforeDeleteRoleEvent.php @@ -13,8 +13,7 @@ final class BeforeDeleteRoleEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role */ - private $role; + private Role $role; public function __construct(Role $role) { diff --git a/src/contracts/Repository/Events/Role/BeforePublishRoleDraftEvent.php b/src/contracts/Repository/Events/Role/BeforePublishRoleDraftEvent.php index 9c497b9314..183f4a6eca 100644 --- a/src/contracts/Repository/Events/Role/BeforePublishRoleDraftEvent.php +++ b/src/contracts/Repository/Events/Role/BeforePublishRoleDraftEvent.php @@ -13,8 +13,7 @@ final class BeforePublishRoleDraftEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - private $roleDraft; + private RoleDraft $roleDraft; public function __construct(RoleDraft $roleDraft) { diff --git a/src/contracts/Repository/Events/Role/BeforeRemovePolicyByRoleDraftEvent.php b/src/contracts/Repository/Events/Role/BeforeRemovePolicyByRoleDraftEvent.php index 2c1cb6dbbc..b5eba1e2f2 100644 --- a/src/contracts/Repository/Events/Role/BeforeRemovePolicyByRoleDraftEvent.php +++ b/src/contracts/Repository/Events/Role/BeforeRemovePolicyByRoleDraftEvent.php @@ -15,14 +15,11 @@ final class BeforeRemovePolicyByRoleDraftEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - private $roleDraft; + private RoleDraft $roleDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\PolicyDraft */ - private $policyDraft; + private PolicyDraft $policyDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft|null */ - private $updatedRoleDraft; + private ?RoleDraft $updatedRoleDraft = null; public function __construct(RoleDraft $roleDraft, PolicyDraft $policyDraft) { diff --git a/src/contracts/Repository/Events/Role/BeforeRemoveRoleAssignmentEvent.php b/src/contracts/Repository/Events/Role/BeforeRemoveRoleAssignmentEvent.php index 36e4ccc8db..de1cf9f245 100644 --- a/src/contracts/Repository/Events/Role/BeforeRemoveRoleAssignmentEvent.php +++ b/src/contracts/Repository/Events/Role/BeforeRemoveRoleAssignmentEvent.php @@ -13,8 +13,7 @@ final class BeforeRemoveRoleAssignmentEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment */ - private $roleAssignment; + private RoleAssignment $roleAssignment; public function __construct(RoleAssignment $roleAssignment) { diff --git a/src/contracts/Repository/Events/Role/BeforeUpdatePolicyByRoleDraftEvent.php b/src/contracts/Repository/Events/Role/BeforeUpdatePolicyByRoleDraftEvent.php index f1a56118d7..379ea5dd09 100644 --- a/src/contracts/Repository/Events/Role/BeforeUpdatePolicyByRoleDraftEvent.php +++ b/src/contracts/Repository/Events/Role/BeforeUpdatePolicyByRoleDraftEvent.php @@ -16,17 +16,13 @@ final class BeforeUpdatePolicyByRoleDraftEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - private $roleDraft; + private RoleDraft $roleDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\PolicyDraft */ - private $policy; + private PolicyDraft $policy; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\PolicyUpdateStruct */ - private $policyUpdateStruct; + private PolicyUpdateStruct $policyUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\PolicyDraft|null */ - private $updatedPolicyDraft; + private ?PolicyDraft $updatedPolicyDraft = null; public function __construct(RoleDraft $roleDraft, PolicyDraft $policy, PolicyUpdateStruct $policyUpdateStruct) { diff --git a/src/contracts/Repository/Events/Role/BeforeUpdateRoleDraftEvent.php b/src/contracts/Repository/Events/Role/BeforeUpdateRoleDraftEvent.php index f9fad19f97..5f1558e33f 100644 --- a/src/contracts/Repository/Events/Role/BeforeUpdateRoleDraftEvent.php +++ b/src/contracts/Repository/Events/Role/BeforeUpdateRoleDraftEvent.php @@ -15,14 +15,11 @@ final class BeforeUpdateRoleDraftEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - private $roleDraft; + private RoleDraft $roleDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleUpdateStruct */ - private $roleUpdateStruct; + private RoleUpdateStruct $roleUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft|null */ - private $updatedRoleDraft; + private ?RoleDraft $updatedRoleDraft = null; public function __construct(RoleDraft $roleDraft, RoleUpdateStruct $roleUpdateStruct) { diff --git a/src/contracts/Repository/Events/Role/CopyRoleEvent.php b/src/contracts/Repository/Events/Role/CopyRoleEvent.php index 402bead5e3..46c03c8147 100644 --- a/src/contracts/Repository/Events/Role/CopyRoleEvent.php +++ b/src/contracts/Repository/Events/Role/CopyRoleEvent.php @@ -14,14 +14,11 @@ final class CopyRoleEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role */ - private $copiedRole; + private Role $copiedRole; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role */ - private $role; + private Role $role; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleCopyStruct */ - private $roleCopyStruct; + private RoleCopyStruct $roleCopyStruct; public function __construct( Role $copiedRole, diff --git a/src/contracts/Repository/Events/Role/CreateRoleDraftEvent.php b/src/contracts/Repository/Events/Role/CreateRoleDraftEvent.php index 1a6877641a..48186bf8d2 100644 --- a/src/contracts/Repository/Events/Role/CreateRoleDraftEvent.php +++ b/src/contracts/Repository/Events/Role/CreateRoleDraftEvent.php @@ -14,11 +14,9 @@ final class CreateRoleDraftEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role */ - private $role; + private Role $role; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - private $roleDraft; + private RoleDraft $roleDraft; public function __construct( RoleDraft $roleDraft, diff --git a/src/contracts/Repository/Events/Role/CreateRoleEvent.php b/src/contracts/Repository/Events/Role/CreateRoleEvent.php index 4a806578a2..4fcdc2f1bb 100644 --- a/src/contracts/Repository/Events/Role/CreateRoleEvent.php +++ b/src/contracts/Repository/Events/Role/CreateRoleEvent.php @@ -14,11 +14,9 @@ final class CreateRoleEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleCreateStruct */ - private $roleCreateStruct; + private RoleCreateStruct $roleCreateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - private $roleDraft; + private RoleDraft $roleDraft; public function __construct( RoleDraft $roleDraft, diff --git a/src/contracts/Repository/Events/Role/DeletePolicyEvent.php b/src/contracts/Repository/Events/Role/DeletePolicyEvent.php index b1511f288c..097823cd35 100644 --- a/src/contracts/Repository/Events/Role/DeletePolicyEvent.php +++ b/src/contracts/Repository/Events/Role/DeletePolicyEvent.php @@ -13,8 +13,7 @@ final class DeletePolicyEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Policy */ - private $policy; + private Policy $policy; public function __construct( Policy $policy diff --git a/src/contracts/Repository/Events/Role/DeleteRoleDraftEvent.php b/src/contracts/Repository/Events/Role/DeleteRoleDraftEvent.php index f3b5d420bc..52cc28b401 100644 --- a/src/contracts/Repository/Events/Role/DeleteRoleDraftEvent.php +++ b/src/contracts/Repository/Events/Role/DeleteRoleDraftEvent.php @@ -13,8 +13,7 @@ final class DeleteRoleDraftEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - private $roleDraft; + private RoleDraft $roleDraft; public function __construct( RoleDraft $roleDraft diff --git a/src/contracts/Repository/Events/Role/DeleteRoleEvent.php b/src/contracts/Repository/Events/Role/DeleteRoleEvent.php index 153f0c862a..0278ab2a14 100644 --- a/src/contracts/Repository/Events/Role/DeleteRoleEvent.php +++ b/src/contracts/Repository/Events/Role/DeleteRoleEvent.php @@ -13,8 +13,7 @@ final class DeleteRoleEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role */ - private $role; + private Role $role; public function __construct( Role $role diff --git a/src/contracts/Repository/Events/Role/PublishRoleDraftEvent.php b/src/contracts/Repository/Events/Role/PublishRoleDraftEvent.php index 32388b589f..808e683f5f 100644 --- a/src/contracts/Repository/Events/Role/PublishRoleDraftEvent.php +++ b/src/contracts/Repository/Events/Role/PublishRoleDraftEvent.php @@ -13,8 +13,7 @@ final class PublishRoleDraftEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - private $roleDraft; + private RoleDraft $roleDraft; public function __construct( RoleDraft $roleDraft diff --git a/src/contracts/Repository/Events/Role/RemovePolicyByRoleDraftEvent.php b/src/contracts/Repository/Events/Role/RemovePolicyByRoleDraftEvent.php index 07e713e060..ac3c407896 100644 --- a/src/contracts/Repository/Events/Role/RemovePolicyByRoleDraftEvent.php +++ b/src/contracts/Repository/Events/Role/RemovePolicyByRoleDraftEvent.php @@ -14,14 +14,11 @@ final class RemovePolicyByRoleDraftEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - private $roleDraft; + private RoleDraft $roleDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\PolicyDraft */ - private $policyDraft; + private PolicyDraft $policyDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - private $updatedRoleDraft; + private RoleDraft $updatedRoleDraft; public function __construct( RoleDraft $updatedRoleDraft, diff --git a/src/contracts/Repository/Events/Role/RemoveRoleAssignmentEvent.php b/src/contracts/Repository/Events/Role/RemoveRoleAssignmentEvent.php index 5278c115d7..f111d530d4 100644 --- a/src/contracts/Repository/Events/Role/RemoveRoleAssignmentEvent.php +++ b/src/contracts/Repository/Events/Role/RemoveRoleAssignmentEvent.php @@ -13,8 +13,7 @@ final class RemoveRoleAssignmentEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment */ - private $roleAssignment; + private RoleAssignment $roleAssignment; public function __construct( RoleAssignment $roleAssignment diff --git a/src/contracts/Repository/Events/Role/UpdatePolicyByRoleDraftEvent.php b/src/contracts/Repository/Events/Role/UpdatePolicyByRoleDraftEvent.php index a624899877..2ffdd7d39d 100644 --- a/src/contracts/Repository/Events/Role/UpdatePolicyByRoleDraftEvent.php +++ b/src/contracts/Repository/Events/Role/UpdatePolicyByRoleDraftEvent.php @@ -15,17 +15,13 @@ final class UpdatePolicyByRoleDraftEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - private $roleDraft; + private RoleDraft $roleDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\PolicyDraft */ - private $policy; + private PolicyDraft $policy; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\PolicyUpdateStruct */ - private $policyUpdateStruct; + private PolicyUpdateStruct $policyUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\PolicyDraft */ - private $updatedPolicyDraft; + private PolicyDraft $updatedPolicyDraft; public function __construct( PolicyDraft $updatedPolicyDraft, diff --git a/src/contracts/Repository/Events/Role/UpdateRoleDraftEvent.php b/src/contracts/Repository/Events/Role/UpdateRoleDraftEvent.php index 0f2a5ab3a1..930f50a4a6 100644 --- a/src/contracts/Repository/Events/Role/UpdateRoleDraftEvent.php +++ b/src/contracts/Repository/Events/Role/UpdateRoleDraftEvent.php @@ -14,14 +14,11 @@ final class UpdateRoleDraftEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - private $roleDraft; + private RoleDraft $roleDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleUpdateStruct */ - private $roleUpdateStruct; + private RoleUpdateStruct $roleUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - private $updatedRoleDraft; + private RoleDraft $updatedRoleDraft; public function __construct( RoleDraft $updatedRoleDraft, diff --git a/src/contracts/Repository/Events/Section/AssignSectionEvent.php b/src/contracts/Repository/Events/Section/AssignSectionEvent.php index 8a695fc10a..7528fde171 100644 --- a/src/contracts/Repository/Events/Section/AssignSectionEvent.php +++ b/src/contracts/Repository/Events/Section/AssignSectionEvent.php @@ -14,11 +14,9 @@ final class AssignSectionEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section */ - private $section; + private Section $section; public function __construct( ContentInfo $contentInfo, diff --git a/src/contracts/Repository/Events/Section/AssignSectionToSubtreeEvent.php b/src/contracts/Repository/Events/Section/AssignSectionToSubtreeEvent.php index d717259819..8bf089e990 100644 --- a/src/contracts/Repository/Events/Section/AssignSectionToSubtreeEvent.php +++ b/src/contracts/Repository/Events/Section/AssignSectionToSubtreeEvent.php @@ -14,11 +14,9 @@ final class AssignSectionToSubtreeEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section */ - private $section; + private Section $section; public function __construct( Location $location, diff --git a/src/contracts/Repository/Events/Section/BeforeAssignSectionEvent.php b/src/contracts/Repository/Events/Section/BeforeAssignSectionEvent.php index a2ae2f3863..96dbb90ce1 100644 --- a/src/contracts/Repository/Events/Section/BeforeAssignSectionEvent.php +++ b/src/contracts/Repository/Events/Section/BeforeAssignSectionEvent.php @@ -14,11 +14,9 @@ final class BeforeAssignSectionEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - private $contentInfo; + private ContentInfo $contentInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section */ - private $section; + private Section $section; public function __construct(ContentInfo $contentInfo, Section $section) { diff --git a/src/contracts/Repository/Events/Section/BeforeAssignSectionToSubtreeEvent.php b/src/contracts/Repository/Events/Section/BeforeAssignSectionToSubtreeEvent.php index a5b06848ef..192e139e90 100644 --- a/src/contracts/Repository/Events/Section/BeforeAssignSectionToSubtreeEvent.php +++ b/src/contracts/Repository/Events/Section/BeforeAssignSectionToSubtreeEvent.php @@ -14,11 +14,9 @@ final class BeforeAssignSectionToSubtreeEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section */ - private $section; + private Section $section; public function __construct(Location $location, Section $section) { diff --git a/src/contracts/Repository/Events/Section/BeforeCreateSectionEvent.php b/src/contracts/Repository/Events/Section/BeforeCreateSectionEvent.php index 4b2208095e..f3418d245d 100644 --- a/src/contracts/Repository/Events/Section/BeforeCreateSectionEvent.php +++ b/src/contracts/Repository/Events/Section/BeforeCreateSectionEvent.php @@ -15,11 +15,9 @@ final class BeforeCreateSectionEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\SectionCreateStruct */ - private $sectionCreateStruct; + private SectionCreateStruct $sectionCreateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section|null */ - private $section; + private ?Section $section = null; public function __construct(SectionCreateStruct $sectionCreateStruct) { diff --git a/src/contracts/Repository/Events/Section/BeforeDeleteSectionEvent.php b/src/contracts/Repository/Events/Section/BeforeDeleteSectionEvent.php index 5caf4732fa..50d7aa73b6 100644 --- a/src/contracts/Repository/Events/Section/BeforeDeleteSectionEvent.php +++ b/src/contracts/Repository/Events/Section/BeforeDeleteSectionEvent.php @@ -13,8 +13,7 @@ final class BeforeDeleteSectionEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section */ - private $section; + private Section $section; public function __construct(Section $section) { diff --git a/src/contracts/Repository/Events/Section/BeforeUpdateSectionEvent.php b/src/contracts/Repository/Events/Section/BeforeUpdateSectionEvent.php index 9c800aee06..231d6ddc3d 100644 --- a/src/contracts/Repository/Events/Section/BeforeUpdateSectionEvent.php +++ b/src/contracts/Repository/Events/Section/BeforeUpdateSectionEvent.php @@ -15,14 +15,11 @@ final class BeforeUpdateSectionEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section */ - private $section; + private Section $section; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\SectionUpdateStruct */ - private $sectionUpdateStruct; + private SectionUpdateStruct $sectionUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section|null */ - private $updatedSection; + private ?Section $updatedSection = null; public function __construct(Section $section, SectionUpdateStruct $sectionUpdateStruct) { diff --git a/src/contracts/Repository/Events/Section/CreateSectionEvent.php b/src/contracts/Repository/Events/Section/CreateSectionEvent.php index 8528a0b363..fe4a9845c3 100644 --- a/src/contracts/Repository/Events/Section/CreateSectionEvent.php +++ b/src/contracts/Repository/Events/Section/CreateSectionEvent.php @@ -14,11 +14,9 @@ final class CreateSectionEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\SectionCreateStruct */ - private $sectionCreateStruct; + private SectionCreateStruct $sectionCreateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section */ - private $section; + private Section $section; public function __construct( Section $section, diff --git a/src/contracts/Repository/Events/Section/DeleteSectionEvent.php b/src/contracts/Repository/Events/Section/DeleteSectionEvent.php index 881d512d23..026ab50d0f 100644 --- a/src/contracts/Repository/Events/Section/DeleteSectionEvent.php +++ b/src/contracts/Repository/Events/Section/DeleteSectionEvent.php @@ -13,8 +13,7 @@ final class DeleteSectionEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section */ - private $section; + private Section $section; public function __construct( Section $section diff --git a/src/contracts/Repository/Events/Section/UpdateSectionEvent.php b/src/contracts/Repository/Events/Section/UpdateSectionEvent.php index 0360bd61ed..c686008377 100644 --- a/src/contracts/Repository/Events/Section/UpdateSectionEvent.php +++ b/src/contracts/Repository/Events/Section/UpdateSectionEvent.php @@ -14,14 +14,11 @@ final class UpdateSectionEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section */ - private $section; + private Section $section; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\SectionUpdateStruct */ - private $sectionUpdateStruct; + private SectionUpdateStruct $sectionUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section */ - private $updatedSection; + private Section $updatedSection; public function __construct( Section $updatedSection, diff --git a/src/contracts/Repository/Events/Setting/BeforeCreateSettingEvent.php b/src/contracts/Repository/Events/Setting/BeforeCreateSettingEvent.php index da4d4f99c1..f2cf2f12e3 100644 --- a/src/contracts/Repository/Events/Setting/BeforeCreateSettingEvent.php +++ b/src/contracts/Repository/Events/Setting/BeforeCreateSettingEvent.php @@ -15,11 +15,9 @@ final class BeforeCreateSettingEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Setting\SettingCreateStruct */ - private $settingCreateStruct; + private SettingCreateStruct $settingCreateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\Setting\Setting|null */ - private $setting; + private ?Setting $setting = null; public function __construct(SettingCreateStruct $settingCreateStruct) { diff --git a/src/contracts/Repository/Events/Setting/BeforeDeleteSettingEvent.php b/src/contracts/Repository/Events/Setting/BeforeDeleteSettingEvent.php index a63f1b5bd2..bf41ee1f3b 100644 --- a/src/contracts/Repository/Events/Setting/BeforeDeleteSettingEvent.php +++ b/src/contracts/Repository/Events/Setting/BeforeDeleteSettingEvent.php @@ -13,8 +13,7 @@ final class BeforeDeleteSettingEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Setting\Setting */ - private $setting; + private Setting $setting; public function __construct(Setting $setting) { diff --git a/src/contracts/Repository/Events/Setting/BeforeUpdateSettingEvent.php b/src/contracts/Repository/Events/Setting/BeforeUpdateSettingEvent.php index 9d4dcbc519..56b40f9a9e 100644 --- a/src/contracts/Repository/Events/Setting/BeforeUpdateSettingEvent.php +++ b/src/contracts/Repository/Events/Setting/BeforeUpdateSettingEvent.php @@ -15,14 +15,11 @@ final class BeforeUpdateSettingEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Setting\Setting */ - private $setting; + private Setting $setting; - /** @var \Ibexa\Contracts\Core\Repository\Values\Setting\SettingUpdateStruct */ - private $settingUpdateStruct; + private SettingUpdateStruct $settingUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\Setting\Setting|null */ - private $updatedSetting; + private ?Setting $updatedSetting = null; public function __construct(Setting $setting, SettingUpdateStruct $settingUpdateStruct) { diff --git a/src/contracts/Repository/Events/Setting/CreateSettingEvent.php b/src/contracts/Repository/Events/Setting/CreateSettingEvent.php index ef418dc1bc..4fe91cda6a 100644 --- a/src/contracts/Repository/Events/Setting/CreateSettingEvent.php +++ b/src/contracts/Repository/Events/Setting/CreateSettingEvent.php @@ -14,11 +14,9 @@ final class CreateSettingEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Setting\Setting */ - private $setting; + private Setting $setting; - /** @var \Ibexa\Contracts\Core\Repository\Values\Setting\SettingCreateStruct */ - private $settingCreateStruct; + private SettingCreateStruct $settingCreateStruct; public function __construct( Setting $setting, diff --git a/src/contracts/Repository/Events/Setting/DeleteSettingEvent.php b/src/contracts/Repository/Events/Setting/DeleteSettingEvent.php index e1c09c27f7..3cd3b8086a 100644 --- a/src/contracts/Repository/Events/Setting/DeleteSettingEvent.php +++ b/src/contracts/Repository/Events/Setting/DeleteSettingEvent.php @@ -13,8 +13,7 @@ final class DeleteSettingEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Setting\Setting */ - private $setting; + private Setting $setting; public function __construct(Setting $setting) { diff --git a/src/contracts/Repository/Events/Setting/UpdateSettingEvent.php b/src/contracts/Repository/Events/Setting/UpdateSettingEvent.php index f094a322ce..50245bc0a4 100644 --- a/src/contracts/Repository/Events/Setting/UpdateSettingEvent.php +++ b/src/contracts/Repository/Events/Setting/UpdateSettingEvent.php @@ -14,14 +14,11 @@ final class UpdateSettingEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Setting\Setting */ - private $updatedSetting; + private Setting $updatedSetting; - /** @var \Ibexa\Contracts\Core\Repository\Values\Setting\Setting */ - private $setting; + private Setting $setting; - /** @var \Ibexa\Contracts\Core\Repository\Values\Setting\SettingUpdateStruct */ - private $settingUpdateStruct; + private SettingUpdateStruct $settingUpdateStruct; public function __construct( Setting $updatedSetting, diff --git a/src/contracts/Repository/Events/Trash/BeforeDeleteTrashItemEvent.php b/src/contracts/Repository/Events/Trash/BeforeDeleteTrashItemEvent.php index a8c4775cc5..b68d71574e 100644 --- a/src/contracts/Repository/Events/Trash/BeforeDeleteTrashItemEvent.php +++ b/src/contracts/Repository/Events/Trash/BeforeDeleteTrashItemEvent.php @@ -15,11 +15,9 @@ final class BeforeDeleteTrashItemEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem */ - private $trashItem; + private TrashItem $trashItem; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Trash\TrashItemDeleteResult|null */ - private $result; + private ?TrashItemDeleteResult $result = null; public function __construct(TrashItem $trashItem) { diff --git a/src/contracts/Repository/Events/Trash/BeforeEmptyTrashEvent.php b/src/contracts/Repository/Events/Trash/BeforeEmptyTrashEvent.php index fb6741860c..9312d58ed1 100644 --- a/src/contracts/Repository/Events/Trash/BeforeEmptyTrashEvent.php +++ b/src/contracts/Repository/Events/Trash/BeforeEmptyTrashEvent.php @@ -14,8 +14,7 @@ final class BeforeEmptyTrashEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Trash\TrashItemDeleteResultList|null */ - private $resultList; + private ?TrashItemDeleteResultList $resultList = null; public function __construct() { diff --git a/src/contracts/Repository/Events/Trash/BeforeRecoverEvent.php b/src/contracts/Repository/Events/Trash/BeforeRecoverEvent.php index 1ac9dcd8e1..aaf1d95e35 100644 --- a/src/contracts/Repository/Events/Trash/BeforeRecoverEvent.php +++ b/src/contracts/Repository/Events/Trash/BeforeRecoverEvent.php @@ -15,14 +15,11 @@ final class BeforeRecoverEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem */ - private $trashItem; + private TrashItem $trashItem; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $newParentLocation; + private ?Location $newParentLocation; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ - private $location; + private ?Location $location = null; public function __construct(TrashItem $trashItem, ?Location $newParentLocation = null) { diff --git a/src/contracts/Repository/Events/Trash/BeforeTrashEvent.php b/src/contracts/Repository/Events/Trash/BeforeTrashEvent.php index d952e1ac42..6d57a4a809 100644 --- a/src/contracts/Repository/Events/Trash/BeforeTrashEvent.php +++ b/src/contracts/Repository/Events/Trash/BeforeTrashEvent.php @@ -15,14 +15,11 @@ final class BeforeTrashEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem|null */ - private $result; + private ?TrashItem $result = null; - /** @var bool */ - private $resultSet = false; + private bool $resultSet = false; public function __construct(Location $location) { diff --git a/src/contracts/Repository/Events/Trash/DeleteTrashItemEvent.php b/src/contracts/Repository/Events/Trash/DeleteTrashItemEvent.php index 0015fd9250..68c61052b2 100644 --- a/src/contracts/Repository/Events/Trash/DeleteTrashItemEvent.php +++ b/src/contracts/Repository/Events/Trash/DeleteTrashItemEvent.php @@ -14,11 +14,9 @@ final class DeleteTrashItemEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem */ - private $trashItem; + private TrashItem $trashItem; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Trash\TrashItemDeleteResult */ - private $result; + private TrashItemDeleteResult $result; public function __construct( TrashItemDeleteResult $result, diff --git a/src/contracts/Repository/Events/Trash/EmptyTrashEvent.php b/src/contracts/Repository/Events/Trash/EmptyTrashEvent.php index 92db321e86..164a2e2735 100644 --- a/src/contracts/Repository/Events/Trash/EmptyTrashEvent.php +++ b/src/contracts/Repository/Events/Trash/EmptyTrashEvent.php @@ -13,8 +13,7 @@ final class EmptyTrashEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Trash\TrashItemDeleteResultList */ - private $resultList; + private TrashItemDeleteResultList $resultList; public function __construct(TrashItemDeleteResultList $resultList) { diff --git a/src/contracts/Repository/Events/Trash/RecoverEvent.php b/src/contracts/Repository/Events/Trash/RecoverEvent.php index 55d47df63f..11bf51629d 100644 --- a/src/contracts/Repository/Events/Trash/RecoverEvent.php +++ b/src/contracts/Repository/Events/Trash/RecoverEvent.php @@ -14,14 +14,11 @@ final class RecoverEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem */ - private $trashItem; + private TrashItem $trashItem; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $newParentLocation; + private ?Location $newParentLocation; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; public function __construct( Location $location, diff --git a/src/contracts/Repository/Events/Trash/TrashEvent.php b/src/contracts/Repository/Events/Trash/TrashEvent.php index 50503e9bd2..69dd31f641 100644 --- a/src/contracts/Repository/Events/Trash/TrashEvent.php +++ b/src/contracts/Repository/Events/Trash/TrashEvent.php @@ -14,11 +14,9 @@ final class TrashEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem|null */ - private $trashItem; + private ?TrashItem $trashItem; public function __construct( ?TrashItem $trashItem, diff --git a/src/contracts/Repository/Events/URL/BeforeUpdateUrlEvent.php b/src/contracts/Repository/Events/URL/BeforeUpdateUrlEvent.php index 5f534a28dd..f1ea0939eb 100644 --- a/src/contracts/Repository/Events/URL/BeforeUpdateUrlEvent.php +++ b/src/contracts/Repository/Events/URL/BeforeUpdateUrlEvent.php @@ -15,14 +15,11 @@ final class BeforeUpdateUrlEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\URL\URL */ - private $url; + private URL $url; - /** @var \Ibexa\Contracts\Core\Repository\Values\URL\URLUpdateStruct */ - private $struct; + private URLUpdateStruct $struct; - /** @var \Ibexa\Contracts\Core\Repository\Values\URL\URL|null */ - private $updatedUrl; + private ?URL $updatedUrl = null; public function __construct(URL $url, URLUpdateStruct $struct) { diff --git a/src/contracts/Repository/Events/URL/UpdateUrlEvent.php b/src/contracts/Repository/Events/URL/UpdateUrlEvent.php index 56e123893b..7dec66f271 100644 --- a/src/contracts/Repository/Events/URL/UpdateUrlEvent.php +++ b/src/contracts/Repository/Events/URL/UpdateUrlEvent.php @@ -14,14 +14,11 @@ final class UpdateUrlEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\URL\URL */ - private $url; + private URL $url; - /** @var \Ibexa\Contracts\Core\Repository\Values\URL\URLUpdateStruct */ - private $struct; + private URLUpdateStruct $struct; - /** @var \Ibexa\Contracts\Core\Repository\Values\URL\URL */ - private $updatedUrl; + private URL $updatedUrl; public function __construct( URL $updatedUrl, diff --git a/src/contracts/Repository/Events/URLAlias/BeforeCreateGlobalUrlAliasEvent.php b/src/contracts/Repository/Events/URLAlias/BeforeCreateGlobalUrlAliasEvent.php index ff4eef4428..eab2b83021 100644 --- a/src/contracts/Repository/Events/URLAlias/BeforeCreateGlobalUrlAliasEvent.php +++ b/src/contracts/Repository/Events/URLAlias/BeforeCreateGlobalUrlAliasEvent.php @@ -24,8 +24,7 @@ final class BeforeCreateGlobalUrlAliasEvent extends BeforeEvent private $alwaysAvailable; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLAlias|null */ - private $urlAlias; + private ?URLAlias $urlAlias = null; public function __construct($resource, $path, $languageCode, $forwarding, $alwaysAvailable) { diff --git a/src/contracts/Repository/Events/URLAlias/BeforeCreateUrlAliasEvent.php b/src/contracts/Repository/Events/URLAlias/BeforeCreateUrlAliasEvent.php index a9b7135bb1..4f5f055ce9 100644 --- a/src/contracts/Repository/Events/URLAlias/BeforeCreateUrlAliasEvent.php +++ b/src/contracts/Repository/Events/URLAlias/BeforeCreateUrlAliasEvent.php @@ -15,8 +15,7 @@ final class BeforeCreateUrlAliasEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; private $path; @@ -26,8 +25,7 @@ final class BeforeCreateUrlAliasEvent extends BeforeEvent private $alwaysAvailable; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLAlias|null */ - private $urlAlias; + private ?URLAlias $urlAlias = null; public function __construct(Location $location, $path, $languageCode, $forwarding, $alwaysAvailable) { diff --git a/src/contracts/Repository/Events/URLAlias/BeforeRefreshSystemUrlAliasesForLocationEvent.php b/src/contracts/Repository/Events/URLAlias/BeforeRefreshSystemUrlAliasesForLocationEvent.php index a5124320ad..afcccec73b 100644 --- a/src/contracts/Repository/Events/URLAlias/BeforeRefreshSystemUrlAliasesForLocationEvent.php +++ b/src/contracts/Repository/Events/URLAlias/BeforeRefreshSystemUrlAliasesForLocationEvent.php @@ -13,8 +13,7 @@ final class BeforeRefreshSystemUrlAliasesForLocationEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; public function __construct(Location $location) { diff --git a/src/contracts/Repository/Events/URLAlias/BeforeRemoveAliasesEvent.php b/src/contracts/Repository/Events/URLAlias/BeforeRemoveAliasesEvent.php index 1a09d8a321..c34d951c54 100644 --- a/src/contracts/Repository/Events/URLAlias/BeforeRemoveAliasesEvent.php +++ b/src/contracts/Repository/Events/URLAlias/BeforeRemoveAliasesEvent.php @@ -12,8 +12,7 @@ final class BeforeRemoveAliasesEvent extends BeforeEvent { - /** @var array */ - private $aliasList; + private array $aliasList; public function __construct(array $aliasList) { diff --git a/src/contracts/Repository/Events/URLAlias/CreateGlobalUrlAliasEvent.php b/src/contracts/Repository/Events/URLAlias/CreateGlobalUrlAliasEvent.php index 3dfe6c382b..f3f834515a 100644 --- a/src/contracts/Repository/Events/URLAlias/CreateGlobalUrlAliasEvent.php +++ b/src/contracts/Repository/Events/URLAlias/CreateGlobalUrlAliasEvent.php @@ -23,8 +23,7 @@ final class CreateGlobalUrlAliasEvent extends AfterEvent private $alwaysAvailable; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLAlias */ - private $urlAlias; + private URLAlias $urlAlias; public function __construct( URLAlias $urlAlias, diff --git a/src/contracts/Repository/Events/URLAlias/CreateUrlAliasEvent.php b/src/contracts/Repository/Events/URLAlias/CreateUrlAliasEvent.php index c638aa13c8..b5b73a0200 100644 --- a/src/contracts/Repository/Events/URLAlias/CreateUrlAliasEvent.php +++ b/src/contracts/Repository/Events/URLAlias/CreateUrlAliasEvent.php @@ -14,8 +14,7 @@ final class CreateUrlAliasEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; private $path; @@ -25,8 +24,7 @@ final class CreateUrlAliasEvent extends AfterEvent private $alwaysAvailable; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLAlias */ - private $urlAlias; + private URLAlias $urlAlias; public function __construct( URLAlias $urlAlias, diff --git a/src/contracts/Repository/Events/URLAlias/RefreshSystemUrlAliasesForLocationEvent.php b/src/contracts/Repository/Events/URLAlias/RefreshSystemUrlAliasesForLocationEvent.php index 5ec39e41e0..55bb51c155 100644 --- a/src/contracts/Repository/Events/URLAlias/RefreshSystemUrlAliasesForLocationEvent.php +++ b/src/contracts/Repository/Events/URLAlias/RefreshSystemUrlAliasesForLocationEvent.php @@ -13,8 +13,7 @@ final class RefreshSystemUrlAliasesForLocationEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; public function __construct(Location $location) { diff --git a/src/contracts/Repository/Events/URLAlias/RemoveAliasesEvent.php b/src/contracts/Repository/Events/URLAlias/RemoveAliasesEvent.php index 966dbdf532..08e5bfa61d 100644 --- a/src/contracts/Repository/Events/URLAlias/RemoveAliasesEvent.php +++ b/src/contracts/Repository/Events/URLAlias/RemoveAliasesEvent.php @@ -12,8 +12,7 @@ final class RemoveAliasesEvent extends AfterEvent { - /** @var array */ - private $aliasList; + private array $aliasList; public function __construct( array $aliasList diff --git a/src/contracts/Repository/Events/URLWildcard/BeforeCreateEvent.php b/src/contracts/Repository/Events/URLWildcard/BeforeCreateEvent.php index 08bca21c0e..9793fe97c4 100644 --- a/src/contracts/Repository/Events/URLWildcard/BeforeCreateEvent.php +++ b/src/contracts/Repository/Events/URLWildcard/BeforeCreateEvent.php @@ -20,8 +20,7 @@ final class BeforeCreateEvent extends BeforeEvent private $forward; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard|null */ - private $urlWildcard; + private ?URLWildcard $urlWildcard = null; public function __construct($sourceUrl, $destinationUrl, $forward) { diff --git a/src/contracts/Repository/Events/URLWildcard/BeforeRemoveEvent.php b/src/contracts/Repository/Events/URLWildcard/BeforeRemoveEvent.php index 07c691373e..e51e73f42c 100644 --- a/src/contracts/Repository/Events/URLWildcard/BeforeRemoveEvent.php +++ b/src/contracts/Repository/Events/URLWildcard/BeforeRemoveEvent.php @@ -13,8 +13,7 @@ final class BeforeRemoveEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard */ - private $urlWildcard; + private URLWildcard $urlWildcard; public function __construct(URLWildcard $urlWildcard) { diff --git a/src/contracts/Repository/Events/URLWildcard/BeforeTranslateEvent.php b/src/contracts/Repository/Events/URLWildcard/BeforeTranslateEvent.php index 21e70d4508..dbf885948c 100644 --- a/src/contracts/Repository/Events/URLWildcard/BeforeTranslateEvent.php +++ b/src/contracts/Repository/Events/URLWildcard/BeforeTranslateEvent.php @@ -16,8 +16,7 @@ final class BeforeTranslateEvent extends BeforeEvent { private $url; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcardTranslationResult|null */ - private $result; + private ?URLWildcardTranslationResult $result = null; public function __construct($url) { diff --git a/src/contracts/Repository/Events/URLWildcard/BeforeUpdateEvent.php b/src/contracts/Repository/Events/URLWildcard/BeforeUpdateEvent.php index d95d3b50a6..4c51bb7767 100644 --- a/src/contracts/Repository/Events/URLWildcard/BeforeUpdateEvent.php +++ b/src/contracts/Repository/Events/URLWildcard/BeforeUpdateEvent.php @@ -14,11 +14,9 @@ final class BeforeUpdateEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard */ - private $urlWildcard; + private URLWildcard $urlWildcard; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcardUpdateStruct */ - private $updateStruct; + private URLWildcardUpdateStruct $updateStruct; public function __construct( URLWildcard $urlWildcard, diff --git a/src/contracts/Repository/Events/URLWildcard/CreateEvent.php b/src/contracts/Repository/Events/URLWildcard/CreateEvent.php index 34f6f9f1b4..3f0ac3216d 100644 --- a/src/contracts/Repository/Events/URLWildcard/CreateEvent.php +++ b/src/contracts/Repository/Events/URLWildcard/CreateEvent.php @@ -19,8 +19,7 @@ final class CreateEvent extends AfterEvent private $forward; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard */ - private $urlWildcard; + private URLWildcard $urlWildcard; public function __construct( URLWildcard $urlWildcard, diff --git a/src/contracts/Repository/Events/URLWildcard/RemoveEvent.php b/src/contracts/Repository/Events/URLWildcard/RemoveEvent.php index 6e9bf88ed8..f5a30cd887 100644 --- a/src/contracts/Repository/Events/URLWildcard/RemoveEvent.php +++ b/src/contracts/Repository/Events/URLWildcard/RemoveEvent.php @@ -13,8 +13,7 @@ final class RemoveEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard */ - private $urlWildcard; + private URLWildcard $urlWildcard; public function __construct( URLWildcard $urlWildcard diff --git a/src/contracts/Repository/Events/URLWildcard/TranslateEvent.php b/src/contracts/Repository/Events/URLWildcard/TranslateEvent.php index 2cf8a6e731..09c0c25df9 100644 --- a/src/contracts/Repository/Events/URLWildcard/TranslateEvent.php +++ b/src/contracts/Repository/Events/URLWildcard/TranslateEvent.php @@ -15,8 +15,7 @@ final class TranslateEvent extends AfterEvent { private $url; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcardTranslationResult */ - private $result; + private URLWildcardTranslationResult $result; public function __construct( URLWildcardTranslationResult $result, diff --git a/src/contracts/Repository/Events/URLWildcard/UpdateEvent.php b/src/contracts/Repository/Events/URLWildcard/UpdateEvent.php index 77599ff663..a211488f4f 100644 --- a/src/contracts/Repository/Events/URLWildcard/UpdateEvent.php +++ b/src/contracts/Repository/Events/URLWildcard/UpdateEvent.php @@ -14,11 +14,9 @@ final class UpdateEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard */ - private $urlWildcard; + private URLWildcard $urlWildcard; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcardUpdateStruct */ - private $updateStruct; + private URLWildcardUpdateStruct $updateStruct; public function __construct( URLWildcard $urlWildcard, diff --git a/src/contracts/Repository/Events/User/AssignUserToUserGroupEvent.php b/src/contracts/Repository/Events/User/AssignUserToUserGroupEvent.php index 17fbf38fef..38d577932f 100644 --- a/src/contracts/Repository/Events/User/AssignUserToUserGroupEvent.php +++ b/src/contracts/Repository/Events/User/AssignUserToUserGroupEvent.php @@ -14,11 +14,9 @@ final class AssignUserToUserGroupEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $user; + private User $user; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $userGroup; + private UserGroup $userGroup; public function __construct( User $user, diff --git a/src/contracts/Repository/Events/User/BeforeAssignUserToUserGroupEvent.php b/src/contracts/Repository/Events/User/BeforeAssignUserToUserGroupEvent.php index b1d1aaf6d1..2aea317bec 100644 --- a/src/contracts/Repository/Events/User/BeforeAssignUserToUserGroupEvent.php +++ b/src/contracts/Repository/Events/User/BeforeAssignUserToUserGroupEvent.php @@ -14,11 +14,9 @@ final class BeforeAssignUserToUserGroupEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $user; + private User $user; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $userGroup; + private UserGroup $userGroup; public function __construct(User $user, UserGroup $userGroup) { diff --git a/src/contracts/Repository/Events/User/BeforeCreateUserEvent.php b/src/contracts/Repository/Events/User/BeforeCreateUserEvent.php index f2771575e3..2ce4bd7a8d 100644 --- a/src/contracts/Repository/Events/User/BeforeCreateUserEvent.php +++ b/src/contracts/Repository/Events/User/BeforeCreateUserEvent.php @@ -15,14 +15,11 @@ final class BeforeCreateUserEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserCreateStruct */ - private $userCreateStruct; + private UserCreateStruct $userCreateStruct; - /** @var array */ - private $parentGroups; + private array $parentGroups; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User|null */ - private $user; + private ?User $user = null; public function __construct(UserCreateStruct $userCreateStruct, array $parentGroups) { diff --git a/src/contracts/Repository/Events/User/BeforeCreateUserGroupEvent.php b/src/contracts/Repository/Events/User/BeforeCreateUserGroupEvent.php index dae1206c69..c97401a527 100644 --- a/src/contracts/Repository/Events/User/BeforeCreateUserGroupEvent.php +++ b/src/contracts/Repository/Events/User/BeforeCreateUserGroupEvent.php @@ -15,14 +15,11 @@ final class BeforeCreateUserGroupEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroupCreateStruct */ - private $userGroupCreateStruct; + private UserGroupCreateStruct $userGroupCreateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $parentGroup; + private UserGroup $parentGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup|null */ - private $userGroup; + private ?UserGroup $userGroup = null; public function __construct(UserGroupCreateStruct $userGroupCreateStruct, UserGroup $parentGroup) { diff --git a/src/contracts/Repository/Events/User/BeforeDeleteUserEvent.php b/src/contracts/Repository/Events/User/BeforeDeleteUserEvent.php index 5485f87d05..5cba0c0dd8 100644 --- a/src/contracts/Repository/Events/User/BeforeDeleteUserEvent.php +++ b/src/contracts/Repository/Events/User/BeforeDeleteUserEvent.php @@ -14,11 +14,9 @@ final class BeforeDeleteUserEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $user; + private User $user; - /** @var array|null */ - private $locations; + private ?array $locations = null; public function __construct(User $user) { diff --git a/src/contracts/Repository/Events/User/BeforeDeleteUserGroupEvent.php b/src/contracts/Repository/Events/User/BeforeDeleteUserGroupEvent.php index 2d5d76969e..03282547df 100644 --- a/src/contracts/Repository/Events/User/BeforeDeleteUserGroupEvent.php +++ b/src/contracts/Repository/Events/User/BeforeDeleteUserGroupEvent.php @@ -14,11 +14,9 @@ final class BeforeDeleteUserGroupEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $userGroup; + private UserGroup $userGroup; - /** @var array|null */ - private $locations; + private ?array $locations = null; public function __construct(UserGroup $userGroup) { diff --git a/src/contracts/Repository/Events/User/BeforeMoveUserGroupEvent.php b/src/contracts/Repository/Events/User/BeforeMoveUserGroupEvent.php index db6c85b32a..4841750021 100644 --- a/src/contracts/Repository/Events/User/BeforeMoveUserGroupEvent.php +++ b/src/contracts/Repository/Events/User/BeforeMoveUserGroupEvent.php @@ -13,11 +13,9 @@ final class BeforeMoveUserGroupEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $userGroup; + private UserGroup $userGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $newParent; + private UserGroup $newParent; public function __construct(UserGroup $userGroup, UserGroup $newParent) { diff --git a/src/contracts/Repository/Events/User/BeforeUnAssignUserFromUserGroupEvent.php b/src/contracts/Repository/Events/User/BeforeUnAssignUserFromUserGroupEvent.php index 3ad55444e6..42bcf52b29 100644 --- a/src/contracts/Repository/Events/User/BeforeUnAssignUserFromUserGroupEvent.php +++ b/src/contracts/Repository/Events/User/BeforeUnAssignUserFromUserGroupEvent.php @@ -14,11 +14,9 @@ final class BeforeUnAssignUserFromUserGroupEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $user; + private User $user; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $userGroup; + private UserGroup $userGroup; public function __construct(User $user, UserGroup $userGroup) { diff --git a/src/contracts/Repository/Events/User/BeforeUpdateUserEvent.php b/src/contracts/Repository/Events/User/BeforeUpdateUserEvent.php index 163e6c8d9a..ce92056349 100644 --- a/src/contracts/Repository/Events/User/BeforeUpdateUserEvent.php +++ b/src/contracts/Repository/Events/User/BeforeUpdateUserEvent.php @@ -15,14 +15,11 @@ final class BeforeUpdateUserEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $user; + private User $user; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserUpdateStruct */ - private $userUpdateStruct; + private UserUpdateStruct $userUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User|null */ - private $updatedUser; + private ?User $updatedUser = null; public function __construct(User $user, UserUpdateStruct $userUpdateStruct) { diff --git a/src/contracts/Repository/Events/User/BeforeUpdateUserGroupEvent.php b/src/contracts/Repository/Events/User/BeforeUpdateUserGroupEvent.php index a70046fa6b..b40aa00489 100644 --- a/src/contracts/Repository/Events/User/BeforeUpdateUserGroupEvent.php +++ b/src/contracts/Repository/Events/User/BeforeUpdateUserGroupEvent.php @@ -15,14 +15,11 @@ final class BeforeUpdateUserGroupEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $userGroup; + private UserGroup $userGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroupUpdateStruct */ - private $userGroupUpdateStruct; + private UserGroupUpdateStruct $userGroupUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup|null */ - private $updatedUserGroup; + private ?UserGroup $updatedUserGroup = null; public function __construct(UserGroup $userGroup, UserGroupUpdateStruct $userGroupUpdateStruct) { diff --git a/src/contracts/Repository/Events/User/BeforeUpdateUserPasswordEvent.php b/src/contracts/Repository/Events/User/BeforeUpdateUserPasswordEvent.php index cc93f1423a..3b3e259902 100644 --- a/src/contracts/Repository/Events/User/BeforeUpdateUserPasswordEvent.php +++ b/src/contracts/Repository/Events/User/BeforeUpdateUserPasswordEvent.php @@ -14,14 +14,11 @@ final class BeforeUpdateUserPasswordEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $user; + private User $user; - /** @var string */ - private $newPassword; + private string $newPassword; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User|null */ - private $updatedUser; + private ?User $updatedUser = null; public function __construct(User $user, string $newPassword) { diff --git a/src/contracts/Repository/Events/User/BeforeUpdateUserTokenEvent.php b/src/contracts/Repository/Events/User/BeforeUpdateUserTokenEvent.php index 82ca2131dc..c352147458 100644 --- a/src/contracts/Repository/Events/User/BeforeUpdateUserTokenEvent.php +++ b/src/contracts/Repository/Events/User/BeforeUpdateUserTokenEvent.php @@ -15,14 +15,11 @@ final class BeforeUpdateUserTokenEvent extends BeforeEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $user; + private User $user; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserTokenUpdateStruct */ - private $userTokenUpdateStruct; + private UserTokenUpdateStruct $userTokenUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User|null */ - private $updatedUser; + private ?User $updatedUser = null; public function __construct(User $user, UserTokenUpdateStruct $userTokenUpdateStruct) { diff --git a/src/contracts/Repository/Events/User/CreateUserEvent.php b/src/contracts/Repository/Events/User/CreateUserEvent.php index f86983991e..d47f199429 100644 --- a/src/contracts/Repository/Events/User/CreateUserEvent.php +++ b/src/contracts/Repository/Events/User/CreateUserEvent.php @@ -14,14 +14,11 @@ final class CreateUserEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserCreateStruct */ - private $userCreateStruct; + private UserCreateStruct $userCreateStruct; - /** @var array */ - private $parentGroups; + private array $parentGroups; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $user; + private User $user; public function __construct( User $user, diff --git a/src/contracts/Repository/Events/User/CreateUserGroupEvent.php b/src/contracts/Repository/Events/User/CreateUserGroupEvent.php index b7cd39820d..3fc6724318 100644 --- a/src/contracts/Repository/Events/User/CreateUserGroupEvent.php +++ b/src/contracts/Repository/Events/User/CreateUserGroupEvent.php @@ -14,14 +14,11 @@ final class CreateUserGroupEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroupCreateStruct */ - private $userGroupCreateStruct; + private UserGroupCreateStruct $userGroupCreateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $parentGroup; + private UserGroup $parentGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $userGroup; + private UserGroup $userGroup; public function __construct( UserGroup $userGroup, diff --git a/src/contracts/Repository/Events/User/DeleteUserEvent.php b/src/contracts/Repository/Events/User/DeleteUserEvent.php index 1ceee53299..948147a934 100644 --- a/src/contracts/Repository/Events/User/DeleteUserEvent.php +++ b/src/contracts/Repository/Events/User/DeleteUserEvent.php @@ -13,11 +13,9 @@ final class DeleteUserEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $user; + private User $user; - /** @var array */ - private $locations; + private array $locations; public function __construct( array $locations, diff --git a/src/contracts/Repository/Events/User/DeleteUserGroupEvent.php b/src/contracts/Repository/Events/User/DeleteUserGroupEvent.php index 312b9df192..c5c2c65c1f 100644 --- a/src/contracts/Repository/Events/User/DeleteUserGroupEvent.php +++ b/src/contracts/Repository/Events/User/DeleteUserGroupEvent.php @@ -13,11 +13,9 @@ final class DeleteUserGroupEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $userGroup; + private UserGroup $userGroup; - /** @var array */ - private $locations; + private array $locations; public function __construct( array $locations, diff --git a/src/contracts/Repository/Events/User/MoveUserGroupEvent.php b/src/contracts/Repository/Events/User/MoveUserGroupEvent.php index 4c0cb5710b..647ec301ea 100644 --- a/src/contracts/Repository/Events/User/MoveUserGroupEvent.php +++ b/src/contracts/Repository/Events/User/MoveUserGroupEvent.php @@ -13,11 +13,9 @@ final class MoveUserGroupEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $userGroup; + private UserGroup $userGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $newParent; + private UserGroup $newParent; public function __construct( UserGroup $userGroup, diff --git a/src/contracts/Repository/Events/User/UnAssignUserFromUserGroupEvent.php b/src/contracts/Repository/Events/User/UnAssignUserFromUserGroupEvent.php index 8a563a5c69..c6f33e96a0 100644 --- a/src/contracts/Repository/Events/User/UnAssignUserFromUserGroupEvent.php +++ b/src/contracts/Repository/Events/User/UnAssignUserFromUserGroupEvent.php @@ -14,11 +14,9 @@ final class UnAssignUserFromUserGroupEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $user; + private User $user; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $userGroup; + private UserGroup $userGroup; public function __construct( User $user, diff --git a/src/contracts/Repository/Events/User/UpdateUserEvent.php b/src/contracts/Repository/Events/User/UpdateUserEvent.php index 61c58e892a..334819b9d6 100644 --- a/src/contracts/Repository/Events/User/UpdateUserEvent.php +++ b/src/contracts/Repository/Events/User/UpdateUserEvent.php @@ -14,14 +14,11 @@ final class UpdateUserEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $user; + private User $user; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserUpdateStruct */ - private $userUpdateStruct; + private UserUpdateStruct $userUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $updatedUser; + private User $updatedUser; public function __construct( User $updatedUser, diff --git a/src/contracts/Repository/Events/User/UpdateUserGroupEvent.php b/src/contracts/Repository/Events/User/UpdateUserGroupEvent.php index e51d086141..d23b0ba1d5 100644 --- a/src/contracts/Repository/Events/User/UpdateUserGroupEvent.php +++ b/src/contracts/Repository/Events/User/UpdateUserGroupEvent.php @@ -14,13 +14,11 @@ final class UpdateUserGroupEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private $userGroup; + private UserGroup $userGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroupUpdateStruct */ - private $userGroupUpdateStruct; + private UserGroupUpdateStruct $userGroupUpdateStruct; - private $updatedUserGroup; + private UserGroup $updatedUserGroup; public function __construct( UserGroup $updatedUserGroup, diff --git a/src/contracts/Repository/Events/User/UpdateUserPasswordEvent.php b/src/contracts/Repository/Events/User/UpdateUserPasswordEvent.php index b12e1d59f0..7dce670593 100644 --- a/src/contracts/Repository/Events/User/UpdateUserPasswordEvent.php +++ b/src/contracts/Repository/Events/User/UpdateUserPasswordEvent.php @@ -13,14 +13,11 @@ final class UpdateUserPasswordEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $user; + private User $user; - /** @var string */ - private $newPassword; + private string $newPassword; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $updatedUser; + private User $updatedUser; public function __construct( User $updatedUser, diff --git a/src/contracts/Repository/Events/User/UpdateUserTokenEvent.php b/src/contracts/Repository/Events/User/UpdateUserTokenEvent.php index d6fca1a7b9..c9aa29821d 100644 --- a/src/contracts/Repository/Events/User/UpdateUserTokenEvent.php +++ b/src/contracts/Repository/Events/User/UpdateUserTokenEvent.php @@ -14,14 +14,11 @@ final class UpdateUserTokenEvent extends AfterEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $user; + private User $user; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserTokenUpdateStruct */ - private $userTokenUpdateStruct; + private UserTokenUpdateStruct $userTokenUpdateStruct; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $updatedUser; + private User $updatedUser; public function __construct( User $updatedUser, diff --git a/src/contracts/Repository/Events/UserPreference/BeforeSetUserPreferenceEvent.php b/src/contracts/Repository/Events/UserPreference/BeforeSetUserPreferenceEvent.php index f59525ee10..239b3449b4 100644 --- a/src/contracts/Repository/Events/UserPreference/BeforeSetUserPreferenceEvent.php +++ b/src/contracts/Repository/Events/UserPreference/BeforeSetUserPreferenceEvent.php @@ -13,7 +13,7 @@ final class BeforeSetUserPreferenceEvent extends BeforeEvent { /** @var \Ibexa\Contracts\Core\Repository\Values\UserPreference\UserPreferenceSetStruct[] */ - private $userPreferenceSetStructs; + private array $userPreferenceSetStructs; public function __construct(array $userPreferenceSetStructs) { diff --git a/src/contracts/Repository/Events/UserPreference/SetUserPreferenceEvent.php b/src/contracts/Repository/Events/UserPreference/SetUserPreferenceEvent.php index 8120251f49..ee438751b4 100644 --- a/src/contracts/Repository/Events/UserPreference/SetUserPreferenceEvent.php +++ b/src/contracts/Repository/Events/UserPreference/SetUserPreferenceEvent.php @@ -13,7 +13,7 @@ final class SetUserPreferenceEvent extends AfterEvent { /** @var \Ibexa\Contracts\Core\Repository\Values\UserPreference\UserPreferenceSetStruct[] */ - private $userPreferenceSetStructs; + private array $userPreferenceSetStructs; public function __construct(array $userPreferenceSetStructs) { diff --git a/src/contracts/Repository/Iterator/BatchIterator.php b/src/contracts/Repository/Iterator/BatchIterator.php index 0ad579dc5a..5b1f91de61 100644 --- a/src/contracts/Repository/Iterator/BatchIterator.php +++ b/src/contracts/Repository/Iterator/BatchIterator.php @@ -14,17 +14,13 @@ final class BatchIterator implements Iterator { public const DEFAULT_BATCH_SIZE = 25; - /** @var \Ibexa\Contracts\Core\Repository\Iterator\BatchIteratorAdapter */ - private $adapter; + private BatchIteratorAdapter $adapter; - /** @var \Iterator|null */ - private $innerIterator; + private ?Iterator $innerIterator = null; - /** @var int */ - private $batchSize; + private int $batchSize; - /** @var int */ - private $position; + private int $position; public function __construct( BatchIteratorAdapter $adapter, diff --git a/src/contracts/Repository/Iterator/BatchIteratorAdapter/ContentFilteringAdapter.php b/src/contracts/Repository/Iterator/BatchIteratorAdapter/ContentFilteringAdapter.php index 5040118493..55844b4533 100644 --- a/src/contracts/Repository/Iterator/BatchIteratorAdapter/ContentFilteringAdapter.php +++ b/src/contracts/Repository/Iterator/BatchIteratorAdapter/ContentFilteringAdapter.php @@ -15,14 +15,12 @@ final class ContentFilteringAdapter implements BatchIteratorAdapter { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\Contracts\Core\Repository\Values\Filter\Filter */ - private $filter; + private Filter $filter; /** @var string[]|null */ - private $languages; + private ?array $languages; public function __construct(ContentService $contentService, Filter $filter, ?array $languages = null) { diff --git a/src/contracts/Repository/Iterator/BatchIteratorAdapter/LocationFilteringAdapter.php b/src/contracts/Repository/Iterator/BatchIteratorAdapter/LocationFilteringAdapter.php index 16467431c1..f98bdaa9c2 100644 --- a/src/contracts/Repository/Iterator/BatchIteratorAdapter/LocationFilteringAdapter.php +++ b/src/contracts/Repository/Iterator/BatchIteratorAdapter/LocationFilteringAdapter.php @@ -15,14 +15,12 @@ final class LocationFilteringAdapter implements BatchIteratorAdapter { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - private $locationService; + private LocationService $locationService; - /** @var \Ibexa\Contracts\Core\Repository\Values\Filter\Filter */ - private $filter; + private Filter $filter; /** @var string[]|null */ - private $languages; + private ?array $languages; public function __construct(LocationService $locationService, Filter $filter, ?array $languages = null) { diff --git a/src/contracts/Repository/Lists/UnauthorizedListItem.php b/src/contracts/Repository/Lists/UnauthorizedListItem.php index 7b4be7eb27..f50c4d4a6e 100644 --- a/src/contracts/Repository/Lists/UnauthorizedListItem.php +++ b/src/contracts/Repository/Lists/UnauthorizedListItem.php @@ -13,14 +13,11 @@ */ abstract class UnauthorizedListItem { - /** @var string */ - private $module; + private string $module; - /** @var string */ - private $function; + private string $function; - /** @var array */ - private $payload; + private array $payload; /** * @param string $module diff --git a/src/contracts/Repository/Values/Content/DraftList/Item/ContentDraftListItem.php b/src/contracts/Repository/Values/Content/DraftList/Item/ContentDraftListItem.php index 422cb91121..e39fe58f80 100644 --- a/src/contracts/Repository/Values/Content/DraftList/Item/ContentDraftListItem.php +++ b/src/contracts/Repository/Values/Content/DraftList/Item/ContentDraftListItem.php @@ -16,10 +16,7 @@ */ class ContentDraftListItem implements ContentDraftListItemInterface { - /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo - */ - private $versionInfo; + private VersionInfo $versionInfo; /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo diff --git a/src/contracts/Repository/Values/Content/DraftList/Item/UnauthorizedContentDraftListItem.php b/src/contracts/Repository/Values/Content/DraftList/Item/UnauthorizedContentDraftListItem.php index f56a239a46..3115851f43 100644 --- a/src/contracts/Repository/Values/Content/DraftList/Item/UnauthorizedContentDraftListItem.php +++ b/src/contracts/Repository/Values/Content/DraftList/Item/UnauthorizedContentDraftListItem.php @@ -16,14 +16,11 @@ */ class UnauthorizedContentDraftListItem implements ContentDraftListItemInterface { - /** @var string */ - private $module; + private string $module; - /** @var string */ - private $function; + private string $function; - /** @var array */ - private $payload; + private array $payload; /** * @param string $module diff --git a/src/contracts/Repository/Values/Content/Query/Aggregation/AbstractRangeAggregation.php b/src/contracts/Repository/Values/Content/Query/Aggregation/AbstractRangeAggregation.php index 745648fd81..fb1de6a8f5 100644 --- a/src/contracts/Repository/Values/Content/Query/Aggregation/AbstractRangeAggregation.php +++ b/src/contracts/Repository/Values/Content/Query/Aggregation/AbstractRangeAggregation.php @@ -14,13 +14,11 @@ abstract class AbstractRangeAggregation implements Aggregation { /** * The name of the aggregation. - * - * @var string */ - protected $name; + protected string $name; /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Query\Aggregation\Range[] */ - protected $ranges; + protected array $ranges; public function __construct(string $name, array $ranges = []) { diff --git a/src/contracts/Repository/Values/Content/Query/Aggregation/AbstractStatsAggregation.php b/src/contracts/Repository/Values/Content/Query/Aggregation/AbstractStatsAggregation.php index 7aafd1b2e9..c85fd26ad0 100644 --- a/src/contracts/Repository/Values/Content/Query/Aggregation/AbstractStatsAggregation.php +++ b/src/contracts/Repository/Values/Content/Query/Aggregation/AbstractStatsAggregation.php @@ -14,10 +14,8 @@ abstract class AbstractStatsAggregation implements Aggregation { /** * The name of the aggregation. - * - * @var string */ - protected $name; + protected string $name; public function __construct(string $name) { diff --git a/src/contracts/Repository/Values/Content/Query/Aggregation/AbstractTermAggregation.php b/src/contracts/Repository/Values/Content/Query/Aggregation/AbstractTermAggregation.php index 2736744e73..241bd9e33c 100644 --- a/src/contracts/Repository/Values/Content/Query/Aggregation/AbstractTermAggregation.php +++ b/src/contracts/Repository/Values/Content/Query/Aggregation/AbstractTermAggregation.php @@ -17,10 +17,8 @@ abstract class AbstractTermAggregation implements Aggregation /** * The name of the aggregation. - * - * @var string */ - protected $name; + protected string $name; /** * Number of facets (terms) returned. diff --git a/src/contracts/Repository/Values/Content/Query/Aggregation/DateMetadataRangeAggregation.php b/src/contracts/Repository/Values/Content/Query/Aggregation/DateMetadataRangeAggregation.php index 4c977605b4..21dfd2ce7d 100644 --- a/src/contracts/Repository/Values/Content/Query/Aggregation/DateMetadataRangeAggregation.php +++ b/src/contracts/Repository/Values/Content/Query/Aggregation/DateMetadataRangeAggregation.php @@ -17,8 +17,7 @@ final class DateMetadataRangeAggregation extends AbstractRangeAggregation public const CREATED = 'created'; public const PUBLISHED = 'published'; - /** @var string */ - private $type; + private string $type; public function __construct(string $name, string $type, array $ranges = []) { diff --git a/src/contracts/Repository/Values/Content/Query/Aggregation/Field/CountryTermAggregation.php b/src/contracts/Repository/Values/Content/Query/Aggregation/Field/CountryTermAggregation.php index dafe9fb50b..198b38ea88 100644 --- a/src/contracts/Repository/Values/Content/Query/Aggregation/Field/CountryTermAggregation.php +++ b/src/contracts/Repository/Values/Content/Query/Aggregation/Field/CountryTermAggregation.php @@ -15,8 +15,7 @@ final class CountryTermAggregation extends AbstractFieldTermAggregation public const TYPE_ALPHA_2 = 4; public const TYPE_ALPHA_3 = 8; - /** @var int */ - private $type; + private int $type; public function __construct( string $name, diff --git a/src/contracts/Repository/Values/Content/Query/Aggregation/Location/SubtreeTermAggregation.php b/src/contracts/Repository/Values/Content/Query/Aggregation/Location/SubtreeTermAggregation.php index 4c8b674191..4585586b8d 100644 --- a/src/contracts/Repository/Values/Content/Query/Aggregation/Location/SubtreeTermAggregation.php +++ b/src/contracts/Repository/Values/Content/Query/Aggregation/Location/SubtreeTermAggregation.php @@ -15,8 +15,7 @@ final class SubtreeTermAggregation extends AbstractTermAggregation implements LocationAggregation { - /** @var string */ - private $pathString; + private string $pathString; public function __construct(string $name, string $pathString) { diff --git a/src/contracts/Repository/Values/Content/Query/Aggregation/ObjectStateTermAggregation.php b/src/contracts/Repository/Values/Content/Query/Aggregation/ObjectStateTermAggregation.php index 9bb9c37759..6fa05df4e6 100644 --- a/src/contracts/Repository/Values/Content/Query/Aggregation/ObjectStateTermAggregation.php +++ b/src/contracts/Repository/Values/Content/Query/Aggregation/ObjectStateTermAggregation.php @@ -10,8 +10,7 @@ final class ObjectStateTermAggregation extends AbstractTermAggregation { - /** @var string */ - private $objectStateGroupIdentifier; + private string $objectStateGroupIdentifier; public function __construct( string $name, diff --git a/src/contracts/Repository/Values/Content/Query/Aggregation/RawRangeAggregation.php b/src/contracts/Repository/Values/Content/Query/Aggregation/RawRangeAggregation.php index 860a414323..02b681eb90 100644 --- a/src/contracts/Repository/Values/Content/Query/Aggregation/RawRangeAggregation.php +++ b/src/contracts/Repository/Values/Content/Query/Aggregation/RawRangeAggregation.php @@ -13,8 +13,7 @@ final class RawRangeAggregation extends AbstractRangeAggregation implements RawAggregation { - /** @var string */ - private $fieldName; + private string $fieldName; public function __construct(string $name, string $fieldName, array $ranges = []) { diff --git a/src/contracts/Repository/Values/Content/Query/Aggregation/RawStatsAggregation.php b/src/contracts/Repository/Values/Content/Query/Aggregation/RawStatsAggregation.php index e17577d066..1a3a27d800 100644 --- a/src/contracts/Repository/Values/Content/Query/Aggregation/RawStatsAggregation.php +++ b/src/contracts/Repository/Values/Content/Query/Aggregation/RawStatsAggregation.php @@ -10,8 +10,7 @@ final class RawStatsAggregation extends AbstractStatsAggregation implements RawAggregation { - /** @var string */ - private $fieldName; + private string $fieldName; public function __construct(string $name, string $fieldName) { diff --git a/src/contracts/Repository/Values/Content/Query/Aggregation/RawTermAggregation.php b/src/contracts/Repository/Values/Content/Query/Aggregation/RawTermAggregation.php index f48364d924..221e578c9e 100644 --- a/src/contracts/Repository/Values/Content/Query/Aggregation/RawTermAggregation.php +++ b/src/contracts/Repository/Values/Content/Query/Aggregation/RawTermAggregation.php @@ -10,8 +10,7 @@ final class RawTermAggregation extends AbstractTermAggregation implements RawAggregation { - /** @var string */ - private $fieldName; + private string $fieldName; public function __construct( string $name, diff --git a/src/contracts/Repository/Values/Content/Query/Aggregation/UserMetadataTermAggregation.php b/src/contracts/Repository/Values/Content/Query/Aggregation/UserMetadataTermAggregation.php index a1fb81d715..c7fb3021e0 100644 --- a/src/contracts/Repository/Values/Content/Query/Aggregation/UserMetadataTermAggregation.php +++ b/src/contracts/Repository/Values/Content/Query/Aggregation/UserMetadataTermAggregation.php @@ -27,10 +27,8 @@ final class UserMetadataTermAggregation extends AbstractTermAggregation /** * The type of the user facet. - * - * @var string */ - private $type; + private string $type; public function __construct( string $name, diff --git a/src/contracts/Repository/Values/Content/Query/Criterion/Image/Orientation.php b/src/contracts/Repository/Values/Content/Query/Criterion/Image/Orientation.php index 5bae6e19e2..2dfc7d8734 100644 --- a/src/contracts/Repository/Values/Content/Query/Criterion/Image/Orientation.php +++ b/src/contracts/Repository/Values/Content/Query/Criterion/Image/Orientation.php @@ -86,7 +86,7 @@ private function isSupportedOrientation(string $orientation): bool /** * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException */ - private function throwException(string $whatIsWrong): void + private function throwException(string $whatIsWrong): never { throw new InvalidArgumentException( '$orientation', diff --git a/src/contracts/Repository/Values/Content/Query/Criterion/MoreLikeThis.php b/src/contracts/Repository/Values/Content/Query/Criterion/MoreLikeThis.php index 2fe2966308..10ae897aea 100644 --- a/src/contracts/Repository/Values/Content/Query/Criterion/MoreLikeThis.php +++ b/src/contracts/Repository/Values/Content/Query/Criterion/MoreLikeThis.php @@ -23,10 +23,8 @@ class MoreLikeThis extends Criterion /** * The type of the parameter from which terms are extracted for finding similar objects. - * - * @var int */ - protected $type; + protected int $type; /** * Creates a new more like this criterion. diff --git a/src/contracts/Repository/Values/Content/Query/Criterion/Operator/Specifications.php b/src/contracts/Repository/Values/Content/Query/Criterion/Operator/Specifications.php index cf03d4ca1f..860023c970 100644 --- a/src/contracts/Repository/Values/Content/Query/Criterion/Operator/Specifications.php +++ b/src/contracts/Repository/Values/Content/Query/Criterion/Operator/Specifications.php @@ -29,6 +29,8 @@ class Specifications /** * Specified operator, as one of the Operator::* constants. + * + * @var string */ public $operator; diff --git a/src/contracts/Repository/Values/Content/RelationList/Item/RelationListItem.php b/src/contracts/Repository/Values/Content/RelationList/Item/RelationListItem.php index 96d16e2cb6..561e15a806 100644 --- a/src/contracts/Repository/Values/Content/RelationList/Item/RelationListItem.php +++ b/src/contracts/Repository/Values/Content/RelationList/Item/RelationListItem.php @@ -16,8 +16,7 @@ */ class RelationListItem implements RelationListItemInterface { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Relation */ - private $relation; + private Relation $relation; public function __construct(Relation $relation) { diff --git a/src/contracts/Repository/Values/Content/Search/AggregationResult.php b/src/contracts/Repository/Values/Content/Search/AggregationResult.php index d0d9672920..50043cdaa7 100644 --- a/src/contracts/Repository/Values/Content/Search/AggregationResult.php +++ b/src/contracts/Repository/Values/Content/Search/AggregationResult.php @@ -14,10 +14,8 @@ abstract class AggregationResult extends ValueObject { /** * The name of the aggregation. - * - * @var string */ - private $name; + private string $name; public function __construct(string $name) { diff --git a/src/contracts/Repository/Values/Content/Search/AggregationResult/RangeAggregationResult.php b/src/contracts/Repository/Values/Content/Search/AggregationResult/RangeAggregationResult.php index a07437968d..cdbce5b272 100644 --- a/src/contracts/Repository/Values/Content/Search/AggregationResult/RangeAggregationResult.php +++ b/src/contracts/Repository/Values/Content/Search/AggregationResult/RangeAggregationResult.php @@ -18,7 +18,7 @@ final class RangeAggregationResult extends AggregationResult implements IteratorAggregate, Countable { /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Search\AggregationResult\RangeAggregationResultEntry[] */ - private $entries; + private iterable $entries; /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Search\AggregationResult\RangeAggregationResultEntry[] $entries diff --git a/src/contracts/Repository/Values/Content/Search/AggregationResult/RangeAggregationResultEntry.php b/src/contracts/Repository/Values/Content/Search/AggregationResult/RangeAggregationResultEntry.php index 358bb29374..0d7584d715 100644 --- a/src/contracts/Repository/Values/Content/Search/AggregationResult/RangeAggregationResultEntry.php +++ b/src/contracts/Repository/Values/Content/Search/AggregationResult/RangeAggregationResultEntry.php @@ -13,11 +13,9 @@ final class RangeAggregationResultEntry extends ValueObject { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Query\Aggregation\Range */ - private $key; + private Range $key; - /** @var int */ - private $count; + private int $count; public function __construct(Range $key, int $count) { diff --git a/src/contracts/Repository/Values/Content/Search/AggregationResult/StatsAggregationResult.php b/src/contracts/Repository/Values/Content/Search/AggregationResult/StatsAggregationResult.php index 543f5e1f86..b4993cfd30 100644 --- a/src/contracts/Repository/Values/Content/Search/AggregationResult/StatsAggregationResult.php +++ b/src/contracts/Repository/Values/Content/Search/AggregationResult/StatsAggregationResult.php @@ -15,17 +15,13 @@ final class StatsAggregationResult extends AggregationResult /** @var float|null */ public $sum; - /** @var int|null */ - private $count; + private ?int $count; - /** @var float|null */ - private $min; + private ?float $min; - /** @var float|null */ - private $max; + private ?float $max; - /** @var float|null */ - private $avg; + private ?float $avg; public function __construct(string $name, ?int $count, ?float $min, ?float $max, ?float $avg, ?float $sum) { diff --git a/src/contracts/Repository/Values/Content/Search/AggregationResult/TermAggregationResult.php b/src/contracts/Repository/Values/Content/Search/AggregationResult/TermAggregationResult.php index 3990484cf7..e8d4beeee2 100644 --- a/src/contracts/Repository/Values/Content/Search/AggregationResult/TermAggregationResult.php +++ b/src/contracts/Repository/Values/Content/Search/AggregationResult/TermAggregationResult.php @@ -18,7 +18,7 @@ class TermAggregationResult extends AggregationResult implements IteratorAggregate, Countable { /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Search\AggregationResult\TermAggregationResultEntry[] */ - private $entries; + private iterable $entries; public function __construct(string $name, iterable $entries = []) { diff --git a/src/contracts/Repository/Values/Content/Search/AggregationResult/TermAggregationResultEntry.php b/src/contracts/Repository/Values/Content/Search/AggregationResult/TermAggregationResultEntry.php index 80bf8d187a..0d3f5d8d6c 100644 --- a/src/contracts/Repository/Values/Content/Search/AggregationResult/TermAggregationResultEntry.php +++ b/src/contracts/Repository/Values/Content/Search/AggregationResult/TermAggregationResultEntry.php @@ -15,8 +15,7 @@ final class TermAggregationResultEntry extends ValueObject /** @var mixed */ private $key; - /** @var int */ - private $count; + private int $count; public function __construct($key, int $count) { diff --git a/src/contracts/Repository/Values/Content/Search/AggregationResultCollection.php b/src/contracts/Repository/Values/Content/Search/AggregationResultCollection.php index 6824c7409b..a5fddec64d 100644 --- a/src/contracts/Repository/Values/Content/Search/AggregationResultCollection.php +++ b/src/contracts/Repository/Values/Content/Search/AggregationResultCollection.php @@ -17,7 +17,7 @@ final class AggregationResultCollection implements Countable, IteratorAggregate { /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Search\AggregationResult[] */ - private $entries; + private array $entries; /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Search\AggregationResult[] $results diff --git a/src/contracts/Repository/Values/Filter/Filter.php b/src/contracts/Repository/Values/Filter/Filter.php index a0b660400d..469dc5d30d 100644 --- a/src/contracts/Repository/Values/Filter/Filter.php +++ b/src/contracts/Repository/Values/Filter/Filter.php @@ -22,13 +22,11 @@ final class Filter private $criterion; /** @var \Ibexa\Contracts\Core\Repository\Values\Filter\FilteringSortClause[] */ - private $sortClauses = []; + private array $sortClauses = []; - /** @var int */ - private $offset = 0; + private int $offset = 0; - /** @var int */ - private $limit = 0; + private int $limit = 0; /** * Build Filter. diff --git a/src/contracts/Repository/Values/User/LookupPolicyLimitations.php b/src/contracts/Repository/Values/User/LookupPolicyLimitations.php index 1b1dbd4955..4c64f8a3c5 100644 --- a/src/contracts/Repository/Values/User/LookupPolicyLimitations.php +++ b/src/contracts/Repository/Values/User/LookupPolicyLimitations.php @@ -15,11 +15,10 @@ */ final class LookupPolicyLimitations extends ValueObject { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Policy */ - protected $policy; + protected Policy $policy; /** @var \Ibexa\Contracts\Core\Repository\Values\User\Limitation[] */ - protected $limitations; + protected array $limitations; /** * @param \Ibexa\Contracts\Core\Repository\Values\User\Policy $policy diff --git a/src/contracts/Repository/Values/User/PasswordInfo.php b/src/contracts/Repository/Values/User/PasswordInfo.php index 17c3f34e07..60f3393586 100644 --- a/src/contracts/Repository/Values/User/PasswordInfo.php +++ b/src/contracts/Repository/Values/User/PasswordInfo.php @@ -14,11 +14,9 @@ final class PasswordInfo extends ValueObject { - /** @var \DateTimeImmutable|null */ - private $expirationDate; + private ?DateTimeImmutable $expirationDate; - /** @var \DateTimeImmutable|null */ - private $expirationWarningDate; + private ?DateTimeImmutable $expirationWarningDate; public function __construct(?DateTimeImmutable $expirationDate = null, ?DateTimeImmutable $expirationWarningDate = null) { diff --git a/src/contracts/Search/Field.php b/src/contracts/Search/Field.php index b3a154c5b3..2531bea45e 100644 --- a/src/contracts/Search/Field.php +++ b/src/contracts/Search/Field.php @@ -36,10 +36,8 @@ class Field extends ValueObject /** * Type of the search field. - * - * @var \Ibexa\Contracts\Core\Search\FieldType */ - protected $type; + protected FieldType $type; /** * @param string $name diff --git a/src/contracts/Specification/Content/ContentTypeSpecification.php b/src/contracts/Specification/Content/ContentTypeSpecification.php index e29909ae01..c4fc9cb6c9 100644 --- a/src/contracts/Specification/Content/ContentTypeSpecification.php +++ b/src/contracts/Specification/Content/ContentTypeSpecification.php @@ -12,10 +12,7 @@ final class ContentTypeSpecification implements ContentSpecification { - /** - * @var string - */ - private $expectedType; + private string $expectedType; public function __construct(string $expectedType) { diff --git a/src/contracts/Test/Persistence/Fixture/BaseInMemoryCachedFileFixture.php b/src/contracts/Test/Persistence/Fixture/BaseInMemoryCachedFileFixture.php index 585766d473..b75ce9d4f7 100644 --- a/src/contracts/Test/Persistence/Fixture/BaseInMemoryCachedFileFixture.php +++ b/src/contracts/Test/Persistence/Fixture/BaseInMemoryCachedFileFixture.php @@ -18,8 +18,7 @@ */ abstract class BaseInMemoryCachedFileFixture implements Fixture { - /** @var array|null */ - private static $inMemoryCachedLoadedData = null; + private static ?array $inMemoryCachedLoadedData = null; /** @var string */ private $filePath; diff --git a/src/contracts/Test/Persistence/Fixture/FixtureImporter.php b/src/contracts/Test/Persistence/Fixture/FixtureImporter.php index dbe36f34e2..df96ed4d44 100644 --- a/src/contracts/Test/Persistence/Fixture/FixtureImporter.php +++ b/src/contracts/Test/Persistence/Fixture/FixtureImporter.php @@ -21,11 +21,10 @@ */ final class FixtureImporter { - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; /** @var array */ - private static $resetSequenceStatements = []; + private static array $resetSequenceStatements = []; public function __construct(Connection $connection) { diff --git a/src/contracts/Test/Repository/SetupFactory/Legacy.php b/src/contracts/Test/Repository/SetupFactory/Legacy.php index f57a5fcec1..08aa69f894 100644 --- a/src/contracts/Test/Repository/SetupFactory/Legacy.php +++ b/src/contracts/Test/Repository/SetupFactory/Legacy.php @@ -21,7 +21,7 @@ use Ibexa\Core\Persistence\Legacy\Content\Type\MemoryCachingHandler as CachingContentTypeHandler; use Ibexa\Core\Persistence\Legacy\Handler; use Ibexa\Core\Repository\Values\User\UserReference; -use Ibexa\Tests\Core\Repository\IdManager; +use Ibexa\Tests\Core\Repository\IdManager\Php; use Ibexa\Tests\Core\Repository\LegacySchemaImporter; use Ibexa\Tests\Integration\Core\LegacyTestContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -70,10 +70,8 @@ class Legacy extends SetupFactory /** * Cached in-memory initial database data fixture. - * - * @var \Ibexa\Contracts\Core\Test\Persistence\Fixture */ - private static $initialDataFixture; + private static ?YamlFixture $initialDataFixture = null; /** * Cached in-memory post insert SQL statements. @@ -183,9 +181,9 @@ public function getConfigValue($configKey) * * @return \Ibexa\Tests\Integration\Core\Repository\IdManager */ - public function getIdManager() + public function getIdManager(): Php { - return new IdManager\Php(); + return new Php(); } /** @@ -207,7 +205,7 @@ protected function getInitialVarDir(): string return __DIR__ . '/../../../../../var'; } - protected function cleanupVarDir($sourceDir) + protected function cleanupVarDir(string $sourceDir) { $fs = new Filesystem(); $varDir = self::$ioRootDir . '/var'; diff --git a/src/lib/Base/Container/ApiLoader/RepositoryFactory.php b/src/lib/Base/Container/ApiLoader/RepositoryFactory.php index a075dd87cb..9be4ebe962 100644 --- a/src/lib/Base/Container/ApiLoader/RepositoryFactory.php +++ b/src/lib/Base/Container/ApiLoader/RepositoryFactory.php @@ -140,7 +140,7 @@ public function buildRepository( * * @return mixed */ - public function buildService(Repository $repository, $serviceName) + public function buildService(Repository $repository, string $serviceName) { $methodName = 'get' . $serviceName . 'Service'; if (!method_exists($repository, $methodName)) { diff --git a/src/lib/Base/Container/Compiler/Persistence/FieldTypeRegistryPass.php b/src/lib/Base/Container/Compiler/Persistence/FieldTypeRegistryPass.php index 3a50cae01e..5d097d994d 100644 --- a/src/lib/Base/Container/Compiler/Persistence/FieldTypeRegistryPass.php +++ b/src/lib/Base/Container/Compiler/Persistence/FieldTypeRegistryPass.php @@ -19,7 +19,7 @@ class FieldTypeRegistryPass extends AbstractFieldTypeBasedPass * * @throws \LogicException */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition(FieldTypeRegistry::class)) { return; diff --git a/src/lib/Base/Container/Compiler/Search/FieldRegistryPass.php b/src/lib/Base/Container/Compiler/Search/FieldRegistryPass.php index 5c80610fe5..89df523c8c 100644 --- a/src/lib/Base/Container/Compiler/Search/FieldRegistryPass.php +++ b/src/lib/Base/Container/Compiler/Search/FieldRegistryPass.php @@ -25,7 +25,7 @@ class FieldRegistryPass implements CompilerPassInterface * * @throws \LogicException */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition(FieldRegistry::class)) { return; diff --git a/src/lib/Base/Container/Compiler/Search/Legacy/CriteriaConverterPass.php b/src/lib/Base/Container/Compiler/Search/Legacy/CriteriaConverterPass.php index def88898f4..d3ffbb7eb0 100644 --- a/src/lib/Base/Container/Compiler/Search/Legacy/CriteriaConverterPass.php +++ b/src/lib/Base/Container/Compiler/Search/Legacy/CriteriaConverterPass.php @@ -21,7 +21,7 @@ class CriteriaConverterPass implements CompilerPassInterface /** * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if ( !$container->hasDefinition('ibexa.search.legacy.gateway.criteria_converter.content') && diff --git a/src/lib/Base/Container/Compiler/Search/Legacy/CriterionFieldValueHandlerRegistryPass.php b/src/lib/Base/Container/Compiler/Search/Legacy/CriterionFieldValueHandlerRegistryPass.php index 76a9100e05..d2a6bf5a7b 100644 --- a/src/lib/Base/Container/Compiler/Search/Legacy/CriterionFieldValueHandlerRegistryPass.php +++ b/src/lib/Base/Container/Compiler/Search/Legacy/CriterionFieldValueHandlerRegistryPass.php @@ -23,7 +23,7 @@ class CriterionFieldValueHandlerRegistryPass implements CompilerPassInterface /** * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition(HandlerRegistry::class)) { return; diff --git a/src/lib/Base/Container/Compiler/Search/Legacy/SortClauseConverterPass.php b/src/lib/Base/Container/Compiler/Search/Legacy/SortClauseConverterPass.php index 49cd59ef8a..7b619b7124 100644 --- a/src/lib/Base/Container/Compiler/Search/Legacy/SortClauseConverterPass.php +++ b/src/lib/Base/Container/Compiler/Search/Legacy/SortClauseConverterPass.php @@ -20,7 +20,7 @@ class SortClauseConverterPass implements CompilerPassInterface /** * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if ( !$container->hasDefinition('ibexa.search.legacy.gateway.sort_clause_converter.content') && diff --git a/src/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPass.php b/src/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPass.php index 0d999b2a34..e8ff834732 100644 --- a/src/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPass.php +++ b/src/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPass.php @@ -26,7 +26,7 @@ class ExternalStorageRegistryPass implements CompilerPassInterface * * @throws \LogicException */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition(StorageRegistry::class)) { return; diff --git a/src/lib/Base/Container/Compiler/Storage/Legacy/RoleLimitationConverterPass.php b/src/lib/Base/Container/Compiler/Storage/Legacy/RoleLimitationConverterPass.php index 75673d2f56..1143c3fb0c 100644 --- a/src/lib/Base/Container/Compiler/Storage/Legacy/RoleLimitationConverterPass.php +++ b/src/lib/Base/Container/Compiler/Storage/Legacy/RoleLimitationConverterPass.php @@ -22,7 +22,7 @@ class RoleLimitationConverterPass implements CompilerPassInterface * * @throws \LogicException */ - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { if (!$container->hasDefinition(LimitationConverter::class)) { return; diff --git a/src/lib/Base/Container/Compiler/TaggedServiceIdsIterator/BackwardCompatibleIterator.php b/src/lib/Base/Container/Compiler/TaggedServiceIdsIterator/BackwardCompatibleIterator.php index dfd87e5880..ea48026f0d 100644 --- a/src/lib/Base/Container/Compiler/TaggedServiceIdsIterator/BackwardCompatibleIterator.php +++ b/src/lib/Base/Container/Compiler/TaggedServiceIdsIterator/BackwardCompatibleIterator.php @@ -17,14 +17,11 @@ */ final class BackwardCompatibleIterator implements IteratorAggregate { - /** @var \Symfony\Component\DependencyInjection\TaggedContainerInterface */ - private $container; + private TaggedContainerInterface $container; - /** @var string */ - private $serviceTag; + private string $serviceTag; - /** @var string */ - private $deprecatedServiceTag; + private string $deprecatedServiceTag; public function __construct(TaggedContainerInterface $container, string $serviceTag, string $deprecatedServiceTag) { diff --git a/src/lib/Base/Exceptions/ContentFieldValidationException.php b/src/lib/Base/Exceptions/ContentFieldValidationException.php index 9c7c15055f..7a4627fdad 100644 --- a/src/lib/Base/Exceptions/ContentFieldValidationException.php +++ b/src/lib/Base/Exceptions/ContentFieldValidationException.php @@ -31,7 +31,7 @@ class ContentFieldValidationException extends APIContentFieldValidationException * * @var array> */ - protected $errors; + protected array $errors; /** @var string|null */ protected $contentName; diff --git a/src/lib/Base/Exceptions/ContentTypeFieldDefinitionValidationException.php b/src/lib/Base/Exceptions/ContentTypeFieldDefinitionValidationException.php index 2e4e8814cf..be63ca5cff 100644 --- a/src/lib/Base/Exceptions/ContentTypeFieldDefinitionValidationException.php +++ b/src/lib/Base/Exceptions/ContentTypeFieldDefinitionValidationException.php @@ -29,7 +29,7 @@ class ContentTypeFieldDefinitionValidationException extends APIContentTypeFieldD * * @var \Ibexa\Core\FieldType\ValidationError[] */ - protected $errors; + protected array $errors; /** * Generates: Content fields did not validate. diff --git a/src/lib/Base/Exceptions/LimitationValidationException.php b/src/lib/Base/Exceptions/LimitationValidationException.php index a1000bde5d..757331c3f1 100644 --- a/src/lib/Base/Exceptions/LimitationValidationException.php +++ b/src/lib/Base/Exceptions/LimitationValidationException.php @@ -24,7 +24,7 @@ class LimitationValidationException extends APILimitationValidationException imp * * @var \Ibexa\Core\FieldType\ValidationError[] */ - protected $errors; + protected array $errors; /** * Generates: Limitations did not validate. diff --git a/src/lib/Base/ServiceContainer.php b/src/lib/Base/ServiceContainer.php index c5cc16002f..b8fb2c91e4 100644 --- a/src/lib/Base/ServiceContainer.php +++ b/src/lib/Base/ServiceContainer.php @@ -89,7 +89,7 @@ public function __construct($container, $installDir, $cacheDir, $debug = false, * * @return \Ibexa\Contracts\Core\Repository\Repository */ - public function getRepository() + public function getRepository(): ?object { return $this->innerContainer->get('ibexa.api.repository'); } @@ -109,7 +109,7 @@ public function getInnerContainer() * * @return object */ - public function get($id) + public function get(string $id): ?object { return $this->innerContainer->get($id); } @@ -121,7 +121,7 @@ public function get($id) * * @return mixed */ - public function getParameter($name) + public function getParameter(string $name) { return $this->innerContainer->getParameter($name); } diff --git a/src/lib/Base/TranslatableBase.php b/src/lib/Base/TranslatableBase.php index d77971497b..aea950f500 100644 --- a/src/lib/Base/TranslatableBase.php +++ b/src/lib/Base/TranslatableBase.php @@ -16,7 +16,7 @@ trait TranslatableBase private $parameters = []; - public function setMessageTemplate($messageTemplate) + public function setMessageTemplate($messageTemplate): void { $this->messageTemplate = $messageTemplate; } @@ -26,17 +26,17 @@ public function getMessageTemplate() return $this->messageTemplate; } - public function setParameters(array $parameters) + public function setParameters(array $parameters): void { $this->parameters = $parameters; } - public function addParameter($name, $value) + public function addParameter($name, $value): void { $this->parameters[$name] = $value; } - public function addParameters(array $parameters) + public function addParameters(array $parameters): void { $this->parameters += $parameters; } diff --git a/src/lib/Base/Utils/DeprecationWarner.php b/src/lib/Base/Utils/DeprecationWarner.php index b592fc52d9..5f43c26da5 100644 --- a/src/lib/Base/Utils/DeprecationWarner.php +++ b/src/lib/Base/Utils/DeprecationWarner.php @@ -9,7 +9,7 @@ class DeprecationWarner implements DeprecationWarnerInterface { - public function log($message) + public function log($message): void { @trigger_error($message, E_USER_DEPRECATED); } diff --git a/src/lib/Event/BookmarkService.php b/src/lib/Event/BookmarkService.php index c0daea036c..3da0d4f93b 100644 --- a/src/lib/Event/BookmarkService.php +++ b/src/lib/Event/BookmarkService.php @@ -19,8 +19,7 @@ class BookmarkService extends BookmarkServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( BookmarkServiceInterface $innerService, diff --git a/src/lib/Event/ContentService.php b/src/lib/Event/ContentService.php index e9f4fb9a67..b96e2c6389 100644 --- a/src/lib/Event/ContentService.php +++ b/src/lib/Event/ContentService.php @@ -50,8 +50,7 @@ class ContentService extends ContentServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( ContentServiceInterface $innerService, diff --git a/src/lib/Event/ContentTypeService.php b/src/lib/Event/ContentTypeService.php index a1714e29fa..3948de9fa3 100644 --- a/src/lib/Event/ContentTypeService.php +++ b/src/lib/Event/ContentTypeService.php @@ -55,8 +55,7 @@ class ContentTypeService extends ContentTypeServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( ContentTypeServiceInterface $innerService, diff --git a/src/lib/Event/FieldTypeService.php b/src/lib/Event/FieldTypeService.php index a4b72a6805..bab18407d0 100644 --- a/src/lib/Event/FieldTypeService.php +++ b/src/lib/Event/FieldTypeService.php @@ -14,8 +14,7 @@ class FieldTypeService extends FieldTypeServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( FieldTypeServiceInterface $innerService, diff --git a/src/lib/Event/LanguageService.php b/src/lib/Event/LanguageService.php index ca8402ce5d..a28c6ea686 100644 --- a/src/lib/Event/LanguageService.php +++ b/src/lib/Event/LanguageService.php @@ -26,8 +26,7 @@ class LanguageService extends LanguageServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( LanguageServiceInterface $innerService, diff --git a/src/lib/Event/LocationService.php b/src/lib/Event/LocationService.php index 4af4d37c4b..8c387788e7 100644 --- a/src/lib/Event/LocationService.php +++ b/src/lib/Event/LocationService.php @@ -34,8 +34,7 @@ class LocationService extends LocationServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( LocationServiceInterface $innerService, diff --git a/src/lib/Event/NotificationService.php b/src/lib/Event/NotificationService.php index 414588b71b..110fe391e3 100644 --- a/src/lib/Event/NotificationService.php +++ b/src/lib/Event/NotificationService.php @@ -22,8 +22,7 @@ class NotificationService extends NotificationServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( NotificationServiceInterface $innerService, diff --git a/src/lib/Event/ObjectStateService.php b/src/lib/Event/ObjectStateService.php index dced3aaccf..b09ca6182d 100644 --- a/src/lib/Event/ObjectStateService.php +++ b/src/lib/Event/ObjectStateService.php @@ -37,8 +37,7 @@ class ObjectStateService extends ObjectStateServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( ObjectStateServiceInterface $innerService, diff --git a/src/lib/Event/Repository.php b/src/lib/Event/Repository.php index 5a7cde3043..5dd6567583 100644 --- a/src/lib/Event/Repository.php +++ b/src/lib/Event/Repository.php @@ -8,81 +8,80 @@ namespace Ibexa\Core\Event; +use Ibexa\Contracts\Core\Repository\BookmarkService; use Ibexa\Contracts\Core\Repository\BookmarkService as BookmarkServiceInterface; +use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentService as ContentServiceInterface; +use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\ContentTypeService as ContentTypeServiceInterface; +use Ibexa\Contracts\Core\Repository\FieldTypeService; use Ibexa\Contracts\Core\Repository\FieldTypeService as FieldTypeServiceInterface; +use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\LanguageService as LanguageServiceInterface; +use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\LocationService as LocationServiceInterface; +use Ibexa\Contracts\Core\Repository\NotificationService; use Ibexa\Contracts\Core\Repository\NotificationService as NotificationServiceInterface; +use Ibexa\Contracts\Core\Repository\ObjectStateService; use Ibexa\Contracts\Core\Repository\ObjectStateService as ObjectStateServiceInterface; use Ibexa\Contracts\Core\Repository\PermissionResolver as PermissionResolverInterface; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; +use Ibexa\Contracts\Core\Repository\RoleService; use Ibexa\Contracts\Core\Repository\RoleService as RoleServiceInterface; +use Ibexa\Contracts\Core\Repository\SearchService; use Ibexa\Contracts\Core\Repository\SearchService as SearchServiceInterface; +use Ibexa\Contracts\Core\Repository\SectionService; use Ibexa\Contracts\Core\Repository\SectionService as SectionServiceInterface; +use Ibexa\Contracts\Core\Repository\TrashService; use Ibexa\Contracts\Core\Repository\TrashService as TrashServiceInterface; +use Ibexa\Contracts\Core\Repository\URLAliasService; use Ibexa\Contracts\Core\Repository\URLAliasService as URLAliasServiceInterface; +use Ibexa\Contracts\Core\Repository\URLService; use Ibexa\Contracts\Core\Repository\URLService as URLServiceInterface; +use Ibexa\Contracts\Core\Repository\URLWildcardService; use Ibexa\Contracts\Core\Repository\URLWildcardService as URLWildcardServiceInterface; +use Ibexa\Contracts\Core\Repository\UserPreferenceService; use Ibexa\Contracts\Core\Repository\UserPreferenceService as UserPreferenceServiceInterface; +use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\UserService as UserServiceInterface; final class Repository implements RepositoryInterface { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - private $repository; + private RepositoryInterface $repository; - /** @var \Ibexa\Contracts\Core\Repository\BookmarkService */ - private $bookmarkService; + private BookmarkService $bookmarkService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - private $contentTypeService; + private ContentTypeService $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ - private $fieldTypeService; + private FieldTypeService $fieldTypeService; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ - private $languageService; + private LanguageService $languageService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - private $locationService; + private LocationService $locationService; - /** @var \Ibexa\Contracts\Core\Repository\NotificationService */ - private $notificationService; + private NotificationService $notificationService; - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ - private $objectStateService; + private ObjectStateService $objectStateService; - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ - private $roleService; + private RoleService $roleService; - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ - private $searchService; + private SearchService $searchService; - /** @var \Ibexa\Contracts\Core\Repository\SectionService */ - private $sectionService; + private SectionService $sectionService; - /** @var \Ibexa\Contracts\Core\Repository\TrashService */ - private $trashService; + private TrashService $trashService; - /** @var \Ibexa\Contracts\Core\Repository\URLAliasService */ - private $urlAliasService; + private URLAliasService $urlAliasService; - /** @var \Ibexa\Contracts\Core\Repository\URLService */ - private $urlService; + private URLService $urlService; - /** @var \Ibexa\Contracts\Core\Repository\URLWildcardService */ - private $urlWildcardService; + private URLWildcardService $urlWildcardService; - /** @var \Ibexa\Contracts\Core\Repository\UserPreferenceService */ - private $userPreferenceService; + private UserPreferenceService $userPreferenceService; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ - private $userService; + private UserService $userService; public function __construct( RepositoryInterface $repository, diff --git a/src/lib/Event/RoleService.php b/src/lib/Event/RoleService.php index af8d128a65..28871478d2 100644 --- a/src/lib/Event/RoleService.php +++ b/src/lib/Event/RoleService.php @@ -52,8 +52,7 @@ class RoleService extends RoleServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( RoleServiceInterface $innerService, diff --git a/src/lib/Event/SearchService.php b/src/lib/Event/SearchService.php index e75dba3f1b..ff19ffbae1 100644 --- a/src/lib/Event/SearchService.php +++ b/src/lib/Event/SearchService.php @@ -14,8 +14,7 @@ class SearchService extends SearchServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( SearchServiceInterface $innerService, diff --git a/src/lib/Event/SectionService.php b/src/lib/Event/SectionService.php index e98bf95b23..29a482f466 100644 --- a/src/lib/Event/SectionService.php +++ b/src/lib/Event/SectionService.php @@ -29,8 +29,7 @@ class SectionService extends SectionServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( SectionServiceInterface $innerService, diff --git a/src/lib/Event/SettingService.php b/src/lib/Event/SettingService.php index 45bbafd46b..380eb5be92 100644 --- a/src/lib/Event/SettingService.php +++ b/src/lib/Event/SettingService.php @@ -23,8 +23,7 @@ final class SettingService extends SettingServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - private $eventDispatcher; + private EventDispatcherInterface $eventDispatcher; public function __construct( SettingServiceInterface $innerService, diff --git a/src/lib/Event/TranslationService.php b/src/lib/Event/TranslationService.php index 4d535e4323..453b61a86e 100644 --- a/src/lib/Event/TranslationService.php +++ b/src/lib/Event/TranslationService.php @@ -14,8 +14,7 @@ class TranslationService extends TranslationServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( TranslationServiceInterface $innerService, diff --git a/src/lib/Event/TrashService.php b/src/lib/Event/TrashService.php index b2d900bb60..7b99612f9c 100644 --- a/src/lib/Event/TrashService.php +++ b/src/lib/Event/TrashService.php @@ -26,8 +26,7 @@ class TrashService extends TrashServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( TrashServiceInterface $innerService, diff --git a/src/lib/Event/URLAliasService.php b/src/lib/Event/URLAliasService.php index 7dc7426bd5..9df5532d16 100644 --- a/src/lib/Event/URLAliasService.php +++ b/src/lib/Event/URLAliasService.php @@ -24,8 +24,7 @@ class URLAliasService extends URLAliasServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( URLAliasServiceInterface $innerService, diff --git a/src/lib/Event/URLService.php b/src/lib/Event/URLService.php index 8460bcd838..7e3ba5db84 100644 --- a/src/lib/Event/URLService.php +++ b/src/lib/Event/URLService.php @@ -18,8 +18,7 @@ class URLService extends URLServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( URLServiceInterface $innerService, diff --git a/src/lib/Event/URLWildcardService.php b/src/lib/Event/URLWildcardService.php index 80a07b8ea1..5cea6ca726 100644 --- a/src/lib/Event/URLWildcardService.php +++ b/src/lib/Event/URLWildcardService.php @@ -25,8 +25,7 @@ class URLWildcardService extends URLWildcardServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( URLWildcardServiceInterface $innerService, @@ -41,7 +40,7 @@ public function create( string $sourceUrl, string $destinationUrl, bool $forward = false - ): UrlWildcard { + ): URLWildcard { $eventData = [ $sourceUrl, $destinationUrl, diff --git a/src/lib/Event/UserPreferenceService.php b/src/lib/Event/UserPreferenceService.php index 11ba84a4ce..e01e22338a 100644 --- a/src/lib/Event/UserPreferenceService.php +++ b/src/lib/Event/UserPreferenceService.php @@ -16,8 +16,7 @@ class UserPreferenceService extends UserPreferenceServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( UserPreferenceServiceInterface $innerService, diff --git a/src/lib/Event/UserService.php b/src/lib/Event/UserService.php index 94b7346d1f..f0a4786027 100644 --- a/src/lib/Event/UserService.php +++ b/src/lib/Event/UserService.php @@ -43,8 +43,7 @@ class UserService extends UserServiceDecorator { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct( UserServiceInterface $innerService, diff --git a/src/lib/FieldType/Author/AuthorCollection.php b/src/lib/FieldType/Author/AuthorCollection.php index 2d1081ccbf..f563b1fc93 100644 --- a/src/lib/FieldType/Author/AuthorCollection.php +++ b/src/lib/FieldType/Author/AuthorCollection.php @@ -65,7 +65,7 @@ public function offsetSet($offset, $value): void * * @param array $authorIds Author's Ids to remove from current collection */ - public function removeAuthorsById(array $authorIds) + public function removeAuthorsById(array $authorIds): void { $aAuthors = $this->getArrayCopy(); foreach ($aAuthors as $i => $author) { diff --git a/src/lib/FieldType/Author/SearchField.php b/src/lib/FieldType/Author/SearchField.php index ea1615bd8a..3e666e075c 100644 --- a/src/lib/FieldType/Author/SearchField.php +++ b/src/lib/FieldType/Author/SearchField.php @@ -18,7 +18,7 @@ */ class SearchField implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { $name = []; $id = []; @@ -75,7 +75,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) ]; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'name' => new Search\FieldType\MultipleStringField(), diff --git a/src/lib/FieldType/Author/Type.php b/src/lib/FieldType/Author/Type.php index 5fa7348ecf..e05feb5013 100644 --- a/src/lib/FieldType/Author/Type.php +++ b/src/lib/FieldType/Author/Type.php @@ -66,7 +66,7 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin * * @return \Ibexa\Core\FieldType\Author\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(); } @@ -108,7 +108,7 @@ protected function checkValueStructure(BaseValue $value) /** * {@inheritdoc} */ - protected function getSortInfo(BaseValue $value) + protected function getSortInfo(BaseValue $value): false|string { if (empty($value->authors)) { return false; @@ -131,11 +131,11 @@ protected function getSortInfo(BaseValue $value) * * @return \Ibexa\Core\FieldType\Author\Value $value */ - public function fromHash($hash) + public function fromHash($hash): Value { return new Value( array_map( - static function ($author) { + static function ($author): Author { return new Author($author); }, $hash @@ -153,7 +153,7 @@ static function ($author) { public function toHash(SPIValue $value): array { return array_map( - static function ($author) { + static function ($author): array { return (array)$author; }, $value->authors->getArrayCopy() @@ -177,7 +177,7 @@ public function isSearchable(): bool * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validateFieldSettings($fieldSettings) + public function validateFieldSettings($fieldSettings): array { $validationErrors = []; @@ -208,7 +208,7 @@ public function validateFieldSettings($fieldSettings) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError|null */ - private function validateSettingName($name) + private function validateSettingName($name): ?ValidationError { if (!isset($this->settingsSchema[$name])) { return new ValidationError( @@ -232,7 +232,7 @@ private function validateSettingName($name) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError|null */ - private function validateDefaultAuthorSetting($name, $value) + private function validateDefaultAuthorSetting(int|string $name, $value): ?ValidationError { $definedValues = [ self::DEFAULT_VALUE_EMPTY, diff --git a/src/lib/FieldType/Author/Value.php b/src/lib/FieldType/Author/Value.php index bac3dfa70b..e156dacf82 100644 --- a/src/lib/FieldType/Author/Value.php +++ b/src/lib/FieldType/Author/Value.php @@ -31,7 +31,7 @@ public function __construct(array $authors = []) $this->authors = new AuthorCollection($authors); } - public function __toString() + public function __toString(): string { if (empty($this->authors)) { return ''; diff --git a/src/lib/FieldType/BinaryBase/BinaryBaseStorage.php b/src/lib/FieldType/BinaryBase/BinaryBaseStorage.php index 7a19ebb623..a3698a7ec4 100644 --- a/src/lib/FieldType/BinaryBase/BinaryBaseStorage.php +++ b/src/lib/FieldType/BinaryBase/BinaryBaseStorage.php @@ -25,23 +25,19 @@ class BinaryBaseStorage extends GatewayBasedStorage { /** * An instance of IOService configured to store to the images folder. - * - * @var \Ibexa\Core\IO\IOServiceInterface */ - protected $ioService; + protected IOServiceInterface $ioService; protected PathGeneratorInterface $pathGenerator; - /** @var \Ibexa\Contracts\Core\IO\MimeTypeDetector */ - protected $mimeTypeDetector; + protected MimeTypeDetector $mimeTypeDetector; protected PathGeneratorInterface $downloadUrlGenerator; /** @var \Ibexa\Core\FieldType\BinaryBase\BinaryBaseStorage\Gateway */ protected $gateway; - /** @var \Ibexa\Core\FieldType\Validator\FileExtensionBlackListValidator */ - protected $fileExtensionBlackListValidator; + protected FileExtensionBlackListValidator $fileExtensionBlackListValidator; public function __construct( StorageGatewayInterface $gateway, @@ -57,7 +53,7 @@ public function __construct( $this->fileExtensionBlackListValidator = $fileExtensionBlackListValidator; } - public function setDownloadUrlGenerator(PathGeneratorInterface $downloadUrlGenerator) + public function setDownloadUrlGenerator(PathGeneratorInterface $downloadUrlGenerator): void { $this->downloadUrlGenerator = $downloadUrlGenerator; } @@ -150,7 +146,7 @@ protected function removeOldFile($fieldId, $versionNo) } } - public function getFieldData(VersionInfo $versionInfo, Field $field) + public function getFieldData(VersionInfo $versionInfo, Field $field): void { $field->value->externalData = $this->gateway->getFileReferenceData($field->id, $versionInfo->versionNo); if ($field->value->externalData !== null) { @@ -174,7 +170,7 @@ public function getFieldData(VersionInfo $versionInfo, Field $field) } } - public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds) + public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds): void { if (empty($fieldIds)) { return; @@ -194,7 +190,7 @@ public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds) } } - public function hasFieldData() + public function hasFieldData(): bool { return true; } diff --git a/src/lib/FieldType/BinaryBase/BinaryBaseStorage/Gateway/DoctrineStorage.php b/src/lib/FieldType/BinaryBase/BinaryBaseStorage/Gateway/DoctrineStorage.php index 9d12671fb8..122ff5e9a0 100644 --- a/src/lib/FieldType/BinaryBase/BinaryBaseStorage/Gateway/DoctrineStorage.php +++ b/src/lib/FieldType/BinaryBase/BinaryBaseStorage/Gateway/DoctrineStorage.php @@ -20,8 +20,7 @@ */ abstract class DoctrineStorage extends Gateway { - /** @var \Doctrine\DBAL\Connection */ - protected $connection; + protected Connection $connection; public function __construct(Connection $connection) { @@ -299,7 +298,7 @@ protected function castToPropertyValue($value, $columnName) * * @return string */ - public function prependMimeToPath($path, $mimeType) + public function prependMimeToPath(string $path, $mimeType) { $res = substr($mimeType, 0, strpos($mimeType, '/')) . '/' . $path; @@ -312,7 +311,7 @@ public function prependMimeToPath($path, $mimeType) * @param array $fieldIds * @param int $versionNo */ - public function removeFileReferences(array $fieldIds, $versionNo) + public function removeFileReferences(array $fieldIds, $versionNo): void { if (empty($fieldIds)) { return; @@ -346,7 +345,7 @@ public function removeFileReferences(array $fieldIds, $versionNo) * @param int $fieldId * @param int $versionNo */ - public function removeFileReference($fieldId, $versionNo) + public function removeFileReference($fieldId, $versionNo): void { $deleteQuery = $this->connection->createQueryBuilder(); $deleteQuery @@ -409,7 +408,7 @@ public function getReferencedFiles(array $fieldIds, $versionNo) $statement = $selectQuery->execute(); return array_map( - function ($row) { + function (array $row) { return $this->prependMimeToPath($row['filename'], $row['mime_type']); }, $statement->fetchAll(PDO::FETCH_ASSOC) diff --git a/src/lib/FieldType/BinaryBase/Type.php b/src/lib/FieldType/BinaryBase/Type.php index 8fcd7d0816..e36ad27188 100644 --- a/src/lib/FieldType/BinaryBase/Type.php +++ b/src/lib/FieldType/BinaryBase/Type.php @@ -32,10 +32,9 @@ abstract class Type extends FieldType ]; /** @var \Ibexa\Core\FieldType\Validator[] */ - private $validators; + private array $validators; - /** @var \Ibexa\Contracts\Core\FieldType\BinaryBase\RouteAwarePathGenerator|null */ - protected $routeAwarePathGenerator; + protected ?RouteAwarePathGenerator $routeAwarePathGenerator; /** * @param \Ibexa\Core\FieldType\Validator[] $validators diff --git a/src/lib/FieldType/BinaryBase/Value.php b/src/lib/FieldType/BinaryBase/Value.php index 8def62307b..e8a9a8c90b 100644 --- a/src/lib/FieldType/BinaryBase/Value.php +++ b/src/lib/FieldType/BinaryBase/Value.php @@ -88,7 +88,7 @@ public function __construct(array $fileData = []) * * @return string */ - public function __toString() + public function __toString(): string { return (string)$this->uri; } diff --git a/src/lib/FieldType/BinaryFile/Type.php b/src/lib/FieldType/BinaryFile/Type.php index a5474a481e..795e8c7f37 100644 --- a/src/lib/FieldType/BinaryFile/Type.php +++ b/src/lib/FieldType/BinaryFile/Type.php @@ -37,7 +37,7 @@ public function getFieldTypeIdentifier(): string * * @return \Ibexa\Core\FieldType\BinaryFile\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(); } @@ -49,7 +49,7 @@ public function getEmptyValue() * * @return \Ibexa\Core\FieldType\BinaryFile\Value */ - protected function createValue(array $inputValue) + protected function createValue(array $inputValue): Value { $inputValue = $this->regenerateUri($inputValue); @@ -61,7 +61,7 @@ protected function createValue(array $inputValue) * * @param \Ibexa\Core\FieldType\BinaryFile\Value|\Ibexa\Core\FieldType\Value $value */ - protected function completeValue(Basevalue $value) + protected function completeValue(BaseValue $value) { parent::completeValue($value); diff --git a/src/lib/FieldType/Checkbox/SearchField.php b/src/lib/FieldType/Checkbox/SearchField.php index 842e87f6cb..58eb57f75f 100644 --- a/src/lib/FieldType/Checkbox/SearchField.php +++ b/src/lib/FieldType/Checkbox/SearchField.php @@ -17,7 +17,7 @@ */ class SearchField implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { return [ new Search\Field( @@ -28,7 +28,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) ]; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'value' => new Search\FieldType\BooleanField(), @@ -58,7 +58,7 @@ public function getDefaultMatchField(): string * * @return string */ - public function getDefaultSortField() + public function getDefaultSortField(): string { return $this->getDefaultMatchField(); } diff --git a/src/lib/FieldType/Checkbox/Type.php b/src/lib/FieldType/Checkbox/Type.php index 5733bd9c8d..91872dfa6f 100644 --- a/src/lib/FieldType/Checkbox/Type.php +++ b/src/lib/FieldType/Checkbox/Type.php @@ -46,7 +46,7 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin * * @return \Ibexa\Core\FieldType\Checkbox\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(false); } @@ -117,7 +117,7 @@ protected function getSortInfo(BaseValue $value): int * * @return \Ibexa\Core\FieldType\Checkbox\Value $value */ - public function fromHash($hash) + public function fromHash($hash): Value { return new Value($hash); } diff --git a/src/lib/FieldType/Checkbox/Value.php b/src/lib/FieldType/Checkbox/Value.php index a1339ee241..1a98fe6a58 100644 --- a/src/lib/FieldType/Checkbox/Value.php +++ b/src/lib/FieldType/Checkbox/Value.php @@ -34,7 +34,7 @@ public function __construct($boolValue = false) /** * @return string */ - public function __toString() + public function __toString(): string { return $this->bool ? '1' : '0'; } diff --git a/src/lib/FieldType/Country/SearchField.php b/src/lib/FieldType/Country/SearchField.php index 4ca6e75998..4e641b0e7e 100644 --- a/src/lib/FieldType/Country/SearchField.php +++ b/src/lib/FieldType/Country/SearchField.php @@ -17,8 +17,7 @@ */ class SearchField implements Indexable { - /** @var array */ - protected $countriesInfo; + protected array $countriesInfo; /** * @param array $countriesInfo Array of countries data @@ -28,7 +27,10 @@ public function __construct(array $countriesInfo) $this->countriesInfo = $countriesInfo; } - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + /** + * @return \Ibexa\Contracts\Core\Search\Field[] + */ + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { if (empty($field->value->data)) { return []; @@ -82,7 +84,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) ]; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'idc' => new Search\FieldType\MultipleIntegerField(), diff --git a/src/lib/FieldType/Country/Type.php b/src/lib/FieldType/Country/Type.php index 9f36c3c020..5e3c9686b0 100644 --- a/src/lib/FieldType/Country/Type.php +++ b/src/lib/FieldType/Country/Type.php @@ -31,8 +31,7 @@ class Type extends FieldType implements TranslationContainerInterface ], ]; - /** @var array */ - protected $countriesInfo; + protected array $countriesInfo; /** * @param array $countriesInfo Array of countries data @@ -66,7 +65,7 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin * * @return \Ibexa\Core\FieldType\Country\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(); } @@ -117,7 +116,7 @@ protected function checkValueStructure(BaseValue $value) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue) + public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue): array { $validationErrors = []; @@ -232,7 +231,7 @@ public function isSearchable(): bool * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validateFieldSettings($fieldSettings) + public function validateFieldSettings($fieldSettings): array { $validationErrors = []; diff --git a/src/lib/FieldType/Country/Value.php b/src/lib/FieldType/Country/Value.php index d72e0c44a1..a1df55a59b 100644 --- a/src/lib/FieldType/Country/Value.php +++ b/src/lib/FieldType/Country/Value.php @@ -43,7 +43,7 @@ public function __construct(array $countries = []) $this->countries = $countries; } - public function __toString() + public function __toString(): string { return implode(', ', array_column($this->countries, 'Name')); } diff --git a/src/lib/FieldType/Date/SearchField.php b/src/lib/FieldType/Date/SearchField.php index 11c28c61b3..a4eab2f700 100644 --- a/src/lib/FieldType/Date/SearchField.php +++ b/src/lib/FieldType/Date/SearchField.php @@ -18,7 +18,7 @@ */ class SearchField implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { if ($field->value->data !== null) { $dateTime = new DateTime("@{$field->value->data['timestamp']}"); @@ -37,7 +37,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) ]; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'value' => new Search\FieldType\DateField(), @@ -67,7 +67,7 @@ public function getDefaultMatchField(): string * * @return string */ - public function getDefaultSortField() + public function getDefaultSortField(): string { return $this->getDefaultMatchField(); } diff --git a/src/lib/FieldType/Date/Type.php b/src/lib/FieldType/Date/Type.php index 642ab8e245..5226afe366 100644 --- a/src/lib/FieldType/Date/Type.php +++ b/src/lib/FieldType/Date/Type.php @@ -65,7 +65,7 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin * * @return \Ibexa\Core\FieldType\Date\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(); } @@ -119,7 +119,7 @@ protected function checkValueStructure(BaseValue $value) * * @return mixed */ - protected function getSortInfo(BaseValue $value) + protected function getSortInfo(BaseValue $value): ?int { if ($value->date === null) { return null; @@ -162,7 +162,7 @@ public function fromHash($hash) * * @return mixed */ - public function toHash(SPIValue $value) + public function toHash(SPIValue $value): ?array { if ($this->isEmptyValue($value)) { return null; @@ -198,7 +198,7 @@ public function isSearchable(): bool * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validateFieldSettings($fieldSettings) + public function validateFieldSettings($fieldSettings): array { $validationErrors = []; diff --git a/src/lib/FieldType/Date/Value.php b/src/lib/FieldType/Date/Value.php index 62b46e7885..f1708b3513 100644 --- a/src/lib/FieldType/Date/Value.php +++ b/src/lib/FieldType/Date/Value.php @@ -56,7 +56,7 @@ public function __construct(DateTime $dateTime = null) * * @return \Ibexa\Core\FieldType\Date\Value */ - public static function fromString($dateString) + public static function fromString($dateString): static { try { return new static(new DateTime($dateString, new DateTimeZone('UTC'))); @@ -74,7 +74,7 @@ public static function fromString($dateString) * * @return \Ibexa\Core\FieldType\Date\Value */ - public static function fromTimestamp($timestamp) + public static function fromTimestamp($timestamp): static { try { return new static(new DateTime("@{$timestamp}")); @@ -83,7 +83,7 @@ public static function fromTimestamp($timestamp) } } - public function __toString() + public function __toString(): string { if (!$this->date instanceof DateTime) { return ''; diff --git a/src/lib/FieldType/DateAndTime/SearchField.php b/src/lib/FieldType/DateAndTime/SearchField.php index 60a4b14f8c..4f6d7b32ae 100644 --- a/src/lib/FieldType/DateAndTime/SearchField.php +++ b/src/lib/FieldType/DateAndTime/SearchField.php @@ -17,7 +17,7 @@ */ class SearchField implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { return [ new Search\Field( @@ -28,7 +28,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) ]; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'value' => new Search\FieldType\DateField(), @@ -58,7 +58,7 @@ public function getDefaultMatchField(): string * * @return string */ - public function getDefaultSortField() + public function getDefaultSortField(): string { return $this->getDefaultMatchField(); } diff --git a/src/lib/FieldType/DateAndTime/Type.php b/src/lib/FieldType/DateAndTime/Type.php index cfdc9fb3c9..ccce0d98bb 100644 --- a/src/lib/FieldType/DateAndTime/Type.php +++ b/src/lib/FieldType/DateAndTime/Type.php @@ -75,7 +75,7 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin * * @return \Ibexa\Core\FieldType\DateAndTime\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(); } @@ -129,7 +129,7 @@ protected function checkValueStructure(BaseValue $value) * * @return int|null */ - protected function getSortInfo(BaseValue $value) + protected function getSortInfo(BaseValue $value): ?int { if ($value->value === null) { return null; @@ -172,7 +172,7 @@ public function fromHash($hash) * * @return mixed */ - public function toHash(SPIValue $value) + public function toHash(SPIValue $value): ?array { if ($this->isEmptyValue($value)) { return null; @@ -208,7 +208,7 @@ public function isSearchable(): bool * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validateFieldSettings($fieldSettings) + public function validateFieldSettings($fieldSettings): array { $validationErrors = []; diff --git a/src/lib/FieldType/DateAndTime/Value.php b/src/lib/FieldType/DateAndTime/Value.php index fe9865df65..620eff0088 100644 --- a/src/lib/FieldType/DateAndTime/Value.php +++ b/src/lib/FieldType/DateAndTime/Value.php @@ -48,7 +48,7 @@ public function __construct(DateTime $dateTime = null) * * @return \Ibexa\Core\FieldType\DateAndTime\Value */ - public static function fromString($dateString) + public static function fromString($dateString): static { try { return new static(new DateTime($dateString)); @@ -64,7 +64,7 @@ public static function fromString($dateString) * * @return \Ibexa\Core\FieldType\DateAndTime\Value */ - public static function fromTimestamp($timestamp) + public static function fromTimestamp($timestamp): static { try { return new static(new DateTime("@{$timestamp}")); @@ -73,7 +73,7 @@ public static function fromTimestamp($timestamp) } } - public function __toString() + public function __toString(): string { if (!$this->value instanceof DateTime) { return ''; diff --git a/src/lib/FieldType/EmailAddress/SearchField.php b/src/lib/FieldType/EmailAddress/SearchField.php index e61724e5ba..176286ab9e 100644 --- a/src/lib/FieldType/EmailAddress/SearchField.php +++ b/src/lib/FieldType/EmailAddress/SearchField.php @@ -17,7 +17,7 @@ */ class SearchField implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { return [ new Search\Field( @@ -41,7 +41,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) ]; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'value' => new Search\FieldType\StringField(), @@ -71,7 +71,7 @@ public function getDefaultMatchField(): string * * @return string */ - public function getDefaultSortField() + public function getDefaultSortField(): string { return $this->getDefaultMatchField(); } diff --git a/src/lib/FieldType/EmailAddress/Type.php b/src/lib/FieldType/EmailAddress/Type.php index ef0d55bda5..ee23e12eec 100644 --- a/src/lib/FieldType/EmailAddress/Type.php +++ b/src/lib/FieldType/EmailAddress/Type.php @@ -43,7 +43,7 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validateValidatorConfiguration($validatorConfiguration) + public function validateValidatorConfiguration($validatorConfiguration): array { $validationErrors = []; $validator = new EmailAddressValidator(); @@ -114,7 +114,7 @@ public function getFieldTypeIdentifier(): string * * @return \Ibexa\Core\FieldType\EmailAddress\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(); } diff --git a/src/lib/FieldType/EmailAddress/Value.php b/src/lib/FieldType/EmailAddress/Value.php index c7ac67a44c..4deed9d568 100644 --- a/src/lib/FieldType/EmailAddress/Value.php +++ b/src/lib/FieldType/EmailAddress/Value.php @@ -31,7 +31,7 @@ public function __construct($email = '') $this->email = $email; } - public function __toString() + public function __toString(): string { return (string)$this->email; } diff --git a/src/lib/FieldType/FieldType.php b/src/lib/FieldType/FieldType.php index 6414b4d118..5d72512196 100644 --- a/src/lib/FieldType/FieldType.php +++ b/src/lib/FieldType/FieldType.php @@ -67,7 +67,7 @@ abstract class FieldType extends SPIFieldType implements Comparable /** * @param \Ibexa\Core\Persistence\TransformationProcessor $transformationProcessor */ - public function setTransformationProcessor(TransformationProcessor $transformationProcessor) + public function setTransformationProcessor(TransformationProcessor $transformationProcessor): void { $this->transformationProcessor = $transformationProcessor; } @@ -178,7 +178,7 @@ public function validateValidatorConfiguration($validatorConfiguration) * * @param mixed $validatorConfiguration */ - public function applyDefaultValidatorConfiguration(&$validatorConfiguration) + public function applyDefaultValidatorConfiguration(&$validatorConfiguration): void { if ($validatorConfiguration !== null && !is_array($validatorConfiguration)) { throw new InvalidArgumentType('$validatorConfiguration', 'array|null', $validatorConfiguration); @@ -237,7 +237,7 @@ public function validateFieldSettings($fieldSettings) * * @param mixed $fieldSettings */ - public function applyDefaultSettings(&$fieldSettings) + public function applyDefaultSettings(&$fieldSettings): void { if ($fieldSettings !== null && !is_array($fieldSettings)) { throw new InvalidArgumentType('$fieldSettings', 'array|null', $fieldSettings); diff --git a/src/lib/FieldType/FieldTypeRegistry.php b/src/lib/FieldType/FieldTypeRegistry.php index f19f050806..5eee49e591 100644 --- a/src/lib/FieldType/FieldTypeRegistry.php +++ b/src/lib/FieldType/FieldTypeRegistry.php @@ -21,7 +21,7 @@ class FieldTypeRegistry protected $fieldTypes; /** @var string[] */ - private $concreteFieldTypesIdentifiers; + private ?array $concreteFieldTypesIdentifiers = null; /** * @param \Ibexa\Contracts\Core\FieldType\FieldType[] $fieldTypes Hash of SPI FieldTypes where key is identifier diff --git a/src/lib/FieldType/Float/SearchField.php b/src/lib/FieldType/Float/SearchField.php index 1aba06c7fe..fccafbc1cf 100644 --- a/src/lib/FieldType/Float/SearchField.php +++ b/src/lib/FieldType/Float/SearchField.php @@ -17,7 +17,7 @@ */ class SearchField implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { return [ new Search\Field( @@ -33,7 +33,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) ]; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'value' => new Search\FieldType\FloatField(), @@ -63,7 +63,7 @@ public function getDefaultMatchField(): string * * @return string */ - public function getDefaultSortField() + public function getDefaultSortField(): string { return $this->getDefaultMatchField(); } diff --git a/src/lib/FieldType/Float/Value.php b/src/lib/FieldType/Float/Value.php index fd79d55c9c..7294f8ed69 100644 --- a/src/lib/FieldType/Float/Value.php +++ b/src/lib/FieldType/Float/Value.php @@ -31,7 +31,7 @@ public function __construct($value = null) $this->value = $value; } - public function __toString() + public function __toString(): string { return (string)$this->value; } diff --git a/src/lib/FieldType/ISBN/Type.php b/src/lib/FieldType/ISBN/Type.php index 2b56fd0435..152c8861eb 100644 --- a/src/lib/FieldType/ISBN/Type.php +++ b/src/lib/FieldType/ISBN/Type.php @@ -62,7 +62,7 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin * * @return \Ibexa\Core\FieldType\ISBN\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(); } @@ -125,7 +125,7 @@ protected function checkValueStructure(BaseValue $value) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue) + public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue): array { $validationErrors = []; if ($this->isEmptyValue($fieldValue)) { @@ -230,7 +230,7 @@ public function isSearchable(): bool * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validateFieldSettings($fieldSettings) + public function validateFieldSettings($fieldSettings): array { $validationErrors = []; @@ -275,7 +275,7 @@ public function validateFieldSettings($fieldSettings) * * @return bool */ - private function validateISBNChecksum($isbnNr): bool + private function validateISBNChecksum(string|array|null $isbnNr): bool { $result = 0; $isbnNr = strtoupper($isbnNr); @@ -303,7 +303,7 @@ private function validateISBNChecksum($isbnNr): bool * * @return bool */ - private function validateISBN13Checksum($isbnNr, &$error): bool + private function validateISBN13Checksum(string|array|null $isbnNr, &$error): bool { if (!$isbnNr) { return false; diff --git a/src/lib/FieldType/ISBN/Value.php b/src/lib/FieldType/ISBN/Value.php index 7b260ba7c1..642da37fb6 100644 --- a/src/lib/FieldType/ISBN/Value.php +++ b/src/lib/FieldType/ISBN/Value.php @@ -31,7 +31,7 @@ public function __construct($isbn = '') $this->isbn = $isbn; } - public function __toString() + public function __toString(): string { return (string)$this->isbn; } diff --git a/src/lib/FieldType/Image/IO/Legacy.php b/src/lib/FieldType/Image/IO/Legacy.php index f4e691cc98..9f3e28f71a 100644 --- a/src/lib/FieldType/Image/IO/Legacy.php +++ b/src/lib/FieldType/Image/IO/Legacy.php @@ -31,36 +31,27 @@ class Legacy implements IOServiceInterface { /** * Published images IO Service. - * - * @var \Ibexa\Core\IO\IOServiceInterface */ - private $publishedIOService; + private IOServiceInterface $publishedIOService; /** * Draft images IO Service. - * - * @var \Ibexa\Core\IO\IOServiceInterface */ - private $draftIOService; + private IOServiceInterface $draftIOService; /** * Prefix for published images. * Example: var/ibexa_demo_site/storage/images. - * - * @var string */ - private $publishedPrefix; + private string $publishedPrefix; /** * Prefix for draft images. * Example: var/ibexa_demo_site/storage/images-versioned. - * - * @var string */ - private $draftPrefix; + private string $draftPrefix; - /** @var \Ibexa\Core\FieldType\Image\IO\OptionsProvider */ - private $optionsProvider; + private OptionsProvider $optionsProvider; /** * @param \Ibexa\Core\FieldType\Image\IO\OptionsProvider $optionsProvider Path options. Known keys: var_dir, storage_dir, draft_images_dir, published_images_dir. @@ -81,7 +72,7 @@ public function __construct(IOServiceInterface $publishedIOService, IOServiceInt /** * Sets the IOService prefix. */ - public function setPrefix($prefix) + public function setPrefix($prefix): void { $this->publishedIOService->setPrefix($prefix); $this->draftIOService->setPrefix($prefix); @@ -90,7 +81,7 @@ public function setPrefix($prefix) /** * Computes the paths to published & draft images path using the options from the provider. */ - private function setPrefixes() + private function setPrefixes(): void { $pathArray = [$this->optionsProvider->getVarDir()]; @@ -211,7 +202,7 @@ public function getFileInputStream(BinaryFile $binaryFile) return $this->publishedIOService->getFileInputStream($binaryFile); } - public function deleteBinaryFile(BinaryFile $binaryFile) + public function deleteBinaryFile(BinaryFile $binaryFile): void { $this->publishedIOService->deleteBinaryFile($binaryFile); } @@ -221,7 +212,7 @@ public function deleteBinaryFile(BinaryFile $binaryFile) * * @param string $path */ - public function deleteDirectory($path) + public function deleteDirectory($path): void { $this->publishedIOService->deleteDirectory($path); } diff --git a/src/lib/FieldType/Image/IO/OptionsProvider.php b/src/lib/FieldType/Image/IO/OptionsProvider.php index 767bbba442..ad13e8efdf 100644 --- a/src/lib/FieldType/Image/IO/OptionsProvider.php +++ b/src/lib/FieldType/Image/IO/OptionsProvider.php @@ -14,8 +14,7 @@ */ class OptionsProvider { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - protected $configResolver; + protected ConfigResolverInterface $configResolver; public function __construct(ConfigResolverInterface $configResolver) { @@ -29,22 +28,22 @@ protected function getSetting(string $name): ?string : null; } - public function getVarDir() + public function getVarDir(): ?string { return $this->getSetting('var_dir'); } - public function getStorageDir() + public function getStorageDir(): ?string { return $this->getSetting('storage_dir'); } - public function getDraftImagesDir() + public function getDraftImagesDir(): ?string { return $this->getSetting('image.versioned_images_dir'); } - public function getPublishedImagesDir() + public function getPublishedImagesDir(): ?string { return $this->getSetting('image.published_images_dir'); } diff --git a/src/lib/FieldType/Image/ImageStorage.php b/src/lib/FieldType/Image/ImageStorage.php index 6b62d5736c..90e6a34009 100644 --- a/src/lib/FieldType/Image/ImageStorage.php +++ b/src/lib/FieldType/Image/ImageStorage.php @@ -22,23 +22,18 @@ */ class ImageStorage extends GatewayBasedStorage { - /** @var \Ibexa\Core\IO\IOServiceInterface */ - protected $ioService; + protected IOServiceInterface $ioService; - /** @var \Ibexa\Core\FieldType\Image\PathGenerator */ - protected $pathGenerator; + protected PathGenerator $pathGenerator; - /** @var \Ibexa\Core\FieldType\Image\AliasCleanerInterface */ - protected $aliasCleaner; + protected AliasCleanerInterface $aliasCleaner; /** @var \Ibexa\Core\FieldType\Image\ImageStorage\Gateway */ protected $gateway; - /** @var \Ibexa\Core\IO\FilePathNormalizerInterface */ - protected $filePathNormalizer; + protected FilePathNormalizerInterface $filePathNormalizer; - /** @var \Ibexa\Core\FieldType\Validator\FileExtensionBlackListValidator */ - protected $fileExtensionBlackListValidator; + protected FileExtensionBlackListValidator $fileExtensionBlackListValidator; public function __construct( StorageGatewayInterface $gateway, @@ -147,7 +142,7 @@ public function storeFieldData(VersionInfo $versionInfo, Field $field): bool return true; } - public function getFieldData(VersionInfo $versionInfo, Field $field) + public function getFieldData(VersionInfo $versionInfo, Field $field): void { if ($field->value->data !== null) { $field->value->data['imageId'] = $this->buildImageId($versionInfo, $field); @@ -158,7 +153,7 @@ public function getFieldData(VersionInfo $versionInfo, Field $field) } } - public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds) + public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds): void { $fieldXmls = $this->gateway->getXmlForImages($versionInfo->versionNo, $fieldIds); diff --git a/src/lib/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php b/src/lib/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php index 1f9b4696a7..0d974e9f8b 100644 --- a/src/lib/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php +++ b/src/lib/FieldType/Image/ImageStorage/Gateway/DoctrineStorage.php @@ -23,8 +23,7 @@ class DoctrineStorage extends Gateway { public const IMAGE_FILE_TABLE = 'ezimagefile'; - /** @var \Doctrine\DBAL\Connection */ - protected $connection; + protected Connection $connection; /** * Maps database field names to property names. @@ -39,8 +38,7 @@ class DoctrineStorage extends Gateway 'data_string' => 'xml', ]; - /** @var \Ibexa\Core\IO\UrlRedecoratorInterface */ - private $redecorator; + private UrlRedecoratorInterface $redecorator; public function __construct(UrlRedecoratorInterface $redecorator, Connection $connection) { @@ -90,7 +88,7 @@ public function getNodePathString(VersionInfo $versionInfo) * @param string $uri File IO uri (not legacy) * @param int $fieldId */ - public function storeImageReference($uri, $fieldId) + public function storeImageReference($uri, $fieldId): void { // legacy stores the path to the image without a leading / $path = $this->redecorator->redecorateFromSource($uri); @@ -118,7 +116,7 @@ public function storeImageReference($uri, $fieldId) * * @return array */ - public function getXmlForImages($versionNo, array $fieldIds) + public function getXmlForImages($versionNo, array $fieldIds): array { $selectQuery = $this->connection->createQueryBuilder(); $selectQuery diff --git a/src/lib/FieldType/Image/ImageThumbnailProxyStrategy.php b/src/lib/FieldType/Image/ImageThumbnailProxyStrategy.php index 1319a9ae42..eaf7a7b52d 100644 --- a/src/lib/FieldType/Image/ImageThumbnailProxyStrategy.php +++ b/src/lib/FieldType/Image/ImageThumbnailProxyStrategy.php @@ -17,11 +17,9 @@ final class ImageThumbnailProxyStrategy implements FieldTypeBasedThumbnailStrategy { - /** @var \Ibexa\Core\FieldType\Image\ImageThumbnailStrategy */ - private $imageThumbnailStrategy; + private ImageThumbnailStrategy $imageThumbnailStrategy; - /** @var \Ibexa\Core\Repository\ProxyFactory\ProxyGeneratorInterface */ - private $proxyGenerator; + private ProxyGeneratorInterface $proxyGenerator; public function __construct( ImageThumbnailStrategy $imageThumbnailStrategy, diff --git a/src/lib/FieldType/Image/ImageThumbnailStrategy.php b/src/lib/FieldType/Image/ImageThumbnailStrategy.php index 79b31c34b7..a3becc847c 100644 --- a/src/lib/FieldType/Image/ImageThumbnailStrategy.php +++ b/src/lib/FieldType/Image/ImageThumbnailStrategy.php @@ -25,14 +25,11 @@ class ImageThumbnailStrategy implements FieldTypeBasedThumbnailStrategy, LoggerA { use LoggerAwareTrait; - /** @var string */ - private $fieldTypeIdentifier; + private string $fieldTypeIdentifier; - /** @var \Ibexa\Contracts\Core\Variation\VariationHandler */ - private $variationHandler; + private VariationHandler $variationHandler; - /** @var string */ - private $variationName; + private string $variationName; public function __construct( string $fieldTypeIdentifier, diff --git a/src/lib/FieldType/Image/SearchField.php b/src/lib/FieldType/Image/SearchField.php index 4c9a5e52b3..b2ea984de8 100644 --- a/src/lib/FieldType/Image/SearchField.php +++ b/src/lib/FieldType/Image/SearchField.php @@ -17,7 +17,7 @@ */ class SearchField implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { $width = isset($field->value->data['width']) && $field->value->data['width'] !== null ? (int)$field->value->data['width'] @@ -66,7 +66,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) ]; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'filename' => new Search\FieldType\StringField(), @@ -102,7 +102,7 @@ public function getDefaultMatchField(): string * * @return string */ - public function getDefaultSortField() + public function getDefaultSortField(): string { return $this->getDefaultMatchField(); } diff --git a/src/lib/FieldType/Image/Type.php b/src/lib/FieldType/Image/Type.php index b3513a0604..47eab3a632 100644 --- a/src/lib/FieldType/Image/Type.php +++ b/src/lib/FieldType/Image/Type.php @@ -53,7 +53,7 @@ class Type extends FieldType implements TranslationContainerInterface ]; /** @var \Ibexa\Core\FieldType\Validator[] */ - private $validators; + private array $validators; /** @var array */ private array $mimeTypes; @@ -94,7 +94,7 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin * * @return \Ibexa\Core\FieldType\Image\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(); } @@ -180,7 +180,7 @@ protected function checkValueStructure(BaseValue $value) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue) + public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue): array { $errors = []; @@ -272,7 +272,7 @@ public function validateFieldSettings($fieldSettings): array * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validateValidatorConfiguration($validatorConfiguration) + public function validateValidatorConfiguration($validatorConfiguration): array { $validationErrors = []; @@ -363,7 +363,7 @@ public function fromHash($hash) * * @return mixed */ - public function toHash(SPIValue $value) + public function toHash(SPIValue $value): ?array { if ($this->isEmptyValue($value)) { return null; @@ -391,7 +391,7 @@ public function toHash(SPIValue $value) * * @return \Ibexa\Contracts\Core\Persistence\Content\FieldValue */ - public function toPersistenceValue(SPIValue $value) + public function toPersistenceValue(SPIValue $value): FieldValue { // Store original data as external (to indicate they need to be stored) return new FieldValue( diff --git a/src/lib/FieldType/Image/Value.php b/src/lib/FieldType/Image/Value.php index 369c8ec036..c575a2d883 100644 --- a/src/lib/FieldType/Image/Value.php +++ b/src/lib/FieldType/Image/Value.php @@ -144,7 +144,7 @@ public function getFileSize() return $this->fileSize; } - public function __toString() + public function __toString(): string { return (string)$this->fileName; } diff --git a/src/lib/FieldType/ImageAsset/AssetMapper.php b/src/lib/FieldType/ImageAsset/AssetMapper.php index f1e198eb94..b4c8b813de 100644 --- a/src/lib/FieldType/ImageAsset/AssetMapper.php +++ b/src/lib/FieldType/ImageAsset/AssetMapper.php @@ -20,17 +20,13 @@ class AssetMapper { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - private $locationService; + private LocationService $locationService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - private $contentTypeService; + private ContentTypeService $contentTypeService; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; /** @var int */ private $contentTypeId = null; diff --git a/src/lib/FieldType/ImageAsset/ImageAssetThumbnailStrategy.php b/src/lib/FieldType/ImageAsset/ImageAssetThumbnailStrategy.php index d94bb14ff2..521dc55402 100644 --- a/src/lib/FieldType/ImageAsset/ImageAssetThumbnailStrategy.php +++ b/src/lib/FieldType/ImageAsset/ImageAssetThumbnailStrategy.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\Field\FieldTypeBasedThumbnailStrategy; +use Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\ThumbnailStrategy; use Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\ThumbnailStrategy as ContentThumbnailStrategy; use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Contracts\Core\Repository\Values\Content\Thumbnail; @@ -18,14 +19,11 @@ class ImageAssetThumbnailStrategy implements FieldTypeBasedThumbnailStrategy { - /** @var string */ - private $fieldTypeIdentifier; + private string $fieldTypeIdentifier; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\ThumbnailStrategy */ - private $thumbnailStrategy; + private ThumbnailStrategy $thumbnailStrategy; public function __construct( string $fieldTypeIdentifier, diff --git a/src/lib/FieldType/ImageAsset/Type.php b/src/lib/FieldType/ImageAsset/Type.php index 4a362e6859..5cf949bca2 100644 --- a/src/lib/FieldType/ImageAsset/Type.php +++ b/src/lib/FieldType/ImageAsset/Type.php @@ -9,6 +9,7 @@ namespace Ibexa\Core\FieldType\ImageAsset; use Ibexa\Contracts\Core\FieldType\Value as SPIValue; +use Ibexa\Contracts\Core\Persistence\Content\Handler; use Ibexa\Contracts\Core\Persistence\Content\Handler as SPIContentHandler; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; @@ -27,14 +28,11 @@ class Type extends FieldType implements TranslationContainerInterface { public const FIELD_TYPE_IDENTIFIER = 'ezimageasset'; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\Core\FieldType\ImageAsset\AssetMapper */ - private $assetMapper; + private AssetMapper $assetMapper; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Handler */ - private $handler; + private Handler $handler; public function __construct( ContentService $contentService, diff --git a/src/lib/FieldType/ImageAsset/Value.php b/src/lib/FieldType/ImageAsset/Value.php index e1510d10fa..cb132e8516 100644 --- a/src/lib/FieldType/ImageAsset/Value.php +++ b/src/lib/FieldType/ImageAsset/Value.php @@ -41,7 +41,7 @@ public function __construct($destinationContentId = null, ?string $alternativeTe /** * {@inheritdoc} */ - public function __toString() + public function __toString(): string { return (string) $this->destinationContentId; } diff --git a/src/lib/FieldType/Integer/SearchField.php b/src/lib/FieldType/Integer/SearchField.php index 750fe80722..4d4ea5cce9 100644 --- a/src/lib/FieldType/Integer/SearchField.php +++ b/src/lib/FieldType/Integer/SearchField.php @@ -17,7 +17,7 @@ */ class SearchField implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { return [ new Search\Field( @@ -33,7 +33,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) ]; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'value' => new Search\FieldType\IntegerField(), @@ -63,7 +63,7 @@ public function getDefaultMatchField(): string * * @return string */ - public function getDefaultSortField() + public function getDefaultSortField(): string { return $this->getDefaultMatchField(); } diff --git a/src/lib/FieldType/Integer/Value.php b/src/lib/FieldType/Integer/Value.php index 0e533e9597..c29595627b 100644 --- a/src/lib/FieldType/Integer/Value.php +++ b/src/lib/FieldType/Integer/Value.php @@ -31,7 +31,7 @@ public function __construct($value = null) $this->value = $value; } - public function __toString() + public function __toString(): string { return (string)$this->value; } diff --git a/src/lib/FieldType/Keyword/KeywordStorage/Gateway/DoctrineStorage.php b/src/lib/FieldType/Keyword/KeywordStorage/Gateway/DoctrineStorage.php index 16d1d85861..aa0cbb6e37 100644 --- a/src/lib/FieldType/Keyword/KeywordStorage/Gateway/DoctrineStorage.php +++ b/src/lib/FieldType/Keyword/KeywordStorage/Gateway/DoctrineStorage.php @@ -18,8 +18,7 @@ class DoctrineStorage extends Gateway public const KEYWORD_TABLE = 'ezkeyword'; public const KEYWORD_ATTRIBUTE_LINK_TABLE = 'ezkeyword_attribute_link'; - /** @var \Doctrine\DBAL\Connection */ - protected $connection; + protected Connection $connection; public function __construct(Connection $connection) { @@ -32,7 +31,7 @@ public function __construct(Connection $connection) * @param \Ibexa\Contracts\Core\Persistence\Content\Field * @param int $contentTypeId */ - public function storeFieldData(Field $field, $contentTypeId) + public function storeFieldData(Field $field, $contentTypeId): void { if (empty($field->value->externalData) && !empty($field->id)) { $this->deleteFieldData($field->id, $field->versionNo); @@ -67,7 +66,7 @@ public function storeFieldData(Field $field, $contentTypeId) * * @param \Ibexa\Contracts\Core\Persistence\Content\Field $field */ - public function getFieldData(Field $field) + public function getFieldData(Field $field): void { $field->value->externalData = $this->getAssignedKeywords($field->id, $field->versionNo); } @@ -79,7 +78,7 @@ public function getFieldData(Field $field) * * @return int */ - public function getContentTypeId(Field $field) + public function getContentTypeId(Field $field): int { return $this->loadContentTypeId($field->fieldDefinitionId); } @@ -90,7 +89,7 @@ public function getContentTypeId(Field $field) * @param int $fieldId * @param int $versionNo */ - public function deleteFieldData($fieldId, $versionNo) + public function deleteFieldData($fieldId, $versionNo): void { $this->deleteOldKeywordAssignments($fieldId, $versionNo); $this->deleteOrphanedKeywords(); @@ -184,7 +183,7 @@ protected function loadContentTypeId($fieldDefinitionId): int * * @return int[] */ - protected function getExistingKeywords($keywordList, $contentTypeId) + protected function getExistingKeywords($keywordList, $contentTypeId): array { // Retrieving potentially existing keywords $query = $this->connection->createQueryBuilder(); @@ -240,7 +239,7 @@ protected function getExistingKeywords($keywordList, $contentTypeId) * * @return int[] */ - protected function insertKeywords(array $keywordsToInsert, $contentTypeId) + protected function insertKeywords(array $keywordsToInsert, $contentTypeId): array { $keywordIdMap = []; // Inserting keywords not yet registered diff --git a/src/lib/FieldType/Keyword/SearchField.php b/src/lib/FieldType/Keyword/SearchField.php index 26bc6d7983..0cc9687e5d 100644 --- a/src/lib/FieldType/Keyword/SearchField.php +++ b/src/lib/FieldType/Keyword/SearchField.php @@ -17,7 +17,7 @@ */ class SearchField implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { return [ new Search\Field( @@ -38,7 +38,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) ]; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'value' => new Search\FieldType\MultipleStringField(), diff --git a/src/lib/FieldType/Keyword/Type.php b/src/lib/FieldType/Keyword/Type.php index da978a7794..0bc551ddf1 100644 --- a/src/lib/FieldType/Keyword/Type.php +++ b/src/lib/FieldType/Keyword/Type.php @@ -47,7 +47,7 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin * * @return \Ibexa\Core\FieldType\Keyword\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value([]); } @@ -105,7 +105,7 @@ protected function getSortInfo(BaseValue $value): string * * @return \Ibexa\Core\FieldType\Keyword\Value $value */ - public function fromHash($hash) + public function fromHash($hash): Value { return new Value($hash); } @@ -139,7 +139,7 @@ public function isSearchable(): bool * * @return \Ibexa\Contracts\Core\Persistence\Content\FieldValue */ - public function toPersistenceValue(SPIValue $value) + public function toPersistenceValue(SPIValue $value): FieldValue { return new FieldValue( [ @@ -157,7 +157,7 @@ public function toPersistenceValue(SPIValue $value) * * @return \Ibexa\Core\FieldType\Keyword\Value */ - public function fromPersistenceValue(FieldValue $fieldValue) + public function fromPersistenceValue(FieldValue $fieldValue): Value { return new Value($fieldValue->externalData); } diff --git a/src/lib/FieldType/Keyword/Value.php b/src/lib/FieldType/Keyword/Value.php index 9dc2aa2103..dc971afa25 100644 --- a/src/lib/FieldType/Keyword/Value.php +++ b/src/lib/FieldType/Keyword/Value.php @@ -49,7 +49,7 @@ public function __construct($values = null) * * @return string A comma separated list of tags, eg: "php, Ibexa, html5" */ - public function __toString() + public function __toString(): string { return implode(', ', $this->values); } diff --git a/src/lib/FieldType/MapLocation/MapLocationStorage.php b/src/lib/FieldType/MapLocation/MapLocationStorage.php index 21b957df0a..28b149a8a4 100644 --- a/src/lib/FieldType/MapLocation/MapLocationStorage.php +++ b/src/lib/FieldType/MapLocation/MapLocationStorage.php @@ -24,12 +24,12 @@ public function storeFieldData(VersionInfo $versionInfo, Field $field) return $this->gateway->storeFieldData($versionInfo, $field); } - public function getFieldData(VersionInfo $versionInfo, Field $field) + public function getFieldData(VersionInfo $versionInfo, Field $field): void { $this->gateway->getFieldData($versionInfo, $field); } - public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds) + public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds): void { $this->gateway->deleteFieldData($versionInfo, $fieldIds); } diff --git a/src/lib/FieldType/MapLocation/MapLocationStorage/Gateway/DoctrineStorage.php b/src/lib/FieldType/MapLocation/MapLocationStorage/Gateway/DoctrineStorage.php index 667be196d7..ffcf537162 100644 --- a/src/lib/FieldType/MapLocation/MapLocationStorage/Gateway/DoctrineStorage.php +++ b/src/lib/FieldType/MapLocation/MapLocationStorage/Gateway/DoctrineStorage.php @@ -17,8 +17,7 @@ class DoctrineStorage extends Gateway { public const MAP_LOCATION_TABLE = 'ezgmaplocation'; - /** @var \Doctrine\DBAL\Connection */ - protected $connection; + protected Connection $connection; public function __construct(Connection $connection) { @@ -134,7 +133,7 @@ protected function storeNewFieldData(VersionInfo $versionInfo, Field $field) * * @return array */ - public function getFieldData(VersionInfo $versionInfo, Field $field) + public function getFieldData(VersionInfo $versionInfo, Field $field): void { $field->value->externalData = $this->loadFieldData($field->id, $versionInfo->versionNo); } @@ -208,7 +207,7 @@ protected function hasFieldData($fieldId, $versionNo): bool * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo * @param int[] $fieldIds */ - public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds) + public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds): void { if (empty($fieldIds)) { // Nothing to do diff --git a/src/lib/FieldType/MapLocation/SearchField.php b/src/lib/FieldType/MapLocation/SearchField.php index 0639d0acc6..63a415a365 100644 --- a/src/lib/FieldType/MapLocation/SearchField.php +++ b/src/lib/FieldType/MapLocation/SearchField.php @@ -17,7 +17,7 @@ */ class SearchField implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { return [ new Search\Field( @@ -41,7 +41,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) ]; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'value_address' => new Search\FieldType\StringField(), @@ -72,7 +72,7 @@ public function getDefaultMatchField(): string * * @return string */ - public function getDefaultSortField() + public function getDefaultSortField(): string { return $this->getDefaultMatchField(); } diff --git a/src/lib/FieldType/MapLocation/Type.php b/src/lib/FieldType/MapLocation/Type.php index 0307fa7288..22e005d4c4 100644 --- a/src/lib/FieldType/MapLocation/Type.php +++ b/src/lib/FieldType/MapLocation/Type.php @@ -47,7 +47,7 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin * * @return \Ibexa\Core\FieldType\MapLocation\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(); } @@ -147,7 +147,7 @@ public function fromHash($hash) * * @return mixed */ - public function toHash(SPIValue $value) + public function toHash(SPIValue $value): ?array { if ($this->isEmptyValue($value)) { return null; @@ -177,7 +177,7 @@ public function isSearchable(): bool * * @return \Ibexa\Contracts\Core\Persistence\Content\FieldValue */ - public function toPersistenceValue(SPIValue $value) + public function toPersistenceValue(SPIValue $value): FieldValue { return new FieldValue( [ diff --git a/src/lib/FieldType/MapLocation/Value.php b/src/lib/FieldType/MapLocation/Value.php index 5118103b49..4bc061dafb 100644 --- a/src/lib/FieldType/MapLocation/Value.php +++ b/src/lib/FieldType/MapLocation/Value.php @@ -52,7 +52,7 @@ public function __construct(array $values = null) * * @return string A comma separated list of tags, eg: "php, Ibexa, html5" */ - public function __toString() + public function __toString(): string { if (is_array($this->address)) { return implode(', ', $this->address); diff --git a/src/lib/FieldType/Media/Type.php b/src/lib/FieldType/Media/Type.php index 99080c463e..961ed2cc42 100644 --- a/src/lib/FieldType/Media/Type.php +++ b/src/lib/FieldType/Media/Type.php @@ -37,7 +37,7 @@ class Type extends BaseType implements TranslationContainerInterface /** * Type constants for validation. */ - private static $availableTypes = [ + private static array $availableTypes = [ self::TYPE_FLASH, self::TYPE_QUICKTIME, self::TYPE_REALPLAYER, @@ -71,7 +71,7 @@ public function getFieldTypeIdentifier(): string * * @return \Ibexa\Core\FieldType\Media\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(); } @@ -83,7 +83,7 @@ public function getEmptyValue() * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validateFieldSettings($fieldSettings) + public function validateFieldSettings($fieldSettings): array { $validationErrors = []; @@ -125,7 +125,7 @@ public function validateFieldSettings($fieldSettings) * * @return \Ibexa\Core\FieldType\Media\Value */ - protected function createValue(array $inputValue) + protected function createValue(array $inputValue): Value { $inputValue = $this->regenerateUri($inputValue); diff --git a/src/lib/FieldType/Null/Type.php b/src/lib/FieldType/Null/Type.php index 6f103b17da..1e71bd5694 100644 --- a/src/lib/FieldType/Null/Type.php +++ b/src/lib/FieldType/Null/Type.php @@ -56,7 +56,7 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin * * @return \Ibexa\Core\FieldType\Null\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(null); } @@ -88,7 +88,7 @@ protected function checkValueStructure(BaseValue $value) /** * {@inheritdoc} */ - protected function getSortInfo(BaseValue $value) + protected function getSortInfo(BaseValue $value): null { return null; } @@ -100,7 +100,7 @@ protected function getSortInfo(BaseValue $value) * * @return \Ibexa\Core\FieldType\Null\Value $value */ - public function fromHash($hash) + public function fromHash($hash): Value { return new Value($hash); } diff --git a/src/lib/FieldType/Null/Value.php b/src/lib/FieldType/Null/Value.php index a55d5e16dc..485d6a53d7 100644 --- a/src/lib/FieldType/Null/Value.php +++ b/src/lib/FieldType/Null/Value.php @@ -31,7 +31,7 @@ public function __construct($value = null) $this->value = $value; } - public function __toString() + public function __toString(): string { return (string)$this->value; } diff --git a/src/lib/FieldType/NullStorage.php b/src/lib/FieldType/NullStorage.php index 5b3e6a79bf..64c51a1f55 100644 --- a/src/lib/FieldType/NullStorage.php +++ b/src/lib/FieldType/NullStorage.php @@ -27,7 +27,7 @@ public function storeFieldData(VersionInfo $versionInfo, Field $field): bool /** * @see \Ibexa\Contracts\Core\FieldType\FieldStorage::getFieldData() */ - public function getFieldData(VersionInfo $versionInfo, Field $field) + public function getFieldData(VersionInfo $versionInfo, Field $field): void { return; } @@ -63,7 +63,7 @@ public function hasFieldData(): bool * * @return bool|null Same as {@link \Ibexa\Contracts\Core\FieldType\FieldStorage::storeFieldData()}. */ - public function copyLegacyField(VersionInfo $versionInfo, Field $field, Field $originalField) + public function copyLegacyField(VersionInfo $versionInfo, Field $field, Field $originalField): void { return; } diff --git a/src/lib/FieldType/Relation/SearchField.php b/src/lib/FieldType/Relation/SearchField.php index 8ed651e69a..b8a5a22665 100644 --- a/src/lib/FieldType/Relation/SearchField.php +++ b/src/lib/FieldType/Relation/SearchField.php @@ -17,7 +17,7 @@ */ class SearchField implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { return [ new Search\Field( @@ -28,7 +28,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) ]; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'value' => new Search\FieldType\StringField(), @@ -58,7 +58,7 @@ public function getDefaultMatchField(): string * * @return string */ - public function getDefaultSortField() + public function getDefaultSortField(): string { return $this->getDefaultMatchField(); } diff --git a/src/lib/FieldType/Relation/Type.php b/src/lib/FieldType/Relation/Type.php index b322db581c..0edf2ade9b 100644 --- a/src/lib/FieldType/Relation/Type.php +++ b/src/lib/FieldType/Relation/Type.php @@ -8,6 +8,7 @@ namespace Ibexa\Core\FieldType\Relation; use Ibexa\Contracts\Core\FieldType\Value as SPIValue; +use Ibexa\Contracts\Core\Persistence\Content\Handler; use Ibexa\Contracts\Core\Persistence\Content\Handler as SPIContentHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; @@ -53,11 +54,9 @@ class Type extends FieldType implements TranslationContainerInterface ], ]; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Handler */ - private $handler; + private Handler $handler; - /** @var \Ibexa\Core\Repository\Validator\TargetContentValidatorInterface */ - private $targetContentValidator; + private TargetContentValidatorInterface $targetContentValidator; public function __construct( SPIContentHandler $handler, @@ -67,7 +66,10 @@ public function __construct( $this->targetContentValidator = $targetContentValidator; } - public function validateFieldSettings($fieldSettings) + /** + * @return \Ibexa\Core\FieldType\ValidationError[] + */ + public function validateFieldSettings($fieldSettings): array { $validationErrors = []; @@ -203,7 +205,7 @@ public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue) * * @return \Ibexa\Core\FieldType\Relation\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(); } @@ -296,7 +298,7 @@ public function fromHash($hash) * * @return mixed */ - public function toHash(SPIValue $value) + public function toHash(SPIValue $value): array { $destinationContentId = null; if ($value->destinationContentId !== null) { @@ -343,7 +345,7 @@ public function isSearchable(): bool * ) * */ - public function getRelations(SPIValue $fieldValue) + public function getRelations(SPIValue $fieldValue): array { $relations = []; if ($fieldValue->destinationContentId !== null) { diff --git a/src/lib/FieldType/Relation/Value.php b/src/lib/FieldType/Relation/Value.php index 1ad3a7f949..424d2a929b 100644 --- a/src/lib/FieldType/Relation/Value.php +++ b/src/lib/FieldType/Relation/Value.php @@ -34,7 +34,7 @@ public function __construct($destinationContentId = null) /** * Returns the related content's name. */ - public function __toString() + public function __toString(): string { return (string)$this->destinationContentId; } diff --git a/src/lib/FieldType/RelationList/SearchField.php b/src/lib/FieldType/RelationList/SearchField.php index 9cfb25a972..8f1ede735f 100644 --- a/src/lib/FieldType/RelationList/SearchField.php +++ b/src/lib/FieldType/RelationList/SearchField.php @@ -17,7 +17,7 @@ */ class SearchField implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { return [ new Search\Field( @@ -33,7 +33,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) ]; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'value' => new Search\FieldType\MultipleStringField(), diff --git a/src/lib/FieldType/RelationList/Type.php b/src/lib/FieldType/RelationList/Type.php index 436f72b39a..95bee49bf0 100644 --- a/src/lib/FieldType/RelationList/Type.php +++ b/src/lib/FieldType/RelationList/Type.php @@ -8,6 +8,7 @@ namespace Ibexa\Core\FieldType\RelationList; use Ibexa\Contracts\Core\FieldType\Value as SPIValue; +use Ibexa\Contracts\Core\Persistence\Content\Handler; use Ibexa\Contracts\Core\Persistence\Content\Handler as SPIContentHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; @@ -71,11 +72,9 @@ class Type extends FieldType implements TranslationContainerInterface ], ]; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Handler */ - private $handler; + private Handler $handler; - /** @var \Ibexa\Core\Repository\Validator\TargetContentValidatorInterface */ - private $targetContentValidator; + private TargetContentValidatorInterface $targetContentValidator; public function __construct( SPIContentHandler $handler, @@ -85,7 +84,10 @@ public function __construct( $this->targetContentValidator = $targetContentValidator; } - public function validateFieldSettings($fieldSettings) + /** + * @return \Ibexa\Core\FieldType\ValidationError[] + */ + public function validateFieldSettings($fieldSettings): array { $validationErrors = []; @@ -193,7 +195,7 @@ public function validateFieldSettings($fieldSettings) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validateValidatorConfiguration($validatorConfiguration) + public function validateValidatorConfiguration($validatorConfiguration): array { $validationErrors = []; @@ -335,7 +337,7 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin * * @return \Ibexa\Core\FieldType\RelationList\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(); } @@ -412,7 +414,7 @@ protected function getSortInfo(BaseValue $value): string * * @return \Ibexa\Core\FieldType\RelationList\Value $value */ - public function fromHash($hash) + public function fromHash($hash): Value { return new Value($hash['destinationContentIds']); } @@ -424,7 +426,7 @@ public function fromHash($hash) * * @return mixed */ - public function toHash(SPIValue $value) + public function toHash(SPIValue $value): array { return ['destinationContentIds' => $value->destinationContentIds]; } @@ -464,7 +466,7 @@ public function isSearchable(): bool * ) * */ - public function getRelations(SPIValue $value) + public function getRelations(SPIValue $value): array { /* @var \Ibexa\Core\FieldType\RelationList\Value $value */ return [ diff --git a/src/lib/FieldType/RelationList/Value.php b/src/lib/FieldType/RelationList/Value.php index d4f9f11524..218bceeefa 100644 --- a/src/lib/FieldType/RelationList/Value.php +++ b/src/lib/FieldType/RelationList/Value.php @@ -31,7 +31,7 @@ public function __construct(array $destinationContentIds = []) $this->destinationContentIds = $destinationContentIds; } - public function __toString() + public function __toString(): string { return implode(',', $this->destinationContentIds); } diff --git a/src/lib/FieldType/Selection/SearchField.php b/src/lib/FieldType/Selection/SearchField.php index e39d0c3a13..3b7f295356 100644 --- a/src/lib/FieldType/Selection/SearchField.php +++ b/src/lib/FieldType/Selection/SearchField.php @@ -17,7 +17,7 @@ */ class SearchField implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { $indexes = []; $values = []; @@ -62,7 +62,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) ]; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'selected_option_value' => new Search\FieldType\MultipleStringField(), diff --git a/src/lib/FieldType/Selection/Type.php b/src/lib/FieldType/Selection/Type.php index 844632dc92..814684b986 100644 --- a/src/lib/FieldType/Selection/Type.php +++ b/src/lib/FieldType/Selection/Type.php @@ -53,7 +53,7 @@ class Type extends FieldType implements TranslationContainerInterface * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validateFieldSettings($fieldSettings) + public function validateFieldSettings($fieldSettings): array { $validationErrors = []; @@ -157,7 +157,7 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin * * @return \Ibexa\Core\FieldType\Selection\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(); } @@ -208,7 +208,7 @@ protected function checkValueStructure(BaseValue $value) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue) + public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue): array { $validationErrors = []; @@ -285,7 +285,7 @@ protected function getSortInfo(BaseValue $value): string * * @return \Ibexa\Core\FieldType\Selection\Value $value */ - public function fromHash($hash) + public function fromHash($hash): Value { return new Value($hash); } diff --git a/src/lib/FieldType/Selection/Value.php b/src/lib/FieldType/Selection/Value.php index e3dd36b5f5..7b2c5b7942 100644 --- a/src/lib/FieldType/Selection/Value.php +++ b/src/lib/FieldType/Selection/Value.php @@ -31,7 +31,7 @@ public function __construct(array $selection = []) $this->selection = $selection; } - public function __toString() + public function __toString(): string { return implode(',', $this->selection); } diff --git a/src/lib/FieldType/TextBlock/SearchField.php b/src/lib/FieldType/TextBlock/SearchField.php index 7ad3c94d16..59d26de328 100644 --- a/src/lib/FieldType/TextBlock/SearchField.php +++ b/src/lib/FieldType/TextBlock/SearchField.php @@ -17,7 +17,7 @@ */ class SearchField implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { return [ new Search\Field( @@ -45,7 +45,7 @@ private function extractShortText($string): string return mb_substr(strtok(trim((string)$string), "\r\n"), 0, 255); } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'value' => new Search\FieldType\StringField(), @@ -75,7 +75,7 @@ public function getDefaultMatchField(): string * * @return string */ - public function getDefaultSortField() + public function getDefaultSortField(): string { return $this->getDefaultMatchField(); } diff --git a/src/lib/FieldType/TextLine/Value.php b/src/lib/FieldType/TextLine/Value.php index 7e135878d5..b2c68d33e8 100644 --- a/src/lib/FieldType/TextLine/Value.php +++ b/src/lib/FieldType/TextLine/Value.php @@ -26,7 +26,7 @@ public function __construct(?string $text = '') $this->text = (string)$text; } - public function __toString() + public function __toString(): string { return $this->text; } diff --git a/src/lib/FieldType/Time/SearchField.php b/src/lib/FieldType/Time/SearchField.php index b56b3275cb..025a69bbf3 100644 --- a/src/lib/FieldType/Time/SearchField.php +++ b/src/lib/FieldType/Time/SearchField.php @@ -17,7 +17,7 @@ */ class SearchField implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { return [ new Search\Field( @@ -28,7 +28,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) ]; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'value' => new Search\FieldType\IntegerField(), @@ -58,7 +58,7 @@ public function getDefaultMatchField(): string * * @return string */ - public function getDefaultSortField() + public function getDefaultSortField(): string { return $this->getDefaultMatchField(); } diff --git a/src/lib/FieldType/Time/Type.php b/src/lib/FieldType/Time/Type.php index f7f1bc62fc..f8e0240407 100644 --- a/src/lib/FieldType/Time/Type.php +++ b/src/lib/FieldType/Time/Type.php @@ -73,7 +73,7 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin * * @return \Ibexa\Core\FieldType\Time\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(); } @@ -198,7 +198,7 @@ public function isSearchable(): bool * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validateFieldSettings($fieldSettings) + public function validateFieldSettings($fieldSettings): array { $validationErrors = []; diff --git a/src/lib/FieldType/Time/Value.php b/src/lib/FieldType/Time/Value.php index 29e9057464..57bca67f15 100644 --- a/src/lib/FieldType/Time/Value.php +++ b/src/lib/FieldType/Time/Value.php @@ -48,7 +48,7 @@ public function __construct($seconds = null) * * @return \Ibexa\Core\FieldType\Time\Value */ - public static function fromDateTime(DateTime $dateTime) + public static function fromDateTime(DateTime $dateTime): static { $dateTime = clone $dateTime; @@ -93,7 +93,7 @@ public static function fromTimestamp($timestamp) } } - public function __toString() + public function __toString(): string { if ($this->time === null) { return ''; diff --git a/src/lib/FieldType/Unindexed.php b/src/lib/FieldType/Unindexed.php index 0491c2b23a..334956899d 100644 --- a/src/lib/FieldType/Unindexed.php +++ b/src/lib/FieldType/Unindexed.php @@ -18,12 +18,12 @@ */ class Unindexed implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { return []; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return []; } @@ -35,7 +35,7 @@ public function getIndexDefinition() * implementation of this interface), this method is used to define default * field for matching. Default field is typically used by Field criterion. */ - public function getDefaultMatchField() + public function getDefaultMatchField(): null { return null; } @@ -47,7 +47,7 @@ public function getDefaultMatchField() * implementation of this interface), this method is used to define default * field for sorting. Default field is typically used by Field sort clause. */ - public function getDefaultSortField() + public function getDefaultSortField(): null { return null; } diff --git a/src/lib/FieldType/Url/SearchField.php b/src/lib/FieldType/Url/SearchField.php index efe0867f21..d435b3083c 100644 --- a/src/lib/FieldType/Url/SearchField.php +++ b/src/lib/FieldType/Url/SearchField.php @@ -17,7 +17,7 @@ */ class SearchField implements Indexable { - public function getIndexData(Field $field, FieldDefinition $fieldDefinition) + public function getIndexData(Field $field, FieldDefinition $fieldDefinition): array { return [ new Search\Field( @@ -43,7 +43,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition) ]; } - public function getIndexDefinition() + public function getIndexDefinition(): array { return [ 'value_url' => new Search\FieldType\StringField(), @@ -75,7 +75,7 @@ public function getDefaultMatchField(): string * * @return string */ - public function getDefaultSortField() + public function getDefaultSortField(): string { return $this->getDefaultMatchField(); } diff --git a/src/lib/FieldType/Url/Type.php b/src/lib/FieldType/Url/Type.php index c25416da71..d97a39606f 100644 --- a/src/lib/FieldType/Url/Type.php +++ b/src/lib/FieldType/Url/Type.php @@ -47,7 +47,7 @@ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, strin * * @return \Ibexa\Core\FieldType\Url\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(); } @@ -129,7 +129,7 @@ public function fromHash($hash) * * @return mixed */ - public function toHash(SPIValue $value) + public function toHash(SPIValue $value): ?array { if ($this->isEmptyValue($value)) { return null; @@ -138,7 +138,7 @@ public function toHash(SPIValue $value) return ['link' => $value->link, 'text' => $value->text]; } - public function toPersistenceValue(SPIValue $value) + public function toPersistenceValue(SPIValue $value): FieldValue { if ($value === null) { return new FieldValue( diff --git a/src/lib/FieldType/Url/UrlStorage.php b/src/lib/FieldType/Url/UrlStorage.php index bcc76eb135..5e43d59d63 100644 --- a/src/lib/FieldType/Url/UrlStorage.php +++ b/src/lib/FieldType/Url/UrlStorage.php @@ -18,8 +18,7 @@ */ class UrlStorage extends GatewayBasedStorage { - /** @var \Psr\Log\LoggerInterface */ - protected $logger; + protected ?LoggerInterface $logger; /** @var \Ibexa\Core\FieldType\Url\UrlStorage\Gateway */ protected $gateway; @@ -62,7 +61,7 @@ public function storeFieldData(VersionInfo $versionInfo, Field $field): bool return true; } - public function getFieldData(VersionInfo $versionInfo, Field $field) + public function getFieldData(VersionInfo $versionInfo, Field $field): void { $id = $field->value->data['urlId']; if (empty($id)) { @@ -81,7 +80,7 @@ public function getFieldData(VersionInfo $versionInfo, Field $field) $field->value->externalData = isset($map[$id]) ? $map[$id] : ''; } - public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds) + public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds): void { foreach ($fieldIds as $fieldId) { $this->gateway->unlinkUrl($fieldId, $versionInfo->versionNo); diff --git a/src/lib/FieldType/Url/UrlStorage/Gateway/DoctrineStorage.php b/src/lib/FieldType/Url/UrlStorage/Gateway/DoctrineStorage.php index c0ef8a3f18..78da762803 100644 --- a/src/lib/FieldType/Url/UrlStorage/Gateway/DoctrineStorage.php +++ b/src/lib/FieldType/Url/UrlStorage/Gateway/DoctrineStorage.php @@ -18,8 +18,7 @@ class DoctrineStorage extends Gateway public const URL_TABLE = DoctrineDatabase::URL_TABLE; public const URL_LINK_TABLE = DoctrineDatabase::URL_LINK_TABLE; - /** @var \Doctrine\DBAL\Connection */ - protected $connection; + protected Connection $connection; public function __construct(Connection $connection) { @@ -35,7 +34,7 @@ public function __construct(Connection $connection) * * @return array An array of URLs, with ids as keys */ - public function getIdUrlMap(array $ids) + public function getIdUrlMap(array $ids): array { $map = []; @@ -68,7 +67,7 @@ public function getIdUrlMap(array $ids) * * @return array An array of URL ids, with URLs as keys */ - public function getUrlIdMap(array $urls) + public function getUrlIdMap(array $urls): array { $map = []; @@ -137,7 +136,7 @@ public function insertUrl($url): int * @param int $fieldId * @param int $versionNo */ - public function linkUrl($urlId, $fieldId, $versionNo) + public function linkUrl($urlId, $fieldId, $versionNo): void { $query = $this->connection->createQueryBuilder(); diff --git a/src/lib/FieldType/Url/Value.php b/src/lib/FieldType/Url/Value.php index ae76e5a900..7927d68f53 100644 --- a/src/lib/FieldType/Url/Value.php +++ b/src/lib/FieldType/Url/Value.php @@ -40,7 +40,7 @@ public function __construct($link = null, $text = null) $this->text = $text; } - public function __toString() + public function __toString(): string { return (string)$this->link; } diff --git a/src/lib/FieldType/User/Type.php b/src/lib/FieldType/User/Type.php index 85a0b322fa..a33ced6fe0 100644 --- a/src/lib/FieldType/User/Type.php +++ b/src/lib/FieldType/User/Type.php @@ -11,6 +11,7 @@ use DateTimeInterface; use Ibexa\Contracts\Core\FieldType\Value as SPIValue; use Ibexa\Contracts\Core\Persistence\Content\FieldValue; +use Ibexa\Contracts\Core\Persistence\User\Handler; use Ibexa\Contracts\Core\Persistence\User\Handler as SPIUserHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\PasswordHashService; @@ -91,14 +92,11 @@ class Type extends FieldType implements TranslationContainerInterface ], ]; - /** @var \Ibexa\Contracts\Core\Persistence\User\Handler */ - private $userHandler; + private Handler $userHandler; - /** @var \Ibexa\Contracts\Core\Repository\PasswordHashService */ - private $passwordHashService; + private PasswordHashService $passwordHashService; - /** @var \Ibexa\Core\Repository\User\PasswordValidatorInterface */ - private $passwordValidator; + private PasswordValidatorInterface $passwordValidator; public function __construct( SPIUserHandler $userHandler, @@ -154,7 +152,7 @@ public function onlyEmptyInstance(): bool * * @return \Ibexa\Core\FieldType\User\Value */ - public function getEmptyValue() + public function getEmptyValue(): Value { return new Value(); } @@ -222,7 +220,7 @@ public function fromHash($hash) * * @return mixed */ - public function toHash(SPIValue $value) + public function toHash(SPIValue $value): ?array { if ($this->isEmptyValue($value)) { return null; @@ -236,7 +234,7 @@ public function toHash(SPIValue $value) return $hash; } - public function toPersistenceValue(SPIValue $value) + public function toPersistenceValue(SPIValue $value): FieldValue { $value->passwordHashType = $this->getPasswordHashTypeForPersistenceValue($value); if ($value->plainPassword) { @@ -256,7 +254,7 @@ public function toPersistenceValue(SPIValue $value) ); } - private function getPasswordHashTypeForPersistenceValue(SPIValue $value): int + private function getPasswordHashTypeForPersistenceValue(BaseValue $value): int { if (null === $value->passwordHashType) { return $this->passwordHashService->getDefaultHashType(); @@ -293,7 +291,7 @@ public function fromPersistenceValue(FieldValue $fieldValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue) + public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue): array { $errors = []; @@ -426,8 +424,10 @@ public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue) /** * {@inheritdoc} + * + * @return \Ibexa\Core\FieldType\ValidationError[] */ - public function validateValidatorConfiguration($validatorConfiguration) + public function validateValidatorConfiguration($validatorConfiguration): array { $validationErrors = []; @@ -449,8 +449,10 @@ public function validateValidatorConfiguration($validatorConfiguration) /** * {@inheritdoc} + * + * @return \Ibexa\Core\FieldType\ValidationError[] */ - public function validateFieldSettings($fieldSettings) + public function validateFieldSettings($fieldSettings): array { $validationErrors = []; diff --git a/src/lib/FieldType/User/UserStorage.php b/src/lib/FieldType/User/UserStorage.php index e09ef60329..6c436738dd 100644 --- a/src/lib/FieldType/User/UserStorage.php +++ b/src/lib/FieldType/User/UserStorage.php @@ -35,12 +35,12 @@ class UserStorage extends GatewayBasedStorage */ protected $gateway; - public function storeFieldData(VersionInfo $versionInfo, Field $field) + public function storeFieldData(VersionInfo $versionInfo, Field $field): bool { return $this->gateway->storeFieldData($versionInfo, $field); } - public function getFieldData(VersionInfo $versionInfo, Field $field) + public function getFieldData(VersionInfo $versionInfo, Field $field): void { $field->value->externalData = $this->gateway->getFieldData($field->id); } @@ -52,7 +52,7 @@ public function getFieldData(VersionInfo $versionInfo, Field $field) * * @throws \Doctrine\DBAL\DBALException */ - public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds) + public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds): bool { return $this->gateway->deleteFieldData($versionInfo, $fieldIds); } diff --git a/src/lib/FieldType/User/UserStorage/Gateway/DoctrineStorage.php b/src/lib/FieldType/User/UserStorage/Gateway/DoctrineStorage.php index c7155eb36b..544287082c 100644 --- a/src/lib/FieldType/User/UserStorage/Gateway/DoctrineStorage.php +++ b/src/lib/FieldType/User/UserStorage/Gateway/DoctrineStorage.php @@ -24,8 +24,7 @@ class DoctrineStorage extends Gateway public const USER_TABLE = 'ezuser'; public const USER_SETTING_TABLE = 'ezuser_setting'; - /** @var \Doctrine\DBAL\Connection */ - protected $connection; + protected Connection $connection; /** * Default values for user fields. @@ -79,7 +78,7 @@ public function getFieldData($fieldId, $userId = null) * * @return array */ - protected function getPropertyMap() + protected function getPropertyMap(): array { return [ 'has_stored_login' => [ @@ -110,7 +109,7 @@ protected function getPropertyMap() ], 'password_updated_at' => [ 'name' => 'passwordUpdatedAt', - 'cast' => static function ($timestamp) { + 'cast' => static function ($timestamp): ?int { return $timestamp ? (int)$timestamp : null; }, ], @@ -134,7 +133,7 @@ protected function getPropertyMap() * * @return array */ - protected function convertColumnsToProperties(array $databaseValues) + protected function convertColumnsToProperties(array $databaseValues): array { $propertyValues = []; $propertyMap = $this->getPropertyMap(); diff --git a/src/lib/FieldType/User/Value.php b/src/lib/FieldType/User/Value.php index 92eefb0355..bb1cb4ee8a 100644 --- a/src/lib/FieldType/User/Value.php +++ b/src/lib/FieldType/User/Value.php @@ -80,7 +80,7 @@ class Value extends BaseValue */ public $plainPassword; - public function __toString() + public function __toString(): string { return (string)$this->login; } diff --git a/src/lib/FieldType/ValidationError.php b/src/lib/FieldType/ValidationError.php index 4c47e5c382..917311fb62 100644 --- a/src/lib/FieldType/ValidationError.php +++ b/src/lib/FieldType/ValidationError.php @@ -22,8 +22,7 @@ class ValidationError implements ValidationErrorInterface /** @var string */ protected $plural; - /** @var array */ - protected $values; + protected array $values; /** * Element on which the error occurred @@ -53,7 +52,7 @@ public function __construct($singular, $plural = null, array $values = [], $targ * * @return \Ibexa\Contracts\Core\Repository\Values\Translation */ - public function getTranslatableMessage() + public function getTranslatableMessage(): Plural|Message { if (isset($this->plural)) { return new Plural( @@ -69,7 +68,7 @@ public function getTranslatableMessage() } } - public function setTarget($target) + public function setTarget($target): void { $this->target = $target; } diff --git a/src/lib/FieldType/Validator.php b/src/lib/FieldType/Validator.php index 870e9fb8bd..828b7a6f66 100644 --- a/src/lib/FieldType/Validator.php +++ b/src/lib/FieldType/Validator.php @@ -121,7 +121,7 @@ public function getMessage() * * @param array $constraints */ - public function initializeWithConstraints(array $constraints) + public function initializeWithConstraints(array $constraints): void { // Reset errors $this->errors = []; diff --git a/src/lib/FieldType/Validator/EmailAddressValidator.php b/src/lib/FieldType/Validator/EmailAddressValidator.php index 0a1f853bf8..51c5debcf8 100644 --- a/src/lib/FieldType/Validator/EmailAddressValidator.php +++ b/src/lib/FieldType/Validator/EmailAddressValidator.php @@ -36,9 +36,9 @@ class EmailAddressValidator extends Validator * * @param mixed $constraints * - * @return mixed + * @return \Ibexa\Core\FieldType\ValidationError[] */ - public function validateConstraints($constraints) + public function validateConstraints($constraints): array { $validationErrors = []; foreach ($constraints as $name => $value) { diff --git a/src/lib/FieldType/Validator/FileExtensionBlackListValidator.php b/src/lib/FieldType/Validator/FileExtensionBlackListValidator.php index 0bee0955ca..bae387ab27 100644 --- a/src/lib/FieldType/Validator/FileExtensionBlackListValidator.php +++ b/src/lib/FieldType/Validator/FileExtensionBlackListValidator.php @@ -39,7 +39,7 @@ public function __construct(ConfigResolverInterface $configResolver) /** * {@inheritdoc} */ - public function validateConstraints($constraints) + public function validateConstraints($constraints): array { return []; } diff --git a/src/lib/FieldType/Validator/FileSizeValidator.php b/src/lib/FieldType/Validator/FileSizeValidator.php index 3a1b744e54..69fad9ca49 100644 --- a/src/lib/FieldType/Validator/FileSizeValidator.php +++ b/src/lib/FieldType/Validator/FileSizeValidator.php @@ -30,7 +30,10 @@ class FileSizeValidator extends Validator ], ]; - public function validateConstraints($constraints) + /** + * @return \Ibexa\Core\FieldType\ValidationError[] + */ + public function validateConstraints($constraints): array { $validationErrors = []; diff --git a/src/lib/FieldType/Validator/ImageValidator.php b/src/lib/FieldType/Validator/ImageValidator.php index 01f371a3ac..71b0989a9c 100644 --- a/src/lib/FieldType/Validator/ImageValidator.php +++ b/src/lib/FieldType/Validator/ImageValidator.php @@ -17,7 +17,7 @@ class ImageValidator extends Validator /** * {@inheritdoc} */ - public function validateConstraints($constraints, ?FieldDefinition $fieldDefinition = null) + public function validateConstraints($constraints, ?FieldDefinition $fieldDefinition = null): array { return []; } diff --git a/src/lib/FieldType/Validator/StringLengthValidator.php b/src/lib/FieldType/Validator/StringLengthValidator.php index 85c136967e..2606863a8f 100644 --- a/src/lib/FieldType/Validator/StringLengthValidator.php +++ b/src/lib/FieldType/Validator/StringLengthValidator.php @@ -38,7 +38,10 @@ class StringLengthValidator extends Validator ], ]; - public function validateConstraints($constraints) + /** + * @return \Ibexa\Core\FieldType\ValidationError[] + */ + public function validateConstraints($constraints): array { $validationErrors = []; foreach ($constraints as $name => $value) { diff --git a/src/lib/FieldType/Value.php b/src/lib/FieldType/Value.php index e5d1d80079..cd2eae50b6 100644 --- a/src/lib/FieldType/Value.php +++ b/src/lib/FieldType/Value.php @@ -21,5 +21,5 @@ abstract class Value extends ValueObject implements ValueInterface * * @return string */ - abstract public function __toString(); + abstract public function __toString(): string; } diff --git a/src/lib/FieldType/ValueSerializer/SymfonySerializerAdapter.php b/src/lib/FieldType/ValueSerializer/SymfonySerializerAdapter.php index 9fcdf51393..bdcf56cd3e 100644 --- a/src/lib/FieldType/ValueSerializer/SymfonySerializerAdapter.php +++ b/src/lib/FieldType/ValueSerializer/SymfonySerializerAdapter.php @@ -22,20 +22,15 @@ final class SymfonySerializerAdapter implements ValueSerializerInterface { private const DEFAULT_FORMAT = 'json'; - /** @var \Symfony\Component\Serializer\Normalizer\NormalizerInterface */ - private $normalizer; + private NormalizerInterface $normalizer; - /** @var \Symfony\Component\Serializer\Normalizer\DenormalizerInterface */ - private $denormalizer; + private DenormalizerInterface $denormalizer; - /** @var \Symfony\Component\Serializer\Encoder\EncoderInterface */ - private $encoder; + private EncoderInterface $encoder; - /** @var \Symfony\Component\Serializer\Encoder\DecoderInterface */ - private $decoder; + private DecoderInterface $decoder; - /** @var string */ - private $format; + private string $format; /** * @param \Symfony\Component\Serializer\Normalizer\NormalizerInterface $normalizer diff --git a/src/lib/Helper/ContentInfoLocationLoader/SudoMainLocationLoader.php b/src/lib/Helper/ContentInfoLocationLoader/SudoMainLocationLoader.php index 650abe4b5c..92733b556e 100644 --- a/src/lib/Helper/ContentInfoLocationLoader/SudoMainLocationLoader.php +++ b/src/lib/Helper/ContentInfoLocationLoader/SudoMainLocationLoader.php @@ -18,8 +18,7 @@ */ class SudoMainLocationLoader implements ContentInfoLocationLoader { - /** @var \Ibexa\Contracts\Core\Repository\Repository|\Ibexa\Core\Repository\Repository */ - private $repository; + private Repository $repository; public function __construct(Repository $repository) { @@ -34,7 +33,7 @@ public function loadLocation(ContentInfo $contentInfo) try { return $this->repository->sudo( - static function (Repository $repository) use ($contentInfo) { + static function (Repository $repository) use ($contentInfo): \Ibexa\Contracts\Core\Repository\Values\Content\Location { return $repository->getLocationService()->loadLocation($contentInfo->mainLocationId); } ); diff --git a/src/lib/Helper/ContentPreviewHelper.php b/src/lib/Helper/ContentPreviewHelper.php index cc7791bf0e..f3be00a7fd 100644 --- a/src/lib/Helper/ContentPreviewHelper.php +++ b/src/lib/Helper/ContentPreviewHelper.php @@ -18,23 +18,18 @@ class ContentPreviewHelper implements SiteAccessAware { - /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessRouterInterface */ - protected $siteAccessRouter; + protected SiteAccessRouterInterface $siteAccessRouter; /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ protected $originalSiteAccess; - /** @var bool */ - private $previewActive = false; + private bool $previewActive = false; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - private $previewedContent; + private ?Content $previewedContent = null; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $previewedLocation; + private ?Location $previewedLocation = null; public function __construct(EventDispatcherInterface $eventDispatcher, SiteAccessRouterInterface $siteAccessRouter) { @@ -42,7 +37,7 @@ public function __construct(EventDispatcherInterface $eventDispatcher, SiteAcces $this->siteAccessRouter = $siteAccessRouter; } - public function setSiteAccess(SiteAccess $siteAccess = null) + public function setSiteAccess(SiteAccess $siteAccess = null): void { $this->originalSiteAccess = $siteAccess; } @@ -96,7 +91,7 @@ public function isPreviewActive() /** * @param bool $previewActive */ - public function setPreviewActive($previewActive) + public function setPreviewActive($previewActive): void { $this->previewActive = (bool)$previewActive; $this->originalSiteAccess = clone $this->originalSiteAccess; @@ -113,7 +108,7 @@ public function getPreviewedContent() /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $previewedContent */ - public function setPreviewedContent(Content $previewedContent) + public function setPreviewedContent(Content $previewedContent): void { $this->previewedContent = $previewedContent; } @@ -129,7 +124,7 @@ public function getPreviewedLocation() /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $previewedLocation */ - public function setPreviewedLocation(Location $previewedLocation) + public function setPreviewedLocation(Location $previewedLocation): void { $this->previewedLocation = $previewedLocation; } diff --git a/src/lib/Helper/FieldHelper.php b/src/lib/Helper/FieldHelper.php index 2cbfc5fa87..893bb05ebb 100644 --- a/src/lib/Helper/FieldHelper.php +++ b/src/lib/Helper/FieldHelper.php @@ -12,11 +12,9 @@ class FieldHelper { - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ - private $fieldTypeService; + private FieldTypeService $fieldTypeService; - /** @var TranslationHelper */ - private $translationHelper; + private TranslationHelper $translationHelper; public function __construct(TranslationHelper $translationHelper, FieldTypeService $fieldTypeService) { @@ -33,7 +31,7 @@ public function __construct(TranslationHelper $translationHelper, FieldTypeServi * * @return bool */ - public function isFieldEmpty(Content $content, $fieldDefIdentifier, $forcedLanguage = null) + public function isFieldEmpty(Content $content, $fieldDefIdentifier, $forcedLanguage = null): bool { $field = $this->translationHelper->getTranslatedField($content, $fieldDefIdentifier, $forcedLanguage); $fieldDefinition = $content->getContentType()->getFieldDefinition($fieldDefIdentifier); diff --git a/src/lib/Helper/FieldsGroups/ArrayTranslatorFieldsGroupsList.php b/src/lib/Helper/FieldsGroups/ArrayTranslatorFieldsGroupsList.php index 016d00cbad..4ca30d153b 100644 --- a/src/lib/Helper/FieldsGroups/ArrayTranslatorFieldsGroupsList.php +++ b/src/lib/Helper/FieldsGroups/ArrayTranslatorFieldsGroupsList.php @@ -19,14 +19,11 @@ */ final class ArrayTranslatorFieldsGroupsList implements FieldsGroupsList { - /** @var array */ - private $groups; + private array $groups; - /** @var string */ - private $defaultGroup; + private string $defaultGroup; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ - private $translator; + private TranslatorInterface $translator; public function __construct(TranslatorInterface $translator, string $defaultGroup, array $groups) { @@ -35,7 +32,10 @@ public function __construct(TranslatorInterface $translator, string $defaultGrou $this->translator = $translator; } - public function getGroups() + /** + * @return mixed[] + */ + public function getGroups(): array { $translatedGroups = []; diff --git a/src/lib/Helper/PreviewLocationProvider.php b/src/lib/Helper/PreviewLocationProvider.php index 4da6a3642e..92b91b639d 100644 --- a/src/lib/Helper/PreviewLocationProvider.php +++ b/src/lib/Helper/PreviewLocationProvider.php @@ -7,6 +7,7 @@ namespace Ibexa\Core\Helper; +use Ibexa\Contracts\Core\Persistence\Content\Location\Handler; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as PersistenceLocationHandler; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Values\Content\Content as APIContent; @@ -18,11 +19,9 @@ */ class PreviewLocationProvider { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - private $locationService; + private LocationService $locationService; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Location\Handler */ - private $locationHandler; + private Handler $locationHandler; /** * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService diff --git a/src/lib/Helper/TranslationHelper.php b/src/lib/Helper/TranslationHelper.php index 27c0e84da5..2c25c684ca 100644 --- a/src/lib/Helper/TranslationHelper.php +++ b/src/lib/Helper/TranslationHelper.php @@ -24,17 +24,13 @@ */ class TranslationHelper { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - protected $configResolver; + protected ConfigResolverInterface $configResolver; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - protected $contentService; + protected ContentService $contentService; - /** @var array */ - private $siteAccessesByLanguage; + private array $siteAccessesByLanguage; - /** @var \Psr\Log\LoggerInterface */ - private $logger; + private ?LoggerInterface $logger; public function __construct(ConfigResolverInterface $configResolver, ContentService $contentService, array $siteAccessesByLanguage, LoggerInterface $logger = null) { @@ -53,7 +49,7 @@ public function __construct(ConfigResolverInterface $configResolver, ContentServ * * @return string */ - public function getTranslatedContentName(Content $content, $forcedLanguage = null): string + public function getTranslatedContentName(Content $content, ?string $forcedLanguage = null): string { return $this->getTranslatedContentNameByVersionInfo( $content->getVersionInfo(), @@ -117,7 +113,7 @@ public function getTranslatedContentNameByContentInfo(ContentInfo $contentInfo, * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Field|null */ - public function getTranslatedField(Content $content, $fieldDefIdentifier, $forcedLanguage = null) + public function getTranslatedField(Content $content, string $fieldDefIdentifier, $forcedLanguage = null) { // Loop over prioritized languages to get the appropriate translated field. foreach ($this->getLanguages($forcedLanguage) as $lang) { @@ -146,7 +142,7 @@ public function getTranslatedField(Content $content, $fieldDefIdentifier, $force public function getTranslatedFieldDefinitionProperty( ContentType $contentType, $fieldDefIdentifier, - $property = 'name', + string $property = 'name', $forcedLanguage = null ) { $fieldDefinition = $contentType->getFieldDefinition($fieldDefIdentifier); @@ -274,7 +270,7 @@ public function getTranslationSiteAccess($languageCode) * * @return array */ - public function getAvailableLanguages() + public function getAvailableLanguages(): array { $translationSiteAccesses = $this->configResolver->getParameter('translation_siteaccesses'); $relatedSiteAccesses = $translationSiteAccesses ?: $this->configResolver->getParameter('related_siteaccesses'); diff --git a/src/lib/IO/ConfigScopeChangeAwareIOService.php b/src/lib/IO/ConfigScopeChangeAwareIOService.php index 1af4d53e6b..d86beba96f 100644 --- a/src/lib/IO/ConfigScopeChangeAwareIOService.php +++ b/src/lib/IO/ConfigScopeChangeAwareIOService.php @@ -16,14 +16,11 @@ class ConfigScopeChangeAwareIOService implements IOServiceInterface, ConfigScopeChangeSubscriber { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; - /** @var \Ibexa\Core\IO\IOServiceInterface */ - private $innerIOService; + private IOServiceInterface $innerIOService; - /** @var string */ - private $prefixParameterName; + private string $prefixParameterName; public function __construct( ConfigResolverInterface $configResolver, diff --git a/src/lib/IO/IOBinarydataHandler/SiteAccessDependentBinaryDataHandler.php b/src/lib/IO/IOBinarydataHandler/SiteAccessDependentBinaryDataHandler.php index c4ab5a7ebb..9b85a51a56 100644 --- a/src/lib/IO/IOBinarydataHandler/SiteAccessDependentBinaryDataHandler.php +++ b/src/lib/IO/IOBinarydataHandler/SiteAccessDependentBinaryDataHandler.php @@ -15,13 +15,11 @@ /** * @internal */ -final class SiteAccessDependentBinaryDataHandler implements IOBinaryDataHandler +final class SiteAccessDependentBinaryDataHandler implements IOBinarydataHandler { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; - /** @var \Ibexa\Bundle\IO\ApiLoader\HandlerRegistry */ - private $dataHandlerRegistry; + private HandlerRegistry $dataHandlerRegistry; public function __construct( ConfigResolverInterface $configResolver, diff --git a/src/lib/IO/IOBinarydataHandler/SiteAccessDependentMetadataHandler.php b/src/lib/IO/IOBinarydataHandler/SiteAccessDependentMetadataHandler.php index b0b570f2c2..b0e4e51693 100644 --- a/src/lib/IO/IOBinarydataHandler/SiteAccessDependentMetadataHandler.php +++ b/src/lib/IO/IOBinarydataHandler/SiteAccessDependentMetadataHandler.php @@ -17,11 +17,9 @@ */ final class SiteAccessDependentMetadataHandler implements IOMetadataHandler { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; - /** @var \Ibexa\Bundle\IO\ApiLoader\HandlerRegistry */ - private $dataHandlerRegistry; + private HandlerRegistry $dataHandlerRegistry; public function __construct( ConfigResolverInterface $configResolver, diff --git a/src/lib/IO/IOMetadataHandler/LegacyDFSCluster.php b/src/lib/IO/IOMetadataHandler/LegacyDFSCluster.php index 79cc6dd02f..ce8df91fe8 100644 --- a/src/lib/IO/IOMetadataHandler/LegacyDFSCluster.php +++ b/src/lib/IO/IOMetadataHandler/LegacyDFSCluster.php @@ -10,6 +10,7 @@ use DateTime; use Doctrine\DBAL\Connection; use Doctrine\DBAL\Exception; +use Ibexa\Contracts\Core\IO\BinaryFile; use Ibexa\Contracts\Core\IO\BinaryFile as SPIBinaryFile; use Ibexa\Contracts\Core\IO\BinaryFileCreateStruct as SPIBinaryFileCreateStruct; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; @@ -24,11 +25,9 @@ */ class LegacyDFSCluster implements IOMetadataHandler { - /** @var \Doctrine\DBAL\Connection */ - private $db; + private Connection $db; - /** @var \Ibexa\Core\IO\UrlDecorator */ - private $urlDecorator; + private ?UrlDecorator $urlDecorator; /** * @param \Doctrine\DBAL\Connection $connection Doctrine DBAL connection @@ -92,7 +91,7 @@ public function create(SPIBinaryFileCreateStruct $spiBinaryFileCreateStruct) * * @param string $spiBinaryFileId */ - public function delete($spiBinaryFileId) + public function delete($spiBinaryFileId): void { $path = (string)$this->addPrefix($spiBinaryFileId); @@ -277,7 +276,7 @@ public function getMimeType($spiBinaryFileId) * * @param string $spiPath SPI Path, not prefixed by URL decoration */ - public function deleteDirectory($spiPath) + public function deleteDirectory($spiPath): void { $query = $this->db->createQueryBuilder(); $query @@ -298,7 +297,7 @@ public function deleteDirectory($spiPath) * * @return \Ibexa\Contracts\Core\IO\BinaryFile */ - protected function mapArrayToSPIBinaryFile(array $properties) + protected function mapArrayToSPIBinaryFile(array $properties): BinaryFile { $spiBinaryFile = new SPIBinaryFile(); $spiBinaryFile->id = $properties['id']; @@ -313,7 +312,7 @@ protected function mapArrayToSPIBinaryFile(array $properties) * * @return \Ibexa\Contracts\Core\IO\BinaryFile */ - protected function mapSPIBinaryFileCreateStructToSPIBinaryFile(SPIBinaryFileCreateStruct $binaryFileCreateStruct) + protected function mapSPIBinaryFileCreateStructToSPIBinaryFile(SPIBinaryFileCreateStruct $binaryFileCreateStruct): BinaryFile { $spiBinaryFile = new SPIBinaryFile(); $spiBinaryFile->id = $binaryFileCreateStruct->id; diff --git a/src/lib/IO/IOService.php b/src/lib/IO/IOService.php index c80a2822fd..9a9d66d840 100644 --- a/src/lib/IO/IOService.php +++ b/src/lib/IO/IOService.php @@ -25,17 +25,13 @@ */ class IOService implements IOServiceInterface { - /** @var \Ibexa\Core\IO\IOBinarydataHandler */ - protected $binarydataHandler; + protected IOBinarydataHandler $binarydataHandler; - /** @var \Ibexa\Core\IO\IOMetadataHandler */ - protected $metadataHandler; + protected IOMetadataHandler $metadataHandler; - /** @var \Ibexa\Contracts\Core\IO\MimeTypeDetector */ - protected $mimeTypeDetector; + protected MimeTypeDetector $mimeTypeDetector; - /** @var array */ - protected $settings; + protected array $settings; public function __construct( IOMetadataHandler $metadataHandler, @@ -49,12 +45,12 @@ public function __construct( $this->settings = $settings; } - public function setPrefix($prefix) + public function setPrefix($prefix): void { $this->settings['prefix'] = $prefix; } - public function newBinaryCreateStructFromUploadedFile(array $uploadedFile) + public function newBinaryCreateStructFromUploadedFile(array $uploadedFile): BinaryFileCreateStruct { if (!is_string($uploadedFile['tmp_name']) || empty($uploadedFile['tmp_name'])) { throw new InvalidArgumentException('uploadedFile', "uploadedFile['tmp_name'] does not exist or has invalid value"); @@ -77,7 +73,7 @@ public function newBinaryCreateStructFromUploadedFile(array $uploadedFile) return $binaryCreateStruct; } - public function newBinaryCreateStructFromLocalFile($localFile) + public function newBinaryCreateStructFromLocalFile($localFile): BinaryFileCreateStruct { if (empty($localFile) || !is_string($localFile)) { throw new InvalidArgumentException('localFile', 'localFile has an invalid value'); @@ -139,7 +135,7 @@ public function createBinaryFile(BinaryFileCreateStruct $binaryFileCreateStruct) return $this->buildDomainBinaryFileObject($spiBinaryFile); } - public function deleteBinaryFile(BinaryFile $binaryFile) + public function deleteBinaryFile(BinaryFile $binaryFile): void { $this->checkBinaryFileId($binaryFile->id); $spiUri = $this->getPrefixedUri($binaryFile->id); @@ -218,7 +214,7 @@ public function exists($binaryFileId) * * @return \Ibexa\Contracts\Core\IO\BinaryFileCreateStruct */ - protected function buildSPIBinaryFileCreateStructObject(BinaryFileCreateStruct $binaryFileCreateStruct) + protected function buildSPIBinaryFileCreateStructObject(BinaryFileCreateStruct $binaryFileCreateStruct): SPIBinaryFileCreateStruct { $spiBinaryCreateStruct = new SPIBinaryFileCreateStruct(); @@ -238,7 +234,7 @@ protected function buildSPIBinaryFileCreateStructObject(BinaryFileCreateStruct $ * * @return \Ibexa\Core\IO\Values\BinaryFile */ - protected function buildDomainBinaryFileObject(SPIBinaryFile $spiBinaryFile) + protected function buildDomainBinaryFileObject(SPIBinaryFile $spiBinaryFile): BinaryFile { return new BinaryFile( [ @@ -257,7 +253,7 @@ protected function buildDomainBinaryFileObject(SPIBinaryFile $spiBinaryFile) * * @return string */ - protected function getPrefixedUri($binaryFileId) + protected function getPrefixedUri(string $binaryFileId): string { $prefix = ''; if (isset($this->settings['prefix'])) { @@ -304,7 +300,7 @@ protected function checkBinaryFileId($binaryFileId) * * @param string $path */ - public function deleteDirectory($path) + public function deleteDirectory($path): void { $prefixedUri = $this->getPrefixedUri($path); $this->metadataHandler->deleteDirectory($prefixedUri); @@ -318,7 +314,7 @@ public function deleteDirectory($path) * * @return bool */ - protected function isAbsolutePath($path) + protected function isAbsolutePath($path): bool { return $path[0] === '/' || (PHP_OS === 'WINNT' && $path[1] === ':'); } diff --git a/src/lib/IO/TolerantIOService.php b/src/lib/IO/TolerantIOService.php index c388b8026a..7e9d821194 100644 --- a/src/lib/IO/TolerantIOService.php +++ b/src/lib/IO/TolerantIOService.php @@ -26,7 +26,7 @@ class TolerantIOService extends IOService /** @var \Psr\Log\LoggerInterface */ protected $logger; - public function setLogger(LoggerInterface $logger = null) + public function setLogger(LoggerInterface $logger = null): void { $this->logger = $logger; } @@ -39,7 +39,7 @@ public function setLogger(LoggerInterface $logger = null) * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentValue If the binary file is invalid * @throws \Ibexa\Core\IO\Exception\BinaryFileNotFoundException If the binary file isn't found */ - public function deleteBinaryFile(BinaryFile $binaryFile) + public function deleteBinaryFile(BinaryFile $binaryFile): void { $this->checkBinaryFileId($binaryFile->id); $spiUri = $this->getPrefixedUri($binaryFile->id); @@ -121,7 +121,7 @@ public function loadBinaryFileByUri($binaryFileUri) } } - private function logMissingFile($id) + private function logMissingFile($id): void { if (!isset($this->logger)) { return; diff --git a/src/lib/IO/UrlDecorator/Prefix.php b/src/lib/IO/UrlDecorator/Prefix.php index 64576fa977..aef42515f9 100644 --- a/src/lib/IO/UrlDecorator/Prefix.php +++ b/src/lib/IO/UrlDecorator/Prefix.php @@ -17,8 +17,7 @@ */ class Prefix implements UrlDecorator { - /** @var \Ibexa\Core\IO\IOConfigProvider */ - protected $ioConfigResolver; + protected IOConfigProvider $ioConfigResolver; public function __construct(IOConfigProvider $IOConfigResolver) { diff --git a/src/lib/IO/UrlRedecorator.php b/src/lib/IO/UrlRedecorator.php index ed4f470335..4e6b4b7659 100644 --- a/src/lib/IO/UrlRedecorator.php +++ b/src/lib/IO/UrlRedecorator.php @@ -12,11 +12,9 @@ */ class UrlRedecorator implements UrlRedecoratorInterface { - /** @var UrlDecorator */ - private $sourceDecorator; + private UrlDecorator $sourceDecorator; - /** @var UrlDecorator */ - private $targetDecorator; + private UrlDecorator $targetDecorator; public function __construct(UrlDecorator $sourceDecorator, UrlDecorator $targetDecorator) { diff --git a/src/lib/Limitation/AbstractPersistenceLimitationType.php b/src/lib/Limitation/AbstractPersistenceLimitationType.php index 61a7d19c9c..8626975af9 100644 --- a/src/lib/Limitation/AbstractPersistenceLimitationType.php +++ b/src/lib/Limitation/AbstractPersistenceLimitationType.php @@ -7,6 +7,7 @@ namespace Ibexa\Core\Limitation; +use Ibexa\Contracts\Core\Persistence\Handler; use Ibexa\Contracts\Core\Persistence\Handler as SPIPersistenceHandler; /** @@ -14,8 +15,7 @@ */ class AbstractPersistenceLimitationType { - /** @var \Ibexa\Contracts\Core\Persistence\Handler */ - protected $persistence; + protected Handler $persistence; /** * @param \Ibexa\Contracts\Core\Persistence\Handler $persistence diff --git a/src/lib/Limitation/BlockingLimitationType.php b/src/lib/Limitation/BlockingLimitationType.php index 0769837be9..e03b281af9 100644 --- a/src/lib/Limitation/BlockingLimitationType.php +++ b/src/lib/Limitation/BlockingLimitationType.php @@ -10,7 +10,9 @@ use Ibexa\Contracts\Core\Limitation\Type as SPILimitationTypeInterface; use Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\MatchNone; use Ibexa\Contracts\Core\Repository\Values\User\Limitation as APILimitationValue; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\BlockingLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\BlockingLimitation as APIBlockingLimitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference as APIUserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -54,7 +56,7 @@ public function __construct($identifier) * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitationValue */ - public function acceptValue(APILimitationValue $limitationValue) + public function acceptValue(APILimitationValue $limitationValue): void { if (!$limitationValue instanceof APIBlockingLimitation) { throw new InvalidArgumentType('$limitationValue', 'BlockingLimitation', $limitationValue); @@ -72,7 +74,7 @@ public function acceptValue(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(APILimitationValue $limitationValue) + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; if (empty($limitationValue->limitationValues)) { @@ -95,7 +97,7 @@ public function validate(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation */ - public function buildValue(array $limitationValues) + public function buildValue(array $limitationValues): BlockingLimitation { return new APIBlockingLimitation($this->identifier, $limitationValues); } @@ -132,9 +134,9 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface */ - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): MatchNone { - return new Criterion\MatchNone(); + return new MatchNone(); } /** @@ -145,7 +147,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren * @return mixed[]|int In case of array, a hash with key as valid limitations value and value as human readable name * of that option, in case of int on of VALUE_SCHEMA_ constants. */ - public function valueSchema() + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } diff --git a/src/lib/Limitation/ChangeOwnerLimitationType.php b/src/lib/Limitation/ChangeOwnerLimitationType.php index ed0005b578..7a2d2aeb93 100644 --- a/src/lib/Limitation/ChangeOwnerLimitationType.php +++ b/src/lib/Limitation/ChangeOwnerLimitationType.php @@ -113,7 +113,7 @@ public function getCriterion(Limitation $value, APIUserReference $currentUser): /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException */ - public function valueSchema(): void + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } diff --git a/src/lib/Limitation/ContentTypeLimitationType.php b/src/lib/Limitation/ContentTypeLimitationType.php index 067792d2df..eb2e0c4115 100644 --- a/src/lib/Limitation/ContentTypeLimitationType.php +++ b/src/lib/Limitation/ContentTypeLimitationType.php @@ -15,8 +15,10 @@ use Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeId; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Contracts\Core\Repository\Values\User\Limitation as APILimitationValue; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ContentTypeLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ContentTypeLimitation as APIContentTypeLimitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference as APIUserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -38,7 +40,7 @@ class ContentTypeLimitationType extends AbstractPersistenceLimitationType implem * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitationValue */ - public function acceptValue(APILimitationValue $limitationValue) + public function acceptValue(APILimitationValue $limitationValue): void { if (!$limitationValue instanceof APIContentTypeLimitation) { throw new InvalidArgumentType('$limitationValue', 'APIContentTypeLimitation', $limitationValue); @@ -62,7 +64,7 @@ public function acceptValue(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(APILimitationValue $limitationValue) + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; foreach ($limitationValue->limitationValues as $key => $id) { @@ -90,7 +92,7 @@ public function validate(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation */ - public function buildValue(array $limitationValues) + public function buildValue(array $limitationValues): ContentTypeLimitation { return new APIContentTypeLimitation(['limitationValues' => $limitationValues]); } @@ -165,7 +167,7 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface */ - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): ContentTypeId { if (empty($value->limitationValues)) { // A Policy should not have empty limitationValues stored @@ -174,11 +176,11 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren if (!isset($value->limitationValues[1])) { // 1 limitation value: EQ operation - return new Criterion\ContentTypeId($value->limitationValues[0]); + return new ContentTypeId($value->limitationValues[0]); } // several limitation values: IN operation - return new Criterion\ContentTypeId($value->limitationValues); + return new ContentTypeId($value->limitationValues); } /** @@ -187,7 +189,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren * @return mixed[]|int In case of array, a hash with key as valid limitations value and value as human readable name * of that option, in case of int on of VALUE_SCHEMA_ constants. */ - public function valueSchema() + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } diff --git a/src/lib/Limitation/LanguageLimitationType.php b/src/lib/Limitation/LanguageLimitationType.php index 818e2dc549..4ca448e842 100644 --- a/src/lib/Limitation/LanguageLimitationType.php +++ b/src/lib/Limitation/LanguageLimitationType.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\Core\Limitation\Target; use Ibexa\Contracts\Core\Limitation\Target\DestinationLocation as DestinationLocationTarget; use Ibexa\Contracts\Core\Limitation\TargetAwareType as SPITargetAwareLimitationType; +use Ibexa\Contracts\Core\Persistence\Content\Handler; use Ibexa\Contracts\Core\Persistence\Content\Handler as SPIPersistenceContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Language\Handler as SPIPersistenceLanguageHandler; use Ibexa\Contracts\Core\Persistence\Content\VersionInfo as SPIVersionInfo; @@ -34,14 +35,12 @@ */ class LanguageLimitationType implements SPITargetAwareLimitationType { - /** @var \Ibexa\Contracts\Core\Persistence\Content\Language\Handler */ - private $persistenceLanguageHandler; + private SPIPersistenceLanguageHandler $persistenceLanguageHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Handler */ - private $persistenceContentHandler; + private Handler $persistenceContentHandler; /** @var \Ibexa\Core\Limitation\LanguageLimitation\VersionTargetEvaluator[] */ - private $versionTargetEvaluators; + private iterable $versionTargetEvaluators; /** * @param \Ibexa\Contracts\Core\Persistence\Content\Language\Handler $persistenceLanguageHandler diff --git a/src/lib/Limitation/LocationLimitationType.php b/src/lib/Limitation/LocationLimitationType.php index f90ec4d3e7..6d33289b08 100644 --- a/src/lib/Limitation/LocationLimitationType.php +++ b/src/lib/Limitation/LocationLimitationType.php @@ -16,8 +16,10 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LocationId; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Contracts\Core\Repository\Values\User\Limitation as APILimitationValue; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\LocationLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\LocationLimitation as APILocationLimitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference as APIUserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -39,7 +41,7 @@ class LocationLimitationType extends AbstractPersistenceLimitationType implement * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitationValue */ - public function acceptValue(APILimitationValue $limitationValue) + public function acceptValue(APILimitationValue $limitationValue): void { if (!$limitationValue instanceof APILocationLimitation) { throw new InvalidArgumentType('$limitationValue', 'APILocationLimitation', $limitationValue); @@ -63,7 +65,7 @@ public function acceptValue(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(APILimitationValue $limitationValue) + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; foreach ($limitationValue->limitationValues as $key => $id) { @@ -91,7 +93,7 @@ public function validate(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation */ - public function buildValue(array $limitationValues) + public function buildValue(array $limitationValues): LocationLimitation { return new APILocationLimitation(['limitationValues' => $limitationValues]); } @@ -111,7 +113,7 @@ public function buildValue(array $limitationValues) * * @return bool */ - public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null) + public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null): bool|true|false { if (!$value instanceof APILocationLimitation) { throw new InvalidArgumentException('$value', 'Must be of type: APILocationLimitation'); @@ -208,7 +210,7 @@ protected function evaluateForContentCreateStruct(APILimitationValue $value, arr * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface */ - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): LocationId { if (empty($value->limitationValues)) { // A Policy should not have empty limitationValues stored @@ -217,11 +219,11 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren if (!isset($value->limitationValues[1])) { // 1 limitation value: EQ operation - return new Criterion\LocationId($value->limitationValues[0]); + return new LocationId($value->limitationValues[0]); } // several limitation values: IN operation - return new Criterion\LocationId($value->limitationValues); + return new LocationId($value->limitationValues); } public function valueSchema(): int diff --git a/src/lib/Limitation/MemberOfLimitationType.php b/src/lib/Limitation/MemberOfLimitationType.php index aaecc7683e..08b05c3479 100644 --- a/src/lib/Limitation/MemberOfLimitationType.php +++ b/src/lib/Limitation/MemberOfLimitationType.php @@ -55,7 +55,10 @@ public function acceptValue(APILimitationValue $limitationValue): void } } - public function validate(APILimitationValue $limitationValue) + /** + * @return \Ibexa\Core\FieldType\ValidationError[] + */ + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; @@ -88,7 +91,7 @@ public function buildValue(array $limitationValues): APILimitationValue return new MemberOfLimitation(['limitationValues' => $limitationValues]); } - public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null) + public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null): ?bool { if (!$value instanceof MemberOfLimitation) { throw new InvalidArgumentException( @@ -124,12 +127,12 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse return self::ACCESS_DENIED; } - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): never { throw new NotImplementedException('Member of Limitation Criterion'); } - public function valueSchema() + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } diff --git a/src/lib/Limitation/NewObjectStateLimitationType.php b/src/lib/Limitation/NewObjectStateLimitationType.php index 2db85f5b1b..a81d5157af 100644 --- a/src/lib/Limitation/NewObjectStateLimitationType.php +++ b/src/lib/Limitation/NewObjectStateLimitationType.php @@ -17,6 +17,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState; use Ibexa\Contracts\Core\Repository\Values\User\Limitation as APILimitationValue; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\NewObjectStateLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\NewObjectStateLimitation as APINewObjectStateLimitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference as APIUserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -38,7 +39,7 @@ class NewObjectStateLimitationType extends AbstractPersistenceLimitationType imp * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitationValue */ - public function acceptValue(APILimitationValue $limitationValue) + public function acceptValue(APILimitationValue $limitationValue): void { if (!$limitationValue instanceof APINewObjectStateLimitation) { throw new InvalidArgumentType('$limitationValue', 'NewObjectStateLimitation', $limitationValue); @@ -62,7 +63,7 @@ public function acceptValue(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(APILimitationValue $limitationValue) + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; foreach ($limitationValue->limitationValues as $key => $id) { @@ -90,7 +91,7 @@ public function validate(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation */ - public function buildValue(array $limitationValues) + public function buildValue(array $limitationValues): NewObjectStateLimitation { return new APINewObjectStateLimitation(['limitationValues' => $limitationValues]); } @@ -151,7 +152,7 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface */ - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): never { throw new NotImplementedException(__METHOD__); } @@ -162,7 +163,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren * @return mixed[]|int In case of array, a hash with key as valid limitations value and value as human readable name * of that option, in case of int on of VALUE_SCHEMA_ constants. */ - public function valueSchema() + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } diff --git a/src/lib/Limitation/NewSectionLimitationType.php b/src/lib/Limitation/NewSectionLimitationType.php index faa03cd792..a9b6318b77 100644 --- a/src/lib/Limitation/NewSectionLimitationType.php +++ b/src/lib/Limitation/NewSectionLimitationType.php @@ -18,7 +18,9 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Section; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation as APILimitationValue; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\NewSectionLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\NewSectionLimitation as APINewSectionLimitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference as APIUserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -40,7 +42,7 @@ class NewSectionLimitationType extends AbstractPersistenceLimitationType impleme * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitationValue */ - public function acceptValue(APILimitationValue $limitationValue) + public function acceptValue(APILimitationValue $limitationValue): void { if (!$limitationValue instanceof APINewSectionLimitation) { throw new InvalidArgumentType('$limitationValue', 'APINewSectionLimitation', $limitationValue); @@ -64,7 +66,7 @@ public function acceptValue(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(APILimitationValue $limitationValue) + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; foreach ($limitationValue->limitationValues as $key => $id) { @@ -92,7 +94,7 @@ public function validate(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation */ - public function buildValue(array $limitationValues) + public function buildValue(array $limitationValues): NewSectionLimitation { return new APINewSectionLimitation(['limitationValues' => $limitationValues]); } @@ -143,7 +145,7 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface */ - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): never { throw new NotImplementedException(__METHOD__); } @@ -154,7 +156,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren * @return mixed[]|int In case of array, a hash with key as valid limitations value and value as human readable name * of that option, in case of int on of VALUE_SCHEMA_ constants. */ - public function valueSchema() + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } @@ -185,7 +187,7 @@ public function getCriterionByTarget(APILimitationValue $value, APIUserReference * * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException */ - private function doEvaluate(APILimitationValue $value, array $targets): bool + private function doEvaluate(NewSectionLimitation|Limitation $value, array $targets): bool { foreach ($targets as $target) { if (!$target instanceof Section && !$target instanceof SPISection) { diff --git a/src/lib/Limitation/ObjectStateLimitationType.php b/src/lib/Limitation/ObjectStateLimitationType.php index 4c4775ece7..53fbfd32c2 100644 --- a/src/lib/Limitation/ObjectStateLimitationType.php +++ b/src/lib/Limitation/ObjectStateLimitationType.php @@ -16,8 +16,11 @@ use Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ObjectStateId; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Contracts\Core\Repository\Values\User\Limitation as APILimitationValue; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ObjectStateLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ObjectStateLimitation as APIObjectStateLimitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference as APIUserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -41,7 +44,7 @@ class ObjectStateLimitationType extends AbstractPersistenceLimitationType implem * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitationValue */ - public function acceptValue(APILimitationValue $limitationValue) + public function acceptValue(APILimitationValue $limitationValue): void { if (!$limitationValue instanceof APIObjectStateLimitation) { throw new InvalidArgumentType('$limitationValue', 'APIObjectStateLimitation', $limitationValue); @@ -67,7 +70,7 @@ public function acceptValue(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(APILimitationValue $limitationValue) + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; foreach ($limitationValue->limitationValues as $key => $id) { @@ -95,7 +98,7 @@ public function validate(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation */ - public function buildValue(array $limitationValues) + public function buildValue(array $limitationValues): ObjectStateLimitation { return new APIObjectStateLimitation(['limitationValues' => $limitationValues]); } @@ -211,7 +214,7 @@ private function areObjectStatesMatchingTheLimitation( * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface|\Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalOperator */ - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): ObjectStateId|LogicalAnd { if (empty($value->limitationValues)) { // A Policy should not have empty limitationValues stored @@ -220,23 +223,23 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren if (!isset($value->limitationValues[1])) { // 1 limitation value: EQ operation - return new Criterion\ObjectStateId($value->limitationValues[0]); + return new ObjectStateId($value->limitationValues[0]); } $groupedLimitationValues = $this->groupLimitationValues($value->limitationValues); if (count($groupedLimitationValues) === 1) { // one group, several limitation values: IN operation - return new Criterion\ObjectStateId($groupedLimitationValues[0]); + return new ObjectStateId($groupedLimitationValues[0]); } // limitations from different groups require logical AND between them $criterions = []; foreach ($groupedLimitationValues as $limitationGroup) { - $criterions[] = new Criterion\ObjectStateId($limitationGroup); + $criterions[] = new ObjectStateId($limitationGroup); } - return new Criterion\LogicalAnd($criterions); + return new LogicalAnd($criterions); } /** @@ -246,7 +249,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren * * @return int[][] */ - private function groupLimitationValues(array $limitationValues) + private function groupLimitationValues(array $limitationValues): array { $objectStateHandler = $this->persistence->objectStateHandler(); $stateGroups = $objectStateHandler->loadAllGroups(); @@ -268,7 +271,7 @@ private function groupLimitationValues(array $limitationValues) /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException */ - public function valueSchema() + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } diff --git a/src/lib/Limitation/OwnerLimitationType.php b/src/lib/Limitation/OwnerLimitationType.php index 633623b813..78d6774ac7 100644 --- a/src/lib/Limitation/OwnerLimitationType.php +++ b/src/lib/Limitation/OwnerLimitationType.php @@ -13,8 +13,10 @@ use Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\UserMetadata; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Contracts\Core\Repository\Values\User\Limitation as APILimitationValue; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\OwnerLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\OwnerLimitation as APIOwnerLimitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference as APIUserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -37,7 +39,7 @@ class OwnerLimitationType extends AbstractPersistenceLimitationType implements S * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitationValue */ - public function acceptValue(APILimitationValue $limitationValue) + public function acceptValue(APILimitationValue $limitationValue): void { if (!$limitationValue instanceof APIOwnerLimitation) { throw new InvalidArgumentType('$limitationValue', 'APIOwnerLimitation', $limitationValue); @@ -64,7 +66,7 @@ public function acceptValue(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(APILimitationValue $limitationValue) + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; foreach ($limitationValue->limitationValues as $key => $value) { @@ -90,7 +92,7 @@ public function validate(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation */ - public function buildValue(array $limitationValues) + public function buildValue(array $limitationValues): OwnerLimitation { return new APIOwnerLimitation(['limitationValues' => $limitationValues]); } @@ -157,7 +159,7 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse * * @todo Add support for $limitationValues[0] == 2 when session values can be injected somehow, or deprecate */ - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): UserMetadata { if (empty($value->limitationValues)) { // A Policy should not have empty limitationValues stored @@ -171,8 +173,8 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren ); } - return new Criterion\UserMetadata( - Criterion\UserMetadata::OWNER, + return new UserMetadata( + UserMetadata::OWNER, Criterion\Operator::EQ, $currentUser->getUserId() ); @@ -184,7 +186,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren * @return mixed[]|int In case of array, a hash with key as valid limitations value and value as human readable name * of that option, in case of int on of VALUE_SCHEMA_ constants. */ - public function valueSchema() + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } diff --git a/src/lib/Limitation/ParentContentTypeLimitationType.php b/src/lib/Limitation/ParentContentTypeLimitationType.php index edf10d02aa..7d188e79b2 100644 --- a/src/lib/Limitation/ParentContentTypeLimitationType.php +++ b/src/lib/Limitation/ParentContentTypeLimitationType.php @@ -18,6 +18,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Contracts\Core\Repository\Values\User\Limitation as APILimitationValue; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ParentContentTypeLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ParentContentTypeLimitation as APIParentContentTypeLimitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference as APIUserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -39,7 +40,7 @@ class ParentContentTypeLimitationType extends AbstractPersistenceLimitationType * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitationValue */ - public function acceptValue(APILimitationValue $limitationValue) + public function acceptValue(APILimitationValue $limitationValue): void { if (!$limitationValue instanceof APIParentContentTypeLimitation) { throw new InvalidArgumentType('$limitationValue', 'APIParentContentTypeLimitation', $limitationValue); @@ -63,7 +64,7 @@ public function acceptValue(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(APILimitationValue $limitationValue) + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; foreach ($limitationValue->limitationValues as $key => $id) { @@ -91,7 +92,7 @@ public function validate(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation */ - public function buildValue(array $limitationValues) + public function buildValue(array $limitationValues): ParentContentTypeLimitation { return new APIParentContentTypeLimitation(['limitationValues' => $limitationValues]); } @@ -222,7 +223,7 @@ protected function evaluateForContentCreateStruct(APILimitationValue $value, arr * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface */ - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): never { throw new NotImplementedException(__METHOD__); } @@ -233,7 +234,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren * @return mixed[]|int In case of array, a hash with key as valid limitations value and value as human readable name * of that option, in case of int on of VALUE_SCHEMA_ constants. */ - public function valueSchema() + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } @@ -245,7 +246,7 @@ public function valueSchema() * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - private function loadParentLocations(ContentInfo $contentInfo) + private function loadParentLocations(ContentInfo $contentInfo): array { $locations = $this->persistence->locationHandler()->loadLocationsByContent($contentInfo->id); $parentLocations = []; diff --git a/src/lib/Limitation/ParentDepthLimitationType.php b/src/lib/Limitation/ParentDepthLimitationType.php index a8be463053..bdbb78e3c0 100644 --- a/src/lib/Limitation/ParentDepthLimitationType.php +++ b/src/lib/Limitation/ParentDepthLimitationType.php @@ -17,6 +17,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Contracts\Core\Repository\Values\User\Limitation as APILimitationValue; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ParentDepthLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ParentDepthLimitation as APIParentDepthLimitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference as APIUserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -37,7 +38,7 @@ class ParentDepthLimitationType extends AbstractPersistenceLimitationType implem * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitationValue */ - public function acceptValue(APILimitationValue $limitationValue) + public function acceptValue(APILimitationValue $limitationValue): void { if (!$limitationValue instanceof APIParentDepthLimitation) { throw new InvalidArgumentType('$limitationValue', 'APIParentDepthLimitation', $limitationValue); @@ -64,7 +65,7 @@ public function acceptValue(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(APILimitationValue $limitationValue) + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; @@ -78,7 +79,7 @@ public function validate(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation */ - public function buildValue(array $limitationValues) + public function buildValue(array $limitationValues): ParentDepthLimitation { return new APIParentDepthLimitation(['limitationValues' => $limitationValues]); } @@ -201,7 +202,7 @@ protected function evaluateForContentCreateStruct(APILimitationValue $value, arr * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface */ - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): never { throw new NotImplementedException(__METHOD__); } @@ -212,7 +213,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren * @return mixed[]|int In case of array, a hash with key as valid limitations value and value as human readable name * of that option, in case of int on of VALUE_SCHEMA_ constants. */ - public function valueSchema() + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } diff --git a/src/lib/Limitation/ParentOwnerLimitationType.php b/src/lib/Limitation/ParentOwnerLimitationType.php index f839264972..8e3e2fa3df 100644 --- a/src/lib/Limitation/ParentOwnerLimitationType.php +++ b/src/lib/Limitation/ParentOwnerLimitationType.php @@ -14,6 +14,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct; use Ibexa\Contracts\Core\Repository\Values\User\Limitation as APILimitationValue; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ParentOwnerLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ParentOwnerLimitation as APIParentOwnerLimitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference as APIUserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -36,7 +37,7 @@ class ParentOwnerLimitationType extends AbstractPersistenceLimitationType implem * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitationValue */ - public function acceptValue(APILimitationValue $limitationValue) + public function acceptValue(APILimitationValue $limitationValue): void { if (!$limitationValue instanceof APIParentOwnerLimitation) { throw new InvalidArgumentType('$limitationValue', 'APIParentOwnerLimitation', $limitationValue); @@ -63,7 +64,7 @@ public function acceptValue(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(APILimitationValue $limitationValue) + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; foreach ($limitationValue->limitationValues as $key => $value) { @@ -89,7 +90,7 @@ public function validate(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation */ - public function buildValue(array $limitationValues) + public function buildValue(array $limitationValues): ParentOwnerLimitation { return new APIParentOwnerLimitation(['limitationValues' => $limitationValues]); } @@ -174,7 +175,7 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface */ - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): never { throw new NotImplementedException(__METHOD__); } @@ -185,7 +186,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren * @return mixed[]|int In case of array, a hash with key as valid limitations value and value as human readable name * of that option, in case of int on of VALUE_SCHEMA_ constants. */ - public function valueSchema() + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } diff --git a/src/lib/Limitation/ParentUserGroupLimitationType.php b/src/lib/Limitation/ParentUserGroupLimitationType.php index 216ed26e55..d3e991837f 100644 --- a/src/lib/Limitation/ParentUserGroupLimitationType.php +++ b/src/lib/Limitation/ParentUserGroupLimitationType.php @@ -14,6 +14,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct; use Ibexa\Contracts\Core\Repository\Values\User\Limitation as APILimitationValue; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ParentUserGroupLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ParentUserGroupLimitation as APIParentUserGroupLimitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference as APIUserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -36,7 +37,7 @@ class ParentUserGroupLimitationType extends AbstractPersistenceLimitationType im * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitationValue */ - public function acceptValue(APILimitationValue $limitationValue) + public function acceptValue(APILimitationValue $limitationValue): void { if (!$limitationValue instanceof APIParentUserGroupLimitation) { throw new InvalidArgumentType('$limitationValue', 'APIParentUserGroupLimitation', $limitationValue); @@ -66,7 +67,7 @@ public function acceptValue(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(APILimitationValue $limitationValue) + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; foreach ($limitationValue->limitationValues as $key => $value) { @@ -92,7 +93,7 @@ public function validate(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation */ - public function buildValue(array $limitationValues) + public function buildValue(array $limitationValues): ParentUserGroupLimitation { return new APIParentUserGroupLimitation(['limitationValues' => $limitationValues]); } @@ -198,7 +199,7 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface */ - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): never { throw new NotImplementedException(__METHOD__); } @@ -209,7 +210,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren * @return mixed[]|int In case of array, a hash with key as valid limitations value and value as human readable name * of that option, in case of int on of VALUE_SCHEMA_ constants. */ - public function valueSchema() + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } diff --git a/src/lib/Limitation/RoleLimitationType.php b/src/lib/Limitation/RoleLimitationType.php index 5940e1d021..70ee36653b 100644 --- a/src/lib/Limitation/RoleLimitationType.php +++ b/src/lib/Limitation/RoleLimitationType.php @@ -54,7 +54,10 @@ public function acceptValue(APILimitationValue $limitationValue): void } } - public function validate(APILimitationValue $limitationValue) + /** + * @return \Ibexa\Core\FieldType\ValidationError[] + */ + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; @@ -84,7 +87,7 @@ public function buildValue(array $limitationValues): APILimitationValue return new UserRoleLimitation(['limitationValues' => $limitationValues]); } - public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null) + public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null): ?bool { if (!$value instanceof UserRoleLimitation) { throw new InvalidArgumentException( @@ -123,12 +126,12 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse return self::ACCESS_DENIED; } - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): never { throw new NotImplementedException('Role Limitation Criterion'); } - public function valueSchema() + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } diff --git a/src/lib/Limitation/SectionLimitationType.php b/src/lib/Limitation/SectionLimitationType.php index bf6eb784d0..cde5a1a377 100644 --- a/src/lib/Limitation/SectionLimitationType.php +++ b/src/lib/Limitation/SectionLimitationType.php @@ -14,9 +14,11 @@ use Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\SectionId; use Ibexa\Contracts\Core\Repository\Values\Content\Section; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Contracts\Core\Repository\Values\User\Limitation as APILimitationValue; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\SectionLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\SectionLimitation as APISectionLimitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference as APIUserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -38,7 +40,7 @@ class SectionLimitationType extends AbstractPersistenceLimitationType implements * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitationValue */ - public function acceptValue(APILimitationValue $limitationValue) + public function acceptValue(APILimitationValue $limitationValue): void { if (!$limitationValue instanceof APISectionLimitation) { throw new InvalidArgumentType('$limitationValue', 'APISectionLimitation', $limitationValue); @@ -62,7 +64,7 @@ public function acceptValue(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(APILimitationValue $limitationValue) + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; foreach ($limitationValue->limitationValues as $key => $id) { @@ -90,7 +92,7 @@ public function validate(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation */ - public function buildValue(array $limitationValues) + public function buildValue(array $limitationValues): SectionLimitation { return new APISectionLimitation(['limitationValues' => $limitationValues]); } @@ -110,7 +112,7 @@ public function buildValue(array $limitationValues) * * @return bool */ - public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null) + public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null): ?bool { if (!$value instanceof APISectionLimitation) { throw new InvalidArgumentException('$value', 'Must be of type: APISectionLimitation'); @@ -157,7 +159,7 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface */ - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): SectionId { if (empty($value->limitationValues)) { // A Policy should not have empty limitationValues stored @@ -166,11 +168,11 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren if (!isset($value->limitationValues[1])) { // 1 limitation value: EQ operation - return new Criterion\SectionId($value->limitationValues[0]); + return new SectionId($value->limitationValues[0]); } // several limitation values: IN operation - return new Criterion\SectionId($value->limitationValues); + return new SectionId($value->limitationValues); } /** @@ -179,7 +181,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren * @return mixed[]|int In case of array, a hash with key as valid limitations value and value as human readable name * of that option, in case of int on of VALUE_SCHEMA_ constants. */ - public function valueSchema() + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } diff --git a/src/lib/Limitation/SiteAccessLimitationType.php b/src/lib/Limitation/SiteAccessLimitationType.php index fb35007e48..125f9bea42 100644 --- a/src/lib/Limitation/SiteAccessLimitationType.php +++ b/src/lib/Limitation/SiteAccessLimitationType.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\Limitation\Type as SPILimitationTypeInterface; use Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException; use Ibexa\Contracts\Core\Repository\Values\User\Limitation as APILimitationValue; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\SiteAccessLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\SiteAccessLimitation as APISiteAccessLimitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference as APIUserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -17,17 +18,17 @@ use Ibexa\Core\Base\Exceptions\InvalidArgumentType; use Ibexa\Core\FieldType\ValidationError; use Ibexa\Core\MVC\Symfony\SiteAccess; +use Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessServiceInterface; /** * SiteAccessLimitation is a User limitation. */ class SiteAccessLimitationType implements SPILimitationTypeInterface { - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessServiceInterface */ - private $siteAccessService; + private SiteAccessServiceInterface $siteAccessService; public function __construct( - SiteAccess\SiteAccessServiceInterface $siteAccessService + SiteAccessServiceInterface $siteAccessService ) { $this->siteAccessService = $siteAccessService; } @@ -49,7 +50,7 @@ public function generateSiteAccessValue(string $sa): string * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitationValue */ - public function acceptValue(APILimitationValue $limitationValue) + public function acceptValue(APILimitationValue $limitationValue): void { if (!$limitationValue instanceof APISiteAccessLimitation) { throw new InvalidArgumentType('$limitationValue', 'APISiteAccessLimitation', $limitationValue); @@ -74,7 +75,7 @@ public function acceptValue(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(APILimitationValue $limitationValue) + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; $siteAccessList = $this->getSiteAccessList(); @@ -101,7 +102,7 @@ public function validate(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation */ - public function buildValue(array $limitationValues) + public function buildValue(array $limitationValues): SiteAccessLimitation { return new APISiteAccessLimitation(['limitationValues' => $limitationValues]); } @@ -155,7 +156,7 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface */ - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): never { throw new NotImplementedException(__METHOD__); } @@ -166,7 +167,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren * @return mixed[]|int In case of array, a hash with key as valid limitations value and value as human readable name * of that option, in case of int on of VALUE_SCHEMA_ constants. */ - public function valueSchema() + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } diff --git a/src/lib/Limitation/StatusLimitationType.php b/src/lib/Limitation/StatusLimitationType.php index 5efd8e2b47..8de92fc655 100644 --- a/src/lib/Limitation/StatusLimitationType.php +++ b/src/lib/Limitation/StatusLimitationType.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Contracts\Core\Repository\Values\User\Limitation as APILimitationValue; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\StatusLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\StatusLimitation as APIStatusLimitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference as APIUserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -33,7 +34,7 @@ class StatusLimitationType implements SPILimitationTypeInterface * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitationValue */ - public function acceptValue(APILimitationValue $limitationValue) + public function acceptValue(APILimitationValue $limitationValue): void { if (!$limitationValue instanceof APIStatusLimitation) { throw new InvalidArgumentType('$limitationValue', 'APIStatusLimitation', $limitationValue); @@ -57,7 +58,7 @@ public function acceptValue(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(APILimitationValue $limitationValue) + public function validate(APILimitationValue $limitationValue): array { // For limitation values used here see \Ibexa\Contracts\Core\Persistence\Content\VersionInfo::STATUS_* constants. $availableStatusSet = [ @@ -90,7 +91,7 @@ public function validate(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation */ - public function buildValue(array $limitationValues) + public function buildValue(array $limitationValues): StatusLimitation { return new APIStatusLimitation(['limitationValues' => $limitationValues]); } @@ -146,7 +147,7 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface */ - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): never { throw new NotImplementedException('Status Limitation Criterion'); } @@ -157,7 +158,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren * @return mixed[]|int In case of array, a hash with key as valid limitations value and value as human readable name * of that option, in case of int on of VALUE_SCHEMA_ constants. */ - public function valueSchema() + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } diff --git a/src/lib/Limitation/SubtreeLimitationType.php b/src/lib/Limitation/SubtreeLimitationType.php index 67ba1511fc..bae411830d 100644 --- a/src/lib/Limitation/SubtreeLimitationType.php +++ b/src/lib/Limitation/SubtreeLimitationType.php @@ -18,6 +18,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Contracts\Core\Repository\Values\User\Limitation as APILimitationValue; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\SubtreeLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\SubtreeLimitation as APISubtreeLimitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference as APIUserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -40,7 +41,7 @@ class SubtreeLimitationType extends AbstractPersistenceLimitationType implements * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitationValue */ - public function acceptValue(APILimitationValue $limitationValue) + public function acceptValue(APILimitationValue $limitationValue): void { if (!$limitationValue instanceof APISubtreeLimitation) { throw new InvalidArgumentType('$limitationValue', 'APISubtreeLimitation', $limitationValue); @@ -64,7 +65,7 @@ public function acceptValue(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(APILimitationValue $limitationValue) + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; foreach ($limitationValue->limitationValues as $key => $path) { @@ -108,7 +109,7 @@ public function validate(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation */ - public function buildValue(array $limitationValues) + public function buildValue(array $limitationValues): SubtreeLimitation { return new APISubtreeLimitation(['limitationValues' => $limitationValues]); } @@ -128,7 +129,7 @@ public function buildValue(array $limitationValues) * * @return bool */ - public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null) + public function evaluate(APILimitationValue $value, APIUserReference $currentUser, ValueObject $object, array $targets = null): ?bool { $targets = $targets ?? []; @@ -242,7 +243,7 @@ protected function evaluateForContentCreateStruct(APILimitationValue $value, arr * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface */ - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): PermissionSubtree { if (empty($value->limitationValues)) { // A Policy should not have empty limitationValues store diff --git a/src/lib/Limitation/UserGroupLimitationType.php b/src/lib/Limitation/UserGroupLimitationType.php index b00829620a..ab435f5b84 100644 --- a/src/lib/Limitation/UserGroupLimitationType.php +++ b/src/lib/Limitation/UserGroupLimitationType.php @@ -14,8 +14,10 @@ use Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\UserMetadata; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Contracts\Core\Repository\Values\User\Limitation as APILimitationValue; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\UserGroupLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\UserGroupLimitation as APIUserGroupLimitation; use Ibexa\Contracts\Core\Repository\Values\User\UserReference as APIUserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -38,7 +40,7 @@ class UserGroupLimitationType extends AbstractPersistenceLimitationType implemen * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitationValue */ - public function acceptValue(APILimitationValue $limitationValue) + public function acceptValue(APILimitationValue $limitationValue): void { if (!$limitationValue instanceof APIUserGroupLimitation) { throw new InvalidArgumentType('$limitationValue', 'APIUserGroupLimitation', $limitationValue); @@ -68,7 +70,7 @@ public function acceptValue(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\FieldType\ValidationError[] */ - public function validate(APILimitationValue $limitationValue) + public function validate(APILimitationValue $limitationValue): array { $validationErrors = []; foreach ($limitationValue->limitationValues as $key => $value) { @@ -94,7 +96,7 @@ public function validate(APILimitationValue $limitationValue) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation */ - public function buildValue(array $limitationValues) + public function buildValue(array $limitationValues): UserGroupLimitation { return new APIUserGroupLimitation(['limitationValues' => $limitationValues]); } @@ -177,7 +179,7 @@ public function evaluate(APILimitationValue $value, APIUserReference $currentUse * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface */ - public function getCriterion(APILimitationValue $value, APIUserReference $currentUser) + public function getCriterion(APILimitationValue $value, APIUserReference $currentUser): UserMetadata { if (empty($value->limitationValues)) { // A Policy should not have empty limitationValues stored @@ -204,8 +206,8 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren } } - return new Criterion\UserMetadata( - Criterion\UserMetadata::GROUP, + return new UserMetadata( + UserMetadata::GROUP, Criterion\Operator::IN, $groupIds ); @@ -217,7 +219,7 @@ public function getCriterion(APILimitationValue $value, APIUserReference $curren * @return mixed[]|int In case of array, a hash with key as valid limitations value and value as human readable name * of that option, in case of int on of VALUE_SCHEMA_ constants. */ - public function valueSchema() + public function valueSchema(): never { throw new NotImplementedException(__METHOD__); } diff --git a/src/lib/MVC/Exception/NoViewTemplateException.php b/src/lib/MVC/Exception/NoViewTemplateException.php index 62f99e6147..390908f8c4 100644 --- a/src/lib/MVC/Exception/NoViewTemplateException.php +++ b/src/lib/MVC/Exception/NoViewTemplateException.php @@ -15,8 +15,7 @@ */ class NoViewTemplateException extends Exception { - /** @var \Ibexa\Core\MVC\Symfony\View\View */ - private $view; + private View $view; public function __construct(View $view) { diff --git a/src/lib/MVC/RepositoryAware.php b/src/lib/MVC/RepositoryAware.php index a48d840963..7b7e4b5b4e 100644 --- a/src/lib/MVC/RepositoryAware.php +++ b/src/lib/MVC/RepositoryAware.php @@ -17,7 +17,7 @@ abstract class RepositoryAware implements RepositoryAwareInterface /** * @param \Ibexa\Contracts\Core\Repository\Repository $repository */ - public function setRepository(Repository $repository) + public function setRepository(Repository $repository): void { $this->repository = $repository; } diff --git a/src/lib/MVC/Symfony/Component/Serializer/AbstractPropertyWhitelistNormalizer.php b/src/lib/MVC/Symfony/Component/Serializer/AbstractPropertyWhitelistNormalizer.php index 8f89e3128e..f51ff6a96a 100644 --- a/src/lib/MVC/Symfony/Component/Serializer/AbstractPropertyWhitelistNormalizer.php +++ b/src/lib/MVC/Symfony/Component/Serializer/AbstractPropertyWhitelistNormalizer.php @@ -18,7 +18,7 @@ abstract class AbstractPropertyWhitelistNormalizer extends PropertyNormalizer * * @throws \Symfony\Component\Serializer\Exception\ExceptionInterface */ - public function normalize($object, string $format = null, array $context = []): array + public function normalize(mixed $object, string $format = null, array $context = []): array { $data = parent::normalize($object, $format, $context) ?? []; if (!is_array($data)) { diff --git a/src/lib/MVC/Symfony/Component/Serializer/CompoundMatcherNormalizer.php b/src/lib/MVC/Symfony/Component/Serializer/CompoundMatcherNormalizer.php index 157f7cdd00..faeac138a4 100644 --- a/src/lib/MVC/Symfony/Component/Serializer/CompoundMatcherNormalizer.php +++ b/src/lib/MVC/Symfony/Component/Serializer/CompoundMatcherNormalizer.php @@ -22,7 +22,7 @@ class CompoundMatcherNormalizer extends AbstractPropertyWhitelistNormalizer impl * * @see \Ibexa\Core\MVC\Symfony\SiteAccess\Matcher\Compound::__sleep */ - public function normalize($object, string $format = null, array $context = []): array + public function normalize(mixed $object, string $format = null, array $context = []): array { $data = parent::normalize($object, $format, $context); diff --git a/src/lib/MVC/Symfony/Controller/Content/DownloadController.php b/src/lib/MVC/Symfony/Controller/Content/DownloadController.php index 5916675c1e..8b8fd39539 100644 --- a/src/lib/MVC/Symfony/Controller/Content/DownloadController.php +++ b/src/lib/MVC/Symfony/Controller/Content/DownloadController.php @@ -21,14 +21,11 @@ class DownloadController extends Controller { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\Core\IO\IOServiceInterface */ - private $ioService; + private IOServiceInterface $ioService; - /** @var \Ibexa\Core\Helper\TranslationHelper */ - private $translationHelper; + private TranslationHelper $translationHelper; public function __construct(ContentService $contentService, IOServiceInterface $ioService, TranslationHelper $translationHelper) { diff --git a/src/lib/MVC/Symfony/Controller/Content/DownloadRedirectionController.php b/src/lib/MVC/Symfony/Controller/Content/DownloadRedirectionController.php index b212490190..bec575bfc1 100644 --- a/src/lib/MVC/Symfony/Controller/Content/DownloadRedirectionController.php +++ b/src/lib/MVC/Symfony/Controller/Content/DownloadRedirectionController.php @@ -20,14 +20,11 @@ class DownloadRedirectionController extends Controller { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Symfony\Component\Routing\RouterInterface */ - private $router; + private RouterInterface $router; - /** @var \Ibexa\Core\MVC\Symfony\Routing\Generator\RouteReferenceGenerator */ - private $routeReferenceGenerator; + private RouteReferenceGenerator $routeReferenceGenerator; public function __construct(ContentService $contentService, RouterInterface $router, RouteReferenceGenerator $routeReferenceGenerator) { @@ -47,7 +44,7 @@ public function __construct(ContentService $contentService, RouterInterface $rou * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ - public function redirectToContentDownloadAction($contentId, $fieldId, Request $request) + public function redirectToContentDownloadAction(int $contentId, $fieldId, Request $request): RedirectResponse { $content = $this->contentService->loadContent($contentId); $field = $this->findFieldInContent($fieldId, $content); diff --git a/src/lib/MVC/Symfony/Controller/Content/PreviewController.php b/src/lib/MVC/Symfony/Controller/Content/PreviewController.php index 5ce1da3e2a..2fb27cfc9c 100644 --- a/src/lib/MVC/Symfony/Controller/Content/PreviewController.php +++ b/src/lib/MVC/Symfony/Controller/Content/PreviewController.php @@ -40,26 +40,19 @@ class PreviewController public const PREVIEW_PARAMETER_NAME = 'isPreview'; public const CONTENT_VIEW_ROUTE = 'ibexa.content.view'; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - private $locationService; + private LocationService $locationService; - /** @var \Ibexa\Core\Helper\PreviewLocationProvider */ - private $locationProvider; + private PreviewLocationProvider $locationProvider; - /** @var \Symfony\Component\HttpKernel\HttpKernelInterface */ - private $kernel; + private HttpKernelInterface $kernel; - /** @var \Ibexa\Core\Helper\ContentPreviewHelper */ - private $previewHelper; + private ContentPreviewHelper $previewHelper; - /** @var \Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface */ - private $authorizationChecker; + private AuthorizationCheckerInterface $authorizationChecker; - /** @var \Ibexa\Core\MVC\Symfony\View\CustomLocationControllerChecker */ - private $controllerChecker; + private CustomLocationControllerChecker $controllerChecker; private bool $debugMode; diff --git a/src/lib/MVC/Symfony/Controller/Content/QueryController.php b/src/lib/MVC/Symfony/Controller/Content/QueryController.php index 35fdafd6bb..7af003c2d9 100644 --- a/src/lib/MVC/Symfony/Controller/Content/QueryController.php +++ b/src/lib/MVC/Symfony/Controller/Content/QueryController.php @@ -25,11 +25,9 @@ */ class QueryController { - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ - private $searchService; + private SearchService $searchService; - /** @var \Ibexa\Core\QueryType\ContentViewQueryTypeMapper */ - private $contentViewQueryTypeMapper; + private ContentViewQueryTypeMapper $contentViewQueryTypeMapper; public function __construct( ContentViewQueryTypeMapper $contentViewQueryTypeMapper, @@ -46,7 +44,7 @@ public function __construct( * * @return \Ibexa\Core\MVC\Symfony\View\ContentView */ - public function contentQueryAction(ContentView $view) + public function contentQueryAction(ContentView $view): ContentView { $this->runQuery($view, 'findContent'); @@ -60,7 +58,7 @@ public function contentQueryAction(ContentView $view) * * @return \Ibexa\Core\MVC\Symfony\View\ContentView */ - public function locationQueryAction(ContentView $view) + public function locationQueryAction(ContentView $view): ContentView { $this->runQuery($view, 'findLocations'); @@ -74,7 +72,7 @@ public function locationQueryAction(ContentView $view) * * @return \Ibexa\Core\MVC\Symfony\View\ContentView */ - public function contentInfoQueryAction(ContentView $view) + public function contentInfoQueryAction(ContentView $view): ContentView { $this->runQuery($view, 'findContentInfo'); @@ -87,7 +85,7 @@ public function contentInfoQueryAction(ContentView $view) * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view * @param string $method Name of the SearchService method to run. */ - private function runQuery(ContentView $view, $method) + private function runQuery(ContentView $view, string $method): void { $searchResults = $this->searchService->$method( $this->contentViewQueryTypeMapper->map($view) @@ -101,7 +99,7 @@ private function runQuery(ContentView $view, $method) * * @return \Ibexa\Core\MVC\Symfony\View\ContentView */ - public function pagingQueryAction(ContentView $view, Request $request) + public function pagingQueryAction(ContentView $view, Request $request): ContentView { $this->runPagingQuery($view, $request); @@ -112,7 +110,7 @@ public function pagingQueryAction(ContentView $view, Request $request) * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view * @param \Symfony\Component\HttpFoundation\Request $request */ - private function runPagingQuery(ContentView $view, Request $request) + private function runPagingQuery(ContentView $view, Request $request): void { $queryParameters = $view->getParameter('query'); diff --git a/src/lib/MVC/Symfony/Controller/Content/ViewController.php b/src/lib/MVC/Symfony/Controller/Content/ViewController.php index 73feb0c081..4bccbd81d1 100644 --- a/src/lib/MVC/Symfony/Controller/Content/ViewController.php +++ b/src/lib/MVC/Symfony/Controller/Content/ViewController.php @@ -28,11 +28,9 @@ */ class ViewController extends Controller { - /** @var \Ibexa\Core\MVC\Symfony\View\ViewManagerInterface */ - protected $viewManager; + protected ViewManagerInterface $viewManager; - /** @var \Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface */ - private $authorizationChecker; + private AuthorizationCheckerInterface $authorizationChecker; public function __construct(ViewManagerInterface $viewManager, AuthorizationCheckerInterface $authorizationChecker) { @@ -56,7 +54,7 @@ public function __construct(ViewManagerInterface $viewManager, AuthorizationChec * * @return \Ibexa\Core\MVC\Symfony\View\ContentView */ - public function viewAction(ContentView $view) + public function viewAction(ContentView $view): ContentView { return $view; } @@ -69,7 +67,7 @@ public function viewAction(ContentView $view) * * @return \Ibexa\Core\MVC\Symfony\View\ContentView */ - public function embedAction(ContentView $view) + public function embedAction(ContentView $view): ContentView { return $view; } @@ -82,7 +80,7 @@ public function embedAction(ContentView $view) * * @return \Symfony\Component\HttpFoundation\Response */ - protected function buildResponse($etag = null, DateTime $lastModified = null) + protected function buildResponse($etag = null, DateTime $lastModified = null): Response { $request = $this->getRequest(); $response = new Response(); @@ -113,7 +111,7 @@ protected function buildResponse($etag = null, DateTime $lastModified = null) return $response; } - protected function handleViewException(Response $response, $params, Exception $e, $viewType, $contentId = null, $locationId = null) + protected function handleViewException(Response $response, array $params, Exception $e, $viewType, $contentId = null, $locationId = null): Response { $event = new APIContentExceptionEvent( $e, diff --git a/src/lib/MVC/Symfony/Controller/Controller.php b/src/lib/MVC/Symfony/Controller/Controller.php index a301cc1548..cbfca30699 100644 --- a/src/lib/MVC/Symfony/Controller/Controller.php +++ b/src/lib/MVC/Symfony/Controller/Controller.php @@ -12,6 +12,7 @@ use Symfony\Component\DependencyInjection\ContainerAwareTrait; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Templating\TemplateReferenceInterface; abstract class Controller implements ContainerAwareInterface { @@ -41,7 +42,7 @@ public function getParameter($parameterName, $defaultValue = null) * * @return bool */ - public function hasParameter($parameterName) + public function hasParameter(string $parameterName) { return $this->getConfigResolver()->hasParameter($parameterName); } @@ -63,7 +64,7 @@ public function getConfigResolver() * * @return \Symfony\Component\HttpFoundation\Response */ - public function render($view, array $parameters = [], Response $response = null) + public function render(string|TemplateReferenceInterface $view, array $parameters = [], Response $response = null) { if (!isset($response)) { $response = new Response(); diff --git a/src/lib/MVC/Symfony/Controller/SecurityController.php b/src/lib/MVC/Symfony/Controller/SecurityController.php index f1143e693b..27907b01be 100644 --- a/src/lib/MVC/Symfony/Controller/SecurityController.php +++ b/src/lib/MVC/Symfony/Controller/SecurityController.php @@ -14,14 +14,11 @@ class SecurityController { - /** @var \Twig\Environment */ - protected $templateEngine; + protected Environment $templateEngine; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - protected $configResolver; + protected ConfigResolverInterface $configResolver; - /** @var \Symfony\Component\Security\Http\Authentication\AuthenticationUtils */ - protected $authenticationUtils; + protected AuthenticationUtils $authenticationUtils; public function __construct(Environment $templateEngine, ConfigResolverInterface $configResolver, AuthenticationUtils $authenticationUtils) { @@ -30,7 +27,7 @@ public function __construct(Environment $templateEngine, ConfigResolverInterface $this->authenticationUtils = $authenticationUtils; } - public function loginAction() + public function loginAction(): LoginFormView { $view = new LoginFormView($this->configResolver->getParameter('security.login_template')); $view->setLastUsername($this->authenticationUtils->getLastUsername()); diff --git a/src/lib/MVC/Symfony/Event/APIContentExceptionEvent.php b/src/lib/MVC/Symfony/Event/APIContentExceptionEvent.php index ff194fe641..5757f58164 100644 --- a/src/lib/MVC/Symfony/Event/APIContentExceptionEvent.php +++ b/src/lib/MVC/Symfony/Event/APIContentExceptionEvent.php @@ -17,14 +17,11 @@ */ class APIContentExceptionEvent extends Event { - /** @var \Exception */ - private $apiException; + private Exception $apiException; - /** @var \Ibexa\Core\MVC\Symfony\View\View */ - private $contentView; + private ?View $contentView = null; - /** @var array */ - private $contentMeta; + private array $contentMeta; public function __construct(Exception $apiException, array $contentMeta) { @@ -46,7 +43,7 @@ public function getApiException() * * @param \Ibexa\Core\MVC\Symfony\View\View $contentView */ - public function setContentView(View $contentView) + public function setContentView(View $contentView): void { $this->contentView = $contentView; } diff --git a/src/lib/MVC/Symfony/Event/PostSiteAccessMatchEvent.php b/src/lib/MVC/Symfony/Event/PostSiteAccessMatchEvent.php index c59c9dae1c..0e0bb42498 100644 --- a/src/lib/MVC/Symfony/Event/PostSiteAccessMatchEvent.php +++ b/src/lib/MVC/Symfony/Event/PostSiteAccessMatchEvent.php @@ -16,11 +16,9 @@ */ class PostSiteAccessMatchEvent extends Event { - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ - private $siteAccess; + private SiteAccess $siteAccess; - /** @var \Symfony\Component\HttpFoundation\Request */ - private $request; + private Request $request; /** * The request type the kernel is currently processing. One of diff --git a/src/lib/MVC/Symfony/Event/PreContentViewEvent.php b/src/lib/MVC/Symfony/Event/PreContentViewEvent.php index 2f3382200f..b830bf66c0 100644 --- a/src/lib/MVC/Symfony/Event/PreContentViewEvent.php +++ b/src/lib/MVC/Symfony/Event/PreContentViewEvent.php @@ -35,8 +35,7 @@ */ class PreContentViewEvent extends Event { - /** @var \Ibexa\Core\MVC\Symfony\View\View */ - private $contentView; + private View $contentView; public function __construct(View $contentView) { diff --git a/src/lib/MVC/Symfony/Event/ResolveRenderOptionsEvent.php b/src/lib/MVC/Symfony/Event/ResolveRenderOptionsEvent.php index 4b28bbd7a5..f85bda6bc3 100644 --- a/src/lib/MVC/Symfony/Event/ResolveRenderOptionsEvent.php +++ b/src/lib/MVC/Symfony/Event/ResolveRenderOptionsEvent.php @@ -13,8 +13,7 @@ final class ResolveRenderOptionsEvent extends Event { - /** @var \Ibexa\Core\MVC\Symfony\Templating\RenderOptions */ - private $renderOptions; + private RenderOptions $renderOptions; public function __construct( RenderOptions $renderOptions diff --git a/src/lib/MVC/Symfony/Event/RouteReferenceGenerationEvent.php b/src/lib/MVC/Symfony/Event/RouteReferenceGenerationEvent.php index 09c8dd890e..2b1e33b9c7 100644 --- a/src/lib/MVC/Symfony/Event/RouteReferenceGenerationEvent.php +++ b/src/lib/MVC/Symfony/Event/RouteReferenceGenerationEvent.php @@ -16,11 +16,9 @@ */ class RouteReferenceGenerationEvent extends Event { - /** @var \Ibexa\Core\MVC\Symfony\Routing\RouteReference */ - private $routeReference; + private RouteReference $routeReference; - /** @var \Symfony\Component\HttpFoundation\Request */ - private $request; + private Request $request; public function __construct(RouteReference $routeReference, Request $request) { @@ -47,7 +45,7 @@ public function getRouteReference() /** * @param \Ibexa\Core\MVC\Symfony\Routing\RouteReference $routeReference */ - public function setRouteReference($routeReference) + public function setRouteReference($routeReference): void { $this->routeReference = $routeReference; } diff --git a/src/lib/MVC/Symfony/Event/ScopeChangeEvent.php b/src/lib/MVC/Symfony/Event/ScopeChangeEvent.php index c9bdd14e13..253b2321c0 100644 --- a/src/lib/MVC/Symfony/Event/ScopeChangeEvent.php +++ b/src/lib/MVC/Symfony/Event/ScopeChangeEvent.php @@ -15,8 +15,7 @@ */ class ScopeChangeEvent extends Event { - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ - private $siteAccess; + private SiteAccess $siteAccess; public function __construct(SiteAccess $siteAccess) { diff --git a/src/lib/MVC/Symfony/EventListener/ContentViewTwigVariablesSubscriber.php b/src/lib/MVC/Symfony/EventListener/ContentViewTwigVariablesSubscriber.php index e1d2b1bcff..95fb474d51 100644 --- a/src/lib/MVC/Symfony/EventListener/ContentViewTwigVariablesSubscriber.php +++ b/src/lib/MVC/Symfony/EventListener/ContentViewTwigVariablesSubscriber.php @@ -23,14 +23,11 @@ final class ContentViewTwigVariablesSubscriber implements EventSubscriberInterfa public const PARAMETERS_KEY = 'params'; - /** @var \Ibexa\Core\MVC\Symfony\View\VariableProviderRegistry */ - private $parameterProviderRegistry; + private VariableProviderRegistry $parameterProviderRegistry; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; - /** @var \Symfony\Component\ExpressionLanguage\ExpressionLanguage */ - private $expressionLanguage; + private ExpressionLanguage $expressionLanguage; public function __construct( VariableProviderRegistry $parameterProviderRegistry, diff --git a/src/lib/MVC/Symfony/EventListener/LanguageSwitchListener.php b/src/lib/MVC/Symfony/EventListener/LanguageSwitchListener.php index 3b15bd2d8d..de6bcace42 100644 --- a/src/lib/MVC/Symfony/EventListener/LanguageSwitchListener.php +++ b/src/lib/MVC/Symfony/EventListener/LanguageSwitchListener.php @@ -18,8 +18,7 @@ */ class LanguageSwitchListener implements EventSubscriberInterface { - /** @var \Ibexa\Core\Helper\TranslationHelper */ - private $translationHelper; + private TranslationHelper $translationHelper; public function __construct(TranslationHelper $translationHelper) { @@ -43,7 +42,7 @@ public static function getSubscribedEvents(): array * * @param \Ibexa\Core\MVC\Symfony\Event\RouteReferenceGenerationEvent $event */ - public function onRouteReferenceGeneration(RouteReferenceGenerationEvent $event) + public function onRouteReferenceGeneration(RouteReferenceGenerationEvent $event): void { $routeReference = $event->getRouteReference(); if (!$routeReference->has('language')) { diff --git a/src/lib/MVC/Symfony/FieldType/BinaryBase/ContentDownloadUrlGenerator.php b/src/lib/MVC/Symfony/FieldType/BinaryBase/ContentDownloadUrlGenerator.php index e067fb62b2..2a07e80b13 100644 --- a/src/lib/MVC/Symfony/FieldType/BinaryBase/ContentDownloadUrlGenerator.php +++ b/src/lib/MVC/Symfony/FieldType/BinaryBase/ContentDownloadUrlGenerator.php @@ -14,11 +14,9 @@ class ContentDownloadUrlGenerator implements RouteAwarePathGenerator { - /** @var \Symfony\Component\Routing\RouterInterface */ - private $router; + private RouterInterface $router; - /** @var string */ - private $route = 'ibexa.content.download.field_id'; + private string $route = 'ibexa.content.download.field_id'; public function __construct(RouterInterface $router) { diff --git a/src/lib/MVC/Symfony/FieldType/ImageAsset/ParameterProvider.php b/src/lib/MVC/Symfony/FieldType/ImageAsset/ParameterProvider.php index 6ec28ddfda..8626d9bc31 100644 --- a/src/lib/MVC/Symfony/FieldType/ImageAsset/ParameterProvider.php +++ b/src/lib/MVC/Symfony/FieldType/ImageAsset/ParameterProvider.php @@ -9,6 +9,8 @@ namespace Ibexa\Core\MVC\Symfony\FieldType\ImageAsset; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\FieldTypeService; +use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Field; @@ -16,14 +18,12 @@ class ParameterProvider implements ParameterProviderInterface { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - private $repository; + private Repository $repository; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionsResolver; + private PermissionResolver $permissionsResolver; /** @var \Ibexa\Core\Repository\FieldTypeService */ - private $fieldTypeService; + private FieldTypeService $fieldTypeService; /** * @param \Ibexa\Contracts\Core\Repository\Repository $repository @@ -73,7 +73,7 @@ public function getViewParameters(Field $field): array private function loadContentInfo(int $id): ContentInfo { return $this->repository->sudo( - static function (Repository $repository) use ($id) { + static function (Repository $repository) use ($id): \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo { return $repository->getContentService()->loadContentInfo($id); } ); diff --git a/src/lib/MVC/Symfony/FieldType/Relation/ParameterProvider.php b/src/lib/MVC/Symfony/FieldType/Relation/ParameterProvider.php index 8115ed1125..61909026e1 100644 --- a/src/lib/MVC/Symfony/FieldType/Relation/ParameterProvider.php +++ b/src/lib/MVC/Symfony/FieldType/Relation/ParameterProvider.php @@ -15,8 +15,7 @@ class ParameterProvider implements ParameterProviderInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; /** * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService diff --git a/src/lib/MVC/Symfony/FieldType/RelationList/ParameterProvider.php b/src/lib/MVC/Symfony/FieldType/RelationList/ParameterProvider.php index 8217406ded..a54e880b4b 100644 --- a/src/lib/MVC/Symfony/FieldType/RelationList/ParameterProvider.php +++ b/src/lib/MVC/Symfony/FieldType/RelationList/ParameterProvider.php @@ -13,8 +13,7 @@ class ParameterProvider implements ParameterProviderInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; /** * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService @@ -35,7 +34,7 @@ public function __construct(ContentService $contentService) * * @return array */ - public function getViewParameters(Field $field) + public function getViewParameters(Field $field): array { $ids = $field->value->destinationContentIds; $list = $this->contentService->loadContentInfoList($ids); diff --git a/src/lib/MVC/Symfony/FieldType/User/ParameterProvider.php b/src/lib/MVC/Symfony/FieldType/User/ParameterProvider.php index f6b23a38b9..7c2a0dc9f0 100644 --- a/src/lib/MVC/Symfony/FieldType/User/ParameterProvider.php +++ b/src/lib/MVC/Symfony/FieldType/User/ParameterProvider.php @@ -15,8 +15,7 @@ class ParameterProvider implements ParameterProviderInterface { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ - private $userService; + private UserService $userService; public function __construct(UserService $userService) { diff --git a/src/lib/MVC/Symfony/FieldType/View/ParameterProvider/LocaleParameterProvider.php b/src/lib/MVC/Symfony/FieldType/View/ParameterProvider/LocaleParameterProvider.php index 2cb621b511..6ee28420ef 100644 --- a/src/lib/MVC/Symfony/FieldType/View/ParameterProvider/LocaleParameterProvider.php +++ b/src/lib/MVC/Symfony/FieldType/View/ParameterProvider/LocaleParameterProvider.php @@ -20,8 +20,7 @@ class LocaleParameterProvider implements ParameterProviderInterface { use RequestStackAware; - /** @var \Ibexa\Core\MVC\Symfony\Locale\LocaleConverterInterface */ - protected $localeConverter; + protected LocaleConverterInterface $localeConverter; public function __construct(LocaleConverterInterface $localeConverter) { @@ -38,7 +37,7 @@ public function __construct(LocaleConverterInterface $localeConverter) * * @return array */ - public function getViewParameters(Field $field) + public function getViewParameters(Field $field): array { $parameters = []; diff --git a/src/lib/MVC/Symfony/FieldType/View/ParameterProviderRegistry.php b/src/lib/MVC/Symfony/FieldType/View/ParameterProviderRegistry.php index 32ddd5f3a7..3fd033d082 100644 --- a/src/lib/MVC/Symfony/FieldType/View/ParameterProviderRegistry.php +++ b/src/lib/MVC/Symfony/FieldType/View/ParameterProviderRegistry.php @@ -49,7 +49,7 @@ public function getParameterProvider($fieldTypeIdentifier) * @param \Ibexa\Core\MVC\Symfony\FieldType\View\ParameterProviderInterface $parameterProvider * @param string $fieldTypeIdentifier */ - public function setParameterProvider(ParameterProviderInterface $parameterProvider, $fieldTypeIdentifier) + public function setParameterProvider(ParameterProviderInterface $parameterProvider, $fieldTypeIdentifier): void { $this->providers[$fieldTypeIdentifier] = $parameterProvider; } diff --git a/src/lib/MVC/Symfony/Locale/LocaleConverter.php b/src/lib/MVC/Symfony/Locale/LocaleConverter.php index 010478b89a..4a160406df 100644 --- a/src/lib/MVC/Symfony/Locale/LocaleConverter.php +++ b/src/lib/MVC/Symfony/Locale/LocaleConverter.php @@ -14,20 +14,15 @@ class LocaleConverter implements LocaleConverterInterface /** * Conversion map, indexed by Ibexa locale. * See locale.yml. - * - * @var array */ - private $conversionMap; + private array $conversionMap; /** * Conversion map, indexed by POSIX locale. - * - * @var array */ - private $reverseConversionMap; + private array $reverseConversionMap; - /** @var \Psr\Log\LoggerInterface */ - private $logger; + private LoggerInterface $logger; public function __construct(array $conversionMap, LoggerInterface $logger) { diff --git a/src/lib/MVC/Symfony/Locale/UserLanguagePreferenceProvider.php b/src/lib/MVC/Symfony/Locale/UserLanguagePreferenceProvider.php index bc25aa132b..68da6001e7 100644 --- a/src/lib/MVC/Symfony/Locale/UserLanguagePreferenceProvider.php +++ b/src/lib/MVC/Symfony/Locale/UserLanguagePreferenceProvider.php @@ -15,17 +15,13 @@ class UserLanguagePreferenceProvider implements UserLanguagePreferenceProviderInterface { - /** @var \Symfony\Component\HttpFoundation\RequestStack */ - private $requestStack; + private RequestStack $requestStack; - /** @var \Ibexa\Contracts\Core\Repository\UserPreferenceService */ - private $userPreferenceService; + private UserPreferenceService $userPreferenceService; - /** @var array */ - private $languageCodesMap; + private array $languageCodesMap; - /** @var string */ - private $localeFallback; + private string $localeFallback; /** * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack diff --git a/src/lib/MVC/Symfony/Matcher/ClassNameMatcherFactory.php b/src/lib/MVC/Symfony/Matcher/ClassNameMatcherFactory.php index 5402ffcc09..796d6c6225 100644 --- a/src/lib/MVC/Symfony/Matcher/ClassNameMatcherFactory.php +++ b/src/lib/MVC/Symfony/Matcher/ClassNameMatcherFactory.php @@ -21,16 +21,13 @@ */ class ClassNameMatcherFactory implements ConfigurableMatcherFactoryInterface { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; /** * The view configuration this matcher should use for matching. * Typically, one of the *_view siteaccess aware settings array. - * - * @var array */ - protected $matchConfig; + protected array $matchConfig; /** @var \Ibexa\Core\MVC\Symfony\Matcher\ViewMatcherInterface[] */ protected $matchers = []; diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Depth.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Depth.php index 4703c40269..dbd08e0b18 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Depth.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Depth.php @@ -38,7 +38,7 @@ public function matchLocation(Location $location): bool public function matchContentInfo(ContentInfo $contentInfo): bool { $location = $this->repository->sudo( - static function (Repository $repository) use ($contentInfo) { + static function (Repository $repository) use ($contentInfo): \Ibexa\Contracts\Core\Repository\Values\Content\Location { return $repository->getLocationService()->loadLocation($contentInfo->mainLocationId); } ); diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTypeGroup.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTypeGroup.php index 3b4216778d..edcad3bd74 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTypeGroup.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTypeGroup.php @@ -22,7 +22,7 @@ class ContentTypeGroup extends MultipleValued * * @return bool */ - public function matchLocation(APILocation $location) + public function matchLocation(APILocation $location): bool { return $this->matchContentTypeId($location->getContentInfo()->contentTypeId); } @@ -34,7 +34,7 @@ public function matchLocation(APILocation $location) * * @return bool */ - public function matchContentInfo(ContentInfo $contentInfo) + public function matchContentInfo(ContentInfo $contentInfo): bool { return $this->matchContentTypeId($contentInfo->contentTypeId); } @@ -51,7 +51,7 @@ public function match(View $view) /** * @return bool */ - private function matchContentTypeId($contentTypeId): bool + private function matchContentTypeId(int $contentTypeId): bool { $contentTypeGroups = $this->repository ->getContentTypeService() diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentContentType.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentContentType.php index 1843af3e82..c8cc3e0419 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentContentType.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentContentType.php @@ -26,7 +26,7 @@ class ParentContentType extends MultipleValued public function matchLocation(APILocation $location): bool { $parent = $this->repository->sudo( - static function (Repository $repository) use ($location) { + static function (Repository $repository) use ($location): \Ibexa\Contracts\Core\Repository\Values\Content\Location { return $repository->getLocationService()->loadLocation($location->parentLocationId); } ); @@ -41,10 +41,10 @@ static function (Repository $repository) use ($location) { * * @return bool */ - public function matchContentInfo(ContentInfo $contentInfo) + public function matchContentInfo(ContentInfo $contentInfo): bool { $location = $this->repository->sudo( - static function (Repository $repository) use ($contentInfo) { + static function (Repository $repository) use ($contentInfo): \Ibexa\Contracts\Core\Repository\Values\Content\Location { return $repository->getLocationService()->loadLocation($contentInfo->mainLocationId); } ); @@ -67,10 +67,10 @@ public function match(View $view): bool /** * @return Location */ - private function loadParentLocation($locationId) + private function loadParentLocation(int $locationId) { return $this->repository->sudo( - static function (Repository $repository) use ($locationId) { + static function (Repository $repository) use ($locationId): \Ibexa\Contracts\Core\Repository\Values\Content\Location { return $repository->getLocationService()->loadLocation($locationId); } ); diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentLocation.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentLocation.php index ff3ab61ae3..356e62ba20 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentLocation.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentLocation.php @@ -38,7 +38,7 @@ public function matchLocation(APILocation $location): bool public function matchContentInfo(ContentInfo $contentInfo): bool { $location = $this->repository->sudo( - static function (Repository $repository) use ($contentInfo) { + static function (Repository $repository) use ($contentInfo): \Ibexa\Contracts\Core\Repository\Values\Content\Location { return $repository->getLocationService()->loadLocation($contentInfo->mainLocationId); } ); diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ParentContentType.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ParentContentType.php index b52ec15ee5..d1e650b8c7 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ParentContentType.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ParentContentType.php @@ -27,7 +27,7 @@ class ParentContentType extends MultipleValued public function matchLocation(APILocation $location): bool { $parentContentType = $this->repository->sudo( - static function (Repository $repository) use ($location) { + static function (Repository $repository) use ($location): \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType { $parent = $repository->getLocationService()->loadLocation($location->parentLocationId); return $repository @@ -46,10 +46,10 @@ static function (Repository $repository) use ($location) { * * @return bool */ - public function matchContentInfo(ContentInfo $contentInfo) + public function matchContentInfo(ContentInfo $contentInfo): bool { $location = $this->repository->sudo( - static function (Repository $repository) use ($contentInfo) { + static function (Repository $repository) use ($contentInfo): \Ibexa\Contracts\Core\Repository\Values\Content\Location { return $repository->getLocationService()->loadLocation($contentInfo->mainLocationId); } ); diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/Section.php b/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/Section.php index 89f5360ecd..ce4b65b587 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/Section.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/Identifier/Section.php @@ -26,7 +26,7 @@ class Section extends MultipleValued public function matchLocation(Location $location): bool { $section = $this->repository->sudo( - static function (Repository $repository) use ($location) { + static function (Repository $repository) use ($location): \Ibexa\Contracts\Core\Repository\Values\Content\Section { return $repository->getSectionService()->loadSection( $location->getContentInfo()->getSectionId() ); @@ -46,7 +46,7 @@ static function (Repository $repository) use ($location) { public function matchContentInfo(ContentInfo $contentInfo): bool { $section = $this->repository->sudo( - static function (Repository $repository) use ($contentInfo) { + static function (Repository $repository) use ($contentInfo): \Ibexa\Contracts\Core\Repository\Values\Content\Section { return $repository->getSectionService()->loadSection( $contentInfo->getSectionId() ); @@ -64,7 +64,7 @@ public function match(View $view): bool $contentInfo = $view->getContent()->contentInfo; $section = $this->repository->sudo( - static function (Repository $repository) use ($contentInfo) { + static function (Repository $repository) use ($contentInfo): \Ibexa\Contracts\Core\Repository\Values\Content\Section { return $repository->getSectionService()->loadSection( $contentInfo->getSectionId() ); diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/MultipleValued.php b/src/lib/MVC/Symfony/Matcher/ContentBased/MultipleValued.php index e09fbeb10c..4f685cc35b 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/MultipleValued.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/MultipleValued.php @@ -25,7 +25,7 @@ abstract class MultipleValued extends RepositoryAware implements MatcherInterfac * * @throws \InvalidArgumentException Should be thrown if $matchingConfig is not valid. */ - public function setMatchingConfig($matchingConfig) + public function setMatchingConfig($matchingConfig): void { $matchingConfig = !is_array($matchingConfig) ? [$matchingConfig] : $matchingConfig; $this->values = array_fill_keys($matchingConfig, true); diff --git a/src/lib/MVC/Symfony/Matcher/ContentBased/UrlAlias.php b/src/lib/MVC/Symfony/Matcher/ContentBased/UrlAlias.php index 906debd877..6d40525bca 100644 --- a/src/lib/MVC/Symfony/Matcher/ContentBased/UrlAlias.php +++ b/src/lib/MVC/Symfony/Matcher/ContentBased/UrlAlias.php @@ -49,12 +49,12 @@ public function matchLocation(Location $location): bool * * @return bool */ - public function matchContentInfo(ContentInfo $contentInfo) + public function matchContentInfo(ContentInfo $contentInfo): never { throw new \RuntimeException('matchContentInfo() is not supported by the UrlAlias matcher'); } - public function setMatchingConfig($matchingConfig) + public function setMatchingConfig($matchingConfig): void { if (!is_array($matchingConfig)) { $matchingConfig = [$matchingConfig]; @@ -62,7 +62,7 @@ public function setMatchingConfig($matchingConfig) array_walk( $matchingConfig, - static function (&$item) { + static function (&$item): void { $item = trim($item, '/ '); } ); diff --git a/src/lib/MVC/Symfony/Matcher/DynamicallyConfiguredMatcherFactoryDecorator.php b/src/lib/MVC/Symfony/Matcher/DynamicallyConfiguredMatcherFactoryDecorator.php index 93a2f92b6e..0d794cf587 100644 --- a/src/lib/MVC/Symfony/Matcher/DynamicallyConfiguredMatcherFactoryDecorator.php +++ b/src/lib/MVC/Symfony/Matcher/DynamicallyConfiguredMatcherFactoryDecorator.php @@ -15,20 +15,15 @@ */ class DynamicallyConfiguredMatcherFactoryDecorator implements MatcherFactoryInterface { - /** @var \Ibexa\Core\MVC\Symfony\Matcher\MatcherFactoryInterface|\Ibexa\Core\MVC\Symfony\Matcher\ConfigurableMatcherFactoryInterface */ - private $innerConfigurableMatcherFactory; + private MatcherFactoryInterface $innerConfigurableMatcherFactory; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; - /** @var string */ - private $parameterName; + private string $parameterName; - /** @var string|null */ - private $namespace; + private ?string $namespace; - /** @var string|null */ - private $scope; + private ?string $scope; public function __construct( MatcherFactoryInterface $innerConfigurableMatcherFactory, diff --git a/src/lib/MVC/Symfony/RequestStackAware.php b/src/lib/MVC/Symfony/RequestStackAware.php index f01126caaf..68027a7374 100644 --- a/src/lib/MVC/Symfony/RequestStackAware.php +++ b/src/lib/MVC/Symfony/RequestStackAware.php @@ -29,7 +29,7 @@ public function getRequestStack() /** * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack */ - public function setRequestStack(RequestStack $requestStack) + public function setRequestStack(RequestStack $requestStack): void { $this->requestStack = $requestStack; } diff --git a/src/lib/MVC/Symfony/Routing/Generator/RouteReferenceGenerator.php b/src/lib/MVC/Symfony/Routing/Generator/RouteReferenceGenerator.php index d5de9b41e3..596409c977 100644 --- a/src/lib/MVC/Symfony/Routing/Generator/RouteReferenceGenerator.php +++ b/src/lib/MVC/Symfony/Routing/Generator/RouteReferenceGenerator.php @@ -18,8 +18,7 @@ class RouteReferenceGenerator implements RouteReferenceGeneratorInterface { use RequestStackAware; - /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ - private $dispatcher; + private EventDispatcherInterface $dispatcher; public function __construct(EventDispatcherInterface $dispatcher) { diff --git a/src/lib/MVC/Symfony/Routing/RouteReference.php b/src/lib/MVC/Symfony/Routing/RouteReference.php index 1441d166b6..7cfc8ba380 100644 --- a/src/lib/MVC/Symfony/Routing/RouteReference.php +++ b/src/lib/MVC/Symfony/Routing/RouteReference.php @@ -11,8 +11,7 @@ class RouteReference { - /** @var \Symfony\Component\HttpFoundation\ParameterBag */ - private $params; + private ParameterBag $params; /** @var mixed Route name or resource (e.g. Location object). */ private $route; @@ -26,7 +25,7 @@ public function __construct($route, array $params = []) /** * @param mixed $route */ - public function setRoute($route) + public function setRoute($route): void { $this->route = $route; } @@ -42,7 +41,7 @@ public function getRoute() /** * @return array */ - public function getParams() + public function getParams(): array { return $this->params->all(); } @@ -53,7 +52,7 @@ public function getParams() * @param string $parameterName * @param mixed $value */ - public function set($parameterName, $value) + public function set(string $parameterName, $value): void { $this->params->set($parameterName, $value); } @@ -67,12 +66,12 @@ public function set($parameterName, $value) * * @return mixed */ - public function get($parameterName, $defaultValue = null, $deep = false) + public function get(string $parameterName, $defaultValue = null, $deep = false): mixed { return $this->params->get($parameterName, $defaultValue, $deep); } - public function has($parameterName) + public function has(string $parameterName): bool { return $this->params->has($parameterName); } @@ -82,7 +81,7 @@ public function has($parameterName) * * @param string $parameterName */ - public function remove($parameterName) + public function remove(string $parameterName): void { $this->params->remove($parameterName); } diff --git a/src/lib/MVC/Symfony/Routing/SimplifiedRequest.php b/src/lib/MVC/Symfony/Routing/SimplifiedRequest.php index ee1dfb539f..bf50b0078c 100644 --- a/src/lib/MVC/Symfony/Routing/SimplifiedRequest.php +++ b/src/lib/MVC/Symfony/Routing/SimplifiedRequest.php @@ -86,7 +86,7 @@ public function __construct( /** * @param array $headers */ - public function setHeaders(array $headers) + public function setHeaders(array $headers): void { $this->headers = $headers; } @@ -94,7 +94,7 @@ public function setHeaders(array $headers) /** * @param string $host */ - public function setHost($host) + public function setHost(?string $host): void { $this->host = $host; } @@ -102,7 +102,7 @@ public function setHost($host) /** * @param array $languages */ - public function setLanguages(array $languages) + public function setLanguages(array $languages): void { $this->languages = $languages; } @@ -110,7 +110,7 @@ public function setLanguages(array $languages) /** * @param string $pathinfo */ - public function setPathinfo($pathinfo) + public function setPathinfo(?string $pathinfo): void { $this->pathinfo = $pathinfo; } @@ -118,7 +118,7 @@ public function setPathinfo($pathinfo) /** * @param int $port */ - public function setPort($port) + public function setPort(?int $port): void { $this->port = $port; } @@ -126,7 +126,7 @@ public function setPort($port) /** * @param array $queryParams */ - public function setQueryParams(array $queryParams) + public function setQueryParams(array $queryParams): void { $this->queryParams = $queryParams; } @@ -134,7 +134,7 @@ public function setQueryParams(array $queryParams) /** * @param string $scheme */ - public function setScheme($scheme) + public function setScheme(?string $scheme): void { $this->scheme = $scheme; } @@ -148,7 +148,7 @@ public function setScheme($scheme) * * @return \Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest */ - public static function fromUrl($url) + public static function fromUrl($url): static { $elements = parse_url($url); $elements['pathinfo'] = isset($elements['path']) ? $elements['path'] : ''; diff --git a/src/lib/MVC/Symfony/Security/Authorization/Attribute.php b/src/lib/MVC/Symfony/Security/Authorization/Attribute.php index 4eda3f9ada..d2a1c7053e 100644 --- a/src/lib/MVC/Symfony/Security/Authorization/Attribute.php +++ b/src/lib/MVC/Symfony/Security/Authorization/Attribute.php @@ -51,7 +51,7 @@ public function __construct($module = null, $function = null, array $limitations * * @return string */ - public function __toString() + public function __toString(): string { return "EZ_ROLE_{$this->module}_{$this->function}"; } diff --git a/src/lib/MVC/Symfony/Security/Authorization/Voter/CoreVoter.php b/src/lib/MVC/Symfony/Security/Authorization/Voter/CoreVoter.php index 8a58d7ef21..01c091a0af 100644 --- a/src/lib/MVC/Symfony/Security/Authorization/Voter/CoreVoter.php +++ b/src/lib/MVC/Symfony/Security/Authorization/Voter/CoreVoter.php @@ -14,8 +14,7 @@ class CoreVoter implements VoterInterface { - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; public function __construct(PermissionResolver $permissionResolver) { diff --git a/src/lib/MVC/Symfony/Security/Authorization/Voter/ValueObjectVoter.php b/src/lib/MVC/Symfony/Security/Authorization/Voter/ValueObjectVoter.php index 422308faff..9193d351e3 100644 --- a/src/lib/MVC/Symfony/Security/Authorization/Voter/ValueObjectVoter.php +++ b/src/lib/MVC/Symfony/Security/Authorization/Voter/ValueObjectVoter.php @@ -17,8 +17,7 @@ */ class ValueObjectVoter implements VoterInterface { - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; public function __construct(PermissionResolver $permissionResolver) { diff --git a/src/lib/MVC/Symfony/Security/User/BaseProvider.php b/src/lib/MVC/Symfony/Security/User/BaseProvider.php index a75f3e5ac6..f95cdd1a83 100644 --- a/src/lib/MVC/Symfony/Security/User/BaseProvider.php +++ b/src/lib/MVC/Symfony/Security/User/BaseProvider.php @@ -22,11 +22,9 @@ abstract class BaseProvider implements APIUserProviderInterface { - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - protected $permissionResolver; + protected PermissionResolver $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ - protected $userService; + protected UserService $userService; public function __construct( UserService $userService, diff --git a/src/lib/MVC/Symfony/Security/UserChecker.php b/src/lib/MVC/Symfony/Security/UserChecker.php index 40703b4b8b..94e11bbaa8 100644 --- a/src/lib/MVC/Symfony/Security/UserChecker.php +++ b/src/lib/MVC/Symfony/Security/UserChecker.php @@ -17,8 +17,7 @@ final class UserChecker implements UserCheckerInterface { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ - private $userService; + private UserService $userService; public function __construct(UserService $userService) { diff --git a/src/lib/MVC/Symfony/SiteAccess.php b/src/lib/MVC/Symfony/SiteAccess.php index b7e0755de5..cdf197e4be 100644 --- a/src/lib/MVC/Symfony/SiteAccess.php +++ b/src/lib/MVC/Symfony/SiteAccess.php @@ -63,7 +63,7 @@ public function __construct( $this->groups = $groups; } - public function __toString() + public function __toString(): string { return "$this->name (matched by '$this->matchingType')"; } diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/Compound.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/Compound.php index b43d6bd2cc..9162b7d20f 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/Compound.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/Compound.php @@ -19,15 +19,13 @@ abstract class Compound implements CompoundInterface, URILexer { /** @var array Collection of rules using the Compound matcher. */ - protected $config; + protected array $config; /** * Matchers map. * Consists of an array of matchers, grouped by ruleset (so array of array of matchers). - * - * @var array */ - protected $matchersMap = []; + protected array $matchersMap; /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\Matcher[] */ protected $subMatchers = []; @@ -44,7 +42,7 @@ public function __construct(array $config) $this->matchersMap = []; } - public function setMatcherBuilder(MatcherBuilderInterface $matcherBuilder) + public function setMatcherBuilder(MatcherBuilderInterface $matcherBuilder): void { $this->matcherBuilder = $matcherBuilder; foreach ($this->config as $i => $rule) { @@ -54,7 +52,7 @@ public function setMatcherBuilder(MatcherBuilderInterface $matcherBuilder) } } - public function setRequest(SimplifiedRequest $request) + public function setRequest(SimplifiedRequest $request): void { $this->request = $request; foreach ($this->matchersMap as $ruleset) { @@ -96,7 +94,7 @@ public function getSubMatchers() return $this->subMatchers; } - public function setSubMatchers(array $subMatchers) + public function setSubMatchers(array $subMatchers): void { $this->subMatchers = $subMatchers; } diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/HostElement.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/HostElement.php index dba77ecc6e..b1664a2ccc 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/HostElement.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/HostElement.php @@ -12,15 +12,12 @@ class HostElement implements VersatileMatcher { - /** @var \Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest */ - private $request; + private ?SimplifiedRequest $request = null; /** * Number of elements to take into account. - * - * @var int */ - private $elementNumber; + private int $elementNumber; /** * Host elements used for matching as an array. @@ -71,7 +68,7 @@ public function getName(): string * * @param \Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest $request */ - public function setRequest(SimplifiedRequest $request) + public function setRequest(SimplifiedRequest $request): void { $this->request = $request; } @@ -81,7 +78,7 @@ public function getRequest() return $this->request; } - public function reverseMatch($siteAccessName) + public function reverseMatch($siteAccessName): ?self { $hostElements = explode('.', (string)$this->request->getHost()); $elementNumber = $this->elementNumber - 1; diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map.php index 6b30b4253d..9964330763 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map.php @@ -61,7 +61,7 @@ public function __sleep() return ['map', 'reverseMap', 'key']; } - public function setRequest(SimplifiedRequest $request) + public function setRequest(SimplifiedRequest $request): void { $this->request = $request; } @@ -76,7 +76,7 @@ public function getRequest() * * @param string $key */ - public function setMapKey($key) + public function setMapKey($key): void { $this->key = $key; } diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Host.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Host.php index b629c409d5..dbe2d064a8 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Host.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Host.php @@ -22,7 +22,7 @@ public function getName(): string * * @param \Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest $request */ - public function setRequest(SimplifiedRequest $request) + public function setRequest(SimplifiedRequest $request): void { if (!$this->key) { $this->setMapKey((string)$request->getHost()); diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Port.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Port.php index 75f6d0d0d3..6969246f71 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Port.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Port.php @@ -22,7 +22,7 @@ public function getName(): string * * @param \Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest $request */ - public function setRequest(SimplifiedRequest $request) + public function setRequest(SimplifiedRequest $request): void { if (!$this->key) { if (!empty($request->getPort())) { diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/URI.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/URI.php index a940b8bb8c..d96e0b81f3 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/URI.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/URI.php @@ -18,7 +18,7 @@ class URI extends Map implements URILexer * * @param \Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest $request */ - public function setRequest(SimplifiedRequest $request) + public function setRequest(SimplifiedRequest $request): void { if (!$this->key) { sscanf((string)$request->getPathInfo(), '/%[^/]', $key); diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex.php index a00d04cf09..05192c8bbd 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex.php @@ -88,7 +88,7 @@ protected function getMatchedSiteAccess() * * @param \Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest $request */ - public function setRequest(SimplifiedRequest $request) + public function setRequest(SimplifiedRequest $request): void { $this->request = $request; } @@ -98,7 +98,7 @@ public function setRequest(SimplifiedRequest $request) * * @param string $element */ - public function setMatchElement($element) + public function setMatchElement($element): void { $this->element = $element; } diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/URIElement.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/URIElement.php index 49dddd748a..a71c7284a7 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/URIElement.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/URIElement.php @@ -14,22 +14,17 @@ class URIElement implements VersatileMatcher, URILexer { - /** @var \Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest */ - private $request; + private ?SimplifiedRequest $request = null; /** * Number of elements to take into account. - * - * @var int */ - private $elementNumber; + private int $elementNumber; /** * URI elements used for matching as an array. - * - * @var array */ - private $uriElements; + private ?array $uriElements = null; /** * Constructor. @@ -56,7 +51,7 @@ public function __sleep() * * @return string|false Siteaccess matched or false. */ - public function match() + public function match(): string|false { try { return implode('_', $this->getURIElements()); @@ -110,7 +105,7 @@ public function getName(): string * * @param \Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest $request */ - public function setRequest(SimplifiedRequest $request) + public function setRequest(SimplifiedRequest $request): void { $this->request = $request; } @@ -171,7 +166,7 @@ public function analyseLink($linkUri): string * * @return \Ibexa\Core\MVC\Symfony\SiteAccess\Matcher\URIElement|null */ - public function reverseMatch($siteAccessName) + public function reverseMatch($siteAccessName): ?self { $elements = $this->elementNumber > 1 ? explode('_', $siteAccessName) : [$siteAccessName]; if (count($elements) !== $this->elementNumber) { diff --git a/src/lib/MVC/Symfony/SiteAccess/Provider/ChainSiteAccessProvider.php b/src/lib/MVC/Symfony/SiteAccess/Provider/ChainSiteAccessProvider.php index 302ab528f1..23d25aad9a 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Provider/ChainSiteAccessProvider.php +++ b/src/lib/MVC/Symfony/SiteAccess/Provider/ChainSiteAccessProvider.php @@ -16,7 +16,7 @@ final class ChainSiteAccessProvider implements SiteAccessProviderInterface { /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessProviderInterface[] */ - private $providers; + private iterable $providers; /** * @param \Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessProviderInterface[] $providers diff --git a/src/lib/MVC/Symfony/SiteAccess/Provider/StaticSiteAccessProvider.php b/src/lib/MVC/Symfony/SiteAccess/Provider/StaticSiteAccessProvider.php index 3041e593e0..0999d33cc4 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Provider/StaticSiteAccessProvider.php +++ b/src/lib/MVC/Symfony/SiteAccess/Provider/StaticSiteAccessProvider.php @@ -22,10 +22,10 @@ final class StaticSiteAccessProvider implements SiteAccessProviderInterface { /** @var string[] */ - private $siteAccessList; + private array $siteAccessList; /** @var string[] */ - private $groupsBySiteAccess; + private array $groupsBySiteAccess; /** * @param string[] $siteAccessList @@ -66,7 +66,7 @@ private function createSiteAccess(string $name): SiteAccess { $siteAccess = new SiteAccess($name, SiteAccess::DEFAULT_MATCHING_TYPE, null, self::class); $siteAccess->groups = array_map( - static function ($groupName) { + static function ($groupName): SiteAccessGroup { return new SiteAccessGroup($groupName); }, $this->groupsBySiteAccess[$name] ?? [] diff --git a/src/lib/MVC/Symfony/SiteAccess/Router.php b/src/lib/MVC/Symfony/SiteAccess/Router.php index 5242945875..94e44a7079 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Router.php +++ b/src/lib/MVC/Symfony/SiteAccess/Router.php @@ -51,13 +51,10 @@ class Router implements SiteAccessRouterInterface, SiteAccessAware * ) * ) * - * - * @var array */ - protected $siteAccessesConfiguration; + protected array $siteAccessesConfiguration; - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessProviderInterface */ - protected $siteAccessProvider; + protected SiteAccessProviderInterface $siteAccessProvider; /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ protected $siteAccess; @@ -65,14 +62,11 @@ class Router implements SiteAccessRouterInterface, SiteAccessAware /** @var string */ protected $siteAccessClass; - /** @var \Psr\Log\LoggerInterface */ - protected $logger; + protected LoggerInterface $logger; - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\MatcherBuilderInterface */ - protected $matcherBuilder; + protected MatcherBuilderInterface $matcherBuilder; - /** @var \Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest */ - protected $request; + protected SimplifiedRequest $request; /** @var bool */ protected $debug; @@ -266,7 +260,7 @@ public function getSiteAccess() /** * @param \Ibexa\Core\MVC\Symfony\SiteAccess|null $siteAccess */ - public function setSiteAccess(SiteAccess $siteAccess = null) + public function setSiteAccess(SiteAccess $siteAccess = null): void { $this->siteAccess = $siteAccess; } diff --git a/src/lib/MVC/Symfony/SiteAccess/SiteAccessService.php b/src/lib/MVC/Symfony/SiteAccess/SiteAccessService.php index a3b83e506d..2fb8699028 100644 --- a/src/lib/MVC/Symfony/SiteAccess/SiteAccessService.php +++ b/src/lib/MVC/Symfony/SiteAccess/SiteAccessService.php @@ -15,14 +15,11 @@ class SiteAccessService implements SiteAccessServiceInterface, SiteAccessAware { - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessProviderInterface */ - private $provider; + private SiteAccessProviderInterface $provider; - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ - private $siteAccess; + private ?SiteAccess $siteAccess = null; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; public function __construct( SiteAccessProviderInterface $provider, diff --git a/src/lib/MVC/Symfony/SiteAccessGroup.php b/src/lib/MVC/Symfony/SiteAccessGroup.php index 32968d3cd9..808f44a66d 100644 --- a/src/lib/MVC/Symfony/SiteAccessGroup.php +++ b/src/lib/MVC/Symfony/SiteAccessGroup.php @@ -12,8 +12,7 @@ final class SiteAccessGroup implements JsonSerializable { - /** @var string */ - private $name; + private string $name; public function __construct(string $name) { @@ -25,7 +24,7 @@ public function getName(): string return $this->name; } - public function __toString() + public function __toString(): string { return $this->name; } diff --git a/src/lib/MVC/Symfony/Templating/GlobalHelper.php b/src/lib/MVC/Symfony/Templating/GlobalHelper.php index 83cc7cd0bd..67a0cc67ac 100644 --- a/src/lib/MVC/Symfony/Templating/GlobalHelper.php +++ b/src/lib/MVC/Symfony/Templating/GlobalHelper.php @@ -8,6 +8,7 @@ namespace Ibexa\Core\MVC\Symfony\Templating; use Ibexa\Contracts\Core\Repository\LocationService; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\Helper\TranslationHelper; use Ibexa\Core\MVC\Symfony\RequestStackAware; @@ -22,17 +23,13 @@ class GlobalHelper { use RequestStackAware; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - protected $configResolver; + protected ConfigResolverInterface $configResolver; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - protected $locationService; + protected LocationService $locationService; - /** @var \Symfony\Component\Routing\RouterInterface */ - protected $router; + protected RouterInterface $router; - /** @var \Ibexa\Core\Helper\TranslationHelper */ - protected $translationHelper; + protected TranslationHelper $translationHelper; public function __construct( ConfigResolverInterface $configResolver, @@ -133,7 +130,7 @@ public function getSystemUriString() * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - public function getRootLocation() + public function getRootLocation(): Location { return $this->locationService->loadLocation( $this->configResolver->getParameter('content.tree_root.location_id') @@ -157,7 +154,7 @@ public function getTranslationSiteAccess($language) * * @return array */ - public function getAvailableLanguages() + public function getAvailableLanguages(): array { return $this->translationHelper->getAvailableLanguages(); } diff --git a/src/lib/MVC/Symfony/Templating/RenderOptions.php b/src/lib/MVC/Symfony/Templating/RenderOptions.php index 1170467fb9..afbecd4047 100644 --- a/src/lib/MVC/Symfony/Templating/RenderOptions.php +++ b/src/lib/MVC/Symfony/Templating/RenderOptions.php @@ -12,8 +12,7 @@ final class RenderOptions implements MutableOptionsBag { - /** @var array */ - private $options; + private array $options; public function __construct(array $options = []) { diff --git a/src/lib/MVC/Symfony/Templating/RenderStrategy.php b/src/lib/MVC/Symfony/Templating/RenderStrategy.php index fa0bf8bba5..68db200e2c 100644 --- a/src/lib/MVC/Symfony/Templating/RenderStrategy.php +++ b/src/lib/MVC/Symfony/Templating/RenderStrategy.php @@ -15,7 +15,7 @@ final class RenderStrategy implements SPIRenderStrategy { /** @var \Ibexa\Contracts\Core\MVC\Templating\RenderStrategy[] */ - private $strategies; + private iterable $strategies; public function __construct(iterable $strategies) { diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php index 4dbfd2700b..10ab906f52 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtension.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\ContentAwareInterface; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Field; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Repository\Values\ValueObject; use Ibexa\Core\Helper\FieldHelper; use Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList; @@ -27,19 +28,15 @@ */ class ContentExtension extends AbstractExtension { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Core\Helper\TranslationHelper */ - protected $translationHelper; + protected TranslationHelper $translationHelper; - /** @var \Ibexa\Core\Helper\FieldHelper */ - protected $fieldHelper; + protected FieldHelper $fieldHelper; private FieldsGroupsList $fieldsGroupsList; - /** @var \Psr\Log\LoggerInterface */ - protected $logger; + protected LoggerInterface $logger; public function __construct( Repository $repository, @@ -126,7 +123,7 @@ public function getTranslatedContentName(Content|ContentInfo|ContentAwareInterfa * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Field */ - public function getTranslatedField(Content|ContentAwareInterface $data, $fieldDefIdentifier, $forcedLanguage = null) + public function getTranslatedField(Content|ContentAwareInterface $data, string $fieldDefIdentifier, $forcedLanguage = null) { return $this->translationHelper->getTranslatedField($this->getContent($data), $fieldDefIdentifier, $forcedLanguage); } @@ -137,7 +134,7 @@ public function getTranslatedField(Content|ContentAwareInterface $data, $fieldDe * * @return mixed A primitive type or a field type Value object depending on the field type. */ - public function getTranslatedFieldValue(Content|ContentAwareInterface $data, $fieldDefIdentifier, $forcedLanguage = null) + public function getTranslatedFieldValue(Content|ContentAwareInterface $data, string $fieldDefIdentifier, $forcedLanguage = null) { return $this->translationHelper->getTranslatedField($this->getContent($data), $fieldDefIdentifier, $forcedLanguage)->value; } @@ -207,7 +204,7 @@ public function getFieldGroupName(string $identifier): ?string * * @return bool */ - public function isFieldEmpty(Content|ContentAwareInterface $data, $fieldDefIdentifier, $forcedLanguage = null) + public function isFieldEmpty(Content|ContentAwareInterface $data, $fieldDefIdentifier, $forcedLanguage = null): bool { if ($fieldDefIdentifier instanceof Field) { $fieldDefIdentifier = $fieldDefIdentifier->fieldDefIdentifier; @@ -221,7 +218,7 @@ public function isFieldEmpty(Content|ContentAwareInterface $data, $fieldDefIdent * * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|null */ - private function getContentType(Content|ContentInfo $content) + private function getContentType(Content|ContentInfo $content): ContentType { if ($content instanceof Content) { return $this->repository->getContentTypeService()->loadContentType( diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/CoreExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/CoreExtension.php index 973c3f6dff..8b8529d5d1 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/CoreExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/CoreExtension.php @@ -13,8 +13,7 @@ class CoreExtension extends AbstractExtension implements GlobalsInterface { - /** @var \Ibexa\Core\MVC\Symfony\Templating\GlobalHelper */ - private $globalHelper; + private GlobalHelper $globalHelper; public function __construct(GlobalHelper $globalHelper) { diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtension.php index 5d909b1005..5817df7e8a 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtension.php @@ -24,21 +24,16 @@ */ class FieldRenderingExtension extends AbstractExtension { - /** @var \Ibexa\Core\MVC\Symfony\Templating\FieldBlockRendererInterface */ - private $fieldBlockRenderer; + private FieldBlockRendererInterface $fieldBlockRenderer; - /** @var \Ibexa\Core\MVC\Symfony\FieldType\View\ParameterProviderRegistryInterface */ - private $parameterProviderRegistry; + private ParameterProviderRegistryInterface $parameterProviderRegistry; - /** @var \Ibexa\Core\Helper\TranslationHelper */ - private $translationHelper; + private TranslationHelper $translationHelper; /** * Hash of field type identifiers (i.e. "ezstring"), indexed by field definition identifier. - * - * @var array */ - private $fieldTypeIdentifiers = []; + private array $fieldTypeIdentifiers = []; public function __construct( FieldBlockRendererInterface $fieldBlockRenderer, @@ -107,7 +102,7 @@ public function renderFieldDefinitionSettings(FieldDefinition $fieldDefinition, * * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException */ - public function renderField(Content $content, $fieldIdentifier, array $params = []) + public function renderField(Content $content, string $fieldIdentifier, array $params = []) { $field = $this->translationHelper->getTranslatedField($content, $fieldIdentifier, isset($params['lang']) ? $params['lang'] : null); if (!$field instanceof Field) { @@ -132,7 +127,7 @@ public function renderField(Content $content, $fieldIdentifier, array $params = * * @return array */ - private function getRenderFieldBlockParameters(Content $content, Field $field, array $params = []) + private function getRenderFieldBlockParameters(Content $content, Field $field, array $params = []): array { // Merging passed parameters to default ones $params += [ diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php index 08bc99da44..60173df5b8 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtension.php @@ -24,22 +24,22 @@ class FileSizeExtension extends AbstractExtension /** * @param \Symfony\Contracts\Translation\TranslatorInterface $translator */ - protected $translator; + protected TranslatorInterface $translator; /** * @param array $suffixes */ - protected $suffixes; + protected array $suffixes; /** * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver */ - protected $configResolver; + protected ConfigResolverInterface $configResolver; /** * @param \Ibexa\Core\MVC\Symfony\Locale\LocaleConverterInterface $localeConverter */ - protected $localeConverter; + protected LocaleConverterInterface $localeConverter; /** * @param \Symfony\Contracts\Translation\TranslatorInterface $translator diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/ImageExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/ImageExtension.php index 21abc9ac49..d7628b366e 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/ImageExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/ImageExtension.php @@ -19,11 +19,9 @@ class ImageExtension extends AbstractExtension { - /** @var \Ibexa\Contracts\Core\Variation\VariationHandler */ - private $imageVariationService; + private VariationHandler $imageVariationService; - /** @var \Ibexa\Core\FieldType\ImageAsset\AssetMapper */ - protected $assetMapper; + protected AssetMapper $assetMapper; public function __construct(VariationHandler $imageVariationService, AssetMapper $assetMapper) { diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/QueryRenderingExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/QueryRenderingExtension.php index 5f3d465192..d1bce94c0d 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/QueryRenderingExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/QueryRenderingExtension.php @@ -18,8 +18,7 @@ class QueryRenderingExtension extends AbstractExtension { private const VALID_TYPES = ['content', 'location']; - /** @var \Symfony\Component\HttpKernel\Fragment\FragmentHandler */ - private $fragmentHandler; + private FragmentHandler $fragmentHandler; public function __construct(FragmentHandler $fragmentHandler) { diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderContentExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderContentExtension.php index 15ddf03243..d2924b5d49 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderContentExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderContentExtension.php @@ -22,11 +22,9 @@ */ final class RenderContentExtension extends AbstractExtension { - /** @var \Ibexa\Core\MVC\Symfony\Templating\RenderContentStrategy */ - private $renderContentStrategy; + private RenderContentStrategy $renderContentStrategy; - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - private $eventDispatcher; + private EventDispatcherInterface $eventDispatcher; public function __construct( RenderContentStrategy $renderContentStrategy, diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderExtension.php index 1389cb7413..8c983da016 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderExtension.php @@ -22,11 +22,9 @@ */ final class RenderExtension extends AbstractExtension { - /** @var \Ibexa\Contracts\Core\MVC\Templating\RenderStrategy */ - private $renderStrategy; + private RenderStrategy $renderStrategy; - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - private $eventDispatcher; + private EventDispatcherInterface $eventDispatcher; public function __construct( RenderStrategy $renderStrategy, diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderLocationExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderLocationExtension.php index c866cb5fbf..3e3d52bfd1 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderLocationExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/RenderLocationExtension.php @@ -21,11 +21,9 @@ */ final class RenderLocationExtension extends AbstractExtension { - /** @var \Ibexa\Core\MVC\Symfony\Templating\RenderLocationStrategy */ - private $renderLocationStrategy; + private RenderLocationStrategy $renderLocationStrategy; - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - private $eventDispatcher; + private EventDispatcherInterface $eventDispatcher; public function __construct( RenderLocationStrategy $renderLocationStrategy, diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/RoutingExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/RoutingExtension.php index 43d5fe3cde..805c14c43f 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/RoutingExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/RoutingExtension.php @@ -26,11 +26,9 @@ class RoutingExtension extends AbstractExtension { - /** @var \Ibexa\Core\MVC\Symfony\Routing\Generator\RouteReferenceGeneratorInterface */ - private $routeReferenceGenerator; + private RouteReferenceGeneratorInterface $routeReferenceGenerator; - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ - private $urlGenerator; + private UrlGeneratorInterface $urlGenerator; public function __construct( RouteReferenceGeneratorInterface $routeReferenceGenerator, @@ -70,7 +68,7 @@ public function getFunctions(): array * * @return \Ibexa\Core\MVC\Symfony\Routing\RouteReference */ - public function getRouteReference($resource = null, $params = []): RouteReference + public function getRouteReference($resource = null, array $params = []): RouteReference { return $this->routeReferenceGenerator->generate($resource, $params); } diff --git a/src/lib/MVC/Symfony/Templating/Twig/FieldBlockRenderer.php b/src/lib/MVC/Symfony/Templating/Twig/FieldBlockRenderer.php index b62dbcd58e..e19ea5cc33 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/FieldBlockRenderer.php +++ b/src/lib/MVC/Symfony/Templating/Twig/FieldBlockRenderer.php @@ -36,11 +36,9 @@ class FieldBlockRenderer implements FieldBlockRendererInterface self::EDIT => 'fieldDefinitionEditResources', ]; - /** @var \Twig\Environment */ - private $twig; + private Environment $twig; - /** @var \Ibexa\Core\MVC\Symfony\Templating\Twig\ResourceProviderInterface */ - private $resourceProvider; + private ResourceProviderInterface $resourceProvider; /** * A \Twig\Template instance used to render template blocks, or path to the template to use. @@ -51,10 +49,8 @@ class FieldBlockRenderer implements FieldBlockRendererInterface /** * Template blocks. - * - * @var array */ - private $blocks; + private array $blocks; /** * @param \Twig\Environment $twig @@ -77,7 +73,7 @@ public function __construct( /** * @param \Twig\Environment $twig */ - public function setTwig(Environment $twig) + public function setTwig(Environment $twig): void { $this->twig = $twig; } @@ -102,7 +98,7 @@ public function renderContentFieldEdit(Field $field, $fieldTypeIdentifier, array * * @return string */ - private function renderContentField(Field $field, $fieldTypeIdentifier, array $params, $type): string + private function renderContentField(Field $field, $fieldTypeIdentifier, array $params, int $type): string { $localTemplate = null; if (isset($params['template'])) { @@ -149,7 +145,7 @@ public function renderFieldDefinitionEdit(FieldDefinition $fieldDefinition, arra * * @return string */ - private function renderFieldDefinition(FieldDefinition $fieldDefinition, array $params, $type): string + private function renderFieldDefinition(FieldDefinition $fieldDefinition, array $params, int $type): string { if (is_string($this->baseTemplate)) { $this->baseTemplate = $this->twig->loadTemplate( @@ -208,7 +204,7 @@ private function searchBlock(string $blockName, Template $tpl): ?array * * @return array */ - private function getBlocksByField($fieldTypeIdentifier, $type, $localTemplate = null): array + private function getBlocksByField($fieldTypeIdentifier, int $type, $localTemplate = null): array { $fieldBlockName = $this->getRenderFieldBlockName($fieldTypeIdentifier, $type); if ($localTemplate !== null) { @@ -237,7 +233,7 @@ private function getBlocksByField($fieldTypeIdentifier, $type, $localTemplate = * * @return array */ - private function getBlocksByFieldDefinition(FieldDefinition $definition, $type): array + private function getBlocksByFieldDefinition(FieldDefinition $definition, int $type): array { return $this->getBlockByName( $this->getRenderFieldDefinitionBlockName($definition->fieldTypeIdentifier, $type), @@ -254,7 +250,7 @@ private function getBlocksByFieldDefinition(FieldDefinition $definition, $type): * * @return array */ - private function getBlockByName($name, $resourcesName): array + private function getBlockByName(string $name, string $resourcesName): array { if (isset($this->blocks[$name])) { return [$name => $this->blocks[$name]]; @@ -289,7 +285,7 @@ private function getBlockByName($name, $resourcesName): array * * @return string */ - private function getRenderFieldBlockName($fieldTypeIdentifier, $type): string + private function getRenderFieldBlockName(string $fieldTypeIdentifier, $type): string { $suffix = $type === self::EDIT ? self::FIELD_EDIT_SUFFIX : self::FIELD_VIEW_SUFFIX; @@ -305,7 +301,7 @@ private function getRenderFieldBlockName($fieldTypeIdentifier, $type): string * * @return string */ - private function getRenderFieldDefinitionBlockName($fieldTypeIdentifier, $type): string + private function getRenderFieldDefinitionBlockName(string $fieldTypeIdentifier, $type): string { $suffix = $type === self::EDIT ? self::FIELD_DEFINITION_EDIT_SUFFIX : self::FIELD_DEFINITION_VIEW_SUFFIX; diff --git a/src/lib/MVC/Symfony/Templating/Twig/ResourceProvider.php b/src/lib/MVC/Symfony/Templating/Twig/ResourceProvider.php index 1901db6a66..04925d5c94 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/ResourceProvider.php +++ b/src/lib/MVC/Symfony/Templating/Twig/ResourceProvider.php @@ -15,8 +15,7 @@ */ final class ResourceProvider implements ResourceProviderInterface { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; public function __construct(ConfigResolverInterface $configResolver) { diff --git a/src/lib/MVC/Symfony/Translation/CatalogueMapperFileWriter.php b/src/lib/MVC/Symfony/Translation/CatalogueMapperFileWriter.php index 1d90f7cb48..0489ce1519 100644 --- a/src/lib/MVC/Symfony/Translation/CatalogueMapperFileWriter.php +++ b/src/lib/MVC/Symfony/Translation/CatalogueMapperFileWriter.php @@ -9,6 +9,7 @@ use JMS\TranslationBundle\Exception\InvalidArgumentException; use JMS\TranslationBundle\Model\Message; +use JMS\TranslationBundle\Model\Message\XliffMessage; use JMS\TranslationBundle\Model\MessageCatalogue; use JMS\TranslationBundle\Translation\FileWriter; use JMS\TranslationBundle\Translation\LoaderManager; @@ -22,11 +23,9 @@ class CatalogueMapperFileWriter extends FileWriter { private const string XLF_FILE_NAME_REGEX_PATTERN = '/\.[-_a-z]+\.xlf$/i'; - /** @var \JMS\TranslationBundle\Translation\LoaderManager */ - private $loaderManager; + private LoaderManager $loaderManager; - /** @var \JMS\TranslationBundle\Translation\FileWriter */ - private $innerFileWriter; + private FileWriter $innerFileWriter; public function __construct(FileWriter $innerFileWriter, LoaderManager $loaderManager) { @@ -34,7 +33,7 @@ public function __construct(FileWriter $innerFileWriter, LoaderManager $loaderMa $this->innerFileWriter = $innerFileWriter; } - public function write(MessageCatalogue $catalogue, $domain, $filePath, $format) + public function write(MessageCatalogue $catalogue, $domain, $filePath, $format): void { $newCatalogue = new MessageCatalogue(); $newCatalogue->setLocale($catalogue->getLocale()); @@ -93,7 +92,7 @@ private function getEnglishFilePath(string $filePath): string * * @return \JMS\TranslationBundle\Model\MessageCatalogue */ - private function loadEnglishCatalogue($foreignFilePath, $domain, $format) + private function loadEnglishCatalogue(string $foreignFilePath, $domain, $format) { return $this->loaderManager->loadFile( $this->getEnglishFilePath($foreignFilePath), @@ -103,7 +102,7 @@ private function loadEnglishCatalogue($foreignFilePath, $domain, $format) ); } - private function hasEnglishCatalogue($foreignFilePath): bool + private function hasEnglishCatalogue(string $foreignFilePath): bool { return file_exists($this->getEnglishFilePath($foreignFilePath)); } @@ -111,11 +110,11 @@ private function hasEnglishCatalogue($foreignFilePath): bool /** * @param $message * - * @return Message\XliffMessage + * @return \JMS\TranslationBundle\Model\Message\XliffMessage */ - private function makeXliffMessage(Message $message) + private function makeXliffMessage(Message $message): XliffMessage { - $newMessage = new Message\XliffMessage($message->getId(), $message->getDomain()); + $newMessage = new XliffMessage($message->getId(), $message->getDomain()); $newMessage->setNew($message->isNew()); $newMessage->setLocaleString($message->getLocaleString()); $newMessage->setSources($message->getSources()); diff --git a/src/lib/MVC/Symfony/Translation/ExceptionMessageTemplateFileVisitor.php b/src/lib/MVC/Symfony/Translation/ExceptionMessageTemplateFileVisitor.php index ac6715402c..0a41ae48ec 100644 --- a/src/lib/MVC/Symfony/Translation/ExceptionMessageTemplateFileVisitor.php +++ b/src/lib/MVC/Symfony/Translation/ExceptionMessageTemplateFileVisitor.php @@ -116,7 +116,7 @@ private function getDocCommentForNode(Node $node): ?string return null; } - private function isIgnore($node): bool + private function isIgnore(Node $node): bool { if (null !== $docComment = $this->getDocCommentForNode($node)) { $annotations = $this->docParser->parse( diff --git a/src/lib/MVC/Symfony/Translation/FieldTypesTranslationExtractor.php b/src/lib/MVC/Symfony/Translation/FieldTypesTranslationExtractor.php index 980e490fea..92555f244f 100644 --- a/src/lib/MVC/Symfony/Translation/FieldTypesTranslationExtractor.php +++ b/src/lib/MVC/Symfony/Translation/FieldTypesTranslationExtractor.php @@ -17,8 +17,7 @@ */ class FieldTypesTranslationExtractor implements ExtractorInterface { - /** @var \Ibexa\Core\FieldType\FieldTypeRegistry */ - private $fieldTypeRegistry; + private FieldTypeRegistry $fieldTypeRegistry; public function __construct(FieldTypeRegistry $fieldTypeRegistry) { diff --git a/src/lib/MVC/Symfony/Translation/ValidationErrorFileVisitor.php b/src/lib/MVC/Symfony/Translation/ValidationErrorFileVisitor.php index 40884bc9e8..be95e649e1 100644 --- a/src/lib/MVC/Symfony/Translation/ValidationErrorFileVisitor.php +++ b/src/lib/MVC/Symfony/Translation/ValidationErrorFileVisitor.php @@ -63,7 +63,7 @@ public function __construct(DocParser $docParser, FileSourceFactory $fileSourceF /** * @param \Psr\Log\LoggerInterface $logger */ - public function setLogger(LoggerInterface $logger) + public function setLogger(LoggerInterface $logger): void { $this->logger = $logger; } diff --git a/src/lib/MVC/Symfony/View/BaseView.php b/src/lib/MVC/Symfony/View/BaseView.php index 237b77f8d5..87a80f4ba1 100644 --- a/src/lib/MVC/Symfony/View/BaseView.php +++ b/src/lib/MVC/Symfony/View/BaseView.php @@ -20,8 +20,7 @@ abstract class BaseView implements View */ protected $templateIdentifier; - /** @var array */ - protected $parameters = []; + protected array $parameters; /** @var array */ protected $configHash = []; @@ -29,14 +28,11 @@ abstract class BaseView implements View /** @var string */ private $viewType = 'full'; - /** @var \Symfony\Component\HttpKernel\Controller\ControllerReference */ - private $controllerReference; + private ?ControllerReference $controllerReference = null; - /** @var \Symfony\Component\HttpFoundation\Response */ - private $response; + private ?Response $response = null; - /** @var bool */ - private $isCacheEnabled = true; + private bool $isCacheEnabled = true; /** * @phpstan-param string|(\Closure(array):string) $templateIdentifier @@ -60,7 +56,7 @@ public function __construct($templateIdentifier = null, array $parameters = [], /** * @param array $parameters Hash of parameters to pass to the template/closure */ - public function setParameters(array $parameters) + public function setParameters(array $parameters): void { $this->parameters = $parameters; } @@ -70,7 +66,7 @@ public function setParameters(array $parameters) * * @param array $parameters */ - public function addParameters(array $parameters) + public function addParameters(array $parameters): void { $this->parameters = array_replace($this->parameters, $parameters); } @@ -121,7 +117,7 @@ public function getParameter($parameterName) * * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType */ - public function setTemplateIdentifier($templateIdentifier) + public function setTemplateIdentifier($templateIdentifier): void { if (!is_string($templateIdentifier) && !$templateIdentifier instanceof \Closure) { throw new InvalidArgumentType('templateIdentifier', 'string or \Closure', $templateIdentifier); @@ -149,7 +145,7 @@ public function getTemplateIdentifier() * * @param array $config */ - public function setConfigHash(array $config) + public function setConfigHash(array $config): void { $this->configHash = $config; } @@ -164,7 +160,7 @@ public function getConfigHash() return $this->configHash; } - public function setViewType($viewType) + public function setViewType($viewType): void { $this->viewType = $viewType; } @@ -174,7 +170,7 @@ public function getViewType() return $this->viewType; } - public function setControllerReference(ControllerReference $controllerReference) + public function setControllerReference(ControllerReference $controllerReference): void { $this->controllerReference = $controllerReference; } @@ -197,7 +193,7 @@ protected function getInternalParameters() return []; } - public function setResponse(Response $response) + public function setResponse(Response $response): void { $this->response = $response; } @@ -207,7 +203,7 @@ public function getResponse() return $this->response; } - public function setCacheEnabled($cacheEnabled) + public function setCacheEnabled($cacheEnabled): void { $this->isCacheEnabled = (bool)$cacheEnabled; } diff --git a/src/lib/MVC/Symfony/View/Builder/ContentViewBuilder.php b/src/lib/MVC/Symfony/View/Builder/ContentViewBuilder.php index 9b9a4c18c9..5ec2c6324d 100644 --- a/src/lib/MVC/Symfony/View/Builder/ContentViewBuilder.php +++ b/src/lib/MVC/Symfony/View/Builder/ContentViewBuilder.php @@ -8,6 +8,7 @@ namespace Ibexa\Core\MVC\Symfony\View\Builder; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Location; @@ -28,20 +29,15 @@ */ class ContentViewBuilder implements ViewBuilder { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - private $repository; + private Repository $repository; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; - /** @var \Ibexa\Core\MVC\Symfony\View\Configurator */ - private $viewConfigurator; + private Configurator $viewConfigurator; - /** @var \Ibexa\Core\MVC\Symfony\View\ParametersInjector */ - private $viewParametersInjector; + private ParametersInjector $viewParametersInjector; - /** @var \Symfony\Component\HttpFoundation\RequestStack */ - private $requestStack; + private RequestStack $requestStack; /** * Default templates, indexed per viewType (full, line, ...). @@ -50,8 +46,7 @@ class ContentViewBuilder implements ViewBuilder */ private $defaultTemplates; - /** @var \Ibexa\Core\Helper\ContentInfoLocationLoader */ - private $locationLoader; + private ?ContentInfoLocationLoader $locationLoader; public function __construct( Repository $repository, @@ -83,7 +78,7 @@ public function matches($argument): bool * If both contentId and locationId parameters are missing * @throws \Ibexa\Core\Base\Exceptions\UnauthorizedException */ - public function buildView(array $parameters) + public function buildView(array $parameters): ContentView { $view = new ContentView(null, [], $parameters['viewType']); $view->setIsEmbed($this->isEmbed($parameters)); @@ -185,7 +180,7 @@ private function resolveMainRequestLanguageCode(): ?string * * @throws \Ibexa\Core\Base\Exceptions\UnauthorizedException */ - private function loadContent($contentId, ?string $languageCode = null) + private function loadContent(int $contentId, ?string $languageCode = null): Content { return $this->repository->getContentService()->loadContent( $contentId, @@ -205,10 +200,10 @@ private function loadContent($contentId, ?string $languageCode = null) * * @throws \Ibexa\Core\Base\Exceptions\UnauthorizedException */ - private function loadEmbeddedContent($contentId, Location $location = null, ?string $languageCode = null) + private function loadEmbeddedContent(int $contentId, Location $location = null, ?string $languageCode = null) { $content = $this->repository->sudo( - static function (Repository $repository) use ($contentId, $languageCode) { + static function (Repository $repository) use ($contentId, $languageCode): \Ibexa\Contracts\Core\Repository\Values\Content\Content { return $repository->getContentService()->loadContent($contentId, $languageCode ? [$languageCode] : null); } ); @@ -239,10 +234,10 @@ static function (Repository $repository) use ($contentId, $languageCode) { * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private function loadLocation($locationId) + private function loadLocation(int $locationId) { $location = $this->repository->sudo( - static function (Repository $repository) use ($locationId) { + static function (Repository $repository) use ($locationId): \Ibexa\Contracts\Core\Repository\Values\Content\Location { return $repository->getLocationService()->loadLocation($locationId); } ); @@ -283,7 +278,7 @@ private function canRead(Content $content, Location $location = null, bool $isEm * * @return bool */ - private function isEmbed($parameters): bool + private function isEmbed(array $parameters): bool { if ($parameters['_controller'] === 'ibexa_content::embedAction') { return true; diff --git a/src/lib/MVC/Symfony/View/Builder/ParametersFilter/RequestAttributes.php b/src/lib/MVC/Symfony/View/Builder/ParametersFilter/RequestAttributes.php index c88679fddc..8fcfca7e30 100644 --- a/src/lib/MVC/Symfony/View/Builder/ParametersFilter/RequestAttributes.php +++ b/src/lib/MVC/Symfony/View/Builder/ParametersFilter/RequestAttributes.php @@ -26,7 +26,7 @@ public static function getSubscribedEvents(): array * * @param \Ibexa\Core\MVC\Symfony\View\Event\FilterViewBuilderParametersEvent $e */ - public function addRequestAttributes(FilterViewBuilderParametersEvent $e) + public function addRequestAttributes(FilterViewBuilderParametersEvent $e): void { $parameterBag = $e->getParameters(); $parameterBag->add($e->getRequest()->attributes->all()); diff --git a/src/lib/MVC/Symfony/View/Builder/Registry/ControllerMatch.php b/src/lib/MVC/Symfony/View/Builder/Registry/ControllerMatch.php index c6f95844b4..85f84e54e2 100644 --- a/src/lib/MVC/Symfony/View/Builder/Registry/ControllerMatch.php +++ b/src/lib/MVC/Symfony/View/Builder/Registry/ControllerMatch.php @@ -16,7 +16,7 @@ class ControllerMatch implements ViewBuilderRegistry { /** @var \Ibexa\Core\MVC\Symfony\View\Builder\ViewBuilder[] */ - private $registry = []; + private array $registry = []; public function __construct(iterable $viewBuilders = []) { @@ -30,7 +30,7 @@ public function __construct(iterable $viewBuilders = []) /** * @param \Ibexa\Core\MVC\Symfony\View\Builder\ViewBuilder[] $viewBuilders */ - public function addToRegistry(array $viewBuilders) + public function addToRegistry(array $viewBuilders): void { $this->registry = array_merge($this->registry, $viewBuilders); } diff --git a/src/lib/MVC/Symfony/View/Configurator/ViewProvider.php b/src/lib/MVC/Symfony/View/Configurator/ViewProvider.php index 22a433edd9..33deadd466 100644 --- a/src/lib/MVC/Symfony/View/Configurator/ViewProvider.php +++ b/src/lib/MVC/Symfony/View/Configurator/ViewProvider.php @@ -19,8 +19,7 @@ */ class ViewProvider implements Configurator { - /** @var \Ibexa\Core\MVC\Symfony\View\Provider\Registry */ - private $providerRegistry; + private Registry $providerRegistry; /** * ViewProvider constructor. @@ -32,7 +31,7 @@ public function __construct(Registry $providersRegistry) $this->providerRegistry = $providersRegistry; } - public function configure(View $view) + public function configure(View $view): void { foreach ($this->providerRegistry->getViewProviders($view) as $viewProvider) { if ($providerView = $viewProvider->getView($view)) { diff --git a/src/lib/MVC/Symfony/View/ContentView.php b/src/lib/MVC/Symfony/View/ContentView.php index 1713c0ac87..ac5e1fd080 100644 --- a/src/lib/MVC/Symfony/View/ContentView.php +++ b/src/lib/MVC/Symfony/View/ContentView.php @@ -39,19 +39,16 @@ */ class ContentView extends BaseView implements View, ContentValueView, LocationValueView, EmbedView, CachableView { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - private $content; + private ?Content $content = null; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ - private $location; + private ?Location $location = null; - /** @var bool */ - private $isEmbed = false; + private bool $isEmbed = false; /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ - public function setContent(Content $content) + public function setContent(Content $content): void { $this->content = $content; } @@ -69,7 +66,7 @@ public function getContent() /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ - public function setLocation(Location $location) + public function setLocation(Location $location): void { $this->location = $location; } @@ -82,7 +79,7 @@ public function getLocation() return $this->location; } - protected function getInternalParameters() + protected function getInternalParameters(): array { $parameters = ['content' => $this->content]; if ($this->location !== null) { @@ -97,7 +94,7 @@ protected function getInternalParameters() * * @param bool $value */ - public function setIsEmbed($value) + public function setIsEmbed($value): void { $this->isEmbed = (bool)$value; } diff --git a/src/lib/MVC/Symfony/View/CustomLocationControllerChecker.php b/src/lib/MVC/Symfony/View/CustomLocationControllerChecker.php index a97e1c7ce4..6afc4ffe15 100644 --- a/src/lib/MVC/Symfony/View/CustomLocationControllerChecker.php +++ b/src/lib/MVC/Symfony/View/CustomLocationControllerChecker.php @@ -16,7 +16,7 @@ class CustomLocationControllerChecker { /** @var \Ibexa\Core\MVC\Symfony\View\ViewProvider[] */ - private $viewProviders; + private ?array $viewProviders = null; /** * Tests if $location has match a view that uses a custom controller. @@ -50,7 +50,7 @@ public function usesCustomController(Content $content, Location $location, $view /** * @param \Ibexa\Core\MVC\Symfony\View\ViewProvider[] $viewProviders */ - public function addViewProviders(array $viewProviders) + public function addViewProviders(array $viewProviders): void { $this->viewProviders = $viewProviders; } diff --git a/src/lib/MVC/Symfony/View/Event/FilterViewBuilderParametersEvent.php b/src/lib/MVC/Symfony/View/Event/FilterViewBuilderParametersEvent.php index 914b9f2466..b08b5ab13c 100644 --- a/src/lib/MVC/Symfony/View/Event/FilterViewBuilderParametersEvent.php +++ b/src/lib/MVC/Symfony/View/Event/FilterViewBuilderParametersEvent.php @@ -16,15 +16,12 @@ */ class FilterViewBuilderParametersEvent extends Event { - /** @var \Symfony\Component\HttpFoundation\Request */ - private $request; + private Request $request; /** * Parameters the ViewBuilder will use. - * - * @var \Symfony\Component\HttpFoundation\ParameterBag */ - private $parameters; + private ParameterBag $parameters; public function __construct(Request $request) { diff --git a/src/lib/MVC/Symfony/View/Event/FilterViewParametersEvent.php b/src/lib/MVC/Symfony/View/Event/FilterViewParametersEvent.php index 496719cd45..a13bd5b5e3 100644 --- a/src/lib/MVC/Symfony/View/Event/FilterViewParametersEvent.php +++ b/src/lib/MVC/Symfony/View/Event/FilterViewParametersEvent.php @@ -20,24 +20,18 @@ class FilterViewParametersEvent extends Event { /** * Copy of the view object that is being built. - * - * @var \Ibexa\Core\MVC\Symfony\View\View */ - private $view; + private View $view; /** * Parameters that were provided to the ViewBuilder. - * - * @var array */ - private $builderParameters; + private array $builderParameters; /** * ParameterBag used to manipulate the view parameters. Its contents will be injected as the view parameters. - * - * @var \Symfony\Component\HttpFoundation\ParameterBag */ - private $parameterBag; + private ParameterBag $parameterBag; public function __construct(View $view, array $builderParameters) { @@ -51,7 +45,7 @@ public function __construct(View $view, array $builderParameters) * * @return array */ - public function getViewParameters() + public function getViewParameters(): array { return $this->parameterBag->all(); } diff --git a/src/lib/MVC/Symfony/View/GenericVariableProviderRegistry.php b/src/lib/MVC/Symfony/View/GenericVariableProviderRegistry.php index b9c234f043..0cf5f3d5bd 100644 --- a/src/lib/MVC/Symfony/View/GenericVariableProviderRegistry.php +++ b/src/lib/MVC/Symfony/View/GenericVariableProviderRegistry.php @@ -15,7 +15,7 @@ final class GenericVariableProviderRegistry implements VariableProviderRegistry { /** @var \Ibexa\Contracts\Core\MVC\View\VariableProvider[] */ - private $twigVariableProviders; + private ?array $twigVariableProviders = null; public function __construct(Traversable $twigVariableProviders) { diff --git a/src/lib/MVC/Symfony/View/LoginFormView.php b/src/lib/MVC/Symfony/View/LoginFormView.php index b8b611d521..fd95a17a5a 100644 --- a/src/lib/MVC/Symfony/View/LoginFormView.php +++ b/src/lib/MVC/Symfony/View/LoginFormView.php @@ -12,11 +12,9 @@ final class LoginFormView extends BaseView { - /** @var string */ - private $lastUsername; + private ?string $lastUsername = null; - /** @var \Symfony\Component\Security\Core\Exception\AuthenticationException|null */ - private $lastAuthenticationException; + private ?AuthenticationException $lastAuthenticationException = null; public function getLastUsername(): ?string { diff --git a/src/lib/MVC/Symfony/View/Manager.php b/src/lib/MVC/Symfony/View/Manager.php index b709740c2c..b8ee5e2a9a 100644 --- a/src/lib/MVC/Symfony/View/Manager.php +++ b/src/lib/MVC/Symfony/View/Manager.php @@ -20,17 +20,13 @@ class Manager implements ViewManagerInterface { - /** @var \Twig\Environment */ - protected $templateEngine; + protected Environment $templateEngine; - /** @var \Psr\Log\LoggerInterface */ - protected $logger; + protected ?LoggerInterface $logger; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; /** * The base layout template to use when the view is requested to be generated @@ -40,8 +36,7 @@ class Manager implements ViewManagerInterface */ protected $viewBaseLayout; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - protected $configResolver; + protected ConfigResolverInterface $configResolver; /** @var \Ibexa\Core\MVC\Symfony\View\Configurator */ private $viewConfigurator; diff --git a/src/lib/MVC/Symfony/View/ParametersInjector/CustomParameters.php b/src/lib/MVC/Symfony/View/ParametersInjector/CustomParameters.php index 7a30313c76..f7faef2eb5 100644 --- a/src/lib/MVC/Symfony/View/ParametersInjector/CustomParameters.php +++ b/src/lib/MVC/Symfony/View/ParametersInjector/CustomParameters.php @@ -21,7 +21,7 @@ public static function getSubscribedEvents(): array return [ViewEvents::FILTER_VIEW_PARAMETERS => 'injectCustomParameters']; } - public function injectCustomParameters(FilterViewParametersEvent $event) + public function injectCustomParameters(FilterViewParametersEvent $event): void { $builderParameters = $event->getBuilderParameters(); diff --git a/src/lib/MVC/Symfony/View/ParametersInjector/EmbedObjectParameters.php b/src/lib/MVC/Symfony/View/ParametersInjector/EmbedObjectParameters.php index 8ae533855d..5ede4ec495 100644 --- a/src/lib/MVC/Symfony/View/ParametersInjector/EmbedObjectParameters.php +++ b/src/lib/MVC/Symfony/View/ParametersInjector/EmbedObjectParameters.php @@ -21,7 +21,7 @@ public static function getSubscribedEvents(): array return [ViewEvents::FILTER_VIEW_PARAMETERS => 'injectEmbedObjectParameters']; } - public function injectEmbedObjectParameters(FilterViewParametersEvent $event) + public function injectEmbedObjectParameters(FilterViewParametersEvent $event): void { $viewType = $event->getView()->getViewType(); if ($viewType == 'embed' || $viewType == 'embed-inline') { diff --git a/src/lib/MVC/Symfony/View/ParametersInjector/EventDispatcherInjector.php b/src/lib/MVC/Symfony/View/ParametersInjector/EventDispatcherInjector.php index a3b3ce339a..7fbe317927 100644 --- a/src/lib/MVC/Symfony/View/ParametersInjector/EventDispatcherInjector.php +++ b/src/lib/MVC/Symfony/View/ParametersInjector/EventDispatcherInjector.php @@ -18,15 +18,14 @@ */ class EventDispatcherInjector implements ParametersInjector { - /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ - private $eventDispatcher; + private EventDispatcherInterface $eventDispatcher; public function __construct(EventDispatcherInterface $eventDispatcher) { $this->eventDispatcher = $eventDispatcher; } - public function injectViewParameters(View $view, array $parameters) + public function injectViewParameters(View $view, array $parameters): void { $event = new FilterViewParametersEvent($view, $parameters); $this->eventDispatcher->dispatch($event, ViewEvents::FILTER_VIEW_PARAMETERS); diff --git a/src/lib/MVC/Symfony/View/ParametersInjector/NoLayout.php b/src/lib/MVC/Symfony/View/ParametersInjector/NoLayout.php index 178aa3c828..d5b07abce9 100644 --- a/src/lib/MVC/Symfony/View/ParametersInjector/NoLayout.php +++ b/src/lib/MVC/Symfony/View/ParametersInjector/NoLayout.php @@ -21,7 +21,7 @@ public static function getSubscribedEvents(): array return [ViewEvents::FILTER_VIEW_PARAMETERS => 'injectCustomParameters']; } - public function injectCustomParameters(FilterViewParametersEvent $event) + public function injectCustomParameters(FilterViewParametersEvent $event): void { $parameters = $event->getBuilderParameters(); diff --git a/src/lib/MVC/Symfony/View/ParametersInjector/ValueObjectsIds.php b/src/lib/MVC/Symfony/View/ParametersInjector/ValueObjectsIds.php index 4221231683..c15a2dd5d3 100644 --- a/src/lib/MVC/Symfony/View/ParametersInjector/ValueObjectsIds.php +++ b/src/lib/MVC/Symfony/View/ParametersInjector/ValueObjectsIds.php @@ -23,7 +23,7 @@ public static function getSubscribedEvents(): array return [View\ViewEvents::FILTER_VIEW_PARAMETERS => 'injectValueObjectsIds']; } - public function injectValueObjectsIds(View\Event\FilterViewParametersEvent $event) + public function injectValueObjectsIds(View\Event\FilterViewParametersEvent $event): void { $view = $event->getView(); $parameterBag = $event->getParameterBag(); diff --git a/src/lib/MVC/Symfony/View/ParametersInjector/ViewbaseLayout.php b/src/lib/MVC/Symfony/View/ParametersInjector/ViewbaseLayout.php index 715f26c870..c86f76e739 100644 --- a/src/lib/MVC/Symfony/View/ParametersInjector/ViewbaseLayout.php +++ b/src/lib/MVC/Symfony/View/ParametersInjector/ViewbaseLayout.php @@ -20,8 +20,7 @@ class ViewbaseLayout implements EventSubscriberInterface /** @var string */ private $viewbaseLayout; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; public function __construct($viewbaseLayout, ConfigResolverInterface $configResolver) { @@ -39,7 +38,7 @@ private function getPageLayout(): string return $this->configResolver->getParameter('page_layout'); } - public function injectViewbaseLayout(FilterViewParametersEvent $event) + public function injectViewbaseLayout(FilterViewParametersEvent $event): void { $pageLayout = $this->getPageLayout(); diff --git a/src/lib/MVC/Symfony/View/Provider/Configured.php b/src/lib/MVC/Symfony/View/Provider/Configured.php index 4f7a38d255..32d999b99d 100644 --- a/src/lib/MVC/Symfony/View/Provider/Configured.php +++ b/src/lib/MVC/Symfony/View/Provider/Configured.php @@ -18,8 +18,7 @@ */ class Configured implements ViewProvider { - /** @var \Ibexa\Core\MVC\Symfony\Matcher\MatcherFactoryInterface */ - protected $matcherFactory; + protected MatcherFactoryInterface $matcherFactory; /** * @param \Ibexa\Core\MVC\Symfony\Matcher\MatcherFactoryInterface $matcherFactory @@ -45,7 +44,7 @@ public function getView(View $view) * * @return \Ibexa\Core\MVC\Symfony\View\ContentView */ - protected function buildContentView(array $viewConfig) + protected function buildContentView(array $viewConfig): ContentView { $view = new ContentView(); $view->setConfigHash($viewConfig); diff --git a/src/lib/MVC/Symfony/View/Provider/Registry.php b/src/lib/MVC/Symfony/View/Provider/Registry.php index ba751daf5a..738c4ccc0a 100644 --- a/src/lib/MVC/Symfony/View/Provider/Registry.php +++ b/src/lib/MVC/Symfony/View/Provider/Registry.php @@ -17,7 +17,7 @@ class Registry * * @var \Ibexa\Core\MVC\Symfony\View\ViewProvider[][] */ - private $viewProviders; + private ?array $viewProviders = null; /** * @param \Ibexa\Core\MVC\Symfony\View\View $view @@ -41,7 +41,7 @@ public function getViewProviders(View $view) * * @param array $viewProviders ['type' => [ViewProvider1, ViewProvider2]] */ - public function setViewProviders(array $viewProviders) + public function setViewProviders(array $viewProviders): void { $this->viewProviders = $viewProviders; } diff --git a/src/lib/MVC/Symfony/View/Renderer/TemplateRenderer.php b/src/lib/MVC/Symfony/View/Renderer/TemplateRenderer.php index 91644d1664..729df5f9ac 100644 --- a/src/lib/MVC/Symfony/View/Renderer/TemplateRenderer.php +++ b/src/lib/MVC/Symfony/View/Renderer/TemplateRenderer.php @@ -18,11 +18,9 @@ class TemplateRenderer implements Renderer { - /** @var \Twig\Environment */ - protected $templateEngine; + protected Environment $templateEngine; - /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ - protected $eventDispatcher; + protected EventDispatcherInterface $eventDispatcher; public function __construct(Environment $templateEngine, EventDispatcherInterface $eventDispatcher) { diff --git a/src/lib/Persistence/Cache/AbstractHandler.php b/src/lib/Persistence/Cache/AbstractHandler.php index b90f7c3e4f..f67328d4e4 100644 --- a/src/lib/Persistence/Cache/AbstractHandler.php +++ b/src/lib/Persistence/Cache/AbstractHandler.php @@ -7,6 +7,7 @@ namespace Ibexa\Core\Persistence\Cache; +use Ibexa\Contracts\Core\Persistence\Handler; use Ibexa\Contracts\Core\Persistence\Handler as PersistenceHandler; use Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierGeneratorInterface; use Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierSanitizer; @@ -19,23 +20,17 @@ */ abstract class AbstractHandler { - /** @var \Symfony\Component\Cache\Adapter\TagAwareAdapterInterface */ - protected $cache; + protected TagAwareAdapterInterface $cache; - /** @var \Ibexa\Contracts\Core\Persistence\Handler */ - protected $persistenceHandler; + protected Handler $persistenceHandler; - /** @var \Ibexa\Core\Persistence\Cache\PersistenceLogger */ - protected $logger; + protected PersistenceLogger $logger; - /** @var \Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierGeneratorInterface */ - protected $cacheIdentifierGenerator; + protected CacheIdentifierGeneratorInterface $cacheIdentifierGenerator; - /** @var \Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierSanitizer */ - protected $cacheIdentifierSanitizer; + protected CacheIdentifierSanitizer $cacheIdentifierSanitizer; - /** @var \Ibexa\Core\Persistence\Cache\LocationPathConverter */ - protected $locationPathConverter; + protected LocationPathConverter $locationPathConverter; /** * Setups current handler with everything needed. diff --git a/src/lib/Persistence/Cache/AbstractInMemoryHandler.php b/src/lib/Persistence/Cache/AbstractInMemoryHandler.php index 604d3c7f07..df47620569 100644 --- a/src/lib/Persistence/Cache/AbstractInMemoryHandler.php +++ b/src/lib/Persistence/Cache/AbstractInMemoryHandler.php @@ -20,24 +20,18 @@ abstract class AbstractInMemoryHandler { /** * NOTE: Instance of this must be TransactionalInMemoryCacheAdapter in order for cache clearing to affect in-memory cache. - * - * @var \Ibexa\Core\Persistence\Cache\Adapter\TransactionAwareAdapterInterface */ - protected $cache; + protected TransactionAwareAdapterInterface $cache; - /** @var \Ibexa\Core\Persistence\Cache\PersistenceLogger */ - protected $logger; + protected PersistenceLogger $logger; /** * NOTE: On purpose private as it's only supposed to be interacted with in tandem with symfony cache here, * hence the cache decorator and the reusable methods here. - * - * @var \Ibexa\Core\Persistence\Cache\InMemory\InMemoryCache */ - private $inMemory; + private InMemoryCache $inMemory; - /** @var \Ibexa\Core\Persistence\Cache\CacheIndicesValidatorInterface */ - private $cacheIndicesValidator; + private ?CacheIndicesValidatorInterface $cacheIndicesValidator; public function __construct( TransactionAwareAdapterInterface $cache, diff --git a/src/lib/Persistence/Cache/AbstractInMemoryPersistenceHandler.php b/src/lib/Persistence/Cache/AbstractInMemoryPersistenceHandler.php index a412a518ff..548537af15 100644 --- a/src/lib/Persistence/Cache/AbstractInMemoryPersistenceHandler.php +++ b/src/lib/Persistence/Cache/AbstractInMemoryPersistenceHandler.php @@ -7,6 +7,7 @@ namespace Ibexa\Core\Persistence\Cache; +use Ibexa\Contracts\Core\Persistence\Handler; use Ibexa\Contracts\Core\Persistence\Handler as PersistenceHandler; use Ibexa\Core\Persistence\Cache\Adapter\TransactionAwareAdapterInterface; use Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierGeneratorInterface; @@ -20,17 +21,13 @@ */ abstract class AbstractInMemoryPersistenceHandler extends AbstractInMemoryHandler { - /** @var \Ibexa\Contracts\Core\Persistence\Handler */ - protected $persistenceHandler; + protected Handler $persistenceHandler; - /** @var \Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierGeneratorInterface */ - protected $cacheIdentifierGenerator; + protected CacheIdentifierGeneratorInterface $cacheIdentifierGenerator; - /** @var \Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierSanitizer */ - protected $cacheIdentifierSanitizer; + protected CacheIdentifierSanitizer $cacheIdentifierSanitizer; - /** @var \Ibexa\Core\Persistence\Cache\LocationPathConverter */ - protected $locationPathConverter; + protected LocationPathConverter $locationPathConverter; public function __construct( TransactionAwareAdapterInterface $cache, diff --git a/src/lib/Persistence/Cache/Adapter/TransactionalInMemoryCacheAdapter.php b/src/lib/Persistence/Cache/Adapter/TransactionalInMemoryCacheAdapter.php index c3960ef0ba..4136ec8c7d 100644 --- a/src/lib/Persistence/Cache/Adapter/TransactionalInMemoryCacheAdapter.php +++ b/src/lib/Persistence/Cache/Adapter/TransactionalInMemoryCacheAdapter.php @@ -60,7 +60,7 @@ public function __construct( $this->deferredItemsDeletion = empty($deferredItemsDeletion) ? [] : \array_fill_keys($deferredItemsDeletion, true); // To modify protected $isHit when items are a "miss" based on deferred delete/invalidation during transactions $this->setCacheItemAsMiss = \Closure::bind( - static function (CacheItem $item) { + static function (CacheItem $item): void { // ... Might not work for anything but new items $item->isHit = false; }, diff --git a/src/lib/Persistence/Cache/ContentHandler.php b/src/lib/Persistence/Cache/ContentHandler.php index bd0ffb3de3..0b83d75d77 100644 --- a/src/lib/Persistence/Cache/ContentHandler.php +++ b/src/lib/Persistence/Cache/ContentHandler.php @@ -68,7 +68,7 @@ protected function init(): void return $tags; }; - $this->getContentInfoKeys = function (ContentInfo $info) { + $this->getContentInfoKeys = function (ContentInfo $info): array { return [ $this->cacheIdentifierGenerator->generateKey(self::CONTENT_INFO_IDENTIFIER, [$info->id], true), $this->cacheIdentifierGenerator->generateKey( @@ -79,7 +79,7 @@ protected function init(): void ]; }; - $this->getContentTags = function (Content $content) { + $this->getContentTags = function (Content $content): array { $versionInfo = $content->versionInfo; $tags = [ $this->cacheIdentifierGenerator->generateTag( @@ -146,7 +146,7 @@ function ($id) use ($versionNo, $translations) { return $this->persistenceHandler->contentHandler()->load($id, $versionNo, $translations); }, $this->getContentTags, - function (Content $content) use ($keySuffix) { + function (Content $content) use ($keySuffix): array { // Version number & translations is part of keySuffix here and depends on what user asked for return [ $this->cacheIdentifierGenerator->generateKey( @@ -172,7 +172,7 @@ function (array $cacheMissIds) use ($translations) { return $this->persistenceHandler->contentHandler()->loadContentList($cacheMissIds, $translations); }, $this->getContentTags, - function (Content $content) use ($keySuffix) { + function (Content $content) use ($keySuffix): array { // Translations is part of keySuffix here and depends on what user asked for return [ $this->cacheIdentifierGenerator->generateKey( @@ -205,7 +205,7 @@ function ($contentId) { ); } - public function loadContentInfoList(array $contentIds) + public function loadContentInfoList(array $contentIds): array { return $this->getMultipleCacheValues( $contentIds, @@ -683,7 +683,7 @@ public function publish($contentId, $versionNo, MetadataUpdateStruct $struct) /** * {@inheritdoc} */ - public function deleteTranslationFromContent($contentId, $languageCode) + public function deleteTranslationFromContent($contentId, $languageCode): void { $this->logger->logCall( __METHOD__, @@ -756,7 +756,7 @@ function (array $cacheMissIds): array { function (VersionInfo $versionInfo): array { return $this->getCacheTagsForVersion($versionInfo); }, - function (VersionInfo $versionInfo) { + function (VersionInfo $versionInfo): array { return [ $this->cacheIdentifierGenerator->generateKey( self::CONTENT_VERSION_INFO_IDENTIFIER, diff --git a/src/lib/Persistence/Cache/ContentLanguageHandler.php b/src/lib/Persistence/Cache/ContentLanguageHandler.php index 94f90c2fa5..fffdfc30ad 100644 --- a/src/lib/Persistence/Cache/ContentLanguageHandler.php +++ b/src/lib/Persistence/Cache/ContentLanguageHandler.php @@ -28,12 +28,12 @@ class ContentLanguageHandler extends AbstractInMemoryPersistenceHandler implemen */ protected function init(): void { - $this->getTags = function (Language $language) { + $this->getTags = function (Language $language): array { return [ $this->cacheIdentifierGenerator->generateTag(self::LANGUAGE_IDENTIFIER, [$language->id]), ]; }; - $this->getKeys = function (Language $language) { + $this->getKeys = function (Language $language): array { return [ $this->cacheIdentifierGenerator->generateKey(self::LANGUAGE_IDENTIFIER, [$language->id], true), $this->cacheIdentifierGenerator->generateKey( diff --git a/src/lib/Persistence/Cache/ContentTypeHandler.php b/src/lib/Persistence/Cache/ContentTypeHandler.php index 123a0ac74f..482154a8fc 100644 --- a/src/lib/Persistence/Cache/ContentTypeHandler.php +++ b/src/lib/Persistence/Cache/ContentTypeHandler.php @@ -51,13 +51,13 @@ class ContentTypeHandler extends AbstractInMemoryPersistenceHandler implements C */ protected function init(): void { - $this->getGroupTags = function (Type\Group $group) { + $this->getGroupTags = function (Type\Group $group): array { return [ $this->cacheIdentifierGenerator->generateTag(self::TYPE_GROUP_IDENTIFIER, [$group->id]), ]; }; - $this->getGroupKeys = function (Type\Group $group) { + $this->getGroupKeys = function (Type\Group $group): array { return [ $this->cacheIdentifierGenerator->generateKey(self::CONTENT_TYPE_GROUP_IDENTIFIER, [$group->id]), $this->cacheIdentifierGenerator->generateKey( @@ -68,13 +68,13 @@ protected function init(): void ]; }; - $this->getTypeTags = function (Type $type) { + $this->getTypeTags = function (Type $type): array { return [ $this->cacheIdentifierGenerator->generateTag(self::TYPE_IDENTIFIER), // For use by deleteByUserAndStatus() as it currently lacks return value for affected type ids $this->cacheIdentifierGenerator->generateTag(self::TYPE_IDENTIFIER, [$type->id]), ]; }; - $this->getTypeKeys = function (Type $type, int $status = Type::STATUS_DEFINED) { + $this->getTypeKeys = function (Type $type, int $status = Type::STATUS_DEFINED): array { return [ $this->cacheIdentifierGenerator->generateKey(self::CONTENT_TYPE_IDENTIFIER, [$type->id], true), $this->cacheIdentifierGenerator->generateKey(self::CONTENT_TYPE_IDENTIFIER, [$type->id], true) . '-' . $status, @@ -160,7 +160,7 @@ function ($groupId) { /** * {@inheritdoc} */ - public function loadGroups(array $groupIds) + public function loadGroups(array $groupIds): array { return $this->getMultipleCacheValues( $groupIds, @@ -224,7 +224,7 @@ function () use ($groupId, $status) { $this->getTypeTags, $this->getTypeKeys, // Add tag in case of empty list - function () use ($groupId) { + function () use ($groupId): array { return [ $this->cacheIdentifierGenerator->generateTag(self::TYPE_GROUP_IDENTIFIER, [$groupId]), ]; @@ -528,7 +528,7 @@ public function removeFieldDefinition( /** * {@inheritdoc} */ - public function updateFieldDefinition($typeId, $status, FieldDefinition $struct) + public function updateFieldDefinition($typeId, $status, FieldDefinition $struct): void { $this->logger->logCall(__METHOD__, ['type' => $typeId, 'status' => $status, 'struct' => $struct]); $this->persistenceHandler->contentTypeHandler()->updateFieldDefinition( @@ -549,7 +549,7 @@ public function updateFieldDefinition($typeId, $status, FieldDefinition $struct) /** * {@inheritdoc} */ - public function publish($typeId) + public function publish($typeId): void { $this->logger->logCall(__METHOD__, ['type' => $typeId]); $this->persistenceHandler->contentTypeHandler()->publish($typeId); @@ -587,9 +587,9 @@ public function getSearchableFieldMap() function () { return $this->persistenceHandler->contentTypeHandler()->getSearchableFieldMap(); }, - static function () {return [];}, - static function () {return [];}, - function () { + static function (): array {return [];}, + static function (): array {return [];}, + function (): array { return [ $this->cacheIdentifierGenerator->generateTag(self::TYPE_MAP_IDENTIFIER), ]; diff --git a/src/lib/Persistence/Cache/Handler.php b/src/lib/Persistence/Cache/Handler.php index 36b225a107..2bd9448e12 100644 --- a/src/lib/Persistence/Cache/Handler.php +++ b/src/lib/Persistence/Cache/Handler.php @@ -32,59 +32,41 @@ */ class Handler implements PersistenceHandlerInterface { - /** @var \Ibexa\Contracts\Core\Persistence\Handler */ - protected $persistenceHandler; + protected PersistenceHandlerInterface $persistenceHandler; - /** @var \Ibexa\Core\Persistence\Cache\SectionHandler */ - protected $sectionHandler; + protected CacheSectionHandler $sectionHandler; - /** @var \Ibexa\Core\Persistence\Cache\ContentHandler */ - protected $contentHandler; + protected CacheContentHandler $contentHandler; - /** @var \Ibexa\Core\Persistence\Cache\ContentLanguageHandler */ - protected $contentLanguageHandler; + protected CacheContentLanguageHandler $contentLanguageHandler; - /** @var \Ibexa\Core\Persistence\Cache\ContentTypeHandler */ - protected $contentTypeHandler; + protected CacheContentTypeHandler $contentTypeHandler; - /** @var \Ibexa\Core\Persistence\Cache\LocationHandler */ - protected $locationHandler; + protected CacheLocationHandler $locationHandler; - /** @var \Ibexa\Core\Persistence\Cache\UserHandler */ - protected $userHandler; + protected CacheUserHandler $userHandler; - /** @var \Ibexa\Core\Persistence\Cache\TrashHandler */ - protected $trashHandler; + protected CacheTrashHandler $trashHandler; - /** @var \Ibexa\Core\Persistence\Cache\UrlAliasHandler */ - protected $urlAliasHandler; + protected CacheUrlAliasHandler $urlAliasHandler; - /** @var \Ibexa\Core\Persistence\Cache\ObjectStateHandler */ - protected $objectStateHandler; + protected CacheObjectStateHandler $objectStateHandler; - /** @var \Ibexa\Core\Persistence\Cache\TransactionHandler */ - protected $transactionHandler; + protected CacheTransactionHandler $transactionHandler; - /** @var \Ibexa\Core\Persistence\Cache\URLHandler */ - protected $urlHandler; + protected CacheUrlHandler $urlHandler; - /** @var \Ibexa\Core\Persistence\Cache\BookmarkHandler */ - protected $bookmarkHandler; + protected CacheBookmarkHandler $bookmarkHandler; - /** @var \Ibexa\Core\Persistence\Cache\NotificationHandler */ - protected $notificationHandler; + protected CacheNotificationHandler $notificationHandler; - /** @var \Ibexa\Core\Persistence\Cache\UserPreferenceHandler */ - protected $userPreferenceHandler; + protected CacheUserPreferenceHandler $userPreferenceHandler; - /** @var \Ibexa\Core\Persistence\Cache\UrlWildcardHandler */ - private $urlWildcardHandler; + private CacheUrlWildcardHandler $urlWildcardHandler; - /** @var \Ibexa\Core\Persistence\Cache\PersistenceLogger */ - protected $logger; + protected PersistenceLogger $logger; - /** @var \Ibexa\Core\Persistence\Cache\SettingHandler */ - private $settingHandler; + private SettingHandler $settingHandler; public function __construct( PersistenceHandlerInterface $persistenceHandler, diff --git a/src/lib/Persistence/Cache/Identifier/CacheIdentifierGenerator.php b/src/lib/Persistence/Cache/Identifier/CacheIdentifierGenerator.php index f0b0233922..323b860803 100644 --- a/src/lib/Persistence/Cache/Identifier/CacheIdentifierGenerator.php +++ b/src/lib/Persistence/Cache/Identifier/CacheIdentifierGenerator.php @@ -22,14 +22,13 @@ final class CacheIdentifierGenerator implements CacheIdentifierGeneratorInterfac use LoggerAwareTrait; - /** @var string */ - private $prefix; + private string $prefix; /** @var array */ - private $tagPatterns; + private array $tagPatterns; /** @var array */ - private $keyPatterns; + private array $keyPatterns; public function __construct(string $prefix, array $tagPatterns, array $keyPatterns) { diff --git a/src/lib/Persistence/Cache/InMemory/InMemoryCache.php b/src/lib/Persistence/Cache/InMemory/InMemoryCache.php index f9fb3bbe4f..8b1a1ecfad 100644 --- a/src/lib/Persistence/Cache/InMemory/InMemoryCache.php +++ b/src/lib/Persistence/Cache/InMemory/InMemoryCache.php @@ -27,13 +27,13 @@ class InMemoryCache { /** @var float Cache Time to Live, in seconds. This is only for how long we keep cache object around in-memory. */ - private $ttl; + private int|float $ttl; /** @var int The limit of objects in cache pool at a given time */ - private $limit; + private int $limit; /** @var bool Switch for enabeling/disabling in-memory cache */ - private $enabled; + private bool $enabled; /** * Cache objects by primary key. @@ -46,14 +46,14 @@ class InMemoryCache private $cacheExpiryTime = []; /** @var int[] Access counter for individual cache (by primary key), to order by by popularity on vacuum(). */ - private $cacheAccessCount = []; + private array $cacheAccessCount = []; /** * Mapping of secondary index to primary key. * * @var string[] */ - private $cacheIndex = []; + private array $cacheIndex = []; /** * In Memory Cache constructor. diff --git a/src/lib/Persistence/Cache/LocationHandler.php b/src/lib/Persistence/Cache/LocationHandler.php index c049e15aa2..9707bcfb97 100644 --- a/src/lib/Persistence/Cache/LocationHandler.php +++ b/src/lib/Persistence/Cache/LocationHandler.php @@ -46,7 +46,7 @@ protected function init(): void return $tags; }; - $this->getLocationKeys = function (Location $location, $keySuffix = '-1') { + $this->getLocationKeys = function (Location $location, string $keySuffix = '-1'): array { return [ $this->cacheIdentifierGenerator->generateKey(self::LOCATION_IDENTIFIER, [$location->id], true) . $keySuffix, $this->cacheIdentifierGenerator->generateKey( @@ -364,7 +364,7 @@ public function swap($locationId1, $locationId2) /** * {@inheritdoc} */ - public function update(UpdateStruct $struct, $locationId) + public function update(UpdateStruct $struct, $locationId): void { $this->logger->logCall(__METHOD__, ['location' => $locationId, 'struct' => $struct]); $this->persistenceHandler->locationHandler()->update($struct, $locationId); @@ -424,7 +424,7 @@ public function deleteChildrenDrafts(int $locationId): void /** * {@inheritdoc} */ - public function setSectionForSubtree($locationId, $sectionId) + public function setSectionForSubtree($locationId, $sectionId): void { $this->logger->logCall(__METHOD__, ['location' => $locationId, 'section' => $sectionId]); $this->persistenceHandler->locationHandler()->setSectionForSubtree($locationId, $sectionId); @@ -437,7 +437,7 @@ public function setSectionForSubtree($locationId, $sectionId) /** * {@inheritdoc} */ - public function changeMainLocation($contentId, $locationId) + public function changeMainLocation($contentId, $locationId): void { $this->logger->logCall(__METHOD__, ['location' => $locationId, 'content' => $contentId]); $this->persistenceHandler->locationHandler()->changeMainLocation($contentId, $locationId); diff --git a/src/lib/Persistence/Cache/ObjectStateHandler.php b/src/lib/Persistence/Cache/ObjectStateHandler.php index a1dd875ecb..b4027cbe4c 100644 --- a/src/lib/Persistence/Cache/ObjectStateHandler.php +++ b/src/lib/Persistence/Cache/ObjectStateHandler.php @@ -61,7 +61,7 @@ function () use ($groupId): array { $this->cacheIdentifierGenerator->generateTag(self::STATE_GROUP_IDENTIFIER, [(int) $groupId]), ]; }, - function () use ($groupId) { + function () use ($groupId): array { return [ $this->cacheIdentifierGenerator->generateKey(self::STATE_GROUP_IDENTIFIER, [(int) $groupId], true), ]; diff --git a/src/lib/Persistence/Cache/PersistenceLogger.php b/src/lib/Persistence/Cache/PersistenceLogger.php index 88e427a153..af7d5c4328 100644 --- a/src/lib/Persistence/Cache/PersistenceLogger.php +++ b/src/lib/Persistence/Cache/PersistenceLogger.php @@ -23,8 +23,7 @@ class PersistenceLogger 'memory' => 0, ]; - /** @var bool */ - protected $logCalls = true; + protected bool $logCalls; /** @var array */ protected $calls = []; @@ -131,7 +130,7 @@ public function logCacheHit(array $arguments = [], int $traceOffset = 2, bool $i * @param array $trimmedBacktrace * @param string $type */ - private function collectCacheCallData($method, array $arguments, array $trimmedBacktrace, string $type): void + private function collectCacheCallData(string $method, array $arguments, array $trimmedBacktrace, string $type): void { // simplest/fastests hash possible to identify if we have already collected this before to save on memory use $callHash = \hash('adler32', $method . \serialize($arguments)); diff --git a/src/lib/Persistence/Cache/TransactionHandler.php b/src/lib/Persistence/Cache/TransactionHandler.php index 5c730f08f1..8878c1e8a8 100644 --- a/src/lib/Persistence/Cache/TransactionHandler.php +++ b/src/lib/Persistence/Cache/TransactionHandler.php @@ -17,7 +17,7 @@ class TransactionHandler extends AbstractInMemoryPersistenceHandler implements T /** * {@inheritdoc} */ - public function beginTransaction() + public function beginTransaction(): void { $this->cache->beginTransaction(); @@ -28,7 +28,7 @@ public function beginTransaction() /** * {@inheritdoc} */ - public function commit() + public function commit(): void { $this->logger->logCall(__METHOD__); $this->persistenceHandler->transactionHandler()->commit(); @@ -39,7 +39,7 @@ public function commit() /** * {@inheritdoc} */ - public function rollback() + public function rollback(): void { $this->logger->logCall(__METHOD__); $this->persistenceHandler->transactionHandler()->rollback(); diff --git a/src/lib/Persistence/Cache/TrashHandler.php b/src/lib/Persistence/Cache/TrashHandler.php index f9a870ef0d..e7912d0262 100644 --- a/src/lib/Persistence/Cache/TrashHandler.php +++ b/src/lib/Persistence/Cache/TrashHandler.php @@ -47,7 +47,7 @@ public function trashSubtree($locationId) $relationTags = []; if (!empty($reverseRelations)) { - $relationTags = array_map(function (Relation $relation) { + $relationTags = array_map(function (Relation $relation): string { return $this->cacheIdentifierGenerator->generateTag( self::CONTENT_IDENTIFIER, [$relation->destinationContentId] @@ -89,7 +89,7 @@ public function recover($trashedId, $newParentId) $relationTags = []; if (!empty($reverseRelations)) { - $relationTags = array_map(function (Relation $relation) { + $relationTags = array_map(function (Relation $relation): string { return $this->cacheIdentifierGenerator->generateTag(self::CONTENT_IDENTIFIER, [$relation->destinationContentId]); }, $reverseRelations); } @@ -165,7 +165,7 @@ public function deleteTrashItem($trashedId) $reverseRelations = $this->persistenceHandler->contentHandler()->loadReverseRelations($trashed->contentId); - $relationTags = array_map(function (Relation $relation) { + $relationTags = array_map(function (Relation $relation): string { return $this->cacheIdentifierGenerator->generateTag(self::CONTENT_IDENTIFIER, [$relation->sourceContentId]); }, $reverseRelations); diff --git a/src/lib/Persistence/Cache/URLHandler.php b/src/lib/Persistence/Cache/URLHandler.php index b06b007be8..7848238cc0 100644 --- a/src/lib/Persistence/Cache/URLHandler.php +++ b/src/lib/Persistence/Cache/URLHandler.php @@ -8,6 +8,7 @@ namespace Ibexa\Core\Persistence\Cache; use Ibexa\Contracts\Core\Persistence\URL\Handler as URLHandlerInterface; +use Ibexa\Contracts\Core\Persistence\URL\URL; use Ibexa\Contracts\Core\Persistence\URL\URLUpdateStruct; use Ibexa\Contracts\Core\Repository\Values\URL\URLQuery; @@ -33,7 +34,7 @@ public function updateUrl($id, URLUpdateStruct $struct) ]); if ($struct->url !== null) { - $this->cache->invalidateTags(array_map(function ($id) { + $this->cache->invalidateTags(array_map(function ($id): string { return $this->cacheIdentifierGenerator->generateTag(self::CONTENT_IDENTIFIER, [$id]); }, $this->persistenceHandler->urlHandler()->findUsages($id))); } @@ -82,7 +83,7 @@ public function loadById($id) /** * {@inheritdoc} */ - public function loadByUrl($url) + public function loadByUrl($url): URL { $this->logger->logCall(__METHOD__, ['url' => $url]); diff --git a/src/lib/Persistence/Cache/UrlAliasHandler.php b/src/lib/Persistence/Cache/UrlAliasHandler.php index cc04b866fa..661c6e3589 100644 --- a/src/lib/Persistence/Cache/UrlAliasHandler.php +++ b/src/lib/Persistence/Cache/UrlAliasHandler.php @@ -176,8 +176,8 @@ function (UrlAlias $alias) { return $tags; }, - static function () { return []; }, - function () use ($locationId) { + static function (): array { return []; }, + function () use ($locationId): array { return [ $this->cacheIdentifierGenerator->generateTag(self::URL_ALIAS_LOCATION_IDENTIFIER, [$locationId]), ]; @@ -394,7 +394,7 @@ public function locationSwapped($location1Id, $location1ParentId, $location2Id, /** * {@inheritdoc} */ - public function translationRemoved(array $locationIds, $languageCode) + public function translationRemoved(array $locationIds, $languageCode): void { $this->logger->logCall( __METHOD__, @@ -415,7 +415,7 @@ public function translationRemoved(array $locationIds, $languageCode) /** * {@inheritdoc} */ - public function archiveUrlAliasesForDeletedTranslations($locationId, $parentLocationId, array $languageCodes) + public function archiveUrlAliasesForDeletedTranslations($locationId, $parentLocationId, array $languageCodes): void { $this->logger->logCall( __METHOD__, @@ -448,7 +448,7 @@ public function archiveUrlAliasesForDeletedTranslations($locationId, $parentLoca * * @return array */ - private function getCacheTags(UrlAlias $urlAlias, array $tags = []) + private function getCacheTags(UrlAlias $urlAlias, array $tags = []): array { $tags[] = $this->cacheIdentifierGenerator->generateTag(self::URL_ALIAS_IDENTIFIER, [$urlAlias->id]); @@ -493,7 +493,7 @@ public function deleteCorruptedUrlAliases() * @throws \Ibexa\Core\Base\Exceptions\BadStateException * @throws \Psr\Cache\InvalidArgumentException */ - public function repairBrokenUrlAliasesForLocation(int $locationId) + public function repairBrokenUrlAliasesForLocation(int $locationId): void { $this->logger->logCall(__METHOD__, ['locationId' => $locationId]); diff --git a/src/lib/Persistence/Cache/UrlWildcardHandler.php b/src/lib/Persistence/Cache/UrlWildcardHandler.php index 6eeb976552..8c347dae4d 100644 --- a/src/lib/Persistence/Cache/UrlWildcardHandler.php +++ b/src/lib/Persistence/Cache/UrlWildcardHandler.php @@ -81,7 +81,7 @@ public function update( return $urlWildcard; } - public function remove($id) + public function remove($id): void { $this->logger->logCall(__METHOD__, ['id' => $id]); diff --git a/src/lib/Persistence/Cache/UserHandler.php b/src/lib/Persistence/Cache/UserHandler.php index 744fc53cf5..a242e0c3d7 100644 --- a/src/lib/Persistence/Cache/UserHandler.php +++ b/src/lib/Persistence/Cache/UserHandler.php @@ -68,13 +68,13 @@ class UserHandler extends AbstractInMemoryPersistenceHandler implements UserHand */ public function init(): void { - $this->getUserTags = function (User $user) { + $this->getUserTags = function (User $user): array { return [ $this->cacheIdentifierGenerator->generateTag(self::CONTENT_IDENTIFIER, [$user->id]), $this->cacheIdentifierGenerator->generateTag(self::USER_IDENTIFIER, [$user->id]), ]; }; - $this->getUserKeys = function (User $user) { + $this->getUserKeys = function (User $user): array { return [ $this->cacheIdentifierGenerator->generateKey(self::USER_IDENTIFIER, [$user->id], true), $this->cacheIdentifierGenerator->generateKey( @@ -89,12 +89,12 @@ public function init(): void ), ]; }; - $this->getRoleTags = function (Role $role) { + $this->getRoleTags = function (Role $role): array { return [ $this->cacheIdentifierGenerator->generateTag(self::ROLE_IDENTIFIER, [$role->id]), ]; }; - $this->getRoleKeys = function (Role $role) { + $this->getRoleKeys = function (Role $role): array { return [ $this->cacheIdentifierGenerator->generateKey(self::ROLE_IDENTIFIER, [$role->id], true), $this->cacheIdentifierGenerator->generateKey( @@ -104,14 +104,14 @@ public function init(): void ), ]; }; - $this->getRoleAssignmentTags = function (RoleAssignment $roleAssignment) { + $this->getRoleAssignmentTags = function (RoleAssignment $roleAssignment): array { return [ $this->cacheIdentifierGenerator->generateTag(self::ROLE_ASSIGNMENT_IDENTIFIER, [$roleAssignment->id]), $this->cacheIdentifierGenerator->generateTag(self::ROLE_ASSIGNMENT_GROUP_LIST_IDENTIFIER, [$roleAssignment->contentId]), $this->cacheIdentifierGenerator->generateTag(self::ROLE_ASSIGNMENT_ROLE_LIST_IDENTIFIER, [$roleAssignment->roleId]), ]; }; - $this->getRoleAssignmentKeys = function (RoleAssignment $roleAssignment) { + $this->getRoleAssignmentKeys = function (RoleAssignment $roleAssignment): array { return [ $this->cacheIdentifierGenerator->generateKey(self::ROLE_ASSIGNMENT_IDENTIFIER, [$roleAssignment->id], true), ]; @@ -121,7 +121,7 @@ public function init(): void /** * {@inheritdoc} */ - public function create(User $user) + public function create(User $user): User { $this->logger->logCall(__METHOD__, ['struct' => $user]); @@ -259,7 +259,7 @@ function (User $user) use ($hash, $getUserKeysFn) { /** * {@inheritdoc} */ - public function update(User $user) + public function update(User $user): User { $this->logger->logCall(__METHOD__, ['struct' => $user]); @@ -355,7 +355,7 @@ public function expireUserToken($hash) /** * {@inheritdoc} */ - public function delete($userId) + public function delete($userId): void { $this->logger->logCall(__METHOD__, ['user' => $userId]); @@ -487,7 +487,7 @@ function () use ($roleId) { $this->getRoleAssignmentTags, $this->getRoleAssignmentKeys, /* Role update (policies) changes role assignment id, also need list tag in case of empty result */ - function () use ($roleId) { + function () use ($roleId): array { return [ $this->cacheIdentifierGenerator->generateTag(self::ROLE_ASSIGNMENT_ROLE_LIST_IDENTIFIER, [$roleId]), $this->cacheIdentifierGenerator->generateTag(self::ROLE_IDENTIFIER, [$roleId]), @@ -585,7 +585,7 @@ function () use ($groupId, $innerHandler) { /** * {@inheritdoc} */ - public function updateRole(RoleUpdateStruct $struct) + public function updateRole(RoleUpdateStruct $struct): void { $this->logger->logCall(__METHOD__, ['struct' => $struct]); $this->persistenceHandler->userHandler()->updateRole($struct); @@ -677,7 +677,7 @@ public function updatePolicy(Policy $policy) /** * {@inheritdoc} */ - public function deletePolicy($policyId, $roleId) + public function deletePolicy($policyId, $roleId): void { $this->logger->logCall(__METHOD__, ['policy' => $policyId]); $this->persistenceHandler->userHandler()->deletePolicy($policyId, $roleId); diff --git a/src/lib/Persistence/Cache/UserPreferenceHandler.php b/src/lib/Persistence/Cache/UserPreferenceHandler.php index d1ad67fb07..0c3e416473 100644 --- a/src/lib/Persistence/Cache/UserPreferenceHandler.php +++ b/src/lib/Persistence/Cache/UserPreferenceHandler.php @@ -76,10 +76,10 @@ function ($userId) use ($name) { return self::NOT_FOUND; } }, - static function () { + static function (): array { return []; }, - function () use ($userId, $name) { + function () use ($userId, $name): array { return [ $this->cacheIdentifierGenerator->generateKey( self::USER_PREFERENCE_WITH_SUFFIX_IDENTIFIER, diff --git a/src/lib/Persistence/FieldType.php b/src/lib/Persistence/FieldType.php index c71152ebe2..604fafadda 100644 --- a/src/lib/Persistence/FieldType.php +++ b/src/lib/Persistence/FieldType.php @@ -20,10 +20,8 @@ class FieldType implements FieldTypeInterface { /** * Holds internal FieldType object. - * - * @var \Ibexa\Contracts\Core\FieldType\FieldType */ - protected $internalFieldType; + protected SPIFieldType $internalFieldType; /** * Creates a new FieldType object. diff --git a/src/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabase.php index 3a85904f3b..ef9c392252 100644 --- a/src/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabase.php @@ -24,8 +24,7 @@ class DoctrineDatabase extends Gateway public const COLUMN_LOCATION_ID = 'node_id'; public const COLUMN_NAME = 'name'; - /** @var \Doctrine\DBAL\Connection */ - protected $connection; + protected Connection $connection; public function __construct(Connection $connection) { diff --git a/src/lib/Persistence/Legacy/Bookmark/Gateway/ExceptionConversion.php b/src/lib/Persistence/Legacy/Bookmark/Gateway/ExceptionConversion.php index 1abc88bbb7..70bdaf18ae 100644 --- a/src/lib/Persistence/Legacy/Bookmark/Gateway/ExceptionConversion.php +++ b/src/lib/Persistence/Legacy/Bookmark/Gateway/ExceptionConversion.php @@ -17,10 +17,7 @@ class ExceptionConversion extends Gateway { - /** - * @var \Ibexa\Core\Persistence\Legacy\Bookmark\Gateway - */ - protected $innerGateway; + protected Gateway $innerGateway; /** * @param \Ibexa\Core\Persistence\Legacy\Bookmark\Gateway $innerGateway diff --git a/src/lib/Persistence/Legacy/Bookmark/Handler.php b/src/lib/Persistence/Legacy/Bookmark/Handler.php index 577de5ea55..3e74bedf2b 100644 --- a/src/lib/Persistence/Legacy/Bookmark/Handler.php +++ b/src/lib/Persistence/Legacy/Bookmark/Handler.php @@ -18,11 +18,9 @@ */ class Handler implements HandlerInterface { - /** @var \Ibexa\Core\Persistence\Legacy\Bookmark\Gateway */ - private $gateway; + private Gateway $gateway; - /** @var \Ibexa\Core\Persistence\Legacy\Bookmark\Mapper */ - private $mapper; + private Mapper $mapper; /** * Handler constructor. diff --git a/src/lib/Persistence/Legacy/Content/FieldHandler.php b/src/lib/Persistence/Legacy/Content/FieldHandler.php index 62e68c3139..a300895a9e 100644 --- a/src/lib/Persistence/Legacy/Content/FieldHandler.php +++ b/src/lib/Persistence/Legacy/Content/FieldHandler.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Persistence\Content; use Ibexa\Contracts\Core\Persistence\Content\Field; +use Ibexa\Contracts\Core\Persistence\Content\Language\Handler; use Ibexa\Contracts\Core\Persistence\Content\Language\Handler as LanguageHandler; use Ibexa\Contracts\Core\Persistence\Content\Type; use Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition; @@ -23,34 +24,26 @@ class FieldHandler { /** * Content Gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Gateway */ - protected $contentGateway; + protected Gateway $contentGateway; /** @var \Ibexa\Core\Persistence\Legacy\Content\Language\Handler */ - protected $languageHandler; + protected Handler $languageHandler; /** * Content Mapper. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Mapper */ - protected $mapper; + protected Mapper $mapper; /** * Storage Handler. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\StorageHandler */ - protected $storageHandler; + protected StorageHandler $storageHandler; /** * FieldType registry. - * - * @var \Ibexa\Core\Persistence\FieldTypeRegistry */ - protected $fieldTypeRegistry; + protected FieldTypeRegistry $fieldTypeRegistry; /** * Hash of SPI FieldTypes or callable callbacks to generate one. @@ -88,7 +81,7 @@ public function __construct( * @param \Ibexa\Contracts\Core\Persistence\Content $content * @param \Ibexa\Contracts\Core\Persistence\Content\Type $contentType */ - public function createNewFields(Content $content, Type $contentType) + public function createNewFields(Content $content, Type $contentType): void { $fieldsToCopy = []; $languageCodes = []; @@ -130,7 +123,7 @@ public function createNewFields(Content $content, Type $contentType) * * @return \Ibexa\Contracts\Core\Persistence\Content\Field */ - protected function getEmptyField(FieldDefinition $fieldDefinition, $languageCode) + protected function getEmptyField(FieldDefinition $fieldDefinition, $languageCode): Field { $fieldType = $this->fieldTypeRegistry->getFieldType($fieldDefinition->fieldType); @@ -302,7 +295,7 @@ protected function createExistingFieldInNewVersion(Field $field, Content $conten * * @param \Ibexa\Contracts\Core\Persistence\Content $content */ - public function loadExternalFieldData(Content $content) + public function loadExternalFieldData(Content $content): void { foreach ($content->fields as $field) { $this->storageHandler->getFieldData($content->versionInfo, $field); @@ -316,7 +309,7 @@ public function loadExternalFieldData(Content $content) * @param \Ibexa\Contracts\Core\Persistence\Content\UpdateStruct $updateStruct * @param \Ibexa\Contracts\Core\Persistence\Content\Type $contentType */ - public function updateFields(Content $content, UpdateStruct $updateStruct, Type $contentType) + public function updateFields(Content $content, UpdateStruct $updateStruct, Type $contentType): void { $updatedFields = []; $fieldsToCopy = []; @@ -427,7 +420,7 @@ protected function updateCopiedField(Field $field, Field $updateField, Field $or * * @return array> */ - protected function getFieldMap(array $fields, &$languageCodes = null) + protected function getFieldMap(array $fields, &$languageCodes = null): array { $fieldMap = []; foreach ($fields as $field) { @@ -446,7 +439,7 @@ protected function getFieldMap(array $fields, &$languageCodes = null) * @param int $contentId * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo */ - public function deleteFields($contentId, VersionInfo $versionInfo) + public function deleteFields(int $contentId, VersionInfo $versionInfo): void { foreach ($this->contentGateway->getFieldIdsByType($contentId, $versionInfo->versionNo) as $fieldType => $ids) { $this->storageHandler->deleteFieldData($fieldType, $versionInfo, $ids); @@ -461,7 +454,7 @@ public function deleteFields($contentId, VersionInfo $versionInfo) * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo[] $versions * @param string $languageCode */ - public function deleteTranslationFromContentFields($contentId, array $versions, $languageCode) + public function deleteTranslationFromContentFields(int $contentId, array $versions, ?string $languageCode): void { foreach ($versions as $versionInfo) { // FT-specific implementations require VersionInfo to delete data @@ -485,7 +478,7 @@ public function deleteTranslationFromContentFields($contentId, array $versions, * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo * @param string $languageCode */ - public function deleteTranslationFromVersionFields(VersionInfo $versionInfo, $languageCode) + public function deleteTranslationFromVersionFields(VersionInfo $versionInfo, ?string $languageCode): void { $fieldTypeIdsMap = $this->contentGateway->getFieldIdsByType( $versionInfo->contentInfo->id, diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorConverter.php index 41c1191cfa..b86497b221 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorConverter.php @@ -23,7 +23,7 @@ class AuthorConverter implements Converter * @throws \DOMException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->dataText = $this->generateXmlString($value->data); $storageFieldValue->sortKeyString = $value->sortKey; @@ -35,7 +35,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { $fieldValue->data = $this->restoreValueFromXmlString($value->dataText); $fieldValue->sortKey = $value->sortKeyString; @@ -47,7 +47,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { $fieldSettings = $fieldDef->fieldTypeConstraints->fieldSettings; @@ -62,7 +62,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { $fieldDef->fieldTypeConstraints->fieldSettings = new FieldSettings( [ @@ -138,7 +138,7 @@ private function generateXmlString(array $authorValue): string * * @return \Ibexa\Core\FieldType\Author\Value[] */ - private function restoreValueFromXmlString($xmlString) + private function restoreValueFromXmlString($xmlString): array { $dom = new DOMDocument('1.0', 'utf-8'); $authors = []; diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/BinaryFileConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/BinaryFileConverter.php index abff8b5d0b..8e55da3cd6 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/BinaryFileConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/BinaryFileConverter.php @@ -42,7 +42,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { $storageDef->dataInt1 = (isset($fieldDef->fieldTypeConstraints->validators['FileSizeValidator']['maxFileSize']) ? $fieldDef->fieldTypeConstraints->validators['FileSizeValidator']['maxFileSize'] @@ -55,7 +55,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { $fieldDef->fieldTypeConstraints = new FieldTypeConstraints( [ @@ -79,7 +79,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * * @return string */ - public function getIndexColumn() + public function getIndexColumn(): string { // @todo: Correct? return 'sort_key_string'; diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/CheckboxConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/CheckboxConverter.php index 190cdcc718..d016367b3b 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/CheckboxConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/CheckboxConverter.php @@ -21,7 +21,7 @@ class CheckboxConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->dataInt = (int)$value->data; $storageFieldValue->sortKeyInt = (int)$value->data; @@ -33,7 +33,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { $fieldValue->data = (bool)$value->dataInt; $fieldValue->sortKey = $value->dataInt; @@ -45,7 +45,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { $storageDef->dataInt3 = (int)$fieldDef->defaultValue->data; } @@ -56,7 +56,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { $fieldDef->defaultValue->data = !empty($storageDef->dataInt3) ? (bool)$storageDef->dataInt3 : false; } diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/CountryConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/CountryConverter.php index 2b7e29904e..fad035d77d 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/CountryConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/CountryConverter.php @@ -22,7 +22,7 @@ class CountryConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->dataText = empty($value->data) ? '' : implode(',', $value->data); $storageFieldValue->sortKeyString = $value->sortKey; @@ -34,7 +34,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { $fieldValue->data = empty($value->dataText) ? null : explode(',', $value->dataText); $fieldValue->sortKey = $value->sortKeyString; @@ -46,7 +46,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { if (isset($fieldDef->fieldTypeConstraints->fieldSettings['isMultiple'])) { $storageDef->dataInt1 = (int)$fieldDef->fieldTypeConstraints->fieldSettings['isMultiple']; @@ -63,7 +63,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { $fieldDef->fieldTypeConstraints->fieldSettings = new FieldSettings( [ diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeConverter.php index 55d5e1cd09..70ad290e07 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeConverter.php @@ -28,7 +28,7 @@ class DateAndTimeConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { // @todo: One should additionally store the timezone here. This could // be done in a backwards compatible way, I think… @@ -42,7 +42,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { if ($value->dataInt === null) { return; @@ -61,7 +61,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { $fieldSettings = $fieldDef->fieldTypeConstraints->fieldSettings; if ($fieldSettings === null) { @@ -82,7 +82,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { $useSeconds = (bool)$storageDef->dataInt2; $dateInterval = $this->getDateIntervalFromXML($storageDef->dataText5); diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateConverter.php index 9e4b6307c1..44c10c3913 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/DateConverter.php @@ -26,7 +26,7 @@ class DateConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->dataInt = ($value->data !== null ? $value->data['timestamp'] : null); $storageFieldValue->sortKeyInt = (int)$value->sortKey; @@ -38,7 +38,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { if ($value->dataInt === null || $value->dataInt == 0) { return; @@ -57,7 +57,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { $storageDef->dataInt1 = $fieldDef->fieldTypeConstraints->fieldSettings['defaultType'] ?? null; } @@ -68,7 +68,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { $fieldDef->fieldTypeConstraints->fieldSettings = new FieldSettings( [ diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/EmailAddressConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/EmailAddressConverter.php index 6157ab9293..579588d5a0 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/EmailAddressConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/EmailAddressConverter.php @@ -23,7 +23,7 @@ class EmailAddressConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->dataText = $value->data; $storageFieldValue->sortKeyString = $value->sortKey; @@ -35,7 +35,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { $fieldValue->data = $value->dataText; $fieldValue->sortKey = $value->sortKeyString; @@ -47,7 +47,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { $storageDef->dataText1 = $fieldDef->defaultValue->data; } @@ -58,7 +58,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { $validatorConstraints = [self::VALIDATOR_IDENTIFIER => []]; $fieldDef->fieldTypeConstraints->validators = $validatorConstraints; diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/FloatConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/FloatConverter.php index 191d3d8a06..46f65b5723 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/FloatConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/FloatConverter.php @@ -26,7 +26,7 @@ class FloatConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->dataFloat = $value->data; $storageFieldValue->sortKeyString = $value->sortKey; @@ -38,7 +38,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { $fieldValue->data = $value->dataFloat; $fieldValue->sortKey = $value->sortKeyString; @@ -50,7 +50,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { if (isset($fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['minFloatValue'])) { $storageDef->dataFloat1 = $fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['minFloatValue']; @@ -73,7 +73,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { $validatorParameters = ['minFloatValue' => null, 'maxFloatValue' => null]; if ($storageDef->dataFloat4 & self::HAS_MIN_VALUE) { diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ISBNConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ISBNConverter.php index 92f3721e49..872e38be8b 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ISBNConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ISBNConverter.php @@ -22,7 +22,7 @@ class ISBNConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->dataText = $value->data; $storageFieldValue->sortKeyString = $value->sortKey; @@ -34,7 +34,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { $fieldValue->data = $value->dataText; $fieldValue->sortKey = $value->sortKeyString; @@ -46,7 +46,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { if (isset($fieldDef->fieldTypeConstraints->fieldSettings['isISBN13'])) { $storageDef->dataInt1 = $fieldDef->fieldTypeConstraints->fieldSettings['isISBN13']; @@ -63,7 +63,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { $fieldDef->fieldTypeConstraints->fieldSettings = new FieldSettings( [ diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageAssetConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageAssetConverter.php index 9077569f3d..dcd9b73bba 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageAssetConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageAssetConverter.php @@ -22,7 +22,7 @@ class ImageAssetConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->dataInt = !empty($value->data['destinationContentId']) ? $value->data['destinationContentId'] @@ -39,7 +39,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { $fieldValue->data = [ 'destinationContentId' => $value->dataInt ?: null, diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php index c6f7d01b5f..1db23aff46 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php @@ -18,11 +18,9 @@ class ImageConverter extends BinaryFileConverter { - /** @var \Ibexa\Core\IO\IOServiceInterface */ - private $imageIoService; + private IOServiceInterface $imageIoService; - /** @var \Ibexa\Core\IO\UrlRedecoratorInterface */ - private $urlRedecorator; + private UrlRedecoratorInterface $urlRedecorator; public function __construct(IOServiceInterface $imageIoService, UrlRedecoratorInterface $urlRedecorator) { @@ -36,7 +34,7 @@ public function __construct(IOServiceInterface $imageIoService, UrlRedecoratorIn * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { if (isset($value->data)) { // Determine what needs to be stored @@ -60,7 +58,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * * @return string */ - protected function createEmptyLegacyXml($contentMetaData) + protected function createEmptyLegacyXml($contentMetaData): string { return $this->fillXml( array_merge( @@ -92,7 +90,7 @@ protected function createEmptyLegacyXml($contentMetaData) * * @return string */ - protected function createLegacyXml(array $data) + protected function createLegacyXml(array $data): string { $data['uri'] = $this->urlRedecorator->redecorateFromSource($data['uri']); $pathInfo = pathinfo($data['uri']); @@ -109,7 +107,7 @@ protected function createLegacyXml(array $data) * * @return string */ - protected function fillXml($imageData, $pathInfo, $timestamp): string + protected function fillXml($imageData, array $pathInfo, $timestamp): string { $additionalData = $this->buildAdditionalDataTag($imageData['additionalData'] ?? []); @@ -171,7 +169,7 @@ private function buildAdditionalDataTag(array $imageEditorData): string * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { if (empty($value->dataText)) { // Special case for anonymous user @@ -235,7 +233,7 @@ private function getFieldSettings(StorageFieldDefinition $storageFieldDefinition * * @return array */ - protected function parseLegacyXml($xml) + protected function parseLegacyXml($xml): ?array { $extractedData = []; diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/IntegerConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/IntegerConverter.php index e7ebb82364..9f4f6d576d 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/IntegerConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/IntegerConverter.php @@ -26,7 +26,7 @@ class IntegerConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->dataInt = $value->data; $storageFieldValue->sortKeyInt = (int)$value->sortKey; @@ -38,7 +38,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { $fieldValue->data = $value->dataInt; $fieldValue->sortKey = $value->sortKeyInt; @@ -50,7 +50,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { if (isset($fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['minIntegerValue'])) { $storageDef->dataInt1 = $fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['minIntegerValue']; @@ -79,7 +79,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { $validatorParameters = ['minIntegerValue' => null, 'maxIntegerValue' => null]; if ($storageDef->dataInt4 & self::HAS_MIN_VALUE) { diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/KeywordConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/KeywordConverter.php index 9d358a58be..ac834043b0 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/KeywordConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/KeywordConverter.php @@ -21,7 +21,7 @@ class KeywordConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->sortKeyString = $value->sortKey; } @@ -32,7 +32,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { $fieldValue->data = []; $fieldValue->sortKey = $value->sortKeyString; diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/MapLocationConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/MapLocationConverter.php index fa6fa7e9bd..62da184199 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/MapLocationConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/MapLocationConverter.php @@ -21,7 +21,7 @@ class MapLocationConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->dataInt = isset($value->externalData['address']) ? 1 : 0; $storageFieldValue->dataText = ''; diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/MediaConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/MediaConverter.php index eba013d5b4..eea5fdc87a 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/MediaConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/MediaConverter.php @@ -20,7 +20,7 @@ class MediaConverter extends BinaryFileConverter * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { parent::toStorageFieldDefinition($fieldDef, $storageDef); @@ -35,7 +35,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { parent::toFieldDefinition($storageDef, $fieldDef); $fieldDef->fieldTypeConstraints->fieldSettings = new FieldSettings( diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/NullConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/NullConverter.php index 20117f043c..6ef63daa2a 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/NullConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/NullConverter.php @@ -24,7 +24,7 @@ class NullConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { // There is no contained data. All data is external. So we just do // nothing here. @@ -36,7 +36,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { // There is no contained data. All data is external. So we just do // nothing here. @@ -48,7 +48,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { // There is no contained data. All data is external. So we just do // nothing here. @@ -60,7 +60,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { // There is no contained data. All data is external. So we just do // nothing here. diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationConverter.php index e33a3fbeaa..67310f1de8 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationConverter.php @@ -22,7 +22,7 @@ class RelationConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->dataInt = !empty($value->data['destinationContentId']) ? $value->data['destinationContentId'] @@ -36,7 +36,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { $fieldValue->data = [ 'destinationContentId' => $value->dataInt ?: null, @@ -50,7 +50,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { $fieldSettings = $fieldDef->fieldTypeConstraints->fieldSettings; $doc = new DOMDocument('1.0', 'utf-8'); @@ -118,7 +118,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { // default settings // use dataInt1 and dataInt2 fields as default for backward compatibility diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationListConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationListConverter.php index 9a3dc4a568..c2a11c67de 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationListConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationListConverter.php @@ -23,8 +23,7 @@ class RelationListConverter implements Converter { - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; public function __construct(Connection $connection) { @@ -34,7 +33,7 @@ public function __construct(Connection $connection) /** * Converts data from $value to $storageFieldValue. */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $doc = new DOMDocument('1.0', 'utf-8'); $root = $doc->createElement('related-objects'); @@ -76,7 +75,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel /** * Converts data from $value to $fieldValue. */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { $fieldValue->data = ['destinationContentIds' => []]; if ($value->dataText === null) { @@ -103,7 +102,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) /** * Converts field definition data in $fieldDef into $storageFieldDef. */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { $fieldSettings = $fieldDef->fieldTypeConstraints->fieldSettings; $validators = $fieldDef->fieldTypeConstraints->validators; @@ -186,7 +185,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * * */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { // default settings $fieldDef->fieldTypeConstraints->fieldSettings = [ @@ -276,7 +275,7 @@ public function getIndexColumn(): string * * @return array */ - protected function getRelationXmlHashFromDB(array $destinationContentIds) + protected function getRelationXmlHashFromDB(array $destinationContentIds): array { if (empty($destinationContentIds)) { return []; diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/SelectionConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/SelectionConverter.php index 202519d46a..efacb45f0e 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/SelectionConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/SelectionConverter.php @@ -23,7 +23,7 @@ class SelectionConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->sortKeyString = $storageFieldValue->dataText = $value->sortKey; } @@ -34,7 +34,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { if ($value->dataText !== '') { $fieldValue->data = array_map( @@ -53,7 +53,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { $fieldSettings = $fieldDef->fieldTypeConstraints->fieldSettings; @@ -87,7 +87,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { $options = []; $multiLingualOptions = [$fieldDef->mainLanguageCode => []]; diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/SerializableConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/SerializableConverter.php index 47770ed868..bb9ba1e720 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/SerializableConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/SerializableConverter.php @@ -18,8 +18,7 @@ final class SerializableConverter implements ConverterInterface { - /** @var \Ibexa\Contracts\Core\FieldType\ValueSerializerInterface */ - private $serializer; + private ValueSerializerInterface $serializer; public function __construct(ValueSerializerInterface $serializer) { diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextBlockConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextBlockConverter.php index fe4dba6bc9..2fd04b135a 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextBlockConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextBlockConverter.php @@ -22,7 +22,7 @@ class TextBlockConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->dataText = $value->data; $storageFieldValue->sortKeyString = $value->sortKey; @@ -34,7 +34,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { $fieldValue->data = $value->dataText; $fieldValue->sortKey = $value->sortKeyString; @@ -46,7 +46,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { if (isset($fieldDef->fieldTypeConstraints->fieldSettings['textRows'])) { $storageDef->dataInt1 = $fieldDef->fieldTypeConstraints->fieldSettings['textRows']; @@ -59,7 +59,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { $fieldDef->fieldTypeConstraints->fieldSettings = new FieldSettings( [ diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineConverter.php index a9a5a648dc..cfb5f5aaba 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineConverter.php @@ -23,7 +23,7 @@ class TextLineConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->dataText = $value->data; $storageFieldValue->sortKeyString = $value->sortKey; @@ -35,7 +35,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { $fieldValue->data = $value->dataText; $fieldValue->sortKey = $value->sortKeyString; @@ -47,7 +47,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { if (isset($fieldDef->fieldTypeConstraints->validators[self::STRING_LENGTH_VALIDATOR_IDENTIFIER]['maxStringLength'])) { $storageDef->dataInt1 = $fieldDef->fieldTypeConstraints->validators[self::STRING_LENGTH_VALIDATOR_IDENTIFIER]['maxStringLength']; @@ -70,7 +70,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { $validatorConstraints = []; diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TimeConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TimeConverter.php index 3a7923e1de..4a3537d83b 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TimeConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/TimeConverter.php @@ -27,7 +27,7 @@ class TimeConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->dataInt = $value->data; $storageFieldValue->sortKeyInt = (int)$value->sortKey; @@ -39,7 +39,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { if ($value->dataInt === null) { return; @@ -55,7 +55,7 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef */ - public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) + public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { $fieldSettings = $fieldDef->fieldTypeConstraints->fieldSettings; @@ -71,7 +71,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { $fieldDef->fieldTypeConstraints->fieldSettings = new FieldSettings( [ diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/UrlConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/UrlConverter.php index c2129ce808..1bbe63aa84 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/UrlConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/UrlConverter.php @@ -21,7 +21,7 @@ class UrlConverter implements Converter * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ - public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue) + public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { $storageFieldValue->dataText = isset($value->data['text']) ? $value->data['text'] @@ -37,7 +37,7 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue */ - public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue) + public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { $fieldValue->data = [ 'urlId' => $value->dataInt, @@ -62,7 +62,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef */ - public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef) + public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { // @todo: Is it possible to store a default value in the DB? $fieldDef->defaultValue = new FieldValue(); diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/ConverterRegistry.php b/src/lib/Persistence/Legacy/Content/FieldValue/ConverterRegistry.php index 4fee74e9ce..0b827ff8e3 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/ConverterRegistry.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/ConverterRegistry.php @@ -13,10 +13,8 @@ class ConverterRegistry { /** * Map of converters. - * - * @var array */ - protected $converterMap = []; + protected array $converterMap; /** * Create converter registry with converter map. @@ -43,7 +41,7 @@ public function __construct(array $converterMap = []) * @param string $typeName * @param mixed $converter Callable or converter instance */ - public function register($typeName, $converter) + public function register($typeName, $converter): void { $this->converterMap[$typeName] = $converter; } diff --git a/src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php index 4a9f41a1eb..4ca92bd6c7 100644 --- a/src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php @@ -18,6 +18,7 @@ use Ibexa\Contracts\Core\Persistence\Content\ContentInfo; use Ibexa\Contracts\Core\Persistence\Content\CreateStruct; use Ibexa\Contracts\Core\Persistence\Content\Field; +use Ibexa\Contracts\Core\Persistence\Content\Language\Handler; use Ibexa\Contracts\Core\Persistence\Content\Language\Handler as LanguageHandler; use Ibexa\Contracts\Core\Persistence\Content\MetadataUpdateStruct; use Ibexa\Contracts\Core\Persistence\Content\Relation\CreateStruct as RelationCreateStruct; @@ -30,6 +31,7 @@ use Ibexa\Core\Base\Exceptions\NotFoundException as NotFound; use Ibexa\Core\Persistence\Legacy\Content\Gateway; use Ibexa\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase\QueryBuilder; +use Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator; use Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator as LanguageMaskGenerator; use Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue; use Ibexa\Core\Persistence\Legacy\SharedGateway\Gateway as SharedGateway; @@ -54,34 +56,27 @@ final class DoctrineDatabase extends Gateway * The native Doctrine connection. * * Meant to be used to transition from eZ/Zeta interface to Doctrine. - * - * @var \Doctrine\DBAL\Connection */ - protected $connection; + protected Connection $connection; /** * Query builder. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Gateway\DoctrineDatabase\QueryBuilder */ - protected $queryBuilder; + protected QueryBuilder $queryBuilder; /** * Caching language handler. * * @var \Ibexa\Core\Persistence\Legacy\Content\Language\CachingHandler */ - protected $languageHandler; + protected Handler $languageHandler; /** * Language mask generator. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator */ - protected $languageMaskGenerator; + protected MaskGenerator $languageMaskGenerator; - /** @var \Ibexa\Core\Persistence\Legacy\SharedGateway\Gateway */ - private $sharedGateway; + private SharedGateway $sharedGateway; /** @var \Doctrine\DBAL\Platforms\AbstractPlatform */ private $databasePlatform; @@ -1897,7 +1892,7 @@ private function deleteTranslationFromContentNames( int $contentId, string $languageCode, ?int $versionNo = null - ) { + ): void { $query = $this->connection->createQueryBuilder(); $query ->delete('ezcontentobject_name') @@ -1929,7 +1924,7 @@ private function deleteTranslationFromContentNames( * * @throws \Ibexa\Core\Base\Exceptions\BadStateException */ - private function deleteTranslationFromContentObject($contentId, $languageId) + private function deleteTranslationFromContentObject(int $contentId, $languageId): void { $query = $this->connection->createQueryBuilder(); $query->update('ezcontentobject') @@ -1971,7 +1966,7 @@ private function deleteTranslationFromContentVersions( int $contentId, int $languageId, ?int $versionNo = null - ) { + ): void { $query = $this->connection->createQueryBuilder(); $query->update('ezcontentobject_version') // parameter for bitwise operation has to be placed verbatim (w/o binding) for this to work cross-DBMS diff --git a/src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase/QueryBuilder.php b/src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase/QueryBuilder.php index 5897c27b4f..df58d73348 100644 --- a/src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase/QueryBuilder.php +++ b/src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase/QueryBuilder.php @@ -18,8 +18,7 @@ */ final class QueryBuilder { - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; public function __construct(Connection $connection) { diff --git a/src/lib/Persistence/Legacy/Content/Gateway/ExceptionConversion.php b/src/lib/Persistence/Legacy/Content/Gateway/ExceptionConversion.php index 997394fc74..7ca5f95f65 100644 --- a/src/lib/Persistence/Legacy/Content/Gateway/ExceptionConversion.php +++ b/src/lib/Persistence/Legacy/Content/Gateway/ExceptionConversion.php @@ -27,10 +27,8 @@ final class ExceptionConversion extends Gateway { /** * The wrapped gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Gateway */ - protected $innerGateway; + protected Gateway $innerGateway; /** * Creates a new exception conversion gateway around $innerGateway. diff --git a/src/lib/Persistence/Legacy/Content/Handler.php b/src/lib/Persistence/Legacy/Content/Handler.php index d0226afa13..e0aa8d3640 100644 --- a/src/lib/Persistence/Legacy/Content/Handler.php +++ b/src/lib/Persistence/Legacy/Content/Handler.php @@ -32,64 +32,47 @@ class Handler implements BaseContentHandler { /** * Content gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Gateway */ - protected $contentGateway; + protected Gateway $contentGateway; /** * Location gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Gateway */ - protected $locationGateway; + protected LocationGateway $locationGateway; /** * Mapper. - * - * @var Mapper */ - protected $mapper; + protected Mapper $mapper; /** * FieldHandler. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\FieldHandler */ - protected $fieldHandler; + protected FieldHandler $fieldHandler; /** * URL slug converter. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter */ - protected $slugConverter; + protected SlugConverter $slugConverter; /** * UrlAlias gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\UrlAlias\Gateway */ - protected $urlAliasGateway; + protected UrlAliasGateway $urlAliasGateway; /** * ContentType handler. - * - * @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler */ - protected $contentTypeHandler; + protected ContentTypeHandler $contentTypeHandler; /** * Tree handler. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\TreeHandler */ - protected $treeHandler; + protected TreeHandler $treeHandler; protected LanguageHandler $languageHandler; - /** @var \Psr\Log\LoggerInterface */ - private $logger; + private LoggerInterface $logger; /** * Creates a new content handler. @@ -158,7 +141,7 @@ public function create(CreateStruct $struct) * * @return \Ibexa\Contracts\Core\Persistence\Content Content value object */ - protected function internalCreate(CreateStruct $struct, $versionNo = 1) + protected function internalCreate(CreateStruct $struct, $versionNo = 1): Content { $content = new Content(); @@ -438,7 +421,10 @@ public function loadContentInfo($contentId) return $this->treeHandler->loadContentInfo($contentId); } - public function loadContentInfoList(array $contentIds) + /** + * @return mixed[] + */ + public function loadContentInfoList(array $contentIds): array { $list = $this->mapper->extractContentInfoFromRows( $this->contentGateway->loadContentInfoList($contentIds) @@ -498,7 +484,7 @@ public function countDraftsForUser(int $userId): int * * @return \Ibexa\Contracts\Core\Persistence\Content\VersionInfo[] */ - public function loadDraftsForUser($userId) + public function loadDraftsForUser($userId): array { $rows = $this->contentGateway->listVersionsForUser($userId, VersionInfo::STATUS_DRAFT); if (empty($rows)) { @@ -506,7 +492,7 @@ public function loadDraftsForUser($userId) } $idVersionPairs = array_map( - static function ($row) { + static function (array $row): array { return [ 'id' => $row['ezcontentobject_version_contentobject_id'], 'version' => $row['ezcontentobject_version_version'], @@ -552,7 +538,7 @@ static function (array $row): array { * * @return bool */ - public function setStatus($contentId, $status, $version) + public function setStatus($contentId, $status, $version): bool { return $this->contentGateway->setStatus($contentId, $version, $status); } @@ -582,7 +568,7 @@ public function updateMetadata($contentId, MetadataUpdateStruct $content) * @param int $contentId * @param \Ibexa\Contracts\Core\Persistence\Content\MetadataUpdateStruct $content */ - protected function updatePathIdentificationString($contentId, MetadataUpdateStruct $content) + protected function updatePathIdentificationString(int $contentId, MetadataUpdateStruct $content) { if (isset($content->mainLanguageId)) { $contentLocationsRows = $this->locationGateway->loadLocationDataByContent($contentId); @@ -646,7 +632,7 @@ public function updateContent($contentId, $versionNo, UpdateStruct $updateStruct * * @return bool */ - public function deleteContent($contentId) + public function deleteContent($contentId): void { $contentLocations = $this->contentGateway->getAllLocationIds($contentId); if (empty($contentLocations)) { @@ -664,7 +650,7 @@ public function deleteContent($contentId) * * @param int $contentId */ - public function removeRawContent($contentId) + public function removeRawContent($contentId): void { $this->treeHandler->removeRawContent($contentId); } @@ -679,7 +665,7 @@ public function removeRawContent($contentId) * * @return bool */ - public function deleteVersion($contentId, $versionNo) + public function deleteVersion($contentId, $versionNo): void { $versionInfo = $this->loadVersionInfo($contentId, $versionNo); @@ -703,7 +689,7 @@ public function deleteVersion($contentId, $versionNo) * * @return \Ibexa\Contracts\Core\Persistence\Content\VersionInfo[] */ - public function listVersions($contentId, $status = null, $limit = -1) + public function listVersions($contentId, $status = null, $limit = -1): array { return $this->treeHandler->listVersions($contentId, $status, $limit); } @@ -887,7 +873,7 @@ public function loadReverseRelationList( /** * {@inheritdoc} */ - public function deleteTranslationFromContent($contentId, $languageCode) + public function deleteTranslationFromContent($contentId, $languageCode): void { $this->fieldHandler->deleteTranslationFromContentFields( $contentId, diff --git a/src/lib/Persistence/Legacy/Content/Language/CachingHandler.php b/src/lib/Persistence/Legacy/Content/Language/CachingHandler.php index 86bc1c47d6..7401a2c36f 100644 --- a/src/lib/Persistence/Legacy/Content/Language/CachingHandler.php +++ b/src/lib/Persistence/Legacy/Content/Language/CachingHandler.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Persistence\Content\Language; use Ibexa\Contracts\Core\Persistence\Content\Language\CreateStruct; +use Ibexa\Contracts\Core\Persistence\Content\Language\Handler; use Ibexa\Contracts\Core\Persistence\Content\Language\Handler as BaseLanguageHandler; use Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierGeneratorInterface; use Ibexa\Core\Persistence\Cache\InMemory\InMemoryCache; @@ -27,17 +28,14 @@ class CachingHandler implements BaseLanguageHandler * * @var \Ibexa\Core\Persistence\Legacy\Content\Language\Handler */ - protected $innerHandler; + protected Handler $innerHandler; /** * Language cache. - * - * @var \Ibexa\Core\Persistence\Cache\InMemory\InMemoryCache */ - protected $cache; + protected InMemoryCache $cache; - /** @var \Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierGeneratorInterface */ - protected $cacheIdentifierGenerator; + protected CacheIdentifierGeneratorInterface $cacheIdentifierGenerator; /** * Creates a caching handler around $innerHandler. @@ -76,7 +74,7 @@ public function create(CreateStruct $struct) * * @param \Ibexa\Contracts\Core\Persistence\Content\Language $language */ - public function update(Language $language) + public function update(Language $language): void { $this->innerHandler->update($language); $this->storeCache([$language]); @@ -213,7 +211,7 @@ public function loadAll() * * @param mixed $id */ - public function delete($id) + public function delete($id): void { $this->innerHandler->delete($id); // Delete by primary key will remove the object, so we don't need to clear `ez-language-code-` here. @@ -243,7 +241,7 @@ protected function storeCache(array $languages, string $listIndex = null): void $this->cache->setMulti( $languages, - static function (Language $language) use ($generator) { + static function (Language $language) use ($generator): array { return [ $generator->generateKey(self::LANGUAGE_IDENTIFIER, [$language->id], true), $generator->generateKey(self::LANGUAGE_CODE_IDENTIFIER, [$language->languageCode], true), diff --git a/src/lib/Persistence/Legacy/Content/Language/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/Content/Language/Gateway/DoctrineDatabase.php index ed0409c56c..1ce10b6745 100644 --- a/src/lib/Persistence/Legacy/Content/Language/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/Content/Language/Gateway/DoctrineDatabase.php @@ -26,10 +26,8 @@ final class DoctrineDatabase extends Gateway { /** * The native Doctrine connection. - * - * @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; /** @var \Doctrine\DBAL\Platforms\AbstractPlatform */ private $dbPlatform; diff --git a/src/lib/Persistence/Legacy/Content/Language/Gateway/ExceptionConversion.php b/src/lib/Persistence/Legacy/Content/Language/Gateway/ExceptionConversion.php index 4c44de5a76..0d80223091 100644 --- a/src/lib/Persistence/Legacy/Content/Language/Gateway/ExceptionConversion.php +++ b/src/lib/Persistence/Legacy/Content/Language/Gateway/ExceptionConversion.php @@ -19,10 +19,7 @@ */ final class ExceptionConversion extends Gateway { - /** - * @var \Ibexa\Core\Persistence\Legacy\Content\Language\Gateway - */ - private $innerGateway; + private Gateway $innerGateway; /** * Creates a new exception conversion gateway around $innerGateway. diff --git a/src/lib/Persistence/Legacy/Content/Language/Handler.php b/src/lib/Persistence/Legacy/Content/Language/Handler.php index 13a37c7b16..b8e9843a8d 100644 --- a/src/lib/Persistence/Legacy/Content/Language/Handler.php +++ b/src/lib/Persistence/Legacy/Content/Language/Handler.php @@ -20,17 +20,13 @@ class Handler implements BaseLanguageHandler { /** * Language Gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Language\Gateway */ - protected $languageGateway; + protected Gateway $languageGateway; /** * Language Mapper. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Language\Mapper */ - protected $languageMapper; + protected Mapper $languageMapper; /** * Creates a new Language Handler. @@ -66,7 +62,7 @@ public function create(CreateStruct $struct) * * @param \Ibexa\Contracts\Core\Persistence\Content\Language $language */ - public function update(Language $language) + public function update(Language $language): void { $this->languageGateway->updateLanguage($language); } @@ -141,7 +137,7 @@ public function loadListByLanguageCodes(array $languageCodes): iterable * * @return \Ibexa\Contracts\Core\Persistence\Content\Language[] */ - public function loadAll() + public function loadAll(): array { return $this->languageMapper->extractLanguagesFromRows( $this->languageGateway->loadAllLanguagesData() @@ -155,7 +151,7 @@ public function loadAll() * * @throws \LogicException If language could not be deleted */ - public function delete($id) + public function delete($id): void { if (!$this->languageGateway->canDeleteLanguage($id)) { throw new LogicException('Cannot delete language: some content still references the language'); diff --git a/src/lib/Persistence/Legacy/Content/Language/MaskGenerator.php b/src/lib/Persistence/Legacy/Content/Language/MaskGenerator.php index d5065670c2..3e977391e5 100644 --- a/src/lib/Persistence/Legacy/Content/Language/MaskGenerator.php +++ b/src/lib/Persistence/Legacy/Content/Language/MaskGenerator.php @@ -7,6 +7,7 @@ namespace Ibexa\Core\Persistence\Legacy\Content\Language; +use Ibexa\Contracts\Core\Persistence\Content\Language\Handler; use Ibexa\Contracts\Core\Persistence\Content\Language\Handler as LanguageHandler; use Ibexa\Core\Base\Exceptions\NotFoundException; @@ -20,7 +21,7 @@ class MaskGenerator * * @var \Ibexa\Core\Persistence\Legacy\Content\Language\Handler */ - protected $languageHandler; + protected Handler $languageHandler; /** * Creates a new Language MaskGenerator. diff --git a/src/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabase.php index 67b84f7c06..3bd07be2d4 100644 --- a/src/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabase.php @@ -36,20 +36,16 @@ */ final class DoctrineDatabase extends Gateway { - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; - /** @var \Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator */ - private $languageMaskGenerator; + private MaskGenerator $languageMaskGenerator; /** @var \Doctrine\DBAL\Platforms\AbstractPlatform */ private $dbPlatform; - /** @var \Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter */ - private $trashCriteriaConverter; + private CriteriaConverter $trashCriteriaConverter; - /** @var \Ibexa\Core\Search\Legacy\Content\Common\Gateway\SortClauseConverter */ - private $trashSortClauseConverter; + private SortClauseConverter $trashSortClauseConverter; /** * @throws \Doctrine\DBAL\DBALException diff --git a/src/lib/Persistence/Legacy/Content/Location/Gateway/ExceptionConversion.php b/src/lib/Persistence/Legacy/Content/Location/Gateway/ExceptionConversion.php index 22841f85a9..3990fa5c56 100644 --- a/src/lib/Persistence/Legacy/Content/Location/Gateway/ExceptionConversion.php +++ b/src/lib/Persistence/Legacy/Content/Location/Gateway/ExceptionConversion.php @@ -23,10 +23,8 @@ final class ExceptionConversion extends Gateway { /** * The wrapped gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Gateway */ - private $innerGateway; + private Gateway $innerGateway; /** * Creates a new exception conversion gateway around $innerGateway. diff --git a/src/lib/Persistence/Legacy/Content/Location/Handler.php b/src/lib/Persistence/Legacy/Content/Location/Handler.php index f4a9cd44d9..197c95a40a 100644 --- a/src/lib/Persistence/Legacy/Content/Location/Handler.php +++ b/src/lib/Persistence/Legacy/Content/Location/Handler.php @@ -28,38 +28,28 @@ class Handler implements BaseLocationHandler { /** * Gateway for handling location data. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Gateway */ - protected $locationGateway; + protected LocationGateway $locationGateway; /** * Location locationMapper. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Mapper */ - protected $locationMapper; + protected LocationMapper $locationMapper; /** * Content handler. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Handler */ - protected $contentHandler; + protected ContentHandler $contentHandler; /** * Object state handler. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\ObjectState\Handler */ - protected $objectStateHandler; + protected ObjectStateHandler $objectStateHandler; /** * Tree handler. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\TreeHandler */ - protected $treeHandler; + protected TreeHandler $treeHandler; public function __construct( LocationGateway $locationGateway, @@ -120,7 +110,7 @@ public function loadList(array $locationIds, array $translations = null, bool $u * * @return array Location ids are in the index, Content ids in the value. */ - public function loadSubtreeIds($locationId) + public function loadSubtreeIds($locationId): array { return $this->locationGateway->getSubtreeContent($locationId, true); } @@ -144,7 +134,7 @@ public function loadByRemoteId($remoteId, array $translations = null, bool $useA * * @return \Ibexa\Contracts\Core\Persistence\Content\Location[] */ - public function loadLocationsByContent($contentId, $rootLocationId = null) + public function loadLocationsByContent($contentId, $rootLocationId = null): array { $rows = $this->locationGateway->loadLocationDataByContent($contentId, $rootLocationId); @@ -161,7 +151,7 @@ public function loadLocationsByTrashContent(int $contentId, ?int $rootLocationId return $this->locationMapper->createLocationsFromRows($rows, '', new Trashed()); } - public function loadParentLocationsForDraftContent($contentId) + public function loadParentLocationsForDraftContent($contentId): array { $rows = $this->locationGateway->loadParentLocationsDataForDraftContent($contentId); @@ -173,7 +163,7 @@ public function loadParentLocationsForDraftContent($contentId) * * @return \Ibexa\Contracts\Core\Persistence\Content\ObjectState[] */ - protected function getDefaultContentStates() + protected function getDefaultContentStates(): array { $defaultObjectStatesMap = []; @@ -358,7 +348,7 @@ private function getSectionId($locationId) * @param \Ibexa\Contracts\Core\Persistence\Content\Location $location * @param int $sectionId */ - private function updateSubtreeSectionIfNecessary(Location $location, $sectionId) + private function updateSubtreeSectionIfNecessary(Location $location, $sectionId): void { if ($this->isMainLocation($location)) { $this->setSectionForSubtree($location->id, $sectionId); @@ -391,7 +381,7 @@ private function isMainLocation(Location $location): bool * * @return bool */ - public function move($sourceId, $destinationParentId) + public function move($sourceId, $destinationParentId): void { $sourceNodeData = $this->locationGateway->getBasicNodeData($sourceId); $destinationNodeData = $this->locationGateway->getBasicNodeData($destinationParentId); @@ -405,7 +395,7 @@ public function move($sourceId, $destinationParentId) $sourceNodeData['contentobject_id'], $sourceNodeData['parent_node_id'], $destinationParentId, - Gateway::NODE_ASSIGNMENT_OP_CODE_MOVE + LocationGateway::NODE_ASSIGNMENT_OP_CODE_MOVE ); $sourceLocation = $this->load($sourceId); @@ -423,7 +413,7 @@ public function move($sourceId, $destinationParentId) * * @param mixed $id Location ID */ - public function hide($id) + public function hide($id): void { $sourceNodeData = $this->locationGateway->getBasicNodeData($id); @@ -436,7 +426,7 @@ public function hide($id) * * @param mixed $id */ - public function unHide($id) + public function unHide($id): void { $sourceNodeData = $this->locationGateway->getBasicNodeData($id); @@ -478,7 +468,7 @@ public function setVisible(int $id): void * * @return bool */ - public function swap($locationId1, $locationId2) + public function swap($locationId1, $locationId2): void { $this->locationGateway->swap($locationId1, $locationId2); } @@ -489,7 +479,7 @@ public function swap($locationId1, $locationId2) * @param \Ibexa\Contracts\Core\Persistence\Content\Location\UpdateStruct $location * @param int $locationId */ - public function update(UpdateStruct $location, $locationId) + public function update(UpdateStruct $location, $locationId): void { $this->locationGateway->update($location, $locationId); } @@ -520,7 +510,7 @@ public function create(CreateStruct $createStruct) * * @return bool */ - public function removeSubtree($locationId) + public function removeSubtree($locationId): void { $this->treeHandler->removeSubtree($locationId); } @@ -536,7 +526,7 @@ public function deleteChildrenDrafts(int $locationId): void * @param mixed $locationId * @param mixed $sectionId */ - public function setSectionForSubtree($locationId, $sectionId) + public function setSectionForSubtree($locationId, $sectionId): void { $this->treeHandler->setSectionForSubtree($locationId, $sectionId); } @@ -549,7 +539,7 @@ public function setSectionForSubtree($locationId, $sectionId) * @param mixed $contentId * @param mixed $locationId */ - public function changeMainLocation($contentId, $locationId) + public function changeMainLocation($contentId, $locationId): void { $this->treeHandler->changeMainLocation($contentId, $locationId); } @@ -559,7 +549,7 @@ public function changeMainLocation($contentId, $locationId) * * @return int */ - public function countAllLocations() + public function countAllLocations(): int { return $this->locationGateway->countAllLocations(); } @@ -572,7 +562,7 @@ public function countAllLocations() * * @return \Ibexa\Contracts\Core\Persistence\Content\Location[] */ - public function loadAllLocations($offset, $limit) + public function loadAllLocations($offset, $limit): array { $rows = $this->locationGateway->loadAllLocationsData($offset, $limit); diff --git a/src/lib/Persistence/Legacy/Content/Location/Mapper.php b/src/lib/Persistence/Legacy/Content/Location/Mapper.php index 72730eba74..b138e633ad 100644 --- a/src/lib/Persistence/Legacy/Content/Location/Mapper.php +++ b/src/lib/Persistence/Legacy/Content/Location/Mapper.php @@ -28,7 +28,7 @@ class Mapper * * @return \Ibexa\Contracts\Core\Persistence\Content\Location */ - public function createLocationFromRow(array $data, $prefix = '', ?Location $location = null) + public function createLocationFromRow(array $data, string $prefix = '', ?Location $location = null) { $location = $location ?: new Location(); @@ -60,7 +60,7 @@ public function createLocationFromRow(array $data, $prefix = '', ?Location $loca * * @return \Ibexa\Contracts\Core\Persistence\Content\Location[] */ - public function createLocationsFromRows(array $rows, $prefix = '', ?Location $location = null): array + public function createLocationsFromRows(array $rows, string $prefix = '', ?Location $location = null): array { $locations = []; @@ -81,7 +81,7 @@ public function createLocationsFromRows(array $rows, $prefix = '', ?Location $lo * * @return \Ibexa\Contracts\Core\Persistence\Content\Location\CreateStruct */ - public function getLocationCreateStruct(array $data) + public function getLocationCreateStruct(array $data): CreateStruct { $struct = new CreateStruct(); diff --git a/src/lib/Persistence/Legacy/Content/Location/Trash/Handler.php b/src/lib/Persistence/Legacy/Content/Location/Trash/Handler.php index 1fd15e816c..c86c6825b6 100644 --- a/src/lib/Persistence/Legacy/Content/Location/Trash/Handler.php +++ b/src/lib/Persistence/Legacy/Content/Location/Trash/Handler.php @@ -14,8 +14,10 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Trash\TrashItemDeleteResult; use Ibexa\Contracts\Core\Repository\Values\Content\Trash\TrashItemDeleteResultList; use Ibexa\Core\Persistence\Legacy\Content\Handler as ContentHandler; +use Ibexa\Core\Persistence\Legacy\Content\Location\Gateway; use Ibexa\Core\Persistence\Legacy\Content\Location\Gateway as LocationGateway; use Ibexa\Core\Persistence\Legacy\Content\Location\Handler as LocationHandler; +use Ibexa\Core\Persistence\Legacy\Content\Location\Mapper; use Ibexa\Core\Persistence\Legacy\Content\Location\Mapper as LocationMapper; /** @@ -27,31 +29,23 @@ class Handler implements BaseTrashHandler /** * Location handler. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Handler */ - protected $locationHandler; + protected LocationHandler $locationHandler; /** * Gateway for handling location data. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Gateway */ - protected $locationGateway; + protected Gateway $locationGateway; /** * Mapper for handling location data. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Mapper */ - protected $locationMapper; + protected Mapper $locationMapper; /** * Content handler. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Handler */ - protected $contentHandler; + protected ContentHandler $contentHandler; public function __construct( LocationHandler $locationHandler, @@ -161,7 +155,7 @@ public function recover($trashedId, $newParentId) /** * {@inheritdoc}. */ - public function findTrashItems(CriterionInterface $criterion = null, $offset = 0, $limit = null, array $sort = null) + public function findTrashItems(CriterionInterface $criterion = null, $offset = 0, $limit = null, array $sort = null): TrashResult { $totalCount = $this->locationGateway->countTrashed($criterion); if ($totalCount === 0) { @@ -184,7 +178,7 @@ public function findTrashItems(CriterionInterface $criterion = null, $offset = 0 /** * {@inheritdoc} */ - public function emptyTrash() + public function emptyTrash(): TrashItemDeleteResultList { $resultList = new TrashItemDeleteResultList(); do { @@ -220,7 +214,7 @@ public function deleteTrashItem($trashedId) * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Trash\TrashItemDeleteResult */ - protected function delete(Trashed $trashItem) + protected function delete(Trashed $trashItem): TrashItemDeleteResult { $result = new TrashItemDeleteResult(); $result->trashItemId = $trashItem->id; diff --git a/src/lib/Persistence/Legacy/Content/Mapper.php b/src/lib/Persistence/Legacy/Content/Mapper.php index 0eae8b2784..b9352ae89a 100644 --- a/src/lib/Persistence/Legacy/Content/Mapper.php +++ b/src/lib/Persistence/Legacy/Content/Mapper.php @@ -86,7 +86,7 @@ public function __construct( * * @return \Ibexa\Contracts\Core\Persistence\Content\ContentInfo */ - private function createContentInfoFromCreateStruct(CreateStruct $struct, $currentVersionNo = 1) + private function createContentInfoFromCreateStruct(CreateStruct $struct, $currentVersionNo = 1): ContentInfo { $contentInfo = new ContentInfo(); @@ -120,7 +120,7 @@ private function createContentInfoFromCreateStruct(CreateStruct $struct, $curren * * @return \Ibexa\Contracts\Core\Persistence\Content\VersionInfo */ - public function createVersionInfoFromCreateStruct(CreateStruct $struct, $versionNo) + public function createVersionInfoFromCreateStruct(CreateStruct $struct, $versionNo): VersionInfo { $versionInfo = new VersionInfo(); @@ -155,7 +155,7 @@ public function createVersionInfoFromCreateStruct(CreateStruct $struct, $version * * @return \Ibexa\Contracts\Core\Persistence\Content\VersionInfo */ - public function createVersionInfoForContent(Content $content, $versionNo, $userId, ?string $languageCode = null) + public function createVersionInfoForContent(Content $content, $versionNo, $userId, ?string $languageCode = null): VersionInfo { $versionInfo = new VersionInfo(); @@ -179,7 +179,7 @@ public function createVersionInfoForContent(Content $content, $versionNo, $userI * * @return \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue */ - public function convertToStorageValue(Field $field) + public function convertToStorageValue(Field $field): StorageFieldValue { $converter = $this->converterRegistry->getConverter( $field->type @@ -379,7 +379,7 @@ private function loadCachedVersionFieldDefinitionsPerLanguage( * * @return \Ibexa\Contracts\Core\Persistence\Content\ContentInfo */ - public function extractContentInfoFromRow(array $row, $prefix = '', $treePrefix = 'ezcontentobject_tree_') + public function extractContentInfoFromRow(array $row, $prefix = '', $treePrefix = 'ezcontentobject_tree_'): ContentInfo { $contentInfo = new ContentInfo(); $contentInfo->id = (int)$row["{$prefix}id"]; @@ -409,7 +409,7 @@ public function extractContentInfoFromRow(array $row, $prefix = '', $treePrefix * * @return \Ibexa\Contracts\Core\Persistence\Content\ContentInfo[] */ - public function extractContentInfoFromRows(array $rows, $prefix = '', $treePrefix = 'ezcontentobject_tree_') + public function extractContentInfoFromRows(array $rows, $prefix = '', $treePrefix = 'ezcontentobject_tree_'): array { $contentInfoObjects = []; foreach ($rows as $row) { @@ -430,7 +430,7 @@ public function extractContentInfoFromRows(array $rows, $prefix = '', $treePrefi * * @return \Ibexa\Contracts\Core\Persistence\Content\VersionInfo */ - private function extractVersionInfoFromRow(array $row, array $names = []) + private function extractVersionInfoFromRow(array $row, array $names = []): VersionInfo { $versionInfo = new VersionInfo(); $versionInfo->id = (int)$row['ezcontentobject_version_id']; @@ -528,7 +528,7 @@ public function extractVersionInfoListFromRows(array $rows, array $nameRows): ar * * @return string[] */ - private function extractLanguageCodesFromMask(int $languageMask, array $allLanguages, &$missing = []) + private function extractLanguageCodesFromMask(int $languageMask, array $allLanguages, &$missing = []): array { $exp = 2; $result = []; @@ -553,7 +553,7 @@ private function extractLanguageCodesFromMask(int $languageMask, array $allLangu /** * @return \Ibexa\Contracts\Core\Persistence\Content\Language[] */ - private function loadAllLanguagesWithIdKey() + private function loadAllLanguagesWithIdKey(): array { $languagesById = []; foreach ($this->languageHandler->loadAll() as $language) { @@ -570,7 +570,7 @@ private function loadAllLanguagesWithIdKey() * * @return \Ibexa\Contracts\Core\Persistence\Content\Field */ - protected function extractFieldFromRow(array $row) + protected function extractFieldFromRow(array $row): Field { $field = new Field(); @@ -597,7 +597,7 @@ protected function extractFieldFromRow(array $row) * @throws \Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter\Exception\NotFound * if the necessary converter for $type could not be found. */ - protected function extractFieldValueFromRow(array $row, $type) + protected function extractFieldValueFromRow(array $row, $type): FieldValue { $storageValue = new StorageFieldValue(); @@ -629,7 +629,7 @@ protected function extractFieldValueFromRow(array $row, $type) * * @return \Ibexa\Contracts\Core\Persistence\Content\CreateStruct */ - public function createCreateStructFromContent(Content $content) + public function createCreateStructFromContent(Content $content): CreateStruct { $struct = new CreateStruct(); $struct->name = $content->versionInfo->names; @@ -655,8 +655,10 @@ public function createCreateStructFromContent(Content $content) /** * Extracts relation objects from $rows. + * + * @return mixed[] */ - public function extractRelationsFromRows(array $rows) + public function extractRelationsFromRows(array $rows): array { $relations = []; @@ -677,7 +679,7 @@ public function extractRelationsFromRows(array $rows) * * @return \Ibexa\Contracts\Core\Persistence\Content\Relation */ - public function extractRelationFromRow(array $row) + public function extractRelationFromRow(array $row): Relation { $relation = new Relation(); $relation->id = (int)$row['ezcontentobject_link_id']; @@ -701,7 +703,7 @@ public function extractRelationFromRow(array $row) * * @return \Ibexa\Contracts\Core\Persistence\Content\Relation */ - public function createRelationFromCreateStruct(RelationCreateStruct $struct) + public function createRelationFromCreateStruct(RelationCreateStruct $struct): Relation { $relation = new Relation(); diff --git a/src/lib/Persistence/Legacy/Content/ObjectState/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/Content/ObjectState/Gateway/DoctrineDatabase.php index 4afaab2d80..480b64fbca 100644 --- a/src/lib/Persistence/Legacy/Content/ObjectState/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/Content/ObjectState/Gateway/DoctrineDatabase.php @@ -28,13 +28,10 @@ final class DoctrineDatabase extends Gateway { /** * Language mask generator. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator */ - private $maskGenerator; + private MaskGenerator $maskGenerator; - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; /** @var \Doctrine\DBAL\Platforms\AbstractPlatform */ private $dbPlatform; diff --git a/src/lib/Persistence/Legacy/Content/ObjectState/Gateway/ExceptionConversion.php b/src/lib/Persistence/Legacy/Content/ObjectState/Gateway/ExceptionConversion.php index b018f7bbca..866516d442 100644 --- a/src/lib/Persistence/Legacy/Content/ObjectState/Gateway/ExceptionConversion.php +++ b/src/lib/Persistence/Legacy/Content/ObjectState/Gateway/ExceptionConversion.php @@ -22,10 +22,8 @@ final class ExceptionConversion extends Gateway { /** * The wrapped gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\ObjectState\Gateway */ - private $innerGateway; + private Gateway $innerGateway; /** * Creates a new exception conversion gateway around $innerGateway. diff --git a/src/lib/Persistence/Legacy/Content/ObjectState/Handler.php b/src/lib/Persistence/Legacy/Content/ObjectState/Handler.php index e1db7acd40..4a8bd73d19 100644 --- a/src/lib/Persistence/Legacy/Content/ObjectState/Handler.php +++ b/src/lib/Persistence/Legacy/Content/ObjectState/Handler.php @@ -18,17 +18,13 @@ class Handler implements BaseObjectStateHandler { /** * ObjectState Gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\ObjectState\Gateway */ - protected $objectStateGateway; + protected Gateway $objectStateGateway; /** * ObjectState Mapper. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\ObjectState\Mapper */ - protected $objectStateMapper; + protected Mapper $objectStateMapper; /** * Creates a new ObjectState Handler. @@ -149,7 +145,7 @@ public function updateGroup($groupId, InputStruct $input) * * @param mixed $groupId */ - public function deleteGroup($groupId) + public function deleteGroup($groupId): void { $objectStates = $this->loadObjectStates($groupId); foreach ($objectStates as $objectState) { @@ -244,7 +240,7 @@ public function update($stateId, InputStruct $input) * @param mixed $stateId * @param int $priority */ - public function setPriority($stateId, $priority) + public function setPriority($stateId, $priority): void { $objectState = $this->load($stateId); $groupObjectStates = $this->loadObjectStates($objectState->groupId); @@ -274,7 +270,7 @@ public function setPriority($stateId, $priority) * * @param mixed $stateId */ - public function delete($stateId) + public function delete($stateId): void { // Get the object state first as we need group ID // to reorder the priorities and reassign content to another state in the group @@ -346,7 +342,7 @@ public function getContentState($contentId, $stateGroupId) * * @return int */ - public function getContentCount($stateId) + public function getContentCount($stateId): int { return $this->objectStateGateway->getContentCount($stateId); } diff --git a/src/lib/Persistence/Legacy/Content/ObjectState/Mapper.php b/src/lib/Persistence/Legacy/Content/ObjectState/Mapper.php index 2da692301b..7fdad58868 100644 --- a/src/lib/Persistence/Legacy/Content/ObjectState/Mapper.php +++ b/src/lib/Persistence/Legacy/Content/ObjectState/Mapper.php @@ -7,6 +7,7 @@ namespace Ibexa\Core\Persistence\Legacy\Content\ObjectState; +use Ibexa\Contracts\Core\Persistence\Content\Language\Handler; use Ibexa\Contracts\Core\Persistence\Content\Language\Handler as LanguageHandler; use Ibexa\Contracts\Core\Persistence\Content\ObjectState; use Ibexa\Contracts\Core\Persistence\Content\ObjectState\Group; @@ -22,7 +23,7 @@ class Mapper * * @var \Ibexa\Core\Persistence\Legacy\Content\Language\Handler */ - protected $languageHandler; + protected Handler $languageHandler; /** * Creates a new mapper. @@ -41,7 +42,7 @@ public function __construct(LanguageHandler $languageHandler) * * @return \Ibexa\Contracts\Core\Persistence\Content\ObjectState */ - public function createObjectStateFromData(array $data) + public function createObjectStateFromData(array $data): ObjectState { $objectState = new ObjectState(); @@ -78,7 +79,7 @@ public function createObjectStateFromData(array $data) * * @return \Ibexa\Contracts\Core\Persistence\Content\ObjectState[] */ - public function createObjectStateListFromData(array $data) + public function createObjectStateListFromData(array $data): array { $objectStates = []; @@ -96,7 +97,7 @@ public function createObjectStateListFromData(array $data) * * @return \Ibexa\Contracts\Core\Persistence\Content\ObjectState\Group */ - public function createObjectStateGroupFromData(array $data) + public function createObjectStateGroupFromData(array $data): Group { $objectStateGroup = new Group(); @@ -133,7 +134,7 @@ public function createObjectStateGroupFromData(array $data) * * @return \Ibexa\Contracts\Core\Persistence\Content\ObjectState\Group[] */ - public function createObjectStateGroupListFromData(array $data) + public function createObjectStateGroupListFromData(array $data): array { $objectStateGroups = []; @@ -151,7 +152,7 @@ public function createObjectStateGroupListFromData(array $data) * * @return \Ibexa\Contracts\Core\Persistence\Content\ObjectState\Group */ - public function createObjectStateGroupFromInputStruct(InputStruct $input) + public function createObjectStateGroupFromInputStruct(InputStruct $input): Group { $objectStateGroup = new Group(); @@ -175,7 +176,7 @@ public function createObjectStateGroupFromInputStruct(InputStruct $input) * * @return \Ibexa\Contracts\Core\Persistence\Content\ObjectState */ - public function createObjectStateFromInputStruct(InputStruct $input) + public function createObjectStateFromInputStruct(InputStruct $input): ObjectState { $objectState = new ObjectState(); diff --git a/src/lib/Persistence/Legacy/Content/Section/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/Content/Section/Gateway/DoctrineDatabase.php index b6f74d3771..b9363e13fc 100644 --- a/src/lib/Persistence/Legacy/Content/Section/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/Content/Section/Gateway/DoctrineDatabase.php @@ -20,8 +20,7 @@ */ final class DoctrineDatabase extends Gateway { - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; /** @var \Doctrine\DBAL\Platforms\AbstractPlatform */ private $dbPlatform; diff --git a/src/lib/Persistence/Legacy/Content/Section/Gateway/ExceptionConversion.php b/src/lib/Persistence/Legacy/Content/Section/Gateway/ExceptionConversion.php index e4a216b131..af0fb23632 100644 --- a/src/lib/Persistence/Legacy/Content/Section/Gateway/ExceptionConversion.php +++ b/src/lib/Persistence/Legacy/Content/Section/Gateway/ExceptionConversion.php @@ -20,10 +20,8 @@ final class ExceptionConversion extends Gateway { /** * The wrapped gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Section\Gateway */ - private $innerGateway; + private Gateway $innerGateway; /** * Creates a new exception conversion gateway around $innerGateway. diff --git a/src/lib/Persistence/Legacy/Content/Section/Handler.php b/src/lib/Persistence/Legacy/Content/Section/Handler.php index aab48c4148..7da342f2e5 100644 --- a/src/lib/Persistence/Legacy/Content/Section/Handler.php +++ b/src/lib/Persistence/Legacy/Content/Section/Handler.php @@ -19,10 +19,8 @@ class Handler implements BaseSectionHandler { /** * Section Gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Section\Gateway */ - protected $sectionGateway; + protected Gateway $sectionGateway; /** * Creates a new Section Handler. @@ -42,7 +40,7 @@ public function __construct(Gateway $sectionGateway) * * @return \Ibexa\Contracts\Core\Persistence\Content\Section */ - public function create($name, $identifier) + public function create($name, $identifier): Section { $section = new Section(); @@ -63,7 +61,7 @@ public function create($name, $identifier) * * @return \Ibexa\Contracts\Core\Persistence\Content\Section */ - public function update($id, $name, $identifier) + public function update($id, $name, $identifier): Section { $this->sectionGateway->updateSection($id, $name, $identifier); @@ -134,7 +132,7 @@ public function loadByIdentifier($identifier) * * @return \Ibexa\Contracts\Core\Persistence\Content\Section */ - protected function createSectionFromArray(array $data) + protected function createSectionFromArray(array $data): Section { $section = new Section(); @@ -152,7 +150,7 @@ protected function createSectionFromArray(array $data) * * @return \Ibexa\Contracts\Core\Persistence\Content\Section[] */ - protected function createSectionsFromArray(array $data) + protected function createSectionsFromArray(array $data): array { $sections = []; foreach ($data as $sectionData) { @@ -171,7 +169,7 @@ protected function createSectionsFromArray(array $data) * * @param mixed $id */ - public function delete($id) + public function delete($id): void { $contentCount = $this->sectionGateway->countContentObjectsInSection($id); @@ -189,7 +187,7 @@ public function delete($id) * @param mixed $sectionId * @param mixed $contentId */ - public function assign($sectionId, $contentId) + public function assign($sectionId, $contentId): void { $this->sectionGateway->assignSectionToContent($sectionId, $contentId); } @@ -201,7 +199,7 @@ public function assign($sectionId, $contentId) * * @return int */ - public function assignmentsCount($sectionId) + public function assignmentsCount($sectionId): int { return $this->sectionGateway->countContentObjectsInSection($sectionId); } @@ -213,7 +211,7 @@ public function assignmentsCount($sectionId) * * @return int */ - public function policiesCount($sectionId) + public function policiesCount($sectionId): int { return $this->sectionGateway->countPoliciesUsingSection($sectionId); } @@ -225,7 +223,7 @@ public function policiesCount($sectionId) * * @return int */ - public function countRoleAssignmentsUsingSection($sectionId) + public function countRoleAssignmentsUsingSection($sectionId): int { return $this->sectionGateway->countRoleAssignmentsUsingSection($sectionId); } diff --git a/src/lib/Persistence/Legacy/Content/StorageHandler.php b/src/lib/Persistence/Legacy/Content/StorageHandler.php index 034773a455..fd4c0b3116 100644 --- a/src/lib/Persistence/Legacy/Content/StorageHandler.php +++ b/src/lib/Persistence/Legacy/Content/StorageHandler.php @@ -17,17 +17,13 @@ class StorageHandler { /** * Storage registry. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\StorageRegistry */ - protected $storageRegistry; + protected StorageRegistry $storageRegistry; /** * Array with database context. - * - * @var array */ - protected $context; + protected array $context; /** * Creates a new storage handler. @@ -75,7 +71,7 @@ public function copyFieldData(VersionInfo $versionInfo, Field $field, Field $ori * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo * @param \Ibexa\Contracts\Core\Persistence\Content\Field $field */ - public function getFieldData(VersionInfo $versionInfo, Field $field) + public function getFieldData(VersionInfo $versionInfo, Field $field): void { $storage = $this->storageRegistry->getStorage($field->type); if ($field->id !== null && $storage->hasFieldData()) { @@ -90,7 +86,7 @@ public function getFieldData(VersionInfo $versionInfo, Field $field) * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo * @param mixed[] $ids */ - public function deleteFieldData($fieldType, VersionInfo $versionInfo, array $ids) + public function deleteFieldData(string $fieldType, VersionInfo $versionInfo, array $ids): void { $this->storageRegistry->getStorage($fieldType) ->deleteFieldData($versionInfo, $ids); diff --git a/src/lib/Persistence/Legacy/Content/TreeHandler.php b/src/lib/Persistence/Legacy/Content/TreeHandler.php index 6b375e376f..94df5b3dc4 100644 --- a/src/lib/Persistence/Legacy/Content/TreeHandler.php +++ b/src/lib/Persistence/Legacy/Content/TreeHandler.php @@ -21,38 +21,28 @@ class TreeHandler { /** * Gateway for handling location data. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Gateway */ - protected $locationGateway; + protected LocationGateway $locationGateway; /** * Location Mapper. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Mapper */ - protected $locationMapper; + protected LocationMapper $locationMapper; /** * Content gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Gateway */ - protected $contentGateway; + protected ContentGateway $contentGateway; /** * Content handler. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Mapper */ - protected $contentMapper; + protected ContentMapper $contentMapper; /** * FieldHandler. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\FieldHandler */ - protected $fieldHandler; + protected FieldHandler $fieldHandler; /** * @param \Ibexa\Core\Persistence\Legacy\Content\Location\Gateway $locationGateway @@ -84,7 +74,7 @@ public function __construct( * * @return \Ibexa\Contracts\Core\Persistence\Content\ContentInfo */ - public function loadContentInfo($contentId) + public function loadContentInfo(int $contentId) { return $this->contentMapper->extractContentInfoFromRow( $this->contentGateway->loadContentInfo($contentId) @@ -98,7 +88,7 @@ public function loadContentInfo($contentId) * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function removeRawContent($contentId) + public function removeRawContent($contentId): void { $mainLocationId = $this->loadContentInfo($contentId)->mainLocationId; // there can be no Locations for Draft Content items @@ -128,7 +118,7 @@ public function removeRawContent($contentId) * * @return \Ibexa\Contracts\Core\Persistence\Content\VersionInfo[] */ - public function listVersions($contentId, $status = null, $limit = -1) + public function listVersions(int $contentId, ?int $status = null, int $limit = -1): array { $rows = $this->contentGateway->listVersions($contentId, $status, $limit); if (empty($rows)) { @@ -136,7 +126,7 @@ public function listVersions($contentId, $status = null, $limit = -1) } $idVersionPairs = array_map( - static function ($row) use ($contentId) { + static function (array $row) use ($contentId): array { return [ 'id' => $contentId, 'version' => $row['ezcontentobject_version_version'], @@ -163,7 +153,7 @@ static function ($row) use ($contentId) { * * @return \Ibexa\Contracts\Core\Persistence\Content\Location */ - public function loadLocation($locationId, array $translations = null, bool $useAlwaysAvailable = true) + public function loadLocation(int $locationId, array $translations = null, bool $useAlwaysAvailable = true) { $data = $this->locationGateway->getBasicNodeData($locationId, $translations, $useAlwaysAvailable); @@ -185,7 +175,7 @@ public function loadLocation($locationId, array $translations = null, bool $useA * * @return bool */ - public function removeSubtree($locationId) + public function removeSubtree($locationId): void { $locationRow = $this->locationGateway->getBasicNodeData($locationId); $contentId = $locationRow['contentobject_id']; @@ -244,7 +234,7 @@ public function deleteChildrenDrafts(int $locationId): void * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function setSectionForSubtree($locationId, $sectionId) + public function setSectionForSubtree(int $locationId, int $sectionId): void { $nodeData = $this->locationGateway->getBasicNodeData($locationId); @@ -261,7 +251,7 @@ public function setSectionForSubtree($locationId, $sectionId) * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function changeMainLocation($contentId, $locationId) + public function changeMainLocation($contentId, $locationId): void { $parentLocationId = $this->loadLocation($locationId)->parentId; diff --git a/src/lib/Persistence/Legacy/Content/Type/ContentUpdater.php b/src/lib/Persistence/Legacy/Content/Type/ContentUpdater.php index 7a915f5830..0f17da7ad9 100644 --- a/src/lib/Persistence/Legacy/Content/Type/ContentUpdater.php +++ b/src/lib/Persistence/Legacy/Content/Type/ContentUpdater.php @@ -9,8 +9,11 @@ use Ibexa\Contracts\Core\Persistence\Content\Type; use Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition; +use Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry; use Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry as Registry; +use Ibexa\Core\Persistence\Legacy\Content\Gateway; use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway; +use Ibexa\Core\Persistence\Legacy\Content\Mapper; use Ibexa\Core\Persistence\Legacy\Content\Mapper as ContentMapper; use Ibexa\Core\Persistence\Legacy\Content\StorageHandler; @@ -21,27 +24,20 @@ class ContentUpdater { /** * Content gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Gateway */ - protected $contentGateway; + protected Gateway $contentGateway; /** * FieldValue converter registry. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry */ - protected $converterRegistry; + protected ConverterRegistry $converterRegistry; /** * Storage handler. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\StorageHandler */ - protected $storageHandler; + protected StorageHandler $storageHandler; - /** @var \Ibexa\Core\Persistence\Legacy\Content\Mapper */ - protected $contentMapper; + protected Mapper $contentMapper; /** * Creates a new content updater. @@ -71,7 +67,7 @@ public function __construct( * * @return \Ibexa\Core\Persistence\Legacy\Content\Type\ContentUpdater\Action[] */ - public function determineActions(Type $fromType, Type $toType) + public function determineActions(Type $fromType, Type $toType): array { $actions = []; foreach ($fromType->fieldDefinitions as $fieldDef) { @@ -126,7 +122,7 @@ protected function hasFieldDefinition(Type $type, FieldDefinition $fieldDef): bo * @param mixed $contentTypeId * @param \Ibexa\Core\Persistence\Legacy\Content\Type\ContentUpdater\Action[] $actions */ - public function applyUpdates($contentTypeId, array $actions) + public function applyUpdates($contentTypeId, array $actions): void { if (empty($actions)) { return; @@ -146,7 +142,7 @@ public function applyUpdates($contentTypeId, array $actions) * * @return int[] */ - protected function getContentIdsByContentTypeId($contentTypeId) + protected function getContentIdsByContentTypeId(int $contentTypeId): array { return $this->contentGateway->getContentIdsByContentTypeId($contentTypeId); } diff --git a/src/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action.php b/src/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action.php index 732fb22caa..8e2c5984c4 100644 --- a/src/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action.php +++ b/src/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action.php @@ -7,6 +7,7 @@ namespace Ibexa\Core\Persistence\Legacy\Content\Type\ContentUpdater; +use Ibexa\Core\Persistence\Legacy\Content\Gateway; use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway; /** @@ -16,10 +17,8 @@ abstract class Action { /** * Content gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Gateway */ - protected $contentGateway; + protected Gateway $contentGateway; /** * Creates a new action. diff --git a/src/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action/AddField.php b/src/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action/AddField.php index 4cda931523..1890c31d67 100644 --- a/src/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action/AddField.php +++ b/src/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action/AddField.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition; use Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter; use Ibexa\Core\Persistence\Legacy\Content\Gateway; +use Ibexa\Core\Persistence\Legacy\Content\Mapper; use Ibexa\Core\Persistence\Legacy\Content\Mapper as ContentMapper; use Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue; use Ibexa\Core\Persistence\Legacy\Content\StorageHandler; @@ -24,27 +25,20 @@ class AddField extends Action { /** * Field definition of the field to add. - * - * @var \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition */ - protected $fieldDefinition; + protected FieldDefinition $fieldDefinition; /** * Storage handler. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\StorageHandler */ - protected $storageHandler; + protected StorageHandler $storageHandler; /** * Field value converter. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter */ - protected $fieldValueConverter; + protected Converter $fieldValueConverter; - /** @var \Ibexa\Core\Persistence\Legacy\Content\Mapper */ - protected $contentMapper; + protected Mapper $contentMapper; /** * Creates a new action. @@ -74,14 +68,14 @@ public function __construct( * * @param int $contentId */ - public function apply($contentId) + public function apply($contentId): void { $versionNumbers = $this->contentGateway->listVersionNumbers($contentId); $languageCodeToFieldId = []; $nameRows = $this->contentGateway->loadVersionedNameData( array_map( - static function ($versionNo) use ($contentId) { + static function ($versionNo) use ($contentId): array { return ['id' => $contentId, 'version' => $versionNo]; }, $versionNumbers @@ -189,7 +183,7 @@ protected function insertField(Content $content, Field $field) * * @return \Ibexa\Contracts\Core\Persistence\Content\Field */ - protected function createField($id, $versionNo, $languageCode) + protected function createField($id, $versionNo, $languageCode): Field { $field = new Field(); diff --git a/src/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action/RemoveField.php b/src/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action/RemoveField.php index 47e7390d03..a13708b229 100644 --- a/src/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action/RemoveField.php +++ b/src/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action/RemoveField.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition; use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway; +use Ibexa\Core\Persistence\Legacy\Content\Mapper; use Ibexa\Core\Persistence\Legacy\Content\Mapper as ContentMapper; use Ibexa\Core\Persistence\Legacy\Content\StorageHandler; use Ibexa\Core\Persistence\Legacy\Content\Type\ContentUpdater\Action; @@ -20,20 +21,15 @@ class RemoveField extends Action { /** * Field definition of the field to remove. - * - * @var \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition */ - protected $fieldDefinition; + protected FieldDefinition $fieldDefinition; /** * Storage handler. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\StorageHandler */ - protected $storageHandler; + protected StorageHandler $storageHandler; - /** @var \Ibexa\Core\Persistence\Legacy\Content\Mapper */ - protected $contentMapper; + protected Mapper $contentMapper; /** * Creates a new action. @@ -60,14 +56,14 @@ public function __construct( * * @param int $contentId */ - public function apply($contentId) + public function apply($contentId): void { $versionNumbers = $this->contentGateway->listVersionNumbers($contentId); $fieldIdSet = []; $nameRows = $this->contentGateway->loadVersionedNameData( array_map( - static function ($versionNo) use ($contentId) { + static function ($versionNo) use ($contentId): array { return ['id' => $contentId, 'version' => $versionNo]; }, $versionNumbers diff --git a/src/lib/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabase.php index 36021566ba..36ac18d9a3 100644 --- a/src/lib/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabase.php @@ -36,10 +36,8 @@ final class DoctrineDatabase extends Gateway { /** * Columns of database tables. - * - * @var array */ - private $columns = [ + private array $columns = [ 'ezcontentclass' => [ 'id', 'always_available', @@ -95,23 +93,18 @@ final class DoctrineDatabase extends Gateway * The native Doctrine connection. * * Meant to be used to transition from eZ/Zeta interface to Doctrine. - * - * @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; /** @var \Doctrine\DBAL\Platforms\AbstractPlatform */ private $dbPlatform; - /** @var \Ibexa\Core\Persistence\Legacy\SharedGateway\Gateway */ - private $sharedGateway; + private SharedGateway $sharedGateway; /** * Language mask generator. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator */ - private $languageMaskGenerator; + private MaskGenerator $languageMaskGenerator; /** * @throws \Doctrine\DBAL\DBALException diff --git a/src/lib/Persistence/Legacy/Content/Type/Gateway/ExceptionConversion.php b/src/lib/Persistence/Legacy/Content/Type/Gateway/ExceptionConversion.php index e84dadec24..964860de56 100644 --- a/src/lib/Persistence/Legacy/Content/Type/Gateway/ExceptionConversion.php +++ b/src/lib/Persistence/Legacy/Content/Type/Gateway/ExceptionConversion.php @@ -25,10 +25,8 @@ final class ExceptionConversion extends Gateway { /** * The wrapped gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Type\Gateway */ - private $innerGateway; + private Gateway $innerGateway; /** * Create a new exception conversion gateway around $innerGateway. diff --git a/src/lib/Persistence/Legacy/Content/Type/Handler.php b/src/lib/Persistence/Legacy/Content/Type/Handler.php index ec267e3c00..4c485be942 100644 --- a/src/lib/Persistence/Legacy/Content/Type/Handler.php +++ b/src/lib/Persistence/Legacy/Content/Type/Handler.php @@ -24,22 +24,17 @@ class Handler implements BaseContentTypeHandler { - /** @var \Ibexa\Core\Persistence\Legacy\Content\Type\Gateway */ - protected $contentTypeGateway; + protected Gateway $contentTypeGateway; /** * Mapper for Type objects. - * - * @var Mapper */ - protected $mapper; + protected Mapper $mapper; /** * Content type update handler. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Type\Update\Handler */ - protected $updateHandler; + protected UpdateHandler $updateHandler; private StorageDispatcherInterface $storageDispatcher; @@ -100,7 +95,7 @@ public function updateGroup(GroupUpdateStruct $struct) * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException If type group contains types * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException If type group with id is not found */ - public function deleteGroup($groupId) + public function deleteGroup($groupId): void { if ($this->contentTypeGateway->countTypesInGroup($groupId) !== 0) { throw new Exception\GroupNotEmpty($groupId); @@ -130,8 +125,10 @@ public function loadGroup($groupId) /** * {@inheritdoc} + * + * @return mixed[] */ - public function loadGroups(array $groupIds) + public function loadGroups(array $groupIds): array { $groups = $this->mapper->extractGroupsFromRows( $this->contentTypeGateway->loadGroupData($groupIds) @@ -302,7 +299,7 @@ public function create(CreateStruct $createStruct) * * @return \Ibexa\Contracts\Core\Persistence\Content\Type */ - protected function internalCreate(CreateStruct $createStruct, $contentTypeId = null) + protected function internalCreate(CreateStruct $createStruct, ?int $contentTypeId = null) { foreach ($createStruct->fieldDefinitions as $fieldDef) { if (!is_int($fieldDef->position)) { @@ -538,7 +535,7 @@ public function getFieldDefinition($id, $status) * * @return int */ - public function getContentCount($contentTypeId) + public function getContentCount($contentTypeId): int { return $this->contentTypeGateway->countInstancesOfType($contentTypeId); } @@ -554,7 +551,7 @@ public function getContentCount($contentTypeId) * @param int $status One of Type::STATUS_DEFINED|Type::STATUS_DRAFT|Type::STATUS_MODIFIED * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDefinition */ - public function addFieldDefinition($contentTypeId, $status, FieldDefinition $fieldDefinition) + public function addFieldDefinition($contentTypeId, $status, FieldDefinition $fieldDefinition): void { $storageFieldDef = new StorageFieldDefinition(); $this->mapper->toStorageFieldDefinition($fieldDefinition, $storageFieldDef); @@ -609,7 +606,7 @@ public function removeFieldDefinition( * @param mixed $contentTypeId * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDefinition */ - public function updateFieldDefinition($contentTypeId, $status, FieldDefinition $fieldDefinition) + public function updateFieldDefinition($contentTypeId, $status, FieldDefinition $fieldDefinition): void { $storageFieldDef = new StorageFieldDefinition(); $this->mapper->toStorageFieldDefinition($fieldDefinition, $storageFieldDef); @@ -629,7 +626,7 @@ public function updateFieldDefinition($contentTypeId, $status, FieldDefinition $ * * @param mixed $contentTypeId */ - public function publish($contentTypeId) + public function publish($contentTypeId): void { $toType = $this->load($contentTypeId, Type::STATUS_DRAFT); @@ -647,7 +644,10 @@ public function publish($contentTypeId) } } - public function getSearchableFieldMap() + /** + * @return non-empty-array[] + */ + public function getSearchableFieldMap(): array { $fieldMap = []; $rows = $this->contentTypeGateway->getSearchableFieldMapData(); diff --git a/src/lib/Persistence/Legacy/Content/Type/Mapper.php b/src/lib/Persistence/Legacy/Content/Type/Mapper.php index d7d7cd39d5..6bc224f77d 100644 --- a/src/lib/Persistence/Legacy/Content/Type/Mapper.php +++ b/src/lib/Persistence/Legacy/Content/Type/Mapper.php @@ -27,13 +27,10 @@ class Mapper { /** * Converter registry. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry */ - protected $converterRegistry; + protected ConverterRegistry $converterRegistry; - /** @var \Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator */ - private $maskGenerator; + private MaskGenerator $maskGenerator; private StorageDispatcherInterface $storageDispatcher; @@ -62,7 +59,7 @@ public function __construct( * * @todo $description is not supported by database, yet */ - public function createGroupFromCreateStruct(GroupCreateStruct $struct) + public function createGroupFromCreateStruct(GroupCreateStruct $struct): Group { $group = new Group(); @@ -87,7 +84,7 @@ public function createGroupFromCreateStruct(GroupCreateStruct $struct) * * @return \Ibexa\Contracts\Core\Persistence\Content\Type\Group[] */ - public function extractGroupsFromRows(array $rows) + public function extractGroupsFromRows(array $rows): array { $groups = []; @@ -115,7 +112,7 @@ public function extractGroupsFromRows(array $rows) * * @return array (Type) */ - public function extractTypesFromRows(array $rows, bool $keepTypeIdAsKey = false) + public function extractTypesFromRows(array $rows, bool $keepTypeIdAsKey = false): array { $types = []; $fields = []; @@ -166,7 +163,7 @@ public function extractTypesFromRows(array $rows, bool $keepTypeIdAsKey = false) public function extractMultilingualData(array $fieldDefinitionRows): array { - return array_map(static function (array $fieldData) { + return array_map(static function (array $fieldData): array { return [ 'ezcontentclass_attribute_multilingual_name' => $fieldData['ezcontentclass_attribute_multilingual_name'] ?? null, 'ezcontentclass_attribute_multilingual_description' => $fieldData['ezcontentclass_attribute_multilingual_description'] ?? null, @@ -184,7 +181,7 @@ public function extractMultilingualData(array $fieldDefinitionRows): array * * @return \Ibexa\Contracts\Core\Persistence\Content\Type */ - protected function extractTypeFromRow(array $row) + protected function extractTypeFromRow(array $row): Type { $type = new Type(); @@ -228,7 +225,7 @@ protected function extractTypeFromRow(array $row) * * @return \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition */ - public function extractFieldFromRow(array $row, array $multilingualData = [], int $status = Type::STATUS_DEFINED) + public function extractFieldFromRow(array $row, array $multilingualData = [], int $status = Type::STATUS_DEFINED): FieldDefinition { $storageFieldDef = $this->extractStorageFieldFromRow($row, $multilingualData); @@ -271,7 +268,7 @@ public function extractFieldFromRow(array $row, array $multilingualData = [], in * * @return \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition */ - protected function extractStorageFieldFromRow(array $row, array $multilingualDataRow = []) + protected function extractStorageFieldFromRow(array $row, array $multilingualDataRow = []): StorageFieldDefinition { $storageFieldDef = new StorageFieldDefinition(); @@ -339,7 +336,7 @@ protected function extractStorageFieldFromRow(array $row, array $multilingualDat * * @return \Ibexa\Contracts\Core\Persistence\Content\Type */ - public function createTypeFromCreateStruct(CreateStruct $createStruct) + public function createTypeFromCreateStruct(CreateStruct $createStruct): Type { $type = new Type(); @@ -373,7 +370,7 @@ public function createTypeFromCreateStruct(CreateStruct $createStruct) * * @return \Ibexa\Contracts\Core\Persistence\Content\Type\CreateStruct */ - public function createCreateStructFromType(Type $type) + public function createCreateStructFromType(Type $type): CreateStruct { $createStruct = new CreateStruct(); @@ -406,7 +403,7 @@ public function createCreateStructFromType(Type $type) * * @return \Ibexa\Contracts\Core\Persistence\Content\Type\UpdateStruct */ - public function createUpdateStructFromType(Type $type) + public function createUpdateStructFromType(Type $type): UpdateStruct { $updateStruct = new UpdateStruct(); @@ -436,7 +433,7 @@ public function createUpdateStructFromType(Type $type) public function toStorageFieldDefinition( FieldDefinition $fieldDef, StorageFieldDefinition $storageFieldDef - ) { + ): void { foreach (array_keys($fieldDef->name) as $languageCode) { $multilingualData = new MultilingualStorageFieldDefinition(); $multilingualData->name = $fieldDef->name[$languageCode]; @@ -467,7 +464,7 @@ public function toFieldDefinition( StorageFieldDefinition $storageFieldDef, FieldDefinition $fieldDef, int $status = Type::STATUS_DEFINED - ) { + ): void { $converter = $this->converterRegistry->getConverter( $fieldDef->fieldType ); diff --git a/src/lib/Persistence/Legacy/Content/Type/Update/Handler/DoctrineDatabase.php b/src/lib/Persistence/Legacy/Content/Type/Update/Handler/DoctrineDatabase.php index be47884bb5..625247c320 100644 --- a/src/lib/Persistence/Legacy/Content/Type/Update/Handler/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/Content/Type/Update/Handler/DoctrineDatabase.php @@ -19,8 +19,7 @@ */ final class DoctrineDatabase extends Handler { - /** @var \Ibexa\Core\Persistence\Legacy\Content\Type\Gateway */ - protected $contentTypeGateway; + protected Gateway $contentTypeGateway; public function __construct(Gateway $contentTypeGateway) { diff --git a/src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php index 4d91760184..0230bc7f48 100644 --- a/src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php @@ -13,6 +13,7 @@ use Doctrine\DBAL\FetchMode; use Doctrine\DBAL\ParameterType; use Ibexa\Core\Base\Exceptions\BadStateException; +use Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator; use Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator as LanguageMaskGenerator; use Ibexa\Core\Persistence\Legacy\Content\UrlAlias\Gateway; use RuntimeException; @@ -46,18 +47,14 @@ final class DoctrineDatabase extends Gateway 'text_md5' => ParameterType::STRING, ]; - /** @var \Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator */ - private $languageMaskGenerator; + private MaskGenerator $languageMaskGenerator; /** * Main URL database table name. - * - * @var string */ - private $table; + private string $table; - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; /** @var \Doctrine\DBAL\Platforms\AbstractPlatform */ private $dbPlatform; @@ -1346,7 +1343,7 @@ private function filterOriginalAliases(array $urlAliasesData): array { $originalUrlAliases = array_filter( $urlAliasesData, - static function ($urlAliasData): bool { + static function (array $urlAliasData): bool { // filter is_original=true ignoring broken parent records (cleaned up elsewhere) return (bool)$urlAliasData['is_original'] && $urlAliasData['existing_parent'] !== null; } diff --git a/src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/ExceptionConversion.php b/src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/ExceptionConversion.php index bb9a446dfe..48b3053694 100644 --- a/src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/ExceptionConversion.php +++ b/src/lib/Persistence/Legacy/Content/UrlAlias/Gateway/ExceptionConversion.php @@ -20,10 +20,8 @@ final class ExceptionConversion extends Gateway { /** * The wrapped gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\UrlAlias\Gateway */ - private $innerGateway; + private Gateway $innerGateway; /** * Creates a new exception conversion gateway around $innerGateway. diff --git a/src/lib/Persistence/Legacy/Content/UrlAlias/Handler.php b/src/lib/Persistence/Legacy/Content/UrlAlias/Handler.php index 5f757fce01..d732796bf3 100644 --- a/src/lib/Persistence/Legacy/Content/UrlAlias/Handler.php +++ b/src/lib/Persistence/Legacy/Content/UrlAlias/Handler.php @@ -49,55 +49,42 @@ class Handler implements UrlAliasHandlerInterface /** * UrlAlias Gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\UrlAlias\Gateway */ - protected $gateway; + protected Gateway $gateway; /** * Gateway for handling location data. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Gateway */ - protected $locationGateway; + protected LocationGateway $locationGateway; /** * UrlAlias Mapper. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\UrlAlias\Mapper */ - protected $mapper; + protected Mapper $mapper; /** * Caching language handler. * * @var \Ibexa\Core\Persistence\Legacy\Content\Language\CachingHandler */ - protected $languageHandler; + protected LanguageHandler $languageHandler; /** * URL slug converter. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter */ - protected $slugConverter; + protected SlugConverter $slugConverter; /** * Gateway for handling content data. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Gateway */ - protected $contentGateway; + protected ContentGateway $contentGateway; /** * Language mask generator. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator */ - protected $maskGenerator; + protected MaskGenerator $maskGenerator; - /** @var \Ibexa\Contracts\Core\Persistence\TransactionHandler */ - private $transactionHandler; + private TransactionHandler $transactionHandler; /** * Creates a new UrlAlias Handler. @@ -169,7 +156,7 @@ private function internalPublishUrlAliasForLocation( $locationId, $parentLocationId, $name, - $languageId, + int $languageId, $alwaysAvailable = false, $updatePathIdentificationString = false, $newId = null @@ -321,7 +308,7 @@ private function internalPublishUrlAliasForLocation( * * @return \Ibexa\Contracts\Core\Persistence\Content\UrlAlias */ - public function createCustomUrlAlias($locationId, $path, $forwarding = false, $languageCode = null, $alwaysAvailable = false) + public function createCustomUrlAlias($locationId, $path, $forwarding = false, $languageCode = null, $alwaysAvailable = false): UrlAlias { return $this->createUrlAlias( 'eznode:' . $locationId, @@ -352,7 +339,7 @@ public function createCustomUrlAlias($locationId, $path, $forwarding = false, $l * * @return \Ibexa\Contracts\Core\Persistence\Content\UrlAlias */ - public function createGlobalUrlAlias($resource, $path, $forwarding = false, $languageCode = null, $alwaysAvailable = false) + public function createGlobalUrlAlias($resource, $path, $forwarding = false, $languageCode = null, $alwaysAvailable = false): UrlAlias { return $this->createUrlAlias( $resource, @@ -482,7 +469,7 @@ protected function createUrlAlias($action, $path, $forward, $languageCode, $alwa * * @return mixed */ - protected function insertNopEntry($parentId, $text, $textMD5) + protected function insertNopEntry($parentId, $text, $textMD5): int { return $this->gateway->insertRow( [ @@ -674,7 +661,7 @@ public function locationMoved($locationId, $oldParentId, $newParentId) * @param mixed $newLocationId * @param mixed $newParentId */ - public function locationCopied($locationId, $newLocationId, $newParentId) + public function locationCopied($locationId, $newLocationId, $newParentId): void { $newParentAliasId = $this->getRealAliasId($newLocationId); $oldParentAliasId = $this->getRealAliasId($locationId); @@ -700,7 +687,7 @@ public function locationCopied($locationId, $newLocationId, $newParentId) * * @throws \Ibexa\Core\Base\Exceptions\NotFoundException */ - public function locationSwapped($location1Id, $location1ParentId, $location2Id, $location2ParentId) + public function locationSwapped($location1Id, $location1ParentId, $location2Id, $location2ParentId): void { $location1 = new SwappedLocationProperties($location1Id, $location1ParentId); $location2 = new SwappedLocationProperties($location2Id, $location2ParentId); @@ -759,7 +746,7 @@ public function locationSwapped($location1Id, $location1ParentId, $location2Id, * * @return array */ - private function getNamesForAllLanguages(array $contentInfo) + private function getNamesForAllLanguages(array $contentInfo): array { $nameDataArray = $this->contentGateway->loadVersionedNameData([ [ @@ -791,7 +778,7 @@ private function getNamesForAllLanguages(array $contentInfo) * @param array $location1Entries * @param array $location2Entries */ - private function historizeBeforeSwap($location1Entries, $location2Entries) + private function historizeBeforeSwap($location1Entries, $location2Entries): void { foreach ($location1Entries as $row) { $this->gateway->historizeBeforeSwap($row['action'], $row['lang_mask']); @@ -861,7 +848,7 @@ private function getUrlAliasesForSwappedLocations( Language $language, SwappedLocationProperties $location1, SwappedLocationProperties $location2 - ) { + ): array { $isMainLanguage1 = $language->id == $location1->mainLanguageId; $isMainLanguage2 = $language->id == $location2->mainLanguageId; $urlAliases = []; @@ -933,7 +920,7 @@ static function (array $row) use ($languageId): bool { * * @return mixed */ - protected function getRealAliasId($locationId) + protected function getRealAliasId(string $locationId) { // Absolute root location does have a url alias entry so we can skip lookup if ($locationId == self::ROOT_LOCATION_ID) { @@ -960,7 +947,7 @@ protected function getRealAliasId($locationId) * @param mixed $newParentAliasId * @param string[] $alreadyGeneratedAliases */ - protected function copySubtree($actionMap, $oldParentAliasId, $newParentAliasId, array $alreadyGeneratedAliases = []): array + protected function copySubtree(array $actionMap, $oldParentAliasId, $newParentAliasId, array $alreadyGeneratedAliases = []): array { $rows = $this->gateway->loadAutogeneratedEntries($oldParentAliasId); $newIdsMap = []; @@ -1001,7 +988,7 @@ protected function copySubtree($actionMap, $oldParentAliasId, $newParentAliasId, * * @return array */ - protected function getCopiedLocationsMap($oldParentId, $newParentId) + protected function getCopiedLocationsMap(int $oldParentId, int $newParentId): array { $originalLocations = $this->locationGateway->getSubtreeContent($oldParentId); $copiedLocations = $this->locationGateway->getSubtreeContent($newParentId); @@ -1039,7 +1026,7 @@ public function locationDeleted($locationId): array * @param int[] $locationIds all Locations of the Content that got Translation removed * @param string $languageCode language code of the removed Translation */ - public function translationRemoved(array $locationIds, $languageCode) + public function translationRemoved(array $locationIds, $languageCode): void { $languageId = $this->languageHandler->loadByLanguageCode($languageCode)->id; @@ -1059,7 +1046,7 @@ public function translationRemoved(array $locationIds, $languageCode) * @param string $action * @param mixed $original */ - protected function removeSubtree($id, $action, $original) + protected function removeSubtree(?int $id, string $action, $original) { // Remove first to avoid unnecessary recursion. if ($original) { @@ -1093,7 +1080,7 @@ protected function getHash($text): string /** * {@inheritdoc} */ - public function archiveUrlAliasesForDeletedTranslations($locationId, $parentLocationId, array $languageCodes) + public function archiveUrlAliasesForDeletedTranslations($locationId, $parentLocationId, array $languageCodes): void { $parentId = $this->getRealAliasId($parentLocationId); @@ -1126,7 +1113,7 @@ function ($languageCode) { * * @throws \Exception */ - public function deleteCorruptedUrlAliases() + public function deleteCorruptedUrlAliases(): float|int|array { $this->transactionHandler->beginTransaction(); try { @@ -1153,7 +1140,7 @@ public function deleteCorruptedUrlAliases() * * @throws \Ibexa\Core\Base\Exceptions\BadStateException */ - public function repairBrokenUrlAliasesForLocation(int $locationId) + public function repairBrokenUrlAliasesForLocation(int $locationId): void { try { $this->gateway->repairBrokenUrlAliasesForLocation($locationId); @@ -1174,7 +1161,7 @@ private function insertAliasEntryAsNop(array $aliasEntry): void * Internal publish custom aliases method, accepting language mask to set correct language mask on url aliases * new alias ID (used when swapping Locations). */ - private function internalPublishCustomUrlAliasForLocation(SwappedLocationProperties $location, int $languageMask) + private function internalPublishCustomUrlAliasForLocation(SwappedLocationProperties $location, int $languageMask): void { foreach ($location->entries as $entry) { if ((int)$entry['is_alias'] === 0) { diff --git a/src/lib/Persistence/Legacy/Content/UrlAlias/Mapper.php b/src/lib/Persistence/Legacy/Content/UrlAlias/Mapper.php index 91cc9cf67e..bf91b52a08 100644 --- a/src/lib/Persistence/Legacy/Content/UrlAlias/Mapper.php +++ b/src/lib/Persistence/Legacy/Content/UrlAlias/Mapper.php @@ -8,6 +8,7 @@ namespace Ibexa\Core\Persistence\Legacy\Content\UrlAlias; use Ibexa\Contracts\Core\Persistence\Content\UrlAlias; +use Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator; use Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator as LanguageMaskGenerator; /** @@ -17,10 +18,8 @@ class Mapper { /** * Language mask generator. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator */ - protected $languageMaskGenerator; + protected MaskGenerator $languageMaskGenerator; /** * Creates a new UrlWildcard Handler. @@ -39,7 +38,7 @@ public function __construct(LanguageMaskGenerator $languageMaskGenerator) * * @return \Ibexa\Contracts\Core\Persistence\Content\UrlAlias */ - public function extractUrlAliasFromData($data) + public function extractUrlAliasFromData($data): UrlAlias { $urlAlias = new UrlAlias(); @@ -64,7 +63,7 @@ public function extractUrlAliasFromData($data) * * @return \Ibexa\Contracts\Core\Persistence\Content\UrlAlias[] */ - public function extractUrlAliasListFromData(array $rows) + public function extractUrlAliasListFromData(array $rows): array { $urlAliases = []; foreach ($rows as $row) { @@ -103,7 +102,7 @@ public function generateIdentityKey(int $parentId, string $hash): string * * @return array */ - protected function matchTypeAndDestination($action) + protected function matchTypeAndDestination($action): array { if (preg_match('#^([a-zA-Z0-9_]+):(.+)?$#', $action, $matches)) { $actionType = $matches[1]; @@ -142,7 +141,7 @@ protected function matchTypeAndDestination($action) * * @return array */ - protected function normalizePathData(array $pathData) + protected function normalizePathData(array $pathData): array { $normalizedPathData = []; foreach ($pathData as $level => $rows) { diff --git a/src/lib/Persistence/Legacy/Content/UrlAlias/SlugConverter.php b/src/lib/Persistence/Legacy/Content/UrlAlias/SlugConverter.php index 3b46ec8157..87dca3977e 100644 --- a/src/lib/Persistence/Legacy/Content/UrlAlias/SlugConverter.php +++ b/src/lib/Persistence/Legacy/Content/UrlAlias/SlugConverter.php @@ -174,10 +174,8 @@ class SlugConverter /** * Transformation processor to normalize URL strings. - * - * @var \Ibexa\Core\Persistence\TransformationProcessor */ - protected $transformationProcessor; + protected TransformationProcessor $transformationProcessor; /** @var array */ protected $configuration; @@ -262,7 +260,7 @@ public function convert($text, $defaultText = '_1', $transformation = null) * * @return int */ - public function getUniqueCounterValue($text, $isRootLevel = true) + public function getUniqueCounterValue($text, $isRootLevel = true): int { if ($isRootLevel) { foreach ($this->configuration['reservedNames'] as $reservedName) { @@ -367,7 +365,7 @@ protected function cleanupText($text, $method) * * @return string */ - protected function getWordSeparator() + protected function getWordSeparator(): string { switch ($this->configuration['wordSeparatorName']) { case 'dash': diff --git a/src/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/DoctrineDatabase.php index 71b107a646..2ada094e80 100644 --- a/src/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/DoctrineDatabase.php @@ -35,11 +35,9 @@ final class DoctrineDatabase extends Gateway */ private const MAX_LIMIT = 1073741824; - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; - /** @var \Ibexa\Core\Persistence\Legacy\Content\UrlWildcard\Query\CriteriaConverter */ - protected $criteriaConverter; + protected CriteriaConverter $criteriaConverter; public const SORT_DIRECTION_MAP = [ SortClause::SORT_ASC => 'ASC', diff --git a/src/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/ExceptionConversion.php b/src/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/ExceptionConversion.php index 614c10609f..1a9d193f5a 100644 --- a/src/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/ExceptionConversion.php +++ b/src/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/ExceptionConversion.php @@ -22,10 +22,8 @@ final class ExceptionConversion extends Gateway { /** * The wrapped gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\UrlWildcard\Gateway */ - private $innerGateway; + private Gateway $innerGateway; /** * Create a new exception conversion gateway around $innerGateway. diff --git a/src/lib/Persistence/Legacy/Content/UrlWildcard/Handler.php b/src/lib/Persistence/Legacy/Content/UrlWildcard/Handler.php index 988c62195c..49806226b0 100644 --- a/src/lib/Persistence/Legacy/Content/UrlWildcard/Handler.php +++ b/src/lib/Persistence/Legacy/Content/UrlWildcard/Handler.php @@ -24,17 +24,13 @@ class Handler implements BaseUrlWildcardHandler /** * UrlWildcard Gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\UrlWildcard\Gateway */ - protected $gateway; + protected Gateway $gateway; /** * UrlWildcard Mapper. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\UrlWildcard\Mapper */ - protected $mapper; + protected Mapper $mapper; /** * Creates a new UrlWildcard Handler. @@ -101,7 +97,7 @@ public function update( * * @param mixed $id */ - public function remove($id) + public function remove($id): void { $this->gateway->deleteUrlWildcard($id); } @@ -183,7 +179,7 @@ public function translate(string $sourceUrl): UrlWildcard $rows = $this->gateway->loadUrlWildcardsData(); uasort( $rows, - static function ($row1, $row2): int { + static function (array $row1, array $row2): int { return strlen($row2['source_url']) - strlen($row1['source_url']); } ); diff --git a/src/lib/Persistence/Legacy/Content/UrlWildcard/Mapper.php b/src/lib/Persistence/Legacy/Content/UrlWildcard/Mapper.php index f888fdb0b7..55d904e0f7 100644 --- a/src/lib/Persistence/Legacy/Content/UrlWildcard/Mapper.php +++ b/src/lib/Persistence/Legacy/Content/UrlWildcard/Mapper.php @@ -23,7 +23,7 @@ class Mapper * * @return \Ibexa\Contracts\Core\Persistence\Content\UrlWildcard */ - public function createUrlWildcard($sourceUrl, $destinationUrl, $forward) + public function createUrlWildcard($sourceUrl, $destinationUrl, $forward): UrlWildcard { $urlWildcard = new UrlWildcard(); @@ -41,7 +41,7 @@ public function createUrlWildcard($sourceUrl, $destinationUrl, $forward) * * @return \Ibexa\Contracts\Core\Persistence\Content\UrlWildcard */ - public function extractUrlWildcardFromRow(array $row) + public function extractUrlWildcardFromRow(array $row): UrlWildcard { $urlWildcard = new UrlWildcard(); @@ -75,7 +75,7 @@ protected function cleanUrl($url): string * * @return \Ibexa\Contracts\Core\Persistence\Content\UrlWildcard[] */ - public function extractUrlWildcardsFromRows(array $rows) + public function extractUrlWildcardsFromRows(array $rows): array { $urlWildcards = []; diff --git a/src/lib/Persistence/Legacy/Content/UrlWildcard/Query/CriteriaConverter.php b/src/lib/Persistence/Legacy/Content/UrlWildcard/Query/CriteriaConverter.php index e04bd25109..31d52bf428 100644 --- a/src/lib/Persistence/Legacy/Content/UrlWildcard/Query/CriteriaConverter.php +++ b/src/lib/Persistence/Legacy/Content/UrlWildcard/Query/CriteriaConverter.php @@ -15,7 +15,7 @@ final class CriteriaConverter { /** @var \Ibexa\Core\Persistence\Legacy\Content\UrlWildcard\Query\CriterionHandler[] */ - private $handlers; + private iterable $handlers; /** * @param \Ibexa\Core\Persistence\Legacy\Content\UrlWildcard\Query\CriterionHandler[] $handlers diff --git a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Content/SiblingQueryBuilder.php b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Content/SiblingQueryBuilder.php index ca5272e165..c0474d404a 100644 --- a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Content/SiblingQueryBuilder.php +++ b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/Content/SiblingQueryBuilder.php @@ -19,8 +19,7 @@ */ final class SiblingQueryBuilder implements CriterionQueryBuilder { - /** @var \Ibexa\Core\Persistence\Legacy\Filter\CriterionQueryBuilder\LogicalAndQueryBuilder */ - private $logicalAndQueryBuilder; + private LogicalAndQueryBuilder $logicalAndQueryBuilder; /** * Sibling is internally a composite LogicalAnd criterion, so is handled by delegation. diff --git a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/LogicalAndQueryBuilder.php b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/LogicalAndQueryBuilder.php index 4dee157b01..c00e84bcc4 100644 --- a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/LogicalAndQueryBuilder.php +++ b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/LogicalAndQueryBuilder.php @@ -19,8 +19,7 @@ */ final class LogicalAndQueryBuilder implements CriterionQueryBuilder { - /** @var \Ibexa\Contracts\Core\Persistence\Filter\CriterionVisitor */ - private $criterionVisitor; + private CriterionVisitor $criterionVisitor; public function __construct(CriterionVisitor $criterionVisitor) { diff --git a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/LogicalNotQueryBuilder.php b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/LogicalNotQueryBuilder.php index 9e50ec24f4..7b62915309 100644 --- a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/LogicalNotQueryBuilder.php +++ b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/LogicalNotQueryBuilder.php @@ -20,8 +20,7 @@ */ final class LogicalNotQueryBuilder implements CriterionQueryBuilder { - /** @var \Ibexa\Contracts\Core\Persistence\Filter\CriterionVisitor */ - private $criterionVisitor; + private CriterionVisitor $criterionVisitor; public function __construct(CriterionVisitor $criterionVisitor) { diff --git a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/LogicalOrQueryBuilder.php b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/LogicalOrQueryBuilder.php index 716e6f6cd1..f2c0ebdc50 100644 --- a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/LogicalOrQueryBuilder.php +++ b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/LogicalOrQueryBuilder.php @@ -19,8 +19,7 @@ */ final class LogicalOrQueryBuilder implements CriterionQueryBuilder { - /** @var \Ibexa\Contracts\Core\Persistence\Filter\CriterionVisitor */ - private $criterionVisitor; + private CriterionVisitor $criterionVisitor; public function __construct(CriterionVisitor $criterionVisitor) { diff --git a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/User/BaseUserCriterionQueryBuilder.php b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/User/BaseUserCriterionQueryBuilder.php index 476ba50a0b..1d5dcd3a38 100644 --- a/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/User/BaseUserCriterionQueryBuilder.php +++ b/src/lib/Persistence/Legacy/Filter/CriterionQueryBuilder/User/BaseUserCriterionQueryBuilder.php @@ -19,8 +19,7 @@ */ abstract class BaseUserCriterionQueryBuilder implements CriterionQueryBuilder { - /** @var \Ibexa\Core\Persistence\TransformationProcessor */ - private $transformationProcessor; + private TransformationProcessor $transformationProcessor; public function __construct(TransformationProcessor $transformationProcessor) { diff --git a/src/lib/Persistence/Legacy/Filter/CriterionVisitor.php b/src/lib/Persistence/Legacy/Filter/CriterionVisitor.php index 58cb5a5600..1bbaf32b7f 100644 --- a/src/lib/Persistence/Legacy/Filter/CriterionVisitor.php +++ b/src/lib/Persistence/Legacy/Filter/CriterionVisitor.php @@ -20,7 +20,7 @@ final class CriterionVisitor implements FilteringCriterionVisitor { /** @var \Ibexa\Contracts\Core\Repository\Values\Filter\CriterionQueryBuilder[] */ - private $criterionQueryBuilders; + private iterable $criterionQueryBuilders; public function __construct(iterable $criterionQueryBuilders) { diff --git a/src/lib/Persistence/Legacy/Filter/Gateway/Content/Doctrine/DoctrineGateway.php b/src/lib/Persistence/Legacy/Filter/Gateway/Content/Doctrine/DoctrineGateway.php index 9226255e42..de1aced5b1 100644 --- a/src/lib/Persistence/Legacy/Filter/Gateway/Content/Doctrine/DoctrineGateway.php +++ b/src/lib/Persistence/Legacy/Filter/Gateway/Content/Doctrine/DoctrineGateway.php @@ -59,14 +59,11 @@ final class DoctrineGateway implements Gateway 'content_main_location_id' => 'main_location.main_node_id', ]; - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; - /** @var \Ibexa\Contracts\Core\Persistence\Filter\CriterionVisitor */ - private $criterionVisitor; + private CriterionVisitor $criterionVisitor; - /** @var \Ibexa\Contracts\Core\Persistence\Filter\SortClauseVisitor */ - private $sortClauseVisitor; + private SortClauseVisitor $sortClauseVisitor; public function __construct( Connection $connection, diff --git a/src/lib/Persistence/Legacy/Filter/Gateway/Content/Mapper/DoctrineGatewayDataMapper.php b/src/lib/Persistence/Legacy/Filter/Gateway/Content/Mapper/DoctrineGatewayDataMapper.php index ae22b35955..0c19a3a812 100644 --- a/src/lib/Persistence/Legacy/Filter/Gateway/Content/Mapper/DoctrineGatewayDataMapper.php +++ b/src/lib/Persistence/Legacy/Filter/Gateway/Content/Mapper/DoctrineGatewayDataMapper.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Persistence\Content\ContentInfo; use Ibexa\Contracts\Core\Persistence\Content\Field; use Ibexa\Contracts\Core\Persistence\Content\FieldValue; +use Ibexa\Contracts\Core\Persistence\Content\Language\Handler; use Ibexa\Contracts\Core\Persistence\Content\Language\Handler as LanguageHandler; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; use Ibexa\Contracts\Core\Persistence\Content\VersionInfo; @@ -25,17 +26,13 @@ */ final class DoctrineGatewayDataMapper implements GatewayDataMapper { - /** @var \Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry */ - private $converterRegistry; + private ConverterRegistry $converterRegistry; - /** @var \Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator */ - private $languageMaskGenerator; + private MaskGenerator $languageMaskGenerator; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Language\Handler */ - private $languageHandler; + private Handler $languageHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler */ - private $contentTypeHandler; + private ContentTypeHandler $contentTypeHandler; public function __construct( LanguageHandler $languageHandler, @@ -92,7 +89,7 @@ private function mapContentDataToPersistenceContent(array $row): Content /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - private function mapVersionDataToPersistenceVersionInfo(array $row): Content\VersionInfo + private function mapVersionDataToPersistenceVersionInfo(array $row): VersionInfo { $versionInfo = new VersionInfo(); $versionInfo->id = (int)$row['content_version_id']; @@ -124,7 +121,7 @@ private function mapFieldDataToPersistenceFieldList( int $versionNo ): array { return array_map( - function (array $row) use ($versionNo) { + function (array $row) use ($versionNo): \Ibexa\Contracts\Core\Persistence\Content\Field { $field = new Field(); $field->id = (int)$row['field_id']; $field->fieldDefinitionId = (int)$row['field_definition_id']; diff --git a/src/lib/Persistence/Legacy/Filter/Gateway/Location/Doctrine/DoctrineGateway.php b/src/lib/Persistence/Legacy/Filter/Gateway/Location/Doctrine/DoctrineGateway.php index 2a60871cf7..bf23ff3009 100644 --- a/src/lib/Persistence/Legacy/Filter/Gateway/Location/Doctrine/DoctrineGateway.php +++ b/src/lib/Persistence/Legacy/Filter/Gateway/Location/Doctrine/DoctrineGateway.php @@ -26,14 +26,11 @@ */ final class DoctrineGateway implements Gateway { - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; - /** @var \Ibexa\Contracts\Core\Persistence\Filter\CriterionVisitor */ - private $criterionVisitor; + private CriterionVisitor $criterionVisitor; - /** @var \Ibexa\Contracts\Core\Persistence\Filter\SortClauseVisitor */ - private $sortClauseVisitor; + private SortClauseVisitor $sortClauseVisitor; public function __construct( Connection $connection, diff --git a/src/lib/Persistence/Legacy/Filter/Handler/ContentFilteringHandler.php b/src/lib/Persistence/Legacy/Filter/Handler/ContentFilteringHandler.php index be975019d2..fe12116bf3 100644 --- a/src/lib/Persistence/Legacy/Filter/Handler/ContentFilteringHandler.php +++ b/src/lib/Persistence/Legacy/Filter/Handler/ContentFilteringHandler.php @@ -14,6 +14,7 @@ use Ibexa\Contracts\Core\Repository\Values\Filter\Filter; use Ibexa\Core\Persistence\Legacy\Content\FieldHandler; use Ibexa\Core\Persistence\Legacy\Filter\Gateway\Content\GatewayDataMapper; +use Ibexa\Core\Persistence\Legacy\Filter\Gateway\Gateway; use Ibexa\Core\Persistence\Legacy\Filter\Gateway\Gateway as FilteringGateway; /** @@ -21,14 +22,11 @@ */ final class ContentFilteringHandler implements Handler { - /** @var \Ibexa\Core\Persistence\Legacy\Filter\Gateway\Gateway */ - private $gateway; + private Gateway $gateway; - /** @var \Ibexa\Core\Persistence\Legacy\Filter\Gateway\Content\GatewayDataMapper */ - private $mapper; + private GatewayDataMapper $mapper; - /** @var \Ibexa\Core\Persistence\Legacy\Content\FieldHandler */ - private $fieldHandler; + private FieldHandler $fieldHandler; public function __construct( FilteringGateway $gateway, diff --git a/src/lib/Persistence/Legacy/Filter/Handler/LocationFilteringHandler.php b/src/lib/Persistence/Legacy/Filter/Handler/LocationFilteringHandler.php index da28228501..2e3179ee7b 100644 --- a/src/lib/Persistence/Legacy/Filter/Handler/LocationFilteringHandler.php +++ b/src/lib/Persistence/Legacy/Filter/Handler/LocationFilteringHandler.php @@ -12,20 +12,19 @@ use Ibexa\Contracts\Core\Persistence\Filter\Location\Handler; use Ibexa\Contracts\Core\Persistence\Filter\Location\LazyLocationListIterator; use Ibexa\Contracts\Core\Repository\Values\Filter\Filter; +use Ibexa\Core\Persistence\Legacy\Content\Location\Mapper; use Ibexa\Core\Persistence\Legacy\Content\Location\Mapper as LocationLegacyMapper; +use Ibexa\Core\Persistence\Legacy\Filter\Gateway\Content\GatewayDataMapper; use Ibexa\Core\Persistence\Legacy\Filter\Gateway\Content\GatewayDataMapper as ContentGatewayDataMapper; use Ibexa\Core\Persistence\Legacy\Filter\Gateway\Gateway; class LocationFilteringHandler implements Handler { - /** @var \Ibexa\Core\Persistence\Legacy\Filter\Gateway\Gateway */ - private $gateway; + private Gateway $gateway; - /** @var \Ibexa\Core\Persistence\Legacy\Content\Location\Mapper */ - private $locationMapper; + private Mapper $locationMapper; - /** @var \Ibexa\Core\Persistence\Legacy\Filter\Gateway\Content\GatewayDataMapper */ - private $contentGatewayDataMapper; + private GatewayDataMapper $contentGatewayDataMapper; public function __construct( Gateway $gateway, diff --git a/src/lib/Persistence/Legacy/Filter/SortClauseVisitor.php b/src/lib/Persistence/Legacy/Filter/SortClauseVisitor.php index 4c729acf82..818c4d5754 100644 --- a/src/lib/Persistence/Legacy/Filter/SortClauseVisitor.php +++ b/src/lib/Persistence/Legacy/Filter/SortClauseVisitor.php @@ -20,7 +20,7 @@ final class SortClauseVisitor implements FilteringSortClauseVisitor { /** @var \Ibexa\Contracts\Core\Repository\Values\Filter\SortClauseQueryBuilder[] */ - private $sortClauseQueryBuilders; + private iterable $sortClauseQueryBuilders; /** @var \Ibexa\Contracts\Core\Repository\Values\Filter\SortClauseQueryBuilder[] */ private static $queryBuildersForSortClauses = []; diff --git a/src/lib/Persistence/Legacy/Handler.php b/src/lib/Persistence/Legacy/Handler.php index 93d740638d..d6240c3402 100644 --- a/src/lib/Persistence/Legacy/Handler.php +++ b/src/lib/Persistence/Legacy/Handler.php @@ -21,6 +21,7 @@ use Ibexa\Contracts\Core\Persistence\Handler as HandlerInterface; use Ibexa\Contracts\Core\Persistence\Notification\Handler as NotificationHandler; use Ibexa\Contracts\Core\Persistence\Setting\Handler as SettingHandler; +use Ibexa\Contracts\Core\Persistence\TransactionHandler; use Ibexa\Contracts\Core\Persistence\TransactionHandler as SPITransactionHandler; use Ibexa\Contracts\Core\Persistence\User\Handler as UserHandler; use Ibexa\Contracts\Core\Persistence\UserPreference\Handler as UserPreferenceHandler; @@ -31,53 +32,37 @@ */ class Handler implements HandlerInterface { - /** @var \Ibexa\Contracts\Core\Persistence\Content\Handler */ - protected $contentHandler; + protected ContentHandler $contentHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler */ - protected $contentTypeHandler; + protected ContentTypeHandler $contentTypeHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Language\Handler */ - protected $languageHandler; + protected LanguageHandler $languageHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Location\Handler */ - protected $locationHandler; + protected LocationHandler $locationHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\ObjectState\Handler */ - protected $objectStateHandler; + protected ObjectStateHandler $objectStateHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Section\Handler */ - protected $sectionHandler; + protected SectionHandler $sectionHandler; - /** @var \Ibexa\Contracts\Core\Persistence\TransactionHandler */ - protected $transactionHandler; + protected TransactionHandler $transactionHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Location\Trash\Handler */ - protected $trashHandler; + protected TrashHandler $trashHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\UrlAlias\Handler */ - protected $urlAliasHandler; + protected UrlAliasHandler $urlAliasHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\UrlWildcard\Handler */ - protected $urlWildcardHandler; + protected UrlWildcardHandler $urlWildcardHandler; - /** @var \Ibexa\Contracts\Core\Persistence\User\Handler */ - protected $userHandler; + protected UserHandler $userHandler; - /** @var \Ibexa\Core\Persistence\Legacy\URL\Handler */ - protected $urlHandler; + protected UrlHandler $urlHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Bookmark\Handler */ - protected $bookmarkHandler; + protected BookmarkHandler $bookmarkHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Notification\Handler */ - protected $notificationHandler; + protected NotificationHandler $notificationHandler; - /** @var \Ibexa\Contracts\Core\Persistence\UserPreference\Handler */ - protected $userPreferenceHandler; + protected UserPreferenceHandler $userPreferenceHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Setting\Handler */ - private $settingHandler; + private SettingHandler $settingHandler; public function __construct( ContentHandler $contentHandler, diff --git a/src/lib/Persistence/Legacy/Notification/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/Notification/Gateway/DoctrineDatabase.php index 7a1a1083ad..13894fa087 100644 --- a/src/lib/Persistence/Legacy/Notification/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/Notification/Gateway/DoctrineDatabase.php @@ -25,8 +25,7 @@ class DoctrineDatabase extends Gateway public const COLUMN_CREATED = 'created'; public const COLUMN_DATA = 'data'; - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; /** * @param \Doctrine\DBAL\Connection $connection diff --git a/src/lib/Persistence/Legacy/Notification/Gateway/ExceptionConversion.php b/src/lib/Persistence/Legacy/Notification/Gateway/ExceptionConversion.php index f91b9962da..c02d594da2 100644 --- a/src/lib/Persistence/Legacy/Notification/Gateway/ExceptionConversion.php +++ b/src/lib/Persistence/Legacy/Notification/Gateway/ExceptionConversion.php @@ -19,10 +19,8 @@ class ExceptionConversion extends Gateway { /** * The wrapped gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\Notification\Gateway */ - protected $innerGateway; + protected Gateway $innerGateway; /** * ExceptionConversion constructor. diff --git a/src/lib/Persistence/Legacy/Notification/Handler.php b/src/lib/Persistence/Legacy/Notification/Handler.php index 9ddf7a36a4..e8084a8c33 100644 --- a/src/lib/Persistence/Legacy/Notification/Handler.php +++ b/src/lib/Persistence/Legacy/Notification/Handler.php @@ -17,11 +17,9 @@ class Handler implements HandlerInterface { - /** @var \Ibexa\Core\Persistence\Legacy\Notification\Gateway */ - protected $gateway; + protected Gateway $gateway; - /** @var \Ibexa\Core\Persistence\Legacy\Notification\Mapper */ - protected $mapper; + protected Mapper $mapper; /** * @param \Ibexa\Core\Persistence\Legacy\Notification\Gateway $gateway diff --git a/src/lib/Persistence/Legacy/Setting/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/Setting/Gateway/DoctrineDatabase.php index 8c96f3fa82..0a1799faec 100644 --- a/src/lib/Persistence/Legacy/Setting/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/Setting/Gateway/DoctrineDatabase.php @@ -19,8 +19,7 @@ */ final class DoctrineDatabase extends Gateway { - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; public function __construct(Connection $connection) { diff --git a/src/lib/Persistence/Legacy/Setting/Gateway/ExceptionConversion.php b/src/lib/Persistence/Legacy/Setting/Gateway/ExceptionConversion.php index c2c48f7b8d..adbb26332e 100644 --- a/src/lib/Persistence/Legacy/Setting/Gateway/ExceptionConversion.php +++ b/src/lib/Persistence/Legacy/Setting/Gateway/ExceptionConversion.php @@ -18,8 +18,7 @@ */ final class ExceptionConversion extends Gateway { - /** @var \Ibexa\Core\Persistence\Legacy\Setting\Gateway */ - private $innerGateway; + private Gateway $innerGateway; public function __construct(Gateway $innerGateway) { diff --git a/src/lib/Persistence/Legacy/Setting/Handler.php b/src/lib/Persistence/Legacy/Setting/Handler.php index 28c2809fa7..6f15397aad 100644 --- a/src/lib/Persistence/Legacy/Setting/Handler.php +++ b/src/lib/Persistence/Legacy/Setting/Handler.php @@ -13,8 +13,7 @@ class Handler implements BaseSettingHandler { - /** @var \Ibexa\Core\Persistence\Legacy\Setting\Gateway */ - protected $settingGateway; + protected Gateway $settingGateway; public function __construct(Gateway $settingGateway) { diff --git a/src/lib/Persistence/Legacy/SharedGateway/GatewayFactory.php b/src/lib/Persistence/Legacy/SharedGateway/GatewayFactory.php index 911089fef5..9e043cbd27 100644 --- a/src/lib/Persistence/Legacy/SharedGateway/GatewayFactory.php +++ b/src/lib/Persistence/Legacy/SharedGateway/GatewayFactory.php @@ -17,11 +17,10 @@ */ final class GatewayFactory { - /** @var \Ibexa\Core\Persistence\Legacy\SharedGateway\Gateway */ - private $fallbackGateway; + private Gateway $fallbackGateway; /** @var \iterable|\Ibexa\Core\Persistence\Legacy\SharedGateway\Gateway[] */ - private $gateways; + private iterable $gateways; public function __construct(Gateway $fallbackGateway, iterable $gateways) { diff --git a/src/lib/Persistence/Legacy/Token/AbstractGateway.php b/src/lib/Persistence/Legacy/Token/AbstractGateway.php index 4d8b8f9752..db7a0470bb 100644 --- a/src/lib/Persistence/Legacy/Token/AbstractGateway.php +++ b/src/lib/Persistence/Legacy/Token/AbstractGateway.php @@ -18,7 +18,7 @@ protected function getAliasedColumns( array $columns ): array { return array_map( - fn (string $column) => $this->getAliasedColumn($column, $alias), + fn (string $column): string => $this->getAliasedColumn($column, $alias), $columns ); } diff --git a/src/lib/Persistence/Legacy/TransactionHandler.php b/src/lib/Persistence/Legacy/TransactionHandler.php index 8615a57ca1..dd3247a80b 100644 --- a/src/lib/Persistence/Legacy/TransactionHandler.php +++ b/src/lib/Persistence/Legacy/TransactionHandler.php @@ -10,7 +10,9 @@ use Doctrine\DBAL\Connection; use Exception; use Ibexa\Contracts\Core\Persistence\TransactionHandler as TransactionHandlerInterface; +use Ibexa\Core\Persistence\Legacy\Content\Language\CachingHandler; use Ibexa\Core\Persistence\Legacy\Content\Language\CachingHandler as CachingLanguageHandler; +use Ibexa\Core\Persistence\Legacy\Content\Type\MemoryCachingHandler; use Ibexa\Core\Persistence\Legacy\Content\Type\MemoryCachingHandler as CachingContentTypeHandler; use RuntimeException; @@ -21,14 +23,11 @@ */ class TransactionHandler implements TransactionHandlerInterface { - /** @var \Doctrine\DBAL\Connection */ - protected $connection; + protected Connection $connection; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler */ - protected $contentTypeHandler; + protected ?MemoryCachingHandler $contentTypeHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Language\Handler */ - protected $languageHandler; + protected ?CachingHandler $languageHandler; public function __construct( Connection $connection, @@ -43,7 +42,7 @@ public function __construct( /** * Begin transaction. */ - public function beginTransaction() + public function beginTransaction(): void { $this->connection->beginTransaction(); } @@ -55,7 +54,7 @@ public function beginTransaction() * * @throws \RuntimeException If no transaction has been started */ - public function commit() + public function commit(): void { try { $this->connection->commit(); @@ -71,7 +70,7 @@ public function commit() * * @throws \RuntimeException If no transaction has been started */ - public function rollback() + public function rollback(): void { try { $this->connection->rollback(); diff --git a/src/lib/Persistence/Legacy/URL/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/URL/Gateway/DoctrineDatabase.php index 20f3247cc6..64d3b8b615 100644 --- a/src/lib/Persistence/Legacy/URL/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/URL/Gateway/DoctrineDatabase.php @@ -44,15 +44,12 @@ class DoctrineDatabase extends Gateway SortClause::SORT_DESC => 'DESC', ]; - /** @var \Doctrine\DBAL\Connection */ - protected $connection; + protected Connection $connection; /** * Criteria converter. - * - * @var \Ibexa\Core\Persistence\Legacy\URL\Query\CriteriaConverter */ - protected $criteriaConverter; + protected CriteriaConverter $criteriaConverter; public function __construct(Connection $connection, CriteriaConverter $criteriaConverter) { @@ -63,7 +60,7 @@ public function __construct(Connection $connection, CriteriaConverter $criteriaC /** * {@inheritdoc} */ - public function find(Criterion $criterion, $offset, $limit, array $sortClauses = [], $doCount = true) + public function find(Criterion $criterion, $offset, $limit, array $sortClauses = [], $doCount = true): array { $count = $doCount ? $this->doCount($criterion) : null; if (!$doCount && $limit === 0) { @@ -137,7 +134,7 @@ public function findUsages($id): array /** * {@inheritdoc} */ - public function updateUrl(URL $url) + public function updateUrl(URL $url): void { $query = $this->connection->createQueryBuilder(); $query diff --git a/src/lib/Persistence/Legacy/URL/Gateway/ExceptionConversion.php b/src/lib/Persistence/Legacy/URL/Gateway/ExceptionConversion.php index 1142fcb0f9..69beecda84 100644 --- a/src/lib/Persistence/Legacy/URL/Gateway/ExceptionConversion.php +++ b/src/lib/Persistence/Legacy/URL/Gateway/ExceptionConversion.php @@ -18,10 +18,8 @@ class ExceptionConversion extends Gateway { /** * The wrapped gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\URL\Gateway */ - protected $innerGateway; + protected Gateway $innerGateway; /** * ExceptionConversion constructor. diff --git a/src/lib/Persistence/Legacy/URL/Handler.php b/src/lib/Persistence/Legacy/URL/Handler.php index c9c5313454..47c8696a7c 100644 --- a/src/lib/Persistence/Legacy/URL/Handler.php +++ b/src/lib/Persistence/Legacy/URL/Handler.php @@ -18,11 +18,9 @@ */ class Handler implements HandlerInterface { - /** @var \Ibexa\Core\Persistence\Legacy\URL\Gateway */ - private $urlGateway; + private Gateway $urlGateway; - /** @var \Ibexa\Core\Persistence\Legacy\URL\Mapper */ - private $urlMapper; + private Mapper $urlMapper; /** * Handler constructor. @@ -54,7 +52,7 @@ public function updateUrl($id, URLUpdateStruct $urlUpdateStruct) /** * {@inheritdoc} */ - public function find(URLQuery $query) + public function find(URLQuery $query): array { $results = $this->urlGateway->find( $query->filter, diff --git a/src/lib/Persistence/Legacy/URL/Mapper.php b/src/lib/Persistence/Legacy/URL/Mapper.php index 9a5da221ef..c18b4572c9 100644 --- a/src/lib/Persistence/Legacy/URL/Mapper.php +++ b/src/lib/Persistence/Legacy/URL/Mapper.php @@ -22,7 +22,7 @@ class Mapper * * @return \Ibexa\Contracts\Core\Persistence\URL\URL */ - public function createURLFromUpdateStruct(URLUpdateStruct $struct) + public function createURLFromUpdateStruct(URLUpdateStruct $struct): URL { $url = new URL(); $url->url = $struct->url; @@ -41,7 +41,7 @@ public function createURLFromUpdateStruct(URLUpdateStruct $struct) * * @return \Ibexa\Contracts\Core\Persistence\URL\URL[] */ - public function extractURLsFromRows(array $rows) + public function extractURLsFromRows(array $rows): array { $urls = []; diff --git a/src/lib/Persistence/Legacy/URL/Query/CriteriaConverter.php b/src/lib/Persistence/Legacy/URL/Query/CriteriaConverter.php index bba52f757f..b041f9d3f1 100644 --- a/src/lib/Persistence/Legacy/URL/Query/CriteriaConverter.php +++ b/src/lib/Persistence/Legacy/URL/Query/CriteriaConverter.php @@ -35,7 +35,7 @@ public function __construct(array $handlers = []) * * @param \Ibexa\Core\Persistence\Legacy\URL\Query\CriterionHandler $handler */ - public function addHandler(CriterionHandler $handler) + public function addHandler(CriterionHandler $handler): void { $this->handlers[] = $handler; } diff --git a/src/lib/Persistence/Legacy/User/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/User/Gateway/DoctrineDatabase.php index 6813a53cd5..f0d084a8e7 100644 --- a/src/lib/Persistence/Legacy/User/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/User/Gateway/DoctrineDatabase.php @@ -26,8 +26,7 @@ */ final class DoctrineDatabase extends Gateway { - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; /** @var \Doctrine\DBAL\Platforms\AbstractPlatform */ private $dbPlatform; diff --git a/src/lib/Persistence/Legacy/User/Gateway/ExceptionConversion.php b/src/lib/Persistence/Legacy/User/Gateway/ExceptionConversion.php index 0a3fc39fe3..209688081e 100644 --- a/src/lib/Persistence/Legacy/User/Gateway/ExceptionConversion.php +++ b/src/lib/Persistence/Legacy/User/Gateway/ExceptionConversion.php @@ -22,10 +22,8 @@ final class ExceptionConversion extends Gateway { /** * The wrapped gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\User\Gateway */ - private $innerGateway; + private Gateway $innerGateway; /** * Create a new exception conversion gateway around $innerGateway. diff --git a/src/lib/Persistence/Legacy/User/Handler.php b/src/lib/Persistence/Legacy/User/Handler.php index d4d809571f..9d03fa1e97 100644 --- a/src/lib/Persistence/Legacy/User/Handler.php +++ b/src/lib/Persistence/Legacy/User/Handler.php @@ -29,27 +29,20 @@ class Handler implements BaseUserHandler { /** * Gateway for storing user data. - * - * @var \Ibexa\Core\Persistence\Legacy\User\Gateway */ - protected $userGateway; + protected Gateway $userGateway; /** * Gateway for storing role data. - * - * @var \Ibexa\Core\Persistence\Legacy\User\Role\Gateway */ - protected $roleGateway; + protected RoleGateway $roleGateway; /** * Mapper for user related objects. - * - * @var \Ibexa\Core\Persistence\Legacy\User\Mapper */ - protected $mapper; + protected Mapper $mapper; - /** @var \Ibexa\Core\Persistence\Legacy\User\Role\LimitationConverter */ - protected $limitationConverter; + protected LimitationConverter $limitationConverter; /** * Construct from userGateway. @@ -77,7 +70,7 @@ public function __construct(Gateway $userGateway, RoleGateway $roleGateway, Mapp * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException */ - public function create(User $user) + public function create(User $user): never { throw new NotImplementedException('This method should not be called, creation is done via content handler.'); } @@ -195,7 +188,7 @@ public function loadUserByToken($hash) * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException */ - public function update(User $user) + public function update(User $user): never { throw new NotImplementedException('This method should not be called, update is done via content handler.'); } @@ -210,7 +203,7 @@ public function updatePassword(User $user): void * * @param \Ibexa\Contracts\Core\Persistence\User\UserTokenUpdateStruct $userTokenUpdateStruct */ - public function updateUserToken(UserTokenUpdateStruct $userTokenUpdateStruct) + public function updateUserToken(UserTokenUpdateStruct $userTokenUpdateStruct): void { $this->userGateway->updateUserToken($userTokenUpdateStruct); } @@ -220,7 +213,7 @@ public function updateUserToken(UserTokenUpdateStruct $userTokenUpdateStruct) * * @param string $hash */ - public function expireUserToken($hash) + public function expireUserToken($hash): void { $this->userGateway->expireUserToken($hash); } @@ -232,7 +225,7 @@ public function expireUserToken($hash) * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException */ - public function delete($userId) + public function delete($userId): never { throw new NotImplementedException('This method should not be called, delete is done via content handler.'); } @@ -415,7 +408,7 @@ public function loadRoles() * * @param \Ibexa\Contracts\Core\Persistence\User\RoleUpdateStruct $role */ - public function updateRole(RoleUpdateStruct $role) + public function updateRole(RoleUpdateStruct $role): void { $this->roleGateway->updateRole($role); } @@ -426,7 +419,7 @@ public function updateRole(RoleUpdateStruct $role) * @param mixed $roleId * @param int $status One of Role::STATUS_DEFINED|Role::STATUS_DRAFT */ - public function deleteRole($roleId, $status = Role::STATUS_DEFINED) + public function deleteRole($roleId, $status = Role::STATUS_DEFINED): void { $role = $this->loadRole($roleId, $status); @@ -442,7 +435,7 @@ public function deleteRole($roleId, $status = Role::STATUS_DEFINED) * * @param mixed $roleDraftId */ - public function publishRoleDraft($roleDraftId) + public function publishRoleDraft($roleDraftId): void { $roleDraft = $this->loadRole($roleDraftId, Role::STATUS_DRAFT); @@ -478,7 +471,7 @@ public function publishRoleDraft($roleDraftId) * * @return \Ibexa\Contracts\Core\Persistence\User\Policy */ - public function addPolicyByRoleDraft($roleId, Policy $policy) + public function addPolicyByRoleDraft($roleId, Policy $policy): Policy { $legacyPolicy = clone $policy; $legacyPolicy->originalId = $policy->id; @@ -500,7 +493,7 @@ public function addPolicyByRoleDraft($roleId, Policy $policy) * * @return \Ibexa\Contracts\Core\Persistence\User\Policy */ - public function addPolicy($roleId, Policy $policy) + public function addPolicy($roleId, Policy $policy): Policy { $legacyPolicy = clone $policy; $this->limitationConverter->toLegacy($legacyPolicy); @@ -519,7 +512,7 @@ public function addPolicy($roleId, Policy $policy) * * @param \Ibexa\Contracts\Core\Persistence\User\Policy $policy */ - public function updatePolicy(Policy $policy) + public function updatePolicy(Policy $policy): void { $policy = clone $policy; $this->limitationConverter->toLegacy($policy); @@ -534,7 +527,7 @@ public function updatePolicy(Policy $policy) * @param mixed $policyId * @param mixed $roleId */ - public function deletePolicy($policyId, $roleId) + public function deletePolicy($policyId, $roleId): void { // Each policy can only be associated to exactly one role. Thus it is // sufficient to use the policyId for identification and just remove @@ -564,7 +557,7 @@ public function deletePolicy($policyId, $roleId) * @param mixed $roleId * @param array $limitation */ - public function assignRole($contentId, $roleId, array $limitation = null) + public function assignRole($contentId, $roleId, array $limitation = null): void { $limitation = $limitation ?: ['' => ['']]; $this->userGateway->assignRole($contentId, $roleId, $limitation); @@ -576,7 +569,7 @@ public function assignRole($contentId, $roleId, array $limitation = null) * @param mixed $contentId The user or user group Id to un-assign the role from. * @param mixed $roleId */ - public function unassignRole($contentId, $roleId) + public function unassignRole($contentId, $roleId): void { $this->userGateway->removeRole($contentId, $roleId); } @@ -586,7 +579,7 @@ public function unassignRole($contentId, $roleId) * * @param mixed $roleAssignmentId The assignment ID. */ - public function removeRoleAssignment($roleAssignmentId) + public function removeRoleAssignment($roleAssignmentId): void { $this->userGateway->removeRoleAssignmentById($roleAssignmentId); } diff --git a/src/lib/Persistence/Legacy/User/Mapper.php b/src/lib/Persistence/Legacy/User/Mapper.php index b18eb8b478..de7fc8b6f1 100644 --- a/src/lib/Persistence/Legacy/User/Mapper.php +++ b/src/lib/Persistence/Legacy/User/Mapper.php @@ -25,7 +25,7 @@ class Mapper * * @return \Ibexa\Contracts\Core\Persistence\User */ - public function mapUser(array $data) + public function mapUser(array $data): User { $user = new User(); $user->id = (int)$data['contentobject_id']; @@ -47,7 +47,7 @@ public function mapUser(array $data) * * @return \Ibexa\Contracts\Core\Persistence\User[] */ - public function mapUsers(array $data) + public function mapUsers(array $data): array { $users = []; foreach ($data as $row) { @@ -111,7 +111,7 @@ public function mapPolicies(array $data): array * * @return \Ibexa\Contracts\Core\Persistence\User\Role */ - public function mapRole(array $data) + public function mapRole(array $data): Role { $role = new Role(); @@ -135,7 +135,7 @@ public function mapRole(array $data) * * @return \Ibexa\Contracts\Core\Persistence\User\Role[] */ - public function mapRoles(array $data) + public function mapRoles(array $data): array { $roleData = []; foreach ($data as $row) { @@ -157,7 +157,7 @@ public function mapRoles(array $data) * * @return \Ibexa\Contracts\Core\Persistence\User\RoleAssignment[] */ - public function mapRoleAssignments(array $data) + public function mapRoleAssignments(array $data): array { $roleAssignmentData = []; foreach ($data as $row) { @@ -195,7 +195,7 @@ public function mapRoleAssignments(array $data) $roleAssignments = []; array_walk_recursive( $roleAssignmentData, - static function ($roleAssignment) use (&$roleAssignments) { + static function ($roleAssignment) use (&$roleAssignments): void { $roleAssignments[] = $roleAssignment; } ); @@ -210,7 +210,7 @@ static function ($roleAssignment) use (&$roleAssignments) { * * @return \Ibexa\Contracts\Core\Persistence\User\RoleCreateStruct */ - public function createCreateStructFromRole(Role $role) + public function createCreateStructFromRole(Role $role): RoleCreateStruct { $createStruct = new RoleCreateStruct(); @@ -227,7 +227,7 @@ public function createCreateStructFromRole(Role $role) * * @return \Ibexa\Contracts\Core\Persistence\User\Role */ - public function createRoleFromCreateStruct(RoleCreateStruct $createStruct) + public function createRoleFromCreateStruct(RoleCreateStruct $createStruct): Role { $role = new Role(); diff --git a/src/lib/Persistence/Legacy/User/Role/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/User/Role/Gateway/DoctrineDatabase.php index 4943584224..f08f5893df 100644 --- a/src/lib/Persistence/Legacy/User/Role/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/User/Role/Gateway/DoctrineDatabase.php @@ -27,8 +27,7 @@ */ final class DoctrineDatabase extends Gateway { - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; /** @var \Doctrine\DBAL\Platforms\AbstractPlatform */ private $dbPlatform; diff --git a/src/lib/Persistence/Legacy/User/Role/Gateway/ExceptionConversion.php b/src/lib/Persistence/Legacy/User/Role/Gateway/ExceptionConversion.php index d0bb7eb64e..954ec3d5dd 100644 --- a/src/lib/Persistence/Legacy/User/Role/Gateway/ExceptionConversion.php +++ b/src/lib/Persistence/Legacy/User/Role/Gateway/ExceptionConversion.php @@ -23,10 +23,8 @@ final class ExceptionConversion extends Gateway { /** * The wrapped gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\User\Role\Gateway */ - private $innerGateway; + private Gateway $innerGateway; /** * Creates a new exception conversion gateway around $innerGateway. diff --git a/src/lib/Persistence/Legacy/User/Role/LimitationConverter.php b/src/lib/Persistence/Legacy/User/Role/LimitationConverter.php index e1d485b966..532311999a 100644 --- a/src/lib/Persistence/Legacy/User/Role/LimitationConverter.php +++ b/src/lib/Persistence/Legacy/User/Role/LimitationConverter.php @@ -34,7 +34,7 @@ public function __construct(array $limitationHandlers = []) * * @param \Ibexa\Core\Persistence\Legacy\User\Role\LimitationHandler $handler */ - public function addHandler(LimitationHandler $handler) + public function addHandler(LimitationHandler $handler): void { $this->limitationHandlers[] = $handler; } @@ -42,7 +42,7 @@ public function addHandler(LimitationHandler $handler) /** * @param \Ibexa\Contracts\Core\Persistence\User\Policy $policy */ - public function toLegacy(Policy $policy) + public function toLegacy(Policy $policy): void { foreach ($this->limitationHandlers as $limitationHandler) { $limitationHandler->toLegacy($policy); @@ -52,7 +52,7 @@ public function toLegacy(Policy $policy) /** * @param \Ibexa\Contracts\Core\Persistence\User\Policy $policy */ - public function toSPI(Policy $policy) + public function toSPI(Policy $policy): void { foreach ($this->limitationHandlers as $limitationHandler) { $limitationHandler->toSPI($policy); diff --git a/src/lib/Persistence/Legacy/User/Role/LimitationHandler.php b/src/lib/Persistence/Legacy/User/Role/LimitationHandler.php index f3f8af0fa2..1aead038db 100644 --- a/src/lib/Persistence/Legacy/User/Role/LimitationHandler.php +++ b/src/lib/Persistence/Legacy/User/Role/LimitationHandler.php @@ -15,7 +15,7 @@ */ abstract class LimitationHandler { - protected $connection; + protected Connection $connection; public function __construct(Connection $connection) { diff --git a/src/lib/Persistence/Legacy/UserPreference/Gateway/DoctrineDatabase.php b/src/lib/Persistence/Legacy/UserPreference/Gateway/DoctrineDatabase.php index 2c004bedec..bae1729611 100644 --- a/src/lib/Persistence/Legacy/UserPreference/Gateway/DoctrineDatabase.php +++ b/src/lib/Persistence/Legacy/UserPreference/Gateway/DoctrineDatabase.php @@ -23,8 +23,7 @@ class DoctrineDatabase extends Gateway public const COLUMN_USER_ID = 'user_id'; public const COLUMN_VALUE = 'value'; - /** @var \Doctrine\DBAL\Connection */ - protected $connection; + protected Connection $connection; public function __construct(Connection $connection) { diff --git a/src/lib/Persistence/Legacy/UserPreference/Gateway/ExceptionConversion.php b/src/lib/Persistence/Legacy/UserPreference/Gateway/ExceptionConversion.php index e9eb328208..a8ec422867 100644 --- a/src/lib/Persistence/Legacy/UserPreference/Gateway/ExceptionConversion.php +++ b/src/lib/Persistence/Legacy/UserPreference/Gateway/ExceptionConversion.php @@ -18,10 +18,8 @@ class ExceptionConversion extends Gateway { /** * The wrapped gateway. - * - * @var \Ibexa\Core\Persistence\Legacy\UserPreference\Gateway */ - protected $innerGateway; + protected Gateway $innerGateway; /** * ExceptionConversion constructor. diff --git a/src/lib/Persistence/Legacy/UserPreference/Handler.php b/src/lib/Persistence/Legacy/UserPreference/Handler.php index 1385c968bd..ffe4f8553b 100644 --- a/src/lib/Persistence/Legacy/UserPreference/Handler.php +++ b/src/lib/Persistence/Legacy/UserPreference/Handler.php @@ -15,11 +15,9 @@ class Handler implements HandlerInterface { - /** @var \Ibexa\Core\Persistence\Legacy\UserPreference\Gateway */ - protected $gateway; + protected Gateway $gateway; - /** @var \Ibexa\Core\Persistence\Legacy\UserPreference\Mapper */ - protected $mapper; + protected Mapper $mapper; /** * @param \Ibexa\Core\Persistence\Legacy\UserPreference\Gateway $gateway diff --git a/src/lib/Persistence/TransformationProcessor.php b/src/lib/Persistence/TransformationProcessor.php index 3b3b98f5f7..00ec586369 100644 --- a/src/lib/Persistence/TransformationProcessor.php +++ b/src/lib/Persistence/TransformationProcessor.php @@ -24,10 +24,8 @@ abstract class TransformationProcessor /** * Parsed rule files. - * - * @var array */ - protected $ruleFiles = []; + protected array $ruleFiles; /** * Compiled rules, which can directly be applied to the input strings. @@ -38,10 +36,8 @@ abstract class TransformationProcessor /** * Transformation compiler. - * - * @var \Ibexa\Core\Persistence\TransformationProcessor\PcreCompiler */ - protected $compiler = null; + protected PcreCompiler $compiler; /** * Construct instance of TransformationProcessor. diff --git a/src/lib/Persistence/TransformationProcessor/DefinitionBased.php b/src/lib/Persistence/TransformationProcessor/DefinitionBased.php index ad6ab55bce..22d64d5de0 100644 --- a/src/lib/Persistence/TransformationProcessor/DefinitionBased.php +++ b/src/lib/Persistence/TransformationProcessor/DefinitionBased.php @@ -17,10 +17,8 @@ class DefinitionBased extends TransformationProcessor { /** * Transformation parser. - * - * @var \Ibexa\Core\Persistence\TransformationProcessor\DefinitionBased\Parser */ - protected $parser = null; + protected Parser $parser; /** * Construct instance of TransformationProcessor\DefinitionBased. diff --git a/src/lib/Persistence/TransformationProcessor/DefinitionBased/Parser.php b/src/lib/Persistence/TransformationProcessor/DefinitionBased/Parser.php index 3222ddab15..a26bb765b3 100644 --- a/src/lib/Persistence/TransformationProcessor/DefinitionBased/Parser.php +++ b/src/lib/Persistence/TransformationProcessor/DefinitionBased/Parser.php @@ -39,10 +39,8 @@ class Parser * * For readability reasons this array is created in the constructor to be * able to use temporary variables. - * - * @var array */ - protected $tokenSpecifications = null; + protected array $tokenSpecifications; /** * Construct. @@ -92,13 +90,13 @@ public function parse($file) * * @return array */ - public function parseString($string) + public function parseString($string): array { $tokens = $this->tokenize($string); $tokens = array_filter( $tokens, - static function ($token): bool { + static function (array $token): bool { return !($token['type'] === TransformationProcessor::T_WHITESPACE || $token['type'] === TransformationProcessor::T_COMMENT); } @@ -131,7 +129,7 @@ static function ($token): bool { * * @return array */ - protected function tokenize($string) + protected function tokenize($string): array { $string = preg_replace('(\\r\\n|\\r)', "\n", $string); $tokens = []; @@ -170,7 +168,7 @@ protected function tokenize($string) * * @return array */ - protected function filterValues(array $data) + protected function filterValues(array $data): array { foreach ($data as $key => $value) { if (is_int($key)) { diff --git a/src/lib/Persistence/TransformationProcessor/PcreCompiler.php b/src/lib/Persistence/TransformationProcessor/PcreCompiler.php index bcbcb98462..93737953ff 100644 --- a/src/lib/Persistence/TransformationProcessor/PcreCompiler.php +++ b/src/lib/Persistence/TransformationProcessor/PcreCompiler.php @@ -19,10 +19,8 @@ class PcreCompiler { /** * Class for converting UTF-8 characters. - * - * @var \Ibexa\Core\Persistence\Utf8Converter */ - protected $converter; + protected Utf8Converter $converter; /** * Construct from UTF8Converter. @@ -45,7 +43,7 @@ public function __construct(Utf8Converter $converter) * * @return array */ - public function compile(array $ast) + public function compile(array $ast): array { $transformations = []; @@ -92,7 +90,7 @@ protected function compileRule(array $rule) * * @return array */ - protected function compileMap(array $rule) + protected function compileMap(array $rule): array { return [ 'regexp' => '(' . preg_quote($this->compileCharacter($rule['data']['src'])) . ')us', @@ -107,7 +105,7 @@ protected function compileMap(array $rule) * * @return array */ - protected function compileReplace(array $rule) + protected function compileReplace(array $rule): array { return [ 'regexp' => '([' . @@ -125,7 +123,7 @@ protected function compileReplace(array $rule) * * @return array */ - protected function compileTranspose(array $rule) + protected function compileTranspose(array $rule): array { return [ 'regexp' => '([' . @@ -143,7 +141,7 @@ protected function compileTranspose(array $rule) * * @return array */ - protected function compileTransposeModulo(array $rule) + protected function compileTransposeModulo(array $rule): array { return [ 'regexp' => '([' . @@ -235,7 +233,7 @@ protected function compileTargetCharacter($char) substr($char, 1, -1) ); - return static function ($matches) use ($string) { + return static function ($matches) use ($string): array|string { return $string; }; diff --git a/src/lib/Persistence/Utf8Converter.php b/src/lib/Persistence/Utf8Converter.php index 2317eca3a3..a8d831d448 100644 --- a/src/lib/Persistence/Utf8Converter.php +++ b/src/lib/Persistence/Utf8Converter.php @@ -84,7 +84,7 @@ public static function toUTF8Character($charCode): string * * @return int */ - public static function toUnicodeCodepoint($char) + public static function toUnicodeCodepoint(string $char): false|int { $charCode = false; // 7bits, 1 char diff --git a/src/lib/Query/QueryFactory.php b/src/lib/Query/QueryFactory.php index 991cd76ecc..5f5862cbf1 100644 --- a/src/lib/Query/QueryFactory.php +++ b/src/lib/Query/QueryFactory.php @@ -13,8 +13,7 @@ final class QueryFactory implements QueryFactoryInterface { - /** @var \Ibexa\Core\QueryType\QueryTypeRegistry */ - private $queryTypeRegistry; + private QueryTypeRegistry $queryTypeRegistry; public function __construct(QueryTypeRegistry $queryTypeRegistry) { diff --git a/src/lib/QueryType/ArrayQueryTypeRegistry.php b/src/lib/QueryType/ArrayQueryTypeRegistry.php index f0086bd6c0..b04d72e955 100644 --- a/src/lib/QueryType/ArrayQueryTypeRegistry.php +++ b/src/lib/QueryType/ArrayQueryTypeRegistry.php @@ -15,14 +15,14 @@ class ArrayQueryTypeRegistry implements QueryTypeRegistry { /** @var QueryType[] */ - private $registry = []; + private array $registry = []; - public function addQueryType($name, QueryType $queryType) + public function addQueryType($name, QueryType $queryType): void { $this->registry[$name] = $queryType; } - public function addQueryTypes(array $queryTypes) + public function addQueryTypes(array $queryTypes): void { $this->registry += $queryTypes; } diff --git a/src/lib/QueryType/BuiltIn/AbstractQueryType.php b/src/lib/QueryType/BuiltIn/AbstractQueryType.php index 28cf18b62d..f36c891814 100644 --- a/src/lib/QueryType/BuiltIn/AbstractQueryType.php +++ b/src/lib/QueryType/BuiltIn/AbstractQueryType.php @@ -25,14 +25,11 @@ abstract class AbstractQueryType extends OptionsResolverBasedQueryType { public const DEFAULT_LIMIT = 25; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - protected $configResolver; + protected ConfigResolverInterface $configResolver; - /** @var \Ibexa\Core\QueryType\BuiltIn\SortClausesFactoryInterface */ - private $sortClausesFactory; + private SortClausesFactoryInterface $sortClausesFactory; public function __construct( Repository $repository, @@ -63,7 +60,7 @@ protected function configureOptions(OptionsResolver $resolver): void 'sort' => [], ]); - $resolver->setNormalizer('sort', function (Options $options, $value) { + $resolver->setNormalizer('sort', function (Options $options, $value): array { if (is_string($value)) { $value = $this->sortClausesFactory->createFromSpecification($value); } diff --git a/src/lib/QueryType/BuiltIn/SortClausesFactory.php b/src/lib/QueryType/BuiltIn/SortClausesFactory.php index 79da7508bb..ea3bbeca90 100644 --- a/src/lib/QueryType/BuiltIn/SortClausesFactory.php +++ b/src/lib/QueryType/BuiltIn/SortClausesFactory.php @@ -17,8 +17,7 @@ */ final class SortClausesFactory implements SortClausesFactoryInterface { - /** @var \Ibexa\Core\QueryType\BuiltIn\SortSpec\SortClauseParserInterface */ - private $sortClauseParser; + private SortClauseParserInterface $sortClauseParser; public function __construct(SortClauseParserInterface $sortClauseArgsParser) { diff --git a/src/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/DefaultSortClauseParser.php b/src/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/DefaultSortClauseParser.php index 481208c67c..0df9c4b7a6 100644 --- a/src/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/DefaultSortClauseParser.php +++ b/src/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/DefaultSortClauseParser.php @@ -19,7 +19,7 @@ final class DefaultSortClauseParser implements SortClauseParserInterface { /** @var string[] */ - private $valueObjectClassMap; + private array $valueObjectClassMap; public function __construct(array $valueObjectClassMap) { diff --git a/src/lib/QueryType/BuiltIn/SortSpec/SortClauseParserDispatcher.php b/src/lib/QueryType/BuiltIn/SortSpec/SortClauseParserDispatcher.php index a843a9bb7d..3331eb038a 100644 --- a/src/lib/QueryType/BuiltIn/SortSpec/SortClauseParserDispatcher.php +++ b/src/lib/QueryType/BuiltIn/SortSpec/SortClauseParserDispatcher.php @@ -14,7 +14,7 @@ final class SortClauseParserDispatcher implements SortClauseParserInterface { /** @var \Ibexa\Core\QueryType\BuiltIn\SortSpec\SortClauseParserInterface[] */ - private $parsers; + private iterable $parsers; public function __construct(iterable $parsers = []) { diff --git a/src/lib/QueryType/BuiltIn/SortSpec/SortSpecLexer.php b/src/lib/QueryType/BuiltIn/SortSpec/SortSpecLexer.php index 26f5ca6d24..cf938ec073 100644 --- a/src/lib/QueryType/BuiltIn/SortSpec/SortSpecLexer.php +++ b/src/lib/QueryType/BuiltIn/SortSpec/SortSpecLexer.php @@ -17,14 +17,12 @@ final class SortSpecLexer implements SortSpecLexerInterface private const FLOAT_PATTERN = '-?[0-9]+\.[0-9]+'; private const INT_PATTERN = '-?[0-9]+'; - /** @var string */ - private $input; + private ?string $input = null; /** @var \Ibexa\Core\QueryType\BuiltIn\SortSpec\Token[] */ - private $tokens = []; + private array $tokens = []; - /** @var int|null */ - private $position; + private ?int $position = null; /** @var \Ibexa\Core\QueryType\BuiltIn\SortSpec\Token|null */ private $current; diff --git a/src/lib/QueryType/BuiltIn/SortSpec/SortSpecParser.php b/src/lib/QueryType/BuiltIn/SortSpec/SortSpecParser.php index 19824ff228..0f9fc7c09c 100644 --- a/src/lib/QueryType/BuiltIn/SortSpec/SortSpecParser.php +++ b/src/lib/QueryType/BuiltIn/SortSpec/SortSpecParser.php @@ -32,11 +32,9 @@ final class SortSpecParser implements SortSpecParserInterface { private const DEFAULT_SORT_DIRECTION = Query::SORT_ASC; - /** @var \Ibexa\Core\QueryType\BuiltIn\SortSpec\SortSpecLexerInterface */ - private $lexer; + private ?SortSpecLexerInterface $lexer; - /** @var \Ibexa\Core\QueryType\BuiltIn\SortSpec\SortClauseParserInterface */ - private $sortClauseParser; + private SortClauseParserInterface $sortClauseParser; public function __construct(SortClauseParserInterface $sortClauseParser, SortSpecLexerInterface $lexer = null) { diff --git a/src/lib/QueryType/BuiltIn/SortSpec/Token.php b/src/lib/QueryType/BuiltIn/SortSpec/Token.php index 3e2376dc16..8ed3c4a834 100644 --- a/src/lib/QueryType/BuiltIn/SortSpec/Token.php +++ b/src/lib/QueryType/BuiltIn/SortSpec/Token.php @@ -20,14 +20,11 @@ final class Token public const TYPE_FLOAT = ''; public const TYPE_EOF = ''; - /** @var string */ - private $type; + private string $type; - /** @var string */ - private $value; + private string $value; - /** @var int */ - private $position; + private int $position; public function __construct(string $type, string $value = '', int $position = -1) { diff --git a/src/lib/QueryType/OptionsResolverBasedQueryType.php b/src/lib/QueryType/OptionsResolverBasedQueryType.php index d0a0b1ee7f..7c606bd1d7 100644 --- a/src/lib/QueryType/OptionsResolverBasedQueryType.php +++ b/src/lib/QueryType/OptionsResolverBasedQueryType.php @@ -22,8 +22,7 @@ */ abstract class OptionsResolverBasedQueryType implements QueryType { - /** @var \Symfony\Component\OptionsResolver\OptionsResolver */ - private $resolver; + private ?OptionsResolver $resolver = null; /** * Configures the OptionsResolver for the QueryType. diff --git a/src/lib/QueryType/QueryParameterContentViewQueryTypeMapper.php b/src/lib/QueryType/QueryParameterContentViewQueryTypeMapper.php index 676bf942b0..f9aec0b322 100644 --- a/src/lib/QueryType/QueryParameterContentViewQueryTypeMapper.php +++ b/src/lib/QueryType/QueryParameterContentViewQueryTypeMapper.php @@ -45,7 +45,7 @@ public function map(ContentView $contentView): Query * * @return array */ - private function extractParametersFromContentView(ContentView $contentView) + private function extractParametersFromContentView(ContentView $contentView): array { $queryParameters = []; diff --git a/src/lib/Repository/BookmarkService.php b/src/lib/Repository/BookmarkService.php index 14831759bf..886037ca47 100644 --- a/src/lib/Repository/BookmarkService.php +++ b/src/lib/Repository/BookmarkService.php @@ -11,8 +11,10 @@ use Exception; use Ibexa\Contracts\Core\Persistence\Bookmark\Bookmark; use Ibexa\Contracts\Core\Persistence\Bookmark\CreateStruct; +use Ibexa\Contracts\Core\Persistence\Bookmark\Handler; use Ibexa\Contracts\Core\Persistence\Bookmark\Handler as BookmarkHandler; use Ibexa\Contracts\Core\Repository\BookmarkService as BookmarkServiceInterface; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; use Ibexa\Contracts\Core\Repository\Values\Bookmark\BookmarkList; use Ibexa\Contracts\Core\Repository\Values\Content\Location; @@ -20,11 +22,9 @@ class BookmarkService implements BookmarkServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Contracts\Core\Persistence\Bookmark\Handler */ - protected $bookmarkHandler; + protected Handler $bookmarkHandler; /** * BookmarkService constructor. diff --git a/src/lib/Repository/ContentService.php b/src/lib/Repository/ContentService.php index 07f00188fb..2fe806c70c 100644 --- a/src/lib/Repository/ContentService.php +++ b/src/lib/Repository/ContentService.php @@ -27,6 +27,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException as APINotFoundException; use Ibexa\Contracts\Core\Repository\NameSchema\NameSchemaServiceInterface; use Ibexa\Contracts\Core\Repository\PermissionService; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; use Ibexa\Contracts\Core\Repository\Validator\ContentValidator; use Ibexa\Contracts\Core\Repository\Values\Content\Content as APIContent; @@ -60,6 +61,7 @@ use Ibexa\Core\Base\Exceptions\NotFoundException; use Ibexa\Core\Base\Exceptions\UnauthorizedException; use Ibexa\Core\FieldType\FieldTypeRegistry; +use Ibexa\Core\Repository\Helper\RelationProcessor; use Ibexa\Core\Repository\Mapper\ContentDomainMapper; use Ibexa\Core\Repository\Mapper\ContentMapper; use Ibexa\Core\Repository\Values\Content\Content; @@ -75,42 +77,34 @@ class ContentService implements ContentServiceInterface { /** @var \Ibexa\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Contracts\Core\Persistence\Handler */ - protected $persistenceHandler; + protected Handler $persistenceHandler; /** @var array */ protected $settings; - /** @var \Ibexa\Core\Repository\Mapper\ContentDomainMapper */ - protected $contentDomainMapper; + protected ContentDomainMapper $contentDomainMapper; - /** @var \Ibexa\Core\Repository\Helper\RelationProcessor */ - protected $relationProcessor; + protected RelationProcessor $relationProcessor; protected NameSchemaServiceInterface $nameSchemaService; - /** @var \Ibexa\Core\FieldType\FieldTypeRegistry */ - protected $fieldTypeRegistry; + protected FieldTypeRegistry $fieldTypeRegistry; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionService $permissionResolver; - /** @var \Ibexa\Core\Repository\Mapper\ContentMapper */ - private $contentMapper; + private ContentMapper $contentMapper; - /** @var \Ibexa\Contracts\Core\Repository\Validator\ContentValidator */ - private $contentValidator; + private ContentValidator $contentValidator; - /** @var \Ibexa\Contracts\Core\Persistence\Filter\Content\Handler */ - private $contentFilteringHandler; + private ContentFilteringHandler $contentFilteringHandler; public function __construct( RepositoryInterface $repository, Handler $handler, ContentDomainMapper $contentDomainMapper, - Helper\RelationProcessor $relationProcessor, + RelationProcessor $relationProcessor, NameSchemaServiceInterface $nameSchemaService, FieldTypeRegistry $fieldTypeRegistry, PermissionService $permissionService, diff --git a/src/lib/Repository/ContentTypeService.php b/src/lib/Repository/ContentTypeService.php index 972f20aa7e..002aaf669c 100644 --- a/src/lib/Repository/ContentTypeService.php +++ b/src/lib/Repository/ContentTypeService.php @@ -21,6 +21,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException as APIBadStateException; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException as APINotFoundException; use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; @@ -31,6 +32,7 @@ use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroupCreateStruct; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroupUpdateStruct; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeUpdateStruct; +use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition; use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition as APIFieldDefinition; use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionCreateStruct; use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionUpdateStruct; @@ -45,34 +47,28 @@ use Ibexa\Core\Base\Exceptions\UnauthorizedException; use Ibexa\Core\FieldType\FieldTypeRegistry; use Ibexa\Core\FieldType\ValidationError; +use Ibexa\Core\Repository\Mapper\ContentDomainMapper; +use Ibexa\Core\Repository\Mapper\ContentTypeDomainMapper; use Ibexa\Core\Repository\Values\ContentType\ContentTypeCreateStruct; use Ibexa\Core\Repository\Values\ContentType\ContentTypeGroup; class ContentTypeService implements ContentTypeServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler */ - protected $contentTypeHandler; + protected Handler $contentTypeHandler; - /** @var \Ibexa\Contracts\Core\Persistence\User\Handler */ - protected $userHandler; + protected UserHandler $userHandler; - /** @var array */ - protected $settings; + protected array $settings; - /** @var \Ibexa\Core\Repository\Mapper\ContentDomainMapper */ - protected $contentDomainMapper; + protected ContentDomainMapper $contentDomainMapper; - /** @var \Ibexa\Core\Repository\Mapper\ContentTypeDomainMapper */ - protected $contentTypeDomainMapper; + protected ContentTypeDomainMapper $contentTypeDomainMapper; - /** @var \Ibexa\Core\FieldType\FieldTypeRegistry */ - protected $fieldTypeRegistry; + protected FieldTypeRegistry $fieldTypeRegistry; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; /** * Setups service with reference to repository object that created it & corresponding handler. @@ -90,8 +86,8 @@ public function __construct( RepositoryInterface $repository, Handler $contentTypeHandler, UserHandler $userHandler, - Mapper\ContentDomainMapper $contentDomainMapper, - Mapper\ContentTypeDomainMapper $contentTypeDomainMapper, + ContentDomainMapper $contentDomainMapper, + ContentTypeDomainMapper $contentTypeDomainMapper, FieldTypeRegistry $fieldTypeRegistry, PermissionResolver $permissionResolver, array $settings = [] @@ -1139,7 +1135,7 @@ public function copyContentType(APIContentType $contentType, User $creator = nul throw new UnauthorizedException('ContentType', 'create'); } - if (empty($creator)) { + if (!$creator instanceof User) { $creator = $this->permissionResolver->getCurrentUserReference(); } @@ -1361,7 +1357,7 @@ public function removeFieldDefinition(APIContentTypeDraft $contentTypeDraft, API $fieldDefinition->identifier ); - if (empty($loadedFieldDefinition) || $loadedFieldDefinition->id != $fieldDefinition->id) { + if (!$loadedFieldDefinition instanceof FieldDefinition || $loadedFieldDefinition->id != $fieldDefinition->id) { throw new InvalidArgumentException( '$fieldDefinition', 'The given Field definition does not belong to the content type' diff --git a/src/lib/Repository/EventSubscriber/DeleteUserSubscriber.php b/src/lib/Repository/EventSubscriber/DeleteUserSubscriber.php index 6592f88207..2eb1de184f 100644 --- a/src/lib/Repository/EventSubscriber/DeleteUserSubscriber.php +++ b/src/lib/Repository/EventSubscriber/DeleteUserSubscriber.php @@ -14,8 +14,7 @@ class DeleteUserSubscriber implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - private $contentTypeService; + private ContentTypeService $contentTypeService; public function __construct(ContentTypeService $contentTypeService) { diff --git a/src/lib/Repository/FieldTypeService.php b/src/lib/Repository/FieldTypeService.php index 2bd95d4de2..4f6d34ce66 100644 --- a/src/lib/Repository/FieldTypeService.php +++ b/src/lib/Repository/FieldTypeService.php @@ -20,8 +20,7 @@ */ class FieldTypeService implements FieldTypeServiceInterface { - /** @var \Ibexa\Core\FieldType\FieldTypeRegistry */ - protected $fieldTypeRegistry; + protected FieldTypeRegistry $fieldTypeRegistry; /** * Holds an array of FieldType objects to avoid re creating them all the time from SPI variants. diff --git a/src/lib/Repository/Helper/RelationProcessor.php b/src/lib/Repository/Helper/RelationProcessor.php index 72066bdfab..932157d128 100644 --- a/src/lib/Repository/Helper/RelationProcessor.php +++ b/src/lib/Repository/Helper/RelationProcessor.php @@ -26,8 +26,7 @@ class RelationProcessor { use LoggerAwareTrait; - /** @var \Ibexa\Contracts\Core\Persistence\Handler */ - protected $persistenceHandler; + protected Handler $persistenceHandler; /** * Setups service with reference to repository object that created it & corresponding handler. @@ -57,7 +56,7 @@ public function appendFieldRelations( SPIFieldType $fieldType, BaseValue $fieldValue, $fieldDefinitionId - ) { + ): void { foreach ($fieldType->getRelations($fieldValue) as $relationType => $destinationIds) { if ($relationType & (Relation::FIELD | Relation::ASSET)) { if (!isset($relations[$relationType][$fieldDefinitionId])) { @@ -113,7 +112,7 @@ public function processFieldRelations( $sourceContentVersionNo, ContentType $contentType, array $existingRelations = [] - ) { + ): void { // Map existing relations for easier handling $mappedRelations = []; foreach ($existingRelations as $relation) { diff --git a/src/lib/Repository/LanguageService.php b/src/lib/Repository/LanguageService.php index 539e25ba40..6e594e1e2f 100644 --- a/src/lib/Repository/LanguageService.php +++ b/src/lib/Repository/LanguageService.php @@ -14,6 +14,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException as APINotFoundException; use Ibexa\Contracts\Core\Repository\LanguageService as LanguageServiceInterface; use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Ibexa\Contracts\Core\Repository\Values\Content\LanguageCreateStruct; @@ -27,17 +28,14 @@ */ class LanguageService implements LanguageServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Language\Handler */ - protected $languageHandler; + protected Handler $languageHandler; /** @var array */ protected $settings; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; /** * Setups service with reference to repository object that created it & corresponding handler. @@ -394,7 +392,7 @@ public function newLanguageCreateStruct(): LanguageCreateStruct * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language */ - protected function buildDomainObject(SPILanguage $spiLanguage) + protected function buildDomainObject(SPILanguage $spiLanguage): Language { return new Language( [ diff --git a/src/lib/Repository/LocationResolver/PermissionAwareLocationResolver.php b/src/lib/Repository/LocationResolver/PermissionAwareLocationResolver.php index 221e43b83b..eb83d74093 100644 --- a/src/lib/Repository/LocationResolver/PermissionAwareLocationResolver.php +++ b/src/lib/Repository/LocationResolver/PermissionAwareLocationResolver.php @@ -20,8 +20,7 @@ */ final class PermissionAwareLocationResolver implements LocationResolver { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - private $locationService; + private LocationService $locationService; public function __construct(LocationService $locationService) { diff --git a/src/lib/Repository/LocationService.php b/src/lib/Repository/LocationService.php index b37a0ac5ed..0b0400c32f 100644 --- a/src/lib/Repository/LocationService.php +++ b/src/lib/Repository/LocationService.php @@ -21,6 +21,7 @@ use Ibexa\Contracts\Core\Repository\NameSchema\NameSchemaServiceInterface; use Ibexa\Contracts\Core\Repository\PermissionCriterionResolver; use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Language; @@ -56,33 +57,25 @@ class LocationService implements LocationServiceInterface { /** @var \Ibexa\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Contracts\Core\Persistence\Handler */ - protected $persistenceHandler; + protected Handler $persistenceHandler; - /** @var array */ - protected $settings; + protected array $settings; - /** @var \Ibexa\Core\Repository\Mapper\ContentDomainMapper */ - protected $contentDomainMapper; + protected ContentDomainMapper $contentDomainMapper; protected NameSchemaServiceInterface $nameSchemaService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionCriterionResolver */ - protected $permissionCriterionResolver; + protected PermissionCriterionResolver $permissionCriterionResolver; - /** @var \Psr\Log\LoggerInterface */ - private $logger; + private LoggerInterface $logger; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; - /** @var \Ibexa\Contracts\Core\Persistence\Filter\Location\Handler */ - private $locationFilteringHandler; + private LocationFilteringHandler $locationFilteringHandler; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - protected $contentTypeService; + protected ContentTypeService $contentTypeService; /** * Setups service with reference to repository object that created it & corresponding handler. diff --git a/src/lib/Repository/Mapper/ContentDomainMapper.php b/src/lib/Repository/Mapper/ContentDomainMapper.php index cba3fe720c..d15890f3f8 100644 --- a/src/lib/Repository/Mapper/ContentDomainMapper.php +++ b/src/lib/Repository/Mapper/ContentDomainMapper.php @@ -10,9 +10,11 @@ use DateTime; use Ibexa\Contracts\Core\Persistence\Content as SPIContent; use Ibexa\Contracts\Core\Persistence\Content\ContentInfo as SPIContentInfo; +use Ibexa\Contracts\Core\Persistence\Content\Handler; use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler; use Ibexa\Contracts\Core\Persistence\Content\Language\Handler as LanguageHandler; use Ibexa\Contracts\Core\Persistence\Content\Location as SPILocation; +use Ibexa\Contracts\Core\Persistence\Content\Location\CreateStruct; use Ibexa\Contracts\Core\Persistence\Content\Location\CreateStruct as SPILocationCreateStruct; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Persistence\Content\Relation as SPIRelation; @@ -54,26 +56,19 @@ class ContentDomainMapper extends ProxyAwareDomainMapper implements LoggerAwareI public const MAX_LOCATION_PRIORITY = 2147483647; public const MIN_LOCATION_PRIORITY = -2147483648; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Handler */ - protected $contentHandler; + protected Handler $contentHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Location\Handler */ - protected $locationHandler; + protected LocationHandler $locationHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler */ - protected $contentTypeHandler; + protected TypeHandler $contentTypeHandler; - /** @var \Ibexa\Core\Repository\Mapper\ContentTypeDomainMapper */ - protected $contentTypeDomainMapper; + protected ContentTypeDomainMapper $contentTypeDomainMapper; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Language\Handler */ - protected $contentLanguageHandler; + protected LanguageHandler $contentLanguageHandler; - /** @var \Ibexa\Core\FieldType\FieldTypeRegistry */ - protected $fieldTypeRegistry; + protected FieldTypeRegistry $fieldTypeRegistry; - /** @var \Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\ThumbnailStrategy */ - private $thumbnailStrategy; + private ThumbnailStrategy $thumbnailStrategy; public function __construct( ContentHandler $contentHandler, @@ -112,7 +107,7 @@ public function buildContentDomainObject( ContentType $contentType, array $prioritizedLanguages = [], string $fieldAlwaysAvailableLanguage = null - ) { + ): Content { $prioritizedFieldLanguageCode = null; if (!empty($prioritizedLanguages)) { $availableFieldLanguageMap = array_fill_keys($spiContent->versionInfo->languageCodes, true); @@ -177,7 +172,7 @@ public function buildContentDomainObjectFromPersistence( * Builds a Content proxy object (lazy loaded, loads as soon as used). */ public function buildContentProxy( - SPIContent\ContentInfo $info, + SPIContentInfo $info, array $prioritizedLanguages = [], bool $useAlwaysAvailable = true ): APIContent { @@ -305,7 +300,7 @@ public function buildDomainFields( * * @return \Ibexa\Core\Repository\Values\Content\VersionInfo */ - public function buildVersionInfoDomainObject(SPIVersionInfo $spiVersionInfo, array $prioritizedLanguages = []) + public function buildVersionInfoDomainObject(SPIVersionInfo $spiVersionInfo, array $prioritizedLanguages = []): VersionInfo { // Map SPI statuses to API switch ($spiVersionInfo->status) { @@ -358,7 +353,7 @@ public function buildVersionInfoDomainObject(SPIVersionInfo $spiVersionInfo, arr * * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ - public function buildContentInfoDomainObject(SPIContentInfo $spiContentInfo) + public function buildContentInfoDomainObject(SPIContentInfo $spiContentInfo): ContentInfo { // Map SPI statuses to API switch ($spiContentInfo->status) { @@ -418,7 +413,7 @@ public function buildRelationDomainObject( SPIRelation $spiRelation, ContentInfo $sourceContentInfo, ContentInfo $destinationContentInfo - ) { + ): Relation { $sourceFieldDefinitionIdentifier = null; if ($spiRelation->sourceFieldDefinitionId !== null) { $contentType = $this->contentTypeHandler->load($sourceContentInfo->contentTypeId); @@ -449,7 +444,7 @@ public function buildRelationDomainObject( public function buildLocationDomainObject( SPILocation $spiLocation, SPIContentInfo $contentInfo = null - ) { + ): APILocation { if ($contentInfo === null) { return $this->buildLocation($spiLocation); } @@ -568,7 +563,7 @@ private function buildRootLocation(SPILocation $spiLocation): APILocation private function mapLocation( SPILocation $spiLocation, ContentInfo $contentInfo, - APIContent $content, + APIContent|Content $content, ?APILocation $parentLocation = null ): APILocation { return new Location( @@ -601,7 +596,7 @@ private function mapLocation( * * @return \Ibexa\Contracts\Core\Persistence\Content\ContentInfo[] ContentInfo we did not find content for is returned. */ - public function buildContentDomainObjectsOnSearchResult(SearchResult $result, array $languageFilter) + public function buildContentDomainObjectsOnSearchResult(SearchResult $result, array $languageFilter): array { if (empty($result->searchHits)) { return []; @@ -660,7 +655,7 @@ public function buildContentDomainObjectsOnSearchResult(SearchResult $result, ar * * @return \Ibexa\Contracts\Core\Persistence\Content\Location[] Locations we did not find content info for is returned. */ - public function buildLocationDomainObjectsOnSearchResult(SearchResult $result, array $languageFilter) + public function buildLocationDomainObjectsOnSearchResult(SearchResult $result, array $languageFilter): array { if (empty($result->searchHits)) { return []; @@ -715,7 +710,7 @@ public function buildSPILocationCreateStruct( $contentId, $contentVersionNo, bool $isContentHidden - ) { + ): CreateStruct { if (!$this->isValidLocationPriority($locationCreateStruct->priority)) { throw new InvalidArgumentValue('priority', $locationCreateStruct->priority, 'LocationCreateStruct'); } @@ -840,7 +835,7 @@ public function isValidLocationPriority($priority): bool * @param mixed $list * @param string $argumentName */ - public function validateTranslatedList($list, $argumentName) + public function validateTranslatedList($list, string $argumentName): void { if (!is_array($list)) { throw new InvalidArgumentType($argumentName, 'array', $list); @@ -865,7 +860,7 @@ public function validateTranslatedList($list, $argumentName) * * @return \DateTime */ - public function getDateTime($timestamp) + public function getDateTime($timestamp): DateTime { $dateTime = new DateTime(); $dateTime->setTimestamp((int)$timestamp); diff --git a/src/lib/Repository/Mapper/ContentLocationMapper/DecoratedLocationService.php b/src/lib/Repository/Mapper/ContentLocationMapper/DecoratedLocationService.php index 2530991b36..63598cfd77 100644 --- a/src/lib/Repository/Mapper/ContentLocationMapper/DecoratedLocationService.php +++ b/src/lib/Repository/Mapper/ContentLocationMapper/DecoratedLocationService.php @@ -21,8 +21,7 @@ */ final class DecoratedLocationService extends LocationServiceDecorator { - /** @var \Ibexa\Core\Repository\Mapper\ContentLocationMapper\ContentLocationMapper */ - private $contentLocationMapper; + private ContentLocationMapper $contentLocationMapper; public function __construct( RepositoryLocationService $innerService, diff --git a/src/lib/Repository/Mapper/ContentLocationMapper/InMemoryContentLocationMapper.php b/src/lib/Repository/Mapper/ContentLocationMapper/InMemoryContentLocationMapper.php index 31b58b586d..8f9d08094f 100644 --- a/src/lib/Repository/Mapper/ContentLocationMapper/InMemoryContentLocationMapper.php +++ b/src/lib/Repository/Mapper/ContentLocationMapper/InMemoryContentLocationMapper.php @@ -24,7 +24,7 @@ final class InMemoryContentLocationMapper implements ContentLocationMapper { /** @var array */ - private $map; + private array $map; /** * @param int[] $map diff --git a/src/lib/Repository/Mapper/ContentMapper.php b/src/lib/Repository/Mapper/ContentMapper.php index cedce66219..f6576fb612 100644 --- a/src/lib/Repository/Mapper/ContentMapper.php +++ b/src/lib/Repository/Mapper/ContentMapper.php @@ -25,10 +25,9 @@ class ContentMapper { /** @var \Ibexa\Core\Persistence\Legacy\Content\Language\Handler */ - private $contentLanguageHandler; + private Handler $contentLanguageHandler; - /** @var \Ibexa\Core\FieldType\FieldTypeRegistry */ - private $fieldTypeRegistry; + private FieldTypeRegistry $fieldTypeRegistry; public function __construct( Handler $contentLanguageHandler, @@ -308,7 +307,7 @@ public function getFieldsForUpdate(array $updatedFields, Content $content): arra !in_array($updatedField->languageCode, $content->versionInfo->languageCodes, true) ); - if (!empty($field)) { + if ($field instanceof Field) { $updatedFieldHash = md5(json_encode($fieldType->toHash($updatedFieldValue))); $contentFieldHash = md5(json_encode($fieldType->toHash($field->value))); diff --git a/src/lib/Repository/Mapper/ContentTypeDomainMapper.php b/src/lib/Repository/Mapper/ContentTypeDomainMapper.php index 05dab96cc3..1afcc273a2 100644 --- a/src/lib/Repository/Mapper/ContentTypeDomainMapper.php +++ b/src/lib/Repository/Mapper/ContentTypeDomainMapper.php @@ -14,7 +14,9 @@ use Ibexa\Contracts\Core\Persistence\Content\Type as SPIContentType; use Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition as SPIFieldDefinition; use Ibexa\Contracts\Core\Persistence\Content\Type\Group as SPIContentTypeGroup; +use Ibexa\Contracts\Core\Persistence\Content\Type\Handler; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as SPITypeHandler; +use Ibexa\Contracts\Core\Persistence\Content\Type\UpdateStruct; use Ibexa\Contracts\Core\Persistence\Content\Type\UpdateStruct as SPIContentTypeUpdateStruct; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType as APIContentType; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft as APIContentTypeDraft; @@ -41,14 +43,11 @@ */ class ContentTypeDomainMapper extends ProxyAwareDomainMapper { - /** @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler */ - protected $contentTypeHandler; + protected Handler $contentTypeHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Language\Handler */ - protected $contentLanguageHandler; + protected SPILanguageHandler $contentLanguageHandler; - /** @var \Ibexa\Core\FieldType\FieldTypeRegistry */ - protected $fieldTypeRegistry; + protected FieldTypeRegistry $fieldTypeRegistry; public function __construct( SPITypeHandler $contentTypeHandler, @@ -121,7 +120,7 @@ public function buildContentTypeDomainObject( * * @return \Ibexa\Contracts\Core\Persistence\Content\Type\UpdateStruct */ - public function buildSPIContentTypeUpdateStruct(APIContentTypeDraft $contentTypeDraft, APIContentTypeUpdateStruct $contentTypeUpdateStruct, APIUserReference $user) + public function buildSPIContentTypeUpdateStruct(APIContentTypeDraft $contentTypeDraft, APIContentTypeUpdateStruct $contentTypeUpdateStruct, APIUserReference $user): UpdateStruct { $updateStruct = new SPIContentTypeUpdateStruct(); @@ -218,7 +217,7 @@ public function buildContentTypeGroupDomainObject(SPIContentTypeGroup $spiGroup, * * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition */ - public function buildFieldDefinitionDomainObject(SPIFieldDefinition $spiFieldDefinition, $mainLanguageCode, array $prioritizedLanguages = []) + public function buildFieldDefinitionDomainObject(SPIFieldDefinition $spiFieldDefinition, $mainLanguageCode, array $prioritizedLanguages = []): FieldDefinition { /** @var $fieldType \Ibexa\Contracts\Core\FieldType\FieldType */ $fieldType = $this->fieldTypeRegistry->getFieldType($spiFieldDefinition->fieldType); diff --git a/src/lib/Repository/Mapper/ProxyAwareDomainMapper.php b/src/lib/Repository/Mapper/ProxyAwareDomainMapper.php index 30936d739c..0dcfa7f458 100644 --- a/src/lib/Repository/Mapper/ProxyAwareDomainMapper.php +++ b/src/lib/Repository/Mapper/ProxyAwareDomainMapper.php @@ -17,8 +17,7 @@ */ abstract class ProxyAwareDomainMapper { - /** @var \Ibexa\Core\Repository\ProxyFactory\ProxyDomainMapperInterface */ - protected $proxyFactory; + protected ?ProxyDomainMapperInterface $proxyFactory; public function __construct(?ProxyDomainMapperInterface $proxyFactory = null) { diff --git a/src/lib/Repository/Mapper/RoleDomainMapper.php b/src/lib/Repository/Mapper/RoleDomainMapper.php index 43d4a25819..ab661a3824 100644 --- a/src/lib/Repository/Mapper/RoleDomainMapper.php +++ b/src/lib/Repository/Mapper/RoleDomainMapper.php @@ -32,8 +32,7 @@ */ class RoleDomainMapper { - /** @var \Ibexa\Core\Repository\Permission\LimitationService */ - protected $limitationService; + protected LimitationService $limitationService; /** * @param \Ibexa\Core\Repository\Permission\LimitationService $limitationService @@ -50,7 +49,7 @@ public function __construct(LimitationService $limitationService) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Role */ - public function buildDomainRoleObject(SPIRole $role) + public function buildDomainRoleObject(SPIRole $role): Role { $rolePolicies = []; foreach ($role->policies as $spiPolicy) { @@ -75,7 +74,7 @@ public function buildDomainRoleObject(SPIRole $role) * * @return \Ibexa\Contracts\Core\Repository\Values\User\RoleDraft */ - public function buildDomainRoleDraftObject(SPIRole $spiRole) + public function buildDomainRoleDraftObject(SPIRole $spiRole): RoleDraft { return new RoleDraft( [ @@ -91,7 +90,7 @@ public function buildDomainRoleDraftObject(SPIRole $spiRole) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Policy|\Ibexa\Contracts\Core\Repository\Values\User\PolicyDraft */ - public function buildDomainPolicyObject(SPIPolicy $spiPolicy) + public function buildDomainPolicyObject(SPIPolicy $spiPolicy): Policy|PolicyDraft { $policyLimitations = []; if ($spiPolicy->module !== '*' && $spiPolicy->function !== '*' && $spiPolicy->limitations !== '*') { @@ -127,7 +126,7 @@ public function buildDomainPolicyObject(SPIPolicy $spiPolicy) * * @return \Ibexa\Contracts\Core\Repository\Values\User\UserRoleAssignment */ - public function buildDomainUserRoleAssignmentObject(SPIRoleAssignment $spiRoleAssignment, User $user, APIRole $role) + public function buildDomainUserRoleAssignmentObject(SPIRoleAssignment $spiRoleAssignment, User $user, APIRole $role): UserRoleAssignment { $limitation = null; if (!empty($spiRoleAssignment->limitationIdentifier)) { @@ -156,7 +155,7 @@ public function buildDomainUserRoleAssignmentObject(SPIRoleAssignment $spiRoleAs * * @return \Ibexa\Contracts\Core\Repository\Values\User\UserGroupRoleAssignment */ - public function buildDomainUserGroupRoleAssignmentObject(SPIRoleAssignment $spiRoleAssignment, UserGroup $userGroup, APIRole $role) + public function buildDomainUserGroupRoleAssignmentObject(SPIRoleAssignment $spiRoleAssignment, UserGroup $userGroup, APIRole $role): UserGroupRoleAssignment { $limitation = null; if (!empty($spiRoleAssignment->limitationIdentifier)) { @@ -231,7 +230,7 @@ protected function fillRoleStructWithPolicies(APIRoleCreateStruct $struct): arra * * @return \Ibexa\Contracts\Core\Persistence\User\Policy */ - public function buildPersistencePolicyObject($module, $function, array $limitations) + public function buildPersistencePolicyObject($module, $function, array $limitations): SPIPolicy { $limitationsToCreate = '*'; if ($module !== '*' && $function !== '*' && !empty($limitations)) { diff --git a/src/lib/Repository/NotificationService.php b/src/lib/Repository/NotificationService.php index 81708f7e1f..77133b148e 100644 --- a/src/lib/Repository/NotificationService.php +++ b/src/lib/Repository/NotificationService.php @@ -24,11 +24,9 @@ class NotificationService implements NotificationServiceInterface { - /** @var \Ibexa\Contracts\Core\Persistence\Notification\Handler */ - protected $persistenceHandler; + protected Handler $persistenceHandler; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - protected $permissionResolver; + protected PermissionResolver $permissionResolver; /** * @param \Ibexa\Contracts\Core\Persistence\Notification\Handler $persistenceHandler @@ -50,7 +48,7 @@ public function loadNotifications(int $offset = 0, int $limit = 25): Notificatio $list = new NotificationList(); $list->totalCount = $this->persistenceHandler->countNotifications($currentUserId); if ($list->totalCount > 0) { - $list->items = array_map(function (Notification $spiNotification) { + $list->items = array_map(function (Notification $spiNotification): APINotification { return $this->buildDomainObject($spiNotification); }, $this->persistenceHandler->loadUserNotifications($currentUserId, $offset, $limit)); } diff --git a/src/lib/Repository/ObjectStateService.php b/src/lib/Repository/ObjectStateService.php index 054cb51741..57401659a8 100644 --- a/src/lib/Repository/ObjectStateService.php +++ b/src/lib/Repository/ObjectStateService.php @@ -15,6 +15,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException as APINotFoundException; use Ibexa\Contracts\Core\Repository\ObjectStateService as ObjectStateServiceInterface; use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState as APIObjectState; @@ -35,17 +36,13 @@ */ class ObjectStateService implements ObjectStateServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Contracts\Core\Persistence\Content\ObjectState\Handler */ - protected $objectStateHandler; + protected Handler $objectStateHandler; - /** @var array */ - protected $settings; + protected array $settings; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; /** * Setups service with reference to repository object that created it & corresponding handler. diff --git a/src/lib/Repository/Permission/CachedPermissionService.php b/src/lib/Repository/Permission/CachedPermissionService.php index 36dabe0d14..1a2c4a9e5b 100644 --- a/src/lib/Repository/Permission/CachedPermissionService.php +++ b/src/lib/Repository/Permission/CachedPermissionService.php @@ -9,7 +9,9 @@ namespace Ibexa\Core\Repository\Permission; use Exception; +use Ibexa\Contracts\Core\Repository\PermissionCriterionResolver; use Ibexa\Contracts\Core\Repository\PermissionCriterionResolver as APIPermissionCriterionResolver; +use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\PermissionResolver as APIPermissionResolver; use Ibexa\Contracts\Core\Repository\PermissionService; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; @@ -31,21 +33,16 @@ */ class CachedPermissionService implements PermissionService { - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $innerPermissionResolver; + private PermissionResolver $innerPermissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\PermissionCriterionResolver */ - private $permissionCriterionResolver; + private PermissionCriterionResolver $permissionCriterionResolver; - /** @var int */ - private $cacheTTL; + private int $cacheTTL; /** * Counter for the current sudo nesting level {@see sudo()}. - * - * @var int */ - private $sudoNestingLevel = 0; + private int $sudoNestingLevel = 0; /** * Cached value for current user's getCriterion() result. diff --git a/src/lib/Repository/Permission/LimitationService.php b/src/lib/Repository/Permission/LimitationService.php index aec9ae9776..da70663357 100644 --- a/src/lib/Repository/Permission/LimitationService.php +++ b/src/lib/Repository/Permission/LimitationService.php @@ -22,7 +22,7 @@ class LimitationService { /** @var \Ibexa\Contracts\Core\Limitation\Type[] */ - private $limitationTypes; + private array $limitationTypes; public function __construct(?Traversable $limitationTypes = null) { diff --git a/src/lib/Repository/Permission/PermissionCriterionResolver.php b/src/lib/Repository/Permission/PermissionCriterionResolver.php index 9aa0880372..51a97c5c39 100644 --- a/src/lib/Repository/Permission/PermissionCriterionResolver.php +++ b/src/lib/Repository/Permission/PermissionCriterionResolver.php @@ -9,6 +9,7 @@ namespace Ibexa\Core\Repository\Permission; use Ibexa\Contracts\Core\Repository\PermissionCriterionResolver as APIPermissionCriterionResolver; +use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\PermissionResolver as PermissionResolverInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd; @@ -24,11 +25,9 @@ */ class PermissionCriterionResolver implements APIPermissionCriterionResolver { - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $innerPermissionResolver; + private PermissionResolver $innerPermissionResolver; - /** @var \Ibexa\Core\Repository\Permission\LimitationService */ - private $limitationService; + private LimitationService $limitationService; /** * Constructor. diff --git a/src/lib/Repository/Permission/PermissionResolver.php b/src/lib/Repository/Permission/PermissionResolver.php index 42204df748..1c570c6926 100644 --- a/src/lib/Repository/Permission/PermissionResolver.php +++ b/src/lib/Repository/Permission/PermissionResolver.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Limitation\Target; use Ibexa\Contracts\Core\Limitation\TargetAwareType; use Ibexa\Contracts\Core\Limitation\Type as LimitationType; +use Ibexa\Contracts\Core\Persistence\User\Handler; use Ibexa\Contracts\Core\Persistence\User\Handler as UserHandler; use Ibexa\Contracts\Core\Repository\PermissionResolver as PermissionResolverInterface; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; @@ -32,36 +33,26 @@ class PermissionResolver implements PermissionResolverInterface { /** * Counter for the current sudo nesting level {@see sudo()}. - * - * @var int */ - private $sudoNestingLevel = 0; + private int $sudoNestingLevel = 0; - /** @var \Ibexa\Core\Repository\Mapper\RoleDomainMapper */ - private $roleDomainMapper; + private RoleDomainMapper $roleDomainMapper; - /** @var \Ibexa\Core\Repository\Permission\LimitationService */ - private $limitationService; + private LimitationService $limitationService; - /** @var \Ibexa\Contracts\Core\Persistence\User\Handler */ - private $userHandler; + private Handler $userHandler; /** * Currently logged in user reference for permission purposes. - * - * @var \Ibexa\Contracts\Core\Repository\Values\User\UserReference */ - private $currentUserRef; + private \Ibexa\Core\Repository\Values\User\UserReference|\Ibexa\Contracts\Core\Repository\Values\User\UserReference|null $currentUserRef = null; /** * Map of system configured policies, for validation usage. - * - * @var array */ - private $policyMap; + private array $policyMap; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; /** * @param array $policyMap Map of system configured policies, for validation usage. diff --git a/src/lib/Repository/ProxyFactory/ProxyDomainMapper.php b/src/lib/Repository/ProxyFactory/ProxyDomainMapper.php index 07f0a81cc4..2c6df7e6a3 100644 --- a/src/lib/Repository/ProxyFactory/ProxyDomainMapper.php +++ b/src/lib/Repository/ProxyFactory/ProxyDomainMapper.php @@ -24,11 +24,10 @@ */ final class ProxyDomainMapper implements ProxyDomainMapperInterface { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - private $repository; + private Repository $repository; /** @var \ProxyManager\Factory\LazyLoadingValueHolderFactory */ - private $proxyGenerator; + private ProxyGeneratorInterface $proxyGenerator; public function __construct(Repository $repository, ProxyGeneratorInterface $proxyGenerator) { diff --git a/src/lib/Repository/ProxyFactory/ProxyDomainMapperFactory.php b/src/lib/Repository/ProxyFactory/ProxyDomainMapperFactory.php index f1c4998ad1..3c24aff0e2 100644 --- a/src/lib/Repository/ProxyFactory/ProxyDomainMapperFactory.php +++ b/src/lib/Repository/ProxyFactory/ProxyDomainMapperFactory.php @@ -15,8 +15,7 @@ */ final class ProxyDomainMapperFactory implements ProxyDomainMapperFactoryInterface { - /** @var \Ibexa\Core\Repository\ProxyFactory\ProxyGeneratorInterface */ - private $proxyGenerator; + private ProxyGeneratorInterface $proxyGenerator; public function __construct(ProxyGeneratorInterface $proxyGenerator) { diff --git a/src/lib/Repository/ProxyFactory/ProxyGenerator.php b/src/lib/Repository/ProxyFactory/ProxyGenerator.php index 06f6911f00..161b5159fe 100644 --- a/src/lib/Repository/ProxyFactory/ProxyGenerator.php +++ b/src/lib/Repository/ProxyFactory/ProxyGenerator.php @@ -21,11 +21,9 @@ */ final class ProxyGenerator implements ProxyGeneratorInterface { - /** @var \ProxyManager\Factory\LazyLoadingValueHolderFactory|null */ - private $lazyLoadingValueHolderFactory; + private ?LazyLoadingValueHolderFactory $lazyLoadingValueHolderFactory = null; - /** @var string */ - private $proxyCacheDir; + private string $proxyCacheDir; public function __construct(string $proxyCacheDir) { @@ -47,7 +45,7 @@ public function createProxy( public function warmUp(iterable $classes): void { foreach ($classes as $class) { - $this->createProxy($class, static function () {}); + $this->createProxy($class, static function (): void {}); } } diff --git a/src/lib/Repository/Repository.php b/src/lib/Repository/Repository.php index b683f985dd..d977397df4 100644 --- a/src/lib/Repository/Repository.php +++ b/src/lib/Repository/Repository.php @@ -11,6 +11,7 @@ use Exception; use Ibexa\Contracts\Core\Persistence\Filter\Content\Handler as ContentFilteringHandler; use Ibexa\Contracts\Core\Persistence\Filter\Location\Handler as LocationFilteringHandler; +use Ibexa\Contracts\Core\Persistence\Handler; use Ibexa\Contracts\Core\Persistence\Handler as PersistenceHandler; use Ibexa\Contracts\Core\Persistence\TransactionHandler; use Ibexa\Contracts\Core\Repository\BookmarkService as BookmarkServiceInterface; @@ -42,6 +43,10 @@ use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\FieldType\FieldTypeRegistry; use Ibexa\Core\Repository\Helper\RelationProcessor; +use Ibexa\Core\Repository\Mapper\ContentDomainMapper; +use Ibexa\Core\Repository\Mapper\ContentMapper; +use Ibexa\Core\Repository\Mapper\ContentTypeDomainMapper; +use Ibexa\Core\Repository\Mapper\RoleDomainMapper; use Ibexa\Core\Repository\Permission\LimitationService; use Ibexa\Core\Repository\ProxyFactory\ProxyDomainMapperFactoryInterface; use Ibexa\Core\Repository\ProxyFactory\ProxyDomainMapperInterface; @@ -58,17 +63,13 @@ class Repository implements RepositoryInterface { /** * Repository Handler object. - * - * @var \Ibexa\Contracts\Core\Persistence\Handler */ - protected $persistenceHandler; + protected Handler $persistenceHandler; /** * Instance of main Search Handler. - * - * @var \Ibexa\Contracts\Core\Search\Handler */ - protected $searchHandler; + protected SearchHandler $searchHandler; /** * Instance of content service. @@ -147,17 +148,14 @@ class Repository implements RepositoryInterface */ protected $fieldTypeService; - /** @var \Ibexa\Core\FieldType\FieldTypeRegistry */ - private $fieldTypeRegistry; + private FieldTypeRegistry $fieldTypeRegistry; protected NameSchemaServiceInterface $nameSchemaService; /** * Instance of relation processor service. - * - * @var \Ibexa\Core\Repository\Helper\RelationProcessor */ - protected $relationProcessor; + protected RelationProcessor $relationProcessor; /** * Instance of URL alias service. @@ -208,53 +206,39 @@ class Repository implements RepositoryInterface */ protected $serviceSettings; - /** @var \Ibexa\Core\Repository\Permission\LimitationService */ - protected $limitationService; + protected LimitationService $limitationService; - /** @var \Ibexa\Core\Repository\Mapper\RoleDomainMapper */ - protected $roleDomainMapper; + protected RoleDomainMapper $roleDomainMapper; - /** @var \Ibexa\Core\Repository\Mapper\ContentDomainMapper */ - protected $contentDomainMapper; + protected ContentDomainMapper $contentDomainMapper; - /** @var \Ibexa\Core\Repository\Mapper\ContentTypeDomainMapper */ - protected $contentTypeDomainMapper; + protected ContentTypeDomainMapper $contentTypeDomainMapper; - /** @var \Ibexa\Core\Search\Common\BackgroundIndexer|null */ - protected $backgroundIndexer; + protected BackgroundIndexer $backgroundIndexer; - /** @var \Psr\Log\LoggerInterface */ - private $logger; + private LoggerInterface $logger; - /** @var \Ibexa\Contracts\Core\Repository\PasswordHashService */ - private $passwordHashService; + private PasswordHashService $passwordHashService; /** @var \Ibexa\Core\Repository\ProxyFactory\ProxyDomainMapperFactory */ - private $proxyDomainMapperFactory; + private ProxyDomainMapperFactoryInterface $proxyDomainMapperFactory; /** @var \Ibexa\Core\Repository\ProxyFactory\ProxyDomainMapperInterface|null */ private $proxyDomainMapper; - /** @var \Ibexa\Contracts\Core\Repository\LanguageResolver */ - private $languageResolver; + private LanguageResolver $languageResolver; - /** @var \Ibexa\Contracts\Core\Repository\PermissionService */ - private $permissionService; + private PermissionService $permissionService; - /** @var \Ibexa\Core\Repository\Mapper\ContentMapper */ - private $contentMapper; + private ContentMapper $contentMapper; - /** @var \Ibexa\Contracts\Core\Repository\Validator\ContentValidator */ - private $contentValidator; + private ContentValidator $contentValidator; - /** @var \Ibexa\Contracts\Core\Persistence\Filter\Content\Handler */ - private $contentFilteringHandler; + private ContentFilteringHandler $contentFilteringHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Filter\Location\Handler */ - private $locationFilteringHandler; + private LocationFilteringHandler $locationFilteringHandler; - /** @var \Ibexa\Core\Repository\User\PasswordValidatorInterface */ - private $passwordValidator; + private PasswordValidatorInterface $passwordValidator; private ConfigResolverInterface $configResolver; @@ -268,10 +252,10 @@ public function __construct( FieldTypeRegistry $fieldTypeRegistry, PasswordHashService $passwordHashGenerator, ProxyDomainMapperFactoryInterface $proxyDomainMapperFactory, - Mapper\ContentDomainMapper $contentDomainMapper, - Mapper\ContentTypeDomainMapper $contentTypeDomainMapper, - Mapper\RoleDomainMapper $roleDomainMapper, - Mapper\ContentMapper $contentMapper, + ContentDomainMapper $contentDomainMapper, + ContentTypeDomainMapper $contentTypeDomainMapper, + RoleDomainMapper $roleDomainMapper, + ContentMapper $contentMapper, ContentValidator $contentValidator, LimitationService $limitationService, LanguageResolver $languageResolver, @@ -668,7 +652,7 @@ public function getRoleService(): RoleServiceInterface return $this->roleService; } - protected function getRoleDomainMapper(): Mapper\RoleDomainMapper + protected function getRoleDomainMapper(): RoleDomainMapper { return $this->roleDomainMapper; } diff --git a/src/lib/Repository/RoleService.php b/src/lib/Repository/RoleService.php index dd942f9771..ce32529f77 100644 --- a/src/lib/Repository/RoleService.php +++ b/src/lib/Repository/RoleService.php @@ -13,6 +13,8 @@ use Ibexa\Contracts\Core\Persistence\User\Role as SPIRole; use Ibexa\Contracts\Core\Persistence\User\RoleUpdateStruct as SPIRoleUpdateStruct; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException as APINotFoundException; +use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; use Ibexa\Contracts\Core\Repository\RoleService as RoleServiceInterface; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\RoleLimitation; @@ -34,6 +36,8 @@ use Ibexa\Core\Base\Exceptions\LimitationValidationException; use Ibexa\Core\Base\Exceptions\NotFound\LimitationNotFoundException; use Ibexa\Core\Base\Exceptions\UnauthorizedException; +use Ibexa\Core\Repository\Mapper\RoleDomainMapper; +use Ibexa\Core\Repository\Permission\LimitationService; use Ibexa\Core\Repository\Values\User\PolicyCreateStruct; use Ibexa\Core\Repository\Values\User\PolicyUpdateStruct; use Ibexa\Core\Repository\Values\User\Role; @@ -47,23 +51,18 @@ */ class RoleService implements RoleServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Contracts\Core\Persistence\User\Handler */ - protected $userHandler; + protected Handler $userHandler; - /** @var \Ibexa\Core\Repository\Permission\LimitationService */ - protected $limitationService; + protected LimitationService $limitationService; - /** @var \Ibexa\Core\Repository\Mapper\RoleDomainMapper */ - protected $roleDomainMapper; + protected RoleDomainMapper $roleDomainMapper; /** @phpstan-var array{policyMap: TPolicyMap}|array{} */ protected array $settings; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; /** * Setups service with reference to repository object that created it & corresponding handler. @@ -73,8 +72,8 @@ class RoleService implements RoleServiceInterface public function __construct( RepositoryInterface $repository, Handler $userHandler, - Permission\LimitationService $limitationService, - Mapper\RoleDomainMapper $roleDomainMapper, + LimitationService $limitationService, + RoleDomainMapper $roleDomainMapper, array $settings = [] ) { $this->repository = $repository; @@ -230,7 +229,7 @@ public function copyRole(APIRole $role, APIRoleCopyStruct $roleCopyStruct): APIR try { $spiRole = $this->userHandler->copyRole($spiRoleCopyStruct); $this->repository->commit(); - } catch (\Exception $e) { + } catch (Exception $e) { $this->repository->rollback(); throw $e; } diff --git a/src/lib/Repository/SearchService.php b/src/lib/Repository/SearchService.php index 625ca37c82..ba6e22a3a9 100644 --- a/src/lib/Repository/SearchService.php +++ b/src/lib/Repository/SearchService.php @@ -9,6 +9,7 @@ namespace Ibexa\Core\Repository; use Ibexa\Contracts\Core\Repository\PermissionCriterionResolver; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; use Ibexa\Contracts\Core\Repository\SearchService as SearchServiceInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Content; @@ -35,22 +36,17 @@ class SearchService implements SearchServiceInterface { /** @var \Ibexa\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Contracts\Core\Search\Handler */ - protected $searchHandler; + protected Handler $searchHandler; - /** @var array */ - protected $settings; + protected array $settings; - /** @var \Ibexa\Core\Repository\Mapper\ContentDomainMapper */ - protected $contentDomainMapper; + protected ContentDomainMapper $contentDomainMapper; - /** @var \Ibexa\Contracts\Core\Repository\PermissionCriterionResolver */ - protected $permissionCriterionResolver; + protected PermissionCriterionResolver $permissionCriterionResolver; - /** @var \Ibexa\Core\Search\Common\BackgroundIndexer */ - protected $backgroundIndexer; + protected BackgroundIndexer $backgroundIndexer; /** * Setups service with reference to repository object that created it & corresponding handler. @@ -301,7 +297,7 @@ public function findLocations(LocationQuery $query, array $languageFilter = [], * * @uses \Ibexa\Contracts\Core\Repository\PermissionCriterionResolver::getPermissionsCriterion() */ - protected function addPermissionsCriterion(Query\CriterionInterface &$criterion): bool + protected function addPermissionsCriterion(CriterionInterface &$criterion): bool { $permissionCriterion = $this->permissionCriterionResolver->getPermissionsCriterion('content', 'read'); if ($permissionCriterion === true || $permissionCriterion === false) { diff --git a/src/lib/Repository/SectionService.php b/src/lib/Repository/SectionService.php index f49095a2a6..7af05ce09d 100644 --- a/src/lib/Repository/SectionService.php +++ b/src/lib/Repository/SectionService.php @@ -12,9 +12,12 @@ use Exception; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler; use Ibexa\Contracts\Core\Persistence\Content\Section as SPISection; +use Ibexa\Contracts\Core\Persistence\Content\Section\Handler; use Ibexa\Contracts\Core\Persistence\Content\Section\Handler as SectionHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException as APINotFoundException; use Ibexa\Contracts\Core\Repository\PermissionCriterionResolver; +use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; use Ibexa\Contracts\Core\Repository\SectionService as SectionServiceInterface; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; @@ -36,23 +39,17 @@ */ class SectionService implements SectionServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - protected $permissionResolver; + protected PermissionResolver $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\PermissionCriterionResolver */ - protected $permissionCriterionResolver; + protected PermissionCriterionResolver $permissionCriterionResolver; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Section\Handler */ - protected $sectionHandler; + protected Handler $sectionHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Location\Handler */ - protected $locationHandler; + protected LocationHandler $locationHandler; - /** @var array */ - protected $settings; + protected array $settings; /** * Setups service with reference to repository object that created it & corresponding handler. @@ -439,7 +436,7 @@ public function newSectionUpdateStruct(): SectionUpdateStruct * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Section */ - protected function buildDomainSectionObject(SPISection $spiSection) + protected function buildDomainSectionObject(SPISection $spiSection): Section { return new Section( [ diff --git a/src/lib/Repository/SettingService.php b/src/lib/Repository/SettingService.php index d1a8c477b7..e296f8392f 100644 --- a/src/lib/Repository/SettingService.php +++ b/src/lib/Repository/SettingService.php @@ -8,6 +8,7 @@ namespace Ibexa\Core\Repository; +use Ibexa\Contracts\Core\Persistence\Setting\Handler; use Ibexa\Contracts\Core\Persistence\Setting\Handler as SettingHandler; use Ibexa\Contracts\Core\Persistence\Setting\Setting as SPISetting; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException as APINotFoundException; @@ -21,11 +22,9 @@ final class SettingService implements SettingServiceInterface { - /** @var \Ibexa\Contracts\Core\Persistence\Setting\Handler */ - private $settingHandler; + private Handler $settingHandler; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; public function __construct( SettingHandler $settingHandler, diff --git a/src/lib/Repository/SiteAccessAware/Config/IOConfigResolver.php b/src/lib/Repository/SiteAccessAware/Config/IOConfigResolver.php index d3e15fe2d7..de128c1b46 100644 --- a/src/lib/Repository/SiteAccessAware/Config/IOConfigResolver.php +++ b/src/lib/Repository/SiteAccessAware/Config/IOConfigResolver.php @@ -15,14 +15,11 @@ */ final class IOConfigResolver implements IOConfigProvider { - /** @var string */ - private $storageDir; + private string $storageDir; - /** @var string */ - private $legacyUrlPrefix; + private string $legacyUrlPrefix; - /** @var string */ - private $urlPrefix; + private string $urlPrefix; public function __construct( string $storageDir, diff --git a/src/lib/Repository/SiteAccessAware/ContentService.php b/src/lib/Repository/SiteAccessAware/ContentService.php index ffad838ff7..cdf2968049 100644 --- a/src/lib/Repository/SiteAccessAware/ContentService.php +++ b/src/lib/Repository/SiteAccessAware/ContentService.php @@ -33,11 +33,9 @@ */ class ContentService implements ContentServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - protected $service; + protected ContentServiceInterface $service; - /** @var \Ibexa\Contracts\Core\Repository\LanguageResolver */ - protected $languageResolver; + protected LanguageResolver $languageResolver; /** * Construct service object from aggregated service and LanguageResolver. diff --git a/src/lib/Repository/SiteAccessAware/ContentTypeService.php b/src/lib/Repository/SiteAccessAware/ContentTypeService.php index c173f2c8ee..8b6658a5d2 100644 --- a/src/lib/Repository/SiteAccessAware/ContentTypeService.php +++ b/src/lib/Repository/SiteAccessAware/ContentTypeService.php @@ -26,11 +26,9 @@ */ class ContentTypeService implements ContentTypeServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - protected $service; + protected ContentTypeServiceInterface $service; - /** @var \Ibexa\Contracts\Core\Repository\LanguageResolver */ - protected $languageResolver; + protected LanguageResolver $languageResolver; /** * Construct service object from aggregated service and LanguageResolver. diff --git a/src/lib/Repository/SiteAccessAware/Language/AbstractLanguageResolver.php b/src/lib/Repository/SiteAccessAware/Language/AbstractLanguageResolver.php index 27ac737c61..bcfaed1401 100644 --- a/src/lib/Repository/SiteAccessAware/Language/AbstractLanguageResolver.php +++ b/src/lib/Repository/SiteAccessAware/Language/AbstractLanguageResolver.php @@ -18,11 +18,9 @@ */ abstract class AbstractLanguageResolver implements APILanguageResolver { - /** @var bool */ - private $defaultUseAlwaysAvailable; + private bool $defaultUseAlwaysAvailable; - /** @var bool */ - private $defaultShowAllTranslations; + private bool $defaultShowAllTranslations; /** * Values typically provided by user context, will need to be set depending on your own custom logic using setter. @@ -34,7 +32,7 @@ abstract class AbstractLanguageResolver implements APILanguageResolver * * @var string|null */ - private $contextLanguage; + private ?string $contextLanguage = null; /** * @param bool $defaultUseAlwaysAvailable diff --git a/src/lib/Repository/SiteAccessAware/Language/LanguageResolver.php b/src/lib/Repository/SiteAccessAware/Language/LanguageResolver.php index 449abd0f71..1af2c1423e 100644 --- a/src/lib/Repository/SiteAccessAware/Language/LanguageResolver.php +++ b/src/lib/Repository/SiteAccessAware/Language/LanguageResolver.php @@ -17,7 +17,7 @@ final class LanguageResolver extends AbstractLanguageResolver * * @var string[] */ - private $configLanguages; + private array $configLanguages; public function __construct( array $configLanguages, diff --git a/src/lib/Repository/SiteAccessAware/LanguageService.php b/src/lib/Repository/SiteAccessAware/LanguageService.php index d55891f819..dd55efc89c 100644 --- a/src/lib/Repository/SiteAccessAware/LanguageService.php +++ b/src/lib/Repository/SiteAccessAware/LanguageService.php @@ -18,8 +18,7 @@ */ class LanguageService implements LanguageServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ - protected $service; + protected LanguageServiceInterface $service; /** * Construct service object from aggregated service. diff --git a/src/lib/Repository/SiteAccessAware/LocationService.php b/src/lib/Repository/SiteAccessAware/LocationService.php index 3dc1d8ddae..f9a697483d 100644 --- a/src/lib/Repository/SiteAccessAware/LocationService.php +++ b/src/lib/Repository/SiteAccessAware/LocationService.php @@ -25,11 +25,9 @@ */ class LocationService implements LocationServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - protected $service; + protected LocationServiceInterface $service; - /** @var \Ibexa\Contracts\Core\Repository\LanguageResolver */ - protected $languageResolver; + protected LanguageResolver $languageResolver; /** * Construct service object from aggregated service and LanguageResolver. diff --git a/src/lib/Repository/SiteAccessAware/NotificationService.php b/src/lib/Repository/SiteAccessAware/NotificationService.php index 031b81b03b..b9d325c439 100644 --- a/src/lib/Repository/SiteAccessAware/NotificationService.php +++ b/src/lib/Repository/SiteAccessAware/NotificationService.php @@ -15,8 +15,7 @@ class NotificationService implements NotificationServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\NotificationService */ - protected $service; + protected NotificationServiceInterface $service; /** * Construct service object from aggregated service. diff --git a/src/lib/Repository/SiteAccessAware/ObjectStateService.php b/src/lib/Repository/SiteAccessAware/ObjectStateService.php index e71c748a45..fe35ed441b 100644 --- a/src/lib/Repository/SiteAccessAware/ObjectStateService.php +++ b/src/lib/Repository/SiteAccessAware/ObjectStateService.php @@ -22,11 +22,9 @@ */ class ObjectStateService implements ObjectStateServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ - protected $service; + protected ObjectStateServiceInterface $service; - /** @var \Ibexa\Contracts\Core\Repository\LanguageResolver */ - protected $languageResolver; + protected LanguageResolver $languageResolver; /** * Construct service object from aggregated service and LanguageResolver. diff --git a/src/lib/Repository/SiteAccessAware/Repository.php b/src/lib/Repository/SiteAccessAware/Repository.php index 13a2d72a89..46c3982b7c 100644 --- a/src/lib/Repository/SiteAccessAware/Repository.php +++ b/src/lib/Repository/SiteAccessAware/Repository.php @@ -33,41 +33,30 @@ */ class Repository implements RepositoryInterface { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - protected $repository; + protected RepositoryInterface $repository; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - protected $contentService; + protected ContentService $contentService; - /** @var \Ibexa\Contracts\Core\Repository\SectionService */ - protected $sectionService; + protected SectionService $sectionService; - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ - protected $searchService; + protected SearchService $searchService; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ - protected $userService; + protected UserService $userService; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ - protected $languageService; + protected LanguageService $languageService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - protected $locationService; + protected LocationService $locationService; - /** @var \Ibexa\Contracts\Core\Repository\TrashService */ - protected $trashService; + protected TrashService $trashService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - protected $contentTypeService; + protected ContentTypeService $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ - protected $objectStateService; + protected ObjectStateService $objectStateService; - /** @var \Ibexa\Contracts\Core\Repository\URLAliasService */ - protected $urlAliasService; + protected URLAliasService $urlAliasService; /** @var \Ibexa\Core\Repository\NotificationService */ - protected $notificationService; + protected NotificationService $notificationService; /** * Construct repository object from aggregated repository. diff --git a/src/lib/Repository/SiteAccessAware/SearchService.php b/src/lib/Repository/SiteAccessAware/SearchService.php index d3651a7031..b1461a4e37 100644 --- a/src/lib/Repository/SiteAccessAware/SearchService.php +++ b/src/lib/Repository/SiteAccessAware/SearchService.php @@ -21,11 +21,9 @@ */ class SearchService implements SearchServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ - protected $service; + protected SearchServiceInterface $service; - /** @var \Ibexa\Contracts\Core\Repository\LanguageResolver */ - protected $languageResolver; + protected LanguageResolver $languageResolver; /** * Construct service object from aggregated service and LanguageResolver. diff --git a/src/lib/Repository/SiteAccessAware/SectionService.php b/src/lib/Repository/SiteAccessAware/SectionService.php index 47b7fc161a..600d53a314 100644 --- a/src/lib/Repository/SiteAccessAware/SectionService.php +++ b/src/lib/Repository/SiteAccessAware/SectionService.php @@ -22,8 +22,7 @@ */ class SectionService implements SectionServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\SectionService */ - protected $service; + protected SectionServiceInterface $service; /** * Construct service object from aggregated service. diff --git a/src/lib/Repository/SiteAccessAware/TrashService.php b/src/lib/Repository/SiteAccessAware/TrashService.php index bce91bb63b..82d1f2dddb 100644 --- a/src/lib/Repository/SiteAccessAware/TrashService.php +++ b/src/lib/Repository/SiteAccessAware/TrashService.php @@ -23,8 +23,7 @@ */ class TrashService implements TrashServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\TrashService */ - protected $service; + protected TrashServiceInterface $service; /** * Construct service object from aggregated service. diff --git a/src/lib/Repository/SiteAccessAware/URLAliasService.php b/src/lib/Repository/SiteAccessAware/URLAliasService.php index d1be047c3c..f2b7fed5c0 100644 --- a/src/lib/Repository/SiteAccessAware/URLAliasService.php +++ b/src/lib/Repository/SiteAccessAware/URLAliasService.php @@ -18,11 +18,9 @@ */ class URLAliasService implements URLAliasServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\URLAliasService */ - protected $service; + protected URLAliasServiceInterface $service; - /** @var \Ibexa\Contracts\Core\Repository\LanguageResolver */ - protected $languageResolver; + protected LanguageResolver $languageResolver; /** * Construct service object from aggregated service and LanguageResolver. diff --git a/src/lib/Repository/SiteAccessAware/UserService.php b/src/lib/Repository/SiteAccessAware/UserService.php index 5b04d386e4..8efa3cda7a 100644 --- a/src/lib/Repository/SiteAccessAware/UserService.php +++ b/src/lib/Repository/SiteAccessAware/UserService.php @@ -29,11 +29,9 @@ */ class UserService implements UserServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ - protected $service; + protected UserServiceInterface $service; - /** @var \Ibexa\Contracts\Core\Repository\LanguageResolver */ - protected $languageResolver; + protected LanguageResolver $languageResolver; /** * Construct service object from aggregated service. diff --git a/src/lib/Repository/Strategy/ContentThumbnail/Field/ContentFieldStrategy.php b/src/lib/Repository/Strategy/ContentThumbnail/Field/ContentFieldStrategy.php index a740210302..58fd6e1974 100644 --- a/src/lib/Repository/Strategy/ContentThumbnail/Field/ContentFieldStrategy.php +++ b/src/lib/Repository/Strategy/ContentThumbnail/Field/ContentFieldStrategy.php @@ -19,7 +19,7 @@ final class ContentFieldStrategy implements ThumbnailStrategy { /** @var \Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\Field\FieldTypeBasedThumbnailStrategy[] */ - private $strategies = []; + private array $strategies = []; /** * @param \Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\Field\FieldTypeBasedThumbnailStrategy[]|\Traversable $strategies diff --git a/src/lib/Repository/Strategy/ContentThumbnail/FirstMatchingFieldStrategy.php b/src/lib/Repository/Strategy/ContentThumbnail/FirstMatchingFieldStrategy.php index b670cae32d..20342957cf 100644 --- a/src/lib/Repository/Strategy/ContentThumbnail/FirstMatchingFieldStrategy.php +++ b/src/lib/Repository/Strategy/ContentThumbnail/FirstMatchingFieldStrategy.php @@ -18,11 +18,9 @@ final class FirstMatchingFieldStrategy implements ThumbnailStrategy { - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ - private $fieldTypeService; + private FieldTypeService $fieldTypeService; - /** @var \Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\Field\ThumbnailStrategy */ - private $contentFieldStrategy; + private ContentFieldThumbnailStrategy $contentFieldStrategy; public function __construct( ContentFieldThumbnailStrategy $contentFieldStrategy, diff --git a/src/lib/Repository/Strategy/ContentThumbnail/StaticStrategy.php b/src/lib/Repository/Strategy/ContentThumbnail/StaticStrategy.php index baa837726c..de8180cb8b 100644 --- a/src/lib/Repository/Strategy/ContentThumbnail/StaticStrategy.php +++ b/src/lib/Repository/Strategy/ContentThumbnail/StaticStrategy.php @@ -15,8 +15,7 @@ final class StaticStrategy implements ThumbnailStrategy { - /** @var string */ - private $staticThumbnail; + private string $staticThumbnail; public function __construct(string $staticThumbnail) { diff --git a/src/lib/Repository/Strategy/ContentThumbnail/ThumbnailChainStrategy.php b/src/lib/Repository/Strategy/ContentThumbnail/ThumbnailChainStrategy.php index 4c19a6323f..900e20890d 100644 --- a/src/lib/Repository/Strategy/ContentThumbnail/ThumbnailChainStrategy.php +++ b/src/lib/Repository/Strategy/ContentThumbnail/ThumbnailChainStrategy.php @@ -16,7 +16,7 @@ final class ThumbnailChainStrategy implements ThumbnailStrategy { /** @var \Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\ThumbnailStrategy[] */ - private $strategies; + private iterable $strategies; /** * @param \Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\ThumbnailStrategy[] $strategies diff --git a/src/lib/Repository/Strategy/ContentValidator/ContentValidatorStrategy.php b/src/lib/Repository/Strategy/ContentValidator/ContentValidatorStrategy.php index 4281c7b6c6..77c77f00c0 100644 --- a/src/lib/Repository/Strategy/ContentValidator/ContentValidatorStrategy.php +++ b/src/lib/Repository/Strategy/ContentValidator/ContentValidatorStrategy.php @@ -18,7 +18,7 @@ final class ContentValidatorStrategy implements ContentValidator { /** @var \Ibexa\Contracts\Core\Repository\Validator\ContentValidator[] */ - private $contentValidators; + private iterable $contentValidators; public function __construct(iterable $contentValidators) { diff --git a/src/lib/Repository/TrashService.php b/src/lib/Repository/TrashService.php index 771fd8805c..40b71cc512 100644 --- a/src/lib/Repository/TrashService.php +++ b/src/lib/Repository/TrashService.php @@ -17,6 +17,7 @@ use Ibexa\Contracts\Core\Repository\NameSchema\NameSchemaServiceInterface; use Ibexa\Contracts\Core\Repository\PermissionCriterionResolver; use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; use Ibexa\Contracts\Core\Repository\TrashService as TrashServiceInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Content; @@ -43,24 +44,19 @@ class TrashService implements TrashServiceInterface { /** @var \Ibexa\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Contracts\Core\Persistence\Handler */ - protected $persistenceHandler; + protected Handler $persistenceHandler; - /** @var array */ - protected $settings; + protected array $settings; protected NameSchemaServiceInterface $nameSchemaService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionCriterionResolver */ - private $permissionCriterionResolver; + private PermissionCriterionResolver $permissionCriterionResolver; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; - /** @var \Ibexa\Core\Repository\ProxyFactory\ProxyDomainMapperInterface */ - private $proxyDomainMapper; + private ProxyDomainMapperInterface $proxyDomainMapper; /** * Setups service with reference to repository object that created it & corresponding handler. @@ -386,7 +382,7 @@ protected function buildDomainTrashItemObject(Trashed $spiTrashItem, Content $co * * @return \DateTime */ - protected function getDateTime($timestamp) + protected function getDateTime($timestamp): DateTime { $dateTime = new DateTime(); $dateTime->setTimestamp($timestamp); diff --git a/src/lib/Repository/URLAliasService.php b/src/lib/Repository/URLAliasService.php index cf09650b4e..af4695a06e 100644 --- a/src/lib/Repository/URLAliasService.php +++ b/src/lib/Repository/URLAliasService.php @@ -15,6 +15,7 @@ use Ibexa\Contracts\Core\Repository\LanguageResolver; use Ibexa\Contracts\Core\Repository\NameSchema\NameSchemaServiceInterface; use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; use Ibexa\Contracts\Core\Repository\URLAliasService as URLAliasServiceInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Location; @@ -28,19 +29,15 @@ */ class URLAliasService implements URLAliasServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Contracts\Core\Persistence\Content\UrlAlias\Handler */ - protected $urlAliasHandler; + protected Handler $urlAliasHandler; protected NameSchemaServiceInterface $nameSchemaService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\LanguageResolver */ - private $languageResolver; + private LanguageResolver $languageResolver; public function __construct( RepositoryInterface $repository, @@ -321,10 +318,10 @@ protected function selectAliasLanguageCode( */ protected function extractPath( SPIURLAlias $spiUrlAlias, - $languageCode, + ?string $languageCode, $showAllTranslations, array $prioritizedLanguageList - ) { + ): false|string { $pathData = []; $pathLevels = count($spiUrlAlias->pathData); @@ -394,7 +391,7 @@ protected function choosePrioritizedLanguageCode(array $entries, $showAllTransla * * @return array */ - protected function matchPath(SPIURLAlias $spiUrlAlias, $path, $languageCode) + protected function matchPath(SPIURLAlias $spiUrlAlias, $path, ?string $languageCode): array { $matchedPathElements = []; $matchedPathLanguageCodes = []; @@ -449,7 +446,7 @@ protected function matchLanguageCode(array $pathElementData, $pathElement) * * @return array */ - private function sortTranslationsByPrioritizedLanguages(array $translations) + private function sortTranslationsByPrioritizedLanguages(array $translations): array { $sortedTranslations = []; foreach ($this->languageResolver->getPrioritizedLanguages() as $languageCode) { @@ -623,7 +620,7 @@ public function removeAliases(array $aliasList): void * * @return \Ibexa\Contracts\Core\Persistence\Content\UrlAlias */ - protected function buildSPIUrlAlias(URLAlias $urlAlias) + protected function buildSPIUrlAlias(URLAlias $urlAlias): SPIURLAlias { return new SPIURLAlias( [ diff --git a/src/lib/Repository/URLService.php b/src/lib/Repository/URLService.php index b3c060d9f8..a70f4b40bb 100644 --- a/src/lib/Repository/URLService.php +++ b/src/lib/Repository/URLService.php @@ -11,11 +11,13 @@ use DateTime; use DateTimeInterface; use Exception; +use Ibexa\Contracts\Core\Persistence\URL\Handler; use Ibexa\Contracts\Core\Persistence\URL\Handler as URLHandler; use Ibexa\Contracts\Core\Persistence\URL\URL as SPIUrl; use Ibexa\Contracts\Core\Persistence\URL\URLUpdateStruct as SPIUrlUpdateStruct; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; use Ibexa\Contracts\Core\Repository\URLService as URLServiceInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Query; @@ -32,13 +34,11 @@ class URLService implements URLServiceInterface { /** @var \Ibexa\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Contracts\Core\Persistence\URL\Handler */ - protected $urlHandler; + protected Handler $urlHandler; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; public function __construct( RepositoryInterface $repository, diff --git a/src/lib/Repository/URLWildcardService.php b/src/lib/Repository/URLWildcardService.php index 3623370c99..5840ab5dc4 100644 --- a/src/lib/Repository/URLWildcardService.php +++ b/src/lib/Repository/URLWildcardService.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Persistence\Content\UrlWildcard as SPIUrlWildcard; use Ibexa\Contracts\Core\Persistence\Content\UrlWildcard\Handler; use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; use Ibexa\Contracts\Core\Repository\URLWildcardService as URLWildcardServiceInterface; use Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard; @@ -31,17 +32,13 @@ */ class URLWildcardService implements URLWildcardServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Contracts\Core\Persistence\Content\UrlWildcard\Handler */ - protected $urlWildcardHandler; + protected Handler $urlWildcardHandler; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; - /** @var array */ - protected $settings; + protected array $settings; /** * Setups service with reference to repository object that created it & corresponding handler. @@ -77,7 +74,7 @@ public function __construct( * * @return \Ibexa\Contracts\Core\Repository\Values\Content\UrlWildcard */ - public function create(string $sourceUrl, string $destinationUrl, bool $forward = false): UrlWildcard + public function create(string $sourceUrl, string $destinationUrl, bool $forward = false): URLWildcard { if (false === $this->permissionResolver->hasAccess('content', 'urltranslator')) { throw new UnauthorizedException('content', 'urltranslator'); @@ -177,7 +174,7 @@ public function remove(URLWildcard $urlWildcard): void * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException * @throws \Ibexa\Core\Base\Exceptions\UnauthorizedException */ - public function load(int $id): UrlWildcard + public function load(int $id): URLWildcard { return $this->buildUrlWildcardDomainObject( $this->urlWildcardHandler->load($id) diff --git a/src/lib/Repository/UserPreferenceService.php b/src/lib/Repository/UserPreferenceService.php index e7af68563f..a1631cbdb0 100644 --- a/src/lib/Repository/UserPreferenceService.php +++ b/src/lib/Repository/UserPreferenceService.php @@ -9,9 +9,11 @@ namespace Ibexa\Core\Repository; use Exception; +use Ibexa\Contracts\Core\Persistence\UserPreference\Handler; use Ibexa\Contracts\Core\Persistence\UserPreference\Handler as UserPreferenceHandler; use Ibexa\Contracts\Core\Persistence\UserPreference\UserPreference; use Ibexa\Contracts\Core\Persistence\UserPreference\UserPreferenceSetStruct; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; use Ibexa\Contracts\Core\Repository\UserPreferenceService as UserPreferenceServiceInterface; use Ibexa\Contracts\Core\Repository\Values\UserPreference\UserPreference as APIUserPreference; @@ -20,11 +22,9 @@ class UserPreferenceService implements UserPreferenceServiceInterface { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - private $repository; + private Repository $repository; - /** @var \Ibexa\Contracts\Core\Persistence\UserPreference\Handler */ - private $userPreferenceHandler; + private Handler $userPreferenceHandler; /** * @param \Ibexa\Contracts\Core\Repository\Repository $repository @@ -47,7 +47,7 @@ public function loadUserPreferences(int $offset = 0, int $limit = 25): UserPrefe $list->totalCount = $this->userPreferenceHandler->countUserPreferences($currentUserId); if ($list->totalCount > 0) { - $list->items = array_map(function (UserPreference $spiUserPreference) { + $list->items = array_map(function (UserPreference $spiUserPreference): APIUserPreference { return $this->buildDomainObject($spiUserPreference); }, $this->userPreferenceHandler->loadUserPreferences($currentUserId, $offset, $limit)); } @@ -74,7 +74,7 @@ public function setUserPreference(array $userPreferenceSetStructs): void try { $value = (string)$userPreferenceSetStruct->value; - } catch (\Exception $exception) { + } catch (Exception $exception) { throw new InvalidArgumentException('value', 'Cannot convert value to string at index ' . $key); } diff --git a/src/lib/Repository/UserService.php b/src/lib/Repository/UserService.php index 7a97184b0d..5ea59dbd1f 100644 --- a/src/lib/Repository/UserService.php +++ b/src/lib/Repository/UserService.php @@ -18,6 +18,7 @@ use Ibexa\Contracts\Core\Persistence\User\UserTokenUpdateStruct as SPIUserTokenUpdateStruct; use Ibexa\Contracts\Core\Repository\PasswordHashService; use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Repository as RepositoryInterface; use Ibexa\Contracts\Core\Repository\UserService as UserServiceInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Content as APIContent; @@ -64,14 +65,11 @@ class UserService implements UserServiceInterface { private const USER_FIELD_TYPE_NAME = 'ezuser'; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Contracts\Core\Persistence\User\Handler */ - protected $userHandler; + protected Handler $userHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Location\Handler */ - private $locationHandler; + private LocationHandler $locationHandler; /** @var array */ protected $settings; @@ -79,18 +77,15 @@ class UserService implements UserServiceInterface /** @var \Psr\Log\LoggerInterface|null */ protected $logger; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\PasswordHashService */ - private $passwordHashService; + private PasswordHashService $passwordHashService; - /** @var \Ibexa\Core\Repository\User\PasswordValidatorInterface */ - private $passwordValidator; + private PasswordValidatorInterface $passwordValidator; private ConfigResolverInterface $configResolver; - public function setLogger(LoggerInterface $logger = null) + public function setLogger(LoggerInterface $logger = null): void { $this->logger = $logger; } diff --git a/src/lib/Repository/Validator/ContentCreateStructValidator.php b/src/lib/Repository/Validator/ContentCreateStructValidator.php index 2f69e7d5de..39af8e848b 100644 --- a/src/lib/Repository/Validator/ContentCreateStructValidator.php +++ b/src/lib/Repository/Validator/ContentCreateStructValidator.php @@ -21,11 +21,9 @@ */ final class ContentCreateStructValidator implements ContentValidator { - /** @var \Ibexa\Core\Repository\Mapper\ContentMapper */ - private $contentMapper; + private ContentMapper $contentMapper; - /** @var \Ibexa\Core\FieldType\FieldTypeRegistry */ - private $fieldTypeRegistry; + private FieldTypeRegistry $fieldTypeRegistry; public function __construct( ContentMapper $contentMapper, diff --git a/src/lib/Repository/Validator/ContentUpdateStructValidator.php b/src/lib/Repository/Validator/ContentUpdateStructValidator.php index 4c49c84c31..0691f1684b 100644 --- a/src/lib/Repository/Validator/ContentUpdateStructValidator.php +++ b/src/lib/Repository/Validator/ContentUpdateStructValidator.php @@ -23,14 +23,12 @@ */ final class ContentUpdateStructValidator implements ContentValidator { - /** @var \Ibexa\Core\Repository\Mapper\ContentMapper */ - private $contentMapper; + private ContentMapper $contentMapper; - /** @var \Ibexa\Core\FieldType\FieldTypeRegistry */ - private $fieldTypeRegistry; + private FieldTypeRegistry $fieldTypeRegistry; /** @var \Ibexa\Core\Persistence\Legacy\Content\Language\Handler */ - private $contentLanguageHandler; + private Handler $contentLanguageHandler; public function __construct( ContentMapper $contentMapper, diff --git a/src/lib/Repository/Validator/TargetContentValidator.php b/src/lib/Repository/Validator/TargetContentValidator.php index 0efcc870a9..64ed28b500 100644 --- a/src/lib/Repository/Validator/TargetContentValidator.php +++ b/src/lib/Repository/Validator/TargetContentValidator.php @@ -9,6 +9,7 @@ namespace Ibexa\Core\Repository\Validator; use Ibexa\Contracts\Core\Persistence\Content; +use Ibexa\Contracts\Core\Persistence\Content\Handler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Core\FieldType\ValidationError; @@ -19,14 +20,12 @@ */ final class TargetContentValidator implements TargetContentValidatorInterface { - /** @var \Ibexa\Contracts\Core\Persistence\Content\Handler */ - private $contentHandler; + private Handler $contentHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler */ - private $contentTypeHandler; + private Content\Type\Handler $contentTypeHandler; public function __construct( - Content\Handler $contentHandler, + Handler $contentHandler, Content\Type\Handler $contentTypeHandler ) { $this->contentHandler = $contentHandler; diff --git a/src/lib/Repository/Validator/UserPasswordValidator.php b/src/lib/Repository/Validator/UserPasswordValidator.php index a802df09ef..10d97ba30c 100644 --- a/src/lib/Repository/Validator/UserPasswordValidator.php +++ b/src/lib/Repository/Validator/UserPasswordValidator.php @@ -24,8 +24,7 @@ class UserPasswordValidator private const AT_LEAST_ONE_NUMERIC_CHARACTER_REGEX = '/\pN/u'; private const AT_LEAST_ONE_NON_ALPHANUMERIC_CHARACTER_REGEX = '/[^\p{Ll}\p{Lu}\pL\pN]/u'; - /** @var array */ - private $constraints; + private array $constraints; /** * @param array $constraints diff --git a/src/lib/Repository/Validator/VersionValidator.php b/src/lib/Repository/Validator/VersionValidator.php index 231addad70..68bec3623e 100644 --- a/src/lib/Repository/Validator/VersionValidator.php +++ b/src/lib/Repository/Validator/VersionValidator.php @@ -21,8 +21,7 @@ */ final class VersionValidator implements ContentValidator { - /** @var \Ibexa\Core\FieldType\FieldTypeRegistry */ - private $fieldTypeRegistry; + private FieldTypeRegistry $fieldTypeRegistry; public function __construct( FieldTypeRegistry $fieldTypeRegistry diff --git a/src/lib/Repository/Values/Content/Content.php b/src/lib/Repository/Values/Content/Content.php index 83a362ca29..207cff8d09 100644 --- a/src/lib/Repository/Values/Content/Content.php +++ b/src/lib/Repository/Values/Content/Content.php @@ -50,7 +50,7 @@ class Content extends APIContent * * @var array> */ - private $fieldDefinitionTranslationMap = []; + private array $fieldDefinitionTranslationMap = []; /** * The first matched field language among user provided prioritized languages. diff --git a/src/lib/Repository/Values/ContentType/ContentType.php b/src/lib/Repository/Values/ContentType/ContentType.php index b9c8f02e97..fdd04dfd7b 100644 --- a/src/lib/Repository/Values/ContentType/ContentType.php +++ b/src/lib/Repository/Values/ContentType/ContentType.php @@ -51,10 +51,8 @@ class ContentType extends APIContentType /** * Contains the content type field definitions from this type. - * - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionCollection */ - protected $fieldDefinitions; + protected FieldDefinitionCollection $fieldDefinitions; public function __construct(array $data = []) { diff --git a/src/lib/Repository/Values/ContentType/FieldDefinitionCollection.php b/src/lib/Repository/Values/ContentType/FieldDefinitionCollection.php index 38c76a59c0..f7fab366b6 100644 --- a/src/lib/Repository/Values/ContentType/FieldDefinitionCollection.php +++ b/src/lib/Repository/Values/ContentType/FieldDefinitionCollection.php @@ -19,10 +19,10 @@ final class FieldDefinitionCollection implements FieldDefinitionCollectionInterface { /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition[] */ - private $fieldDefinitions; + private array $fieldDefinitions; /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition[] */ - private $fieldDefinitionsByIdentifier; + private array $fieldDefinitionsByIdentifier; /** * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition[] diff --git a/src/lib/Repository/Values/ContentType/FieldType.php b/src/lib/Repository/Values/ContentType/FieldType.php index 73892d38c4..2818d4d582 100644 --- a/src/lib/Repository/Values/ContentType/FieldType.php +++ b/src/lib/Repository/Values/ContentType/FieldType.php @@ -27,7 +27,7 @@ class FieldType implements FieldTypeInterface * * @var \Ibexa\Core\FieldType\FieldType */ - protected $internalFieldType; + protected SPIFieldTypeInterface $internalFieldType; /** * @param \Ibexa\Contracts\Core\FieldType\FieldType $fieldType diff --git a/src/lib/Repository/Values/User/PolicyDraft.php b/src/lib/Repository/Values/User/PolicyDraft.php index 7bf74b2049..ba92515cb7 100644 --- a/src/lib/Repository/Values/User/PolicyDraft.php +++ b/src/lib/Repository/Values/User/PolicyDraft.php @@ -22,10 +22,8 @@ class PolicyDraft extends APIPolicyDraft /** * Set of properties that are specific to PolicyDraft. - * - * @var array */ - private $draftProperties = ['originalId' => true]; + private array $draftProperties = ['originalId' => true]; public function __get($property) { diff --git a/src/lib/Repository/Values/User/UserReference.php b/src/lib/Repository/Values/User/UserReference.php index 0a0aba4027..bea8516de6 100644 --- a/src/lib/Repository/Values/User/UserReference.php +++ b/src/lib/Repository/Values/User/UserReference.php @@ -17,8 +17,7 @@ */ class UserReference implements APIUserReference { - /** @var int */ - private $userId; + private int $userId; public function __construct(int $userId) { diff --git a/src/lib/Search/Common/EventSubscriber/AbstractSearchEventSubscriber.php b/src/lib/Search/Common/EventSubscriber/AbstractSearchEventSubscriber.php index 78ae7a695a..2425d03cdd 100644 --- a/src/lib/Search/Common/EventSubscriber/AbstractSearchEventSubscriber.php +++ b/src/lib/Search/Common/EventSubscriber/AbstractSearchEventSubscriber.php @@ -8,6 +8,7 @@ namespace Ibexa\Core\Search\Common\EventSubscriber; use Ibexa\Contracts\Core\Persistence\Handler as PersistenceHandler; +use Ibexa\Contracts\Core\Search\Handler; use Ibexa\Contracts\Core\Search\Handler as SearchHandler; /** @@ -15,11 +16,9 @@ */ abstract class AbstractSearchEventSubscriber { - /** @var \Ibexa\Contracts\Core\Search\Handler */ - protected $searchHandler; + protected Handler $searchHandler; - /** @var \Ibexa\Contracts\Core\Persistence\Handler */ - protected $persistenceHandler; + protected PersistenceHandler $persistenceHandler; public function __construct( SearchHandler $searchHandler, diff --git a/src/lib/Search/Common/EventSubscriber/ContentEventSubscriber.php b/src/lib/Search/Common/EventSubscriber/ContentEventSubscriber.php index a15ffd61c8..a75b0221b4 100644 --- a/src/lib/Search/Common/EventSubscriber/ContentEventSubscriber.php +++ b/src/lib/Search/Common/EventSubscriber/ContentEventSubscriber.php @@ -33,7 +33,7 @@ public static function getSubscribedEvents(): array ]; } - public function onCopyContent(CopyContentEvent $event) + public function onCopyContent(CopyContentEvent $event): void { $this->searchHandler->indexContent( $this->persistenceHandler->contentHandler()->load( @@ -51,7 +51,7 @@ public function onCopyContent(CopyContentEvent $event) } } - public function onDeleteContent(DeleteContentEvent $event) + public function onDeleteContent(DeleteContentEvent $event): void { $this->searchHandler->deleteContent($event->getContentInfo()->id); @@ -60,7 +60,7 @@ public function onDeleteContent(DeleteContentEvent $event) } } - public function onDeleteTranslation(DeleteTranslationEvent $event) + public function onDeleteTranslation(DeleteTranslationEvent $event): void { $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( $event->getContentInfo()->id @@ -93,7 +93,7 @@ public function onDeleteTranslation(DeleteTranslationEvent $event) } } - public function onHideContent(HideContentEvent $event) + public function onHideContent(HideContentEvent $event): void { $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($event->getContentInfo()->id); foreach ($locations as $location) { @@ -101,7 +101,7 @@ public function onHideContent(HideContentEvent $event) } } - public function onPublishVersion(PublishVersionEvent $event) + public function onPublishVersion(PublishVersionEvent $event): void { $this->searchHandler->indexContent( $this->persistenceHandler->contentHandler()->load($event->getContent()->id, $event->getContent()->getVersionInfo()->versionNo) @@ -113,7 +113,7 @@ public function onPublishVersion(PublishVersionEvent $event) } } - public function onRevealContent(RevealContentEvent $event) + public function onRevealContent(RevealContentEvent $event): void { $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($event->getContentInfo()->id); foreach ($locations as $location) { @@ -121,7 +121,7 @@ public function onRevealContent(RevealContentEvent $event) } } - public function onUpdateContentMetadata(UpdateContentMetadataEvent $event) + public function onUpdateContentMetadata(UpdateContentMetadataEvent $event): void { $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($event->getContent()->id); if ($contentInfo->status !== ContentInfo::STATUS_PUBLISHED) { diff --git a/src/lib/Search/Common/EventSubscriber/LocationEventSubscriber.php b/src/lib/Search/Common/EventSubscriber/LocationEventSubscriber.php index 37ba9c7e45..25affda515 100644 --- a/src/lib/Search/Common/EventSubscriber/LocationEventSubscriber.php +++ b/src/lib/Search/Common/EventSubscriber/LocationEventSubscriber.php @@ -36,12 +36,12 @@ public static function getSubscribedEvents(): array ]; } - public function onCopySubtree(CopySubtreeEvent $event) + public function onCopySubtree(CopySubtreeEvent $event): void { $this->indexSubtree($event->getLocation()->id); } - public function onCreateLocation(CreateLocationEvent $event) + public function onCreateLocation(CreateLocationEvent $event): void { $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( $event->getContentInfo()->id @@ -61,7 +61,7 @@ public function onCreateLocation(CreateLocationEvent $event) ); } - public function onDeleteLocation(DeleteLocationEvent $event) + public function onDeleteLocation(DeleteLocationEvent $event): void { $this->searchHandler->deleteLocation( $event->getLocation()->id, @@ -69,24 +69,24 @@ public function onDeleteLocation(DeleteLocationEvent $event) ); } - public function onHideLocation(HideLocationEvent $event) + public function onHideLocation(HideLocationEvent $event): void { $this->indexSubtree($event->getHiddenLocation()->id); } - public function onMoveSubtree(MoveSubtreeEvent $event) + public function onMoveSubtree(MoveSubtreeEvent $event): void { $this->indexSubtree($event->getLocation()->id); } - public function onSwapLocation(SwapLocationEvent $event) + public function onSwapLocation(SwapLocationEvent $event): void { $locations = [ $event->getLocation1(), $event->getLocation2(), ]; - array_walk($locations, function (Location $location) { + array_walk($locations, function (Location $location): void { $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($location->contentId); $this->searchHandler->indexContent( @@ -102,12 +102,12 @@ public function onSwapLocation(SwapLocationEvent $event) }); } - public function onUnhideLocation(UnhideLocationEvent $event) + public function onUnhideLocation(UnhideLocationEvent $event): void { $this->indexSubtree($event->getRevealedLocation()->id); } - public function onUpdateLocation(UpdateLocationEvent $event) + public function onUpdateLocation(UpdateLocationEvent $event): void { $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( $event->getLocation()->contentId diff --git a/src/lib/Search/Common/EventSubscriber/ObjectStateEventSubscriber.php b/src/lib/Search/Common/EventSubscriber/ObjectStateEventSubscriber.php index b679eeb487..cae26cb27a 100644 --- a/src/lib/Search/Common/EventSubscriber/ObjectStateEventSubscriber.php +++ b/src/lib/Search/Common/EventSubscriber/ObjectStateEventSubscriber.php @@ -19,7 +19,7 @@ public static function getSubscribedEvents(): array ]; } - public function onSetContentState(SetContentStateEvent $event) + public function onSetContentState(SetContentStateEvent $event): void { $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($event->getContentInfo()->id); diff --git a/src/lib/Search/Common/EventSubscriber/SectionEventSubscriber.php b/src/lib/Search/Common/EventSubscriber/SectionEventSubscriber.php index 22ea6630b7..010ffeb141 100644 --- a/src/lib/Search/Common/EventSubscriber/SectionEventSubscriber.php +++ b/src/lib/Search/Common/EventSubscriber/SectionEventSubscriber.php @@ -19,7 +19,7 @@ public static function getSubscribedEvents(): array ]; } - public function onAssignSection(AssignSectionEvent $event) + public function onAssignSection(AssignSectionEvent $event): void { $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($event->getContentInfo()->id); $this->searchHandler->indexContent( diff --git a/src/lib/Search/Common/EventSubscriber/TrashEventSubscriber.php b/src/lib/Search/Common/EventSubscriber/TrashEventSubscriber.php index dfc798bbc6..4fc646b86b 100644 --- a/src/lib/Search/Common/EventSubscriber/TrashEventSubscriber.php +++ b/src/lib/Search/Common/EventSubscriber/TrashEventSubscriber.php @@ -26,12 +26,12 @@ public static function getSubscribedEvents(): array ]; } - public function onRecover(RecoverEvent $event) + public function onRecover(RecoverEvent $event): void { $this->indexSubtree($event->getLocation()->id); } - public function onTrash(TrashEvent $event) + public function onTrash(TrashEvent $event): void { if ($event->getTrashItem() instanceof TrashItem) { $this->searchHandler->deleteContent( diff --git a/src/lib/Search/Common/EventSubscriber/UserEventSubscriber.php b/src/lib/Search/Common/EventSubscriber/UserEventSubscriber.php index 2a1c880622..077e8b8adc 100644 --- a/src/lib/Search/Common/EventSubscriber/UserEventSubscriber.php +++ b/src/lib/Search/Common/EventSubscriber/UserEventSubscriber.php @@ -38,7 +38,7 @@ public static function getSubscribedEvents(): array ]; } - public function onCreateUser(CreateUserEvent $event) + public function onCreateUser(CreateUserEvent $event): void { $userContentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( $event->getUser()->id @@ -60,7 +60,7 @@ public function onCreateUser(CreateUserEvent $event) } } - public function onCreateUserGroup(CreateUserGroupEvent $event) + public function onCreateUserGroup(CreateUserGroupEvent $event): void { $userGroupContentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( $event->getUserGroup()->id @@ -82,7 +82,7 @@ public function onCreateUserGroup(CreateUserGroupEvent $event) } } - public function onDeleteUser(DeleteUserEvent $event) + public function onDeleteUser(DeleteUserEvent $event): void { $this->searchHandler->deleteContent($event->getUser()->id); @@ -91,7 +91,7 @@ public function onDeleteUser(DeleteUserEvent $event) } } - public function onDeleteUserGroup(DeleteUserGroupEvent $event) + public function onDeleteUserGroup(DeleteUserGroupEvent $event): void { $this->searchHandler->deleteContent($event->getUserGroup()->id); @@ -100,7 +100,7 @@ public function onDeleteUserGroup(DeleteUserGroupEvent $event) } } - public function onMoveUserGroup(MoveUserGroupEvent $event) + public function onMoveUserGroup(MoveUserGroupEvent $event): void { $userGroupContentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( $event->getUserGroup()->id @@ -109,7 +109,7 @@ public function onMoveUserGroup(MoveUserGroupEvent $event) $this->indexSubtree($userGroupContentInfo->mainLocationId); } - public function onUpdateUser(UpdateUserEvent $event) + public function onUpdateUser(UpdateUserEvent $event): void { $userContentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( $event->getUser()->id @@ -131,7 +131,7 @@ public function onUpdateUser(UpdateUserEvent $event) } } - public function onUpdateUserGroup(UpdateUserGroupEvent $event) + public function onUpdateUserGroup(UpdateUserGroupEvent $event): void { $userContentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo( $event->getUserGroup()->id diff --git a/src/lib/Search/Common/FieldNameGenerator.php b/src/lib/Search/Common/FieldNameGenerator.php index 696c646096..11fc9c34c2 100644 --- a/src/lib/Search/Common/FieldNameGenerator.php +++ b/src/lib/Search/Common/FieldNameGenerator.php @@ -33,10 +33,8 @@ class FieldNameGenerator * ... * ) * - * - * @var array */ - protected $fieldNameMapping; + protected array $fieldNameMapping; public function __construct(array $fieldNameMapping) { diff --git a/src/lib/Search/Common/FieldNameResolver.php b/src/lib/Search/Common/FieldNameResolver.php index 1e24e5f968..e071e7cfd8 100644 --- a/src/lib/Search/Common/FieldNameResolver.php +++ b/src/lib/Search/Common/FieldNameResolver.php @@ -7,6 +7,7 @@ namespace Ibexa\Core\Search\Common; +use Ibexa\Contracts\Core\Persistence\Content\Type\Handler; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; @@ -22,24 +23,18 @@ class FieldNameResolver { /** * Field registry. - * - * @var \Ibexa\Core\Search\Common\FieldRegistry */ - protected $fieldRegistry; + protected FieldRegistry $fieldRegistry; /** * Content type handler. - * - * @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler */ - protected $contentTypeHandler; + protected Handler $contentTypeHandler; /** * Field name generator. - * - * @var \Ibexa\Core\Search\Common\FieldNameGenerator */ - protected $nameGenerator; + protected FieldNameGenerator $nameGenerator; /** * Create from search field registry, content type handler and field name generator. @@ -105,7 +100,7 @@ public function getFieldTypes( $fieldDefinitionIdentifier, $fieldTypeIdentifier = null, $name = null - ) { + ): array { $fieldMap = $this->getSearchableFieldMap(); $fieldTypeNameMap = []; @@ -166,7 +161,7 @@ public function getSortFieldName( $contentTypeIdentifier, $fieldDefinitionIdentifier, $name = null - ) { + ): ?false { $fieldMap = $this->getSearchableFieldMap(); // First check if field exists in type, there is nothing to do if it doesn't @@ -202,10 +197,10 @@ public function getIndexFieldName( $criterionOrSortClause, $contentTypeIdentifier, $fieldDefinitionIdentifier, - $fieldTypeIdentifier, + string $fieldTypeIdentifier, $name, $isSortField - ) { + ): array { // If criterion or sort clause implements CustomFieldInterface and custom field is set for // ContentType/FieldDefinition, return it if ( diff --git a/src/lib/Search/Common/FieldValueMapper/IntegerMapper.php b/src/lib/Search/Common/FieldValueMapper/IntegerMapper.php index c1e2aa3d9b..b6ae18b3e7 100644 --- a/src/lib/Search/Common/FieldValueMapper/IntegerMapper.php +++ b/src/lib/Search/Common/FieldValueMapper/IntegerMapper.php @@ -21,7 +21,7 @@ public function canMap(Field $field): bool return $field->getType() instanceof IntegerField; } - public function map(Field $field) + public function map(Field $field): int { return $this->convert($field->getValue()); } diff --git a/src/lib/Search/Common/FieldValueMapper/MultipleBooleanMapper.php b/src/lib/Search/Common/FieldValueMapper/MultipleBooleanMapper.php index 11b9e7a1f9..866170c592 100644 --- a/src/lib/Search/Common/FieldValueMapper/MultipleBooleanMapper.php +++ b/src/lib/Search/Common/FieldValueMapper/MultipleBooleanMapper.php @@ -21,7 +21,10 @@ public function canMap(Field $field): bool return $field->getType() instanceof MultipleBooleanField; } - public function map(Field $field) + /** + * @return bool[] + */ + public function map(Field $field): array { $values = []; diff --git a/src/lib/Search/Common/FieldValueMapper/MultipleIdentifierMapper.php b/src/lib/Search/Common/FieldValueMapper/MultipleIdentifierMapper.php index 7260c96b7e..32a68739a3 100644 --- a/src/lib/Search/Common/FieldValueMapper/MultipleIdentifierMapper.php +++ b/src/lib/Search/Common/FieldValueMapper/MultipleIdentifierMapper.php @@ -25,9 +25,9 @@ public function canMap(Field $field): bool * * @param \Ibexa\Contracts\Core\Search\Field $field * - * @return mixed + * @return mixed[] */ - public function map(Field $field) + public function map(Field $field): array { $values = []; diff --git a/src/lib/Search/Common/FieldValueMapper/MultipleIntegerMapper.php b/src/lib/Search/Common/FieldValueMapper/MultipleIntegerMapper.php index 60dad1d0af..f0f0300735 100644 --- a/src/lib/Search/Common/FieldValueMapper/MultipleIntegerMapper.php +++ b/src/lib/Search/Common/FieldValueMapper/MultipleIntegerMapper.php @@ -20,7 +20,10 @@ public function canMap(Field $field): bool return $field->getType() instanceof MultipleIntegerField; } - public function map(Field $field) + /** + * @return int[] + */ + public function map(Field $field): array { $values = []; diff --git a/src/lib/Search/Common/FieldValueMapper/MultipleRemoteIdentifierMapper.php b/src/lib/Search/Common/FieldValueMapper/MultipleRemoteIdentifierMapper.php index e0001b7480..fddc8402e6 100644 --- a/src/lib/Search/Common/FieldValueMapper/MultipleRemoteIdentifierMapper.php +++ b/src/lib/Search/Common/FieldValueMapper/MultipleRemoteIdentifierMapper.php @@ -20,7 +20,10 @@ public function canMap(Field $field): bool return $field->getType() instanceof MultipleRemoteIdentifierField; } - public function map(Field $field) + /** + * @return string[] + */ + public function map(Field $field): array { $values = []; diff --git a/src/lib/Search/Common/FieldValueMapper/MultipleStringMapper.php b/src/lib/Search/Common/FieldValueMapper/MultipleStringMapper.php index 0d2d6bcfb1..7e6a56605b 100644 --- a/src/lib/Search/Common/FieldValueMapper/MultipleStringMapper.php +++ b/src/lib/Search/Common/FieldValueMapper/MultipleStringMapper.php @@ -32,7 +32,7 @@ public function canMap(Field $field): bool * * @return array */ - public function map(Field $field) + public function map(Field $field): array { $values = []; diff --git a/src/lib/Search/Common/FieldValueMapper/StringMapper.php b/src/lib/Search/Common/FieldValueMapper/StringMapper.php index 137d1f0e55..949046b331 100644 --- a/src/lib/Search/Common/FieldValueMapper/StringMapper.php +++ b/src/lib/Search/Common/FieldValueMapper/StringMapper.php @@ -24,7 +24,7 @@ public function canMap(Field $field): bool return $field->getType() instanceof FieldType\StringField; } - public function map(Field $field) + public function map(Field $field): string { return $this->convert($field->getValue()); } diff --git a/src/lib/Search/Common/Indexer.php b/src/lib/Search/Common/Indexer.php index 064af65d46..48317de863 100644 --- a/src/lib/Search/Common/Indexer.php +++ b/src/lib/Search/Common/Indexer.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Driver\Statement; use Ibexa\Contracts\Core\Persistence\Content\ContentInfo; +use Ibexa\Contracts\Core\Persistence\Handler; use Ibexa\Contracts\Core\Persistence\Handler as PersistenceHandler; use Ibexa\Contracts\Core\Search\Handler as SearchHandler; use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway; @@ -21,17 +22,13 @@ */ abstract class Indexer { - /** @var \Psr\Log\LoggerInterface */ - protected $logger; + protected LoggerInterface $logger; - /** @var \Ibexa\Contracts\Core\Persistence\Handler */ - protected $persistenceHandler; + protected Handler $persistenceHandler; - /** @var \Doctrine\DBAL\Connection */ - protected $connection; + protected Connection $connection; - /** @var \Ibexa\Contracts\Core\Search\Handler */ - protected $searchHandler; + protected SearchHandler $searchHandler; public function __construct( LoggerInterface $logger, diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriteriaConverter.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriteriaConverter.php index 5aab74e911..4b480b2887 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriteriaConverter.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriteriaConverter.php @@ -39,7 +39,7 @@ public function __construct(array $handlers = []) * * @param \Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler $handler */ - public function addHandler(CriterionHandler $handler) + public function addHandler(CriterionHandler $handler): void { $this->handlers[] = $handler; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler.php index cbf0535df6..24eda511fe 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler.php @@ -30,8 +30,7 @@ abstract class CriterionHandler Operator::LIKE => 'like', ]; - /** @var \Doctrine\DBAL\Connection */ - protected $connection; + protected Connection $connection; /** @var \Doctrine\DBAL\Platforms\AbstractPlatform|null */ protected $dbPlatform; diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeIdentifier.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeIdentifier.php index bb8118e84e..a311f39398 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeIdentifier.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeIdentifier.php @@ -9,6 +9,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; +use Ibexa\Contracts\Core\Persistence\Content\Type\Handler; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; @@ -25,15 +26,10 @@ class ContentTypeIdentifier extends CriterionHandler { /** * Content type handler. - * - * @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler */ - protected $contentTypeHandler; + protected Handler $contentTypeHandler; - /** - * @var \Psr\Log\LoggerInterface - */ - protected $logger; + protected LoggerInterface $logger; public function __construct( Connection $connection, diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/Field.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/Field.php index ef02608d96..ee45ec705f 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/Field.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/Field.php @@ -14,10 +14,12 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry; use Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry as Registry; use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway; use Ibexa\Core\Persistence\TransformationProcessor; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; +use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\FieldValue\Converter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\FieldValue\Converter as FieldValueConverter; /** @@ -27,24 +29,18 @@ class Field extends FieldBase { /** * Field converter registry. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry */ - protected $fieldConverterRegistry; + protected ConverterRegistry $fieldConverterRegistry; /** * Field value converter. - * - * @var \Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\FieldValue\Converter */ - protected $fieldValueConverter; + protected Converter $fieldValueConverter; /** * Transformation processor. - * - * @var \Ibexa\Core\Persistence\TransformationProcessor */ - protected $transformationProcessor; + protected TransformationProcessor $transformationProcessor; public function __construct( Connection $connection, @@ -80,7 +76,7 @@ public function accept(CriterionInterface $criterion): bool * @throws \RuntimeException if no converter is found * @throws \Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter\Exception\NotFound */ - protected function getFieldsInformation($fieldIdentifier) + protected function getFieldsInformation($fieldIdentifier): array { $fieldMapArray = []; $fieldMap = $this->contentTypeHandler->getSearchableFieldMap(); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldBase.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldBase.php index 7ab13f6662..727d108bd2 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldBase.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldBase.php @@ -11,6 +11,7 @@ use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Persistence\Content\Language\Handler as LanguageHandler; +use Ibexa\Contracts\Core\Persistence\Content\Type\Handler; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -22,17 +23,13 @@ abstract class FieldBase extends CriterionHandler { /** * Content type handler. - * - * @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler */ - protected $contentTypeHandler; + protected Handler $contentTypeHandler; /** * Language handler. - * - * @var \Ibexa\Contracts\Core\Persistence\Content\Language\Handler */ - protected $languageHandler; + protected LanguageHandler $languageHandler; /** * @throws \Doctrine\DBAL\DBALException diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldEmpty.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldEmpty.php index 9a6dd3ac77..dc2e7859db 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldEmpty.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldEmpty.php @@ -16,6 +16,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry; use Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry as Registry; use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; @@ -27,15 +28,10 @@ class FieldEmpty extends FieldBase { /** * Field converter registry. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry */ - protected $fieldConverterRegistry; + protected ConverterRegistry $fieldConverterRegistry; - /** - * @var \Ibexa\Contracts\Core\Repository\FieldTypeService - */ - protected $fieldTypeService; + protected FieldTypeService $fieldTypeService; public function __construct( Connection $connection, diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldRelation.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldRelation.php index d2ac6395ec..a5fc72dba7 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldRelation.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldRelation.php @@ -45,7 +45,7 @@ public function accept(CriterionInterface $criterion): bool * * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException If no searchable fields are found for the given $fieldIdentifier. */ - protected function getFieldDefinitionsIds($fieldDefinitionIdentifier) + protected function getFieldDefinitionsIds($fieldDefinitionIdentifier): array { $fieldDefinitionIdList = []; $fieldMap = $this->contentTypeHandler->getSearchableFieldMap(); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/Converter.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/Converter.php index 2bed57d87c..c9811368f9 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/Converter.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/Converter.php @@ -18,17 +18,13 @@ class Converter { /** * Criterion field value handler registry. - * - * @var \Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\FieldValue\HandlerRegistry */ - protected $registry; + protected HandlerRegistry $registry; /** * Default Criterion field value handler. - * - * @var \Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\FieldValue\Handler */ - protected $defaultHandler; + protected ?Handler $defaultHandler; /** * Construct from an array of Criterion field value handlers. diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/Handler.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/Handler.php index 1142398ea2..8025e5f90e 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/Handler.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/Handler.php @@ -21,8 +21,7 @@ */ abstract class Handler { - /** @var \Doctrine\DBAL\Connection */ - protected $connection; + protected Connection $connection; /** * Map of criterion operators to the respective function names @@ -40,10 +39,8 @@ abstract class Handler /** * Transformation processor. - * - * @var \Ibexa\Core\Persistence\TransformationProcessor */ - protected $transformationProcessor; + protected TransformationProcessor $transformationProcessor; /** @var \Doctrine\DBAL\Platforms\AbstractPlatform|null */ protected $dbPlatform; @@ -76,7 +73,7 @@ public function handle( Criterion $criterion, string $column ) { - if (is_array($criterion->value) && Criterion\Operator::isUnary($criterion->operator)) { + if (is_array($criterion->value) && CriterionOperator::isUnary($criterion->operator)) { if (count($criterion->value) > 1) { throw new InvalidArgumentException('$criterion->value', "Too many arguments for unary operator '$criterion->operator'"); } @@ -85,7 +82,7 @@ public function handle( } switch ($criterion->operator) { - case Criterion\Operator::IN: + case CriterionOperator::IN: $values = array_map([$this, 'prepareParameter'], $criterion->value); $filter = $subQuery->expr()->in( $column, @@ -96,7 +93,7 @@ public function handle( ); break; - case Criterion\Operator::BETWEEN: + case CriterionOperator::BETWEEN: $filter = $this->dbPlatform->getBetweenExpression( $column, $outerQuery->createNamedParameter($this->lowerCase($criterion->value[0])), @@ -104,11 +101,11 @@ public function handle( ); break; - case Criterion\Operator::EQ: - case Criterion\Operator::GT: - case Criterion\Operator::GTE: - case Criterion\Operator::LT: - case Criterion\Operator::LTE: + case CriterionOperator::EQ: + case CriterionOperator::GT: + case CriterionOperator::GTE: + case CriterionOperator::LT: + case CriterionOperator::LTE: $operatorFunction = $this->comparatorMap[$criterion->operator]; $filter = $subQuery->expr()->{$operatorFunction}( $column, @@ -116,7 +113,7 @@ public function handle( ); break; - case Criterion\Operator::LIKE: + case CriterionOperator::LIKE: $value = str_replace('*', '%', $this->prepareLikeString($criterion->value)); $filter = $subQuery->expr()->like( @@ -125,7 +122,7 @@ public function handle( ); break; - case Criterion\Operator::CONTAINS: + case CriterionOperator::CONTAINS: $filter = $subQuery->expr()->like( $column, $outerQuery->createNamedParameter( diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/Handler/Collection.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/Handler/Collection.php index 590737cac0..520f1e34b3 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/Handler/Collection.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/Handler/Collection.php @@ -25,10 +25,8 @@ class Collection extends Handler { /** * Character separating indexed values. - * - * @var string */ - protected $separator; + protected string $separator; public function __construct( Connection $connection, diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/HandlerRegistry.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/HandlerRegistry.php index 7128991443..49f76280a8 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/HandlerRegistry.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FieldValue/HandlerRegistry.php @@ -41,7 +41,7 @@ public function __construct(array $map = []) * @param string $fieldTypeIdentifier * @param \Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler\FieldValue\Handler $handler */ - public function register($fieldTypeIdentifier, $handler) + public function register($fieldTypeIdentifier, $handler): void { $this->map[$fieldTypeIdentifier] = $handler; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FullText.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FullText.php index b6e2bb0cee..cea1b2b9f7 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FullText.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/FullText.php @@ -26,10 +26,8 @@ class FullText extends CriterionHandler { /** * Full text search configuration options. - * - * @var array */ - protected $configuration = [ + protected array $configuration = [ // @see getStopWordThresholdValue() 'stopWordThresholdFactor' => 0.66, 'enableWildcards' => true, @@ -70,21 +68,16 @@ class FullText extends CriterionHandler ]; /** - * @var int|null - * * @see getStopWordThresholdValue() */ - private $stopWordThresholdValue; + private ?int $stopWordThresholdValue = null; /** * Transformation processor to normalize search strings. - * - * @var \Ibexa\Core\Persistence\TransformationProcessor */ - protected $processor; + protected TransformationProcessor $processor; - /** @var \Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator */ - private $languageMaskGenerator; + private MaskGenerator $languageMaskGenerator; /** * @param array $configuration diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php index 8375c77e6b..b4461149d5 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/LanguageCode.php @@ -20,8 +20,7 @@ */ class LanguageCode extends CriterionHandler { - /** @var \Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator */ - private $maskGenerator; + private MaskGenerator $maskGenerator; public function __construct(Connection $connection, MaskGenerator $maskGenerator) { diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MapLocationDistance.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MapLocationDistance.php index f8945726b9..53e8adf500 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MapLocationDistance.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/MapLocationDistance.php @@ -45,7 +45,7 @@ public function accept(CriterionInterface $criterion): bool * * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException If no searchable fields are found for the given $fieldIdentifier. */ - protected function getFieldDefinitionIds($fieldIdentifier) + protected function getFieldDefinitionIds($fieldIdentifier): array { $fieldDefinitionIdList = []; $fieldMap = $this->contentTypeHandler->getSearchableFieldMap(); diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserEmail.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserEmail.php index 8ce58368ee..941d87906d 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserEmail.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserEmail.php @@ -18,8 +18,7 @@ class UserEmail extends CriterionHandler { - /** @var \Ibexa\Core\Persistence\TransformationProcessor */ - private $transformationProcessor; + private TransformationProcessor $transformationProcessor; public function __construct( Connection $connection, diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserLogin.php b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserLogin.php index 443fef7ae9..c1b28ca6ad 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserLogin.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/CriterionHandler/UserLogin.php @@ -18,8 +18,7 @@ class UserLogin extends CriterionHandler { - /** @var \Ibexa\Core\Persistence\TransformationProcessor */ - private $transformationProcessor; + private TransformationProcessor $transformationProcessor; public function __construct( Connection $connection, diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseConverter.php b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseConverter.php index 053eb7eb10..0cc3d424ab 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseConverter.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseConverter.php @@ -45,7 +45,7 @@ public function __construct(array $handlers = []) * * @param \Ibexa\Core\Search\Legacy\Content\Common\Gateway\SortClauseHandler $handler */ - public function addHandler(SortClauseHandler $handler) + public function addHandler(SortClauseHandler $handler): void { $this->handlers[] = $handler; } diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler.php b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler.php index 7d9c68cce2..0fcde0177c 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler.php @@ -16,8 +16,7 @@ */ abstract class SortClauseHandler { - /** @var \Doctrine\DBAL\Connection */ - protected $connection; + protected Connection $connection; /** @var \Doctrine\DBAL\Platforms\AbstractPlatform|null */ protected $dbPlatform; diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/Factory/RandomSortClauseHandlerFactory.php b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/Factory/RandomSortClauseHandlerFactory.php index 9a03bf68b3..c9ba29c83f 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/Factory/RandomSortClauseHandlerFactory.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/Factory/RandomSortClauseHandlerFactory.php @@ -15,10 +15,9 @@ class RandomSortClauseHandlerFactory { /** @var iterable|\Ibexa\Core\Search\Legacy\Content\Common\Gateway\SortClauseHandler\AbstractRandom[] */ - private $randomSortClauseGateways = []; + private iterable $randomSortClauseGateways; - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; public function __construct(Connection $connection, iterable $randomSortClauseGateways) { diff --git a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/Field.php b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/Field.php index 367120fdef..d7aa888ab6 100644 --- a/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/Field.php +++ b/src/lib/Search/Legacy/Content/Common/Gateway/SortClauseHandler/Field.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Query\QueryBuilder; +use Ibexa\Contracts\Core\Persistence\Content\Language\Handler; use Ibexa\Contracts\Core\Persistence\Content\Language\Handler as LanguageHandler; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; @@ -24,17 +25,13 @@ class Field extends SortClauseHandler { /** * Language handler. - * - * @var \Ibexa\Contracts\Core\Persistence\Content\Language\Handler */ - protected $languageHandler; + protected Handler $languageHandler; /** * Content type handler. - * - * @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler */ - protected $contentTypeHandler; + protected ContentTypeHandler $contentTypeHandler; public function __construct( Connection $connection, @@ -158,7 +155,7 @@ public function applyJoin( protected function getFieldCondition( QueryBuilder $query, array $languageSettings, - $fieldTableName + string $fieldTableName ) { // 1. Use main language(s) by default if (empty($languageSettings['languages'])) { diff --git a/src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php b/src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php index 30113aad04..446dd7f117 100644 --- a/src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php +++ b/src/lib/Search/Legacy/Content/Gateway/DoctrineDatabase.php @@ -12,6 +12,7 @@ use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Query\QueryBuilder; use Ibexa\Contracts\Core\Persistence\Content\ContentInfo; +use Ibexa\Contracts\Core\Persistence\Content\Language\Handler; use Ibexa\Contracts\Core\Persistence\Content\Language\Handler as LanguageHandler; use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; @@ -27,32 +28,25 @@ */ final class DoctrineDatabase extends Gateway { - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; /** @var \Doctrine\DBAL\Platforms\AbstractPlatform */ private $dbPlatform; /** * Criteria converter. - * - * @var \Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter */ - private $criteriaConverter; + private CriteriaConverter $criteriaConverter; /** * Sort clause converter. - * - * @var \Ibexa\Core\Search\Legacy\Content\Common\Gateway\SortClauseConverter */ - private $sortClauseConverter; + private SortClauseConverter $sortClauseConverter; /** * Language handler. - * - * @var \Ibexa\Contracts\Core\Persistence\Content\Language\Handler */ - private $languageHandler; + private Handler $languageHandler; /** * @throws \Doctrine\DBAL\DBALException diff --git a/src/lib/Search/Legacy/Content/Gateway/ExceptionConversion.php b/src/lib/Search/Legacy/Content/Gateway/ExceptionConversion.php index 6415ac3b87..b104ffcea3 100644 --- a/src/lib/Search/Legacy/Content/Gateway/ExceptionConversion.php +++ b/src/lib/Search/Legacy/Content/Gateway/ExceptionConversion.php @@ -19,10 +19,7 @@ */ class ExceptionConversion extends Gateway { - /** - * @var \Ibexa\Core\Search\Legacy\Content\Gateway - */ - protected $innerGateway; + protected Gateway $innerGateway; public function __construct(Gateway $innerGateway) { diff --git a/src/lib/Search/Legacy/Content/Handler.php b/src/lib/Search/Legacy/Content/Handler.php index ccf685cce0..72d2d041ec 100644 --- a/src/lib/Search/Legacy/Content/Handler.php +++ b/src/lib/Search/Legacy/Content/Handler.php @@ -21,6 +21,7 @@ use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\Base\Exceptions\NotFoundException; use Ibexa\Core\Persistence\Legacy\Content\Location\Mapper as LocationMapper; +use Ibexa\Core\Persistence\Legacy\Content\Mapper; use Ibexa\Core\Persistence\Legacy\Content\Mapper as ContentMapper; use Ibexa\Core\Search\Legacy\Content\Location\Gateway as LocationGateway; use Ibexa\Core\Search\Legacy\Content\Mapper\FullTextMapper; @@ -53,52 +54,38 @@ class Handler implements SearchHandlerInterface { /** * Content locator gateway. - * - * @var \Ibexa\Core\Search\Legacy\Content\Gateway */ - protected $gateway; + protected Gateway $gateway; /** * Location locator gateway. - * - * @var \Ibexa\Core\Search\Legacy\Content\Location\Gateway */ - protected $locationGateway; + protected LocationGateway $locationGateway; /** * Word indexer gateway. - * - * @var \Ibexa\Core\Search\Legacy\Content\WordIndexer\Gateway */ - protected $indexerGateway; + protected WordIndexerGateway $indexerGateway; /** * Content mapper. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Mapper */ - protected $contentMapper; + protected Mapper $contentMapper; /** * Location locationMapper. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Mapper */ - protected $locationMapper; + protected LocationMapper $locationMapper; /** * Language handler. - * - * @var \Ibexa\Contracts\Core\Persistence\Content\Language\Handler */ - protected $languageHandler; + protected LanguageHandler $languageHandler; /** * FullText mapper. - * - * @var \Ibexa\Core\Search\Legacy\Content\Mapper\FullTextMapper */ - protected $mapper; + protected FullTextMapper $mapper; public function __construct( Gateway $gateway, @@ -257,7 +244,7 @@ public function findLocations(LocationQuery $query, array $languageFilter = []): * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException */ - public function suggest($prefix, $fieldPaths = [], $limit = 10, Criterion $filter = null) + public function suggest($prefix, $fieldPaths = [], $limit = 10, Criterion $filter = null): never { throw new NotImplementedException('Suggestions are not supported by Legacy search engine.'); } @@ -267,7 +254,7 @@ public function suggest($prefix, $fieldPaths = [], $limit = 10, Criterion $filte * * @param \Ibexa\Contracts\Core\Persistence\Content $content */ - public function indexContent(Content $content) + public function indexContent(Content $content): void { $fullTextValue = $this->mapper->mapContent($content); @@ -280,7 +267,7 @@ public function indexContent(Content $content) * @param \Ibexa\Contracts\Core\Persistence\Content[] $contentList * @param callable $errorCallback (Content $content, NotFoundException $e) */ - public function bulkIndex(array $contentList, callable $errorCallback) + public function bulkIndex(array $contentList, callable $errorCallback): void { $fullTextBulkData = []; foreach ($contentList as $content) { @@ -297,7 +284,7 @@ public function bulkIndex(array $contentList, callable $errorCallback) /** * @param \Ibexa\Contracts\Core\Persistence\Content\Location $location */ - public function indexLocation(Location $location) + public function indexLocation(Location $location): void { // Not needed with Legacy Storage/Search Engine } @@ -308,7 +295,7 @@ public function indexLocation(Location $location) * @param int $contentId * @param int|null $versionId */ - public function deleteContent($contentId, $versionId = null) + public function deleteContent($contentId, $versionId = null): void { $this->indexerGateway->remove($contentId, $versionId); } @@ -324,7 +311,7 @@ public function deleteTranslation(int $contentId, string $languageCode): void * @param mixed $locationId * @param mixed $contentId */ - public function deleteLocation($locationId, $contentId) + public function deleteLocation($locationId, $contentId): void { // Not needed with Legacy Storage/Search Engine } @@ -332,7 +319,7 @@ public function deleteLocation($locationId, $contentId) /** * Purges all contents from the index. */ - public function purgeIndex() + public function purgeIndex(): void { $this->indexerGateway->purgeIndex(); } @@ -342,7 +329,7 @@ public function purgeIndex() * * @param bool $flush */ - public function commit($flush = false) + public function commit($flush = false): void { // Not needed with Legacy Storage/Search Engine } diff --git a/src/lib/Search/Legacy/Content/Indexer.php b/src/lib/Search/Legacy/Content/Indexer.php index 51d013a7de..72c927425b 100644 --- a/src/lib/Search/Legacy/Content/Indexer.php +++ b/src/lib/Search/Legacy/Content/Indexer.php @@ -32,7 +32,7 @@ public function getName(): string return 'Ibexa Legacy (SQL) Search Engine'; } - public function updateSearchIndex(array $contentIds, $commit) + public function updateSearchIndex(array $contentIds, $commit): void { $contentHandler = $this->persistenceHandler->contentHandler(); foreach ($contentIds as $contentId) { @@ -57,7 +57,7 @@ public function updateSearchIndex(array $contentIds, $commit) } } - public function purge() + public function purge(): void { $this->searchHandler->purgeIndex(); } diff --git a/src/lib/Search/Legacy/Content/IndexerGateway.php b/src/lib/Search/Legacy/Content/IndexerGateway.php index db4a5e4403..9aa1bbaf84 100644 --- a/src/lib/Search/Legacy/Content/IndexerGateway.php +++ b/src/lib/Search/Legacy/Content/IndexerGateway.php @@ -22,8 +22,7 @@ */ final class IndexerGateway implements SPIIndexerGateway { - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; public function __construct(Connection $connection) { diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsBookmarked.php b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsBookmarked.php index e5263adb52..fb44040e0b 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsBookmarked.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/CriterionHandler/Location/IsBookmarked.php @@ -47,7 +47,7 @@ public function handle( QueryBuilder $queryBuilder, CriterionInterface $criterion, array $languageSettings - ) { + ): string { if (!is_array($criterion->value)) { throw new LogicException(sprintf( 'Expected %s Criterion value to be an array, %s received', diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/DoctrineDatabase.php b/src/lib/Search/Legacy/Content/Location/Gateway/DoctrineDatabase.php index 45a687a0ee..59ab7aad38 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/DoctrineDatabase.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/DoctrineDatabase.php @@ -10,6 +10,7 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\FetchMode; use Doctrine\DBAL\ParameterType; +use Ibexa\Contracts\Core\Persistence\Content\Language\Handler; use Ibexa\Contracts\Core\Persistence\Content\Language\Handler as LanguageHandler; use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway; @@ -29,21 +30,16 @@ final class DoctrineDatabase extends Gateway */ public const MAX_LIMIT = 1073741824; - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; - /** @var \Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter */ - private $criteriaConverter; + private CriteriaConverter $criteriaConverter; - /** @var \Ibexa\Core\Search\Legacy\Content\Common\Gateway\SortClauseConverter */ - private $sortClauseConverter; + private SortClauseConverter $sortClauseConverter; /** * Language handler. - * - * @var \Ibexa\Contracts\Core\Persistence\Content\Language\Handler */ - private $languageHandler; + private Handler $languageHandler; /** @var \Doctrine\DBAL\Platforms\AbstractPlatform */ private $dbPlatform; diff --git a/src/lib/Search/Legacy/Content/Location/Gateway/ExceptionConversion.php b/src/lib/Search/Legacy/Content/Location/Gateway/ExceptionConversion.php index a01350b25e..12296dad9f 100644 --- a/src/lib/Search/Legacy/Content/Location/Gateway/ExceptionConversion.php +++ b/src/lib/Search/Legacy/Content/Location/Gateway/ExceptionConversion.php @@ -20,10 +20,8 @@ class ExceptionConversion extends Gateway { /** * The wrapped gateway. - * - * @var \Ibexa\Core\Search\Legacy\Content\Location\Gateway */ - protected $innerGateway; + protected Gateway $innerGateway; /** * Creates a new exception conversion gateway around $innerGateway. diff --git a/src/lib/Search/Legacy/Content/Mapper/FullTextMapper.php b/src/lib/Search/Legacy/Content/Mapper/FullTextMapper.php index c3c75d702f..9f16ed9e62 100644 --- a/src/lib/Search/Legacy/Content/Mapper/FullTextMapper.php +++ b/src/lib/Search/Legacy/Content/Mapper/FullTextMapper.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Persistence\Content; use Ibexa\Contracts\Core\Persistence\Content\Type; +use Ibexa\Contracts\Core\Persistence\Content\Type\Handler; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as ContentTypeHandler; use Ibexa\Contracts\Core\Search\Field; use Ibexa\Contracts\Core\Search\FieldType; @@ -24,17 +25,13 @@ class FullTextMapper { /** * Field registry. - * - * @var \Ibexa\Core\Search\Common\FieldRegistry */ - protected $fieldRegistry; + protected FieldRegistry $fieldRegistry; /** * Content type handler. - * - * @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler */ - protected $contentTypeHandler; + protected Handler $contentTypeHandler; /** * @param \Ibexa\Core\Search\Common\FieldRegistry $fieldRegistry @@ -55,7 +52,7 @@ public function __construct( * * @return \Ibexa\Core\Search\Legacy\Content\FullTextData */ - public function mapContent(Content $content) + public function mapContent(Content $content): FullTextData { return new FullTextData( [ @@ -84,7 +81,7 @@ protected function getFullTextValues(Content $content): array foreach ($content->fields as $field) { $fieldDefinition = $this->contentTypeHandler->getFieldDefinition( $field->fieldDefinitionId, - Content\Type::STATUS_DEFINED + Type::STATUS_DEFINED ); if (!$fieldDefinition->isSearchable) { continue; diff --git a/src/lib/Search/Legacy/Content/WordIndexer/Gateway/DoctrineDatabase.php b/src/lib/Search/Legacy/Content/WordIndexer/Gateway/DoctrineDatabase.php index 729388af3e..9044dd2939 100644 --- a/src/lib/Search/Legacy/Content/WordIndexer/Gateway/DoctrineDatabase.php +++ b/src/lib/Search/Legacy/Content/WordIndexer/Gateway/DoctrineDatabase.php @@ -8,6 +8,7 @@ namespace Ibexa\Core\Search\Legacy\Content\WordIndexer\Gateway; use Doctrine\DBAL\Connection; +use Ibexa\Contracts\Core\Persistence\Content\Type\Handler; use Ibexa\Contracts\Core\Persistence\Content\Type\Handler as SPITypeHandler; use Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator; use Ibexa\Core\Persistence\TransformationProcessor; @@ -27,45 +28,35 @@ class DoctrineDatabase extends Gateway */ public const DB_INT_MAX = 2147483647; - /** @var \Doctrine\DBAL\Connection */ - protected $connection; + protected Connection $connection; /** * Persistence content type handler. * * Need this for being able to pick fields that are searchable. - * - * @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler */ - protected $typeHandler; + protected Handler $typeHandler; /** * Transformation processor. * * Need this for being able to transform text to searchable value - * - * @var \Ibexa\Core\Persistence\TransformationProcessor */ - protected $transformationProcessor; + protected TransformationProcessor $transformationProcessor; /** * LegacySearchService. * * Need this for queries on ezsearch* tables - * - * @var \Ibexa\Core\Search\Legacy\Content\WordIndexer\Repository\SearchIndex */ - protected $searchIndex; + protected SearchIndex $searchIndex; - /** @var \Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator */ - private $languageMaskGenerator; + private MaskGenerator $languageMaskGenerator; /** * Full text search configuration options. - * - * @var array */ - protected $fullTextSearchConfiguration; + protected array $fullTextSearchConfiguration; public function __construct( Connection $connection, @@ -92,7 +83,7 @@ public function __construct( * * @param \Ibexa\Core\Search\Legacy\Content\FullTextData $fullTextData */ - public function index(FullTextData $fullTextData) + public function index(FullTextData $fullTextData): void { $indexArray = []; $indexArrayOnlyWords = []; @@ -177,7 +168,7 @@ public function index(FullTextData $fullTextData) * * @param \Ibexa\Core\Search\Legacy\Content\FullTextData[] $fullTextBulkData */ - public function bulkIndex(array $fullTextBulkData) + public function bulkIndex(array $fullTextBulkData): void { foreach ($fullTextBulkData as $fullTextData) { $this->index($fullTextData); @@ -218,7 +209,7 @@ public function remove($contentId, $versionId = null): bool /** * Remove entire search index. */ - public function purgeIndex() + public function purgeIndex(): void { $this->searchIndex->purge(); } @@ -237,7 +228,7 @@ public function purgeIndex() * * @return int last placement */ - private function indexWords(FullTextData $fullTextData, array $indexArray, array $wordIDArray, $placement = 0) + private function indexWords(FullTextData $fullTextData, array $indexArray, array $wordIDArray, int $placement = 0): int { $contentId = $fullTextData->id; @@ -298,7 +289,7 @@ private function indexWords(FullTextData $fullTextData, array $indexArray, array * * @return array wordIDArray */ - private function buildWordIDArray(array $indexArrayOnlyWords) + private function buildWordIDArray(array $indexArrayOnlyWords): array { $wordCount = count($indexArrayOnlyWords); $wordIDArray = []; diff --git a/src/lib/Search/Legacy/Content/WordIndexer/Repository/SearchIndex.php b/src/lib/Search/Legacy/Content/WordIndexer/Repository/SearchIndex.php index f1dc58039a..685c524c86 100644 --- a/src/lib/Search/Legacy/Content/WordIndexer/Repository/SearchIndex.php +++ b/src/lib/Search/Legacy/Content/WordIndexer/Repository/SearchIndex.php @@ -20,7 +20,7 @@ class SearchIndex public const SEARCH_WORD_TABLE = 'ezsearch_word'; public const SEARCH_OBJECT_WORD_LINK_TABLE = 'ezsearch_object_word_link'; - protected $connection; + protected Connection $connection; public function __construct(Connection $connection) { diff --git a/tests/bundle/Core/ApiLoader/CacheFactoryTest.php b/tests/bundle/Core/ApiLoader/CacheFactoryTest.php index 195dec054a..d3897516d7 100644 --- a/tests/bundle/Core/ApiLoader/CacheFactoryTest.php +++ b/tests/bundle/Core/ApiLoader/CacheFactoryTest.php @@ -9,6 +9,7 @@ use Ibexa\Bundle\Core\ApiLoader\CacheFactory; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Cache\Adapter\AdapterInterface; use Symfony\Component\Cache\Adapter\TagAwareAdapter; @@ -17,10 +18,10 @@ class CacheFactoryTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $configResolver; + private MockObject $configResolver; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $container; + private MockObject $container; protected function setUp(): void { @@ -32,7 +33,7 @@ protected function setUp(): void /** * @return array */ - public function providerGetService() + public function providerGetService(): array { return [ ['default', 'default'], @@ -44,7 +45,7 @@ public function providerGetService() /** * @dataProvider providerGetService */ - public function testGetService($name, $expected) + public function testGetService(string $name, string $expected): void { $this->configResolver ->expects(self::once()) diff --git a/tests/bundle/Core/Cache/Warmer/ProxyCacheWarmerTest.php b/tests/bundle/Core/Cache/Warmer/ProxyCacheWarmerTest.php index 606beeff6b..971c30c149 100644 --- a/tests/bundle/Core/Cache/Warmer/ProxyCacheWarmerTest.php +++ b/tests/bundle/Core/Cache/Warmer/ProxyCacheWarmerTest.php @@ -10,15 +10,16 @@ use Ibexa\Bundle\Core\Cache\Warmer\ProxyCacheWarmer; use Ibexa\Core\Repository\ProxyFactory\ProxyGeneratorInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; final class ProxyCacheWarmerTest extends TestCase { /** @var \Ibexa\Core\Repository\ProxyFactory\ProxyGeneratorInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $proxyGenerator; + private MockObject $proxyGenerator; /** @var \Ibexa\Bundle\Core\Cache\Warmer\ProxyCacheWarmer */ - private $proxyCacheWarmer; + private ProxyCacheWarmer $proxyCacheWarmer; protected function setUp(): void { diff --git a/tests/bundle/Core/ChainConfigResolverTest.php b/tests/bundle/Core/ChainConfigResolverTest.php index 0c46cedae0..be4dd79aa6 100644 --- a/tests/bundle/Core/ChainConfigResolverTest.php +++ b/tests/bundle/Core/ChainConfigResolverTest.php @@ -10,6 +10,7 @@ use Ibexa\Bundle\Core\DependencyInjection\Configuration\ChainConfigResolver; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\MVC\Exception\ParameterNotFoundException; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -18,14 +19,14 @@ class ChainConfigResolverTest extends TestCase { /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\ChainConfigResolver */ - private $chainResolver; + private ChainConfigResolver $chainResolver; protected function setUp(): void { $this->chainResolver = new ChainConfigResolver(); } - public function testPriority() + public function testPriority(): void { self::assertEquals([], $this->chainResolver->getAllResolvers()); @@ -47,7 +48,7 @@ public function testPriority() * Resolvers are supposed to be sorted only once. * This test will check that by trying to get all resolvers several times. */ - public function testSortResolvers() + public function testSortResolvers(): void { list($low, $medium, $high) = $this->createResolverMocks(); // We're using a mock here and not $this->chainResolver because we need to ensure that the sorting operation is done only once. @@ -77,7 +78,7 @@ public function testSortResolvers() /** * This test ensures that if a resolver is being added on the fly, the sorting is reset. */ - public function testReSortResolvers() + public function testReSortResolvers(): void { list($low, $medium, $high) = $this->createResolverMocks(); $highest = clone $high; @@ -120,14 +121,14 @@ public function testReSortResolvers() ); } - public function testGetDefaultNamespace() + public function testGetDefaultNamespace(): void { $this->expectException(\LogicException::class); $this->chainResolver->getDefaultNamespace(); } - public function testSetDefaultNamespace() + public function testSetDefaultNamespace(): void { $namespace = 'foo'; foreach ($this->createResolverMocks() as $i => $resolver) { @@ -141,7 +142,7 @@ public function testSetDefaultNamespace() $this->chainResolver->setDefaultNamespace($namespace); } - public function testGetParameterInvalid() + public function testGetParameterInvalid(): void { $this->expectException(ParameterNotFoundException::class); @@ -168,7 +169,7 @@ public function testGetParameterInvalid() * @param string $scope * @param mixed $expectedValue */ - public function testGetParameter($paramName, $namespace, $scope, $expectedValue) + public function testGetParameter(string $paramName, string $namespace, string $scope, string|bool|array $expectedValue): void { $resolver = $this->createMock(ConfigResolverInterface::class); $resolver @@ -181,7 +182,7 @@ public function testGetParameter($paramName, $namespace, $scope, $expectedValue) self::assertSame($expectedValue, $this->chainResolver->getParameter($paramName, $namespace, $scope)); } - public function getParameterProvider() + public function getParameterProvider(): array { return [ ['foo', 'namespace', 'scope', 'someValue'], @@ -191,7 +192,7 @@ public function getParameterProvider() ]; } - public function testHasParameterTrue() + public function testHasParameterTrue(): void { $paramName = 'foo'; $namespace = 'yetAnotherNamespace'; @@ -222,7 +223,7 @@ public function testHasParameterTrue() self::assertTrue($this->chainResolver->hasParameter($paramName, $namespace, $scope)); } - public function testHasParameterFalse() + public function testHasParameterFalse(): void { $paramName = 'foo'; $namespace = 'yetAnotherNamespace'; @@ -242,7 +243,7 @@ public function testHasParameterFalse() /** * @return \PHPUnit\Framework\MockObject\MockObject[] */ - private function createResolverMocks() + private function createResolverMocks(): array { return [ $this->createMock(ConfigResolverInterface::class), @@ -251,7 +252,7 @@ private function createResolverMocks() ]; } - private function buildMock($class, array $methods = []) + private function buildMock(string $class, array $methods = []): MockObject { return $this ->getMockBuilder($class) diff --git a/tests/bundle/Core/ConfigResolverTest.php b/tests/bundle/Core/ConfigResolverTest.php index b5ba8ee677..a3071bddd5 100644 --- a/tests/bundle/Core/ConfigResolverTest.php +++ b/tests/bundle/Core/ConfigResolverTest.php @@ -10,16 +10,17 @@ use Ibexa\Bundle\Core\DependencyInjection\Configuration\ConfigResolver; use Ibexa\Core\MVC\Exception\ParameterNotFoundException; use Ibexa\Core\MVC\Symfony\SiteAccess; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerInterface; class ConfigResolverTest extends TestCase { /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ - private $siteAccess; + private SiteAccess $siteAccess; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $containerMock; + private MockObject $containerMock; protected function setUp(): void { @@ -35,7 +36,7 @@ protected function setUp(): void * * @return \Ibexa\Bundle\Core\DependencyInjection\Configuration\ConfigResolver */ - private function getResolver($defaultNS = 'ibexa.site_access.config', $undefinedStrategy = ConfigResolver::UNDEFINED_STRATEGY_EXCEPTION, array $groupsBySiteAccess = []) + private function getResolver(string $defaultNS = 'ibexa.site_access.config', int $undefinedStrategy = ConfigResolver::UNDEFINED_STRATEGY_EXCEPTION, array $groupsBySiteAccess = []): ConfigResolver { $configResolver = new ConfigResolver( null, @@ -49,7 +50,7 @@ private function getResolver($defaultNS = 'ibexa.site_access.config', $undefined return $configResolver; } - public function testGetSetUndefinedStrategy() + public function testGetSetUndefinedStrategy(): void { $strategy = ConfigResolver::UNDEFINED_STRATEGY_NULL; $defaultNS = 'ibexa.site_access.config'; @@ -64,7 +65,7 @@ public function testGetSetUndefinedStrategy() self::assertSame('anotherNamespace', $resolver->getDefaultNamespace()); } - public function testGetParameterFailedWithException() + public function testGetParameterFailedWithException(): void { $this->expectException(ParameterNotFoundException::class); @@ -72,13 +73,13 @@ public function testGetParameterFailedWithException() $resolver->getParameter('foo'); } - public function testGetParameterFailedNull() + public function testGetParameterFailedNull(): void { $resolver = $this->getResolver('ibexa.site_access.config', ConfigResolver::UNDEFINED_STRATEGY_NULL); self::assertNull($resolver->getParameter('foo')); } - public function parameterProvider() + public function parameterProvider(): array { return [ ['foo', 'bar'], @@ -108,7 +109,7 @@ public function parameterProvider() /** * @dataProvider parameterProvider */ - public function testGetParameterGlobalScope($paramName, $expectedValue) + public function testGetParameterGlobalScope(string $paramName, string|bool|array $expectedValue): void { $globalScopeParameter = "ibexa.site_access.config.global.$paramName"; $this->containerMock @@ -128,7 +129,7 @@ public function testGetParameterGlobalScope($paramName, $expectedValue) /** * @dataProvider parameterProvider */ - public function testGetParameterRelativeScope($paramName, $expectedValue) + public function testGetParameterRelativeScope(string $paramName, string|bool|array $expectedValue): void { $relativeScopeParameter = "ibexa.site_access.config.{$this->siteAccess->name}.$paramName"; $this->containerMock @@ -154,7 +155,7 @@ public function testGetParameterRelativeScope($paramName, $expectedValue) /** * @dataProvider parameterProvider */ - public function testGetParameterSpecificScope($paramName, $expectedValue) + public function testGetParameterSpecificScope(string $paramName, string|bool|array $expectedValue): void { $scope = 'some_siteaccess'; $relativeScopeParameter = "ibexa.site_access.config.$scope.$paramName"; @@ -184,7 +185,7 @@ public function testGetParameterSpecificScope($paramName, $expectedValue) /** * @dataProvider parameterProvider */ - public function testGetParameterDefaultScope($paramName, $expectedValue) + public function testGetParameterDefaultScope(string $paramName, string|bool|array $expectedValue): void { $defaultScopeParameter = "ibexa.site_access.config.default.$paramName"; $relativeScopeParameter = "ibexa.site_access.config.{$this->siteAccess->name}.$paramName"; @@ -209,7 +210,7 @@ public function testGetParameterDefaultScope($paramName, $expectedValue) self::assertSame($expectedValue, $this->getResolver()->getParameter($paramName)); } - public function hasParameterProvider() + public function hasParameterProvider(): array { return [ [true, true, true, true, true], @@ -226,7 +227,7 @@ public function hasParameterProvider() /** * @dataProvider hasParameterProvider */ - public function testHasParameterNoNamespace($defaultMatch, $groupMatch, $scopeMatch, $globalMatch, $expectedResult) + public function testHasParameterNoNamespace(bool $defaultMatch, bool $groupMatch, bool $scopeMatch, bool $globalMatch, bool $expectedResult): void { $paramName = 'foo.bar'; $groupName = 'my_group'; @@ -255,7 +256,7 @@ public function testHasParameterNoNamespace($defaultMatch, $groupMatch, $scopeMa /** * @dataProvider hasParameterProvider */ - public function testHasParameterWithNamespaceAndScope($defaultMatch, $groupMatch, $scopeMatch, $globalMatch, $expectedResult) + public function testHasParameterWithNamespaceAndScope(bool $defaultMatch, bool $groupMatch, bool $scopeMatch, bool $globalMatch, bool $expectedResult): void { $paramName = 'foo.bar'; $namespace = 'my.namespace'; @@ -286,7 +287,7 @@ public function testHasParameterWithNamespaceAndScope($defaultMatch, $groupMatch self::assertSame($expectedResult, $configResolver->hasParameter($paramName, $namespace, $scope)); } - public function testGetSetDefaultScope() + public function testGetSetDefaultScope(): void { $newDefaultScope = 'bar'; $configResolver = $this->getResolver(); diff --git a/tests/bundle/Core/DependencyInjection/Compiler/ChainConfigResolverPassTest.php b/tests/bundle/Core/DependencyInjection/Compiler/ChainConfigResolverPassTest.php index 5d79973cdd..33faca094e 100644 --- a/tests/bundle/Core/DependencyInjection/Compiler/ChainConfigResolverPassTest.php +++ b/tests/bundle/Core/DependencyInjection/Compiler/ChainConfigResolverPassTest.php @@ -42,7 +42,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void * * @dataProvider addResolverProvider */ - public function testAddResolver($declaredPriority, $expectedPriority) + public function testAddResolver(?int $declaredPriority, int $expectedPriority): void { $resolverDef = new Definition(); $serviceId = 'some_service_id'; @@ -63,7 +63,7 @@ public function testAddResolver($declaredPriority, $expectedPriority) ); } - public function addResolverProvider() + public function addResolverProvider(): array { return [ [null, 0], diff --git a/tests/bundle/Core/DependencyInjection/Compiler/ChainRoutingPassTest.php b/tests/bundle/Core/DependencyInjection/Compiler/ChainRoutingPassTest.php index a97122ffd3..3dcec2c386 100644 --- a/tests/bundle/Core/DependencyInjection/Compiler/ChainRoutingPassTest.php +++ b/tests/bundle/Core/DependencyInjection/Compiler/ChainRoutingPassTest.php @@ -44,7 +44,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void * * @dataProvider addRouterProvider */ - public function testAddRouter($declaredPriority, $expectedPriority) + public function testAddRouter(?int $declaredPriority, int $expectedPriority): void { $resolverDef = new Definition(); $serviceId = 'some_service_id'; @@ -70,7 +70,7 @@ public function testAddRouter($declaredPriority, $expectedPriority) * * @dataProvider addRouterProvider */ - public function testAddRouterWithDefaultRouter($declaredPriority, $expectedPriority) + public function testAddRouterWithDefaultRouter(?int $declaredPriority, int $expectedPriority): void { $defaultRouter = new Definition(); $this->setDefinition('router.default', $defaultRouter); @@ -124,7 +124,7 @@ public function testAddRouterWithDefaultRouter($declaredPriority, $expectedPrior ); } - public function addRouterProvider() + public function addRouterProvider(): array { return [ [null, 0], diff --git a/tests/bundle/Core/DependencyInjection/Compiler/FieldTypeParameterProviderRegistryPassTest.php b/tests/bundle/Core/DependencyInjection/Compiler/FieldTypeParameterProviderRegistryPassTest.php index 9e19239e81..f30b1a16f5 100644 --- a/tests/bundle/Core/DependencyInjection/Compiler/FieldTypeParameterProviderRegistryPassTest.php +++ b/tests/bundle/Core/DependencyInjection/Compiler/FieldTypeParameterProviderRegistryPassTest.php @@ -36,7 +36,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void /** * @dataProvider tagsProvider */ - public function testRegisterFieldType(string $tag) + public function testRegisterFieldType(string $tag): void { $fieldTypeIdentifier = 'field_type_identifier'; $serviceId = 'service_id'; @@ -58,7 +58,7 @@ public function testRegisterFieldType(string $tag) * * @param string $tag */ - public function testRegisterFieldTypeNoAlias(string $tag) + public function testRegisterFieldTypeNoAlias(string $tag): void { $this->expectException(\LogicException::class); diff --git a/tests/bundle/Core/DependencyInjection/Compiler/FragmentPassTest.php b/tests/bundle/Core/DependencyInjection/Compiler/FragmentPassTest.php index 6616520948..72c78331d0 100644 --- a/tests/bundle/Core/DependencyInjection/Compiler/FragmentPassTest.php +++ b/tests/bundle/Core/DependencyInjection/Compiler/FragmentPassTest.php @@ -24,7 +24,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void $container->addCompilerPass(new FragmentPass()); } - public function testProcess() + public function testProcess(): void { $inlineRendererDef = new Definition(InlineFragmentRenderer::class); $inlineRendererDef->addTag('kernel.fragment_renderer'); diff --git a/tests/bundle/Core/DependencyInjection/Compiler/NotificationRendererPassTest.php b/tests/bundle/Core/DependencyInjection/Compiler/NotificationRendererPassTest.php index eb87e94e90..a230b50584 100644 --- a/tests/bundle/Core/DependencyInjection/Compiler/NotificationRendererPassTest.php +++ b/tests/bundle/Core/DependencyInjection/Compiler/NotificationRendererPassTest.php @@ -31,7 +31,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void $container->addCompilerPass(new NotificationRendererPass()); } - public function testAddRenderer() + public function testAddRenderer(): void { $definition = new Definition(); $definition->addTag(NotificationRendererPass::TAG_NAME, [ @@ -48,7 +48,7 @@ public function testAddRenderer() ); } - public function testAddRendererWithoutAliasThrowsLogicException() + public function testAddRendererWithoutAliasThrowsLogicException(): void { $this->expectException(\LogicException::class); diff --git a/tests/bundle/Core/DependencyInjection/Compiler/PlaceholderProviderPassTest.php b/tests/bundle/Core/DependencyInjection/Compiler/PlaceholderProviderPassTest.php index 9c174c56bd..fad1abddc1 100644 --- a/tests/bundle/Core/DependencyInjection/Compiler/PlaceholderProviderPassTest.php +++ b/tests/bundle/Core/DependencyInjection/Compiler/PlaceholderProviderPassTest.php @@ -30,7 +30,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void $container->addCompilerPass(new PlaceholderProviderPass()); } - public function testAddProvider() + public function testAddProvider(): void { $definition = new Definition(); $definition->addTag(PlaceholderProviderPass::TAG_NAME, ['type' => self::PROVIDER_TYPE]); @@ -45,7 +45,7 @@ public function testAddProvider() ); } - public function testAddProviderWithoutType() + public function testAddProviderWithoutType(): void { $this->expectException(\LogicException::class); diff --git a/tests/bundle/Core/DependencyInjection/Compiler/RegisterStorageEnginePassTest.php b/tests/bundle/Core/DependencyInjection/Compiler/RegisterStorageEnginePassTest.php index 2b298c9b24..be60023985 100644 --- a/tests/bundle/Core/DependencyInjection/Compiler/RegisterStorageEnginePassTest.php +++ b/tests/bundle/Core/DependencyInjection/Compiler/RegisterStorageEnginePassTest.php @@ -34,7 +34,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void $container->addCompilerPass(new RegisterStorageEnginePass()); } - public function testRegisterStorageEngine() + public function testRegisterStorageEngine(): void { $storageEngineDef = new Definition(); $storageEngineIdentifier = 'i_am_a_storage_engine'; @@ -51,7 +51,7 @@ public function testRegisterStorageEngine() ); } - public function testRegisterDefaultStorageEngine() + public function testRegisterDefaultStorageEngine(): void { $storageEngineDef = new Definition(); $storageEngineIdentifier = 'i_am_a_storage_engine'; @@ -70,7 +70,7 @@ public function testRegisterDefaultStorageEngine() ); } - public function testRegisterStorageEngineNoAlias() + public function testRegisterStorageEngineNoAlias(): void { $this->expectException(\LogicException::class); diff --git a/tests/bundle/Core/DependencyInjection/Compiler/SlugConverterConfigurationPassTest.php b/tests/bundle/Core/DependencyInjection/Compiler/SlugConverterConfigurationPassTest.php index b679a7aa2c..f1d5be4893 100644 --- a/tests/bundle/Core/DependencyInjection/Compiler/SlugConverterConfigurationPassTest.php +++ b/tests/bundle/Core/DependencyInjection/Compiler/SlugConverterConfigurationPassTest.php @@ -38,13 +38,13 @@ public function testMergeConfigurations( array $commandsToAdd, array $existingOldParameters, array $expectedCommands - ) { + ): void { $definition = new Definition(SlugConverter::class); $definition->setArgument(0, $this->createMock(TransformationProcessor::class)); $definition->setArgument(1, $existingOldParameters); $definition->setPublic(true); - $this->setDefinition(\Ibexa\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter::class, $definition); + $this->setDefinition(SlugConverter::class, $definition); $this->setParameter('ibexa.url_alias.slug_converter', [ 'transformation' => 'urlalias', @@ -62,7 +62,7 @@ public function testMergeConfigurations( $slugConverterRef = new ReflectionClass(SlugConverter::class); $configurationPropertyRef = $slugConverterRef->getProperty('configuration'); $configurationPropertyRef->setAccessible(true); - $configuration = $configurationPropertyRef->getValue($this->container->get(\Ibexa\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter::class)); + $configuration = $configurationPropertyRef->getValue($this->container->get(SlugConverter::class)); self::assertEquals('urlalias', $configuration['transformation']); self::assertEquals('underscore', $configuration['wordSeparatorName']); @@ -70,7 +70,7 @@ public function testMergeConfigurations( self::assertEquals('url_cleanup', $configuration['transformationGroups']['urlalias']['cleanupMethod']); } - public function configurationProvider() + public function configurationProvider(): array { $injectedBySemanticCommands = [ 'new_command_to_add', diff --git a/tests/bundle/Core/DependencyInjection/Compiler/URLHandlerPassTest.php b/tests/bundle/Core/DependencyInjection/Compiler/URLHandlerPassTest.php index 50a459809a..1ec5924d83 100644 --- a/tests/bundle/Core/DependencyInjection/Compiler/URLHandlerPassTest.php +++ b/tests/bundle/Core/DependencyInjection/Compiler/URLHandlerPassTest.php @@ -27,7 +27,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void $container->addCompilerPass(new URLHandlerPass()); } - public function testRegisterURLHandler() + public function testRegisterURLHandler(): void { $serviceId = 'service_id'; $scheme = 'http'; @@ -44,7 +44,7 @@ public function testRegisterURLHandler() ); } - public function testRegisterURLHandlerNoScheme() + public function testRegisterURLHandlerNoScheme(): void { $this->expectException(\LogicException::class); diff --git a/tests/bundle/Core/DependencyInjection/Compiler/ViewProvidersPassTest.php b/tests/bundle/Core/DependencyInjection/Compiler/ViewProvidersPassTest.php index 8cfa5c4418..3527b18573 100644 --- a/tests/bundle/Core/DependencyInjection/Compiler/ViewProvidersPassTest.php +++ b/tests/bundle/Core/DependencyInjection/Compiler/ViewProvidersPassTest.php @@ -36,7 +36,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void /** * @dataProvider addViewProviderProvider */ - public function testAddViewProvider($declaredPriority, $expectedPriority) + public function testAddViewProvider(?int $declaredPriority, int $expectedPriority): void { $def = new Definition(); @@ -58,7 +58,7 @@ public function testAddViewProvider($declaredPriority, $expectedPriority) ); } - public function addViewProviderProvider() + public function addViewProviderProvider(): array { return [ [null, 0], diff --git a/tests/bundle/Core/DependencyInjection/Configuration/ComplexSettings/ComplexSettingParserTest.php b/tests/bundle/Core/DependencyInjection/Configuration/ComplexSettings/ComplexSettingParserTest.php index a2c60061cf..80c1a859bc 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/ComplexSettings/ComplexSettingParserTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/ComplexSettings/ComplexSettingParserTest.php @@ -13,7 +13,7 @@ class ComplexSettingParserTest extends TestCase { /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\ComplexSettings\ComplexSettingParser */ - private $parser; + private ComplexSettingParser $parser; protected function setUp(): void { @@ -23,7 +23,7 @@ protected function setUp(): void /** * @dataProvider provideSettings */ - public function testContainsDynamicSettings($setting, $expected) + public function testContainsDynamicSettings(string $setting, array $expected): void { self::assertEquals($expected[0], $this->parser->containsDynamicSettings($setting), 'string'); } @@ -31,12 +31,12 @@ public function testContainsDynamicSettings($setting, $expected) /** * @dataProvider provideSettings */ - public function testParseComplexSetting($setting, $expected) + public function testParseComplexSetting(string $setting, array $expected): void { self::assertEquals($expected[1], $this->parser->parseComplexSetting($setting), 'string'); } - public function provideSettings() + public function provideSettings(): array { // array( setting, array( isDynamicSetting, containsDynamicSettings ) ) return [ diff --git a/tests/bundle/Core/DependencyInjection/Configuration/ComplexSettings/ComplexSettingValueResolverTest.php b/tests/bundle/Core/DependencyInjection/Configuration/ComplexSettings/ComplexSettingValueResolverTest.php index 4afa862ff5..effa5c4085 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/ComplexSettings/ComplexSettingValueResolverTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/ComplexSettings/ComplexSettingValueResolverTest.php @@ -12,7 +12,7 @@ class ComplexSettingValueResolverTest extends TestCase { - public function testGetArgumentValue() + public function testGetArgumentValue(): void { $resolver = new ComplexSettingValueResolver(); self::assertEquals( diff --git a/tests/bundle/Core/DependencyInjection/Configuration/ConfigParserTest.php b/tests/bundle/Core/DependencyInjection/Configuration/ConfigParserTest.php index ea0d2ec768..6881621258 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/ConfigParserTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/ConfigParserTest.php @@ -11,13 +11,14 @@ use Ibexa\Bundle\Core\DependencyInjection\Configuration\ParserInterface; use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface; use Ibexa\Core\Base\Exceptions\InvalidArgumentType; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use stdClass; use Symfony\Component\Config\Definition\Builder\NodeBuilder; class ConfigParserTest extends TestCase { - public function testConstructWrongInnerParser() + public function testConstructWrongInnerParser(): void { $this->expectException(InvalidArgumentType::class); @@ -29,7 +30,7 @@ public function testConstructWrongInnerParser() ); } - public function testConstruct() + public function testConstruct(): void { $innerParsers = [ $this->getConfigurationParserMock(), @@ -40,7 +41,7 @@ public function testConstruct() self::assertSame($innerParsers, $configParser->getConfigParsers()); } - public function testGetSetInnerParsers() + public function testGetSetInnerParsers(): void { $configParser = new ConfigParser(); self::assertSame([], $configParser->getConfigParsers()); @@ -54,7 +55,7 @@ public function testGetSetInnerParsers() self::assertSame($innerParsers, $configParser->getConfigParsers()); } - public function testMapConfig() + public function testMapConfig(): void { $parsers = [ $this->getConfigurationParserMock(), @@ -80,7 +81,7 @@ public function testMapConfig() $configParser->mapConfig($scopeSettings, $currentScope, $contextualizer); } - public function testPrePostMap() + public function testPrePostMap(): void { $parsers = [ $this->getConfigurationParserMock(), @@ -110,7 +111,7 @@ public function testPrePostMap() $configParser->postMap($config, $contextualizer); } - public function testAddSemanticConfig() + public function testAddSemanticConfig(): void { $parsers = [ $this->getConfigurationParserMock(), @@ -131,7 +132,7 @@ public function testAddSemanticConfig() $configParser->addSemanticConfig($nodeBuilder); } - protected function getConfigurationParserMock() + protected function getConfigurationParserMock(): MockObject { return $this->createMock(ParserInterface::class); } diff --git a/tests/bundle/Core/DependencyInjection/Configuration/ConfigResolver/ChainConfigResolverTest.php b/tests/bundle/Core/DependencyInjection/Configuration/ConfigResolver/ChainConfigResolverTest.php index a496421ddd..d69e1a1d58 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/ConfigResolver/ChainConfigResolverTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/ConfigResolver/ChainConfigResolverTest.php @@ -17,6 +17,7 @@ use Ibexa\Core\MVC\Symfony\SiteAccess; use Ibexa\Core\MVC\Symfony\SiteAccess\Provider\StaticSiteAccessProvider; use Ibexa\Core\MVC\Symfony\SiteAccessGroup; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use function sprintf; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -33,10 +34,10 @@ class ChainConfigResolverTest extends TestCase private const SCOPE_GLOBAL = 'global'; /** @var \Ibexa\Core\MVC\Symfony\SiteAccess|\PHPUnit\Framework\MockObject\MockObject */ - private $siteAccess; + private SiteAccess $siteAccess; /** @var \Symfony\Component\DependencyInjection\ContainerInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $containerMock; + private MockObject $containerMock; protected function setUp(): void { @@ -49,7 +50,7 @@ protected function setUp(): void /** * @dataProvider parameterProvider */ - public function testGetParameterDefaultScope(string $paramName, $expectedValue): void + public function testGetParameterDefaultScope(string $paramName, string|bool|array $expectedValue): void { $globalScopeParameter = $this->getParameter($paramName, self::SCOPE_GLOBAL); $relativeScopeParameter = $this->getParameter($paramName, $this->siteAccess->name); @@ -80,7 +81,7 @@ public function testGetParameterDefaultScope(string $paramName, $expectedValue): /** * @dataProvider parameterProvider */ - public function testGetParameterRelativeScope(string $paramName, $expectedValue): void + public function testGetParameterRelativeScope(string $paramName, string|bool|array $expectedValue): void { $globalScopeParameter = $this->getParameter($paramName, self::SCOPE_GLOBAL); $relativeScopeParameter = $this->getParameter($paramName, $this->siteAccess->name); @@ -107,7 +108,7 @@ public function testGetParameterRelativeScope(string $paramName, $expectedValue) /** * @dataProvider parameterProvider */ - public function testGetParameterSpecificScope(string $paramName, $expectedValue): void + public function testGetParameterSpecificScope(string $paramName, string|bool|array $expectedValue): void { $specificScopeParameter = $this->getParameter($paramName, self::FIRST_SA_NAME); $this->containerMock @@ -136,7 +137,7 @@ public function testGetParameterSpecificScope(string $paramName, $expectedValue) /** * @dataProvider parameterProvider */ - public function testGetParameterGlobalScope(string $paramName, $expectedValue): void + public function testGetParameterGlobalScope(string $paramName, string|bool|array $expectedValue): void { $globalScopeParameter = $this->getParameter($paramName, self::SCOPE_GLOBAL); $this->containerMock diff --git a/tests/bundle/Core/DependencyInjection/Configuration/ConfigResolver/ConfigResolverTest.php b/tests/bundle/Core/DependencyInjection/Configuration/ConfigResolver/ConfigResolverTest.php index 304979e394..a1d33a9cba 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/ConfigResolver/ConfigResolverTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/ConfigResolver/ConfigResolverTest.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\MVC\Exception\ParameterNotFoundException; use Ibexa\Core\MVC\Symfony\SiteAccess; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -26,7 +27,7 @@ abstract class ConfigResolverTest extends TestCase protected $siteAccess; /** @var \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\DependencyInjection\ContainerInterface */ - protected $containerMock; + protected MockObject $containerMock; protected function setUp(): void { @@ -61,7 +62,7 @@ public function testGetParameterFailedWithException(): void /** * @dataProvider parameterProvider */ - public function testGetParameterGlobalScope(string $paramName, $expectedValue): void + public function testGetParameterGlobalScope(string $paramName, string|bool|array $expectedValue): void { $globalScopeParameter = sprintf('%s.%s.%s', $this->getNamespace(), $this->getScope(), $paramName); $this->containerMock diff --git a/tests/bundle/Core/DependencyInjection/Configuration/Parser/AbstractParserTestCase.php b/tests/bundle/Core/DependencyInjection/Configuration/Parser/AbstractParserTestCase.php index 6182f5e281..b0798f3628 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/Parser/AbstractParserTestCase.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/Parser/AbstractParserTestCase.php @@ -45,7 +45,7 @@ protected function setUp(): void * @param string $scope SiteAccess name, group, default or global * @param bool $assertSame Set to false if you want to use assertEquals() instead of assertSame() */ - protected function assertConfigResolverParameterValue($parameterName, $expectedValue, $scope, $assertSame = true) + protected function assertConfigResolverParameterValue(string $parameterName, $expectedValue, ?string $scope, $assertSame = true) { $chainConfigResolver = $this->getConfigResolver(); $assertMethod = $assertSame ? 'assertSame' : 'assertEquals'; diff --git a/tests/bundle/Core/DependencyInjection/Configuration/Parser/CommonTest.php b/tests/bundle/Core/DependencyInjection/Configuration/Parser/CommonTest.php index 057b5da634..3c4c2bb3ed 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/Parser/CommonTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/Parser/CommonTest.php @@ -25,7 +25,7 @@ protected function getMinimalConfiguration(): array return $this->minimalConfig = Yaml::parse(file_get_contents(__DIR__ . '/../../Fixtures/ezpublish_minimal.yml')); } - public function testIndexPage() + public function testIndexPage(): void { $indexPage1 = '/Getting-Started'; $indexPage2 = '/Contact-Us'; @@ -42,7 +42,7 @@ public function testIndexPage() $this->assertConfigResolverParameterValue('index_page', null, self::EMPTY_SA_GROUP); } - public function testDefaultPage() + public function testDefaultPage(): void { $defaultPage1 = '/Getting-Started'; $defaultPage2 = '/Foo/bar'; @@ -62,7 +62,7 @@ public function testDefaultPage() /** * Test defaults. */ - public function testNonExistentSettings() + public function testNonExistentSettings(): void { $this->load(); $this->assertConfigResolverParameterValue('url_alias_router', true, 'ibexa_demo_site'); @@ -75,7 +75,7 @@ public function testNonExistentSettings() $this->assertConfigResolverParameterValue('index_page', null, 'ibexa_demo_site'); } - public function testMiscSettings() + public function testMiscSettings(): void { $cachePoolName = 'cache_foo'; $varDir = 'var/foo/bar'; @@ -116,7 +116,7 @@ public function testMiscSettings() $this->assertConfigResolverParameterValue('anonymous_user_id', $anonymousUserId, 'ibexa_demo_site'); } - public function testApiKeysSettings() + public function testApiKeysSettings(): void { $key = 'my_key'; $this->load( @@ -135,7 +135,7 @@ public function testApiKeysSettings() $this->assertConfigResolverParameterValue('api_keys.google_maps', $key, 'ibexa_demo_site'); } - public function testUserSettings() + public function testUserSettings(): void { $layout = 'somelayout.html.twig'; $loginTemplate = 'login_template.html.twig'; @@ -156,7 +156,7 @@ public function testUserSettings() $this->assertConfigResolverParameterValue('security.login_template', $loginTemplate, 'ibexa_demo_site'); } - public function testNoUserSettings() + public function testNoUserSettings(): void { $this->load(); $this->assertConfigResolverParameterValue( @@ -174,7 +174,7 @@ public function testNoUserSettings() /** * @dataProvider sessionSettingsProvider */ - public function testSessionSettings(array $inputParams, array $expected) + public function testSessionSettings(array $inputParams, array $expected): void { $this->load( [ @@ -187,7 +187,7 @@ public function testSessionSettings(array $inputParams, array $expected) $this->assertConfigResolverParameterValue('session', $expected['session'], 'ibexa_demo_site'); } - public function sessionSettingsProvider() + public function sessionSettingsProvider(): array { return [ [ diff --git a/tests/bundle/Core/DependencyInjection/Configuration/Parser/ContentTest.php b/tests/bundle/Core/DependencyInjection/Configuration/Parser/ContentTest.php index c38e81bf37..eb10a6317b 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/Parser/ContentTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/Parser/ContentTest.php @@ -25,7 +25,7 @@ protected function getMinimalConfiguration(): array return Yaml::parse(file_get_contents(__DIR__ . '/../../Fixtures/ezpublish_minimal.yml')); } - public function testDefaultContentSettings() + public function testDefaultContentSettings(): void { $this->load(); @@ -37,7 +37,7 @@ public function testDefaultContentSettings() /** * @dataProvider contentSettingsProvider */ - public function testContentSettings(array $config, array $expected) + public function testContentSettings(array $config, array $expected): void { $this->load( [ @@ -52,7 +52,7 @@ public function testContentSettings(array $config, array $expected) } } - public function contentSettingsProvider() + public function contentSettingsProvider(): array { return [ [ diff --git a/tests/bundle/Core/DependencyInjection/Configuration/Parser/FieldType/ImageAssetTest.php b/tests/bundle/Core/DependencyInjection/Configuration/Parser/FieldType/ImageAssetTest.php index 7925544598..518d025776 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/Parser/FieldType/ImageAssetTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/Parser/FieldType/ImageAssetTest.php @@ -24,7 +24,7 @@ protected function getContainerExtensions(): array ]; } - public function testDefaultImageAssetSettings() + public function testDefaultImageAssetSettings(): void { $this->load(); @@ -43,7 +43,7 @@ public function testDefaultImageAssetSettings() /** * @dataProvider imageAssetSettingsProvider */ - public function testImageAssetSettings(array $config, array $expected) + public function testImageAssetSettings(array $config, array $expected): void { $this->load( [ diff --git a/tests/bundle/Core/DependencyInjection/Configuration/Parser/IOTest.php b/tests/bundle/Core/DependencyInjection/Configuration/Parser/IOTest.php index 2b2ea2a995..2c2992e897 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/Parser/IOTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/Parser/IOTest.php @@ -36,7 +36,7 @@ protected function getMinimalConfiguration(): array return $this->minimalConfig = Yaml::parse(file_get_contents(__DIR__ . '/../../Fixtures/ezpublish_minimal.yml')); } - public function testHandlersConfig() + public function testHandlersConfig(): void { $config = [ 'system' => [ diff --git a/tests/bundle/Core/DependencyInjection/Configuration/Parser/ImageTest.php b/tests/bundle/Core/DependencyInjection/Configuration/Parser/ImageTest.php index 22bf92734c..ba06a2f6bb 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/Parser/ImageTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/Parser/ImageTest.php @@ -44,7 +44,7 @@ protected function getContainerExtensions(): array ]; } - public function testVariations() + public function testVariations(): void { $this->load(); @@ -72,7 +72,7 @@ public function testVariations() ); } - public function testPrePostParameters() + public function testPrePostParameters(): void { $this->expectException(\InvalidArgumentException::class); diff --git a/tests/bundle/Core/DependencyInjection/Configuration/Parser/LanguagesTest.php b/tests/bundle/Core/DependencyInjection/Configuration/Parser/LanguagesTest.php index 6a4508862e..bd3b753fa7 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/Parser/LanguagesTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/Parser/LanguagesTest.php @@ -23,7 +23,7 @@ protected function getMinimalConfiguration(): array return Yaml::parse(file_get_contents(__DIR__ . '/../../Fixtures/ezpublish_minimal.yml')); } - public function testLanguagesSingleSiteaccess() + public function testLanguagesSingleSiteaccess(): void { $langDemoSite = ['eng-GB']; $langFre = ['fre-FR', 'eng-GB']; @@ -58,7 +58,7 @@ public function testLanguagesSingleSiteaccess() $this->assertConfigResolverParameterValue('languages', [], 'ibexa_demo_site_admin'); } - public function testLanguagesSiteaccessGroup() + public function testLanguagesSiteaccessGroup(): void { $langDemoSite = ['eng-US', 'eng-GB']; $config = [ @@ -83,7 +83,7 @@ public function testLanguagesSiteaccessGroup() $this->assertConfigResolverParameterValue('languages', [], 'ibexa_demo_site_admin'); } - public function testTranslationSiteAccesses() + public function testTranslationSiteAccesses(): void { $translationSAsDemoSite = ['foo', 'bar']; $translationSAsFre = ['foo2', 'bar2']; @@ -101,7 +101,7 @@ public function testTranslationSiteAccesses() $this->assertConfigResolverParameterValue('translation_siteaccesses', [], self::EMPTY_SA_GROUP); } - public function testTranslationSiteAccessesWithGroup() + public function testTranslationSiteAccessesWithGroup(): void { $translationSAsDemoSite = ['ibexa_demo_site', 'fre']; $config = [ diff --git a/tests/bundle/Core/DependencyInjection/Configuration/Parser/TemplatesTest.php b/tests/bundle/Core/DependencyInjection/Configuration/Parser/TemplatesTest.php index 2907e3398b..93c573de4b 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/Parser/TemplatesTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/Parser/TemplatesTest.php @@ -32,7 +32,7 @@ protected function getMinimalConfiguration(): array return $this->config = Yaml::parse(file_get_contents(__DIR__ . '/../../Fixtures/ezpublish_templates.yml')); } - public function testFieldTemplates() + public function testFieldTemplates(): void { $this->load(); $fixedUpConfig = $this->getExpectedConfigFieldTemplates($this->config); @@ -95,7 +95,7 @@ protected function getSiteAccessProviderMock(): SiteAccessProviderInterface * * @return array */ - private function getExpectedConfigFieldTemplates(array $config) + private function getExpectedConfigFieldTemplates(array $config): array { foreach ($config['system']['ibexa_demo_frontend_group']['field_templates'] as &$block) { if (!isset($block['priority'])) { @@ -106,7 +106,7 @@ private function getExpectedConfigFieldTemplates(array $config) return $config; } - public function testFieldDefinitionSettingsTemplates() + public function testFieldDefinitionSettingsTemplates(): void { $this->load(); $fixedUpConfig = $this->getExpectedConfigFieldDefinitionSettingsTemplates($this->config); @@ -149,7 +149,7 @@ public function testFieldDefinitionSettingsTemplates() * * @return array */ - private function getExpectedConfigFieldDefinitionSettingsTemplates(array $config) + private function getExpectedConfigFieldDefinitionSettingsTemplates(array $config): array { foreach ($config['system']['ibexa_demo_frontend_group']['fielddefinition_settings_templates'] as &$block) { if (!isset($block['priority'])) { diff --git a/tests/bundle/Core/DependencyInjection/Configuration/Parser/ViewTest.php b/tests/bundle/Core/DependencyInjection/Configuration/Parser/ViewTest.php index be7546142f..ee795a6f86 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/Parser/ViewTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/Parser/ViewTest.php @@ -28,7 +28,7 @@ protected function getMinimalConfiguration(): array return $this->config = Yaml::parse(file_get_contents(__DIR__ . '/../../Fixtures/ezpublish_view.yml')); } - public function testLocationView() + public function testLocationView(): void { $this->load(); $expectedLocationView = $this->config['system']['ibexa_demo_frontend_group']['location_view']; @@ -50,7 +50,7 @@ public function testLocationView() $this->assertConfigResolverParameterValue('location_view', [], 'ibexa_demo_site_admin', false); } - public function testContentView() + public function testContentView(): void { $this->load(); $expectedContentView = $this->config['system']['ibexa_demo_frontend_group']['content_view']; diff --git a/tests/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/ConfigurationProcessorTest.php b/tests/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/ConfigurationProcessorTest.php index 16470bc09b..3f9433cdbc 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/ConfigurationProcessorTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/ConfigurationProcessorTest.php @@ -11,13 +11,14 @@ use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor; use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface; use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\HookableConfigurationMapperInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use stdClass; use Symfony\Component\DependencyInjection\ContainerInterface; class ConfigurationProcessorTest extends TestCase { - public function testConstruct() + public function testConstruct(): void { $namespace = 'ibexa_test'; $siteAccessNodeName = 'foo'; @@ -43,7 +44,7 @@ public function testConstruct() self::assertSame($groupsBySa, $contextualizer->getGroupsBySiteAccess()); } - public function testGetSetContextualizer() + public function testGetSetContextualizer(): void { $namespace = 'ibexa_test'; $siteAccessNodeName = 'foo'; @@ -60,7 +61,7 @@ public function testGetSetContextualizer() self::assertSame($newContextualizer, $processor->getContextualizer()); } - public function testMapConfigWrongMapper() + public function testMapConfigWrongMapper(): void { $this->expectException(\InvalidArgumentException::class); @@ -72,7 +73,7 @@ public function testMapConfigWrongMapper() $processor->mapConfig([], new stdClass()); } - public function testMapConfigClosure() + public function testMapConfigClosure(): void { $namespace = 'ibexa_test'; $saNodeName = 'foo'; @@ -103,7 +104,7 @@ public function testMapConfigClosure() ], ]; - $mapperClosure = static function (array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) use ($config, $availableSAs, $saNodeName, $expectedContextualizer) { + $mapperClosure = static function (array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) use ($config, $availableSAs, $saNodeName, $expectedContextualizer): void { self::assertTrue(isset($availableSAs[$currentScope])); self::assertSame($config[$saNodeName][$currentScope], $scopeSettings); self::assertSame($expectedContextualizer, $contextualizer); @@ -111,7 +112,7 @@ public function testMapConfigClosure() $processor->mapConfig($config, $mapperClosure); } - public function testMapConfigMapperObject() + public function testMapConfigMapperObject(): void { $namespace = 'ibexa_test'; $saNodeName = 'foo'; @@ -157,7 +158,7 @@ public function testMapConfigMapperObject() $processor->mapConfig($config, $mapper); } - public function testMapConfigHookableMapperObject() + public function testMapConfigHookableMapperObject(): void { $namespace = 'ibexa_test'; $saNodeName = 'foo'; @@ -211,7 +212,7 @@ public function testMapConfigHookableMapperObject() $processor->mapConfig($config, $mapper); } - public function testMapSetting() + public function testMapSetting(): void { $namespace = 'ibexa_test'; $saNodeName = 'foo'; @@ -247,7 +248,7 @@ public function testMapSetting() $processor->mapSetting('foo', $config); } - public function testMapConfigArray() + public function testMapConfigArray(): void { $namespace = 'ibexa_test'; $saNodeName = 'foo'; @@ -283,12 +284,12 @@ public function testMapConfigArray() $processor->mapConfigArray('hello', $config, ContextualizerInterface::MERGE_FROM_SECOND_LEVEL); } - protected function getContainerMock() + protected function getContainerMock(): MockObject { return $this->createMock(ContainerInterface::class); } - protected function getContextualizerMock() + protected function getContextualizerMock(): MockObject { return $this->createMock(ContextualizerInterface::class); } diff --git a/tests/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/ContextualizerTest.php b/tests/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/ContextualizerTest.php index fbf3613d1a..1406abe349 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/ContextualizerTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/ContextualizerTest.php @@ -10,6 +10,7 @@ use Ibexa\Bundle\Core\DependencyInjection\Configuration\ConfigResolver; use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\Contextualizer; use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -17,32 +18,27 @@ class ContextualizerTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $container; + private MockObject $container; - /** @var string */ - private $namespace = 'ibexa_test'; + private string $namespace = 'ibexa_test'; - /** @var string */ - private $saNodeName = 'heyho'; + private string $saNodeName = 'heyho'; - /** @var array */ - private $availableSAs = ['sa1', 'sa2', 'sa3']; + private array $availableSAs = ['sa1', 'sa2', 'sa3']; - /** @var array */ - private $availableSiteAccessGroups = [ + private array $availableSiteAccessGroups = [ 'sa_group1' => ['sa1', 'sa2', 'sa3'], 'sa_group2' => ['sa1'], ]; - /** @var array */ - private $groupsBySA = [ + private array $groupsBySA = [ 'sa1' => ['sa_group1', 'sa_group2'], 'sa2' => ['sa_group1'], 'sa3' => ['sa_group1'], ]; /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\Contextualizer */ - private $contextualizer; + private Contextualizer $contextualizer; protected function setUp(): void { @@ -61,7 +57,7 @@ protected function setUp(): void /** * @dataProvider setContextualParameterProvider */ - public function testSetContextualParameter($parameterName, $scope, $value) + public function testSetContextualParameter(string $parameterName, string $scope, string|int|bool|array $value): void { $this->container ->expects(self::once()) @@ -71,7 +67,7 @@ public function testSetContextualParameter($parameterName, $scope, $value) $this->contextualizer->setContextualParameter($parameterName, $scope, $value); } - public function setContextualParameterProvider() + public function setContextualParameterProvider(): array { return [ ['my_parameter', 'sa1', 'foobar'], @@ -83,7 +79,7 @@ public function setContextualParameterProvider() ]; } - public function testMapSetting() + public function testMapSetting(): void { $fooSa1 = 'bar'; $planetsSa1 = ['Earth']; @@ -131,7 +127,7 @@ public function testMapSetting() self::assertSame($boolSa2, $container->getParameter("$this->namespace.sa2.a_bool")); } - public function testMapConfigArray() + public function testMapConfigArray(): void { $containerBuilder = new ContainerBuilder(); $this->contextualizer->setContainer($containerBuilder); @@ -233,7 +229,7 @@ public function testMapConfigArray() ); } - public function testMapConfigArraySecondLevel() + public function testMapConfigArraySecondLevel(): void { $containerBuilder = new ContainerBuilder(); $this->contextualizer->setContainer($containerBuilder); @@ -343,7 +339,7 @@ public function testMapConfigArraySecondLevel() ); } - public function testMapConfigArrayUnique() + public function testMapConfigArrayUnique(): void { $containerBuilder = new ContainerBuilder(); $this->contextualizer->setContainer($containerBuilder); @@ -396,7 +392,7 @@ public function testMapConfigArrayUnique() ); } - public function testGetSetContainer() + public function testGetSetContainer(): void { self::assertSame($this->container, $this->contextualizer->getContainer()); $containerBuilder = new ContainerBuilder(); @@ -404,7 +400,7 @@ public function testGetSetContainer() self::assertSame($containerBuilder, $this->contextualizer->getContainer()); } - public function testGetSetSANodeName() + public function testGetSetSANodeName(): void { $nodeName = 'foobarbaz'; self::assertSame($this->saNodeName, $this->contextualizer->getSiteAccessNodeName()); @@ -412,7 +408,7 @@ public function testGetSetSANodeName() self::assertSame($nodeName, $this->contextualizer->getSiteAccessNodeName()); } - public function testGetSetNamespace() + public function testGetSetNamespace(): void { $ns = 'ibexa'; self::assertSame($this->namespace, $this->contextualizer->getNamespace()); @@ -420,7 +416,7 @@ public function testGetSetNamespace() self::assertSame($ns, $this->contextualizer->getNamespace()); } - public function testGetSetAvailableSiteAccesses() + public function testGetSetAvailableSiteAccesses(): void { self::assertSame($this->availableSAs, $this->contextualizer->getAvailableSiteAccesses()); $sa = ['foo', 'bar', 'baz']; @@ -428,7 +424,7 @@ public function testGetSetAvailableSiteAccesses() self::assertSame($sa, $this->contextualizer->getAvailableSiteAccesses()); } - public function testGetSetGroupsBySA() + public function testGetSetGroupsBySA(): void { self::assertSame($this->groupsBySA, $this->contextualizer->getGroupsBySiteAccess()); $groups = ['foo' => ['bar', 'baz'], 'group2' => ['some', 'thing']]; @@ -443,7 +439,7 @@ public function testGetSetGroupsBySA() * @dataProvider fullMapConfigArrayProvider */ public function testFullMapConfigArray( - $testId, + string $testId, $siteaccess, array $groups, array $defaultValue, @@ -452,7 +448,7 @@ public function testFullMapConfigArray( $options, array $expected, $customSANodeKey = null - ) { + ): void { $this->contextualizer->setAvailableSiteAccesses($config['siteaccess']['list']); $this->contextualizer->setGroupsBySiteAccess([$siteaccess => $groups]); @@ -502,7 +498,10 @@ public function testFullMapConfigArray( $this->contextualizer->mapConfigArray($testId, $config, $options); } - public function fullMapConfigArrayProvider() + /** + * @return \non-empty-list, (0|1|2|'customBaseKey'|'krondor'|'location_view'|'wizards'|array<(array<(literal-string&non-falsy-string), non-empty-array<(int<0, max>|(literal-string&lowercase-string&non-falsy-string)), ('dwarve.html.twig'|'krondor'|'moredhel.html.twig'|'moredhel2.html.twig'|'sorcerer.html.twig'|'sorcerer2.html.twig'|'sorcerer3.html.twig'|'warrior.html.twig'|'wizard.html.twig'|non-empty-array<(int<0, max>|(literal-string&lowercase-string&non-falsy-string)), ('krondor'|'Kulgan'|'Macros the Black'|'Pug'|'Rogen'|'William'|non-empty-array<(literal-string&non-falsy-string), non-empty-array<(literal-string&lowercase-string&non-falsy-string), ('dwarve.html.twig'|'moredhel.html.twig'|'moredhel2.html.twig'|'sorcerer.html.twig'|'sorcerer2.html.twig'|'sorcerer3.html.twig'|'warrior.html.twig'|'wizard.html.twig')>>)>)>>|non-empty-string)>)>> + */ + public function fullMapConfigArrayProvider(): array { $testId = 'wizards'; $siteaccess = 'krondor'; diff --git a/tests/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/DynamicSettingParserTest.php b/tests/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/DynamicSettingParserTest.php index ebd5991120..7088723857 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/DynamicSettingParserTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/SiteAccessAware/DynamicSettingParserTest.php @@ -15,13 +15,13 @@ class DynamicSettingParserTest extends TestCase /** * @dataProvider isDynamicSettingProvider */ - public function testIsDynamicSetting($setting, $expected) + public function testIsDynamicSetting(string $setting, bool $expected): void { $parser = new DynamicSettingParser(); self::assertSame($expected, $parser->isDynamicSetting($setting)); } - public function isDynamicSettingProvider() + public function isDynamicSettingProvider(): array { return [ ['foo', false], @@ -40,7 +40,7 @@ public function isDynamicSettingProvider() ]; } - public function testParseDynamicSettingFail() + public function testParseDynamicSettingFail(): void { $this->expectException(\OutOfBoundsException::class); @@ -51,13 +51,13 @@ public function testParseDynamicSettingFail() /** * @dataProvider parseDynamicSettingProvider */ - public function testParseDynamicSetting($setting, array $expected) + public function testParseDynamicSetting(string $setting, array $expected): void { $parser = new DynamicSettingParser(); self::assertSame($expected, $parser->parseDynamicSetting($setting)); } - public function parseDynamicSettingProvider() + public function parseDynamicSettingProvider(): array { return [ [ diff --git a/tests/bundle/Core/DependencyInjection/Configuration/Suggestion/Collector/SuggestionCollectorTest.php b/tests/bundle/Core/DependencyInjection/Configuration/Suggestion/Collector/SuggestionCollectorTest.php index abfdf4e7a8..97cbc9233c 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/Suggestion/Collector/SuggestionCollectorTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/Suggestion/Collector/SuggestionCollectorTest.php @@ -13,7 +13,7 @@ class SuggestionCollectorTest extends TestCase { - public function testAddHasGetSuggestions() + public function testAddHasGetSuggestions(): void { $collector = new SuggestionCollector(); $suggestions = [new ConfigSuggestion(), new ConfigSuggestion(), new ConfigSuggestion()]; diff --git a/tests/bundle/Core/DependencyInjection/Configuration/Suggestion/ConfigSuggestionTest.php b/tests/bundle/Core/DependencyInjection/Configuration/Suggestion/ConfigSuggestionTest.php index b16db5268a..591f4c60f6 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/Suggestion/ConfigSuggestionTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/Suggestion/ConfigSuggestionTest.php @@ -12,7 +12,7 @@ class ConfigSuggestionTest extends TestCase { - public function testEmptyConstructor() + public function testEmptyConstructor(): void { $suggestion = new ConfigSuggestion(); self::assertNull($suggestion->getMessage()); @@ -20,7 +20,7 @@ public function testEmptyConstructor() self::assertFalse($suggestion->isMandatory()); } - public function testConfigSuggestion() + public function testConfigSuggestion(): void { $message = 'some message'; $configArray = ['foo' => 'bar']; diff --git a/tests/bundle/Core/DependencyInjection/Configuration/Suggestion/Formatter/YamlSuggestionFormatterTest.php b/tests/bundle/Core/DependencyInjection/Configuration/Suggestion/Formatter/YamlSuggestionFormatterTest.php index c818e73bda..cf4b1ce7a7 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/Suggestion/Formatter/YamlSuggestionFormatterTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/Suggestion/Formatter/YamlSuggestionFormatterTest.php @@ -13,7 +13,7 @@ class YamlSuggestionFormatterTest extends TestCase { - public function testFormat() + public function testFormat(): void { $message = <<format($suggestion))); } - public function testFormatNoSuggestion() + public function testFormatNoSuggestion(): void { $message = 'This is a message'; $suggestion = new ConfigSuggestion($message); diff --git a/tests/bundle/Core/DependencyInjection/IbexaCoreExtensionTest.php b/tests/bundle/Core/DependencyInjection/IbexaCoreExtensionTest.php index 912da421af..454624d0c0 100644 --- a/tests/bundle/Core/DependencyInjection/IbexaCoreExtensionTest.php +++ b/tests/bundle/Core/DependencyInjection/IbexaCoreExtensionTest.php @@ -35,10 +35,9 @@ class IbexaCoreExtensionTest extends AbstractExtensionTestCase { private $minimalConfig = []; - private $siteaccessConfig = []; + private array $siteaccessConfig = []; - /** @var \Ibexa\Bundle\Core\DependencyInjection\IbexaCoreExtension */ - private $extension; + private ?IbexaCoreExtension $extension = null; protected function setUp(): void { @@ -87,7 +86,7 @@ protected function getMinimalConfiguration(): array return $this->minimalConfig = Yaml::parse(file_get_contents(__DIR__ . '/Fixtures/ezpublish_minimal_no_siteaccess.yml')); } - public function testSiteAccessConfiguration() + public function testSiteAccessConfiguration(): void { $this->load($this->siteaccessConfig); $this->assertContainerBuilderHasParameter( @@ -120,7 +119,7 @@ public function testSiteAccessConfiguration() } } - public function testSiteAccessNoConfiguration() + public function testSiteAccessNoConfiguration(): void { $this->load(); $this->assertContainerBuilderHasParameter('ibexa.site_access.list', ['setup']); @@ -130,7 +129,7 @@ public function testSiteAccessNoConfiguration() $this->assertContainerBuilderHasParameter('ibexa.site_access.match_config', null); } - public function testImageMagickConfigurationBasic() + public function testImageMagickConfigurationBasic(): void { if (!isset($_ENV['imagemagickConvertPath']) || !is_executable($_ENV['imagemagickConvertPath'])) { self::markTestSkipped('Missing or mis-configured Imagemagick convert path.'); @@ -187,7 +186,7 @@ public function translationsConfigurationProvider(): iterable ]; } - public function testImageMagickConfigurationFilters() + public function testImageMagickConfigurationFilters(): void { if (!isset($_ENV['imagemagickConvertPath']) || !is_executable($_ENV['imagemagickConvertPath'])) { self::markTestSkipped('Missing or mis-configured Imagemagick convert path.'); @@ -214,7 +213,7 @@ public function testImageMagickConfigurationFilters() self::assertSame($customFilters['wow'], $filters['wow']); } - public function testImagePlaceholderConfiguration() + public function testImagePlaceholderConfiguration(): void { $this->load([ 'image_placeholder' => [ @@ -249,7 +248,7 @@ public function testImagePlaceholderConfiguration() ], $this->container->getParameter('ibexa.io.images.alias.placeholder_provider')); } - public function testRoutingConfiguration() + public function testRoutingConfiguration(): void { $this->load(); $this->assertContainerBuilderHasAlias('router', ChainRouter::class); @@ -267,14 +266,14 @@ public function testRoutingConfiguration() * @param array $customCacheConfig * @param string $expectedPurgeType */ - public function testCacheConfiguration(array $customCacheConfig, $expectedPurgeType) + public function testCacheConfiguration(array $customCacheConfig, string $expectedPurgeType): void { $this->load($customCacheConfig); $this->assertContainerBuilderHasParameter('ibexa.http_cache.purge_type', $expectedPurgeType); } - public function cacheConfigurationProvider() + public function cacheConfigurationProvider(): array { return [ [[], 'local'], @@ -311,7 +310,7 @@ public function cacheConfigurationProvider() ]; } - public function testCacheConfigurationCustomPurgeService() + public function testCacheConfigurationCustomPurgeService(): void { $serviceId = 'foobar'; $this->setDefinition($serviceId, new Definition()); @@ -324,7 +323,7 @@ public function testCacheConfigurationCustomPurgeService() $this->assertContainerBuilderHasParameter('ibexa.http_cache.purge_type', 'foobar'); } - public function testLocaleConfiguration() + public function testLocaleConfiguration(): void { $this->load(['locale_conversion' => ['foo' => 'bar']]); $conversionMap = $this->container->getParameter('ibexa.locale.conversion_map'); @@ -332,7 +331,7 @@ public function testLocaleConfiguration() self::assertSame('bar', $conversionMap['foo']); } - public function testRepositoriesConfiguration() + public function testRepositoriesConfiguration(): void { $repositories = [ 'main' => [ @@ -385,7 +384,7 @@ public function testRepositoriesConfiguration() /** * @dataProvider repositoriesConfigurationFieldGroupsProvider */ - public function testRepositoriesConfigurationFieldGroups($repositories, $expectedRepositories) + public function testRepositoriesConfigurationFieldGroups(array $repositories, array $expectedRepositories): void { $this->load(['repositories' => $repositories]); self::assertTrue($this->container->hasParameter('ibexa.repositories')); @@ -400,7 +399,7 @@ public function testRepositoriesConfigurationFieldGroups($repositories, $expecte } } - public function repositoriesConfigurationFieldGroupsProvider() + public function repositoriesConfigurationFieldGroupsProvider(): array { return [ //empty config @@ -520,7 +519,7 @@ public function repositoriesConfigurationFieldGroupsProvider() ]; } - public function testRepositoriesConfigurationEmpty() + public function testRepositoriesConfigurationEmpty(): void { $repositories = [ 'main' => null, @@ -556,7 +555,7 @@ public function testRepositoriesConfigurationEmpty() ); } - public function testRepositoriesConfigurationStorageEmpty() + public function testRepositoriesConfigurationStorageEmpty(): void { $repositories = [ 'main' => [ @@ -597,7 +596,7 @@ public function testRepositoriesConfigurationStorageEmpty() ); } - public function testRepositoriesConfigurationSearchEmpty() + public function testRepositoriesConfigurationSearchEmpty(): void { $repositories = [ 'main' => [ @@ -638,7 +637,7 @@ public function testRepositoriesConfigurationSearchEmpty() ); } - public function testRepositoriesConfigurationCompatibility() + public function testRepositoriesConfigurationCompatibility(): void { $repositories = [ 'main' => [ @@ -709,7 +708,7 @@ public function testRepositoriesConfigurationCompatibility() ); } - public function testRepositoriesConfigurationCompatibility2() + public function testRepositoriesConfigurationCompatibility2(): void { $repositories = [ 'main' => [ @@ -748,7 +747,7 @@ public function testRepositoriesConfigurationCompatibility2() ); } - public function testRegisteredPolicies() + public function testRegisteredPolicies(): void { $this->load(); $this->assertContainerBuilderHasParameter('ibexa.api.role.policy_map'); @@ -800,7 +799,7 @@ public function testRegisteredPolicies() self::assertEquals($expectedPolicies, $this->container->getParameter('ibexa.api.role.policy_map')); } - public function testUrlAliasConfiguration() + public function testUrlAliasConfiguration(): void { $configuration = [ 'transformation' => 'urlalias_lowercase', diff --git a/tests/bundle/Core/DependencyInjection/Security/PolicyProvider/PoliciesConfigBuilderTest.php b/tests/bundle/Core/DependencyInjection/Security/PolicyProvider/PoliciesConfigBuilderTest.php index 4914843b4c..d5f15fb258 100644 --- a/tests/bundle/Core/DependencyInjection/Security/PolicyProvider/PoliciesConfigBuilderTest.php +++ b/tests/bundle/Core/DependencyInjection/Security/PolicyProvider/PoliciesConfigBuilderTest.php @@ -57,7 +57,7 @@ public function policiesConfigProvider(): array ]; } - public function testAddResource() + public function testAddResource(): void { $containerBuilder = new ContainerBuilder(); $configBuilder = new PoliciesConfigBuilder($containerBuilder); diff --git a/tests/bundle/Core/DependencyInjection/Security/PolicyProvider/YamlPolicyProviderTest.php b/tests/bundle/Core/DependencyInjection/Security/PolicyProvider/YamlPolicyProviderTest.php index 74285ddb49..cfc0a9fefd 100644 --- a/tests/bundle/Core/DependencyInjection/Security/PolicyProvider/YamlPolicyProviderTest.php +++ b/tests/bundle/Core/DependencyInjection/Security/PolicyProvider/YamlPolicyProviderTest.php @@ -14,7 +14,7 @@ class YamlPolicyProviderTest extends TestCase { - public function testSingleYaml() + public function testSingleYaml(): void { $files = [__DIR__ . '/../../Fixtures/policies1.yml']; $provider = new StubYamlPolicyProvider($files); @@ -44,7 +44,7 @@ public function testSingleYaml() $provider->addPolicies($configBuilder); } - public function testMultipleYaml() + public function testMultipleYaml(): void { $file1 = __DIR__ . '/../../Fixtures/policies1.yml'; $file2 = __DIR__ . '/../../Fixtures/policies2.yml'; diff --git a/tests/bundle/Core/DependencyInjection/Stub/StubPolicyProvider.php b/tests/bundle/Core/DependencyInjection/Stub/StubPolicyProvider.php index 7e0d2c1433..ad060a74fe 100644 --- a/tests/bundle/Core/DependencyInjection/Stub/StubPolicyProvider.php +++ b/tests/bundle/Core/DependencyInjection/Stub/StubPolicyProvider.php @@ -16,15 +16,14 @@ */ class StubPolicyProvider implements PolicyProviderInterface { - /** @var array */ - private $policies; + private array $policies; public function __construct(array $policies) { $this->policies = $policies; } - public function addPolicies(ConfigBuilderInterface $configBuilder) + public function addPolicies(ConfigBuilderInterface $configBuilder): void { $configBuilder->addConfig($this->policies); } diff --git a/tests/bundle/Core/DependencyInjection/Stub/StubYamlPolicyProvider.php b/tests/bundle/Core/DependencyInjection/Stub/StubYamlPolicyProvider.php index c3c77190ef..572507316a 100644 --- a/tests/bundle/Core/DependencyInjection/Stub/StubYamlPolicyProvider.php +++ b/tests/bundle/Core/DependencyInjection/Stub/StubYamlPolicyProvider.php @@ -11,8 +11,7 @@ class StubYamlPolicyProvider extends YamlPolicyProvider { - /** @var array */ - private $files; + private array $files; public function __construct(array $files) { diff --git a/tests/bundle/Core/EventListener/BackgroundIndexingTerminateListenerTest.php b/tests/bundle/Core/EventListener/BackgroundIndexingTerminateListenerTest.php index 9de34fb626..499746ca0b 100644 --- a/tests/bundle/Core/EventListener/BackgroundIndexingTerminateListenerTest.php +++ b/tests/bundle/Core/EventListener/BackgroundIndexingTerminateListenerTest.php @@ -14,6 +14,9 @@ use Ibexa\Contracts\Core\Persistence\Handler as PersistenceHandler; use Ibexa\Contracts\Core\Search\Handler as SearchHandler; use Ibexa\Core\Base\Exceptions\NotFoundException; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\MockObject\Stub\Exception; +use PHPUnit\Framework\MockObject\Stub\ReturnStub; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Component\Console\ConsoleEvents; @@ -25,10 +28,10 @@ class BackgroundIndexingTerminateListenerTest extends TestCase protected $listener; /** @var \Ibexa\Contracts\Core\Persistence\Handler|\PHPUnit\Framework\MockObject\MockObject */ - protected $persistenceMock; + protected MockObject $persistenceMock; /** @var \Ibexa\Contracts\Core\Search\Handler|\PHPUnit\Framework\MockObject\MockObject */ - protected $searchMock; + protected MockObject $searchMock; protected function setUp(): void { @@ -47,7 +50,7 @@ protected function tearDown(): void parent::tearDown(); } - public function testGetSubscribedEvents() + public function testGetSubscribedEvents(): void { self::assertSame( [ @@ -59,7 +62,7 @@ public function testGetSubscribedEvents() ); } - public function indexingProvider() + public function indexingProvider(): array { $info = new ContentInfo(['id' => 33]); $location = new Location(['id' => 44, 'contentId' => 33]); @@ -82,7 +85,7 @@ public function indexingProvider() * @param array|null $value * @param \Psr\Log\LoggerInterface|\PHPUnit\Framework\MockObject\MockObject|null $logger */ - public function testIndexing(array $values = null, $logger = null) + public function testIndexing(array $values = null, MockObject&LoggerInterface $logger = null): void { $contentHandlerMock = $this->createMock(Content\Handler::class); $this->persistenceMock @@ -140,7 +143,7 @@ public function testIndexing(array $values = null, $logger = null) $this->listener->reindex(); } - public function indexDeleteProvider() + public function indexDeleteProvider(): array { $location = new Location(['id' => 44, 'contentId' => 33]); $info = new ContentInfo(['id' => 33, 'currentVersionNo' => 2, 'status' => ContentInfo::STATUS_PUBLISHED]); @@ -167,7 +170,7 @@ public function indexDeleteProvider() * @param \PHPUnit\Framework\MockObject\Stub $infoReturn * @param \PHPUnit\Framework\MockObject\Stub|null $contentReturn */ - public function testIndexDelete($value, $infoReturn, $contentReturn = null) + public function testIndexDelete(Location|ContentInfo $value, ReturnStub|Exception $infoReturn, Exception $contentReturn = null): void { $contentHandlerMock = $this->createMock(Content\Handler::class); $this->persistenceMock diff --git a/tests/bundle/Core/EventListener/BackwardCompatibleCommandListenerTest.php b/tests/bundle/Core/EventListener/BackwardCompatibleCommandListenerTest.php index c42ce15f20..d713f86dbd 100644 --- a/tests/bundle/Core/EventListener/BackwardCompatibleCommandListenerTest.php +++ b/tests/bundle/Core/EventListener/BackwardCompatibleCommandListenerTest.php @@ -33,7 +33,7 @@ final class BackwardCompatibleCommandListenerTest extends TestCase ]; /** @var \Ibexa\Bundle\Core\EventListener\BackwardCompatibleCommandListener */ - private $listener; + private BackwardCompatibleCommandListener $listener; protected function setUp(): void { @@ -115,7 +115,7 @@ private function createBackwardCompatibleCommand(string $name, array $aliases = { return new class($name, $aliases) extends Command implements BackwardCompatibleCommand { /** @var string[] */ - private $deprecatedAliases; + private array $deprecatedAliases; public function __construct(string $name, array $deprecatedAliases) { diff --git a/tests/bundle/Core/EventListener/ConfigScopeListenerTest.php b/tests/bundle/Core/EventListener/ConfigScopeListenerTest.php index 868d52185a..95314d80fb 100644 --- a/tests/bundle/Core/EventListener/ConfigScopeListenerTest.php +++ b/tests/bundle/Core/EventListener/ConfigScopeListenerTest.php @@ -14,18 +14,19 @@ use Ibexa\Core\MVC\Symfony\SiteAccess; use Ibexa\Tests\Bundle\Core\EventListener\Stubs\ViewManager; use Ibexa\Tests\Bundle\Core\EventListener\Stubs\ViewProvider; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ConfigScopeListenerTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $configResolver; + private MockObject $configResolver; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $viewManager; + private MockObject $viewManager; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $viewProviders; + private array $viewProviders; protected function setUp(): void { @@ -38,7 +39,7 @@ protected function setUp(): void ]; } - public function testGetSubscribedEvents() + public function testGetSubscribedEvents(): void { self::assertSame( [ @@ -49,7 +50,7 @@ public function testGetSubscribedEvents() ); } - public function testOnConfigScopeChange() + public function testOnConfigScopeChange(): void { $siteAccess = new SiteAccess('test'); $event = new ScopeChangeEvent($siteAccess); diff --git a/tests/bundle/Core/EventListener/ConsoleCommandListenerTest.php b/tests/bundle/Core/EventListener/ConsoleCommandListenerTest.php index 511a6547db..c085e3aeb9 100644 --- a/tests/bundle/Core/EventListener/ConsoleCommandListenerTest.php +++ b/tests/bundle/Core/EventListener/ConsoleCommandListenerTest.php @@ -11,6 +11,7 @@ use Ibexa\Core\MVC\Exception\InvalidSiteAccessException; use Ibexa\Core\MVC\Symfony\SiteAccess; use Ibexa\Tests\Bundle\Core\EventListener\Stubs\TestOutput; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\ConsoleEvents; @@ -26,22 +27,22 @@ class ConsoleCommandListenerTest extends TestCase private const INVALID_SA_NAME = 'foo'; /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ - private $siteAccess; + private SiteAccess $siteAccess; /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $dispatcher; + private MockObject $dispatcher; /** @var \Ibexa\Bundle\Core\EventListener\ConsoleCommandListener */ - private $listener; + private ConsoleCommandListener $listener; /** @var \Symfony\Component\Console\Input\InputDefinition */ - private $inputDefinition; + private InputDefinition $inputDefinition; /** @var \Symfony\Component\Console\Output\Output */ - private $testOutput; + private TestOutput $testOutput; /** @var \Symfony\Component\Console\Command\Command|\PHPUnit\Framework\MockObject\MockObject */ - private $command; + private MockObject $command; protected function setUp(): void { @@ -56,7 +57,7 @@ protected function setUp(): void $this->command = $this->createMock(Command::class); } - public function testGetSubscribedEvents() + public function testGetSubscribedEvents(): void { self::assertSame( [ @@ -66,7 +67,7 @@ public function testGetSubscribedEvents() ); } - public function testInvalidSiteAccessDev() + public function testInvalidSiteAccessDev(): void { $this->expectException(InvalidSiteAccessException::class); $this->expectExceptionMessageMatches('/^Invalid SiteAccess \'foo\', matched by .+\\. Valid SiteAccesses are/'); @@ -79,7 +80,7 @@ public function testInvalidSiteAccessDev() $this->listener->onConsoleCommand($event); } - public function testInvalidSiteAccessProd() + public function testInvalidSiteAccessProd(): void { $this->expectException(InvalidSiteAccessException::class); $this->expectExceptionMessageMatches('/^Invalid SiteAccess \'foo\', matched by .+\\.$/'); @@ -92,7 +93,7 @@ public function testInvalidSiteAccessProd() $this->listener->onConsoleCommand($event); } - public function testValidSiteAccess() + public function testValidSiteAccess(): void { $this->dispatcher->expects(self::once()) ->method('dispatch'); @@ -102,7 +103,7 @@ public function testValidSiteAccess() self::assertEquals(new SiteAccess('site1', 'cli'), $this->siteAccess); } - public function testDefaultSiteAccess() + public function testDefaultSiteAccess(): void { $this->dispatcher->expects(self::once()) ->method('dispatch'); diff --git a/tests/bundle/Core/EventListener/ContentDownloadRouteReferenceListenerTest.php b/tests/bundle/Core/EventListener/ContentDownloadRouteReferenceListenerTest.php index d33fa227d8..26ca98dffd 100644 --- a/tests/bundle/Core/EventListener/ContentDownloadRouteReferenceListenerTest.php +++ b/tests/bundle/Core/EventListener/ContentDownloadRouteReferenceListenerTest.php @@ -16,6 +16,7 @@ use Ibexa\Core\MVC\Symfony\Routing\RouteReference; use Ibexa\Core\Repository\Values\Content\Content; use Ibexa\Core\Repository\Values\Content\VersionInfo; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use stdClass; use Symfony\Component\HttpFoundation\Request; @@ -23,14 +24,14 @@ class ContentDownloadRouteReferenceListenerTest extends TestCase { /** @var \Ibexa\Core\Helper\TranslationHelper|\PHPUnit\Framework\MockObject\MockObject */ - protected $translationHelperMock; + protected MockObject $translationHelperMock; protected function setUp(): void { $this->translationHelperMock = $this->createMock(TranslationHelper::class); } - public function testIgnoresOtherRoutes() + public function testIgnoresOtherRoutes(): void { $routeReference = new RouteReference('some_route'); $event = new RouteReferenceGenerationEvent($routeReference, new Request()); @@ -41,7 +42,7 @@ public function testIgnoresOtherRoutes() self::assertEquals('some_route', $routeReference->getRoute()); } - public function testThrowsExceptionOnBadContentParameter() + public function testThrowsExceptionOnBadContentParameter(): void { $this->expectException(\InvalidArgumentException::class); @@ -58,7 +59,7 @@ public function testThrowsExceptionOnBadContentParameter() $eventListener->onRouteReferenceGeneration($event); } - public function testThrowsExceptionOnBadFieldIdentifier() + public function testThrowsExceptionOnBadFieldIdentifier(): void { $this->expectException(\InvalidArgumentException::class); @@ -86,7 +87,7 @@ public function testThrowsExceptionOnBadFieldIdentifier() $eventListener->onRouteReferenceGeneration($event); } - public function testGeneratesCorrectRouteReference() + public function testGeneratesCorrectRouteReference(): void { $content = $this->getCompleteContent(); @@ -112,7 +113,7 @@ public function testGeneratesCorrectRouteReference() self::assertEquals('Test-file.pdf', $routeReference->get(ContentDownloadRouteReferenceListener::OPT_DOWNLOAD_NAME)); } - public function testDownloadNameOverrideWorks() + public function testDownloadNameOverrideWorks(): void { $content = $this->getCompleteContent(); @@ -135,7 +136,7 @@ public function testDownloadNameOverrideWorks() /** * @return \Ibexa\Core\Repository\Values\Content\Content */ - protected function getCompleteContent() + protected function getCompleteContent(): Content { return new Content( [ @@ -157,7 +158,7 @@ protected function getCompleteContent() ); } - protected function getListener() + protected function getListener(): ContentDownloadRouteReferenceListener { return new ContentDownloadRouteReferenceListener($this->translationHelperMock); } diff --git a/tests/bundle/Core/EventListener/ExceptionListenerTest.php b/tests/bundle/Core/EventListener/ExceptionListenerTest.php index d84680b4e6..a232502b43 100644 --- a/tests/bundle/Core/EventListener/ExceptionListenerTest.php +++ b/tests/bundle/Core/EventListener/ExceptionListenerTest.php @@ -24,6 +24,7 @@ use Ibexa\Core\Base\Exceptions\NotFound\LimitationNotFoundException; use Ibexa\Core\Base\Exceptions\NotFoundException; use Ibexa\Core\Base\Exceptions\UnauthorizedException; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -39,10 +40,10 @@ class ExceptionListenerTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject|\Symfony\Contracts\Translation\TranslatorInterface */ - private $translator; + private MockObject $translator; /** @var \Ibexa\Bundle\Core\EventListener\ExceptionListener */ - private $listener; + private ExceptionListener $listener; protected function setUp(): void { @@ -51,7 +52,7 @@ protected function setUp(): void $this->listener = new ExceptionListener($this->translator); } - public function testGetSubscribedEvents() + public function testGetSubscribedEvents(): void { self::assertSame( [KernelEvents::EXCEPTION => ['onKernelException', 10]], @@ -64,7 +65,7 @@ public function testGetSubscribedEvents() * * @return \Symfony\Component\HttpKernel\Event\ExceptionEvent */ - private function generateExceptionEvent(Exception $exception) + private function generateExceptionEvent(Exception $exception): ExceptionEvent { return new ExceptionEvent( $this->createMock(HttpKernelInterface::class), @@ -74,7 +75,7 @@ private function generateExceptionEvent(Exception $exception) ); } - public function testNotFoundException() + public function testNotFoundException(): void { $messageTemplate = 'some message template'; $translationParams = ['some' => 'thing']; @@ -97,7 +98,7 @@ public function testNotFoundException() self::assertSame($translatedMessage, $convertedException->getMessage()); } - public function testUnauthorizedException() + public function testUnauthorizedException(): void { $messageTemplate = 'some message template'; $translationParams = ['some' => 'thing']; @@ -125,7 +126,7 @@ public function testUnauthorizedException() * * @param \Exception|\Ibexa\Core\Base\Translatable $exception */ - public function testBadRequestException(Exception $exception) + public function testBadRequestException(Exception $exception): void { $messageTemplate = 'some message template'; $translationParams = ['some' => 'thing']; @@ -147,7 +148,7 @@ public function testBadRequestException(Exception $exception) self::assertSame($translatedMessage, $convertedException->getMessage()); } - public function badRequestExceptionProvider() + public function badRequestExceptionProvider(): array { return [ [new BadStateException('foo', 'bar')], @@ -162,7 +163,7 @@ public function badRequestExceptionProvider() * * @param \Exception|\Ibexa\Core\Base\Translatable $exception */ - public function testOtherRepositoryException(Exception $exception) + public function testOtherRepositoryException(Exception $exception): void { $messageTemplate = 'some message template'; $translationParams = ['some' => 'thing']; @@ -185,7 +186,7 @@ public function testOtherRepositoryException(Exception $exception) self::assertSame(Response::HTTP_INTERNAL_SERVER_ERROR, $convertedException->getStatusCode()); } - public function otherExceptionProvider() + public function otherExceptionProvider(): array { return [ [new ForbiddenException('foo')], @@ -200,7 +201,7 @@ public function otherExceptionProvider() ]; } - public function testUntouchedException() + public function testUntouchedException(): void { $exception = new \RuntimeException('foo'); $event = $this->generateExceptionEvent($exception); diff --git a/tests/bundle/Core/EventListener/IndexRequestListenerTest.php b/tests/bundle/Core/EventListener/IndexRequestListenerTest.php index 854bcc1947..68d39dd13d 100644 --- a/tests/bundle/Core/EventListener/IndexRequestListenerTest.php +++ b/tests/bundle/Core/EventListener/IndexRequestListenerTest.php @@ -9,6 +9,7 @@ use Ibexa\Bundle\Core\EventListener\IndexRequestListener; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Event\RequestEvent; @@ -18,19 +19,19 @@ class IndexRequestListenerTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $configResolver; + private MockObject $configResolver; /** @var \Ibexa\Bundle\Core\EventListener\IndexRequestListener */ - private $indexRequestEventListener; + private IndexRequestListener $indexRequestEventListener; /** @var \Symfony\Component\HttpFoundation\Request */ - private $request; + private MockObject $request; /** @var \Symfony\Component\HttpKernel\Event\RequestEvent */ - private $event; + private RequestEvent $event; /** @var \Symfony\Component\HttpKernel\HttpKernelInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $httpKernel; + private MockObject $httpKernel; protected function setUp(): void { @@ -53,7 +54,7 @@ protected function setUp(): void ); } - public function testSubscribedEvents() + public function testSubscribedEvents(): void { self::assertSame( [ @@ -68,7 +69,7 @@ public function testSubscribedEvents() /** * @dataProvider indexPageProvider */ - public function testOnKernelRequestIndexOnIndexPage($requestPath, $configuredIndexPath, $expectedIndexPath) + public function testOnKernelRequestIndexOnIndexPage(string $requestPath, string $configuredIndexPath, string $expectedIndexPath): void { $this->configResolver ->expects(self::once()) @@ -81,7 +82,7 @@ public function testOnKernelRequestIndexOnIndexPage($requestPath, $configuredInd self::assertTrue($this->request->attributes->get('needsRedirect')); } - public function indexPageProvider() + public function indexPageProvider(): array { return [ ['/', '/foo', '/foo'], @@ -94,7 +95,7 @@ public function indexPageProvider() ]; } - public function testOnKernelRequestIndexNotOnIndexPage() + public function testOnKernelRequestIndexNotOnIndexPage(): void { $this->request->attributes->set('semanticPathinfo', '/anyContent'); $this->indexRequestEventListener->onKernelRequestIndex($this->event); diff --git a/tests/bundle/Core/EventListener/LocaleListenerTest.php b/tests/bundle/Core/EventListener/LocaleListenerTest.php index a54dd44da1..3aad97cf38 100644 --- a/tests/bundle/Core/EventListener/LocaleListenerTest.php +++ b/tests/bundle/Core/EventListener/LocaleListenerTest.php @@ -10,6 +10,7 @@ use Ibexa\Bundle\Core\EventListener\LocaleListener; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\MVC\Symfony\Locale\LocaleConverterInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\Request; @@ -21,13 +22,13 @@ class LocaleListenerTest extends TestCase { /** @var \Ibexa\Core\MVC\Symfony\Locale\LocaleConverterInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $localeConverter; + private MockObject $localeConverter; /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $configResolver; + private MockObject $configResolver; /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $requestStack; + private RequestStack $requestStack; protected function setUp(): void { @@ -47,7 +48,7 @@ protected function setUp(): void /** * @dataProvider onKernelRequestProvider */ - public function testOnKernelRequest(array $configuredLanguages, array $convertedLocalesValueMap, $expectedLocale): void + public function testOnKernelRequest(array $configuredLanguages, array $convertedLocalesValueMap, ?string $expectedLocale): void { $this->configResolver ->expects(self::once()) diff --git a/tests/bundle/Core/EventListener/OriginalRequestListenerTest.php b/tests/bundle/Core/EventListener/OriginalRequestListenerTest.php index 049931a944..be3066121c 100644 --- a/tests/bundle/Core/EventListener/OriginalRequestListenerTest.php +++ b/tests/bundle/Core/EventListener/OriginalRequestListenerTest.php @@ -17,7 +17,7 @@ class OriginalRequestListenerTest extends TestCase { - public function testGetSubscribedEvents() + public function testGetSubscribedEvents(): void { self::assertSame( [ @@ -27,7 +27,7 @@ public function testGetSubscribedEvents() ); } - public function testOnKernelRequestNotMaster() + public function testOnKernelRequestNotMaster(): void { $request = new Request(); $event = new RequestEvent( @@ -41,7 +41,7 @@ public function testOnKernelRequestNotMaster() self::assertFalse($request->attributes->has('_ez_original_request')); } - public function testOnKernelRequestNoOriginalRequest() + public function testOnKernelRequestNoOriginalRequest(): void { $request = new Request(); $event = new RequestEvent( @@ -55,7 +55,7 @@ public function testOnKernelRequestNoOriginalRequest() self::assertFalse($request->attributes->has('_ez_original_request')); } - public function testOnKernelRequestWithOriginalRequest() + public function testOnKernelRequestWithOriginalRequest(): void { ClockMock::withClockMock(true); diff --git a/tests/bundle/Core/EventListener/RejectExplicitFrontControllerRequestsListenerTest.php b/tests/bundle/Core/EventListener/RejectExplicitFrontControllerRequestsListenerTest.php index a3e50db59a..fa946750a6 100644 --- a/tests/bundle/Core/EventListener/RejectExplicitFrontControllerRequestsListenerTest.php +++ b/tests/bundle/Core/EventListener/RejectExplicitFrontControllerRequestsListenerTest.php @@ -9,6 +9,7 @@ namespace Ibexa\Tests\Bundle\Core\EventListener; use Ibexa\Bundle\Core\EventListener\RejectExplicitFrontControllerRequestsListener; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Event\RequestEvent; @@ -19,10 +20,10 @@ class RejectExplicitFrontControllerRequestsListenerTest extends TestCase { /** @var \Ibexa\Bundle\Core\EventListener\RejectExplicitFrontControllerRequestsListener */ - private $eventListener; + private RejectExplicitFrontControllerRequestsListener $eventListener; /** @var \Symfony\Component\HttpKernel\HttpKernelInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $httpKernel; + private MockObject $httpKernel; protected function setUp(): void { diff --git a/tests/bundle/Core/EventListener/RequestEventListenerTest.php b/tests/bundle/Core/EventListener/RequestEventListenerTest.php index f3bbd9d5d7..4a7086815a 100644 --- a/tests/bundle/Core/EventListener/RequestEventListenerTest.php +++ b/tests/bundle/Core/EventListener/RequestEventListenerTest.php @@ -10,6 +10,7 @@ use Ibexa\Bundle\Core\EventListener\RequestEventListener; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\MVC\Symfony\SiteAccess; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Bridge\PhpUnit\ClockMock; @@ -24,25 +25,25 @@ class RequestEventListenerTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $configResolver; + private MockObject $configResolver; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $router; + private MockObject $router; /** @var \PHPUnit\Framework\MockObject\MockObject|\Psr\Log\LoggerInterface */ - private $logger; + private MockObject $logger; /** @var \Ibexa\Bundle\Core\EventListener\RequestEventListener */ - private $requestEventListener; + private RequestEventListener $requestEventListener; /** @var \Symfony\Component\HttpFoundation\Request */ - private $request; + private MockObject $request; /** @var \Symfony\Component\HttpKernel\Event\RequestEvent */ - private $event; + private RequestEvent $event; /** @var \Symfony\Component\HttpKernel\HttpKernelInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $httpKernel; + private MockObject $httpKernel; protected function setUp(): void { @@ -67,7 +68,7 @@ protected function setUp(): void ); } - public function testSubscribedEvents() + public function testSubscribedEvents(): void { self::assertSame( [ @@ -80,7 +81,7 @@ public function testSubscribedEvents() ); } - public function testOnKernelRequestForwardSubRequest() + public function testOnKernelRequestForwardSubRequest(): void { $this->httpKernel ->expects(self::never()) @@ -90,7 +91,7 @@ public function testOnKernelRequestForwardSubRequest() $this->requestEventListener->onKernelRequestForward($event); } - public function testOnKernelRequestForward() + public function testOnKernelRequestForward(): void { ClockMock::withClockMock(true); @@ -121,14 +122,14 @@ public function testOnKernelRequestForward() ClockMock::withClockMock(false); } - public function testOnKernelRequestRedirectSubRequest() + public function testOnKernelRequestRedirectSubRequest(): void { $event = new RequestEvent($this->httpKernel, new Request(), HttpKernelInterface::SUB_REQUEST); $this->requestEventListener->onKernelRequestRedirect($event); self::assertFalse($event->hasResponse()); } - public function testOnKernelRequestRedirect() + public function testOnKernelRequestRedirect(): void { $queryParameters = ['some' => 'thing']; $cookieParameters = ['cookie' => 'value']; @@ -149,7 +150,7 @@ public function testOnKernelRequestRedirect() self::assertTrue($event->isPropagationStopped()); } - public function testOnKernelRequestRedirectWithLocationId() + public function testOnKernelRequestRedirectWithLocationId(): void { $queryParameters = ['some' => 'thing']; $cookieParameters = ['cookie' => 'value']; @@ -172,7 +173,7 @@ public function testOnKernelRequestRedirectWithLocationId() self::assertTrue($event->isPropagationStopped()); } - public function testOnKernelRequestRedirectPrependSiteaccess() + public function testOnKernelRequestRedirectPrependSiteaccess(): void { $queryParameters = ['some' => 'thing']; $cookieParameters = ['cookie' => 'value']; diff --git a/tests/bundle/Core/EventListener/RoutingListenerTest.php b/tests/bundle/Core/EventListener/RoutingListenerTest.php index 76663ac22f..dd4e753407 100644 --- a/tests/bundle/Core/EventListener/RoutingListenerTest.php +++ b/tests/bundle/Core/EventListener/RoutingListenerTest.php @@ -14,6 +14,7 @@ use Ibexa\Core\MVC\Symfony\MVCEvents; use Ibexa\Core\MVC\Symfony\Routing\Generator\UrlAliasGenerator; use Ibexa\Core\MVC\Symfony\SiteAccess; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\HttpKernelInterface; @@ -21,13 +22,13 @@ class RoutingListenerTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $configResolver; + private MockObject $configResolver; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $urlAliasRouter; + private MockObject $urlAliasRouter; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $urlAliasGenerator; + private MockObject $urlAliasGenerator; protected function setUp(): void { @@ -37,7 +38,7 @@ protected function setUp(): void $this->urlAliasGenerator = $this->createMock(UrlAliasGenerator::class); } - public function testGetSubscribedEvents() + public function testGetSubscribedEvents(): void { $listener = new RoutingListener($this->configResolver, $this->urlAliasRouter, $this->urlAliasGenerator); self::assertSame( @@ -48,7 +49,7 @@ public function testGetSubscribedEvents() ); } - public function testOnSiteAccessMatch() + public function testOnSiteAccessMatch(): void { $rootLocationId = 123; $excludedUriPrefixes = ['/foo/bar', '/baz']; diff --git a/tests/bundle/Core/EventListener/SessionSetDynamicNameListenerTest.php b/tests/bundle/Core/EventListener/SessionSetDynamicNameListenerTest.php index 618a167d3c..930be9d6b8 100644 --- a/tests/bundle/Core/EventListener/SessionSetDynamicNameListenerTest.php +++ b/tests/bundle/Core/EventListener/SessionSetDynamicNameListenerTest.php @@ -100,7 +100,7 @@ public function testOnSiteAccessMatchNonNativeSessionStorage(): void /** * @dataProvider onSiteAccessMatchProvider */ - public function testOnSiteAccessMatch(SiteAccess $siteAccess, $configuredSessionStorageOptions, array $expectedSessionStorageOptions): void + public function testOnSiteAccessMatch(SiteAccess $siteAccess, array $configuredSessionStorageOptions, array $expectedSessionStorageOptions): void { $request = new Request(); $request->setSession(new Session(new MockArraySessionStorage())); diff --git a/tests/bundle/Core/EventListener/SiteAccessListenerTest.php b/tests/bundle/Core/EventListener/SiteAccessListenerTest.php index 164d6dbfec..568b144ca3 100644 --- a/tests/bundle/Core/EventListener/SiteAccessListenerTest.php +++ b/tests/bundle/Core/EventListener/SiteAccessListenerTest.php @@ -19,10 +19,10 @@ class SiteAccessListenerTest extends TestCase { /** @var \Ibexa\Bundle\Core\EventListener\SiteAccessListener */ - private $listener; + private SiteAccessListener $listener; /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ - private $defaultSiteaccess; + private SiteAccess $defaultSiteaccess; protected function setUp(): void { @@ -32,7 +32,7 @@ protected function setUp(): void $this->listener = new SiteAccessListener($this->defaultSiteaccess); } - public function testGetSubscribedEvents() + public function testGetSubscribedEvents(): void { self::assertSame( [ @@ -42,7 +42,7 @@ public function testGetSubscribedEvents() ); } - public function siteAccessMatchProvider() + public function siteAccessMatchProvider(): array { return [ ['/foo/bar', '/foo/bar', '', []], @@ -64,11 +64,11 @@ public function siteAccessMatchProvider() * @dataProvider siteAccessMatchProvider */ public function testOnSiteAccessMatchMasterRequest( - $uri, - $expectedSemanticPathinfo, - $expectedVPString, + string $uri, + string $expectedSemanticPathinfo, + string $expectedVPString, array $expectedVPArray - ) { + ): void { $uri = rawurldecode($uri); $semanticPathinfoPos = strpos($uri, $expectedSemanticPathinfo); if ($semanticPathinfoPos !== 0) { @@ -100,7 +100,7 @@ public function testOnSiteAccessMatchMasterRequest( /** * @dataProvider siteAccessMatchProvider */ - public function testOnSiteAccessMatchSubRequest($uri, $semanticPathinfo, $vpString, $expectedViewParameters) + public function testOnSiteAccessMatchSubRequest(string $uri, string $semanticPathinfo, string $vpString, array $expectedViewParameters): void { $siteAccess = new SiteAccess('test', 'test', $this->createMock(SiteAccess\Matcher::class)); $request = Request::create($uri); diff --git a/tests/bundle/Core/EventListener/Stubs/TestOutput.php b/tests/bundle/Core/EventListener/Stubs/TestOutput.php index 3243bac942..89595d21be 100644 --- a/tests/bundle/Core/EventListener/Stubs/TestOutput.php +++ b/tests/bundle/Core/EventListener/Stubs/TestOutput.php @@ -16,7 +16,7 @@ class TestOutput extends Output { public $output = ''; - public function clear() + public function clear(): void { $this->output = ''; } diff --git a/tests/bundle/Core/EventListener/ViewControllerListenerTest.php b/tests/bundle/Core/EventListener/ViewControllerListenerTest.php index f9744862d4..f7ce3e0be3 100644 --- a/tests/bundle/Core/EventListener/ViewControllerListenerTest.php +++ b/tests/bundle/Core/EventListener/ViewControllerListenerTest.php @@ -15,6 +15,7 @@ use Ibexa\Core\MVC\Symfony\View\ContentView; use Ibexa\Core\MVC\Symfony\View\Event\FilterViewBuilderParametersEvent; use Ibexa\Core\MVC\Symfony\View\ViewEvents; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -28,31 +29,31 @@ class ViewControllerListenerTest extends TestCase { /** @var \Symfony\Component\HttpKernel\Controller\ControllerResolver|\PHPUnit\Framework\MockObject\MockObject */ - private $controllerResolver; + private MockObject $controllerResolver; /** @var \Psr\Log\LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $logger; + private MockObject $logger; /** @var \Ibexa\Bundle\Core\EventListener\ViewControllerListener */ - private $controllerListener; + private ViewControllerListener $controllerListener; /** @var \Symfony\Component\HttpKernel\Event\ControllerEvent */ private $event; /** @var \Symfony\Component\HttpFoundation\Request */ - private $request; + private Request $request; /** @var \Ibexa\Core\MVC\Symfony\View\Builder\ViewBuilderRegistry|\PHPUnit\Framework\MockObject\MockObject */ - private $viewBuilderRegistry; + private MockObject $viewBuilderRegistry; /** @var \Ibexa\Core\MVC\Symfony\View\Configurator|\PHPUnit\Framework\MockObject\MockObject */ private $viewConfigurator; /** @var \Ibexa\Core\MVC\Symfony\View\Builder\ViewBuilder|\PHPUnit\Framework\MockObject\MockObject */ - private $viewBuilderMock; + private MockObject $viewBuilderMock; /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $eventDispatcher; + private MockObject $eventDispatcher; protected function setUp(): void { @@ -74,7 +75,7 @@ protected function setUp(): void $this->viewBuilderMock = $this->createMock(ViewBuilder::class); } - public function testGetSubscribedEvents() + public function testGetSubscribedEvents(): void { self::assertSame( [KernelEvents::CONTROLLER => ['getController', 10]], @@ -82,7 +83,7 @@ public function testGetSubscribedEvents() ); } - public function testGetControllerNoBuilder() + public function testGetControllerNoBuilder(): void { $initialController = 'Foo::bar'; $this->request->attributes->set('_controller', $initialController); @@ -96,9 +97,9 @@ public function testGetControllerNoBuilder() $this->controllerListener->getController($this->event); } - public function testGetControllerWithClosure() + public function testGetControllerWithClosure(): void { - $initialController = static function () {}; + $initialController = static function (): void {}; $this->request->attributes->set('_controller', $initialController); $this->viewBuilderRegistry @@ -110,7 +111,7 @@ public function testGetControllerWithClosure() $this->controllerListener->getController($this->event); } - public function testGetControllerMatchedView() + public function testGetControllerMatchedView(): void { $contentId = 12; $locationId = 123; @@ -144,7 +145,7 @@ public function testGetControllerMatchedView() $this->controllerResolver ->expects(self::once()) ->method('getController') - ->will(self::returnValue(static function () {})); + ->will(self::returnValue(static function (): void {})); $this->controllerListener->getController($this->event); self::assertEquals($customController, $this->request->attributes->get('_controller')); @@ -192,11 +193,11 @@ public function testGetControllerEmitsProperEvents(): void /** * @return \Symfony\Component\HttpKernel\Event\ControllerEvent */ - protected function createEvent() + protected function createEvent(): ControllerEvent { return new ControllerEvent( $this->createMock(HttpKernelInterface::class), - static function () {}, + static function (): void {}, $this->request, HttpKernelInterface::MAIN_REQUEST ); diff --git a/tests/bundle/Core/EventSubscriber/CrowdinRequestLocaleSubscriberTest.php b/tests/bundle/Core/EventSubscriber/CrowdinRequestLocaleSubscriberTest.php index 2a6e88ab9a..a1aa2f5424 100644 --- a/tests/bundle/Core/EventSubscriber/CrowdinRequestLocaleSubscriberTest.php +++ b/tests/bundle/Core/EventSubscriber/CrowdinRequestLocaleSubscriberTest.php @@ -18,7 +18,7 @@ class CrowdinRequestLocaleSubscriberTest extends TestCase /** * @dataProvider testSetRequestsProvider */ - public function testSetLocale(Request $request, $shouldHaveCustomLocale) + public function testSetLocale(Request $request, bool $shouldHaveCustomLocale): void { $event = new RequestEvent( $this->getMockBuilder(HttpKernelInterface::class)->getMock(), @@ -36,7 +36,7 @@ public function testSetLocale(Request $request, $shouldHaveCustomLocale) ); } - public function testSetRequestsProvider() + public function testSetRequestsProvider(): array { return [ 'with_ez_in_context_translation_cookie' => [ diff --git a/tests/bundle/Core/Fragment/DirectFragmentRendererTest.php b/tests/bundle/Core/Fragment/DirectFragmentRendererTest.php index 68b1d656e8..57becf6b5c 100644 --- a/tests/bundle/Core/Fragment/DirectFragmentRendererTest.php +++ b/tests/bundle/Core/Fragment/DirectFragmentRendererTest.php @@ -59,7 +59,7 @@ public function testSubRequestBuilding(): void $controllerResolver ->method('getController') - ->willReturn(static function () { + ->willReturn(static function (): Response { return new Response('response_body'); }); @@ -76,7 +76,7 @@ public function testControllerResponse(): void $controllerResolver ->method('getController') - ->willReturn(static function () { + ->willReturn(static function (): Response { return new Response('response_body'); }); @@ -95,7 +95,7 @@ public function testControllerViewResponse(): void $controllerResolverMock = $this->getControllerResolverInterfaceMock(); $controllerResolverMock ->method('getController') - ->willReturn(static function (...$args) use ($contentView) { + ->willReturn(static function (...$args) use ($contentView): \Ibexa\Core\MVC\Symfony\View\ContentView { $contentView->setParameters($args); return $contentView; @@ -141,7 +141,7 @@ public function testControllerUnhandledStringResponse(): void $controllerResolver ->method('getController') - ->willReturn(static function (...$args) { + ->willReturn(static function (...$args): array { return ['some_array' => $args]; }); diff --git a/tests/bundle/Core/Fragment/FragmentListenerFactoryTest.php b/tests/bundle/Core/Fragment/FragmentListenerFactoryTest.php index 678c4b817c..8a32541611 100644 --- a/tests/bundle/Core/Fragment/FragmentListenerFactoryTest.php +++ b/tests/bundle/Core/Fragment/FragmentListenerFactoryTest.php @@ -20,7 +20,7 @@ class FragmentListenerFactoryTest extends TestCase /** * @dataProvider buildFragmentListenerProvider */ - public function testBuildFragmentListener($requestUri, $isFragmentCandidate) + public function testBuildFragmentListener(string $requestUri, bool $isFragmentCandidate): void { $listenerClass = FragmentListener::class; $uriSigner = new UriSigner('my_precious_secret'); @@ -44,7 +44,7 @@ public function testBuildFragmentListener($requestUri, $isFragmentCandidate) } } - public function buildFragmentListenerProvider() + public function buildFragmentListenerProvider(): array { return [ ['/foo/bar', false], @@ -56,7 +56,7 @@ public function buildFragmentListenerProvider() ]; } - public function testBuildFragmentListenerNoRequest() + public function testBuildFragmentListenerNoRequest(): void { $factory = new FragmentListenerFactory(); $factory->setRequestStack(new RequestStack()); diff --git a/tests/bundle/Core/Imagine/AliasCleanerTest.php b/tests/bundle/Core/Imagine/AliasCleanerTest.php index 596e2381f2..1035a93a40 100644 --- a/tests/bundle/Core/Imagine/AliasCleanerTest.php +++ b/tests/bundle/Core/Imagine/AliasCleanerTest.php @@ -9,15 +9,16 @@ use Ibexa\Bundle\Core\Imagine\AliasCleaner; use Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class AliasCleanerTest extends TestCase { /** @var \Ibexa\Bundle\Core\Imagine\AliasCleaner */ - private $aliasCleaner; + private AliasCleaner $aliasCleaner; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $resolver; + private MockObject $resolver; protected function setUp(): void { @@ -26,7 +27,7 @@ protected function setUp(): void $this->aliasCleaner = new AliasCleaner($this->resolver); } - public function testRemoveAliases() + public function testRemoveAliases(): void { $originalPath = 'foo/bar/test.jpg'; $this->resolver diff --git a/tests/bundle/Core/Imagine/AliasGeneratorTest.php b/tests/bundle/Core/Imagine/AliasGeneratorTest.php index f022df510a..bf4d423d08 100644 --- a/tests/bundle/Core/Imagine/AliasGeneratorTest.php +++ b/tests/bundle/Core/Imagine/AliasGeneratorTest.php @@ -9,6 +9,7 @@ use Ibexa\Bundle\Core\Imagine\AliasGenerator; use Ibexa\Bundle\Core\Imagine\Variation\ImagineAwareAliasGenerator; +use Ibexa\Contracts\Core\FieldType\Value; use Ibexa\Contracts\Core\FieldType\Value as FieldTypeValue; use Ibexa\Contracts\Core\Repository\Exceptions\InvalidVariationException; use Ibexa\Contracts\Core\Repository\Values\Content\Field; @@ -30,46 +31,47 @@ use Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface; use Liip\ImagineBundle\Imagine\Filter\FilterConfiguration; use Liip\ImagineBundle\Imagine\Filter\FilterManager; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; class AliasGeneratorTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject|\Liip\ImagineBundle\Binary\Loader\LoaderInterface */ - private $dataLoader; + private MockObject $dataLoader; /** @var \PHPUnit\Framework\MockObject\MockObject|\Liip\ImagineBundle\Imagine\Filter\FilterManager */ - private $filterManager; + private MockObject $filterManager; /** @var \PHPUnit\Framework\MockObject\MockObject|\Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface */ - private $ioResolver; + private MockObject $ioResolver; /** @var \Liip\ImagineBundle\Imagine\Filter\FilterConfiguration */ - private $filterConfiguration; + private FilterConfiguration $filterConfiguration; /** @var \PHPUnit\Framework\MockObject\MockObject|\Psr\Log\LoggerInterface */ - private $logger; + private MockObject $logger; /** @var \PHPUnit\Framework\MockObject\MockObject|\Imagine\Image\ImagineInterface */ - private $imagine; + private MockObject $imagine; /** @var \Ibexa\Bundle\Core\Imagine\AliasGenerator */ - private $aliasGenerator; + private AliasGenerator $aliasGenerator; /** @var \Ibexa\Contracts\Core\Variation\VariationHandler */ - private $decoratedAliasGenerator; + private ImagineAwareAliasGenerator $decoratedAliasGenerator; /** @var \PHPUnit\Framework\MockObject\MockObject|\Imagine\Image\BoxInterface */ - private $box; + private MockObject $box; /** @var \PHPUnit\Framework\MockObject\MockObject|\Imagine\Image\ImageInterface */ - private $image; + private MockObject $image; /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\IO\IOServiceInterface */ - private $ioService; + private MockObject $ioService; /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\Variation\VariationPathGenerator */ - private $variationPathGenerator; + private MockObject $variationPathGenerator; protected function setUp(): void { @@ -108,7 +110,7 @@ protected function setUp(): void * @param \Ibexa\Contracts\Core\FieldType\Value $value * @param bool $isSupported */ - public function testSupportsValue($value, $isSupported) + public function testSupportsValue((Value&MockObject)|TextLineValue|ImageValue $value, bool $isSupported): void { self::assertSame($isSupported, $this->aliasGenerator->supportsValue($value)); } @@ -122,7 +124,7 @@ public function testSupportsValue($value, $isSupported) * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ - public function supportsValueProvider() + public function supportsValueProvider(): array { return [ [$this->createMock(FieldTypeValue::class), false], @@ -132,7 +134,7 @@ public function supportsValueProvider() ]; } - public function testGetVariationWrongValue() + public function testGetVariationWrongValue(): void { $this->expectException(\InvalidArgumentException::class); @@ -145,7 +147,7 @@ public function testGetVariationWrongValue() * * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType */ - public function testGetVariationNotStored() + public function testGetVariationNotStored(): void { $originalPath = 'foo/bar/image.jpg'; $variationName = 'my_variation'; @@ -191,7 +193,7 @@ public function testGetVariationNotStored() ); } - public function testGetVariationOriginal() + public function testGetVariationOriginal(): void { $originalPath = 'foo/bar/image.jpg'; $variationName = 'original'; @@ -245,7 +247,7 @@ public function testGetVariationOriginal() * * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType */ - public function testGetVariationNotStoredHavingReferences() + public function testGetVariationNotStoredHavingReferences(): void { $originalPath = 'foo/bar/image.jpg'; $variationName = 'my_variation'; @@ -316,7 +318,7 @@ public function testGetVariationNotStoredHavingReferences() * * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType */ - public function testGetVariationAlreadyStored() + public function testGetVariationAlreadyStored(): void { $originalPath = 'foo/bar/image.jpg'; $variationName = 'my_variation'; @@ -355,7 +357,7 @@ public function testGetVariationAlreadyStored() ); } - public function testGetVariationOriginalNotFound() + public function testGetVariationOriginalNotFound(): void { $this->expectException(SourceImageNotFoundException::class); @@ -368,7 +370,7 @@ public function testGetVariationOriginalNotFound() $this->aliasGenerator->getVariation($field, new VersionInfo(), 'foo'); } - public function testGetVariationInvalidVariation() + public function testGetVariationInvalidVariation(): void { $this->expectException(InvalidVariationException::class); diff --git a/tests/bundle/Core/Imagine/BinaryLoaderTest.php b/tests/bundle/Core/Imagine/BinaryLoaderTest.php index feddb12766..c515d29b88 100644 --- a/tests/bundle/Core/Imagine/BinaryLoaderTest.php +++ b/tests/bundle/Core/Imagine/BinaryLoaderTest.php @@ -15,16 +15,17 @@ use Ibexa\Core\IO\Values\MissingBinaryFile; use Liip\ImagineBundle\Exception\Binary\Loader\NotLoadableException; use Liip\ImagineBundle\Model\Binary; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Mime\MimeTypes; class BinaryLoaderTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $ioService; + private MockObject $ioService; /** @var \Ibexa\Bundle\Core\Imagine\BinaryLoader */ - private $binaryLoader; + private BinaryLoader $binaryLoader; protected function setUp(): void { @@ -33,9 +34,9 @@ protected function setUp(): void $this->binaryLoader = new BinaryLoader($this->ioService, new MimeTypes()); } - public function testFindNotFound() + public function testFindNotFound(): void { - $this->expectException(\Liip\ImagineBundle\Exception\Binary\Loader\NotLoadableException::class); + $this->expectException(NotLoadableException::class); $path = 'something.jpg'; $this->ioService @@ -47,9 +48,9 @@ public function testFindNotFound() $this->binaryLoader->find($path); } - public function testFindMissing() + public function testFindMissing(): void { - $this->expectException(\Liip\ImagineBundle\Exception\Binary\Loader\NotLoadableException::class); + $this->expectException(NotLoadableException::class); $path = 'something.jpg'; $this->ioService @@ -61,7 +62,7 @@ public function testFindMissing() $this->binaryLoader->find($path); } - public function testFindBadPathRoot() + public function testFindBadPathRoot(): void { $path = 'var/site/storage/images/1/2/3/123-name/name.png'; $this->ioService diff --git a/tests/bundle/Core/Imagine/Cache/Resolver/ProxyResolverTest.php b/tests/bundle/Core/Imagine/Cache/Resolver/ProxyResolverTest.php index 0f53eea8d3..c87108cca5 100644 --- a/tests/bundle/Core/Imagine/Cache/Resolver/ProxyResolverTest.php +++ b/tests/bundle/Core/Imagine/Cache/Resolver/ProxyResolverTest.php @@ -9,18 +9,19 @@ use Ibexa\Bundle\Core\Imagine\Cache\Resolver\ProxyResolver; use Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ProxyResolverTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject|\Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface */ - private $resolver; + private MockObject $resolver; /** @var string */ - private $path; + private string $path; /** @var string */ - private $filter; + private string $filter; protected function setUp(): void { @@ -30,7 +31,7 @@ protected function setUp(): void $this->filter = 'medium'; } - public function testResolveUsingProxyHostWithTrailingSlash() + public function testResolveUsingProxyHostWithTrailingSlash(): void { $hosts = ['http://ezplatform.com/']; $proxyResolver = new ProxyResolver($this->resolver, $hosts); @@ -48,7 +49,7 @@ public function testResolveUsingProxyHostWithTrailingSlash() self::assertEquals($expected, $proxyResolver->resolve($this->path, $this->filter)); } - public function testResolveAndRemovePortUsingProxyHost() + public function testResolveAndRemovePortUsingProxyHost(): void { $hosts = ['http://ibexa.co']; $proxyResolver = new ProxyResolver($this->resolver, $hosts); @@ -66,7 +67,7 @@ public function testResolveAndRemovePortUsingProxyHost() self::assertEquals($expected, $proxyResolver->resolve($this->path, $this->filter)); } - public function testResolveAndRemovePortUsingProxyHostWithTrailingSlash() + public function testResolveAndRemovePortUsingProxyHostWithTrailingSlash(): void { $hosts = ['http://ibexa.co']; $proxyResolver = new ProxyResolver($this->resolver, $hosts); diff --git a/tests/bundle/Core/Imagine/Cache/Resolver/RelativeResolverTest.php b/tests/bundle/Core/Imagine/Cache/Resolver/RelativeResolverTest.php index 1d41a4f323..9a9f414b7f 100644 --- a/tests/bundle/Core/Imagine/Cache/Resolver/RelativeResolverTest.php +++ b/tests/bundle/Core/Imagine/Cache/Resolver/RelativeResolverTest.php @@ -9,12 +9,13 @@ use Ibexa\Bundle\Core\Imagine\Cache\Resolver\RelativeResolver; use Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class RelativeResolverTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject|\Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface */ - private $liipResolver; + private MockObject $liipResolver; protected function setUp(): void { @@ -22,7 +23,7 @@ protected function setUp(): void $this->liipResolver = $this->getMockBuilder(ResolverInterface::class)->getMock(); } - public function testResolve() + public function testResolve(): void { $resolver = new RelativeResolver($this->liipResolver); diff --git a/tests/bundle/Core/Imagine/Cache/ResolverFactoryTest.php b/tests/bundle/Core/Imagine/Cache/ResolverFactoryTest.php index 32c17cf66c..05235b4ad6 100644 --- a/tests/bundle/Core/Imagine/Cache/ResolverFactoryTest.php +++ b/tests/bundle/Core/Imagine/Cache/ResolverFactoryTest.php @@ -12,18 +12,19 @@ use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Liip\ImagineBundle\Imagine\Cache\Resolver\ProxyResolver; use Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ResolverFactoryTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private MockObject $configResolver; /** @var \PHPUnit\Framework\MockObject\MockObject|\Liip\ImagineBundle\Imagine\Cache\Resolver\ResolverInterface */ - private $resolver; + private MockObject $resolver; /** @var \Ibexa\Bundle\Core\Imagine\Cache\ResolverFactory */ - private $factory; + private ResolverFactory $factory; protected function setUp(): void { @@ -38,7 +39,7 @@ protected function setUp(): void ); } - public function testCreateProxyCacheResolver() + public function testCreateProxyCacheResolver(): void { $this->configResolver ->expects(self::at(0)) @@ -59,7 +60,7 @@ public function testCreateProxyCacheResolver() self::assertEquals($expected, $this->factory->createCacheResolver()); } - public function testCreateRelativeCacheResolver() + public function testCreateRelativeCacheResolver(): void { $this->configResolver ->expects(self::at(0)) diff --git a/tests/bundle/Core/Imagine/Filter/AbstractFilterTest.php b/tests/bundle/Core/Imagine/Filter/AbstractFilterTest.php index 4f4ef7ca3f..b79e6e9d7d 100644 --- a/tests/bundle/Core/Imagine/Filter/AbstractFilterTest.php +++ b/tests/bundle/Core/Imagine/Filter/AbstractFilterTest.php @@ -8,6 +8,7 @@ namespace Ibexa\Tests\Bundle\Core\Imagine\Filter; use Ibexa\Bundle\Core\Imagine\Filter\AbstractFilter; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class AbstractFilterTest extends TestCase @@ -21,12 +22,12 @@ protected function setUp(): void $this->filter = $this->getFilter(); } - protected function getFilter() + protected function getFilter(): MockObject { return $this->getMockForAbstractClass(AbstractFilter::class); } - public function testGetSetOptions() + public function testGetSetOptions(): void { self::assertSame([], $this->filter->getOptions()); $options = ['foo' => 'bar', 'some' => ['thing']]; @@ -37,7 +38,7 @@ public function testGetSetOptions() /** * @dataProvider getSetOptionNoDefaulValueProvider */ - public function testGetSetOptionNoDefaultValue($optionName, $value) + public function testGetSetOptionNoDefaultValue(string $optionName, string|int|bool|\stdClass|array $value): void { self::assertFalse($this->filter->hasOption($optionName)); self::assertNull($this->filter->getOption($optionName)); @@ -46,7 +47,7 @@ public function testGetSetOptionNoDefaultValue($optionName, $value) self::assertSame($value, $this->filter->getOption($optionName)); } - public function getSetOptionNoDefaulValueProvider() + public function getSetOptionNoDefaulValueProvider(): array { return [ ['foo', 'bar'], @@ -61,7 +62,7 @@ public function getSetOptionNoDefaulValueProvider() /** * @dataProvider getSetOptionWithDefaulValueProvider */ - public function testGetSetOptionWithDefaultValue($optionName, $value, $defaultValue) + public function testGetSetOptionWithDefaultValue(string $optionName, string|int|bool|\stdClass|array $value, string|int|bool|\stdClass|array $defaultValue): void { self::assertFalse($this->filter->hasOption($optionName)); self::assertSame($defaultValue, $this->filter->getOption($optionName, $defaultValue)); @@ -70,7 +71,7 @@ public function testGetSetOptionWithDefaultValue($optionName, $value, $defaultVa self::assertSame($value, $this->filter->getOption($optionName)); } - public function getSetOptionWithDefaulValueProvider() + public function getSetOptionWithDefaulValueProvider(): array { return [ ['foo', 'bar', 'default'], diff --git a/tests/bundle/Core/Imagine/Filter/FilterConfigurationTest.php b/tests/bundle/Core/Imagine/Filter/FilterConfigurationTest.php index fe9cf8af97..e57ddd8ab0 100644 --- a/tests/bundle/Core/Imagine/Filter/FilterConfigurationTest.php +++ b/tests/bundle/Core/Imagine/Filter/FilterConfigurationTest.php @@ -9,15 +9,16 @@ use Ibexa\Bundle\Core\Imagine\Filter\FilterConfiguration; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class FilterConfigurationTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $configResolver; + private MockObject $configResolver; /** @var \Ibexa\Bundle\Core\Imagine\Filter\FilterConfiguration */ - private $filterConfiguration; + private FilterConfiguration $filterConfiguration; protected function setUp(): void { @@ -27,7 +28,7 @@ protected function setUp(): void $this->filterConfiguration->setConfigResolver($this->configResolver); } - public function testGetOnlyImagineFilters() + public function testGetOnlyImagineFilters(): void { $fooConfig = ['fooconfig']; $barConfig = ['barconfig']; @@ -44,7 +45,7 @@ public function testGetOnlyImagineFilters() self::assertSame($barConfig, $this->filterConfiguration->get('bar')); } - public function testGetNoEzVariationInvalidImagineFilter() + public function testGetNoEzVariationInvalidImagineFilter(): void { $this->expectException(\RuntimeException::class); @@ -90,7 +91,7 @@ public function testGetWithEzVariationNullConfiguration(): void ); } - public function testGetEzVariationNoReference() + public function testGetEzVariationNoReference(): void { $fooConfig = ['fooconfig']; $barConfig = ['barconfig']; @@ -119,7 +120,7 @@ public function testGetEzVariationNoReference() ); } - public function testGetEzVariationWithReference() + public function testGetEzVariationWithReference(): void { $fooConfig = ['fooconfig']; $barConfig = ['barconfig']; @@ -149,7 +150,7 @@ public function testGetEzVariationWithReference() ); } - public function testGetEzVariationImagineFilters() + public function testGetEzVariationImagineFilters(): void { $filters = ['some_filter' => []]; $imagineConfig = ['filters' => $filters]; @@ -177,7 +178,7 @@ public function testGetEzVariationImagineFilters() ); } - public function testGetEzVariationImagineOptions() + public function testGetEzVariationImagineOptions(): void { $imagineConfig = [ 'foo_option' => 'foo', @@ -210,7 +211,7 @@ public function testGetEzVariationImagineOptions() ); } - public function testAll() + public function testAll(): void { $fooConfig = ['fooconfig']; $barConfig = ['barconfig']; diff --git a/tests/bundle/Core/Imagine/Filter/Loader/BorderFilterLoaderTest.php b/tests/bundle/Core/Imagine/Filter/Loader/BorderFilterLoaderTest.php index 3dc1640763..9f48a0d443 100644 --- a/tests/bundle/Core/Imagine/Filter/Loader/BorderFilterLoaderTest.php +++ b/tests/bundle/Core/Imagine/Filter/Loader/BorderFilterLoaderTest.php @@ -21,7 +21,7 @@ class BorderFilterLoaderTest extends TestCase /** * @dataProvider loadInvalidProvider */ - public function testLoadInvalidOptions(array $options) + public function testLoadInvalidOptions(array $options): void { $this->expectException(InvalidArgumentException::class); @@ -29,7 +29,7 @@ public function testLoadInvalidOptions(array $options) $loader->load($this->createMock(ImageInterface::class), $options); } - public function loadInvalidProvider() + public function loadInvalidProvider(): array { return [ [[]], @@ -38,7 +38,7 @@ public function loadInvalidProvider() ]; } - public function testLoadDefaultColor() + public function testLoadDefaultColor(): void { $image = $this->createMock(ImageInterface::class); $options = [10, 10]; @@ -85,7 +85,7 @@ public function testLoadDefaultColor() /** * @dataProvider loadProvider */ - public function testLoad($thickX, $thickY, $color) + public function testLoad(int $thickX, int $thickY, string $color): void { $image = $this->createMock(ImageInterface::class); $options = [$thickX, $thickY, $color]; @@ -129,7 +129,7 @@ public function testLoad($thickX, $thickY, $color) self::assertSame($image, $loader->load($image, $options)); } - public function loadProvider() + public function loadProvider(): array { return [ [10, 10, '#fff'], diff --git a/tests/bundle/Core/Imagine/Filter/Loader/CropFilterLoaderTest.php b/tests/bundle/Core/Imagine/Filter/Loader/CropFilterLoaderTest.php index e937182c95..afc08e26de 100644 --- a/tests/bundle/Core/Imagine/Filter/Loader/CropFilterLoaderTest.php +++ b/tests/bundle/Core/Imagine/Filter/Loader/CropFilterLoaderTest.php @@ -11,15 +11,16 @@ use Imagine\Exception\InvalidArgumentException; use Imagine\Image\ImageInterface; use Liip\ImagineBundle\Imagine\Filter\Loader\LoaderInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class CropFilterLoaderTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $innerLoader; + private MockObject $innerLoader; /** @var \Ibexa\Bundle\Core\Imagine\Filter\Loader\CropFilterLoader */ - private $loader; + private CropFilterLoader $loader; protected function setUp(): void { @@ -32,14 +33,14 @@ protected function setUp(): void /** * @dataProvider loadInvalidProvider */ - public function testLoadInvalidOptions(array $options) + public function testLoadInvalidOptions(array $options): void { $this->expectException(InvalidArgumentException::class); $this->loader->load($this->createMock(ImageInterface::class), $options); } - public function loadInvalidProvider() + public function loadInvalidProvider(): array { return [ [[]], @@ -50,7 +51,7 @@ public function loadInvalidProvider() ]; } - public function testLoad() + public function testLoad(): void { $width = 123; $height = 789; diff --git a/tests/bundle/Core/Imagine/Filter/Loader/GrayscaleFilterLoaderTest.php b/tests/bundle/Core/Imagine/Filter/Loader/GrayscaleFilterLoaderTest.php index eaa18287ba..3dfdb86762 100644 --- a/tests/bundle/Core/Imagine/Filter/Loader/GrayscaleFilterLoaderTest.php +++ b/tests/bundle/Core/Imagine/Filter/Loader/GrayscaleFilterLoaderTest.php @@ -14,7 +14,7 @@ class GrayscaleFilterLoaderTest extends TestCase { - public function testLoad() + public function testLoad(): void { $image = $this->createMock(ImageInterface::class); $effects = $this->createMock(EffectsInterface::class); diff --git a/tests/bundle/Core/Imagine/Filter/Loader/ReduceNoiseFilterLoaderTest.php b/tests/bundle/Core/Imagine/Filter/Loader/ReduceNoiseFilterLoaderTest.php index b4a6eb2942..a7c1e4064b 100644 --- a/tests/bundle/Core/Imagine/Filter/Loader/ReduceNoiseFilterLoaderTest.php +++ b/tests/bundle/Core/Imagine/Filter/Loader/ReduceNoiseFilterLoaderTest.php @@ -11,15 +11,16 @@ use Ibexa\Bundle\Core\Imagine\Filter\Loader\ReduceNoiseFilterLoader; use Imagine\Exception\NotSupportedException; use Imagine\Image\ImageInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ReduceNoiseFilterLoaderTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $filter; + private MockObject $filter; /** @var \Ibexa\Bundle\Core\Imagine\Filter\Loader\ReduceNoiseFilterLoader */ - private $loader; + private ReduceNoiseFilterLoader $loader; protected function setUp(): void { @@ -28,7 +29,7 @@ protected function setUp(): void $this->loader = new ReduceNoiseFilterLoader($this->filter); } - public function testLoadInvalidDriver() + public function testLoadInvalidDriver(): void { $this->expectException(NotSupportedException::class); diff --git a/tests/bundle/Core/Imagine/Filter/Loader/ScaleDownOnlyFilterLoaderTest.php b/tests/bundle/Core/Imagine/Filter/Loader/ScaleDownOnlyFilterLoaderTest.php index c120b142ab..6ec42370a1 100644 --- a/tests/bundle/Core/Imagine/Filter/Loader/ScaleDownOnlyFilterLoaderTest.php +++ b/tests/bundle/Core/Imagine/Filter/Loader/ScaleDownOnlyFilterLoaderTest.php @@ -11,15 +11,16 @@ use Imagine\Exception\InvalidArgumentException; use Imagine\Image\ImageInterface; use Liip\ImagineBundle\Imagine\Filter\Loader\LoaderInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ScaleDownOnlyFilterLoaderTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $innerLoader; + private MockObject $innerLoader; /** @var \Ibexa\Bundle\Core\Imagine\Filter\Loader\ScaleDownOnlyFilterLoader */ - private $loader; + private ScaleDownOnlyFilterLoader $loader; protected function setUp(): void { @@ -32,14 +33,14 @@ protected function setUp(): void /** * @dataProvider loadInvalidProvider */ - public function testLoadInvalidOptions(array $options) + public function testLoadInvalidOptions(array $options): void { $this->expectException(InvalidArgumentException::class); $this->loader->load($this->createMock(ImageInterface::class), $options); } - public function loadInvalidProvider() + public function loadInvalidProvider(): array { return [ [[]], @@ -48,7 +49,7 @@ public function loadInvalidProvider() ]; } - public function testLoad() + public function testLoad(): void { $options = [123, 456]; $image = $this->createMock(ImageInterface::class); diff --git a/tests/bundle/Core/Imagine/Filter/Loader/ScaleExactFilterLoaderTest.php b/tests/bundle/Core/Imagine/Filter/Loader/ScaleExactFilterLoaderTest.php index 273b6dd972..774683c5ff 100644 --- a/tests/bundle/Core/Imagine/Filter/Loader/ScaleExactFilterLoaderTest.php +++ b/tests/bundle/Core/Imagine/Filter/Loader/ScaleExactFilterLoaderTest.php @@ -11,15 +11,16 @@ use Imagine\Exception\InvalidArgumentException; use Imagine\Image\ImageInterface; use Liip\ImagineBundle\Imagine\Filter\Loader\LoaderInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ScaleExactFilterLoaderTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $innerLoader; + private MockObject $innerLoader; /** @var \Ibexa\Bundle\Core\Imagine\Filter\Loader\ScaleExactFilterLoader */ - private $loader; + private ScaleExactFilterLoader $loader; protected function setUp(): void { @@ -32,14 +33,14 @@ protected function setUp(): void /** * @dataProvider loadInvalidProvider */ - public function testLoadInvalidOptions(array $options) + public function testLoadInvalidOptions(array $options): void { $this->expectException(InvalidArgumentException::class); $this->loader->load($this->createMock(ImageInterface::class), $options); } - public function loadInvalidProvider() + public function loadInvalidProvider(): array { return [ [[]], @@ -48,7 +49,7 @@ public function loadInvalidProvider() ]; } - public function testLoad() + public function testLoad(): void { $options = [123, 456]; $image = $this->createMock(ImageInterface::class); diff --git a/tests/bundle/Core/Imagine/Filter/Loader/ScaleFilterLoaderTest.php b/tests/bundle/Core/Imagine/Filter/Loader/ScaleFilterLoaderTest.php index 873eb0d0fc..1ae0ea2d9a 100644 --- a/tests/bundle/Core/Imagine/Filter/Loader/ScaleFilterLoaderTest.php +++ b/tests/bundle/Core/Imagine/Filter/Loader/ScaleFilterLoaderTest.php @@ -12,15 +12,16 @@ use Imagine\Image\Box; use Imagine\Image\ImageInterface; use Liip\ImagineBundle\Imagine\Filter\Loader\LoaderInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ScaleFilterLoaderTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $innerLoader; + private MockObject $innerLoader; /** @var \Ibexa\Bundle\Core\Imagine\Filter\Loader\ScaleFilterLoader */ - private $loader; + private ScaleFilterLoader $loader; protected function setUp(): void { @@ -33,14 +34,14 @@ protected function setUp(): void /** * @dataProvider loadInvalidProvider */ - public function testLoadInvalidOptions(array $options) + public function testLoadInvalidOptions(array $options): void { $this->expectException(InvalidArgumentException::class); $this->loader->load($this->createMock(ImageInterface::class), $options); } - public function loadInvalidProvider() + public function loadInvalidProvider(): array { return [ [[]], @@ -49,7 +50,7 @@ public function loadInvalidProvider() ]; } - public function testLoadHeighten() + public function testLoadHeighten(): void { $width = 900; $height = 400; @@ -72,7 +73,7 @@ public function testLoadHeighten() self::assertSame($image, $this->loader->load($image, [$width, $height])); } - public function testLoadWiden() + public function testLoadWiden(): void { $width = 900; $height = 600; diff --git a/tests/bundle/Core/Imagine/Filter/Loader/ScaleHeightDownOnlyFilterLoaderTest.php b/tests/bundle/Core/Imagine/Filter/Loader/ScaleHeightDownOnlyFilterLoaderTest.php index 840cca4006..35dfb68288 100644 --- a/tests/bundle/Core/Imagine/Filter/Loader/ScaleHeightDownOnlyFilterLoaderTest.php +++ b/tests/bundle/Core/Imagine/Filter/Loader/ScaleHeightDownOnlyFilterLoaderTest.php @@ -11,15 +11,16 @@ use Imagine\Exception\InvalidArgumentException; use Imagine\Image\ImageInterface; use Liip\ImagineBundle\Imagine\Filter\Loader\LoaderInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ScaleHeightDownOnlyFilterLoaderTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $innerLoader; + private MockObject $innerLoader; /** @var \Ibexa\Bundle\Core\Imagine\Filter\Loader\ScaleHeightDownOnlyFilterLoader */ - private $loader; + private ScaleHeightDownOnlyFilterLoader $loader; protected function setUp(): void { @@ -29,14 +30,14 @@ protected function setUp(): void $this->loader->setInnerLoader($this->innerLoader); } - public function testLoadInvalid() + public function testLoadInvalid(): void { $this->expectException(InvalidArgumentException::class); $this->loader->load($this->createMock(ImageInterface::class), []); } - public function testLoad() + public function testLoad(): void { $height = 123; $image = $this->createMock(ImageInterface::class); diff --git a/tests/bundle/Core/Imagine/Filter/Loader/ScaleHeightFilterLoaderTest.php b/tests/bundle/Core/Imagine/Filter/Loader/ScaleHeightFilterLoaderTest.php index 9b36149c03..0e4b406555 100644 --- a/tests/bundle/Core/Imagine/Filter/Loader/ScaleHeightFilterLoaderTest.php +++ b/tests/bundle/Core/Imagine/Filter/Loader/ScaleHeightFilterLoaderTest.php @@ -11,15 +11,16 @@ use Imagine\Exception\InvalidArgumentException; use Imagine\Image\ImageInterface; use Liip\ImagineBundle\Imagine\Filter\Loader\LoaderInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ScaleHeightFilterLoaderTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $innerLoader; + private MockObject $innerLoader; /** @var \Ibexa\Bundle\Core\Imagine\Filter\Loader\ScaleHeightFilterLoader */ - private $loader; + private ScaleHeightFilterLoader $loader; protected function setUp(): void { @@ -29,14 +30,14 @@ protected function setUp(): void $this->loader->setInnerLoader($this->innerLoader); } - public function testLoadFail() + public function testLoadFail(): void { $this->expectException(InvalidArgumentException::class); $this->loader->load($this->createMock(ImageInterface::class, [])); } - public function testLoad() + public function testLoad(): void { $height = 123; $image = $this->createMock(ImageInterface::class); diff --git a/tests/bundle/Core/Imagine/Filter/Loader/ScalePercentFilterLoaderTest.php b/tests/bundle/Core/Imagine/Filter/Loader/ScalePercentFilterLoaderTest.php index 762ec807e8..36310382a7 100644 --- a/tests/bundle/Core/Imagine/Filter/Loader/ScalePercentFilterLoaderTest.php +++ b/tests/bundle/Core/Imagine/Filter/Loader/ScalePercentFilterLoaderTest.php @@ -12,15 +12,16 @@ use Imagine\Image\Box; use Imagine\Image\ImageInterface; use Liip\ImagineBundle\Imagine\Filter\Loader\LoaderInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ScalePercentFilterLoaderTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $innerLoader; + private MockObject $innerLoader; /** @var \Ibexa\Bundle\Core\Imagine\Filter\Loader\ScalePercentFilterLoader */ - private $loader; + private ScalePercentFilterLoader $loader; protected function setUp(): void { @@ -33,14 +34,14 @@ protected function setUp(): void /** * @dataProvider loadInvalidProvider */ - public function testLoadInvalidOptions(array $options) + public function testLoadInvalidOptions(array $options): void { $this->expectException(InvalidArgumentException::class); $this->loader->load($this->createMock(ImageInterface::class), $options); } - public function loadInvalidProvider() + public function loadInvalidProvider(): array { return [ [[]], @@ -49,7 +50,7 @@ public function loadInvalidProvider() ]; } - public function testLoad() + public function testLoad(): void { $widthPercent = 40; $heightPercent = 125; diff --git a/tests/bundle/Core/Imagine/Filter/Loader/ScaleWidthDownOnlyFilterLoaderTest.php b/tests/bundle/Core/Imagine/Filter/Loader/ScaleWidthDownOnlyFilterLoaderTest.php index 4ad49d493d..f99b13cada 100644 --- a/tests/bundle/Core/Imagine/Filter/Loader/ScaleWidthDownOnlyFilterLoaderTest.php +++ b/tests/bundle/Core/Imagine/Filter/Loader/ScaleWidthDownOnlyFilterLoaderTest.php @@ -11,15 +11,16 @@ use Imagine\Exception\InvalidArgumentException; use Imagine\Image\ImageInterface; use Liip\ImagineBundle\Imagine\Filter\Loader\LoaderInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ScaleWidthDownOnlyFilterLoaderTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $innerLoader; + private MockObject $innerLoader; /** @var \Ibexa\Bundle\Core\Imagine\Filter\Loader\ScaleWidthDownOnlyFilterLoader */ - private $loader; + private ScaleWidthDownOnlyFilterLoader $loader; protected function setUp(): void { @@ -29,14 +30,14 @@ protected function setUp(): void $this->loader->setInnerLoader($this->innerLoader); } - public function testLoadInvalid() + public function testLoadInvalid(): void { $this->expectException(InvalidArgumentException::class); $this->loader->load($this->createMock(ImageInterface::class), []); } - public function testLoad() + public function testLoad(): void { $width = 123; $image = $this->createMock(ImageInterface::class); diff --git a/tests/bundle/Core/Imagine/Filter/Loader/ScaleWidthFilterLoaderTest.php b/tests/bundle/Core/Imagine/Filter/Loader/ScaleWidthFilterLoaderTest.php index 78fb82b9e0..743cfa8ba8 100644 --- a/tests/bundle/Core/Imagine/Filter/Loader/ScaleWidthFilterLoaderTest.php +++ b/tests/bundle/Core/Imagine/Filter/Loader/ScaleWidthFilterLoaderTest.php @@ -11,15 +11,16 @@ use Imagine\Exception\InvalidArgumentException; use Imagine\Image\ImageInterface; use Liip\ImagineBundle\Imagine\Filter\Loader\LoaderInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ScaleWidthFilterLoaderTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $innerLoader; + private MockObject $innerLoader; /** @var \Ibexa\Bundle\Core\Imagine\Filter\Loader\ScaleWidthFilterLoader */ - private $loader; + private ScaleWidthFilterLoader $loader; protected function setUp(): void { @@ -29,14 +30,14 @@ protected function setUp(): void $this->loader->setInnerLoader($this->innerLoader); } - public function testLoadFail() + public function testLoadFail(): void { $this->expectException(InvalidArgumentException::class); $this->loader->load($this->createMock(ImageInterface::class, [])); } - public function testLoad() + public function testLoad(): void { $width = 123; $image = $this->createMock(ImageInterface::class); diff --git a/tests/bundle/Core/Imagine/Filter/Loader/SwirlFilterLoaderTest.php b/tests/bundle/Core/Imagine/Filter/Loader/SwirlFilterLoaderTest.php index 4af693b48b..9300fcd990 100644 --- a/tests/bundle/Core/Imagine/Filter/Loader/SwirlFilterLoaderTest.php +++ b/tests/bundle/Core/Imagine/Filter/Loader/SwirlFilterLoaderTest.php @@ -10,15 +10,16 @@ use Ibexa\Bundle\Core\Imagine\Filter\FilterInterface; use Ibexa\Bundle\Core\Imagine\Filter\Loader\SwirlFilterLoader; use Imagine\Image\ImageInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class SwirlFilterLoaderTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $filter; + private MockObject $filter; /** @var \Ibexa\Bundle\Core\Imagine\Filter\Loader\SwirlFilterLoader */ - private $loader; + private SwirlFilterLoader $loader; protected function setUp(): void { @@ -27,7 +28,7 @@ protected function setUp(): void $this->loader = new SwirlFilterLoader($this->filter); } - public function testLoadNoOption() + public function testLoadNoOption(): void { $image = $this->createMock(ImageInterface::class); $this->filter @@ -46,7 +47,7 @@ public function testLoadNoOption() /** * @dataProvider loadWithOptionProvider */ - public function testLoadWithOption($degrees) + public function testLoadWithOption(int|float $degrees): void { $image = $this->createMock(ImageInterface::class); $this->filter @@ -63,7 +64,7 @@ public function testLoadWithOption($degrees) self::assertSame($image, $this->loader->load($image, [$degrees])); } - public function loadWithOptionProvider() + public function loadWithOptionProvider(): array { return [ [10], diff --git a/tests/bundle/Core/Imagine/Filter/UnsupportedFilterTest.php b/tests/bundle/Core/Imagine/Filter/UnsupportedFilterTest.php index 6076a2a83b..b24742b68f 100644 --- a/tests/bundle/Core/Imagine/Filter/UnsupportedFilterTest.php +++ b/tests/bundle/Core/Imagine/Filter/UnsupportedFilterTest.php @@ -13,7 +13,7 @@ class UnsupportedFilterTest extends AbstractFilterTest { - public function testLoad() + public function testLoad(): void { $this->expectException(NotSupportedException::class); diff --git a/tests/bundle/Core/Imagine/IORepositoryResolverTest.php b/tests/bundle/Core/Imagine/IORepositoryResolverTest.php index 804150e77b..c7c80df017 100644 --- a/tests/bundle/Core/Imagine/IORepositoryResolverTest.php +++ b/tests/bundle/Core/Imagine/IORepositoryResolverTest.php @@ -19,6 +19,7 @@ use Ibexa\Core\IO\Values\MissingBinaryFile; use Liip\ImagineBundle\Exception\Imagine\Cache\Resolver\NotResolvableException; use Liip\ImagineBundle\Model\Binary; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\RequestContext; @@ -26,25 +27,25 @@ class IORepositoryResolverTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $ioService; + private MockObject $ioService; /** @var \Symfony\Component\Routing\RequestContext */ - private $requestContext; + private RequestContext $requestContext; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $configResolver; + private MockObject $configResolver; /** @var \Ibexa\Bundle\Core\Imagine\IORepositoryResolver */ - private $imageResolver; + private IORepositoryResolver $imageResolver; /** @var \Ibexa\Bundle\Core\Imagine\Filter\FilterConfiguration */ - private $filterConfiguration; + private FilterConfiguration $filterConfiguration; /** @var \Ibexa\Contracts\Core\Variation\VariationPurger|\PHPUnit\Framework\MockObject\MockObject */ - protected $variationPurger; + protected MockObject $variationPurger; /** @var \Ibexa\Contracts\Core\Variation\VariationPathGenerator|\PHPUnit\Framework\MockObject\MockObject */ - protected $variationPathGenerator; + protected MockObject $variationPathGenerator; protected function setUp(): void { @@ -68,7 +69,7 @@ protected function setUp(): void /** * @dataProvider getFilePathProvider */ - public function testGetFilePath($path, $filter, $expected) + public function testGetFilePath(string $path, string $filter, string $expected): void { $this->variationPathGenerator ->expects(self::once()) @@ -78,7 +79,7 @@ public function testGetFilePath($path, $filter, $expected) self::assertSame($expected, $this->imageResolver->getFilePath($path, $filter)); } - public function getFilePathProvider() + public function getFilePathProvider(): array { return [ ['Tardis/bigger/in-the-inside/RiverSong.jpg', 'thumbnail', 'Tardis/bigger/in-the-inside/RiverSong_thumbnail.jpg'], @@ -88,7 +89,7 @@ public function getFilePathProvider() ]; } - public function testIsStoredImageExists() + public function testIsStoredImageExists(): void { $filter = 'thumbnail'; $path = 'Tardis/bigger/in-the-inside/RiverSong.jpg'; @@ -109,7 +110,7 @@ public function testIsStoredImageExists() self::assertTrue($this->imageResolver->isStored($path, $filter)); } - public function testIsStoredImageDoesntExist() + public function testIsStoredImageDoesntExist(): void { $filter = 'thumbnail'; $path = 'Tardis/bigger/in-the-inside/RiverSong.jpg'; @@ -133,7 +134,7 @@ public function testIsStoredImageDoesntExist() /** * @dataProvider resolveProvider */ - public function testResolve($path, $filter, $variationPath, $requestUrl, $expected) + public function testResolve(string $path, string $filter, string $variationPath, ?string $requestUrl, string $expected): void { if ($requestUrl) { $this->requestContext->fromRequest(Request::create($requestUrl)); @@ -153,7 +154,7 @@ public function testResolve($path, $filter, $variationPath, $requestUrl, $expect self::assertSame($expected, $result); } - public function testResolveMissing() + public function testResolveMissing(): void { $this->expectException(NotResolvableException::class); @@ -167,7 +168,7 @@ public function testResolveMissing() $this->imageResolver->resolve($path, 'some_filter'); } - public function testResolveNotFound() + public function testResolveNotFound(): void { $this->expectException(NotResolvableException::class); @@ -181,7 +182,7 @@ public function testResolveNotFound() $this->imageResolver->resolve($path, 'some_filter'); } - public function resolveProvider() + public function resolveProvider(): array { return [ [ @@ -236,7 +237,7 @@ public function resolveProvider() ]; } - public function testStore() + public function testStore(): void { $filter = 'thumbnail'; $path = 'Tardis/bigger/in-the-inside/RiverSong.jpg'; @@ -256,7 +257,7 @@ public function testStore() $this->imageResolver->store($binary, $path, $filter); } - public function testRemoveEmptyFilters() + public function testRemoveEmptyFilters(): void { $originalPath = 'foo/bar/test.jpg'; $filters = ['filter1' => true, 'filter2' => true, 'chaud_cacao' => true]; @@ -309,7 +310,7 @@ public function testRemoveEmptyFilters() $this->imageResolver->remove([$originalPath], []); } - public function testRemoveWithFilters() + public function testRemoveWithFilters(): void { $originalPath = 'foo/bar/test.jpg'; $filters = ['filter1', 'filter2', 'chaud_cacao']; diff --git a/tests/bundle/Core/Imagine/ImageAsset/AliasGeneratorTest.php b/tests/bundle/Core/Imagine/ImageAsset/AliasGeneratorTest.php index dac3ff147d..c780344d34 100644 --- a/tests/bundle/Core/Imagine/ImageAsset/AliasGeneratorTest.php +++ b/tests/bundle/Core/Imagine/ImageAsset/AliasGeneratorTest.php @@ -17,21 +17,22 @@ use Ibexa\Core\FieldType\ImageAsset; use Ibexa\Core\Repository\Values\Content\Content; use Ibexa\Core\Repository\Values\Content\VersionInfo; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class AliasGeneratorTest extends TestCase { /** @var \Ibexa\Bundle\Core\Imagine\ImageAsset\AliasGenerator */ - private $aliasGenerator; + private AliasGenerator $aliasGenerator; /** @var \Ibexa\Contracts\Core\Variation\VariationHandler|\PHPUnit\Framework\MockObject\MockObject */ - private $innerAliasGenerator; + private MockObject $innerAliasGenerator; /** @var \Ibexa\Contracts\Core\Repository\ContentService|\PHPUnit\Framework\MockObject\MockObject */ - private $contentService; + private MockObject $contentService; /** @var \Ibexa\Core\FieldType\ImageAsset\AssetMapper|\PHPUnit\Framework\MockObject\MockObject */ - private $assetMapper; + private MockObject $assetMapper; protected function setUp(): void { @@ -46,7 +47,7 @@ protected function setUp(): void ); } - public function testGetVariationOfImageAsset() + public function testGetVariationOfImageAsset(): void { $assetField = new Field([ 'value' => new ImageAsset\Value(486), @@ -96,7 +97,7 @@ public function testGetVariationOfImageAsset() self::assertEquals($expectedVariation, $actualVariation); } - public function testGetVariationOfNonImageAsset() + public function testGetVariationOfNonImageAsset(): void { $imageField = new Field([ 'value' => new Image\Value([ @@ -134,7 +135,7 @@ public function testGetVariationOfNonImageAsset() self::assertEquals($expectedVariation, $actualVariation); } - public function testSupport() + public function testSupport(): void { self::assertTrue($this->aliasGenerator->supportsValue(new ImageAsset\Value())); self::assertFalse($this->aliasGenerator->supportsValue(new Image\Value())); diff --git a/tests/bundle/Core/Imagine/PlaceholderAliasGeneratorConfiguratorTest.php b/tests/bundle/Core/Imagine/PlaceholderAliasGeneratorConfiguratorTest.php index d1e84f2a66..cc00c7b838 100644 --- a/tests/bundle/Core/Imagine/PlaceholderAliasGeneratorConfiguratorTest.php +++ b/tests/bundle/Core/Imagine/PlaceholderAliasGeneratorConfiguratorTest.php @@ -24,7 +24,7 @@ class PlaceholderAliasGeneratorConfiguratorTest extends TestCase 'c' => 'C', ]; - public function testConfigure() + public function testConfigure(): void { $configResolver = $this->createMock(ConfigResolverInterface::class); $configResolver diff --git a/tests/bundle/Core/Imagine/PlaceholderAliasGeneratorTest.php b/tests/bundle/Core/Imagine/PlaceholderAliasGeneratorTest.php index 0feac2fa72..4876586811 100644 --- a/tests/bundle/Core/Imagine/PlaceholderAliasGeneratorTest.php +++ b/tests/bundle/Core/Imagine/PlaceholderAliasGeneratorTest.php @@ -24,27 +24,28 @@ use Ibexa\Core\IO\Values\BinaryFileCreateStruct; use Ibexa\Core\Repository\Values\Content\VersionInfo; use Liip\ImagineBundle\Exception\Imagine\Cache\Resolver\NotResolvableException; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class PlaceholderAliasGeneratorTest extends TestCase { /** @var \Ibexa\Bundle\Core\Imagine\PlaceholderAliasGenerator */ - private $aliasGenerator; + private PlaceholderAliasGenerator $aliasGenerator; /** @var \Ibexa\Contracts\Core\Variation\VariationHandler|\PHPUnit\Framework\MockObject\MockObject */ - private $innerAliasGenerator; + private MockObject $innerAliasGenerator; /** @var \Ibexa\Core\IO\IOServiceInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $ioService; + private MockObject $ioService; /** @var \Ibexa\Bundle\Core\Imagine\IORepositoryResolver|\PHPUnit\Framework\MockObject\MockObject */ - private $ioResolver; + private MockObject $ioResolver; /** @var \Ibexa\Bundle\Core\Imagine\PlaceholderProvider|\PHPUnit\Framework\MockObject\MockObject */ - private $placeholderProvider; + private MockObject $placeholderProvider; /** @var array */ - private $placeholderOptions; + private array $placeholderOptions; protected function setUp(): void { @@ -64,7 +65,7 @@ protected function setUp(): void ); } - public function testGetVariationWrongValue() + public function testGetVariationWrongValue(): void { $this->expectException(\InvalidArgumentException::class); @@ -82,7 +83,7 @@ public function testGetVariationWrongValue() /** * @dataProvider getVariationProvider */ - public function testGetVariationSkipsPlaceholderGeneration(Field $field, APIVersionInfo $versionInfo, string $variationName, array $parameters) + public function testGetVariationSkipsPlaceholderGeneration(Field $field, APIVersionInfo $versionInfo, string $variationName, array $parameters): void { $expectedVariation = $this->createMock(ImageVariation::class); @@ -115,7 +116,7 @@ public function testGetVariationSkipsPlaceholderGeneration(Field $field, APIVers /** * @dataProvider getVariationProvider */ - public function testGetVariationOriginalFound(Field $field, APIVersionInfo $versionInfo, string $variationName, array $parameters) + public function testGetVariationOriginalFound(Field $field, APIVersionInfo $versionInfo, string $variationName, array $parameters): void { $expectedVariation = $this->createMock(ImageVariation::class); @@ -148,7 +149,7 @@ public function testGetVariationOriginalFound(Field $field, APIVersionInfo $vers /** * @dataProvider getVariationProvider */ - public function testGetVariationOriginalNotFound(Field $field, APIVersionInfo $versionInfo, string $variationName, array $parameters) + public function testGetVariationOriginalNotFound(Field $field, APIVersionInfo $versionInfo, string $variationName, array $parameters): void { $placeholderPath = '/tmp/placeholder.jpg'; $binaryCreateStruct = new BinaryFileCreateStruct(); @@ -273,7 +274,7 @@ public function testGetVariationReturnsPlaceholderIfBinaryDataIsNotAvailable( /** * @dataProvider supportsValueProvider */ - public function testSupportsValue(Value $value, bool $isSupported) + public function testSupportsValue(Value $value, bool $isSupported): void { self::assertSame($isSupported, $this->aliasGenerator->supportsValue($value)); } diff --git a/tests/bundle/Core/Imagine/PlaceholderProvider/GenericProviderTest.php b/tests/bundle/Core/Imagine/PlaceholderProvider/GenericProviderTest.php index def720c8ad..f73e559cc1 100644 --- a/tests/bundle/Core/Imagine/PlaceholderProvider/GenericProviderTest.php +++ b/tests/bundle/Core/Imagine/PlaceholderProvider/GenericProviderTest.php @@ -22,7 +22,7 @@ class GenericProviderTest extends TestCase /** * @dataProvider getPlaceholderDataProvider */ - public function testGetPlaceholder(ImageValue $value, $expectedText, array $options = []) + public function testGetPlaceholder(ImageValue $value, string $expectedText, array $options = []): void { $font = $this->createMock(AbstractFont::class); @@ -30,7 +30,7 @@ public function testGetPlaceholder(ImageValue $value, $expectedText, array $opti $imagine ->expects(self::atLeastOnce()) ->method('font') - ->willReturnCallback(function ($fontpath, $fontsize, ColorInterface $foreground) use ($options, $font) { + ->willReturnCallback(function ($fontpath, $fontsize, ColorInterface $foreground) use ($options, $font): \PHPUnit\Framework\MockObject\MockObject { $this->assertEquals($options['fontpath'], $fontpath); $this->assertEquals($options['fontsize'], $fontsize); $this->assertColorEquals($options['foreground'], $foreground); @@ -48,7 +48,7 @@ public function testGetPlaceholder(ImageValue $value, $expectedText, array $opti $imagine ->expects(self::atLeastOnce()) ->method('create') - ->willReturnCallback(function (BoxInterface $size, ColorInterface $background) use ($value, $options, $image) { + ->willReturnCallback(function (BoxInterface $size, ColorInterface $background) use ($value, $options, $image): \PHPUnit\Framework\MockObject\MockObject { $this->assertSizeEquals([$value->width, $value->height], $size); $this->assertColorEquals($options['background'], $background); @@ -70,7 +70,7 @@ public function testGetPlaceholder(ImageValue $value, $expectedText, array $opti $provider->getPlaceholder($value, $options); } - public function getPlaceholderDataProvider() + public function getPlaceholderDataProvider(): array { return [ [ @@ -91,13 +91,13 @@ public function getPlaceholderDataProvider() ]; } - private function assertSizeEquals(array $expected, BoxInterface $actual) + private function assertSizeEquals(array $expected, BoxInterface $actual): void { self::assertEquals($expected[0], $actual->getWidth()); self::assertEquals($expected[1], $actual->getHeight()); } - private function assertColorEquals($expected, ColorInterface $actual) + private function assertColorEquals($expected, ColorInterface $actual): void { self::assertEquals(strtolower($expected), strtolower((string)$actual)); } diff --git a/tests/bundle/Core/Imagine/PlaceholderProviderRegistryTest.php b/tests/bundle/Core/Imagine/PlaceholderProviderRegistryTest.php index c5b421f6a3..e274026c54 100644 --- a/tests/bundle/Core/Imagine/PlaceholderProviderRegistryTest.php +++ b/tests/bundle/Core/Imagine/PlaceholderProviderRegistryTest.php @@ -22,7 +22,7 @@ class PlaceholderProviderRegistryTest extends TestCase /** * @depends testGetProviderKnown */ - public function testConstructor() + public function testConstructor(): void { $providers = [ self::FOO => $this->getPlaceholderProviderMock(), @@ -48,7 +48,7 @@ public function testAddProvider(): void self::assertSame($provider, $registry->getProvider(self::FOO)); } - public function testSupports() + public function testSupports(): void { $registry = new PlaceholderProviderRegistry([ 'supported' => $this->getPlaceholderProviderMock(), @@ -58,7 +58,7 @@ public function testSupports() self::assertFalse($registry->supports('unsupported')); } - public function testGetProviderKnown() + public function testGetProviderKnown(): void { $provider = $this->getPlaceholderProviderMock(); @@ -69,7 +69,7 @@ public function testGetProviderKnown() self::assertEquals($provider, $registry->getProvider(self::FOO)); } - public function testGetProviderUnknown() + public function testGetProviderUnknown(): void { $this->expectException(\InvalidArgumentException::class); diff --git a/tests/bundle/Core/Imagine/VariationPathGenerator/AliasDirectoryVariationPathGeneratorTest.php b/tests/bundle/Core/Imagine/VariationPathGenerator/AliasDirectoryVariationPathGeneratorTest.php index fa6ecbec97..45b8288d21 100644 --- a/tests/bundle/Core/Imagine/VariationPathGenerator/AliasDirectoryVariationPathGeneratorTest.php +++ b/tests/bundle/Core/Imagine/VariationPathGenerator/AliasDirectoryVariationPathGeneratorTest.php @@ -12,7 +12,7 @@ class AliasDirectoryVariationPathGeneratorTest extends TestCase { - public function testGetVariationPath() + public function testGetVariationPath(): void { $generator = new AliasDirectoryVariationPathGenerator(); diff --git a/tests/bundle/Core/Imagine/VariationPathGenerator/OriginalDirectoryVariationPathGeneratorTest.php b/tests/bundle/Core/Imagine/VariationPathGenerator/OriginalDirectoryVariationPathGeneratorTest.php index 88edae38c2..5c3dcc9f87 100644 --- a/tests/bundle/Core/Imagine/VariationPathGenerator/OriginalDirectoryVariationPathGeneratorTest.php +++ b/tests/bundle/Core/Imagine/VariationPathGenerator/OriginalDirectoryVariationPathGeneratorTest.php @@ -12,7 +12,7 @@ class OriginalDirectoryVariationPathGeneratorTest extends TestCase { - public function testGetVariationPath() + public function testGetVariationPath(): void { $generator = new OriginalDirectoryVariationPathGenerator(); self::assertEquals( diff --git a/tests/bundle/Core/Imagine/VariationPurger/ImageFileVariationPurgerTest.php b/tests/bundle/Core/Imagine/VariationPurger/ImageFileVariationPurgerTest.php index 66111770e4..10c40d91b8 100644 --- a/tests/bundle/Core/Imagine/VariationPurger/ImageFileVariationPurgerTest.php +++ b/tests/bundle/Core/Imagine/VariationPurger/ImageFileVariationPurgerTest.php @@ -12,15 +12,16 @@ use Ibexa\Contracts\Core\Variation\VariationPathGenerator; use Ibexa\Core\IO\IOServiceInterface; use Ibexa\Core\IO\Values\BinaryFile; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ImageFileVariationPurgerTest extends TestCase { /** @var \Ibexa\Core\IO\IOServiceInterface|\PHPUnit\Framework\MockObject\MockObject */ - protected $ioServiceMock; + protected MockObject $ioServiceMock; /** @var \Ibexa\Contracts\Core\Variation\VariationPathGenerator|\PHPUnit\Framework\MockObject\MockObject */ - protected $pathGeneratorMock; + protected MockObject $pathGeneratorMock; /** @var \Ibexa\Bundle\Core\Imagine\VariationPurger\ImageFileVariationPurger */ protected $purger; @@ -31,7 +32,7 @@ protected function setUp(): void $this->pathGeneratorMock = $this->createMock(VariationPathGenerator::class); } - public function testIteratesOverItems() + public function testIteratesOverItems(): void { $purger = $this->createPurger( [ @@ -53,7 +54,7 @@ public function testIteratesOverItems() $purger->purge(['large', 'gallery']); } - public function testPurgesExistingItem() + public function testPurgesExistingItem(): void { $purger = $this->createPurger( ['path/to/file.png'] @@ -82,7 +83,7 @@ public function testPurgesExistingItem() $purger->purge(['large']); } - public function testDoesNotPurgeNotExistingItem() + public function testDoesNotPurgeNotExistingItem(): void { $purger = $this->createPurger( ['path/to/file.png'] @@ -109,7 +110,7 @@ public function testDoesNotPurgeNotExistingItem() $purger->purge(['large']); } - private function createPurger(array $fileList) + private function createPurger(array $fileList): ImageFileVariationPurger { return new ImageFileVariationPurger(new ArrayIterator($fileList), $this->ioServiceMock, $this->pathGeneratorMock); } diff --git a/tests/bundle/Core/Imagine/VariationPurger/LegacyStorageImageFileListTest.php b/tests/bundle/Core/Imagine/VariationPurger/LegacyStorageImageFileListTest.php index 73b77a6638..74dd6c18f7 100644 --- a/tests/bundle/Core/Imagine/VariationPurger/LegacyStorageImageFileListTest.php +++ b/tests/bundle/Core/Imagine/VariationPurger/LegacyStorageImageFileListTest.php @@ -12,21 +12,22 @@ use Ibexa\Bundle\Core\Imagine\VariationPurger\LegacyStorageImageFileList; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\IO\IOConfigProvider; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class LegacyStorageImageFileListTest extends TestCase { /** @var \Ibexa\Bundle\Core\Imagine\VariationPurger\ImageFileRowReader|\PHPUnit\Framework\MockObject\MockObject */ - protected $rowReaderMock; + protected MockObject $rowReaderMock; /** @var \Ibexa\Bundle\Core\Imagine\VariationPurger\LegacyStorageImageFileList */ protected $fileList; /** @var \Ibexa\Core\IO\IOConfigProvider|\PHPUnit\Framework\MockObject\MockObject */ - private $ioConfigResolverMock; + private MockObject $ioConfigResolverMock; /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $configResolverMock; + private MockObject $configResolverMock; protected function setUp(): void { @@ -48,7 +49,7 @@ protected function setUp(): void ); } - public function testIterator() + public function testIterator(): void { $expected = [ 'path/to/1st/image.jpg', @@ -64,7 +65,7 @@ public function testIterator() /** * Tests that the iterator transforms the ezimagefile value into a binaryfile id. */ - public function testImageIdTransformation() + public function testImageIdTransformation(): void { $this->configureRowReaderMock(['var/ibexa_demo_site/storage/images/path/to/1st/image.jpg']); foreach ($this->fileList as $file) { @@ -72,7 +73,7 @@ public function testImageIdTransformation() } } - private function configureRowReaderMock(array $fileList) + private function configureRowReaderMock(array $fileList): void { $mockInvocator = $this->rowReaderMock->expects(self::any())->method('getRow'); call_user_func_array([$mockInvocator, 'willReturnOnConsecutiveCalls'], $fileList); diff --git a/tests/bundle/Core/Routing/DefaultRouterTest.php b/tests/bundle/Core/Routing/DefaultRouterTest.php index cd3a45a3a3..816489fe23 100644 --- a/tests/bundle/Core/Routing/DefaultRouterTest.php +++ b/tests/bundle/Core/Routing/DefaultRouterTest.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest; use Ibexa\Core\MVC\Symfony\SiteAccess; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use ReflectionObject; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -23,10 +24,10 @@ class DefaultRouterTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\DependencyInjection\ContainerInterface */ - protected $container; + protected MockObject $container; /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - protected $configResolver; + protected MockObject $configResolver; /** @var \Symfony\Component\Routing\RequestContext */ protected $requestContext; @@ -65,7 +66,7 @@ protected function generateRouter(array $mockedMethods = []) return $router; } - public function testMatchRequestWithSemanticPathinfo() + public function testMatchRequestWithSemanticPathinfo(): void { $pathinfo = '/siteaccess/foo/bar'; $semanticPathinfo = '/foo/bar'; @@ -90,7 +91,7 @@ public function testMatchRequestWithSemanticPathinfo() self::assertSame($matchedParameters, $router->matchRequest($request)); } - public function testMatchRequestRegularPathinfo() + public function testMatchRequestRegularPathinfo(): void { $matchedParameters = ['_controller' => 'AcmeBundle:myAction']; $pathinfo = '/siteaccess/foo/bar'; @@ -119,7 +120,7 @@ public function testMatchRequestRegularPathinfo() /** * @dataProvider providerGenerateNoSiteAccess */ - public function testGenerateNoSiteAccess($url) + public function testGenerateNoSiteAccess(string $url): void { $generator = $this->createMock(UrlGeneratorInterface::class); $generator @@ -138,7 +139,7 @@ public function testGenerateNoSiteAccess($url) self::assertSame($url, $router->generate(__METHOD__)); } - public function providerGenerateNoSiteAccess() + public function providerGenerateNoSiteAccess(): array { return [ ['/foo/bar'], @@ -159,7 +160,7 @@ public function providerGenerateNoSiteAccess() * @param int $referenceType The type of reference to be generated (one of the constants) * @param string $routeName */ - public function testGenerateWithSiteAccess($urlGenerated, $relevantUri, $expectedUrl, $saName, $isMatcherLexer, $referenceType, $routeName) + public function testGenerateWithSiteAccess(string $urlGenerated, string $relevantUri, string $expectedUrl, string $saName, bool $isMatcherLexer, int $referenceType, ?string $routeName): void { $routeName = $routeName ?: __METHOD__; $nonSiteAccessAwareRoutes = ['_dontwantsiteaccess']; @@ -220,7 +221,7 @@ public function testGenerateWithSiteAccess($urlGenerated, $relevantUri, $expecte self::assertSame($expectedUrl, $router->generate($routeName, [], $referenceType)); } - public function providerGenerateWithSiteAccess() + public function providerGenerateWithSiteAccess(): array { return [ ['/foo/bar', '/foo/bar', '/foo/bar', 'test_siteaccess', false, UrlGeneratorInterface::ABSOLUTE_PATH, null], @@ -238,7 +239,7 @@ public function providerGenerateWithSiteAccess() ]; } - public function testGenerateReverseSiteAccessMatch() + public function testGenerateReverseSiteAccessMatch(): void { $routeName = 'some_route_name'; $urlGenerated = 'http://phoenix-rises.fm/foo/bar'; @@ -292,7 +293,7 @@ public function testGenerateReverseSiteAccessMatch() * * @param string $uri */ - public function testGetContextBySimplifiedRequest($uri) + public function testGetContextBySimplifiedRequest(string $uri): void { $this->getExpectedRequestContext($uri); @@ -311,7 +312,7 @@ public function testGetContextBySimplifiedRequest($uri) * * @phpstan-return array */ - public function providerGetContextBySimplifiedRequest() + public function providerGetContextBySimplifiedRequest(): array { return [ ['/foo/bar'], @@ -323,7 +324,7 @@ public function providerGetContextBySimplifiedRequest() ]; } - private function getExpectedRequestContext($uri) + private function getExpectedRequestContext(string $uri): RequestContext { $requestContext = new RequestContext(); $uriComponents = parse_url($uri); diff --git a/tests/bundle/Core/Routing/UrlAliasRouterTest.php b/tests/bundle/Core/Routing/UrlAliasRouterTest.php index e3eb1d401e..15787b4e81 100644 --- a/tests/bundle/Core/Routing/UrlAliasRouterTest.php +++ b/tests/bundle/Core/Routing/UrlAliasRouterTest.php @@ -18,13 +18,14 @@ use Ibexa\Core\MVC\Symfony\View\Manager as ViewManager; use Ibexa\Core\Repository\Values\Content\Location; use Ibexa\Tests\Core\MVC\Symfony\Routing\UrlAliasRouterTest as BaseUrlAliasRouterTest; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\RequestContext; class UrlAliasRouterTest extends BaseUrlAliasRouterTest { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $configResolver; + private MockObject $configResolver; protected function setUp(): void { @@ -44,7 +45,7 @@ protected function setUp(): void parent::setUp(); } - protected function getRouter(LocationService $locationService, URLAliasService $urlAliasService, ContentService $contentService, UrlAliasGenerator $urlAliasGenerator, RequestContext $requestContext) + protected function getRouter(LocationService $locationService, URLAliasService $urlAliasService, ContentService $contentService, UrlAliasGenerator $urlAliasGenerator, RequestContext $requestContext): UrlAliasRouter { $router = new UrlAliasRouter($locationService, $urlAliasService, $contentService, $urlAliasGenerator, $requestContext); $router->setConfigResolver($this->configResolver); @@ -61,7 +62,7 @@ protected function resetConfigResolver() $this->router->setConfigResolver($this->configResolver); } - public function testMatchRequestDeactivatedUrlAlias() + public function testMatchRequestDeactivatedUrlAlias(): void { $this->expectException(ResourceNotFoundException::class); @@ -79,7 +80,7 @@ public function testMatchRequestDeactivatedUrlAlias() $this->router->matchRequest($this->getRequestByPathInfo('/foo')); } - public function testMatchRequestWithRootLocation() + public function testMatchRequestWithRootLocation(): void { $rootLocationId = 123; $this->resetConfigResolver(); @@ -135,7 +136,7 @@ public function testMatchRequestWithRootLocation() self::assertEquals($expected, $this->router->matchRequest($request)); } - public function testMatchRequestLocationCaseRedirectWithRootLocation() + public function testMatchRequestLocationCaseRedirectWithRootLocation(): void { $rootLocationId = 123; $this->resetConfigResolver(); @@ -193,7 +194,7 @@ public function testMatchRequestLocationCaseRedirectWithRootLocation() self::assertEquals($expected, $this->router->matchRequest($request)); } - public function testMatchRequestLocationCaseRedirectWithRootRootLocation() + public function testMatchRequestLocationCaseRedirectWithRootRootLocation(): void { $rootLocationId = 123; $this->resetConfigResolver(); @@ -251,7 +252,7 @@ public function testMatchRequestLocationCaseRedirectWithRootRootLocation() self::assertEquals($expected, $this->router->matchRequest($request)); } - public function testMatchRequestResourceCaseRedirectWithRootLocation() + public function testMatchRequestResourceCaseRedirectWithRootLocation(): void { $rootLocationId = 123; $this->resetConfigResolver(); @@ -299,7 +300,7 @@ public function testMatchRequestResourceCaseRedirectWithRootLocation() self::assertEquals($expected, $this->router->matchRequest($request)); } - public function testMatchRequestVirtualCaseRedirectWithRootLocation() + public function testMatchRequestVirtualCaseRedirectWithRootLocation(): void { $rootLocationId = 123; $this->resetConfigResolver(); @@ -345,7 +346,7 @@ public function testMatchRequestVirtualCaseRedirectWithRootLocation() self::assertEquals($expected, $this->router->matchRequest($request)); } - public function testMatchRequestWithRootLocationAndExclusion() + public function testMatchRequestWithRootLocationAndExclusion(): void { $this->resetConfigResolver(); $this->configResolver @@ -373,7 +374,7 @@ public function testMatchRequestWithRootLocationAndExclusion() $urlAlias = new URLAlias( [ 'path' => $pathInfo, - 'type' => UrlAlias::LOCATION, + 'type' => URLAlias::LOCATION, 'destination' => $destinationId, 'isHistory' => false, ] diff --git a/tests/bundle/Core/SiteAccess/Config/IOConfigResolverTest.php b/tests/bundle/Core/SiteAccess/Config/IOConfigResolverTest.php index cf6b8a1586..04456c055f 100644 --- a/tests/bundle/Core/SiteAccess/Config/IOConfigResolverTest.php +++ b/tests/bundle/Core/SiteAccess/Config/IOConfigResolverTest.php @@ -13,6 +13,7 @@ use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\MVC\Symfony\SiteAccess; use Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessService; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -23,10 +24,10 @@ class IOConfigResolverTest extends TestCase private const DEFAULT_NAMESPACE = 'ibexa.site_access.config'; /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $configResolver; + private MockObject $configResolver; /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessService|\PHPUnit\Framework\MockObject\MockObject */ - private $siteAccessService; + private MockObject $siteAccessService; protected function setUp(): void { diff --git a/tests/bundle/Core/SiteAccess/MatcherBuilderTest.php b/tests/bundle/Core/SiteAccess/MatcherBuilderTest.php index 66bc2bebab..f00c99e9a2 100644 --- a/tests/bundle/Core/SiteAccess/MatcherBuilderTest.php +++ b/tests/bundle/Core/SiteAccess/MatcherBuilderTest.php @@ -12,6 +12,7 @@ use Ibexa\Bundle\Core\SiteAccess\SiteAccessMatcherRegistryInterface; use Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest; use Ibexa\Core\MVC\Symfony\SiteAccess\Matcher; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -20,7 +21,7 @@ class MatcherBuilderTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $siteAccessMatcherRegistry; + private MockObject $siteAccessMatcherRegistry; protected function setUp(): void { @@ -28,7 +29,7 @@ protected function setUp(): void $this->siteAccessMatcherRegistry = $this->createMock(SiteAccessMatcherRegistryInterface::class); } - public function testBuildMatcherNoService() + public function testBuildMatcherNoService(): void { $this->siteAccessMatcherRegistry ->expects(self::never()) @@ -39,7 +40,7 @@ public function testBuildMatcherNoService() self::assertInstanceOf(get_class($matcher), $builtMatcher); } - public function testBuildMatcherServiceWrongInterface() + public function testBuildMatcherServiceWrongInterface(): void { $this->expectException(\TypeError::class); @@ -53,7 +54,7 @@ public function testBuildMatcherServiceWrongInterface() $matcherBuilder->buildMatcher("@$serviceId", [], new SimplifiedRequest()); } - public function testBuildMatcherService() + public function testBuildMatcherService(): void { $serviceId = 'foo'; $matcher = $this->createMock(CoreMatcher::class); diff --git a/tests/bundle/Core/URLChecker/URLCheckerTest.php b/tests/bundle/Core/URLChecker/URLCheckerTest.php index e0d6be90ec..dcbc435af2 100644 --- a/tests/bundle/Core/URLChecker/URLCheckerTest.php +++ b/tests/bundle/Core/URLChecker/URLCheckerTest.php @@ -15,19 +15,20 @@ use Ibexa\Contracts\Core\Repository\Values\URL\URL; use Ibexa\Contracts\Core\Repository\Values\URL\URLQuery; use Ibexa\Contracts\Core\Repository\Values\URL\URLUpdateStruct; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; class URLCheckerTest extends TestCase { /** @var \Ibexa\Contracts\Core\Repository\URLService|\PHPUnit\Framework\MockObject\MockObject */ - private $urlService; + private MockObject $urlService; /** @var \Ibexa\Bundle\Core\URLChecker\URLHandlerRegistryInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $handlerRegistry; + private MockObject $handlerRegistry; /** @var \Psr\Log\LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $logger; + private MockObject $logger; protected function setUp(): void { @@ -35,7 +36,7 @@ protected function setUp(): void $this->urlService ->expects(self::any()) ->method('createUpdateStruct') - ->willReturnCallback(static function () { + ->willReturnCallback(static function (): URLUpdateStruct { return new URLUpdateStruct(); }); @@ -43,7 +44,7 @@ protected function setUp(): void $this->logger = $this->createMock(LoggerInterface::class); } - public function testCheck() + public function testCheck(): void { $query = new URLQuery(); $groups = $this->createGroupedUrls(['http', 'https']); @@ -63,7 +64,7 @@ public function testCheck() $handler ->expects(self::once()) ->method('validate') - ->willReturnCallback(function (array $urls) use ($scheme, $groups) { + ->willReturnCallback(function (array $urls) use ($scheme, $groups): void { $this->assertEqualsCanonicalizing($groups[$scheme], $urls); }); } @@ -74,7 +75,7 @@ public function testCheck() $urlChecker->check($query); } - public function testCheckUnsupported() + public function testCheckUnsupported(): void { $query = new URLQuery(); $groups = $this->createGroupedUrls(['http', 'https'], 10); @@ -98,7 +99,7 @@ public function testCheckUnsupported() $handler ->expects(self::once()) ->method('validate') - ->willReturnCallback(function (array $urls) use ($scheme, $groups) { + ->willReturnCallback(function (array $urls) use ($scheme, $groups): void { $this->assertEqualsCanonicalizing($groups[$scheme], $urls); }); } @@ -109,7 +110,7 @@ public function testCheckUnsupported() $urlChecker->check($query); } - private function configureUrlHandlerRegistry(array $schemes) + private function configureUrlHandlerRegistry(array $schemes): void { $this->handlerRegistry ->method('supported') @@ -124,7 +125,7 @@ private function configureUrlHandlerRegistry(array $schemes) }); } - private function createSearchResults(array &$urls) + private function createSearchResults(array &$urls): SearchResult { $input = array_reduce($urls, 'array_merge', []); @@ -136,7 +137,10 @@ private function createSearchResults(array &$urls) ]); } - private function createGroupedUrls(array $schemes, $n = 10) + /** + * @return \list<\Ibexa\Contracts\Core\Repository\Values\URL\URL>[] + */ + private function createGroupedUrls(array $schemes, int $n = 10): array { $results = []; @@ -156,7 +160,7 @@ private function createGroupedUrls(array $schemes, $n = 10) /** * @return \Ibexa\Bundle\Core\URLChecker\URLChecker */ - private function createUrlChecker() + private function createUrlChecker(): URLChecker { $urlChecker = new URLChecker( $this->urlService, diff --git a/tests/bundle/Debug/Collector/IbexaCoreCollectorTest.php b/tests/bundle/Debug/Collector/IbexaCoreCollectorTest.php index 01cda5dd7e..26ce28e321 100644 --- a/tests/bundle/Debug/Collector/IbexaCoreCollectorTest.php +++ b/tests/bundle/Debug/Collector/IbexaCoreCollectorTest.php @@ -9,6 +9,7 @@ use Exception; use Ibexa\Bundle\Debug\Collector\IbexaCoreCollector; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -17,7 +18,7 @@ class IbexaCoreCollectorTest extends TestCase { /** @var \Ibexa\Bundle\Debug\Collector\IbexaCoreCollector */ - private $mainCollector; + private IbexaCoreCollector $mainCollector; protected function setUp(): void { @@ -25,7 +26,7 @@ protected function setUp(): void $this->mainCollector = new IbexaCoreCollector(); } - public function testAddGetCollector() + public function testAddGetCollector(): void { $collector = $this->getDataCollectorMock(); $name = 'foobar'; @@ -38,7 +39,7 @@ public function testAddGetCollector() self::assertSame($collector, $this->mainCollector->getCollector($name)); } - public function testGetInvalidCollector() + public function testGetInvalidCollector(): void { $this->expectException(\InvalidArgumentException::class); @@ -47,7 +48,7 @@ public function testGetInvalidCollector() self::assertSame($collector, $this->mainCollector->getCollector('foo')); } - public function testGetAllCollectors() + public function testGetAllCollectors(): void { $collector1 = $this->getDataCollectorMock(); $nameCollector1 = 'collector1'; @@ -74,7 +75,7 @@ public function testGetAllCollectors() self::assertSame($allCollectors, $this->mainCollector->getAllCollectors()); } - public function testGetToolbarTemplateNothing() + public function testGetToolbarTemplateNothing(): void { $collector = $this->getDataCollectorMock(); $name = 'foobar'; @@ -86,7 +87,7 @@ public function testGetToolbarTemplateNothing() self::assertNull($this->mainCollector->getToolbarTemplate($name)); } - public function testGetToolbarTemplate() + public function testGetToolbarTemplate(): void { $collector = $this->getDataCollectorMock(); $name = 'foobar'; @@ -100,7 +101,7 @@ public function testGetToolbarTemplate() self::assertSame($toolbarTemplate, $this->mainCollector->getToolbarTemplate($name)); } - public function testGetPanelTemplateNothing() + public function testGetPanelTemplateNothing(): void { $collector = $this->getDataCollectorMock(); $name = 'foobar'; @@ -112,7 +113,7 @@ public function testGetPanelTemplateNothing() self::assertNull($this->mainCollector->getPanelTemplate($name)); } - public function testGetPanelTemplate() + public function testGetPanelTemplate(): void { $collector = $this->getDataCollectorMock(); $name = 'foobar'; @@ -126,7 +127,7 @@ public function testGetPanelTemplate() self::assertSame($panelTemplate, $this->mainCollector->getPanelTemplate($name)); } - public function testCollect() + public function testCollect(): void { $collector1 = $this->getDataCollectorMock(); $nameCollector1 = 'collector1'; @@ -162,7 +163,7 @@ public function testCollect() $this->mainCollector->collect($request, $response, $exception); } - protected function getDataCollectorMock() + protected function getDataCollectorMock(): MockObject { return $this->createMock(DataCollectorInterface::class); } diff --git a/tests/bundle/Debug/DependencyInjection/Compiler/DataCollectorPassTest.php b/tests/bundle/Debug/DependencyInjection/Compiler/DataCollectorPassTest.php index 0969549e98..7e81394d77 100644 --- a/tests/bundle/Debug/DependencyInjection/Compiler/DataCollectorPassTest.php +++ b/tests/bundle/Debug/DependencyInjection/Compiler/DataCollectorPassTest.php @@ -27,7 +27,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void $container->addCompilerPass(new DataCollectorPass()); } - public function testAddCollector() + public function testAddCollector(): void { $panelTemplate = 'panel.html.twig'; $toolbarTemplate = 'toolbar.html.twig'; diff --git a/tests/bundle/IO/DependencyInjection/Compiler/IOConfigurationPassTest.php b/tests/bundle/IO/DependencyInjection/Compiler/IOConfigurationPassTest.php index 28855e616b..bde32bd420 100644 --- a/tests/bundle/IO/DependencyInjection/Compiler/IOConfigurationPassTest.php +++ b/tests/bundle/IO/DependencyInjection/Compiler/IOConfigurationPassTest.php @@ -11,6 +11,7 @@ use Ibexa\Bundle\IO\DependencyInjection\Compiler\IOConfigurationPass; use Ibexa\Bundle\IO\DependencyInjection\ConfigurationFactory; use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractCompilerPassTestCase; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; @@ -18,10 +19,10 @@ class IOConfigurationPassTest extends AbstractCompilerPassTestCase { /** @var \Ibexa\Bundle\IO\DependencyInjection\ConfigurationFactory|\PHPUnit\Framework\MockObject\MockObject */ - protected $metadataConfigurationFactoryMock; + protected ?MockObject $metadataConfigurationFactoryMock = null; /** @var \Ibexa\Bundle\IO\DependencyInjection\ConfigurationFactory|\PHPUnit\Framework\MockObject\MockObject */ - protected $binarydataConfigurationFactoryMock; + protected ?MockObject $binarydataConfigurationFactoryMock = null; protected function setUp(): void { @@ -55,7 +56,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void /** * Tests that the default handlers are available when nothing is configured. */ - public function testDefaultHandlers() + public function testDefaultHandlers(): void { $this->compile(); @@ -72,7 +73,7 @@ public function testDefaultHandlers() ); } - public function testBinarydataHandler() + public function testBinarydataHandler(): void { $this->container->setParameter( 'ibexa.io.binarydata_handlers', @@ -92,7 +93,7 @@ public function testBinarydataHandler() ); } - public function testMetadataHandler() + public function testMetadataHandler(): void { $this->container->setParameter( 'ibexa.io.metadata_handlers', @@ -112,7 +113,7 @@ public function testMetadataHandler() ); } - public function testUnknownMetadataHandler() + public function testUnknownMetadataHandler(): void { $this->expectException(InvalidConfigurationException::class); $this->expectExceptionMessage('Unknown handler'); @@ -125,7 +126,7 @@ public function testUnknownMetadataHandler() $this->compile(); } - public function testUnknownBinarydataHandler() + public function testUnknownBinarydataHandler(): void { $this->expectException(InvalidConfigurationException::class); $this->expectExceptionMessage('Unknown handler'); diff --git a/tests/bundle/IO/DependencyInjection/ConfigurationFactory/BaseFlysystemTest.php b/tests/bundle/IO/DependencyInjection/ConfigurationFactory/BaseFlysystemTest.php index 2544b5d773..098248bc04 100644 --- a/tests/bundle/IO/DependencyInjection/ConfigurationFactory/BaseFlysystemTest.php +++ b/tests/bundle/IO/DependencyInjection/ConfigurationFactory/BaseFlysystemTest.php @@ -13,9 +13,9 @@ abstract class BaseFlysystemTest extends ConfigurationFactoryTest { - private $flysystemAdapterServiceId = 'oneup_flysystem.test_adapter'; + private string $flysystemAdapterServiceId = 'oneup_flysystem.test_adapter'; - private $filesystemServiceId = 'ezpublish.core.io.flysystem.my_test_handler_filesystem'; + private string $filesystemServiceId = 'ezpublish.core.io.flysystem.my_test_handler_filesystem'; public function provideHandlerConfiguration() { @@ -31,7 +31,7 @@ public function provideParentServiceDefinition() return new Definition(null, [null]); } - public function validateConfiguredHandler($handlerDefinitionId) + public function validateConfiguredHandler($handlerDefinitionId): void { self::assertContainerBuilderHasServiceDefinitionWithArgument( $handlerDefinitionId, @@ -40,7 +40,7 @@ public function validateConfiguredHandler($handlerDefinitionId) ); } - public function validateConfiguredContainer() + public function validateConfiguredContainer(): void { self::assertContainerBuilderHasService( $this->filesystemServiceId diff --git a/tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/FlysystemTest.php b/tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/FlysystemTest.php index fb745f670d..fc1072a76d 100644 --- a/tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/FlysystemTest.php +++ b/tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/FlysystemTest.php @@ -16,7 +16,7 @@ class FlysystemTest * * @return \Ibexa\Bundle\IO\DependencyInjection\ConfigurationFactory\MetadataHandler\Flysystem */ - public function provideTestedFactory() + public function provideTestedFactory(): Flysystem { return new Flysystem(); } diff --git a/tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSClusterTest.php b/tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSClusterTest.php index 384e18f1df..8d7ac71a44 100644 --- a/tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSClusterTest.php +++ b/tests/bundle/IO/DependencyInjection/ConfigurationFactory/MetadataHandler/LegacyDFSClusterTest.php @@ -18,7 +18,7 @@ class LegacyDFSClusterTest extends ConfigurationFactoryTest * * @return \Ibexa\Bundle\IO\DependencyInjection\ConfigurationFactory */ - public function provideTestedFactory() + public function provideTestedFactory(): LegacyDFSCluster { return new LegacyDFSCluster(); } @@ -28,12 +28,12 @@ public function provideExpectedParentServiceId(): string return \Ibexa\Core\IO\IOMetadataHandler\LegacyDFSCluster::class; } - public function provideParentServiceDefinition() + public function provideParentServiceDefinition(): Definition { return new Definition(null, [null]); } - public function provideHandlerConfiguration() + public function provideHandlerConfiguration(): array { return ['connection' => 'doctrine.dbal.test_connection']; } @@ -45,7 +45,7 @@ public function provideHandlerConfiguration() * * @param string $handlerServiceId id of the service that was registered by the compiler pass */ - public function validateConfiguredHandler($handlerServiceId) + public function validateConfiguredHandler($handlerServiceId): void { self::assertContainerBuilderHasServiceDefinitionWithArgument( $handlerServiceId, diff --git a/tests/bundle/IO/DependencyInjection/ConfigurationFactoryTest.php b/tests/bundle/IO/DependencyInjection/ConfigurationFactoryTest.php index 6058496e9d..837c1f45d6 100644 --- a/tests/bundle/IO/DependencyInjection/ConfigurationFactoryTest.php +++ b/tests/bundle/IO/DependencyInjection/ConfigurationFactoryTest.php @@ -35,7 +35,7 @@ protected function setUp(): void } } - public function testGetParentServiceId() + public function testGetParentServiceId(): void { self::assertEquals( $this->provideExpectedParentServiceId(), @@ -43,7 +43,7 @@ public function testGetParentServiceId() ); } - public function testAddConfiguration() + public function testAddConfiguration(): void { $node = new ArrayNodeDefinition('handler'); $this->factory->addConfiguration($node); @@ -52,7 +52,7 @@ public function testAddConfiguration() // @todo customized testing of configuration node ? } - public function testConfigureHandler() + public function testConfigureHandler(): void { $handlerConfiguration = $this->provideHandlerConfiguration($this->container) + diff --git a/tests/bundle/IO/DependencyInjection/IbexaIOExtensionTest.php b/tests/bundle/IO/DependencyInjection/IbexaIOExtensionTest.php index ea3f5356b2..984e4f1d9c 100644 --- a/tests/bundle/IO/DependencyInjection/IbexaIOExtensionTest.php +++ b/tests/bundle/IO/DependencyInjection/IbexaIOExtensionTest.php @@ -31,7 +31,7 @@ protected function getContainerExtensions(): array return [$extension]; } - public function testParametersWithoutConfiguration() + public function testParametersWithoutConfiguration(): void { $this->load(); @@ -39,7 +39,7 @@ public function testParametersWithoutConfiguration() $this->assertContainerBuilderHasParameter('ibexa.io.binarydata_handlers', []); } - public function testParametersWithMetadataHandler() + public function testParametersWithMetadataHandler(): void { $config = [ 'metadata_handlers' => [ @@ -55,7 +55,7 @@ public function testParametersWithMetadataHandler() ); } - public function testParametersWithBinarydataHandler() + public function testParametersWithBinarydataHandler(): void { $config = [ 'binarydata_handlers' => [ diff --git a/tests/bundle/IO/Migration/FileMigratorTest.php b/tests/bundle/IO/Migration/FileMigratorTest.php index 34e1dcb176..c98cef10b2 100644 --- a/tests/bundle/IO/Migration/FileMigratorTest.php +++ b/tests/bundle/IO/Migration/FileMigratorTest.php @@ -14,30 +14,31 @@ use Ibexa\Contracts\Core\IO\BinaryFile; use Ibexa\Core\IO\IOBinarydataHandler; use Ibexa\Core\IO\IOMetadataHandler; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; final class FileMigratorTest extends TestCase { /** @var \Ibexa\Bundle\IO\ApiLoader\HandlerRegistry|\PHPUnit\Framework\MockObject\MockObject */ - private $metadataHandlerRegistry; + private MockObject $metadataHandlerRegistry; /** @var \Ibexa\Bundle\IO\ApiLoader\HandlerRegistry|\PHPUnit\Framework\MockObject\MockObject */ - private $binaryHandlerRegistry; + private MockObject $binaryHandlerRegistry; /** @var \Ibexa\Bundle\IO\Migration\FileMigratorInterface */ - private $fileMigrator; + private FileMigrator $fileMigrator; /** @var \Ibexa\Core\IO\IOMetadataHandler\Flysystem */ - private $metadataFlysystem; + private MockObject $metadataFlysystem; /** @var \Ibexa\Core\IO\IOMetadataHandler\LegacyDFSCluster */ - private $metadataLegacyDFSCluster; + private MockObject $metadataLegacyDFSCluster; /** @var \Ibexa\Core\IO\IOBinarydataHandler\Flysystem */ - private $binaryFlysystemFrom; + private MockObject $binaryFlysystemFrom; /** @var \Ibexa\Core\IO\IOBinarydataHandler\Flysystem */ - private $binaryFlysystemTo; + private MockObject $binaryFlysystemTo; protected function setUp(): void { diff --git a/tests/integration/Core/BinaryBase/BinaryBaseStorage/BinaryBaseStorageTest.php b/tests/integration/Core/BinaryBase/BinaryBaseStorage/BinaryBaseStorageTest.php index 2386599759..6f4e3c08b9 100644 --- a/tests/integration/Core/BinaryBase/BinaryBaseStorage/BinaryBaseStorageTest.php +++ b/tests/integration/Core/BinaryBase/BinaryBaseStorage/BinaryBaseStorageTest.php @@ -32,13 +32,13 @@ class BinaryBaseStorageTest extends BaseCoreFieldTypeIntegrationTest protected PathGeneratorInterface&MockObject $pathGeneratorMock; /** @var \Ibexa\Core\IO\IOServiceInterface|\PHPUnit\Framework\MockObject\MockObject */ - protected $ioServiceMock; + protected MockObject $ioServiceMock; /** @var \Ibexa\Core\FieldType\BinaryBase\BinaryBaseStorage|\PHPUnit\Framework\MockObject\MockObject */ - protected $storage; + protected MockObject $storage; /** @var \Ibexa\Core\FieldType\Validator\FileExtensionBlackListValidator&\PHPUnit\Framework\MockObject\MockObject */ - protected $fileExtensionBlackListValidatorMock; + protected MockObject $fileExtensionBlackListValidatorMock; protected function setUp(): void { diff --git a/tests/integration/Core/FieldType/FieldConstraintsStorage/Stub/ExampleFieldType.php b/tests/integration/Core/FieldType/FieldConstraintsStorage/Stub/ExampleFieldType.php index d786ac5fa9..75b3ea4a69 100644 --- a/tests/integration/Core/FieldType/FieldConstraintsStorage/Stub/ExampleFieldType.php +++ b/tests/integration/Core/FieldType/FieldConstraintsStorage/Stub/ExampleFieldType.php @@ -46,7 +46,7 @@ protected function checkValueStructure(Value $value): void // Nothing to do here. } - public function toHash(Value $value) + public function toHash(Value $value): null { return null; } diff --git a/tests/integration/Core/Image/ImageStorage/ImageStorageTest.php b/tests/integration/Core/Image/ImageStorage/ImageStorageTest.php index a283a4be03..91f19ef984 100644 --- a/tests/integration/Core/Image/ImageStorage/ImageStorageTest.php +++ b/tests/integration/Core/Image/ImageStorage/ImageStorageTest.php @@ -23,32 +23,33 @@ use Ibexa\Core\IO\Values\BinaryFile; use Ibexa\Core\IO\Values\BinaryFileCreateStruct; use Ibexa\Tests\Integration\Core\BaseCoreFieldTypeIntegrationTest; +use PHPUnit\Framework\MockObject\MockObject; final class ImageStorageTest extends BaseCoreFieldTypeIntegrationTest { /** @var \Ibexa\Core\FieldType\Image\ImageStorage\Gateway */ - private $gateway; + private DoctrineStorage $gateway; /** @var \Ibexa\Core\IO\UrlRedecoratorInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $redecorator; + private MockObject $redecorator; /** @var \Ibexa\Core\FieldType\Image\PathGenerator|\PHPUnit\Framework\MockObject\MockObject */ - private $pathGenerator; + private MockObject $pathGenerator; /** @var \Ibexa\Core\FieldType\Image\AliasCleanerInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $aliasCleaner; + private MockObject $aliasCleaner; /** @var \Ibexa\Core\IO\FilePathNormalizerInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $filePathNormalizer; + private MockObject $filePathNormalizer; /** @var \Ibexa\Core\IO\IOServiceInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $ioService; + private MockObject $ioService; /** @var \Ibexa\Core\FieldType\Image\ImageStorage */ - private $storage; + private ImageStorage $storage; /** @var \Ibexa\Core\FieldType\Validator\FileExtensionBlackListValidator&\PHPUnit\Framework\MockObject\MockObject */ - private $fileExtensionBlackListValidator; + private MockObject $fileExtensionBlackListValidator; protected function setUp(): void { diff --git a/tests/integration/Core/Limitation/MemberOfLimitationTest.php b/tests/integration/Core/Limitation/MemberOfLimitationTest.php index 08318cb5cb..14211d5ff3 100644 --- a/tests/integration/Core/Limitation/MemberOfLimitationTest.php +++ b/tests/integration/Core/Limitation/MemberOfLimitationTest.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\MemberOfLimitation; +use Ibexa\Contracts\Core\Repository\Values\User\UserGroup; use Ibexa\Core\Limitation\MemberOfLimitationType; use Ibexa\Tests\Integration\Core\Repository\Limitation\PermissionResolver\BaseLimitationIntegrationTest; @@ -63,7 +64,7 @@ public function testCanUserAssignRoleToUser(array $limitations, bool $expectedRe 'assign', $limitations, $repository->sudo( - static function (Repository $repository) { + static function (Repository $repository): UserGroup { return $repository->getUserService()->loadUserGroup(self::USERS_GROUP_ID); }, $repository diff --git a/tests/integration/Core/Limitation/RoleLimitationTest.php b/tests/integration/Core/Limitation/RoleLimitationTest.php index 91035a9ad8..cd728cbf96 100644 --- a/tests/integration/Core/Limitation/RoleLimitationTest.php +++ b/tests/integration/Core/Limitation/RoleLimitationTest.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\UserRoleLimitation; +use Ibexa\Contracts\Core\Repository\Values\User\UserGroup; use Ibexa\Tests\Integration\Core\Repository\Limitation\PermissionResolver\BaseLimitationIntegrationTest; final class RoleLimitationTest extends BaseLimitationIntegrationTest @@ -58,7 +59,7 @@ public function testCanUserAssignRole(array $limitations, bool $expectedResult): 'assign', $limitations, $repository->sudo( - static function (Repository $repository) { + static function (Repository $repository): UserGroup { return $repository->getUserService()->loadUserGroup(self::USERS_GROUP_ID); }, $repository diff --git a/tests/integration/Core/Persistence/Filter/Doctrine/FilteringQueryBuilderTest.php b/tests/integration/Core/Persistence/Filter/Doctrine/FilteringQueryBuilderTest.php index ba52bbb698..e3f28f3610 100644 --- a/tests/integration/Core/Persistence/Filter/Doctrine/FilteringQueryBuilderTest.php +++ b/tests/integration/Core/Persistence/Filter/Doctrine/FilteringQueryBuilderTest.php @@ -17,7 +17,7 @@ class FilteringQueryBuilderTest extends TestCase { /** @var \Ibexa\Contracts\Core\Persistence\Filter\Doctrine\FilteringQueryBuilder */ - private $queryBuilder; + private FilteringQueryBuilder $queryBuilder; protected function setUp(): void { diff --git a/tests/integration/Core/Persistence/Search/Content/IndexerGatewayTest.php b/tests/integration/Core/Persistence/Search/Content/IndexerGatewayTest.php index 7e5741aaa8..b8c419de7f 100644 --- a/tests/integration/Core/Persistence/Search/Content/IndexerGatewayTest.php +++ b/tests/integration/Core/Persistence/Search/Content/IndexerGatewayTest.php @@ -20,7 +20,7 @@ final class IndexerGatewayTest extends BaseGatewayTest { /** @var \Ibexa\Core\Search\Legacy\Content\IndexerGateway */ - private $gateway; + private IndexerGateway $gateway; /** * @throws \ErrorException diff --git a/tests/integration/Core/Persistence/Variation/InMemoryVariationHandler.php b/tests/integration/Core/Persistence/Variation/InMemoryVariationHandler.php index 748e137b73..3e79cd28fa 100644 --- a/tests/integration/Core/Persistence/Variation/InMemoryVariationHandler.php +++ b/tests/integration/Core/Persistence/Variation/InMemoryVariationHandler.php @@ -20,7 +20,7 @@ public function getVariation( VersionInfo $versionInfo, $variationName, array $parameters = [] - ) { + ): Variation { return new Variation([ 'uri' => $field->value . '-in-memory-test', ]); diff --git a/tests/integration/Core/Repository/BaseContentServiceTest.php b/tests/integration/Core/Repository/BaseContentServiceTest.php index 284d805c8c..7e6c06e157 100644 --- a/tests/integration/Core/Repository/BaseContentServiceTest.php +++ b/tests/integration/Core/Repository/BaseContentServiceTest.php @@ -70,8 +70,8 @@ protected function createContentVersion1EmptyBinaryField() */ protected function createContentDraftVersion1( $locationId = 56, - $contentTypeIdentifier = 'forum', - $contentFieldNameIdentifier = 'name', + string $contentTypeIdentifier = 'forum', + string $contentFieldNameIdentifier = 'name', User $contentOwner = null ) { $repository = $this->getRepository(); @@ -345,9 +345,9 @@ protected function createMultipleLanguageContentVersion2() * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content Content Draft */ protected function createMultilingualContentDraft( - $contentTypeIdentifier, + string $contentTypeIdentifier, $parentLocationId, - $mainLanguageCode, + string $mainLanguageCode, array $multilingualFieldValues ) { $repository = $this->getRepository(); @@ -397,7 +397,7 @@ protected function createMultilingualContentDraft( * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content Content Draft */ protected function createContentDraft( - $contentTypeIdentifier, + string $contentTypeIdentifier, $parentLocationId, array $fieldValues ) { diff --git a/tests/integration/Core/Repository/BaseNonRedundantFieldSetTest.php b/tests/integration/Core/Repository/BaseNonRedundantFieldSetTest.php index f5c4b9a9fa..f1a85c3071 100644 --- a/tests/integration/Core/Repository/BaseNonRedundantFieldSetTest.php +++ b/tests/integration/Core/Repository/BaseNonRedundantFieldSetTest.php @@ -122,7 +122,7 @@ protected function createContentType() * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - protected function createTestContent($mainLanguageCode, array $fieldValues) + protected function createTestContent(string $mainLanguageCode, array $fieldValues) { $repository = $this->getRepository(); diff --git a/tests/integration/Core/Repository/BaseTest.php b/tests/integration/Core/Repository/BaseTest.php index 457da2dee2..7f0c67409e 100644 --- a/tests/integration/Core/Repository/BaseTest.php +++ b/tests/integration/Core/Repository/BaseTest.php @@ -42,8 +42,7 @@ abstract class BaseTest extends TestCase */ public const DB_INT_MAX = 2147483647; - /** @var \Ibexa\Contracts\Core\Test\Repository\SetupFactory */ - private $setupFactory; + private ?object $setupFactory = null; /** @var \Ibexa\Contracts\Core\Repository\Repository */ private $repository; @@ -261,7 +260,7 @@ protected function assertStructPropertiesCorrect(ValueObject $expectedValues, Va * * @param array $items An array of scalar values */ - private function sortItems(array &$items) + private function sortItems(array &$items): void { $sorter = function ($a, $b): int { if (!is_scalar($a) || !is_scalar($b)) { @@ -273,7 +272,7 @@ private function sortItems(array &$items) usort($items, $sorter); } - private function assertPropertiesEqual($propertyName, $expectedValue, $actualValue, $sortArray = false) + private function assertPropertiesEqual($propertyName, $expectedValue, $actualValue, bool $sortArray = false): void { if ($expectedValue instanceof ArrayObject) { $expectedValue = $expectedValue->getArrayCopy(); @@ -326,7 +325,7 @@ protected function createUserVersion1( $userCreate->setField('first_name', 'Example'); $userCreate->setField('last_name', 'User'); - if (!empty($contentType)) { + if ($contentType instanceof ContentType) { $userCreate->contentType = $contentType; } @@ -388,10 +387,10 @@ protected function createCustomUserVersion1($userGroupName, $roleIdentifier, Rol * @return \Ibexa\Contracts\Core\Repository\Values\User\User */ protected function createCustomUserWithLogin( - $login, - $email, + string $login, + string $email, $userGroupName, - $roleIdentifier, + string $roleIdentifier, RoleLimitation $roleLimitation = null ) { $repository = $this->getRepository(); @@ -448,7 +447,7 @@ protected function createCustomUserWithLogin( * * @return \Ibexa\Contracts\Core\Repository\Values\User\User */ - protected function createUser($login, $firstName, $lastName, UserGroup $userGroup = null) + protected function createUser(string $login, $firstName, $lastName, UserGroup $userGroup = null) { $repository = $this->getRepository(); @@ -487,7 +486,7 @@ protected function createUser($login, $firstName, $lastName, UserGroup $userGrou */ public function createDateTime($timestamp = null) { - $dateTime = new \DateTime(); + $dateTime = new DateTime(); if ($timestamp !== null) { $dateTime->setTimestamp($timestamp); } @@ -545,7 +544,7 @@ protected function isLegacySearchEngineSetup(): bool * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function createRoleWithPolicies($roleName, array $policiesData) + public function createRoleWithPolicies(string $roleName, array $policiesData) { $repository = $this->getRepository(false); $roleService = $repository->getRoleService(); @@ -586,7 +585,7 @@ public function createRoleWithPolicies($roleName, array $policiesData) * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function createUserWithPolicies($login, array $policiesData, RoleLimitation $roleLimitation = null) + public function createUserWithPolicies(string $login, array $policiesData, RoleLimitation $roleLimitation = null) { $repository = $this->getRepository(false); $roleService = $repository->getRoleService(); @@ -646,7 +645,7 @@ protected function getRawDatabaseConnection(): Connection * * @return mixed the return result of the given callback */ - public function performRawDatabaseOperation(callable $callback) + public function performRawDatabaseOperation(callable $callback): void { $repository = $this->getRepository(false); $repository->beginTransaction(); diff --git a/tests/integration/Core/Repository/BookmarkServiceTest.php b/tests/integration/Core/Repository/BookmarkServiceTest.php index 0009ab2b74..dbeeb2caf6 100644 --- a/tests/integration/Core/Repository/BookmarkServiceTest.php +++ b/tests/integration/Core/Repository/BookmarkServiceTest.php @@ -24,7 +24,7 @@ class BookmarkServiceTest extends BaseTest /** * @covers \Ibexa\Contracts\Core\Repository\BookmarkService::isBookmarked */ - public function testIsBookmarked() + public function testIsBookmarked(): void { $repository = $this->getRepository(); @@ -39,7 +39,7 @@ public function testIsBookmarked() /** * @covers \Ibexa\Contracts\Core\Repository\BookmarkService::isBookmarked */ - public function testIsNotBookmarked() + public function testIsNotBookmarked(): void { $repository = $this->getRepository(); @@ -54,7 +54,7 @@ public function testIsNotBookmarked() /** * @covers \Ibexa\Contracts\Core\Repository\BookmarkService::createBookmark */ - public function testCreateBookmark() + public function testCreateBookmark(): void { $repository = $this->getRepository(); @@ -77,7 +77,7 @@ public function testCreateBookmark() * * @depends testCreateBookmark */ - public function testCreateBookmarkThrowsInvalidArgumentException() + public function testCreateBookmarkThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -95,7 +95,7 @@ public function testCreateBookmarkThrowsInvalidArgumentException() /** * @covers \Ibexa\Contracts\Core\Repository\BookmarkService::deleteBookmark */ - public function testDeleteBookmark() + public function testDeleteBookmark(): void { $repository = $this->getRepository(); @@ -119,7 +119,7 @@ public function testDeleteBookmark() * * @depends testDeleteBookmark */ - public function testDeleteBookmarkThrowsInvalidArgumentException() + public function testDeleteBookmarkThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -137,7 +137,7 @@ public function testDeleteBookmarkThrowsInvalidArgumentException() /** * @covers \Ibexa\Contracts\Core\Repository\BookmarkService::loadBookmarks */ - public function testLoadBookmarks() + public function testLoadBookmarks(): void { $repository = $this->getRepository(); diff --git a/tests/integration/Core/Repository/Common/SlugConverter.php b/tests/integration/Core/Repository/Common/SlugConverter.php index a8d72a44d7..2e645db4ff 100644 --- a/tests/integration/Core/Repository/Common/SlugConverter.php +++ b/tests/integration/Core/Repository/Common/SlugConverter.php @@ -20,7 +20,7 @@ class SlugConverter extends LegacySlugConverter * @param string $key * @param string $value */ - public function setConfigurationValue($key, $value) + public function setConfigurationValue($key, $value): void { $this->configuration[$key] = $value; } diff --git a/tests/integration/Core/Repository/ContentService/VersionValidatorTest.php b/tests/integration/Core/Repository/ContentService/VersionValidatorTest.php index 718a0c3a49..6c7ad56178 100644 --- a/tests/integration/Core/Repository/ContentService/VersionValidatorTest.php +++ b/tests/integration/Core/Repository/ContentService/VersionValidatorTest.php @@ -8,6 +8,8 @@ namespace Ibexa\Tests\Integration\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; @@ -28,13 +30,13 @@ final class VersionValidatorTest extends BaseTest private const GER_DE = 'ger-DE'; /** @var \Ibexa\Core\Repository\Validator\VersionValidator */ - private $validator; + private VersionValidator $validator; /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - private $contentTypeService; + private ContentTypeService $contentTypeService; protected function setUp(): void { diff --git a/tests/integration/Core/Repository/ContentServiceAuthorizationTest.php b/tests/integration/Core/Repository/ContentServiceAuthorizationTest.php index 94710f5c9a..53760f2920 100644 --- a/tests/integration/Core/Repository/ContentServiceAuthorizationTest.php +++ b/tests/integration/Core/Repository/ContentServiceAuthorizationTest.php @@ -7,14 +7,18 @@ namespace Ibexa\Tests\Integration\Core\Repository; +use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; +use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Repository; +use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\Relation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\LanguageLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\LocationLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\SubtreeLimitation; +use Ibexa\Contracts\Core\Repository\Values\User\User; /** * Test case for operations in the ContentServiceAuthorization using in memory storage. @@ -29,22 +33,22 @@ class ContentServiceAuthorizationTest extends BaseContentServiceTest { /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $administratorUser; + private User $administratorUser; /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ - private $anonymousUser; + private User $anonymousUser; /** @var \Ibexa\Contracts\Core\Repository\Repository */ - private $repository; + private Repository $repository; /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; /** @var \Ibexa\Contracts\Core\Repository\UserService */ - private $userService; + private UserService $userService; /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; public function setUp(): void { @@ -69,7 +73,7 @@ public function setUp(): void * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testCreateContent */ - public function testCreateContentThrowsUnauthorizedException() + public function testCreateContentThrowsUnauthorizedException(): void { $this->permissionResolver->setCurrentUserReference($this->anonymousUser); @@ -96,7 +100,7 @@ public function testCreateContentThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testCreateContent */ - public function testCreateContentThrowsUnauthorizedExceptionWithSecondParameter() + public function testCreateContentThrowsUnauthorizedExceptionWithSecondParameter(): void { $this->permissionResolver->setCurrentUserReference($this->anonymousUser); @@ -113,7 +117,7 @@ public function testCreateContentThrowsUnauthorizedExceptionWithSecondParameter( * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentInfo */ - public function testLoadContentInfoThrowsUnauthorizedException() + public function testLoadContentInfoThrowsUnauthorizedException(): void { $contentId = $this->generateId('object', 10); $this->setRestrictedEditorUser(); @@ -132,13 +136,13 @@ public function testLoadContentInfoThrowsUnauthorizedException() * * @depends testLoadContentInfoThrowsUnauthorizedException */ - public function testSudo() + public function testSudo(): void { $repository = $this->getRepository(); $contentId = $this->generateId('object', 10); $this->setRestrictedEditorUser(); - $contentInfo = $repository->sudo(static function (Repository $repository) use ($contentId) { + $contentInfo = $repository->sudo(static function (Repository $repository) use ($contentId): \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo { return $repository->getContentService()->loadContentInfo($contentId); }); @@ -155,7 +159,7 @@ public function testSudo() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentInfoList */ - public function testLoadContentInfoListSkipsUnauthorizedItems() + public function testLoadContentInfoListSkipsUnauthorizedItems(): void { $contentId = $this->generateId('object', 10); $this->setRestrictedEditorUser(); @@ -170,7 +174,7 @@ public function testLoadContentInfoListSkipsUnauthorizedItems() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentInfoByRemoteId */ - public function testLoadContentInfoByRemoteIdThrowsUnauthorizedException() + public function testLoadContentInfoByRemoteIdThrowsUnauthorizedException(): void { $anonymousRemoteId = 'faaeb9be3bd98ed09f606fc16d144eca'; @@ -189,7 +193,7 @@ public function testLoadContentInfoByRemoteIdThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadVersionInfo */ - public function testLoadVersionInfoThrowsUnauthorizedException() + public function testLoadVersionInfoThrowsUnauthorizedException(): void { $contentInfo = $this->getContentInfoForAnonymousUser(); @@ -208,7 +212,7 @@ public function testLoadVersionInfoThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadVersionInfoWithSecondParameter */ - public function testLoadVersionInfoThrowsUnauthorizedExceptionWithSecondParameter() + public function testLoadVersionInfoThrowsUnauthorizedExceptionWithSecondParameter(): void { $contentInfo = $this->getContentInfoForAnonymousUser(); @@ -227,7 +231,7 @@ public function testLoadVersionInfoThrowsUnauthorizedExceptionWithSecondParamete * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadVersionInfoById */ - public function testLoadVersionInfoByIdThrowsUnauthorizedException() + public function testLoadVersionInfoByIdThrowsUnauthorizedException(): void { $anonymousUserId = $this->generateId('user', 10); $this->setRestrictedEditorUser(); @@ -245,7 +249,7 @@ public function testLoadVersionInfoByIdThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadVersionInfoByIdWithSecondParameter */ - public function testLoadVersionInfoByIdThrowsUnauthorizedExceptionWithSecondParameter() + public function testLoadVersionInfoByIdThrowsUnauthorizedExceptionWithSecondParameter(): void { $anonymousUserId = $this->generateId('user', 10); $this->setRestrictedEditorUser(); @@ -263,7 +267,7 @@ public function testLoadVersionInfoByIdThrowsUnauthorizedExceptionWithSecondPara * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadVersionInfoById */ - public function testLoadVersionInfoByIdThrowsUnauthorizedExceptionForFirstDraft() + public function testLoadVersionInfoByIdThrowsUnauthorizedExceptionForFirstDraft(): void { $contentDraft = $this->createContentDraftVersion1(); @@ -286,7 +290,7 @@ public function testLoadVersionInfoByIdThrowsUnauthorizedExceptionForFirstDraft( * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentByContentInfo */ - public function testLoadContentByContentInfoThrowsUnauthorizedException() + public function testLoadContentByContentInfoThrowsUnauthorizedException(): void { $contentInfo = $this->getContentInfoForAnonymousUser(); @@ -305,7 +309,7 @@ public function testLoadContentByContentInfoThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentByContentInfoWithLanguageParameters */ - public function testLoadContentByContentInfoThrowsUnauthorizedExceptionWithSecondParameter() + public function testLoadContentByContentInfoThrowsUnauthorizedExceptionWithSecondParameter(): void { $contentInfo = $this->getContentInfoForAnonymousUser(); @@ -324,7 +328,7 @@ public function testLoadContentByContentInfoThrowsUnauthorizedExceptionWithSecon * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentByContentInfoWithVersionNumberParameter */ - public function testLoadContentByContentInfoThrowsUnauthorizedExceptionWithThirdParameter() + public function testLoadContentByContentInfoThrowsUnauthorizedExceptionWithThirdParameter(): void { $contentInfo = $this->getContentInfoForAnonymousUser(); @@ -343,7 +347,7 @@ public function testLoadContentByContentInfoThrowsUnauthorizedExceptionWithThird * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentByVersionInfo */ - public function testLoadContentByVersionInfoThrowsUnauthorizedException() + public function testLoadContentByVersionInfoThrowsUnauthorizedException(): void { $contentInfo = $this->getContentInfoForAnonymousUser(); @@ -364,7 +368,7 @@ public function testLoadContentByVersionInfoThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentByVersionInfoWithSecondParameter */ - public function testLoadContentByVersionInfoThrowsUnauthorizedExceptionWithSecondParameter() + public function testLoadContentByVersionInfoThrowsUnauthorizedExceptionWithSecondParameter(): void { $contentInfo = $this->getContentInfoForAnonymousUser(); @@ -385,7 +389,7 @@ public function testLoadContentByVersionInfoThrowsUnauthorizedExceptionWithSecon * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContent */ - public function testLoadContentThrowsUnauthorizedException() + public function testLoadContentThrowsUnauthorizedException(): void { $anonymousUserId = $this->generateId('user', 10); $this->setRestrictedEditorUser(); @@ -403,7 +407,7 @@ public function testLoadContentThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentWithPrioritizedLanguages */ - public function testLoadContentThrowsUnauthorizedExceptionWithSecondParameter() + public function testLoadContentThrowsUnauthorizedExceptionWithSecondParameter(): void { $anonymousUserId = $this->generateId('user', 10); $this->setRestrictedEditorUser(); @@ -421,7 +425,7 @@ public function testLoadContentThrowsUnauthorizedExceptionWithSecondParameter() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentWithThirdParameter */ - public function testLoadContentThrowsUnauthorizedExceptionWithThirdParameter() + public function testLoadContentThrowsUnauthorizedExceptionWithThirdParameter(): void { $anonymousUserId = $this->generateId('user', 10); $this->setRestrictedEditorUser(); @@ -439,7 +443,7 @@ public function testLoadContentThrowsUnauthorizedExceptionWithThirdParameter() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContent */ - public function testLoadContentThrowsUnauthorizedExceptionOnDrafts() + public function testLoadContentThrowsUnauthorizedExceptionOnDrafts(): void { $editorUser = $this->createUserVersion1(); @@ -467,7 +471,7 @@ public function testLoadContentThrowsUnauthorizedExceptionOnDrafts() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContent */ - public function testLoadContentThrowsUnauthorizedExceptionsOnArchives() + public function testLoadContentThrowsUnauthorizedExceptionsOnArchives(): void { $contentTypeService = $this->getRepository()->getContentTypeService(); @@ -512,7 +516,7 @@ public function testLoadContentThrowsUnauthorizedExceptionsOnArchives() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentByRemoteId */ - public function testLoadContentByRemoteIdThrowsUnauthorizedException() + public function testLoadContentByRemoteIdThrowsUnauthorizedException(): void { $anonymousRemoteId = 'faaeb9be3bd98ed09f606fc16d144eca'; @@ -531,7 +535,7 @@ public function testLoadContentByRemoteIdThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentByRemoteIdWithSecondParameter */ - public function testLoadContentByRemoteIdThrowsUnauthorizedExceptionWithSecondParameter() + public function testLoadContentByRemoteIdThrowsUnauthorizedExceptionWithSecondParameter(): void { $anonymousRemoteId = 'faaeb9be3bd98ed09f606fc16d144eca'; @@ -550,7 +554,7 @@ public function testLoadContentByRemoteIdThrowsUnauthorizedExceptionWithSecondPa * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentByRemoteIdWithThirdParameter */ - public function testLoadContentByRemoteIdThrowsUnauthorizedExceptionWithThirdParameter() + public function testLoadContentByRemoteIdThrowsUnauthorizedExceptionWithThirdParameter(): void { $anonymousRemoteId = 'faaeb9be3bd98ed09f606fc16d144eca'; @@ -569,7 +573,7 @@ public function testLoadContentByRemoteIdThrowsUnauthorizedExceptionWithThirdPar * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testUpdateContentMetadata */ - public function testUpdateContentMetadataThrowsUnauthorizedException() + public function testUpdateContentMetadataThrowsUnauthorizedException(): void { $content = $this->createContentVersion1(); @@ -601,7 +605,7 @@ public function testUpdateContentMetadataThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testDeleteContent */ - public function testDeleteContentThrowsUnauthorizedException() + public function testDeleteContentThrowsUnauthorizedException(): void { $contentVersion2 = $this->createContentVersion2(); @@ -672,7 +676,7 @@ public function testDeleteContentWithLanguageLimitation(): void * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testCreateContentDraft */ - public function testCreateContentDraftThrowsUnauthorizedException() + public function testCreateContentDraftThrowsUnauthorizedException(): void { $content = $this->createContentVersion1(); @@ -693,7 +697,7 @@ public function testCreateContentDraftThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testCreateContentDraftWithSecondParameter */ - public function testCreateContentDraftThrowsUnauthorizedExceptionWithSecondParameter() + public function testCreateContentDraftThrowsUnauthorizedExceptionWithSecondParameter(): void { $content = $this->createContentVersion1(); @@ -713,7 +717,7 @@ public function testCreateContentDraftThrowsUnauthorizedExceptionWithSecondParam * * @covers \Ibexa\Contracts\Core\Repository\ContentService::countContentDrafts() */ - public function testCountContentDraftsReturnZero() + public function testCountContentDraftsReturnZero(): void { $this->permissionResolver->setCurrentUserReference($this->anonymousUser); @@ -726,7 +730,7 @@ public function testCountContentDraftsReturnZero() * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentDrafts * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentDrafts */ - public function testLoadContentDraftsThrowsUnauthorizedException() + public function testLoadContentDraftsThrowsUnauthorizedException(): void { $this->permissionResolver->setCurrentUserReference($this->anonymousUser); @@ -741,7 +745,7 @@ public function testLoadContentDraftsThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentDrafts */ - public function testLoadContentDraftsThrowsUnauthorizedExceptionWithUser() + public function testLoadContentDraftsThrowsUnauthorizedExceptionWithUser(): void { $this->permissionResolver->setCurrentUserReference($this->anonymousUser); @@ -758,7 +762,7 @@ public function testLoadContentDraftsThrowsUnauthorizedExceptionWithUser() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testUpdateContent */ - public function testUpdateContentThrowsUnauthorizedException() + public function testUpdateContentThrowsUnauthorizedException(): void { $draftVersion2 = $this->createContentDraftVersion2(); @@ -787,7 +791,7 @@ public function testUpdateContentThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testPublishVersion */ - public function testPublishVersionThrowsUnauthorizedException() + public function testPublishVersionThrowsUnauthorizedException(): void { $draft = $this->createContentDraftVersion1(); @@ -806,7 +810,7 @@ public function testPublishVersionThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testDeleteVersion */ - public function testDeleteVersionThrowsUnauthorizedException() + public function testDeleteVersionThrowsUnauthorizedException(): void { $draft = $this->createContentDraftVersion1(); @@ -825,7 +829,7 @@ public function testDeleteVersionThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadVersions */ - public function testLoadVersionsThrowsUnauthorizedException() + public function testLoadVersionsThrowsUnauthorizedException(): void { $contentVersion2 = $this->createContentVersion2(); @@ -846,7 +850,7 @@ public function testLoadVersionsThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testCopyContent */ - public function testCopyContentThrowsUnauthorizedException() + public function testCopyContentThrowsUnauthorizedException(): void { $parentLocationId = $this->generateId('location', 52); @@ -883,7 +887,7 @@ public function testCopyContentThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testCopyContentWithGivenVersion */ - public function testCopyContentThrowsUnauthorizedExceptionWithGivenVersion() + public function testCopyContentThrowsUnauthorizedExceptionWithGivenVersion(): void { $parentLocationId = $this->generateId('location', 52); @@ -917,7 +921,7 @@ public function testCopyContentThrowsUnauthorizedExceptionWithGivenVersion() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadRelationList */ - public function testLoadRelationsThrowsUnauthorizedException() + public function testLoadRelationsThrowsUnauthorizedException(): void { $mediaEditor = $this->createMediaUserVersion1(); @@ -944,7 +948,7 @@ public function testLoadRelationsThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadRelationList */ - public function testLoadRelationsForDraftVersionThrowsUnauthorizedException() + public function testLoadRelationsForDraftVersionThrowsUnauthorizedException(): void { $draft = $this->createContentDraftVersion1(); @@ -963,7 +967,7 @@ public function testLoadRelationsForDraftVersionThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadReverseRelations */ - public function testLoadReverseRelationsThrowsUnauthorizedException() + public function testLoadReverseRelationsThrowsUnauthorizedException(): void { $mediaEditor = $this->createMediaUserVersion1(); @@ -986,7 +990,7 @@ public function testLoadReverseRelationsThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testAddRelation */ - public function testAddRelationThrowsUnauthorizedException() + public function testAddRelationThrowsUnauthorizedException(): void { $mediaRemoteId = 'a6e35cbcb7cd6ae4b691f3eee30cd262'; @@ -1014,7 +1018,7 @@ public function testAddRelationThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testDeleteRelation */ - public function testDeleteRelationThrowsUnauthorizedException() + public function testDeleteRelationThrowsUnauthorizedException(): void { $mediaRemoteId = 'a6e35cbcb7cd6ae4b691f3eee30cd262'; $demoDesignRemoteId = '8b8b22fe3c6061ed500fbd2b377b885f'; @@ -1044,7 +1048,7 @@ public function testDeleteRelationThrowsUnauthorizedException() * * @return \Ibexa\Contracts\Core\Repository\Values\User\User */ - private function createAnonymousWithEditorRole() + private function createAnonymousWithEditorRole(): User { $roleService = $this->repository->getRoleService(); @@ -1074,7 +1078,7 @@ private function createAnonymousWithEditorRole() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testAddRelation */ - public function testLoadRelationsWithUnauthorizedRelations() + public function testLoadRelationsWithUnauthorizedRelations(): void { $mainLanguage = 'eng-GB'; @@ -1232,7 +1236,7 @@ public function testLoadRelationsWithUnauthorizedRelations() /** * Test copying Content to the authorized Location (limited by policies). */ - public function testCopyContentToAuthorizedLocation() + public function testCopyContentToAuthorizedLocation(): void { $locationService = $this->repository->getLocationService(); $roleService = $this->repository->getRoleService(); @@ -1276,7 +1280,7 @@ public function testCopyContentToAuthorizedLocation() /** * Test copying Content to the authorized Location (limited by policies). */ - public function testCopyContentToAuthorizedLocationWithSubtreeLimitation() + public function testCopyContentToAuthorizedLocationWithSubtreeLimitation(): void { $locationService = $this->repository->getLocationService(); diff --git a/tests/integration/Core/Repository/ContentServiceTest.php b/tests/integration/Core/Repository/ContentServiceTest.php index fb21357fdf..4ee24327f5 100644 --- a/tests/integration/Core/Repository/ContentServiceTest.php +++ b/tests/integration/Core/Repository/ContentServiceTest.php @@ -8,11 +8,14 @@ namespace Ibexa\Tests\Integration\Core\Repository; use Exception; +use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; use Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException; use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException as APIInvalidArgumentException; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; +use Ibexa\Contracts\Core\Repository\LocationService; +use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; @@ -66,13 +69,13 @@ class ContentServiceTest extends BaseContentServiceTest private const ENG_GB = 'eng-GB'; /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - private $locationService; + private LocationService $locationService; public function setUp(): void { @@ -94,7 +97,7 @@ public function setUp(): void * @group user * @group field-type */ - public function testNewContentCreateStruct() + public function testNewContentCreateStruct(): void { $contentTypeService = $this->getRepository()->getContentTypeService(); $contentType = $contentTypeService->loadContentTypeByIdentifier(self::FORUM_IDENTIFIER); @@ -218,7 +221,7 @@ public function testCreateContentSetsContentInfo($content) * * @depends testCreateContentSetsContentInfo */ - public function testCreateContentSetsExpectedContentInfo($content) + public function testCreateContentSetsExpectedContentInfo($content): void { $permissionResolver = $this->getRepository()->getPermissionResolver(); @@ -278,7 +281,7 @@ public function testCreateContentSetsVersionInfo($content) * * @depends testCreateContentSetsVersionInfo */ - public function testCreateContentSetsExpectedVersionInfo($content) + public function testCreateContentSetsExpectedVersionInfo($content): void { $currentUserReference = $this->getRepository()->getPermissionResolver()->getCurrentUserReference(); @@ -310,7 +313,7 @@ public function testCreateContentSetsExpectedVersionInfo($content) * * @depends testCreateContent */ - public function testCreateContentSetsExpectedContentType($content) + public function testCreateContentSetsExpectedContentType($content): void { $contentType = $content->getContentType(); @@ -364,7 +367,7 @@ public function testCreateContentWithContentTypeDefaultOptions(): void * * @depends testCreateContent */ - public function testCreateContentThrowsInvalidArgumentException() + public function testCreateContentThrowsInvalidArgumentException(): void { $contentTypeService = $this->getRepository()->getContentTypeService(); @@ -396,7 +399,7 @@ public function testCreateContentThrowsInvalidArgumentException() * * @depends testCreateContent */ - public function testCreateContentThrowsInvalidArgumentExceptionOnFieldTypeNotAccept() + public function testCreateContentThrowsInvalidArgumentExceptionOnFieldTypeNotAccept(): void { $contentTypeService = $this->getRepository()->getContentTypeService(); @@ -417,7 +420,7 @@ public function testCreateContentThrowsInvalidArgumentExceptionOnFieldTypeNotAcc * * @depends testCreateContent */ - public function testCreateContentThrowsContentFieldValidationException() + public function testCreateContentThrowsContentFieldValidationException(): void { $contentTypeService = $this->getRepository()->getContentTypeService(); @@ -441,7 +444,7 @@ public function testCreateContentThrowsContentFieldValidationException() * * @depends testCreateContent */ - public function testCreateContentRequiredFieldMissing() + public function testCreateContentRequiredFieldMissing(): void { $contentTypeService = $this->getRepository()->getContentTypeService(); $contentType = $contentTypeService->loadContentTypeByIdentifier(self::FORUM_IDENTIFIER); @@ -468,7 +471,7 @@ public function testCreateContentRequiredFieldMissing() * * @group user */ - public function testCreateContentWithLocationCreateParameterDoesNotCreateLocationImmediately() + public function testCreateContentWithLocationCreateParameterDoesNotCreateLocationImmediately(): void { $this->createContentDraftVersion1(); @@ -485,7 +488,7 @@ public function testCreateContentWithLocationCreateParameterDoesNotCreateLocatio * * @depends testCreateContentWithLocationCreateParameterDoesNotCreateLocationImmediately */ - public function testCreateContentThrowsInvalidArgumentExceptionWithLocationCreateParameter() + public function testCreateContentThrowsInvalidArgumentExceptionWithLocationCreateParameter(): void { $parentLocationId = $this->generateId('location', 56); // $parentLocationId is a valid location ID @@ -561,7 +564,7 @@ public function testLoadContentInfo() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo */ - public function testLoadContentInfoSetsExpectedContentInfo(ContentInfo $contentInfo) + public function testLoadContentInfoSetsExpectedContentInfo(ContentInfo $contentInfo): void { $this->assertPropertiesCorrectUnsorted( $this->getExpectedMediaContentInfoProperties(), @@ -651,7 +654,7 @@ public function testLoadContentInfoSetsExpectedOwnerProxy(ContentInfo $contentIn * * @depends testLoadContentInfo */ - public function testLoadContentInfoThrowsNotFoundException() + public function testLoadContentInfoThrowsNotFoundException(): void { $nonExistentContentId = $this->generateId('object', self::DB_INT_MAX); @@ -665,7 +668,7 @@ public function testLoadContentInfoThrowsNotFoundException() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentInfoList() */ - public function testLoadContentInfoList() + public function testLoadContentInfoList(): void { $mediaFolderId = $this->generateId('object', self::MEDIA_CONTENT_ID); $list = iterator_to_array($this->contentService->loadContentInfoList([$mediaFolderId])); @@ -685,7 +688,7 @@ public function testLoadContentInfoList() * * @depends testLoadContentInfoList */ - public function testLoadContentInfoListSkipsNotFoundItems() + public function testLoadContentInfoListSkipsNotFoundItems(): void { $nonExistentContentId = $this->generateId('object', self::DB_INT_MAX); $list = $this->contentService->loadContentInfoList([$nonExistentContentId]); @@ -717,7 +720,7 @@ public function testLoadContentInfoByRemoteId() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo */ - public function testLoadContentInfoByRemoteIdSetsExpectedContentInfo(ContentInfo $contentInfo) + public function testLoadContentInfoByRemoteIdSetsExpectedContentInfo(ContentInfo $contentInfo): void { $this->assertPropertiesCorrectUnsorted( [ @@ -746,7 +749,7 @@ public function testLoadContentInfoByRemoteIdSetsExpectedContentInfo(ContentInfo * * @depends testLoadContentInfoByRemoteId */ - public function testLoadContentInfoByRemoteIdThrowsNotFoundException() + public function testLoadContentInfoByRemoteIdThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -762,7 +765,7 @@ public function testLoadContentInfoByRemoteIdThrowsNotFoundException() * * @group user */ - public function testLoadVersionInfo() + public function testLoadVersionInfo(): void { $mediaFolderId = $this->generateId('object', self::MEDIA_CONTENT_ID); // $mediaFolderId contains the ID of the "Media" folder @@ -809,7 +812,7 @@ public function testLoadVersionInfoById() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo */ - public function testLoadVersionInfoByIdSetsExpectedVersionInfo(VersionInfo $versionInfo) + public function testLoadVersionInfoByIdSetsExpectedVersionInfo(VersionInfo $versionInfo): void { $this->assertPropertiesCorrect( [ @@ -885,7 +888,7 @@ public function testLoadVersionInfoByIdGetLanguages(VersionInfo $versionInfo): v * * @depends testLoadVersionInfoById */ - public function testLoadVersionInfoByIdThrowsNotFoundException() + public function testLoadVersionInfoByIdThrowsNotFoundException(): void { $nonExistentContentId = $this->generateId('object', self::DB_INT_MAX); @@ -901,7 +904,7 @@ public function testLoadVersionInfoByIdThrowsNotFoundException() * * @depends testLoadContentInfo */ - public function testLoadContentByContentInfo() + public function testLoadContentByContentInfo(): void { $mediaFolderId = $this->generateId('object', self::MEDIA_CONTENT_ID); // $mediaFolderId contains the ID of the "Media" folder @@ -925,7 +928,7 @@ public function testLoadContentByContentInfo() * * @depends testLoadVersionInfo */ - public function testLoadContentByVersionInfo() + public function testLoadContentByVersionInfo(): void { $mediaFolderId = $this->generateId('object', self::MEDIA_CONTENT_ID); // $mediaFolderId contains the ID of the "Media" folder @@ -953,7 +956,7 @@ public function testLoadContentByVersionInfo() * @group user * @group field-type */ - public function testLoadContent() + public function testLoadContent(): void { $mediaFolderId = $this->generateId('object', self::MEDIA_CONTENT_ID); // $mediaFolderId contains the ID of the "Media" folder @@ -974,7 +977,7 @@ public function testLoadContent() * * @depends testLoadContent */ - public function testLoadContentThrowsNotFoundException() + public function testLoadContentThrowsNotFoundException(): void { $nonExistentContentId = $this->generateId('object', self::DB_INT_MAX); @@ -988,7 +991,7 @@ public function testLoadContentThrowsNotFoundException() * * @return array */ - public function contentRemoteIdVersionLanguageProvider() + public function contentRemoteIdVersionLanguageProvider(): array { return [ ['f5c88a2209584891056f987fd965b0ba', null, null], @@ -1013,7 +1016,7 @@ public function contentRemoteIdVersionLanguageProvider() * @param array|null $languages * @param int $versionNo */ - public function testLoadContentByRemoteId($remoteId, $languages, $versionNo) + public function testLoadContentByRemoteId($remoteId, $languages, $versionNo): void { $content = $this->contentService->loadContentByRemoteId($remoteId, $languages, $versionNo); @@ -1036,7 +1039,7 @@ public function testLoadContentByRemoteId($remoteId, $languages, $versionNo) * * @depends testLoadContentByRemoteId */ - public function testLoadContentByRemoteIdThrowsNotFoundException() + public function testLoadContentByRemoteIdThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -1085,7 +1088,7 @@ public function testPublishVersion() * * @depends testPublishVersion */ - public function testPublishVersionSetsExpectedContentInfo($content) + public function testPublishVersionSetsExpectedContentInfo($content): void { $userReference = $this->getRepository()->getPermissionResolver()->getCurrentUserReference(); @@ -1127,7 +1130,7 @@ public function testPublishVersionSetsExpectedContentInfo($content) * * @depends testPublishVersion */ - public function testPublishVersionSetsExpectedVersionInfo($content) + public function testPublishVersionSetsExpectedVersionInfo($content): void { $currentUserReference = $this->getRepository()->getPermissionResolver()->getCurrentUserReference(); @@ -1167,7 +1170,7 @@ public function testPublishVersionSetsExpectedVersionInfo($content) * * @depends testPublishVersion */ - public function testPublishVersionSetsExpectedContentType($content) + public function testPublishVersionSetsExpectedContentType($content): void { $contentType = $content->getContentType(); @@ -1216,7 +1219,7 @@ public function testPublishVersionCreatesLocationsDefinedOnCreate(): array * * @depends testPublishVersionCreatesLocationsDefinedOnCreate */ - public function testCreateContentWithLocationCreateParameterCreatesExpectedLocation(array $testData) + public function testCreateContentWithLocationCreateParameterCreatesExpectedLocation(array $testData): void { /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ @@ -1250,7 +1253,7 @@ public function testCreateContentWithLocationCreateParameterCreatesExpectedLocat * * @depends testPublishVersion */ - public function testPublishVersionThrowsBadStateException() + public function testPublishVersionThrowsBadStateException(): void { $draft = $this->createContentDraftVersion1(); @@ -1268,7 +1271,7 @@ public function testPublishVersionThrowsBadStateException() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::publishVersion */ - public function testPublishVersionDoesNotChangePublishedDate() + public function testPublishVersionDoesNotChangePublishedDate(): void { $publishedContent = $this->createContentVersion1(); @@ -1322,7 +1325,7 @@ public function testCreateContentDraft() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::createContentDraft */ - public function testCreateContentDraftInOtherLanguage() + public function testCreateContentDraftInOtherLanguage(): void { $content = $this->createContentVersion1(); @@ -1352,7 +1355,7 @@ public function testCreateContentDraftInOtherLanguage() * * @group user */ - public function testCreateContentDraftAndLoadAccess() + public function testCreateContentDraftAndLoadAccess(): void { $user = $this->createUserVersion1(); @@ -1377,7 +1380,7 @@ public function testCreateContentDraftAndLoadAccess() * * @depends testCreateContentDraft */ - public function testCreateContentDraftSetsExpectedProperties($draft) + public function testCreateContentDraftSetsExpectedProperties($draft): void { self::assertEquals( [ @@ -1400,7 +1403,7 @@ public function testCreateContentDraftSetsExpectedProperties($draft) * * @depends testCreateContentDraft */ - public function testCreateContentDraftSetsContentInfo($draft) + public function testCreateContentDraftSetsContentInfo($draft): void { $contentInfo = $draft->contentInfo; $currentUserReference = $this->getRepository()->getPermissionResolver()->getCurrentUserReference(); @@ -1436,7 +1439,7 @@ public function testCreateContentDraftSetsContentInfo($draft) * * @depends testCreateContentDraft */ - public function testCreateContentDraftSetsVersionInfo($draft) + public function testCreateContentDraftSetsVersionInfo($draft): void { $versionInfo = $draft->getVersionInfo(); $currentUserReference = $this->getRepository()->getPermissionResolver()->getCurrentUserReference(); @@ -1472,7 +1475,7 @@ public function testCreateContentDraftSetsVersionInfo($draft) * @depends testCreateContentDraft * @depends testLoadVersionInfo */ - public function testCreateContentDraftLoadVersionInfoStillLoadsPublishedVersion($draft) + public function testCreateContentDraftLoadVersionInfoStillLoadsPublishedVersion($draft): void { $content = $this->createContentVersion1(); @@ -1493,7 +1496,7 @@ public function testCreateContentDraftLoadVersionInfoStillLoadsPublishedVersion( * @depends testLoadContent * @depends testCreateContentDraft */ - public function testCreateContentDraftLoadContentStillLoadsPublishedVersion() + public function testCreateContentDraftLoadContentStillLoadsPublishedVersion(): void { $content = $this->createContentVersion1(); @@ -1514,7 +1517,7 @@ public function testCreateContentDraftLoadContentStillLoadsPublishedVersion() * @depends testLoadContentByRemoteId * @depends testCreateContentDraft */ - public function testCreateContentDraftLoadContentByRemoteIdStillLoadsPublishedVersion() + public function testCreateContentDraftLoadContentByRemoteIdStillLoadsPublishedVersion(): void { $content = $this->createContentVersion1(); @@ -1535,7 +1538,7 @@ public function testCreateContentDraftLoadContentByRemoteIdStillLoadsPublishedVe * @depends testLoadContentByContentInfo * @depends testCreateContentDraft */ - public function testCreateContentDraftLoadContentByContentInfoStillLoadsPublishedVersion() + public function testCreateContentDraftLoadContentByContentInfoStillLoadsPublishedVersion(): void { $content = $this->createContentVersion1(); @@ -1555,7 +1558,7 @@ public function testCreateContentDraftLoadContentByContentInfoStillLoadsPublishe * * @group user */ - public function testNewContentUpdateStruct() + public function testNewContentUpdateStruct(): void { $updateStruct = $this->contentService->newContentUpdateStruct(); @@ -1644,7 +1647,7 @@ public function testUpdateContentWithDifferentUser() * * @depends testUpdateContent */ - public function testUpdateContentSetsExpectedFields($content) + public function testUpdateContentSetsExpectedFields($content): void { $actual = $this->normalizeFields($content->getFields()); @@ -1679,7 +1682,7 @@ public function testUpdateContentSetsExpectedFields($content) * * @depends testUpdateContent */ - public function testUpdateContentThrowsBadStateException() + public function testUpdateContentThrowsBadStateException(): void { $content = $this->createContentVersion1(); @@ -1706,7 +1709,7 @@ public function testUpdateContentThrowsBadStateException() * * @depends testUpdateContent */ - public function testUpdateContentThrowsInvalidArgumentExceptionWhenFieldTypeDoesNotAccept() + public function testUpdateContentThrowsInvalidArgumentExceptionWhenFieldTypeDoesNotAccept(): void { $draft = $this->createContentDraftVersion1(); @@ -1730,7 +1733,7 @@ public function testUpdateContentThrowsInvalidArgumentExceptionWhenFieldTypeDoes * * @depends testUpdateContent */ - public function testUpdateContentWhenMandatoryFieldIsEmpty() + public function testUpdateContentWhenMandatoryFieldIsEmpty(): void { $draft = $this->createContentDraftVersion1(); @@ -1757,7 +1760,7 @@ public function testUpdateContentWhenMandatoryFieldIsEmpty() * * @depends testUpdateContent */ - public function testUpdateContentThrowsContentFieldValidationException() + public function testUpdateContentThrowsContentFieldValidationException(): void { $contentTypeService = $this->getRepository()->getContentTypeService(); $contentType = $contentTypeService->loadContentTypeByIdentifier('folder'); @@ -1784,7 +1787,7 @@ public function testUpdateContentThrowsContentFieldValidationException() * * @depends testUpdateContent */ - public function testUpdateContentValidatorIgnoresRequiredFieldsOfNotUpdatedLanguages() + public function testUpdateContentValidatorIgnoresRequiredFieldsOfNotUpdatedLanguages(): void { $contentTypeService = $this->getRepository()->getContentTypeService(); $contentType = $contentTypeService->loadContentTypeByIdentifier('folder'); @@ -1826,7 +1829,7 @@ public function testUpdateContentValidatorIgnoresRequiredFieldsOfNotUpdatedLangu * * @depends testUpdateContent */ - public function testUpdateContentWithNotUpdatingMandatoryField() + public function testUpdateContentWithNotUpdatingMandatoryField(): void { $draft = $this->createContentDraftVersion1(); @@ -1861,7 +1864,7 @@ public function testUpdateContentWithNotUpdatingMandatoryField() * * @depends testUpdateContent */ - public function testCreateContentDraftWithSecondParameter() + public function testCreateContentDraftWithSecondParameter(): void { $contentVersion2 = $this->createContentVersion2(); @@ -1879,7 +1882,7 @@ public function testCreateContentDraftWithSecondParameter() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::createContentDraft */ - public function testCreateContentDraftWithThirdParameter() + public function testCreateContentDraftWithThirdParameter(): void { $content = $this->contentService->loadContent(4); $user = $this->createUserVersion1(); @@ -1904,7 +1907,7 @@ public function testCreateContentDraftWithThirdParameter() * @depends testPublishVersion * @depends testUpdateContent */ - public function testPublishVersionFromContentDraft() + public function testPublishVersionFromContentDraft(): void { $contentVersion2 = $this->createContentVersion2(); @@ -1932,7 +1935,7 @@ public function testPublishVersionFromContentDraft() * * @depends testPublishVersionFromContentDraft */ - public function testPublishVersionFromContentDraftArchivesOldVersion() + public function testPublishVersionFromContentDraftArchivesOldVersion(): void { $contentVersion2 = $this->createContentVersion2(); @@ -1960,7 +1963,7 @@ public function testPublishVersionFromContentDraftArchivesOldVersion() * * @depends testPublishVersionFromContentDraft */ - public function testPublishVersionFromContentDraftUpdatesContentInfoCurrentVersion() + public function testPublishVersionFromContentDraftUpdatesContentInfoCurrentVersion(): void { $contentVersion2 = $this->createContentVersion2(); @@ -1974,7 +1977,7 @@ public function testPublishVersionFromContentDraftUpdatesContentInfoCurrentVersi * * @depends testPublishVersionFromContentDraft */ - public function testPublishVersionFromOldContentDraftArchivesNewerVersionNo() + public function testPublishVersionFromOldContentDraftArchivesNewerVersionNo(): void { $content = $this->createContentVersion1(); @@ -2069,7 +2072,7 @@ public function testPublishVersionNotCreatingUnlimitedArchives(): void * * @group user */ - public function testNewContentMetadataUpdateStruct() + public function testNewContentMetadataUpdateStruct(): void { // Creates a new metadata update struct $metadataUpdate = $this->contentService->newContentMetadataUpdateStruct(); @@ -2136,7 +2139,7 @@ public function testUpdateContentMetadata() * * @depends testUpdateContentMetadata */ - public function testUpdateContentMetadataSetsExpectedProperties($content) + public function testUpdateContentMetadataSetsExpectedProperties($content): void { $contentInfo = $content->contentInfo; $currentUserReference = $this->getRepository()->getPermissionResolver()->getCurrentUserReference(); @@ -2176,7 +2179,7 @@ public function testUpdateContentMetadataSetsExpectedProperties($content) * * @depends testUpdateContentMetadata */ - public function testUpdateContentMetadataNotUpdatesContentVersion($content) + public function testUpdateContentMetadataNotUpdatesContentVersion($content): void { self::assertEquals(1, $content->getVersionInfo()->versionNo); } @@ -2188,7 +2191,7 @@ public function testUpdateContentMetadataNotUpdatesContentVersion($content) * * @depends testUpdateContentMetadata */ - public function testUpdateContentMetadataThrowsInvalidArgumentExceptionOnDuplicateRemoteId() + public function testUpdateContentMetadataThrowsInvalidArgumentExceptionOnDuplicateRemoteId(): void { $content = $this->createContentVersion1(); @@ -2209,7 +2212,7 @@ public function testUpdateContentMetadataThrowsInvalidArgumentExceptionOnDuplica * * @covers \Ibexa\Contracts\Core\Repository\ContentService::updateContentMetadata */ - public function testUpdateContentMetadataThrowsInvalidArgumentExceptionOnNoMetadataPropertiesSet() + public function testUpdateContentMetadataThrowsInvalidArgumentExceptionOnNoMetadataPropertiesSet(): void { $contentInfo = $this->contentService->loadContentInfo(4); $contentMetadataUpdateStruct = $this->contentService->newContentMetadataUpdateStruct(); @@ -2315,7 +2318,7 @@ public function testUpdateContentMainTranslation(): void * * @depends testPublishVersionFromContentDraft */ - public function testDeleteContent() + public function testDeleteContent(): void { $contentVersion2 = $this->createContentVersion2(); @@ -2342,7 +2345,7 @@ public function testDeleteContent() * * @depends testPublishVersionFromContentDraft */ - public function testDeleteContentWithEmptyBinaryField() + public function testDeleteContentWithEmptyBinaryField(): void { $contentVersion = $this->createContentVersion1EmptyBinaryField(); @@ -2407,7 +2410,7 @@ public function testCountContentDraftsForUsers(): void /** * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDraftList() */ - public function testLoadContentDraftsReturnsEmptyArrayByDefault() + public function testLoadContentDraftsReturnsEmptyArrayByDefault(): void { $contentDrafts = $this->contentService->loadContentDraftList(); @@ -2463,7 +2466,7 @@ public function testLoadContentDraftList(): void /** * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDraftList($user) */ - public function testLoadContentDraftsWithFirstParameter() + public function testLoadContentDraftsWithFirstParameter(): void { $user = $this->createUserVersion1(); @@ -2591,7 +2594,7 @@ public function testLoadAllContentDraftList(): void * * @depends testPublishVersionFromContentDraft */ - public function testLoadVersionInfoWithSecondParameter() + public function testLoadVersionInfoWithSecondParameter(): void { $publishedContent = $this->createContentVersion1(); @@ -2616,7 +2619,7 @@ public function testLoadVersionInfoWithSecondParameter() * * @depends testLoadVersionInfoWithSecondParameter */ - public function testLoadVersionInfoThrowsNotFoundExceptionWithSecondParameter() + public function testLoadVersionInfoThrowsNotFoundExceptionWithSecondParameter(): void { $draft = $this->createContentDraftVersion1(); @@ -2633,7 +2636,7 @@ public function testLoadVersionInfoThrowsNotFoundExceptionWithSecondParameter() * * @depends testLoadVersionInfoWithSecondParameter */ - public function testLoadVersionInfoByIdWithSecondParameter() + public function testLoadVersionInfoByIdWithSecondParameter(): array { $publishedContent = $this->createContentVersion1(); @@ -2665,7 +2668,7 @@ public function testLoadVersionInfoByIdWithSecondParameter() * * @param array $data */ - public function testLoadVersionInfoByIdWithSecondParameterSetsExpectedVersionInfo(array $data) + public function testLoadVersionInfoByIdWithSecondParameterSetsExpectedVersionInfo(array $data): void { /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo */ $versionInfo = $data['versionInfo']; @@ -2712,7 +2715,7 @@ public function testLoadVersionInfoByIdWithSecondParameterSetsExpectedVersionInf * * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadVersionInfoById($contentId, $versionNo) */ - public function testLoadVersionInfoByIdThrowsNotFoundExceptionWithSecondParameter() + public function testLoadVersionInfoByIdThrowsNotFoundExceptionWithSecondParameter(): void { $content = $this->createContentVersion1(); @@ -2730,7 +2733,7 @@ public function testLoadVersionInfoByIdThrowsNotFoundExceptionWithSecondParamete * @depends testCreateContent * @depends testLoadContentByVersionInfo */ - public function testLoadContentByVersionInfoWithSecondParameter() + public function testLoadContentByVersionInfoWithSecondParameter(): void { $sectionId = $this->generateId('section', 1); $contentTypeService = $this->getRepository()->getContentTypeService(); @@ -2806,7 +2809,7 @@ static function ($field1, $field2): int { * * @depends testLoadContentByContentInfo */ - public function testLoadContentByContentInfoWithLanguageParameters() + public function testLoadContentByContentInfoWithLanguageParameters(): void { $sectionId = $this->generateId('section', 1); $contentTypeService = $this->getRepository()->getContentTypeService(); @@ -2916,7 +2919,7 @@ public function testLoadContentByContentInfoWithLanguageParameters() * * @depends testLoadContentByContentInfo */ - public function testLoadContentByContentInfoWithVersionNumberParameter() + public function testLoadContentByContentInfoWithVersionNumberParameter(): void { $publishedContent = $this->createContentVersion1(); @@ -2948,7 +2951,7 @@ public function testLoadContentByContentInfoWithVersionNumberParameter() * * @depends testLoadContentByContentInfoWithVersionNumberParameter */ - public function testLoadContentByContentInfoThrowsNotFoundExceptionWithVersionNumberParameter() + public function testLoadContentByContentInfoThrowsNotFoundExceptionWithVersionNumberParameter(): void { $content = $this->createContentVersion1(); @@ -2984,7 +2987,7 @@ public function testLoadContentWithPrioritizedLanguages() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $contentDraft */ - public function testLoadContentWithPrioritizedLanguagesThrowsNotFoundException(Content $contentDraft) + public function testLoadContentWithPrioritizedLanguagesThrowsNotFoundException(Content $contentDraft): void { $this->expectException(NotFoundException::class); @@ -3017,7 +3020,7 @@ public function testLoadContentPassTroughPrioritizedLanguagesToContentType(Conte * * @depends testPublishVersionFromContentDraft */ - public function testLoadContentWithThirdParameter() + public function testLoadContentWithThirdParameter(): void { $publishedContent = $this->createContentVersion1(); @@ -3042,7 +3045,7 @@ public function testLoadContentWithThirdParameter() * * @depends testLoadContentWithThirdParameter */ - public function testLoadContentThrowsNotFoundExceptionWithThirdParameter() + public function testLoadContentThrowsNotFoundExceptionWithThirdParameter(): void { $content = $this->createContentVersion1(); @@ -3059,7 +3062,7 @@ public function testLoadContentThrowsNotFoundExceptionWithThirdParameter() * * @depends testPublishVersionFromContentDraft */ - public function testLoadContentByRemoteIdWithSecondParameter() + public function testLoadContentByRemoteIdWithSecondParameter(): void { $draft = $this->createMultipleLanguageDraftVersion1(); @@ -3083,7 +3086,7 @@ public function testLoadContentByRemoteIdWithSecondParameter() * * @depends testPublishVersionFromContentDraft */ - public function testLoadContentByRemoteIdWithThirdParameter() + public function testLoadContentByRemoteIdWithThirdParameter(): void { $publishedContent = $this->createContentVersion1(); @@ -3112,7 +3115,7 @@ public function testLoadContentByRemoteIdWithThirdParameter() * * @depends testLoadContentByRemoteIdWithThirdParameter */ - public function testLoadContentByRemoteIdThrowsNotFoundExceptionWithThirdParameter() + public function testLoadContentByRemoteIdThrowsNotFoundExceptionWithThirdParameter(): void { $content = $this->createContentVersion1(); @@ -3133,7 +3136,7 @@ public function testLoadContentByRemoteIdThrowsNotFoundExceptionWithThirdParamet * * @param string[]|null $languageCodes */ - public function testLoadContentWithPrioritizedLanguagesList($languageCodes) + public function testLoadContentWithPrioritizedLanguagesList($languageCodes): void { $content = $this->createContentVersion2(); @@ -3153,7 +3156,7 @@ public function testLoadContentWithPrioritizedLanguagesList($languageCodes) /** * @return array */ - public function getPrioritizedLanguageList() + public function getPrioritizedLanguageList(): array { return [ [[self::ENG_US]], @@ -3173,7 +3176,7 @@ public function getPrioritizedLanguageList() * @depends testPublishVersion * @depends testCreateContentDraft */ - public function testDeleteVersion() + public function testDeleteVersion(): void { $content = $this->createContentVersion1(); @@ -3205,7 +3208,7 @@ public function testDeleteVersion() * @depends testCreateContent * @depends testPublishVersion */ - public function testDeleteVersionThrowsBadStateExceptionOnPublishedVersion() + public function testDeleteVersionThrowsBadStateExceptionOnPublishedVersion(): void { $content = $this->createContentVersion1(); @@ -3224,7 +3227,7 @@ public function testDeleteVersionThrowsBadStateExceptionOnPublishedVersion() * @depends testCreateContent * @depends testPublishVersion */ - public function testDeleteVersionWorksIfOnlyVersionIsDraft() + public function testDeleteVersionWorksIfOnlyVersionIsDraft(): void { $draft = $this->createContentDraftVersion1(); @@ -3246,7 +3249,7 @@ public function testDeleteVersionWorksIfOnlyVersionIsDraft() * * @return \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo[] */ - public function testLoadVersions() + public function testLoadVersions(): array { $contentVersion2 = $this->createContentVersion2(); @@ -3272,7 +3275,7 @@ public function testLoadVersions() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo[] $versions */ - public function testLoadVersionsSetsExpectedVersionInfo(array $versions) + public function testLoadVersionsSetsExpectedVersionInfo(array $versions): void { self::assertCount(2, $versions); @@ -3325,7 +3328,7 @@ public function testLoadVersionsSetsExpectedVersionInfo(array $versions) * * @group field-type */ - public function testCopyContent() + public function testCopyContent(): void { $parentLocationId = $this->generateId('location', 56); @@ -3388,7 +3391,7 @@ public function testCopyContent() * * @group field-type */ - public function testCopyContentWithNewOwner() + public function testCopyContentWithNewOwner(): void { $parentLocationId = $this->generateId('location', 56); @@ -3448,7 +3451,7 @@ public function testCopyContentWithNewOwner() * * @depends testCopyContent */ - public function testCopyContentWithGivenVersion() + public function testCopyContentWithGivenVersion(): void { $parentLocationId = $this->generateId('location', 56); @@ -3538,7 +3541,7 @@ public function testAddRelation(): array * * @depends testAddRelation */ - public function testAddRelationAddsRelationToContent($relations) + public function testAddRelationAddsRelationToContent($relations): void { self::assertCount( 1, @@ -3549,7 +3552,7 @@ public function testAddRelationAddsRelationToContent($relations) /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Relation[] $relations */ - protected function assertExpectedRelations($relations) + protected function assertExpectedRelations(array $relations) { self::assertEquals( [ @@ -3576,7 +3579,7 @@ protected function assertExpectedRelations($relations) * * @depends testAddRelation */ - public function testAddRelationSetsExpectedRelations($relations) + public function testAddRelationSetsExpectedRelations($relations): void { $this->assertExpectedRelations($relations); } @@ -3590,7 +3593,7 @@ public function testAddRelationSetsExpectedRelations($relations) * * @depends testAddRelationSetsExpectedRelations */ - public function testCreateContentDraftWithRelations() + public function testCreateContentDraftWithRelations(): array { $draft = $this->createContentDraftVersion1(); $media = $this->contentService->loadContentInfoByRemoteId(self::MEDIA_REMOTE_ID); @@ -3636,7 +3639,7 @@ public function testCreateContentDraftWithRelationsCreatesRelations(array $relat * * @depends testCreateContentDraftWithRelationsCreatesRelations */ - public function testCreateContentDraftWithRelationsCreatesExpectedRelations($relations) + public function testCreateContentDraftWithRelationsCreatesExpectedRelations($relations): void { $this->assertExpectedRelations($relations); } @@ -3648,7 +3651,7 @@ public function testCreateContentDraftWithRelationsCreatesExpectedRelations($rel * * @depends testAddRelation */ - public function testAddRelationThrowsBadStateException() + public function testAddRelationThrowsBadStateException(): void { $content = $this->createContentVersion1(); @@ -3671,7 +3674,7 @@ public function testAddRelationThrowsBadStateException() * @depends testAddRelation * @depends loadRelationList */ - public function testLoadRelationsSkipsArchivedContent() + public function testLoadRelationsSkipsArchivedContent(): void { $trashService = $this->getRepository()->getTrashService(); @@ -3727,7 +3730,7 @@ public function testLoadRelationsSkipsArchivedContent() * @depends testAddRelation * @depends loadRelationList */ - public function testLoadRelationsSkipsDraftContent() + public function testLoadRelationsSkipsDraftContent(): void { $draft = $this->createContentDraftVersion1(); @@ -3955,7 +3958,7 @@ public function testCountReverseRelationsForUnauthorizedUser(): void * * @depends testAddRelation */ - public function testLoadReverseRelations() + public function testLoadReverseRelations(): void { $versionInfo = $this->createContentVersion1()->getVersionInfo(); $contentInfo = $versionInfo->getContentInfo(); @@ -4038,7 +4041,7 @@ static function ($rel1, $rel2): int { * @depends testAddRelation * @depends testLoadReverseRelations */ - public function testLoadReverseRelationsSkipsArchivedContent() + public function testLoadReverseRelationsSkipsArchivedContent(): void { $trashService = $this->getRepository()->getTrashService(); @@ -4112,7 +4115,7 @@ public function testLoadReverseRelationsSkipsArchivedContent() * @depends testAddRelation * @depends testLoadReverseRelations */ - public function testLoadReverseRelationsSkipsDraftContent() + public function testLoadReverseRelationsSkipsDraftContent(): void { // Load "Media" page Content $media = $this->contentService->loadContentByRemoteId(self::MEDIA_REMOTE_ID); @@ -4294,7 +4297,7 @@ public function testLoadReverseRelationListSkipsArchivedContent(): void /** * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadReverseRelationList */ - public function testLoadReverseRelationListSkipsDraftContent() + public function testLoadReverseRelationListSkipsDraftContent(): void { $draft1 = $this->contentService->createContentDraft( $this->createFolder([self::ENG_GB => 'Foo'], 2)->contentInfo @@ -4346,7 +4349,7 @@ public function testLoadReverseRelationListWithType(): void * * @depends testLoadRelationList */ - public function testDeleteRelation() + public function testDeleteRelation(): void { $draft = $this->createContentDraftVersion1(); @@ -4373,7 +4376,7 @@ public function testDeleteRelation() * * @depends testDeleteRelation */ - public function testDeleteRelationThrowsBadStateException() + public function testDeleteRelationThrowsBadStateException(): void { $content = $this->createContentVersion1(); @@ -4407,7 +4410,7 @@ public function testDeleteRelationThrowsBadStateException() * * @depends testDeleteRelation */ - public function testDeleteRelationThrowsInvalidArgumentException() + public function testDeleteRelationThrowsInvalidArgumentException(): void { $draft = $this->createContentDraftVersion1(); @@ -4430,7 +4433,7 @@ public function testDeleteRelationThrowsInvalidArgumentException() * @depends testCreateContent * @depends testLoadContent */ - public function testCreateContentInTransactionWithRollback() + public function testCreateContentInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -4479,7 +4482,7 @@ public function testCreateContentInTransactionWithRollback() * @depends testCreateContent * @depends testLoadContent */ - public function testCreateContentInTransactionWithCommit() + public function testCreateContentInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -4523,7 +4526,7 @@ public function testCreateContentInTransactionWithCommit() * @depends testCreateContentWithLocationCreateParameterDoesNotCreateLocationImmediately * @depends testLoadContentThrowsNotFoundException */ - public function testCreateContentWithLocationCreateParameterInTransactionWithRollback() + public function testCreateContentWithLocationCreateParameterInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -4561,7 +4564,7 @@ public function testCreateContentWithLocationCreateParameterInTransactionWithRol * @depends testCreateContentWithLocationCreateParameterDoesNotCreateLocationImmediately * @depends testLoadContentThrowsNotFoundException */ - public function testCreateContentWithLocationCreateParameterInTransactionWithCommit() + public function testCreateContentWithLocationCreateParameterInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -4595,7 +4598,7 @@ public function testCreateContentWithLocationCreateParameterInTransactionWithCom * @depends testCreateContentDraft * @depends testLoadContent */ - public function testCreateContentDraftInTransactionWithRollback() + public function testCreateContentDraftInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -4640,7 +4643,7 @@ public function testCreateContentDraftInTransactionWithRollback() * @depends testCreateContentDraft * @depends testLoadContent */ - public function testCreateContentDraftInTransactionWithCommit() + public function testCreateContentDraftInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -4683,7 +4686,7 @@ public function testCreateContentDraftInTransactionWithCommit() * @depends testPublishVersion * @depends testLoadContent */ - public function testPublishVersionInTransactionWithRollback() + public function testPublishVersionInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -4730,7 +4733,7 @@ public function testPublishVersionInTransactionWithRollback() * @depends testPublishVersion * @depends testLoadVersionInfo */ - public function testPublishVersionInTransactionWithCommit() + public function testPublishVersionInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -4772,7 +4775,7 @@ public function testPublishVersionInTransactionWithCommit() * @depends testLoadContent * @depends testLoadContentInfo */ - public function testUpdateContentInTransactionWithRollback() + public function testUpdateContentInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -4823,7 +4826,7 @@ public function testUpdateContentInTransactionWithRollback() * @depends testLoadContent * @depends testLoadContentInfo */ - public function testUpdateContentInTransactionWithCommit() + public function testUpdateContentInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -4873,7 +4876,7 @@ public function testUpdateContentInTransactionWithCommit() * @depends testUpdateContentMetadata * @depends testLoadContentInfo */ - public function testUpdateContentMetadataInTransactionWithRollback() + public function testUpdateContentMetadataInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -4921,7 +4924,7 @@ public function testUpdateContentMetadataInTransactionWithRollback() * @depends testUpdateContentMetadata * @depends testLoadContentInfo */ - public function testUpdateContentMetadataInTransactionWithCommit() + public function testUpdateContentMetadataInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -4969,7 +4972,7 @@ public function testUpdateContentMetadataInTransactionWithCommit() * @depends testUpdateContentMetadata * @depends testLoadContentInfo */ - public function testUpdateContentMetadataCheckWithinTransaction() + public function testUpdateContentMetadataCheckWithinTransaction(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -5017,7 +5020,7 @@ public function testUpdateContentMetadataCheckWithinTransaction() * @depends testLoadContentInfo * @depends testLoadContentDraftList */ - public function testDeleteVersionInTransactionWithRollback() + public function testDeleteVersionInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -5057,7 +5060,7 @@ public function testDeleteVersionInTransactionWithRollback() * @depends testLoadContentInfo * @depends testLoadContentDrafts */ - public function testDeleteVersionInTransactionWithCommit() + public function testDeleteVersionInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -5096,7 +5099,7 @@ public function testDeleteVersionInTransactionWithCommit() * @depends testDeleteContent * @depends testLoadContentInfo */ - public function testDeleteContentInTransactionWithRollback() + public function testDeleteContentInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -5134,7 +5137,7 @@ public function testDeleteContentInTransactionWithRollback() * @depends testDeleteContent * @depends testLoadContentInfo */ - public function testDeleteContentInTransactionWithCommit() + public function testDeleteContentInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -5175,7 +5178,7 @@ public function testDeleteContentInTransactionWithCommit() * * @depends testCopyContent */ - public function testCopyContentInTransactionWithRollback() + public function testCopyContentInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -5223,7 +5226,7 @@ public function testCopyContentInTransactionWithRollback() * * @depends testCopyContent */ - public function testCopyContentInTransactionWithCommit() + public function testCopyContentInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -5264,7 +5267,7 @@ public function testCopyContentInTransactionWithCommit() self::assertCount(2, $locations); } - public function testURLAliasesCreatedForNewContent() + public function testURLAliasesCreatedForNewContent(): void { $urlAliasService = $this->getRepository()->getURLAliasService(); @@ -5295,7 +5298,7 @@ public function testURLAliasesCreatedForNewContent() ); } - public function testURLAliasesCreatedForUpdatedContent() + public function testURLAliasesCreatedForUpdatedContent(): void { $urlAliasService = $this->getRepository()->getURLAliasService(); @@ -5362,7 +5365,7 @@ public function testURLAliasesCreatedForUpdatedContent() ); } - public function testCustomURLAliasesNotHistorizedOnUpdatedContent() + public function testCustomURLAliasesNotHistorizedOnUpdatedContent(): void { $urlAliasService = $this->getRepository()->getURLAliasService(); @@ -5419,7 +5422,7 @@ public function testCustomURLAliasesNotHistorizedOnUpdatedContent() * Test to ensure that old versions are not affected by updates to newer * drafts. */ - public function testUpdatingDraftDoesNotUpdateOldVersions() + public function testUpdatingDraftDoesNotUpdateOldVersions(): void { $contentVersion2 = $this->createContentVersion2(); @@ -5436,7 +5439,7 @@ public function testUpdatingDraftDoesNotUpdateOldVersions() * Test scenario with writer and publisher users. * Writer can only create content. Publisher can publish this content. */ - public function testPublishWorkflow() + public function testPublishWorkflow(): void { $this->createRoleWithPolicies('Publisher', [ ['module' => 'content', 'function' => 'read'], @@ -5475,7 +5478,7 @@ public function testPublishWorkflow() /** * Test publish / content policy is required to be able to publish content. */ - public function testPublishContentWithoutPublishPolicyThrowsException() + public function testPublishContentWithoutPublishPolicyThrowsException(): void { $this->createRoleWithPolicies('Writer', [ ['module' => 'content', 'function' => 'read'], @@ -5501,7 +5504,7 @@ public function testPublishContentWithoutPublishPolicyThrowsException() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteTranslation */ - public function testDeleteTranslation() + public function testDeleteTranslation(): void { $content = $this->createContentVersion2(); @@ -5525,7 +5528,7 @@ public function testDeleteTranslation() * Test deleting a Translation which is initial for some Version, updates initialLanguageCode * with mainLanguageCode (assuming they are different). */ - public function testDeleteTranslationUpdatesInitialLanguageCodeVersion() + public function testDeleteTranslationUpdatesInitialLanguageCodeVersion(): void { $content = $this->createContentVersion2(); // create another, copied, version @@ -5559,7 +5562,7 @@ public function testDeleteTranslationUpdatesInitialLanguageCodeVersion() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteTranslation */ - public function testDeleteTranslationUpdatesUrlAlias() + public function testDeleteTranslationUpdatesUrlAlias(): void { $urlAliasService = $this->getRepository()->getURLAliasService(); @@ -5599,7 +5602,7 @@ public function testDeleteTranslationUpdatesUrlAlias() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteTranslation */ - public function testDeleteTranslationMainLanguageThrowsBadStateException() + public function testDeleteTranslationMainLanguageThrowsBadStateException(): void { $content = $this->createContentVersion2(); @@ -5618,7 +5621,7 @@ public function testDeleteTranslationMainLanguageThrowsBadStateException() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteTranslation */ - public function testDeleteTranslationDeletesSingleTranslationVersions() + public function testDeleteTranslationDeletesSingleTranslationVersions(): void { // content created by the createContentVersion1 method has eng-US translation only. $content = $this->createContentVersion1(); @@ -5647,7 +5650,7 @@ public function testDeleteTranslationDeletesSingleTranslationVersions() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteTranslation */ - public function testDeleteTranslationThrowsUnauthorizedException() + public function testDeleteTranslationThrowsUnauthorizedException(): void { $content = $this->createContentVersion2(); @@ -5677,7 +5680,7 @@ public function testDeleteTranslationThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteTranslation */ - public function testDeleteTranslationThrowsInvalidArgumentException() + public function testDeleteTranslationThrowsInvalidArgumentException(): void { // content created by the createContentVersion1 method has eng-US translation only. $content = $this->createContentVersion1(); @@ -5693,7 +5696,7 @@ public function testDeleteTranslationThrowsInvalidArgumentException() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteTranslationFromDraft */ - public function testDeleteTranslationFromDraft() + public function testDeleteTranslationFromDraft(): void { $languageCode = self::ENG_GB; $content = $this->createMultipleLanguageContentVersion2(); @@ -5711,7 +5714,7 @@ public function testDeleteTranslationFromDraft() * * @return array */ - public function providerForDeleteTranslationFromDraftRemovesUrlAliasOnPublishing() + public function providerForDeleteTranslationFromDraftRemovesUrlAliasOnPublishing(): array { return [ [ @@ -5737,7 +5740,7 @@ public function providerForDeleteTranslationFromDraftRemovesUrlAliasOnPublishing * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function testDeleteTranslationFromDraftRemovesUrlAliasOnPublishing(array $fieldValues) + public function testDeleteTranslationFromDraftRemovesUrlAliasOnPublishing(array $fieldValues): void { $urlAliasService = $this->getRepository()->getURLAliasService(); @@ -5798,7 +5801,7 @@ public function testDeleteTranslationFromDraftRemovesUrlAliasOnPublishing(array /** * Test that URL aliases for deleted Translations are properly archived. */ - public function testDeleteTranslationFromDraftArchivesUrlAliasOnPublishing() + public function testDeleteTranslationFromDraftArchivesUrlAliasOnPublishing(): void { $urlAliasService = $this->getRepository()->getURLAliasService(); @@ -5857,7 +5860,7 @@ public function testDeleteTranslationFromDraftArchivesUrlAliasOnPublishing() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteTranslationFromDraft */ - public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnSingleTranslation() + public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnSingleTranslation(): void { // create Content with single Translation $publishedContent = $this->contentService->publishVersion( @@ -5894,7 +5897,7 @@ public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnSingleTra * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteTranslationFromDraft */ - public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnMainTranslation() + public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnMainTranslation(): void { $mainLanguageCode = self::ENG_US; $draft = $this->createMultilingualContentDraft( @@ -5920,7 +5923,7 @@ public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnMainTrans * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteTranslationFromDraft */ - public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnPublishedVersion() + public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnPublishedVersion(): void { $languageCode = self::ENG_US; $content = $this->createMultipleLanguageContentVersion2(); @@ -5938,7 +5941,7 @@ public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnPublished * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteTranslationFromDraft */ - public function testDeleteTranslationFromDraftThrowsUnauthorizedException() + public function testDeleteTranslationFromDraftThrowsUnauthorizedException(): void { $languageCode = self::ENG_GB; $content = $this->createMultipleLanguageContentVersion2(); @@ -5970,7 +5973,7 @@ public function testDeleteTranslationFromDraftThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteTranslationFromDraft */ - public function testDeleteTranslationFromDraftThrowsInvalidArgumentException() + public function testDeleteTranslationFromDraftThrowsInvalidArgumentException(): void { $languageCode = self::GER_DE; $content = $this->createMultipleLanguageContentVersion2(); @@ -5983,7 +5986,7 @@ public function testDeleteTranslationFromDraftThrowsInvalidArgumentException() /** * Test loading list of Content items. */ - public function testLoadContentListByContentInfo() + public function testLoadContentListByContentInfo(): void { $allLocationsCount = $this->locationService->getAllLocationsCount(); $contentInfoList = array_map( @@ -6014,7 +6017,7 @@ static function (Location $location) { * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteVersion */ - public function testLoadVersionsAfterDeletingTwoDrafts() + public function testLoadVersionsAfterDeletingTwoDrafts(): void { $content = $this->createFolder([self::ENG_GB => 'Foo'], 2); @@ -6045,7 +6048,7 @@ public function testLoadVersionsAfterDeletingTwoDrafts() /** * Tests loading list of content versions of status draft. */ - public function testLoadVersionsOfStatusDraft() + public function testLoadVersionsOfStatusDraft(): void { $content = $this->createContentVersion1(); @@ -6061,7 +6064,7 @@ public function testLoadVersionsOfStatusDraft() /** * Tests loading list of content versions of status archived. */ - public function testLoadVersionsOfStatusArchived() + public function testLoadVersionsOfStatusArchived(): void { $content = $this->createContentVersion1(); @@ -6083,7 +6086,7 @@ public function testLoadVersionsOfStatusArchived() * @param array $expectedAliasProperties * @param array $actualAliases */ - private function assertAliasesCorrect(array $expectedAliasProperties, array $actualAliases) + private function assertAliasesCorrect(array $expectedAliasProperties, array $actualAliases): void { foreach ($actualAliases as $actualAlias) { if (!isset($expectedAliasProperties[$actualAlias->path])) { @@ -6127,7 +6130,7 @@ private function assertAliasesCorrect(array $expectedAliasProperties, array $act * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field[] $fields */ - private function assertAllFieldsEquals(array $fields) + private function assertAllFieldsEquals(array $fields): void { $actual = $this->normalizeFields($fields); $expected = $this->normalizeFields($this->createFieldsFixture()); @@ -6142,7 +6145,7 @@ private function assertAllFieldsEquals(array $fields) * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field[] $fields * @param string $languageCode */ - private function assertLocaleFieldsEquals(array $fields, $languageCode) + private function assertLocaleFieldsEquals(array $fields, string $languageCode): void { $actual = $this->normalizeFields($fields); @@ -6169,7 +6172,7 @@ private function assertLocaleFieldsEquals(array $fields, $languageCode) * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Field[] */ - private function normalizeFields(array $fields) + private function normalizeFields(array $fields): array { $normalized = []; foreach ($fields as $field) { @@ -6202,7 +6205,7 @@ static function ($field1, $field2): int { * * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo */ - private function assertDefaultContentStates(ContentInfo $contentInfo) + private function assertDefaultContentStates(ContentInfo $contentInfo): void { $objectStateService = $this->getRepository()->getObjectStateService(); @@ -6227,7 +6230,7 @@ private function assertDefaultContentStates(ContentInfo $contentInfo) * @param string $languageCode * @param int $contentId */ - private function assertTranslationDoesNotExist($languageCode, $contentId) + private function assertTranslationDoesNotExist(string $languageCode, int $contentId): void { $content = $this->contentService->loadContent($contentId); @@ -6252,7 +6255,7 @@ private function assertTranslationDoesNotExist($languageCode, $contentId) * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Field[] */ - private function createFieldsFixture() + private function createFieldsFixture(): array { return [ new Field( @@ -6281,7 +6284,7 @@ private function createFieldsFixture() * * @return array */ - private function getExpectedMediaContentInfoProperties() + private function getExpectedMediaContentInfoProperties(): array { return [ 'id' => self::MEDIA_CONTENT_ID, @@ -6354,7 +6357,7 @@ function (Location $parentLocation) { * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function testRevealContent() + public function testRevealContent(): void { $contentTypeService = $this->getRepository()->getContentTypeService(); @@ -6405,7 +6408,7 @@ function (Location $parentLocation) { /** * @depends testRevealContent */ - public function testRevealContentWithHiddenParent() + public function testRevealContentWithHiddenParent(): void { $contentTypeService = $this->getRepository()->getContentTypeService(); @@ -6463,7 +6466,7 @@ public function testRevealContentWithHiddenParent() /** * @depends testRevealContent */ - public function testRevealContentWithHiddenChildren() + public function testRevealContentWithHiddenChildren(): void { $contentTypeService = $this->getRepository()->getContentTypeService(); @@ -6528,7 +6531,7 @@ public function testRevealContentWithHiddenChildren() } } - public function testHideContentWithParentLocation() + public function testHideContentWithParentLocation(): void { $contentTypeService = $this->getRepository()->getContentTypeService(); @@ -6575,7 +6578,7 @@ public function testHideContentWithParentLocation() self::assertTrue($childLocations[0]->invisible); } - public function testChangeContentName() + public function testChangeContentName(): void { $contentDraft = $this->createContentDraft( 'folder', @@ -6597,7 +6600,7 @@ public function testChangeContentName() self::assertEquals('Polo', $updatedContent->contentInfo->name); } - public function testCopyTranslationsFromPublishedToDraft() + public function testCopyTranslationsFromPublishedToDraft(): void { $contentDraft = $this->createContentDraft( 'folder', @@ -6660,7 +6663,7 @@ public function testCopyTranslationsFromPublishedToDraft() ); } - public function testCopyTranslationsFromInvalidPublishedContentToDraft() + public function testCopyTranslationsFromInvalidPublishedContentToDraft(): void { $contentTypeService = $this->getRepository()->getContentTypeService(); @@ -6787,7 +6790,7 @@ static function (Location $location) { ); } - public function testPublishVersionWithSelectedLanguages() + public function testPublishVersionWithSelectedLanguages(): void { $publishedContent = $this->createFolder( [ @@ -6817,7 +6820,7 @@ public function testPublishVersionWithSelectedLanguages() ); } - public function testCreateContentWithRomanianSpecialCharsInTitle() + public function testCreateContentWithRomanianSpecialCharsInTitle(): void { $baseName = 'ȘșțȚdfdf'; $expectedPath = '/SstTdfdf'; @@ -6881,7 +6884,7 @@ private function createUserWithVersionReadLimitations(array $limitationValues = * * @return object */ - private function createContentWithReverseRelations(array $drafts) + private function createContentWithReverseRelations(array $drafts): \AnonymousClass13a5954aa9e8fdf09c5a832a6eaba225 { $contentWithReverseRelations = new class() { /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ diff --git a/tests/integration/Core/Repository/ContentTypeServiceAuthorizationTest.php b/tests/integration/Core/Repository/ContentTypeServiceAuthorizationTest.php index feb041b512..e91b2cd928 100644 --- a/tests/integration/Core/Repository/ContentTypeServiceAuthorizationTest.php +++ b/tests/integration/Core/Repository/ContentTypeServiceAuthorizationTest.php @@ -28,7 +28,7 @@ class ContentTypeServiceAuthorizationTest extends BaseContentTypeServiceTest * * @depends Ibexa\Tests\Integration\Core\Repository\ContentTypeServiceTest::testCreateContentTypeGroup */ - public function testCreateContentTypeGroupThrowsUnauthorizedException() + public function testCreateContentTypeGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -70,7 +70,7 @@ public function testCreateContentTypeGroupThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentTypeServiceTest::testUpdateContentTypeGroup */ - public function testUpdateContentTypeGroupThrowsUnauthorizedException() + public function testUpdateContentTypeGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -121,7 +121,7 @@ public function testUpdateContentTypeGroupThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentTypeServiceTest::testDeleteContentTypeGroup */ - public function testDeleteContentTypeGroupThrowsUnauthorizedException() + public function testDeleteContentTypeGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -159,7 +159,7 @@ public function testDeleteContentTypeGroupThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentTypeServiceTest::testCreateContentType */ - public function testCreateContentTypeThrowsUnauthorizedException() + public function testCreateContentTypeThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -217,7 +217,7 @@ public function testCreateContentTypeThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentTypeServiceTest::testUpdateContentTypeDraft */ - public function testUpdateContentTypeDraftThrowsUnauthorizedException() + public function testUpdateContentTypeDraftThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -270,7 +270,7 @@ public function testUpdateContentTypeDraftThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentTypeServiceTest::testAddFieldDefinition */ - public function testAddFieldDefinitionThrowsUnauthorizedException() + public function testAddFieldDefinitionThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -327,7 +327,7 @@ public function testAddFieldDefinitionThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentTypeServiceTest::testRemoveFieldDefinition */ - public function testRemoveFieldDefinitionThrowsUnauthorizedException() + public function testRemoveFieldDefinitionThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -361,7 +361,7 @@ public function testRemoveFieldDefinitionThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentTypeServiceTest::testUpdateFieldDefinition */ - public function testUpdateFieldDefinitionThrowsUnauthorizedException() + public function testUpdateFieldDefinitionThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -420,7 +420,7 @@ public function testUpdateFieldDefinitionThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentTypeServiceTest::testPublishContentTypeDraft */ - public function testPublishContentTypeDraftThrowsUnauthorizedException() + public function testPublishContentTypeDraftThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -452,7 +452,7 @@ public function testPublishContentTypeDraftThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentTypeServiceTest::testCreateContentTypeDraft */ - public function testCreateContentTypeDraftThrowsUnauthorizedException() + public function testCreateContentTypeDraftThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -485,7 +485,7 @@ public function testCreateContentTypeDraftThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentTypeServiceTest::testDeleteContentType */ - public function testDeleteContentTypeThrowsUnauthorizedException() + public function testDeleteContentTypeThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -518,7 +518,7 @@ public function testDeleteContentTypeThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentTypeServiceTest::testCopyContentType */ - public function testCopyContentTypeThrowsUnauthorizedException() + public function testCopyContentTypeThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -551,7 +551,7 @@ public function testCopyContentTypeThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentTypeServiceTest::testAssignContentTypeGroup */ - public function testAssignContentTypeGroupThrowsUnauthorizedException() + public function testAssignContentTypeGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -585,7 +585,7 @@ public function testAssignContentTypeGroupThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentTypeServiceTest::testUnassignContentTypeGroup */ - public function testUnassignContentTypeGroupThrowsUnauthorizedException() + public function testUnassignContentTypeGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/ContentTypeServiceTest.php b/tests/integration/Core/Repository/ContentTypeServiceTest.php index 6d066c2752..4229b8b2fd 100644 --- a/tests/integration/Core/Repository/ContentTypeServiceTest.php +++ b/tests/integration/Core/Repository/ContentTypeServiceTest.php @@ -29,6 +29,7 @@ use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionCreateStruct; use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionUpdateStruct; use Ibexa\Contracts\Core\Repository\Values\Translation\Message; +use Ibexa\Contracts\Core\Repository\Values\ValueObject; use Ibexa\Core\FieldType\TextLine\Value as TextLineValue; /** @@ -75,7 +76,7 @@ public function testNewContentTypeGroupCreateStruct() * * @depends testNewContentTypeGroupCreateStruct */ - public function testNewContentTypeGroupCreateStructValues($createStruct) + public function testNewContentTypeGroupCreateStructValues(ValueObject $createStruct): void { $this->assertPropertiesCorrect( [ @@ -99,7 +100,7 @@ public function testNewContentTypeGroupCreateStructValues($createStruct) * * @group user */ - public function testCreateContentTypeGroup() + public function testCreateContentTypeGroup(): array { $repository = $this->getRepository(); @@ -142,7 +143,7 @@ public function testCreateContentTypeGroup() * * @depends testCreateContentTypeGroup */ - public function testCreateContentTypeGroupStructValues(array $data) + public function testCreateContentTypeGroupStructValues(array $data): array { $createStruct = $data['createStruct']; $group = $data['group']; @@ -175,7 +176,7 @@ public function testCreateContentTypeGroupStructValues(array $data) * * @depends testCreateContentTypeGroupStructValues */ - public function testCreateContentTypeGroupStructLanguageDependentValues(array $data) + public function testCreateContentTypeGroupStructLanguageDependentValues(array $data): void { $createStruct = $data['createStruct']; $group = $data['group']; @@ -196,7 +197,7 @@ public function testCreateContentTypeGroupStructLanguageDependentValues(array $d * * @depends testCreateContentTypeGroup */ - public function testCreateContentTypeGroupThrowsInvalidArgumentException() + public function testCreateContentTypeGroupThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$contentTypeGroupCreateStruct\' is invalid: A group with the identifier \'Content\' already exists'); @@ -268,7 +269,7 @@ public function testLoadSystemContentTypeGroup(): void * * @depends testLoadContentTypeGroup */ - public function testLoadContentTypeGroupStructValues(ContentTypeGroup $group) + public function testLoadContentTypeGroupStructValues(ContentTypeGroup $group): void { $this->assertPropertiesCorrect( [ @@ -288,7 +289,7 @@ public function testLoadContentTypeGroupStructValues(ContentTypeGroup $group) * * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::loadContentTypeGroup() */ - public function testLoadContentTypeGroupThrowsNotFoundException() + public function testLoadContentTypeGroupThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -333,7 +334,7 @@ public function testLoadContentTypeGroupByIdentifier() * * @depends testLoadContentTypeGroupByIdentifier */ - public function testLoadContentTypeGroupByIdentifierStructValues(ContentTypeGroup $group) + public function testLoadContentTypeGroupByIdentifierStructValues(ContentTypeGroup $group): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -351,7 +352,7 @@ public function testLoadContentTypeGroupByIdentifierStructValues(ContentTypeGrou * * @depends testLoadContentTypeGroupByIdentifier */ - public function testLoadContentTypeGroupByIdentifierThrowsNotFoundException() + public function testLoadContentTypeGroupByIdentifierThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -413,7 +414,7 @@ public function testLoadContentTypeGroups() * * @depends testLoadContentTypeGroups */ - public function testLoadContentTypeGroupsIdentifiers($groups) + public function testLoadContentTypeGroupsIdentifiers($groups): void { self::assertCount(4, $groups); @@ -444,7 +445,7 @@ public function testLoadContentTypeGroupsIdentifiers($groups) * * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::newContentTypeGroupUpdateStruct() */ - public function testNewContentTypeGroupUpdateStruct() + public function testNewContentTypeGroupUpdateStruct(): void { $repository = $this->getRepository(); @@ -467,7 +468,7 @@ public function testNewContentTypeGroupUpdateStruct() * * @depends testCreateContentTypeGroup */ - public function testUpdateContentTypeGroup() + public function testUpdateContentTypeGroup(): array { $repository = $this->getRepository(); @@ -520,7 +521,7 @@ public function testUpdateContentTypeGroup() * * @depends testUpdateContentTypeGroup */ - public function testUpdateContentTypeGroupStructValues(array $data) + public function testUpdateContentTypeGroupStructValues(array $data): array { $expectedValues = [ 'identifier' => $data['updateStruct']->identifier, @@ -543,7 +544,7 @@ public function testUpdateContentTypeGroupStructValues(array $data) * * @depends testUpdateContentTypeGroupStructValues */ - public function testUpdateContentTypeGroupStructLanguageDependentValues(array $data) + public function testUpdateContentTypeGroupStructLanguageDependentValues(array $data): void { $expectedValues = [ 'identifier' => $data['updateStruct']->identifier, @@ -568,7 +569,7 @@ public function testUpdateContentTypeGroupStructLanguageDependentValues(array $d * * @depends testUpdateContentTypeGroup */ - public function testUpdateContentTypeGroupThrowsInvalidArgumentException() + public function testUpdateContentTypeGroupThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$contentTypeGroupUpdateStruct->identifier\' is invalid: given identifier already exists'); @@ -597,7 +598,7 @@ public function testUpdateContentTypeGroupThrowsInvalidArgumentException() * * @depends testLoadContentTypeGroup */ - public function testDeleteContentTypeGroup() + public function testDeleteContentTypeGroup(): void { $this->expectException(NotFoundException::class); @@ -687,7 +688,7 @@ public function testNewContentTypeCreateStruct() * * @depends testNewContentTypeCreateStruct */ - public function testNewContentTypeCreateStructValues($createStruct) + public function testNewContentTypeCreateStructValues(ValueObject $createStruct): void { $this->assertPropertiesCorrect( [ @@ -742,7 +743,7 @@ public function testNewFieldDefinitionCreateStruct() * * @depends testNewFieldDefinitionCreateStruct */ - public function testNewFieldDefinitionCreateStructValues($createStruct) + public function testNewFieldDefinitionCreateStructValues(ValueObject $createStruct): void { $this->assertPropertiesCorrect( [ @@ -771,7 +772,7 @@ public function testNewFieldDefinitionCreateStructValues($createStruct) * * @depends testDeleteContentTypeGroup */ - public function testDeleteContentTypeGroupThrowsInvalidArgumentException() + public function testDeleteContentTypeGroupThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -799,7 +800,7 @@ public function testDeleteContentTypeGroupThrowsInvalidArgumentException() * @group user * @group field-type */ - public function testCreateContentType() + public function testCreateContentType(): array { $repository = $this->getRepository(); @@ -907,7 +908,7 @@ public function testCreateContentType() * * @param array $data */ - public function testCreateContentTypeStructValues(array $data) + public function testCreateContentTypeStructValues(array $data): void { $typeCreate = $data['typeCreate']; $contentType = $data['contentType']; @@ -1009,7 +1010,7 @@ protected function assertFieldDefinitionsEqual( * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup[] $expectedGroups * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup[] $actualGroups */ - protected function assertContentTypeGroupsCorrect($expectedGroups, $actualGroups) + protected function assertContentTypeGroupsCorrect($expectedGroups, array $actualGroups) { $sorter = static function ($a, $b): int { return strcmp($a->id, $b->id); @@ -1041,7 +1042,7 @@ protected function assertContentTypeGroupsCorrect($expectedGroups, $actualGroups * * @depends testCreateContentType */ - public function testCreateContentTypeThrowsInvalidArgumentExceptionDuplicateIdentifier() + public function testCreateContentTypeThrowsInvalidArgumentExceptionDuplicateIdentifier(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$contentTypeCreateStruct\' is invalid: Another content type with identifier \'folder\' exists'); @@ -1076,7 +1077,7 @@ public function testCreateContentTypeThrowsInvalidArgumentExceptionDuplicateIden * * @depends testCreateContentType */ - public function testCreateContentTypeThrowsInvalidArgumentExceptionDuplicateRemoteId() + public function testCreateContentTypeThrowsInvalidArgumentExceptionDuplicateRemoteId(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Another content type with remoteId \'a3d405b81be900468eb153d774f4f0d2\' exists'); @@ -1111,7 +1112,7 @@ public function testCreateContentTypeThrowsInvalidArgumentExceptionDuplicateRemo * * @depends testCreateContentType */ - public function testCreateContentTypeThrowsInvalidArgumentExceptionDuplicateFieldIdentifier() + public function testCreateContentTypeThrowsInvalidArgumentExceptionDuplicateFieldIdentifier(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$contentTypeCreateStruct\' is invalid: The argument contains duplicate Field definition identifier \'title\''); @@ -1149,7 +1150,7 @@ public function testCreateContentTypeThrowsInvalidArgumentExceptionDuplicateFiel * * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::createContentType */ - public function testCreateContentTypeThrowsInvalidArgumentExceptionDuplicateContentTypeIdentifier() + public function testCreateContentTypeThrowsInvalidArgumentExceptionDuplicateContentTypeIdentifier(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Another content type with identifier \'blog-post\' exists'); @@ -1188,7 +1189,7 @@ public function testCreateContentTypeThrowsInvalidArgumentExceptionDuplicateCont * * @depends testCreateContentType */ - public function testCreateContentTypeThrowsContentTypeFieldDefinitionValidationException() + public function testCreateContentTypeThrowsContentTypeFieldDefinitionValidationException(): void { $repository = $this->getRepository(); @@ -1247,7 +1248,7 @@ public function testCreateContentTypeThrowsContentTypeFieldDefinitionValidationE * * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::createContentTypeGroup */ - public function testCreateContentTypeThrowsInvalidArgumentExceptionGroupsEmpty() + public function testCreateContentTypeThrowsInvalidArgumentExceptionGroupsEmpty(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$contentTypeGroups\' is invalid: The argument must contain at least one content type group'); @@ -1296,7 +1297,7 @@ public function testNewContentTypeUpdateStruct() * * @depends testNewContentTypeUpdateStruct */ - public function testNewContentTypeUpdateStructValues($typeUpdate) + public function testNewContentTypeUpdateStructValues($typeUpdate): void { foreach ($typeUpdate as $propertyName => $propertyValue) { self::assertNull( @@ -1313,7 +1314,7 @@ public function testNewContentTypeUpdateStructValues($typeUpdate) * * @depends testCreateContentType */ - public function testLoadContentTypeDraft() + public function testLoadContentTypeDraft(): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -1339,7 +1340,7 @@ public function testLoadContentTypeDraft() * * @depends testLoadContentTypeDraft */ - public function testLoadContentTypeDraftThrowsNotFoundException() + public function testLoadContentTypeDraftThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -1359,7 +1360,7 @@ public function testLoadContentTypeDraftThrowsNotFoundException() * * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::loadContentTypeDraft() */ - public function testLoadContentTypeDraftThrowsNotFoundExceptionIfDiffrentOwner() + public function testLoadContentTypeDraftThrowsNotFoundExceptionIfDiffrentOwner(): void { $this->expectException(NotFoundException::class); @@ -1380,7 +1381,7 @@ public function testLoadContentTypeDraftThrowsNotFoundExceptionIfDiffrentOwner() * * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::loadContentTypeDraft() */ - public function testCanLoadContentTypeDraftEvenIfDiffrentOwner() + public function testCanLoadContentTypeDraftEvenIfDiffrentOwner(): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -1402,7 +1403,7 @@ public function testCanLoadContentTypeDraftEvenIfDiffrentOwner() * * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::updateContentTypeDraft() */ - public function testUpdateContentTypeDraft() + public function testUpdateContentTypeDraft(): array { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -1456,7 +1457,7 @@ public function testUpdateContentTypeDraft() * * @depends testUpdateContentTypeDraft */ - public function testUpdateContentTypeDraftStructValues($data) + public function testUpdateContentTypeDraftStructValues(array $data): void { $originalType = $data['originalType']; $updateStruct = $data['updateStruct']; @@ -1501,7 +1502,7 @@ public function testUpdateContentTypeDraftStructValues($data) * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function testUpdateContentTypeDraftWithNewTranslation() + public function testUpdateContentTypeDraftWithNewTranslation(): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -1541,7 +1542,7 @@ public function testUpdateContentTypeDraftWithNewTranslation() * * @depends testUpdateContentTypeDraft */ - public function testUpdateContentTypeDraftThrowsInvalidArgumentExceptionDuplicateIdentifier() + public function testUpdateContentTypeDraftThrowsInvalidArgumentExceptionDuplicateIdentifier(): void { $this->expectException(InvalidArgumentException::class); @@ -1566,7 +1567,7 @@ public function testUpdateContentTypeDraftThrowsInvalidArgumentExceptionDuplicat * * @depends testUpdateContentTypeDraft */ - public function testUpdateContentTypeDraftThrowsInvalidArgumentExceptionDuplicateRemoteId() + public function testUpdateContentTypeDraftThrowsInvalidArgumentExceptionDuplicateRemoteId(): void { $this->expectException(InvalidArgumentException::class); @@ -1591,7 +1592,7 @@ public function testUpdateContentTypeDraftThrowsInvalidArgumentExceptionDuplicat * * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::updateContentTypeDraft */ - public function testUpdateContentTypeDraftThrowsInvalidArgumentExceptionNoDraftForAuthenticatedUser() + public function testUpdateContentTypeDraftThrowsInvalidArgumentExceptionNoDraftForAuthenticatedUser(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$contentTypeDraft\' is invalid: There is no content type draft assigned to the authenticated user'); @@ -1630,7 +1631,7 @@ public function testUpdateContentTypeDraftThrowsInvalidArgumentExceptionNoDraftF * * @depends testCreateContentType */ - public function testAddFieldDefinition() + public function testAddFieldDefinition(): array { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -1685,7 +1686,7 @@ public function testAddFieldDefinition() * * @depends testAddFieldDefinition */ - public function testAddFieldDefinitionStructValues(array $data) + public function testAddFieldDefinitionStructValues(array $data): void { $loadedType = $data['loadedType']; $fieldDefCreate = $data['fieldDefCreate']; @@ -1713,7 +1714,7 @@ public function testAddFieldDefinitionStructValues(array $data) * * @depends testAddFieldDefinition */ - public function testAddFieldDefinitionThrowsInvalidArgumentExceptionDuplicateFieldIdentifier() + public function testAddFieldDefinitionThrowsInvalidArgumentExceptionDuplicateFieldIdentifier(): void { $this->expectException(InvalidArgumentException::class); @@ -1740,7 +1741,7 @@ public function testAddFieldDefinitionThrowsInvalidArgumentExceptionDuplicateFie * * @depends testAddFieldDefinition */ - public function testAddFieldDefinitionThrowsContentTypeFieldDefinitionValidationException() + public function testAddFieldDefinitionThrowsContentTypeFieldDefinitionValidationException(): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -1800,7 +1801,7 @@ public function testAddFieldDefinitionThrowsContentTypeFieldDefinitionValidation * * @depends testAddFieldDefinition */ - public function testAddFieldDefinitionThrowsBadStateExceptionNonRepeatableField() + public function testAddFieldDefinitionThrowsBadStateExceptionNonRepeatableField(): void { $this->expectException(BadStateException::class); $this->expectExceptionMessage('The content type already contains a Field definition of the singular Field Type \'ezuser\''); @@ -1841,7 +1842,7 @@ public function testAddFieldDefinitionThrowsBadStateExceptionNonRepeatableField( * * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::createContentType() */ - public function testCreateContentThrowsContentTypeValidationException() + public function testCreateContentThrowsContentTypeValidationException(): void { $this->expectException(ContentTypeValidationException::class); $this->expectExceptionMessage('Field Type \'ezuser\' is singular and cannot be used more than once in a content type'); @@ -1896,7 +1897,7 @@ public function testCreateContentThrowsContentTypeValidationException() * * @depends testAddFieldDefinition */ - public function testAddFieldDefinitionThrowsBadStateExceptionContentInstances() + public function testAddFieldDefinitionThrowsBadStateExceptionContentInstances(): void { $this->expectException(BadStateException::class); $this->expectExceptionMessage('A Field definition of the \'ezuser\' Field Type cannot be added because the content type already has Content items'); @@ -1938,7 +1939,7 @@ public function testAddFieldDefinitionThrowsBadStateExceptionContentInstances() * * @depends testCreateContentType */ - public function testRemoveFieldDefinition() + public function testRemoveFieldDefinition(): array { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -1973,7 +1974,7 @@ public function testRemoveFieldDefinition() * * @depends testRemoveFieldDefinition */ - public function testRemoveFieldDefinitionRemoved(array $data) + public function testRemoveFieldDefinitionRemoved(array $data): void { $removedFieldDefinition = $data['removedFieldDefinition']; $loadedType = $data['loadedType']; @@ -1997,7 +1998,7 @@ public function testRemoveFieldDefinitionRemoved(array $data) * * @depends testRemoveFieldDefinition */ - public function testRemoveFieldDefinitionThrowsInvalidArgumentException() + public function testRemoveFieldDefinitionThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -2024,7 +2025,7 @@ public function testRemoveFieldDefinitionThrowsInvalidArgumentException() * * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::removeFieldDefinition */ - public function testRemoveFieldDefinitionThrowsInvalidArgumentExceptionOnWrongDraft() + public function testRemoveFieldDefinitionThrowsInvalidArgumentExceptionOnWrongDraft(): void { $this->expectException(InvalidArgumentException::class); @@ -2047,7 +2048,7 @@ public function testRemoveFieldDefinitionThrowsInvalidArgumentExceptionOnWrongDr * * @depends testRemoveFieldDefinition */ - public function testRemoveFieldDefinitionRemovesFieldFromContent() + public function testRemoveFieldDefinitionRemovesFieldFromContent(): array { $repository = $this->getRepository(); @@ -2118,7 +2119,7 @@ public function testRemoveFieldDefinitionRemovesFieldFromContent() * * @depends testRemoveFieldDefinitionRemovesFieldFromContent */ - public function testRemoveFieldDefinitionRemovesFieldFromContentRemoved($data) + public function testRemoveFieldDefinitionRemovesFieldFromContentRemoved($data): void { list( $contentVersion1Archived, @@ -2147,7 +2148,7 @@ public function testRemoveFieldDefinitionRemovesFieldFromContentRemoved($data) * * @depends testAddFieldDefinition */ - public function testAddFieldDefinitionAddsFieldToContent() + public function testAddFieldDefinitionAddsFieldToContent(): array { $repository = $this->getRepository(); @@ -2239,7 +2240,7 @@ public function testAddFieldDefinitionAddsFieldToContent() * * @depends testAddFieldDefinitionAddsFieldToContent */ - public function testAddFieldDefinitionAddsFieldToContentAdded(array $data) + public function testAddFieldDefinitionAddsFieldToContentAdded(array $data): void { list( $contentVersion1Archived, @@ -2302,7 +2303,7 @@ public function testNewFieldDefinitionUpdateStruct() * * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct */ - public function testNewFieldDefinitionUpdateStructValues($fieldDefinitionUpdateStruct) + public function testNewFieldDefinitionUpdateStructValues($fieldDefinitionUpdateStruct): void { foreach ($fieldDefinitionUpdateStruct as $propertyName => $propertyValue) { self::assertNull( @@ -2321,7 +2322,7 @@ public function testNewFieldDefinitionUpdateStructValues($fieldDefinitionUpdateS * * @depends testLoadContentTypeDraft */ - public function testUpdateFieldDefinition() + public function testUpdateFieldDefinition(): array { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -2375,7 +2376,7 @@ public function testUpdateFieldDefinition() /** * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::updateFieldDefinition */ - public function testUpdateFieldDefinitionWithNewTranslation() + public function testUpdateFieldDefinitionWithNewTranslation(): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -2445,7 +2446,7 @@ public function testUpdateFieldDefinitionWithNewTranslation() * * @depends testUpdateFieldDefinition */ - public function testUpdateFieldDefinitionStructValues(array $data) + public function testUpdateFieldDefinitionStructValues(array $data): void { $originalField = $data['originalField']; $updatedField = $data['updatedField']; @@ -2477,7 +2478,7 @@ public function testUpdateFieldDefinitionStructValues(array $data) * @covers \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionUpdateStruct * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::updateFieldDefinition */ - public function testUpdateFieldDefinitionWithEmptyStruct() + public function testUpdateFieldDefinitionWithEmptyStruct(): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -2505,7 +2506,7 @@ public function testUpdateFieldDefinitionWithEmptyStruct() * * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::updateFieldDefinition */ - public function testUpdateFieldDefinitionThrowsInvalidArgumentExceptionFieldIdentifierExists() + public function testUpdateFieldDefinitionThrowsInvalidArgumentExceptionFieldIdentifierExists(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$fieldDefinitionUpdateStruct\' is invalid: Another Field definition with identifier \'title\' exists in the content type'); @@ -2538,7 +2539,7 @@ public function testUpdateFieldDefinitionThrowsInvalidArgumentExceptionFieldIden * * @depends testLoadContentTypeDraft */ - public function testUpdateFieldDefinitionThrowsInvalidArgumentExceptionForUndefinedField() + public function testUpdateFieldDefinitionThrowsInvalidArgumentExceptionForUndefinedField(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$fieldDefinition\' is invalid: The given Field definition does not belong to the content type'); @@ -2572,7 +2573,7 @@ public function testUpdateFieldDefinitionThrowsInvalidArgumentExceptionForUndefi * * @depends testLoadContentTypeDraft */ - public function testPublishContentTypeDraft() + public function testPublishContentTypeDraft(): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -2602,7 +2603,7 @@ public function testPublishContentTypeDraft() * * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::publishContentTypeDraft */ - public function testPublishContentTypeDraftSetsNameSchema() + public function testPublishContentTypeDraftSetsNameSchema(): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -2638,7 +2639,7 @@ public function testPublishContentTypeDraftSetsNameSchema() * * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::publishContentTypeDraft */ - public function testPublishContentTypeDraftRefreshesContentTypesList() + public function testPublishContentTypeDraftRefreshesContentTypesList(): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -2694,7 +2695,7 @@ static function (ContentType $contentType) { * * @depends testPublishContentTypeDraft */ - public function testPublishContentTypeDraftThrowsBadStateException() + public function testPublishContentTypeDraftThrowsBadStateException(): void { $this->expectException(BadStateException::class); @@ -2718,7 +2719,7 @@ public function testPublishContentTypeDraftThrowsBadStateException() * * @depends testPublishContentTypeDraft */ - public function testPublishContentTypeDraftThrowsInvalidArgumentExceptionWithoutFields() + public function testPublishContentTypeDraftThrowsInvalidArgumentExceptionWithoutFields(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$contentTypeDraft\' is invalid: The content type draft should have at least one Field definition'); @@ -2783,7 +2784,7 @@ public function testLoadContentType() * * @param string[] $languageCodes */ - public function testLoadContentTypeWithPrioritizedLanguagesList(array $languageCodes) + public function testLoadContentTypeWithPrioritizedLanguagesList(array $languageCodes): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -2818,7 +2819,7 @@ public function testLoadContentTypeWithPrioritizedLanguagesList(array $languageC /** * @return array */ - public function getPrioritizedLanguageList() + public function getPrioritizedLanguageList(): array { return [ [[]], @@ -2836,7 +2837,7 @@ public function getPrioritizedLanguageList() * * @depends testLoadContentType */ - public function testLoadContentTypeStructValues($userGroupType) + public function testLoadContentTypeStructValues(ValueObject $userGroupType) { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -2878,7 +2879,7 @@ public function testLoadContentTypeStructValues($userGroupType) * * @depends testLoadContentTypeStructValues */ - public function testLoadContentTypeFieldDefinitions(APIFieldDefinitionCollection $fieldDefinitions) + public function testLoadContentTypeFieldDefinitions(APIFieldDefinitionCollection $fieldDefinitions): void { $expectedFieldDefinitions = [ 'name' => [ @@ -2974,7 +2975,7 @@ static function ($fieldDefinition) { * * @depends testLoadContentType */ - public function testLoadContentTypeThrowsNotFoundException() + public function testLoadContentTypeThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -3027,7 +3028,7 @@ public function testLoadContentTypeByIdentifier() * * @depends testLoadContentTypeByIdentifier */ - public function testLoadContentTypeByIdentifierReturnsCorrectInstance($contentType) + public function testLoadContentTypeByIdentifierReturnsCorrectInstance($contentType): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -3045,7 +3046,7 @@ public function testLoadContentTypeByIdentifierReturnsCorrectInstance($contentTy * * @depends testLoadContentTypeByIdentifier */ - public function testLoadContentTypeByIdentifierThrowsNotFoundException() + public function testLoadContentTypeByIdentifierThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -3094,7 +3095,7 @@ public function testLoadContentTypeByRemoteId() * * @depends testLoadContentTypeByRemoteId */ - public function testLoadContentTypeByRemoteIdReturnsCorrectInstance($contentType) + public function testLoadContentTypeByRemoteIdReturnsCorrectInstance($contentType): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -3112,7 +3113,7 @@ public function testLoadContentTypeByRemoteIdReturnsCorrectInstance($contentType * * @depends testLoadContentType */ - public function testLoadContentTypeByRemoteIdThrowsNotFoundException() + public function testLoadContentTypeByRemoteIdThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -3133,7 +3134,7 @@ public function testLoadContentTypeByRemoteIdThrowsNotFoundException() * * @depends testLoadContentType */ - public function testLoadContentTypeList() + public function testLoadContentTypeList(): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -3185,7 +3186,7 @@ public function testLoadContentTypes() * * @depends testLoadContentTypes */ - public function testLoadContentTypesContent(array $types) + public function testLoadContentTypesContent(array $types): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -3216,7 +3217,7 @@ static function ($a, $b): int { * * @depends testLoadContentType */ - public function testCreateContentTypeDraft() + public function testCreateContentTypeDraft(): array { $repository = $this->getRepository(); @@ -3246,7 +3247,7 @@ public function testCreateContentTypeDraft() * * @depends testCreateContentTypeDraft */ - public function testCreateContentTypeDraftStructValues(array $data) + public function testCreateContentTypeDraftStructValues(array $data): array { $originalType = $data['originalType']; $typeDraft = $data['typeDraft']; @@ -3299,7 +3300,7 @@ public function testCreateContentTypeDraftStructValues(array $data) * * @depends testCreateContentTypeDraftStructValues */ - public function testCreateContentTypeDraftStructLanguageDependentValues(array $data) + public function testCreateContentTypeDraftStructLanguageDependentValues(array $data): void { $originalType = $data['originalType']; $typeDraft = $data['typeDraft']; @@ -3323,7 +3324,7 @@ public function testCreateContentTypeDraftStructLanguageDependentValues(array $d * * @depends testCreateContentTypeDraft */ - public function testCreateContentTypeDraftThrowsBadStateException() + public function testCreateContentTypeDraftThrowsBadStateException(): void { $this->expectException(BadStateException::class); @@ -3348,7 +3349,7 @@ public function testCreateContentTypeDraftThrowsBadStateException() * * @depends testLoadContentTypeByIdentifier */ - public function testDeleteContentType() + public function testDeleteContentType(): void { $this->expectException(NotFoundException::class); @@ -3373,7 +3374,7 @@ public function testDeleteContentType() * * @depends testDeleteContentType */ - public function testDeleteContentTypeThrowsBadStateException() + public function testDeleteContentTypeThrowsBadStateException(): void { $this->expectException(BadStateException::class); @@ -3399,7 +3400,7 @@ public function testDeleteContentTypeThrowsBadStateException() * * @depends testLoadContentTypeByIdentifier */ - public function testCopyContentType() + public function testCopyContentType(): array { $repository = $this->getRepository(); @@ -3446,7 +3447,7 @@ public function testCopyContentType() * * @depends testCopyContentType */ - public function testCopyContentTypeStructValues(array $data) + public function testCopyContentTypeStructValues(array $data): void { $originalType = $data['originalType']; $copiedType = $data['copiedType']; @@ -3459,7 +3460,7 @@ public function testCopyContentTypeStructValues(array $data) * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $copiedType * @param array $excludedProperties */ - private function assertCopyContentTypeValues($originalType, $copiedType, $excludedProperties = []) + private function assertCopyContentTypeValues(ValueObject $originalType, ValueObject $copiedType, array $excludedProperties = []): void { $allProperties = [ 'names', @@ -3537,7 +3538,7 @@ private function assertCopyContentTypeValues($originalType, $copiedType, $exclud * * @depends testCopyContentType */ - public function testCopyContentTypeWithSecondParameter() + public function testCopyContentTypeWithSecondParameter(): void { $repository = $this->getRepository(); @@ -3571,7 +3572,7 @@ public function testCopyContentTypeWithSecondParameter() * @depends testLoadContentTypeByIdentifier * @depends testLoadContentType */ - public function testAssignContentTypeGroup() + public function testAssignContentTypeGroup(): void { $repository = $this->getRepository(); @@ -3606,7 +3607,7 @@ public function testAssignContentTypeGroup() * * @depends testAssignContentTypeGroup */ - public function testAssignContentTypeGroupThrowsInvalidArgumentException() + public function testAssignContentTypeGroupThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -3632,7 +3633,7 @@ public function testAssignContentTypeGroupThrowsInvalidArgumentException() * * @depends testAssignContentTypeGroup */ - public function testUnassignContentTypeGroup() + public function testUnassignContentTypeGroup(): void { $repository = $this->getRepository(); @@ -3671,7 +3672,7 @@ public function testUnassignContentTypeGroup() * * @depends testUnassignContentTypeGroup */ - public function testUnassignContentTypeGroupThrowsInvalidArgumentException() + public function testUnassignContentTypeGroupThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -3695,7 +3696,7 @@ public function testUnassignContentTypeGroupThrowsInvalidArgumentException() * * @depends testUnassignContentTypeGroup */ - public function testUnassignContentTypeGroupThrowsBadStateException() + public function testUnassignContentTypeGroupThrowsBadStateException(): void { $this->expectException(BadStateException::class); @@ -3722,7 +3723,7 @@ public function testUnassignContentTypeGroupThrowsBadStateException() * @depends testLoadContentTypeGroup * @depends testCreateContentTypeGroup */ - public function testCreateContentTypeGroupInTransactionWithRollback() + public function testCreateContentTypeGroupInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -3769,7 +3770,7 @@ public function testCreateContentTypeGroupInTransactionWithRollback() * @depends testLoadContentTypeGroup * @depends testCreateContentTypeGroup */ - public function testCreateContentTypeGroupInTransactionWithCommit() + public function testCreateContentTypeGroupInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -3812,7 +3813,7 @@ public function testCreateContentTypeGroupInTransactionWithCommit() * @depends testUpdateContentTypeGroup * @depends testLoadContentTypeGroupByIdentifier */ - public function testUpdateContentTypeGroupInTransactionWithRollback() + public function testUpdateContentTypeGroupInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -3856,7 +3857,7 @@ public function testUpdateContentTypeGroupInTransactionWithRollback() * @depends testUpdateContentTypeGroup * @depends testLoadContentTypeGroupByIdentifier */ - public function testUpdateContentTypeGroupInTransactionWithCommit() + public function testUpdateContentTypeGroupInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -3902,7 +3903,7 @@ public function testUpdateContentTypeGroupInTransactionWithCommit() * @depends testDeleteContentTypeGroup * @depends testLoadContentTypeGroupByIdentifierThrowsNotFoundException */ - public function testDeleteContentTypeGroupWithRollback() + public function testDeleteContentTypeGroupWithRollback(): void { $repository = $this->getRepository(); @@ -3951,7 +3952,7 @@ public function testDeleteContentTypeGroupWithRollback() * @depends testDeleteContentTypeGroup * @depends testLoadContentTypeGroupByIdentifierThrowsNotFoundException */ - public function testDeleteContentTypeGroupWithCommit() + public function testDeleteContentTypeGroupWithCommit(): void { $repository = $this->getRepository(); @@ -4000,7 +4001,7 @@ public function testDeleteContentTypeGroupWithCommit() * @depends testCreateContentType * @depends testLoadContentTypeByIdentifierThrowsNotFoundException */ - public function testCreateContentTypeInTransactionWithRollback() + public function testCreateContentTypeInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -4061,7 +4062,7 @@ public function testCreateContentTypeInTransactionWithRollback() * @depends testCreateContentType * @depends testLoadContentTypeByIdentifierThrowsNotFoundException */ - public function testCreateContentTypeInTransactionWithCommit() + public function testCreateContentTypeInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -4119,7 +4120,7 @@ public function testCreateContentTypeInTransactionWithCommit() * @depends testLoadContentTypeByIdentifier * @depends testLoadContentTypeThrowsNotFoundException */ - public function testCopyContentTypeInTransactionWithRollback() + public function testCopyContentTypeInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -4164,7 +4165,7 @@ public function testCopyContentTypeInTransactionWithRollback() * @depends testLoadContentTypeByIdentifier * @depends testLoadContentTypeThrowsNotFoundException */ - public function testCopyContentTypeInTransactionWithCommit() + public function testCopyContentTypeInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -4204,7 +4205,7 @@ public function testCopyContentTypeInTransactionWithCommit() * @depends testCopyContentType * @depends testLoadContentTypeByIdentifierThrowsNotFoundException */ - public function testDeleteContentTypeInTransactionWithRollback() + public function testDeleteContentTypeInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -4244,7 +4245,7 @@ public function testDeleteContentTypeInTransactionWithRollback() * @depends testCopyContentType * @depends testLoadContentTypeByIdentifierThrowsNotFoundException */ - public function testDeleteContentTypeInTransactionWithCommit() + public function testDeleteContentTypeInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -4287,7 +4288,7 @@ public function testDeleteContentTypeInTransactionWithCommit() * * @depends testAssignContentTypeGroup */ - public function testAssignContentTypeGroupInTransactionWithRollback() + public function testAssignContentTypeGroupInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -4334,7 +4335,7 @@ public function testAssignContentTypeGroupInTransactionWithRollback() * * @depends testAssignContentTypeGroup */ - public function testAssignContentTypeGroupInTransactionWithCommit() + public function testAssignContentTypeGroupInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -4379,7 +4380,7 @@ public function testAssignContentTypeGroupInTransactionWithCommit() * * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::isContentTypeUsed() */ - public function testIsContentTypeUsed() + public function testIsContentTypeUsed(): void { $repository = $this->getRepository(); @@ -4405,7 +4406,7 @@ public function testIsContentTypeUsed() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function testRemoveContentTypeTranslation() + public function testRemoveContentTypeTranslation(): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -4447,7 +4448,7 @@ public function testRemoveContentTypeTranslation() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function testRemoveContentTypeTranslationWithMultilingualData() + public function testRemoveContentTypeTranslationWithMultilingualData(): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -4509,7 +4510,7 @@ public function testRemoveContentTypeTranslationWithMultilingualData() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function testUpdateContentTypeDraftWithNewTranslationWithMultilingualData() + public function testUpdateContentTypeDraftWithNewTranslationWithMultilingualData(): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -4638,7 +4639,7 @@ public function testUpdateContentTypeDraftWithNewTranslationWithMultilingualData * * @covers \Ibexa\Contracts\Core\Repository\ContentTypeService::deleteUserDrafts() */ - public function testDeleteUserDrafts() + public function testDeleteUserDrafts(): void { $this->expectException(NotFoundException::class); diff --git a/tests/integration/Core/Repository/FieldType/AuthorIntegrationTest.php b/tests/integration/Core/Repository/FieldType/AuthorIntegrationTest.php index a1a200a2f8..14dd68e1c2 100644 --- a/tests/integration/Core/Repository/FieldType/AuthorIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/AuthorIntegrationTest.php @@ -12,6 +12,7 @@ use Ibexa\Core\FieldType\Author\Author; use Ibexa\Core\FieldType\Author\AuthorCollection; use Ibexa\Core\FieldType\Author\Type; +use Ibexa\Core\FieldType\Author\Value; use Ibexa\Core\FieldType\Author\Value as AuthorValue; /** @@ -37,7 +38,7 @@ public function getTypeName(): string * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return [ 'defaultAuthor' => [ @@ -52,7 +53,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return [ 'defaultAuthor' => Type::DEFAULT_VALUE_EMPTY, @@ -64,7 +65,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -76,7 +77,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return []; } @@ -86,7 +87,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return []; } @@ -96,7 +97,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'unknown' => ['value' => 42], @@ -108,7 +109,7 @@ public function getInvalidValidatorConfiguration() * * @return \Ibexa\Core\FieldType\Author\Value */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { return new AuthorValue( [ @@ -141,7 +142,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( AuthorValue::class, @@ -188,7 +189,7 @@ public function assertFieldDataLoadedCorrect(Field $field) * * @return array[] */ - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ ['Sindelfingen', InvalidArgumentException::class], @@ -200,7 +201,7 @@ public function provideInvalidCreationFieldData() * * @return \Ibexa\Core\FieldType\Author\Value */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): Value { return new AuthorValue( [ @@ -222,7 +223,7 @@ public function getValidUpdateFieldData() * * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( AuthorValue::class, @@ -261,7 +262,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( AuthorValue::class, @@ -307,7 +308,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -340,7 +341,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -366,7 +367,7 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new AuthorValue()], @@ -374,7 +375,7 @@ public function providerForTestIsEmptyValue() ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ @@ -396,7 +397,7 @@ public function providerForTestIsNotEmptyValue() ]; } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): array { return [ new Author( @@ -409,7 +410,7 @@ protected function getValidSearchValueOne() ]; } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): array { return [ new Author( @@ -432,7 +433,7 @@ protected function getSearchTargetValueTwo(): string return 'Greta'; } - protected function getAdditionallyIndexedFieldData() + protected function getAdditionallyIndexedFieldData(): array { return [ [ @@ -453,7 +454,7 @@ protected function getAdditionallyIndexedFieldData() ]; } - protected function getValidMultivaluedSearchValuesOne() + protected function getValidMultivaluedSearchValuesOne(): array { return [ new Author( @@ -473,7 +474,7 @@ protected function getValidMultivaluedSearchValuesOne() ]; } - protected function getValidMultivaluedSearchValuesTwo() + protected function getValidMultivaluedSearchValuesTwo(): array { return [ new Author( @@ -500,17 +501,17 @@ protected function getValidMultivaluedSearchValuesTwo() ]; } - protected function getMultivaluedSearchTargetValuesOne() + protected function getMultivaluedSearchTargetValuesOne(): array { return ['Antoinette', 'Ferdinand']; } - protected function getMultivaluedSearchTargetValuesTwo() + protected function getMultivaluedSearchTargetValuesTwo(): array { return ['Greta', 'Leopold', 'Maximilian']; } - protected function getAdditionallyIndexedMultivaluedFieldData() + protected function getAdditionallyIndexedMultivaluedFieldData(): array { return [ [ @@ -526,7 +527,7 @@ protected function getAdditionallyIndexedMultivaluedFieldData() ]; } - protected function getFullTextIndexedFieldData() + protected function getFullTextIndexedFieldData(): array { return [ ['Ferdinand', 'Greta'], diff --git a/tests/integration/Core/Repository/FieldType/BaseIntegrationTest.php b/tests/integration/Core/Repository/FieldType/BaseIntegrationTest.php index db760b6274..fff0883967 100644 --- a/tests/integration/Core/Repository/FieldType/BaseIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/BaseIntegrationTest.php @@ -259,7 +259,7 @@ abstract public function provideFromHashData(); * @param \Ibexa\Contracts\Core\Repository $repository * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ - public function postCreationHook(Repository\Repository $repository, Repository\Values\Content\Content $content) + public function postCreationHook(Repository\Repository $repository, Content $content): void { // Do nothing by default } @@ -387,7 +387,7 @@ protected function getOverride($key, array $overrideValues, $default) * * @dataProvider providerForTestIsEmptyValue */ - public function testIsEmptyValue($value) + public function testIsEmptyValue($value): void { self::assertTrue($this->getRepository()->getFieldTypeService()->getFieldType($this->getTypeName())->isEmptyValue($value)); } @@ -399,7 +399,7 @@ abstract public function providerForTestIsEmptyValue(); * * @dataProvider providerForTestIsNotEmptyValue */ - public function testIsNotEmptyValue($value) + public function testIsNotEmptyValue($value): void { self::assertFalse($this->getRepository()->getFieldTypeService()->getFieldType($this->getTypeName())->isEmptyValue($value)); } @@ -409,7 +409,7 @@ abstract public function providerForTestIsNotEmptyValue(); /** * @depends testCreateContentType */ - public function testContentTypeField($contentType) + public function testContentTypeField($contentType): void { self::assertSame( $this->getTypeName(), @@ -443,7 +443,7 @@ public function testLoadContentTypeFieldType($contentType) return $contentType->fieldDefinitions[1]; } - public function testSettingsSchema() + public function testSettingsSchema(): void { $repository = $this->getRepository(); $fieldTypeService = $repository->getFieldTypeService(); @@ -458,7 +458,7 @@ public function testSettingsSchema() /** * @depends testLoadContentTypeFieldType */ - public function testLoadContentTypeFieldData(FieldDefinition $fieldDefinition) + public function testLoadContentTypeFieldData(FieldDefinition $fieldDefinition): void { self::assertEquals( $this->getTypeName(), @@ -480,7 +480,7 @@ public function testLoadContentTypeFieldData(FieldDefinition $fieldDefinition) /** * @depends testCreateContentType */ - public function testCreateContentTypeFailsWithInvalidFieldSettings() + public function testCreateContentTypeFailsWithInvalidFieldSettings(): void { $this->expectException(ContentTypeFieldDefinitionValidationException::class); @@ -490,7 +490,7 @@ public function testCreateContentTypeFailsWithInvalidFieldSettings() ); } - public function testValidatorSchema() + public function testValidatorSchema(): void { $repository = $this->getRepository(); $fieldTypeService = $repository->getFieldTypeService(); @@ -505,7 +505,7 @@ public function testValidatorSchema() /** * @depends testCreateContentType */ - public function testCreateContentTypeFailsWithInvalidValidatorConfiguration() + public function testCreateContentTypeFailsWithInvalidValidatorConfiguration(): void { $this->expectException(ContentTypeFieldDefinitionValidationException::class); @@ -645,7 +645,7 @@ public function testPublishedFieldType($content) /** * @depends testPublishContent */ - public function testPublishedName(Content $content) + public function testPublishedName(Content $content): void { self::assertEquals( $content->getFieldValue('name') . ' ' . $this->getFieldName(), @@ -685,7 +685,7 @@ public function testLoadFieldType() /** * @depends testLoadFieldType */ - public function testLoadExternalData() + public function testLoadExternalData(): void { $this->assertFieldDataLoadedCorrect($this->testLoadFieldType()); } @@ -705,7 +705,7 @@ public function testCreateContentWithEmptyFieldValue() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $contentDraft */ - public function testPublishContentWithEmptyFieldValue(Content $contentDraft) + public function testPublishContentWithEmptyFieldValue(Content $contentDraft): void { $this->getRepository(false)->getContentService()->publishVersion( $contentDraft->versionInfo @@ -758,7 +758,7 @@ public function testLoadEmptyFieldValueType($content) /** * @depends testLoadEmptyFieldValueType */ - public function testLoadEmptyFieldValueData($field) + public function testLoadEmptyFieldValueData($field): void { /** @var \Ibexa\Core\FieldType\FieldType $fieldType */ $fieldType = $this->getRepository()->getFieldTypeService()->getFieldType($this->getTypeName()); @@ -828,7 +828,7 @@ public function testUpdateTypeFieldStillAvailable($content) /** * @depends testUpdateTypeFieldStillAvailable */ - public function testUpdatedDataCorrect(Field $field) + public function testUpdatedDataCorrect(Field $field): void { $this->assertUpdatedFieldDataLoadedCorrect($field); } @@ -858,7 +858,7 @@ public function testUpdateNoNewContentTypeFieldStillAvailable($content) /** * @depends testUpdateNoNewContentTypeFieldStillAvailable */ - public function testUpdatedNoNewContentDataCorrect(Field $field) + public function testUpdatedNoNewContentDataCorrect(Field $field): void { $this->assertFieldDataLoadedCorrect($field); } @@ -904,7 +904,7 @@ public function testCopiedFieldType($content) /** * @depends testCopiedFieldType */ - public function testCopiedExternalData(Field $field) + public function testCopiedExternalData(Field $field): void { $this->assertCopiedFieldDataLoadedCorrectly($field); } @@ -912,7 +912,7 @@ public function testCopiedExternalData(Field $field) /** * @depends testCopyField */ - public function testDeleteContent($content) + public function testDeleteContent($content): void { $this->expectException(NotFoundException::class); @@ -947,7 +947,7 @@ public function testCreateContentFails($failingValue, ?string $expectedException * * @dataProvider provideInvalidUpdateFieldData */ - public function testUpdateContentFails($failingValue, $expectedException) + public function testUpdateContentFails($failingValue, string $expectedException): void { $this->expectException($expectedException); $this->updateContent($failingValue); @@ -973,7 +973,7 @@ protected function removeFieldDefinition() /** * Tests removal of field definition from the ContentType of the Content. */ - public function testRemoveFieldDefinition() + public function testRemoveFieldDefinition(): void { $content = $this->removeFieldDefinition(); @@ -1010,7 +1010,7 @@ protected function addFieldDefinition() /** * Tests addition of field definition from the ContentType of the Content. */ - public function testAddFieldDefinition() + public function testAddFieldDefinition(): void { $content = $this->addFieldDefinition(); @@ -1028,7 +1028,7 @@ public function testAddFieldDefinition() /** * @dataProvider provideToHashData */ - public function testToHash($value, $expectedHash) + public function testToHash($value, $expectedHash): void { $repository = $this->getRepository(); $fieldTypeService = $repository->getFieldTypeService(); @@ -1048,7 +1048,7 @@ public function testToHash($value, $expectedHash) * @todo: Requires correct registered FieldTypeService, needs to be * maintained! */ - public function testFromHash($hash, $expectedValue) + public function testFromHash($hash, $expectedValue): void { $repository = $this->getRepository(); $fieldTypeService = $repository->getFieldTypeService(); @@ -1063,7 +1063,7 @@ public function testFromHash($hash, $expectedValue) /** * Test that exceeding default version archive limit has no effect on a published content. */ - public function testExceededVersionArchiveLimitHasNoEffectOnContent() + public function testExceededVersionArchiveLimitHasNoEffectOnContent(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -1088,7 +1088,7 @@ public function testExceededVersionArchiveLimitHasNoEffectOnContent() /** * Test that deleting new draft does not affect data of published version. */ - public function testDeleteDraftOfPublishedContentDoesNotDeleteData() + public function testDeleteDraftOfPublishedContentDoesNotDeleteData(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -1110,7 +1110,7 @@ public function testDeleteDraftOfPublishedContentDoesNotDeleteData() /** * Test creating new translation from existing content with empty field. */ - public function testUpdateContentWithNewTranslationOnEmptyField() + public function testUpdateContentWithNewTranslationOnEmptyField(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -1152,7 +1152,7 @@ public function getValidMultilingualFieldData(array $languageCodes) * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteTranslation */ - public function testDeleteTranslation() + public function testDeleteTranslation(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); diff --git a/tests/integration/Core/Repository/FieldType/CheckboxIntegrationTest.php b/tests/integration/Core/Repository/FieldType/CheckboxIntegrationTest.php index 537552f3b5..beaa83a124 100644 --- a/tests/integration/Core/Repository/FieldType/CheckboxIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/CheckboxIntegrationTest.php @@ -15,6 +15,7 @@ use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Test\Repository\SetupFactory\Legacy; use Ibexa\Core\Base\Exceptions\InvalidArgumentType; +use Ibexa\Core\FieldType\Checkbox\Value; use Ibexa\Core\FieldType\Checkbox\Value as CheckboxValue; /** @@ -42,7 +43,7 @@ public function getTypeName(): string * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return []; } @@ -52,7 +53,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return []; } @@ -62,7 +63,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -74,7 +75,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return []; } @@ -84,7 +85,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return []; } @@ -94,7 +95,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'unknown' => ['value' => 42], @@ -106,7 +107,7 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { return new CheckboxValue(true); } @@ -129,7 +130,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( CheckboxValue::class, @@ -145,7 +146,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -160,7 +161,7 @@ public function provideInvalidCreationFieldData() * * @return array */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): Value { return new CheckboxValue(false); } @@ -172,7 +173,7 @@ public function getValidUpdateFieldData() * * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( CheckboxValue::class, @@ -201,7 +202,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( CheckboxValue::class, @@ -237,7 +238,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -254,7 +255,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -264,12 +265,12 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return []; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [$this->getValidCreationFieldData()], diff --git a/tests/integration/Core/Repository/FieldType/CountryIntegrationTest.php b/tests/integration/Core/Repository/FieldType/CountryIntegrationTest.php index b74fb63e7b..88c649171a 100644 --- a/tests/integration/Core/Repository/FieldType/CountryIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/CountryIntegrationTest.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException; use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\Values\Content\Field; +use Ibexa\Core\FieldType\Country\Value; use Ibexa\Core\FieldType\Country\Value as CountryValue; /** @@ -35,7 +36,7 @@ public function getTypeName(): string * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return [ 'isMultiple' => [ @@ -50,7 +51,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return [ 'isMultiple' => false, @@ -62,7 +63,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -74,7 +75,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return []; } @@ -84,7 +85,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return []; } @@ -94,7 +95,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'unknown' => ['value' => 42], @@ -106,7 +107,7 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { return new CountryValue( [ @@ -138,7 +139,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( CountryValue::class, @@ -162,7 +163,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -198,7 +199,7 @@ public function provideInvalidCreationFieldData() * * @return array */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): Value { return new CountryValue( [ @@ -219,7 +220,7 @@ public function getValidUpdateFieldData() * * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( CountryValue::class, @@ -255,7 +256,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( CountryValue::class, @@ -298,7 +299,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -330,7 +331,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -355,7 +356,7 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new CountryValue()], @@ -363,7 +364,7 @@ public function providerForTestIsEmptyValue() ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ @@ -372,12 +373,12 @@ public function providerForTestIsNotEmptyValue() ]; } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): array { return ['Andorra']; } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): array { return ['Trinidad and Tobago']; } @@ -392,7 +393,7 @@ protected function getSearchTargetValueTwo(): string return 'Trinidad and Tobago'; } - protected function getAdditionallyIndexedFieldData() + protected function getAdditionallyIndexedFieldData(): array { return [ [ @@ -423,17 +424,17 @@ protected function getAdditionallyIndexedFieldData() ]; } - protected function getValidMultivaluedSearchValuesOne() + protected function getValidMultivaluedSearchValuesOne(): array { return ['Andorra', 'Bolivia']; } - protected function getValidMultivaluedSearchValuesTwo() + protected function getValidMultivaluedSearchValuesTwo(): array { return ['Syrian Arab Republic', 'Trinidad and Tobago']; } - protected function getAdditionallyIndexedMultivaluedFieldData() + protected function getAdditionallyIndexedMultivaluedFieldData(): array { return [ [ @@ -459,7 +460,7 @@ protected function getAdditionallyIndexedMultivaluedFieldData() ]; } - protected function getFullTextIndexedFieldData() + protected function getFullTextIndexedFieldData(): array { return [ ['Andorra', 'Tobago'], diff --git a/tests/integration/Core/Repository/FieldType/DateAndTimeIntegrationTest.php b/tests/integration/Core/Repository/FieldType/DateAndTimeIntegrationTest.php index 9c2616cdad..2699ebbe09 100644 --- a/tests/integration/Core/Repository/FieldType/DateAndTimeIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/DateAndTimeIntegrationTest.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Contracts\Core\Test\Repository\SetupFactory\Legacy; +use Ibexa\Core\FieldType\DateAndTime\Value; use Ibexa\Core\FieldType\DateAndTime\Value as DateAndTimeValue; /** @@ -46,7 +47,7 @@ protected function supportsLikeWildcard($value): bool * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return [ 'useSeconds' => [ @@ -69,7 +70,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return [ 'useSeconds' => false, @@ -83,7 +84,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -95,7 +96,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return []; } @@ -105,7 +106,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return []; } @@ -115,7 +116,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'unknown' => ['value' => 42], @@ -127,7 +128,7 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { // We may only create times from timestamps here, since storing will // loose information about the timezone. @@ -152,7 +153,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( DateAndTimeValue::class, @@ -160,7 +161,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); $expectedData = [ - 'value' => new \DateTime('@123456'), + 'value' => new DateTime('@123456'), ]; $this->assertPropertiesCorrect( $expectedData, @@ -168,7 +169,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -182,7 +183,7 @@ public function provideInvalidCreationFieldData() * * @return array */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): Value { return DateAndTimeValue::fromTimestamp(12345678); } @@ -194,7 +195,7 @@ public function getValidUpdateFieldData() * * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( DateAndTimeValue::class, @@ -202,7 +203,7 @@ public function assertUpdatedFieldDataLoadedCorrect(Field $field) ); $expectedData = [ - 'value' => new \DateTime('@12345678'), + 'value' => new DateTime('@12345678'), ]; $this->assertPropertiesCorrect( $expectedData, @@ -223,7 +224,7 @@ public function provideInvalidUpdateFieldData() * * @dataProvider provideInvalidUpdateFieldData */ - public function testUpdateContentFails($failingValue, $expectedException) + public function testUpdateContentFails($failingValue, $expectedException): array { return [ [ @@ -240,7 +241,7 @@ public function testUpdateContentFails($failingValue, $expectedException) * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( DateAndTimeValue::class, @@ -248,7 +249,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) ); $expectedData = [ - 'value' => new \DateTime('@123456'), + 'value' => new DateTime('@123456'), ]; $this->assertPropertiesCorrect( $expectedData, @@ -276,7 +277,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -296,7 +297,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -309,14 +310,14 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new DateAndTimeValue()], ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ diff --git a/tests/integration/Core/Repository/FieldType/DateIntegrationTest.php b/tests/integration/Core/Repository/FieldType/DateIntegrationTest.php index 1c6b88aca5..4ee0421fef 100644 --- a/tests/integration/Core/Repository/FieldType/DateIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/DateIntegrationTest.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Contracts\Core\Test\Repository\SetupFactory\Legacy; use Ibexa\Core\FieldType\Date\Type; +use Ibexa\Core\FieldType\Date\Value; use Ibexa\Core\FieldType\Date\Value as DateValue; /** @@ -47,7 +48,7 @@ protected function supportsLikeWildcard($value): bool * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return [ 'defaultType' => [ @@ -62,7 +63,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return [ 'defaultType' => Type::DEFAULT_EMPTY, @@ -74,7 +75,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -86,7 +87,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return []; } @@ -96,7 +97,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return []; } @@ -106,7 +107,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'unknown' => ['value' => 42], @@ -118,7 +119,7 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { return DateValue::fromTimestamp(86400); } @@ -141,7 +142,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( DateValue::class, @@ -158,7 +159,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -173,7 +174,7 @@ public function provideInvalidCreationFieldData() * * @return mixed */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): Value { return DateValue::fromTimestamp(86400); } @@ -186,7 +187,7 @@ public function getValidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( DateValue::class, @@ -215,7 +216,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { $this->assertFieldDataLoadedCorrect($field); } @@ -240,7 +241,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { $timestamp = 186401; $dateTime = new DateTime("@{$timestamp}"); @@ -276,7 +277,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { $timestamp = 123456; @@ -301,14 +302,14 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new DateValue()], ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ @@ -327,7 +328,7 @@ protected function getValidSearchValueTwo(): int return 172800; } - protected function getSearchTargetValueOne() + protected function getSearchTargetValueOne(): int|string { // Handling Legacy Search Engine, which stores Date value as timestamp if ($this->getSetupFactory() instanceof Legacy) { @@ -337,7 +338,7 @@ protected function getSearchTargetValueOne() return '1970-01-02T00:00:00Z'; } - protected function getSearchTargetValueTwo() + protected function getSearchTargetValueTwo(): int|string { // Handling Legacy Search Engine, which stores Date value as timestamp if ($this->getSetupFactory() instanceof Legacy) { diff --git a/tests/integration/Core/Repository/FieldType/EmailAddressIntegrationTest.php b/tests/integration/Core/Repository/FieldType/EmailAddressIntegrationTest.php index 58ad782a6a..71feb68785 100644 --- a/tests/integration/Core/Repository/FieldType/EmailAddressIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/EmailAddressIntegrationTest.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Core\Base\Exceptions\ContentFieldValidationException; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\FieldType\EmailAddress\Value; use Ibexa\Core\FieldType\EmailAddress\Value as EmailAddressValue; /** @@ -35,7 +36,7 @@ public function getTypeName(): string * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return []; } @@ -45,7 +46,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return []; } @@ -55,7 +56,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -67,7 +68,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return [ 'EmailAddressValidator' => [], @@ -79,7 +80,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return [ 'EmailAddressValidator' => [], @@ -91,7 +92,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'StringLengthValidator' => [ @@ -105,7 +106,7 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { return new EmailAddressValue('spam@ibexa.co'); } @@ -128,7 +129,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( EmailAddressValue::class, @@ -144,7 +145,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -179,7 +180,7 @@ public function provideInvalidCreationFieldData() * * @return array */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): Value { return new EmailAddressValue('spam_name@ibexa-some-thing.co'); } @@ -191,7 +192,7 @@ public function getValidUpdateFieldData() * * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( EmailAddressValue::class, @@ -220,7 +221,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( EmailAddressValue::class, @@ -256,7 +257,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -273,7 +274,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -283,7 +284,7 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new EmailAddressValue()], @@ -292,7 +293,7 @@ public function providerForTestIsEmptyValue() ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ @@ -323,7 +324,7 @@ protected function getSearchTargetValueTwo(): string return strtoupper($this->getValidSearchValueTwo()); } - protected function getFullTextIndexedFieldData() + protected function getFullTextIndexedFieldData(): array { return [ ['holmes4@ibexa.co', 'wyoming.knott@o2.ru'], diff --git a/tests/integration/Core/Repository/FieldType/FileSearchBaseIntegrationTest.php b/tests/integration/Core/Repository/FieldType/FileSearchBaseIntegrationTest.php index d2c0dcc2d5..82a57d7bb0 100644 --- a/tests/integration/Core/Repository/FieldType/FileSearchBaseIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/FileSearchBaseIntegrationTest.php @@ -193,7 +193,7 @@ protected function uriExistsOnIO($uri) /** * Tests that a VersionUpdate can remove the stored file. */ - public function testUpdateWithRemove() + public function testUpdateWithRemove(): void { $type = $this->createContentType( $this->getValidFieldSettings(), diff --git a/tests/integration/Core/Repository/FieldType/FloatIntegrationTest.php b/tests/integration/Core/Repository/FieldType/FloatIntegrationTest.php index 97845f7893..539e2a180f 100644 --- a/tests/integration/Core/Repository/FieldType/FloatIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/FloatIntegrationTest.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException; use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\Values\Content\Field; +use Ibexa\Core\FieldType\Float\Value; use Ibexa\Core\FieldType\Float\Value as FloatValue; /** @@ -35,7 +36,7 @@ public function getTypeName(): string * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return []; } @@ -45,7 +46,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return []; } @@ -55,7 +56,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -67,7 +68,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return [ 'FloatValueValidator' => [ @@ -88,7 +89,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return [ 'FloatValueValidator' => [ @@ -103,7 +104,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'FloatValueValidator' => [ @@ -117,7 +118,7 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { return new FloatValue(23.5); } @@ -140,7 +141,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( FloatValue::class, @@ -156,7 +157,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -177,7 +178,7 @@ public function provideInvalidCreationFieldData() /** * Get update field externals data. */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): Value { return new FloatValue(42.5); } @@ -189,7 +190,7 @@ public function getValidUpdateFieldData() * * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( FloatValue::class, @@ -218,7 +219,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( FloatValue::class, @@ -254,7 +255,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -271,7 +272,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -281,14 +282,14 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new FloatValue()], ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ diff --git a/tests/integration/Core/Repository/FieldType/ISBNIntegrationTest.php b/tests/integration/Core/Repository/FieldType/ISBNIntegrationTest.php index 5e7d747927..15eba3d282 100644 --- a/tests/integration/Core/Repository/FieldType/ISBNIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/ISBNIntegrationTest.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException; use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\Values\Content\Field; +use Ibexa\Core\FieldType\ISBN\Value; use Ibexa\Core\FieldType\ISBN\Value as ISBNValue; /** @@ -35,7 +36,7 @@ public function getTypeName(): string * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return [ 'isISBN13' => [ @@ -50,7 +51,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return [ 'isISBN13' => true, @@ -62,7 +63,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -74,7 +75,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return []; } @@ -84,7 +85,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return []; } @@ -94,7 +95,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'unknown' => ['value' => 42], @@ -106,7 +107,7 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { return new ISBNValue('9789722514095'); } @@ -129,7 +130,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( ISBNValue::class, @@ -144,7 +145,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -171,7 +172,7 @@ public function provideInvalidCreationFieldData() * * @return array */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): Value { return new ISBNValue('978-972-25-1409-5'); } @@ -183,7 +184,7 @@ public function getValidUpdateFieldData() * * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( ISBNValue::class, @@ -210,7 +211,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( ISBNValue::class, @@ -245,7 +246,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -270,7 +271,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -292,7 +293,7 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new ISBNValue()], @@ -301,7 +302,7 @@ public function providerForTestIsEmptyValue() ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ @@ -320,7 +321,7 @@ protected function getValidSearchValueTwo(): string return '9780380448340'; } - protected function getFullTextIndexedFieldData() + protected function getFullTextIndexedFieldData(): array { return [ ['9780099067504', '9780380448340'], diff --git a/tests/integration/Core/Repository/FieldType/IntegerIntegrationTest.php b/tests/integration/Core/Repository/FieldType/IntegerIntegrationTest.php index 6e62427e2d..67d8ce9aad 100644 --- a/tests/integration/Core/Repository/FieldType/IntegerIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/IntegerIntegrationTest.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException; use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Core\Base\Exceptions\InvalidArgumentType; +use Ibexa\Core\FieldType\Integer\Value; use Ibexa\Core\FieldType\Integer\Value as IntegerValue; /** @@ -35,7 +36,7 @@ public function getTypeName(): string * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return []; } @@ -45,7 +46,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return []; } @@ -55,7 +56,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -67,7 +68,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return [ 'IntegerValueValidator' => [ @@ -88,7 +89,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return [ 'IntegerValueValidator' => [ @@ -103,7 +104,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'IntegerValueValidator' => [ @@ -117,7 +118,7 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { return new IntegerValue(23); } @@ -140,7 +141,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( IntegerValue::class, @@ -156,7 +157,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -179,7 +180,7 @@ public function provideInvalidCreationFieldData() * * @return array */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): Value { return new IntegerValue(42); } @@ -191,7 +192,7 @@ public function getValidUpdateFieldData() * * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( IntegerValue::class, @@ -220,7 +221,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( IntegerValue::class, @@ -256,7 +257,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -273,7 +274,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -283,14 +284,14 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new IntegerValue()], ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ @@ -311,7 +312,7 @@ protected function getValidSearchValueTwo(): int return 26; } - protected function getFullTextIndexedFieldData() + protected function getFullTextIndexedFieldData(): array { return [ ['25', '26'], diff --git a/tests/integration/Core/Repository/FieldType/KeywordIntegrationTest.php b/tests/integration/Core/Repository/FieldType/KeywordIntegrationTest.php index 6673e530a9..93f46e68bc 100644 --- a/tests/integration/Core/Repository/FieldType/KeywordIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/KeywordIntegrationTest.php @@ -7,11 +7,13 @@ namespace Ibexa\Tests\Integration\Core\Repository\FieldType; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Core\Base\Exceptions\InvalidArgumentType; +use Ibexa\Core\FieldType\Keyword\Value; use Ibexa\Core\FieldType\Keyword\Value as KeywordValue; /** @@ -37,7 +39,7 @@ public function getTypeName(): string * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return []; } @@ -47,7 +49,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return []; } @@ -57,7 +59,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -69,7 +71,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return []; } @@ -79,7 +81,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return []; } @@ -89,7 +91,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'unknown' => ['value' => 23], @@ -101,15 +103,17 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { return new KeywordValue(['foo', 'bar', 'sindelfingen']); } /** * {@inheritdoc} + * + * @return \Ibexa\Core\FieldType\Keyword\Value[] */ - public function getValidMultilingualFieldData(array $languageCodes) + public function getValidMultilingualFieldData(array $languageCodes): array { $data = []; foreach ($languageCodes as $languageCode) { @@ -143,7 +147,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( KeywordValue::class, @@ -156,7 +160,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -175,7 +179,7 @@ public function provideInvalidCreationFieldData() * * @return array */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): Value { return new KeywordValue(['bielefeld']); } @@ -187,7 +191,7 @@ public function getValidUpdateFieldData() * * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( KeywordValue::class, @@ -213,7 +217,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( KeywordValue::class, @@ -246,7 +250,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -263,7 +267,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -273,7 +277,7 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new KeywordValue()], @@ -282,7 +286,7 @@ public function providerForTestIsEmptyValue() ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ @@ -297,7 +301,7 @@ public function providerForTestIsNotEmptyValue() /** * Test updating multiple contents with ezkeyword field preserves proper fields values. */ - public function testUpdateContentKeywords() + public function testUpdateContentKeywords(): void { $contentType = $this->testCreateContentType(); $contentService = $this->getRepository()->getContentService(); @@ -333,7 +337,7 @@ public function testUpdateContentKeywords() /** * {@inheritdoc} */ - protected function createContent($fieldData, $contentType = null) + protected function createContent($fieldData, $contentType = null): Content { if ($contentType === null) { $contentType = $this->testCreateContentType(); @@ -361,7 +365,7 @@ protected function createContent($fieldData, $contentType = null) * @param int $contentId * @param \Ibexa\Core\FieldType\Keyword\Value $value */ - private function assertContentFieldHasCorrectData($contentId, KeywordValue $value) + private function assertContentFieldHasCorrectData(int $contentId, KeywordValue $value): void { $contentService = $this->getRepository()->getContentService(); $loadedContent = $contentService->loadContent($contentId, ['eng-US']); @@ -397,7 +401,7 @@ public function testGoBackToDifferentVersionWithDifferentKeywords(): void self::assertEqualsCanonicalizing($contentDraft03->getFieldValue('data'), $value01); } - public function testKeywordsAreCaseSensitive() + public function testKeywordsAreCaseSensitive(): void { $contentType = $this->testCreateContentType(); $publishedContent01 = $this->createAndPublishContent('Foo', $contentType, md5(uniqid(__METHOD__, true))); @@ -421,7 +425,7 @@ public function testKeywordsAreCaseSensitive() * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - protected function createAndPublishContent($fieldData, ContentType $contentType, $remoteId) + protected function createAndPublishContent($fieldData, ContentType $contentType, $remoteId): Content { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -451,29 +455,29 @@ protected function getValidSearchValueTwo(): string return 'branch'; } - protected function getValidMultivaluedSearchValuesOne() + protected function getValidMultivaluedSearchValuesOne(): array { return ['add', 'branch']; } - protected function getValidMultivaluedSearchValuesTwo() + protected function getValidMultivaluedSearchValuesTwo(): array { return ['commit', 'delete']; } - public function checkFullTextSupport() + public function checkFullTextSupport(): void { // Does nothing } - protected function getFullTextIndexedFieldData() + protected function getFullTextIndexedFieldData(): array { return [ ['add', 'branch'], ]; } - public function providerForTestTruncateField() + public function providerForTestTruncateField(): array { return [ [new KeywordValue()], @@ -493,7 +497,7 @@ public function providerForTestTruncateField() * * @todo Move this method to BaseIntegrationTest when fixed for all field types. */ - public function testTruncateField($emptyValue) + public function testTruncateField($emptyValue): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -522,7 +526,7 @@ public function testTruncateField($emptyValue) * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content[] */ - protected function createKeywordContent() + protected function createKeywordContent(): array { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -578,7 +582,7 @@ protected function createKeywordContent() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testFindContentFieldCriterion() + public function testFindContentFieldCriterion(): void { $this->createKeywordContent(); $repository = $this->getRepository(); diff --git a/tests/integration/Core/Repository/FieldType/MapLocationIntegrationTest.php b/tests/integration/Core/Repository/FieldType/MapLocationIntegrationTest.php index 240e1a9c6e..9aa5e0e8e5 100644 --- a/tests/integration/Core/Repository/FieldType/MapLocationIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/MapLocationIntegrationTest.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Core\Base\Exceptions\InvalidArgumentType; +use Ibexa\Core\FieldType\MapLocation\Value; use Ibexa\Core\FieldType\MapLocation\Value as MapLocationValue; /** @@ -34,7 +35,7 @@ public function getTypeName(): string * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return []; } @@ -44,7 +45,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return []; } @@ -54,7 +55,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -66,7 +67,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return []; } @@ -76,7 +77,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return []; } @@ -86,7 +87,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'unknown' => ['value' => 23], @@ -98,7 +99,7 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { return new MapLocationValue( [ @@ -127,7 +128,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertEquals( $this->getValidCreationFieldData(), @@ -135,7 +136,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -181,7 +182,7 @@ public function provideInvalidCreationFieldData() * * @return array */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): Value { // https://maps.google.de/maps?qll=,&spn=0.139491,0.209942&sll=51.983611,8.574829&sspn=0.36242,0.839767&oq=Punta+Cana&t=h&hnear=Punta+Cana,+La+Altagracia,+Dominikanische+Republik&z=13 return new MapLocationValue( @@ -200,7 +201,7 @@ public function getValidUpdateFieldData() * * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertEquals( $this->getValidUpdateFieldData(), @@ -221,7 +222,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertEquals( $this->getValidCreationFieldData(), @@ -249,7 +250,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -276,7 +277,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -296,7 +297,7 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new MapLocationValue()], @@ -311,7 +312,7 @@ public function providerForTestIsEmptyValue() ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ diff --git a/tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php b/tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php index ca1403263e..5cbceeed4a 100644 --- a/tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Contracts\Core\Test\Repository\SetupFactory\Legacy; use Ibexa\Core\Base\Exceptions\InvalidArgumentType; +use Ibexa\Core\FieldType\Relation\Value; use Ibexa\Core\FieldType\Relation\Value as RelationValue; use Ibexa\Core\Repository\Values\Content\Relation; @@ -49,7 +50,7 @@ protected function supportsLikeWildcard($value): bool * * @return array|\Ibexa\Contracts\Core\Repository\Values\Content\Relation[] */ - public function getCreateExpectedRelations(Content $content) + public function getCreateExpectedRelations(Content $content): array { $contentService = $this->getRepository()->getContentService(); @@ -70,7 +71,7 @@ public function getCreateExpectedRelations(Content $content) * * @return array|\Ibexa\Contracts\Core\Repository\Values\Content\Relation[] */ - public function getUpdateExpectedRelations(Content $content) + public function getUpdateExpectedRelations(Content $content): array { $contentService = $this->getRepository()->getContentService(); @@ -86,7 +87,7 @@ public function getUpdateExpectedRelations(Content $content) ]; } - public function getSettingsSchema() + public function getSettingsSchema(): array { return [ 'selectionMethod' => [ @@ -111,7 +112,7 @@ public function getSettingsSchema() /** * @covers \Ibexa\Tests\Integration\Core\Repository\FieldType\BaseIntegrationTest::getValidatorSchema() */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return []; } @@ -123,7 +124,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return [ 'selectionMethod' => 0, @@ -140,7 +141,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return []; } @@ -152,7 +153,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'selectionMethod' => 'a', @@ -169,7 +170,7 @@ public function getInvalidFieldSettings() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return ['noValidator' => true]; } @@ -179,7 +180,7 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { return new RelationValue(4); } @@ -202,7 +203,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( RelationValue::class, @@ -218,7 +219,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -304,7 +305,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field): void * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -323,7 +324,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -333,14 +334,14 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new RelationValue()], ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ diff --git a/tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php b/tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php index 5da099b74c..b473621f73 100644 --- a/tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Core\Base\Exceptions\InvalidArgumentType; use Ibexa\Core\FieldType\RelationList\Type as RelationListType; +use Ibexa\Core\FieldType\RelationList\Value; use Ibexa\Core\FieldType\RelationList\Value as RelationListValue; use Ibexa\Core\Repository\Values\Content\Relation; @@ -49,7 +50,7 @@ protected function supportsLikeWildcard($value): bool * * @return array|\Ibexa\Contracts\Core\Repository\Values\Content\Relation[] */ - public function getCreateExpectedRelations(Content $content) + public function getCreateExpectedRelations(Content $content): array { $contentService = $this->getRepository()->getContentService(); @@ -78,7 +79,7 @@ public function getCreateExpectedRelations(Content $content) * * @return array|\Ibexa\Contracts\Core\Repository\Values\Content\Relation[] */ - public function getUpdateExpectedRelations(Content $content) + public function getUpdateExpectedRelations(Content $content): array { $contentService = $this->getRepository()->getContentService(); @@ -112,7 +113,7 @@ public function getUpdateExpectedRelations(Content $content) ]; } - public function getSettingsSchema() + public function getSettingsSchema(): array { return [ 'selectionMethod' => [ @@ -134,7 +135,7 @@ public function getSettingsSchema() ]; } - public function getValidatorSchema() + public function getValidatorSchema(): array { return [ 'RelationListValueValidator' => [ @@ -153,7 +154,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return [ 'selectionMethod' => 1, @@ -170,7 +171,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return [ 'RelationListValueValidator' => [ @@ -186,7 +187,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return ['selectionMethod' => 'a', 'selectionDefaultLocation' => true, 'unknownSetting' => false]; } @@ -198,7 +199,7 @@ public function getInvalidFieldSettings() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return ['noValidator' => true]; } @@ -208,7 +209,7 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { return new RelationListValue([4, 49]); } @@ -231,7 +232,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( RelationListValue::class, @@ -247,7 +248,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -332,7 +333,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field): void * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -351,7 +352,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -361,7 +362,7 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new RelationListValue()], @@ -369,7 +370,7 @@ public function providerForTestIsEmptyValue() ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ @@ -378,12 +379,12 @@ public function providerForTestIsNotEmptyValue() ]; } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): array { return [11]; } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): array { return [12]; } @@ -398,12 +399,12 @@ protected function getSearchTargetValueTwo(): int return 12; } - protected function getValidMultivaluedSearchValuesOne() + protected function getValidMultivaluedSearchValuesOne(): array { return [11, 12]; } - protected function getValidMultivaluedSearchValuesTwo() + protected function getValidMultivaluedSearchValuesTwo(): array { return [13, 14]; } diff --git a/tests/integration/Core/Repository/FieldType/RelationSearchBaseIntegrationTestTrait.php b/tests/integration/Core/Repository/FieldType/RelationSearchBaseIntegrationTestTrait.php index 7e6662dcab..0e71c719d4 100644 --- a/tests/integration/Core/Repository/FieldType/RelationSearchBaseIntegrationTestTrait.php +++ b/tests/integration/Core/Repository/FieldType/RelationSearchBaseIntegrationTestTrait.php @@ -42,7 +42,7 @@ abstract public function getUpdateExpectedRelations(Content $content); /** * Tests relation processing on field create. */ - public function testCreateContentRelationsProcessedCorrect() + public function testCreateContentRelationsProcessedCorrect(): void { $content = $this->createContent($this->getValidCreationFieldData()); @@ -61,7 +61,7 @@ public function testCreateContentRelationsProcessedCorrect() /** * Tests relation processing on field update. */ - public function testUpdateContentRelationsProcessedCorrect() + public function testUpdateContentRelationsProcessedCorrect(): void { $content = $this->updateContent($this->getValidUpdateFieldData()); @@ -84,7 +84,7 @@ public function testUpdateContentRelationsProcessedCorrect() * * @return \Ibexa\Core\Repository\Values\Content\Relation[] */ - protected function normalizeRelations(array $relations) + protected function normalizeRelations(array $relations): array { usort( $relations, @@ -97,7 +97,7 @@ static function (RelationContract $a, RelationContract $b): int { } ); $normalized = array_map( - static function (RelationContract $relation) { + static function (RelationContract $relation): Relation { $newRelation = new Relation( [ 'id' => null, @@ -116,7 +116,7 @@ static function (RelationContract $relation) { return $normalized; } - public function testCopyContentCopiesFieldRelations() + public function testCopyContentCopiesFieldRelations(): void { $content = $this->updateContent($this->getValidUpdateFieldData()); $contentService = $this->getRepository()->getContentService(); @@ -151,7 +151,7 @@ public function testCopyContentCopiesFieldRelations() ); } - public function testSubtreeCopyContentCopiesFieldRelations() + public function testSubtreeCopyContentCopiesFieldRelations(): void { $contentService = $this->getRepository()->getContentService(); $locationService = $this->getRepository()->getLocationService(); diff --git a/tests/integration/Core/Repository/FieldType/SearchBaseIntegrationTest.php b/tests/integration/Core/Repository/FieldType/SearchBaseIntegrationTest.php index 8cb1caeafe..c8e46ad40d 100644 --- a/tests/integration/Core/Repository/FieldType/SearchBaseIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/SearchBaseIntegrationTest.php @@ -21,6 +21,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\Field as FieldSortClause; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Test\Repository\SetupFactory\Legacy; use Ibexa\Core\Search\Common\FieldNameResolver; @@ -216,7 +217,7 @@ protected function getFullTextIndexedFieldData() ); } - public function checkFullTextSupport() + public function checkFullTextSupport(): void { // Does nothing by default, override in a concrete test case as needed } @@ -262,7 +263,7 @@ protected function checkCustomFieldsSupport() * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - protected function createTestSearchContent($fieldData, Repository $repository, $contentType) + protected function createTestSearchContent($fieldData, Repository $repository, ContentType $contentType) { $contentService = $repository->getContentService(); $locationService = $repository->getLocationService(); @@ -374,7 +375,7 @@ public function findProvider() * * @depends testCreateTestContent */ - public function testFindEqualsOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindEqualsOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field('data', Operator::EQ, $valueOne); @@ -394,7 +395,7 @@ public function testFindEqualsOne($valueOne, $valueTwo, $filter, $content, $modi * * @depends testCreateTestContent */ - public function testFindNotEqualsOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotEqualsOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot(new Field('data', Operator::EQ, $valueOne)); @@ -414,7 +415,7 @@ public function testFindNotEqualsOne($valueOne, $valueTwo, $filter, $content, $m * * @depends testCreateTestContent */ - public function testFindEqualsTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindEqualsTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field('data', Operator::EQ, $valueTwo); @@ -434,7 +435,7 @@ public function testFindEqualsTwo($valueOne, $valueTwo, $filter, $content, $modi * * @depends testCreateTestContent */ - public function testFindNotEqualsTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotEqualsTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot(new Field('data', Operator::EQ, $valueTwo)); @@ -454,7 +455,7 @@ public function testFindNotEqualsTwo($valueOne, $valueTwo, $filter, $content, $m * * @depends testCreateTestContent */ - public function testFindInOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindInOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field('data', Operator::IN, [$valueOne]); @@ -474,7 +475,7 @@ public function testFindInOne($valueOne, $valueTwo, $filter, $content, $modifyFi * * @depends testCreateTestContent */ - public function testFindNotInOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotInOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot( new Field('data', Operator::IN, [$valueOne]) @@ -496,7 +497,7 @@ public function testFindNotInOne($valueOne, $valueTwo, $filter, $content, $modif * * @depends testCreateTestContent */ - public function testFindInTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindInTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field('data', Operator::IN, [$valueTwo]); @@ -516,7 +517,7 @@ public function testFindInTwo($valueOne, $valueTwo, $filter, $content, $modifyFi * * @depends testCreateTestContent */ - public function testFindNotInTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotInTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot( new Field('data', Operator::IN, [$valueTwo]) @@ -538,7 +539,7 @@ public function testFindNotInTwo($valueOne, $valueTwo, $filter, $content, $modif * * @depends testCreateTestContent */ - public function testFindInOneTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindInOneTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field( 'data', @@ -565,7 +566,7 @@ public function testFindInOneTwo($valueOne, $valueTwo, $filter, $content, $modif * * @depends testCreateTestContent */ - public function testFindNotInOneTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotInOneTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot( new Field( @@ -594,7 +595,7 @@ public function testFindNotInOneTwo($valueOne, $valueTwo, $filter, $content, $mo * * @depends testCreateTestContent */ - public function testFindGreaterThanOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindGreaterThanOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field('data', Operator::GT, $valueOne); @@ -614,7 +615,7 @@ public function testFindGreaterThanOne($valueOne, $valueTwo, $filter, $content, * * @depends testCreateTestContent */ - public function testFindNotGreaterThanOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotGreaterThanOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot(new Field('data', Operator::GT, $valueOne)); @@ -634,7 +635,7 @@ public function testFindNotGreaterThanOne($valueOne, $valueTwo, $filter, $conten * * @depends testCreateTestContent */ - public function testFindGreaterThanTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindGreaterThanTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field('data', Operator::GT, $valueTwo); @@ -654,7 +655,7 @@ public function testFindGreaterThanTwo($valueOne, $valueTwo, $filter, $content, * * @depends testCreateTestContent */ - public function testFindNotGreaterThanTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotGreaterThanTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot(new Field('data', Operator::GT, $valueTwo)); @@ -674,7 +675,7 @@ public function testFindNotGreaterThanTwo($valueOne, $valueTwo, $filter, $conten * * @depends testCreateTestContent */ - public function testFindGreaterThanOrEqualOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindGreaterThanOrEqualOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field('data', Operator::GTE, $valueOne); @@ -694,7 +695,7 @@ public function testFindGreaterThanOrEqualOne($valueOne, $valueTwo, $filter, $co * * @depends testCreateTestContent */ - public function testFindNotGreaterThanOrEqual($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotGreaterThanOrEqual($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot(new Field('data', Operator::GTE, $valueOne)); @@ -714,7 +715,7 @@ public function testFindNotGreaterThanOrEqual($valueOne, $valueTwo, $filter, $co * * @depends testCreateTestContent */ - public function testFindGreaterThanOrEqualTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindGreaterThanOrEqualTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field('data', Operator::GTE, $valueTwo); @@ -734,7 +735,7 @@ public function testFindGreaterThanOrEqualTwo($valueOne, $valueTwo, $filter, $co * * @depends testCreateTestContent */ - public function testFindNotGreaterThanOrEqualTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotGreaterThanOrEqualTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot(new Field('data', Operator::GTE, $valueTwo)); @@ -754,7 +755,7 @@ public function testFindNotGreaterThanOrEqualTwo($valueOne, $valueTwo, $filter, * * @depends testCreateTestContent */ - public function testFindLowerThanOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindLowerThanOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field('data', Operator::LT, $valueOne); @@ -774,7 +775,7 @@ public function testFindLowerThanOne($valueOne, $valueTwo, $filter, $content, $m * * @depends testCreateTestContent */ - public function testFindNotLowerThanOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotLowerThanOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot(new Field('data', Operator::LT, $valueOne)); @@ -794,7 +795,7 @@ public function testFindNotLowerThanOne($valueOne, $valueTwo, $filter, $content, * * @depends testCreateTestContent */ - public function testFindLowerThanTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindLowerThanTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field('data', Operator::LT, $valueTwo); @@ -814,7 +815,7 @@ public function testFindLowerThanTwo($valueOne, $valueTwo, $filter, $content, $m * * @depends testCreateTestContent */ - public function testFindNotLowerThanTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotLowerThanTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot(new Field('data', Operator::LT, $valueTwo)); @@ -834,7 +835,7 @@ public function testFindNotLowerThanTwo($valueOne, $valueTwo, $filter, $content, * * @depends testCreateTestContent */ - public function testFindLowerThanOrEqualOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindLowerThanOrEqualOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field('data', Operator::LTE, $valueOne); @@ -854,7 +855,7 @@ public function testFindLowerThanOrEqualOne($valueOne, $valueTwo, $filter, $cont * * @depends testCreateTestContent */ - public function testFindNotLowerThanOrEqualOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotLowerThanOrEqualOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot(new Field('data', Operator::LTE, $valueOne)); @@ -874,7 +875,7 @@ public function testFindNotLowerThanOrEqualOne($valueOne, $valueTwo, $filter, $c * * @depends testCreateTestContent */ - public function testFindLowerThanOrEqualTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindLowerThanOrEqualTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field('data', Operator::LTE, $valueTwo); @@ -894,7 +895,7 @@ public function testFindLowerThanOrEqualTwo($valueOne, $valueTwo, $filter, $cont * * @depends testCreateTestContent */ - public function testFindNotLowerThanOrEqualTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotLowerThanOrEqualTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot(new Field('data', Operator::LTE, $valueTwo)); @@ -914,7 +915,7 @@ public function testFindNotLowerThanOrEqualTwo($valueOne, $valueTwo, $filter, $c * * @depends testCreateTestContent */ - public function testFindBetweenOneTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindBetweenOneTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field( 'data', @@ -941,7 +942,7 @@ public function testFindBetweenOneTwo($valueOne, $valueTwo, $filter, $content, $ * * @depends testCreateTestContent */ - public function testFindNotBetweenOneTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotBetweenOneTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot( new Field( @@ -970,7 +971,7 @@ public function testFindNotBetweenOneTwo($valueOne, $valueTwo, $filter, $content * * @depends testCreateTestContent */ - public function testFindBetweenTwoOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindBetweenTwoOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field( 'data', @@ -997,7 +998,7 @@ public function testFindBetweenTwoOne($valueOne, $valueTwo, $filter, $content, $ * * @depends testCreateTestContent */ - public function testFindNotBetweenTwoOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotBetweenTwoOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot( new Field( @@ -1026,7 +1027,7 @@ public function testFindNotBetweenTwoOne($valueOne, $valueTwo, $filter, $content * * @depends testCreateTestContent */ - public function testFindContainsOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindContainsOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field('data', Operator::CONTAINS, $valueOne); @@ -1046,7 +1047,7 @@ public function testFindContainsOne($valueOne, $valueTwo, $filter, $content, $mo * * @depends testCreateTestContent */ - public function testFindNotContainsOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotContainsOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot(new Field('data', Operator::CONTAINS, $valueOne)); @@ -1066,7 +1067,7 @@ public function testFindNotContainsOne($valueOne, $valueTwo, $filter, $content, * * @depends testCreateTestContent */ - public function testFindContainsTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindContainsTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new Field('data', Operator::CONTAINS, $valueTwo); @@ -1086,7 +1087,7 @@ public function testFindContainsTwo($valueOne, $valueTwo, $filter, $content, $mo * * @depends testCreateTestContent */ - public function testFindNotContainsTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotContainsTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $criteria = new LogicalNot( new Field('data', Operator::CONTAINS, $valueTwo) @@ -1102,7 +1103,7 @@ public function testFindNotContainsTwo($valueOne, $valueTwo, $filter, $content, * * @depends testCreateTestContent */ - public function testFindLikeOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindLikeOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { // (in case test is skipped for current search engine) $this->supportsLikeWildcard($valueOne); @@ -1119,7 +1120,7 @@ public function testFindLikeOne($valueOne, $valueTwo, $filter, $content, $modify * * @depends testCreateTestContent */ - public function testFindNotLikeOne($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotLikeOne($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { if ($this->supportsLikeWildcard($valueOne)) { $valueOne = substr_replace($valueOne, '*', -1, 1); @@ -1139,7 +1140,7 @@ public function testFindNotLikeOne($valueOne, $valueTwo, $filter, $content, $mod * * @depends testCreateTestContent */ - public function testFindLikeTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindLikeTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { if ($this->supportsLikeWildcard($valueTwo)) { $valueTwo = substr_replace($valueTwo, '*', 1, 1); @@ -1157,7 +1158,7 @@ public function testFindLikeTwo($valueOne, $valueTwo, $filter, $content, $modify * * @depends testCreateTestContent */ - public function testFindNotLikeTwo($valueOne, $valueTwo, $filter, $content, $modifyField, array $context) + public function testFindNotLikeTwo($valueOne, $valueTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { if ($this->supportsLikeWildcard($valueTwo)) { $valueTwo = substr_replace($valueTwo, '*', 2, 1); @@ -1278,7 +1279,7 @@ public function sortProvider() * * @depends testCreateTestContent */ - public function testSort($ascending, $content, $modifyField, array $context) + public function testSort($ascending, $content, $modifyField, array $context): void { [$repository, $contentOneId, $contentTwoId] = $context; $sortClause = new FieldSortClause( @@ -1329,7 +1330,7 @@ public function fullTextFindProvider() * * @depends testCreateTestContent */ - public function testFullTextFindOne($valueOne, $valueTwo, $filter, $content, array $context) + public function testFullTextFindOne($valueOne, $valueTwo, bool $filter, bool $content, array $context): void { $this->checkFullTextSupport(); @@ -1343,7 +1344,7 @@ public function testFullTextFindOne($valueOne, $valueTwo, $filter, $content, arr * * @depends testCreateTestContent */ - public function testFullTextFindTwo($valueOne, $valueTwo, $filter, $content, array $context) + public function testFullTextFindTwo($valueOne, $valueTwo, bool $filter, bool $content, array $context): void { $this->checkFullTextSupport(); diff --git a/tests/integration/Core/Repository/FieldType/SearchMultivaluedBaseIntegrationTest.php b/tests/integration/Core/Repository/FieldType/SearchMultivaluedBaseIntegrationTest.php index 705afec4c0..5faf855e58 100644 --- a/tests/integration/Core/Repository/FieldType/SearchMultivaluedBaseIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/SearchMultivaluedBaseIntegrationTest.php @@ -224,7 +224,7 @@ public function findMultivaluedProvider() * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedEqualsOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedEqualsOne($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::EQ); @@ -248,7 +248,7 @@ public function testFindMultivaluedEqualsOne($valuesOne, $valuesTwo, $filter, $c * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedNotEqualsOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedNotEqualsOne($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::EQ); @@ -272,7 +272,7 @@ public function testFindMultivaluedNotEqualsOne($valuesOne, $valuesTwo, $filter, * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedInOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedInOne($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::IN); @@ -294,7 +294,7 @@ public function testFindMultivaluedInOne($valuesOne, $valuesTwo, $filter, $conte * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedNotInOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedNotInOne($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::IN); @@ -318,7 +318,7 @@ public function testFindMultivaluedNotInOne($valuesOne, $valuesTwo, $filter, $co * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedInOneTwo($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedInOneTwo($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::IN); @@ -340,7 +340,7 @@ public function testFindMultivaluedInOneTwo($valuesOne, $valuesTwo, $filter, $co * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedNotInOneTwo($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedNotInOneTwo($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::IN); @@ -364,7 +364,7 @@ public function testFindMultivaluedNotInOneTwo($valuesOne, $valuesTwo, $filter, * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedContainsOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedContainsOne($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::CONTAINS); @@ -388,7 +388,7 @@ public function testFindMultivaluedContainsOne($valuesOne, $valuesTwo, $filter, * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedNotContainsOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedNotContainsOne($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::CONTAINS); @@ -412,7 +412,7 @@ public function testFindMultivaluedNotContainsOne($valuesOne, $valuesTwo, $filte * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedGreaterThanOneFindsOneTwo($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedGreaterThanOneFindsOneTwo($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::GT); @@ -434,7 +434,7 @@ public function testFindMultivaluedGreaterThanOneFindsOneTwo($valuesOne, $values * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedGreaterThanOneFindsTwo($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedGreaterThanOneFindsTwo($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::GT); @@ -456,7 +456,7 @@ public function testFindMultivaluedGreaterThanOneFindsTwo($valuesOne, $valuesTwo * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedNotGreaterThanOneFindsOneTwo($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedNotGreaterThanOneFindsOneTwo($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::GT); @@ -478,7 +478,7 @@ public function testFindMultivaluedNotGreaterThanOneFindsOneTwo($valuesOne, $val * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedNotGreaterThanOneFindsTwo($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedNotGreaterThanOneFindsTwo($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::GT); @@ -500,7 +500,7 @@ public function testFindMultivaluedNotGreaterThanOneFindsTwo($valuesOne, $values * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedGreaterThanOrEqualOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedGreaterThanOrEqualOne($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::GTE); @@ -524,7 +524,7 @@ public function testFindMultivaluedGreaterThanOrEqualOne($valuesOne, $valuesTwo, * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedNotGreaterThanOrEqual($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedNotGreaterThanOrEqual($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::GTE); @@ -548,7 +548,7 @@ public function testFindMultivaluedNotGreaterThanOrEqual($valuesOne, $valuesTwo, * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedLowerThanOneEmpty($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedLowerThanOneEmpty($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::LT); @@ -570,7 +570,7 @@ public function testFindMultivaluedLowerThanOneEmpty($valuesOne, $valuesTwo, $fi * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedLowerThanOneFindsOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedLowerThanOneFindsOne($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::LT); @@ -592,7 +592,7 @@ public function testFindMultivaluedLowerThanOneFindsOne($valuesOne, $valuesTwo, * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedNotLowerThanOneEmpty($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedNotLowerThanOneEmpty($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::LT); @@ -614,7 +614,7 @@ public function testFindMultivaluedNotLowerThanOneEmpty($valuesOne, $valuesTwo, * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedNotLowerThanOneFindsOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedNotLowerThanOneFindsOne($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::LT); @@ -636,7 +636,7 @@ public function testFindMultivaluedNotLowerThanOneFindsOne($valuesOne, $valuesTw * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedLowerThanOrEqualOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedLowerThanOrEqualOne($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::LTE); @@ -660,7 +660,7 @@ public function testFindMultivaluedLowerThanOrEqualOne($valuesOne, $valuesTwo, $ * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedNotLowerThanOrEqualOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedNotLowerThanOrEqualOne($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::LTE); @@ -684,7 +684,7 @@ public function testFindMultivaluedNotLowerThanOrEqualOne($valuesOne, $valuesTwo * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedBetweenOneTwo($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedBetweenOneTwo($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::BETWEEN); @@ -717,7 +717,7 @@ public function testFindMultivaluedBetweenOneTwo($valuesOne, $valuesTwo, $filter * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedNotBetweenOneTwo($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedNotBetweenOneTwo($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::BETWEEN); @@ -752,7 +752,7 @@ public function testFindMultivaluedNotBetweenOneTwo($valuesOne, $valuesTwo, $fil * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedBetweenTwoOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedBetweenTwoOne($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::BETWEEN); @@ -785,7 +785,7 @@ public function testFindMultivaluedBetweenTwoOne($valuesOne, $valuesTwo, $filter * * @depends testCreateMultivaluedTestContent */ - public function testFindMultivaluedNotBetweenTwoOne($valuesOne, $valuesTwo, $filter, $content, $modifyField, array $context) + public function testFindMultivaluedNotBetweenTwoOne($valuesOne, $valuesTwo, bool $filter, bool $content, ?string $modifyField, array $context): void { $this->checkOperatorSupport(Operator::BETWEEN); diff --git a/tests/integration/Core/Repository/FieldType/SelectionIntegrationTest.php b/tests/integration/Core/Repository/FieldType/SelectionIntegrationTest.php index 3a3e014c35..a66b5c81d0 100644 --- a/tests/integration/Core/Repository/FieldType/SelectionIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/SelectionIntegrationTest.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException; use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Core\Base\Exceptions\InvalidArgumentType; +use Ibexa\Core\FieldType\Selection\Value; use Ibexa\Core\FieldType\Selection\Value as SelectionValue; /** @@ -25,7 +26,7 @@ class SelectionIntegrationTest extends SearchMultivaluedBaseIntegrationTest * * @return string */ - public function getTypeName() + public function getTypeName(): string { return 'ezselection'; } @@ -35,7 +36,7 @@ public function getTypeName() * * If Selection is improved to be able to index + search for string also with LegacySearch, then adapt this too. */ - protected function supportsLikeWildcard($value) + protected function supportsLikeWildcard($value): bool { parent::supportsLikeWildcard($value); @@ -47,7 +48,7 @@ protected function supportsLikeWildcard($value) * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return [ 'isMultiple' => [ @@ -70,7 +71,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return [ 'isMultiple' => true, @@ -98,7 +99,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -112,7 +113,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return []; } @@ -122,7 +123,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return []; } @@ -132,7 +133,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'unknown' => ['value' => 23], @@ -144,7 +145,7 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { return new SelectionValue([0, 2]); } @@ -154,7 +155,7 @@ public function getValidCreationFieldData() * * @return string */ - public function getFieldName() + public function getFieldName(): string { return 'A first' . ' ' . 'Sindelfingen'; } @@ -167,7 +168,7 @@ public function getFieldName() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( SelectionValue::class, @@ -183,7 +184,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -202,7 +203,7 @@ public function provideInvalidCreationFieldData() * * @return array */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): Value { return new SelectionValue([1]); } @@ -214,7 +215,7 @@ public function getValidUpdateFieldData() * * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( SelectionValue::class, @@ -243,7 +244,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( SelectionValue::class, @@ -279,7 +280,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -296,7 +297,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -306,7 +307,7 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new SelectionValue()], @@ -314,7 +315,7 @@ public function providerForTestIsEmptyValue() ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ @@ -326,27 +327,27 @@ public function providerForTestIsNotEmptyValue() ]; } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): array { return [1]; } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): array { return [2]; } - protected function getSearchTargetValueOne() + protected function getSearchTargetValueOne(): int { return 1; } - protected function getSearchTargetValueTwo() + protected function getSearchTargetValueTwo(): int { return 2; } - protected function getAdditionallyIndexedFieldData() + protected function getAdditionallyIndexedFieldData(): array { return [ [ @@ -362,17 +363,17 @@ protected function getAdditionallyIndexedFieldData() ]; } - protected function getValidMultivaluedSearchValuesOne() + protected function getValidMultivaluedSearchValuesOne(): array { return [0, 1]; } - protected function getValidMultivaluedSearchValuesTwo() + protected function getValidMultivaluedSearchValuesTwo(): array { return [2, 3, 4]; } - protected function getAdditionallyIndexedMultivaluedFieldData() + protected function getAdditionallyIndexedMultivaluedFieldData(): array { return [ [ @@ -383,7 +384,7 @@ protected function getAdditionallyIndexedMultivaluedFieldData() ]; } - protected function getFullTextIndexedFieldData() + protected function getFullTextIndexedFieldData(): array { return [ ['Bielefeld', 'Sindelfingen'], diff --git a/tests/integration/Core/Repository/FieldType/SelectionMultilingualIntegrationTest.php b/tests/integration/Core/Repository/FieldType/SelectionMultilingualIntegrationTest.php index 0cdb894853..19c0dadd40 100644 --- a/tests/integration/Core/Repository/FieldType/SelectionMultilingualIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/SelectionMultilingualIntegrationTest.php @@ -20,7 +20,7 @@ class SelectionMultilingualIntegrationTest extends SelectionIntegrationTest * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return array_merge( parent::getSettingsSchema(), @@ -38,7 +38,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return [ @@ -90,7 +90,7 @@ public function getFieldName(): string return 'Arkansas' . ' ' . 'Mississippi'; } - protected function getAdditionallyIndexedFieldData() + protected function getAdditionallyIndexedFieldData(): array { return [ [ @@ -106,7 +106,7 @@ protected function getAdditionallyIndexedFieldData() ]; } - protected function getAdditionallyIndexedMultivaluedFieldData() + protected function getAdditionallyIndexedMultivaluedFieldData(): array { return [ [ @@ -117,7 +117,7 @@ protected function getAdditionallyIndexedMultivaluedFieldData() ]; } - protected function getFullTextIndexedFieldData() + protected function getFullTextIndexedFieldData(): array { return [ ['Hudson', 'Mississippi'], diff --git a/tests/integration/Core/Repository/FieldType/TextBlockIntegrationTest.php b/tests/integration/Core/Repository/FieldType/TextBlockIntegrationTest.php index 8d664ba334..b742032bb7 100644 --- a/tests/integration/Core/Repository/FieldType/TextBlockIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/TextBlockIntegrationTest.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\Values\Content\Field; +use Ibexa\Core\FieldType\TextBlock\Value; use Ibexa\Core\FieldType\TextBlock\Value as TextBlockValue; /** @@ -34,7 +35,7 @@ public function getTypeName(): string * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return [ 'textRows' => [ @@ -49,7 +50,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return [ 'textRows' => 0, @@ -61,7 +62,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -73,7 +74,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return []; } @@ -83,7 +84,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return []; } @@ -93,7 +94,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'unknown' => ['value' => 23], @@ -105,7 +106,7 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { return new TextBlockValue('Example'); } @@ -128,7 +129,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( TextBlockValue::class, @@ -144,7 +145,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -159,7 +160,7 @@ public function provideInvalidCreationFieldData() * * @return array */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): Value { return new TextBlockValue('Example 2'); } @@ -171,7 +172,7 @@ public function getValidUpdateFieldData() * * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( TextBlockValue::class, @@ -200,7 +201,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( TextBlockValue::class, @@ -236,7 +237,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -253,7 +254,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -263,7 +264,7 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new TextBlockValue()], @@ -275,7 +276,7 @@ public function providerForTestIsEmptyValue() ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ @@ -307,7 +308,7 @@ protected function getSearchTargetValueTwo(): string return strtoupper("truth suffers from ' too much analysis"); } - protected function getFullTextIndexedFieldData() + protected function getFullTextIndexedFieldData(): array { return [ ['path', 'analysis'], diff --git a/tests/integration/Core/Repository/FieldType/TextLineIntegrationTest.php b/tests/integration/Core/Repository/FieldType/TextLineIntegrationTest.php index 73fb280f23..a2d39a6d2c 100644 --- a/tests/integration/Core/Repository/FieldType/TextLineIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/TextLineIntegrationTest.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException; use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\Values\Content\Field; +use Ibexa\Core\FieldType\TextLine\Value; use Ibexa\Core\FieldType\TextLine\Value as TextLineValue; /** @@ -35,7 +36,7 @@ public function getTypeName(): string * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return []; } @@ -45,7 +46,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return []; } @@ -55,7 +56,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -67,7 +68,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return [ 'StringLengthValidator' => [ @@ -88,7 +89,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return [ 'StringLengthValidator' => [ @@ -103,7 +104,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'StringLengthValidator' => [ @@ -117,7 +118,7 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { return new TextLineValue('Example'); } @@ -140,7 +141,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( TextLineValue::class, @@ -156,7 +157,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -179,7 +180,7 @@ public function provideInvalidCreationFieldData() * * @return array */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): Value { return new TextLineValue('Example 2'); } @@ -191,7 +192,7 @@ public function getValidUpdateFieldData() * * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( TextLineValue::class, @@ -220,7 +221,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( TextLineValue::class, @@ -256,7 +257,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -273,7 +274,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -283,7 +284,7 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new TextLineValue()], @@ -293,7 +294,7 @@ public function providerForTestIsEmptyValue() ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ @@ -325,7 +326,7 @@ protected function getSearchTargetValueTwo(): string return strtoupper($this->getValidSearchValueTwo()); } - protected function getFullTextIndexedFieldData() + protected function getFullTextIndexedFieldData(): array { return [ ['aaa', 'bbb'], diff --git a/tests/integration/Core/Repository/FieldType/TimeIntegrationTest.php b/tests/integration/Core/Repository/FieldType/TimeIntegrationTest.php index 7bf5f66e29..f8c2ddbf7f 100644 --- a/tests/integration/Core/Repository/FieldType/TimeIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/TimeIntegrationTest.php @@ -10,6 +10,7 @@ use DateTime; use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\Values\Content\Field; +use Ibexa\Core\FieldType\Time\Value; use Ibexa\Core\FieldType\Time\Value as TimeValue; /** @@ -45,7 +46,7 @@ protected function supportsLikeWildcard($value): bool * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return [ 'useSeconds' => [ @@ -64,7 +65,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return [ 'useSeconds' => false, @@ -77,7 +78,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -89,7 +90,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return []; } @@ -99,7 +100,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return []; } @@ -109,7 +110,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'unknown' => ['value' => 42], @@ -121,7 +122,7 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { // We may only create times from timestamps here, since storing will // loose information about the timezone. @@ -146,7 +147,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( TimeValue::class, @@ -162,7 +163,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -188,7 +189,7 @@ public function getValidUpdateFieldData() * * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( TimeValue::class, @@ -218,7 +219,7 @@ public function provideInvalidUpdateFieldData() * * @dataProvider provideInvalidUpdateFieldData */ - public function testUpdateContentFails($failingValue, $expectedException) + public function testUpdateContentFails($failingValue, $expectedException): array { return [ [ @@ -235,7 +236,7 @@ public function testUpdateContentFails($failingValue, $expectedException) * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( TimeValue::class, @@ -271,7 +272,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { $timestamp = 123456; $dateTime = new DateTime("@{$timestamp}"); @@ -291,7 +292,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -301,14 +302,14 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new TimeValue()], ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ @@ -317,12 +318,12 @@ public function providerForTestIsNotEmptyValue() ]; } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): Value { return new TimeValue($this->getSearchTargetValueOne()); } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): Value { return new TimeValue($this->getSearchTargetValueTwo()); } diff --git a/tests/integration/Core/Repository/FieldType/UrlIntegrationTest.php b/tests/integration/Core/Repository/FieldType/UrlIntegrationTest.php index 9a5f34e9ad..db54870f1d 100644 --- a/tests/integration/Core/Repository/FieldType/UrlIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/UrlIntegrationTest.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Core\Base\Exceptions\InvalidArgumentType; +use Ibexa\Core\FieldType\Url\Value; use Ibexa\Core\FieldType\Url\Value as UrlValue; /** @@ -34,7 +35,7 @@ public function getTypeName(): string * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return []; } @@ -44,7 +45,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return []; } @@ -54,7 +55,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -66,7 +67,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return []; } @@ -76,7 +77,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return []; } @@ -86,7 +87,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'unknown' => ['value' => 23], @@ -98,7 +99,7 @@ public function getInvalidValidatorConfiguration() * * @return mixed */ - public function getValidCreationFieldData() + public function getValidCreationFieldData(): Value { return new UrlValue('http://example.com', 'Example'); } @@ -121,7 +122,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( UrlValue::class, @@ -138,7 +139,7 @@ public function assertFieldDataLoadedCorrect(Field $field) ); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return [ [ @@ -157,7 +158,7 @@ public function provideInvalidCreationFieldData() * * @return array */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): Value { return new UrlValue('http://example.com/2', 'Example 2'); } @@ -169,7 +170,7 @@ public function getValidUpdateFieldData() * * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( UrlValue::class, @@ -199,7 +200,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( UrlValue::class, @@ -236,7 +237,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -263,7 +264,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -277,7 +278,7 @@ public function provideFromHashData() ]; } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new UrlValue()], @@ -287,7 +288,7 @@ public function providerForTestIsEmptyValue() ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ @@ -299,12 +300,12 @@ public function providerForTestIsNotEmptyValue() ]; } - protected function getValidSearchValueOne() + protected function getValidSearchValueOne(): Value { return new UrlValue('http://ample.com', 'Ample'); } - protected function getValidSearchValueTwo() + protected function getValidSearchValueTwo(): Value { return new UrlValue('http://example.com', 'Example'); } @@ -319,7 +320,7 @@ protected function getSearchTargetValueTwo(): string return 'http://example.com'; } - protected function getAdditionallyIndexedFieldData() + protected function getAdditionallyIndexedFieldData(): array { return [ [ @@ -331,7 +332,7 @@ protected function getAdditionallyIndexedFieldData() ]; } - protected function getFullTextIndexedFieldData() + protected function getFullTextIndexedFieldData(): array { return [ ['ample', 'example'], diff --git a/tests/integration/Core/Repository/FieldType/UserIntegrationTest.php b/tests/integration/Core/Repository/FieldType/UserIntegrationTest.php index 432e0a2b8c..5896ba2d7f 100644 --- a/tests/integration/Core/Repository/FieldType/UserIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/UserIntegrationTest.php @@ -10,10 +10,12 @@ use Doctrine\DBAL\Exception\NotNullConstraintViolationException; use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; use Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition; use Ibexa\Core\FieldType\User\Type; +use Ibexa\Core\FieldType\User\Value; use Ibexa\Core\FieldType\User\Value as UserValue; use Ibexa\Core\Repository\Values\User\User; use Ibexa\Tests\Core\FieldType\DataProvider\UserValidatorConfigurationSchemaProvider; @@ -43,7 +45,7 @@ public function getTypeName(): string * * @return array */ - public function getSettingsSchema() + public function getSettingsSchema(): array { return [ 'PasswordTTL' => [ @@ -70,7 +72,7 @@ public function getSettingsSchema() * * @return mixed */ - public function getValidFieldSettings() + public function getValidFieldSettings(): array { return [ 'PasswordTTL' => null, @@ -85,7 +87,7 @@ public function getValidFieldSettings() * * @return mixed */ - public function getInvalidFieldSettings() + public function getInvalidFieldSettings(): array { return [ 'somethingUnknown' => 0, @@ -97,7 +99,7 @@ public function getInvalidFieldSettings() * * @return array */ - public function getValidatorSchema() + public function getValidatorSchema(): array { return (new UserValidatorConfigurationSchemaProvider()) ->getExpectedValidatorConfigurationSchema(); @@ -108,7 +110,7 @@ public function getValidatorSchema() * * @return mixed */ - public function getValidValidatorConfiguration() + public function getValidValidatorConfiguration(): array { return [ 'PasswordValueValidator' => [ @@ -128,7 +130,7 @@ public function getValidValidatorConfiguration() * * @return mixed */ - public function getInvalidValidatorConfiguration() + public function getInvalidValidatorConfiguration(): array { return [ 'unknown' => ['value' => 23], @@ -168,7 +170,7 @@ public function getFieldName(): string * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertFieldDataLoadedCorrect(Field $field) + public function assertFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( UserValue::class, @@ -191,7 +193,7 @@ public function assertFieldDataLoadedCorrect(Field $field) self::assertNotNull($field->value->contentId); } - public function provideInvalidCreationFieldData() + public function provideInvalidCreationFieldData(): array { return []; } @@ -208,7 +210,7 @@ public function testCreateContentFails( * * @return \Ibexa\Core\FieldType\User\Value */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): Value { return new UserValue( [ @@ -229,7 +231,7 @@ public function getValidUpdateFieldData() * * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf( UserValue::class, @@ -252,7 +254,7 @@ public function assertUpdatedFieldDataLoadedCorrect(Field $field) self::assertNotNull($field->value->contentId); } - public function provideInvalidUpdateFieldData() + public function provideInvalidUpdateFieldData(): array { return [ [ @@ -271,7 +273,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( UserValue::class, @@ -315,7 +317,7 @@ public function assertCopiedFieldDataLoadedCorrectly(Field $field) * * @return array */ - public function provideToHashData() + public function provideToHashData(): array { return [ [ @@ -356,7 +358,7 @@ public function provideToHashData() * * @return array */ - public function provideFromHashData() + public function provideFromHashData(): array { return [ [ @@ -371,7 +373,7 @@ public function provideFromHashData() * * @param mixed $fieldData */ - protected function createContent($fieldData, $contentType = null) + protected function createContent($fieldData, $contentType = null): Content { if ($contentType === null) { $contentType = $this->testCreateContentType(); @@ -405,12 +407,12 @@ protected function createContent($fieldData, $contentType = null) return $contentService->createContentDraft($user->content->contentInfo, $user->content->versionInfo); } - public function testCreateContentWithEmptyFieldValue() + public function testCreateContentWithEmptyFieldValue(): void { self::markTestSkipped('User field will never be created empty'); } - public function providerForTestIsEmptyValue() + public function providerForTestIsEmptyValue(): array { return [ [new UserValue()], @@ -418,7 +420,7 @@ public function providerForTestIsEmptyValue() ]; } - public function providerForTestIsNotEmptyValue() + public function providerForTestIsNotEmptyValue(): array { return [ [ @@ -427,7 +429,7 @@ public function providerForTestIsNotEmptyValue() ]; } - public function testRemoveFieldDefinition() + public function testRemoveFieldDefinition(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -472,7 +474,7 @@ public function testCopyField($content) /** * @depends testCopyField */ - public function testCopiedFieldType($content) + public function testCopiedFieldType($content): void { self::markTestSkipped('Users cannot be copied, content is not passed to test.'); } @@ -480,7 +482,7 @@ public function testCopiedFieldType($content) /** * @depends testCopiedFieldType */ - public function testCopiedExternalData(Field $field) + public function testCopiedExternalData(Field $field): void { self::markTestSkipped('Users cannot be copied, field is not passed to test.'); } @@ -488,7 +490,7 @@ public function testCopiedExternalData(Field $field) /** * @see https://issues.ibexa.co/browse/EZP-30966 */ - public function testUpdateFieldDefinitionWithIncompleteSettingsSchema() + public function testUpdateFieldDefinitionWithIncompleteSettingsSchema(): void { $contentTypeService = $this->getRepository()->getContentTypeService(); $contentType = $this->testCreateContentType(); diff --git a/tests/integration/Core/Repository/FieldTypeServiceTest.php b/tests/integration/Core/Repository/FieldTypeServiceTest.php index b296579223..044779caf1 100644 --- a/tests/integration/Core/Repository/FieldTypeServiceTest.php +++ b/tests/integration/Core/Repository/FieldTypeServiceTest.php @@ -23,7 +23,7 @@ class FieldTypeServiceTest extends BaseTest * * @covers \Ibexa\Contracts\Core\Repository\FieldTypeService::getFieldTypes() */ - public function testGetFieldTypes() + public function testGetFieldTypes(): void { $repository = $this->getRepository(); @@ -52,7 +52,7 @@ public function testGetFieldTypes() * * @covers \Ibexa\Contracts\Core\Repository\FieldTypeService::getFieldType() */ - public function testGetFieldType() + public function testGetFieldType(): void { $repository = $this->getRepository(); @@ -78,7 +78,7 @@ public function testGetFieldType() * * @covers \Ibexa\Contracts\Core\Repository\FieldTypeService::getFieldType() */ - public function testGetFieldTypeThrowsNotFoundException() + public function testGetFieldTypeThrowsNotFoundException(): void { $this->expectException(\RuntimeException::class); @@ -97,7 +97,7 @@ public function testGetFieldTypeThrowsNotFoundException() * * @covers \Ibexa\Contracts\Core\Repository\FieldTypeService::hasFieldType() */ - public function testHasFieldTypeReturnsTrue() + public function testHasFieldTypeReturnsTrue(): void { $repository = $this->getRepository(); @@ -116,7 +116,7 @@ public function testHasFieldTypeReturnsTrue() * * @covers \Ibexa\Contracts\Core\Repository\FieldTypeService::hasFieldType() */ - public function testHasFieldTypeReturnsFalse() + public function testHasFieldTypeReturnsFalse(): void { $repository = $this->getRepository(); diff --git a/tests/integration/Core/Repository/LanguageServiceAuthorizationTest.php b/tests/integration/Core/Repository/LanguageServiceAuthorizationTest.php index dd4eb9fc89..5f05710b1c 100644 --- a/tests/integration/Core/Repository/LanguageServiceAuthorizationTest.php +++ b/tests/integration/Core/Repository/LanguageServiceAuthorizationTest.php @@ -28,7 +28,7 @@ class LanguageServiceAuthorizationTest extends BaseTest * * @depends testCreateLanguage */ - public function testCreateLanguageThrowsUnauthorizedException() + public function testCreateLanguageThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -62,7 +62,7 @@ public function testCreateLanguageThrowsUnauthorizedException() * * @depends testUpdateLanguageName */ - public function testUpdateLanguageNameThrowsUnauthorizedException() + public function testUpdateLanguageNameThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -100,7 +100,7 @@ public function testUpdateLanguageNameThrowsUnauthorizedException() * * @depends testEnableLanguage */ - public function testEnableLanguageThrowsUnauthorizedException() + public function testEnableLanguageThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -136,7 +136,7 @@ public function testEnableLanguageThrowsUnauthorizedException() * * @depends testDisableLanguage */ - public function testDisableLanguageThrowsUnauthorizedException() + public function testDisableLanguageThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -172,7 +172,7 @@ public function testDisableLanguageThrowsUnauthorizedException() * * @depends testDeleteLanguage */ - public function testDeleteLanguageThrowsUnauthorizedException() + public function testDeleteLanguageThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/LanguageServiceMaximumSupportedLanguagesTest.php b/tests/integration/Core/Repository/LanguageServiceMaximumSupportedLanguagesTest.php index 31e8a0b759..b2a9203313 100644 --- a/tests/integration/Core/Repository/LanguageServiceMaximumSupportedLanguagesTest.php +++ b/tests/integration/Core/Repository/LanguageServiceMaximumSupportedLanguagesTest.php @@ -7,6 +7,7 @@ namespace Ibexa\Tests\Integration\Core\Repository; +use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Test\Repository\SetupFactory\Legacy as LegacySetupFactory; /** @@ -20,10 +21,9 @@ class LanguageServiceMaximumSupportedLanguagesTest extends BaseTest { /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ - private $languageService; + private LanguageService $languageService; - /** @var array */ - private $createdLanguages = []; + private array $createdLanguages = []; /** * Creates as much languages as possible. @@ -78,7 +78,7 @@ protected function tearDown(): void * * @depends Ibexa\Tests\Integration\Core\Repository\LanguageServiceTest::testNewLanguageCreateStruct */ - public function testCreateMaximumLanguageLimit() + public function testCreateMaximumLanguageLimit(): void { $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('Maximum number of languages reached.'); diff --git a/tests/integration/Core/Repository/LanguageServiceTest.php b/tests/integration/Core/Repository/LanguageServiceTest.php index ed3074ca1d..bac793c9f8 100644 --- a/tests/integration/Core/Repository/LanguageServiceTest.php +++ b/tests/integration/Core/Repository/LanguageServiceTest.php @@ -28,7 +28,7 @@ class LanguageServiceTest extends BaseTest * * @covers \Ibexa\Contracts\Core\Repository\LanguageService::newLanguageCreateStruct */ - public function testNewLanguageCreateStruct() + public function testNewLanguageCreateStruct(): void { $repository = $this->getRepository(); @@ -94,7 +94,7 @@ public function testCreateLanguage() * * @depends testCreateLanguage */ - public function testCreateLanguageSetsIdPropertyOnReturnedLanguage($language) + public function testCreateLanguageSetsIdPropertyOnReturnedLanguage($language): void { self::assertNotNull($language->id); } @@ -108,7 +108,7 @@ public function testCreateLanguageSetsIdPropertyOnReturnedLanguage($language) * * @depends testCreateLanguage */ - public function testCreateLanguageSetsExpectedProperties($language) + public function testCreateLanguageSetsExpectedProperties($language): void { self::assertEquals( [ @@ -131,7 +131,7 @@ public function testCreateLanguageSetsExpectedProperties($language) * * @depends testCreateLanguage */ - public function testCreateLanguageThrowsInvalidArgumentException() + public function testCreateLanguageThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'languageCreateStruct\' is invalid: language with the "nor-NO" language code already exists'); @@ -162,7 +162,7 @@ public function testCreateLanguageThrowsInvalidArgumentException() * * @depends testCreateLanguage */ - public function testLoadLanguageById() + public function testLoadLanguageById(): void { $repository = $this->getRepository(); @@ -197,7 +197,7 @@ public function testLoadLanguageById() * * @depends testLoadLanguageById */ - public function testLoadLanguageByIdThrowsNotFoundException() + public function testLoadLanguageByIdThrowsNotFoundException(): void { $repository = $this->getRepository(); @@ -223,7 +223,7 @@ public function testLoadLanguageByIdThrowsNotFoundException() * * @depends testLoadLanguageById */ - public function testUpdateLanguageName() + public function testUpdateLanguageName(): void { $repository = $this->getRepository(); @@ -269,7 +269,7 @@ public function testUpdateLanguageName() * * @covers \Ibexa\Contracts\Core\Repository\LanguageService::updateLanguageName */ - public function testUpdateLanguageNameThrowsInvalidArgumentException() + public function testUpdateLanguageNameThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'newName\' is invalid: \'\' is incorrect value'); @@ -288,7 +288,7 @@ public function testUpdateLanguageNameThrowsInvalidArgumentException() * * @depends testLoadLanguageById */ - public function testEnableLanguage() + public function testEnableLanguage(): void { $repository = $this->getRepository(); @@ -318,7 +318,7 @@ public function testEnableLanguage() * * @depends testLoadLanguageById */ - public function testDisableLanguage() + public function testDisableLanguage(): void { $repository = $this->getRepository(); @@ -349,7 +349,7 @@ public function testDisableLanguage() * * @depends testCreateLanguage */ - public function testLoadLanguage() + public function testLoadLanguage(): void { $repository = $this->getRepository(); @@ -401,7 +401,7 @@ public function testLoadLanguage() * * @depends testLoadLanguage */ - public function testLoadLanguageThrowsNotFoundException() + public function testLoadLanguageThrowsNotFoundException(): void { $repository = $this->getRepository(); @@ -422,7 +422,7 @@ public function testLoadLanguageThrowsNotFoundException() * * @covers \Ibexa\Contracts\Core\Repository\LanguageService::loadLanguage */ - public function testLoadLanguageThrowsInvalidArgumentException() + public function testLoadLanguageThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'languageCode\' is invalid: language code has an invalid value'); @@ -440,7 +440,7 @@ public function testLoadLanguageThrowsInvalidArgumentException() * @depends testCreateLanguage * @depends testLoadLanguage */ - public function testLoadLanguages() + public function testLoadLanguages(): void { $repository = $this->getRepository(); @@ -485,7 +485,7 @@ public function testLoadLanguages() * * @depends testCreateLanguage */ - public function loadLanguagesReturnsAnEmptyArrayByDefault() + public function loadLanguagesReturnsAnEmptyArrayByDefault(): void { $repository = $this->getRepository(); @@ -501,7 +501,7 @@ public function loadLanguagesReturnsAnEmptyArrayByDefault() * * @depends testLoadLanguages */ - public function testDeleteLanguage() + public function testDeleteLanguage(): void { $repository = $this->getRepository(); $languageService = $repository->getContentLanguageService(); @@ -544,7 +544,7 @@ public function testDeleteLanguage() * * @depends testDeleteLanguage */ - public function testDeleteLanguageThrowsInvalidArgumentException() + public function testDeleteLanguageThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'language\' is invalid: Cannot delete language: some content still references the language'); @@ -588,7 +588,7 @@ public function testDeleteLanguageThrowsInvalidArgumentException() * * @covers \Ibexa\Contracts\Core\Repository\LanguageService::getDefaultLanguageCode */ - public function testGetDefaultLanguageCode() + public function testGetDefaultLanguageCode(): void { $repository = $this->getRepository(); $languageService = $repository->getContentLanguageService(); @@ -606,7 +606,7 @@ public function testGetDefaultLanguageCode() * * @depends testCreateLanguage */ - public function testCreateLanguageInTransactionWithRollback() + public function testCreateLanguageInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -652,7 +652,7 @@ public function testCreateLanguageInTransactionWithRollback() * * @depends testCreateLanguage */ - public function testCreateLanguageInTransactionWithCommit() + public function testCreateLanguageInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -694,7 +694,7 @@ public function testCreateLanguageInTransactionWithCommit() * * @depends testUpdateLanguageName */ - public function testUpdateLanguageNameInTransactionWithRollback() + public function testUpdateLanguageNameInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -733,7 +733,7 @@ public function testUpdateLanguageNameInTransactionWithRollback() * * @depends testUpdateLanguageName */ - public function testUpdateLanguageNameInTransactionWithCommit() + public function testUpdateLanguageNameInTransactionWithCommit(): void { $repository = $this->getRepository(); diff --git a/tests/integration/Core/Repository/Limitation/PermissionResolver/LocationLimitationIntegrationTest.php b/tests/integration/Core/Repository/Limitation/PermissionResolver/LocationLimitationIntegrationTest.php index 474cb3a77b..818d355f3f 100644 --- a/tests/integration/Core/Repository/Limitation/PermissionResolver/LocationLimitationIntegrationTest.php +++ b/tests/integration/Core/Repository/Limitation/PermissionResolver/LocationLimitationIntegrationTest.php @@ -81,7 +81,7 @@ public function testCanUserReadTrashedContent(array $limitations, bool $expected $this->loginAsEditorUserWithLimitations('content', 'read', $limitations); $trashItem = $repository->sudo( - static function (Repository $repository) use ($location) { + static function (Repository $repository) use ($location): ?\Ibexa\Contracts\Core\Repository\Values\Content\TrashItem { return $repository->getTrashService()->trash($location); } ); diff --git a/tests/integration/Core/Repository/LocationServiceAuthorizationTest.php b/tests/integration/Core/Repository/LocationServiceAuthorizationTest.php index 0209c446a0..f9d0d17aba 100644 --- a/tests/integration/Core/Repository/LocationServiceAuthorizationTest.php +++ b/tests/integration/Core/Repository/LocationServiceAuthorizationTest.php @@ -32,7 +32,7 @@ class LocationServiceAuthorizationTest extends BaseTest * * @depends Ibexa\Tests\Integration\Core\Repository\LocationServiceTest::testCreateLocation */ - public function testCreateLocationThrowsUnauthorizedException() + public function testCreateLocationThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -75,7 +75,7 @@ public function testCreateLocationThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\LocationServiceTest::testCreateLocation */ - public function testCreateLocationThrowsUnauthorizedExceptionDueToLackOfContentManageLocationsPolicy() + public function testCreateLocationThrowsUnauthorizedExceptionDueToLackOfContentManageLocationsPolicy(): void { $this->expectException(UnauthorizedException::class); @@ -136,7 +136,7 @@ public function testCreateLocationThrowsUnauthorizedExceptionDueToLackOfContentM * * @depends Ibexa\Tests\Integration\Core\Repository\LocationServiceTest::testLoadLocation */ - public function testLoadLocationThrowsUnauthorizedException() + public function testLoadLocationThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -186,7 +186,7 @@ public function testLoadLocationListFiltersUnauthorizedLocations(): void * * @depends Ibexa\Tests\Integration\Core\Repository\LocationServiceTest::testLoadLocationByRemoteId */ - public function testLoadLocationByRemoteIdThrowsUnauthorizedException() + public function testLoadLocationByRemoteIdThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -216,7 +216,7 @@ public function testLoadLocationByRemoteIdThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\LocationServiceTest::testLoadLocations */ - public function testLoadLocationsNoAccess() + public function testLoadLocationsNoAccess(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -246,7 +246,7 @@ public function testLoadLocationsNoAccess() * * @depends Ibexa\Tests\Integration\Core\Repository\LocationServiceTest::testUpdateLocation */ - public function testUpdateLocationThrowsUnauthorizedException() + public function testUpdateLocationThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -286,7 +286,7 @@ public function testUpdateLocationThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\LocationServiceTest::testSwapLocation */ - public function testSwapLocationThrowsUnauthorizedException() + public function testSwapLocationThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -328,7 +328,7 @@ public function testSwapLocationThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\LocationServiceTest::testHideLocation */ - public function testHideLocationThrowsUnauthorizedException() + public function testHideLocationThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -359,7 +359,7 @@ public function testHideLocationThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\LocationServiceTest::testUnhideLocation */ - public function testUnhideLocationThrowsUnauthorizedException() + public function testUnhideLocationThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -393,7 +393,7 @@ public function testUnhideLocationThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\LocationServiceTest::testDeleteLocation */ - public function testDeleteLocationThrowsUnauthorizedException() + public function testDeleteLocationThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -457,7 +457,7 @@ public function testDeleteLocationThrowsUnauthorizedExceptionWithLanguageLimitat * * @depends Ibexa\Tests\Integration\Core\Repository\LocationServiceTest::testDeleteLocation */ - public function testDeleteLocationWithSubtreeThrowsUnauthorizedException() + public function testDeleteLocationWithSubtreeThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); $this->expectExceptionMessage('The User does not have the \'remove\' \'content\' permission'); @@ -556,7 +556,7 @@ public function testDeleteLocationWithSubtreeThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\LocationServiceTest::testCopySubtree */ - public function testCopySubtreeThrowsUnauthorizedException() + public function testCopySubtreeThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -601,7 +601,7 @@ public function testCopySubtreeThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\LocationServiceTest::testMoveSubtree */ - public function testMoveSubtreeThrowsUnauthorizedException() + public function testMoveSubtreeThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/LocationServiceTest.php b/tests/integration/Core/Repository/LocationServiceTest.php index 63875e9cb3..12ca15a9cc 100644 --- a/tests/integration/Core/Repository/LocationServiceTest.php +++ b/tests/integration/Core/Repository/LocationServiceTest.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\URLAliasService; use Ibexa\Contracts\Core\Repository\URLAliasService as URLAliasServiceInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct; @@ -73,7 +74,7 @@ public function testNewLocationCreateStruct() * * @depends testNewLocationCreateStruct */ - public function testNewLocationCreateStructValues(LocationCreateStruct $locationCreate) + public function testNewLocationCreateStructValues(LocationCreateStruct $locationCreate): void { $this->assertPropertiesCorrect( [ @@ -96,7 +97,7 @@ public function testNewLocationCreateStructValues(LocationCreateStruct $location * * @depends testNewLocationCreateStruct */ - public function testCreateLocation() + public function testCreateLocation(): array { $repository = $this->getRepository(); @@ -223,7 +224,7 @@ public function testCreateLocationWithContentTypeSortingOptions(): void * * @depends testCreateLocation */ - public function testCreateLocationStructValues(array $data) + public function testCreateLocationStructValues(array $data): void { $locationCreate = $data['locationCreate']; $createdLocation = $data['createdLocation']; @@ -255,7 +256,7 @@ public function testCreateLocationStructValues(array $data) * * @depends testNewLocationCreateStruct */ - public function testCreateLocationThrowsInvalidArgumentExceptionContentAlreadyBelowParent() + public function testCreateLocationThrowsInvalidArgumentExceptionContentAlreadyBelowParent(): void { $this->expectException(InvalidArgumentException::class); @@ -290,7 +291,7 @@ public function testCreateLocationThrowsInvalidArgumentExceptionContentAlreadyBe * * @depends testNewLocationCreateStruct */ - public function testCreateLocationThrowsInvalidArgumentExceptionParentIsSubLocationOfContent() + public function testCreateLocationThrowsInvalidArgumentExceptionParentIsSubLocationOfContent(): void { $this->expectException(InvalidArgumentException::class); @@ -325,7 +326,7 @@ public function testCreateLocationThrowsInvalidArgumentExceptionParentIsSubLocat * * @depends testNewLocationCreateStruct */ - public function testCreateLocationThrowsInvalidArgumentExceptionRemoteIdExists() + public function testCreateLocationThrowsInvalidArgumentExceptionRemoteIdExists(): void { $this->expectException(InvalidArgumentException::class); @@ -362,7 +363,7 @@ public function testCreateLocationThrowsInvalidArgumentExceptionRemoteIdExists() * * @dataProvider dataProviderForOutOfRangeLocationPriority */ - public function testCreateLocationThrowsInvalidArgumentExceptionPriorityIsOutOfRange($priority) + public function testCreateLocationThrowsInvalidArgumentExceptionPriorityIsOutOfRange($priority): void { $this->expectException(InvalidArgumentException::class); @@ -394,7 +395,7 @@ public function testCreateLocationThrowsInvalidArgumentExceptionPriorityIsOutOfR /* END: Use Case */ } - public function dataProviderForOutOfRangeLocationPriority() + public function dataProviderForOutOfRangeLocationPriority(): array { return [[-2147483649], [2147483648]]; } @@ -406,7 +407,7 @@ public function dataProviderForOutOfRangeLocationPriority() * * @depends testCreateLocation */ - public function testCreateLocationInTransactionWithRollback() + public function testCreateLocationInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -487,7 +488,7 @@ public function testLoadLocation() * * @depends testLoadLocation */ - public function testLoadLocationRootStructValues() + public function testLoadLocationRootStructValues(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -566,7 +567,7 @@ private function assertRootLocationStructValues(Location $location): void * * @depends testLoadLocation */ - public function testLoadLocationStructValues(Location $location) + public function testLoadLocationStructValues(Location $location): void { $this->assertPropertiesCorrect( [ @@ -598,7 +599,7 @@ public function testLoadLocationStructValues(Location $location) self::assertEquals(4, $content->contentInfo->id); } - public function testLoadLocationPrioritizedLanguagesFallback() + public function testLoadLocationPrioritizedLanguagesFallback(): void { $repository = $this->getRepository(); @@ -659,7 +660,7 @@ public function testLoadLocationThrowsNotFoundExceptionForNotAvailableContent(): * * @depends testCreateLocation */ - public function testLoadLocationThrowsNotFoundException() + public function testLoadLocationThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -745,7 +746,7 @@ public function testLoadLocationListPrioritizedLanguagesFallbackAndAlwaysAvailab * * @covers \Ibexa\Contracts\Core\Repository\LocationService::loadLocationList */ - public function testLoadLocationListWithRootLocationId() + public function testLoadLocationListWithRootLocationId(): void { $repository = $this->getRepository(); @@ -767,7 +768,7 @@ public function testLoadLocationListWithRootLocationId() * * @covers \Ibexa\Contracts\Core\Repository\LocationService::loadLocationList */ - public function testLoadLocationListInCorrectOrder() + public function testLoadLocationListInCorrectOrder(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -791,7 +792,7 @@ public function testLoadLocationListInCorrectOrder() * * @depends testLoadLocation */ - public function testLoadLocationByRemoteId() + public function testLoadLocationByRemoteId(): void { $repository = $this->getRepository(); @@ -816,7 +817,7 @@ public function testLoadLocationByRemoteId() * * @depends testLoadLocation */ - public function testLoadLocationByRemoteIdThrowsNotFoundException() + public function testLoadLocationByRemoteIdThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -872,7 +873,7 @@ public function testLoadLocations() * * @depends testLoadLocations */ - public function testLoadLocationsContent(array $locations) + public function testLoadLocationsContent(array $locations): void { self::assertCount(1, $locations); foreach ($locations as $loadedLocation) { @@ -954,7 +955,7 @@ public function testLoadLocationsLimitedSubtree() * * @depends testLoadLocationsLimitedSubtree */ - public function testLoadLocationsLimitedSubtreeContent(array $locations) + public function testLoadLocationsLimitedSubtreeContent(array $locations): void { self::assertCount(1, $locations); @@ -971,7 +972,7 @@ public function testLoadLocationsLimitedSubtreeContent(array $locations) * * @depends testLoadLocations */ - public function testLoadLocationsThrowsBadStateException() + public function testLoadLocationsThrowsBadStateException(): void { $this->expectException(BadStateException::class); @@ -1002,7 +1003,7 @@ public function testLoadLocationsThrowsBadStateException() * * @depends testLoadLocations */ - public function testLoadLocationsThrowsBadStateExceptionLimitedSubtree() + public function testLoadLocationsThrowsBadStateExceptionLimitedSubtree(): void { $this->expectException(BadStateException::class); @@ -1108,7 +1109,7 @@ public function testLoadParentLocationsForDraftContent() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $contentDraft */ - public function testLoadParentLocationsForDraftContentThrowsBadStateException(Content $contentDraft) + public function testLoadParentLocationsForDraftContentThrowsBadStateException(Content $contentDraft): void { $this->expectException(BadStateException::class); $this->expectExceptionMessageMatches('/is already published/'); @@ -1129,7 +1130,7 @@ public function testLoadParentLocationsForDraftContentThrowsBadStateException(Co * * @depends testLoadLocation */ - public function testGetLocationChildCount() + public function testGetLocationChildCount(): void { // $locationId is the ID of an existing location $locationService = $this->getRepository()->getLocationService(); @@ -1149,7 +1150,7 @@ public function testGetLocationChildCount() * * @depends testLoadLocationChildren */ - public function testLoadLocationChildrenData(LocationList $locations) + public function testLoadLocationChildrenData(LocationList $locations): void { self::assertCount(5, $locations->locations); self::assertEquals(5, $locations->getTotalCount()); @@ -1412,7 +1413,7 @@ static function (Location $location) { * * @covers \Ibexa\Contracts\Core\Repository\LocationService::newLocationUpdateStruct */ - public function testNewLocationUpdateStruct() + public function testNewLocationUpdateStruct(): void { $repository = $this->getRepository(); @@ -1445,7 +1446,7 @@ public function testNewLocationUpdateStruct() * * @depends testLoadLocation */ - public function testUpdateLocation() + public function testUpdateLocation(): array { $repository = $this->getRepository(); @@ -1484,7 +1485,7 @@ public function testUpdateLocation() * * @depends testUpdateLocation */ - public function testUpdateLocationStructValues(array $data) + public function testUpdateLocationStructValues(array $data): void { $originalLocation = $data['originalLocation']; $updateStruct = $data['updateStruct']; @@ -1515,7 +1516,7 @@ public function testUpdateLocationStructValues(array $data) * * @depends testLoadLocation */ - public function testUpdateLocationWithSameRemoteId() + public function testUpdateLocationWithSameRemoteId(): void { $repository = $this->getRepository(); @@ -1551,7 +1552,7 @@ public function testUpdateLocationWithSameRemoteId() * * @depends testLoadLocation */ - public function testUpdateLocationThrowsInvalidArgumentException() + public function testUpdateLocationThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -1583,7 +1584,7 @@ public function testUpdateLocationThrowsInvalidArgumentException() * * @dataProvider dataProviderForOutOfRangeLocationPriority */ - public function testUpdateLocationThrowsInvalidArgumentExceptionPriorityIsOutOfRange($priority) + public function testUpdateLocationThrowsInvalidArgumentExceptionPriorityIsOutOfRange($priority): void { $this->expectException(InvalidArgumentException::class); @@ -1614,7 +1615,7 @@ public function testUpdateLocationThrowsInvalidArgumentExceptionPriorityIsOutOfR * * @depends testLoadLocation */ - public function testUpdateLocationTwice() + public function testUpdateLocationTwice(): void { $repository = $this->getRepository(); $permissionResolver = $repository->getPermissionResolver(); @@ -1646,7 +1647,7 @@ public function testUpdateLocationTwice() * * @depends testLoadLocation */ - public function testSwapLocation() + public function testSwapLocation(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -1858,7 +1859,7 @@ static function (Location $location) { * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ - public function testSwapLocationDoesNotCorruptSearchResults(array $contentItems) + public function testSwapLocationDoesNotCorruptSearchResults(array $contentItems): void { $repository = $this->getRepository(false); $searchService = $repository->getSearchService(); @@ -1961,7 +1962,7 @@ public function testSwapLocationForSecondaryLocations(): void * * @covers \Ibexa\Contracts\Core\Repository\LocationService::swapLocation */ - public function testSwapLocationUpdatesMainLocation() + public function testSwapLocationUpdatesMainLocation(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -1999,7 +2000,7 @@ public function testSwapLocationUpdatesMainLocation() * * @covers \Ibexa\Contracts\Core\Repository\LocationService::swapLocation */ - public function testBookmarksAreSwappedAfterSwapLocation() + public function testBookmarksAreSwappedAfterSwapLocation(): void { $repository = $this->getRepository(); @@ -2036,7 +2037,7 @@ public function testBookmarksAreSwappedAfterSwapLocation() * * @depends testLoadLocation */ - public function testHideLocation() + public function testHideLocation(): void { $repository = $this->getRepository(); @@ -2107,7 +2108,7 @@ protected function assertSubtreeProperties(array $expectedValues, Location $loca * * @depends testHideLocation */ - public function testUnhideLocation() + public function testUnhideLocation(): void { $repository = $this->getRepository(); @@ -2152,7 +2153,7 @@ public function testUnhideLocation() * * @depends testUnhideLocation */ - public function testUnhideLocationNotUnhidesHiddenSubtree() + public function testUnhideLocationNotUnhidesHiddenSubtree(): void { $repository = $this->getRepository(); @@ -2218,7 +2219,7 @@ public function testUnhideLocationNotUnhidesHiddenSubtree() * * @depends testLoadLocation */ - public function testDeleteLocation() + public function testDeleteLocation(): void { $repository = $this->getRepository(); @@ -2268,7 +2269,7 @@ public function testDeleteLocation() * * @depends testDeleteLocation */ - public function testDeleteLocationDecrementsChildCountOnParent() + public function testDeleteLocationDecrementsChildCountOnParent(): void { $repository = $this->getRepository(); @@ -2314,7 +2315,7 @@ public function testDeleteLocationDecrementsChildCountOnParent() * * @covers \Ibexa\Contracts\Core\Repository\LocationService::deleteLocation() */ - public function testDeleteContentObjectLastLocation() + public function testDeleteContentObjectLastLocation(): void { $this->expectException(NotFoundException::class); @@ -2360,7 +2361,7 @@ public function testDeleteContentObjectLastLocation() * * @depends testDeleteLocation */ - public function testDeleteLocationDeletesRelatedBookmarks() + public function testDeleteLocationDeletesRelatedBookmarks(): void { $repository = $this->getRepository(); @@ -2462,7 +2463,7 @@ public function testDeleteUnusedLocationWhichPreviousHadContentWithRelativeAlias * * @depends testLoadLocation */ - public function testCopySubtree() + public function testCopySubtree(): void { $repository = $this->getRepository(); @@ -2515,7 +2516,7 @@ public function testCopySubtree() * * @depends testLoadLocation */ - public function testCopySubtreeWithAliases() + public function testCopySubtreeWithAliases(): void { $repository = $this->getRepository(); $urlAliasService = $repository->getURLAliasService(); @@ -2610,7 +2611,7 @@ public function testCopySubtreeWithTranslatedContent(): void * * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo */ - private function assertDefaultContentStates(ContentInfo $contentInfo) + private function assertDefaultContentStates(ContentInfo $contentInfo): void { $repository = $this->getRepository(); $objectStateService = $repository->getObjectStateService(); @@ -2637,7 +2638,7 @@ private function assertDefaultContentStates(ContentInfo $contentInfo) * * @depends testCopySubtree */ - public function testCopySubtreeUpdatesSubtreeProperties() + public function testCopySubtreeUpdatesSubtreeProperties(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -2704,7 +2705,7 @@ public function testCopySubtreeUpdatesSubtreeProperties() * * @depends testCopySubtree */ - public function testCopySubtreeIncrementsChildCountOfNewParent() + public function testCopySubtreeIncrementsChildCountOfNewParent(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -2793,7 +2794,7 @@ public function testCopySubtreeWithInvisibleChild(): void * * @depends testCopySubtree */ - public function testCopySubtreeThrowsInvalidArgumentException() + public function testCopySubtreeThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -3035,7 +3036,7 @@ public function testMoveSubtreeHidden(): void * * @depends testMoveSubtree */ - public function testMoveSubtreeUpdatesSubtreeProperties() + public function testMoveSubtreeUpdatesSubtreeProperties(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -3097,7 +3098,7 @@ public function testMoveSubtreeUpdatesSubtreeProperties() * * @depends testMoveSubtreeUpdatesSubtreeProperties */ - public function testMoveSubtreeUpdatesSubtreePropertiesHidden() + public function testMoveSubtreeUpdatesSubtreePropertiesHidden(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -3163,7 +3164,7 @@ public function testMoveSubtreeUpdatesSubtreePropertiesHidden() * * @depends testMoveSubtree */ - public function testMoveSubtreeIncrementsChildCountOfNewParent() + public function testMoveSubtreeIncrementsChildCountOfNewParent(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -3222,7 +3223,7 @@ public function testMoveSubtreeIncrementsChildCountOfNewParent() * * @depends testMoveSubtree */ - public function testMoveSubtreeDecrementsChildCountOfOldParent() + public function testMoveSubtreeDecrementsChildCountOfOldParent(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -3283,7 +3284,7 @@ public function testMoveSubtreeDecrementsChildCountOfOldParent() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function testMoveInvisibleSubtree() + public function testMoveInvisibleSubtree(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -3642,7 +3643,7 @@ private function loadSubtreeProperties(Location $location, array $properties = [ * * @return array */ - private function loadLocationProperties(Location $location, array $overwrite = []) + private function loadLocationProperties(Location $location, array $overwrite = []): array { return array_merge( [ @@ -3679,13 +3680,13 @@ protected function assertGeneratedAliases($urlAliasService, array $expectedAlias * @param \Ibexa\Contracts\Core\Repository\URLAliasService $urlAliasService * @param array $expectedSubItemAliases */ - private function assertAliasesBeforeCopy($urlAliasService, array $expectedSubItemAliases) + private function assertAliasesBeforeCopy(URLAliasService $urlAliasService, array $expectedSubItemAliases): void { foreach ($expectedSubItemAliases as $aliasUrl) { try { $urlAliasService->lookup($aliasUrl); self::fail('We didn\'t expect to find alias, but it was found'); - } catch (\Exception $e) { + } catch (Exception $e) { self::assertTrue(true); // OK - alias was not found } } @@ -3699,7 +3700,7 @@ private function assertAliasesBeforeCopy($urlAliasService, array $expectedSubIte * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content published Content */ - private function publishContentWithParentLocation($contentName, $parentLocationId) + private function publishContentWithParentLocation(string $contentName, int $parentLocationId): Content { $repository = $this->getRepository(false); $locationService = $repository->getLocationService(); diff --git a/tests/integration/Core/Repository/NonRedundantFieldSetTest.php b/tests/integration/Core/Repository/NonRedundantFieldSetTest.php index 2ad7c523e1..efb453bc1b 100644 --- a/tests/integration/Core/Repository/NonRedundantFieldSetTest.php +++ b/tests/integration/Core/Repository/NonRedundantFieldSetTest.php @@ -58,7 +58,7 @@ public function testCreateContentDefaultValues() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ - public function testCreateContentDefaultValuesFields(Content $content) + public function testCreateContentDefaultValuesFields(Content $content): void { self::assertCount(1, $content->versionInfo->languageCodes); self::assertContains('eng-US', $content->versionInfo->languageCodes); @@ -107,7 +107,7 @@ public function testCreateContentEmptyValues() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ - public function testCreateContentEmptyValuesFields(Content $content) + public function testCreateContentEmptyValuesFields(Content $content): void { $emptyValue = $this->getRepository()->getFieldTypeService()->getFieldType('ezstring')->getEmptyValue(); @@ -160,7 +160,7 @@ public function testCreateContentEmptyValuesTranslationNotStored() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ - public function testCreateContentEmptyValuesTranslationNotStoredFields(Content $content) + public function testCreateContentEmptyValuesTranslationNotStoredFields(Content $content): void { $emptyValue = $this->getRepository()->getFieldTypeService()->getFieldType('ezstring')->getEmptyValue(); @@ -215,7 +215,7 @@ public function testCreateContentTwoLanguagesMainTranslationStored() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ - public function testCreateContentTwoLanguagesMainTranslationStoredFields(Content $content) + public function testCreateContentTwoLanguagesMainTranslationStoredFields(Content $content): void { $emptyValue = $this->getRepository()->getFieldTypeService()->getFieldType('ezstring')->getEmptyValue(); @@ -274,7 +274,7 @@ public function testCreateContentTwoLanguagesSecondTranslationNotStored() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ - public function testCreateContentTwoLanguagesSecondTranslationNotStoredFields(Content $content) + public function testCreateContentTwoLanguagesSecondTranslationNotStoredFields(Content $content): void { $emptyValue = $this->getRepository()->getFieldTypeService()->getFieldType('ezstring')->getEmptyValue(); @@ -325,7 +325,7 @@ public function testCreateContentDefaultValuesNoStructFields() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ - public function testCreateContentDefaultValuesNoStructFieldsFields(Content $content) + public function testCreateContentDefaultValuesNoStructFieldsFields(Content $content): void { $emptyValue = $this->getRepository()->getFieldTypeService()->getFieldType('ezstring')->getEmptyValue(); @@ -375,7 +375,7 @@ public function testCreateContentTwoLanguagesNoValuesForMainLanguage() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ - public function testCreateContentTwoLanguagesNoValuesForMainLanguageFields(Content $content) + public function testCreateContentTwoLanguagesNoValuesForMainLanguageFields(Content $content): void { $emptyValue = $this->getRepository()->getFieldTypeService()->getFieldType('ezstring')->getEmptyValue(); @@ -406,7 +406,7 @@ public function testCreateContentTwoLanguagesNoValuesForMainLanguageFields(Conte * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content[] */ - public function testCreateContentDraft() + public function testCreateContentDraft(): array { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -427,7 +427,7 @@ public function testCreateContentDraft() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content[] $data */ - public function testCreateContentDraftFields(array $data) + public function testCreateContentDraftFields(array $data): void { $content = $data[1]; @@ -459,7 +459,7 @@ public function testCreateContentDraftFields(array $data) * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content[] $data */ - public function testCreateContentDraftFieldsRetainsIds(array $data) + public function testCreateContentDraftFieldsRetainsIds(array $data): void { $this->assertFieldIds($data[0], $data[1]); } @@ -501,7 +501,7 @@ public function testUpdateContentWithNewLanguage() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ - public function testUpdateContentWithNewLanguageFields(Content $content) + public function testUpdateContentWithNewLanguageFields(Content $content): void { $emptyValue = $this->getRepository()->getFieldTypeService()->getFieldType('ezstring')->getEmptyValue(); @@ -570,7 +570,7 @@ public function testUpdateContentWithNewLanguageVariant() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ - public function testUpdateContentWithNewLanguageVariantFields(Content $content) + public function testUpdateContentWithNewLanguageVariantFields(Content $content): void { $emptyValue = $this->getRepository()->getFieldTypeService()->getFieldType('ezstring')->getEmptyValue(); @@ -631,7 +631,7 @@ public function testUpdateContentWithNewLanguageNoValues() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ - public function testUpdateContentWithNewLanguageNoValuesFields(Content $content) + public function testUpdateContentWithNewLanguageNoValuesFields(Content $content): void { $emptyValue = $this->getRepository()->getFieldTypeService()->getFieldType('ezstring')->getEmptyValue(); @@ -696,7 +696,7 @@ public function testUpdateContentUpdatingNonTranslatableFieldUpdatesFieldCopy() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ - public function testUpdateContentUpdatingNonTranslatableFieldUpdatesFieldCopyFields(Content $content) + public function testUpdateContentUpdatingNonTranslatableFieldUpdatesFieldCopyFields(Content $content): void { $emptyValue = $this->getRepository()->getFieldTypeService()->getFieldType('ezstring')->getEmptyValue(); @@ -754,7 +754,7 @@ public function testUpdateContentWithTwoLanguagesInitialLanguageTranslationNotCr * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ - public function testUpdateContentWithTwoLanguagesInitialLanguageTranslationNotCreatedFields(Content $content) + public function testUpdateContentWithTwoLanguagesInitialLanguageTranslationNotCreatedFields(Content $content): void { $emptyValue = $this->getRepository()->getFieldTypeService()->getFieldType('ezstring')->getEmptyValue(); @@ -803,7 +803,7 @@ protected function assertFieldIds(Content $content1, Content $content2) * * @return array */ - protected function mapFields(array $fields) + protected function mapFields(array $fields): array { $mappedFields = []; diff --git a/tests/integration/Core/Repository/NotificationServiceTest.php b/tests/integration/Core/Repository/NotificationServiceTest.php index eb6186093d..cfc7cf5655 100644 --- a/tests/integration/Core/Repository/NotificationServiceTest.php +++ b/tests/integration/Core/Repository/NotificationServiceTest.php @@ -24,7 +24,7 @@ class NotificationServiceTest extends BaseTest /** * @covers \Ibexa\Contracts\Core\Repository\NotificationService::loadNotifications() */ - public function testLoadNotifications() + public function testLoadNotifications(): void { $repository = $this->getRepository(); @@ -42,7 +42,7 @@ public function testLoadNotifications() /** * @covers \Ibexa\Contracts\Core\Repository\NotificationService::getNotification() */ - public function testGetNotification() + public function testGetNotification(): void { $repository = $this->getRepository(); @@ -61,7 +61,7 @@ public function testGetNotification() /** * @covers \Ibexa\Contracts\Core\Repository\NotificationService::markNotificationAsRead() */ - public function testMarkNotificationAsRead() + public function testMarkNotificationAsRead(): void { $repository = $this->getRepository(); @@ -80,7 +80,7 @@ public function testMarkNotificationAsRead() /** * @covers \Ibexa\Contracts\Core\Repository\NotificationService::getPendingNotificationCount() */ - public function testGetPendingNotificationCount() + public function testGetPendingNotificationCount(): void { $repository = $this->getRepository(); @@ -95,7 +95,7 @@ public function testGetPendingNotificationCount() /** * @covers \Ibexa\Contracts\Core\Repository\NotificationService::getNotificationCount() */ - public function testGetNotificationCount() + public function testGetNotificationCount(): void { $repository = $this->getRepository(); @@ -110,7 +110,7 @@ public function testGetNotificationCount() /** * @covers \Ibexa\Contracts\Core\Repository\NotificationService::deleteNotification() */ - public function testDeleteNotification() + public function testDeleteNotification(): void { $repository = $this->getRepository(); @@ -131,7 +131,7 @@ public function testDeleteNotification() /** * @covers \Ibexa\Contracts\Core\Repository\NotificationService::createNotification() */ - public function testCreateNotification() + public function testCreateNotification(): void { $repository = $this->getRepository(); @@ -161,7 +161,7 @@ public function testCreateNotification() * * @depends testCreateNotification */ - public function testCreateNotificationThrowsInvalidArgumentExceptionOnMissingOwner() + public function testCreateNotificationThrowsInvalidArgumentExceptionOnMissingOwner(): void { $this->expectException(InvalidArgumentException::class); @@ -184,7 +184,7 @@ public function testCreateNotificationThrowsInvalidArgumentExceptionOnMissingOwn * * @depends testCreateNotification */ - public function testCreateNotificationThrowsInvalidArgumentExceptionOnMissingType() + public function testCreateNotificationThrowsInvalidArgumentExceptionOnMissingType(): void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/integration/Core/Repository/ObjectStateServiceAuthorizationTest.php b/tests/integration/Core/Repository/ObjectStateServiceAuthorizationTest.php index db3ad3e695..25716e2106 100644 --- a/tests/integration/Core/Repository/ObjectStateServiceAuthorizationTest.php +++ b/tests/integration/Core/Repository/ObjectStateServiceAuthorizationTest.php @@ -26,7 +26,7 @@ class ObjectStateServiceAuthorizationTest extends BaseTest * * @depends Ibexa\Tests\Integration\Core\Repository\ObjectStateServiceTest::testCreateObjectStateGroup */ - public function testCreateObjectStateGroupThrowsUnauthorizedException() + public function testCreateObjectStateGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -71,7 +71,7 @@ public function testCreateObjectStateGroupThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ObjectStateServiceTest::testUpdateObjectStateGroup */ - public function testUpdateObjectStateGroupThrowsUnauthorizedException() + public function testUpdateObjectStateGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -121,7 +121,7 @@ public function testUpdateObjectStateGroupThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ObjectStateServiceTest::testDeleteObjectStateGroup */ - public function testDeleteObjectStateGroupThrowsUnauthorizedException() + public function testDeleteObjectStateGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -158,7 +158,7 @@ public function testDeleteObjectStateGroupThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ObjectStateServiceTest::testCreateObjectState */ - public function testCreateObjectStateThrowsUnauthorizedException() + public function testCreateObjectStateThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -210,7 +210,7 @@ public function testCreateObjectStateThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ObjectStateServiceTest::testUpdateObjectState */ - public function testUpdateObjectStateThrowsUnauthorizedException() + public function testUpdateObjectStateThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -261,7 +261,7 @@ public function testUpdateObjectStateThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ObjectStateServiceTest::testSetPriorityOfObjectState */ - public function testSetPriorityOfObjectStateThrowsUnauthorizedException() + public function testSetPriorityOfObjectStateThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -300,7 +300,7 @@ public function testSetPriorityOfObjectStateThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ObjectStateServiceTest::testDeleteObjectState */ - public function testDeleteObjectStateThrowsUnauthorizedException() + public function testDeleteObjectStateThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -335,7 +335,7 @@ public function testDeleteObjectStateThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\ObjectStateServiceTest::testSetContentState */ - public function testSetContentStateThrowsUnauthorizedException() + public function testSetContentStateThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/ObjectStateServiceTest.php b/tests/integration/Core/Repository/ObjectStateServiceTest.php index 9a792115aa..3fc89e48b2 100644 --- a/tests/integration/Core/Repository/ObjectStateServiceTest.php +++ b/tests/integration/Core/Repository/ObjectStateServiceTest.php @@ -65,7 +65,7 @@ public function testNewObjectStateGroupCreateStruct() * * @depends testNewObjectStateGroupCreateStruct */ - public function testNewObjectStateGroupCreateStructValues(ObjectStateGroupCreateStruct $objectStateGroupCreate) + public function testNewObjectStateGroupCreateStructValues(ObjectStateGroupCreateStruct $objectStateGroupCreate): void { $this->assertPropertiesCorrect( [ @@ -109,7 +109,7 @@ public function testNewObjectStateGroupUpdateStruct() * * @depends testNewObjectStateGroupUpdateStruct */ - public function testNewObjectStateGroupUpdateStructValues(ObjectStateGroupUpdateStruct $objectStateGroupUpdate) + public function testNewObjectStateGroupUpdateStructValues(ObjectStateGroupUpdateStruct $objectStateGroupUpdate): void { $this->assertPropertiesCorrect( [ @@ -155,7 +155,7 @@ public function testNewObjectStateCreateStruct() * * @depends testNewObjectStateCreateStruct */ - public function testNewObjectStateCreateStructValues(ObjectStateCreateStruct $objectStateCreate) + public function testNewObjectStateCreateStructValues(ObjectStateCreateStruct $objectStateCreate): void { $this->assertPropertiesCorrect( [ @@ -200,7 +200,7 @@ public function testNewObjectStateUpdateStruct() * * @depends testNewObjectStateUpdateStruct */ - public function testNewObjectStateUpdateStructValues(ObjectStateUpdateStruct $objectStateUpdate) + public function testNewObjectStateUpdateStructValues(ObjectStateUpdateStruct $objectStateUpdate): void { $this->assertPropertiesCorrect( [ @@ -261,7 +261,7 @@ public function testCreateObjectStateGroup() * * @depends testCreateObjectStateGroup */ - public function testCreateObjectStateGroupStructValues(ObjectStateGroup $createdObjectStateGroup) + public function testCreateObjectStateGroupStructValues(ObjectStateGroup $createdObjectStateGroup): void { $this->assertPropertiesCorrect( [ @@ -290,7 +290,7 @@ public function testCreateObjectStateGroupStructValues(ObjectStateGroup $created * * @depends testCreateObjectStateGroup */ - public function testCreateObjectStateGroupThrowsInvalidArgumentException() + public function testCreateObjectStateGroupThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -323,7 +323,7 @@ public function testCreateObjectStateGroupThrowsInvalidArgumentException() * * @covers \Ibexa\Contracts\Core\Repository\ObjectStateService::loadObjectStateGroup */ - public function testLoadObjectStateGroup() + public function testLoadObjectStateGroup(): void { $repository = $this->getRepository(); @@ -364,7 +364,7 @@ public function testLoadObjectStateGroup() * * @depends testLoadObjectStateGroup */ - public function testLoadObjectStateGroupThrowsNotFoundException() + public function testLoadObjectStateGroupThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -442,7 +442,7 @@ public function testLoadObjectStateGroupByIdentifierThrowsNotFoundException(): v * * @depends testLoadObjectStateGroup */ - public function testLoadObjectStateGroups() + public function testLoadObjectStateGroups(): void { $repository = $this->getRepository(); @@ -470,7 +470,7 @@ public function testLoadObjectStateGroups() * * @return bool[] */ - protected function createObjectStateGroups() + protected function createObjectStateGroups(): array { $repository = $this->getRepository(); $objectStateService = $repository->getObjectStateService(); @@ -544,7 +544,7 @@ protected function assertObjectsLoadedByIdentifiers(array $expectedIdentifiers, * * @depends testLoadObjectStateGroups */ - public function testLoadObjectStateGroupsWithOffset() + public function testLoadObjectStateGroupsWithOffset(): void { $repository = $this->getRepository(); $objectStateService = $repository->getObjectStateService(); @@ -597,7 +597,7 @@ static function ($group) { * * @depends testLoadObjectStateGroupsWithOffset */ - public function testLoadObjectStateGroupsWithOffsetAndLimit() + public function testLoadObjectStateGroupsWithOffsetAndLimit(): void { $repository = $this->getRepository(); $objectStateService = $repository->getObjectStateService(); @@ -629,7 +629,7 @@ public function testLoadObjectStateGroupsWithOffsetAndLimit() * * @depends testLoadObjectStateGroup */ - public function testLoadObjectStates() + public function testLoadObjectStates(): void { $repository = $this->getRepository(); @@ -664,7 +664,7 @@ public function testLoadObjectStates() * * @depends testLoadObjectStateGroup */ - public function testUpdateObjectStateGroup() + public function testUpdateObjectStateGroup(): array { $repository = $this->getRepository(); @@ -721,7 +721,7 @@ public function testUpdateObjectStateGroup() * * @depends testLoadObjectStateGroup */ - public function testUpdateObjectStateGroupChosenFieldsOnly() + public function testUpdateObjectStateGroupChosenFieldsOnly(): void { $repository = $this->getRepository(); $objectStateService = $repository->getObjectStateService(); @@ -763,7 +763,7 @@ public function testUpdateObjectStateGroupChosenFieldsOnly() * * @depends testUpdateObjectStateGroup */ - public function testUpdateObjectStateGroupThrowsInvalidArgumentException() + public function testUpdateObjectStateGroupThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -814,7 +814,7 @@ public function testUpdateObjectStateGroupThrowsInvalidArgumentException() * * @depends testUpdateObjectStateGroup */ - public function testUpdateObjectStateGroupStructValues(array $testData) + public function testUpdateObjectStateGroupStructValues(array $testData): void { list( $loadedObjectStateGroup, @@ -841,7 +841,7 @@ public function testUpdateObjectStateGroupStructValues(array $testData) * @depends testLoadObjectStateGroup * @depends testNewObjectStateCreateStruct */ - public function testCreateObjectState() + public function testCreateObjectState(): array { $repository = $this->getRepository(); @@ -894,7 +894,7 @@ public function testCreateObjectState() * * @covers \Ibexa\Contracts\Core\Repository\ObjectStateService::createObjectState */ - public function testCreateObjectStateInEmptyGroup() + public function testCreateObjectStateInEmptyGroup(): void { $repository = $this->getRepository(); $objectStateService = $repository->getObjectStateService(); @@ -954,7 +954,7 @@ public function testCreateObjectStateInEmptyGroup() * @depends testLoadObjectStateGroup * @depends testCreateObjectState */ - public function testCreateObjectStateThrowsInvalidArgumentException() + public function testCreateObjectStateThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -997,7 +997,7 @@ public function testCreateObjectStateThrowsInvalidArgumentException() * * @depends testCreateObjectState */ - public function testCreateObjectStateStructValues(array $testData) + public function testCreateObjectStateStructValues(array $testData): void { list( $loadedObjectStateGroup, @@ -1117,7 +1117,7 @@ public function testLoadObjectStateByIdentifierThrowsNotFoundException(): void * * @depends testLoadObjectState */ - public function testLoadObjectStateStructValues(ObjectState $loadedObjectState) + public function testLoadObjectStateStructValues(ObjectState $loadedObjectState): void { $this->assertPropertiesCorrect( [ @@ -1151,7 +1151,7 @@ public function testLoadObjectStateStructValues(ObjectState $loadedObjectState) * * @depends testLoadObjectState */ - public function testLoadObjectStateThrowsNotFoundException() + public function testLoadObjectStateThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -1174,7 +1174,7 @@ public function testLoadObjectStateThrowsNotFoundException() * * @return array */ - public function getPrioritizedLanguagesList() + public function getPrioritizedLanguagesList(): array { return [ [[], null], @@ -1198,7 +1198,7 @@ public function getPrioritizedLanguagesList() public function testLoadObjectStateGroupsWithPrioritizedLanguagesList( array $prioritizedLanguages, $expectedLanguageCode - ) { + ): void { // cleanup before the actual test $this->deleteExistingObjectStateGroups(); @@ -1239,7 +1239,7 @@ public function testLoadObjectStateGroupsWithPrioritizedLanguagesList( public function testLoadObjectStateGroupWithPrioritizedLanguagesList( array $prioritizedLanguages, $expectedLanguageCode - ) { + ): void { $repository = $this->getRepository(); $objectStateService = $repository->getObjectStateService(); @@ -1275,7 +1275,7 @@ public function testLoadObjectStateGroupWithPrioritizedLanguagesList( public function testLoadObjectStateWithPrioritizedLanguagesList( array $prioritizedLanguages, $expectedLanguageCode - ) { + ): void { $repository = $this->getRepository(); $objectStateService = $repository->getObjectStateService(); @@ -1308,7 +1308,7 @@ public function testLoadObjectStateWithPrioritizedLanguagesList( * @param string[] $languageCodes * @param string|null $expectedLanguageCode */ - public function testLoadObjectStatesWithPrioritizedLanguagesList($languageCodes, $expectedLanguageCode) + public function testLoadObjectStatesWithPrioritizedLanguagesList(array $languageCodes, $expectedLanguageCode): void { $repository = $this->getRepository(); $objectStateService = $repository->getObjectStateService(); @@ -1362,7 +1362,7 @@ public function testLoadObjectStatesWithPrioritizedLanguagesList($languageCodes, * * @depends testLoadObjectState */ - public function testUpdateObjectState() + public function testUpdateObjectState(): array { $repository = $this->getRepository(); @@ -1418,7 +1418,7 @@ public function testUpdateObjectState() * * @depends testLoadObjectState */ - public function testUpdateObjectStateChosenFieldsOnly() + public function testUpdateObjectStateChosenFieldsOnly(): void { $repository = $this->getRepository(); $objectStateService = $repository->getObjectStateService(); @@ -1466,7 +1466,7 @@ public function testUpdateObjectStateChosenFieldsOnly() * * @depends testUpdateObjectState */ - public function testUpdateObjectStateThrowsInvalidArgumentException() + public function testUpdateObjectStateThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -1508,7 +1508,7 @@ public function testUpdateObjectStateThrowsInvalidArgumentException() * * @depends testUpdateObjectState */ - public function testUpdateObjectStateStructValues(array $testData) + public function testUpdateObjectStateStructValues(array $testData): void { list( $loadedObjectState, @@ -1547,7 +1547,7 @@ public function testUpdateObjectStateStructValues(array $testData) * * @depends testLoadObjectState */ - public function testSetPriorityOfObjectState() + public function testSetPriorityOfObjectState(): void { $repository = $this->getRepository(); @@ -1588,7 +1588,7 @@ public function testSetPriorityOfObjectState() * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentInfo * @depends testLoadObjectState */ - public function testGetContentState() + public function testGetContentState(): void { $repository = $this->getRepository(); @@ -1626,7 +1626,7 @@ public function testGetContentState() * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentInfo * @depends testLoadObjectState */ - public function testGetInitialObjectState() + public function testGetInitialObjectState(): void { $repository = $this->getRepository(); $objectStateService = $repository->getObjectStateService(); @@ -1694,7 +1694,7 @@ public function testGetInitialObjectState() * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentInfo * @depends testLoadObjectState */ - public function testSetContentState() + public function testSetContentState(): void { $repository = $this->getRepository(); @@ -1739,7 +1739,7 @@ public function testSetContentState() * * @depends testSetContentState */ - public function testSetContentStateThrowsInvalidArgumentException() + public function testSetContentStateThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -1784,7 +1784,7 @@ public function testSetContentStateThrowsInvalidArgumentException() * * @depends testLoadObjectState */ - public function testGetContentCount() + public function testGetContentCount(): void { $repository = $this->getRepository(); @@ -1809,7 +1809,7 @@ public function testGetContentCount() * * @depends testLoadObjectState */ - public function testDeleteObjectState() + public function testDeleteObjectState(): void { $repository = $this->getRepository(); @@ -1843,7 +1843,7 @@ public function testDeleteObjectState() * * @depends testLoadObjectStateGroup */ - public function testDeleteObjectStateGroup() + public function testDeleteObjectStateGroup(): void { $repository = $this->getRepository(); @@ -1875,7 +1875,7 @@ public function testDeleteObjectStateGroup() /** * Delete existing (e.g. initial) object state groups. */ - private function deleteExistingObjectStateGroups() + private function deleteExistingObjectStateGroups(): void { $repository = $this->getRepository(); $objectStateService = $repository->getObjectStateService(); @@ -1899,10 +1899,10 @@ private function deleteExistingObjectStateGroups() */ private function createObjectState( ObjectStateGroup $objectStateGroup, - $identifier, + string $identifier, array $names, array $descriptions - ) { + ): ObjectState { $objectStateService = $this->getRepository(false)->getObjectStateService(); $objectStateCreateStruct = $objectStateService->newObjectStateCreateStruct( $identifier diff --git a/tests/integration/Core/Repository/Parallel/BaseParallelTestCase.php b/tests/integration/Core/Repository/Parallel/BaseParallelTestCase.php index b7c794a9f0..480d9bdc57 100644 --- a/tests/integration/Core/Repository/Parallel/BaseParallelTestCase.php +++ b/tests/integration/Core/Repository/Parallel/BaseParallelTestCase.php @@ -30,7 +30,7 @@ protected function addParallelProcess(ParallelProcessList $list, callable $callb { $connection = $this->getRawDatabaseConnection(); - $process = new Process(static function () use ($callback, $connection) { + $process = new Process(static function () use ($callback, $connection): void { $connection->connect(); $callback(); $connection->close(); diff --git a/tests/integration/Core/Repository/Parallel/ContentServiceTest.php b/tests/integration/Core/Repository/Parallel/ContentServiceTest.php index 0adfb8a436..fa8fba6c58 100644 --- a/tests/integration/Core/Repository/Parallel/ContentServiceTest.php +++ b/tests/integration/Core/Repository/Parallel/ContentServiceTest.php @@ -29,14 +29,14 @@ public function testPublishMultipleVersions(): void $version2 = $contentService->createContentDraft($content->contentInfo, $content->versionInfo); $processList = new ParallelProcessList(); - $this->addParallelProcess($processList, static function () use ($version1, $contentService) { + $this->addParallelProcess($processList, static function () use ($version1, $contentService): void { try { $contentService->publishVersion($version1->versionInfo); } catch (BadStateException $e) { } }); - $this->addParallelProcess($processList, static function () use ($version2, $contentService) { + $this->addParallelProcess($processList, static function () use ($version2, $contentService): void { try { $contentService->publishVersion($version2->versionInfo); } catch (BadStateException $e) { diff --git a/tests/integration/Core/Repository/PermissionResolverTest.php b/tests/integration/Core/Repository/PermissionResolverTest.php index d07f89a792..be16d5b8ad 100644 --- a/tests/integration/Core/Repository/PermissionResolverTest.php +++ b/tests/integration/Core/Repository/PermissionResolverTest.php @@ -36,7 +36,7 @@ class PermissionResolverTest extends BaseTest * * @covers \Ibexa\Contracts\Core\Repository\PermissionResolver::getCurrentUserReference() */ - public function testGetCurrentUserReferenceReturnsAnonymousUserReference() + public function testGetCurrentUserReferenceReturnsAnonymousUserReference(): void { $repository = $this->getRepository(); $anonymousUserId = $this->generateId('user', 10); @@ -66,7 +66,7 @@ public function testGetCurrentUserReferenceReturnsAnonymousUserReference() * * @depends Ibexa\Tests\Integration\Core\Repository\RepositoryTest::testGetUserService */ - public function testSetCurrentUserReference() + public function testSetCurrentUserReference(): void { $repository = $this->getRepository(); $repository->getPermissionResolver()->setCurrentUserReference( @@ -109,7 +109,7 @@ public function testSetCurrentUserReference() * * @depends Ibexa\Tests\Integration\Core\Repository\RepositoryTest::testGetUserService */ - public function testHasAccessWithAnonymousUserNo() + public function testHasAccessWithAnonymousUserNo(): void { $repository = $this->getRepository(); @@ -141,7 +141,7 @@ public function testHasAccessWithAnonymousUserNo() * @depends Ibexa\Tests\Integration\Core\Repository\RepositoryTest::testGetUserService * @depends testHasAccessWithAnonymousUserNo */ - public function testHasAccessForCurrentUserNo() + public function testHasAccessForCurrentUserNo(): void { $repository = $this->getRepository(); @@ -175,7 +175,7 @@ public function testHasAccessForCurrentUserNo() * * @depends Ibexa\Tests\Integration\Core\Repository\RepositoryTest::testGetUserService */ - public function testHasAccessWithAdministratorUser() + public function testHasAccessWithAdministratorUser(): void { $repository = $this->getRepository(); @@ -206,7 +206,7 @@ public function testHasAccessWithAdministratorUser() * @depends testSetCurrentUserReference * @depends testHasAccessWithAdministratorUser */ - public function testHasAccessForCurrentUserYes() + public function testHasAccessForCurrentUserYes(): void { $repository = $this->getRepository(); @@ -239,7 +239,7 @@ public function testHasAccessForCurrentUserYes() * @depends Ibexa\Tests\Integration\Core\Repository\RepositoryTest::testGetUserService * @depends testSetCurrentUserReference */ - public function testHasAccessLimited() + public function testHasAccessLimited(): void { $repository = $this->getRepository(); @@ -271,7 +271,7 @@ public function testHasAccessLimited() * @depends Ibexa\Tests\Integration\Core\Repository\RepositoryTest::testGetContentService * @depends testHasAccessForCurrentUserNo */ - public function testCanUserForAnonymousUserNo() + public function testCanUserForAnonymousUserNo(): void { $this->expectException(UnauthorizedException::class); @@ -318,7 +318,7 @@ public function testCanUserForAnonymousUserNo() * @depends Ibexa\Tests\Integration\Core\Repository\RepositoryTest::testGetContentService * @depends testHasAccessForCurrentUserYes */ - public function testCanUserForAdministratorUser() + public function testCanUserForAdministratorUser(): void { $this->expectException(NotFoundException::class); @@ -364,7 +364,7 @@ public function testCanUserForAdministratorUser() * @depends Ibexa\Tests\Integration\Core\Repository\RepositoryTest::testGetContentService * @depends testHasAccessLimited */ - public function testCanUserWithLimitationYes() + public function testCanUserWithLimitationYes(): void { $repository = $this->getRepository(); @@ -401,7 +401,7 @@ public function testCanUserWithLimitationYes() * @depends Ibexa\Tests\Integration\Core\Repository\RepositoryTest::testGetContentService * @depends testHasAccessLimited */ - public function testCanUserWithLimitationNo() + public function testCanUserWithLimitationNo(): void { $this->expectException(UnauthorizedException::class); @@ -447,7 +447,7 @@ public function testCanUserWithLimitationNo() * @depends testSetCurrentUserReference * @depends testHasAccessLimited */ - public function testCanUserThrowsInvalidArgumentException() + public function testCanUserThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -487,7 +487,7 @@ public function testCanUserThrowsInvalidArgumentException() * @depends Ibexa\Tests\Integration\Core\Repository\RepositoryTest::testGetContentTypeService * @depends testHasAccessLimited */ - public function testCanUserWithTargetYes() + public function testCanUserWithTargetYes(): void { $repository = $this->getRepository(); @@ -549,7 +549,7 @@ public function testCanUserWithTargetYes() * @depends Ibexa\Tests\Integration\Core\Repository\RepositoryTest::testGetContentTypeService * @depends testHasAccessLimited */ - public function testCanUserWithTargetNo() + public function testCanUserWithTargetNo(): void { $this->expectException(UnauthorizedException::class); @@ -610,7 +610,7 @@ public function testCanUserWithTargetNo() * @depends Ibexa\Tests\Integration\Core\Repository\RepositoryTest::testGetContentTypeService * @depends testHasAccessLimited */ - public function testCanUserWithMultipleTargetsYes() + public function testCanUserWithMultipleTargetsYes(): void { $repository = $this->getRepository(); @@ -673,7 +673,7 @@ public function testCanUserWithMultipleTargetsYes() * @depends Ibexa\Tests\Integration\Core\Repository\RepositoryTest::testGetContentTypeService * @depends testHasAccessLimited */ - public function testCanUserWithMultipleTargetsNo() + public function testCanUserWithMultipleTargetsNo(): void { $this->expectException(UnauthorizedException::class); @@ -737,7 +737,7 @@ public function testCanUserWithMultipleTargetsNo() * @depends testSetCurrentUserReference * @depends testHasAccessLimited */ - public function testCanUserWithTargetThrowsInvalidArgumentException() + public function testCanUserWithTargetThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -780,7 +780,7 @@ public function testCanUserWithTargetThrowsInvalidArgumentException() * * @covers \Ibexa\Contracts\Core\Repository\PermissionResolver::canUser() */ - public function testCanUserThrowsBadStateException() + public function testCanUserThrowsBadStateException(): void { $this->expectException(BadStateException::class); @@ -808,12 +808,12 @@ public function testCanUserThrowsBadStateException() */ public function testCanUserWithLimitations( Limitation $limitation, - $module, - $function, + string $module, + string $function, ValueObject $object, array $targets, - $expectedResult - ) { + bool $expectedResult + ): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); $roleService = $repository->getRoleService(); @@ -847,7 +847,7 @@ public function testCanUserWithLimitations( * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function getDataForTestCanUserWithLimitations() + public function getDataForTestCanUserWithLimitations(): array { $repository = $this->getRepository(); $contentService = $repository->getContentService(); diff --git a/tests/integration/Core/Repository/Regression/EZP20018LanguageTest.php b/tests/integration/Core/Repository/Regression/EZP20018LanguageTest.php index 21c9d61d26..050325a6de 100644 --- a/tests/integration/Core/Repository/Regression/EZP20018LanguageTest.php +++ b/tests/integration/Core/Repository/Regression/EZP20018LanguageTest.php @@ -61,7 +61,7 @@ protected function setUp(): void /** * @covers \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LanguageCode */ - public function testSearchOnNotExistingLanguageGivesException() + public function testSearchOnNotExistingLanguageGivesException(): void { $this->expectException(NotFoundException::class); @@ -78,7 +78,7 @@ public function testSearchOnNotExistingLanguageGivesException() /** * @covers \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LanguageCode */ - public function testSearchOnUsedLanguageGivesOneResult() + public function testSearchOnUsedLanguageGivesOneResult(): void { $query = new Query(); $query->filter = new LanguageCode(['por-PT'], false); @@ -91,7 +91,7 @@ public function testSearchOnUsedLanguageGivesOneResult() /** * @covers \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LanguageCode */ - public function testSearchOnStandardLanguageGivesManyResult() + public function testSearchOnStandardLanguageGivesManyResult(): void { $query = new Query(); $query->filter = new LanguageCode(['eng-US'], false); @@ -105,7 +105,7 @@ public function testSearchOnStandardLanguageGivesManyResult() /** * @covers \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LanguageCode */ - public function testSearchOnNotUsedInstalledLanguageGivesNoResult() + public function testSearchOnNotUsedInstalledLanguageGivesNoResult(): void { $query = new Query(); $query->filter = new LanguageCode(['eng-GB'], false); diff --git a/tests/integration/Core/Repository/Regression/EZP20018ObjectStateTest.php b/tests/integration/Core/Repository/Regression/EZP20018ObjectStateTest.php index 91c5484303..cdb071191c 100644 --- a/tests/integration/Core/Repository/Regression/EZP20018ObjectStateTest.php +++ b/tests/integration/Core/Repository/Regression/EZP20018ObjectStateTest.php @@ -20,7 +20,7 @@ */ class EZP20018ObjectStateTest extends BaseTest { - public function testSearchForNonUsedObjectState() + public function testSearchForNonUsedObjectState(): void { $repository = $this->getRepository(); @@ -48,7 +48,7 @@ public function testSearchForNonUsedObjectState() self::assertCount($results2->totalCount, $results2->searchHits); } - public function testSearchForUsedObjectState() + public function testSearchForUsedObjectState(): void { $repository = $this->getRepository(); diff --git a/tests/integration/Core/Repository/Regression/EZP20018VisibilityTest.php b/tests/integration/Core/Repository/Regression/EZP20018VisibilityTest.php index 3ecc0e0c5a..c3c6d23633 100644 --- a/tests/integration/Core/Repository/Regression/EZP20018VisibilityTest.php +++ b/tests/integration/Core/Repository/Regression/EZP20018VisibilityTest.php @@ -20,7 +20,7 @@ */ class EZP20018VisibilityTest extends BaseTest { - public function testSearchForHiddenContent() + public function testSearchForHiddenContent(): void { $repository = $this->getRepository(); @@ -44,7 +44,7 @@ public function testSearchForHiddenContent() self::assertCount(1, $results2->searchHits); } - public function testSearchForVisibleContent() + public function testSearchForVisibleContent(): void { $repository = $this->getRepository(); diff --git a/tests/integration/Core/Repository/Regression/EZP21069Test.php b/tests/integration/Core/Repository/Regression/EZP21069Test.php index cafd165695..ea952df9e0 100644 --- a/tests/integration/Core/Repository/Regression/EZP21069Test.php +++ b/tests/integration/Core/Repository/Regression/EZP21069Test.php @@ -84,7 +84,7 @@ protected function setUp(): void $this->refreshSearch($repository); } - public function testSearchOnPreviousAttributeContentGivesNoResult() + public function testSearchOnPreviousAttributeContentGivesNoResult(): void { $query = new Query(); $query->filter = new Field('name', Operator::EQ, 'TheOriginalNews'); @@ -94,7 +94,7 @@ public function testSearchOnPreviousAttributeContentGivesNoResult() self::assertEmpty($results->searchHits); } - public function testSearchOnCurrentAttributeContentGivesOnesResult() + public function testSearchOnCurrentAttributeContentGivesOnesResult(): void { $query = new Query(); $query->filter = new Field('name', Operator::EQ, 'TheUpdatedNews'); @@ -104,7 +104,7 @@ public function testSearchOnCurrentAttributeContentGivesOnesResult() self::assertCount(1, $results->searchHits); } - public function testSearchOnDraftAttributeContentGivesNoResult() + public function testSearchOnDraftAttributeContentGivesNoResult(): void { $query = new Query(); $query->filter = new Field('name', Operator::EQ, 'TheDraftNews'); diff --git a/tests/integration/Core/Repository/Regression/EZP21089Test.php b/tests/integration/Core/Repository/Regression/EZP21089Test.php index 79249e3176..33b36544b2 100644 --- a/tests/integration/Core/Repository/Regression/EZP21089Test.php +++ b/tests/integration/Core/Repository/Regression/EZP21089Test.php @@ -8,6 +8,7 @@ namespace Ibexa\Tests\Integration\Core\Repository\Regression; use DateTime; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Tests\Integration\Core\Repository\BaseTest; /** @@ -23,7 +24,7 @@ class EZP21089Test extends BaseTest { /** @var \Ibexa\Core\Repository\Values\ContentType\ContentType */ - private $contentType; + private ContentType $contentType; protected function setUp(): void { @@ -107,7 +108,7 @@ protected function setUp(): void $this->contentType = $contentTypeService->loadContentType($type->id); } - public function testCreateContent() + public function testCreateContent(): void { $repository = $this->getRepository(); diff --git a/tests/integration/Core/Repository/Regression/EZP21109EzIntegerTest.php b/tests/integration/Core/Repository/Regression/EZP21109EzIntegerTest.php index eb1ca7deea..ce32c99ee2 100644 --- a/tests/integration/Core/Repository/Regression/EZP21109EzIntegerTest.php +++ b/tests/integration/Core/Repository/Regression/EZP21109EzIntegerTest.php @@ -48,7 +48,7 @@ protected function tearDown(): void * * @dataProvider validIntegerValues */ - public function testEzIntegerWithDefaultValues($integerValue) + public function testEzIntegerWithDefaultValues(int $integerValue): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -75,7 +75,7 @@ public function testEzIntegerWithDefaultValues($integerValue) $contentService->deleteContent($content->versionInfo->contentInfo); } - public function validIntegerValues() + public function validIntegerValues(): array { return [ [0], @@ -91,7 +91,7 @@ public function validIntegerValues() * * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ - protected function createTestContentType() + protected function createTestContentType(): ContentType { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); diff --git a/tests/integration/Core/Repository/Regression/EZP21771EzStringTest.php b/tests/integration/Core/Repository/Regression/EZP21771EzStringTest.php index 610a4902f7..1816569c20 100644 --- a/tests/integration/Core/Repository/Regression/EZP21771EzStringTest.php +++ b/tests/integration/Core/Repository/Regression/EZP21771EzStringTest.php @@ -22,7 +22,7 @@ class EZP21771EzStringTest extends BaseTest * It shouldn't throw a fatal error when inserting 11 consecutive digits * into an eZString field */ - public function test11NumbersOnEzString() + public function test11NumbersOnEzString(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); diff --git a/tests/integration/Core/Repository/Regression/EZP21798Test.php b/tests/integration/Core/Repository/Regression/EZP21798Test.php index 590a4f3a6a..1071438576 100644 --- a/tests/integration/Core/Repository/Regression/EZP21798Test.php +++ b/tests/integration/Core/Repository/Regression/EZP21798Test.php @@ -23,7 +23,7 @@ class EZP21798Test extends BaseTest * This test will verify that anonymous users can access to a new section * that it's allowed to */ - public function testRoleChanges() + public function testRoleChanges(): void { $repository = $this->getRepository(); $permissionResolver = $repository->getPermissionResolver(); diff --git a/tests/integration/Core/Repository/Regression/EZP21906SearchOneContentMultipleLocationsTest.php b/tests/integration/Core/Repository/Regression/EZP21906SearchOneContentMultipleLocationsTest.php index 0a78fad519..f59e5bc64b 100644 --- a/tests/integration/Core/Repository/Regression/EZP21906SearchOneContentMultipleLocationsTest.php +++ b/tests/integration/Core/Repository/Regression/EZP21906SearchOneContentMultipleLocationsTest.php @@ -64,14 +64,14 @@ protected function setUp(): void /** * @dataProvider searchContentQueryProvider */ - public function testSearchContentMultipleLocations(Query $query, $expectedResultCount) + public function testSearchContentMultipleLocations(Query $query, int $expectedResultCount): void { $result = $this->getRepository()->getSearchService()->findContent($query); self::assertSame($expectedResultCount, $result->totalCount); self::assertSame($expectedResultCount, count($result->searchHits)); } - public function searchContentQueryProvider() + public function searchContentQueryProvider(): array { return [ [ diff --git a/tests/integration/Core/Repository/Regression/EZP22408DeleteRelatedObjectTest.php b/tests/integration/Core/Repository/Regression/EZP22408DeleteRelatedObjectTest.php index c4db367886..0beb50a5cb 100644 --- a/tests/integration/Core/Repository/Regression/EZP22408DeleteRelatedObjectTest.php +++ b/tests/integration/Core/Repository/Regression/EZP22408DeleteRelatedObjectTest.php @@ -7,13 +7,15 @@ namespace Ibexa\Tests\Integration\Core\Repository\Regression; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; +use Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft; use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionCreateStruct; use Ibexa\Tests\Integration\Core\Repository\BaseTest; class EZP22408DeleteRelatedObjectTest extends BaseTest { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ - private $testContentType; + private ?ContentTypeDraft $testContentType = null; protected function setUp(): void { @@ -22,7 +24,7 @@ protected function setUp(): void $this->createTestContentType(); } - public function testRelationListIsUpdatedWhenRelatedObjectIsDeleted() + public function testRelationListIsUpdatedWhenRelatedObjectIsDeleted(): void { $targetObject1 = $this->createTargetObject('Relation list target object 1'); $targetObject2 = $this->createTargetObject('Relation list target object 2'); @@ -43,7 +45,7 @@ public function testRelationListIsUpdatedWhenRelatedObjectIsDeleted() self::assertSame([$targetObject2->id], $relationListValue->destinationContentIds); } - public function testSingleRelationIsUpdatedWhenRelatedObjectIsDeleted() + public function testSingleRelationIsUpdatedWhenRelatedObjectIsDeleted(): void { $targetObject = $this->createTargetObject('Single relation target object'); $referenceObject = $this->createReferenceObject( @@ -61,7 +63,7 @@ public function testSingleRelationIsUpdatedWhenRelatedObjectIsDeleted() self::assertEmpty($relationValue->destinationContentId); } - private function createTestContentType() + private function createTestContentType(): void { $languageCode = $this->getMainLanguageCode(); $contentTypeService = $this->getRepository()->getContentTypeService(); @@ -120,7 +122,7 @@ private function getMainLanguageCode(): string * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - private function createTargetObject($name) + private function createTargetObject(string $name): Content { $contentService = $this->getRepository()->getContentService(); $createStruct = $contentService->newContentCreateStruct( @@ -146,7 +148,7 @@ private function createTargetObject($name) * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - private function createReferenceObject($name, array $relationListTarget = [], $singleRelationTarget = null) + private function createReferenceObject(string $name, array $relationListTarget = [], $singleRelationTarget = null): Content { $contentService = $this->getRepository()->getContentService(); $createStruct = $contentService->newContentCreateStruct( @@ -176,7 +178,7 @@ private function createReferenceObject($name, array $relationListTarget = [], $s /** * @return \Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct */ - private function getLocationCreateStruct() + private function getLocationCreateStruct(): LocationCreateStruct { return $this->getRepository()->getLocationService()->newLocationCreateStruct(2); } diff --git a/tests/integration/Core/Repository/Regression/EZP22409RelationListTypeStateTest.php b/tests/integration/Core/Repository/Regression/EZP22409RelationListTypeStateTest.php index fba7847e34..55412168f9 100644 --- a/tests/integration/Core/Repository/Regression/EZP22409RelationListTypeStateTest.php +++ b/tests/integration/Core/Repository/Regression/EZP22409RelationListTypeStateTest.php @@ -100,12 +100,12 @@ protected function setUp(): void $contentTypeService->publishContentTypeDraft($type); } - public function testCreateObjectWithRelationToContentType() + public function testCreateObjectWithRelationToContentType(): void { $this->createContentWithRelationList(); } - public function testCreateObjectWithRelationToContentTypeWithExistingDraft() + public function testCreateObjectWithRelationToContentTypeWithExistingDraft(): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); @@ -120,7 +120,7 @@ public function testCreateObjectWithRelationToContentTypeWithExistingDraft() /** * Creates content #2 of type 'test-type' with a relation list to new content #1 of type 'folder'. */ - private function createContentWithRelationList() + private function createContentWithRelationList(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); diff --git a/tests/integration/Core/Repository/Regression/EZP22612URLAliasTranslations.php b/tests/integration/Core/Repository/Regression/EZP22612URLAliasTranslations.php index 80a7e74879..a9054f7721 100644 --- a/tests/integration/Core/Repository/Regression/EZP22612URLAliasTranslations.php +++ b/tests/integration/Core/Repository/Regression/EZP22612URLAliasTranslations.php @@ -35,7 +35,7 @@ protected function setUp(): void $contentService->publishVersion($draft->versionInfo); } - private function getFolderCreateStruct($name) + private function getFolderCreateStruct(string $name) { $createStruct = $this->getRepository()->getContentService()->newContentCreateStruct( $this->getRepository()->getContentTypeService()->loadContentTypeByIdentifier('folder'), @@ -50,7 +50,7 @@ private function getFolderCreateStruct($name) /** * Test that alias is found (ie. NotFoundException is not thrown). */ - public function testURLAliasLoadedInRightLanguage() + public function testURLAliasLoadedInRightLanguage(): void { $aliasService = $this->getRepository()->getURLAliasService(); $alias = $aliasService->lookup('common/alias'); diff --git a/tests/integration/Core/Repository/Regression/EZP22840RoleLimitations.php b/tests/integration/Core/Repository/Regression/EZP22840RoleLimitations.php index 4629a1e11f..4045618e0d 100644 --- a/tests/integration/Core/Repository/Regression/EZP22840RoleLimitations.php +++ b/tests/integration/Core/Repository/Regression/EZP22840RoleLimitations.php @@ -20,7 +20,7 @@ class EZP22840RoleLimitations extends BaseTest /** * Test Subtree Role Assignment Limitation against state/assign. */ - public function testSubtreeRoleAssignLimitation() + public function testSubtreeRoleAssignLimitation(): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); @@ -66,7 +66,7 @@ public function testSubtreeRoleAssignLimitation() /** * Test Section Role Assignment Limitation against user/login. */ - public function testSectionRoleAssignLimitation() + public function testSectionRoleAssignLimitation(): void { $repository = $this->getRepository(); $permissionResolver = $repository->getPermissionResolver(); diff --git a/tests/integration/Core/Repository/Regression/EZP22958SearchSubtreePathstringFormatTest.php b/tests/integration/Core/Repository/Regression/EZP22958SearchSubtreePathstringFormatTest.php index ff8da3162f..0d1aa05fa6 100644 --- a/tests/integration/Core/Repository/Regression/EZP22958SearchSubtreePathstringFormatTest.php +++ b/tests/integration/Core/Repository/Regression/EZP22958SearchSubtreePathstringFormatTest.php @@ -26,7 +26,7 @@ protected function setUp(): void * * @dataProvider searchContentQueryWithInvalidDataProvider */ - public function testSearchContentSubtreeShouldThrowException($pathString) + public function testSearchContentSubtreeShouldThrowException(string|array $pathString): void { $this->expectException(\InvalidArgumentException::class); @@ -44,7 +44,7 @@ public function testSearchContentSubtreeShouldThrowException($pathString) * * @dataProvider searchContentQueryProvider */ - public function testSearchContentSubtree($pathString) + public function testSearchContentSubtree(string|array $pathString): void { $query = new Query( [ @@ -55,7 +55,7 @@ public function testSearchContentSubtree($pathString) $result = $this->getRepository()->getSearchService()->findContent($query); } - public function searchContentQueryProvider() + public function searchContentQueryProvider(): array { return [ [ @@ -70,7 +70,7 @@ public function searchContentQueryProvider() ]; } - public function searchContentQueryWithInvalidDataProvider() + public function searchContentQueryWithInvalidDataProvider(): array { return [ [ diff --git a/tests/integration/Core/Repository/Regression/EZP26327UrlAliasHistorizationTest.php b/tests/integration/Core/Repository/Regression/EZP26327UrlAliasHistorizationTest.php index 0e65134c73..d7340b8a24 100644 --- a/tests/integration/Core/Repository/Regression/EZP26327UrlAliasHistorizationTest.php +++ b/tests/integration/Core/Repository/Regression/EZP26327UrlAliasHistorizationTest.php @@ -16,7 +16,7 @@ */ class EZP26327UrlAliasHistorizationTest extends BaseTest { - public function testHistorization() + public function testHistorization(): void { $contentService = $this->getRepository()->getContentService(); $contentTypeService = $this->getRepository()->getContentTypeService(); diff --git a/tests/integration/Core/Repository/Regression/EZP26367UrlAliasHistoryRedirectLoopTest.php b/tests/integration/Core/Repository/Regression/EZP26367UrlAliasHistoryRedirectLoopTest.php index 79a7b9cf0c..881351e616 100644 --- a/tests/integration/Core/Repository/Regression/EZP26367UrlAliasHistoryRedirectLoopTest.php +++ b/tests/integration/Core/Repository/Regression/EZP26367UrlAliasHistoryRedirectLoopTest.php @@ -20,7 +20,7 @@ */ class EZP26367UrlAliasHistoryRedirectLoopTest extends BaseTest { - public function testReverseLookupReturnsHistoryAlias() + public function testReverseLookupReturnsHistoryAlias(): void { $contentService = $this->getRepository()->getContentService(); $contentTypeService = $this->getRepository()->getContentTypeService(); @@ -88,7 +88,7 @@ public function testReverseLookupReturnsHistoryAlias() self::assertFalse($urlAlias->isHistory); } - public function testLookupHistoryUrlReturnsActiveAlias() + public function testLookupHistoryUrlReturnsActiveAlias(): void { $contentService = $this->getRepository()->getContentService(); $contentTypeService = $this->getRepository()->getContentTypeService(); diff --git a/tests/integration/Core/Repository/Regression/EZP26551DeleteContentTypeDraftTest.php b/tests/integration/Core/Repository/Regression/EZP26551DeleteContentTypeDraftTest.php index 275380d794..5543ee7e13 100644 --- a/tests/integration/Core/Repository/Regression/EZP26551DeleteContentTypeDraftTest.php +++ b/tests/integration/Core/Repository/Regression/EZP26551DeleteContentTypeDraftTest.php @@ -18,7 +18,7 @@ */ class EZP26551DeleteContentTypeDraftTest extends BaseTest { - public function testDeleteContentTypeGroup() + public function testDeleteContentTypeGroup(): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); diff --git a/tests/integration/Core/Repository/Regression/EZP28799SubtreeSearchTest.php b/tests/integration/Core/Repository/Regression/EZP28799SubtreeSearchTest.php index 7f46a1c5c2..0c64f53f7d 100644 --- a/tests/integration/Core/Repository/Regression/EZP28799SubtreeSearchTest.php +++ b/tests/integration/Core/Repository/Regression/EZP28799SubtreeSearchTest.php @@ -18,7 +18,7 @@ class EZP28799SubtreeSearchTest extends BaseTest /** * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content[] */ - public function createTestContent() + public function createTestContent(): array { $rootLocationId = 2; $contentService = $this->getRepository()->getContentService(); @@ -61,7 +61,7 @@ public function createTestContent() return [$leftFolder, $rightFolder, $targetFolder]; } - public function testConflictingConditions() + public function testConflictingConditions(): void { list($leftFolder, $rightFolder, $targetFolder) = $this->createTestContent(); $locationService = $this->getRepository()->getLocationService(); @@ -83,7 +83,7 @@ public function testConflictingConditions() self::assertSame(0, $result->totalCount); } - public function testNegativeSubtree() + public function testNegativeSubtree(): void { list($leftFolder, $rightFolder, $targetFolder) = $this->createTestContent(); $locationService = $this->getRepository()->getLocationService(); diff --git a/tests/integration/Core/Repository/Regression/EnvTest.php b/tests/integration/Core/Repository/Regression/EnvTest.php index 9296c9eed8..c47c86993a 100644 --- a/tests/integration/Core/Repository/Regression/EnvTest.php +++ b/tests/integration/Core/Repository/Regression/EnvTest.php @@ -21,7 +21,7 @@ class EnvTest extends BaseTest /** * Verify Redis cache is setup if asked for, if not file system. */ - public function testVerifyCacheDriver() + public function testVerifyCacheDriver(): void { $pool = $this->getSetupFactory()->getServiceContainer()->get('ibexa.cache_pool'); diff --git a/tests/integration/Core/Repository/Regression/PureNegativeQueryTest.php b/tests/integration/Core/Repository/Regression/PureNegativeQueryTest.php index b5002bb318..637416c3d6 100644 --- a/tests/integration/Core/Repository/Regression/PureNegativeQueryTest.php +++ b/tests/integration/Core/Repository/Regression/PureNegativeQueryTest.php @@ -10,6 +10,8 @@ use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalOr; use Ibexa\Tests\Integration\Core\Repository\BaseTest; /** @@ -20,7 +22,7 @@ */ class PureNegativeQueryTest extends BaseTest { - public function providerForTestMatchAll() + public function providerForTestMatchAll(): array { $query = new Query(['filter' => new Criterion\MatchAll()]); $result = $this->getRepository()->getSearchService()->findContent($query); @@ -31,7 +33,7 @@ public function providerForTestMatchAll() return [ [ - new Criterion\LogicalOr( + new LogicalOr( [ new Criterion\ContentId($contentId), new Criterion\MatchNone(), @@ -40,7 +42,7 @@ public function providerForTestMatchAll() 1, ], [ - new Criterion\LogicalAnd( + new LogicalAnd( [ new Criterion\ContentId($contentId), new Criterion\MatchNone(), @@ -49,7 +51,7 @@ public function providerForTestMatchAll() 0, ], [ - new Criterion\LogicalOr( + new LogicalOr( [ new Criterion\ContentId($contentId), new Criterion\LogicalNot( @@ -60,7 +62,7 @@ public function providerForTestMatchAll() 1, ], [ - new Criterion\LogicalAnd( + new LogicalAnd( [ new Criterion\ContentId($contentId), new Criterion\LogicalNot( @@ -71,7 +73,7 @@ public function providerForTestMatchAll() 0, ], [ - new Criterion\LogicalOr( + new LogicalOr( [ new Criterion\ContentId($contentId), new Criterion\MatchAll(), @@ -80,7 +82,7 @@ public function providerForTestMatchAll() $totalCount, ], [ - new Criterion\LogicalAnd( + new LogicalAnd( [ new Criterion\ContentId($contentId), new Criterion\MatchAll(), @@ -89,7 +91,7 @@ public function providerForTestMatchAll() 1, ], [ - new Criterion\LogicalOr( + new LogicalOr( [ new Criterion\MatchAll(), new Criterion\MatchNone(), @@ -98,7 +100,7 @@ public function providerForTestMatchAll() $totalCount, ], [ - new Criterion\LogicalAnd( + new LogicalAnd( [ new Criterion\MatchAll(), new Criterion\MatchNone(), @@ -107,7 +109,7 @@ public function providerForTestMatchAll() 0, ], [ - new Criterion\LogicalOr( + new LogicalOr( [ new Criterion\ContentId($contentId), new Criterion\LogicalNot( @@ -118,7 +120,7 @@ public function providerForTestMatchAll() $totalCount, ], [ - new Criterion\LogicalOr( + new LogicalOr( [ new Criterion\ContentId($contentId), new Criterion\LogicalNot( @@ -131,7 +133,7 @@ public function providerForTestMatchAll() 1, ], [ - new Criterion\LogicalOr( + new LogicalOr( [ new Criterion\LogicalNot( new Criterion\ContentId($contentId) @@ -146,7 +148,7 @@ public function providerForTestMatchAll() $totalCount, ], [ - new Criterion\LogicalOr( + new LogicalOr( [ new Criterion\LogicalNot( new Criterion\ContentId($contentId) @@ -159,7 +161,7 @@ public function providerForTestMatchAll() $totalCount - 1, ], [ - new Criterion\LogicalAnd( + new LogicalAnd( [ new Criterion\ContentId($contentId), new Criterion\LogicalNot( @@ -170,7 +172,7 @@ public function providerForTestMatchAll() 0, ], [ - new Criterion\LogicalAnd( + new LogicalAnd( [ new Criterion\ContentId($contentId), new Criterion\LogicalNot( @@ -183,7 +185,7 @@ public function providerForTestMatchAll() 1, ], [ - new Criterion\LogicalAnd( + new LogicalAnd( [ new Criterion\LogicalNot( new Criterion\ContentId($contentId) @@ -198,7 +200,7 @@ public function providerForTestMatchAll() 0, ], [ - new Criterion\LogicalAnd( + new LogicalAnd( [ new Criterion\LogicalNot( new Criterion\ContentId($contentId) @@ -219,7 +221,7 @@ public function providerForTestMatchAll() * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion * @param int $totalCount */ - public function testMatchAllContentInfoQuery($criterion, $totalCount) + public function testMatchAllContentInfoQuery(LogicalOr|LogicalAnd $criterion, ?int $totalCount): void { $query = new Query( [ @@ -238,7 +240,7 @@ public function testMatchAllContentInfoQuery($criterion, $totalCount) * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion * @param int $totalCount */ - public function testMatchAllContentInfoFilter($criterion, $totalCount) + public function testMatchAllContentInfoFilter(LogicalOr|LogicalAnd $criterion, ?int $totalCount): void { $query = new Query( [ @@ -257,7 +259,7 @@ public function testMatchAllContentInfoFilter($criterion, $totalCount) * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion * @param int $totalCount */ - public function testMatchAllLocationQuery($criterion, $totalCount) + public function testMatchAllLocationQuery(LogicalOr|LogicalAnd $criterion, ?int $totalCount): void { $query = new LocationQuery( [ @@ -276,7 +278,7 @@ public function testMatchAllLocationQuery($criterion, $totalCount) * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterion * @param int $totalCount */ - public function testMatchAllLocationFilter($criterion, $totalCount) + public function testMatchAllLocationFilter(LogicalOr|LogicalAnd $criterion, ?int $totalCount): void { $query = new LocationQuery( [ diff --git a/tests/integration/Core/Repository/RepositoryTest.php b/tests/integration/Core/Repository/RepositoryTest.php index 8784b2fdea..87a770bd72 100644 --- a/tests/integration/Core/Repository/RepositoryTest.php +++ b/tests/integration/Core/Repository/RepositoryTest.php @@ -37,7 +37,7 @@ class RepositoryTest extends BaseTest /** * Test for the getRepository() method. */ - public function testGetRepository() + public function testGetRepository(): void { self::assertInstanceOf(Repository::class, $this->getSetupFactory()->getRepository(true)); } @@ -48,7 +48,7 @@ public function testGetRepository() * @group content * @group user */ - public function testGetContentService() + public function testGetContentService(): void { $repository = $this->getRepository(); self::assertInstanceOf( @@ -64,7 +64,7 @@ public function testGetContentService() * * @covers \Ibexa\Contracts\Core\Repository\Repository::getContentLanguageService() */ - public function testGetContentLanguageService() + public function testGetContentLanguageService(): void { $repository = $this->getRepository(); self::assertInstanceOf( @@ -80,7 +80,7 @@ public function testGetContentLanguageService() * @group field-type * @group user */ - public function testGetContentTypeService() + public function testGetContentTypeService(): void { $repository = $this->getRepository(); self::assertInstanceOf( @@ -94,7 +94,7 @@ public function testGetContentTypeService() * * @group location */ - public function testGetLocationService() + public function testGetLocationService(): void { $repository = $this->getRepository(); self::assertInstanceOf( @@ -108,7 +108,7 @@ public function testGetLocationService() * * @group section */ - public function testGetSectionService() + public function testGetSectionService(): void { $repository = $this->getRepository(); self::assertInstanceOf( @@ -122,7 +122,7 @@ public function testGetSectionService() * * @group user */ - public function testGetUserService() + public function testGetUserService(): void { $repository = $this->getRepository(); self::assertInstanceOf( @@ -136,7 +136,7 @@ public function testGetUserService() * * @group user */ - public function testGetNotificationService() + public function testGetNotificationService(): void { $repository = $this->getRepository(); self::assertInstanceOf( @@ -150,7 +150,7 @@ public function testGetNotificationService() * * @group trash */ - public function testGetTrashService() + public function testGetTrashService(): void { $repository = $this->getRepository(); self::assertInstanceOf( @@ -164,7 +164,7 @@ public function testGetTrashService() * * @group role */ - public function testGetRoleService() + public function testGetRoleService(): void { $repository = $this->getRepository(); self::assertInstanceOf( @@ -178,7 +178,7 @@ public function testGetRoleService() * * @group url-alias */ - public function testGetURLAliasService() + public function testGetURLAliasService(): void { $repository = $this->getRepository(); self::assertInstanceOf( @@ -192,7 +192,7 @@ public function testGetURLAliasService() * * @group url-wildcard */ - public function testGetURLWildcardService() + public function testGetURLWildcardService(): void { $repository = $this->getRepository(); self::assertInstanceOf( @@ -206,7 +206,7 @@ public function testGetURLWildcardService() * * @group object-state */ - public function testGetObjectStateService() + public function testGetObjectStateService(): void { $repository = $this->getRepository(); self::assertInstanceOf( @@ -220,7 +220,7 @@ public function testGetObjectStateService() * * @group object-state */ - public function testGetFieldTypeService() + public function testGetFieldTypeService(): void { $repository = $this->getRepository(); self::assertInstanceOf( @@ -234,7 +234,7 @@ public function testGetFieldTypeService() * * @group search */ - public function testGetSearchService() + public function testGetSearchService(): void { $repository = $this->getRepository(); @@ -249,7 +249,7 @@ public function testGetSearchService() * * @group permission */ - public function testGetPermissionResolver() + public function testGetPermissionResolver(): void { $repository = $this->getRepository(); @@ -262,7 +262,7 @@ public function testGetPermissionResolver() /** * Test for the commit() method. */ - public function testCommit() + public function testCommit(): void { $repository = $this->getRepository(); @@ -279,7 +279,7 @@ public function testCommit() /** * Test for the commit() method. */ - public function testCommitThrowsRuntimeException() + public function testCommitThrowsRuntimeException(): void { $this->expectException(\RuntimeException::class); @@ -290,7 +290,7 @@ public function testCommitThrowsRuntimeException() /** * Test for the rollback() method. */ - public function testRollback() + public function testRollback(): void { $repository = $this->getRepository(); $repository->beginTransaction(); @@ -300,7 +300,7 @@ public function testRollback() /** * Test for the rollback() method. */ - public function testRollbackThrowsRuntimeException() + public function testRollbackThrowsRuntimeException(): void { $this->expectException(\RuntimeException::class); diff --git a/tests/integration/Core/Repository/RoleServiceAuthorizationTest.php b/tests/integration/Core/Repository/RoleServiceAuthorizationTest.php index 11a30eeaae..68cb2b6c62 100644 --- a/tests/integration/Core/Repository/RoleServiceAuthorizationTest.php +++ b/tests/integration/Core/Repository/RoleServiceAuthorizationTest.php @@ -30,7 +30,7 @@ class RoleServiceAuthorizationTest extends BaseTest * @depends Ibexa\Tests\Integration\Core\Repository\RoleServiceTest::testCreateRole * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUser */ - public function testCreateRoleThrowsUnauthorizedException() + public function testCreateRoleThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -62,7 +62,7 @@ public function testCreateRoleThrowsUnauthorizedException() * @depends Ibexa\Tests\Integration\Core\Repository\RoleServiceTest::testLoadRole * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUser */ - public function testLoadRoleThrowsUnauthorizedException() + public function testLoadRoleThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -91,7 +91,7 @@ public function testLoadRoleThrowsUnauthorizedException() * @depends Ibexa\Tests\Integration\Core\Repository\RoleServiceTest::testLoadRoleByIdentifier * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUser */ - public function testLoadRoleByIdentifierThrowsUnauthorizedException() + public function testLoadRoleByIdentifierThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -117,7 +117,7 @@ public function testLoadRoleByIdentifierThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\RoleService::loadRoles() */ - public function testLoadRolesLoadsEmptyListForAnonymousUser() + public function testLoadRolesLoadsEmptyListForAnonymousUser(): void { $repository = $this->getRepository(); $permissionResolver = $repository->getPermissionResolver(); @@ -140,7 +140,7 @@ public function testLoadRolesLoadsEmptyListForAnonymousUser() * * @covers \Ibexa\Contracts\Core\Repository\RoleService::loadRoles() */ - public function testLoadRolesForUserWithSubtreeLimitation() + public function testLoadRolesForUserWithSubtreeLimitation(): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); @@ -173,7 +173,7 @@ public function testLoadRolesForUserWithSubtreeLimitation() * @depends Ibexa\Tests\Integration\Core\Repository\RoleServiceTest::testDeleteRole * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUser */ - public function testDeleteRoleThrowsUnauthorizedException() + public function testDeleteRoleThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -202,7 +202,7 @@ public function testDeleteRoleThrowsUnauthorizedException() * @depends Ibexa\Tests\Integration\Core\Repository\RoleServiceTest::testUpdatePolicyByRoleDraft * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUser */ - public function testUpdatePolicyByRoleDraftThrowsUnauthorizedException() + public function testUpdatePolicyByRoleDraftThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -250,7 +250,7 @@ public function testUpdatePolicyByRoleDraftThrowsUnauthorizedException() * @depends Ibexa\Tests\Integration\Core\Repository\RoleServiceTest::testRemovePolicyByRoleDraft * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUser */ - public function testRemovePolicyThrowsUnauthorizedException() + public function testRemovePolicyThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -295,7 +295,7 @@ public function testRemovePolicyThrowsUnauthorizedException() * @depends Ibexa\Tests\Integration\Core\Repository\RoleServiceTest::testRemovePolicyByRoleDraft * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUser */ - public function testDeletePolicyThrowsUnauthorizedException() + public function testDeletePolicyThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -329,7 +329,7 @@ public function testDeletePolicyThrowsUnauthorizedException() * @depends Ibexa\Tests\Integration\Core\Repository\RoleServiceTest::testAssignRoleToUserGroup * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUser */ - public function testAssignRoleToUserGroupThrowsUnauthorizedException() + public function testAssignRoleToUserGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -364,7 +364,7 @@ public function testAssignRoleToUserGroupThrowsUnauthorizedException() * @depends Ibexa\Tests\Integration\Core\Repository\RoleServiceTest::testAssignRoleToUserGroup * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUser */ - public function testAssignRoleToUserGroupThrowsUnauthorizedExceptionWithRoleLimitationParameter() + public function testAssignRoleToUserGroupThrowsUnauthorizedExceptionWithRoleLimitationParameter(): void { $this->expectException(UnauthorizedException::class); @@ -406,7 +406,7 @@ public function testAssignRoleToUserGroupThrowsUnauthorizedExceptionWithRoleLimi * @depends Ibexa\Tests\Integration\Core\Repository\RoleServiceTest::testRemoveRoleAssignmentFromUserGroup * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUser */ - public function testRemoveRoleAssignmentFromUserGroupThrowsUnauthorizedException() + public function testRemoveRoleAssignmentFromUserGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -450,7 +450,7 @@ public function testRemoveRoleAssignmentFromUserGroupThrowsUnauthorizedException * @depends Ibexa\Tests\Integration\Core\Repository\RoleServiceTest::testAssignRoleToUser * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUser */ - public function testAssignRoleToUserThrowsUnauthorizedException() + public function testAssignRoleToUserThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -479,7 +479,7 @@ public function testAssignRoleToUserThrowsUnauthorizedException() * @depends Ibexa\Tests\Integration\Core\Repository\RoleServiceTest::testAssignRoleToUser * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUser */ - public function testAssignRoleToUserThrowsUnauthorizedExceptionWithRoleLimitationParameter() + public function testAssignRoleToUserThrowsUnauthorizedExceptionWithRoleLimitationParameter(): void { $this->expectException(UnauthorizedException::class); @@ -515,7 +515,7 @@ public function testAssignRoleToUserThrowsUnauthorizedExceptionWithRoleLimitatio * @depends Ibexa\Tests\Integration\Core\Repository\RoleServiceTest::testRemoveRoleAssignment * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUser */ - public function testRemoveRoleAssignmentThrowsUnauthorizedException() + public function testRemoveRoleAssignmentThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -552,7 +552,7 @@ public function testRemoveRoleAssignmentThrowsUnauthorizedException() * @depends Ibexa\Tests\Integration\Core\Repository\RoleServiceTest::testGetRoleAssignments * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUser */ - public function testGetRoleAssignmentsThrowsUnauthorizedException() + public function testGetRoleAssignmentsThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -578,7 +578,7 @@ public function testGetRoleAssignmentsThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\RoleService::getRoleAssignmentsForUser() */ - public function testGetRoleAssignmentsForUserLoadsEmptyListForAnonymousUser() + public function testGetRoleAssignmentsForUserLoadsEmptyListForAnonymousUser(): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); @@ -600,7 +600,7 @@ public function testGetRoleAssignmentsForUserLoadsEmptyListForAnonymousUser() * * @covers \Ibexa\Contracts\Core\Repository\RoleService::getRoleAssignmentsForUser() */ - public function testGetRoleAssignmentsForUserWithSubtreeLimitation() + public function testGetRoleAssignmentsForUserWithSubtreeLimitation(): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); @@ -633,7 +633,7 @@ public function testGetRoleAssignmentsForUserWithSubtreeLimitation() * @depends Ibexa\Tests\Integration\Core\Repository\RoleServiceTest::testGetRoleAssignmentsForUserGroup * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUser */ - public function testGetRoleAssignmentsForUserGroupThrowsUnauthorizedException() + public function testGetRoleAssignmentsForUserGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/RoleServiceTest.php b/tests/integration/Core/Repository/RoleServiceTest.php index d37e910cb8..a878a5f321 100644 --- a/tests/integration/Core/Repository/RoleServiceTest.php +++ b/tests/integration/Core/Repository/RoleServiceTest.php @@ -59,7 +59,7 @@ class RoleServiceTest extends BaseTest * * @covers \Ibexa\Contracts\Core\Repository\RoleService::newRoleCreateStruct() */ - public function testNewRoleCreateStruct() + public function testNewRoleCreateStruct(): void { $repository = $this->getRepository(); @@ -90,7 +90,7 @@ public function testNewRoleCopyStruct(): void * * @depends testNewRoleCreateStruct */ - public function testNewRoleCreateStructSetsNamePropertyOnStruct() + public function testNewRoleCreateStructSetsNamePropertyOnStruct(): void { $repository = $this->getRepository(); @@ -111,7 +111,7 @@ public function testNewRoleCreateStructSetsNamePropertyOnStruct() * * @depends testNewRoleCreateStruct */ - public function testCreateRole() + public function testCreateRole(): array { $repository = $this->getRepository(); @@ -145,7 +145,7 @@ public function testCreateRole() * * @depends testCreateRole */ - public function testRoleCreateStructValues(array $data) + public function testRoleCreateStructValues(array $data): array { $createStruct = $data['createStruct']; $role = $data['role']; @@ -172,7 +172,7 @@ public function testRoleCreateStructValues(array $data) * * @depends testNewRoleCreateStruct */ - public function testCreateRoleWithPolicy() + public function testCreateRoleWithPolicy(): array { $repository = $this->getRepository(); @@ -220,7 +220,7 @@ public function testCreateRoleWithPolicy() * * @depends testCreateRoleWithPolicy */ - public function testRoleCreateStructValuesWithPolicy(array $data) + public function testRoleCreateStructValuesWithPolicy(array $data): array { $createStruct = $data['createStruct']; $role = $data['role']; @@ -249,15 +249,15 @@ public function testRoleCreateStructValuesWithPolicy(array $data) * * @covers \Ibexa\Contracts\Core\Repository\RoleService::createRole */ - public function testCreateRoleWithMultiplePolicies() + public function testCreateRoleWithMultiplePolicies(): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); - $limitation1 = new Limitation\ContentTypeLimitation(); + $limitation1 = new ContentTypeLimitation(); $limitation1->limitationValues = ['1', '3', '13']; - $limitation2 = new Limitation\SectionLimitation(); + $limitation2 = new SectionLimitation(); $limitation2->limitationValues = ['2', '3']; $limitation3 = new Limitation\OwnerLimitation(); @@ -342,7 +342,7 @@ public function testCreateRoleWithMultiplePolicies() * * @depends testNewRoleCreateStruct */ - public function testCreateRoleDraft() + public function testCreateRoleDraft(): void { $repository = $this->getRepository(); @@ -374,7 +374,7 @@ public function testCreateRoleDraft() * * @depends testCreateRole */ - public function testCreateRoleThrowsInvalidArgumentException() + public function testCreateRoleThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -401,7 +401,7 @@ public function testCreateRoleThrowsInvalidArgumentException() * * @depends testCreateRoleDraft */ - public function testCreateRoleDraftThrowsInvalidArgumentException() + public function testCreateRoleDraftThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -431,7 +431,7 @@ public function testCreateRoleDraftThrowsInvalidArgumentException() * * @covers \Ibexa\Contracts\Core\Repository\RoleService::createRole() */ - public function testCreateRoleThrowsLimitationValidationException() + public function testCreateRoleThrowsLimitationValidationException(): void { $this->expectException(LimitationValidationException::class); @@ -473,7 +473,7 @@ public function testCreateRoleThrowsLimitationValidationException() * * @depends testNewRoleCreateStruct */ - public function testCreateRoleInTransactionWithRollback() + public function testCreateRoleInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -510,7 +510,7 @@ public function testCreateRoleInTransactionWithRollback() * * @depends testNewRoleCreateStruct */ - public function testCreateRoleDraftInTransactionWithRollback() + public function testCreateRoleDraftInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -723,7 +723,7 @@ public function testCopyRoleWithPoliciesAndLimitations( * * @depends testCreateRole */ - public function testLoadRole() + public function testLoadRole(): void { $repository = $this->getRepository(); @@ -751,7 +751,7 @@ public function testLoadRole() * * @depends testCreateRoleDraft */ - public function testLoadRoleDraft() + public function testLoadRoleDraft(): void { $repository = $this->getRepository(); @@ -773,7 +773,7 @@ public function testLoadRoleDraft() self::assertEquals('roleName', $role->identifier); } - public function testLoadRoleDraftByRoleId() + public function testLoadRoleDraftByRoleId(): void { $repository = $this->getRepository(); @@ -806,7 +806,7 @@ public function testLoadRoleDraftByRoleId() * * @depends testLoadRole */ - public function testLoadRoleThrowsNotFoundException() + public function testLoadRoleThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -830,7 +830,7 @@ public function testLoadRoleThrowsNotFoundException() * * @depends testLoadRoleDraft */ - public function testLoadRoleDraftThrowsNotFoundException() + public function testLoadRoleDraftThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -847,7 +847,7 @@ public function testLoadRoleDraftThrowsNotFoundException() /* END: Use Case */ } - public function testLoadRoleDraftByRoleIdThrowsNotFoundException() + public function testLoadRoleDraftByRoleIdThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -871,7 +871,7 @@ public function testLoadRoleDraftByRoleIdThrowsNotFoundException() * * @depends testCreateRole */ - public function testLoadRoleByIdentifier() + public function testLoadRoleByIdentifier(): void { $repository = $this->getRepository(); @@ -901,7 +901,7 @@ public function testLoadRoleByIdentifier() * * @depends testLoadRoleByIdentifier */ - public function testLoadRoleByIdentifierThrowsNotFoundException() + public function testLoadRoleByIdentifierThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -924,7 +924,7 @@ public function testLoadRoleByIdentifierThrowsNotFoundException() * * @depends testCreateRole */ - public function testLoadRoles() + public function testLoadRoles(): void { $repository = $this->getRepository(); @@ -961,7 +961,7 @@ public function testLoadRoles() * * @depends testLoadRoles */ - public function testLoadRolesReturnsExpectedSetOfDefaultRoles() + public function testLoadRolesReturnsExpectedSetOfDefaultRoles(): void { $repository = $this->getRepository(); @@ -993,7 +993,7 @@ public function testLoadRolesReturnsExpectedSetOfDefaultRoles() * * @covers \Ibexa\Contracts\Core\Repository\RoleService::newRoleUpdateStruct() */ - public function testNewRoleUpdateStruct() + public function testNewRoleUpdateStruct(): void { $repository = $this->getRepository(); @@ -1013,7 +1013,7 @@ public function testNewRoleUpdateStruct() * @depends testNewRoleUpdateStruct * @depends testLoadRoleDraft */ - public function testUpdateRoleDraft() + public function testUpdateRoleDraft(): void { $repository = $this->getRepository(); @@ -1045,7 +1045,7 @@ public function testUpdateRoleDraft() * * @depends testUpdateRoleDraft */ - public function testUpdateRoleDraftThrowsInvalidArgumentException() + public function testUpdateRoleDraftThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -1076,7 +1076,7 @@ public function testUpdateRoleDraftThrowsInvalidArgumentException() * @depends testCreateRole * @depends testLoadRoles */ - public function testDeleteRole() + public function testDeleteRole(): void { $repository = $this->getRepository(); @@ -1104,7 +1104,7 @@ public function testDeleteRole() * * @depends testLoadRoleDraft */ - public function testDeleteRoleDraft() + public function testDeleteRoleDraft(): void { $this->expectException(NotFoundException::class); @@ -1131,7 +1131,7 @@ public function testDeleteRoleDraft() * * @covers \Ibexa\Contracts\Core\Repository\RoleService::newPolicyCreateStruct() */ - public function testNewPolicyCreateStruct() + public function testNewPolicyCreateStruct(): void { $repository = $this->getRepository(); @@ -1150,7 +1150,7 @@ public function testNewPolicyCreateStruct() * * @depends testNewPolicyCreateStruct */ - public function testNewPolicyCreateStructSetsStructProperties() + public function testNewPolicyCreateStructSetsStructProperties(): void { $repository = $this->getRepository(); @@ -1173,7 +1173,7 @@ public function testNewPolicyCreateStructSetsStructProperties() * @depends testCreateRoleDraft * @depends testNewPolicyCreateStruct */ - public function testAddPolicyByRoleDraft() + public function testAddPolicyByRoleDraft(): void { $repository = $this->getRepository(); @@ -1206,7 +1206,7 @@ public function testAddPolicyByRoleDraft() } usort( $actual, - static function ($p1, $p2): int { + static function (array $p1, array $p2): int { return strcasecmp($p1['function'], $p2['function']); } ); @@ -1235,7 +1235,7 @@ static function ($p1, $p2): int { * * @depends testAddPolicyByRoleDraft */ - public function testAddPolicyByRoleDraftUpdatesRole() + public function testAddPolicyByRoleDraftUpdatesRole(): array { $repository = $this->getRepository(); @@ -1277,7 +1277,7 @@ public function testAddPolicyByRoleDraftUpdatesRole() * * @depends testAddPolicyByRoleDraftUpdatesRole */ - public function testAddPolicyByRoleDraftSetsPolicyProperties($roleAndPolicy) + public function testAddPolicyByRoleDraftSetsPolicyProperties($roleAndPolicy): void { list($role, $policy) = $roleAndPolicy; @@ -1295,7 +1295,7 @@ public function testAddPolicyByRoleDraftSetsPolicyProperties($roleAndPolicy) * @depends testNewPolicyCreateStruct * @depends testCreateRoleDraft */ - public function testAddPolicyByRoleDraftThrowsLimitationValidationException() + public function testAddPolicyByRoleDraftThrowsLimitationValidationException(): void { $this->expectException(LimitationValidationException::class); @@ -1335,7 +1335,7 @@ public function testAddPolicyByRoleDraftThrowsLimitationValidationException() * * @depends testAddPolicyByRoleDraftUpdatesRole */ - public function testCreateRoleWithAddPolicy() + public function testCreateRoleWithAddPolicy(): void { $repository = $this->getRepository(); @@ -1396,7 +1396,7 @@ public function testCreateRoleWithAddPolicy() * * @depends testAddPolicyByRoleDraftUpdatesRole */ - public function testCreateRoleDraftWithAddPolicy() + public function testCreateRoleDraftWithAddPolicy(): void { $repository = $this->getRepository(); @@ -1452,7 +1452,7 @@ public function testCreateRoleDraftWithAddPolicy() * * @covers \Ibexa\Contracts\Core\Repository\RoleService::newPolicyUpdateStruct() */ - public function testNewPolicyUpdateStruct() + public function testNewPolicyUpdateStruct(): void { $repository = $this->getRepository(); @@ -1467,7 +1467,7 @@ public function testNewPolicyUpdateStruct() ); } - public function testUpdatePolicyByRoleDraftNoLimitation() + public function testUpdatePolicyByRoleDraftNoLimitation(): void { $repository = $this->getRepository(); @@ -1529,7 +1529,7 @@ public function testUpdatePolicyByRoleDraftNoLimitation() * @depends testAddPolicyByRoleDraft * @depends testNewPolicyUpdateStruct */ - public function testUpdatePolicyByRoleDraft() + public function testUpdatePolicyByRoleDraft(): array { $repository = $this->getRepository(); @@ -1633,7 +1633,7 @@ public function testUpdatePolicyUpdatesLimitations($roleAndPolicy) * * @depends testUpdatePolicyUpdatesLimitations */ - public function testUpdatePolicyUpdatesRole($role) + public function testUpdatePolicyUpdatesRole($role): void { $limitations = []; foreach ($role->getPolicies() as $policy) { @@ -1668,7 +1668,7 @@ public function testUpdatePolicyUpdatesRole($role) * @depends testNewRoleCreateStruct * @depends testCreateRole */ - public function testUpdatePolicyByRoleDraftThrowsLimitationValidationException() + public function testUpdatePolicyByRoleDraftThrowsLimitationValidationException(): void { $this->expectException(LimitationValidationException::class); @@ -1738,7 +1738,7 @@ public function testUpdatePolicyByRoleDraftThrowsLimitationValidationException() * * @depends testAddPolicyByRoleDraft */ - public function testRemovePolicyByRoleDraft() + public function testRemovePolicyByRoleDraft(): void { $repository = $this->getRepository(); @@ -1776,7 +1776,7 @@ public function testRemovePolicyByRoleDraft() * * @covers \Ibexa\Contracts\Core\Repository\RoleService::addPolicyByRoleDraft() */ - public function testAddPolicyWithRoleAssignment() + public function testAddPolicyWithRoleAssignment(): void { $repository = $this->getRepository(); @@ -1875,7 +1875,7 @@ public function testLoadRoleAssignment() * * @depends testLoadRoleByIdentifier */ - public function testGetRoleAssignments() + public function testGetRoleAssignments(): array { $repository = $this->getRepository(); @@ -1912,7 +1912,7 @@ public function testGetRoleAssignments() * * @depends testGetRoleAssignments */ - public function testGetRoleAssignmentsContainExpectedLimitation(array $roleAssignments) + public function testGetRoleAssignmentsContainExpectedLimitation(array $roleAssignments): void { self::assertEquals( 'Subtree', @@ -2021,7 +2021,7 @@ public function testCountRoleAssignmentsAfterDeletingUser(): void * * @depends testGetRoleAssignments */ - public function testAssignRoleToUser() + public function testAssignRoleToUser(): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); @@ -2050,7 +2050,7 @@ public function testAssignRoleToUser() * * @depends testAssignRoleToUser */ - public function testAssignRoleToUserWithRoleLimitation() + public function testAssignRoleToUserWithRoleLimitation(): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); @@ -2157,7 +2157,7 @@ public function testAssignRoleToUserWithRoleLimitation() * @depends testAssignRoleToUser * @depends testLoadRoleByIdentifier */ - public function testAssignRoleToUserWithRoleLimitationThrowsLimitationValidationException() + public function testAssignRoleToUserWithRoleLimitationThrowsLimitationValidationException(): void { $this->expectException(LimitationValidationException::class); @@ -2199,7 +2199,7 @@ public function testAssignRoleToUserWithRoleLimitationThrowsLimitationValidation * @depends testAssignRoleToUser * @depends testLoadRoleByIdentifier */ - public function testAssignRoleToUserThrowsInvalidArgumentException() + public function testAssignRoleToUserThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -2245,7 +2245,7 @@ public function testAssignRoleToUserThrowsInvalidArgumentException() * @depends testAssignRoleToUser * @depends testLoadRoleByIdentifier */ - public function testAssignRoleToUserWithRoleLimitationThrowsInvalidArgumentException() + public function testAssignRoleToUserWithRoleLimitationThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -2298,7 +2298,7 @@ public function testAssignRoleToUserWithRoleLimitationThrowsInvalidArgumentExcep * * @depends testAssignRoleToUser */ - public function testRemoveRoleAssignment() + public function testRemoveRoleAssignment(): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); @@ -2335,7 +2335,7 @@ public function testRemoveRoleAssignment() * @depends testAssignRoleToUser * @depends testCreateRoleWithAddPolicy */ - public function testGetRoleAssignmentsForUserDirect() + public function testGetRoleAssignmentsForUserDirect(): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); @@ -2391,7 +2391,7 @@ public function testGetRoleAssignmentsForUserDirect() * @depends testAssignRoleToUser * @depends testCreateRoleWithAddPolicy */ - public function testGetRoleAssignmentsForUserEmpty() + public function testGetRoleAssignmentsForUserEmpty(): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); @@ -2416,7 +2416,7 @@ public function testGetRoleAssignmentsForUserEmpty() * @depends testAssignRoleToUser * @depends testCreateRoleWithAddPolicy */ - public function testGetRoleAssignmentsForUserInherited() + public function testGetRoleAssignmentsForUserInherited(): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); @@ -2444,7 +2444,7 @@ public function testGetRoleAssignmentsForUserInherited() * * @depends testGetRoleAssignments */ - public function testAssignRoleToUserGroup() + public function testAssignRoleToUserGroup(): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); @@ -2473,7 +2473,7 @@ public function testAssignRoleToUserGroup() * * @covers \Ibexa\Contracts\Core\Repository\RoleService::assignRoleToUserGroup() */ - public function testAssignRoleToUserGroupAffectsRoleAssignmentsForUser() + public function testAssignRoleToUserGroupAffectsRoleAssignmentsForUser(): void { $roleService = $this->getRepository()->getRoleService(); @@ -2503,7 +2503,7 @@ public function testAssignRoleToUserGroupAffectsRoleAssignmentsForUser() * * @depends testAssignRoleToUserGroup */ - public function testAssignRoleToUserGroupWithRoleLimitation() + public function testAssignRoleToUserGroupWithRoleLimitation(): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); @@ -2606,7 +2606,7 @@ public function testAssignRoleToUserGroupWithRoleLimitation() * @depends testLoadRoleByIdentifier * @depends testAssignRoleToUserGroup */ - public function testAssignRoleToUserGroupWithRoleLimitationThrowsLimitationValidationException() + public function testAssignRoleToUserGroupWithRoleLimitationThrowsLimitationValidationException(): void { $this->expectException(LimitationValidationException::class); @@ -2649,7 +2649,7 @@ public function testAssignRoleToUserGroupWithRoleLimitationThrowsLimitationValid * @depends testLoadRoleByIdentifier * @depends testAssignRoleToUserGroup */ - public function testAssignRoleToUserGroupThrowsInvalidArgumentException() + public function testAssignRoleToUserGroupThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -2696,7 +2696,7 @@ public function testAssignRoleToUserGroupThrowsInvalidArgumentException() * @depends testLoadRoleByIdentifier * @depends testAssignRoleToUserGroup */ - public function testAssignRoleToUserGroupWithRoleLimitationThrowsInvalidArgumentException() + public function testAssignRoleToUserGroupWithRoleLimitationThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -2750,7 +2750,7 @@ public function testAssignRoleToUserGroupWithRoleLimitationThrowsInvalidArgument * * @depends testAssignRoleToUserGroup */ - public function testRemoveRoleAssignmentFromUserGroup() + public function testRemoveRoleAssignmentFromUserGroup(): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); @@ -2786,7 +2786,7 @@ public function testRemoveRoleAssignmentFromUserGroup() * * @covers \Ibexa\Contracts\Core\Repository\RoleService::removeRoleAssignment */ - public function testUnassignRoleByAssignment() + public function testUnassignRoleByAssignment(): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); @@ -2813,7 +2813,7 @@ public function testUnassignRoleByAssignment() * * @covers \Ibexa\Contracts\Core\Repository\RoleService::removeRoleAssignment */ - public function testUnassignRoleByAssignmentThrowsUnauthorizedException() + public function testUnassignRoleByAssignmentThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -2838,7 +2838,7 @@ public function testUnassignRoleByAssignmentThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\RoleService::removeRoleAssignment */ - public function testUnassignRoleByAssignmentThrowsNotFoundException() + public function testUnassignRoleByAssignmentThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -2866,7 +2866,7 @@ public function testUnassignRoleByAssignmentThrowsNotFoundException() * @depends testAssignRoleToUserGroup * @depends testCreateRoleWithAddPolicy */ - public function testGetRoleAssignmentsForUserGroup() + public function testGetRoleAssignmentsForUserGroup(): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); @@ -2917,7 +2917,7 @@ public function testGetRoleAssignmentsForUserGroup() * @depends testAssignRoleToUser * @depends testAssignRoleToUserGroup */ - public function testLoadPoliciesByUserId() + public function testLoadPoliciesByUserId(): void { $repository = $this->getRepository(); @@ -2994,7 +2994,7 @@ public function testLoadPoliciesByUserId() * * @depends testCreateRoleDraft */ - public function testPublishRoleDraft() + public function testPublishRoleDraft(): void { $repository = $this->getRepository(); @@ -3033,7 +3033,7 @@ public function testPublishRoleDraft() * @depends testCreateRoleDraft * @depends testAddPolicyByRoleDraft */ - public function testPublishRoleDraftAddPolicies() + public function testPublishRoleDraftAddPolicies(): void { $repository = $this->getRepository(); @@ -3068,7 +3068,7 @@ public function testPublishRoleDraftAddPolicies() } usort( $actual, - static function ($p1, $p2): int { + static function (array $p1, array $p2): int { return strcasecmp($p1['function'], $p2['function']); } ); diff --git a/tests/integration/Core/Repository/SearchEngineIndexingTest.php b/tests/integration/Core/Repository/SearchEngineIndexingTest.php index 7cdaf1e370..c73299c34b 100644 --- a/tests/integration/Core/Repository/SearchEngineIndexingTest.php +++ b/tests/integration/Core/Repository/SearchEngineIndexingTest.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Repository\SearchService; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; @@ -59,7 +60,7 @@ public function testFindContentInfoFullTextIsSearchable() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo */ - public function testFindLocationsFullTextIsSearchable(ContentInfo $contentInfo) + public function testFindLocationsFullTextIsSearchable(ContentInfo $contentInfo): void { $searchTerm = 'pamplemousse'; @@ -86,7 +87,7 @@ public function testFindLocationsFullTextIsSearchable(ContentInfo $contentInfo) * * @depends testFindContentInfoFullTextIsSearchable */ - public function testFindContentInfoFullTextIsNotSearchable() + public function testFindContentInfoFullTextIsNotSearchable(): void { $searchTerm = 'pamplemousse'; $this->createFullTextIsSearchableContent($searchTerm, false); @@ -110,7 +111,7 @@ public function testFindContentInfoFullTextIsNotSearchable() * * @depends testFindLocationsFullTextIsSearchable */ - public function testFindLocationsFullTextIsNotSearchable() + public function testFindLocationsFullTextIsNotSearchable(): void { $searchTerm = 'pamplemousse'; @@ -185,7 +186,7 @@ protected function createFullTextIsSearchableContent($searchText, $isSearchable) /** * EZP-26186: Make sure index is NOT deleted on removal of version draft (affected Solr). */ - public function testDeleteVersion() + public function testDeleteVersion(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -213,7 +214,7 @@ public function testDeleteVersion() /** * EZP-26186: Make sure affected child locations are deleted on content deletion (affected Solr). */ - public function testDeleteContent() + public function testDeleteContent(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -236,7 +237,7 @@ public function testDeleteContent() /** * EZP-26186: Make sure index is deleted on removal of Users (affected Solr). */ - public function testDeleteUser() + public function testDeleteUser(): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -259,7 +260,7 @@ public function testDeleteUser() /** * EZP-26186: Make sure index is deleted on removal of UserGroups (affected Solr). */ - public function testDeleteUserGroup() + public function testDeleteUserGroup(): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -282,7 +283,7 @@ public function testDeleteUserGroup() /** * Test that a newly created user is available for search. */ - public function testCreateUser() + public function testCreateUser(): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -318,7 +319,7 @@ public function testCreateUser() /** * Test that a newly updated user is available for search. */ - public function testUpdateUser() + public function testUpdateUser(): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -350,7 +351,7 @@ public function testUpdateUser() /** * Test that a newly created user group is available for search. */ - public function testCreateUserGroup() + public function testCreateUserGroup(): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -380,7 +381,7 @@ public function testCreateUserGroup() /** * Test that a newly created Location is available for search. */ - public function testCreateLocation() + public function testCreateLocation(): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -402,7 +403,7 @@ public function testCreateLocation() /** * Test that hiding a Location makes it unavailable for search. */ - public function testHideSubtree() + public function testHideSubtree(): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -428,7 +429,7 @@ public function testHideSubtree() /** * Test that hiding and revealing a Location makes it available for search. */ - public function testRevealSubtree() + public function testRevealSubtree(): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -456,7 +457,7 @@ public function testRevealSubtree() /** * Test that a copied subtree is available for search. */ - public function testCopySubtree() + public function testCopySubtree(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -506,7 +507,7 @@ public function testCopySubtree() /** * Test that moved subtree is available for search and found only under a specific parent Location. */ - public function testMoveSubtree() + public function testMoveSubtree(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -571,7 +572,7 @@ public function testMoveSubtree() * Testing that content is indexed even when containing only fields with values * considered to be empty by the search engine. */ - public function testIndexContentWithNullField() + public function testIndexContentWithNullField(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -627,7 +628,7 @@ public function testIndexContentWithNullField() /** * Test that updated Location is available for search. */ - public function testUpdateLocation() + public function testUpdateLocation(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -665,7 +666,7 @@ public function testUpdateLocation() * Testing that content will be deleted with all of its subitems but subitems with additional location will stay as * they are. */ - public function testDeleteLocation() + public function testDeleteLocation(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -700,7 +701,7 @@ public function testDeleteLocation() /** * Test content is available for search after being published. */ - public function testPublishVersion() + public function testPublishVersion(): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -731,7 +732,7 @@ public function testPublishVersion() /** * Test recovered content is available for search. */ - public function testRecoverLocation() + public function testRecoverLocation(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -761,7 +762,7 @@ public function testRecoverLocation() /** * Test copied content is available for search. */ - public function testCopyContent() + public function testCopyContent(): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -787,7 +788,7 @@ public function testCopyContent() /** * Test that setting object content state to locked and then unlocked does not affect search index. */ - public function testSetContentState() + public function testSetContentState(): void { $repository = $this->getRepository(); $objectStateService = $repository->getObjectStateService(); @@ -819,7 +820,7 @@ public function testSetContentState() * * @dataProvider getSpecialFullTextCases */ - public function testIndexingSpecialFullTextCases($text, $searchForText) + public function testIndexingSpecialFullTextCases(string $text, $searchForText): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -891,7 +892,7 @@ public function getEmailAddressesCases(): array * * @return array */ - public function getSpecialFullTextCases() + public function getSpecialFullTextCases(): array { return [ ['UPPERCASE TEXT', 'uppercase text'], @@ -918,7 +919,7 @@ public function getSpecialFullTextCases() * * @see https://issues.ibexa.co/browse/EZP-27250 */ - public function testUserFullTextSearch() + public function testUserFullTextSearch(): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -940,7 +941,7 @@ public function testUserFullTextSearch() /** * Test updating Content field value with empty value removes it from search index. */ - public function testRemovedContentFieldValueIsNotFound() + public function testRemovedContentFieldValueIsNotFound(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -975,7 +976,7 @@ public function testRemovedContentFieldValueIsNotFound() * @param int $parentLocationId parent location Id * @param bool $expected expected value of {invisible} property in subtree */ - private function assertSubtreeInvisibleProperty(SearchService $searchService, $parentLocationId, $expected) + private function assertSubtreeInvisibleProperty(SearchService $searchService, $parentLocationId, $expected): void { $criterion = new Criterion\ParentLocationId($parentLocationId); $query = new LocationQuery(['filter' => $criterion]); @@ -990,7 +991,7 @@ private function assertSubtreeInvisibleProperty(SearchService $searchService, $p /** * Test that swapping locations affects properly Search Engine Index. */ - public function testSwapLocation() + public function testSwapLocation(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -1023,7 +1024,7 @@ public function testSwapLocation() /** * Test that updating Content metadata affects properly Search Engine Index. */ - public function testUpdateContentMetadata() + public function testUpdateContentMetadata(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -1037,7 +1038,7 @@ public function testUpdateContentMetadata() $newContentMetadataUpdateStruct = $contentService->newContentMetadataUpdateStruct(); $newContentMetadataUpdateStruct->remoteId = md5('Test'); - $newContentMetadataUpdateStruct->publishedDate = new \DateTime(); + $newContentMetadataUpdateStruct->publishedDate = new DateTime(); $newContentMetadataUpdateStruct->publishedDate->add(new \DateInterval('P1D')); $newContentMetadataUpdateStruct->mainLocationId = $newLocation->id; @@ -1074,7 +1075,7 @@ public function testUpdateContentMetadata() /** * Test that updating Content Draft metadata does not affect Search Engine Index. */ - public function testUpdateContentDraftMetadataIsNotIndexed() + public function testUpdateContentDraftMetadataIsNotIndexed(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -1099,7 +1100,7 @@ public function testUpdateContentDraftMetadataIsNotIndexed() /** * Test that assigning section to content object properly affects Search Engine Index. */ - public function testAssignSection() + public function testAssignSection(): void { $repository = $this->getRepository(); $sectionService = $repository->getSectionService(); @@ -1123,7 +1124,7 @@ public function testAssignSection() /** * Test search engine is updated after removal of the translation from all the Versions. */ - public function testDeleteTranslation() + public function testDeleteTranslation(): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -1270,7 +1271,7 @@ protected function createContent( * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - protected function createContentWithNameAndDescription($contentName, $contentDescription, array $parentLocationIdList = []) + protected function createContentWithNameAndDescription(string $contentName, $contentDescription, array $parentLocationIdList = []): Content { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -1303,7 +1304,7 @@ protected function createContentWithNameAndDescription($contentName, $contentDes * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - protected function createMultiLanguageContent(array $names, $parentLocationId, $alwaysAvailable) + protected function createMultiLanguageContent(array $names, int $parentLocationId, $alwaysAvailable) { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -1363,7 +1364,7 @@ protected function assertContentIdSearch($contentId, $expectedCount) * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - protected function createNewTestLocation() + protected function createNewTestLocation(): Location { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); diff --git a/tests/integration/Core/Repository/SearchService/Aggregation/DataSetBuilder/TermAggregationDataSetBuilder.php b/tests/integration/Core/Repository/SearchService/Aggregation/DataSetBuilder/TermAggregationDataSetBuilder.php index b2a87eecfe..1f7c9333ee 100644 --- a/tests/integration/Core/Repository/SearchService/Aggregation/DataSetBuilder/TermAggregationDataSetBuilder.php +++ b/tests/integration/Core/Repository/SearchService/Aggregation/DataSetBuilder/TermAggregationDataSetBuilder.php @@ -17,11 +17,9 @@ */ final class TermAggregationDataSetBuilder { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Query\Aggregation */ - private $aggregation; + private Aggregation $aggregation; - /** @var array */ - private $entries; + private array $entries; /** @var callable|null */ private $mapper; diff --git a/tests/integration/Core/Repository/SearchService/Aggregation/FixtureGenerator/FieldAggregationFixtureGenerator.php b/tests/integration/Core/Repository/SearchService/Aggregation/FixtureGenerator/FieldAggregationFixtureGenerator.php index 326aeef304..ff10450a59 100644 --- a/tests/integration/Core/Repository/SearchService/Aggregation/FixtureGenerator/FieldAggregationFixtureGenerator.php +++ b/tests/integration/Core/Repository/SearchService/Aggregation/FixtureGenerator/FieldAggregationFixtureGenerator.php @@ -17,20 +17,15 @@ */ final class FieldAggregationFixtureGenerator { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - private $repository; + private Repository $repository; - /** @var string|null */ - private $contentTypeIdentifier; + private ?string $contentTypeIdentifier = null; - /** @var string|null */ - private $fieldTypeIdentifier; + private ?string $fieldTypeIdentifier = null; - /** @var string|null */ - private $fieldDefinitionIdentifier; + private ?string $fieldDefinitionIdentifier = null; - /** @var iterable|null */ - private $values; + private ?iterable $values = null; /** @var callable|null */ private $fieldDefinitionCreateStructConfigurator; diff --git a/tests/integration/Core/Repository/SearchService/RemoteIdIndexingTest.php b/tests/integration/Core/Repository/SearchService/RemoteIdIndexingTest.php index a8d8099af3..9ffc226bb2 100644 --- a/tests/integration/Core/Repository/SearchService/RemoteIdIndexingTest.php +++ b/tests/integration/Core/Repository/SearchService/RemoteIdIndexingTest.php @@ -16,7 +16,7 @@ final class RemoteIdIndexingTest extends BaseTest { /** @var int[] */ - private static $contentIdByRemoteIdIndex = []; + private static array $contentIdByRemoteIdIndex = []; /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException diff --git a/tests/integration/Core/Repository/SearchServiceAuthorizationTest.php b/tests/integration/Core/Repository/SearchServiceAuthorizationTest.php index 052e8358a4..6a48fb4a9f 100644 --- a/tests/integration/Core/Repository/SearchServiceAuthorizationTest.php +++ b/tests/integration/Core/Repository/SearchServiceAuthorizationTest.php @@ -31,7 +31,7 @@ class SearchServiceAuthorizationTest extends BaseTest * * @depends Ibexa\Tests\Integration\Core\Repository\SearchServiceTest::testFindContentFiltered */ - public function testFindContent() + public function testFindContent(): void { $repository = $this->getRepository(); $permissionResolver = $repository->getPermissionResolver(); @@ -62,7 +62,7 @@ public function testFindContent() * * @depends Ibexa\Tests\Integration\Core\Repository\SearchServiceTest::testFindContentFiltered */ - public function testFindContentEmptyResult() + public function testFindContentEmptyResult(): void { $repository = $this->getRepository(); $permissionResolver = $repository->getPermissionResolver(); @@ -96,7 +96,7 @@ public function testFindContentEmptyResult() * * @depends Ibexa\Tests\Integration\Core\Repository\SearchServiceTest::testFindSingle */ - public function testFindSingleThrowsNotFoundException() + public function testFindSingleThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -129,7 +129,7 @@ public function testFindSingleThrowsNotFoundException() * * @depends Ibexa\Tests\Integration\Core\Repository\SearchServiceAuthorizationTest::testFindContent */ - public function testFindContentWithUserPermissionFilter() + public function testFindContentWithUserPermissionFilter(): void { $repository = $this->getRepository(); $permissionResolver = $repository->getPermissionResolver(); @@ -168,7 +168,7 @@ public function testFindContentWithUserPermissionFilter() * * @depends Ibexa\Tests\Integration\Core\Repository\SearchServiceAuthorizationTest::testFindContent */ - public function testFindSingleWithUserPermissionFilter() + public function testFindSingleWithUserPermissionFilter(): void { $repository = $this->getRepository(); $permissionResolver = $repository->getPermissionResolver(); @@ -200,7 +200,7 @@ public function testFindSingleWithUserPermissionFilter() * * @depends Ibexa\Tests\Integration\Core\Repository\SearchServiceAuthorizationTest::testFindContent */ - public function testFindSingleThrowsNotFoundExceptionWithUserPermissionFilter() + public function testFindSingleThrowsNotFoundExceptionWithUserPermissionFilter(): void { $this->expectException(NotFoundException::class); diff --git a/tests/integration/Core/Repository/SearchServiceFulltextTest.php b/tests/integration/Core/Repository/SearchServiceFulltextTest.php index ff3219f92b..d1e8254f4c 100644 --- a/tests/integration/Core/Repository/SearchServiceFulltextTest.php +++ b/tests/integration/Core/Repository/SearchServiceFulltextTest.php @@ -43,8 +43,10 @@ protected function setUp(): void /** * Create test Content and return Content ID map for subsequent testing. + * + * @return mixed[] */ - public function testPrepareContent() + public function testPrepareContent(): array { $repository = $this->getRepository(); $dataMap = [ @@ -216,7 +218,7 @@ private function doTestFulltextContentSearch(string $searchString, array $expect * * @dataProvider providerForTestFulltextSearchSolr7 */ - public function testFulltextLocationSearchSolr7($searchString, array $expectedKeys, array $idMap): void + public function testFulltextLocationSearchSolr7(string $searchString, array $expectedKeys, array $idMap): void { if (false === $this->isSolrMajorVersionInRange('7.0.0', '8.0.0')) { self::markTestSkipped('This test is only relevant for Solr >= 7'); @@ -243,12 +245,12 @@ private function doTestFulltextLocationSearch($searchString, array $expectedKeys * @param array $expectedKeys * @param array $idMap */ - public function assertFulltextSearch(SearchResult $searchResult, array $expectedKeys, array $idMap) + public function assertFulltextSearch(SearchResult $searchResult, array $expectedKeys, array $idMap): void { self::assertEquals( array_reduce( $expectedKeys, - static function ($carry, $item) { + static function ($carry, $item): float|int { $carry += count((array)$item); return $carry; @@ -272,7 +274,7 @@ static function ($carry, $item) { * * @return array */ - private function mapKeysToIds(array $expectedKeys, array $idMap) + private function mapKeysToIds(array $expectedKeys, array $idMap): array { $expectedIds = []; diff --git a/tests/integration/Core/Repository/SearchServiceImageTest.php b/tests/integration/Core/Repository/SearchServiceImageTest.php index e9b589aa3e..9e82758f1e 100644 --- a/tests/integration/Core/Repository/SearchServiceImageTest.php +++ b/tests/integration/Core/Repository/SearchServiceImageTest.php @@ -255,7 +255,7 @@ public function provideInvalidDataForTestCriterion(): iterable /** * @param string|array $value */ - private function createMimeTypeCriterion($value): Query\Criterion\Image\MimeType + private function createMimeTypeCriterion(string|array $value): Query\Criterion\Image\MimeType { return new Query\Criterion\Image\MimeType( self::IMAGE_FIELD_DEF_IDENTIFIER, @@ -268,7 +268,7 @@ private function createMimeTypeCriterion($value): Query\Criterion\Image\MimeType * @param numeric|null $max */ private function createFileSizeCriterion( - $min = 0, + int|string|float|null $min = 0, $max = null ): Query\Criterion\Image\FileSize { return new Query\Criterion\Image\FileSize( @@ -324,7 +324,7 @@ private function createDimensionsCriterion( /** * @param string|array $value */ - private function createOrientationCriterion($value): Query\Criterion\Image\Orientation + private function createOrientationCriterion(string|array $value): Query\Criterion\Image\Orientation { return new Query\Criterion\Image\Orientation( self::IMAGE_FIELD_DEF_IDENTIFIER, diff --git a/tests/integration/Core/Repository/SearchServiceLocationTest.php b/tests/integration/Core/Repository/SearchServiceLocationTest.php index 7a38aee7c3..2896c92900 100644 --- a/tests/integration/Core/Repository/SearchServiceLocationTest.php +++ b/tests/integration/Core/Repository/SearchServiceLocationTest.php @@ -193,7 +193,7 @@ protected function createFolderWithNonPrintableUtf8Characters(): Content * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testFieldIsEmptyInLocation() + public function testFieldIsEmptyInLocation(): void { $testContents = $this->createMovieContent(); @@ -226,7 +226,7 @@ public function testFieldIsEmptyInLocation() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testFieldIsNotEmptyInLocation() + public function testFieldIsNotEmptyInLocation(): void { $testContents = $this->createMovieContent(); @@ -256,7 +256,7 @@ public function testFieldIsNotEmptyInLocation() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testFieldCollectionContains() + public function testFieldCollectionContains(): void { $testContent = $this->createMultipleCountriesContent(); @@ -288,7 +288,7 @@ public function testFieldCollectionContains() * * @depends Ibexa\Tests\Integration\Core\Repository\SearchServiceTest::testFieldCollectionContains */ - public function testFieldCollectionContainsNoMatch() + public function testFieldCollectionContainsNoMatch(): void { $this->createMultipleCountriesContent(); $query = new LocationQuery( @@ -375,7 +375,7 @@ public function testEscapedNonPrintableUtf8Characters(): void self::assertEquals(1, $result->totalCount); } - public function testInvalidFieldIdentifierRange() + public function testInvalidFieldIdentifierRange(): void { $this->expectException(InvalidArgumentException::class); @@ -396,7 +396,7 @@ public function testInvalidFieldIdentifierRange() ); } - public function testInvalidFieldIdentifierIn() + public function testInvalidFieldIdentifierIn(): void { $this->expectException(InvalidArgumentException::class); @@ -417,7 +417,7 @@ public function testInvalidFieldIdentifierIn() ); } - public function testFindLocationsWithNonSearchableField() + public function testFindLocationsWithNonSearchableField(): void { $this->expectException(InvalidArgumentException::class); @@ -456,7 +456,7 @@ static function (SearchHit $searchHit) { * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testQueryCustomField() + public function testQueryCustomField(): void { $query = new LocationQuery( [ @@ -487,7 +487,7 @@ public function testQueryCustomField() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testQueryModifiedField() + public function testQueryModifiedField(): void { // Check using get_class since the others extend SetupFactory\Legacy if ($this->getSetupFactory() instanceof Legacy) { @@ -558,7 +558,7 @@ protected function createTestPlaceContentType() * * @group maplocation */ - public function testMapLocationDistanceLessThanOrEqual() + public function testMapLocationDistanceLessThanOrEqual(): void { $contentType = $this->createTestPlaceContentType(); @@ -640,7 +640,7 @@ public function testMapLocationDistanceLessThanOrEqual() * * @group maplocation */ - public function testMapLocationDistanceGreaterThanOrEqual() + public function testMapLocationDistanceGreaterThanOrEqual(): void { $contentType = $this->createTestPlaceContentType(); @@ -722,7 +722,7 @@ public function testMapLocationDistanceGreaterThanOrEqual() * * @group maplocation */ - public function testMapLocationDistanceBetween() + public function testMapLocationDistanceBetween(): void { $contentType = $this->createTestPlaceContentType(); @@ -820,7 +820,7 @@ public function testMapLocationDistanceBetween() * * @group maplocation */ - public function testMapLocationDistanceSortAscending() + public function testMapLocationDistanceSortAscending(): void { $contentType = $this->createTestPlaceContentType(); @@ -939,7 +939,7 @@ public function testMapLocationDistanceSortAscending() * * @group maplocation */ - public function testMapLocationDistanceSortDescending() + public function testMapLocationDistanceSortDescending(): void { $contentType = $this->createTestPlaceContentType(); @@ -1058,7 +1058,7 @@ public function testMapLocationDistanceSortDescending() * * @group maplocation */ - public function testMapLocationDistanceWithCustomField() + public function testMapLocationDistanceWithCustomField(): void { $contentType = $this->createTestPlaceContentType(); @@ -1143,7 +1143,7 @@ public function testMapLocationDistanceWithCustomField() * * @group maplocation */ - public function testMapLocationDistanceWithCustomFieldSort() + public function testMapLocationDistanceWithCustomFieldSort(): void { $contentType = $this->createTestPlaceContentType(); @@ -1263,7 +1263,7 @@ public function testMapLocationDistanceWithCustomFieldSort() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testVisibilityCriterionWithHiddenContent() + public function testVisibilityCriterionWithHiddenContent(): void { $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); diff --git a/tests/integration/Core/Repository/SearchServiceTest.php b/tests/integration/Core/Repository/SearchServiceTest.php index d6dc0baa09..97e7172d95 100644 --- a/tests/integration/Core/Repository/SearchServiceTest.php +++ b/tests/integration/Core/Repository/SearchServiceTest.php @@ -21,6 +21,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Test\Repository\SetupFactory\Legacy; use Ibexa\Tests\Solr\SetupFactory\LegacySetupFactory as LegacySolrSetupFactory; @@ -44,7 +45,7 @@ class SearchServiceTest extends BaseTest self::FIND_LOCATION_METHOD, ]; - public function getFilterContentSearches() + public function getFilterContentSearches(): array { $fixtureDir = $this->getFixtureDir(); @@ -188,7 +189,7 @@ public function getFilterContentSearches() [ 'filter' => new Criterion\DateMetadata( Criterion\DateMetadata::MODIFIED, - Criterion\Operator::GT, + Operator::GT, 1343140540 ), 'sortClauses' => [new SortClause\ContentId()], @@ -199,7 +200,7 @@ public function getFilterContentSearches() [ 'filter' => new Criterion\DateMetadata( Criterion\DateMetadata::MODIFIED, - Criterion\Operator::GTE, + Operator::GTE, 1311154215 ), 'sortClauses' => [new SortClause\ContentId()], @@ -210,7 +211,7 @@ public function getFilterContentSearches() [ 'filter' => new Criterion\DateMetadata( Criterion\DateMetadata::MODIFIED, - Criterion\Operator::LTE, + Operator::LTE, 1311154215 ), 'limit' => 10, @@ -222,7 +223,7 @@ public function getFilterContentSearches() [ 'filter' => new Criterion\DateMetadata( Criterion\DateMetadata::MODIFIED, - Criterion\Operator::IN, + Operator::IN, [1033920794, 1060695457, 1343140540] ), 'sortClauses' => [new SortClause\ContentId()], @@ -233,7 +234,7 @@ public function getFilterContentSearches() [ 'filter' => new Criterion\DateMetadata( Criterion\DateMetadata::MODIFIED, - Criterion\Operator::BETWEEN, + Operator::BETWEEN, [1033920776, 1072180276] ), 'sortClauses' => [new SortClause\ContentId()], @@ -244,7 +245,7 @@ public function getFilterContentSearches() [ 'filter' => new Criterion\DateMetadata( Criterion\DateMetadata::CREATED, - Criterion\Operator::BETWEEN, + Operator::BETWEEN, [1033920776, 1072180278] ), 'sortClauses' => [new SortClause\ContentId()], @@ -255,7 +256,7 @@ public function getFilterContentSearches() [ 'filter' => new Criterion\CustomField( 'user_group_name_value_s', - Criterion\Operator::EQ, + Operator::EQ, 'Members' ), 'sortClauses' => [new SortClause\ContentId()], @@ -266,7 +267,7 @@ public function getFilterContentSearches() [ 'filter' => new Criterion\CustomField( 'user_group_name_value_s', - Criterion\Operator::CONTAINS, + Operator::CONTAINS, 'Members' ), 'sortClauses' => [new SortClause\ContentId()], @@ -277,7 +278,7 @@ public function getFilterContentSearches() [ 'filter' => new Criterion\CustomField( 'user_group_name_value_s', - Criterion\Operator::LT, + Operator::LT, 'Members' ), 'sortClauses' => [new SortClause\ContentId()], @@ -288,7 +289,7 @@ public function getFilterContentSearches() [ 'filter' => new Criterion\CustomField( 'user_group_name_value_s', - Criterion\Operator::LTE, + Operator::LTE, 'Members' ), 'sortClauses' => [new SortClause\ContentId()], @@ -299,7 +300,7 @@ public function getFilterContentSearches() [ 'filter' => new Criterion\CustomField( 'user_group_name_value_s', - Criterion\Operator::GT, + Operator::GT, 'Members' ), 'sortClauses' => [new SortClause\ContentId()], @@ -310,7 +311,7 @@ public function getFilterContentSearches() [ 'filter' => new Criterion\CustomField( 'user_group_name_value_s', - Criterion\Operator::GTE, + Operator::GTE, 'Members' ), 'sortClauses' => [new SortClause\ContentId()], @@ -321,7 +322,7 @@ public function getFilterContentSearches() [ 'filter' => new Criterion\CustomField( 'user_group_name_value_s', - Criterion\Operator::BETWEEN, + Operator::BETWEEN, ['Administrator users', 'Members'] ), 'sortClauses' => [new SortClause\ContentId()], @@ -350,7 +351,7 @@ public function getFilterContentSearches() [ 'filter' => new Criterion\Field( 'name', - Criterion\Operator::EQ, + Operator::EQ, 'Members' ), 'sortClauses' => [new SortClause\ContentId()], @@ -361,7 +362,7 @@ public function getFilterContentSearches() [ 'filter' => new Criterion\Field( 'name', - Criterion\Operator::IN, + Operator::IN, ['Members', 'Anonymous users'] ), 'sortClauses' => [new SortClause\ContentId()], @@ -372,7 +373,7 @@ public function getFilterContentSearches() [ 'filter' => new Criterion\DateMetadata( Criterion\DateMetadata::MODIFIED, - Criterion\Operator::BETWEEN, + Operator::BETWEEN, [1033920275, 1033920794] ), 'sortClauses' => [new SortClause\ContentId()], @@ -385,12 +386,12 @@ public function getFilterContentSearches() [ new Criterion\Field( 'name', - Criterion\Operator::EQ, + Operator::EQ, 'Members' ), new Criterion\DateMetadata( Criterion\DateMetadata::MODIFIED, - Criterion\Operator::BETWEEN, + Operator::BETWEEN, [1033920275, 1033920794] ), ] @@ -446,7 +447,7 @@ public function getFilterContentSearches() ], $fixtureDir . 'Status.php', // Result having the same sort level should be sorted between them to be system independent - static function (&$data) { + static function (&$data): void { usort( $data->searchHits, static function ($a, $b): int { @@ -469,7 +470,7 @@ static function ($a, $b): int { [ 'filter' => new Criterion\UserMetadata( Criterion\UserMetadata::MODIFIER, - Criterion\Operator::EQ, + Operator::EQ, 14 ), 'sortClauses' => [ @@ -483,7 +484,7 @@ static function ($a, $b): int { [ 'filter' => new Criterion\UserMetadata( Criterion\UserMetadata::MODIFIER, - Criterion\Operator::IN, + Operator::IN, [14] ), 'sortClauses' => [ @@ -497,7 +498,7 @@ static function ($a, $b): int { [ 'filter' => new Criterion\UserMetadata( Criterion\UserMetadata::OWNER, - Criterion\Operator::EQ, + Operator::EQ, 14 ), 'sortClauses' => [ @@ -511,7 +512,7 @@ static function ($a, $b): int { [ 'filter' => new Criterion\UserMetadata( Criterion\UserMetadata::OWNER, - Criterion\Operator::IN, + Operator::IN, [14] ), 'sortClauses' => [ @@ -525,7 +526,7 @@ static function ($a, $b): int { [ 'filter' => new Criterion\UserMetadata( Criterion\UserMetadata::GROUP, - Criterion\Operator::EQ, + Operator::EQ, 12 ), 'sortClauses' => [ @@ -539,7 +540,7 @@ static function ($a, $b): int { [ 'filter' => new Criterion\UserMetadata( Criterion\UserMetadata::GROUP, - Criterion\Operator::IN, + Operator::IN, [12] ), 'sortClauses' => [ @@ -553,7 +554,7 @@ static function ($a, $b): int { [ 'filter' => new Criterion\UserMetadata( Criterion\UserMetadata::GROUP, - Criterion\Operator::EQ, + Operator::EQ, 4 ), 'sortClauses' => [ @@ -567,7 +568,7 @@ static function ($a, $b): int { [ 'filter' => new Criterion\UserMetadata( Criterion\UserMetadata::GROUP, - Criterion\Operator::IN, + Operator::IN, [4] ), 'sortClauses' => [ @@ -609,7 +610,7 @@ static function ($a, $b): int { ]; } - public function getContentQuerySearches() + public function getContentQuerySearches(): array { $fixtureDir = $this->getFixtureDir(); @@ -844,35 +845,35 @@ public function getContentQuerySearches() ]; } - public function getLocationQuerySearches() + public function getLocationQuerySearches(): array { $fixtureDir = $this->getFixtureDir(); return [ [ [ - 'query' => new Criterion\Location\Depth(Criterion\Operator::EQ, 1), + 'query' => new Criterion\Location\Depth(Operator::EQ, 1), 'sortClauses' => [new SortClause\ContentId()], ], $fixtureDir . 'Depth.php', ], [ [ - 'query' => new Criterion\Location\Depth(Criterion\Operator::IN, [1, 3]), + 'query' => new Criterion\Location\Depth(Operator::IN, [1, 3]), 'sortClauses' => [new SortClause\ContentId()], ], $fixtureDir . 'DepthIn.php', ], [ [ - 'query' => new Criterion\Location\Depth(Criterion\Operator::GT, 2), + 'query' => new Criterion\Location\Depth(Operator::GT, 2), 'sortClauses' => [new SortClause\ContentId()], ], $fixtureDir . 'DepthGt.php', ], [ [ - 'query' => new Criterion\Location\Depth(Criterion\Operator::GTE, 2), + 'query' => new Criterion\Location\Depth(Operator::GTE, 2), 'sortClauses' => [new SortClause\ContentId()], 'limit' => 50, ], @@ -880,14 +881,14 @@ public function getLocationQuerySearches() ], [ [ - 'query' => new Criterion\Location\Depth(Criterion\Operator::LT, 2), + 'query' => new Criterion\Location\Depth(Operator::LT, 2), 'sortClauses' => [new SortClause\ContentId()], ], $fixtureDir . 'Depth.php', ], [ [ - 'query' => new Criterion\Location\Depth(Criterion\Operator::LTE, 2), + 'query' => new Criterion\Location\Depth(Operator::LTE, 2), 'sortClauses' => [new SortClause\ContentId()], 'limit' => 50, ], @@ -895,7 +896,7 @@ public function getLocationQuerySearches() ], [ [ - 'query' => new Criterion\Location\Depth(Criterion\Operator::BETWEEN, [1, 2]), + 'query' => new Criterion\Location\Depth(Operator::BETWEEN, [1, 2]), 'sortClauses' => [new SortClause\ContentId()], 'limit' => 50, ], @@ -921,7 +922,7 @@ public function getLocationQuerySearches() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testFindContentFiltered($queryData, $fixture, $closure = null) + public function testFindContentFiltered(array $queryData, string $fixture, \Closure $closure = null): void { $query = new Query($queryData); $this->assertQueryFixture($query, $fixture, $closure); @@ -934,7 +935,7 @@ public function testFindContentFiltered($queryData, $fixture, $closure = null) * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContentInfo() */ - public function testFindContentInfoFiltered($queryData, $fixture, $closure = null) + public function testFindContentInfoFiltered(array $queryData, string $fixture, \Closure $closure = null): void { $query = new Query($queryData); $this->assertQueryFixture($query, $fixture, $this->getContentInfoFixtureClosure($closure), true); @@ -947,7 +948,7 @@ public function testFindContentInfoFiltered($queryData, $fixture, $closure = nul * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testFindLocationsContentFiltered($queryData, $fixture, $closure = null) + public function testFindLocationsContentFiltered(array $queryData, string $fixture, \Closure $closure = null): void { $query = new LocationQuery($queryData); $this->assertQueryFixture($query, $fixture, $closure); @@ -960,7 +961,7 @@ public function testFindLocationsContentFiltered($queryData, $fixture, $closure * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testQueryContent($queryData, $fixture, $closure = null) + public function testQueryContent(array $queryData, string $fixture, ?callable $closure = null): void { $query = new Query($queryData); $this->assertQueryFixture($query, $fixture, $closure); @@ -973,7 +974,7 @@ public function testQueryContent($queryData, $fixture, $closure = null) * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testQueryContentInfo($queryData, $fixture, $closure = null) + public function testQueryContentInfo(array $queryData, string $fixture, $closure = null): void { $query = new Query($queryData); $this->assertQueryFixture($query, $fixture, $this->getContentInfoFixtureClosure($closure), true); @@ -986,7 +987,7 @@ public function testQueryContentInfo($queryData, $fixture, $closure = null) * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testQueryContentLocations($queryData, $fixture, $closure = null) + public function testQueryContentLocations(array $queryData, string $fixture, ?callable $closure = null): void { $query = new LocationQuery($queryData); $this->assertQueryFixture($query, $fixture, $closure); @@ -999,20 +1000,20 @@ public function testQueryContentLocations($queryData, $fixture, $closure = null) * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testQueryLocations($queryData, $fixture, $closure = null) + public function testQueryLocations(array $queryData, string $fixture, ?callable $closure = null): void { $query = new LocationQuery($queryData); $this->assertQueryFixture($query, $fixture, $closure); } - public function getCaseInsensitiveSearches() + public function getCaseInsensitiveSearches(): array { return [ [ [ 'filter' => new Criterion\Field( 'name', - Criterion\Operator::EQ, + Operator::EQ, 'Members' ), 'sortClauses' => [new SortClause\ContentId()], @@ -1022,7 +1023,7 @@ public function getCaseInsensitiveSearches() [ 'filter' => new Criterion\Field( 'name', - Criterion\Operator::EQ, + Operator::EQ, 'members' ), 'sortClauses' => [new SortClause\ContentId()], @@ -1032,7 +1033,7 @@ public function getCaseInsensitiveSearches() [ 'filter' => new Criterion\Field( 'name', - Criterion\Operator::EQ, + Operator::EQ, 'MEMBERS' ), 'sortClauses' => [new SortClause\ContentId()], @@ -1048,7 +1049,7 @@ public function getCaseInsensitiveSearches() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testFindContentFieldFiltersCaseSensitivity($queryData) + public function testFindContentFieldFiltersCaseSensitivity(array $queryData): void { $query = new Query($queryData); $this->assertQueryFixture( @@ -1064,7 +1065,7 @@ public function testFindContentFieldFiltersCaseSensitivity($queryData) * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testFindLocationsFieldFiltersCaseSensitivity($queryData) + public function testFindLocationsFieldFiltersCaseSensitivity(array $queryData): void { $query = new LocationQuery($queryData); $this->assertQueryFixture( @@ -1073,7 +1074,7 @@ public function testFindLocationsFieldFiltersCaseSensitivity($queryData) ); } - public function getRelationFieldFilterSearches() + public function getRelationFieldFilterSearches(): array { $fixtureDir = $this->getFixtureDir(); @@ -1082,7 +1083,7 @@ public function getRelationFieldFilterSearches() [ 'filter' => new Criterion\FieldRelation( 'image', - Criterion\Operator::IN, + Operator::IN, [1, 4, 10] ), 'sortClauses' => [new SortClause\ContentId()], @@ -1093,7 +1094,7 @@ public function getRelationFieldFilterSearches() [ 'filter' => new Criterion\FieldRelation( 'image', - Criterion\Operator::IN, + Operator::IN, [4, 49] ), 'sortClauses' => [new SortClause\ContentId()], @@ -1104,7 +1105,7 @@ public function getRelationFieldFilterSearches() [ 'filter' => new Criterion\FieldRelation( 'image', - Criterion\Operator::IN, + Operator::IN, [4] ), 'sortClauses' => [new SortClause\ContentId()], @@ -1115,7 +1116,7 @@ public function getRelationFieldFilterSearches() [ 'filter' => new Criterion\FieldRelation( 'image', - Criterion\Operator::CONTAINS, + Operator::CONTAINS, [1, 4, 10] ), 'sortClauses' => [new SortClause\ContentId()], @@ -1126,7 +1127,7 @@ public function getRelationFieldFilterSearches() [ 'filter' => new Criterion\FieldRelation( 'image', - Criterion\Operator::CONTAINS, + Operator::CONTAINS, [4, 49] ), 'sortClauses' => [new SortClause\ContentId()], @@ -1137,7 +1138,7 @@ public function getRelationFieldFilterSearches() [ 'filter' => new Criterion\FieldRelation( 'image', - Criterion\Operator::CONTAINS, + Operator::CONTAINS, [4] ), 'sortClauses' => [new SortClause\ContentId()], @@ -1151,7 +1152,7 @@ public function getRelationFieldFilterSearches() * Purely for creating relation data needed for testFindRelationFieldContentInfoFiltered() * and testFindRelationFieldLocationsFiltered(). */ - public function testRelationContentCreation() + public function testRelationContentCreation(): void { $repository = $this->getRepository(); $galleryType = $repository->getContentTypeService()->loadContentTypeByIdentifier('gallery'); @@ -1184,7 +1185,7 @@ public function testRelationContentCreation() * * @depends testRelationContentCreation */ - public function testFindRelationFieldContentInfoFiltered($queryData, $fixture) + public function testFindRelationFieldContentInfoFiltered(array $queryData, string $fixture): void { $this->getRepository(false); // To make sure repo is setup w/o removing data from getRelationFieldFilterContentSearches $query = new Query($queryData); @@ -1200,14 +1201,14 @@ public function testFindRelationFieldContentInfoFiltered($queryData, $fixture) * * @depends testRelationContentCreation */ - public function testFindRelationFieldLocationsFiltered($queryData, $fixture) + public function testFindRelationFieldLocationsFiltered(array $queryData, string $fixture): void { $this->getRepository(false); // To make sure repo is setup w/o removing data from getRelationFieldFilterContentSearches $query = new LocationQuery($queryData); $this->assertQueryFixture($query, $fixture, null, true, false, false); } - public function testFindSingle() + public function testFindSingle(): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -1224,7 +1225,7 @@ public function testFindSingle() ); } - public function testFindNoPerformCount() + public function testFindNoPerformCount(): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -1249,7 +1250,7 @@ public function testFindNoPerformCount() } } - public function testFindNoPerformCountException() + public function testFindNoPerformCountException(): void { $this->expectException(\RuntimeException::class); @@ -1270,7 +1271,7 @@ public function testFindNoPerformCountException() $searchService->findContent($query); } - public function testFindLocationsNoPerformCount() + public function testFindLocationsNoPerformCount(): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -1295,7 +1296,7 @@ public function testFindLocationsNoPerformCount() } } - public function testFindLocationsNoPerformCountException() + public function testFindLocationsNoPerformCountException(): void { $this->expectException(\RuntimeException::class); @@ -1321,7 +1322,7 @@ public function testFindLocationsNoPerformCountException() * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content[] */ - protected function createMovieContent() + protected function createMovieContent(): array { $movies = []; @@ -1479,7 +1480,7 @@ public function testFieldIsEmpty() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testFieldIsNotEmpty() + public function testFieldIsNotEmpty(): void { $testContents = $this->createMovieContent(); @@ -1508,7 +1509,7 @@ public function testFieldIsNotEmpty() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testFieldCollectionContains() + public function testFieldCollectionContains(): void { $testContent = $this->createMultipleCountriesContent(); @@ -1516,7 +1517,7 @@ public function testFieldCollectionContains() [ 'query' => new Criterion\Field( 'countries', - Criterion\Operator::CONTAINS, + Operator::CONTAINS, 'Belgium' ), ] @@ -1540,14 +1541,14 @@ public function testFieldCollectionContains() * * @depends testFieldCollectionContains */ - public function testFieldCollectionContainsNoMatch() + public function testFieldCollectionContainsNoMatch(): void { $this->createMultipleCountriesContent(); $query = new Query( [ 'query' => new Criterion\Field( 'countries', - Criterion\Operator::CONTAINS, + Operator::CONTAINS, 'Netherlands Antilles' ), ] @@ -1560,7 +1561,7 @@ public function testFieldCollectionContainsNoMatch() self::assertEquals(0, $result->totalCount); } - public function testInvalidFieldIdentifierRange() + public function testInvalidFieldIdentifierRange(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$criterion->target\' is invalid: No searchable Fields found for the provided Criterion target \'some_hopefully_unknown_field\''); @@ -1573,7 +1574,7 @@ public function testInvalidFieldIdentifierRange() [ 'filter' => new Criterion\Field( 'some_hopefully_unknown_field', - Criterion\Operator::BETWEEN, + Operator::BETWEEN, [10, 1000] ), 'sortClauses' => [new SortClause\ContentId()], @@ -1582,7 +1583,7 @@ public function testInvalidFieldIdentifierRange() ); } - public function testInvalidFieldIdentifierIn() + public function testInvalidFieldIdentifierIn(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$criterion->target\' is invalid: No searchable Fields found for the provided Criterion target \'some_hopefully_unknown_field\''); @@ -1595,7 +1596,7 @@ public function testInvalidFieldIdentifierIn() [ 'filter' => new Criterion\Field( 'some_hopefully_unknown_field', - Criterion\Operator::EQ, + Operator::EQ, 1000 ), 'sortClauses' => [new SortClause\ContentId()], @@ -1604,7 +1605,7 @@ public function testInvalidFieldIdentifierIn() ); } - public function testFindContentWithNonSearchableField() + public function testFindContentWithNonSearchableField(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$criterion->target\' is invalid: No searchable Fields found for the provided Criterion target \'tag_cloud_url\''); @@ -1617,7 +1618,7 @@ public function testFindContentWithNonSearchableField() [ 'filter' => new Criterion\Field( 'tag_cloud_url', - Criterion\Operator::EQ, + Operator::EQ, 'http://nimbus.com' ), 'sortClauses' => [new SortClause\ContentId()], @@ -1626,7 +1627,7 @@ public function testFindContentWithNonSearchableField() ); } - public function testSortFieldWithNonSearchableField() + public function testSortFieldWithNonSearchableField(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$sortClause->targetData\' is invalid: No searchable Fields found for the provided Sort Clause target \'title\' on \'template_look\''); @@ -1643,7 +1644,7 @@ public function testSortFieldWithNonSearchableField() ); } - public function testSortMapLocationDistanceWithNonSearchableField() + public function testSortMapLocationDistanceWithNonSearchableField(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$sortClause->targetData\' is invalid: No searchable Fields found for the provided Sort Clause target \'title\' on \'template_look\''); @@ -1667,7 +1668,7 @@ public function testSortMapLocationDistanceWithNonSearchableField() ); } - public function testFindSingleFailMultiple() + public function testFindSingleFailMultiple(): void { $this->expectException(InvalidArgumentException::class); @@ -1681,7 +1682,7 @@ public function testFindSingleFailMultiple() ); } - public function testFindSingleWithNonSearchableField() + public function testFindSingleWithNonSearchableField(): void { $this->expectException(InvalidArgumentException::class); @@ -1691,7 +1692,7 @@ public function testFindSingleWithNonSearchableField() $searchService->findSingle( new Criterion\Field( 'tag_cloud_url', - Criterion\Operator::EQ, + Operator::EQ, 'http://nimbus.com' ) ); @@ -1868,7 +1869,7 @@ static function (SearchHit $a, SearchHit $b): int { } } - public function getSortedLocationSearches() + public function getSortedLocationSearches(): array { $fixtureDir = $this->getFixtureDir(); @@ -1891,7 +1892,7 @@ public function getSortedLocationSearches() ], $fixtureDir . 'SortLocationDepth.php', // Result having the same sort level should be sorted between them to be system independent - static function (&$data) { + static function (&$data): void { // Result with ids: // 4 has depth = 1 // 11, 12, 13, 42, 59 have depth = 2 @@ -1992,11 +1993,11 @@ protected function createTestContentType() * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content */ protected function createMultilingualContent( - $contentType, + ContentType $contentType, $fieldValue11 = null, $fieldValue12 = null, $fieldValue2 = null, - $mainLanguageCode = 'eng-GB', + ?string $mainLanguageCode = 'eng-GB', $alwaysAvailable = false ) { $repository = $this->getRepository(); @@ -2022,7 +2023,7 @@ protected function createMultilingualContent( return $content; } - public function providerForTestMultilingualFieldSort() + public function providerForTestMultilingualFieldSort(): array { return [ 0 => [ @@ -2342,10 +2343,10 @@ public function providerForTestMultilingualFieldSort() */ public function testMultilingualFieldSortContent( array $contentDataList, - $languageSettings, + array $languageSettings, array $sortClauses, - $expected - ) { + array $expected + ): void { $this->assertMultilingualFieldSort( $contentDataList, $languageSettings, @@ -2368,10 +2369,10 @@ public function testMultilingualFieldSortContent( */ public function testMultilingualFieldSortLocation( array $contentDataList, - $languageSettings, + array $languageSettings, array $sortClauses, - $expected - ) { + array $expected + ): void { $this->assertMultilingualFieldSort( $contentDataList, $languageSettings, @@ -2390,7 +2391,7 @@ public function testMultilingualFieldSortLocation( */ protected function assertMultilingualFieldSort( array $contentDataList, - $languageSettings, + array $languageSettings, array $sortClauses, $expected, $contentSearch = true @@ -2459,7 +2460,7 @@ protected function assertMultilingualFieldSort( self::assertEquals($expectedIdList, $this->mapResultContentIds($result)); } - public function providerForTestMultilingualFieldFilter() + public function providerForTestMultilingualFieldFilter(): array { return [ 0 => [ @@ -2475,7 +2476,7 @@ public function providerForTestMultilingualFieldFilter() 'ger-DE', ], ], - new Criterion\Field('integer', Criterion\Operator::LT, 5), + new Criterion\Field('integer', Operator::LT, 5), /** * Expected order, Value eng-GB, Value ger-DE. * @@ -2493,7 +2494,7 @@ public function providerForTestMultilingualFieldFilter() ], 'useAlwaysAvailable' => false, ], - new Criterion\Field('integer', Criterion\Operator::LT, 2), + new Criterion\Field('integer', Operator::LT, 2), /** * Expected order, Value eng-GB, Value ger-DE. * @@ -2508,7 +2509,7 @@ public function providerForTestMultilingualFieldFilter() 'eng-GB', ], ], - new Criterion\Field('integer', Criterion\Operator::LTE, 4), + new Criterion\Field('integer', Operator::LTE, 4), /** * Expected order, Value eng-GB, Value ger-DE. * @@ -2527,7 +2528,7 @@ public function providerForTestMultilingualFieldFilter() ], 'useAlwaysAvailable' => false, ], - new Criterion\Field('integer', Criterion\Operator::LTE, 4), + new Criterion\Field('integer', Operator::LTE, 4), /** * Expected order, Value eng-GB, Value ger-DE. * @@ -2539,7 +2540,7 @@ public function providerForTestMultilingualFieldFilter() 4 => [ $fixture, $languageSettings, - new Criterion\Field('integer', Criterion\Operator::LTE, 4), + new Criterion\Field('integer', Operator::LTE, 4), /** * Expected order, Value eng-GB, Value ger-DE. * @@ -2552,7 +2553,7 @@ public function providerForTestMultilingualFieldFilter() 5 => [ $fixture, $languageSettings, - new Criterion\Field('integer', Criterion\Operator::GT, 1), + new Criterion\Field('integer', Operator::GT, 1), /** * Expected order, Value eng-GB, Value ger-DE. * @@ -2565,7 +2566,7 @@ public function providerForTestMultilingualFieldFilter() 6 => [ $fixture, $languageSettings, - new Criterion\Field('integer', Criterion\Operator::GTE, 2), + new Criterion\Field('integer', Operator::GTE, 2), /** * Expected order, Value eng-GB, Value ger-DE. * @@ -2578,7 +2579,7 @@ public function providerForTestMultilingualFieldFilter() 7 => [ $fixture, $languageSettings, - new Criterion\Field('integer', Criterion\Operator::BETWEEN, [2, 4]), + new Criterion\Field('integer', Operator::BETWEEN, [2, 4]), /** * Expected order, Value eng-GB, Value ger-DE. * @@ -2590,13 +2591,13 @@ public function providerForTestMultilingualFieldFilter() 8 => [ $fixture, $languageSettings, - new Criterion\Field('integer', Criterion\Operator::BETWEEN, [4, 2]), + new Criterion\Field('integer', Operator::BETWEEN, [4, 2]), [], ], 9 => [ $fixture, $languageSettings, - new Criterion\Field('integer', Criterion\Operator::EQ, 4), + new Criterion\Field('integer', Operator::EQ, 4), /** * Expected order, Value eng-GB, Value ger-DE. * @@ -2607,7 +2608,7 @@ public function providerForTestMultilingualFieldFilter() 10 => [ $fixture, $languageSettings, - new Criterion\Field('integer', Criterion\Operator::EQ, 2), + new Criterion\Field('integer', Operator::EQ, 2), /** * Expected order, Value eng-GB, Value ger-DE. * @@ -2632,10 +2633,10 @@ public function providerForTestMultilingualFieldFilter() */ public function testMultilingualFieldFilterContent( array $contentDataList, - $languageSettings, + array $languageSettings, Criterion $criterion, - $expected - ) { + array $expected + ): void { $this->assertMultilingualFieldFilter( $contentDataList, $languageSettings, @@ -2658,10 +2659,10 @@ public function testMultilingualFieldFilterContent( */ public function testMultilingualFieldFilterLocation( array $contentDataList, - $languageSettings, + array $languageSettings, Criterion $criterion, - $expected - ) { + array $expected + ): void { $this->assertMultilingualFieldFilter( $contentDataList, $languageSettings, @@ -2680,7 +2681,7 @@ public function testMultilingualFieldFilterLocation( */ protected function assertMultilingualFieldFilter( array $contentDataList, - $languageSettings, + array $languageSettings, Criterion $criterion, $expected, $contentSearch = true @@ -2780,7 +2781,7 @@ static function (SearchHit $searchHit) { * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testFindAndSortContent($queryData, $fixture, $closure = null) + public function testFindAndSortContent(array $queryData, string $fixture, \Closure $closure = null): void { $query = new Query($queryData); $this->assertQueryFixture($query, $fixture, $closure); @@ -2793,7 +2794,7 @@ public function testFindAndSortContent($queryData, $fixture, $closure = null) * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContentInfo() */ - public function testFindAndSortContentInfo($queryData, $fixture, $closure = null) + public function testFindAndSortContentInfo(array $queryData, string $fixture, \Closure $closure = null): void { $query = new Query($queryData); $this->assertQueryFixture($query, $fixture, $this->getContentInfoFixtureClosure($closure), true); @@ -2806,7 +2807,7 @@ public function testFindAndSortContentInfo($queryData, $fixture, $closure = null * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testFindAndSortContentLocations($queryData, $fixture, $closure = null) + public function testFindAndSortContentLocations(array $queryData, string $fixture, \Closure $closure = null): void { $query = new LocationQuery($queryData); $this->assertQueryFixture($query, $fixture, $closure); @@ -2819,7 +2820,7 @@ public function testFindAndSortContentLocations($queryData, $fixture, $closure = * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testFindAndSortLocations($queryData, $fixture, $closure = null) + public function testFindAndSortLocations(array $queryData, string $fixture, \Closure $closure = null): void { $query = new LocationQuery($queryData); $this->assertQueryFixture($query, $fixture, $closure); @@ -2830,13 +2831,13 @@ public function testFindAndSortLocations($queryData, $fixture, $closure = null) * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testQueryCustomField() + public function testQueryCustomField(): void { $query = new Query( [ 'query' => new Criterion\CustomField( 'custom_field', - Criterion\Operator::EQ, + Operator::EQ, 'AdMiNiStRaToR' ), 'offset' => 0, @@ -2859,7 +2860,7 @@ public function testQueryCustomField() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testQueryModifiedField() + public function testQueryModifiedField(): void { // Check using get_class since the others extend SetupFactory\Legacy if ($this->getSetupFactory() instanceof Legacy) { @@ -2873,7 +2874,7 @@ public function testQueryModifiedField() [ 'query' => new Criterion\Field( 'first_name', - Criterion\Operator::EQ, + Operator::EQ, 'User' ), 'offset' => 0, @@ -2900,7 +2901,7 @@ public function testQueryModifiedField() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testSortModifiedField() + public function testSortModifiedField(): void { // Check using get_class since the others extend SetupFactory\Legacy if ($this->getSetupFactory() instanceof Legacy) { @@ -2969,7 +2970,7 @@ protected function createTestPlaceContentType() * * @group maplocation */ - public function testMapLocationDistanceLessThanOrEqual() + public function testMapLocationDistanceLessThanOrEqual(): void { $contentType = $this->createTestPlaceContentType(); @@ -3020,7 +3021,7 @@ public function testMapLocationDistanceLessThanOrEqual() new Criterion\ContentTypeId($contentType->id), new Criterion\MapLocationDistance( 'maplocation', - Criterion\Operator::LTE, + Operator::LTE, 240, 43.756825, 15.775074 @@ -3050,7 +3051,7 @@ public function testMapLocationDistanceLessThanOrEqual() * * @group maplocation */ - public function testMapLocationDistanceGreaterThanOrEqual() + public function testMapLocationDistanceGreaterThanOrEqual(): void { $contentType = $this->createTestPlaceContentType(); @@ -3101,7 +3102,7 @@ public function testMapLocationDistanceGreaterThanOrEqual() new Criterion\ContentTypeId($contentType->id), new Criterion\MapLocationDistance( 'maplocation', - Criterion\Operator::GTE, + Operator::GTE, 240, 43.756825, 15.775074 @@ -3131,7 +3132,7 @@ public function testMapLocationDistanceGreaterThanOrEqual() * * @group maplocation */ - public function testMapLocationDistanceBetween() + public function testMapLocationDistanceBetween(): void { $contentType = $this->createTestPlaceContentType(); @@ -3198,7 +3199,7 @@ public function testMapLocationDistanceBetween() new Criterion\ContentTypeId($contentType->id), new Criterion\MapLocationDistance( 'maplocation', - Criterion\Operator::BETWEEN, + Operator::BETWEEN, [239, 241], 43.756825, 15.775074 @@ -3236,7 +3237,7 @@ public function testMapLocationDistanceBetween() * * @group maplocation */ - public function testMapLocationDistanceBetweenPolar() + public function testMapLocationDistanceBetweenPolar(): void { $contentType = $this->createTestPlaceContentType(); @@ -3271,7 +3272,7 @@ public function testMapLocationDistanceBetweenPolar() new Criterion\ContentTypeId($contentType->id), new Criterion\MapLocationDistance( 'maplocation', - Criterion\Operator::BETWEEN, + Operator::BETWEEN, [221, 350], 89, 16 @@ -3301,7 +3302,7 @@ public function testMapLocationDistanceBetweenPolar() * * @group maplocation */ - public function testMapLocationDistanceSortAscending() + public function testMapLocationDistanceSortAscending(): void { $contentType = $this->createTestPlaceContentType(); @@ -3373,7 +3374,7 @@ public function testMapLocationDistanceSortAscending() new Criterion\ContentTypeId($contentType->id), new Criterion\MapLocationDistance( 'maplocation', - Criterion\Operator::GTE, + Operator::GTE, 235, $wellInVodice['latitude'], $wellInVodice['longitude'] @@ -3419,7 +3420,7 @@ public function testMapLocationDistanceSortAscending() * * @group maplocation */ - public function testMapLocationDistanceSortDescending() + public function testMapLocationDistanceSortDescending(): void { $contentType = $this->createTestPlaceContentType(); @@ -3491,7 +3492,7 @@ public function testMapLocationDistanceSortDescending() new Criterion\ContentTypeId($contentType->id), new Criterion\MapLocationDistance( 'maplocation', - Criterion\Operator::GTE, + Operator::GTE, 235, $well['latitude'], $well['longitude'] @@ -3537,7 +3538,7 @@ public function testMapLocationDistanceSortDescending() * * @group maplocation */ - public function testMapLocationDistanceWithCustomField() + public function testMapLocationDistanceWithCustomField(): void { $contentType = $this->createTestPlaceContentType(); @@ -3583,7 +3584,7 @@ public function testMapLocationDistanceWithCustomField() $distanceCriterion = new Criterion\MapLocationDistance( 'maplocation', - Criterion\Operator::LTE, + Operator::LTE, 240, 43.756825, 15.775074 @@ -3621,7 +3622,7 @@ public function testMapLocationDistanceWithCustomField() * * @group maplocation */ - public function testMapLocationDistanceWithCustomFieldSort() + public function testMapLocationDistanceWithCustomFieldSort(): void { $contentType = $this->createTestPlaceContentType(); @@ -3702,7 +3703,7 @@ public function testMapLocationDistanceWithCustomFieldSort() new Criterion\ContentTypeId($contentType->id), new Criterion\MapLocationDistance( 'maplocation', - Criterion\Operator::GTE, + Operator::GTE, 235, $well['latitude'], $well['longitude'] @@ -3740,7 +3741,7 @@ public function testMapLocationDistanceWithCustomFieldSort() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testFindMainLocation() + public function testFindMainLocation(): void { $plainSiteLocationId = 56; $designLocationId = 58; @@ -3785,7 +3786,7 @@ public function testFindMainLocation() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testFindNonMainLocation() + public function testFindNonMainLocation(): void { $designLocationId = 58; $partnersContentId = 59; @@ -3829,7 +3830,7 @@ public function testFindNonMainLocation() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testSortMainLocationAscending() + public function testSortMainLocationAscending(): void { $plainSiteLocationId = 56; $designLocationId = 58; @@ -3872,7 +3873,7 @@ public function testSortMainLocationAscending() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testSortMainLocationDescending() + public function testSortMainLocationDescending(): void { $plainSiteLocationId = 56; $designLocationId = 58; @@ -3915,7 +3916,7 @@ public function testSortMainLocationDescending() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testContentWithMultipleLocations() + public function testContentWithMultipleLocations(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -4018,7 +4019,7 @@ protected function createContentForTestUserMetadataGroupHorizontal() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testUserMetadataGroupHorizontalFilterContent(string $queryType = null) + public function testUserMetadataGroupHorizontalFilterContent(string $queryType = null): void { if ($queryType === null) { $queryType = 'filter'; @@ -4041,7 +4042,7 @@ public function testUserMetadataGroupHorizontalFilterContent(string $queryType = $criteria[] = new Criterion\UserMetadata( Criterion\UserMetadata::GROUP, - Criterion\Operator::EQ, + Operator::EQ, $editorsUserGroupId ); @@ -4097,7 +4098,7 @@ public function testUserMetadataGroupHorizontalFilterContent(string $queryType = * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testUserMetadataGroupHorizontalQueryContent() + public function testUserMetadataGroupHorizontalQueryContent(): void { $this->testUserMetadataGroupHorizontalFilterContent('query'); } @@ -4107,7 +4108,7 @@ public function testUserMetadataGroupHorizontalQueryContent() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testUserMetadataGroupHorizontalFilterLocation($queryType = null) + public function testUserMetadataGroupHorizontalFilterLocation($queryType = null): void { if ($queryType === null) { $queryType = 'filter'; @@ -4131,7 +4132,7 @@ public function testUserMetadataGroupHorizontalFilterLocation($queryType = null) $criteria[] = new Criterion\UserMetadata( Criterion\UserMetadata::GROUP, - Criterion\Operator::EQ, + Operator::EQ, $editorsUserGroupId ); @@ -4198,7 +4199,7 @@ public function testUserMetadataGroupHorizontalFilterLocation($queryType = null) * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations() */ - public function testUserMetadataGroupHorizontalQueryLocation() + public function testUserMetadataGroupHorizontalQueryLocation(): void { $this->testUserMetadataGroupHorizontalFilterLocation('query'); } @@ -4208,7 +4209,7 @@ public function testUserMetadataGroupHorizontalQueryLocation() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testFullTextOnNewContent() + public function testFullTextOnNewContent(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -4249,7 +4250,7 @@ public function testFullTextOnNewContent() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testLanguageAnalysisSeparateContent() + public function testLanguageAnalysisSeparateContent(): void { self::markTestSkipped('Language analysis is currently not supported'); @@ -4313,7 +4314,7 @@ public function testLanguageAnalysisSeparateContent() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testLanguageAnalysisSameContent() + public function testLanguageAnalysisSameContent(): void { self::markTestSkipped('Language analysis is currently not supported'); @@ -4363,7 +4364,7 @@ public function testLanguageAnalysisSameContent() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testLanguageAnalysisSameContentNotFound() + public function testLanguageAnalysisSameContentNotFound(): void { self::markTestSkipped('Language analysis is currently not supported'); @@ -4414,7 +4415,7 @@ public function testLanguageAnalysisSameContentNotFound() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent */ - public function testFindContentWithLanguageFilter() + public function testFindContentWithLanguageFilter(): void { $repository = $this->getRepository(); $searchService = $repository->getSearchService(); @@ -4456,7 +4457,7 @@ public function testFindContentWithLanguageFilter() * * @return array */ - public function testFulltextComplex() + public function testFulltextComplex(): array { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -4528,7 +4529,7 @@ public function testFulltextComplex() * * @param array $data */ - public function testFulltextContentSearchComplex(array $data) + public function testFulltextContentSearchComplex(array $data): void { // Do not initialize from scratch $repository = $this->getRepository(false); @@ -4574,7 +4575,7 @@ public function testFulltextContentSearchComplex(array $data) * * @param array $data */ - public function testFulltextContentTranslationSearch(array $data) + public function testFulltextContentTranslationSearch(array $data): void { $criterion = $data[0]; $query = new Query(['query' => $criterion]); @@ -4591,7 +4592,7 @@ public function testFulltextContentTranslationSearch(array $data) * * @param array $data */ - public function testFulltextLocationSearchComplex(array $data) + public function testFulltextLocationSearchComplex(array $data): void { $setupFactory = $this->getSetupFactory(); if ($setupFactory instanceof LegacySolrSetupFactory && getenv('SOLR_VERSION') === '4.10.4') { @@ -4859,7 +4860,7 @@ protected function getFixtureDir(): string private function getContentInfoFixtureClosure($closure = null) { /** @var $data \Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult */ - return static function (&$data) use ($closure) { + return static function (&$data) use ($closure): void { foreach ($data->searchHits as $searchHit) { if ($searchHit->valueObject instanceof Content) { $searchHit->valueObject = $searchHit->valueObject->getVersionInfo()->getContentInfo(); @@ -4879,7 +4880,7 @@ private function getContentInfoFixtureClosure($closure = null) * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent() */ - public function testFieldCriterionForContentsWithIdenticalFieldIdentifiers() + public function testFieldCriterionForContentsWithIdenticalFieldIdentifiers(): void { $this->createContentWithFieldType( 'url', @@ -4895,7 +4896,7 @@ public function testFieldCriterionForContentsWithIdenticalFieldIdentifiers() [ 'query' => new Criterion\Field( 'title', - Criterion\Operator::EQ, + Operator::EQ, 'foo' ), ] @@ -4962,7 +4963,7 @@ private function createContentWithFieldType( * * @dataProvider getSeedsForRandomSortClause */ - public function testRandomSortContent(?int $firstSeed, ?int $secondSeed) + public function testRandomSortContent(?int $firstSeed, ?int $secondSeed): void { if ($firstSeed || $secondSeed) { $this->skipIfSeedNotImplemented(); @@ -5008,7 +5009,7 @@ public function testRandomSortContent(?int $firstSeed, ?int $secondSeed) * * @dataProvider getSeedsForRandomSortClause */ - public function testRandomSortLocation(?int $firstSeed, ?int $secondSeed) + public function testRandomSortLocation(?int $firstSeed, ?int $secondSeed): void { if ($firstSeed || $secondSeed) { $this->skipIfSeedNotImplemented(); @@ -5047,7 +5048,7 @@ public function testRandomSortLocation(?int $firstSeed, ?int $secondSeed) } } - public function getSeedsForRandomSortClause() + public function getSeedsForRandomSortClause(): array { $randomSeed = mt_rand(); @@ -5067,7 +5068,7 @@ public function getSeedsForRandomSortClause() ]; } - private function skipIfSeedNotImplemented() + private function skipIfSeedNotImplemented(): void { /** @var \Ibexa\Contracts\Core\Test\Repository\SetupFactory\Legacy $setupFactory */ $setupFactory = $this->getSetupFactory(); diff --git a/tests/integration/Core/Repository/SearchServiceTranslationLanguageFallbackTest.php b/tests/integration/Core/Repository/SearchServiceTranslationLanguageFallbackTest.php index 09c200b469..213d402ff3 100644 --- a/tests/integration/Core/Repository/SearchServiceTranslationLanguageFallbackTest.php +++ b/tests/integration/Core/Repository/SearchServiceTranslationLanguageFallbackTest.php @@ -13,6 +13,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Tests\Solr\SetupFactory\LegacySetupFactory as LegacySolrSetupFactory; use RuntimeException; @@ -87,13 +88,13 @@ protected function createTestContentType() * @return mixed */ protected function createContent( - $contentType, + ContentType $contentType, array $searchValuesMap, - $mainLanguageCode, + ?string $mainLanguageCode, $alwaysAvailable, $sortValue, array $parentLocationIds - ) { + ): array { $repository = $this->getRepository(); $contentService = $repository->getContentService(); $locationService = $repository->getLocationService(); @@ -128,7 +129,7 @@ protected function createContent( * * @return array */ - public function createTestContent(array $parentLocationIds) + public function createTestContent(array $parentLocationIds): array { $repository = $this->getRepository(); $languageService = $repository->getContentLanguageService(); @@ -194,7 +195,10 @@ public function testCreateTestContent() return $this->createTestContent([2, 12]); } - public function providerForTestFind() + /** + * @return mixed[] + */ + public function providerForTestFind(): array { $data = [ 0 => [ @@ -1679,7 +1683,7 @@ public function providerForTestFind() return $data; } - protected function getSetupType() + protected function getSetupType(): string { if (getenv('SOLR_CLOUD')) { return self::SETUP_CLOUD; @@ -1729,7 +1733,7 @@ public function testFindContent( array $languageSettings, array $contentDataList, array $context - ) { + ): void { /** @var \Ibexa\Contracts\Core\Repository\Repository $repository */ list($repository, $data) = $context; @@ -1779,7 +1783,7 @@ public function testFindLocationsSingle( array $languageSettings, array $contentDataList, array $context - ) { + ): void { /** @var \Ibexa\Contracts\Core\Repository\Repository $repository */ list($repository, $data) = $context; @@ -1834,7 +1838,7 @@ public function testFindLocationsMultiple( array $languageSettings, array $contentDataList, array $context - ) { + ): void { /** @var \Ibexa\Contracts\Core\Repository\Repository $repository */ list($repository, $data) = $context; diff --git a/tests/integration/Core/Repository/SectionServiceAuthorizationTest.php b/tests/integration/Core/Repository/SectionServiceAuthorizationTest.php index 7acdc8cea0..1a0a590c85 100644 --- a/tests/integration/Core/Repository/SectionServiceAuthorizationTest.php +++ b/tests/integration/Core/Repository/SectionServiceAuthorizationTest.php @@ -25,7 +25,7 @@ class SectionServiceAuthorizationTest extends BaseTest * * @covers \Ibexa\Contracts\Core\Repository\SectionService::createSection() */ - public function testCreateSectionThrowsUnauthorizedException() + public function testCreateSectionThrowsUnauthorizedException(): void { $repository = $this->getRepository(); @@ -55,7 +55,7 @@ public function testCreateSectionThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\SectionService::loadSection() */ - public function testLoadSectionThrowsUnauthorizedException() + public function testLoadSectionThrowsUnauthorizedException(): void { $repository = $this->getRepository(); @@ -87,7 +87,7 @@ public function testLoadSectionThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\SectionService::updateSection() */ - public function testUpdateSectionThrowsUnauthorizedException() + public function testUpdateSectionThrowsUnauthorizedException(): void { $repository = $this->getRepository(); @@ -123,7 +123,7 @@ public function testUpdateSectionThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\SectionService::loadSections() */ - public function testLoadSectionsLoadsEmptyListForAnonymousUser() + public function testLoadSectionsLoadsEmptyListForAnonymousUser(): void { $repository = $this->getRepository(); @@ -160,7 +160,7 @@ public function testLoadSectionsLoadsEmptyListForAnonymousUser() * * @covers \Ibexa\Contracts\Core\Repository\SectionService::loadSections() */ - public function testLoadSectionFiltersSections() + public function testLoadSectionFiltersSections(): void { $repository = $this->getRepository(); @@ -205,7 +205,7 @@ public function testLoadSectionFiltersSections() * * @covers \Ibexa\Contracts\Core\Repository\SectionService::loadSectionByIdentifier() */ - public function testLoadSectionByIdentifierThrowsUnauthorizedException() + public function testLoadSectionByIdentifierThrowsUnauthorizedException(): void { $repository = $this->getRepository(); @@ -237,7 +237,7 @@ public function testLoadSectionByIdentifierThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\SectionService::assignSection() */ - public function testAssignSectionThrowsUnauthorizedException() + public function testAssignSectionThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -279,7 +279,7 @@ public function testAssignSectionThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\SectionService::deleteSection() */ - public function testDeleteSectionThrowsUnauthorizedException() + public function testDeleteSectionThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/SectionServiceTest.php b/tests/integration/Core/Repository/SectionServiceTest.php index 61d11265cf..83d302bb4d 100644 --- a/tests/integration/Core/Repository/SectionServiceTest.php +++ b/tests/integration/Core/Repository/SectionServiceTest.php @@ -77,7 +77,7 @@ protected function setUp(): void * * @covers \Ibexa\Contracts\Core\Repository\SectionService::newSectionCreateStruct() */ - public function testNewSectionCreateStruct() + public function testNewSectionCreateStruct(): void { $repository = $this->getRepository(); @@ -97,7 +97,7 @@ public function testNewSectionCreateStruct() * * @depends testNewSectionCreateStruct */ - public function testCreateSection() + public function testCreateSection(): void { $repository = $this->getRepository(); @@ -121,7 +121,7 @@ public function testCreateSection() * * @depends testNewSectionCreateStruct */ - public function testCreateSectionForUserWithSectionLimitation() + public function testCreateSectionForUserWithSectionLimitation(): void { $repository = $this->getRepository(); @@ -160,7 +160,7 @@ public function testCreateSectionForUserWithSectionLimitation() * * @depends testCreateSection */ - public function testCreateSectionThrowsInvalidArgumentException() + public function testCreateSectionThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -191,7 +191,7 @@ public function testCreateSectionThrowsInvalidArgumentException() * * @depends testCreateSection */ - public function testLoadSection() + public function testLoadSection(): void { $repository = $this->getRepository(); @@ -212,7 +212,7 @@ public function testLoadSection() * * @covers \Ibexa\Contracts\Core\Repository\SectionService::loadSection() */ - public function testLoadSectionThrowsNotFoundException() + public function testLoadSectionThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -233,7 +233,7 @@ public function testLoadSectionThrowsNotFoundException() * * @covers \Ibexa\Contracts\Core\Repository\SectionService::newSectionUpdateStruct() */ - public function testNewSectionUpdateStruct() + public function testNewSectionUpdateStruct(): void { $repository = $this->getRepository(); @@ -255,7 +255,7 @@ public function testNewSectionUpdateStruct() * @depends testLoadSection * @depends testNewSectionUpdateStruct */ - public function testUpdateSection() + public function testUpdateSection(): void { $repository = $this->getRepository(); @@ -293,7 +293,7 @@ public function testUpdateSection() * @depends testLoadSection * @depends testNewSectionUpdateStruct */ - public function testUpdateSectionForUserWithSectionLimitation() + public function testUpdateSectionForUserWithSectionLimitation(): void { $repository = $this->getRepository(); $administratorUserId = $this->generateId('user', 14); @@ -349,7 +349,7 @@ public function testUpdateSectionForUserWithSectionLimitation() * * @depends testUpdateSection */ - public function testUpdateSectionKeepsSectionIdentifierOnNameUpdate() + public function testUpdateSectionKeepsSectionIdentifierOnNameUpdate(): void { $repository = $this->getRepository(); @@ -377,7 +377,7 @@ public function testUpdateSectionKeepsSectionIdentifierOnNameUpdate() * * @depends testUpdateSection */ - public function testUpdateSectionWithSectionIdentifierOnNameUpdate() + public function testUpdateSectionWithSectionIdentifierOnNameUpdate(): void { $repository = $this->getRepository(); @@ -408,7 +408,7 @@ public function testUpdateSectionWithSectionIdentifierOnNameUpdate() * * @depends testUpdateSection */ - public function testUpdateSectionKeepsSectionNameOnIdentifierUpdate() + public function testUpdateSectionKeepsSectionNameOnIdentifierUpdate(): void { $repository = $this->getRepository(); @@ -437,7 +437,7 @@ public function testUpdateSectionKeepsSectionNameOnIdentifierUpdate() * * @depends testUpdateSection */ - public function testUpdateSectionThrowsInvalidArgumentException() + public function testUpdateSectionThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -475,7 +475,7 @@ public function testUpdateSectionThrowsInvalidArgumentException() * * @depends testCreateSection */ - public function testLoadSections() + public function testLoadSections(): void { $repository = $this->getRepository(); @@ -498,7 +498,7 @@ public function testLoadSections() * * @depends testCreateSection */ - public function testLoadSectionsReturnsDefaultSectionsByDefault() + public function testLoadSectionsReturnsDefaultSectionsByDefault(): void { $repository = $this->getRepository(); @@ -560,7 +560,7 @@ public function testLoadSectionsReturnsDefaultSectionsByDefault() * * @depends testCreateSection */ - public function testLoadSectionByIdentifier() + public function testLoadSectionByIdentifier(): void { $repository = $this->getRepository(); @@ -584,7 +584,7 @@ public function testLoadSectionByIdentifier() * * @covers \Ibexa\Contracts\Core\Repository\SectionService::loadSectionByIdentifier() */ - public function testLoadSectionByIdentifierThrowsNotFoundException() + public function testLoadSectionByIdentifierThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -603,7 +603,7 @@ public function testLoadSectionByIdentifierThrowsNotFoundException() * * @covers \Ibexa\Contracts\Core\Repository\SectionService::countAssignedContents() */ - public function testCountAssignedContents() + public function testCountAssignedContents(): void { $repository = $this->getRepository(); @@ -632,7 +632,7 @@ public function testCountAssignedContents() * * @covers \Ibexa\Contracts\Core\Repository\SectionService::isSectionUsed() */ - public function testIsSectionUsed() + public function testIsSectionUsed(): void { $repository = $this->getRepository(); @@ -663,7 +663,7 @@ public function testIsSectionUsed() * * @depends testCountAssignedContents */ - public function testAssignSection() + public function testAssignSection(): void { $repository = $this->getRepository(); $sectionService = $repository->getSectionService(); @@ -721,7 +721,7 @@ public function testAssignSection() * * @depends testCreateSection */ - public function testAssignSectionToSubtree() + public function testAssignSectionToSubtree(): void { $repository = $this->getRepository(); $sectionService = $repository->getSectionService(); @@ -774,7 +774,7 @@ public function testAssignSectionToSubtree() * * @depends testCreateSection */ - public function testCountAssignedContentsReturnsZeroByDefault() + public function testCountAssignedContentsReturnsZeroByDefault(): void { $repository = $this->getRepository(); @@ -801,7 +801,7 @@ public function testCountAssignedContentsReturnsZeroByDefault() * * @depends testCreateSection */ - public function testIsSectionUsedReturnsZeroByDefault() + public function testIsSectionUsedReturnsZeroByDefault(): void { $repository = $this->getRepository(); @@ -828,7 +828,7 @@ public function testIsSectionUsedReturnsZeroByDefault() * * @depends testLoadSections */ - public function testDeleteSection() + public function testDeleteSection(): void { $repository = $this->getRepository(); @@ -855,7 +855,7 @@ public function testDeleteSection() * * @depends testDeleteSection */ - public function testDeleteSectionThrowsNotFoundException() + public function testDeleteSectionThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -885,7 +885,7 @@ public function testDeleteSectionThrowsNotFoundException() * * @depends testAssignSection */ - public function testDeleteSectionThrowsBadStateException() + public function testDeleteSectionThrowsBadStateException(): void { $this->expectException(BadStateException::class); @@ -924,7 +924,7 @@ public function testDeleteSectionThrowsBadStateException() * @depends testCreateSection * @depends testLoadSectionByIdentifier */ - public function testCreateSectionInTransactionWithRollback() + public function testCreateSectionInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -970,7 +970,7 @@ public function testCreateSectionInTransactionWithRollback() * @depends testCreateSection * @depends testLoadSectionByIdentifier */ - public function testCreateSectionInTransactionWithCommit() + public function testCreateSectionInTransactionWithCommit(): void { $repository = $this->getRepository(); @@ -1012,7 +1012,7 @@ public function testCreateSectionInTransactionWithCommit() * @depends testUpdateSection * @depends testLoadSectionByIdentifier */ - public function testUpdateSectionInTransactionWithRollback() + public function testUpdateSectionInTransactionWithRollback(): void { $repository = $this->getRepository(); @@ -1056,7 +1056,7 @@ public function testUpdateSectionInTransactionWithRollback() * @depends testUpdateSection * @depends testLoadSectionByIdentifier */ - public function testUpdateSectionInTransactionWithCommit() + public function testUpdateSectionInTransactionWithCommit(): void { $repository = $this->getRepository(); diff --git a/tests/integration/Core/Repository/SettingServiceTest.php b/tests/integration/Core/Repository/SettingServiceTest.php index 30bd6c6ed8..f51b2899a8 100644 --- a/tests/integration/Core/Repository/SettingServiceTest.php +++ b/tests/integration/Core/Repository/SettingServiceTest.php @@ -51,7 +51,7 @@ protected function setUp(): void * * @dataProvider dataProviderForCreateSetting */ - public function testCreateSetting(string $identifier, $value): void + public function testCreateSetting(string $identifier, bool|string|int|float|array|null $value): void { $settingService = $this->getSettingService(); diff --git a/tests/integration/Core/Repository/TrashServiceAuthorizationTest.php b/tests/integration/Core/Repository/TrashServiceAuthorizationTest.php index 7767645d89..e0c83de069 100644 --- a/tests/integration/Core/Repository/TrashServiceAuthorizationTest.php +++ b/tests/integration/Core/Repository/TrashServiceAuthorizationTest.php @@ -31,7 +31,7 @@ class TrashServiceAuthorizationTest extends BaseTrashServiceTest * @depends Ibexa\Tests\Integration\Core\Repository\TrashServiceTest::testLoadTrashItem * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testLoadUser */ - public function testLoadTrashItemThrowsUnauthorizedException() + public function testLoadTrashItemThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -60,7 +60,7 @@ public function testLoadTrashItemThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\TrashService::trash */ - public function testTrashThrowsUnauthorizedException() + public function testTrashThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); $this->expectExceptionMessage('The User does not have the \'remove\' \'content\' permission'); @@ -123,7 +123,7 @@ public function testTrashThrowsUnauthorizedExceptionWithLanguageLimitation(): vo * * @covers \Ibexa\Contracts\Core\Repository\TrashService::trash */ - public function testTrashRequiresContentRemovePolicy() + public function testTrashRequiresContentRemovePolicy(): void { $repository = $this->getRepository(); $trashService = $repository->getTrashService(); @@ -153,7 +153,7 @@ public function testTrashRequiresContentRemovePolicy() * @depends Ibexa\Tests\Integration\Core\Repository\TrashServiceTest::testRecover * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testLoadUser */ - public function testRecoverThrowsUnauthorizedException() + public function testRecoverThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -185,7 +185,7 @@ public function testRecoverThrowsUnauthorizedException() * @depends Ibexa\Tests\Integration\Core\Repository\TrashServiceTest::testRecover * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testLoadUser */ - public function testRecoverThrowsUnauthorizedExceptionWithNewParentLocationParameter() + public function testRecoverThrowsUnauthorizedExceptionWithNewParentLocationParameter(): void { $this->expectException(UnauthorizedException::class); @@ -225,7 +225,7 @@ public function testRecoverThrowsUnauthorizedExceptionWithNewParentLocationParam * @depends Ibexa\Tests\Integration\Core\Repository\TrashServiceTest::testEmptyTrash * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testLoadUser */ - public function testEmptyTrashThrowsUnauthorizedException() + public function testEmptyTrashThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -257,7 +257,7 @@ public function testEmptyTrashThrowsUnauthorizedException() * @depends Ibexa\Tests\Integration\Core\Repository\TrashServiceTest::testDeleteTrashItem * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testLoadUser */ - public function testDeleteTrashItemThrowsUnauthorizedException() + public function testDeleteTrashItemThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -281,7 +281,7 @@ public function testDeleteTrashItemThrowsUnauthorizedException() /* END: Use Case */ } - public function testTrashRequiresPremissionsToRemoveAllSubitems() + public function testTrashRequiresPremissionsToRemoveAllSubitems(): void { $this->createRoleWithPolicies('Publisher', [ ['module' => 'content', 'function' => 'read'], diff --git a/tests/integration/Core/Repository/TrashServiceTest.php b/tests/integration/Core/Repository/TrashServiceTest.php index 138c43b553..9a6c79df59 100644 --- a/tests/integration/Core/Repository/TrashServiceTest.php +++ b/tests/integration/Core/Repository/TrashServiceTest.php @@ -40,7 +40,7 @@ class TrashServiceTest extends BaseTrashServiceTest * * @depends Ibexa\Tests\Integration\Core\Repository\LocationServiceTest::testLoadLocationByRemoteId */ - public function testTrash() + public function testTrash(): void { /* BEGIN: Use Case */ $trashItem = $this->createTrashItem(); @@ -57,7 +57,7 @@ public function testTrash() * * @depends testTrash */ - public function testTrashSetsExpectedTrashItemProperties() + public function testTrashSetsExpectedTrashItemProperties(): void { $repository = $this->getRepository(); @@ -90,7 +90,7 @@ public function testTrashSetsExpectedTrashItemProperties() * * @depends testTrash */ - public function testTrashRemovesLocationFromMainStorage() + public function testTrashRemovesLocationFromMainStorage(): void { $this->expectException(NotFoundException::class); @@ -115,7 +115,7 @@ public function testTrashRemovesLocationFromMainStorage() * * @depends testTrash */ - public function testTrashRemovesChildLocationsFromMainStorage() + public function testTrashRemovesChildLocationsFromMainStorage(): void { $repository = $this->getRepository(); @@ -150,7 +150,7 @@ public function testTrashRemovesChildLocationsFromMainStorage() * * @depends testTrash */ - public function testTrashDecrementsChildCountOnParentLocation() + public function testTrashDecrementsChildCountOnParentLocation(): void { $repository = $this->getRepository(); $locationService = $repository->getLocationService(); @@ -174,7 +174,7 @@ public function testTrashDecrementsChildCountOnParentLocation() /** * Test sending a location to trash updates Content mainLocation. */ - public function testTrashUpdatesMainLocation() + public function testTrashUpdatesMainLocation(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -202,7 +202,7 @@ public function testTrashUpdatesMainLocation() /** * Test sending a location to trash. */ - public function testTrashReturnsNull() + public function testTrashReturnsNull(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -225,7 +225,7 @@ public function testTrashReturnsNull() * * @depends testTrash */ - public function testLoadTrashItem() + public function testLoadTrashItem(): void { $repository = $this->getRepository(); $trashService = $repository->getTrashService(); @@ -274,7 +274,7 @@ public function testLoadTrashItem() * * @depends testLoadTrashItem */ - public function testLoadTrashItemThrowsNotFoundException() + public function testLoadTrashItemThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -295,7 +295,7 @@ public function testLoadTrashItemThrowsNotFoundException() * * @depends testTrash */ - public function testRecover() + public function testRecover(): void { $repository = $this->getRepository(); $trashService = $repository->getTrashService(); @@ -336,7 +336,7 @@ public function testRecover() /** * Test recovering a non existing trash item results in a NotFoundException. */ - public function testRecoverThrowsNotFoundExceptionForNonExistingTrashItem() + public function testRecoverThrowsNotFoundExceptionForNonExistingTrashItem(): void { $this->expectException(NotFoundException::class); @@ -357,7 +357,7 @@ public function testRecoverThrowsNotFoundExceptionForNonExistingTrashItem() * * @depends testTrash */ - public function testNotFoundAliasAfterRemoveIt() + public function testNotFoundAliasAfterRemoveIt(): void { $this->expectException(NotFoundException::class); @@ -383,7 +383,7 @@ public function testNotFoundAliasAfterRemoveIt() * * @depends testTrash */ - public function testAliasesForRemovedItems() + public function testAliasesForRemovedItems(): void { $mediaRemoteId = '75c715a51699d2d309a924eca6a95145'; @@ -425,7 +425,7 @@ public function testAliasesForRemovedItems() * * @depends testRecover */ - public function testRecoverDoesNotRestoreChildLocations() + public function testRecoverDoesNotRestoreChildLocations(): void { $repository = $this->getRepository(); $trashService = $repository->getTrashService(); @@ -476,7 +476,7 @@ public function testRecoverDoesNotRestoreChildLocations() * * @todo Fix naming */ - public function testRecoverWithLocationCreateStructParameter() + public function testRecoverWithLocationCreateStructParameter(): void { $repository = $this->getRepository(); $trashService = $repository->getTrashService(); @@ -525,7 +525,7 @@ public function testRecoverWithLocationCreateStructParameter() * * @depends testRecover */ - public function testRecoverIncrementsChildCountOnOriginalParent() + public function testRecoverIncrementsChildCountOnOriginalParent(): void { $repository = $this->getRepository(); $trashService = $repository->getTrashService(); @@ -564,7 +564,7 @@ public function testRecoverIncrementsChildCountOnOriginalParent() * * @depends testRecoverWithLocationCreateStructParameter */ - public function testRecoverWithLocationCreateStructParameterIncrementsChildCountOnNewParent() + public function testRecoverWithLocationCreateStructParameterIncrementsChildCountOnNewParent(): void { $repository = $this->getRepository(); $trashService = $repository->getTrashService(); @@ -607,7 +607,7 @@ public function testRecoverWithLocationCreateStructParameterIncrementsChildCount /** * Test recovering a location from trash to non existing location. */ - public function testRecoverToNonExistingLocation() + public function testRecoverToNonExistingLocation(): void { $this->expectException(NotFoundException::class); @@ -743,7 +743,7 @@ public function testFindTrashItemsSort(array $sortClausesClasses): void * * @depends testTrash */ - public function testFindTrashItemsLimits() + public function testFindTrashItemsLimits(): void { $repository = $this->getRepository(); $trashService = $repository->getTrashService(); @@ -772,7 +772,7 @@ public function testFindTrashItemsLimits() * * @depends Ibexa\Tests\Integration\Core\Repository\TrashServiceTest::testFindTrashItems */ - public function testFindTrashItemsLimitedAccess() + public function testFindTrashItemsLimitedAccess(): void { $repository = $this->getRepository(); $trashService = $repository->getTrashService(); @@ -816,7 +816,7 @@ public function testFindTrashItemsLimitedAccess() /** * Test Section Role Assignment Limitation against user/login. */ - public function testFindTrashItemsSubtreeLimitation() + public function testFindTrashItemsSubtreeLimitation(): void { $repository = $this->getRepository(); $contentService = $repository->getContentService(); @@ -873,7 +873,7 @@ public function testFindTrashItemsSubtreeLimitation() * * @depends testFindTrashItems */ - public function testEmptyTrash() + public function testEmptyTrash(): void { $repository = $this->getRepository(); $trashService = $repository->getTrashService(); @@ -904,7 +904,7 @@ public function testEmptyTrash() * * @depends testFindTrashItems */ - public function testEmptyTrashForUserWithSubtreeLimitation() + public function testEmptyTrashForUserWithSubtreeLimitation(): void { $repository = $this->getRepository(); $trashService = $repository->getTrashService(); @@ -948,7 +948,7 @@ public function testEmptyTrashForUserWithSubtreeLimitation() * * @depends testFindTrashItems */ - public function testDeleteTrashItem() + public function testDeleteTrashItem(): void { $repository = $this->getRepository(); $trashService = $repository->getTrashService(); @@ -997,7 +997,7 @@ static function ($trashItem) { /** * Test deleting a non existing trash item. */ - public function testDeleteThrowsNotFoundExceptionForNonExistingTrashItem() + public function testDeleteThrowsNotFoundExceptionForNonExistingTrashItem(): void { $this->expectException(NotFoundException::class); @@ -1224,7 +1224,7 @@ public function trashSortClausesProvider(): array * * @return string[] */ - private function createRemoteIdList() + private function createRemoteIdList(): array { $repository = $this->getRepository(); @@ -1254,7 +1254,7 @@ private function createRemoteIdList() * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - protected function createNewContentInPlaceTrashedOne(Repository $repository, $parentLocationId) + protected function createNewContentInPlaceTrashedOne(Repository $repository, int $parentLocationId): Content { $contentService = $repository->getContentService(); $locationService = $repository->getLocationService(); @@ -1274,7 +1274,7 @@ protected function createNewContentInPlaceTrashedOne(Repository $repository, $pa /** * @param string $urlPath Url alias path */ - private function assertAliasNotExists(URLAliasService $urlAliasService, $urlPath) + private function assertAliasNotExists(URLAliasService $urlAliasService, string $urlPath): void { try { $this->getRepository()->getURLAliasService()->lookup($urlPath); diff --git a/tests/integration/Core/Repository/URLAliasServiceAuthorizationTest.php b/tests/integration/Core/Repository/URLAliasServiceAuthorizationTest.php index 6c565dacd1..656f7716bf 100644 --- a/tests/integration/Core/Repository/URLAliasServiceAuthorizationTest.php +++ b/tests/integration/Core/Repository/URLAliasServiceAuthorizationTest.php @@ -18,7 +18,7 @@ class URLAliasServiceAuthorizationTest extends BaseTest * * @depends Ibexa\Tests\Integration\Core\Repository\URLAliasServiceTest::testCreateUrlAlias */ - public function testCreateUrlAliasThrowsUnauthorizedException() + public function testCreateUrlAliasThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -52,7 +52,7 @@ public function testCreateUrlAliasThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\URLAliasServiceTest::testCreateGlobalUrlAlias */ - public function testCreateGlobalUrlAliasThrowsUnauthorizedException() + public function testCreateGlobalUrlAliasThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -80,7 +80,7 @@ public function testCreateGlobalUrlAliasThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\URLAliasServiceTest::testRemoveAliases */ - public function testRemoveAliasesThrowsUnauthorizedException() + public function testRemoveAliasesThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/URLAliasServiceTest.php b/tests/integration/Core/Repository/URLAliasServiceTest.php index 63dc1e90a7..0dfa57b488 100644 --- a/tests/integration/Core/Repository/URLAliasServiceTest.php +++ b/tests/integration/Core/Repository/URLAliasServiceTest.php @@ -11,6 +11,7 @@ use Exception; use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\URLAlias; @@ -70,7 +71,7 @@ protected function setUp(): void * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::createUrlAlias() */ - public function testCreateUrlAlias() + public function testCreateUrlAlias(): array { $repository = $this->getRepository(); @@ -104,7 +105,7 @@ public function testCreateUrlAlias() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function testCreateSameAliasForDifferentLanguage() + public function testCreateSameAliasForDifferentLanguage(): void { $repository = $this->getRepository(); $locationId = $this->generateId('location', 5); @@ -152,7 +153,7 @@ public function testLoad(): void * * @depends testCreateUrlAlias */ - public function testCreateUrlAliasPropertyValues(array $testData) + public function testCreateUrlAliasPropertyValues(array $testData): void { [$createdUrlAlias, $locationId] = $testData; @@ -180,7 +181,7 @@ public function testCreateUrlAliasPropertyValues(array $testData) * * @depends testCreateUrlAliasPropertyValues */ - public function testCreateUrlAliasWithForwarding() + public function testCreateUrlAliasWithForwarding(): array { $repository = $this->getRepository(); @@ -210,7 +211,7 @@ public function testCreateUrlAliasWithForwarding() * * @depends testCreateUrlAliasWithForwarding */ - public function testCreateUrlAliasPropertyValuesWithForwarding(array $testData) + public function testCreateUrlAliasPropertyValuesWithForwarding(array $testData): void { [$createdUrlAlias, $locationId] = $testData; @@ -236,7 +237,7 @@ public function testCreateUrlAliasPropertyValuesWithForwarding(array $testData) * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::createUrlAlias($location, $path, $languageCode, $forwarding, $alwaysAvailable) */ - public function testCreateUrlAliasWithAlwaysAvailable() + public function testCreateUrlAliasWithAlwaysAvailable(): array { $repository = $this->getRepository(); @@ -266,7 +267,7 @@ public function testCreateUrlAliasWithAlwaysAvailable() * * @depends testCreateUrlAliasWithAlwaysAvailable */ - public function testCreateUrlAliasPropertyValuesWithAlwaysAvailable(array $testData) + public function testCreateUrlAliasPropertyValuesWithAlwaysAvailable(array $testData): void { [$createdUrlAlias, $locationId] = $testData; @@ -292,7 +293,7 @@ public function testCreateUrlAliasPropertyValuesWithAlwaysAvailable(array $testD * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::createUrlAlias() */ - public function testCreateUrlAliasThrowsInvalidArgumentException() + public function testCreateUrlAliasThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -346,7 +347,7 @@ public function testCreateGlobalUrlAlias() * * @depends testCreateGlobalUrlAlias */ - public function testCreateGlobalUrlAliasPropertyValues(URLAlias $createdUrlAlias) + public function testCreateGlobalUrlAliasPropertyValues(URLAlias $createdUrlAlias): void { self::assertNotNull($createdUrlAlias->id); @@ -398,7 +399,7 @@ public function testCreateGlobalUrlAliasWithForward() * * @depends testCreateGlobalUrlAliasWithForward */ - public function testCreateGlobalUrlAliasWithForwardPropertyValues(URLAlias $createdUrlAlias) + public function testCreateGlobalUrlAliasWithForwardPropertyValues(URLAlias $createdUrlAlias): void { self::assertNotNull($createdUrlAlias->id); @@ -451,7 +452,7 @@ public function testCreateGlobalUrlAliasWithAlwaysAvailable() * * @depends testCreateGlobalUrlAliasWithAlwaysAvailable */ - public function testCreateGlobalUrlAliasWithAlwaysAvailablePropertyValues(URLAlias $createdUrlAlias) + public function testCreateGlobalUrlAliasWithAlwaysAvailablePropertyValues(URLAlias $createdUrlAlias): void { self::assertNotNull($createdUrlAlias->id); @@ -475,7 +476,7 @@ public function testCreateGlobalUrlAliasWithAlwaysAvailablePropertyValues(URLAli * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::createGlobalUrlAlias($resource, $path, $languageCode, $forwarding, $alwaysAvailable) */ - public function testCreateGlobalUrlAliasForLocation() + public function testCreateGlobalUrlAliasForLocation(): array { $repository = $this->getRepository(); @@ -510,7 +511,7 @@ public function testCreateGlobalUrlAliasForLocation() * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::createGlobalUrlAlias($resource, $path, $languageCode, $forwarding, $alwaysAvailable) */ - public function testCreateGlobalUrlAliasForLocationVariation() + public function testCreateGlobalUrlAliasForLocationVariation(): array { $repository = $this->getRepository(); @@ -545,7 +546,7 @@ public function testCreateGlobalUrlAliasForLocationVariation() * * @depends testCreateGlobalUrlAliasForLocation */ - public function testCreateGlobalUrlAliasForLocationPropertyValues($testData) + public function testCreateGlobalUrlAliasForLocationPropertyValues($testData): void { [$createdUrlAlias, $locationId] = $testData; @@ -571,7 +572,7 @@ public function testCreateGlobalUrlAliasForLocationPropertyValues($testData) * * @depends testCreateGlobalUrlAliasForLocationVariation */ - public function testCreateGlobalUrlAliasForLocationVariationPropertyValues($testData) + public function testCreateGlobalUrlAliasForLocationVariationPropertyValues($testData): void { $this->testCreateGlobalUrlAliasForLocationPropertyValues($testData); } @@ -581,7 +582,7 @@ public function testCreateGlobalUrlAliasForLocationVariationPropertyValues($test * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::createGlobalUrlAlias() */ - public function testCreateGlobalUrlAliasThrowsInvalidArgumentException() + public function testCreateGlobalUrlAliasThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -605,7 +606,7 @@ public function testCreateGlobalUrlAliasThrowsInvalidArgumentException() * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::listLocationAliases() */ - public function testListLocationAliases() + public function testListLocationAliases(): array { $repository = $this->getRepository(); @@ -638,7 +639,7 @@ public function testListLocationAliases() * * @depends testListLocationAliases */ - public function testListLocationAliasesLoadsCorrectly(array $testData) + public function testListLocationAliasesLoadsCorrectly(array $testData): void { [$loadedAliases, $location] = $testData; @@ -659,7 +660,7 @@ public function testListLocationAliasesLoadsCorrectly(array $testData) * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::listLocationAliases($location, $custom, $languageCode) */ - public function testListLocationAliasesWithCustomFilter() + public function testListLocationAliasesWithCustomFilter(): void { $repository = $this->getRepository(); @@ -688,7 +689,7 @@ public function testListLocationAliasesWithCustomFilter() * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::listLocationAliases($location, $custom) */ - public function testListLocationAliasesWithLanguageCodeFilter() + public function testListLocationAliasesWithLanguageCodeFilter(): void { $repository = $this->getRepository(); @@ -716,7 +717,7 @@ public function testListLocationAliasesWithLanguageCodeFilter() * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::listGlobalAliases() */ - public function testListGlobalAliases() + public function testListGlobalAliases(): void { $repository = $this->getRepository(); @@ -737,7 +738,7 @@ public function testListGlobalAliases() /** * Creates 3 global aliases. */ - private function createGlobalAliases() + private function createGlobalAliases(): void { $repository = $this->getRepository(); $urlAliasService = $repository->getURLAliasService(); @@ -766,7 +767,7 @@ private function createGlobalAliases() * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::listGlobalAliases($languageCode) */ - public function testListGlobalAliasesWithLanguageFilter() + public function testListGlobalAliasesWithLanguageFilter(): void { $repository = $this->getRepository(); @@ -789,7 +790,7 @@ public function testListGlobalAliasesWithLanguageFilter() * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::listGlobalAliases($languageCode, $offset) */ - public function testListGlobalAliasesWithOffset() + public function testListGlobalAliasesWithOffset(): void { $repository = $this->getRepository(); @@ -812,7 +813,7 @@ public function testListGlobalAliasesWithOffset() * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::listGlobalAliases($languageCode, $offset, $limit) */ - public function testListGlobalAliasesWithLimit() + public function testListGlobalAliasesWithLimit(): void { $repository = $this->getRepository(); @@ -835,7 +836,7 @@ public function testListGlobalAliasesWithLimit() * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::removeAliases() */ - public function testRemoveAliases() + public function testRemoveAliases(): void { $repository = $this->getRepository(); @@ -876,7 +877,7 @@ public function testRemoveAliases() * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::removeAliases() */ - public function testRemoveAliasesThrowsInvalidArgumentExceptionIfAutogeneratedAliasesAreToBeRemoved() + public function testRemoveAliasesThrowsInvalidArgumentExceptionIfAutogeneratedAliasesAreToBeRemoved(): void { $this->expectException(InvalidArgumentException::class); @@ -928,7 +929,7 @@ public function testLookUp() * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::lookUp($url, $languageCode) */ - public function testLookUpWithLanguageFilter() + public function testLookUpWithLanguageFilter(): void { $repository = $this->getRepository(); @@ -956,7 +957,7 @@ public function testLookUpWithLanguageFilter() * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::lookUp() */ - public function testLookUpThrowsNotFoundException() + public function testLookUpThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -975,7 +976,7 @@ public function testLookUpThrowsNotFoundException() * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::lookUp($url, $languageCode) */ - public function testLookUpThrowsNotFoundExceptionWithLanguageFilter() + public function testLookUpThrowsNotFoundExceptionWithLanguageFilter(): void { $this->expectException(NotFoundException::class); @@ -994,7 +995,7 @@ public function testLookUpThrowsNotFoundExceptionWithLanguageFilter() * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::lookUp($url, $languageCode) */ - public function testLookUpThrowsInvalidArgumentException() + public function testLookUpThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -1016,7 +1017,7 @@ public function testLookUpThrowsInvalidArgumentException() * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::lookUp * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::listLocationAliases */ - public function testLookupOnRenamedParent() + public function testLookupOnRenamedParent(): void { $urlAliasService = $this->getRepository()->getURLAliasService(); $locationService = $this->getRepository()->getLocationService(); @@ -1076,7 +1077,7 @@ public function testLookupOnRenamedParent() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function testLookupOnMultilingualNestedLocations() + public function testLookupOnMultilingualNestedLocations(): array { $urlAliasService = $this->getRepository()->getURLAliasService(); $locationService = $this->getRepository()->getLocationService(); @@ -1137,7 +1138,7 @@ public function testLookupOnMultilingualNestedLocations() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException * @throws \ErrorException */ - public function testRefreshSystemUrlAliasesForLocationWithChangedSlugConverterConfiguration() + public function testRefreshSystemUrlAliasesForLocationWithChangedSlugConverterConfiguration(): void { [$topFolderLocation, $nestedFolderLocation] = $this->testLookupOnMultilingualNestedLocations(); @@ -1199,7 +1200,7 @@ public function testRefreshSystemUrlAliasesForLocationWithChangedSlugConverterCo * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function testRefreshSystemUrlAliasesForContentsWithUpdatedContentTypes() + public function testRefreshSystemUrlAliasesForContentsWithUpdatedContentTypes(): void { [$topFolderLocation, $nestedFolderLocation] = $this->testLookupOnMultilingualNestedLocations(); /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $topFolderLocation */ @@ -1252,7 +1253,7 @@ public function testRefreshSystemUrlAliasesForContentsWithUpdatedContentTypes() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function testCreateNonLatinNonEmptyUniqueAliases() + public function testCreateNonLatinNonEmptyUniqueAliases(): void { $repository = $this->getRepository(); $urlAliasService = $repository->getURLAliasService(); @@ -1303,7 +1304,7 @@ public function testCreateNonLatinNonEmptyUniqueAliases() * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException * @throws \Exception */ - public function testRefreshSystemUrlAliasesForMissingUrlWithHistory() + public function testRefreshSystemUrlAliasesForMissingUrlWithHistory(): void { $repository = $this->getRepository(); $urlAliasService = $repository->getURLAliasService(); @@ -1402,7 +1403,7 @@ static function (Connection $connection) use ($folderLocation) { * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException * @throws \Exception */ - public function testRefreshSystemUrlAliasesForMovedLocation() + public function testRefreshSystemUrlAliasesForMovedLocation(): void { $repository = $this->getRepository(); $urlAliasService = $repository->getURLAliasService(); @@ -1434,7 +1435,7 @@ static function (Connection $connection) use ($nestedFolderLocation) { $expr = $queryBuilder->expr(); $queryBuilder ->update('ezurlalias_ml') - ->set('link', $queryBuilder->createPositionalParameter(666, \PDO::PARAM_INT)) + ->set('link', $queryBuilder->createPositionalParameter(666, PDO::PARAM_INT)) ->where( $expr->eq( 'action', @@ -1446,7 +1447,7 @@ static function (Connection $connection) use ($nestedFolderLocation) { ->andWhere( $expr->eq( 'is_original', - $queryBuilder->createPositionalParameter(0, \PDO::PARAM_INT) + $queryBuilder->createPositionalParameter(0, PDO::PARAM_INT) ) ) ->andWhere( @@ -1568,7 +1569,7 @@ protected function assertUrlIsCurrent($lookupUrl, $expectedDestination) * @param int $expectedDestination Expected Location ID * @param string $lookupUrl */ - protected function assertLookupHistory($expectedIsHistory, $expectedDestination, $lookupUrl) + protected function assertLookupHistory($expectedIsHistory, $expectedDestination, string $lookupUrl) { $urlAliasService = $this->getRepository(false)->getURLAliasService(); @@ -1599,7 +1600,7 @@ protected function assertLookupHistory($expectedIsHistory, $expectedDestination, * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - protected function updateContentField(ContentInfo $contentInfo, $fieldDefinitionIdentifier, array $fieldValues) + protected function updateContentField(ContentInfo $contentInfo, string $fieldDefinitionIdentifier, array $fieldValues): Content { $contentService = $this->getRepository(false)->getContentService(); @@ -1624,7 +1625,7 @@ protected function updateContentField(ContentInfo $contentInfo, $fieldDefinition * * @throws \ErrorException */ - public function testDeleteCorruptedUrlAliases() + public function testDeleteCorruptedUrlAliases(): void { $repository = $this->getRepository(); $urlAliasService = $repository->getURLAliasService(); @@ -1694,7 +1695,7 @@ protected function changeSlugConverterConfiguration($key, $value) * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - protected function changeContentTypeUrlAliasSchema($contentTypeIdentifier, $newUrlAliasSchema) + protected function changeContentTypeUrlAliasSchema(string $contentTypeIdentifier, $newUrlAliasSchema) { $contentTypeService = $this->getRepository(false)->getContentTypeService(); @@ -1727,11 +1728,11 @@ private function assertUrlAliasPropertiesSame(array $expectedValues, URLAlias $u private function assertUrlAliasPropertiesCorrect( Location $expectedDestinationLocation, - $expectedPath, + string $expectedPath, array $expectedLanguageCodes, - $expectedIsHistory, + bool $expectedIsHistory, URLAlias $actualUrlAliasValue - ) { + ): void { self::assertPropertiesCorrect( [ 'destination' => $expectedDestinationLocation->id, diff --git a/tests/integration/Core/Repository/URLServiceAuthorizationTest.php b/tests/integration/Core/Repository/URLServiceAuthorizationTest.php index f7deed7e25..397ae3671c 100644 --- a/tests/integration/Core/Repository/URLServiceAuthorizationTest.php +++ b/tests/integration/Core/Repository/URLServiceAuthorizationTest.php @@ -18,7 +18,7 @@ class URLServiceAuthorizationTest extends BaseURLServiceTest * * @covers \Ibexa\Contracts\Core\Repository\URLService::findUrls */ - public function testFindUrlsThrowsUnauthorizedException() + public function testFindUrlsThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -47,7 +47,7 @@ public function testFindUrlsThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\URLService::updateUrl */ - public function testUpdateUrlThrowsUnauthorizedException() + public function testUpdateUrlThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -78,7 +78,7 @@ public function testUpdateUrlThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\URLService::loadById */ - public function testLoadByIdThrowsUnauthorizedException() + public function testLoadByIdThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -105,7 +105,7 @@ public function testLoadByIdThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\URLService::loadById */ - public function testLoadByUrlThrowsUnauthorizedException() + public function testLoadByUrlThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/URLServiceTest.php b/tests/integration/Core/Repository/URLServiceTest.php index 6318771c65..37789ec7b3 100644 --- a/tests/integration/Core/Repository/URLServiceTest.php +++ b/tests/integration/Core/Repository/URLServiceTest.php @@ -173,7 +173,7 @@ protected function setUp(): void * * @covers \Ibexa\Contracts\Core\Repository\URLService::findUrls() */ - public function testFindUrls() + public function testFindUrls(): void { $expectedUrls = [ 'https://www.apache.org/', @@ -209,7 +209,7 @@ public function testFindUrls() * * @covers \Ibexa\Contracts\Core\Repository\URLService::findUrls() */ - public function testFindUrlsWithoutCounting() + public function testFindUrlsWithoutCounting(): void { $expectedUrls = [ 'https://www.apache.org/', @@ -248,7 +248,7 @@ public function testFindUrlsWithoutCounting() * * @depends testFindUrls */ - public function testFindUrlsUsingMatchNone() + public function testFindUrlsUsingMatchNone(): void { $query = new URLQuery(); $query->filter = new Criterion\MatchNone(); @@ -263,7 +263,7 @@ public function testFindUrlsUsingMatchNone() * * @depends testFindUrls */ - public function testFindUrlsUsingPatternCriterion() + public function testFindUrlsUsingPatternCriterion(): void { $expectedUrls = [ 'https://www.google.de/', @@ -286,7 +286,7 @@ public function testFindUrlsUsingPatternCriterion() * * @depends testFindUrls */ - public function testFindUrlsUsingValidityCriterionValid() + public function testFindUrlsUsingValidityCriterionValid(): void { $expectedUrls = [ 'https://www.google.com/', @@ -441,7 +441,7 @@ public function testFindUrlsUsingSectionIdentifierOrSectionIdCriterion(): void * * @depends testFindUrls */ - public function testFindUrlsUsingValidityCriterionInvalid() + public function testFindUrlsUsingValidityCriterionInvalid(): void { $expectedUrls = [ '/content/view/tagcloud/2', @@ -460,7 +460,7 @@ public function testFindUrlsUsingValidityCriterionInvalid() * * @depends testFindUrls */ - public function testFindUrlsUsingVisibleOnlyCriterion() + public function testFindUrlsUsingVisibleOnlyCriterion(): void { $expectedUrls = [ 'https://vimeo.com/', @@ -516,7 +516,7 @@ public function testFindUrlsUsingVisibleOnlyCriterionReturnsUniqueItems(): void * * @covers \Ibexa\Contracts\Core\Repository\URLService::findUrls() */ - public function testFindUrlsWithInvalidOffsetThrowsInvalidArgumentException() + public function testFindUrlsWithInvalidOffsetThrowsInvalidArgumentException(): void { $query = new URLQuery(); $query->filter = new Criterion\MatchAll(); @@ -537,7 +537,7 @@ public function testFindUrlsWithInvalidOffsetThrowsInvalidArgumentException() * * @covers \Ibexa\Contracts\Core\Repository\URLService::findUrls() */ - public function testFindUrlsWithInvalidLimitThrowsInvalidArgumentException() + public function testFindUrlsWithInvalidLimitThrowsInvalidArgumentException(): void { $query = new URLQuery(); $query->filter = new Criterion\MatchAll(); @@ -560,7 +560,7 @@ public function testFindUrlsWithInvalidLimitThrowsInvalidArgumentException() * * @depends testFindUrls */ - public function testFindUrlsWithOffset() + public function testFindUrlsWithOffset(): void { $expectedUrls = [ 'https://www.discuz.net/forum.php', @@ -590,7 +590,7 @@ public function testFindUrlsWithOffset() * * @depends testFindUrls */ - public function testFindUrlsWithOffsetAndLimit() + public function testFindUrlsWithOffsetAndLimit(): void { $expectedUrls = [ 'https://www.discuz.net/forum.php', @@ -614,7 +614,7 @@ public function testFindUrlsWithOffsetAndLimit() * * @depends testFindUrls */ - public function testFindUrlsWithLimitZero() + public function testFindUrlsWithLimitZero(): void { $query = new URLQuery(); $query->filter = new Criterion\MatchAll(); @@ -632,7 +632,7 @@ public function testFindUrlsWithLimitZero() * * @dataProvider dataProviderForFindUrlsWithSorting */ - public function testFindUrlsWithSorting(SortClause $sortClause, array $expectedUrls) + public function testFindUrlsWithSorting(SortClause $sortClause, array $expectedUrls): void { $query = new URLQuery(); $query->filter = new Criterion\MatchAll(); @@ -641,7 +641,7 @@ public function testFindUrlsWithSorting(SortClause $sortClause, array $expectedU $this->doTestFindUrls($query, $expectedUrls, count($expectedUrls), false); } - public function dataProviderForFindUrlsWithSorting() + public function dataProviderForFindUrlsWithSorting(): array { $urlsSortedById = [ '/content/view/sitemap/2', @@ -682,7 +682,7 @@ public function dataProviderForFindUrlsWithSorting() * * @covers \Ibexa\Contracts\Core\Repository\URLService::updateUrl() */ - public function testUpdateUrl() + public function testUpdateUrl(): void { $repository = $this->getRepository(); @@ -715,7 +715,7 @@ public function testUpdateUrl() * * @covers \Ibexa\Contracts\Core\Repository\URLService::updateUrl() */ - public function testUpdateUrlStatus() + public function testUpdateUrlStatus(): void { $repository = $this->getRepository(); @@ -753,7 +753,7 @@ public function testUpdateUrlStatus() * * @depends testUpdateUrl */ - public function testUpdateUrlWithNonUniqueUrl() + public function testUpdateUrlWithNonUniqueUrl(): void { $this->expectException(InvalidArgumentException::class); @@ -778,7 +778,7 @@ public function testUpdateUrlWithNonUniqueUrl() * * @covers \Ibexa\Contracts\Core\Repository\URLService::loadById */ - public function testLoadById() + public function testLoadById(): void { $repository = $this->getRepository(); @@ -808,7 +808,7 @@ public function testLoadById() * * @depends testLoadById */ - public function testLoadByIdThrowsNotFoundException() + public function testLoadByIdThrowsNotFoundException(): void { $repository = $this->getRepository(); @@ -826,7 +826,7 @@ public function testLoadByIdThrowsNotFoundException() * * @covers \Ibexa\Contracts\Core\Repository\URLService::loadByUrl */ - public function testLoadByUrl() + public function testLoadByUrl(): void { $repository = $this->getRepository(); @@ -856,7 +856,7 @@ public function testLoadByUrl() * * @depends testLoadByUrl */ - public function testLoadByUrlThrowsNotFoundException() + public function testLoadByUrlThrowsNotFoundException(): void { $repository = $this->getRepository(); @@ -897,7 +897,7 @@ public function testCreateUpdateStruct() * * @depends testCreateUpdateStruct */ - public function testCreateUpdateStructValues(URLUpdateStruct $updateStruct) + public function testCreateUpdateStructValues(URLUpdateStruct $updateStruct): void { $this->assertPropertiesCorrect([ 'url' => null, @@ -913,7 +913,7 @@ public function testCreateUpdateStructValues(URLUpdateStruct $updateStruct) * * @dataProvider dataProviderForFindUsages */ - public function testFindUsages($urlId, $offset, $limit, array $expectedContentInfos, $expectedTotalCount = null) + public function testFindUsages($urlId, int $offset, int $limit, array $expectedContentInfos, $expectedTotalCount = null): void { $repository = $this->getRepository(); @@ -931,7 +931,7 @@ public function testFindUsages($urlId, $offset, $limit, array $expectedContentIn $this->assertUsagesSearchResultItems($usagesSearchResults, $expectedContentInfos); } - public function dataProviderForFindUsages() + public function dataProviderForFindUsages(): array { return [ // findUsages($url, 0, -1) @@ -946,7 +946,7 @@ public function dataProviderForFindUsages() * * @depends testFindUsages */ - public function testFindUsagesReturnsEmptySearchResults() + public function testFindUsagesReturnsEmptySearchResults(): void { $repository = $this->getRepository(); diff --git a/tests/integration/Core/Repository/URLWildcardServiceAuthorizationTest.php b/tests/integration/Core/Repository/URLWildcardServiceAuthorizationTest.php index 946a04ea81..43e82e8652 100644 --- a/tests/integration/Core/Repository/URLWildcardServiceAuthorizationTest.php +++ b/tests/integration/Core/Repository/URLWildcardServiceAuthorizationTest.php @@ -52,7 +52,7 @@ public function testCreateThrowsUnauthorizedException(): void * * @depends Ibexa\Tests\Integration\Core\Repository\URLWildcardServiceTest::testRemove */ - public function testRemoveThrowsUnauthorizedException() + public function testRemoveThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/URLWildcardServiceTest.php b/tests/integration/Core/Repository/URLWildcardServiceTest.php index 68bb9dc187..c065f1decf 100644 --- a/tests/integration/Core/Repository/URLWildcardServiceTest.php +++ b/tests/integration/Core/Repository/URLWildcardServiceTest.php @@ -58,7 +58,7 @@ public function testCreate() * * @depends testCreate */ - public function testCreateSetsIdPropertyOnURLWildcard(URLWildcard $urlWildcard) + public function testCreateSetsIdPropertyOnURLWildcard(URLWildcard $urlWildcard): void { self::assertNotNull($urlWildcard->id); } @@ -72,7 +72,7 @@ public function testCreateSetsIdPropertyOnURLWildcard(URLWildcard $urlWildcard) * * @depends testCreate */ - public function testCreateSetsPropertiesOnURLWildcard(URLWildcard $urlWildcard) + public function testCreateSetsPropertiesOnURLWildcard(URLWildcard $urlWildcard): void { $this->assertPropertiesCorrect( [ @@ -91,7 +91,7 @@ public function testCreateSetsPropertiesOnURLWildcard(URLWildcard $urlWildcard) * * @depends testCreate */ - public function testCreateWithOptionalForwardParameter() + public function testCreateWithOptionalForwardParameter(): void { $repository = $this->getRepository(); @@ -119,7 +119,7 @@ public function testCreateWithOptionalForwardParameter() * * @depends testCreate */ - public function testCreateThrowsInvalidArgumentExceptionOnDuplicateSourceUrl() + public function testCreateThrowsInvalidArgumentExceptionOnDuplicateSourceUrl(): void { $this->expectException(InvalidArgumentException::class); @@ -144,7 +144,7 @@ public function testCreateThrowsInvalidArgumentExceptionOnDuplicateSourceUrl() * * @depends testCreate */ - public function testCreateThrowsContentValidationExceptionWhenPatternsAndPlaceholdersNotMatch() + public function testCreateThrowsContentValidationExceptionWhenPatternsAndPlaceholdersNotMatch(): void { $this->expectException(ContentValidationException::class); @@ -166,7 +166,7 @@ public function testCreateThrowsContentValidationExceptionWhenPatternsAndPlaceho * * @depends testCreate */ - public function testCreateThrowsContentValidationExceptionWhenPlaceholdersNotValidNumberSequence() + public function testCreateThrowsContentValidationExceptionWhenPlaceholdersNotValidNumberSequence(): void { $this->expectException(ContentValidationException::class); @@ -221,7 +221,7 @@ public function testLoad() * * @depends testLoad */ - public function testLoadSetsPropertiesOnURLWildcard(URLWildcard $urlWildcard) + public function testLoadSetsPropertiesOnURLWildcard(URLWildcard $urlWildcard): void { $this->assertPropertiesCorrect( [ @@ -242,7 +242,7 @@ public function testLoadSetsPropertiesOnURLWildcard(URLWildcard $urlWildcard) * * @depends testLoad */ - public function testLoadThrowsNotFoundException(URLWildcard $urlWildcard) + public function testLoadThrowsNotFoundException(URLWildcard $urlWildcard): void { $this->expectException(NotFoundException::class); @@ -307,7 +307,7 @@ public function testUpdate(): void * * @depends testLoad */ - public function testRemove() + public function testRemove(): void { $this->expectException(NotFoundException::class); @@ -337,7 +337,7 @@ public function testRemove() * * @depends testCreate */ - public function testLoadAll() + public function testLoadAll(): void { $repository = $this->getRepository(); @@ -368,7 +368,7 @@ public function testLoadAll() * * @depends testLoadAll */ - public function testLoadAllWithOffsetParameter() + public function testLoadAllWithOffsetParameter(): void { $repository = $this->getRepository(); @@ -393,7 +393,7 @@ public function testLoadAllWithOffsetParameter() * * @depends testLoadAll */ - public function testLoadAllWithOffsetAndLimitParameter() + public function testLoadAllWithOffsetAndLimitParameter(): void { $repository = $this->getRepository(); @@ -418,7 +418,7 @@ public function testLoadAllWithOffsetAndLimitParameter() * * @depends testLoadAll */ - public function testLoadAllReturnsEmptyArrayByDefault() + public function testLoadAllReturnsEmptyArrayByDefault(): void { $repository = $this->getRepository(); @@ -472,7 +472,7 @@ public function testTranslate() * * @depends testTranslate */ - public function testTranslateSetsPropertiesOnTranslationResult(URLWildcardTranslationResult $result) + public function testTranslateSetsPropertiesOnTranslationResult(URLWildcardTranslationResult $result): void { $this->assertPropertiesCorrect( [ @@ -490,7 +490,7 @@ public function testTranslateSetsPropertiesOnTranslationResult(URLWildcardTransl * * @depends testTranslate */ - public function testTranslateWithForwardSetToTrue() + public function testTranslateWithForwardSetToTrue(): void { $repository = $this->getRepository(); @@ -520,7 +520,7 @@ public function testTranslateWithForwardSetToTrue() * * @depends testTranslate */ - public function testTranslateReturnsLongestMatchingWildcard() + public function testTranslateReturnsLongestMatchingWildcard(): void { $repository = $this->getRepository(); @@ -545,7 +545,7 @@ public function testTranslateReturnsLongestMatchingWildcard() * * @depends testTranslate */ - public function testTranslateThrowsNotFoundExceptionWhenNotAliasOrWildcardMatches() + public function testTranslateThrowsNotFoundExceptionWhenNotAliasOrWildcardMatches(): void { $this->expectException(NotFoundException::class); diff --git a/tests/integration/Core/Repository/UserPreferenceServiceTest.php b/tests/integration/Core/Repository/UserPreferenceServiceTest.php index 9abe039bbb..1d5306cd4e 100644 --- a/tests/integration/Core/Repository/UserPreferenceServiceTest.php +++ b/tests/integration/Core/Repository/UserPreferenceServiceTest.php @@ -23,7 +23,7 @@ class UserPreferenceServiceTest extends BaseTest /** * @covers \Ibexa\Contracts\Core\Repository\UserPreferenceService::loadUserPreferences() */ - public function testLoadUserPreferences() + public function testLoadUserPreferences(): void { $repository = $this->getRepository(); @@ -41,7 +41,7 @@ public function testLoadUserPreferences() /** * @covers \Ibexa\Contracts\Core\Repository\UserPreferenceService::getUserPreference() */ - public function testGetUserPreference() + public function testGetUserPreference(): void { $repository = $this->getRepository(); @@ -62,7 +62,7 @@ public function testGetUserPreference() * * @depends testGetUserPreference */ - public function testSetUserPreference() + public function testSetUserPreference(): void { $repository = $this->getRepository(); @@ -89,7 +89,7 @@ public function testSetUserPreference() * * @depends testSetUserPreference */ - public function testSetUserPreferenceThrowsInvalidArgumentExceptionOnInvalidValue() + public function testSetUserPreferenceThrowsInvalidArgumentExceptionOnInvalidValue(): void { $this->expectException(InvalidArgumentException::class); @@ -113,7 +113,7 @@ public function testSetUserPreferenceThrowsInvalidArgumentExceptionOnInvalidValu * * @depends testSetUserPreference */ - public function testSetUserPreferenceThrowsInvalidArgumentExceptionOnEmptyName() + public function testSetUserPreferenceThrowsInvalidArgumentExceptionOnEmptyName(): void { $this->expectException(InvalidArgumentException::class); @@ -134,7 +134,7 @@ public function testSetUserPreferenceThrowsInvalidArgumentExceptionOnEmptyName() /** * @covers \Ibexa\Contracts\Core\Repository\UserPreferenceService::getUserPreferenceCount() */ - public function testGetUserPreferenceCount() + public function testGetUserPreferenceCount(): void { $repository = $this->getRepository(); diff --git a/tests/integration/Core/Repository/UserServiceAuthorizationTest.php b/tests/integration/Core/Repository/UserServiceAuthorizationTest.php index d8350793de..00a80ea7b1 100644 --- a/tests/integration/Core/Repository/UserServiceAuthorizationTest.php +++ b/tests/integration/Core/Repository/UserServiceAuthorizationTest.php @@ -26,7 +26,7 @@ class UserServiceAuthorizationTest extends BaseTest * * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testLoadUserGroup */ - public function testLoadUserGroupThrowsUnauthorizedException() + public function testLoadUserGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -80,7 +80,7 @@ public function testLoadUserGroupByRemoteIdThrowsUnauthorizedException(): void * * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testLoadSubUserGroups */ - public function testLoadSubUserGroupsThrowsUnauthorizedException() + public function testLoadSubUserGroupsThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -108,7 +108,7 @@ public function testLoadSubUserGroupsThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUserGroup */ - public function testCreateUserGroupThrowsUnauthorizedException() + public function testCreateUserGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -143,7 +143,7 @@ public function testCreateUserGroupThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testDeleteUserGroup */ - public function testDeleteUserGroupThrowsUnauthorizedException() + public function testDeleteUserGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -171,7 +171,7 @@ public function testDeleteUserGroupThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testMoveUserGroup */ - public function testMoveUserGroupThrowsUnauthorizedException() + public function testMoveUserGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -206,7 +206,7 @@ public function testMoveUserGroupThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testUpdateUserGroup */ - public function testUpdateUserGroupThrowsUnauthorizedException() + public function testUpdateUserGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -244,7 +244,7 @@ public function testUpdateUserGroupThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testCreateUser */ - public function testCreateUserThrowsUnauthorizedException() + public function testCreateUserThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -288,7 +288,7 @@ public function testCreateUserThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testDeleteUser */ - public function testDeleteUserThrowsUnauthorizedException() + public function testDeleteUserThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -312,7 +312,7 @@ public function testDeleteUserThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\UserService::updateUser() */ - public function testUpdateUserThrowsUnauthorizedException() + public function testUpdateUserThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -367,7 +367,7 @@ public function testUpdateUserPasswordThrowsUnauthorizedException(): void * * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testAssignUserToUserGroup */ - public function testAssignUserToUserGroupThrowsUnauthorizedException() + public function testAssignUserToUserGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -400,7 +400,7 @@ public function testAssignUserToUserGroupThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testUnAssignUserFromUserGroup */ - public function testUnAssignUserFromUserGroupThrowsUnauthorizedException() + public function testUnAssignUserFromUserGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -441,7 +441,7 @@ public function testUnAssignUserFromUserGroupThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testLoadUserGroupsOfUser */ - public function testLoadUserGroupsOfUserThrowsUnauthorizedException() + public function testLoadUserGroupsOfUserThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -468,7 +468,7 @@ public function testLoadUserGroupsOfUserThrowsUnauthorizedException() * * @depends Ibexa\Tests\Integration\Core\Repository\UserServiceTest::testLoadUsersOfUserGroup */ - public function testLoadUsersOfUserGroupThrowsUnauthorizedException() + public function testLoadUsersOfUserGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/UserServiceTest.php b/tests/integration/Core/Repository/UserServiceTest.php index ae26610519..4c60109cad 100644 --- a/tests/integration/Core/Repository/UserServiceTest.php +++ b/tests/integration/Core/Repository/UserServiceTest.php @@ -57,7 +57,7 @@ class UserServiceTest extends BaseTest * * @covers \Ibexa\Contracts\Core\Repository\UserService::loadUserGroup() */ - public function testLoadUserGroup() + public function testLoadUserGroup(): void { $repository = $this->getRepository(); @@ -103,7 +103,7 @@ public function testLoadUserGroupByRemoteId(): void * * @covers \Ibexa\Contracts\Core\Repository\UserService::loadUserGroup() */ - public function testLoadUserGroupWithNoAccessToParent() + public function testLoadUserGroupWithNoAccessToParent(): void { $repository = $this->getRepository(); @@ -140,7 +140,7 @@ public function testLoadUserGroupWithNoAccessToParent() * * @depends testLoadUserGroup */ - public function testLoadUserGroupThrowsNotFoundException() + public function testLoadUserGroupThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -179,7 +179,7 @@ public function testLoadUserGroupByRemoteIdThrowsNotFoundException(): void * * @depends testLoadUserGroup */ - public function testLoadSubUserGroups() + public function testLoadSubUserGroups(): void { $repository = $this->getRepository(); @@ -204,7 +204,7 @@ public function testLoadSubUserGroups() * * @covers \Ibexa\Contracts\Core\Repository\UserService::loadSubUserGroups */ - public function testLoadSubUserGroupsThrowsNotFoundException() + public function testLoadSubUserGroupsThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -264,7 +264,7 @@ public function testNewUserGroupCreateStruct() * * @depends testNewUserGroupCreateStruct */ - public function testNewUserGroupCreateStructSetsMainLanguageCode($groupCreate) + public function testNewUserGroupCreateStructSetsMainLanguageCode($groupCreate): void { self::assertEquals('eng-US', $groupCreate->mainLanguageCode); } @@ -278,7 +278,7 @@ public function testNewUserGroupCreateStructSetsMainLanguageCode($groupCreate) * * @depends testNewUserGroupCreateStruct */ - public function testNewUserGroupCreateStructSetsContentType($groupCreate) + public function testNewUserGroupCreateStructSetsContentType($groupCreate): void { self::assertInstanceOf( ContentType::class, @@ -293,7 +293,7 @@ public function testNewUserGroupCreateStructSetsContentType($groupCreate) * * @depends testNewUserGroupCreateStruct */ - public function testNewUserGroupCreateStructWithSecondParameter() + public function testNewUserGroupCreateStructWithSecondParameter(): void { $repository = $this->getRepository(); @@ -352,7 +352,7 @@ public function testCreateUserGroup() * * @depends testCreateUserGroup */ - public function testCreateUserGroupSetsExpectedProperties($userGroup) + public function testCreateUserGroupSetsExpectedProperties($userGroup): void { self::assertEquals( [ @@ -371,7 +371,7 @@ public function testCreateUserGroupSetsExpectedProperties($userGroup) * * @depends testCreateUserGroup */ - public function testCreateUserGroupThrowsInvalidArgumentException() + public function testCreateUserGroupThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -407,7 +407,7 @@ public function testCreateUserGroupThrowsInvalidArgumentException() * * @depends testCreateUserGroup */ - public function testCreateUserGroupThrowsInvalidArgumentExceptionFieldTypeNotAccept() + public function testCreateUserGroupThrowsInvalidArgumentExceptionFieldTypeNotAccept(): void { $this->expectException(InvalidArgumentException::class); @@ -442,7 +442,7 @@ public function testCreateUserGroupThrowsInvalidArgumentExceptionFieldTypeNotAcc * * @depends testCreateUserGroup */ - public function testCreateUserGroupWhenMissingField() + public function testCreateUserGroupWhenMissingField(): void { $this->expectException(ContentFieldValidationException::class); @@ -525,7 +525,7 @@ public function testCreateUserGroupInTransactionWithRollback(): void * * @depends testCreateUserGroup */ - public function testDeleteUserGroup() + public function testDeleteUserGroup(): void { $this->expectException(NotFoundException::class); @@ -548,7 +548,7 @@ public function testDeleteUserGroup() * * @covers \Ibexa\Contracts\Core\Repository\UserService::deleteUserGroup */ - public function testDeleteUserGroupThrowsNotFoundException() + public function testDeleteUserGroupThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -578,7 +578,7 @@ public function testDeleteUserGroupThrowsNotFoundException() * @depends testCreateUserGroup * @depends testLoadSubUserGroups */ - public function testMoveUserGroup() + public function testMoveUserGroup(): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -623,7 +623,7 @@ static function ($content) { * * @covers \Ibexa\Contracts\Core\Repository\UserService::moveUserGroup */ - public function testMoveUserGroupThrowsNotFoundException() + public function testMoveUserGroupThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -662,7 +662,7 @@ public function testMoveUserGroupThrowsNotFoundException() * * @covers \Ibexa\Contracts\Core\Repository\UserService::newUserGroupUpdateStruct */ - public function testNewUserGroupUpdateStruct() + public function testNewUserGroupUpdateStruct(): void { $repository = $this->getRepository(); @@ -689,7 +689,7 @@ public function testNewUserGroupUpdateStruct() * @depends testCreateUserGroup * @depends testNewUserGroupUpdateStruct */ - public function testUpdateUserGroup() + public function testUpdateUserGroup(): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -722,7 +722,7 @@ public function testUpdateUserGroup() * * @depends testUpdateUserGroup */ - public function testUpdateUserGroupWithSubContentUpdateStruct() + public function testUpdateUserGroupWithSubContentUpdateStruct(): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -763,7 +763,7 @@ public function testUpdateUserGroupWithSubContentUpdateStruct() * * @depends testUpdateUserGroup */ - public function testUpdateUserGroupWithSubContentMetadataUpdateStruct() + public function testUpdateUserGroupWithSubContentMetadataUpdateStruct(): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -807,7 +807,7 @@ public function testUpdateUserGroupWithSubContentMetadataUpdateStruct() * * @depends testUpdateUserGroup */ - public function testUpdateUserGroupThrowsInvalidArgumentExceptionOnFieldTypeNotAccept() + public function testUpdateUserGroupThrowsInvalidArgumentExceptionOnFieldTypeNotAccept(): void { $this->expectException(InvalidArgumentException::class); @@ -868,7 +868,7 @@ public function testNewUserCreateStruct() * * @covers \Ibexa\Contracts\Core\Repository\UserService::updateUserGroup */ - public function testUpdateUserGroupThrowsContentFieldValidationExceptionOnRequiredFieldEmpty() + public function testUpdateUserGroupThrowsContentFieldValidationExceptionOnRequiredFieldEmpty(): void { $this->expectException(ContentFieldValidationException::class); @@ -893,7 +893,7 @@ public function testUpdateUserGroupThrowsContentFieldValidationExceptionOnRequir * * @depends testNewUserCreateStruct */ - public function testNewUserCreateStructSetsExpectedProperties($userCreate) + public function testNewUserCreateStructSetsExpectedProperties($userCreate): void { self::assertEquals( [ @@ -918,7 +918,7 @@ public function testNewUserCreateStructSetsExpectedProperties($userCreate) * * @depends testNewUserCreateStruct */ - public function testNewUserCreateStructWithFifthParameter() + public function testNewUserCreateStructWithFifthParameter(): void { $repository = $this->getRepository(); @@ -986,7 +986,7 @@ public function testCreateUser() * * @depends testCreateUser */ - public function testCreateUserSetsExpectedProperties(User $user) + public function testCreateUserSetsExpectedProperties(User $user): void { self::assertEquals( [ @@ -1009,7 +1009,7 @@ public function testCreateUserSetsExpectedProperties(User $user) * * @depends testCreateUser */ - public function testCreateUserWhenMissingField() + public function testCreateUserWhenMissingField(): void { $this->expectException(ContentFieldValidationException::class); @@ -1050,7 +1050,7 @@ public function testCreateUserWhenMissingField() * * @depends testCreateUser */ - public function testCreateUserThrowsInvalidArgumentExceptionOnFieldTypeNotAccept() + public function testCreateUserThrowsInvalidArgumentExceptionOnFieldTypeNotAccept(): void { $this->expectException(InvalidArgumentException::class); @@ -1091,7 +1091,7 @@ public function testCreateUserThrowsInvalidArgumentExceptionOnFieldTypeNotAccept * * @depends testCreateUser */ - public function testCreateUserThrowsInvalidArgumentException() + public function testCreateUserThrowsInvalidArgumentException(): void { $repository = $this->getRepository(); @@ -1285,7 +1285,7 @@ public function testCreateUserInTransactionWithRollback(): void * * @covers \Ibexa\Contracts\Core\Repository\UserService::createUser */ - public function testCreateUserThrowsNotFoundException() + public function testCreateUserThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -1318,7 +1318,7 @@ public function testCreateUserThrowsNotFoundException() * * @covers \Ibexa\Contracts\Core\Repository\UserService::createUser */ - public function testCreateUserWithWeakPasswordThrowsUserPasswordValidationException() + public function testCreateUserWithWeakPasswordThrowsUserPasswordValidationException(): void { $userContentType = $this->createUserContentTypeWithStrongPassword(); @@ -1349,7 +1349,7 @@ public function testCreateUserWithWeakPasswordThrowsUserPasswordValidationExcept * * @covers \Ibexa\Contracts\Core\Repository\UserService::createUser */ - public function testCreateUserWithStrongPassword() + public function testCreateUserWithStrongPassword(): void { $userContentType = $this->createUserContentTypeWithStrongPassword(); @@ -1394,7 +1394,7 @@ public function testLoadUser(): void * * @depends testLoadUser */ - public function testLoadUserThrowsNotFoundException() + public function testLoadUserThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -1459,7 +1459,7 @@ public function testCheckUserCredentialsInvalid(): void * * @depends testCreateUser */ - public function testLoadUserByLogin() + public function testLoadUserByLogin(): void { $repository = $this->getRepository(); @@ -1496,7 +1496,7 @@ public function testLoadUserByLogin() * * @depends testLoadUserByLogin */ - public function testLoadUserByLoginThrowsNotFoundExceptionForUnknownLogin() + public function testLoadUserByLoginThrowsNotFoundExceptionForUnknownLogin(): void { $this->expectException(NotFoundException::class); @@ -1520,7 +1520,7 @@ public function testLoadUserByLoginThrowsNotFoundExceptionForUnknownLogin() * * @depends testLoadUserByLogin */ - public function testLoadUserByLoginWorksForLoginWithWrongCase() + public function testLoadUserByLoginWorksForLoginWithWrongCase(): void { $repository = $this->getRepository(); @@ -1559,7 +1559,7 @@ public function testLoadUserByLoginWorksForLoginWithWrongCase() * * @depends testLoadUserByLogin */ - public function testLoadUserByLoginThrowsNotFoundExceptionForUnknownLoginByEmail() + public function testLoadUserByLoginThrowsNotFoundExceptionForUnknownLoginByEmail(): void { $this->expectException(NotFoundException::class); @@ -1602,7 +1602,7 @@ public function testLoadUserByEmail(): void * * @depends testLoadUserByEmail */ - public function testLoadUserByEmailReturnsEmptyInUnknownEmail() + public function testLoadUserByEmailReturnsEmptyInUnknownEmail(): void { $repository = $this->getRepository(); @@ -1627,7 +1627,7 @@ public function testLoadUserByEmailReturnsEmptyInUnknownEmail() * @depends testCreateUser * @depends testLoadUser */ - public function testDeleteUser() + public function testDeleteUser(): void { $this->expectException(NotFoundException::class); @@ -1654,7 +1654,7 @@ public function testDeleteUser() * @depends testCreateUser * @depends testLoadUser */ - public function testDeleteUserDeletesRelatedBookmarks() + public function testDeleteUserDeletesRelatedBookmarks(): void { $repository = $this->getRepository(); @@ -1687,7 +1687,7 @@ public function testDeleteUserDeletesRelatedBookmarks() * * @covers \Ibexa\Contracts\Core\Repository\UserService::newUserUpdateStruct() */ - public function testNewUserUpdateStruct() + public function testNewUserUpdateStruct(): void { $repository = $this->getRepository(); @@ -1836,7 +1836,7 @@ public function testUpdateUserNoPassword(): void * * @depends testUpdateUser */ - public function testUpdateUserUpdatesExpectedProperties(User $user) + public function testUpdateUserUpdatesExpectedProperties(User $user): void { self::assertEquals( [ @@ -1871,7 +1871,7 @@ public function testUpdateUserUpdatesExpectedProperties(User $user) * * @depends testUpdateUser */ - public function testUpdateUserReturnsPublishedVersion(User $user) + public function testUpdateUserReturnsPublishedVersion(User $user): void { self::assertEquals( APIVersionInfo::STATUS_PUBLISHED, @@ -1886,7 +1886,7 @@ public function testUpdateUserReturnsPublishedVersion(User $user) * * @depends testUpdateUser */ - public function testUpdateUserWithContentMetadataUpdateStruct() + public function testUpdateUserWithContentMetadataUpdateStruct(): void { $repository = $this->getRepository(); @@ -1925,7 +1925,7 @@ public function testUpdateUserWithContentMetadataUpdateStruct() * * @depends testUpdateUser */ - public function testUpdateUserWithContentUpdateStruct() + public function testUpdateUserWithContentUpdateStruct(): void { $repository = $this->getRepository(); @@ -1968,7 +1968,7 @@ public function testUpdateUserWithContentUpdateStruct() * * @depends testUpdateUser */ - public function testUpdateUserWhenMissingField() + public function testUpdateUserWhenMissingField(): void { $this->expectException(ContentFieldValidationException::class); @@ -2006,7 +2006,7 @@ public function testUpdateUserWhenMissingField() * * @depends testUpdateUser */ - public function testUpdateUserThrowsInvalidArgumentExceptionOnFieldTypeNotAccept() + public function testUpdateUserThrowsInvalidArgumentExceptionOnFieldTypeNotAccept(): void { $this->expectException(InvalidArgumentException::class); @@ -2042,7 +2042,7 @@ public function testUpdateUserThrowsInvalidArgumentExceptionOnFieldTypeNotAccept * * @covers \Ibexa\Contracts\Core\Repository\UserService::updateUser */ - public function testUpdateUserWithWeakPasswordThrowsUserPasswordValidationException() + public function testUpdateUserWithWeakPasswordThrowsUserPasswordValidationException(): void { $userService = $this->getRepository()->getUserService(); @@ -2077,7 +2077,7 @@ public function testUpdateUserWithWeakPasswordThrowsUserPasswordValidationExcept * * @covers \Ibexa\Contracts\Core\Repository\UserService::updateUser */ - public function testUpdateUserWithStrongPassword() + public function testUpdateUserWithStrongPassword(): void { $userService = $this->getRepository()->getUserService(); @@ -2186,7 +2186,7 @@ public function testUpdateUserPasswordWithUnsupportedHashType(): void * * @depends testCreateUser */ - public function testLoadUserGroupsOfUser() + public function testLoadUserGroupsOfUser(): void { $repository = $this->getRepository(); @@ -2213,7 +2213,7 @@ public function testLoadUserGroupsOfUser() * * @depends testCreateUser */ - public function testLoadUsersOfUserGroup() + public function testLoadUsersOfUserGroup(): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -2242,7 +2242,7 @@ public function testLoadUsersOfUserGroup() * * @depends testLoadUserGroupsOfUser */ - public function testAssignUserToUserGroup() + public function testAssignUserToUserGroup(): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -2285,7 +2285,7 @@ public function testAssignUserToUserGroup() * * @depends testAssignUserToUserGroup */ - public function testAssignUserToUserGroupThrowsInvalidArgumentException() + public function testAssignUserToUserGroupThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'user\' is invalid: User is already in the given User Group'); @@ -2348,7 +2348,7 @@ public function testAssignUserToGroupWithLocationsValidation(): void * * @depends testLoadUserGroupsOfUser */ - public function testUnAssignUserFromUserGroup() + public function testUnAssignUserFromUserGroup(): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -2391,7 +2391,7 @@ public function testUnAssignUserFromUserGroup() * * @depends testUnAssignUserFromUserGroup */ - public function testUnAssignUserFromUserGroupThrowsInvalidArgumentException() + public function testUnAssignUserFromUserGroupThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -2420,7 +2420,7 @@ public function testUnAssignUserFromUserGroupThrowsInvalidArgumentException() * * @depends testUnAssignUserFromUserGroup */ - public function testUnAssignUserFromUserGroupThrowsBadStateArgumentException() + public function testUnAssignUserFromUserGroupThrowsBadStateArgumentException(): void { $this->expectException(BadStateException::class); $this->expectExceptionMessage('Argument \'user\' has a bad state: User only has one User Group, cannot unassign from last group'); @@ -2496,7 +2496,7 @@ public function testUnAssignUserToGroupWithLocationValidation(): void public function testLoadUserGroupWithPrioritizedLanguagesList( array $prioritizedLanguages, $expectedLanguageCode - ) { + ): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -2530,7 +2530,7 @@ public function testLoadUserGroupWithPrioritizedLanguagesList( public function testLoadUserGroupWithPrioritizedLanguagesListAfterMainLanguageUpdate( array $prioritizedLanguages, $expectedLanguageCode - ) { + ): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); $contentService = $repository->getContentService(); @@ -2571,7 +2571,7 @@ public function testLoadUserGroupWithPrioritizedLanguagesListAfterMainLanguageUp public function testLoadSubUserGroupsWithPrioritizedLanguagesList( array $prioritizedLanguages, $expectedLanguageCode - ) { + ): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -2613,7 +2613,7 @@ public function testLoadSubUserGroupsWithPrioritizedLanguagesList( public function testLoadUserWithPrioritizedLanguagesList( array $prioritizedLanguages, $expectedLanguageCode - ) { + ): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -2651,7 +2651,7 @@ public function testLoadUserWithPrioritizedLanguagesList( public function testLoadUserWithPrioritizedLanguagesListAfterMainLanguageUpdate( array $prioritizedLanguages, $expectedLanguageCode - ) { + ): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); $contentService = $repository->getContentService(); @@ -2696,7 +2696,7 @@ public function testLoadUserWithPrioritizedLanguagesListAfterMainLanguageUpdate( public function testLoadUserByLoginWithPrioritizedLanguagesList( array $prioritizedLanguages, $expectedLanguageCode - ) { + ): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); $user = $this->createMultiLanguageUser(); @@ -2734,7 +2734,7 @@ public function testLoadUserByLoginWithPrioritizedLanguagesList( public function testLoadUsersByEmailWithPrioritizedLanguagesList( array $prioritizedLanguages, $expectedLanguageCode - ) { + ): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); $user = $this->createMultiLanguageUser(); @@ -2773,8 +2773,8 @@ public function testLoadUsersByEmailWithPrioritizedLanguagesList( */ public function testLoadUserGroupsOfUserWithPrioritizedLanguagesList( array $prioritizedLanguages, - $expectedLanguageCode - ) { + ?string $expectedLanguageCode + ): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); $userGroup = $this->createMultiLanguageUserGroup(); @@ -2807,7 +2807,7 @@ public function testLoadUserGroupsOfUserWithPrioritizedLanguagesList( public function testLoadUsersOfUserGroupWithPrioritizedLanguagesList( array $prioritizedLanguages, $expectedLanguageCode - ) { + ): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -2848,7 +2848,7 @@ public function testLoadUsersOfUserGroupWithPrioritizedLanguagesList( * * @return array */ - public function getPrioritizedLanguageList() + public function getPrioritizedLanguageList(): array { return [ [[], null], @@ -2867,7 +2867,7 @@ public function getPrioritizedLanguageList() * * @return \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - private function createMultiLanguageUserGroup($parentGroupId = 4) + private function createMultiLanguageUserGroup($parentGroupId = 4): \Ibexa\Contracts\Core\Repository\Values\User\UserGroup { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -2925,7 +2925,7 @@ private function createUserGroupVersion1() * * @return \Ibexa\Contracts\Core\Repository\Values\User\User */ - private function createMultiLanguageUser($userGroupId = 13) + private function createMultiLanguageUser(int $userGroupId = 13): User { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -3034,7 +3034,7 @@ public function testLoadUserByToken(): string * * @param string $originalUserToken */ - public function testUpdateUserToken($originalUserToken) + public function testUpdateUserToken(string $originalUserToken): void { $repository = $this->getRepository(false); $userService = $repository->getUserService(); @@ -3060,7 +3060,7 @@ public function testUpdateUserToken($originalUserToken) * * @param string $userToken */ - public function testExpireUserToken($userToken) + public function testExpireUserToken(string $userToken): void { $this->expectException(NotFoundException::class); @@ -3093,7 +3093,7 @@ public function testLoadUserByTokenThrowsNotFoundException(): void /** * @covers \Ibexa\Contracts\Core\Repository\UserService::validatePassword() */ - public function testValidatePasswordWithDefaultContext() + public function testValidatePasswordWithDefaultContext(): void { $userService = $this->getRepository()->getUserService(); @@ -3109,7 +3109,7 @@ public function testValidatePasswordWithDefaultContext() * * @dataProvider dataProviderForValidatePassword */ - public function testValidatePassword(string $password, array $expectedErrors) + public function testValidatePassword(string $password, array $expectedErrors): void { $userService = $this->getRepository()->getUserService(); $contentType = $this->createUserContentTypeWithStrongPassword(); diff --git a/tests/integration/Core/Repository/Values/User/Limitation/ContentTypeLimitationTest.php b/tests/integration/Core/Repository/Values/User/Limitation/ContentTypeLimitationTest.php index 3a51f70c1e..fc30a90e6a 100644 --- a/tests/integration/Core/Repository/Values/User/Limitation/ContentTypeLimitationTest.php +++ b/tests/integration/Core/Repository/Values/User/Limitation/ContentTypeLimitationTest.php @@ -23,7 +23,7 @@ class ContentTypeLimitationTest extends BaseLimitationTest * * @throws \ErrorException */ - public function testContentTypeLimitationAllow() + public function testContentTypeLimitationAllow(): void { $repository = $this->getRepository(); $permissionResolver = $repository->getPermissionResolver(); @@ -93,7 +93,7 @@ public function testContentTypeLimitationAllow() * * @throws \ErrorException */ - public function testContentTypeLimitationForbid() + public function testContentTypeLimitationForbid(): void { $this->expectException(UnauthorizedException::class); @@ -151,7 +151,7 @@ public function testContentTypeLimitationForbid() /** * @throws \ErrorException */ - public function testContentTypeLimitationForbidVariant() + public function testContentTypeLimitationForbidVariant(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/Values/User/Limitation/LocationLimitationTest.php b/tests/integration/Core/Repository/Values/User/Limitation/LocationLimitationTest.php index fbd07994aa..7cdb95f388 100644 --- a/tests/integration/Core/Repository/Values/User/Limitation/LocationLimitationTest.php +++ b/tests/integration/Core/Repository/Values/User/Limitation/LocationLimitationTest.php @@ -23,7 +23,7 @@ class LocationLimitationTest extends BaseLimitationTest * * @covers \Ibexa\Contracts\Core\Repository\Values\User\Limitation\LocationLimitation */ - public function testLocationLimitationAllow() + public function testLocationLimitationAllow(): void { $repository = $this->getRepository(); $permissionResolver = $repository->getPermissionResolver(); @@ -56,7 +56,7 @@ public function testLocationLimitationAllow() ); } - public function testLocationLimitationForbid() + public function testLocationLimitationForbid(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/Values/User/Limitation/NewObjectStateLimitationTest.php b/tests/integration/Core/Repository/Values/User/Limitation/NewObjectStateLimitationTest.php index 415b8b89ac..babc5951ae 100644 --- a/tests/integration/Core/Repository/Values/User/Limitation/NewObjectStateLimitationTest.php +++ b/tests/integration/Core/Repository/Values/User/Limitation/NewObjectStateLimitationTest.php @@ -18,7 +18,7 @@ */ class NewObjectStateLimitationTest extends BaseLimitationTest { - public function testNewObjectStateLimitationAllow() + public function testNewObjectStateLimitationAllow(): void { $repository = $this->getRepository(); $notLockedState = $this->generateId('objectstate', 2); @@ -62,7 +62,7 @@ public function testNewObjectStateLimitationAllow() * * @throws \ErrorException if a mandatory test fixture not exists. */ - public function testNewObjectStateLimitationForbid() + public function testNewObjectStateLimitationForbid(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/Values/User/Limitation/NewSectionLimitationTest.php b/tests/integration/Core/Repository/Values/User/Limitation/NewSectionLimitationTest.php index eade460f7d..2f25d17a35 100644 --- a/tests/integration/Core/Repository/Values/User/Limitation/NewSectionLimitationTest.php +++ b/tests/integration/Core/Repository/Values/User/Limitation/NewSectionLimitationTest.php @@ -18,7 +18,7 @@ */ class NewSectionLimitationTest extends BaseLimitationTest { - public function testNewSectionLimitationAllow() + public function testNewSectionLimitationAllow(): void { $repository = $this->getRepository(); @@ -69,7 +69,7 @@ public function testNewSectionLimitationAllow() ); } - public function testNewSectionLimitationForbid() + public function testNewSectionLimitationForbid(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/Values/User/Limitation/OwnerLimitationTest.php b/tests/integration/Core/Repository/Values/User/Limitation/OwnerLimitationTest.php index 4bc4c30e5e..a24d7081ce 100644 --- a/tests/integration/Core/Repository/Values/User/Limitation/OwnerLimitationTest.php +++ b/tests/integration/Core/Repository/Values/User/Limitation/OwnerLimitationTest.php @@ -19,7 +19,7 @@ */ class OwnerLimitationTest extends BaseLimitationTest { - public function testOwnerLimitationAllow() + public function testOwnerLimitationAllow(): void { $this->expectException(NotFoundException::class); @@ -86,7 +86,7 @@ public function testOwnerLimitationAllow() $contentService->loadContent($content->id); } - public function testOwnerLimitationForbid() + public function testOwnerLimitationForbid(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/Values/User/Limitation/ParentContentTypeLimitationTest.php b/tests/integration/Core/Repository/Values/User/Limitation/ParentContentTypeLimitationTest.php index 2358e08bc6..e34ff65634 100644 --- a/tests/integration/Core/Repository/Values/User/Limitation/ParentContentTypeLimitationTest.php +++ b/tests/integration/Core/Repository/Values/User/Limitation/ParentContentTypeLimitationTest.php @@ -19,7 +19,7 @@ */ class ParentContentTypeLimitationTest extends BaseLimitationTest { - public function testParentContentTypeLimitationAllow() + public function testParentContentTypeLimitationAllow(): void { $repository = $this->getRepository(); $permissionResolver = $repository->getPermissionResolver(); @@ -67,7 +67,7 @@ public function testParentContentTypeLimitationAllow() ); } - public function testParentContentTypeLimitationForbid() + public function testParentContentTypeLimitationForbid(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/Values/User/Limitation/ParentDepthLimitationTest.php b/tests/integration/Core/Repository/Values/User/Limitation/ParentDepthLimitationTest.php index f89a7b3f8b..4d103c5867 100644 --- a/tests/integration/Core/Repository/Values/User/Limitation/ParentDepthLimitationTest.php +++ b/tests/integration/Core/Repository/Values/User/Limitation/ParentDepthLimitationTest.php @@ -19,7 +19,7 @@ */ class ParentDepthLimitationTest extends BaseLimitationTest { - public function testParentDepthLimitationForbid() + public function testParentDepthLimitationForbid(): void { $this->expectException(UnauthorizedException::class); @@ -59,7 +59,7 @@ public function testParentDepthLimitationForbid() ); } - public function testParentDepthLimitationAllow() + public function testParentDepthLimitationAllow(): void { $repository = $this->getRepository(); $permissionResolver = $repository->getPermissionResolver(); @@ -104,7 +104,7 @@ public function testParentDepthLimitationAllow() * * @depends testParentDepthLimitationAllow */ - public function testParentDepthLimitationAllowPublish() + public function testParentDepthLimitationAllowPublish(): void { $repository = $this->getRepository(); $permissionResolver = $repository->getPermissionResolver(); diff --git a/tests/integration/Core/Repository/Values/User/Limitation/ParentOwnerLimitationTest.php b/tests/integration/Core/Repository/Values/User/Limitation/ParentOwnerLimitationTest.php index 2e70479ef0..3ac39cdaae 100644 --- a/tests/integration/Core/Repository/Values/User/Limitation/ParentOwnerLimitationTest.php +++ b/tests/integration/Core/Repository/Values/User/Limitation/ParentOwnerLimitationTest.php @@ -18,7 +18,7 @@ */ class ParentOwnerLimitationTest extends BaseLimitationTest { - public function testParentOwnerLimitationAllow() + public function testParentOwnerLimitationAllow(): void { $repository = $this->getRepository(); @@ -61,7 +61,7 @@ public function testParentOwnerLimitationAllow() ); } - public function testParentOwnerLimitationForbid() + public function testParentOwnerLimitationForbid(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/Values/User/Limitation/ParentUserGroupLimitationTest.php b/tests/integration/Core/Repository/Values/User/Limitation/ParentUserGroupLimitationTest.php index ed6df96440..6b341f5590 100644 --- a/tests/integration/Core/Repository/Values/User/Limitation/ParentUserGroupLimitationTest.php +++ b/tests/integration/Core/Repository/Values/User/Limitation/ParentUserGroupLimitationTest.php @@ -18,7 +18,7 @@ */ class ParentUserGroupLimitationTest extends BaseLimitationTest { - public function testParentUserGroupLimitationAllow() + public function testParentUserGroupLimitationAllow(): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -80,7 +80,7 @@ public function testParentUserGroupLimitationAllow() ); } - public function testParentUserGroupLimitationForbid() + public function testParentUserGroupLimitationForbid(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/Values/User/Limitation/RolePolicyLimitationTest.php b/tests/integration/Core/Repository/Values/User/Limitation/RolePolicyLimitationTest.php index 436ad323b2..973797bb89 100644 --- a/tests/integration/Core/Repository/Values/User/Limitation/RolePolicyLimitationTest.php +++ b/tests/integration/Core/Repository/Values/User/Limitation/RolePolicyLimitationTest.php @@ -20,7 +20,7 @@ class RolePolicyLimitationTest extends BaseLimitationTest /** * Data provider for {@see testRolePoliciesWithOverlappingLimitations}. */ - public function providerForTestRolePoliciesWithOverlappingLimitations() + public function providerForTestRolePoliciesWithOverlappingLimitations(): array { // get actual locations count for the given subtree when user is (by default) an admin $actualSubtreeLocationsCount = $this->getSubtreeLocationsCount('/1/2/'); @@ -45,10 +45,10 @@ public function providerForTestRolePoliciesWithOverlappingLimitations() * @param string $widePolicyFunction */ public function testRolePoliciesWithOverlappingLimitations( - $expectedSubtreeLocationsCount, - $widePolicyModule, - $widePolicyFunction - ) { + ?int $expectedSubtreeLocationsCount, + string $widePolicyModule, + string $widePolicyFunction + ): void { $repository = $this->getRepository(); $roleService = $repository->getRoleService(); $permissionResolver = $repository->getPermissionResolver(); @@ -104,7 +104,7 @@ public function testRolePoliciesWithOverlappingLimitations( * * @return int|null */ - protected function getSubtreeLocationsCount($subtreePathString) + protected function getSubtreeLocationsCount($subtreePathString): ?int { $criterion = new Criterion\Subtree($subtreePathString); $query = new LocationQuery(['filter' => $criterion]); @@ -152,7 +152,7 @@ protected function createUserInGroup(UserGroup $group) * @param string $function * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation[] $limitations */ - protected function addPolicyToNewRole(RoleCreateStruct $roleCreateStruct, $module, $function, array $limitations) + protected function addPolicyToNewRole(RoleCreateStruct $roleCreateStruct, string $module, string $function, array $limitations) { $roleService = $this->getRepository()->getRoleService(); $policyCreateStruct = $roleService->newPolicyCreateStruct($module, $function); @@ -171,7 +171,7 @@ protected function addPolicyToNewRole(RoleCreateStruct $roleCreateStruct, $modul * * @return \Ibexa\Contracts\Core\Repository\Values\User\UserGroup */ - protected function createGroup($groupName, $mainLanguageCode, $parentGroupId) + protected function createGroup($groupName, string $mainLanguageCode, int $parentGroupId): UserGroup { $userService = $this->getRepository()->getUserService(); diff --git a/tests/integration/Core/Repository/Values/User/Limitation/SectionLimitationTest.php b/tests/integration/Core/Repository/Values/User/Limitation/SectionLimitationTest.php index b1266799f4..3b034c4a78 100644 --- a/tests/integration/Core/Repository/Values/User/Limitation/SectionLimitationTest.php +++ b/tests/integration/Core/Repository/Values/User/Limitation/SectionLimitationTest.php @@ -18,7 +18,7 @@ */ class SectionLimitationTest extends BaseLimitationTest { - public function testSectionLimitationAllow() + public function testSectionLimitationAllow(): void { $repository = $this->getRepository(); @@ -76,7 +76,7 @@ public function testSectionLimitationAllow() ); } - public function testSectionLimitationForbid() + public function testSectionLimitationForbid(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/Values/User/Limitation/StatusLimitationTest.php b/tests/integration/Core/Repository/Values/User/Limitation/StatusLimitationTest.php index ac7ff751f9..47966c8253 100644 --- a/tests/integration/Core/Repository/Values/User/Limitation/StatusLimitationTest.php +++ b/tests/integration/Core/Repository/Values/User/Limitation/StatusLimitationTest.php @@ -19,7 +19,7 @@ */ class StatusLimitationTest extends BaseLimitationTest { - public function testStatusLimitationAllow() + public function testStatusLimitationAllow(): void { $repository = $this->getRepository(); $permissionResolver = $repository->getPermissionResolver(); @@ -80,7 +80,7 @@ public function testStatusLimitationAllow() ); } - public function testStatusLimitationForbid() + public function testStatusLimitationForbid(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/Values/User/Limitation/SubtreeLimitationTest.php b/tests/integration/Core/Repository/Values/User/Limitation/SubtreeLimitationTest.php index fddc5e47f7..be1c59d094 100644 --- a/tests/integration/Core/Repository/Values/User/Limitation/SubtreeLimitationTest.php +++ b/tests/integration/Core/Repository/Values/User/Limitation/SubtreeLimitationTest.php @@ -28,7 +28,7 @@ class SubtreeLimitationTest extends BaseLimitationTest * @see \Ibexa\Contracts\Core\Repository\Values\User\Limitation\SectionLimitation * @see \Ibexa\Contracts\Core\Repository\Values\User\Limitation\SubtreeLimitation */ - public function testSubtreeLimitationAllow() + public function testSubtreeLimitationAllow(): void { $repository = $this->getRepository(); @@ -68,7 +68,7 @@ public function testSubtreeLimitationAllow() * @see \Ibexa\Contracts\Core\Repository\Values\User\Limitation\SectionLimitation * @see \Ibexa\Contracts\Core\Repository\Values\User\Limitation\SubtreeLimitation */ - public function testSubtreeLimitationForbid() + public function testSubtreeLimitationForbid(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/integration/Core/Repository/Values/User/Limitation/UserGroupLimitationTest.php b/tests/integration/Core/Repository/Values/User/Limitation/UserGroupLimitationTest.php index 34c176d004..4e05424008 100644 --- a/tests/integration/Core/Repository/Values/User/Limitation/UserGroupLimitationTest.php +++ b/tests/integration/Core/Repository/Values/User/Limitation/UserGroupLimitationTest.php @@ -20,7 +20,7 @@ */ class UserGroupLimitationTest extends BaseLimitationTest { - public function testUserGroupLimitationAllow() + public function testUserGroupLimitationAllow(): void { $repository = $this->getRepository(); $userService = $repository->getUserService(); @@ -44,7 +44,7 @@ public function testUserGroupLimitationAllow() ); } - public function testUserGroupLimitationForbid() + public function testUserGroupLimitationForbid(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/lib/Base/Container/Compiler/FieldTypeRegistryPassTest.php b/tests/lib/Base/Container/Compiler/FieldTypeRegistryPassTest.php index 7d30cdcbf2..def5cbee74 100644 --- a/tests/lib/Base/Container/Compiler/FieldTypeRegistryPassTest.php +++ b/tests/lib/Base/Container/Compiler/FieldTypeRegistryPassTest.php @@ -36,7 +36,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void /** * @dataProvider tagsProvider */ - public function testRegisterFieldType(string $tag) + public function testRegisterFieldType(string $tag): void { $fieldTypeIdentifier = 'field_type_identifier'; $serviceId = 'service_id'; @@ -58,7 +58,7 @@ public function testRegisterFieldType(string $tag) * * @param string $tag */ - public function testRegisterFieldTypeNoAlias(string $tag) + public function testRegisterFieldTypeNoAlias(string $tag): void { $this->expectException(\LogicException::class); diff --git a/tests/lib/Base/Container/Compiler/Search/FieldTypeRegistryPassTest.php b/tests/lib/Base/Container/Compiler/Search/FieldTypeRegistryPassTest.php index 1efb7e677c..526494fca9 100644 --- a/tests/lib/Base/Container/Compiler/Search/FieldTypeRegistryPassTest.php +++ b/tests/lib/Base/Container/Compiler/Search/FieldTypeRegistryPassTest.php @@ -33,7 +33,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void $container->addCompilerPass(new FieldRegistryPass()); } - public function testRegisterFieldType() + public function testRegisterFieldType(): void { $fieldTypeIdentifier = 'field_type_identifier'; $serviceId = 'service_id'; @@ -50,7 +50,7 @@ public function testRegisterFieldType() ); } - public function testRegisterFieldTypeNoAlias() + public function testRegisterFieldTypeNoAlias(): void { $this->expectException(\LogicException::class); diff --git a/tests/lib/Base/Container/Compiler/Search/Legacy/CriteriaConverterPassTest.php b/tests/lib/Base/Container/Compiler/Search/Legacy/CriteriaConverterPassTest.php index a1f9e60491..a52cf123d8 100644 --- a/tests/lib/Base/Container/Compiler/Search/Legacy/CriteriaConverterPassTest.php +++ b/tests/lib/Base/Container/Compiler/Search/Legacy/CriteriaConverterPassTest.php @@ -26,7 +26,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void $container->addCompilerPass(new CriteriaConverterPass()); } - public function testAddContentHandlers() + public function testAddContentHandlers(): void { $this->setDefinition( 'ibexa.search.legacy.gateway.criteria_converter.content', @@ -47,7 +47,7 @@ public function testAddContentHandlers() ); } - public function testAddLocationHandlers() + public function testAddLocationHandlers(): void { $this->setDefinition( 'ibexa.search.legacy.gateway.criteria_converter.location', diff --git a/tests/lib/Base/Container/Compiler/Search/Legacy/CriterionFieldValueHandlerRegistryPassTest.php b/tests/lib/Base/Container/Compiler/Search/Legacy/CriterionFieldValueHandlerRegistryPassTest.php index 7cb1b9e5f8..0502c551b9 100644 --- a/tests/lib/Base/Container/Compiler/Search/Legacy/CriterionFieldValueHandlerRegistryPassTest.php +++ b/tests/lib/Base/Container/Compiler/Search/Legacy/CriterionFieldValueHandlerRegistryPassTest.php @@ -36,7 +36,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void $container->addCompilerPass(new CriterionFieldValueHandlerRegistryPass()); } - public function testRegisterValueHandler() + public function testRegisterValueHandler(): void { $fieldTypeIdentifier = 'field_type_identifier'; $serviceId = 'service_id'; @@ -56,7 +56,7 @@ public function testRegisterValueHandler() ); } - public function testRegisterValueHandlerNoAlias() + public function testRegisterValueHandlerNoAlias(): void { $this->expectException(\LogicException::class); diff --git a/tests/lib/Base/Container/Compiler/Search/Legacy/SortClauseConverterPassTest.php b/tests/lib/Base/Container/Compiler/Search/Legacy/SortClauseConverterPassTest.php index 1fa7eb7372..4fe405fcb2 100644 --- a/tests/lib/Base/Container/Compiler/Search/Legacy/SortClauseConverterPassTest.php +++ b/tests/lib/Base/Container/Compiler/Search/Legacy/SortClauseConverterPassTest.php @@ -26,7 +26,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void $container->addCompilerPass(new SortClauseConverterPass()); } - public function testAddContentHandlers() + public function testAddContentHandlers(): void { $this->setDefinition( 'ibexa.search.legacy.gateway.sort_clause_converter.content', @@ -47,7 +47,7 @@ public function testAddContentHandlers() ); } - public function testAddLocationHandlers() + public function testAddLocationHandlers(): void { $this->setDefinition( 'ibexa.search.legacy.gateway.sort_clause_converter.location', @@ -68,7 +68,7 @@ public function testAddLocationHandlers() ); } - public function testAddLocationAndContentHandlers() + public function testAddLocationAndContentHandlers(): void { $this->setDefinition( 'ibexa.search.legacy.gateway.sort_clause_converter.content', diff --git a/tests/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPassTest.php b/tests/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPassTest.php index 3711c3b798..5802cbdae5 100644 --- a/tests/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPassTest.php +++ b/tests/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPassTest.php @@ -31,7 +31,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void /** * @dataProvider externalStorageHandlerTagsProvider */ - public function testRegisterExternalStorageHandler(string $tag) + public function testRegisterExternalStorageHandler(string $tag): void { $def = new Definition(); $fieldTypeIdentifier = 'field_type_identifier'; @@ -51,7 +51,7 @@ public function testRegisterExternalStorageHandler(string $tag) /** * @dataProvider externalStorageHandlerTagsProvider */ - public function testRegisterExternalStorageHandlerNoAlias(string $tag) + public function testRegisterExternalStorageHandlerNoAlias(string $tag): void { $this->expectException(\LogicException::class); @@ -73,7 +73,7 @@ public function testRegisterExternalStorageHandlerNoAlias(string $tag) /** * @dataProvider externalStorageHandlerGatewayTagsProvider */ - public function testRegisterExternalStorageHandlerWithGateway(string $tag) + public function testRegisterExternalStorageHandlerWithGateway(string $tag): void { $handlerDef = new Definition(); $handlerDef->setClass(GatewayBasedStorageHandler::class); @@ -105,7 +105,7 @@ public function testRegisterExternalStorageHandlerWithGateway(string $tag) /** * @dataProvider externalStorageHandlerGatewayTagsProvider */ - public function testRegisterExternalStorageHandlerWithoutRegisteredGateway(string $tag) + public function testRegisterExternalStorageHandlerWithoutRegisteredGateway(string $tag): void { $this->expectException(\LogicException::class); @@ -130,7 +130,7 @@ public function testRegisterExternalStorageHandlerWithoutRegisteredGateway(strin /** * @dataProvider externalStorageHandlerGatewayTagsProvider */ - public function testRegisterExternalStorageHandlerWithGatewayNoAlias(string $tag) + public function testRegisterExternalStorageHandlerWithGatewayNoAlias(string $tag): void { $this->expectException(\LogicException::class); @@ -161,7 +161,7 @@ public function testRegisterExternalStorageHandlerWithGatewayNoAlias(string $tag /** * @dataProvider externalStorageHandlerGatewayTagsProvider */ - public function testRegisterExternalStorageHandlerWithGatewayNoIdentifier(string $tag) + public function testRegisterExternalStorageHandlerWithGatewayNoIdentifier(string $tag): void { $this->expectException(\LogicException::class); diff --git a/tests/lib/Base/Container/Compiler/Storage/Legacy/FieldValueConverterRegistryPassTest.php b/tests/lib/Base/Container/Compiler/Storage/Legacy/FieldValueConverterRegistryPassTest.php index 9764a3adbd..2a421d456d 100644 --- a/tests/lib/Base/Container/Compiler/Storage/Legacy/FieldValueConverterRegistryPassTest.php +++ b/tests/lib/Base/Container/Compiler/Storage/Legacy/FieldValueConverterRegistryPassTest.php @@ -33,7 +33,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void $container->addCompilerPass(new FieldValueConverterRegistryPass()); } - public function testRegisterConverterNoLazy() + public function testRegisterConverterNoLazy(): void { $fieldTypeIdentifier = 'fieldtype_identifier'; $serviceId = 'some_service_id'; diff --git a/tests/lib/Base/Container/Compiler/Storage/Legacy/RoleLimitationConverterPassTest.php b/tests/lib/Base/Container/Compiler/Storage/Legacy/RoleLimitationConverterPassTest.php index cb71ba5b9c..011a4af10e 100644 --- a/tests/lib/Base/Container/Compiler/Storage/Legacy/RoleLimitationConverterPassTest.php +++ b/tests/lib/Base/Container/Compiler/Storage/Legacy/RoleLimitationConverterPassTest.php @@ -36,7 +36,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void $container->addCompilerPass(new RoleLimitationConverterPass()); } - public function testRegisterRoleLimitationConverter() + public function testRegisterRoleLimitationConverter(): void { $serviceId = 'service_id'; $def = new Definition(); diff --git a/tests/lib/Base/Container/Compiler/TaggedServiceIdsIterator/BackwardCompatibleIteratorTest.php b/tests/lib/Base/Container/Compiler/TaggedServiceIdsIterator/BackwardCompatibleIteratorTest.php index b80516d505..d2707b1ba4 100644 --- a/tests/lib/Base/Container/Compiler/TaggedServiceIdsIterator/BackwardCompatibleIteratorTest.php +++ b/tests/lib/Base/Container/Compiler/TaggedServiceIdsIterator/BackwardCompatibleIteratorTest.php @@ -9,6 +9,7 @@ namespace Ibexa\Tests\Core\Base\Container\Compiler\TaggedServiceIdsIterator; use Ibexa\Core\Base\Container\Compiler\TaggedServiceIdsIterator\BackwardCompatibleIterator; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\TaggedContainerInterface; @@ -18,10 +19,10 @@ final class BackwardCompatibleIteratorTest extends TestCase private const EXAMPLE_DEPRECATED_SERVICE_TAG = 'deprecated_tag'; /** @var \Ibexa\Tests\Core\Base\Container\Compiler\TaggedServiceIdsIterator\DeprecationErrorCollector */ - private $deprecationErrorCollector; + private DeprecationErrorCollector $deprecationErrorCollector; /** @var \Symfony\Component\DependencyInjection\TaggedContainerInterface */ - private $container; + private MockObject $container; protected function setUp(): void { diff --git a/tests/lib/Base/Container/Compiler/TaggedServiceIdsIterator/DeprecationErrorCollector.php b/tests/lib/Base/Container/Compiler/TaggedServiceIdsIterator/DeprecationErrorCollector.php index 143e244563..a41d9dc884 100644 --- a/tests/lib/Base/Container/Compiler/TaggedServiceIdsIterator/DeprecationErrorCollector.php +++ b/tests/lib/Base/Container/Compiler/TaggedServiceIdsIterator/DeprecationErrorCollector.php @@ -15,8 +15,7 @@ */ final class DeprecationErrorCollector { - /** @var array */ - private $errors = []; + private array $errors = []; /** @var callable|null */ private $previousErrorHandler; diff --git a/tests/lib/Collection/ArrayListTest.php b/tests/lib/Collection/ArrayListTest.php index 297c3cd20c..fab9937723 100644 --- a/tests/lib/Collection/ArrayListTest.php +++ b/tests/lib/Collection/ArrayListTest.php @@ -72,7 +72,7 @@ public function testFilter(): void self::assertEquals( $this->createCollection(['7', '9', '10']), - $list->filter(static fn (string $item) => ctype_digit($item)) + $list->filter(static fn (string $item): bool => ctype_digit($item)) ); } diff --git a/tests/lib/Collection/ArrayMapTest.php b/tests/lib/Collection/ArrayMapTest.php index 33d86ac2b8..cccc1ddb69 100644 --- a/tests/lib/Collection/ArrayMapTest.php +++ b/tests/lib/Collection/ArrayMapTest.php @@ -82,16 +82,16 @@ public function testExists(): void { $map = $this->createCollection(self::EXAMPLE_DATA); - self::assertTrue($map->exists(static fn ($value, $key) => $value === 'foo')); - self::assertFalse($map->exists(static fn ($value, $key) => $value === 'non-existing')); + self::assertTrue($map->exists(static fn ($value, $key): bool => $value === 'foo')); + self::assertFalse($map->exists(static fn ($value, $key): bool => $value === 'non-existing')); } public function testForAll(): void { $map = $this->createCollection(self::EXAMPLE_DATA); - self::assertTrue($map->forAll(static fn ($value, $key) => strlen($value) > 2)); - self::assertFalse($map->forAll(static fn ($value, $key) => $value === 'foo')); + self::assertTrue($map->forAll(static fn ($value, $key): bool => strlen($value) > 2)); + self::assertFalse($map->forAll(static fn ($value, $key): bool => $value === 'foo')); } protected function getExampleData(): array diff --git a/tests/lib/Event/AbstractServiceTest.php b/tests/lib/Event/AbstractServiceTest.php index d9c567610e..1746c4f719 100644 --- a/tests/lib/Event/AbstractServiceTest.php +++ b/tests/lib/Event/AbstractServiceTest.php @@ -19,8 +19,8 @@ abstract class AbstractServiceTest extends TestCase public function getEventDispatcher(string $beforeEventName, string $eventName): TraceableEventDispatcher { $eventDispatcher = new EventDispatcher(); - $eventDispatcher->addListener($beforeEventName, static function (BeforeEvent $event) {}); - $eventDispatcher->addListener($eventName, static function (AfterEvent $event) {}); + $eventDispatcher->addListener($beforeEventName, static function (BeforeEvent $event): void {}); + $eventDispatcher->addListener($eventName, static function (AfterEvent $event): void {}); return new TraceableEventDispatcher( $eventDispatcher, diff --git a/tests/lib/Event/BookmarkServiceTest.php b/tests/lib/Event/BookmarkServiceTest.php index 4e79186353..c1a6d9df8a 100644 --- a/tests/lib/Event/BookmarkServiceTest.php +++ b/tests/lib/Event/BookmarkServiceTest.php @@ -17,7 +17,7 @@ class BookmarkServiceTest extends AbstractServiceTest { - public function testCreateBookmarkEvents() + public function testCreateBookmarkEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateBookmarkEvent::class, @@ -42,7 +42,7 @@ public function testCreateBookmarkEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateBookmarkStopPropagationInBeforeEvents() + public function testCreateBookmarkStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateBookmarkEvent::class, @@ -55,7 +55,7 @@ public function testCreateBookmarkStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(BookmarkServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeCreateBookmarkEvent::class, static function (BeforeCreateBookmarkEvent $event) { + $traceableEventDispatcher->addListener(BeforeCreateBookmarkEvent::class, static function (BeforeCreateBookmarkEvent $event): void { $event->stopPropagation(); }, 10); @@ -74,7 +74,7 @@ public function testCreateBookmarkStopPropagationInBeforeEvents() ]); } - public function testDeleteBookmarkEvents() + public function testDeleteBookmarkEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteBookmarkEvent::class, @@ -99,7 +99,7 @@ public function testDeleteBookmarkEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteBookmarkStopPropagationInBeforeEvents() + public function testDeleteBookmarkStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteBookmarkEvent::class, @@ -112,7 +112,7 @@ public function testDeleteBookmarkStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(BookmarkServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteBookmarkEvent::class, static function (BeforeDeleteBookmarkEvent $event) { + $traceableEventDispatcher->addListener(BeforeDeleteBookmarkEvent::class, static function (BeforeDeleteBookmarkEvent $event): void { $event->stopPropagation(); }, 10); diff --git a/tests/lib/Event/ContentServiceTest.php b/tests/lib/Event/ContentServiceTest.php index fe98d7c941..bc42d49b8b 100644 --- a/tests/lib/Event/ContentServiceTest.php +++ b/tests/lib/Event/ContentServiceTest.php @@ -47,7 +47,7 @@ class ContentServiceTest extends AbstractServiceTest { - public function testDeleteContentEvents() + public function testDeleteContentEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteContentEvent::class, @@ -75,7 +75,7 @@ public function testDeleteContentEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnDeleteContentResultInBeforeEvents() + public function testReturnDeleteContentResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteContentEvent::class, @@ -91,7 +91,7 @@ public function testReturnDeleteContentResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('deleteContent')->willReturn($locations); - $traceableEventDispatcher->addListener(BeforeDeleteContentEvent::class, static function (BeforeDeleteContentEvent $event) use ($eventLocations) { + $traceableEventDispatcher->addListener(BeforeDeleteContentEvent::class, static function (BeforeDeleteContentEvent $event) use ($eventLocations): void { $event->setLocations($eventLocations); }, 10); @@ -109,7 +109,7 @@ public function testReturnDeleteContentResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteContentStopPropagationInBeforeEvents() + public function testDeleteContentStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteContentEvent::class, @@ -125,7 +125,7 @@ public function testDeleteContentStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('deleteContent')->willReturn($locations); - $traceableEventDispatcher->addListener(BeforeDeleteContentEvent::class, static function (BeforeDeleteContentEvent $event) use ($eventLocations) { + $traceableEventDispatcher->addListener(BeforeDeleteContentEvent::class, static function (BeforeDeleteContentEvent $event) use ($eventLocations): void { $event->setLocations($eventLocations); $event->stopPropagation(); }, 10); @@ -146,7 +146,7 @@ public function testDeleteContentStopPropagationInBeforeEvents() ]); } - public function testCopyContentEvents() + public function testCopyContentEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCopyContentEvent::class, @@ -176,7 +176,7 @@ public function testCopyContentEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCopyContentResultInBeforeEvents() + public function testReturnCopyContentResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCopyContentEvent::class, @@ -194,7 +194,7 @@ public function testReturnCopyContentResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('copyContent')->willReturn($content); - $traceableEventDispatcher->addListener(BeforeCopyContentEvent::class, static function (BeforeCopyContentEvent $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforeCopyContentEvent::class, static function (BeforeCopyContentEvent $event) use ($eventContent): void { $event->setContent($eventContent); }, 10); @@ -212,7 +212,7 @@ public function testReturnCopyContentResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCopyContentStopPropagationInBeforeEvents() + public function testCopyContentStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCopyContentEvent::class, @@ -230,7 +230,7 @@ public function testCopyContentStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('copyContent')->willReturn($content); - $traceableEventDispatcher->addListener(BeforeCopyContentEvent::class, static function (BeforeCopyContentEvent $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforeCopyContentEvent::class, static function (BeforeCopyContentEvent $event) use ($eventContent): void { $event->setContent($eventContent); $event->stopPropagation(); }, 10); @@ -251,7 +251,7 @@ public function testCopyContentStopPropagationInBeforeEvents() ]); } - public function testUpdateContentEvents() + public function testUpdateContentEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateContentEvent::class, @@ -280,7 +280,7 @@ public function testUpdateContentEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnUpdateContentResultInBeforeEvents() + public function testReturnUpdateContentResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateContentEvent::class, @@ -297,7 +297,7 @@ public function testReturnUpdateContentResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('updateContent')->willReturn($content); - $traceableEventDispatcher->addListener(BeforeUpdateContentEvent::class, static function (BeforeUpdateContentEvent $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforeUpdateContentEvent::class, static function (BeforeUpdateContentEvent $event) use ($eventContent): void { $event->setContent($eventContent); }, 10); @@ -315,7 +315,7 @@ public function testReturnUpdateContentResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUpdateContentStopPropagationInBeforeEvents() + public function testUpdateContentStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateContentEvent::class, @@ -332,7 +332,7 @@ public function testUpdateContentStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('updateContent')->willReturn($content); - $traceableEventDispatcher->addListener(BeforeUpdateContentEvent::class, static function (BeforeUpdateContentEvent $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforeUpdateContentEvent::class, static function (BeforeUpdateContentEvent $event) use ($eventContent): void { $event->setContent($eventContent); $event->stopPropagation(); }, 10); @@ -353,7 +353,7 @@ public function testUpdateContentStopPropagationInBeforeEvents() ]); } - public function testDeleteRelationEvents() + public function testDeleteRelationEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteRelationEvent::class, @@ -379,7 +379,7 @@ public function testDeleteRelationEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteRelationStopPropagationInBeforeEvents() + public function testDeleteRelationStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteRelationEvent::class, @@ -393,7 +393,7 @@ public function testDeleteRelationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteRelationEvent::class, static function (BeforeDeleteRelationEvent $event) { + $traceableEventDispatcher->addListener(BeforeDeleteRelationEvent::class, static function (BeforeDeleteRelationEvent $event): void { $event->stopPropagation(); }, 10); @@ -412,7 +412,7 @@ public function testDeleteRelationStopPropagationInBeforeEvents() ]); } - public function testCreateContentEvents() + public function testCreateContentEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateContentEvent::class, @@ -441,7 +441,7 @@ public function testCreateContentEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateContentResultInBeforeEvents() + public function testReturnCreateContentResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateContentEvent::class, @@ -458,7 +458,7 @@ public function testReturnCreateContentResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('createContent')->willReturn($content); - $traceableEventDispatcher->addListener(BeforeCreateContentEvent::class, static function (BeforeCreateContentEvent $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforeCreateContentEvent::class, static function (BeforeCreateContentEvent $event) use ($eventContent): void { $event->setContent($eventContent); }, 10); @@ -476,7 +476,7 @@ public function testReturnCreateContentResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateContentStopPropagationInBeforeEvents() + public function testCreateContentStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateContentEvent::class, @@ -493,7 +493,7 @@ public function testCreateContentStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('createContent')->willReturn($content); - $traceableEventDispatcher->addListener(BeforeCreateContentEvent::class, static function (BeforeCreateContentEvent $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforeCreateContentEvent::class, static function (BeforeCreateContentEvent $event) use ($eventContent): void { $event->setContent($eventContent); $event->stopPropagation(); }, 10); @@ -514,7 +514,7 @@ public function testCreateContentStopPropagationInBeforeEvents() ]); } - public function testHideContentEvents() + public function testHideContentEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeHideContentEvent::class, @@ -539,7 +539,7 @@ public function testHideContentEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testHideContentStopPropagationInBeforeEvents() + public function testHideContentStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeHideContentEvent::class, @@ -552,7 +552,7 @@ public function testHideContentStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeHideContentEvent::class, static function (BeforeHideContentEvent $event) { + $traceableEventDispatcher->addListener(BeforeHideContentEvent::class, static function (BeforeHideContentEvent $event): void { $event->stopPropagation(); }, 10); @@ -571,7 +571,7 @@ public function testHideContentStopPropagationInBeforeEvents() ]); } - public function testDeleteVersionEvents() + public function testDeleteVersionEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteVersionEvent::class, @@ -596,7 +596,7 @@ public function testDeleteVersionEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteVersionStopPropagationInBeforeEvents() + public function testDeleteVersionStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteVersionEvent::class, @@ -609,7 +609,7 @@ public function testDeleteVersionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteVersionEvent::class, static function (BeforeDeleteVersionEvent $event) { + $traceableEventDispatcher->addListener(BeforeDeleteVersionEvent::class, static function (BeforeDeleteVersionEvent $event): void { $event->stopPropagation(); }, 10); @@ -628,7 +628,7 @@ public function testDeleteVersionStopPropagationInBeforeEvents() ]); } - public function testAddRelationEvents() + public function testAddRelationEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAddRelationEvent::class, @@ -657,7 +657,7 @@ public function testAddRelationEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnAddRelationResultInBeforeEvents() + public function testReturnAddRelationResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAddRelationEvent::class, @@ -674,7 +674,7 @@ public function testReturnAddRelationResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('addRelation')->willReturn($relation); - $traceableEventDispatcher->addListener(BeforeAddRelationEvent::class, static function (BeforeAddRelationEvent $event) use ($eventRelation) { + $traceableEventDispatcher->addListener(BeforeAddRelationEvent::class, static function (BeforeAddRelationEvent $event) use ($eventRelation): void { $event->setRelation($eventRelation); }, 10); @@ -692,7 +692,7 @@ public function testReturnAddRelationResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testAddRelationStopPropagationInBeforeEvents() + public function testAddRelationStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAddRelationEvent::class, @@ -709,7 +709,7 @@ public function testAddRelationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('addRelation')->willReturn($relation); - $traceableEventDispatcher->addListener(BeforeAddRelationEvent::class, static function (BeforeAddRelationEvent $event) use ($eventRelation) { + $traceableEventDispatcher->addListener(BeforeAddRelationEvent::class, static function (BeforeAddRelationEvent $event) use ($eventRelation): void { $event->setRelation($eventRelation); $event->stopPropagation(); }, 10); @@ -730,7 +730,7 @@ public function testAddRelationStopPropagationInBeforeEvents() ]); } - public function testUpdateContentMetadataEvents() + public function testUpdateContentMetadataEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateContentMetadataEvent::class, @@ -759,7 +759,7 @@ public function testUpdateContentMetadataEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnUpdateContentMetadataResultInBeforeEvents() + public function testReturnUpdateContentMetadataResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateContentMetadataEvent::class, @@ -776,7 +776,7 @@ public function testReturnUpdateContentMetadataResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('updateContentMetadata')->willReturn($content); - $traceableEventDispatcher->addListener(BeforeUpdateContentMetadataEvent::class, static function (BeforeUpdateContentMetadataEvent $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforeUpdateContentMetadataEvent::class, static function (BeforeUpdateContentMetadataEvent $event) use ($eventContent): void { $event->setContent($eventContent); }, 10); @@ -794,7 +794,7 @@ public function testReturnUpdateContentMetadataResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUpdateContentMetadataStopPropagationInBeforeEvents() + public function testUpdateContentMetadataStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateContentMetadataEvent::class, @@ -811,7 +811,7 @@ public function testUpdateContentMetadataStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('updateContentMetadata')->willReturn($content); - $traceableEventDispatcher->addListener(BeforeUpdateContentMetadataEvent::class, static function (BeforeUpdateContentMetadataEvent $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforeUpdateContentMetadataEvent::class, static function (BeforeUpdateContentMetadataEvent $event) use ($eventContent): void { $event->setContent($eventContent); $event->stopPropagation(); }, 10); @@ -832,7 +832,7 @@ public function testUpdateContentMetadataStopPropagationInBeforeEvents() ]); } - public function testDeleteTranslationEvents() + public function testDeleteTranslationEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteTranslationEvent::class, @@ -858,7 +858,7 @@ public function testDeleteTranslationEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteTranslationStopPropagationInBeforeEvents() + public function testDeleteTranslationStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteTranslationEvent::class, @@ -872,7 +872,7 @@ public function testDeleteTranslationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteTranslationEvent::class, static function (BeforeDeleteTranslationEvent $event) { + $traceableEventDispatcher->addListener(BeforeDeleteTranslationEvent::class, static function (BeforeDeleteTranslationEvent $event): void { $event->stopPropagation(); }, 10); @@ -891,7 +891,7 @@ public function testDeleteTranslationStopPropagationInBeforeEvents() ]); } - public function testPublishVersionEvents() + public function testPublishVersionEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforePublishVersionEvent::class, @@ -920,7 +920,7 @@ public function testPublishVersionEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnPublishVersionResultInBeforeEvents() + public function testReturnPublishVersionResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforePublishVersionEvent::class, @@ -937,7 +937,7 @@ public function testReturnPublishVersionResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('publishVersion')->willReturn($content); - $traceableEventDispatcher->addListener(BeforePublishVersionEvent::class, static function (BeforePublishVersionEvent $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforePublishVersionEvent::class, static function (BeforePublishVersionEvent $event) use ($eventContent): void { $event->setContent($eventContent); }, 10); @@ -955,7 +955,7 @@ public function testReturnPublishVersionResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testPublishVersionStopPropagationInBeforeEvents() + public function testPublishVersionStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforePublishVersionEvent::class, @@ -972,7 +972,7 @@ public function testPublishVersionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('publishVersion')->willReturn($content); - $traceableEventDispatcher->addListener(BeforePublishVersionEvent::class, static function (BeforePublishVersionEvent $event) use ($eventContent) { + $traceableEventDispatcher->addListener(BeforePublishVersionEvent::class, static function (BeforePublishVersionEvent $event) use ($eventContent): void { $event->setContent($eventContent); $event->stopPropagation(); }, 10); @@ -993,7 +993,7 @@ public function testPublishVersionStopPropagationInBeforeEvents() ]); } - public function testCreateContentDraftEvents() + public function testCreateContentDraftEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateContentDraftEvent::class, @@ -1023,7 +1023,7 @@ public function testCreateContentDraftEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateContentDraftResultInBeforeEvents() + public function testReturnCreateContentDraftResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateContentDraftEvent::class, @@ -1041,7 +1041,7 @@ public function testReturnCreateContentDraftResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('createContentDraft')->willReturn($contentDraft); - $traceableEventDispatcher->addListener(BeforeCreateContentDraftEvent::class, static function (BeforeCreateContentDraftEvent $event) use ($eventContentDraft) { + $traceableEventDispatcher->addListener(BeforeCreateContentDraftEvent::class, static function (BeforeCreateContentDraftEvent $event) use ($eventContentDraft): void { $event->setContentDraft($eventContentDraft); }, 10); @@ -1059,7 +1059,7 @@ public function testReturnCreateContentDraftResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateContentDraftStopPropagationInBeforeEvents() + public function testCreateContentDraftStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateContentDraftEvent::class, @@ -1077,7 +1077,7 @@ public function testCreateContentDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); $innerServiceMock->method('createContentDraft')->willReturn($contentDraft); - $traceableEventDispatcher->addListener(BeforeCreateContentDraftEvent::class, static function (BeforeCreateContentDraftEvent $event) use ($eventContentDraft) { + $traceableEventDispatcher->addListener(BeforeCreateContentDraftEvent::class, static function (BeforeCreateContentDraftEvent $event) use ($eventContentDraft): void { $event->setContentDraft($eventContentDraft); $event->stopPropagation(); }, 10); @@ -1098,7 +1098,7 @@ public function testCreateContentDraftStopPropagationInBeforeEvents() ]); } - public function testRevealContentEvents() + public function testRevealContentEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRevealContentEvent::class, @@ -1123,7 +1123,7 @@ public function testRevealContentEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testRevealContentStopPropagationInBeforeEvents() + public function testRevealContentStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRevealContentEvent::class, @@ -1136,7 +1136,7 @@ public function testRevealContentStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeRevealContentEvent::class, static function (BeforeRevealContentEvent $event) { + $traceableEventDispatcher->addListener(BeforeRevealContentEvent::class, static function (BeforeRevealContentEvent $event): void { $event->stopPropagation(); }, 10); diff --git a/tests/lib/Event/ContentTypeServiceTest.php b/tests/lib/Event/ContentTypeServiceTest.php index 3b916b65bc..5a0e9757ac 100644 --- a/tests/lib/Event/ContentTypeServiceTest.php +++ b/tests/lib/Event/ContentTypeServiceTest.php @@ -53,7 +53,7 @@ class ContentTypeServiceTest extends AbstractServiceTest { - public function testAddFieldDefinitionEvents() + public function testAddFieldDefinitionEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAddFieldDefinitionEvent::class, @@ -79,7 +79,7 @@ public function testAddFieldDefinitionEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testAddFieldDefinitionStopPropagationInBeforeEvents() + public function testAddFieldDefinitionStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAddFieldDefinitionEvent::class, @@ -93,7 +93,7 @@ public function testAddFieldDefinitionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeAddFieldDefinitionEvent::class, static function (BeforeAddFieldDefinitionEvent $event) { + $traceableEventDispatcher->addListener(BeforeAddFieldDefinitionEvent::class, static function (BeforeAddFieldDefinitionEvent $event): void { $event->stopPropagation(); }, 10); @@ -112,7 +112,7 @@ public function testAddFieldDefinitionStopPropagationInBeforeEvents() ]); } - public function testDeleteContentTypeGroupEvents() + public function testDeleteContentTypeGroupEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteContentTypeGroupEvent::class, @@ -137,7 +137,7 @@ public function testDeleteContentTypeGroupEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteContentTypeGroupStopPropagationInBeforeEvents() + public function testDeleteContentTypeGroupStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteContentTypeGroupEvent::class, @@ -150,7 +150,7 @@ public function testDeleteContentTypeGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteContentTypeGroupEvent::class, static function (BeforeDeleteContentTypeGroupEvent $event) { + $traceableEventDispatcher->addListener(BeforeDeleteContentTypeGroupEvent::class, static function (BeforeDeleteContentTypeGroupEvent $event): void { $event->stopPropagation(); }, 10); @@ -169,7 +169,7 @@ public function testDeleteContentTypeGroupStopPropagationInBeforeEvents() ]); } - public function testCreateContentTypeDraftEvents() + public function testCreateContentTypeDraftEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateContentTypeDraftEvent::class, @@ -197,7 +197,7 @@ public function testCreateContentTypeDraftEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateContentTypeDraftResultInBeforeEvents() + public function testReturnCreateContentTypeDraftResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateContentTypeDraftEvent::class, @@ -213,7 +213,7 @@ public function testReturnCreateContentTypeDraftResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('createContentTypeDraft')->willReturn($contentTypeDraft); - $traceableEventDispatcher->addListener(BeforeCreateContentTypeDraftEvent::class, static function (BeforeCreateContentTypeDraftEvent $event) use ($eventContentTypeDraft) { + $traceableEventDispatcher->addListener(BeforeCreateContentTypeDraftEvent::class, static function (BeforeCreateContentTypeDraftEvent $event) use ($eventContentTypeDraft): void { $event->setContentTypeDraft($eventContentTypeDraft); }, 10); @@ -231,7 +231,7 @@ public function testReturnCreateContentTypeDraftResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateContentTypeDraftStopPropagationInBeforeEvents() + public function testCreateContentTypeDraftStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateContentTypeDraftEvent::class, @@ -247,7 +247,7 @@ public function testCreateContentTypeDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('createContentTypeDraft')->willReturn($contentTypeDraft); - $traceableEventDispatcher->addListener(BeforeCreateContentTypeDraftEvent::class, static function (BeforeCreateContentTypeDraftEvent $event) use ($eventContentTypeDraft) { + $traceableEventDispatcher->addListener(BeforeCreateContentTypeDraftEvent::class, static function (BeforeCreateContentTypeDraftEvent $event) use ($eventContentTypeDraft): void { $event->setContentTypeDraft($eventContentTypeDraft); $event->stopPropagation(); }, 10); @@ -268,7 +268,7 @@ public function testCreateContentTypeDraftStopPropagationInBeforeEvents() ]); } - public function testCreateContentTypeGroupEvents() + public function testCreateContentTypeGroupEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateContentTypeGroupEvent::class, @@ -296,7 +296,7 @@ public function testCreateContentTypeGroupEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateContentTypeGroupResultInBeforeEvents() + public function testReturnCreateContentTypeGroupResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateContentTypeGroupEvent::class, @@ -312,7 +312,7 @@ public function testReturnCreateContentTypeGroupResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('createContentTypeGroup')->willReturn($contentTypeGroup); - $traceableEventDispatcher->addListener(BeforeCreateContentTypeGroupEvent::class, static function (BeforeCreateContentTypeGroupEvent $event) use ($eventContentTypeGroup) { + $traceableEventDispatcher->addListener(BeforeCreateContentTypeGroupEvent::class, static function (BeforeCreateContentTypeGroupEvent $event) use ($eventContentTypeGroup): void { $event->setContentTypeGroup($eventContentTypeGroup); }, 10); @@ -330,7 +330,7 @@ public function testReturnCreateContentTypeGroupResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateContentTypeGroupStopPropagationInBeforeEvents() + public function testCreateContentTypeGroupStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateContentTypeGroupEvent::class, @@ -346,7 +346,7 @@ public function testCreateContentTypeGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('createContentTypeGroup')->willReturn($contentTypeGroup); - $traceableEventDispatcher->addListener(BeforeCreateContentTypeGroupEvent::class, static function (BeforeCreateContentTypeGroupEvent $event) use ($eventContentTypeGroup) { + $traceableEventDispatcher->addListener(BeforeCreateContentTypeGroupEvent::class, static function (BeforeCreateContentTypeGroupEvent $event) use ($eventContentTypeGroup): void { $event->setContentTypeGroup($eventContentTypeGroup); $event->stopPropagation(); }, 10); @@ -367,7 +367,7 @@ public function testCreateContentTypeGroupStopPropagationInBeforeEvents() ]); } - public function testUpdateContentTypeGroupEvents() + public function testUpdateContentTypeGroupEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateContentTypeGroupEvent::class, @@ -393,7 +393,7 @@ public function testUpdateContentTypeGroupEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUpdateContentTypeGroupStopPropagationInBeforeEvents() + public function testUpdateContentTypeGroupStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateContentTypeGroupEvent::class, @@ -407,7 +407,7 @@ public function testUpdateContentTypeGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeUpdateContentTypeGroupEvent::class, static function (BeforeUpdateContentTypeGroupEvent $event) { + $traceableEventDispatcher->addListener(BeforeUpdateContentTypeGroupEvent::class, static function (BeforeUpdateContentTypeGroupEvent $event): void { $event->stopPropagation(); }, 10); @@ -426,7 +426,7 @@ public function testUpdateContentTypeGroupStopPropagationInBeforeEvents() ]); } - public function testCreateContentTypeEvents() + public function testCreateContentTypeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateContentTypeEvent::class, @@ -455,7 +455,7 @@ public function testCreateContentTypeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateContentTypeResultInBeforeEvents() + public function testReturnCreateContentTypeResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateContentTypeEvent::class, @@ -472,7 +472,7 @@ public function testReturnCreateContentTypeResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('createContentType')->willReturn($contentTypeDraft); - $traceableEventDispatcher->addListener(BeforeCreateContentTypeEvent::class, static function (BeforeCreateContentTypeEvent $event) use ($eventContentTypeDraft) { + $traceableEventDispatcher->addListener(BeforeCreateContentTypeEvent::class, static function (BeforeCreateContentTypeEvent $event) use ($eventContentTypeDraft): void { $event->setContentTypeDraft($eventContentTypeDraft); }, 10); @@ -490,7 +490,7 @@ public function testReturnCreateContentTypeResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateContentTypeStopPropagationInBeforeEvents() + public function testCreateContentTypeStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateContentTypeEvent::class, @@ -507,7 +507,7 @@ public function testCreateContentTypeStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('createContentType')->willReturn($contentTypeDraft); - $traceableEventDispatcher->addListener(BeforeCreateContentTypeEvent::class, static function (BeforeCreateContentTypeEvent $event) use ($eventContentTypeDraft) { + $traceableEventDispatcher->addListener(BeforeCreateContentTypeEvent::class, static function (BeforeCreateContentTypeEvent $event) use ($eventContentTypeDraft): void { $event->setContentTypeDraft($eventContentTypeDraft); $event->stopPropagation(); }, 10); @@ -528,7 +528,7 @@ public function testCreateContentTypeStopPropagationInBeforeEvents() ]); } - public function testRemoveContentTypeTranslationEvents() + public function testRemoveContentTypeTranslationEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRemoveContentTypeTranslationEvent::class, @@ -557,7 +557,7 @@ public function testRemoveContentTypeTranslationEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnRemoveContentTypeTranslationResultInBeforeEvents() + public function testReturnRemoveContentTypeTranslationResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRemoveContentTypeTranslationEvent::class, @@ -574,7 +574,7 @@ public function testReturnRemoveContentTypeTranslationResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('removeContentTypeTranslation')->willReturn($newContentTypeDraft); - $traceableEventDispatcher->addListener(BeforeRemoveContentTypeTranslationEvent::class, static function (BeforeRemoveContentTypeTranslationEvent $event) use ($eventNewContentTypeDraft) { + $traceableEventDispatcher->addListener(BeforeRemoveContentTypeTranslationEvent::class, static function (BeforeRemoveContentTypeTranslationEvent $event) use ($eventNewContentTypeDraft): void { $event->setNewContentTypeDraft($eventNewContentTypeDraft); }, 10); @@ -592,7 +592,7 @@ public function testReturnRemoveContentTypeTranslationResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testRemoveContentTypeTranslationStopPropagationInBeforeEvents() + public function testRemoveContentTypeTranslationStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRemoveContentTypeTranslationEvent::class, @@ -609,7 +609,7 @@ public function testRemoveContentTypeTranslationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('removeContentTypeTranslation')->willReturn($newContentTypeDraft); - $traceableEventDispatcher->addListener(BeforeRemoveContentTypeTranslationEvent::class, static function (BeforeRemoveContentTypeTranslationEvent $event) use ($eventNewContentTypeDraft) { + $traceableEventDispatcher->addListener(BeforeRemoveContentTypeTranslationEvent::class, static function (BeforeRemoveContentTypeTranslationEvent $event) use ($eventNewContentTypeDraft): void { $event->setNewContentTypeDraft($eventNewContentTypeDraft); $event->stopPropagation(); }, 10); @@ -630,7 +630,7 @@ public function testRemoveContentTypeTranslationStopPropagationInBeforeEvents() ]); } - public function testUnassignContentTypeGroupEvents() + public function testUnassignContentTypeGroupEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUnassignContentTypeGroupEvent::class, @@ -656,7 +656,7 @@ public function testUnassignContentTypeGroupEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUnassignContentTypeGroupStopPropagationInBeforeEvents() + public function testUnassignContentTypeGroupStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUnassignContentTypeGroupEvent::class, @@ -670,7 +670,7 @@ public function testUnassignContentTypeGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeUnassignContentTypeGroupEvent::class, static function (BeforeUnassignContentTypeGroupEvent $event) { + $traceableEventDispatcher->addListener(BeforeUnassignContentTypeGroupEvent::class, static function (BeforeUnassignContentTypeGroupEvent $event): void { $event->stopPropagation(); }, 10); @@ -689,7 +689,7 @@ public function testUnassignContentTypeGroupStopPropagationInBeforeEvents() ]); } - public function testPublishContentTypeDraftEvents() + public function testPublishContentTypeDraftEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforePublishContentTypeDraftEvent::class, @@ -714,7 +714,7 @@ public function testPublishContentTypeDraftEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testPublishContentTypeDraftStopPropagationInBeforeEvents() + public function testPublishContentTypeDraftStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforePublishContentTypeDraftEvent::class, @@ -727,7 +727,7 @@ public function testPublishContentTypeDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforePublishContentTypeDraftEvent::class, static function (BeforePublishContentTypeDraftEvent $event) { + $traceableEventDispatcher->addListener(BeforePublishContentTypeDraftEvent::class, static function (BeforePublishContentTypeDraftEvent $event): void { $event->stopPropagation(); }, 10); @@ -746,7 +746,7 @@ public function testPublishContentTypeDraftStopPropagationInBeforeEvents() ]); } - public function testUpdateFieldDefinitionEvents() + public function testUpdateFieldDefinitionEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateFieldDefinitionEvent::class, @@ -773,7 +773,7 @@ public function testUpdateFieldDefinitionEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUpdateFieldDefinitionStopPropagationInBeforeEvents() + public function testUpdateFieldDefinitionStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateFieldDefinitionEvent::class, @@ -788,7 +788,7 @@ public function testUpdateFieldDefinitionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeUpdateFieldDefinitionEvent::class, static function (BeforeUpdateFieldDefinitionEvent $event) { + $traceableEventDispatcher->addListener(BeforeUpdateFieldDefinitionEvent::class, static function (BeforeUpdateFieldDefinitionEvent $event): void { $event->stopPropagation(); }, 10); @@ -807,7 +807,7 @@ public function testUpdateFieldDefinitionStopPropagationInBeforeEvents() ]); } - public function testRemoveFieldDefinitionEvents() + public function testRemoveFieldDefinitionEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRemoveFieldDefinitionEvent::class, @@ -833,7 +833,7 @@ public function testRemoveFieldDefinitionEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testRemoveFieldDefinitionStopPropagationInBeforeEvents() + public function testRemoveFieldDefinitionStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRemoveFieldDefinitionEvent::class, @@ -847,7 +847,7 @@ public function testRemoveFieldDefinitionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeRemoveFieldDefinitionEvent::class, static function (BeforeRemoveFieldDefinitionEvent $event) { + $traceableEventDispatcher->addListener(BeforeRemoveFieldDefinitionEvent::class, static function (BeforeRemoveFieldDefinitionEvent $event): void { $event->stopPropagation(); }, 10); @@ -866,7 +866,7 @@ public function testRemoveFieldDefinitionStopPropagationInBeforeEvents() ]); } - public function testAssignContentTypeGroupEvents() + public function testAssignContentTypeGroupEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAssignContentTypeGroupEvent::class, @@ -892,7 +892,7 @@ public function testAssignContentTypeGroupEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testAssignContentTypeGroupStopPropagationInBeforeEvents() + public function testAssignContentTypeGroupStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAssignContentTypeGroupEvent::class, @@ -906,7 +906,7 @@ public function testAssignContentTypeGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeAssignContentTypeGroupEvent::class, static function (BeforeAssignContentTypeGroupEvent $event) { + $traceableEventDispatcher->addListener(BeforeAssignContentTypeGroupEvent::class, static function (BeforeAssignContentTypeGroupEvent $event): void { $event->stopPropagation(); }, 10); @@ -925,7 +925,7 @@ public function testAssignContentTypeGroupStopPropagationInBeforeEvents() ]); } - public function testUpdateContentTypeDraftEvents() + public function testUpdateContentTypeDraftEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateContentTypeDraftEvent::class, @@ -951,7 +951,7 @@ public function testUpdateContentTypeDraftEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUpdateContentTypeDraftStopPropagationInBeforeEvents() + public function testUpdateContentTypeDraftStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateContentTypeDraftEvent::class, @@ -965,7 +965,7 @@ public function testUpdateContentTypeDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeUpdateContentTypeDraftEvent::class, static function (BeforeUpdateContentTypeDraftEvent $event) { + $traceableEventDispatcher->addListener(BeforeUpdateContentTypeDraftEvent::class, static function (BeforeUpdateContentTypeDraftEvent $event): void { $event->stopPropagation(); }, 10); @@ -984,7 +984,7 @@ public function testUpdateContentTypeDraftStopPropagationInBeforeEvents() ]); } - public function testDeleteContentTypeEvents() + public function testDeleteContentTypeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteContentTypeEvent::class, @@ -1009,7 +1009,7 @@ public function testDeleteContentTypeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteContentTypeStopPropagationInBeforeEvents() + public function testDeleteContentTypeStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteContentTypeEvent::class, @@ -1022,7 +1022,7 @@ public function testDeleteContentTypeStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteContentTypeEvent::class, static function (BeforeDeleteContentTypeEvent $event) { + $traceableEventDispatcher->addListener(BeforeDeleteContentTypeEvent::class, static function (BeforeDeleteContentTypeEvent $event): void { $event->stopPropagation(); }, 10); @@ -1041,7 +1041,7 @@ public function testDeleteContentTypeStopPropagationInBeforeEvents() ]); } - public function testCopyContentTypeEvents() + public function testCopyContentTypeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCopyContentTypeEvent::class, @@ -1070,7 +1070,7 @@ public function testCopyContentTypeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCopyContentTypeResultInBeforeEvents() + public function testReturnCopyContentTypeResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCopyContentTypeEvent::class, @@ -1087,7 +1087,7 @@ public function testReturnCopyContentTypeResultInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('copyContentType')->willReturn($contentTypeCopy); - $traceableEventDispatcher->addListener(BeforeCopyContentTypeEvent::class, static function (BeforeCopyContentTypeEvent $event) use ($eventContentTypeCopy) { + $traceableEventDispatcher->addListener(BeforeCopyContentTypeEvent::class, static function (BeforeCopyContentTypeEvent $event) use ($eventContentTypeCopy): void { $event->setContentTypeCopy($eventContentTypeCopy); }, 10); @@ -1105,7 +1105,7 @@ public function testReturnCopyContentTypeResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCopyContentTypeStopPropagationInBeforeEvents() + public function testCopyContentTypeStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCopyContentTypeEvent::class, @@ -1122,7 +1122,7 @@ public function testCopyContentTypeStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ContentTypeServiceInterface::class); $innerServiceMock->method('copyContentType')->willReturn($contentTypeCopy); - $traceableEventDispatcher->addListener(BeforeCopyContentTypeEvent::class, static function (BeforeCopyContentTypeEvent $event) use ($eventContentTypeCopy) { + $traceableEventDispatcher->addListener(BeforeCopyContentTypeEvent::class, static function (BeforeCopyContentTypeEvent $event) use ($eventContentTypeCopy): void { $event->setContentTypeCopy($eventContentTypeCopy); $event->stopPropagation(); }, 10); diff --git a/tests/lib/Event/LanguageServiceTest.php b/tests/lib/Event/LanguageServiceTest.php index c474a8d459..11c03eda5b 100644 --- a/tests/lib/Event/LanguageServiceTest.php +++ b/tests/lib/Event/LanguageServiceTest.php @@ -24,7 +24,7 @@ class LanguageServiceTest extends AbstractServiceTest { - public function testDeleteLanguageEvents() + public function testDeleteLanguageEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteLanguageEvent::class, @@ -49,7 +49,7 @@ public function testDeleteLanguageEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteLanguageStopPropagationInBeforeEvents() + public function testDeleteLanguageStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteLanguageEvent::class, @@ -62,7 +62,7 @@ public function testDeleteLanguageStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteLanguageEvent::class, static function (BeforeDeleteLanguageEvent $event) { + $traceableEventDispatcher->addListener(BeforeDeleteLanguageEvent::class, static function (BeforeDeleteLanguageEvent $event): void { $event->stopPropagation(); }, 10); @@ -81,7 +81,7 @@ public function testDeleteLanguageStopPropagationInBeforeEvents() ]); } - public function testCreateLanguageEvents() + public function testCreateLanguageEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateLanguageEvent::class, @@ -109,7 +109,7 @@ public function testCreateLanguageEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateLanguageResultInBeforeEvents() + public function testReturnCreateLanguageResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateLanguageEvent::class, @@ -125,7 +125,7 @@ public function testReturnCreateLanguageResultInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); $innerServiceMock->method('createLanguage')->willReturn($language); - $traceableEventDispatcher->addListener(BeforeCreateLanguageEvent::class, static function (BeforeCreateLanguageEvent $event) use ($eventLanguage) { + $traceableEventDispatcher->addListener(BeforeCreateLanguageEvent::class, static function (BeforeCreateLanguageEvent $event) use ($eventLanguage): void { $event->setLanguage($eventLanguage); }, 10); @@ -143,7 +143,7 @@ public function testReturnCreateLanguageResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateLanguageStopPropagationInBeforeEvents() + public function testCreateLanguageStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateLanguageEvent::class, @@ -159,7 +159,7 @@ public function testCreateLanguageStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); $innerServiceMock->method('createLanguage')->willReturn($language); - $traceableEventDispatcher->addListener(BeforeCreateLanguageEvent::class, static function (BeforeCreateLanguageEvent $event) use ($eventLanguage) { + $traceableEventDispatcher->addListener(BeforeCreateLanguageEvent::class, static function (BeforeCreateLanguageEvent $event) use ($eventLanguage): void { $event->setLanguage($eventLanguage); $event->stopPropagation(); }, 10); @@ -180,7 +180,7 @@ public function testCreateLanguageStopPropagationInBeforeEvents() ]); } - public function testUpdateLanguageNameEvents() + public function testUpdateLanguageNameEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateLanguageNameEvent::class, @@ -209,7 +209,7 @@ public function testUpdateLanguageNameEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnUpdateLanguageNameResultInBeforeEvents() + public function testReturnUpdateLanguageNameResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateLanguageNameEvent::class, @@ -226,7 +226,7 @@ public function testReturnUpdateLanguageNameResultInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); $innerServiceMock->method('updateLanguageName')->willReturn($updatedLanguage); - $traceableEventDispatcher->addListener(BeforeUpdateLanguageNameEvent::class, static function (BeforeUpdateLanguageNameEvent $event) use ($eventUpdatedLanguage) { + $traceableEventDispatcher->addListener(BeforeUpdateLanguageNameEvent::class, static function (BeforeUpdateLanguageNameEvent $event) use ($eventUpdatedLanguage): void { $event->setUpdatedLanguage($eventUpdatedLanguage); }, 10); @@ -244,7 +244,7 @@ public function testReturnUpdateLanguageNameResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUpdateLanguageNameStopPropagationInBeforeEvents() + public function testUpdateLanguageNameStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateLanguageNameEvent::class, @@ -261,7 +261,7 @@ public function testUpdateLanguageNameStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); $innerServiceMock->method('updateLanguageName')->willReturn($updatedLanguage); - $traceableEventDispatcher->addListener(BeforeUpdateLanguageNameEvent::class, static function (BeforeUpdateLanguageNameEvent $event) use ($eventUpdatedLanguage) { + $traceableEventDispatcher->addListener(BeforeUpdateLanguageNameEvent::class, static function (BeforeUpdateLanguageNameEvent $event) use ($eventUpdatedLanguage): void { $event->setUpdatedLanguage($eventUpdatedLanguage); $event->stopPropagation(); }, 10); @@ -282,7 +282,7 @@ public function testUpdateLanguageNameStopPropagationInBeforeEvents() ]); } - public function testDisableLanguageEvents() + public function testDisableLanguageEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDisableLanguageEvent::class, @@ -310,7 +310,7 @@ public function testDisableLanguageEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnDisableLanguageResultInBeforeEvents() + public function testReturnDisableLanguageResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDisableLanguageEvent::class, @@ -326,7 +326,7 @@ public function testReturnDisableLanguageResultInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); $innerServiceMock->method('disableLanguage')->willReturn($disabledLanguage); - $traceableEventDispatcher->addListener(BeforeDisableLanguageEvent::class, static function (BeforeDisableLanguageEvent $event) use ($eventDisabledLanguage) { + $traceableEventDispatcher->addListener(BeforeDisableLanguageEvent::class, static function (BeforeDisableLanguageEvent $event) use ($eventDisabledLanguage): void { $event->setDisabledLanguage($eventDisabledLanguage); }, 10); @@ -344,7 +344,7 @@ public function testReturnDisableLanguageResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDisableLanguageStopPropagationInBeforeEvents() + public function testDisableLanguageStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDisableLanguageEvent::class, @@ -360,7 +360,7 @@ public function testDisableLanguageStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); $innerServiceMock->method('disableLanguage')->willReturn($disabledLanguage); - $traceableEventDispatcher->addListener(BeforeDisableLanguageEvent::class, static function (BeforeDisableLanguageEvent $event) use ($eventDisabledLanguage) { + $traceableEventDispatcher->addListener(BeforeDisableLanguageEvent::class, static function (BeforeDisableLanguageEvent $event) use ($eventDisabledLanguage): void { $event->setDisabledLanguage($eventDisabledLanguage); $event->stopPropagation(); }, 10); @@ -381,7 +381,7 @@ public function testDisableLanguageStopPropagationInBeforeEvents() ]); } - public function testEnableLanguageEvents() + public function testEnableLanguageEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeEnableLanguageEvent::class, @@ -409,7 +409,7 @@ public function testEnableLanguageEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnEnableLanguageResultInBeforeEvents() + public function testReturnEnableLanguageResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeEnableLanguageEvent::class, @@ -425,7 +425,7 @@ public function testReturnEnableLanguageResultInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); $innerServiceMock->method('enableLanguage')->willReturn($enabledLanguage); - $traceableEventDispatcher->addListener(BeforeEnableLanguageEvent::class, static function (BeforeEnableLanguageEvent $event) use ($eventEnabledLanguage) { + $traceableEventDispatcher->addListener(BeforeEnableLanguageEvent::class, static function (BeforeEnableLanguageEvent $event) use ($eventEnabledLanguage): void { $event->setEnabledLanguage($eventEnabledLanguage); }, 10); @@ -443,7 +443,7 @@ public function testReturnEnableLanguageResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testEnableLanguageStopPropagationInBeforeEvents() + public function testEnableLanguageStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeEnableLanguageEvent::class, @@ -459,7 +459,7 @@ public function testEnableLanguageStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LanguageServiceInterface::class); $innerServiceMock->method('enableLanguage')->willReturn($enabledLanguage); - $traceableEventDispatcher->addListener(BeforeEnableLanguageEvent::class, static function (BeforeEnableLanguageEvent $event) use ($eventEnabledLanguage) { + $traceableEventDispatcher->addListener(BeforeEnableLanguageEvent::class, static function (BeforeEnableLanguageEvent $event) use ($eventEnabledLanguage): void { $event->setEnabledLanguage($eventEnabledLanguage); $event->stopPropagation(); }, 10); diff --git a/tests/lib/Event/LocationServiceTest.php b/tests/lib/Event/LocationServiceTest.php index eeeaeec6d5..97cd7ff581 100644 --- a/tests/lib/Event/LocationServiceTest.php +++ b/tests/lib/Event/LocationServiceTest.php @@ -32,7 +32,7 @@ class LocationServiceTest extends AbstractServiceTest { - public function testCopySubtreeEvents() + public function testCopySubtreeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCopySubtreeEvent::class, @@ -61,7 +61,7 @@ public function testCopySubtreeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCopySubtreeResultInBeforeEvents() + public function testReturnCopySubtreeResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCopySubtreeEvent::class, @@ -78,7 +78,7 @@ public function testReturnCopySubtreeResultInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('copySubtree')->willReturn($location); - $traceableEventDispatcher->addListener(BeforeCopySubtreeEvent::class, static function (BeforeCopySubtreeEvent $event) use ($eventLocation) { + $traceableEventDispatcher->addListener(BeforeCopySubtreeEvent::class, static function (BeforeCopySubtreeEvent $event) use ($eventLocation): void { $event->setLocation($eventLocation); }, 10); @@ -96,7 +96,7 @@ public function testReturnCopySubtreeResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCopySubtreeStopPropagationInBeforeEvents() + public function testCopySubtreeStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCopySubtreeEvent::class, @@ -113,7 +113,7 @@ public function testCopySubtreeStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('copySubtree')->willReturn($location); - $traceableEventDispatcher->addListener(BeforeCopySubtreeEvent::class, static function (BeforeCopySubtreeEvent $event) use ($eventLocation) { + $traceableEventDispatcher->addListener(BeforeCopySubtreeEvent::class, static function (BeforeCopySubtreeEvent $event) use ($eventLocation): void { $event->setLocation($eventLocation); $event->stopPropagation(); }, 10); @@ -134,7 +134,7 @@ public function testCopySubtreeStopPropagationInBeforeEvents() ]); } - public function testDeleteLocationEvents() + public function testDeleteLocationEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteLocationEvent::class, @@ -159,7 +159,7 @@ public function testDeleteLocationEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteLocationStopPropagationInBeforeEvents() + public function testDeleteLocationStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteLocationEvent::class, @@ -172,7 +172,7 @@ public function testDeleteLocationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteLocationEvent::class, static function (BeforeDeleteLocationEvent $event) { + $traceableEventDispatcher->addListener(BeforeDeleteLocationEvent::class, static function (BeforeDeleteLocationEvent $event): void { $event->stopPropagation(); }, 10); @@ -191,7 +191,7 @@ public function testDeleteLocationStopPropagationInBeforeEvents() ]); } - public function testUnhideLocationEvents() + public function testUnhideLocationEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUnhideLocationEvent::class, @@ -219,7 +219,7 @@ public function testUnhideLocationEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnUnhideLocationResultInBeforeEvents() + public function testReturnUnhideLocationResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUnhideLocationEvent::class, @@ -235,7 +235,7 @@ public function testReturnUnhideLocationResultInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('unhideLocation')->willReturn($revealedLocation); - $traceableEventDispatcher->addListener(BeforeUnhideLocationEvent::class, static function (BeforeUnhideLocationEvent $event) use ($eventRevealedLocation) { + $traceableEventDispatcher->addListener(BeforeUnhideLocationEvent::class, static function (BeforeUnhideLocationEvent $event) use ($eventRevealedLocation): void { $event->setRevealedLocation($eventRevealedLocation); }, 10); @@ -253,7 +253,7 @@ public function testReturnUnhideLocationResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUnhideLocationStopPropagationInBeforeEvents() + public function testUnhideLocationStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUnhideLocationEvent::class, @@ -269,7 +269,7 @@ public function testUnhideLocationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('unhideLocation')->willReturn($revealedLocation); - $traceableEventDispatcher->addListener(BeforeUnhideLocationEvent::class, static function (BeforeUnhideLocationEvent $event) use ($eventRevealedLocation) { + $traceableEventDispatcher->addListener(BeforeUnhideLocationEvent::class, static function (BeforeUnhideLocationEvent $event) use ($eventRevealedLocation): void { $event->setRevealedLocation($eventRevealedLocation); $event->stopPropagation(); }, 10); @@ -290,7 +290,7 @@ public function testUnhideLocationStopPropagationInBeforeEvents() ]); } - public function testHideLocationEvents() + public function testHideLocationEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeHideLocationEvent::class, @@ -318,7 +318,7 @@ public function testHideLocationEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnHideLocationResultInBeforeEvents() + public function testReturnHideLocationResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeHideLocationEvent::class, @@ -334,7 +334,7 @@ public function testReturnHideLocationResultInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('hideLocation')->willReturn($hiddenLocation); - $traceableEventDispatcher->addListener(BeforeHideLocationEvent::class, static function (BeforeHideLocationEvent $event) use ($eventHiddenLocation) { + $traceableEventDispatcher->addListener(BeforeHideLocationEvent::class, static function (BeforeHideLocationEvent $event) use ($eventHiddenLocation): void { $event->setHiddenLocation($eventHiddenLocation); }, 10); @@ -352,7 +352,7 @@ public function testReturnHideLocationResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testHideLocationStopPropagationInBeforeEvents() + public function testHideLocationStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeHideLocationEvent::class, @@ -368,7 +368,7 @@ public function testHideLocationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('hideLocation')->willReturn($hiddenLocation); - $traceableEventDispatcher->addListener(BeforeHideLocationEvent::class, static function (BeforeHideLocationEvent $event) use ($eventHiddenLocation) { + $traceableEventDispatcher->addListener(BeforeHideLocationEvent::class, static function (BeforeHideLocationEvent $event) use ($eventHiddenLocation): void { $event->setHiddenLocation($eventHiddenLocation); $event->stopPropagation(); }, 10); @@ -389,7 +389,7 @@ public function testHideLocationStopPropagationInBeforeEvents() ]); } - public function testSwapLocationEvents() + public function testSwapLocationEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeSwapLocationEvent::class, @@ -415,7 +415,7 @@ public function testSwapLocationEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testSwapLocationStopPropagationInBeforeEvents() + public function testSwapLocationStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeSwapLocationEvent::class, @@ -429,7 +429,7 @@ public function testSwapLocationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeSwapLocationEvent::class, static function (BeforeSwapLocationEvent $event) { + $traceableEventDispatcher->addListener(BeforeSwapLocationEvent::class, static function (BeforeSwapLocationEvent $event): void { $event->stopPropagation(); }, 10); @@ -448,7 +448,7 @@ public function testSwapLocationStopPropagationInBeforeEvents() ]); } - public function testMoveSubtreeEvents() + public function testMoveSubtreeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeMoveSubtreeEvent::class, @@ -474,7 +474,7 @@ public function testMoveSubtreeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testMoveSubtreeStopPropagationInBeforeEvents() + public function testMoveSubtreeStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeMoveSubtreeEvent::class, @@ -488,7 +488,7 @@ public function testMoveSubtreeStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeMoveSubtreeEvent::class, static function (BeforeMoveSubtreeEvent $event) { + $traceableEventDispatcher->addListener(BeforeMoveSubtreeEvent::class, static function (BeforeMoveSubtreeEvent $event): void { $event->stopPropagation(); }, 10); @@ -507,7 +507,7 @@ public function testMoveSubtreeStopPropagationInBeforeEvents() ]); } - public function testUpdateLocationEvents() + public function testUpdateLocationEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateLocationEvent::class, @@ -536,7 +536,7 @@ public function testUpdateLocationEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnUpdateLocationResultInBeforeEvents() + public function testReturnUpdateLocationResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateLocationEvent::class, @@ -553,7 +553,7 @@ public function testReturnUpdateLocationResultInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('updateLocation')->willReturn($updatedLocation); - $traceableEventDispatcher->addListener(BeforeUpdateLocationEvent::class, static function (BeforeUpdateLocationEvent $event) use ($eventUpdatedLocation) { + $traceableEventDispatcher->addListener(BeforeUpdateLocationEvent::class, static function (BeforeUpdateLocationEvent $event) use ($eventUpdatedLocation): void { $event->setUpdatedLocation($eventUpdatedLocation); }, 10); @@ -571,7 +571,7 @@ public function testReturnUpdateLocationResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUpdateLocationStopPropagationInBeforeEvents() + public function testUpdateLocationStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateLocationEvent::class, @@ -588,7 +588,7 @@ public function testUpdateLocationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('updateLocation')->willReturn($updatedLocation); - $traceableEventDispatcher->addListener(BeforeUpdateLocationEvent::class, static function (BeforeUpdateLocationEvent $event) use ($eventUpdatedLocation) { + $traceableEventDispatcher->addListener(BeforeUpdateLocationEvent::class, static function (BeforeUpdateLocationEvent $event) use ($eventUpdatedLocation): void { $event->setUpdatedLocation($eventUpdatedLocation); $event->stopPropagation(); }, 10); @@ -609,7 +609,7 @@ public function testUpdateLocationStopPropagationInBeforeEvents() ]); } - public function testCreateLocationEvents() + public function testCreateLocationEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateLocationEvent::class, @@ -638,7 +638,7 @@ public function testCreateLocationEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateLocationResultInBeforeEvents() + public function testReturnCreateLocationResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateLocationEvent::class, @@ -655,7 +655,7 @@ public function testReturnCreateLocationResultInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('createLocation')->willReturn($location); - $traceableEventDispatcher->addListener(BeforeCreateLocationEvent::class, static function (BeforeCreateLocationEvent $event) use ($eventLocation) { + $traceableEventDispatcher->addListener(BeforeCreateLocationEvent::class, static function (BeforeCreateLocationEvent $event) use ($eventLocation): void { $event->setLocation($eventLocation); }, 10); @@ -673,7 +673,7 @@ public function testReturnCreateLocationResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateLocationStopPropagationInBeforeEvents() + public function testCreateLocationStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateLocationEvent::class, @@ -690,7 +690,7 @@ public function testCreateLocationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(LocationServiceInterface::class); $innerServiceMock->method('createLocation')->willReturn($location); - $traceableEventDispatcher->addListener(BeforeCreateLocationEvent::class, static function (BeforeCreateLocationEvent $event) use ($eventLocation) { + $traceableEventDispatcher->addListener(BeforeCreateLocationEvent::class, static function (BeforeCreateLocationEvent $event) use ($eventLocation): void { $event->setLocation($eventLocation); $event->stopPropagation(); }, 10); diff --git a/tests/lib/Event/NotificationServiceTest.php b/tests/lib/Event/NotificationServiceTest.php index c42369c8e6..5673f4a13d 100644 --- a/tests/lib/Event/NotificationServiceTest.php +++ b/tests/lib/Event/NotificationServiceTest.php @@ -20,7 +20,7 @@ class NotificationServiceTest extends AbstractServiceTest { - public function testCreateNotificationEvents() + public function testCreateNotificationEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateNotificationEvent::class, @@ -48,7 +48,7 @@ public function testCreateNotificationEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateNotificationResultInBeforeEvents() + public function testReturnCreateNotificationResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateNotificationEvent::class, @@ -64,7 +64,7 @@ public function testReturnCreateNotificationResultInBeforeEvents() $innerServiceMock = $this->createMock(NotificationServiceInterface::class); $innerServiceMock->method('createNotification')->willReturn($notification); - $traceableEventDispatcher->addListener(BeforeCreateNotificationEvent::class, static function (BeforeCreateNotificationEvent $event) use ($eventNotification) { + $traceableEventDispatcher->addListener(BeforeCreateNotificationEvent::class, static function (BeforeCreateNotificationEvent $event) use ($eventNotification): void { $event->setNotification($eventNotification); }, 10); @@ -82,7 +82,7 @@ public function testReturnCreateNotificationResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateNotificationStopPropagationInBeforeEvents() + public function testCreateNotificationStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateNotificationEvent::class, @@ -98,7 +98,7 @@ public function testCreateNotificationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(NotificationServiceInterface::class); $innerServiceMock->method('createNotification')->willReturn($notification); - $traceableEventDispatcher->addListener(BeforeCreateNotificationEvent::class, static function (BeforeCreateNotificationEvent $event) use ($eventNotification) { + $traceableEventDispatcher->addListener(BeforeCreateNotificationEvent::class, static function (BeforeCreateNotificationEvent $event) use ($eventNotification): void { $event->setNotification($eventNotification); $event->stopPropagation(); }, 10); @@ -119,7 +119,7 @@ public function testCreateNotificationStopPropagationInBeforeEvents() ]); } - public function testDeleteNotificationEvents() + public function testDeleteNotificationEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteNotificationEvent::class, @@ -144,7 +144,7 @@ public function testDeleteNotificationEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteNotificationStopPropagationInBeforeEvents() + public function testDeleteNotificationStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteNotificationEvent::class, @@ -157,7 +157,7 @@ public function testDeleteNotificationStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(NotificationServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteNotificationEvent::class, static function (BeforeDeleteNotificationEvent $event) { + $traceableEventDispatcher->addListener(BeforeDeleteNotificationEvent::class, static function (BeforeDeleteNotificationEvent $event): void { $event->stopPropagation(); }, 10); @@ -176,7 +176,7 @@ public function testDeleteNotificationStopPropagationInBeforeEvents() ]); } - public function testMarkNotificationAsReadEvents() + public function testMarkNotificationAsReadEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeMarkNotificationAsReadEvent::class, @@ -201,7 +201,7 @@ public function testMarkNotificationAsReadEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testMarkNotificationAsReadStopPropagationInBeforeEvents() + public function testMarkNotificationAsReadStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeMarkNotificationAsReadEvent::class, @@ -214,7 +214,7 @@ public function testMarkNotificationAsReadStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(NotificationServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeMarkNotificationAsReadEvent::class, static function (BeforeMarkNotificationAsReadEvent $event) { + $traceableEventDispatcher->addListener(BeforeMarkNotificationAsReadEvent::class, static function (BeforeMarkNotificationAsReadEvent $event): void { $event->stopPropagation(); }, 10); diff --git a/tests/lib/Event/ObjectStateServiceTest.php b/tests/lib/Event/ObjectStateServiceTest.php index 2252edd57e..e5ae2c3c9f 100644 --- a/tests/lib/Event/ObjectStateServiceTest.php +++ b/tests/lib/Event/ObjectStateServiceTest.php @@ -35,7 +35,7 @@ class ObjectStateServiceTest extends AbstractServiceTest { - public function testSetContentStateEvents() + public function testSetContentStateEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeSetContentStateEvent::class, @@ -62,7 +62,7 @@ public function testSetContentStateEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testSetContentStateStopPropagationInBeforeEvents() + public function testSetContentStateStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeSetContentStateEvent::class, @@ -77,7 +77,7 @@ public function testSetContentStateStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeSetContentStateEvent::class, static function (BeforeSetContentStateEvent $event) { + $traceableEventDispatcher->addListener(BeforeSetContentStateEvent::class, static function (BeforeSetContentStateEvent $event): void { $event->stopPropagation(); }, 10); @@ -96,7 +96,7 @@ public function testSetContentStateStopPropagationInBeforeEvents() ]); } - public function testCreateObjectStateGroupEvents() + public function testCreateObjectStateGroupEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateObjectStateGroupEvent::class, @@ -124,7 +124,7 @@ public function testCreateObjectStateGroupEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateObjectStateGroupResultInBeforeEvents() + public function testReturnCreateObjectStateGroupResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateObjectStateGroupEvent::class, @@ -140,7 +140,7 @@ public function testReturnCreateObjectStateGroupResultInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); $innerServiceMock->method('createObjectStateGroup')->willReturn($objectStateGroup); - $traceableEventDispatcher->addListener(BeforeCreateObjectStateGroupEvent::class, static function (BeforeCreateObjectStateGroupEvent $event) use ($eventObjectStateGroup) { + $traceableEventDispatcher->addListener(BeforeCreateObjectStateGroupEvent::class, static function (BeforeCreateObjectStateGroupEvent $event) use ($eventObjectStateGroup): void { $event->setObjectStateGroup($eventObjectStateGroup); }, 10); @@ -158,7 +158,7 @@ public function testReturnCreateObjectStateGroupResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateObjectStateGroupStopPropagationInBeforeEvents() + public function testCreateObjectStateGroupStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateObjectStateGroupEvent::class, @@ -174,7 +174,7 @@ public function testCreateObjectStateGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); $innerServiceMock->method('createObjectStateGroup')->willReturn($objectStateGroup); - $traceableEventDispatcher->addListener(BeforeCreateObjectStateGroupEvent::class, static function (BeforeCreateObjectStateGroupEvent $event) use ($eventObjectStateGroup) { + $traceableEventDispatcher->addListener(BeforeCreateObjectStateGroupEvent::class, static function (BeforeCreateObjectStateGroupEvent $event) use ($eventObjectStateGroup): void { $event->setObjectStateGroup($eventObjectStateGroup); $event->stopPropagation(); }, 10); @@ -195,7 +195,7 @@ public function testCreateObjectStateGroupStopPropagationInBeforeEvents() ]); } - public function testUpdateObjectStateEvents() + public function testUpdateObjectStateEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateObjectStateEvent::class, @@ -224,7 +224,7 @@ public function testUpdateObjectStateEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnUpdateObjectStateResultInBeforeEvents() + public function testReturnUpdateObjectStateResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateObjectStateEvent::class, @@ -241,7 +241,7 @@ public function testReturnUpdateObjectStateResultInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); $innerServiceMock->method('updateObjectState')->willReturn($updatedObjectState); - $traceableEventDispatcher->addListener(BeforeUpdateObjectStateEvent::class, static function (BeforeUpdateObjectStateEvent $event) use ($eventUpdatedObjectState) { + $traceableEventDispatcher->addListener(BeforeUpdateObjectStateEvent::class, static function (BeforeUpdateObjectStateEvent $event) use ($eventUpdatedObjectState): void { $event->setUpdatedObjectState($eventUpdatedObjectState); }, 10); @@ -259,7 +259,7 @@ public function testReturnUpdateObjectStateResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUpdateObjectStateStopPropagationInBeforeEvents() + public function testUpdateObjectStateStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateObjectStateEvent::class, @@ -276,7 +276,7 @@ public function testUpdateObjectStateStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); $innerServiceMock->method('updateObjectState')->willReturn($updatedObjectState); - $traceableEventDispatcher->addListener(BeforeUpdateObjectStateEvent::class, static function (BeforeUpdateObjectStateEvent $event) use ($eventUpdatedObjectState) { + $traceableEventDispatcher->addListener(BeforeUpdateObjectStateEvent::class, static function (BeforeUpdateObjectStateEvent $event) use ($eventUpdatedObjectState): void { $event->setUpdatedObjectState($eventUpdatedObjectState); $event->stopPropagation(); }, 10); @@ -297,7 +297,7 @@ public function testUpdateObjectStateStopPropagationInBeforeEvents() ]); } - public function testCreateObjectStateEvents() + public function testCreateObjectStateEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateObjectStateEvent::class, @@ -326,7 +326,7 @@ public function testCreateObjectStateEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateObjectStateResultInBeforeEvents() + public function testReturnCreateObjectStateResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateObjectStateEvent::class, @@ -343,7 +343,7 @@ public function testReturnCreateObjectStateResultInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); $innerServiceMock->method('createObjectState')->willReturn($objectState); - $traceableEventDispatcher->addListener(BeforeCreateObjectStateEvent::class, static function (BeforeCreateObjectStateEvent $event) use ($eventObjectState) { + $traceableEventDispatcher->addListener(BeforeCreateObjectStateEvent::class, static function (BeforeCreateObjectStateEvent $event) use ($eventObjectState): void { $event->setObjectState($eventObjectState); }, 10); @@ -361,7 +361,7 @@ public function testReturnCreateObjectStateResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateObjectStateStopPropagationInBeforeEvents() + public function testCreateObjectStateStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateObjectStateEvent::class, @@ -378,7 +378,7 @@ public function testCreateObjectStateStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); $innerServiceMock->method('createObjectState')->willReturn($objectState); - $traceableEventDispatcher->addListener(BeforeCreateObjectStateEvent::class, static function (BeforeCreateObjectStateEvent $event) use ($eventObjectState) { + $traceableEventDispatcher->addListener(BeforeCreateObjectStateEvent::class, static function (BeforeCreateObjectStateEvent $event) use ($eventObjectState): void { $event->setObjectState($eventObjectState); $event->stopPropagation(); }, 10); @@ -399,7 +399,7 @@ public function testCreateObjectStateStopPropagationInBeforeEvents() ]); } - public function testUpdateObjectStateGroupEvents() + public function testUpdateObjectStateGroupEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateObjectStateGroupEvent::class, @@ -428,7 +428,7 @@ public function testUpdateObjectStateGroupEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnUpdateObjectStateGroupResultInBeforeEvents() + public function testReturnUpdateObjectStateGroupResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateObjectStateGroupEvent::class, @@ -445,7 +445,7 @@ public function testReturnUpdateObjectStateGroupResultInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); $innerServiceMock->method('updateObjectStateGroup')->willReturn($updatedObjectStateGroup); - $traceableEventDispatcher->addListener(BeforeUpdateObjectStateGroupEvent::class, static function (BeforeUpdateObjectStateGroupEvent $event) use ($eventUpdatedObjectStateGroup) { + $traceableEventDispatcher->addListener(BeforeUpdateObjectStateGroupEvent::class, static function (BeforeUpdateObjectStateGroupEvent $event) use ($eventUpdatedObjectStateGroup): void { $event->setUpdatedObjectStateGroup($eventUpdatedObjectStateGroup); }, 10); @@ -463,7 +463,7 @@ public function testReturnUpdateObjectStateGroupResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUpdateObjectStateGroupStopPropagationInBeforeEvents() + public function testUpdateObjectStateGroupStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateObjectStateGroupEvent::class, @@ -480,7 +480,7 @@ public function testUpdateObjectStateGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); $innerServiceMock->method('updateObjectStateGroup')->willReturn($updatedObjectStateGroup); - $traceableEventDispatcher->addListener(BeforeUpdateObjectStateGroupEvent::class, static function (BeforeUpdateObjectStateGroupEvent $event) use ($eventUpdatedObjectStateGroup) { + $traceableEventDispatcher->addListener(BeforeUpdateObjectStateGroupEvent::class, static function (BeforeUpdateObjectStateGroupEvent $event) use ($eventUpdatedObjectStateGroup): void { $event->setUpdatedObjectStateGroup($eventUpdatedObjectStateGroup); $event->stopPropagation(); }, 10); @@ -501,7 +501,7 @@ public function testUpdateObjectStateGroupStopPropagationInBeforeEvents() ]); } - public function testSetPriorityOfObjectStateEvents() + public function testSetPriorityOfObjectStateEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeSetPriorityOfObjectStateEvent::class, @@ -527,7 +527,7 @@ public function testSetPriorityOfObjectStateEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testSetPriorityOfObjectStateStopPropagationInBeforeEvents() + public function testSetPriorityOfObjectStateStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeSetPriorityOfObjectStateEvent::class, @@ -541,7 +541,7 @@ public function testSetPriorityOfObjectStateStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeSetPriorityOfObjectStateEvent::class, static function (BeforeSetPriorityOfObjectStateEvent $event) { + $traceableEventDispatcher->addListener(BeforeSetPriorityOfObjectStateEvent::class, static function (BeforeSetPriorityOfObjectStateEvent $event): void { $event->stopPropagation(); }, 10); @@ -560,7 +560,7 @@ public function testSetPriorityOfObjectStateStopPropagationInBeforeEvents() ]); } - public function testDeleteObjectStateGroupEvents() + public function testDeleteObjectStateGroupEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteObjectStateGroupEvent::class, @@ -585,7 +585,7 @@ public function testDeleteObjectStateGroupEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteObjectStateGroupStopPropagationInBeforeEvents() + public function testDeleteObjectStateGroupStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteObjectStateGroupEvent::class, @@ -598,7 +598,7 @@ public function testDeleteObjectStateGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteObjectStateGroupEvent::class, static function (BeforeDeleteObjectStateGroupEvent $event) { + $traceableEventDispatcher->addListener(BeforeDeleteObjectStateGroupEvent::class, static function (BeforeDeleteObjectStateGroupEvent $event): void { $event->stopPropagation(); }, 10); @@ -617,7 +617,7 @@ public function testDeleteObjectStateGroupStopPropagationInBeforeEvents() ]); } - public function testDeleteObjectStateEvents() + public function testDeleteObjectStateEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteObjectStateEvent::class, @@ -642,7 +642,7 @@ public function testDeleteObjectStateEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteObjectStateStopPropagationInBeforeEvents() + public function testDeleteObjectStateStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteObjectStateEvent::class, @@ -655,7 +655,7 @@ public function testDeleteObjectStateStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(ObjectStateServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteObjectStateEvent::class, static function (BeforeDeleteObjectStateEvent $event) { + $traceableEventDispatcher->addListener(BeforeDeleteObjectStateEvent::class, static function (BeforeDeleteObjectStateEvent $event): void { $event->stopPropagation(); }, 10); diff --git a/tests/lib/Event/RoleServiceTest.php b/tests/lib/Event/RoleServiceTest.php index 59168bb8d9..32ecfb674d 100644 --- a/tests/lib/Event/RoleServiceTest.php +++ b/tests/lib/Event/RoleServiceTest.php @@ -47,7 +47,7 @@ class RoleServiceTest extends AbstractServiceTest { - public function testPublishRoleDraftEvents() + public function testPublishRoleDraftEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforePublishRoleDraftEvent::class, @@ -72,7 +72,7 @@ public function testPublishRoleDraftEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testPublishRoleDraftStopPropagationInBeforeEvents() + public function testPublishRoleDraftStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforePublishRoleDraftEvent::class, @@ -85,7 +85,7 @@ public function testPublishRoleDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); - $traceableEventDispatcher->addListener(BeforePublishRoleDraftEvent::class, static function (BeforePublishRoleDraftEvent $event) { + $traceableEventDispatcher->addListener(BeforePublishRoleDraftEvent::class, static function (BeforePublishRoleDraftEvent $event): void { $event->stopPropagation(); }, 10); @@ -104,7 +104,7 @@ public function testPublishRoleDraftStopPropagationInBeforeEvents() ]); } - public function testAssignRoleToUserEvents() + public function testAssignRoleToUserEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAssignRoleToUserEvent::class, @@ -131,7 +131,7 @@ public function testAssignRoleToUserEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testAssignRoleToUserStopPropagationInBeforeEvents() + public function testAssignRoleToUserStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAssignRoleToUserEvent::class, @@ -146,7 +146,7 @@ public function testAssignRoleToUserStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeAssignRoleToUserEvent::class, static function (BeforeAssignRoleToUserEvent $event) { + $traceableEventDispatcher->addListener(BeforeAssignRoleToUserEvent::class, static function (BeforeAssignRoleToUserEvent $event): void { $event->stopPropagation(); }, 10); @@ -165,7 +165,7 @@ public function testAssignRoleToUserStopPropagationInBeforeEvents() ]); } - public function testUpdateRoleDraftEvents() + public function testUpdateRoleDraftEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateRoleDraftEvent::class, @@ -194,7 +194,7 @@ public function testUpdateRoleDraftEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnUpdateRoleDraftResultInBeforeEvents() + public function testReturnUpdateRoleDraftResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateRoleDraftEvent::class, @@ -211,7 +211,7 @@ public function testReturnUpdateRoleDraftResultInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('updateRoleDraft')->willReturn($updatedRoleDraft); - $traceableEventDispatcher->addListener(BeforeUpdateRoleDraftEvent::class, static function (BeforeUpdateRoleDraftEvent $event) use ($eventUpdatedRoleDraft) { + $traceableEventDispatcher->addListener(BeforeUpdateRoleDraftEvent::class, static function (BeforeUpdateRoleDraftEvent $event) use ($eventUpdatedRoleDraft): void { $event->setUpdatedRoleDraft($eventUpdatedRoleDraft); }, 10); @@ -229,7 +229,7 @@ public function testReturnUpdateRoleDraftResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUpdateRoleDraftStopPropagationInBeforeEvents() + public function testUpdateRoleDraftStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateRoleDraftEvent::class, @@ -246,7 +246,7 @@ public function testUpdateRoleDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('updateRoleDraft')->willReturn($updatedRoleDraft); - $traceableEventDispatcher->addListener(BeforeUpdateRoleDraftEvent::class, static function (BeforeUpdateRoleDraftEvent $event) use ($eventUpdatedRoleDraft) { + $traceableEventDispatcher->addListener(BeforeUpdateRoleDraftEvent::class, static function (BeforeUpdateRoleDraftEvent $event) use ($eventUpdatedRoleDraft): void { $event->setUpdatedRoleDraft($eventUpdatedRoleDraft); $event->stopPropagation(); }, 10); @@ -267,7 +267,7 @@ public function testUpdateRoleDraftStopPropagationInBeforeEvents() ]); } - public function testAssignRoleToUserGroupEvents() + public function testAssignRoleToUserGroupEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAssignRoleToUserGroupEvent::class, @@ -294,7 +294,7 @@ public function testAssignRoleToUserGroupEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testAssignRoleToUserGroupStopPropagationInBeforeEvents() + public function testAssignRoleToUserGroupStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAssignRoleToUserGroupEvent::class, @@ -309,7 +309,7 @@ public function testAssignRoleToUserGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeAssignRoleToUserGroupEvent::class, static function (BeforeAssignRoleToUserGroupEvent $event) { + $traceableEventDispatcher->addListener(BeforeAssignRoleToUserGroupEvent::class, static function (BeforeAssignRoleToUserGroupEvent $event): void { $event->stopPropagation(); }, 10); @@ -328,7 +328,7 @@ public function testAssignRoleToUserGroupStopPropagationInBeforeEvents() ]); } - public function testUpdatePolicyByRoleDraftEvents() + public function testUpdatePolicyByRoleDraftEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdatePolicyByRoleDraftEvent::class, @@ -358,7 +358,7 @@ public function testUpdatePolicyByRoleDraftEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnUpdatePolicyByRoleDraftResultInBeforeEvents() + public function testReturnUpdatePolicyByRoleDraftResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdatePolicyByRoleDraftEvent::class, @@ -376,7 +376,7 @@ public function testReturnUpdatePolicyByRoleDraftResultInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('updatePolicyByRoleDraft')->willReturn($updatedPolicyDraft); - $traceableEventDispatcher->addListener(BeforeUpdatePolicyByRoleDraftEvent::class, static function (BeforeUpdatePolicyByRoleDraftEvent $event) use ($eventUpdatedPolicyDraft) { + $traceableEventDispatcher->addListener(BeforeUpdatePolicyByRoleDraftEvent::class, static function (BeforeUpdatePolicyByRoleDraftEvent $event) use ($eventUpdatedPolicyDraft): void { $event->setUpdatedPolicyDraft($eventUpdatedPolicyDraft); }, 10); @@ -394,7 +394,7 @@ public function testReturnUpdatePolicyByRoleDraftResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUpdatePolicyByRoleDraftStopPropagationInBeforeEvents() + public function testUpdatePolicyByRoleDraftStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdatePolicyByRoleDraftEvent::class, @@ -412,7 +412,7 @@ public function testUpdatePolicyByRoleDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('updatePolicyByRoleDraft')->willReturn($updatedPolicyDraft); - $traceableEventDispatcher->addListener(BeforeUpdatePolicyByRoleDraftEvent::class, static function (BeforeUpdatePolicyByRoleDraftEvent $event) use ($eventUpdatedPolicyDraft) { + $traceableEventDispatcher->addListener(BeforeUpdatePolicyByRoleDraftEvent::class, static function (BeforeUpdatePolicyByRoleDraftEvent $event) use ($eventUpdatedPolicyDraft): void { $event->setUpdatedPolicyDraft($eventUpdatedPolicyDraft); $event->stopPropagation(); }, 10); @@ -433,7 +433,7 @@ public function testUpdatePolicyByRoleDraftStopPropagationInBeforeEvents() ]); } - public function testCreateRoleEvents() + public function testCreateRoleEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateRoleEvent::class, @@ -461,7 +461,7 @@ public function testCreateRoleEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateRoleResultInBeforeEvents() + public function testReturnCreateRoleResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateRoleEvent::class, @@ -477,7 +477,7 @@ public function testReturnCreateRoleResultInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('createRole')->willReturn($roleDraft); - $traceableEventDispatcher->addListener(BeforeCreateRoleEvent::class, static function (BeforeCreateRoleEvent $event) use ($eventRoleDraft) { + $traceableEventDispatcher->addListener(BeforeCreateRoleEvent::class, static function (BeforeCreateRoleEvent $event) use ($eventRoleDraft): void { $event->setRoleDraft($eventRoleDraft); }, 10); @@ -495,7 +495,7 @@ public function testReturnCreateRoleResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateRoleStopPropagationInBeforeEvents() + public function testCreateRoleStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateRoleEvent::class, @@ -511,7 +511,7 @@ public function testCreateRoleStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('createRole')->willReturn($roleDraft); - $traceableEventDispatcher->addListener(BeforeCreateRoleEvent::class, static function (BeforeCreateRoleEvent $event) use ($eventRoleDraft) { + $traceableEventDispatcher->addListener(BeforeCreateRoleEvent::class, static function (BeforeCreateRoleEvent $event) use ($eventRoleDraft): void { $event->setRoleDraft($eventRoleDraft); $event->stopPropagation(); }, 10); @@ -532,7 +532,7 @@ public function testCreateRoleStopPropagationInBeforeEvents() ]); } - public function testRemovePolicyByRoleDraftEvents() + public function testRemovePolicyByRoleDraftEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRemovePolicyByRoleDraftEvent::class, @@ -561,7 +561,7 @@ public function testRemovePolicyByRoleDraftEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnRemovePolicyByRoleDraftResultInBeforeEvents() + public function testReturnRemovePolicyByRoleDraftResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRemovePolicyByRoleDraftEvent::class, @@ -578,7 +578,7 @@ public function testReturnRemovePolicyByRoleDraftResultInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('removePolicyByRoleDraft')->willReturn($updatedRoleDraft); - $traceableEventDispatcher->addListener(BeforeRemovePolicyByRoleDraftEvent::class, static function (BeforeRemovePolicyByRoleDraftEvent $event) use ($eventUpdatedRoleDraft) { + $traceableEventDispatcher->addListener(BeforeRemovePolicyByRoleDraftEvent::class, static function (BeforeRemovePolicyByRoleDraftEvent $event) use ($eventUpdatedRoleDraft): void { $event->setUpdatedRoleDraft($eventUpdatedRoleDraft); }, 10); @@ -596,7 +596,7 @@ public function testReturnRemovePolicyByRoleDraftResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testRemovePolicyByRoleDraftStopPropagationInBeforeEvents() + public function testRemovePolicyByRoleDraftStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRemovePolicyByRoleDraftEvent::class, @@ -613,7 +613,7 @@ public function testRemovePolicyByRoleDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('removePolicyByRoleDraft')->willReturn($updatedRoleDraft); - $traceableEventDispatcher->addListener(BeforeRemovePolicyByRoleDraftEvent::class, static function (BeforeRemovePolicyByRoleDraftEvent $event) use ($eventUpdatedRoleDraft) { + $traceableEventDispatcher->addListener(BeforeRemovePolicyByRoleDraftEvent::class, static function (BeforeRemovePolicyByRoleDraftEvent $event) use ($eventUpdatedRoleDraft): void { $event->setUpdatedRoleDraft($eventUpdatedRoleDraft); $event->stopPropagation(); }, 10); @@ -634,7 +634,7 @@ public function testRemovePolicyByRoleDraftStopPropagationInBeforeEvents() ]); } - public function testAddPolicyByRoleDraftEvents() + public function testAddPolicyByRoleDraftEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAddPolicyByRoleDraftEvent::class, @@ -663,7 +663,7 @@ public function testAddPolicyByRoleDraftEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnAddPolicyByRoleDraftResultInBeforeEvents() + public function testReturnAddPolicyByRoleDraftResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAddPolicyByRoleDraftEvent::class, @@ -680,7 +680,7 @@ public function testReturnAddPolicyByRoleDraftResultInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('addPolicyByRoleDraft')->willReturn($updatedRoleDraft); - $traceableEventDispatcher->addListener(BeforeAddPolicyByRoleDraftEvent::class, static function (BeforeAddPolicyByRoleDraftEvent $event) use ($eventUpdatedRoleDraft) { + $traceableEventDispatcher->addListener(BeforeAddPolicyByRoleDraftEvent::class, static function (BeforeAddPolicyByRoleDraftEvent $event) use ($eventUpdatedRoleDraft): void { $event->setUpdatedRoleDraft($eventUpdatedRoleDraft); }, 10); @@ -698,7 +698,7 @@ public function testReturnAddPolicyByRoleDraftResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testAddPolicyByRoleDraftStopPropagationInBeforeEvents() + public function testAddPolicyByRoleDraftStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAddPolicyByRoleDraftEvent::class, @@ -715,7 +715,7 @@ public function testAddPolicyByRoleDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('addPolicyByRoleDraft')->willReturn($updatedRoleDraft); - $traceableEventDispatcher->addListener(BeforeAddPolicyByRoleDraftEvent::class, static function (BeforeAddPolicyByRoleDraftEvent $event) use ($eventUpdatedRoleDraft) { + $traceableEventDispatcher->addListener(BeforeAddPolicyByRoleDraftEvent::class, static function (BeforeAddPolicyByRoleDraftEvent $event) use ($eventUpdatedRoleDraft): void { $event->setUpdatedRoleDraft($eventUpdatedRoleDraft); $event->stopPropagation(); }, 10); @@ -736,7 +736,7 @@ public function testAddPolicyByRoleDraftStopPropagationInBeforeEvents() ]); } - public function testDeleteRoleEvents() + public function testDeleteRoleEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteRoleEvent::class, @@ -761,7 +761,7 @@ public function testDeleteRoleEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteRoleStopPropagationInBeforeEvents() + public function testDeleteRoleStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteRoleEvent::class, @@ -774,7 +774,7 @@ public function testDeleteRoleStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteRoleEvent::class, static function (BeforeDeleteRoleEvent $event) { + $traceableEventDispatcher->addListener(BeforeDeleteRoleEvent::class, static function (BeforeDeleteRoleEvent $event): void { $event->stopPropagation(); }, 10); @@ -793,7 +793,7 @@ public function testDeleteRoleStopPropagationInBeforeEvents() ]); } - public function testDeleteRoleDraftEvents() + public function testDeleteRoleDraftEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteRoleDraftEvent::class, @@ -818,7 +818,7 @@ public function testDeleteRoleDraftEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteRoleDraftStopPropagationInBeforeEvents() + public function testDeleteRoleDraftStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteRoleDraftEvent::class, @@ -831,7 +831,7 @@ public function testDeleteRoleDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteRoleDraftEvent::class, static function (BeforeDeleteRoleDraftEvent $event) { + $traceableEventDispatcher->addListener(BeforeDeleteRoleDraftEvent::class, static function (BeforeDeleteRoleDraftEvent $event): void { $event->stopPropagation(); }, 10); @@ -850,7 +850,7 @@ public function testDeleteRoleDraftStopPropagationInBeforeEvents() ]); } - public function testRemoveRoleAssignmentEvents() + public function testRemoveRoleAssignmentEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRemoveRoleAssignmentEvent::class, @@ -875,7 +875,7 @@ public function testRemoveRoleAssignmentEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testRemoveRoleAssignmentStopPropagationInBeforeEvents() + public function testRemoveRoleAssignmentStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRemoveRoleAssignmentEvent::class, @@ -888,7 +888,7 @@ public function testRemoveRoleAssignmentStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeRemoveRoleAssignmentEvent::class, static function (BeforeRemoveRoleAssignmentEvent $event) { + $traceableEventDispatcher->addListener(BeforeRemoveRoleAssignmentEvent::class, static function (BeforeRemoveRoleAssignmentEvent $event): void { $event->stopPropagation(); }, 10); @@ -907,7 +907,7 @@ public function testRemoveRoleAssignmentStopPropagationInBeforeEvents() ]); } - public function testCreateRoleDraftEvents() + public function testCreateRoleDraftEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateRoleDraftEvent::class, @@ -935,7 +935,7 @@ public function testCreateRoleDraftEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateRoleDraftResultInBeforeEvents() + public function testReturnCreateRoleDraftResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateRoleDraftEvent::class, @@ -951,7 +951,7 @@ public function testReturnCreateRoleDraftResultInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('createRoleDraft')->willReturn($roleDraft); - $traceableEventDispatcher->addListener(BeforeCreateRoleDraftEvent::class, static function (BeforeCreateRoleDraftEvent $event) use ($eventRoleDraft) { + $traceableEventDispatcher->addListener(BeforeCreateRoleDraftEvent::class, static function (BeforeCreateRoleDraftEvent $event) use ($eventRoleDraft): void { $event->setRoleDraft($eventRoleDraft); }, 10); @@ -969,7 +969,7 @@ public function testReturnCreateRoleDraftResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateRoleDraftStopPropagationInBeforeEvents() + public function testCreateRoleDraftStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateRoleDraftEvent::class, @@ -985,7 +985,7 @@ public function testCreateRoleDraftStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(RoleServiceInterface::class); $innerServiceMock->method('createRoleDraft')->willReturn($roleDraft); - $traceableEventDispatcher->addListener(BeforeCreateRoleDraftEvent::class, static function (BeforeCreateRoleDraftEvent $event) use ($eventRoleDraft) { + $traceableEventDispatcher->addListener(BeforeCreateRoleDraftEvent::class, static function (BeforeCreateRoleDraftEvent $event) use ($eventRoleDraft): void { $event->setRoleDraft($eventRoleDraft); $event->stopPropagation(); }, 10); diff --git a/tests/lib/Event/SectionServiceTest.php b/tests/lib/Event/SectionServiceTest.php index 5b84b2910d..06028b7a30 100644 --- a/tests/lib/Event/SectionServiceTest.php +++ b/tests/lib/Event/SectionServiceTest.php @@ -27,7 +27,7 @@ class SectionServiceTest extends AbstractServiceTest { - public function testAssignSectionEvents() + public function testAssignSectionEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAssignSectionEvent::class, @@ -53,7 +53,7 @@ public function testAssignSectionEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testAssignSectionStopPropagationInBeforeEvents() + public function testAssignSectionStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAssignSectionEvent::class, @@ -67,7 +67,7 @@ public function testAssignSectionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(SectionServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeAssignSectionEvent::class, static function (BeforeAssignSectionEvent $event) { + $traceableEventDispatcher->addListener(BeforeAssignSectionEvent::class, static function (BeforeAssignSectionEvent $event): void { $event->stopPropagation(); }, 10); @@ -86,7 +86,7 @@ public function testAssignSectionStopPropagationInBeforeEvents() ]); } - public function testUpdateSectionEvents() + public function testUpdateSectionEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateSectionEvent::class, @@ -115,7 +115,7 @@ public function testUpdateSectionEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnUpdateSectionResultInBeforeEvents() + public function testReturnUpdateSectionResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateSectionEvent::class, @@ -132,7 +132,7 @@ public function testReturnUpdateSectionResultInBeforeEvents() $innerServiceMock = $this->createMock(SectionServiceInterface::class); $innerServiceMock->method('updateSection')->willReturn($updatedSection); - $traceableEventDispatcher->addListener(BeforeUpdateSectionEvent::class, static function (BeforeUpdateSectionEvent $event) use ($eventUpdatedSection) { + $traceableEventDispatcher->addListener(BeforeUpdateSectionEvent::class, static function (BeforeUpdateSectionEvent $event) use ($eventUpdatedSection): void { $event->setUpdatedSection($eventUpdatedSection); }, 10); @@ -150,7 +150,7 @@ public function testReturnUpdateSectionResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUpdateSectionStopPropagationInBeforeEvents() + public function testUpdateSectionStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateSectionEvent::class, @@ -167,7 +167,7 @@ public function testUpdateSectionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(SectionServiceInterface::class); $innerServiceMock->method('updateSection')->willReturn($updatedSection); - $traceableEventDispatcher->addListener(BeforeUpdateSectionEvent::class, static function (BeforeUpdateSectionEvent $event) use ($eventUpdatedSection) { + $traceableEventDispatcher->addListener(BeforeUpdateSectionEvent::class, static function (BeforeUpdateSectionEvent $event) use ($eventUpdatedSection): void { $event->setUpdatedSection($eventUpdatedSection); $event->stopPropagation(); }, 10); @@ -188,7 +188,7 @@ public function testUpdateSectionStopPropagationInBeforeEvents() ]); } - public function testAssignSectionToSubtreeEvents() + public function testAssignSectionToSubtreeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAssignSectionToSubtreeEvent::class, @@ -214,7 +214,7 @@ public function testAssignSectionToSubtreeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testAssignSectionToSubtreeStopPropagationInBeforeEvents() + public function testAssignSectionToSubtreeStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAssignSectionToSubtreeEvent::class, @@ -228,7 +228,7 @@ public function testAssignSectionToSubtreeStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(SectionServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeAssignSectionToSubtreeEvent::class, static function (BeforeAssignSectionToSubtreeEvent $event) { + $traceableEventDispatcher->addListener(BeforeAssignSectionToSubtreeEvent::class, static function (BeforeAssignSectionToSubtreeEvent $event): void { $event->stopPropagation(); }, 10); @@ -247,7 +247,7 @@ public function testAssignSectionToSubtreeStopPropagationInBeforeEvents() ]); } - public function testDeleteSectionEvents() + public function testDeleteSectionEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteSectionEvent::class, @@ -272,7 +272,7 @@ public function testDeleteSectionEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteSectionStopPropagationInBeforeEvents() + public function testDeleteSectionStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteSectionEvent::class, @@ -285,7 +285,7 @@ public function testDeleteSectionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(SectionServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeDeleteSectionEvent::class, static function (BeforeDeleteSectionEvent $event) { + $traceableEventDispatcher->addListener(BeforeDeleteSectionEvent::class, static function (BeforeDeleteSectionEvent $event): void { $event->stopPropagation(); }, 10); @@ -304,7 +304,7 @@ public function testDeleteSectionStopPropagationInBeforeEvents() ]); } - public function testCreateSectionEvents() + public function testCreateSectionEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateSectionEvent::class, @@ -332,7 +332,7 @@ public function testCreateSectionEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateSectionResultInBeforeEvents() + public function testReturnCreateSectionResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateSectionEvent::class, @@ -348,7 +348,7 @@ public function testReturnCreateSectionResultInBeforeEvents() $innerServiceMock = $this->createMock(SectionServiceInterface::class); $innerServiceMock->method('createSection')->willReturn($section); - $traceableEventDispatcher->addListener(BeforeCreateSectionEvent::class, static function (BeforeCreateSectionEvent $event) use ($eventSection) { + $traceableEventDispatcher->addListener(BeforeCreateSectionEvent::class, static function (BeforeCreateSectionEvent $event) use ($eventSection): void { $event->setSection($eventSection); }, 10); @@ -366,7 +366,7 @@ public function testReturnCreateSectionResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateSectionStopPropagationInBeforeEvents() + public function testCreateSectionStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateSectionEvent::class, @@ -382,7 +382,7 @@ public function testCreateSectionStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(SectionServiceInterface::class); $innerServiceMock->method('createSection')->willReturn($section); - $traceableEventDispatcher->addListener(BeforeCreateSectionEvent::class, static function (BeforeCreateSectionEvent $event) use ($eventSection) { + $traceableEventDispatcher->addListener(BeforeCreateSectionEvent::class, static function (BeforeCreateSectionEvent $event) use ($eventSection): void { $event->setSection($eventSection); $event->stopPropagation(); }, 10); diff --git a/tests/lib/Event/SettingServiceTest.php b/tests/lib/Event/SettingServiceTest.php index 567dd22b7a..fd43334955 100644 --- a/tests/lib/Event/SettingServiceTest.php +++ b/tests/lib/Event/SettingServiceTest.php @@ -57,7 +57,7 @@ public function testReturnUpdateSettingResultInBeforeEvents(): void $traceableEventDispatcher->addListener( BeforeUpdateSettingEvent::class, - static function (BeforeUpdateSettingEvent $event) use ($eventUpdatedSetting) { + static function (BeforeUpdateSettingEvent $event) use ($eventUpdatedSetting): void { $event->setUpdatedSetting($eventUpdatedSetting); }, 10 @@ -91,7 +91,7 @@ public function testUpdateSettingStopPropagationInBeforeEvents(): void $eventUpdatedSetting = $this->createMock(Setting::class); $traceableEventDispatcher->addListener( BeforeUpdateSettingEvent::class, - static function (BeforeUpdateSettingEvent $event) use ($eventUpdatedSetting) { + static function (BeforeUpdateSettingEvent $event) use ($eventUpdatedSetting): void { $event->setUpdatedSetting($eventUpdatedSetting); $event->stopPropagation(); }, @@ -169,7 +169,7 @@ public function testDeleteSettingStopPropagationInBeforeEvents(): void $traceableEventDispatcher->addListener( BeforeDeleteSettingEvent::class, - static function (BeforeDeleteSettingEvent $event) { + static function (BeforeDeleteSettingEvent $event): void { $event->stopPropagation(); }, 10 @@ -235,7 +235,7 @@ public function testReturnCreateSettingResultInBeforeEvents(): void $setting = $this->createMock(Setting::class); $traceableEventDispatcher->addListener( BeforeCreateSettingEvent::class, - static function (BeforeCreateSettingEvent $event) use ($eventSetting) { + static function (BeforeCreateSettingEvent $event) use ($eventSetting): void { $event->setSetting($eventSetting); }, 10 @@ -269,7 +269,7 @@ public function testCreateSettingStopPropagationInBeforeEvents(): void $setting = $this->createMock(Setting::class); $traceableEventDispatcher->addListener( BeforeCreateSettingEvent::class, - static function (BeforeCreateSettingEvent $event) use ($eventSetting) { + static function (BeforeCreateSettingEvent $event) use ($eventSetting): void { $event->setSetting($eventSetting); $event->stopPropagation(); }, diff --git a/tests/lib/Event/TrashServiceTest.php b/tests/lib/Event/TrashServiceTest.php index 5934c7174f..3ce79912c9 100644 --- a/tests/lib/Event/TrashServiceTest.php +++ b/tests/lib/Event/TrashServiceTest.php @@ -24,7 +24,7 @@ class TrashServiceTest extends AbstractServiceTest { - public function testEmptyTrashEvents() + public function testEmptyTrashEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeEmptyTrashEvent::class, @@ -51,7 +51,7 @@ public function testEmptyTrashEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnEmptyTrashResultInBeforeEvents() + public function testReturnEmptyTrashResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeEmptyTrashEvent::class, @@ -66,7 +66,7 @@ public function testReturnEmptyTrashResultInBeforeEvents() $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->method('emptyTrash')->willReturn($resultList); - $traceableEventDispatcher->addListener(BeforeEmptyTrashEvent::class, static function (BeforeEmptyTrashEvent $event) use ($eventResultList) { + $traceableEventDispatcher->addListener(BeforeEmptyTrashEvent::class, static function (BeforeEmptyTrashEvent $event) use ($eventResultList): void { $event->setResultList($eventResultList); }, 10); @@ -84,7 +84,7 @@ public function testReturnEmptyTrashResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testEmptyTrashStopPropagationInBeforeEvents() + public function testEmptyTrashStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeEmptyTrashEvent::class, @@ -99,7 +99,7 @@ public function testEmptyTrashStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->method('emptyTrash')->willReturn($resultList); - $traceableEventDispatcher->addListener(BeforeEmptyTrashEvent::class, static function (BeforeEmptyTrashEvent $event) use ($eventResultList) { + $traceableEventDispatcher->addListener(BeforeEmptyTrashEvent::class, static function (BeforeEmptyTrashEvent $event) use ($eventResultList): void { $event->setResultList($eventResultList); $event->stopPropagation(); }, 10); @@ -120,7 +120,7 @@ public function testEmptyTrashStopPropagationInBeforeEvents() ]); } - public function testTrashEvents() + public function testTrashEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeTrashEvent::class, @@ -148,7 +148,7 @@ public function testTrashEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnTrashResultInBeforeEvents() + public function testReturnTrashResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeTrashEvent::class, @@ -164,7 +164,7 @@ public function testReturnTrashResultInBeforeEvents() $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->method('trash')->willReturn($trashItem); - $traceableEventDispatcher->addListener(BeforeTrashEvent::class, static function (BeforeTrashEvent $event) use ($eventTrashItem) { + $traceableEventDispatcher->addListener(BeforeTrashEvent::class, static function (BeforeTrashEvent $event) use ($eventTrashItem): void { $event->setResult($eventTrashItem); }, 10); @@ -182,7 +182,7 @@ public function testReturnTrashResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testTrashStopPropagationInBeforeEvents() + public function testTrashStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeTrashEvent::class, @@ -198,7 +198,7 @@ public function testTrashStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->method('trash')->willReturn($trashItem); - $traceableEventDispatcher->addListener(BeforeTrashEvent::class, static function (BeforeTrashEvent $event) use ($eventTrashItem) { + $traceableEventDispatcher->addListener(BeforeTrashEvent::class, static function (BeforeTrashEvent $event) use ($eventTrashItem): void { $event->setResult($eventTrashItem); $event->stopPropagation(); }, 10); @@ -233,7 +233,7 @@ public function testTrashStopPropagationInBeforeEventsSetsNullResult(): void $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->expects(self::never())->method('trash'); - $traceableEventDispatcher->addListener(BeforeTrashEvent::class, static function (BeforeTrashEvent $event) { + $traceableEventDispatcher->addListener(BeforeTrashEvent::class, static function (BeforeTrashEvent $event): void { $event->setResult(null); $event->stopPropagation(); }, 10); @@ -254,7 +254,7 @@ public function testTrashStopPropagationInBeforeEventsSetsNullResult(): void ]); } - public function testRecoverEvents() + public function testRecoverEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRecoverEvent::class, @@ -283,7 +283,7 @@ public function testRecoverEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnRecoverResultInBeforeEvents() + public function testReturnRecoverResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRecoverEvent::class, @@ -300,7 +300,7 @@ public function testReturnRecoverResultInBeforeEvents() $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->method('recover')->willReturn($location); - $traceableEventDispatcher->addListener(BeforeRecoverEvent::class, static function (BeforeRecoverEvent $event) use ($eventLocation) { + $traceableEventDispatcher->addListener(BeforeRecoverEvent::class, static function (BeforeRecoverEvent $event) use ($eventLocation): void { $event->setLocation($eventLocation); }, 10); @@ -318,7 +318,7 @@ public function testReturnRecoverResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testRecoverStopPropagationInBeforeEvents() + public function testRecoverStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRecoverEvent::class, @@ -335,7 +335,7 @@ public function testRecoverStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->method('recover')->willReturn($location); - $traceableEventDispatcher->addListener(BeforeRecoverEvent::class, static function (BeforeRecoverEvent $event) use ($eventLocation) { + $traceableEventDispatcher->addListener(BeforeRecoverEvent::class, static function (BeforeRecoverEvent $event) use ($eventLocation): void { $event->setLocation($eventLocation); $event->stopPropagation(); }, 10); @@ -356,7 +356,7 @@ public function testRecoverStopPropagationInBeforeEvents() ]); } - public function testDeleteTrashItemEvents() + public function testDeleteTrashItemEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteTrashItemEvent::class, @@ -384,7 +384,7 @@ public function testDeleteTrashItemEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnDeleteTrashItemResultInBeforeEvents() + public function testReturnDeleteTrashItemResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteTrashItemEvent::class, @@ -400,7 +400,7 @@ public function testReturnDeleteTrashItemResultInBeforeEvents() $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->method('deleteTrashItem')->willReturn($result); - $traceableEventDispatcher->addListener(BeforeDeleteTrashItemEvent::class, static function (BeforeDeleteTrashItemEvent $event) use ($eventResult) { + $traceableEventDispatcher->addListener(BeforeDeleteTrashItemEvent::class, static function (BeforeDeleteTrashItemEvent $event) use ($eventResult): void { $event->setResult($eventResult); }, 10); @@ -418,7 +418,7 @@ public function testReturnDeleteTrashItemResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteTrashItemStopPropagationInBeforeEvents() + public function testDeleteTrashItemStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteTrashItemEvent::class, @@ -434,7 +434,7 @@ public function testDeleteTrashItemStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(TrashServiceInterface::class); $innerServiceMock->method('deleteTrashItem')->willReturn($result); - $traceableEventDispatcher->addListener(BeforeDeleteTrashItemEvent::class, static function (BeforeDeleteTrashItemEvent $event) use ($eventResult) { + $traceableEventDispatcher->addListener(BeforeDeleteTrashItemEvent::class, static function (BeforeDeleteTrashItemEvent $event) use ($eventResult): void { $event->setResult($eventResult); $event->stopPropagation(); }, 10); diff --git a/tests/lib/Event/URLAliasServiceTest.php b/tests/lib/Event/URLAliasServiceTest.php index b529912e0d..a307e03486 100644 --- a/tests/lib/Event/URLAliasServiceTest.php +++ b/tests/lib/Event/URLAliasServiceTest.php @@ -22,7 +22,7 @@ class URLAliasServiceTest extends AbstractServiceTest { - public function testCreateGlobalUrlAliasEvents() + public function testCreateGlobalUrlAliasEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateGlobalUrlAliasEvent::class, @@ -54,7 +54,7 @@ public function testCreateGlobalUrlAliasEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateGlobalUrlAliasResultInBeforeEvents() + public function testReturnCreateGlobalUrlAliasResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateGlobalUrlAliasEvent::class, @@ -74,7 +74,7 @@ public function testReturnCreateGlobalUrlAliasResultInBeforeEvents() $innerServiceMock = $this->createMock(URLAliasServiceInterface::class); $innerServiceMock->method('createGlobalUrlAlias')->willReturn($urlAlias); - $traceableEventDispatcher->addListener(BeforeCreateGlobalUrlAliasEvent::class, static function (BeforeCreateGlobalUrlAliasEvent $event) use ($eventUrlAlias) { + $traceableEventDispatcher->addListener(BeforeCreateGlobalUrlAliasEvent::class, static function (BeforeCreateGlobalUrlAliasEvent $event) use ($eventUrlAlias): void { $event->setUrlAlias($eventUrlAlias); }, 10); @@ -92,7 +92,7 @@ public function testReturnCreateGlobalUrlAliasResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateGlobalUrlAliasStopPropagationInBeforeEvents() + public function testCreateGlobalUrlAliasStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateGlobalUrlAliasEvent::class, @@ -112,7 +112,7 @@ public function testCreateGlobalUrlAliasStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(URLAliasServiceInterface::class); $innerServiceMock->method('createGlobalUrlAlias')->willReturn($urlAlias); - $traceableEventDispatcher->addListener(BeforeCreateGlobalUrlAliasEvent::class, static function (BeforeCreateGlobalUrlAliasEvent $event) use ($eventUrlAlias) { + $traceableEventDispatcher->addListener(BeforeCreateGlobalUrlAliasEvent::class, static function (BeforeCreateGlobalUrlAliasEvent $event) use ($eventUrlAlias): void { $event->setUrlAlias($eventUrlAlias); $event->stopPropagation(); }, 10); @@ -133,7 +133,7 @@ public function testCreateGlobalUrlAliasStopPropagationInBeforeEvents() ]); } - public function testRefreshSystemUrlAliasesForLocationEvents() + public function testRefreshSystemUrlAliasesForLocationEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRefreshSystemUrlAliasesForLocationEvent::class, @@ -158,7 +158,7 @@ public function testRefreshSystemUrlAliasesForLocationEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testRefreshSystemUrlAliasesForLocationStopPropagationInBeforeEvents() + public function testRefreshSystemUrlAliasesForLocationStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRefreshSystemUrlAliasesForLocationEvent::class, @@ -171,7 +171,7 @@ public function testRefreshSystemUrlAliasesForLocationStopPropagationInBeforeEve $innerServiceMock = $this->createMock(URLAliasServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeRefreshSystemUrlAliasesForLocationEvent::class, static function (BeforeRefreshSystemUrlAliasesForLocationEvent $event) { + $traceableEventDispatcher->addListener(BeforeRefreshSystemUrlAliasesForLocationEvent::class, static function (BeforeRefreshSystemUrlAliasesForLocationEvent $event): void { $event->stopPropagation(); }, 10); @@ -190,7 +190,7 @@ public function testRefreshSystemUrlAliasesForLocationStopPropagationInBeforeEve ]); } - public function testCreateUrlAliasEvents() + public function testCreateUrlAliasEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateUrlAliasEvent::class, @@ -222,7 +222,7 @@ public function testCreateUrlAliasEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateUrlAliasResultInBeforeEvents() + public function testReturnCreateUrlAliasResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateUrlAliasEvent::class, @@ -242,7 +242,7 @@ public function testReturnCreateUrlAliasResultInBeforeEvents() $innerServiceMock = $this->createMock(URLAliasServiceInterface::class); $innerServiceMock->method('createUrlAlias')->willReturn($urlAlias); - $traceableEventDispatcher->addListener(BeforeCreateUrlAliasEvent::class, static function (BeforeCreateUrlAliasEvent $event) use ($eventUrlAlias) { + $traceableEventDispatcher->addListener(BeforeCreateUrlAliasEvent::class, static function (BeforeCreateUrlAliasEvent $event) use ($eventUrlAlias): void { $event->setUrlAlias($eventUrlAlias); }, 10); @@ -260,7 +260,7 @@ public function testReturnCreateUrlAliasResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateUrlAliasStopPropagationInBeforeEvents() + public function testCreateUrlAliasStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateUrlAliasEvent::class, @@ -280,7 +280,7 @@ public function testCreateUrlAliasStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(URLAliasServiceInterface::class); $innerServiceMock->method('createUrlAlias')->willReturn($urlAlias); - $traceableEventDispatcher->addListener(BeforeCreateUrlAliasEvent::class, static function (BeforeCreateUrlAliasEvent $event) use ($eventUrlAlias) { + $traceableEventDispatcher->addListener(BeforeCreateUrlAliasEvent::class, static function (BeforeCreateUrlAliasEvent $event) use ($eventUrlAlias): void { $event->setUrlAlias($eventUrlAlias); $event->stopPropagation(); }, 10); @@ -301,7 +301,7 @@ public function testCreateUrlAliasStopPropagationInBeforeEvents() ]); } - public function testRemoveAliasesEvents() + public function testRemoveAliasesEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRemoveAliasesEvent::class, @@ -326,7 +326,7 @@ public function testRemoveAliasesEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testRemoveAliasesStopPropagationInBeforeEvents() + public function testRemoveAliasesStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRemoveAliasesEvent::class, @@ -339,7 +339,7 @@ public function testRemoveAliasesStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(URLAliasServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeRemoveAliasesEvent::class, static function (BeforeRemoveAliasesEvent $event) { + $traceableEventDispatcher->addListener(BeforeRemoveAliasesEvent::class, static function (BeforeRemoveAliasesEvent $event): void { $event->stopPropagation(); }, 10); diff --git a/tests/lib/Event/URLServiceTest.php b/tests/lib/Event/URLServiceTest.php index 35c96695fe..cbb4f12675 100644 --- a/tests/lib/Event/URLServiceTest.php +++ b/tests/lib/Event/URLServiceTest.php @@ -16,7 +16,7 @@ class URLServiceTest extends AbstractServiceTest { - public function testUpdateUrlEvents() + public function testUpdateUrlEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateUrlEvent::class, @@ -45,7 +45,7 @@ public function testUpdateUrlEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnUpdateUrlResultInBeforeEvents() + public function testReturnUpdateUrlResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateUrlEvent::class, @@ -62,7 +62,7 @@ public function testReturnUpdateUrlResultInBeforeEvents() $innerServiceMock = $this->createMock(URLServiceInterface::class); $innerServiceMock->method('updateUrl')->willReturn($updatedUrl); - $traceableEventDispatcher->addListener(BeforeUpdateUrlEvent::class, static function (BeforeUpdateUrlEvent $event) use ($eventUpdatedUrl) { + $traceableEventDispatcher->addListener(BeforeUpdateUrlEvent::class, static function (BeforeUpdateUrlEvent $event) use ($eventUpdatedUrl): void { $event->setUpdatedUrl($eventUpdatedUrl); }, 10); @@ -80,7 +80,7 @@ public function testReturnUpdateUrlResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUpdateUrlStopPropagationInBeforeEvents() + public function testUpdateUrlStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateUrlEvent::class, @@ -97,7 +97,7 @@ public function testUpdateUrlStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(URLServiceInterface::class); $innerServiceMock->method('updateUrl')->willReturn($updatedUrl); - $traceableEventDispatcher->addListener(BeforeUpdateUrlEvent::class, static function (BeforeUpdateUrlEvent $event) use ($eventUpdatedUrl) { + $traceableEventDispatcher->addListener(BeforeUpdateUrlEvent::class, static function (BeforeUpdateUrlEvent $event) use ($eventUpdatedUrl): void { $event->setUpdatedUrl($eventUpdatedUrl); $event->stopPropagation(); }, 10); diff --git a/tests/lib/Event/URLWildcardServiceTest.php b/tests/lib/Event/URLWildcardServiceTest.php index effd399760..06478562d7 100644 --- a/tests/lib/Event/URLWildcardServiceTest.php +++ b/tests/lib/Event/URLWildcardServiceTest.php @@ -26,7 +26,7 @@ class URLWildcardServiceTest extends AbstractServiceTest /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function testRemoveEvents() + public function testRemoveEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRemoveEvent::class, @@ -54,7 +54,7 @@ public function testRemoveEvents() /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function testRemoveStopPropagationInBeforeEvents() + public function testRemoveStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeRemoveEvent::class, @@ -67,7 +67,7 @@ public function testRemoveStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(URLWildcardServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeRemoveEvent::class, static function (BeforeRemoveEvent $event) { + $traceableEventDispatcher->addListener(BeforeRemoveEvent::class, static function (BeforeRemoveEvent $event): void { $event->stopPropagation(); }, 10); @@ -130,7 +130,7 @@ public function testUpdateStopPropagationInBeforeEvents(): void $traceableEventDispatcher->addListener( BeforeUpdateEvent::class, - static function (BeforeUpdateEvent $event) { + static function (BeforeUpdateEvent $event): void { $event->stopPropagation(); }, 10 @@ -159,7 +159,7 @@ static function (BeforeUpdateEvent $event) { ]); } - public function testCreateEvents() + public function testCreateEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateEvent::class, @@ -189,7 +189,7 @@ public function testCreateEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateResultInBeforeEvents() + public function testReturnCreateResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateEvent::class, @@ -207,7 +207,7 @@ public function testReturnCreateResultInBeforeEvents() $innerServiceMock = $this->createMock(URLWildcardServiceInterface::class); $innerServiceMock->method('create')->willReturn($urlWildcard); - $traceableEventDispatcher->addListener(BeforeCreateEvent::class, static function (BeforeCreateEvent $event) use ($eventUrlWildcard) { + $traceableEventDispatcher->addListener(BeforeCreateEvent::class, static function (BeforeCreateEvent $event) use ($eventUrlWildcard): void { $event->setUrlWildcard($eventUrlWildcard); }, 10); @@ -225,7 +225,7 @@ public function testReturnCreateResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateStopPropagationInBeforeEvents() + public function testCreateStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateEvent::class, @@ -243,7 +243,7 @@ public function testCreateStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(URLWildcardServiceInterface::class); $innerServiceMock->method('create')->willReturn($urlWildcard); - $traceableEventDispatcher->addListener(BeforeCreateEvent::class, static function (BeforeCreateEvent $event) use ($eventUrlWildcard) { + $traceableEventDispatcher->addListener(BeforeCreateEvent::class, static function (BeforeCreateEvent $event) use ($eventUrlWildcard): void { $event->setUrlWildcard($eventUrlWildcard); $event->stopPropagation(); }, 10); @@ -264,7 +264,7 @@ public function testCreateStopPropagationInBeforeEvents() ]); } - public function testTranslateEvents() + public function testTranslateEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeTranslateEvent::class, @@ -292,7 +292,7 @@ public function testTranslateEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnTranslateResultInBeforeEvents() + public function testReturnTranslateResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeTranslateEvent::class, @@ -308,7 +308,7 @@ public function testReturnTranslateResultInBeforeEvents() $innerServiceMock = $this->createMock(URLWildcardServiceInterface::class); $innerServiceMock->method('translate')->willReturn($result); - $traceableEventDispatcher->addListener(BeforeTranslateEvent::class, static function (BeforeTranslateEvent $event) use ($eventResult) { + $traceableEventDispatcher->addListener(BeforeTranslateEvent::class, static function (BeforeTranslateEvent $event) use ($eventResult): void { $event->setResult($eventResult); }, 10); @@ -326,7 +326,7 @@ public function testReturnTranslateResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testTranslateStopPropagationInBeforeEvents() + public function testTranslateStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeTranslateEvent::class, @@ -342,7 +342,7 @@ public function testTranslateStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(URLWildcardServiceInterface::class); $innerServiceMock->method('translate')->willReturn($result); - $traceableEventDispatcher->addListener(BeforeTranslateEvent::class, static function (BeforeTranslateEvent $event) use ($eventResult) { + $traceableEventDispatcher->addListener(BeforeTranslateEvent::class, static function (BeforeTranslateEvent $event) use ($eventResult): void { $event->setResult($eventResult); $event->stopPropagation(); }, 10); diff --git a/tests/lib/Event/UserPreferenceServiceTest.php b/tests/lib/Event/UserPreferenceServiceTest.php index 6922b9eea3..ca531bcd22 100644 --- a/tests/lib/Event/UserPreferenceServiceTest.php +++ b/tests/lib/Event/UserPreferenceServiceTest.php @@ -14,7 +14,7 @@ class UserPreferenceServiceTest extends AbstractServiceTest { - public function testSetUserPreferenceEvents() + public function testSetUserPreferenceEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeSetUserPreferenceEvent::class, @@ -39,7 +39,7 @@ public function testSetUserPreferenceEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testSetUserPreferenceStopPropagationInBeforeEvents() + public function testSetUserPreferenceStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeSetUserPreferenceEvent::class, @@ -52,7 +52,7 @@ public function testSetUserPreferenceStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserPreferenceServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeSetUserPreferenceEvent::class, static function (BeforeSetUserPreferenceEvent $event) { + $traceableEventDispatcher->addListener(BeforeSetUserPreferenceEvent::class, static function (BeforeSetUserPreferenceEvent $event): void { $event->stopPropagation(); }, 10); diff --git a/tests/lib/Event/UserServiceTest.php b/tests/lib/Event/UserServiceTest.php index 6b122d5823..c09850926c 100644 --- a/tests/lib/Event/UserServiceTest.php +++ b/tests/lib/Event/UserServiceTest.php @@ -39,7 +39,7 @@ class UserServiceTest extends AbstractServiceTest { - public function testUpdateUserGroupEvents() + public function testUpdateUserGroupEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateUserGroupEvent::class, @@ -68,7 +68,7 @@ public function testUpdateUserGroupEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnUpdateUserGroupResultInBeforeEvents() + public function testReturnUpdateUserGroupResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateUserGroupEvent::class, @@ -85,7 +85,7 @@ public function testReturnUpdateUserGroupResultInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('updateUserGroup')->willReturn($updatedUserGroup); - $traceableEventDispatcher->addListener(BeforeUpdateUserGroupEvent::class, static function (BeforeUpdateUserGroupEvent $event) use ($eventUpdatedUserGroup) { + $traceableEventDispatcher->addListener(BeforeUpdateUserGroupEvent::class, static function (BeforeUpdateUserGroupEvent $event) use ($eventUpdatedUserGroup): void { $event->setUpdatedUserGroup($eventUpdatedUserGroup); }, 10); @@ -103,7 +103,7 @@ public function testReturnUpdateUserGroupResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUpdateUserGroupStopPropagationInBeforeEvents() + public function testUpdateUserGroupStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateUserGroupEvent::class, @@ -120,7 +120,7 @@ public function testUpdateUserGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('updateUserGroup')->willReturn($updatedUserGroup); - $traceableEventDispatcher->addListener(BeforeUpdateUserGroupEvent::class, static function (BeforeUpdateUserGroupEvent $event) use ($eventUpdatedUserGroup) { + $traceableEventDispatcher->addListener(BeforeUpdateUserGroupEvent::class, static function (BeforeUpdateUserGroupEvent $event) use ($eventUpdatedUserGroup): void { $event->setUpdatedUserGroup($eventUpdatedUserGroup); $event->stopPropagation(); }, 10); @@ -141,7 +141,7 @@ public function testUpdateUserGroupStopPropagationInBeforeEvents() ]); } - public function testUpdateUserEvents() + public function testUpdateUserEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateUserEvent::class, @@ -170,7 +170,7 @@ public function testUpdateUserEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnUpdateUserResultInBeforeEvents() + public function testReturnUpdateUserResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateUserEvent::class, @@ -187,7 +187,7 @@ public function testReturnUpdateUserResultInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('updateUser')->willReturn($updatedUser); - $traceableEventDispatcher->addListener(BeforeUpdateUserEvent::class, static function (BeforeUpdateUserEvent $event) use ($eventUpdatedUser) { + $traceableEventDispatcher->addListener(BeforeUpdateUserEvent::class, static function (BeforeUpdateUserEvent $event) use ($eventUpdatedUser): void { $event->setUpdatedUser($eventUpdatedUser); }, 10); @@ -205,7 +205,7 @@ public function testReturnUpdateUserResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUpdateUserStopPropagationInBeforeEvents() + public function testUpdateUserStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateUserEvent::class, @@ -222,7 +222,7 @@ public function testUpdateUserStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('updateUser')->willReturn($updatedUser); - $traceableEventDispatcher->addListener(BeforeUpdateUserEvent::class, static function (BeforeUpdateUserEvent $event) use ($eventUpdatedUser) { + $traceableEventDispatcher->addListener(BeforeUpdateUserEvent::class, static function (BeforeUpdateUserEvent $event) use ($eventUpdatedUser): void { $event->setUpdatedUser($eventUpdatedUser); $event->stopPropagation(); }, 10); @@ -243,7 +243,7 @@ public function testUpdateUserStopPropagationInBeforeEvents() ]); } - public function testUnAssignUserFromUserGroupEvents() + public function testUnAssignUserFromUserGroupEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUnAssignUserFromUserGroupEvent::class, @@ -269,7 +269,7 @@ public function testUnAssignUserFromUserGroupEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUnAssignUserFromUserGroupStopPropagationInBeforeEvents() + public function testUnAssignUserFromUserGroupStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUnAssignUserFromUserGroupEvent::class, @@ -283,7 +283,7 @@ public function testUnAssignUserFromUserGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeUnAssignUserFromUserGroupEvent::class, static function (BeforeUnAssignUserFromUserGroupEvent $event) { + $traceableEventDispatcher->addListener(BeforeUnAssignUserFromUserGroupEvent::class, static function (BeforeUnAssignUserFromUserGroupEvent $event): void { $event->stopPropagation(); }, 10); @@ -302,7 +302,7 @@ public function testUnAssignUserFromUserGroupStopPropagationInBeforeEvents() ]); } - public function testDeleteUserGroupEvents() + public function testDeleteUserGroupEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteUserGroupEvent::class, @@ -330,7 +330,7 @@ public function testDeleteUserGroupEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnDeleteUserGroupResultInBeforeEvents() + public function testReturnDeleteUserGroupResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteUserGroupEvent::class, @@ -346,7 +346,7 @@ public function testReturnDeleteUserGroupResultInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('deleteUserGroup')->willReturn($locations); - $traceableEventDispatcher->addListener(BeforeDeleteUserGroupEvent::class, static function (BeforeDeleteUserGroupEvent $event) use ($eventLocations) { + $traceableEventDispatcher->addListener(BeforeDeleteUserGroupEvent::class, static function (BeforeDeleteUserGroupEvent $event) use ($eventLocations): void { $event->setLocations($eventLocations); }, 10); @@ -364,7 +364,7 @@ public function testReturnDeleteUserGroupResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteUserGroupStopPropagationInBeforeEvents() + public function testDeleteUserGroupStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteUserGroupEvent::class, @@ -380,7 +380,7 @@ public function testDeleteUserGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('deleteUserGroup')->willReturn($locations); - $traceableEventDispatcher->addListener(BeforeDeleteUserGroupEvent::class, static function (BeforeDeleteUserGroupEvent $event) use ($eventLocations) { + $traceableEventDispatcher->addListener(BeforeDeleteUserGroupEvent::class, static function (BeforeDeleteUserGroupEvent $event) use ($eventLocations): void { $event->setLocations($eventLocations); $event->stopPropagation(); }, 10); @@ -401,7 +401,7 @@ public function testDeleteUserGroupStopPropagationInBeforeEvents() ]); } - public function testAssignUserToUserGroupEvents() + public function testAssignUserToUserGroupEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAssignUserToUserGroupEvent::class, @@ -427,7 +427,7 @@ public function testAssignUserToUserGroupEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testAssignUserToUserGroupStopPropagationInBeforeEvents() + public function testAssignUserToUserGroupStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeAssignUserToUserGroupEvent::class, @@ -441,7 +441,7 @@ public function testAssignUserToUserGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeAssignUserToUserGroupEvent::class, static function (BeforeAssignUserToUserGroupEvent $event) { + $traceableEventDispatcher->addListener(BeforeAssignUserToUserGroupEvent::class, static function (BeforeAssignUserToUserGroupEvent $event): void { $event->stopPropagation(); }, 10); @@ -460,7 +460,7 @@ public function testAssignUserToUserGroupStopPropagationInBeforeEvents() ]); } - public function testDeleteUserEvents() + public function testDeleteUserEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteUserEvent::class, @@ -488,7 +488,7 @@ public function testDeleteUserEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnDeleteUserResultInBeforeEvents() + public function testReturnDeleteUserResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteUserEvent::class, @@ -504,7 +504,7 @@ public function testReturnDeleteUserResultInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('deleteUser')->willReturn($locations); - $traceableEventDispatcher->addListener(BeforeDeleteUserEvent::class, static function (BeforeDeleteUserEvent $event) use ($eventLocations) { + $traceableEventDispatcher->addListener(BeforeDeleteUserEvent::class, static function (BeforeDeleteUserEvent $event) use ($eventLocations): void { $event->setLocations($eventLocations); }, 10); @@ -522,7 +522,7 @@ public function testReturnDeleteUserResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testDeleteUserStopPropagationInBeforeEvents() + public function testDeleteUserStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeDeleteUserEvent::class, @@ -538,7 +538,7 @@ public function testDeleteUserStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('deleteUser')->willReturn($locations); - $traceableEventDispatcher->addListener(BeforeDeleteUserEvent::class, static function (BeforeDeleteUserEvent $event) use ($eventLocations) { + $traceableEventDispatcher->addListener(BeforeDeleteUserEvent::class, static function (BeforeDeleteUserEvent $event) use ($eventLocations): void { $event->setLocations($eventLocations); $event->stopPropagation(); }, 10); @@ -559,7 +559,7 @@ public function testDeleteUserStopPropagationInBeforeEvents() ]); } - public function testMoveUserGroupEvents() + public function testMoveUserGroupEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeMoveUserGroupEvent::class, @@ -585,7 +585,7 @@ public function testMoveUserGroupEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testMoveUserGroupStopPropagationInBeforeEvents() + public function testMoveUserGroupStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeMoveUserGroupEvent::class, @@ -599,7 +599,7 @@ public function testMoveUserGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); - $traceableEventDispatcher->addListener(BeforeMoveUserGroupEvent::class, static function (BeforeMoveUserGroupEvent $event) { + $traceableEventDispatcher->addListener(BeforeMoveUserGroupEvent::class, static function (BeforeMoveUserGroupEvent $event): void { $event->stopPropagation(); }, 10); @@ -618,7 +618,7 @@ public function testMoveUserGroupStopPropagationInBeforeEvents() ]); } - public function testCreateUserEvents() + public function testCreateUserEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateUserEvent::class, @@ -647,7 +647,7 @@ public function testCreateUserEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateUserResultInBeforeEvents() + public function testReturnCreateUserResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateUserEvent::class, @@ -664,7 +664,7 @@ public function testReturnCreateUserResultInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('createUser')->willReturn($user); - $traceableEventDispatcher->addListener(BeforeCreateUserEvent::class, static function (BeforeCreateUserEvent $event) use ($eventUser) { + $traceableEventDispatcher->addListener(BeforeCreateUserEvent::class, static function (BeforeCreateUserEvent $event) use ($eventUser): void { $event->setUser($eventUser); }, 10); @@ -682,7 +682,7 @@ public function testReturnCreateUserResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateUserStopPropagationInBeforeEvents() + public function testCreateUserStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateUserEvent::class, @@ -699,7 +699,7 @@ public function testCreateUserStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('createUser')->willReturn($user); - $traceableEventDispatcher->addListener(BeforeCreateUserEvent::class, static function (BeforeCreateUserEvent $event) use ($eventUser) { + $traceableEventDispatcher->addListener(BeforeCreateUserEvent::class, static function (BeforeCreateUserEvent $event) use ($eventUser): void { $event->setUser($eventUser); $event->stopPropagation(); }, 10); @@ -720,7 +720,7 @@ public function testCreateUserStopPropagationInBeforeEvents() ]); } - public function testCreateUserGroupEvents() + public function testCreateUserGroupEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateUserGroupEvent::class, @@ -749,7 +749,7 @@ public function testCreateUserGroupEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnCreateUserGroupResultInBeforeEvents() + public function testReturnCreateUserGroupResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateUserGroupEvent::class, @@ -766,7 +766,7 @@ public function testReturnCreateUserGroupResultInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('createUserGroup')->willReturn($userGroup); - $traceableEventDispatcher->addListener(BeforeCreateUserGroupEvent::class, static function (BeforeCreateUserGroupEvent $event) use ($eventUserGroup) { + $traceableEventDispatcher->addListener(BeforeCreateUserGroupEvent::class, static function (BeforeCreateUserGroupEvent $event) use ($eventUserGroup): void { $event->setUserGroup($eventUserGroup); }, 10); @@ -784,7 +784,7 @@ public function testReturnCreateUserGroupResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testCreateUserGroupStopPropagationInBeforeEvents() + public function testCreateUserGroupStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeCreateUserGroupEvent::class, @@ -801,7 +801,7 @@ public function testCreateUserGroupStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('createUserGroup')->willReturn($userGroup); - $traceableEventDispatcher->addListener(BeforeCreateUserGroupEvent::class, static function (BeforeCreateUserGroupEvent $event) use ($eventUserGroup) { + $traceableEventDispatcher->addListener(BeforeCreateUserGroupEvent::class, static function (BeforeCreateUserGroupEvent $event) use ($eventUserGroup): void { $event->setUserGroup($eventUserGroup); $event->stopPropagation(); }, 10); @@ -822,7 +822,7 @@ public function testCreateUserGroupStopPropagationInBeforeEvents() ]); } - public function testUpdateUserTokenEvents() + public function testUpdateUserTokenEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateUserTokenEvent::class, @@ -851,7 +851,7 @@ public function testUpdateUserTokenEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testReturnUpdateUserTokenResultInBeforeEvents() + public function testReturnUpdateUserTokenResultInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateUserTokenEvent::class, @@ -868,7 +868,7 @@ public function testReturnUpdateUserTokenResultInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('updateUserToken')->willReturn($updatedUser); - $traceableEventDispatcher->addListener(BeforeUpdateUserTokenEvent::class, static function (BeforeUpdateUserTokenEvent $event) use ($eventUpdatedUser) { + $traceableEventDispatcher->addListener(BeforeUpdateUserTokenEvent::class, static function (BeforeUpdateUserTokenEvent $event) use ($eventUpdatedUser): void { $event->setUpdatedUser($eventUpdatedUser); }, 10); @@ -886,7 +886,7 @@ public function testReturnUpdateUserTokenResultInBeforeEvents() self::assertSame([], $traceableEventDispatcher->getNotCalledListeners()); } - public function testUpdateUserTokenStopPropagationInBeforeEvents() + public function testUpdateUserTokenStopPropagationInBeforeEvents(): void { $traceableEventDispatcher = $this->getEventDispatcher( BeforeUpdateUserTokenEvent::class, @@ -903,7 +903,7 @@ public function testUpdateUserTokenStopPropagationInBeforeEvents() $innerServiceMock = $this->createMock(UserServiceInterface::class); $innerServiceMock->method('updateUserToken')->willReturn($updatedUser); - $traceableEventDispatcher->addListener(BeforeUpdateUserTokenEvent::class, static function (BeforeUpdateUserTokenEvent $event) use ($eventUpdatedUser) { + $traceableEventDispatcher->addListener(BeforeUpdateUserTokenEvent::class, static function (BeforeUpdateUserTokenEvent $event) use ($eventUpdatedUser): void { $event->setUpdatedUser($eventUpdatedUser); $event->stopPropagation(); }, 10); diff --git a/tests/lib/FieldType/APIFieldTypeTest.php b/tests/lib/FieldType/APIFieldTypeTest.php index 8f5fbd89cf..363765af55 100644 --- a/tests/lib/FieldType/APIFieldTypeTest.php +++ b/tests/lib/FieldType/APIFieldTypeTest.php @@ -12,15 +12,16 @@ use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition as APIFieldDefinition; use Ibexa\Core\FieldType\Value; use Ibexa\Core\Repository\Values\ContentType\FieldType; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class APIFieldTypeTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $innerFieldType; + private MockObject $innerFieldType; /** @var \Ibexa\Core\Repository\Values\ContentType\FieldType */ - private $fieldType; + private FieldType $fieldType; protected function setUp(): void { @@ -29,7 +30,7 @@ protected function setUp(): void $this->fieldType = new FieldType($this->innerFieldType); } - public function testValidateValidatorConfigurationNoError() + public function testValidateValidatorConfigurationNoError(): void { $validatorConfig = ['foo' => 'bar']; $validationErrors = []; @@ -42,7 +43,7 @@ public function testValidateValidatorConfigurationNoError() self::assertSame($validationErrors, $this->fieldType->validateValidatorConfiguration($validatorConfig)); } - public function testValidateValidatorConfiguration() + public function testValidateValidatorConfiguration(): void { $validatorConfig = ['foo' => 'bar']; $validationErrors = [ @@ -59,7 +60,7 @@ public function testValidateValidatorConfiguration() self::assertSame($validationErrors, $this->fieldType->validateValidatorConfiguration($validatorConfig)); } - public function testValidateFieldSettingsNoError() + public function testValidateFieldSettingsNoError(): void { $fieldSettings = ['foo' => 'bar']; $validationErrors = []; @@ -72,7 +73,7 @@ public function testValidateFieldSettingsNoError() self::assertSame($validationErrors, $this->fieldType->validateFieldSettings($fieldSettings)); } - public function testValidateFieldSettings() + public function testValidateFieldSettings(): void { $fieldSettings = ['foo' => 'bar']; $validationErrors = [ @@ -89,7 +90,7 @@ public function testValidateFieldSettings() self::assertSame($validationErrors, $this->fieldType->validateFieldSettings($fieldSettings)); } - public function testValidateValueNoError() + public function testValidateValueNoError(): void { $fieldDefinition = $this->getMockForAbstractClass(APIFieldDefinition::class); $value = $this->getMockForAbstractClass(Value::class); @@ -103,7 +104,7 @@ public function testValidateValueNoError() self::assertSame($validationErrors, $this->fieldType->validateValue($fieldDefinition, $value)); } - public function testValidateValue() + public function testValidateValue(): void { $fieldDefinition = $this->getMockForAbstractClass(APIFieldDefinition::class); $value = $this->getMockForAbstractClass(Value::class); diff --git a/tests/lib/FieldType/AuthorTest.php b/tests/lib/FieldType/AuthorTest.php index 0ce6fcd8b4..588c719cb3 100644 --- a/tests/lib/FieldType/AuthorTest.php +++ b/tests/lib/FieldType/AuthorTest.php @@ -10,6 +10,7 @@ use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\FieldType\Author\Author; use Ibexa\Core\FieldType\Author\AuthorCollection; +use Ibexa\Core\FieldType\Author\Type; use Ibexa\Core\FieldType\Author\Type as AuthorType; use Ibexa\Core\FieldType\Author\Value as AuthorValue; use Ibexa\Core\FieldType\Value; @@ -21,7 +22,7 @@ class AuthorTest extends FieldTypeTest { /** @var \Ibexa\Core\FieldType\Author\Author[] */ - private $authors; + private array $authors; protected function setUp(): void { @@ -44,7 +45,7 @@ protected function setUp(): void * * @return \Ibexa\Contracts\Core\FieldType\FieldType */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { $fieldType = new AuthorType(); $fieldType->setTransformationProcessor($this->getTransformationProcessorMock()); @@ -57,7 +58,7 @@ protected function createFieldTypeUnderTest() * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return []; } @@ -67,7 +68,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return [ 'defaultAuthor' => [ @@ -82,12 +83,12 @@ protected function getSettingsSchemaExpectation() * * @return \Ibexa\Core\FieldType\Author\Value */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): AuthorValue { return new AuthorValue(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -134,7 +135,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -201,7 +202,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -268,7 +269,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ @@ -322,7 +323,7 @@ public function provideInputForFromHash() * * @return array */ - public function provideValidFieldSettings() + public function provideValidFieldSettings(): array { return [ [ @@ -364,7 +365,7 @@ public function provideValidFieldSettings() * * @return array */ - public function provideInValidFieldSettings() + public function provideInValidFieldSettings(): array { return [ [ @@ -391,7 +392,7 @@ protected function tearDown(): void /** * @covers \Ibexa\Core\FieldType\FieldType::getValidatorConfigurationSchema */ - public function testValidatorConfigurationSchema() + public function testValidatorConfigurationSchema(): void { $ft = $this->createFieldTypeUnderTest(); self::assertEmpty( @@ -403,7 +404,7 @@ public function testValidatorConfigurationSchema() /** * @covers \Ibexa\Core\FieldType\Author\Type::acceptValue */ - public function testAcceptValueInvalidType() + public function testAcceptValueInvalidType(): void { $this->expectException(InvalidArgumentException::class); @@ -414,7 +415,7 @@ public function testAcceptValueInvalidType() /** * @covers \Ibexa\Core\FieldType\Author\Type::acceptValue */ - public function testAcceptValueInvalidFormat() + public function testAcceptValueInvalidFormat(): void { $this->expectException(InvalidArgumentException::class); @@ -427,7 +428,7 @@ public function testAcceptValueInvalidFormat() /** * @covers \Ibexa\Core\FieldType\Author\Type::acceptValue */ - public function testAcceptValueValidFormat() + public function testAcceptValueValidFormat(): void { $ft = $this->createFieldTypeUnderTest(); $author = new Author(); @@ -441,7 +442,7 @@ public function testAcceptValueValidFormat() /** * @covers \Ibexa\Core\FieldType\Author\Value::__construct */ - public function testBuildFieldValueWithoutParam() + public function testBuildFieldValueWithoutParam(): void { $value = new AuthorValue(); self::assertInstanceOf(AuthorCollection::class, $value->authors); @@ -451,7 +452,7 @@ public function testBuildFieldValueWithoutParam() /** * @covers \Ibexa\Core\FieldType\Author\Value::__construct */ - public function testBuildFieldValueWithParam() + public function testBuildFieldValueWithParam(): void { $value = new AuthorValue($this->authors); self::assertInstanceOf(AuthorCollection::class, $value->authors); @@ -461,7 +462,7 @@ public function testBuildFieldValueWithParam() /** * @covers \Ibexa\Core\FieldType\Author\Value::__toString */ - public function testFieldValueToString() + public function testFieldValueToString(): void { $value = new AuthorValue($this->authors); @@ -476,7 +477,7 @@ public function testFieldValueToString() /** * @covers \Ibexa\Core\FieldType\Author\AuthorCollection::offsetSet */ - public function testAddAuthor() + public function testAddAuthor(): void { $value = new AuthorValue(); $value->authors[] = $this->authors[0]; @@ -496,7 +497,7 @@ public function testAddAuthor() /** * @covers \Ibexa\Core\FieldType\Author\AuthorCollection::removeAuthorsById */ - public function testRemoveAuthors() + public function testRemoveAuthors(): void { $existingIds = []; foreach ($this->authors as $author) { diff --git a/tests/lib/FieldType/BaseFieldTypeTest.php b/tests/lib/FieldType/BaseFieldTypeTest.php index f1688903b9..e96bf8fc98 100644 --- a/tests/lib/FieldType/BaseFieldTypeTest.php +++ b/tests/lib/FieldType/BaseFieldTypeTest.php @@ -9,8 +9,10 @@ use Ibexa\Contracts\Core\FieldType\FieldType; use Ibexa\Contracts\Core\FieldType\ValidationError; +use Ibexa\Contracts\Core\FieldType\Value; use Ibexa\Contracts\Core\FieldType\Value as SPIValue; use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition as APIFieldDefinition; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; abstract class BaseFieldTypeTest extends TestCase @@ -512,7 +514,7 @@ protected function getFieldTypeUnderTest() return $this->fieldTypeUnderTest; } - public function testGetFieldTypeIdentifier() + public function testGetFieldTypeIdentifier(): void { self::assertSame( $this->provideFieldTypeIdentifier(), @@ -537,7 +539,7 @@ public function testGetName( ); } - public function testValidatorConfigurationSchema() + public function testValidatorConfigurationSchema(): void { $fieldType = $this->getFieldTypeUnderTest(); @@ -548,7 +550,7 @@ public function testValidatorConfigurationSchema() ); } - public function testSettingsSchema() + public function testSettingsSchema(): void { $fieldType = $this->getFieldTypeUnderTest(); @@ -559,7 +561,7 @@ public function testSettingsSchema() ); } - public function testEmptyValue() + public function testEmptyValue(): void { $fieldType = $this->getFieldTypeUnderTest(); @@ -575,7 +577,7 @@ public function testEmptyValue() * * @dataProvider provideValidInputForAcceptValue */ - public function testAcceptValue($inputValue, $expectedOutputValue) + public function testAcceptValue($inputValue, $expectedOutputValue): void { $fieldType = $this->getFieldTypeUnderTest(); @@ -591,7 +593,7 @@ public function testAcceptValue($inputValue, $expectedOutputValue) /** * Tests that default empty value is unchanged by acceptValue() method. */ - public function testAcceptGetEmptyValue() + public function testAcceptGetEmptyValue(): void { $fieldType = $this->getFieldTypeUnderTest(); $emptyValue = $fieldType->getEmptyValue(); @@ -628,7 +630,7 @@ public function testAcceptValueFailsOnInvalidValues( * * @dataProvider provideInputForToHash */ - public function testToHash($inputValue, $expectedResult) + public function testToHash(Value $inputValue, $expectedResult): void { $fieldType = $this->getFieldTypeUnderTest(); @@ -657,7 +659,7 @@ public function testToHash($inputValue, $expectedResult) * * @dataProvider provideInputForFromHash */ - public function testFromHash($inputHash, $expectedResult) + public function testFromHash($inputHash, $expectedResult): void { $this->assertIsValidHashValue($inputHash); @@ -680,7 +682,7 @@ public function testFromHash($inputHash, $expectedResult) } } - public function testEmptyValueIsEmpty() + public function testEmptyValueIsEmpty(): void { $fieldType = $this->getFieldTypeUnderTest(); @@ -694,7 +696,7 @@ public function testEmptyValueIsEmpty() * * @dataProvider provideValidFieldSettings */ - public function testValidateFieldSettingsValid($inputSettings) + public function testValidateFieldSettingsValid(array $inputSettings): void { $fieldType = $this->getFieldTypeUnderTest(); @@ -716,7 +718,7 @@ public function testValidateFieldSettingsValid($inputSettings) * * @dataProvider provideInvalidFieldSettings */ - public function testValidateFieldSettingsInvalid($inputSettings) + public function testValidateFieldSettingsInvalid(array $inputSettings): void { $fieldType = $this->getFieldTypeUnderTest(); @@ -747,7 +749,7 @@ public function testValidateFieldSettingsInvalid($inputSettings) * * @dataProvider provideValidValidatorConfiguration */ - public function testValidateValidatorConfigurationValid($inputConfiguration) + public function testValidateValidatorConfigurationValid(array $inputConfiguration): void { $fieldType = $this->getFieldTypeUnderTest(); @@ -769,7 +771,7 @@ public function testValidateValidatorConfigurationValid($inputConfiguration) * * @dataProvider provideInvalidValidatorConfiguration */ - public function testValidateValidatorConfigurationInvalid($inputConfiguration) + public function testValidateValidatorConfigurationInvalid(array $inputConfiguration): void { $fieldType = $this->getFieldTypeUnderTest(); @@ -800,7 +802,7 @@ public function testValidateValidatorConfigurationInvalid($inputConfiguration) * * @dataProvider provideValidFieldSettings */ - public function testFieldSettingsToHash($inputSettings) + public function testFieldSettingsToHash(array $inputSettings): void { $fieldType = $this->getFieldTypeUnderTest(); @@ -814,7 +816,7 @@ public function testFieldSettingsToHash($inputSettings) * * @dataProvider provideValidValidatorConfiguration */ - public function testValidatorConfigurationToHash($inputConfiguration) + public function testValidatorConfigurationToHash(array $inputConfiguration): void { $fieldType = $this->getFieldTypeUnderTest(); @@ -828,7 +830,7 @@ public function testValidatorConfigurationToHash($inputConfiguration) * * @dataProvider provideValidFieldSettings */ - public function testFieldSettingsFromHash($inputSettings) + public function testFieldSettingsFromHash(array $inputSettings): void { $fieldType = $this->getFieldTypeUnderTest(); @@ -843,7 +845,7 @@ public function testFieldSettingsFromHash($inputSettings) * * @dataProvider provideValidValidatorConfiguration */ - public function testValidatorConfigurationFromHash($inputConfiguration) + public function testValidatorConfigurationFromHash(array $inputConfiguration): void { $fieldType = $this->getFieldTypeUnderTest(); @@ -895,7 +897,7 @@ protected function assertIsValidHashValue($actualHash, $keyChain = []) /** * @dataProvider provideValidDataForValidate */ - public function testValidateValid($fieldDefinitionData, $value) + public function testValidateValid(array $fieldDefinitionData, MockObject&Value $value): void { $validationErrors = $this->doValidate($fieldDefinitionData, $value); @@ -906,7 +908,7 @@ public function testValidateValid($fieldDefinitionData, $value) /** * @dataProvider provideInvalidDataForValidate */ - public function testValidateInvalid($fieldDefinitionData, $value, $errors) + public function testValidateInvalid(array $fieldDefinitionData, MockObject&Value $value, array $errors): void { $validationErrors = $this->doValidate($fieldDefinitionData, $value); @@ -914,7 +916,7 @@ public function testValidateInvalid($fieldDefinitionData, $value, $errors) self::assertEquals($errors, $validationErrors); } - protected function doValidate($fieldDefinitionData, $value) + protected function doValidate($fieldDefinitionData, Value $value) { $fieldType = $this->getFieldTypeUnderTest(); diff --git a/tests/lib/FieldType/BinaryFileTest.php b/tests/lib/FieldType/BinaryFileTest.php index f0a94eac5d..e51db9b544 100644 --- a/tests/lib/FieldType/BinaryFileTest.php +++ b/tests/lib/FieldType/BinaryFileTest.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\FieldType\BinaryBase\RouteAwarePathGenerator; use Ibexa\Core\Base\Exceptions\InvalidArgumentValue; use Ibexa\Core\FieldType\BinaryFile\Type as BinaryFileType; +use Ibexa\Core\FieldType\BinaryFile\Value; use Ibexa\Core\FieldType\BinaryFile\Value as BinaryFileValue; use Ibexa\Core\FieldType\FieldType; use Ibexa\Core\FieldType\ValidationError; @@ -44,12 +45,12 @@ protected function createFieldTypeUnderTest(): FieldType return $fieldType; } - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new BinaryFileValue(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { $baseInput = parent::provideInvalidInputForAcceptValue(); $binaryFileInput = [ @@ -62,7 +63,7 @@ public function provideInvalidInputForAcceptValue() return array_merge($baseInput, $binaryFileInput); } - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -206,7 +207,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -388,7 +389,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ @@ -519,7 +520,7 @@ public function provideDataForGetName(): array ]; } - public function provideValidDataForValidate() + public function provideValidDataForValidate(): array { return [ [ @@ -543,7 +544,7 @@ public function provideValidDataForValidate() ]; } - public function provideInvalidDataForValidate() + public function provideInvalidDataForValidate(): array { return [ // File is too large diff --git a/tests/lib/FieldType/CheckboxTest.php b/tests/lib/FieldType/CheckboxTest.php index 10f6963418..0747408150 100644 --- a/tests/lib/FieldType/CheckboxTest.php +++ b/tests/lib/FieldType/CheckboxTest.php @@ -8,7 +8,9 @@ namespace Ibexa\Tests\Core\FieldType; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\FieldType\Checkbox\Type; use Ibexa\Core\FieldType\Checkbox\Type as Checkbox; +use Ibexa\Core\FieldType\Checkbox\Value; use Ibexa\Core\FieldType\Checkbox\Value as CheckboxValue; /** @@ -28,7 +30,7 @@ class CheckboxTest extends FieldTypeTest * * @return \Ibexa\Contracts\Core\FieldType\FieldType */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { $fieldType = new Checkbox(); $fieldType->setTransformationProcessor($this->getTransformationProcessorMock()); @@ -41,7 +43,7 @@ protected function createFieldTypeUnderTest() * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return []; } @@ -51,7 +53,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return []; } @@ -61,12 +63,12 @@ protected function getSettingsSchemaExpectation() * * @return \Ibexa\Core\FieldType\Checkbox\Value */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new CheckboxValue(false); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -109,7 +111,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -158,7 +160,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -207,7 +209,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ @@ -224,7 +226,7 @@ public function provideInputForFromHash() /** * @covers \Ibexa\Core\FieldType\Checkbox\Type::toPersistenceValue */ - public function testToPersistenceValue() + public function testToPersistenceValue(): void { $ft = $this->createFieldTypeUnderTest(); $fieldValue = $ft->toPersistenceValue(new CheckboxValue(true)); @@ -236,7 +238,7 @@ public function testToPersistenceValue() /** * @covers \Ibexa\Core\FieldType\Checkbox\Value::__construct */ - public function testBuildFieldValueWithParam() + public function testBuildFieldValueWithParam(): void { $bool = true; $value = new CheckboxValue($bool); @@ -246,7 +248,7 @@ public function testBuildFieldValueWithParam() /** * @covers \Ibexa\Core\FieldType\Checkbox\Value::__construct */ - public function testBuildFieldValueWithoutParam() + public function testBuildFieldValueWithoutParam(): void { $value = new CheckboxValue(); self::assertFalse($value->bool); @@ -255,7 +257,7 @@ public function testBuildFieldValueWithoutParam() /** * @covers \Ibexa\Core\FieldType\Checkbox\Value::__toString */ - public function testFieldValueToString() + public function testFieldValueToString(): void { $valueTrue = new CheckboxValue(true); $valueFalse = new CheckboxValue(false); diff --git a/tests/lib/FieldType/CountryTest.php b/tests/lib/FieldType/CountryTest.php index fbba207340..48c1efaa77 100644 --- a/tests/lib/FieldType/CountryTest.php +++ b/tests/lib/FieldType/CountryTest.php @@ -9,7 +9,9 @@ use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\FieldType\Country\Exception\InvalidValue; +use Ibexa\Core\FieldType\Country\Type; use Ibexa\Core\FieldType\Country\Type as Country; +use Ibexa\Core\FieldType\Country\Value; use Ibexa\Core\FieldType\Country\Value as CountryValue; use Ibexa\Core\FieldType\ValidationError; @@ -35,7 +37,7 @@ protected function provideFieldTypeIdentifier(): string * * @return \Ibexa\Core\FieldType\FieldType */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { $fieldType = new Country( [ @@ -87,7 +89,7 @@ protected function createFieldTypeUnderTest() * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return []; } @@ -97,7 +99,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return [ 'isMultiple' => [ @@ -112,12 +114,12 @@ protected function getSettingsSchemaExpectation() * * @return \Ibexa\Core\FieldType\Country\Value */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new CountryValue(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -168,7 +170,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -267,7 +269,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -340,7 +342,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ @@ -437,7 +439,7 @@ public function provideDataForGetName(): array * * @return array */ - public function provideValidDataForValidate() + public function provideValidDataForValidate(): array { return [ [ @@ -555,7 +557,7 @@ public function provideValidDataForValidate() * * @return array */ - public function provideInvalidDataForValidate() + public function provideInvalidDataForValidate(): array { return [ [ diff --git a/tests/lib/FieldType/DateAndTimeTest.php b/tests/lib/FieldType/DateAndTimeTest.php index a5d91bf33f..4c948aeb53 100644 --- a/tests/lib/FieldType/DateAndTimeTest.php +++ b/tests/lib/FieldType/DateAndTimeTest.php @@ -9,7 +9,9 @@ use DateInterval; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\FieldType\DateAndTime\Type; use Ibexa\Core\FieldType\DateAndTime\Type as DateAndTime; +use Ibexa\Core\FieldType\DateAndTime\Value; use Ibexa\Core\FieldType\DateAndTime\Value as DateAndTimeValue; use stdClass; @@ -30,7 +32,7 @@ class DateAndTimeTest extends FieldTypeTest * * @return \Ibexa\Core\FieldType\FieldType */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { $fieldType = new DateAndTime(); $fieldType->setTransformationProcessor($this->getTransformationProcessorMock()); @@ -43,7 +45,7 @@ protected function createFieldTypeUnderTest() * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return []; } @@ -53,7 +55,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return [ 'useSeconds' => [ @@ -74,12 +76,12 @@ protected function getSettingsSchemaExpectation() /** * Returns the empty value expected from the field type. */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new DateAndTimeValue(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -118,7 +120,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -175,7 +177,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -198,7 +200,7 @@ public function provideInputForToHash() * * @dataProvider provideInputForFromHash */ - public function testFromHash($inputHash, $expectedResult) + public function testFromHash(?array $inputHash, Value $expectedResult): void { $this->assertIsValidHashValue($inputHash); @@ -229,7 +231,7 @@ public function testFromHash($inputHash, $expectedResult) * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { $date = new \DateTime('Tue, 28 Aug 2012 12:20:00 +0200'); @@ -260,7 +262,7 @@ public function provideInputForFromHash() * * @dataProvider provideInputForTimeStringFromHash */ - public function testTimeStringFromHash($inputHash, $intervalSpec) + public function testTimeStringFromHash(array $inputHash, string $intervalSpec): void { $this->assertIsValidHashValue($inputHash); @@ -297,7 +299,7 @@ public function testTimeStringFromHash($inputHash, $intervalSpec) * * @return array */ - public function provideInputForTimeStringFromHash() + public function provideInputForTimeStringFromHash(): array { return [ [ @@ -343,7 +345,7 @@ public function provideInputForTimeStringFromHash() * * @return array */ - public function provideValidFieldSettings() + public function provideValidFieldSettings(): array { return [ [ @@ -394,7 +396,7 @@ public function provideValidFieldSettings() * * @return array */ - public function provideInValidFieldSettings() + public function provideInValidFieldSettings(): array { return [ [ diff --git a/tests/lib/FieldType/DateTest.php b/tests/lib/FieldType/DateTest.php index 11f9d347db..e62da66988 100644 --- a/tests/lib/FieldType/DateTest.php +++ b/tests/lib/FieldType/DateTest.php @@ -10,7 +10,9 @@ use DateTime; use DateTimeZone; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\FieldType\Date\Type; use Ibexa\Core\FieldType\Date\Type as Date; +use Ibexa\Core\FieldType\Date\Value; use Ibexa\Core\FieldType\Date\Value as DateValue; /** @@ -30,7 +32,7 @@ class DateTest extends FieldTypeTest * * @return \Ibexa\Core\FieldType\FieldType */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { $fieldType = new Date(); $fieldType->setTransformationProcessor($this->getTransformationProcessorMock()); @@ -43,7 +45,7 @@ protected function createFieldTypeUnderTest() * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return []; } @@ -53,7 +55,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return [ 'defaultType' => [ @@ -66,12 +68,12 @@ protected function getSettingsSchemaExpectation() /** * Returns the empty value expected from the field type. */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new DateValue(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -110,7 +112,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -173,7 +175,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -225,7 +227,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { $dateTime = new DateTime(); @@ -277,7 +279,7 @@ public function provideInputForFromHash() * * @return array */ - public function provideValidFieldSettings() + public function provideValidFieldSettings(): array { return [ [ @@ -319,7 +321,7 @@ public function provideValidFieldSettings() * * @return array */ - public function provideInValidFieldSettings() + public function provideInValidFieldSettings(): array { return [ [ diff --git a/tests/lib/FieldType/EmailAddressTest.php b/tests/lib/FieldType/EmailAddressTest.php index 31468e09e1..328031befd 100644 --- a/tests/lib/FieldType/EmailAddressTest.php +++ b/tests/lib/FieldType/EmailAddressTest.php @@ -8,7 +8,9 @@ namespace Ibexa\Tests\Core\FieldType; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\FieldType\EmailAddress\Type; use Ibexa\Core\FieldType\EmailAddress\Type as EmailAddressType; +use Ibexa\Core\FieldType\EmailAddress\Value; use Ibexa\Core\FieldType\EmailAddress\Value as EmailAddressValue; use Ibexa\Core\FieldType\ValidationError; @@ -29,7 +31,7 @@ class EmailAddressTest extends FieldTypeTest * * @return \Ibexa\Core\FieldType\FieldType */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { $transformationProcessorMock = $this->getTransformationProcessorMock(); @@ -55,7 +57,7 @@ static function ($value, $group): string { * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return [ 'EmailAddressValidator' => [], @@ -67,7 +69,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return []; } @@ -75,12 +77,12 @@ protected function getSettingsSchemaExpectation() /** * Returns the empty value expected from the field type. */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new EmailAddressValue(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -123,7 +125,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -176,7 +178,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -225,7 +227,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ @@ -271,7 +273,7 @@ public function provideInputForFromHash() * * @return array */ - public function provideValidValidatorConfiguration() + public function provideValidValidatorConfiguration(): array { return [ [ @@ -334,7 +336,7 @@ public function provideValidValidatorConfiguration() * * @return array */ - public function provideInvalidValidatorConfiguration() + public function provideInvalidValidatorConfiguration(): array { return [ [ @@ -424,7 +426,7 @@ public function provideDataForGetName(): array * * @return array */ - public function provideValidDataForValidate() + public function provideValidDataForValidate(): array { return [ [ @@ -500,7 +502,7 @@ public function provideValidDataForValidate() * * @return array */ - public function provideInvalidDataForValidate() + public function provideInvalidDataForValidate(): array { return [ [ diff --git a/tests/lib/FieldType/EmailAddressValidatorTest.php b/tests/lib/FieldType/EmailAddressValidatorTest.php index 88f7e31326..bb65489337 100644 --- a/tests/lib/FieldType/EmailAddressValidatorTest.php +++ b/tests/lib/FieldType/EmailAddressValidatorTest.php @@ -23,7 +23,7 @@ class EmailAddressValidatorTest extends TestCase /** * This test ensure an EmailAddressValidator can be created. */ - public function testConstructor() + public function testConstructor(): void { self::assertInstanceOf( Validator::class, @@ -37,7 +37,7 @@ public function testConstructor() * @covers \Ibexa\Core\FieldType\Validator::initializeWithConstraints * @covers \Ibexa\Core\FieldType\Validator::__get */ - public function testConstraintsInitializeGet() + public function testConstraintsInitializeGet(): void { $constraints = [ 'Extent' => 'regex', @@ -54,7 +54,7 @@ public function testConstraintsInitializeGet() * * @covers \Ibexa\Core\FieldType\Validator::getConstraintsSchema */ - public function testGetConstraintsSchema() + public function testGetConstraintsSchema(): void { $constraintsSchema = [ 'Extent' => [ @@ -72,7 +72,7 @@ public function testGetConstraintsSchema() * @covers \Ibexa\Core\FieldType\Validator::__set * @covers \Ibexa\Core\FieldType\Validator::__get */ - public function testConstraintsSetGet() + public function testConstraintsSetGet(): void { $constraints = [ 'Extent' => 'regex', @@ -82,7 +82,7 @@ public function testConstraintsSetGet() self::assertSame($constraints['Extent'], $validator->Extent); } - public function testValidateCorrectEmailAddresses() + public function testValidateCorrectEmailAddresses(): void { $validator = new EmailAddressValidator(); $validator->Extent = 'regex'; @@ -98,7 +98,7 @@ public function testValidateCorrectEmailAddresses() * * @covers \Ibexa\Core\FieldType\Validator\EmailAddressValidator::validate */ - public function testValidateWrongEmailAddresses() + public function testValidateWrongEmailAddresses(): void { $validator = new EmailAddressValidator(); $validator->Extent = 'regex'; diff --git a/tests/lib/FieldType/FieldTypeMockTest.php b/tests/lib/FieldType/FieldTypeMockTest.php index 64eb687d93..7fb93fd8c4 100644 --- a/tests/lib/FieldType/FieldTypeMockTest.php +++ b/tests/lib/FieldType/FieldTypeMockTest.php @@ -13,7 +13,7 @@ class FieldTypeMockTest extends TestCase { - public function testApplyDefaultSettingsThrowsInvalidArgumentException() + public function testApplyDefaultSettingsThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -35,7 +35,7 @@ public function testApplyDefaultSettingsThrowsInvalidArgumentException() * * @covers \Ibexa\Core\FieldType\FieldType::applyDefaultSettings */ - public function testApplyDefaultSettings($initialSettings, $expectedSettings) + public function testApplyDefaultSettings(array $initialSettings, array $expectedSettings): void { /** @var \Ibexa\Core\FieldType\FieldType|\PHPUnit\Framework\MockObject\MockObject $stub */ $stub = $this->getMockForAbstractClass( @@ -94,7 +94,7 @@ public function testApplyDefaultSettings($initialSettings, $expectedSettings) ); } - public function providerForTestApplyDefaultSettings() + public function providerForTestApplyDefaultSettings(): array { return [ [ @@ -161,7 +161,7 @@ public function providerForTestApplyDefaultSettings() ]; } - public function testApplyDefaultValidatorConfigurationEmptyThrowsInvalidArgumentException() + public function testApplyDefaultValidatorConfigurationEmptyThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -178,7 +178,7 @@ public function testApplyDefaultValidatorConfigurationEmptyThrowsInvalidArgument $stub->applyDefaultValidatorConfiguration($validatorConfiguration); } - public function testApplyDefaultValidatorConfigurationEmpty() + public function testApplyDefaultValidatorConfigurationEmpty(): void { /** @var \Ibexa\Core\FieldType\FieldType|\PHPUnit\Framework\MockObject\MockObject $stub */ $stub = $this->getMockForAbstractClass( @@ -208,7 +208,7 @@ public function testApplyDefaultValidatorConfigurationEmpty() /** * @dataProvider providerForTestApplyDefaultValidatorConfiguration */ - public function testApplyDefaultValidatorConfiguration($initialConfiguration, $expectedConfiguration) + public function testApplyDefaultValidatorConfiguration(?array $initialConfiguration, array $expectedConfiguration): void { /** @var \Ibexa\Core\FieldType\FieldType|\PHPUnit\Framework\MockObject\MockObject $stub */ $stub = $this->getMockForAbstractClass( @@ -247,7 +247,7 @@ public function testApplyDefaultValidatorConfiguration($initialConfiguration, $e ); } - public function providerForTestApplyDefaultValidatorConfiguration() + public function providerForTestApplyDefaultValidatorConfiguration(): array { $defaultConfiguration = [ 'TestValidator' => [ diff --git a/tests/lib/FieldType/FileSizeValidatorTest.php b/tests/lib/FieldType/FileSizeValidatorTest.php index 029e074202..5da70e3b3c 100644 --- a/tests/lib/FieldType/FileSizeValidatorTest.php +++ b/tests/lib/FieldType/FileSizeValidatorTest.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\PropertyNotFoundException; use Ibexa\Contracts\Core\Repository\Values\Translation\Message; use Ibexa\Contracts\Core\Repository\Values\Translation\Plural; +use Ibexa\Core\FieldType\BinaryFile\Value; use Ibexa\Core\FieldType\BinaryFile\Value as BinaryFileValue; use Ibexa\Core\FieldType\Validator; use Ibexa\Core\FieldType\Validator\FileSizeValidator; @@ -35,7 +36,7 @@ protected function getMaxFileSize(): int /** * This test ensure an FileSizeValidator can be created. */ - public function testConstructor() + public function testConstructor(): void { self::assertInstanceOf( Validator::class, @@ -49,7 +50,7 @@ public function testConstructor() * @covers \Ibexa\Core\FieldType\Validator::initializeWithConstraints * @covers \Ibexa\Core\FieldType\Validator::__get */ - public function testConstraintsInitializeGet() + public function testConstraintsInitializeGet(): void { $constraints = [ 'maxFileSize' => 4096, @@ -66,7 +67,7 @@ public function testConstraintsInitializeGet() * * @covers \Ibexa\Core\FieldType\Validator::getConstraintsSchema */ - public function testGetConstraintsSchema() + public function testGetConstraintsSchema(): void { $constraintsSchema = [ 'maxFileSize' => [ @@ -84,7 +85,7 @@ public function testGetConstraintsSchema() * @covers \Ibexa\Core\FieldType\Validator::__set * @covers \Ibexa\Core\FieldType\Validator::__get */ - public function testConstraintsSetGet() + public function testConstraintsSetGet(): void { $constraints = [ 'maxFileSize' => 4096, @@ -99,7 +100,7 @@ public function testConstraintsSetGet() * * @covers \Ibexa\Core\FieldType\Validator::initializeWithConstraints */ - public function testInitializeBadConstraint() + public function testInitializeBadConstraint(): void { $this->expectException(PropertyNotFoundException::class); @@ -117,7 +118,7 @@ public function testInitializeBadConstraint() * * @covers \Ibexa\Core\FieldType\Validator::__set */ - public function testSetBadConstraint() + public function testSetBadConstraint(): void { $this->expectException(PropertyNotFoundException::class); @@ -130,7 +131,7 @@ public function testSetBadConstraint() * * @covers \Ibexa\Core\FieldType\Validator::__get */ - public function testGetBadConstraint() + public function testGetBadConstraint(): void { $this->expectException(PropertyNotFoundException::class); @@ -148,7 +149,7 @@ public function testGetBadConstraint() * @covers \Ibexa\Core\FieldType\Validator\FileSizeValidator::validate * @covers \Ibexa\Core\FieldType\Validator::getMessage */ - public function testValidateCorrectValues($size) + public function testValidateCorrectValues(int $size): void { self::markTestSkipped('BinaryFile field type does not use this validator anymore.'); $validator = new FileSizeValidator(); @@ -162,7 +163,7 @@ public function testValidateCorrectValues($size) * * @return \Ibexa\Core\FieldType\BinaryFile\Value */ - protected function getBinaryFileValue($size) + protected function getBinaryFileValue($size): Value { self::markTestSkipped('BinaryFile field type does not use this validator anymore.'); $value = new BinaryFileValue($this->createMock(IOServiceInterface::class)); @@ -171,7 +172,7 @@ protected function getBinaryFileValue($size) return $value; } - public function providerForValidateOK() + public function providerForValidateOK(): array { return [ [0], @@ -187,7 +188,7 @@ public function providerForValidateOK() * * @covers \Ibexa\Core\FieldType\Validator\FileSizeValidator::validate */ - public function testValidateWrongValues($size, $message, $values) + public function testValidateWrongValues(int $size, array $message, array $values): void { self::markTestSkipped('BinaryFile field type does not use this validator anymore.'); $validator = new FileSizeValidator(); @@ -217,7 +218,7 @@ public function testValidateWrongValues($size, $message, $values) ); } - public function providerForValidateKO() + public function providerForValidateKO(): array { return [ [ @@ -238,7 +239,7 @@ public function providerForValidateKO() * * @covers \Ibexa\Core\FieldType\Validator\FileSizeValidator::validateConstraints */ - public function testValidateConstraintsCorrectValues($constraints) + public function testValidateConstraintsCorrectValues(array $constraints): void { $validator = new FileSizeValidator(); @@ -247,7 +248,7 @@ public function testValidateConstraintsCorrectValues($constraints) ); } - public function providerForValidateConstraintsOK() + public function providerForValidateConstraintsOK(): array { return [ [ @@ -267,7 +268,7 @@ public function providerForValidateConstraintsOK() * * @covers \Ibexa\Core\FieldType\Validator\FileSizeValidator::validateConstraints */ - public function testValidateConstraintsWrongValues($constraints, $expectedMessages, $values) + public function testValidateConstraintsWrongValues(array $constraints, array $expectedMessages, array $values): void { $validator = new FileSizeValidator(); $messages = $validator->validateConstraints($constraints); @@ -286,7 +287,7 @@ public function testValidateConstraintsWrongValues($constraints, $expectedMessag ); } - public function providerForValidateConstraintsKO() + public function providerForValidateConstraintsKO(): array { return [ [ diff --git a/tests/lib/FieldType/FloatTest.php b/tests/lib/FieldType/FloatTest.php index 7200b33660..0b1f0636f0 100644 --- a/tests/lib/FieldType/FloatTest.php +++ b/tests/lib/FieldType/FloatTest.php @@ -8,7 +8,9 @@ namespace Ibexa\Tests\Core\FieldType; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\FieldType\Float\Type; use Ibexa\Core\FieldType\Float\Type as FloatType; +use Ibexa\Core\FieldType\Float\Value; use Ibexa\Core\FieldType\Float\Value as FloatValue; use Ibexa\Core\FieldType\ValidationError; @@ -29,7 +31,7 @@ class FloatTest extends FieldTypeTest * * @return \Ibexa\Core\FieldType\FieldType */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { $fieldType = new FloatType(); $fieldType->setTransformationProcessor($this->getTransformationProcessorMock()); @@ -42,7 +44,7 @@ protected function createFieldTypeUnderTest() * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return [ 'FloatValueValidator' => [ @@ -63,7 +65,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return []; } @@ -73,12 +75,12 @@ protected function getSettingsSchemaExpectation() * * @return \Ibexa\Core\FieldType\Float\Value */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new FloatValue(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -125,7 +127,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -190,7 +192,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -239,7 +241,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ @@ -281,7 +283,7 @@ public function provideInputForFromHash() * * @return array */ - public function provideValidValidatorConfiguration() + public function provideValidValidatorConfiguration(): array { return [ [ @@ -368,7 +370,7 @@ public function provideValidValidatorConfiguration() * * @return array */ - public function provideInvalidValidatorConfiguration() + public function provideInvalidValidatorConfiguration(): array { return [ [ @@ -458,7 +460,7 @@ public function provideDataForGetName(): array * * @return array */ - public function provideValidDataForValidate() + public function provideValidDataForValidate(): array { return [ [ @@ -539,7 +541,7 @@ public function provideValidDataForValidate() * * @return array */ - public function provideInvalidDataForValidate() + public function provideInvalidDataForValidate(): array { return [ [ diff --git a/tests/lib/FieldType/Generic/GenericTest.php b/tests/lib/FieldType/Generic/GenericTest.php index 4a8ca0ac9a..fa46ad8d8a 100644 --- a/tests/lib/FieldType/Generic/GenericTest.php +++ b/tests/lib/FieldType/Generic/GenericTest.php @@ -12,8 +12,11 @@ use Ibexa\Contracts\Core\FieldType\ValueSerializerInterface; use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Tests\Core\FieldType\BaseFieldTypeTest; +use Ibexa\Tests\Core\FieldType\Generic\Stubs\Type; use Ibexa\Tests\Core\FieldType\Generic\Stubs\Type as GenericFieldTypeStub; +use Ibexa\Tests\Core\FieldType\Generic\Stubs\Value; use Ibexa\Tests\Core\FieldType\Generic\Stubs\Value as GenericFieldValueStub; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\Validator\ConstraintViolation; use Symfony\Component\Validator\ConstraintViolationList; use Symfony\Component\Validator\ConstraintViolationListInterface; @@ -22,10 +25,10 @@ class GenericTest extends BaseFieldTypeTest { /** @var \Ibexa\Contracts\Core\FieldType\ValueSerializerInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $serializer; + private ValueSerializerInterface $serializer; /** @var \Symfony\Component\Validator\Validator\ValidatorInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $validator; + private MockObject $validator; protected function setUp(): void { @@ -53,7 +56,7 @@ public function testValidateValid($fieldDefinitionData, $value): void */ public function testValidateInvalid($fieldDefinitionData, $value, $errors): void { - $constraintViolationList = new ConstraintViolationList(array_map(static function (ValidationError $error) { + $constraintViolationList = new ConstraintViolationList(array_map(static function (ValidationError $error): ConstraintViolation { return new ConstraintViolation((string) $error->getTranslatableMessage()); }, $errors)); @@ -70,7 +73,7 @@ protected function provideFieldTypeIdentifier(): string return 'generic'; } - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { return new GenericFieldTypeStub($this->serializer, $this->validator); } @@ -85,7 +88,7 @@ protected function getSettingsSchemaExpectation(): array return []; } - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new GenericFieldValueStub(); } @@ -165,7 +168,7 @@ private function createSerializerMock(): ValueSerializerInterface $serializer ->method('normalize') - ->willReturnCallback(static function (GenericFieldValueStub $value) { + ->willReturnCallback(static function (GenericFieldValueStub $value): array { return [ 'value' => $value->getValue(), ]; @@ -173,7 +176,7 @@ private function createSerializerMock(): ValueSerializerInterface $serializer ->method('denormalize') - ->willReturnCallback(function (array $data, string $valueClass) { + ->willReturnCallback(function (array $data, string $valueClass): Value { $this->assertEquals($valueClass, GenericFieldValueStub::class); return new GenericFieldValueStub($data['value']); diff --git a/tests/lib/FieldType/Generic/Stubs/Value.php b/tests/lib/FieldType/Generic/Stubs/Value.php index cda857ccb0..4540103566 100644 --- a/tests/lib/FieldType/Generic/Stubs/Value.php +++ b/tests/lib/FieldType/Generic/Stubs/Value.php @@ -24,7 +24,7 @@ public function getValue() return $this->value; } - public function __toString() + public function __toString(): string { return (string)$this->value; } diff --git a/tests/lib/FieldType/Generic/ValueSerializer/SymfonySerializerAdapterTest.php b/tests/lib/FieldType/Generic/ValueSerializer/SymfonySerializerAdapterTest.php index f564441e91..8048a5a14e 100644 --- a/tests/lib/FieldType/Generic/ValueSerializer/SymfonySerializerAdapterTest.php +++ b/tests/lib/FieldType/Generic/ValueSerializer/SymfonySerializerAdapterTest.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\FieldType\Value; use Ibexa\Core\FieldType\ValueSerializer\SymfonySerializerAdapter; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Encoder\DecoderInterface; use Symfony\Component\Serializer\Encoder\EncoderInterface; @@ -22,19 +23,19 @@ class SymfonySerializerAdapterTest extends TestCase private const TEST_CONTEXT = ['foo' => 'bar']; /** @var \Symfony\Component\Serializer\Normalizer\NormalizerInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $normalizer; + private MockObject $normalizer; /** @var \Symfony\Component\Serializer\Normalizer\DenormalizerInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $denomalizer; + private MockObject $denomalizer; /** @var \Symfony\Component\Serializer\Encoder\EncoderInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $encoder; + private MockObject $encoder; /** @var \Symfony\Component\Serializer\Encoder\DecoderInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $decoder; + private MockObject $decoder; /** @var \Ibexa\Core\FieldType\ValueSerializer\SymfonySerializerAdapter */ - private $adapter; + private SymfonySerializerAdapter $adapter; protected function setUp(): void { diff --git a/tests/lib/FieldType/ISBNTest.php b/tests/lib/FieldType/ISBNTest.php index 38cc00a5ff..f636d6ebf9 100644 --- a/tests/lib/FieldType/ISBNTest.php +++ b/tests/lib/FieldType/ISBNTest.php @@ -8,6 +8,7 @@ namespace Ibexa\Tests\Core\FieldType; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\FieldType\ISBN\Type; use Ibexa\Core\FieldType\ISBN\Type as ISBN; use Ibexa\Core\FieldType\ISBN\Value as ISBNValue; use Ibexa\Core\FieldType\ValidationError; @@ -29,7 +30,7 @@ class ISBNTest extends FieldTypeTest * * @return \Ibexa\Core\FieldType\FieldType */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { $fieldType = new ISBN('9789722514095'); $fieldType->setTransformationProcessor($this->getTransformationProcessorMock()); @@ -42,7 +43,7 @@ protected function createFieldTypeUnderTest() * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return []; } @@ -52,7 +53,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return [ 'isISBN13' => [ @@ -67,7 +68,7 @@ protected function getEmptyValueExpectation(): ISBNValue return new ISBNValue(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -118,7 +119,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -171,7 +172,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -216,7 +217,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ @@ -245,7 +246,7 @@ public function provideDataForGetName(): array * * @return array */ - public function provideValidDataForValidate() + public function provideValidDataForValidate(): array { return [ [ @@ -290,7 +291,7 @@ public function provideValidDataForValidate() * * @return array */ - public function provideInvalidDataForValidate() + public function provideInvalidDataForValidate(): array { return [ [ diff --git a/tests/lib/FieldType/Image/IO/LegacyTest.php b/tests/lib/FieldType/Image/IO/LegacyTest.php index 33a74ea5b1..c927fc790f 100644 --- a/tests/lib/FieldType/Image/IO/LegacyTest.php +++ b/tests/lib/FieldType/Image/IO/LegacyTest.php @@ -14,6 +14,7 @@ use Ibexa\Core\IO\IOServiceInterface; use Ibexa\Core\IO\Values\BinaryFile; use Ibexa\Core\IO\Values\BinaryFileCreateStruct; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class LegacyTest extends TestCase @@ -26,14 +27,14 @@ class LegacyTest extends TestCase * * @var \Ibexa\Core\IO\IOServiceInterface|\PHPUnit\Framework\MockObject\MockObject */ - protected $publishedIoServiceMock; + protected MockObject $publishedIoServiceMock; /** * Internal IOService instance for draft images. * * @var \Ibexa\Core\IO\IOServiceInterface|\PHPUnit\Framework\MockObject\MockObject */ - protected $draftIoServiceMock; + protected MockObject $draftIoServiceMock; protected function setUp(): void { @@ -47,7 +48,7 @@ protected function setUp(): void ); } - public function testNewBinaryCreateStructFromLocalFile() + public function testNewBinaryCreateStructFromLocalFile(): void { $path = '/tmp/file.png'; $struct = new BinaryFileCreateStruct(); @@ -65,7 +66,7 @@ public function testNewBinaryCreateStructFromLocalFile() ); } - public function testExists() + public function testExists(): void { $path = 'path/file.png'; $this->publishedIoServiceMock @@ -84,7 +85,7 @@ public function testExists() /** * Standard binary file, with regular id. */ - public function testLoadBinaryFile() + public function testLoadBinaryFile(): void { $id = 'path/file.jpg'; $binaryFile = new BinaryFile(['id' => $id]); @@ -106,7 +107,7 @@ public function testLoadBinaryFile() /** * Load from internal draft binary file path. */ - public function testLoadBinaryFileDraftInternalPath() + public function testLoadBinaryFileDraftInternalPath(): void { $internalId = 'var/test/storage/images-versioned/path/file.jpg'; $id = 'path/file.jpg'; @@ -129,7 +130,7 @@ public function testLoadBinaryFileDraftInternalPath() /** * Load from internal published binary file path. */ - public function testLoadBinaryFilePublishedInternalPath() + public function testLoadBinaryFilePublishedInternalPath(): void { $internalId = 'var/test/storage/images/path/file.jpg'; $id = 'path/file.jpg'; @@ -152,7 +153,7 @@ public function testLoadBinaryFilePublishedInternalPath() /** * Load from external draft binary file path. */ - public function testLoadBinaryFileDraftExternalPath() + public function testLoadBinaryFileDraftExternalPath(): void { $id = 'path/file.jpg'; $binaryFile = new BinaryFile(['id' => $id]); @@ -175,7 +176,7 @@ public function testLoadBinaryFileDraftExternalPath() ); } - public function testLoadBinaryFileByUriWithPublishedFile() + public function testLoadBinaryFileByUriWithPublishedFile(): void { $binaryFileUri = 'var/test/images/an/image.png'; $binaryFile = new BinaryFile(['id' => 'an/image.png']); @@ -191,7 +192,7 @@ public function testLoadBinaryFileByUriWithPublishedFile() ); } - public function testLoadBinaryFileByUriWithDraftFile() + public function testLoadBinaryFileByUriWithDraftFile(): void { $binaryFileUri = 'var/test/images-versioned/an/image.png'; $binaryFile = new BinaryFile(['id' => 'an/image.png']); @@ -214,7 +215,7 @@ public function testLoadBinaryFileByUriWithDraftFile() ); } - public function testGetFileContents() + public function testGetFileContents(): void { $contents = 'some contents'; $path = 'path/file.png'; @@ -240,7 +241,7 @@ public function testGetFileContents() ); } - public function testGetFileContentsOfDraft() + public function testGetFileContentsOfDraft(): void { $contents = 'some contents'; $path = 'path/file.png'; @@ -266,7 +267,7 @@ public function testGetFileContentsOfDraft() ); } - public function testGetMimeType() + public function testGetMimeType(): void { $path = 'path/file.png'; $mimeType = 'image/png'; @@ -291,7 +292,7 @@ public function testGetMimeType() ); } - public function testGetMimeTypeOfDraft() + public function testGetMimeTypeOfDraft(): void { $path = 'path/file.png'; $mimeType = 'image/png'; @@ -316,7 +317,7 @@ public function testGetMimeTypeOfDraft() ); } - public function testCreateBinaryFile() + public function testCreateBinaryFile(): void { $createStruct = new BinaryFileCreateStruct(); $binaryFile = new BinaryFile(); @@ -335,7 +336,7 @@ public function testCreateBinaryFile() ); } - public function testGetUri() + public function testGetUri(): void { $binaryFile = new BinaryFile(); $this->publishedIoServiceMock @@ -352,7 +353,7 @@ public function testGetUri() ); } - public function testGetFileInputStream() + public function testGetFileInputStream(): void { $binaryFile = new BinaryFile(); $this->publishedIoServiceMock @@ -369,7 +370,7 @@ public function testGetFileInputStream() ); } - public function testDeleteBinaryFile() + public function testDeleteBinaryFile(): void { $binaryFile = new BinaryFile(); $this->publishedIoServiceMock @@ -382,7 +383,7 @@ public function testDeleteBinaryFile() $this->service->deleteBinaryFile($binaryFile); } - public function testNewBinaryCreateStructFromUploadedFile() + public function testNewBinaryCreateStructFromUploadedFile(): void { $struct = new BinaryFileCreateStruct(); $this->publishedIoServiceMock diff --git a/tests/lib/FieldType/Image/PathGenerator/LegacyPathGeneratorTest.php b/tests/lib/FieldType/Image/PathGenerator/LegacyPathGeneratorTest.php index a9ecee1dd0..83a3c0e8d4 100644 --- a/tests/lib/FieldType/Image/PathGenerator/LegacyPathGeneratorTest.php +++ b/tests/lib/FieldType/Image/PathGenerator/LegacyPathGeneratorTest.php @@ -22,7 +22,7 @@ class LegacyPathGeneratorTest extends TestCase * * @dataProvider provideStoragePathForFieldData */ - public function testGetStoragePathForField($data, $expectedPath) + public function testGetStoragePathForField(array $data, string $expectedPath): void { $pathGenerator = new LegacyPathGenerator(); @@ -36,7 +36,7 @@ public function testGetStoragePathForField($data, $expectedPath) ); } - public function provideStoragePathForFieldData() + public function provideStoragePathForFieldData(): array { return [ [ diff --git a/tests/lib/FieldType/ImageAsset/AssetMapperTest.php b/tests/lib/FieldType/ImageAsset/AssetMapperTest.php index 60c17983ed..7870c19b41 100644 --- a/tests/lib/FieldType/ImageAsset/AssetMapperTest.php +++ b/tests/lib/FieldType/ImageAsset/AssetMapperTest.php @@ -23,6 +23,7 @@ use Ibexa\Core\Repository\Values\Content\VersionInfo; use Ibexa\Core\Repository\Values\ContentType\ContentType; use Ibexa\Core\Repository\Values\ContentType\FieldDefinition; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class AssetMapperTest extends TestCase @@ -30,19 +31,18 @@ class AssetMapperTest extends TestCase public const EXAMPLE_CONTENT_ID = 487; /** @var \Ibexa\Contracts\Core\Repository\ContentService|\PHPUnit\Framework\MockObject\MockObject */ - private $contentService; + private MockObject $contentService; /** @var \Ibexa\Contracts\Core\Repository\LocationService|\PHPUnit\Framework\MockObject\MockObject */ - private $locationService; + private MockObject $locationService; /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService|\PHPUnit\Framework\MockObject\MockObject */ - private $contentTypeService; + private MockObject $contentTypeService; /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $configResolver; + private ConfigResolverInterface $configResolver; - /** @var array */ - private $mappings = [ + private array $mappings = [ 'content_type_identifier' => 'image', 'content_field_identifier' => 'image', 'name_field_identifier' => 'name', diff --git a/tests/lib/FieldType/ImageAssetTest.php b/tests/lib/FieldType/ImageAssetTest.php index a85e2cbb94..4f26b0f266 100644 --- a/tests/lib/FieldType/ImageAssetTest.php +++ b/tests/lib/FieldType/ImageAssetTest.php @@ -20,7 +20,9 @@ use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\FieldType\Image\Value; use Ibexa\Core\FieldType\ImageAsset; +use Ibexa\Core\FieldType\ImageAsset\Type; use Ibexa\Core\FieldType\ValidationError; +use PHPUnit\Framework\MockObject\MockObject; /** * @group fieldType @@ -31,13 +33,13 @@ class ImageAssetTest extends FieldTypeTest private const DESTINATION_CONTENT_ID = 14; /** @var \Ibexa\Contracts\Core\Repository\ContentService|\PHPUnit\Framework\MockObject\MockObject */ - private $contentServiceMock; + private MockObject $contentServiceMock; /** @var \Ibexa\Core\FieldType\ImageAsset\AssetMapper|\PHPUnit\Framework\MockObject\MockObject */ - private $assetMapperMock; + private MockObject $assetMapperMock; /** @var \Ibexa\Contracts\Core\Persistence\Content\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $contentHandlerMock; + private MockObject $contentHandlerMock; /** * {@inheritdoc} @@ -81,15 +83,15 @@ protected function setUp(): void */ protected function provideFieldTypeIdentifier(): string { - return ImageAsset\Type::FIELD_TYPE_IDENTIFIER; + return Type::FIELD_TYPE_IDENTIFIER; } /** * {@inheritdoc} */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { - return new ImageAsset\Type( + return new Type( $this->contentServiceMock, $this->assetMapperMock, $this->contentHandlerMock @@ -115,7 +117,7 @@ protected function getSettingsSchemaExpectation(): array /** * {@inheritdoc} */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): ImageAsset\Value { return new ImageAsset\Value(); } @@ -232,7 +234,7 @@ public function provideInvalidDataForValidate(): array /** * {@inheritdoc} */ - public function testValidateNonAsset() + public function testValidateNonAsset(): void { $destinationContentId = 7; $destinationContent = $this->createMock(Content::class); @@ -412,7 +414,7 @@ public function testGetName( self::assertSame($expected, $name); } - public function testIsSearchable() + public function testIsSearchable(): void { self::assertTrue($this->getFieldTypeUnderTest()->isSearchable()); } @@ -420,7 +422,7 @@ public function testIsSearchable() /** * @covers \Ibexa\Core\FieldType\Relation\Type::getRelations */ - public function testGetRelations() + public function testGetRelations(): void { $destinationContentId = 7; $fieldType = $this->createFieldTypeUnderTest(); diff --git a/tests/lib/FieldType/ImageTest.php b/tests/lib/FieldType/ImageTest.php index a15395812c..ffbcf50099 100644 --- a/tests/lib/FieldType/ImageTest.php +++ b/tests/lib/FieldType/ImageTest.php @@ -10,11 +10,14 @@ use Ibexa\Contracts\Core\IO\MimeTypeDetector; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\FieldType\Image\Type; use Ibexa\Core\FieldType\Image\Type as ImageType; +use Ibexa\Core\FieldType\Image\Value; use Ibexa\Core\FieldType\Image\Value as ImageValue; use Ibexa\Core\FieldType\ValidationError; use Ibexa\Core\FieldType\Validator\FileExtensionBlackListValidator; use Ibexa\Core\FieldType\Validator\ImageValidator; +use PHPUnit\Framework\MockObject\MockObject; /** * @group fieldType @@ -66,7 +69,7 @@ protected function getMimeTypeDetectorMock() * * @return \Ibexa\Core\FieldType\FieldType */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { $fieldType = new ImageType( [ @@ -80,7 +83,7 @@ protected function createFieldTypeUnderTest() return $fieldType; } - private function getBlackListValidatorMock() + private function getBlackListValidatorMock(): MockObject { return $this ->getMockBuilder(FileExtensionBlackListValidator::class) @@ -91,7 +94,7 @@ private function getBlackListValidatorMock() ->getMock(); } - private function getImageValidatorMock() + private function getImageValidatorMock(): MockObject { return $this ->getMockBuilder(ImageValidator::class) @@ -99,7 +102,7 @@ private function getImageValidatorMock() ->getMock(); } - private function getConfigResolverMock() + private function getConfigResolverMock(): MockObject { $configResolver = $this ->createMock(ConfigResolverInterface::class); @@ -117,7 +120,7 @@ private function getConfigResolverMock() * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return [ 'FileSizeValidator' => [ @@ -140,7 +143,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return [ 'mimeTypes' => [ @@ -155,12 +158,12 @@ protected function getSettingsSchemaExpectation() * * @return \Ibexa\Core\FieldType\Image\Value */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new ImageValue(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -237,7 +240,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -333,7 +336,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -432,7 +435,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ @@ -566,7 +569,7 @@ public function provideDataForGetName(): array * * @return array */ - public function provideValidDataForValidate() + public function provideValidDataForValidate(): array { return [ [ @@ -654,7 +657,7 @@ public function provideValidDataForValidate() * * @return array */ - public function provideInvalidDataForValidate() + public function provideInvalidDataForValidate(): array { return [ 'file is too large' => [ diff --git a/tests/lib/FieldType/IntegerTest.php b/tests/lib/FieldType/IntegerTest.php index b9c73b56b5..4fa979132a 100644 --- a/tests/lib/FieldType/IntegerTest.php +++ b/tests/lib/FieldType/IntegerTest.php @@ -8,7 +8,9 @@ namespace Ibexa\Tests\Core\FieldType; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\FieldType\Integer\Type; use Ibexa\Core\FieldType\Integer\Type as Integer; +use Ibexa\Core\FieldType\Integer\Value; use Ibexa\Core\FieldType\Integer\Value as IntegerValue; use Ibexa\Core\FieldType\ValidationError; @@ -29,7 +31,7 @@ class IntegerTest extends FieldTypeTest * * @return \Ibexa\Core\FieldType\FieldType */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { $fieldType = new Integer(); $fieldType->setTransformationProcessor($this->getTransformationProcessorMock()); @@ -42,7 +44,7 @@ protected function createFieldTypeUnderTest() * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return [ 'IntegerValueValidator' => [ @@ -63,7 +65,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return []; } @@ -71,12 +73,12 @@ protected function getSettingsSchemaExpectation() /** * Returns the empty value expected from the field type. */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new IntegerValue(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -123,7 +125,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -180,7 +182,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -229,7 +231,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ @@ -271,7 +273,7 @@ public function provideInputForFromHash() * * @return array */ - public function provideValidValidatorConfiguration() + public function provideValidValidatorConfiguration(): array { return [ [ @@ -358,7 +360,7 @@ public function provideValidValidatorConfiguration() * * @return array */ - public function provideInvalidValidatorConfiguration() + public function provideInvalidValidatorConfiguration(): array { return [ [ @@ -448,7 +450,7 @@ public function provideDataForGetName(): array * * @return array */ - public function provideValidDataForValidate() + public function provideValidDataForValidate(): array { return [ [ @@ -529,7 +531,7 @@ public function provideValidDataForValidate() * * @return array */ - public function provideInvalidDataForValidate() + public function provideInvalidDataForValidate(): array { return [ [ diff --git a/tests/lib/FieldType/KeywordTest.php b/tests/lib/FieldType/KeywordTest.php index 953b08311a..95eee21529 100644 --- a/tests/lib/FieldType/KeywordTest.php +++ b/tests/lib/FieldType/KeywordTest.php @@ -8,7 +8,9 @@ namespace Ibexa\Tests\Core\FieldType; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\FieldType\Keyword\Type; use Ibexa\Core\FieldType\Keyword\Type as KeywordType; +use Ibexa\Core\FieldType\Keyword\Value; use Ibexa\Core\FieldType\Keyword\Value as KeywordValue; /** @@ -28,7 +30,7 @@ class KeywordTest extends FieldTypeTest * * @return \Ibexa\Core\FieldType\FieldType */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { $fieldType = new KeywordType(); $fieldType->setTransformationProcessor($this->getTransformationProcessorMock()); @@ -41,7 +43,7 @@ protected function createFieldTypeUnderTest() * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return []; } @@ -51,7 +53,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return []; } @@ -59,12 +61,12 @@ protected function getSettingsSchemaExpectation() /** * Returns the empty value expected from the field type. */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new KeywordValue([]); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -103,7 +105,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -164,7 +166,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -213,7 +215,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ diff --git a/tests/lib/FieldType/MapLocationTest.php b/tests/lib/FieldType/MapLocationTest.php index 52ff1a046c..4ef9c9abe2 100644 --- a/tests/lib/FieldType/MapLocationTest.php +++ b/tests/lib/FieldType/MapLocationTest.php @@ -8,7 +8,8 @@ namespace Ibexa\Tests\Core\FieldType; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; -use Ibexa\Core\FieldType\MapLocation; +use Ibexa\Core\FieldType\MapLocation\Type; +use Ibexa\Core\FieldType\MapLocation\Value; class MapLocationTest extends FieldTypeTest { @@ -23,9 +24,9 @@ class MapLocationTest extends FieldTypeTest * * @return \Ibexa\Core\FieldType\FieldType */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { - $fieldType = new MapLocation\Type(); + $fieldType = new Type(); $fieldType->setTransformationProcessor($this->getTransformationProcessorMock()); return $fieldType; @@ -36,7 +37,7 @@ protected function createFieldTypeUnderTest() * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return []; } @@ -46,7 +47,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return []; } @@ -54,12 +55,12 @@ protected function getSettingsSchemaExpectation() /** * Returns the empty value expected from the field type. */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { - return new MapLocation\Value(); + return new Value(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -67,7 +68,7 @@ public function provideInvalidInputForAcceptValue() InvalidArgumentException::class, ], [ - new MapLocation\Value( + new Value( [ 'latitude' => 'foo', ] @@ -75,7 +76,7 @@ public function provideInvalidInputForAcceptValue() InvalidArgumentException::class, ], [ - new MapLocation\Value( + new Value( [ 'latitude' => 23.42, 'longitude' => 'bar', @@ -84,7 +85,7 @@ public function provideInvalidInputForAcceptValue() InvalidArgumentException::class, ], [ - new MapLocation\Value( + new Value( [ 'latitude' => 23.42, 'longitude' => 42.23, @@ -125,20 +126,20 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ null, - new MapLocation\Value(), + new Value(), ], [ [], - new MapLocation\Value(), + new Value(), ], [ - new MapLocation\Value(), - new MapLocation\Value(), + new Value(), + new Value(), ], [ [ @@ -146,7 +147,7 @@ public function provideValidInputForAcceptValue() 'longitude' => 42.23, 'address' => 'Nowhere', ], - new MapLocation\Value( + new Value( [ 'latitude' => 23.42, 'longitude' => 42.23, @@ -160,7 +161,7 @@ public function provideValidInputForAcceptValue() 'longitude' => 42, 'address' => 'Somewhere', ], - new MapLocation\Value( + new Value( [ 'latitude' => 23, 'longitude' => 42, @@ -169,14 +170,14 @@ public function provideValidInputForAcceptValue() ), ], [ - new MapLocation\Value( + new Value( [ 'latitude' => 23.42, 'longitude' => 42.23, 'address' => 'Nowhere', ] ), - new MapLocation\Value( + new Value( [ 'latitude' => 23.42, 'longitude' => 42.23, @@ -222,15 +223,15 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ - new MapLocation\Value(), + new Value(), null, ], [ - new MapLocation\Value( + new Value( [ 'latitude' => 23.42, 'longitude' => 42.23, @@ -283,12 +284,12 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ null, - new MapLocation\Value(), + new Value(), ], [ [ @@ -296,7 +297,7 @@ public function provideInputForFromHash() 'longitude' => 42.23, 'address' => 'Nowhere', ], - new MapLocation\Value( + new Value( [ 'latitude' => 23.42, 'longitude' => 42.23, @@ -316,7 +317,7 @@ public function provideDataForGetName(): array { return [ [$this->getEmptyValueExpectation(), '', [], 'en_GB'], - [new MapLocation\Value(['address' => 'Bag End, The Shire']), 'Bag End, The Shire', [], 'en_GB'], + [new Value(['address' => 'Bag End, The Shire']), 'Bag End, The Shire', [], 'en_GB'], ]; } } diff --git a/tests/lib/FieldType/MediaTest.php b/tests/lib/FieldType/MediaTest.php index 5933628d7a..b029c8e5a7 100644 --- a/tests/lib/FieldType/MediaTest.php +++ b/tests/lib/FieldType/MediaTest.php @@ -9,7 +9,9 @@ use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\FieldType\BinaryFile\Value as BinaryFileValue; +use Ibexa\Core\FieldType\Media\Type; use Ibexa\Core\FieldType\Media\Type as MediaType; +use Ibexa\Core\FieldType\Media\Value; use Ibexa\Core\FieldType\Media\Value as MediaValue; use Ibexa\Core\FieldType\ValidationError; @@ -30,7 +32,7 @@ class MediaTest extends BinaryBaseTest * * @return \Ibexa\Core\FieldType\FieldType */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { $fieldType = new MediaType([$this->getBlackListValidatorMock()]); $fieldType->setTransformationProcessor($this->getTransformationProcessorMock()); @@ -38,12 +40,12 @@ protected function createFieldTypeUnderTest() return $fieldType; } - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new MediaValue(); } - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return [ 'mediaType' => [ @@ -53,7 +55,7 @@ protected function getSettingsSchemaExpectation() ]; } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { $baseInput = parent::provideInvalidInputForAcceptValue(); $binaryFileInput = [ @@ -86,7 +88,7 @@ public function provideInvalidInputForAcceptValue() return array_merge($baseInput, $binaryFileInput); } - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -320,7 +322,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -490,7 +492,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ @@ -605,7 +607,7 @@ public function provideInputForFromHash() * * @return array */ - public function provideValidFieldSettings() + public function provideValidFieldSettings(): array { return [ [ @@ -647,7 +649,7 @@ public function provideValidFieldSettings() * * @return array */ - public function provideInValidFieldSettings() + public function provideInValidFieldSettings(): array { return [ [ @@ -687,7 +689,7 @@ public function provideDataForGetName(): array ]; } - public function provideValidDataForValidate() + public function provideValidDataForValidate(): array { return [ [ @@ -711,7 +713,7 @@ public function provideValidDataForValidate() ]; } - public function provideInvalidDataForValidate() + public function provideInvalidDataForValidate(): array { return [ // File is too large diff --git a/tests/lib/FieldType/RelationListTest.php b/tests/lib/FieldType/RelationListTest.php index d452daec28..879fadd0da 100644 --- a/tests/lib/FieldType/RelationListTest.php +++ b/tests/lib/FieldType/RelationListTest.php @@ -17,6 +17,7 @@ use Ibexa\Core\FieldType\RelationList\Value; use Ibexa\Core\FieldType\ValidationError; use Ibexa\Core\Repository\Validator\TargetContentValidatorInterface; +use PHPUnit\Framework\MockObject\MockObject; class RelationListTest extends FieldTypeTest { @@ -24,10 +25,10 @@ class RelationListTest extends FieldTypeTest private const DESTINATION_CONTENT_ID_22 = 22; /** @var \Ibexa\Contracts\Core\Persistence\Content\Handler */ - private $contentHandler; + private MockObject $contentHandler; /** @var \Ibexa\Core\Repository\Validator\TargetContentValidatorInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $targetContentValidator; + private MockObject $targetContentValidator; protected function setUp(): void { @@ -107,7 +108,7 @@ protected function createFieldTypeUnderTest(): RelationList * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return [ 'RelationListValueValidator' => [ @@ -124,7 +125,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return [ 'selectionMethod' => [ @@ -151,13 +152,13 @@ protected function getSettingsSchemaExpectation() * * @return \Ibexa\Core\FieldType\RelationList\Value */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { // @todo FIXME: Is this correct? return new Value(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -196,7 +197,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -253,7 +254,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -302,7 +303,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ @@ -338,7 +339,7 @@ public function provideInputForFromHash() * * @return array */ - public function provideValidFieldSettings() + public function provideValidFieldSettings(): array { return [ [ @@ -424,7 +425,7 @@ public function provideValidFieldSettings() * * @return array */ - public function provideInValidFieldSettings() + public function provideInValidFieldSettings(): array { return [ [ @@ -488,7 +489,7 @@ public function provideInValidFieldSettings() * * @return array */ - public function provideValidValidatorConfiguration() + public function provideValidValidatorConfiguration(): array { return [ [ @@ -553,7 +554,7 @@ public function provideValidValidatorConfiguration() * * @return array */ - public function provideInvalidValidatorConfiguration() + public function provideInvalidValidatorConfiguration(): array { return [ [ @@ -630,7 +631,7 @@ public function provideInvalidValidatorConfiguration() * * @return array */ - public function provideValidDataForValidate() + public function provideValidDataForValidate(): array { return [ [ @@ -740,7 +741,7 @@ public function provideValidDataForValidate() * * @return array */ - public function provideInvalidDataForValidate() + public function provideInvalidDataForValidate(): array { return [ [ @@ -839,7 +840,7 @@ private function generateContentTypeValidationError(string $contentTypeIdentifie /** * @covers \Ibexa\Core\FieldType\Relation\Type::getRelations */ - public function testGetRelations() + public function testGetRelations(): void { $ft = $this->createFieldTypeUnderTest(); self::assertEquals( diff --git a/tests/lib/FieldType/RelationTest.php b/tests/lib/FieldType/RelationTest.php index 54a149a8a1..78761a860d 100644 --- a/tests/lib/FieldType/RelationTest.php +++ b/tests/lib/FieldType/RelationTest.php @@ -14,19 +14,21 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Relation; use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\FieldType\Relation\Type; use Ibexa\Core\FieldType\Relation\Type as RelationType; use Ibexa\Core\FieldType\Relation\Value; use Ibexa\Core\FieldType\ValidationError; use Ibexa\Core\Repository\Validator\TargetContentValidatorInterface; +use PHPUnit\Framework\MockObject\MockObject; class RelationTest extends FieldTypeTest { private const DESTINATION_CONTENT_ID = 14; - private $contentHandler; + private MockObject $contentHandler; /** @var \Ibexa\Core\Repository\Validator\TargetContentValidatorInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $targetContentValidator; + private MockObject $targetContentValidator; protected function setUp(): void { @@ -73,7 +75,7 @@ protected function setUp(): void * * @return \Ibexa\Core\FieldType\Relation\Type */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { $fieldType = new RelationType( $this->contentHandler, @@ -89,7 +91,7 @@ protected function createFieldTypeUnderTest() * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return []; } @@ -99,7 +101,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return [ 'selectionMethod' => [ @@ -126,12 +128,12 @@ protected function getSettingsSchemaExpectation() * * @return \Ibexa\Core\FieldType\Relation\Value */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new Value(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -170,7 +172,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -223,7 +225,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -272,7 +274,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ @@ -308,7 +310,7 @@ public function provideInputForFromHash() * * @return array */ - public function provideValidFieldSettings() + public function provideValidFieldSettings(): array { return [ [ @@ -349,7 +351,7 @@ public function provideValidFieldSettings() * * @return array */ - public function provideInValidFieldSettings() + public function provideInValidFieldSettings(): array { return [ [ @@ -380,7 +382,7 @@ public function provideInValidFieldSettings() /** * @covers \Ibexa\Core\FieldType\Relation\Type::getRelations */ - public function testGetRelations() + public function testGetRelations(): void { $ft = $this->createFieldTypeUnderTest(); self::assertEquals( diff --git a/tests/lib/FieldType/SelectionTest.php b/tests/lib/FieldType/SelectionTest.php index 7b05fc327e..ffdd78faaf 100644 --- a/tests/lib/FieldType/SelectionTest.php +++ b/tests/lib/FieldType/SelectionTest.php @@ -9,7 +9,9 @@ use Ibexa\Contracts\Core\FieldType\Value as SPIValue; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\FieldType\Selection\Type; use Ibexa\Core\FieldType\Selection\Type as Selection; +use Ibexa\Core\FieldType\Selection\Value; use Ibexa\Core\FieldType\Selection\Value as SelectionValue; use Ibexa\Core\FieldType\ValidationError; @@ -30,7 +32,7 @@ class SelectionTest extends FieldTypeTest * * @return \Ibexa\Core\FieldType\FieldType */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { $fieldType = new Selection(); $fieldType->setTransformationProcessor($this->getTransformationProcessorMock()); @@ -43,7 +45,7 @@ protected function createFieldTypeUnderTest() * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return []; } @@ -53,7 +55,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return [ 'isMultiple' => [ @@ -76,12 +78,12 @@ protected function getSettingsSchemaExpectation() * * @return \Ibexa\Core\FieldType\Selection\Value */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new SelectionValue(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -124,7 +126,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -181,7 +183,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -230,7 +232,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ @@ -266,7 +268,7 @@ public function provideInputForFromHash() * * @return array */ - public function provideValidFieldSettings() + public function provideValidFieldSettings(): array { return [ [ @@ -310,7 +312,7 @@ public function provideValidFieldSettings() * * @return array */ - public function provideInValidFieldSettings() + public function provideInValidFieldSettings(): array { return [ [ @@ -432,7 +434,7 @@ public function provideDataForGetName(): array * * @return array */ - public function provideValidDataForValidate() + public function provideValidDataForValidate(): array { return [ [ @@ -555,7 +557,7 @@ public function provideValidDataForValidate() * * @return array */ - public function provideInvalidDataForValidate() + public function provideInvalidDataForValidate(): array { return [ [ diff --git a/tests/lib/FieldType/TimeTest.php b/tests/lib/FieldType/TimeTest.php index c7cf1c510d..615de5fdf9 100644 --- a/tests/lib/FieldType/TimeTest.php +++ b/tests/lib/FieldType/TimeTest.php @@ -9,7 +9,9 @@ use DateTime; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\FieldType\Time\Type; use Ibexa\Core\FieldType\Time\Type as Time; +use Ibexa\Core\FieldType\Time\Value; use Ibexa\Core\FieldType\Time\Value as TimeValue; /** @@ -29,7 +31,7 @@ class TimeTest extends FieldTypeTest * * @return \Ibexa\Core\FieldType\FieldType */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { $fieldType = new Time(); $fieldType->setTransformationProcessor($this->getTransformationProcessorMock()); @@ -42,7 +44,7 @@ protected function createFieldTypeUnderTest() * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return []; } @@ -52,7 +54,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return [ 'useSeconds' => [ @@ -69,12 +71,12 @@ protected function getSettingsSchemaExpectation() /** * Returns the empty value expected from the field type. */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new TimeValue(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -113,7 +115,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { $dateTime = new DateTime(); // change timezone to UTC (+00:00) to be able to calculate proper TimeValue @@ -191,7 +193,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -244,7 +246,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ @@ -284,7 +286,7 @@ public function provideInputForFromHash() * * @return array */ - public function provideValidFieldSettings() + public function provideValidFieldSettings(): array { return [ [ @@ -328,7 +330,7 @@ public function provideValidFieldSettings() * * @return array */ - public function provideInValidFieldSettings() + public function provideInValidFieldSettings(): array { return [ [ diff --git a/tests/lib/FieldType/Url/Gateway/DoctrineStorageTest.php b/tests/lib/FieldType/Url/Gateway/DoctrineStorageTest.php index d5a1db5a68..d353888e91 100644 --- a/tests/lib/FieldType/Url/Gateway/DoctrineStorageTest.php +++ b/tests/lib/FieldType/Url/Gateway/DoctrineStorageTest.php @@ -21,7 +21,7 @@ class DoctrineStorageTest extends TestCase /** * @covers \Ibexa\Core\FieldType\Url\UrlStorage\Gateway\DoctrineStorage::getIdUrlMap */ - public function testGetIdUrlMap() + public function testGetIdUrlMap(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urls.php'); @@ -41,7 +41,7 @@ public function testGetIdUrlMap() /** * @covers \Ibexa\Core\FieldType\Url\UrlStorage\Gateway\DoctrineStorage::getUrlIdMap */ - public function testGetUrlIdMap() + public function testGetUrlIdMap(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urls.php'); @@ -65,7 +65,7 @@ public function testGetUrlIdMap() /** * @covers \Ibexa\Core\FieldType\Url\UrlStorage\Gateway\DoctrineStorage::insertUrl */ - public function testInsertUrl() + public function testInsertUrl(): void { $gateway = $this->getStorageGateway(); @@ -111,7 +111,7 @@ public function testInsertUrl() /** * @covers \Ibexa\Core\FieldType\Url\UrlStorage\Gateway\DoctrineStorage::linkUrl */ - public function testLinkUrl() + public function testLinkUrl(): void { $gateway = $this->getStorageGateway(); @@ -148,7 +148,7 @@ public function testLinkUrl() /** * @covers \Ibexa\Core\FieldType\Url\UrlStorage\Gateway\DoctrineStorage::unlinkUrl */ - public function testUnlinkUrl() + public function testUnlinkUrl(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urls.php'); diff --git a/tests/lib/FieldType/Url/UrlStorageTest.php b/tests/lib/FieldType/Url/UrlStorageTest.php index 9d8c0c9857..a6d01df0ac 100644 --- a/tests/lib/FieldType/Url/UrlStorageTest.php +++ b/tests/lib/FieldType/Url/UrlStorageTest.php @@ -12,12 +12,13 @@ use Ibexa\Contracts\Core\Persistence\Content\FieldValue; use Ibexa\Contracts\Core\Persistence\Content\VersionInfo; use Ibexa\Core\FieldType\Url\UrlStorage; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; class UrlStorageTest extends TestCase { - public function testStoreFieldDataWithExistingUrl() + public function testStoreFieldDataWithExistingUrl(): void { $versionInfo = new VersionInfo(['versionNo' => 24]); $fieldValue = new FieldValue(['externalData' => 'http://ibexa.co']); @@ -51,7 +52,7 @@ public function testStoreFieldDataWithExistingUrl() self::assertEquals(12, $field->value->data['urlId']); } - public function testStoreFieldDataWithNewUrl() + public function testStoreFieldDataWithNewUrl(): void { $versionInfo = new VersionInfo(['versionNo' => 24]); $fieldValue = new FieldValue(['externalData' => 'http://ibexa.co']); @@ -91,7 +92,7 @@ public function testStoreFieldDataWithNewUrl() self::assertEquals(12, $field->value->data['urlId']); } - public function testStoreFieldDataWithEmptyUrl() + public function testStoreFieldDataWithEmptyUrl(): void { $versionInfo = new VersionInfo(['versionNo' => 24]); $fieldValue = new FieldValue(['externalData' => '']); @@ -121,7 +122,7 @@ public function testStoreFieldDataWithEmptyUrl() self::assertNull($field->value->data); } - public function testGetFieldData() + public function testGetFieldData(): void { $versionInfo = new VersionInfo(); $fieldValue = new FieldValue(['data' => ['urlId' => 12]]); @@ -140,7 +141,7 @@ public function testGetFieldData() self::assertEquals('http://ibexa.co', $field->value->externalData); } - public function testGetFieldDataNotFound() + public function testGetFieldDataNotFound(): void { $versionInfo = new VersionInfo(); $fieldValue = new FieldValue(['data' => ['urlId' => 12]]); @@ -165,7 +166,7 @@ public function testGetFieldDataNotFound() self::assertEquals('', $field->value->externalData); } - public function testGetFieldDataWithEmptyUrlId() + public function testGetFieldDataWithEmptyUrlId(): void { $versionInfo = new VersionInfo(); $fieldValue = new FieldValue(['data' => ['urlId' => null]]); @@ -187,7 +188,7 @@ public function testGetFieldDataWithEmptyUrlId() self::assertNull($field->value->externalData); } - public function testDeleteFieldData() + public function testDeleteFieldData(): void { $versionInfo = new VersionInfo(['versionNo' => 24]); $fieldIds = [12, 23, 34]; @@ -204,7 +205,7 @@ public function testDeleteFieldData() $storage->deleteFieldData($versionInfo, $fieldIds); } - public function testHasFieldData() + public function testHasFieldData(): void { $storage = $this->getPartlyMockedStorage($this->getGatewayMock()); @@ -216,7 +217,7 @@ public function testHasFieldData() * * @return \Ibexa\Core\FieldType\Url\UrlStorage|\PHPUnit\Framework\MockObject\MockObject */ - protected function getPartlyMockedStorage(StorageGatewayInterface $gateway) + protected function getPartlyMockedStorage(StorageGatewayInterface $gateway): MockObject { return $this->getMockBuilder(UrlStorage::class) ->setMethods(null) @@ -230,7 +231,7 @@ protected function getPartlyMockedStorage(StorageGatewayInterface $gateway) } /** @var \Psr\Log\LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */ - protected $loggerMock; + protected ?MockObject $loggerMock = null; /** * @return \Psr\Log\LoggerInterface|\PHPUnit\Framework\MockObject\MockObject @@ -247,7 +248,7 @@ protected function getLoggerMock() } /** @var \Ibexa\Core\FieldType\Url\UrlStorage\Gateway|\PHPUnit\Framework\MockObject\MockObject */ - protected $gatewayMock; + protected ?MockObject $gatewayMock = null; /** * @return \Ibexa\Core\FieldType\Url\UrlStorage\Gateway|\PHPUnit\Framework\MockObject\MockObject diff --git a/tests/lib/FieldType/UrlTest.php b/tests/lib/FieldType/UrlTest.php index 40de5967cd..8021af715d 100644 --- a/tests/lib/FieldType/UrlTest.php +++ b/tests/lib/FieldType/UrlTest.php @@ -8,7 +8,9 @@ namespace Ibexa\Tests\Core\FieldType; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\FieldType\Url\Type; use Ibexa\Core\FieldType\Url\Type as UrlType; +use Ibexa\Core\FieldType\Url\Value; use Ibexa\Core\FieldType\Url\Value as UrlValue; /** @@ -28,7 +30,7 @@ class UrlTest extends FieldTypeTest * * @return \Ibexa\Core\FieldType\FieldType */ - protected function createFieldTypeUnderTest() + protected function createFieldTypeUnderTest(): Type { $fieldType = new UrlType(); $fieldType->setTransformationProcessor($this->getTransformationProcessorMock()); @@ -41,7 +43,7 @@ protected function createFieldTypeUnderTest() * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return []; } @@ -51,7 +53,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return []; } @@ -59,12 +61,12 @@ protected function getSettingsSchemaExpectation() /** * Returns the empty value expected from the field type. */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new UrlValue(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -107,7 +109,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -160,7 +162,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { return [ [ @@ -219,7 +221,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ diff --git a/tests/lib/FieldType/UserTest.php b/tests/lib/FieldType/UserTest.php index eddebb1ef4..1737511d7d 100644 --- a/tests/lib/FieldType/UserTest.php +++ b/tests/lib/FieldType/UserTest.php @@ -16,6 +16,7 @@ use Ibexa\Core\Base\Exceptions\NotFoundException; use Ibexa\Core\FieldType\User\Type; use Ibexa\Core\FieldType\User\Type as UserType; +use Ibexa\Core\FieldType\User\Value; use Ibexa\Core\FieldType\User\Value as UserValue; use Ibexa\Core\FieldType\ValidationError; use Ibexa\Core\Persistence\Cache\UserHandler; @@ -61,7 +62,7 @@ protected function createFieldTypeUnderTest(): UserType * * @return array */ - protected function getValidatorConfigurationSchemaExpectation() + protected function getValidatorConfigurationSchemaExpectation(): array { return (new UserValidatorConfigurationSchemaProvider()) ->getExpectedValidatorConfigurationSchema(); @@ -72,7 +73,7 @@ protected function getValidatorConfigurationSchemaExpectation() * * @return array */ - protected function getSettingsSchemaExpectation() + protected function getSettingsSchemaExpectation(): array { return [ UserType::PASSWORD_TTL_SETTING => [ @@ -97,12 +98,12 @@ protected function getSettingsSchemaExpectation() /** * Returns the empty value expected from the field type. */ - protected function getEmptyValueExpectation() + protected function getEmptyValueExpectation(): Value { return new UserValue(); } - public function provideInvalidInputForAcceptValue() + public function provideInvalidInputForAcceptValue(): array { return [ [ @@ -141,7 +142,7 @@ public function provideInvalidInputForAcceptValue() * * @return array */ - public function provideValidInputForAcceptValue() + public function provideValidInputForAcceptValue(): array { return [ [ @@ -224,7 +225,7 @@ public function provideValidInputForAcceptValue() * * @return array */ - public function provideInputForToHash() + public function provideInputForToHash(): array { $passwordUpdatedAt = new DateTimeImmutable(); @@ -292,7 +293,7 @@ public function provideInputForToHash() * * @return array */ - public function provideInputForFromHash() + public function provideInputForFromHash(): array { return [ [ @@ -688,7 +689,7 @@ public function providerForTestValidate(): array 'email' ), ], - static function (InvocationMocker $loadByLoginInvocationMocker) { + static function (InvocationMocker $loadByLoginInvocationMocker): void { $loadByLoginInvocationMocker->willThrowException( new NotFoundException('user', 'user') ); @@ -716,7 +717,7 @@ static function (InvocationMocker $loadByLoginInvocationMocker) { 'username' ), ], - function (InvocationMocker $loadByLoginInvocationMocker) { + function (InvocationMocker $loadByLoginInvocationMocker): void { $loadByLoginInvocationMocker->willReturn( $this->createMock(UserValue::class) ); diff --git a/tests/lib/Helper/ContentInfoLocationLoader/SudoMainLocationLoaderTest.php b/tests/lib/Helper/ContentInfoLocationLoader/SudoMainLocationLoaderTest.php index e7d07f3481..8a830b4786 100644 --- a/tests/lib/Helper/ContentInfoLocationLoader/SudoMainLocationLoaderTest.php +++ b/tests/lib/Helper/ContentInfoLocationLoader/SudoMainLocationLoaderTest.php @@ -18,19 +18,20 @@ use Ibexa\Core\Repository\Permission\PermissionResolver; use Ibexa\Core\Repository\Repository; use Ibexa\Core\Repository\Values\Content\Location; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class SudoMainLocationLoaderTest extends TestCase { /** @var \Ibexa\Core\Helper\ContentInfoLocationLoader\SudoMainLocationLoader */ - private $loader; + private SudoMainLocationLoader $loader; protected function setUp(): void { $this->loader = new SudoMainLocationLoader($this->getRepositoryMock()); } - public function testLoadLocationNoMainLocation() + public function testLoadLocationNoMainLocation(): void { $this->expectException(NotFoundException::class); @@ -43,7 +44,7 @@ public function testLoadLocationNoMainLocation() $this->loader->loadLocation($contentInfo); } - public function testLoadLocation() + public function testLoadLocation(): void { $contentInfo = new ContentInfo(['mainLocationId' => 42]); $location = new Location(); @@ -67,7 +68,7 @@ public function testLoadLocation() self::assertSame($location, $this->loader->loadLocation($contentInfo)); } - public function testLoadLocationError() + public function testLoadLocationError(): void { $this->expectException(NotFoundException::class); @@ -139,7 +140,7 @@ private function getLocationServiceMock() /** * @return \Ibexa\Core\Repository\Permission\PermissionResolver|\PHPUnit\Framework\MockObject\MockObject */ - private function getPermissionResolverMock() + private function getPermissionResolverMock(): MockObject { $configResolverMock = $this->createMock(ConfigResolverInterface::class); $configResolverMock diff --git a/tests/lib/Helper/ContentPreviewHelperTest.php b/tests/lib/Helper/ContentPreviewHelperTest.php index 59afe15726..14f630f877 100644 --- a/tests/lib/Helper/ContentPreviewHelperTest.php +++ b/tests/lib/Helper/ContentPreviewHelperTest.php @@ -14,19 +14,20 @@ use Ibexa\Core\MVC\Symfony\MVCEvents; use Ibexa\Core\MVC\Symfony\SiteAccess; use Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessRouterInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcherInterface; class ContentPreviewHelperTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $eventDispatcher; + private MockObject $eventDispatcher; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $siteAccessRouter; + private MockObject $siteAccessRouter; /** @var \Ibexa\Core\Helper\ContentPreviewHelper */ - private $previewHelper; + private ContentPreviewHelper $previewHelper; protected function setUp(): void { @@ -36,7 +37,7 @@ protected function setUp(): void $this->previewHelper = new ContentPreviewHelper($this->eventDispatcher, $this->siteAccessRouter); } - public function testChangeConfigScope() + public function testChangeConfigScope(): void { $newSiteAccessName = 'test'; $newSiteAccess = new SiteAccess($newSiteAccessName); @@ -61,7 +62,7 @@ public function testChangeConfigScope() ); } - public function testRestoreConfigScope() + public function testRestoreConfigScope(): void { $originalSiteAccess = new SiteAccess('foo', 'bar'); $event = new ScopeChangeEvent($originalSiteAccess); @@ -77,7 +78,7 @@ public function testRestoreConfigScope() ); } - public function testPreviewActive() + public function testPreviewActive(): void { $originalSiteAccess = new SiteAccess('foo', 'bar'); $this->previewHelper->setSiteAccess($originalSiteAccess); @@ -91,7 +92,7 @@ public function testPreviewActive() self::assertNotSame($originalSiteAccess, $this->previewHelper->getOriginalSiteAccess()); } - public function testPreviewedContent() + public function testPreviewedContent(): void { self::assertNull($this->previewHelper->getPreviewedContent()); $content = $this->createMock(APIContent::class); @@ -99,7 +100,7 @@ public function testPreviewedContent() self::assertSame($content, $this->previewHelper->getPreviewedContent()); } - public function testPreviewedLocation() + public function testPreviewedLocation(): void { self::assertNull($this->previewHelper->getPreviewedLocation()); $location = $this->createMock(APILocation::class); diff --git a/tests/lib/Helper/FieldHelperTest.php b/tests/lib/Helper/FieldHelperTest.php index 02de654da1..7794833f27 100644 --- a/tests/lib/Helper/FieldHelperTest.php +++ b/tests/lib/Helper/FieldHelperTest.php @@ -18,18 +18,19 @@ use Ibexa\Core\Helper\FieldHelper; use Ibexa\Core\Helper\TranslationHelper; use Ibexa\Core\Repository\Values\ContentType\FieldType; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class FieldHelperTest extends TestCase { /** @var \Ibexa\Core\Helper\FieldHelper */ - private $fieldHelper; + private FieldHelper $fieldHelper; /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService|\PHPUnit\Framework\MockObject\MockObject */ - private $fieldTypeServiceMock; + private MockObject $fieldTypeServiceMock; /** @var \Ibexa\Core\Helper\TranslationHelper|\PHPUnit\Framework\MockObject\MockObject */ - private $translationHelper; + private MockObject $translationHelper; protected function setUp(): void { @@ -39,7 +40,7 @@ protected function setUp(): void $this->fieldHelper = new FieldHelper($this->translationHelper, $this->fieldTypeServiceMock); } - public function testIsFieldEmpty() + public function testIsFieldEmpty(): void { $contentTypeId = 123; $contentInfo = new ContentInfo(['contentTypeId' => $contentTypeId]); @@ -85,7 +86,7 @@ public function testIsFieldEmpty() self::assertTrue($this->fieldHelper->isFieldEmpty($content, $fieldDefIdentifier)); } - public function testIsFieldNotEmpty() + public function testIsFieldNotEmpty(): void { $contentTypeId = 123; $contentInfo = new ContentInfo(['contentTypeId' => $contentTypeId]); diff --git a/tests/lib/Helper/FieldsGroups/ArrayTranslatorFieldsGroupsListTest.php b/tests/lib/Helper/FieldsGroups/ArrayTranslatorFieldsGroupsListTest.php index ad5e3f82db..45aa3b5523 100644 --- a/tests/lib/Helper/FieldsGroups/ArrayTranslatorFieldsGroupsListTest.php +++ b/tests/lib/Helper/FieldsGroups/ArrayTranslatorFieldsGroupsListTest.php @@ -27,7 +27,7 @@ class ArrayTranslatorFieldsGroupsListTest extends TestCase private const DEFAULT_GROUP_ID = self::SECOND_GROUP_ID; private const DEFAULT_GROUP_NAME = self::SECOND_GROUP_NAME; - private $translatorMock; + private ?MockObject $translatorMock = null; public function testTranslatesGroups(): void { diff --git a/tests/lib/Helper/PreviewLocationProviderTest.php b/tests/lib/Helper/PreviewLocationProviderTest.php index 2db4957a3e..30c18fddd2 100644 --- a/tests/lib/Helper/PreviewLocationProviderTest.php +++ b/tests/lib/Helper/PreviewLocationProviderTest.php @@ -15,18 +15,19 @@ use Ibexa\Core\Repository\Values\Content\Content; use Ibexa\Core\Repository\Values\Content\Location; use Ibexa\Core\Repository\Values\Content\VersionInfo; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class PreviewLocationProviderTest extends TestCase { /** @var \Ibexa\Contracts\Core\Repository\LocationService|\PHPUnit\Framework\MockObject\MockObject */ - private $locationService; + private MockObject $locationService; /** @var \Ibexa\Contracts\Core\Persistence\Content\Location\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $locationHandler; + private MockObject $locationHandler; /** @var \Ibexa\Core\Helper\PreviewLocationProvider */ - private $provider; + private PreviewLocationProvider $provider; protected function setUp(): void { @@ -37,7 +38,7 @@ protected function setUp(): void $this->provider = new PreviewLocationProvider($this->locationService, $this->locationHandler); } - public function testGetPreviewLocationDraft() + public function testGetPreviewLocationDraft(): void { $contentId = 123; $parentLocationId = 456; @@ -60,7 +61,7 @@ public function testGetPreviewLocationDraft() self::assertEquals($parentLocationId, $location->parentLocationId); } - public function testGetPreviewLocation() + public function testGetPreviewLocation(): void { $contentId = 123; $locationId = 456; @@ -84,7 +85,7 @@ public function testGetPreviewLocation() self::assertSame($content, $location->getContent()); } - public function testGetPreviewLocationNoLocation() + public function testGetPreviewLocationNoLocation(): void { $contentId = 123; $content = $this->getContentMock($contentId); diff --git a/tests/lib/Helper/TranslationHelperTest.php b/tests/lib/Helper/TranslationHelperTest.php index 54bbf4f1a6..a44b1fa213 100644 --- a/tests/lib/Helper/TranslationHelperTest.php +++ b/tests/lib/Helper/TranslationHelperTest.php @@ -14,30 +14,31 @@ use Ibexa\Core\Helper\TranslationHelper; use Ibexa\Core\Repository\Values\Content\Content; use Ibexa\Core\Repository\Values\Content\VersionInfo; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; class TranslationHelperTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private MockObject $configResolver; /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private MockObject $contentService; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $logger; + private MockObject $logger; /** @var \Ibexa\Core\Helper\TranslationHelper */ - private $translationHelper; + private TranslationHelper $translationHelper; - private $siteAccessByLanguages; + private array $siteAccessByLanguages; /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Field[] */ - private $translatedFields; + private array $translatedFields; /** @var string[] */ - private $translatedNames; + private array $translatedNames; protected function setUp(): void { @@ -74,7 +75,7 @@ protected function setUp(): void /** * @return \Ibexa\Core\Repository\Values\Content\Content */ - private function generateContent() + private function generateContent(): Content { return new Content( [ @@ -87,7 +88,7 @@ private function generateContent() /** * @return \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ - private function generateVersionInfo() + private function generateVersionInfo(): VersionInfo { return new VersionInfo( [ @@ -103,7 +104,7 @@ private function generateVersionInfo() * @param array $prioritizedLanguages * @param string $expectedLocale */ - public function testGetTranslatedName(array $prioritizedLanguages, $expectedLocale) + public function testGetTranslatedName(array $prioritizedLanguages, string $expectedLocale): void { $content = $this->generateContent(); $this->configResolver @@ -121,7 +122,7 @@ public function testGetTranslatedName(array $prioritizedLanguages, $expectedLoca * @param array $prioritizedLanguages * @param string $expectedLocale */ - public function testGetTranslatedNameByContentInfo(array $prioritizedLanguages, $expectedLocale) + public function testGetTranslatedNameByContentInfo(array $prioritizedLanguages, string $expectedLocale): void { $versionInfo = $this->generateVersionInfo(); $contentInfo = new ContentInfo(['id' => 123]); @@ -140,7 +141,7 @@ public function testGetTranslatedNameByContentInfo(array $prioritizedLanguages, self::assertSame($this->translatedNames[$expectedLocale], $this->translationHelper->getTranslatedContentNameByContentInfo($contentInfo)); } - public function getTranslatedNameProvider() + public function getTranslatedNameProvider(): array { return [ [['fre-FR', 'eng-GB'], 'fre-FR'], @@ -151,7 +152,7 @@ public function getTranslatedNameProvider() ]; } - public function testGetTranslatedNameByContentInfoForcedLanguage() + public function testGetTranslatedNameByContentInfoForcedLanguage(): void { $versionInfo = $this->generateVersionInfo(); $contentInfo = new ContentInfo(['id' => 123]); @@ -169,7 +170,7 @@ public function testGetTranslatedNameByContentInfoForcedLanguage() self::assertSame('Mon nom en français', $this->translationHelper->getTranslatedContentNameByContentInfo($contentInfo, 'eng-US')); } - public function testGetTranslatedNameByContentInfoForcedLanguageMainLanguage() + public function testGetTranslatedNameByContentInfoForcedLanguageMainLanguage(): void { $name = 'Name in main language'; $mainLanguage = 'eng-GB'; @@ -194,7 +195,7 @@ public function testGetTranslatedNameByContentInfoForcedLanguageMainLanguage() ); } - public function testGetTranslatedNameForcedLanguage() + public function testGetTranslatedNameForcedLanguage(): void { $content = $this->generateContent(); $this->configResolver @@ -211,7 +212,7 @@ public function testGetTranslatedNameForcedLanguage() * @param array $prioritizedLanguages * @param string $expectedLocale */ - public function getTranslatedField(array $prioritizedLanguages, $expectedLocale) + public function getTranslatedField(array $prioritizedLanguages, string $expectedLocale): void { $content = $this->generateContent(); $this->configResolver @@ -223,7 +224,7 @@ public function getTranslatedField(array $prioritizedLanguages, $expectedLocale) self::assertSame($this->translatedFields[$expectedLocale], $this->translationHelper->getTranslatedField($content, 'test')); } - public function getTranslatedFieldProvider() + public function getTranslatedFieldProvider(): array { return [ [['fre-FR', 'eng-GB'], 'fre-FR'], @@ -234,7 +235,7 @@ public function getTranslatedFieldProvider() ]; } - public function testGetTranslationSiteAccessUnkownLanguage() + public function testGetTranslationSiteAccessUnkownLanguage(): void { $this->configResolver ->expects(self::exactly(2)) @@ -258,7 +259,7 @@ public function testGetTranslationSiteAccessUnkownLanguage() /** * @dataProvider getTranslationSiteAccessProvider */ - public function testGetTranslationSiteAccess($language, array $translationSiteAccesses, array $relatedSiteAccesses, $expectedResult) + public function testGetTranslationSiteAccess(string $language, array $translationSiteAccesses, array $relatedSiteAccesses, ?string $expectedResult): void { $this->configResolver ->expects(self::exactly(2)) @@ -275,7 +276,7 @@ public function testGetTranslationSiteAccess($language, array $translationSiteAc self::assertSame($expectedResult, $this->translationHelper->getTranslationSiteAccess($language)); } - public function getTranslationSiteAccessProvider() + public function getTranslationSiteAccessProvider(): array { return [ ['eng-GB', ['fre', 'eng', 'heb'], ['esl', 'fre', 'eng', 'heb'], 'eng'], @@ -293,7 +294,7 @@ public function getTranslationSiteAccessProvider() ]; } - public function testGetAvailableLanguagesWithTranslationSiteAccesses() + public function testGetAvailableLanguagesWithTranslationSiteAccesses(): void { $this->configResolver ->expects(self::any()) @@ -314,7 +315,7 @@ public function testGetAvailableLanguagesWithTranslationSiteAccesses() self::assertSame($expectedLanguages, $this->translationHelper->getAvailableLanguages()); } - public function testGetAvailableLanguagesWithoutTranslationSiteAccesses() + public function testGetAvailableLanguagesWithoutTranslationSiteAccesses(): void { $this->configResolver ->expects(self::any()) diff --git a/tests/lib/IO/ConfigScopeChangeAwareIOServiceTest.php b/tests/lib/IO/ConfigScopeChangeAwareIOServiceTest.php index 8b3e0b1fb6..781b4a4b3b 100644 --- a/tests/lib/IO/ConfigScopeChangeAwareIOServiceTest.php +++ b/tests/lib/IO/ConfigScopeChangeAwareIOServiceTest.php @@ -14,6 +14,7 @@ use Ibexa\Core\IO\Values\BinaryFile; use Ibexa\Core\IO\Values\BinaryFileCreateStruct; use Ibexa\Core\MVC\Symfony\Event\ScopeChangeEvent; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; final class ConfigScopeChangeAwareIOServiceTest extends TestCase @@ -25,10 +26,10 @@ final class ConfigScopeChangeAwareIOServiceTest extends TestCase protected $ioService; /** @var \Ibexa\Core\IO\ConfigScopeChangeAwareIOService|\PHPUnit\Framework\MockObject\MockObject */ - protected $innerIOService; + protected MockObject $innerIOService; /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface|\PHPUnit\Framework\MockObject\MockObject */ - protected $configResolver; + protected MockObject $configResolver; protected function setUp(): void { diff --git a/tests/lib/IO/FilePathNormalizer/FlysystemTest.php b/tests/lib/IO/FilePathNormalizer/FlysystemTest.php index 35e933257c..ad8698e538 100644 --- a/tests/lib/IO/FilePathNormalizer/FlysystemTest.php +++ b/tests/lib/IO/FilePathNormalizer/FlysystemTest.php @@ -11,15 +11,16 @@ use Ibexa\Core\IO\FilePathNormalizer\Flysystem; use Ibexa\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter; use League\Flysystem\WhitespacePathNormalizer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; final class FlysystemTest extends TestCase { /** @var \Ibexa\Core\IO\FilePathNormalizer\Flysystem */ - private $filePathNormalizer; + private Flysystem $filePathNormalizer; /** @var \Ibexa\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter|\PHPUnit\Framework\MockObject\MockObject */ - private $slugConverter; + private MockObject $slugConverter; public function setUp(): void { diff --git a/tests/lib/IO/Flysystem/Adapter/DynamicPathFilesystemAdapterDecoratorTest.php b/tests/lib/IO/Flysystem/Adapter/DynamicPathFilesystemAdapterDecoratorTest.php index 98e0aad30f..bfdd74e17e 100644 --- a/tests/lib/IO/Flysystem/Adapter/DynamicPathFilesystemAdapterDecoratorTest.php +++ b/tests/lib/IO/Flysystem/Adapter/DynamicPathFilesystemAdapterDecoratorTest.php @@ -376,7 +376,7 @@ private function createFileAttributesPathMock(string $path): MockObject /** * @param string|int $returnValue */ - private function createFileAttributesMock(string $methodName, $returnValue): MockObject + private function createFileAttributesMock(string $methodName, int|string $returnValue): MockObject { $fileAttributesMock = $this->createMock(FileAttributes::class); $fileAttributesMock diff --git a/tests/lib/IO/IOBinarydataHandler/FlysystemTest.php b/tests/lib/IO/IOBinarydataHandler/FlysystemTest.php index e09f9f9bbe..a29316c89b 100644 --- a/tests/lib/IO/IOBinarydataHandler/FlysystemTest.php +++ b/tests/lib/IO/IOBinarydataHandler/FlysystemTest.php @@ -59,7 +59,7 @@ public function testCreate(): void $this->handler->create($spiBinaryFileCreateStruct); } - public function testDelete() + public function testDelete(): void { $this->filesystem ->expects(self::once()) diff --git a/tests/lib/IO/IOMetadataHandler/FlysystemTest.php b/tests/lib/IO/IOMetadataHandler/FlysystemTest.php index 88ae2c8324..e607f2d634 100644 --- a/tests/lib/IO/IOMetadataHandler/FlysystemTest.php +++ b/tests/lib/IO/IOMetadataHandler/FlysystemTest.php @@ -12,20 +12,22 @@ use Ibexa\Contracts\Core\IO\BinaryFileCreateStruct as SPIBinaryFileCreateStruct; use Ibexa\Core\IO\Exception\BinaryFileNotFoundException; use Ibexa\Core\IO\IOMetadataHandler\Flysystem; +use League\Flysystem\FilesystemOperator; use League\Flysystem\UnableToRetrieveMetadata; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class FlysystemTest extends TestCase { /** @var \Ibexa\Core\IO\IOMetadataHandler|\PHPUnit\Framework\MockObject\MockObject */ - private $handler; + private Flysystem $handler; /** @var \League\Flysystem\FilesystemOperator|\PHPUnit\Framework\MockObject\MockObject */ - private $filesystem; + private MockObject $filesystem; protected function setUp(): void { - $this->filesystem = $this->createMock(\League\Flysystem\FilesystemOperator::class); + $this->filesystem = $this->createMock(FilesystemOperator::class); $this->handler = new Flysystem($this->filesystem); } @@ -63,7 +65,7 @@ public function testCreate(): void self::assertEquals($expectedSpiBinaryFile, $spiBinaryFile); } - public function testDelete() + public function testDelete(): void { $this->filesystem->expects(self::never())->method('delete'); $this->handler->delete('prefix/my/file.png'); diff --git a/tests/lib/IO/IOMetadataHandler/LegacyDFSClusterTest.php b/tests/lib/IO/IOMetadataHandler/LegacyDFSClusterTest.php index e32feed3ef..9951407284 100644 --- a/tests/lib/IO/IOMetadataHandler/LegacyDFSClusterTest.php +++ b/tests/lib/IO/IOMetadataHandler/LegacyDFSClusterTest.php @@ -18,21 +18,22 @@ use Ibexa\Core\IO\Exception\BinaryFileNotFoundException; use Ibexa\Core\IO\IOMetadataHandler\LegacyDFSCluster; use Ibexa\Core\IO\UrlDecorator; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class LegacyDFSClusterTest extends TestCase { /** @var \Ibexa\Core\IO\IOMetadataHandler&\PHPUnit\Framework\MockObject\MockObject */ - private $handler; + private LegacyDFSCluster $handler; /** @var \Doctrine\DBAL\Connection&\PHPUnit\Framework\MockObject\MockObject */ - private $dbalMock; + private MockObject $dbalMock; /** @var \Doctrine\DBAL\Query\QueryBuilder&\PHPUnit\Framework\MockObject\MockObject */ - private $qbMock; + private MockObject $qbMock; /** @var \Ibexa\Core\IO\UrlDecorator&\PHPUnit\Framework\MockObject\MockObject */ - private $urlDecoratorMock; + private MockObject $urlDecoratorMock; protected function setUp(): void { @@ -66,7 +67,7 @@ public function providerCreate(): iterable /** * @dataProvider providerCreate */ - public function testCreate(string $id, string $mimeType, int $size, \DateTime $mtime, \DateTime $mtimeExpected): void + public function testCreate(string $id, string $mimeType, int $size, DateTime $mtime, DateTime $mtimeExpected): void { $this->dbalMock ->expects(self::once()) @@ -200,7 +201,7 @@ public function testDeletedirectory(): void /** * @return \PHPUnit\Framework\MockObject\MockObject */ - protected function createDbalStatementMock() + protected function createDbalStatementMock(): MockObject { return $this->createMock(Statement::class); } diff --git a/tests/lib/IO/MimeTypeDetector/FileInfoTest.php b/tests/lib/IO/MimeTypeDetector/FileInfoTest.php index 8bf1beac7b..c91fa82b53 100644 --- a/tests/lib/IO/MimeTypeDetector/FileInfoTest.php +++ b/tests/lib/IO/MimeTypeDetector/FileInfoTest.php @@ -25,7 +25,7 @@ protected function getFixture(): string return __DIR__ . '/../../_fixtures/squirrel-developers.jpg'; } - public function testGetFromPath() + public function testGetFromPath(): void { self::assertEquals( $this->mimeTypeDetector->getFromPath( @@ -35,7 +35,7 @@ public function testGetFromPath() ); } - public function testGetFromBuffer() + public function testGetFromBuffer(): void { self::assertEquals( $this->mimeTypeDetector->getFromBuffer( diff --git a/tests/lib/IO/UrlDecorator/PrefixTest.php b/tests/lib/IO/UrlDecorator/PrefixTest.php index 90b32f4561..f23bede3dd 100644 --- a/tests/lib/IO/UrlDecorator/PrefixTest.php +++ b/tests/lib/IO/UrlDecorator/PrefixTest.php @@ -18,7 +18,7 @@ class PrefixTest extends TestCase /** * @dataProvider provideData */ - public function testDecorate($url, $prefix, $decoratedUrl) + public function testDecorate(string $url, string $prefix, string $decoratedUrl): void { $decorator = $this->buildDecorator($prefix); @@ -31,7 +31,7 @@ public function testDecorate($url, $prefix, $decoratedUrl) /** * @dataProvider provideData */ - public function testUndecorate($url, $prefix, $decoratedUrl) + public function testUndecorate(string $url, string $prefix, string $decoratedUrl): void { $decorator = $this->buildDecorator($prefix); @@ -51,7 +51,7 @@ protected function buildDecorator(string $prefix): UrlDecorator return new Prefix($ioConfigResolverMock); } - public function provideData() + public function provideData(): array { return [ [ diff --git a/tests/lib/IO/UrlRedecoratorTest.php b/tests/lib/IO/UrlRedecoratorTest.php index 45ede2b84b..8213190490 100644 --- a/tests/lib/IO/UrlRedecoratorTest.php +++ b/tests/lib/IO/UrlRedecoratorTest.php @@ -9,18 +9,19 @@ use Ibexa\Core\IO\UrlDecorator; use Ibexa\Core\IO\UrlRedecorator; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class UrlRedecoratorTest extends TestCase { /** @var \Ibexa\Core\IO\UrlRedecorator|\PHPUnit\Framework\MockObject\MockObject */ - private $redecorator; + private UrlRedecorator $redecorator; /** @var \Ibexa\Core\IO\UrlDecorator|\PHPUnit\Framework\MockObject\MockObject */ - private $sourceDecoratorMock; + private ?MockObject $sourceDecoratorMock = null; /** @var \Ibexa\Core\IO\UrlDecorator|\PHPUnit\Framework\MockObject\MockObject */ - private $targetDecoratorMock; + private ?MockObject $targetDecoratorMock = null; protected function setUp(): void { @@ -30,7 +31,7 @@ protected function setUp(): void ); } - public function testRedecorateFromSource() + public function testRedecorateFromSource(): void { $this->sourceDecoratorMock ->expects(self::once()) @@ -50,7 +51,7 @@ public function testRedecorateFromSource() ); } - public function testRedecorateFromTarget() + public function testRedecorateFromTarget(): void { $this->targetDecoratorMock ->expects(self::once()) diff --git a/tests/lib/Limitation/Base.php b/tests/lib/Limitation/Base.php index be8b5d3153..9f1ec7a8dc 100644 --- a/tests/lib/Limitation/Base.php +++ b/tests/lib/Limitation/Base.php @@ -9,15 +9,16 @@ use Ibexa\Contracts\Core\Persistence\Handler as SPIHandler; use Ibexa\Contracts\Core\Repository\Values\User\User as APIUser; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; abstract class Base extends TestCase { /** @var \Ibexa\Contracts\Core\Persistence\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $persistenceHandlerMock; + private ?MockObject $persistenceHandlerMock = null; /** @var \Ibexa\Contracts\Core\Repository\Values\User\User|\PHPUnit\Framework\MockObject\MockObject */ - private $userMock; + private ?MockObject $userMock = null; /** * @param array $mockMethods For specifying the methods to mock, all by default diff --git a/tests/lib/Limitation/BlockingLimitationTypeTest.php b/tests/lib/Limitation/BlockingLimitationTypeTest.php index fedcabed5b..1004c1ed13 100644 --- a/tests/lib/Limitation/BlockingLimitationTypeTest.php +++ b/tests/lib/Limitation/BlockingLimitationTypeTest.php @@ -27,7 +27,7 @@ class BlockingLimitationTypeTest extends Base /** * @return \Ibexa\Core\Limitation\BlockingLimitationType */ - public function testConstruct() + public function testConstruct(): BlockingLimitationType { return new BlockingLimitationType('Test'); } @@ -35,7 +35,7 @@ public function testConstruct() /** * @return array */ - public function providerForTestAcceptValue() + public function providerForTestAcceptValue(): array { return [ [new BlockingLimitation('Test', [])], @@ -51,7 +51,7 @@ public function providerForTestAcceptValue() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\BlockingLimitation $limitation * @param \Ibexa\Core\Limitation\BlockingLimitationType $limitationType */ - public function testAcceptValue(BlockingLimitation $limitation, BlockingLimitationType $limitationType) + public function testAcceptValue(BlockingLimitation $limitation, BlockingLimitationType $limitationType): void { $limitationType->acceptValue($limitation); } @@ -59,7 +59,7 @@ public function testAcceptValue(BlockingLimitation $limitation, BlockingLimitati /** * @return array */ - public function providerForTestAcceptValueException() + public function providerForTestAcceptValueException(): array { return [ [new ObjectStateLimitation()], @@ -74,7 +74,7 @@ public function providerForTestAcceptValueException() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation * @param \Ibexa\Core\Limitation\BlockingLimitationType $limitationType */ - public function testAcceptValueException(Limitation $limitation, BlockingLimitationType $limitationType) + public function testAcceptValueException(Limitation $limitation, BlockingLimitationType $limitationType): void { $this->expectException(InvalidArgumentException::class); @@ -84,7 +84,7 @@ public function testAcceptValueException(Limitation $limitation, BlockingLimitat /** * @return array */ - public function providerForTestValidatePass() + public function providerForTestValidatePass(): array { return [ [new BlockingLimitation('Test', ['limitationValues' => ['ezjscore::call']])], @@ -97,7 +97,7 @@ public function providerForTestValidatePass() * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\BlockingLimitation $limitation */ - public function testValidatePass(BlockingLimitation $limitation) + public function testValidatePass(BlockingLimitation $limitation): void { // Need to create inline instead of depending on testConstruct() to get correct mock instance $limitationType = $this->testConstruct(); @@ -109,7 +109,7 @@ public function testValidatePass(BlockingLimitation $limitation) /** * @return array */ - public function providerForTestValidateError() + public function providerForTestValidateError(): array { return [ [new BlockingLimitation('Test', []), 1], @@ -124,7 +124,7 @@ public function providerForTestValidateError() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\BlockingLimitation $limitation * @param int $errorCount */ - public function testValidateError(BlockingLimitation $limitation, $errorCount) + public function testValidateError(BlockingLimitation $limitation, int $errorCount): void { $this->getPersistenceMock() ->expects(self::never()) @@ -142,7 +142,7 @@ public function testValidateError(BlockingLimitation $limitation, $errorCount) * * @param \Ibexa\Core\Limitation\BlockingLimitationType $limitationType */ - public function testBuildValue(BlockingLimitationType $limitationType) + public function testBuildValue(BlockingLimitationType $limitationType): void { $expected = ['test', 'test' => 9]; $value = $limitationType->buildValue($expected); @@ -155,7 +155,7 @@ public function testBuildValue(BlockingLimitationType $limitationType) /** * @return array */ - public function providerForTestEvaluate() + public function providerForTestEvaluate(): array { return [ // ContentInfo, no access @@ -198,7 +198,7 @@ public function testEvaluate( BlockingLimitation $limitation, ValueObject $object, array $targets - ) { + ): void { // Need to create inline instead of depending on testConstruct() to get correct mock instance $limitationType = $this->testConstruct(); @@ -225,7 +225,7 @@ public function testEvaluate( /** * @return array */ - public function providerForTestEvaluateInvalidArgument() + public function providerForTestEvaluateInvalidArgument(): array { return [ // invalid limitation @@ -244,7 +244,7 @@ public function testEvaluateInvalidArgument( Limitation $limitation, ValueObject $object, array $targets - ) { + ): void { $this->expectException(InvalidArgumentException::class); // Need to create inline instead of depending on testConstruct() to get correct mock instance @@ -274,7 +274,7 @@ public function testEvaluateInvalidArgument( * * @param \Ibexa\Core\Limitation\BlockingLimitationType $limitationType */ - public function testGetCriterion(BlockingLimitationType $limitationType) + public function testGetCriterion(BlockingLimitationType $limitationType): void { $criterion = $limitationType->getCriterion( new BlockingLimitation('Test', []), @@ -291,7 +291,7 @@ public function testGetCriterion(BlockingLimitationType $limitationType) * * @param \Ibexa\Core\Limitation\BlockingLimitationType $limitationType */ - public function testValueSchema(BlockingLimitationType $limitationType) + public function testValueSchema(BlockingLimitationType $limitationType): void { $this->expectException(NotImplementedException::class); diff --git a/tests/lib/Limitation/ContentTypeLimitationTypeTest.php b/tests/lib/Limitation/ContentTypeLimitationTypeTest.php index 6fb780eff5..74c847a0ec 100644 --- a/tests/lib/Limitation/ContentTypeLimitationTypeTest.php +++ b/tests/lib/Limitation/ContentTypeLimitationTypeTest.php @@ -24,6 +24,7 @@ use Ibexa\Core\Limitation\ContentTypeLimitationType; use Ibexa\Core\Repository\Values\Content\ContentCreateStruct; use Ibexa\Core\Repository\Values\Content\Location; +use PHPUnit\Framework\MockObject\MockObject; /** * Test Case for LimitationType. @@ -31,7 +32,7 @@ class ContentTypeLimitationTypeTest extends Base { /** @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $contentTypeHandlerMock; + private MockObject $contentTypeHandlerMock; /** * Setup Location Handler mock. @@ -54,7 +55,7 @@ protected function tearDown(): void /** * @return \Ibexa\Core\Limitation\ContentTypeLimitationType */ - public function testConstruct() + public function testConstruct(): ContentTypeLimitationType { return new ContentTypeLimitationType($this->getPersistenceMock()); } @@ -62,7 +63,7 @@ public function testConstruct() /** * @return array */ - public function providerForTestAcceptValue() + public function providerForTestAcceptValue(): array { return [ [new ContentTypeLimitation()], @@ -79,7 +80,7 @@ public function providerForTestAcceptValue() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\ContentTypeLimitation $limitation * @param \Ibexa\Core\Limitation\ContentTypeLimitationType $limitationType */ - public function testAcceptValue(ContentTypeLimitation $limitation, ContentTypeLimitationType $limitationType) + public function testAcceptValue(ContentTypeLimitation $limitation, ContentTypeLimitationType $limitationType): void { $limitationType->acceptValue($limitation); } @@ -87,7 +88,7 @@ public function testAcceptValue(ContentTypeLimitation $limitation, ContentTypeLi /** * @return array */ - public function providerForTestAcceptValueException() + public function providerForTestAcceptValueException(): array { return [ [new ObjectStateLimitation()], @@ -103,7 +104,7 @@ public function providerForTestAcceptValueException() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation * @param \Ibexa\Core\Limitation\ContentTypeLimitationType $limitationType */ - public function testAcceptValueException(Limitation $limitation, ContentTypeLimitationType $limitationType) + public function testAcceptValueException(Limitation $limitation, ContentTypeLimitationType $limitationType): void { $this->expectException(InvalidArgumentException::class); @@ -113,7 +114,7 @@ public function testAcceptValueException(Limitation $limitation, ContentTypeLimi /** * @return array */ - public function providerForTestValidatePass() + public function providerForTestValidatePass(): array { return [ [new ContentTypeLimitation()], @@ -127,7 +128,7 @@ public function providerForTestValidatePass() * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\ContentTypeLimitation $limitation */ - public function testValidatePass(ContentTypeLimitation $limitation) + public function testValidatePass(ContentTypeLimitation $limitation): void { if (!empty($limitation->limitationValues)) { $this->getPersistenceMock() @@ -153,7 +154,7 @@ public function testValidatePass(ContentTypeLimitation $limitation) /** * @return array */ - public function providerForTestValidateError() + public function providerForTestValidateError(): array { return [ [new ContentTypeLimitation(), 0], @@ -168,7 +169,7 @@ public function providerForTestValidateError() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\ContentTypeLimitation $limitation * @param int $errorCount */ - public function testValidateError(ContentTypeLimitation $limitation, $errorCount) + public function testValidateError(ContentTypeLimitation $limitation, int $errorCount): void { if (!empty($limitation->limitationValues)) { $this->getPersistenceMock() @@ -201,7 +202,7 @@ public function testValidateError(ContentTypeLimitation $limitation, $errorCount * * @param \Ibexa\Core\Limitation\ContentTypeLimitationType $limitationType */ - public function testBuildValue(ContentTypeLimitationType $limitationType) + public function testBuildValue(ContentTypeLimitationType $limitationType): void { $expected = ['test', 'test' => 9]; $value = $limitationType->buildValue($expected); @@ -214,7 +215,7 @@ public function testBuildValue(ContentTypeLimitationType $limitationType) /** * @return array */ - public function providerForTestEvaluate() + public function providerForTestEvaluate(): array { // Mocks for testing Content & VersionInfo objects, should only be used once because of expect rules. $contentMock = $this->createMock(APIContent::class); @@ -312,7 +313,7 @@ public function testEvaluate( ValueObject $object, array $targets, $expected - ) { + ): void { // Need to create inline instead of depending on testConstruct() to get correct mock instance $limitationType = $this->testConstruct(); @@ -340,7 +341,7 @@ public function testEvaluate( /** * @return array */ - public function providerForTestEvaluateInvalidArgument() + public function providerForTestEvaluateInvalidArgument(): array { return [ // invalid limitation @@ -365,7 +366,7 @@ public function testEvaluateInvalidArgument( Limitation $limitation, ValueObject $object, array $targets - ) { + ): void { $this->expectException(InvalidArgumentException::class); // Need to create inline instead of depending on testConstruct() to get correct mock instance @@ -395,7 +396,7 @@ public function testEvaluateInvalidArgument( * * @param \Ibexa\Core\Limitation\ContentTypeLimitationType $limitationType */ - public function testGetCriterionInvalidValue(ContentTypeLimitationType $limitationType) + public function testGetCriterionInvalidValue(ContentTypeLimitationType $limitationType): void { $this->expectException(\RuntimeException::class); @@ -410,7 +411,7 @@ public function testGetCriterionInvalidValue(ContentTypeLimitationType $limitati * * @param \Ibexa\Core\Limitation\ContentTypeLimitationType $limitationType */ - public function testGetCriterionSingleValue(ContentTypeLimitationType $limitationType) + public function testGetCriterionSingleValue(ContentTypeLimitationType $limitationType): void { $criterion = $limitationType->getCriterion( new ContentTypeLimitation(['limitationValues' => [9]]), @@ -429,7 +430,7 @@ public function testGetCriterionSingleValue(ContentTypeLimitationType $limitatio * * @param \Ibexa\Core\Limitation\ContentTypeLimitationType $limitationType */ - public function testGetCriterionMultipleValues(ContentTypeLimitationType $limitationType) + public function testGetCriterionMultipleValues(ContentTypeLimitationType $limitationType): void { $criterion = $limitationType->getCriterion( new ContentTypeLimitation(['limitationValues' => [9, 55]]), @@ -448,7 +449,7 @@ public function testGetCriterionMultipleValues(ContentTypeLimitationType $limita * * @param \Ibexa\Core\Limitation\ContentTypeLimitationType $limitationType */ - public function testValueSchema(ContentTypeLimitationType $limitationType) + public function testValueSchema(ContentTypeLimitationType $limitationType): void { $this->expectException(NotImplementedException::class); diff --git a/tests/lib/Limitation/LocationLimitationTypeTest.php b/tests/lib/Limitation/LocationLimitationTypeTest.php index 82186c4dfd..4fa8e3b5ab 100644 --- a/tests/lib/Limitation/LocationLimitationTypeTest.php +++ b/tests/lib/Limitation/LocationLimitationTypeTest.php @@ -23,6 +23,7 @@ use Ibexa\Core\Limitation\LocationLimitationType; use Ibexa\Core\Repository\Values\Content\ContentCreateStruct; use Ibexa\Core\Repository\Values\Content\Location; +use PHPUnit\Framework\MockObject\MockObject; /** * Test Case for LimitationType. @@ -30,7 +31,7 @@ class LocationLimitationTypeTest extends Base { /** @var \Ibexa\Contracts\Core\Persistence\Content\Location\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $locationHandlerMock; + private MockObject $locationHandlerMock; /** * Setup Location Handler mock. @@ -53,7 +54,7 @@ protected function tearDown(): void /** * @return \Ibexa\Core\Limitation\LocationLimitationType */ - public function testConstruct() + public function testConstruct(): LocationLimitationType { return new LocationLimitationType($this->getPersistenceMock()); } @@ -61,7 +62,7 @@ public function testConstruct() /** * @return array */ - public function providerForTestAcceptValue() + public function providerForTestAcceptValue(): array { return [ [new LocationLimitation()], @@ -78,7 +79,7 @@ public function providerForTestAcceptValue() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\LocationLimitation $limitation * @param \Ibexa\Core\Limitation\LocationLimitationType $limitationType */ - public function testAcceptValue(LocationLimitation $limitation, LocationLimitationType $limitationType) + public function testAcceptValue(LocationLimitation $limitation, LocationLimitationType $limitationType): void { $limitationType->acceptValue($limitation); } @@ -86,7 +87,7 @@ public function testAcceptValue(LocationLimitation $limitation, LocationLimitati /** * @return array */ - public function providerForTestAcceptValueException() + public function providerForTestAcceptValueException(): array { return [ [new ObjectStateLimitation()], @@ -102,7 +103,7 @@ public function providerForTestAcceptValueException() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation * @param \Ibexa\Core\Limitation\LocationLimitationType $limitationType */ - public function testAcceptValueException(Limitation $limitation, LocationLimitationType $limitationType) + public function testAcceptValueException(Limitation $limitation, LocationLimitationType $limitationType): void { $this->expectException(InvalidArgumentException::class); @@ -112,7 +113,7 @@ public function testAcceptValueException(Limitation $limitation, LocationLimitat /** * @return array */ - public function providerForTestValidatePass() + public function providerForTestValidatePass(): array { return [ [new LocationLimitation()], @@ -126,7 +127,7 @@ public function providerForTestValidatePass() * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\LocationLimitation $limitation */ - public function testValidatePass(LocationLimitation $limitation) + public function testValidatePass(LocationLimitation $limitation): void { if (!empty($limitation->limitationValues)) { $this->getPersistenceMock() @@ -152,7 +153,7 @@ public function testValidatePass(LocationLimitation $limitation) /** * @return array */ - public function providerForTestValidateError() + public function providerForTestValidateError(): array { return [ [new LocationLimitation(), 0], @@ -167,7 +168,7 @@ public function providerForTestValidateError() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\LocationLimitation $limitation * @param int $errorCount */ - public function testValidateError(LocationLimitation $limitation, $errorCount) + public function testValidateError(LocationLimitation $limitation, int $errorCount): void { if (!empty($limitation->limitationValues)) { $this->getPersistenceMock() @@ -200,7 +201,7 @@ public function testValidateError(LocationLimitation $limitation, $errorCount) * * @param \Ibexa\Core\Limitation\LocationLimitationType $limitationType */ - public function testBuildValue(LocationLimitationType $limitationType) + public function testBuildValue(LocationLimitationType $limitationType): void { $expected = ['test', 'test' => 9]; $value = $limitationType->buildValue($expected); @@ -213,7 +214,7 @@ public function testBuildValue(LocationLimitationType $limitationType) /** * @return array */ - public function providerForTestEvaluate() + public function providerForTestEvaluate(): array { // Mocks for testing Content & VersionInfo objects, should only be used once because of expect rules. $contentMock = $this->createMock(APIContent::class); @@ -345,7 +346,7 @@ public function testEvaluate( $targets, array $persistenceLocations, $expected - ) { + ): void { // Need to create inline instead of depending on testConstruct() to get correct mock instance $limitationType = $this->testConstruct(); @@ -386,7 +387,7 @@ public function testEvaluate( /** * @return array */ - public function providerForTestEvaluateInvalidArgument() + public function providerForTestEvaluateInvalidArgument(): array { return [ // invalid limitation @@ -426,9 +427,9 @@ public function providerForTestEvaluateInvalidArgument() public function testEvaluateInvalidArgument( Limitation $limitation, ValueObject $object, - $targets, + ?array $targets, array $persistenceLocations - ) { + ): void { $this->expectException(InvalidArgumentException::class); // Need to create inline instead of depending on testConstruct() to get correct mock instance @@ -458,7 +459,7 @@ public function testEvaluateInvalidArgument( * * @param \Ibexa\Core\Limitation\LocationLimitationType $limitationType */ - public function testGetCriterionInvalidValue(LocationLimitationType $limitationType) + public function testGetCriterionInvalidValue(LocationLimitationType $limitationType): void { $this->expectException(\RuntimeException::class); @@ -473,7 +474,7 @@ public function testGetCriterionInvalidValue(LocationLimitationType $limitationT * * @param \Ibexa\Core\Limitation\LocationLimitationType $limitationType */ - public function testGetCriterionSingleValue(LocationLimitationType $limitationType) + public function testGetCriterionSingleValue(LocationLimitationType $limitationType): void { $criterion = $limitationType->getCriterion( new LocationLimitation(['limitationValues' => [9]]), @@ -492,7 +493,7 @@ public function testGetCriterionSingleValue(LocationLimitationType $limitationTy * * @param \Ibexa\Core\Limitation\LocationLimitationType $limitationType */ - public function testGetCriterionMultipleValues(LocationLimitationType $limitationType) + public function testGetCriterionMultipleValues(LocationLimitationType $limitationType): void { $criterion = $limitationType->getCriterion( new LocationLimitation(['limitationValues' => [9, 55]]), @@ -511,7 +512,7 @@ public function testGetCriterionMultipleValues(LocationLimitationType $limitatio * * @param \Ibexa\Core\Limitation\LocationLimitationType $limitationType */ - public function testValueSchema(LocationLimitationType $limitationType) + public function testValueSchema(LocationLimitationType $limitationType): void { self::assertEquals( LocationLimitationType::VALUE_SCHEMA_LOCATION_ID, diff --git a/tests/lib/Limitation/NewObjectStateLimitationTypeTest.php b/tests/lib/Limitation/NewObjectStateLimitationTypeTest.php index 73fb5aabf1..23cb7d6be6 100644 --- a/tests/lib/Limitation/NewObjectStateLimitationTypeTest.php +++ b/tests/lib/Limitation/NewObjectStateLimitationTypeTest.php @@ -21,6 +21,7 @@ use Ibexa\Core\Repository\Values\Content\Location; use Ibexa\Core\Repository\Values\Content\VersionInfo; use Ibexa\Core\Repository\Values\ObjectState\ObjectState; +use PHPUnit\Framework\MockObject\MockObject; /** * Test Case for LimitationType. @@ -28,7 +29,7 @@ class NewObjectStateLimitationTypeTest extends Base { /** @var \Ibexa\Contracts\Core\Persistence\Content\ObjectState\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $objectStateHandlerMock; + private MockObject $objectStateHandlerMock; /** * Setup Handler mock. @@ -51,7 +52,7 @@ protected function tearDown(): void /** * @return \Ibexa\Core\Limitation\NewObjectStateLimitationType */ - public function testConstruct() + public function testConstruct(): NewObjectStateLimitationType { return new NewObjectStateLimitationType($this->getPersistenceMock()); } @@ -59,7 +60,7 @@ public function testConstruct() /** * @return array */ - public function providerForTestAcceptValue() + public function providerForTestAcceptValue(): array { return [ [new NewObjectStateLimitation()], @@ -76,7 +77,7 @@ public function providerForTestAcceptValue() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\NewObjectStateLimitation $limitation * @param \Ibexa\Core\Limitation\NewObjectStateLimitationType $limitationType */ - public function testAcceptValue(NewObjectStateLimitation $limitation, NewObjectStateLimitationType $limitationType) + public function testAcceptValue(NewObjectStateLimitation $limitation, NewObjectStateLimitationType $limitationType): void { $limitationType->acceptValue($limitation); } @@ -84,7 +85,7 @@ public function testAcceptValue(NewObjectStateLimitation $limitation, NewObjectS /** * @return array */ - public function providerForTestAcceptValueException() + public function providerForTestAcceptValueException(): array { return [ [new ObjectStateLimitation()], @@ -100,7 +101,7 @@ public function providerForTestAcceptValueException() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation * @param \Ibexa\Core\Limitation\NewObjectStateLimitationType $limitationType */ - public function testAcceptValueException(Limitation $limitation, NewObjectStateLimitationType $limitationType) + public function testAcceptValueException(Limitation $limitation, NewObjectStateLimitationType $limitationType): void { $this->expectException(InvalidArgumentException::class); @@ -110,7 +111,7 @@ public function testAcceptValueException(Limitation $limitation, NewObjectStateL /** * @return array */ - public function providerForTestValidatePass() + public function providerForTestValidatePass(): array { return [ [new NewObjectStateLimitation()], @@ -124,7 +125,7 @@ public function providerForTestValidatePass() * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\NewObjectStateLimitation $limitation */ - public function testValidatePass(NewObjectStateLimitation $limitation) + public function testValidatePass(NewObjectStateLimitation $limitation): void { if (!empty($limitation->limitationValues)) { $this->getPersistenceMock() @@ -150,7 +151,7 @@ public function testValidatePass(NewObjectStateLimitation $limitation) /** * @return array */ - public function providerForTestValidateError() + public function providerForTestValidateError(): array { return [ [new NewObjectStateLimitation(), 0], @@ -165,7 +166,7 @@ public function providerForTestValidateError() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\NewObjectStateLimitation $limitation * @param int $errorCount */ - public function testValidateError(NewObjectStateLimitation $limitation, $errorCount) + public function testValidateError(NewObjectStateLimitation $limitation, int $errorCount): void { if (!empty($limitation->limitationValues)) { $this->getPersistenceMock() @@ -198,7 +199,7 @@ public function testValidateError(NewObjectStateLimitation $limitation, $errorCo * * @param \Ibexa\Core\Limitation\NewObjectStateLimitationType $limitationType */ - public function testBuildValue(NewObjectStateLimitationType $limitationType) + public function testBuildValue(NewObjectStateLimitationType $limitationType): void { $expected = ['test', 'test' => 9]; $value = $limitationType->buildValue($expected); @@ -211,7 +212,7 @@ public function testBuildValue(NewObjectStateLimitationType $limitationType) /** * @return array */ - public function providerForTestEvaluate() + public function providerForTestEvaluate(): array { return [ // ContentInfo, no access @@ -267,7 +268,7 @@ public function testEvaluate( ValueObject $object, array $targets, $expected - ) { + ): void { // Need to create inline instead of depending on testConstruct() to get correct mock instance $limitationType = $this->testConstruct(); @@ -295,7 +296,7 @@ public function testEvaluate( /** * @return array */ - public function providerForTestEvaluateInvalidArgument() + public function providerForTestEvaluateInvalidArgument(): array { return [ // invalid limitation @@ -326,7 +327,7 @@ public function testEvaluateInvalidArgument( Limitation $limitation, ValueObject $object, array $targets - ) { + ): void { $this->expectException(InvalidArgumentException::class); // Need to create inline instead of depending on testConstruct() to get correct mock instance @@ -356,7 +357,7 @@ public function testEvaluateInvalidArgument( * * @param \Ibexa\Core\Limitation\NewObjectStateLimitationType $limitationType */ - public function testGetCriterion(NewObjectStateLimitationType $limitationType) + public function testGetCriterion(NewObjectStateLimitationType $limitationType): void { $this->expectException(NotImplementedException::class); @@ -371,7 +372,7 @@ public function testGetCriterion(NewObjectStateLimitationType $limitationType) * * @param \Ibexa\Core\Limitation\NewObjectStateLimitationType $limitationType */ - public function testValueSchema(NewObjectStateLimitationType $limitationType) + public function testValueSchema(NewObjectStateLimitationType $limitationType): void { $this->expectException(NotImplementedException::class); diff --git a/tests/lib/Limitation/ObjectStateLimitationTypeTest.php b/tests/lib/Limitation/ObjectStateLimitationTypeTest.php index 341498cf3a..90e9e98702 100644 --- a/tests/lib/Limitation/ObjectStateLimitationTypeTest.php +++ b/tests/lib/Limitation/ObjectStateLimitationTypeTest.php @@ -18,6 +18,7 @@ use Ibexa\Contracts\Core\Repository\Values\ValueObject; use Ibexa\Core\Limitation\ObjectStateLimitationType; use Ibexa\Core\Repository\Values\Content\ContentCreateStruct; +use PHPUnit\Framework\MockObject\MockObject; /** * Test Case for LimitationType. @@ -25,13 +26,13 @@ class ObjectStateLimitationTypeTest extends Base { /** @var \Ibexa\Contracts\Core\Persistence\Content\ObjectState\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $objectStateHandlerMock; + private MockObject $objectStateHandlerMock; /** @var \Ibexa\Contracts\Core\Persistence\Content\ObjectState\Group[] */ - private $allObjectStateGroups; + private array $allObjectStateGroups; /** @var array */ - private $loadObjectStatesMap; + private array $loadObjectStatesMap; /** * Setup Handler mock. @@ -78,7 +79,7 @@ protected function tearDown(): void /** * @return \Ibexa\Core\Limitation\ObjectStateLimitationType */ - public function testConstruct() + public function testConstruct(): ObjectStateLimitationType { return new ObjectStateLimitationType($this->getPersistenceMock()); } @@ -153,8 +154,8 @@ public function providerForTestEvaluate(): array public function testEvaluate( ObjectStateLimitation $limitation, ValueObject $object, - $expected - ) { + bool $expected + ): void { $getContentStateMap = [ [ 1, @@ -212,7 +213,7 @@ public function testEvaluate( * * @param \Ibexa\Core\Limitation\ObjectStateLimitationType $limitationType */ - public function testGetCriterionInvalidValue(ObjectStateLimitationType $limitationType) + public function testGetCriterionInvalidValue(ObjectStateLimitationType $limitationType): void { $this->expectException(\RuntimeException::class); @@ -227,7 +228,7 @@ public function testGetCriterionInvalidValue(ObjectStateLimitationType $limitati * * @param \Ibexa\Core\Limitation\ObjectStateLimitationType $limitationType */ - public function testGetCriterionSingleValue(ObjectStateLimitationType $limitationType) + public function testGetCriterionSingleValue(ObjectStateLimitationType $limitationType): void { $criterion = $limitationType->getCriterion( new ObjectStateLimitation(['limitationValues' => [2]]), @@ -241,7 +242,7 @@ public function testGetCriterionSingleValue(ObjectStateLimitationType $limitatio self::assertEquals([2], $criterion->value); } - public function testGetCriterionMultipleValuesFromSingleGroup() + public function testGetCriterionMultipleValuesFromSingleGroup(): void { $this->getPersistenceMock() ->method('objectStateHandler') @@ -270,7 +271,7 @@ public function testGetCriterionMultipleValuesFromSingleGroup() self::assertEquals([1, 2], $criterion->value); } - public function testGetCriterionMultipleValuesFromMultipleGroups() + public function testGetCriterionMultipleValuesFromMultipleGroups(): void { $this->getPersistenceMock() ->method('objectStateHandler') diff --git a/tests/lib/Limitation/ParentContentTypeLimitationTypeTest.php b/tests/lib/Limitation/ParentContentTypeLimitationTypeTest.php index 28393bdd5f..419467a03e 100644 --- a/tests/lib/Limitation/ParentContentTypeLimitationTypeTest.php +++ b/tests/lib/Limitation/ParentContentTypeLimitationTypeTest.php @@ -25,6 +25,7 @@ use Ibexa\Core\Limitation\ParentContentTypeLimitationType; use Ibexa\Core\Repository\Values\Content\ContentCreateStruct; use Ibexa\Core\Repository\Values\Content\Location; +use PHPUnit\Framework\MockObject\MockObject; /** * Test Case for LimitationType. @@ -32,13 +33,13 @@ class ParentContentTypeLimitationTypeTest extends Base { /** @var \Ibexa\Contracts\Core\Persistence\Content\Location\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $locationHandlerMock; + private MockObject $locationHandlerMock; /** @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $contentTypeHandlerMock; + private MockObject $contentTypeHandlerMock; /** @var \Ibexa\Contracts\Core\Persistence\Content\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $contentHandlerMock; + private MockObject $contentHandlerMock; /** * Setup Location Handler mock. @@ -65,7 +66,7 @@ protected function tearDown(): void /** * @return \Ibexa\Core\Limitation\ParentContentTypeLimitationType */ - public function testConstruct() + public function testConstruct(): ParentContentTypeLimitationType { return new ParentContentTypeLimitationType($this->getPersistenceMock()); } @@ -73,7 +74,7 @@ public function testConstruct() /** * @return array */ - public function providerForTestAcceptValue() + public function providerForTestAcceptValue(): array { return [ [new ParentContentTypeLimitation()], @@ -90,7 +91,7 @@ public function providerForTestAcceptValue() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\ParentContentTypeLimitation $limitation * @param \Ibexa\Core\Limitation\ParentContentTypeLimitationType $limitationType */ - public function testAcceptValue(ParentContentTypeLimitation $limitation, ParentContentTypeLimitationType $limitationType) + public function testAcceptValue(ParentContentTypeLimitation $limitation, ParentContentTypeLimitationType $limitationType): void { $limitationType->acceptValue($limitation); } @@ -98,7 +99,7 @@ public function testAcceptValue(ParentContentTypeLimitation $limitation, ParentC /** * @return array */ - public function providerForTestAcceptValueException() + public function providerForTestAcceptValueException(): array { return [ [new ObjectStateLimitation()], @@ -115,7 +116,7 @@ public function providerForTestAcceptValueException() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation * @param \Ibexa\Core\Limitation\ParentContentTypeLimitationType $limitationType */ - public function testAcceptValueException(Limitation $limitation, ParentContentTypeLimitationType $limitationType) + public function testAcceptValueException(Limitation $limitation, ParentContentTypeLimitationType $limitationType): void { $this->expectException(InvalidArgumentException::class); @@ -125,7 +126,7 @@ public function testAcceptValueException(Limitation $limitation, ParentContentTy /** * @return array */ - public function providerForTestValidatePass() + public function providerForTestValidatePass(): array { return [ [new ParentContentTypeLimitation()], @@ -139,7 +140,7 @@ public function providerForTestValidatePass() * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\ParentContentTypeLimitation $limitation */ - public function testValidatePass(ParentContentTypeLimitation $limitation) + public function testValidatePass(ParentContentTypeLimitation $limitation): void { if (!empty($limitation->limitationValues)) { $this->getPersistenceMock() @@ -166,7 +167,7 @@ public function testValidatePass(ParentContentTypeLimitation $limitation) /** * @return array */ - public function providerForTestValidateError() + public function providerForTestValidateError(): array { return [ [new ParentContentTypeLimitation(), 0], @@ -181,7 +182,7 @@ public function providerForTestValidateError() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\ParentContentTypeLimitation $limitation * @param int $errorCount */ - public function testValidateError(ParentContentTypeLimitation $limitation, $errorCount) + public function testValidateError(ParentContentTypeLimitation $limitation, int $errorCount): void { if (!empty($limitation->limitationValues)) { $this->getPersistenceMock() @@ -214,7 +215,7 @@ public function testValidateError(ParentContentTypeLimitation $limitation, $erro * * @param \Ibexa\Core\Limitation\ParentContentTypeLimitationType $limitationType */ - public function testBuildValue(ParentContentTypeLimitationType $limitationType) + public function testBuildValue(ParentContentTypeLimitationType $limitationType): void { $expected = ['test', 'test' => '1']; $value = $limitationType->buildValue($expected); @@ -224,7 +225,7 @@ public function testBuildValue(ParentContentTypeLimitationType $limitationType) self::assertEquals($expected, $value->limitationValues); } - protected function getTestEvaluateContentMock() + protected function getTestEvaluateContentMock(): MockObject { $contentMock = $this->createMock(APIContent::class); @@ -236,7 +237,7 @@ protected function getTestEvaluateContentMock() return $contentMock; } - protected function getTestEvaluateVersionInfoMock() + protected function getTestEvaluateVersionInfoMock(): MockObject { $versionInfoMock = $this->createMock(APIVersionInfo::class); @@ -251,7 +252,7 @@ protected function getTestEvaluateVersionInfoMock() /** * @return array */ - public function providerForTestEvaluate() + public function providerForTestEvaluate(): array { return [ // ContentInfo, with API targets, no access @@ -447,7 +448,7 @@ public function providerForTestEvaluate() ]; } - protected function assertContentHandlerExpectations($callNo, $persistenceCalled, $contentId, $contentInfo) + protected function assertContentHandlerExpectations(int $callNo, $persistenceCalled, $contentId, $contentInfo) { $this->getPersistenceMock() ->expects(self::at($callNo + ($persistenceCalled ? 1 : 0))) @@ -467,10 +468,10 @@ protected function assertContentHandlerExpectations($callNo, $persistenceCalled, public function testEvaluate( ParentContentTypeLimitation $limitation, ValueObject $object, - $targets, + ?array $targets, array $persistence, $expected - ) { + ): void { // Need to create inline instead of depending on testConstruct() to get correct mock instance $limitationType = $this->testConstruct(); @@ -572,7 +573,7 @@ public function testEvaluate( /** * @return array */ - public function providerForTestEvaluateInvalidArgument() + public function providerForTestEvaluateInvalidArgument(): array { return [ // invalid limitation @@ -609,7 +610,7 @@ public function providerForTestEvaluateInvalidArgument() /** * @dataProvider providerForTestEvaluateInvalidArgument */ - public function testEvaluateInvalidArgument(Limitation $limitation, ValueObject $object, $targets) + public function testEvaluateInvalidArgument(Limitation $limitation, ValueObject $object, ?array $targets): void { $this->expectException(InvalidArgumentException::class); @@ -639,7 +640,7 @@ public function testEvaluateInvalidArgument(Limitation $limitation, ValueObject * * @param \Ibexa\Core\Limitation\ParentContentTypeLimitationType $limitationType */ - public function testGetCriterionInvalidValue(ParentContentTypeLimitationType $limitationType) + public function testGetCriterionInvalidValue(ParentContentTypeLimitationType $limitationType): void { $this->expectException(NotImplementedException::class); @@ -654,7 +655,7 @@ public function testGetCriterionInvalidValue(ParentContentTypeLimitationType $li * * @param \Ibexa\Core\Limitation\ParentContentTypeLimitationType $limitationType */ - public function testValueSchema(ParentContentTypeLimitationType $limitationType) + public function testValueSchema(ParentContentTypeLimitationType $limitationType): void { self::markTestIncomplete('Method is not implemented yet: ' . __METHOD__); } diff --git a/tests/lib/Limitation/ParentDepthLimitationTypeTest.php b/tests/lib/Limitation/ParentDepthLimitationTypeTest.php index 6015d56b0e..58b07f8e8b 100644 --- a/tests/lib/Limitation/ParentDepthLimitationTypeTest.php +++ b/tests/lib/Limitation/ParentDepthLimitationTypeTest.php @@ -20,6 +20,7 @@ use Ibexa\Core\Limitation\ParentDepthLimitationType; use Ibexa\Core\Repository\Values\Content\ContentCreateStruct; use Ibexa\Core\Repository\Values\Content\Location; +use PHPUnit\Framework\MockObject\MockObject; /** * Test Case for LimitationType. @@ -27,7 +28,7 @@ class ParentDepthLimitationTypeTest extends Base { /** @var \Ibexa\Contracts\Core\Persistence\Content\Location\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $locationHandlerMock; + private MockObject $locationHandlerMock; /** * Setup Location Handler mock. @@ -50,7 +51,7 @@ protected function tearDown(): void /** * @return \Ibexa\Core\Limitation\ParentDepthLimitationType */ - public function testConstruct() + public function testConstruct(): ParentDepthLimitationType { return new ParentDepthLimitationType($this->getPersistenceMock()); } @@ -58,7 +59,7 @@ public function testConstruct() /** * @return array */ - public function providerForTestAcceptValue() + public function providerForTestAcceptValue(): array { return [ [new ParentDepthLimitation()], @@ -75,7 +76,7 @@ public function providerForTestAcceptValue() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\ParentDepthLimitation $limitation * @param \Ibexa\Core\Limitation\ParentDepthLimitationType $limitationType */ - public function testAcceptValue(ParentDepthLimitation $limitation, ParentDepthLimitationType $limitationType) + public function testAcceptValue(ParentDepthLimitation $limitation, ParentDepthLimitationType $limitationType): void { $limitationType->acceptValue($limitation); } @@ -83,7 +84,7 @@ public function testAcceptValue(ParentDepthLimitation $limitation, ParentDepthLi /** * @return array */ - public function providerForTestAcceptValueException() + public function providerForTestAcceptValueException(): array { return [ [new ObjectStateLimitation()], @@ -99,7 +100,7 @@ public function providerForTestAcceptValueException() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation * @param \Ibexa\Core\Limitation\ParentDepthLimitationType $limitationType */ - public function testAcceptValueException(Limitation $limitation, ParentDepthLimitationType $limitationType) + public function testAcceptValueException(Limitation $limitation, ParentDepthLimitationType $limitationType): void { $this->expectException(InvalidArgumentException::class); @@ -109,7 +110,7 @@ public function testAcceptValueException(Limitation $limitation, ParentDepthLimi /** * @return array */ - public function providerForTestValidatePass() + public function providerForTestValidatePass(): array { return [ [new ParentDepthLimitation()], @@ -125,7 +126,7 @@ public function providerForTestValidatePass() * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\ParentDepthLimitation $limitation */ - public function testValidatePass(ParentDepthLimitation $limitation, ParentDepthLimitationType $limitationType) + public function testValidatePass(ParentDepthLimitation $limitation, ParentDepthLimitationType $limitationType): void { $validationErrors = $limitationType->validate($limitation); self::assertEmpty($validationErrors); @@ -136,7 +137,7 @@ public function testValidatePass(ParentDepthLimitation $limitation, ParentDepthL * * @param \Ibexa\Core\Limitation\ParentDepthLimitationType $limitationType */ - public function testBuildValue(ParentDepthLimitationType $limitationType) + public function testBuildValue(ParentDepthLimitationType $limitationType): void { $expected = [2, 7]; $value = $limitationType->buildValue($expected); @@ -152,7 +153,7 @@ public function testBuildValue(ParentDepthLimitationType $limitationType) /** * @return array */ - public function providerForTestEvaluate() + public function providerForTestEvaluate(): array { // Mocks for testing Content & VersionInfo objects, should only be used once because of expect rules. $contentMock = $this->createMock(APIContent::class); @@ -285,10 +286,10 @@ public function providerForTestEvaluate() public function testEvaluate( ParentDepthLimitation $limitation, ValueObject $object, - $targets, + ?array $targets, array $persistenceLocations, $expected - ) { + ): void { // Need to create inline instead of depending on testConstruct() to get correct mock instance $limitationType = $this->testConstruct(); @@ -346,7 +347,7 @@ public function testEvaluate( /** * @return array */ - public function providerForTestEvaluateInvalidArgument() + public function providerForTestEvaluateInvalidArgument(): array { return [ // invalid limitation @@ -386,9 +387,9 @@ public function providerForTestEvaluateInvalidArgument() public function testEvaluateInvalidArgument( Limitation $limitation, ValueObject $object, - $targets, + ?array $targets, array $persistenceLocations - ) { + ): void { $this->expectException(InvalidArgumentException::class); // Need to create inline instead of depending on testConstruct() to get correct mock instance diff --git a/tests/lib/Limitation/RoleLimitationTypeTest.php b/tests/lib/Limitation/RoleLimitationTypeTest.php index ea6035ea61..07273e52dd 100644 --- a/tests/lib/Limitation/RoleLimitationTypeTest.php +++ b/tests/lib/Limitation/RoleLimitationTypeTest.php @@ -157,7 +157,7 @@ public function testValidateError(UserRoleLimitation $limitation, int $errorCoun self::assertCount($errorCount, $validationErrors); } - public function providerForTestValidateError() + public function providerForTestValidateError(): array { return [ [ @@ -204,7 +204,7 @@ public function testEvaluate( self::assertEquals($expected, $value); } - public function providerForTestEvaluate() + public function providerForTestEvaluate(): array { return [ 'valid_role_limitation' => [ diff --git a/tests/lib/Limitation/SectionLimitationTypeTest.php b/tests/lib/Limitation/SectionLimitationTypeTest.php index fdb938866d..9e48acf8ff 100644 --- a/tests/lib/Limitation/SectionLimitationTypeTest.php +++ b/tests/lib/Limitation/SectionLimitationTypeTest.php @@ -26,6 +26,7 @@ use Ibexa\Core\Limitation\SectionLimitationType; use Ibexa\Core\Repository\Values\Content\ContentCreateStruct; use Ibexa\Core\Repository\Values\Content\Location; +use PHPUnit\Framework\MockObject\MockObject; /** * Test Case for LimitationType. @@ -33,7 +34,7 @@ class SectionLimitationTypeTest extends Base { /** @var \Ibexa\Contracts\Core\Persistence\Content\Section\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $sectionHandlerMock; + private MockObject $sectionHandlerMock; /** * Setup Location Handler mock. @@ -56,7 +57,7 @@ protected function tearDown(): void /** * @return \Ibexa\Core\Limitation\SectionLimitationType */ - public function testConstruct() + public function testConstruct(): SectionLimitationType { return new SectionLimitationType($this->getPersistenceMock()); } @@ -64,7 +65,7 @@ public function testConstruct() /** * @return array */ - public function providerForTestAcceptValue() + public function providerForTestAcceptValue(): array { return [ [new SectionLimitation()], @@ -81,7 +82,7 @@ public function providerForTestAcceptValue() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\SectionLimitation $limitation * @param \Ibexa\Core\Limitation\SectionLimitationType $limitationType */ - public function testAcceptValue(SectionLimitation $limitation, SectionLimitationType $limitationType) + public function testAcceptValue(SectionLimitation $limitation, SectionLimitationType $limitationType): void { $limitationType->acceptValue($limitation); } @@ -89,7 +90,7 @@ public function testAcceptValue(SectionLimitation $limitation, SectionLimitation /** * @return array */ - public function providerForTestAcceptValueException() + public function providerForTestAcceptValueException(): array { return [ [new ObjectStateLimitation()], @@ -108,7 +109,7 @@ public function providerForTestAcceptValueException() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation * @param \Ibexa\Core\Limitation\SectionLimitationType $limitationType */ - public function testAcceptValueException(Limitation $limitation, SectionLimitationType $limitationType) + public function testAcceptValueException(Limitation $limitation, SectionLimitationType $limitationType): void { $this->expectException(InvalidArgumentException::class); @@ -118,7 +119,7 @@ public function testAcceptValueException(Limitation $limitation, SectionLimitati /** * @return array */ - public function providerForTestValidatePass() + public function providerForTestValidatePass(): array { return [ [new SectionLimitation()], @@ -132,7 +133,7 @@ public function providerForTestValidatePass() * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\SectionLimitation $limitation */ - public function testValidatePass(SectionLimitation $limitation) + public function testValidatePass(SectionLimitation $limitation): void { if (!empty($limitation->limitationValues)) { $this->getPersistenceMock() @@ -163,7 +164,7 @@ public function testValidatePass(SectionLimitation $limitation) /** * @return array */ - public function providerForTestValidateError() + public function providerForTestValidateError(): array { return [ [new SectionLimitation(), 0], @@ -178,7 +179,7 @@ public function providerForTestValidateError() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\SectionLimitation $limitation * @param int $errorCount */ - public function testValidateError(SectionLimitation $limitation, $errorCount) + public function testValidateError(SectionLimitation $limitation, int $errorCount): void { if (!empty($limitation->limitationValues)) { $this->getPersistenceMock() @@ -211,7 +212,7 @@ public function testValidateError(SectionLimitation $limitation, $errorCount) * * @param \Ibexa\Core\Limitation\SectionLimitationType $limitationType */ - public function testBuildValue(SectionLimitationType $limitationType) + public function testBuildValue(SectionLimitationType $limitationType): void { $expected = ['test', 'test' => '33']; $value = $limitationType->buildValue($expected); @@ -224,7 +225,7 @@ public function testBuildValue(SectionLimitationType $limitationType) /** * @return array */ - public function providerForTestEvaluate() + public function providerForTestEvaluate(): array { // Mocks for testing Content & VersionInfo objects, should only be used once because of expect rules. $contentMock = $this->createMock(APIContent::class); @@ -355,9 +356,9 @@ public function providerForTestEvaluate() public function testEvaluate( SectionLimitation $limitation, ValueObject $object, - $targets, + ?array $targets, $expected - ) { + ): void { // Need to create inline instead of depending on testConstruct() to get correct mock instance $limitationType = $this->testConstruct(); @@ -383,7 +384,7 @@ public function testEvaluate( /** * @return array */ - public function providerForTestEvaluateInvalidArgument() + public function providerForTestEvaluateInvalidArgument(): array { return [ // invalid limitation @@ -401,8 +402,8 @@ public function providerForTestEvaluateInvalidArgument() public function testEvaluateInvalidArgument( Limitation $limitation, ValueObject $object, - $targets - ) { + ?array $targets + ): void { $this->expectException(InvalidArgumentException::class); // Need to create inline instead of depending on testConstruct() to get correct mock instance @@ -431,7 +432,7 @@ public function testEvaluateInvalidArgument( * * @param \Ibexa\Core\Limitation\SectionLimitationType $limitationType */ - public function testGetCriterionInvalidValue(SectionLimitationType $limitationType) + public function testGetCriterionInvalidValue(SectionLimitationType $limitationType): void { $this->expectException(\RuntimeException::class); @@ -446,7 +447,7 @@ public function testGetCriterionInvalidValue(SectionLimitationType $limitationTy * * @param \Ibexa\Core\Limitation\SectionLimitationType $limitationType */ - public function testGetCriterionSingleValue(SectionLimitationType $limitationType) + public function testGetCriterionSingleValue(SectionLimitationType $limitationType): void { $criterion = $limitationType->getCriterion( new SectionLimitation(['limitationValues' => ['9']]), @@ -465,7 +466,7 @@ public function testGetCriterionSingleValue(SectionLimitationType $limitationTyp * * @param \Ibexa\Core\Limitation\SectionLimitationType $limitationType */ - public function testGetCriterionMultipleValues(SectionLimitationType $limitationType) + public function testGetCriterionMultipleValues(SectionLimitationType $limitationType): void { $criterion = $limitationType->getCriterion( new SectionLimitation(['limitationValues' => ['9', '55']]), @@ -484,7 +485,7 @@ public function testGetCriterionMultipleValues(SectionLimitationType $limitation * * @param \Ibexa\Core\Limitation\SectionLimitationType $limitationType */ - public function testValueSchema(SectionLimitationType $limitationType) + public function testValueSchema(SectionLimitationType $limitationType): void { $this->expectException(NotImplementedException::class); diff --git a/tests/lib/Limitation/SiteAccessLimitationTypeTest.php b/tests/lib/Limitation/SiteAccessLimitationTypeTest.php index 2996a4f4a5..05d3d2d713 100644 --- a/tests/lib/Limitation/SiteAccessLimitationTypeTest.php +++ b/tests/lib/Limitation/SiteAccessLimitationTypeTest.php @@ -15,6 +15,7 @@ use Ibexa\Contracts\Core\Repository\Values\ValueObject; use Ibexa\Core\Limitation\SiteAccessLimitationType; use Ibexa\Core\MVC\Symfony\SiteAccess; +use PHPUnit\Framework\MockObject\MockObject; /** * Test Case for LimitationType. @@ -22,7 +23,7 @@ class SiteAccessLimitationTypeTest extends Base { /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessServiceInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $siteAccessServiceMock; + private MockObject $siteAccessServiceMock; protected function setUp(): void { @@ -40,7 +41,7 @@ protected function setUp(): void /** * @return \Ibexa\Core\Limitation\SiteAccessLimitationType */ - public function testConstruct() + public function testConstruct(): SiteAccessLimitationType { return new SiteAccessLimitationType( $this->siteAccessServiceMock @@ -50,7 +51,7 @@ public function testConstruct() /** * @return array */ - public function providerForTestAcceptValue() + public function providerForTestAcceptValue(): array { return [ [new SiteAccessLimitation()], @@ -88,7 +89,7 @@ public function providerForTestAcceptValue() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\SiteAccessLimitation $limitation * @param \Ibexa\Core\Limitation\SiteAccessLimitationType $limitationType */ - public function testAcceptValue(SiteAccessLimitation $limitation, SiteAccessLimitationType $limitationType) + public function testAcceptValue(SiteAccessLimitation $limitation, SiteAccessLimitationType $limitationType): void { $limitationType->acceptValue($limitation); } @@ -96,7 +97,7 @@ public function testAcceptValue(SiteAccessLimitation $limitation, SiteAccessLimi /** * @return array */ - public function providerForTestAcceptValueException() + public function providerForTestAcceptValueException(): array { return [ [new ObjectStateLimitation()], @@ -112,7 +113,7 @@ public function providerForTestAcceptValueException() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation * @param \Ibexa\Core\Limitation\SiteAccessLimitationType $limitationType */ - public function testAcceptValueException(Limitation $limitation, SiteAccessLimitationType $limitationType) + public function testAcceptValueException(Limitation $limitation, SiteAccessLimitationType $limitationType): void { $this->expectException(InvalidArgumentException::class); @@ -122,7 +123,7 @@ public function testAcceptValueException(Limitation $limitation, SiteAccessLimit /** * @return array */ - public function providerForTestValidateError() + public function providerForTestValidateError(): array { return [ [new SiteAccessLimitation(), 0], @@ -171,7 +172,7 @@ public function providerForTestValidateError() * @param int $errorCount * @param \Ibexa\Core\Limitation\SiteAccessLimitationType $limitationType */ - public function testValidateError(SiteAccessLimitation $limitation, $errorCount, SiteAccessLimitationType $limitationType) + public function testValidateError(SiteAccessLimitation $limitation, int $errorCount, SiteAccessLimitationType $limitationType): void { $validationErrors = $limitationType->validate($limitation); self::assertCount($errorCount, $validationErrors); @@ -182,7 +183,7 @@ public function testValidateError(SiteAccessLimitation $limitation, $errorCount, * * @param \Ibexa\Core\Limitation\SiteAccessLimitationType $limitationType */ - public function testBuildValue(SiteAccessLimitationType $limitationType) + public function testBuildValue(SiteAccessLimitationType $limitationType): void { $expected = ['test', 'test' => 9]; $value = $limitationType->buildValue($expected); @@ -195,7 +196,7 @@ public function testBuildValue(SiteAccessLimitationType $limitationType) /** * @return array */ - public function providerForTestEvaluate() + public function providerForTestEvaluate(): array { return [ // SiteAccess, no access @@ -229,7 +230,7 @@ public function testEvaluate( ValueObject $object, $expected, SiteAccessLimitationType $limitationType - ) { + ): void { $userMock = $this->getUserMock(); $userMock->expects(self::never())->method(self::anything()); @@ -246,7 +247,7 @@ public function testEvaluate( /** * @return array */ - public function providerForTestEvaluateInvalidArgument() + public function providerForTestEvaluateInvalidArgument(): array { return [ // invalid limitation @@ -271,7 +272,7 @@ public function testEvaluateInvalidArgument( Limitation $limitation, ValueObject $object, SiteAccessLimitationType $limitationType - ) { + ): void { $this->expectException(InvalidArgumentException::class); $userMock = $this->getUserMock(); @@ -289,7 +290,7 @@ public function testEvaluateInvalidArgument( * * @param \Ibexa\Core\Limitation\SiteAccessLimitationType $limitationType */ - public function testGetCriterion(SiteAccessLimitationType $limitationType) + public function testGetCriterion(SiteAccessLimitationType $limitationType): void { $this->expectException(NotImplementedException::class); @@ -301,7 +302,7 @@ public function testGetCriterion(SiteAccessLimitationType $limitationType) * * @param \Ibexa\Core\Limitation\SiteAccessLimitationType $limitationType */ - public function testValueSchema(SiteAccessLimitationType $limitationType) + public function testValueSchema(SiteAccessLimitationType $limitationType): void { self::markTestSkipped('Method valueSchema() is not implemented'); } diff --git a/tests/lib/Limitation/StatusLimitationTypeTest.php b/tests/lib/Limitation/StatusLimitationTypeTest.php index 5960d445b3..e855bf3aa1 100644 --- a/tests/lib/Limitation/StatusLimitationTypeTest.php +++ b/tests/lib/Limitation/StatusLimitationTypeTest.php @@ -19,6 +19,7 @@ use Ibexa\Core\Limitation\StatusLimitationType; use Ibexa\Core\Repository\Values\Content\VersionInfo; use Ibexa\Core\Repository\Values\User\User; +use PHPUnit\Framework\MockObject\MockObject; /** * Test Case for LimitationType. @@ -28,7 +29,7 @@ class StatusLimitationTypeTest extends Base /** * @return \Ibexa\Core\Limitation\StatusLimitationType */ - public function testConstruct() + public function testConstruct(): StatusLimitationType { return new StatusLimitationType(); } @@ -36,7 +37,7 @@ public function testConstruct() /** * @return array */ - public function providerForTestAcceptValue() + public function providerForTestAcceptValue(): array { return [ [new StatusLimitation()], @@ -63,7 +64,7 @@ public function providerForTestAcceptValue() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\StatusLimitation $limitation * @param \Ibexa\Core\Limitation\StatusLimitationType $limitationType */ - public function testAcceptValue(StatusLimitation $limitation, StatusLimitationType $limitationType) + public function testAcceptValue(StatusLimitation $limitation, StatusLimitationType $limitationType): void { $limitationType->acceptValue($limitation); } @@ -71,7 +72,7 @@ public function testAcceptValue(StatusLimitation $limitation, StatusLimitationTy /** * @return array */ - public function providerForTestAcceptValueException() + public function providerForTestAcceptValueException(): array { return [ [new ObjectStateLimitation()], @@ -87,7 +88,7 @@ public function providerForTestAcceptValueException() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation * @param \Ibexa\Core\Limitation\StatusLimitationType $limitationType */ - public function testAcceptValueException(Limitation $limitation, StatusLimitationType $limitationType) + public function testAcceptValueException(Limitation $limitation, StatusLimitationType $limitationType): void { $this->expectException(InvalidArgumentException::class); @@ -97,7 +98,7 @@ public function testAcceptValueException(Limitation $limitation, StatusLimitatio /** * @return array */ - public function providerForTestValidateError() + public function providerForTestValidateError(): array { return [ [new StatusLimitation(), 0], @@ -157,7 +158,7 @@ public function providerForTestValidateError() * @param int $errorCount * @param \Ibexa\Core\Limitation\StatusLimitationType $limitationType */ - public function testValidateError(StatusLimitation $limitation, $errorCount, StatusLimitationType $limitationType) + public function testValidateError(StatusLimitation $limitation, int $errorCount, StatusLimitationType $limitationType): void { $validationErrors = $limitationType->validate($limitation); self::assertCount($errorCount, $validationErrors); @@ -168,7 +169,7 @@ public function testValidateError(StatusLimitation $limitation, $errorCount, Sta * * @param \Ibexa\Core\Limitation\StatusLimitationType $limitationType */ - public function testBuildValue(StatusLimitationType $limitationType) + public function testBuildValue(StatusLimitationType $limitationType): void { $expected = ['test', 'test' => 9]; $value = $limitationType->buildValue($expected); @@ -178,7 +179,7 @@ public function testBuildValue(StatusLimitationType $limitationType) self::assertEquals($expected, $value->limitationValues); } - protected function getVersionInfoMock($shouldBeCalled = true) + protected function getVersionInfoMock($shouldBeCalled = true): MockObject { $versionInfoMock = $this->getMockBuilder(APIVersionInfo::class) ->disableOriginalConstructor() @@ -201,7 +202,7 @@ protected function getVersionInfoMock($shouldBeCalled = true) return $versionInfoMock; } - protected function getContentMock() + protected function getContentMock(): MockObject { $contentMock = $this->getMockBuilder(APIContent::class) ->setConstructorArgs([]) @@ -219,7 +220,7 @@ protected function getContentMock() /** * @return array */ - public function providerForTestEvaluate() + public function providerForTestEvaluate(): array { return [ // VersionInfo, no access @@ -271,7 +272,7 @@ public function testEvaluate( ValueObject $object, $expected, StatusLimitationType $limitationType - ) { + ): void { $userMock = $this->getUserMock(); $userMock->expects(self::never()) ->method(self::anything()); @@ -290,7 +291,7 @@ public function testEvaluate( /** * @return array */ - public function providerForTestEvaluateInvalidArgument() + public function providerForTestEvaluateInvalidArgument(): array { $versionInfoMock = $this->getMockBuilder(APIVersionInfo::class) ->setConstructorArgs([]) @@ -320,7 +321,7 @@ public function testEvaluateInvalidArgument( Limitation $limitation, ValueObject $object, StatusLimitationType $limitationType - ) { + ): void { $this->expectException(InvalidArgumentException::class); $userMock = $this->getUserMock(); @@ -339,7 +340,7 @@ public function testEvaluateInvalidArgument( * * @param \Ibexa\Core\Limitation\StatusLimitationType $limitationType */ - public function testGetCriterion(StatusLimitationType $limitationType) + public function testGetCriterion(StatusLimitationType $limitationType): void { $this->expectException(NotImplementedException::class); @@ -351,7 +352,7 @@ public function testGetCriterion(StatusLimitationType $limitationType) * * @param \Ibexa\Core\Limitation\StatusLimitationType $limitationType */ - public function testValueSchema(StatusLimitationType $limitationType) + public function testValueSchema(StatusLimitationType $limitationType): void { self::markTestSkipped('Method valueSchema() is not implemented'); } diff --git a/tests/lib/Limitation/SubtreeLimitationTypeTest.php b/tests/lib/Limitation/SubtreeLimitationTypeTest.php index eb7464c8f8..08070ea81b 100644 --- a/tests/lib/Limitation/SubtreeLimitationTypeTest.php +++ b/tests/lib/Limitation/SubtreeLimitationTypeTest.php @@ -26,6 +26,7 @@ use Ibexa\Core\Repository\Values\Content\ContentCreateStruct; use Ibexa\Core\Repository\Values\Content\Location; use Ibexa\Core\Repository\Values\Content\Query\Criterion\PermissionSubtree; +use PHPUnit\Framework\MockObject\MockObject; /** * Test Case for LimitationType. @@ -33,7 +34,7 @@ class SubtreeLimitationTypeTest extends Base { /** @var \Ibexa\Contracts\Core\Persistence\Content\Location\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $locationHandlerMock; + private MockObject $locationHandlerMock; /** * Setup Location Handler mock. @@ -56,7 +57,7 @@ protected function tearDown(): void /** * @return \Ibexa\Core\Limitation\SubtreeLimitationType */ - public function testConstruct() + public function testConstruct(): SubtreeLimitationType { return new SubtreeLimitationType($this->getPersistenceMock()); } @@ -64,7 +65,7 @@ public function testConstruct() /** * @return array */ - public function providerForTestAcceptValue() + public function providerForTestAcceptValue(): array { return [ [new SubtreeLimitation()], @@ -81,7 +82,7 @@ public function providerForTestAcceptValue() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\SubtreeLimitation $limitation * @param \Ibexa\Core\Limitation\SubtreeLimitationType $limitationType */ - public function testAcceptValue(SubtreeLimitation $limitation, SubtreeLimitationType $limitationType) + public function testAcceptValue(SubtreeLimitation $limitation, SubtreeLimitationType $limitationType): void { $limitationType->acceptValue($limitation); } @@ -89,7 +90,7 @@ public function testAcceptValue(SubtreeLimitation $limitation, SubtreeLimitation /** * @return array */ - public function providerForTestAcceptValueException() + public function providerForTestAcceptValueException(): array { return [ [new ObjectStateLimitation()], @@ -108,7 +109,7 @@ public function providerForTestAcceptValueException() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation * @param \Ibexa\Core\Limitation\SubtreeLimitationType $limitationType */ - public function testAcceptValueException(Limitation $limitation, SubtreeLimitationType $limitationType) + public function testAcceptValueException(Limitation $limitation, SubtreeLimitationType $limitationType): void { $this->expectException(InvalidArgumentException::class); @@ -118,7 +119,7 @@ public function testAcceptValueException(Limitation $limitation, SubtreeLimitati /** * @return array */ - public function providerForTestValidatePass() + public function providerForTestValidatePass(): array { return [ [new SubtreeLimitation()], @@ -132,7 +133,7 @@ public function providerForTestValidatePass() * * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\SubtreeLimitation $limitation */ - public function testValidatePass(SubtreeLimitation $limitation) + public function testValidatePass(SubtreeLimitation $limitation): void { if (!empty($limitation->limitationValues)) { $this->getPersistenceMock() @@ -164,7 +165,7 @@ public function testValidatePass(SubtreeLimitation $limitation) /** * @return array */ - public function providerForTestValidateError() + public function providerForTestValidateError(): array { return [ [new SubtreeLimitation(), 0], @@ -179,7 +180,7 @@ public function providerForTestValidateError() * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation\SubtreeLimitation $limitation * @param int $errorCount */ - public function testValidateError(SubtreeLimitation $limitation, $errorCount) + public function testValidateError(SubtreeLimitation $limitation, int $errorCount): void { if (!empty($limitation->limitationValues)) { $this->getPersistenceMock() @@ -208,7 +209,7 @@ public function testValidateError(SubtreeLimitation $limitation, $errorCount) self::assertCount($errorCount, $validationErrors); } - public function testValidateErrorWrongPath() + public function testValidateErrorWrongPath(): void { $limitation = new SubtreeLimitation(['limitationValues' => ['/1/2/42/']]); @@ -242,7 +243,7 @@ public function testValidateErrorWrongPath() * * @param \Ibexa\Core\Limitation\SubtreeLimitationType $limitationType */ - public function testBuildValue(SubtreeLimitationType $limitationType) + public function testBuildValue(SubtreeLimitationType $limitationType): void { $expected = ['test', 'test' => '/1/999/']; $value = $limitationType->buildValue($expected); @@ -255,7 +256,7 @@ public function testBuildValue(SubtreeLimitationType $limitationType) /** * @return array */ - public function providerForTestEvaluate() + public function providerForTestEvaluate(): array { // Mocks for testing Content & VersionInfo objects, should only be used once because of expect rules. $contentMock = $this->createMock(APIContent::class); @@ -403,7 +404,7 @@ public function testEvaluate( $targets, array $persistenceLocations, $expected - ) { + ): void { // Need to create inline instead of depending on testConstruct() to get correct mock instance $limitationType = $this->testConstruct(); @@ -456,7 +457,7 @@ public function testEvaluate( /** * @return array */ - public function providerForTestEvaluateInvalidArgument() + public function providerForTestEvaluateInvalidArgument(): array { return [ // invalid limitation @@ -482,9 +483,9 @@ public function providerForTestEvaluateInvalidArgument() public function testEvaluateInvalidArgument( Limitation $limitation, ValueObject $object, - $targets, + ?array $targets, array $persistenceLocations - ) { + ): void { $this->expectException(InvalidArgumentException::class); // Need to create inline instead of depending on testConstruct() to get correct mock instance @@ -514,7 +515,7 @@ public function testEvaluateInvalidArgument( * * @param \Ibexa\Core\Limitation\SubtreeLimitationType $limitationType */ - public function testGetCriterionInvalidValue(SubtreeLimitationType $limitationType) + public function testGetCriterionInvalidValue(SubtreeLimitationType $limitationType): void { $this->expectException(\RuntimeException::class); @@ -529,7 +530,7 @@ public function testGetCriterionInvalidValue(SubtreeLimitationType $limitationTy * * @param \Ibexa\Core\Limitation\SubtreeLimitationType $limitationType */ - public function testGetCriterionSingleValue(SubtreeLimitationType $limitationType) + public function testGetCriterionSingleValue(SubtreeLimitationType $limitationType): void { $criterion = $limitationType->getCriterion( new SubtreeLimitation(['limitationValues' => ['/1/9/']]), @@ -550,7 +551,7 @@ public function testGetCriterionSingleValue(SubtreeLimitationType $limitationTyp * * @param \Ibexa\Core\Limitation\SubtreeLimitationType $limitationType */ - public function testGetCriterionMultipleValues(SubtreeLimitationType $limitationType) + public function testGetCriterionMultipleValues(SubtreeLimitationType $limitationType): void { $criterion = $limitationType->getCriterion( new SubtreeLimitation(['limitationValues' => ['/1/9/', '/1/55/']]), @@ -571,7 +572,7 @@ public function testGetCriterionMultipleValues(SubtreeLimitationType $limitation * * @param \Ibexa\Core\Limitation\SubtreeLimitationType $limitationType */ - public function testValueSchema(SubtreeLimitationType $limitationType) + public function testValueSchema(SubtreeLimitationType $limitationType): void { self::assertEquals( SubtreeLimitationType::VALUE_SCHEMA_LOCATION_PATH, diff --git a/tests/lib/MVC/Symfony/Component/Serializer/Stubs/CompoundStub.php b/tests/lib/MVC/Symfony/Component/Serializer/Stubs/CompoundStub.php index fa3e894fe0..e3c9683402 100644 --- a/tests/lib/MVC/Symfony/Component/Serializer/Stubs/CompoundStub.php +++ b/tests/lib/MVC/Symfony/Component/Serializer/Stubs/CompoundStub.php @@ -19,12 +19,12 @@ public function __construct(array $subMatchers) $this->subMatchers = $subMatchers; } - public function match() + public function match(): never { throw new NotImplementedException(__METHOD__); } - public function reverseMatch($siteAccessName) + public function reverseMatch($siteAccessName): never { throw new NotImplementedException(__METHOD__); } diff --git a/tests/lib/MVC/Symfony/Component/Serializer/Stubs/MatcherStub.php b/tests/lib/MVC/Symfony/Component/Serializer/Stubs/MatcherStub.php index 93df93a591..42843fe793 100644 --- a/tests/lib/MVC/Symfony/Component/Serializer/Stubs/MatcherStub.php +++ b/tests/lib/MVC/Symfony/Component/Serializer/Stubs/MatcherStub.php @@ -22,17 +22,17 @@ public function __construct($data = null) $this->data = $data; } - public function setRequest(SimplifiedRequest $request) + public function setRequest(SimplifiedRequest $request): never { throw new NotImplementedException(__METHOD__); } - public function match() + public function match(): never { throw new NotImplementedException(__METHOD__); } - public function getName() + public function getName(): never { throw new NotImplementedException(__METHOD__); } diff --git a/tests/lib/MVC/Symfony/Component/Serializer/Stubs/RegexMatcher.php b/tests/lib/MVC/Symfony/Component/Serializer/Stubs/RegexMatcher.php index 5ce34687a8..991669b78d 100644 --- a/tests/lib/MVC/Symfony/Component/Serializer/Stubs/RegexMatcher.php +++ b/tests/lib/MVC/Symfony/Component/Serializer/Stubs/RegexMatcher.php @@ -13,7 +13,7 @@ final class RegexMatcher extends BaseRegex { - public function getName() + public function getName(): never { throw new NotImplementedException(__METHOD__); } diff --git a/tests/lib/MVC/Symfony/Controller/ControllerTest.php b/tests/lib/MVC/Symfony/Controller/ControllerTest.php index 093615627c..cb1bb39264 100644 --- a/tests/lib/MVC/Symfony/Controller/ControllerTest.php +++ b/tests/lib/MVC/Symfony/Controller/ControllerTest.php @@ -8,6 +8,7 @@ namespace Ibexa\Tests\Core\MVC\Symfony\Controller; use Ibexa\Core\MVC\Symfony\Controller\Controller; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Response; @@ -21,13 +22,13 @@ class ControllerTest extends TestCase { /** @var \Ibexa\Core\MVC\Symfony\Controller\Controller */ - protected $controller; + protected MockObject $controller; /** @var \PHPUnit\Framework\MockObject\MockObject */ - protected $templateEngineMock; + protected MockObject $templateEngineMock; /** @var \PHPUnit\Framework\MockObject\MockObject */ - protected $containerMock; + protected MockObject $containerMock; protected function setUp(): void { @@ -42,7 +43,7 @@ protected function setUp(): void ->will(self::returnValue($this->templateEngineMock)); } - public function testRender() + public function testRender(): void { $view = 'some:valid:view.html.twig'; $params = ['foo' => 'bar', 'truc' => 'muche']; @@ -57,7 +58,7 @@ public function testRender() self::assertSame($tplResult, $response->getContent()); } - public function testRenderWithResponse() + public function testRenderWithResponse(): void { $response = new Response(); $view = 'some:valid:view.html.twig'; diff --git a/tests/lib/MVC/Symfony/Event/RouteReferenceGenerationEventTest.php b/tests/lib/MVC/Symfony/Event/RouteReferenceGenerationEventTest.php index 09c47f2133..79cb947c98 100644 --- a/tests/lib/MVC/Symfony/Event/RouteReferenceGenerationEventTest.php +++ b/tests/lib/MVC/Symfony/Event/RouteReferenceGenerationEventTest.php @@ -14,7 +14,7 @@ class RouteReferenceGenerationEventTest extends TestCase { - public function testConstruct() + public function testConstruct(): void { $routeReference = new RouteReference('foo'); $request = new Request(); @@ -23,7 +23,7 @@ public function testConstruct() self::assertSame($request, $event->getRequest()); } - public function testGetSet() + public function testGetSet(): void { $routeReference = new RouteReference('foo'); $request = new Request(); diff --git a/tests/lib/MVC/Symfony/Event/ScopeChangeEventTest.php b/tests/lib/MVC/Symfony/Event/ScopeChangeEventTest.php index c44d0c463b..8869d4efb5 100644 --- a/tests/lib/MVC/Symfony/Event/ScopeChangeEventTest.php +++ b/tests/lib/MVC/Symfony/Event/ScopeChangeEventTest.php @@ -13,7 +13,7 @@ class ScopeChangeEventTest extends TestCase { - public function testGetSiteAccess() + public function testGetSiteAccess(): void { $siteAccess = new SiteAccess('foo', 'test'); $event = new ScopeChangeEvent($siteAccess); diff --git a/tests/lib/MVC/Symfony/EventListener/ContentViewTwigVariablesSubscriberTest.php b/tests/lib/MVC/Symfony/EventListener/ContentViewTwigVariablesSubscriberTest.php index 9732352854..4af21247f1 100644 --- a/tests/lib/MVC/Symfony/EventListener/ContentViewTwigVariablesSubscriberTest.php +++ b/tests/lib/MVC/Symfony/EventListener/ContentViewTwigVariablesSubscriberTest.php @@ -45,7 +45,7 @@ private function getRegistry(array $providers): GenericVariableProviderRegistry private function getProvider(string $identifier): VariableProvider { return new class($identifier) implements VariableProvider { - private $identifier; + private string $identifier; public function __construct(string $identifier) { diff --git a/tests/lib/MVC/Symfony/EventListener/LanguageSwitchListenerTest.php b/tests/lib/MVC/Symfony/EventListener/LanguageSwitchListenerTest.php index ce13fc1191..94fa73d125 100644 --- a/tests/lib/MVC/Symfony/EventListener/LanguageSwitchListenerTest.php +++ b/tests/lib/MVC/Symfony/EventListener/LanguageSwitchListenerTest.php @@ -12,13 +12,14 @@ use Ibexa\Core\MVC\Symfony\EventListener\LanguageSwitchListener; use Ibexa\Core\MVC\Symfony\MVCEvents; use Ibexa\Core\MVC\Symfony\Routing\RouteReference; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; class LanguageSwitchListenerTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $translationHelper; + private MockObject $translationHelper; protected function setUp(): void { @@ -28,7 +29,7 @@ protected function setUp(): void ->getMock(); } - public function testGetSubscribedEvents() + public function testGetSubscribedEvents(): void { self::assertSame( [MVCEvents::ROUTE_REFERENCE_GENERATION => 'onRouteReferenceGeneration'], @@ -36,7 +37,7 @@ public function testGetSubscribedEvents() ); } - public function testOnRouteReferenceGenerationNoLanguage() + public function testOnRouteReferenceGenerationNoLanguage(): void { $this->translationHelper ->expects(self::never()) @@ -47,7 +48,7 @@ public function testOnRouteReferenceGenerationNoLanguage() $listener->onRouteReferenceGeneration($event); } - public function testOnRouteReferenceGeneration() + public function testOnRouteReferenceGeneration(): void { $language = 'fre-FR'; $routeReference = new RouteReference('foo', ['language' => $language]); @@ -66,7 +67,7 @@ public function testOnRouteReferenceGeneration() self::assertSame($expectedSiteAccess, $routeReference->get('siteaccess')); } - public function testOnRouteReferenceGenerationNoTranslationSiteAccess() + public function testOnRouteReferenceGenerationNoTranslationSiteAccess(): void { $language = 'fre-FR'; $routeReference = new RouteReference('foo', ['language' => $language]); diff --git a/tests/lib/MVC/Symfony/FieldType/ImageAsset/ParameterProviderTest.php b/tests/lib/MVC/Symfony/FieldType/ImageAsset/ParameterProviderTest.php index c6af688b58..266f4b4dc7 100644 --- a/tests/lib/MVC/Symfony/FieldType/ImageAsset/ParameterProviderTest.php +++ b/tests/lib/MVC/Symfony/FieldType/ImageAsset/ParameterProviderTest.php @@ -17,21 +17,22 @@ use Ibexa\Core\FieldType\ImageAsset\Value as ImageAssetValue; use Ibexa\Core\MVC\Symfony\FieldType\ImageAsset\ParameterProvider; use Ibexa\Core\Repository\SiteAccessAware\Repository; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ParameterProviderTest extends TestCase { /** @var \Ibexa\Core\Repository\SiteAccessAware\Repository|\PHPUnit\Framework\MockObject\MockObject */ - private $repository; + private MockObject $repository; /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver|\PHPUnit\Framework\MockObject\MockObject */ - private $permissionsResolver; + private MockObject $permissionsResolver; /** @var \Ibexa\Core\MVC\Symfony\FieldType\ImageAsset\ParameterProvider */ - private $parameterProvider; + private ParameterProvider $parameterProvider; /** @var \Ibexa\Contracts\Core\Repository\FieldType|\PHPUnit\Framework\MockObject\MockObject */ - private $fieldType; + private MockObject $fieldType; protected function setUp(): void { @@ -68,7 +69,7 @@ public function dataProviderForTestGetViewParameters(): array /** * @dataProvider dataProviderForTestGetViewParameters */ - public function testGetViewParameters($status, array $expected): void + public function testGetViewParameters(int $status, array $expected): void { $destinationContentId = 1; @@ -76,7 +77,7 @@ public function testGetViewParameters($status, array $expected): void ->method('isEmptyValue') ->willReturn(false); - $closure = static function (Repository $repository) use ($destinationContentId) { + $closure = static function (Repository $repository) use ($destinationContentId): \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo { return $repository->getContentService()->loadContentInfo($destinationContentId); }; @@ -104,7 +105,7 @@ public function testGetViewParametersHandleNotFoundException(): void ->method('isEmptyValue') ->willReturn(false); - $closure = static function (Repository $repository) use ($destinationContentId) { + $closure = static function (Repository $repository) use ($destinationContentId): \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo { return $repository->getContentService()->loadContentInfo($destinationContentId); }; diff --git a/tests/lib/MVC/Symfony/FieldType/Relation/ParameterProviderTest.php b/tests/lib/MVC/Symfony/FieldType/Relation/ParameterProviderTest.php index 5000f84fc3..cb0efbc461 100644 --- a/tests/lib/MVC/Symfony/FieldType/Relation/ParameterProviderTest.php +++ b/tests/lib/MVC/Symfony/FieldType/Relation/ParameterProviderTest.php @@ -18,7 +18,7 @@ class ParameterProviderTest extends TestCase { - public function providerForTestGetViewParameters() + public function providerForTestGetViewParameters(): array { return [ [ContentInfo::STATUS_DRAFT, ['available' => true]], @@ -30,7 +30,7 @@ public function providerForTestGetViewParameters() /** * @dataProvider providerForTestGetViewParameters */ - public function testGetViewParameters($status, array $expected) + public function testGetViewParameters(int $status, array $expected): void { $contentServiceMock = $this->createMock(ContentService::class); $contentServiceMock @@ -47,7 +47,7 @@ public function testGetViewParameters($status, array $expected) TestCase::assertSame($parameters, $expected); } - public function testNotFoundGetViewParameters() + public function testNotFoundGetViewParameters(): void { $contentId = 123; @@ -64,7 +64,7 @@ public function testNotFoundGetViewParameters() TestCase::assertSame($parameters, ['available' => false]); } - public function testUnauthorizedGetViewParameters() + public function testUnauthorizedGetViewParameters(): void { $contentId = 123; diff --git a/tests/lib/MVC/Symfony/FieldType/RelationList/ParameterProviderTest.php b/tests/lib/MVC/Symfony/FieldType/RelationList/ParameterProviderTest.php index 7a5aa2df1b..dfa4665251 100644 --- a/tests/lib/MVC/Symfony/FieldType/RelationList/ParameterProviderTest.php +++ b/tests/lib/MVC/Symfony/FieldType/RelationList/ParameterProviderTest.php @@ -16,7 +16,7 @@ class ParameterProviderTest extends TestCase { - public function providerForTestGetViewParameters() + public function providerForTestGetViewParameters(): array { return [ [[123, 456, 789], ['available' => [123 => true, 456 => true, 789 => false]]], @@ -29,13 +29,13 @@ public function providerForTestGetViewParameters() /** * @dataProvider providerForTestGetViewParameters */ - public function testGetViewParameters(array $desinationContentIds, array $expected) + public function testGetViewParameters(array $desinationContentIds, array $expected): void { $contentServiceMock = $this->createMock(ContentService::class); $contentServiceMock ->method('loadContentInfoList') ->with($desinationContentIds) - ->will(self::returnCallback(static function ($arg) { + ->will(self::returnCallback(static function ($arg): array { $return = []; if (in_array(123, $arg)) { $return[123] = new ContentInfo(['status' => ContentInfo::STATUS_DRAFT]); @@ -60,7 +60,7 @@ public function testGetViewParameters(array $desinationContentIds, array $expect TestCase::assertSame($parameters, $expected); } - public function testNotFoundGetViewParameters() + public function testNotFoundGetViewParameters(): void { $contentId = 123; @@ -78,7 +78,7 @@ public function testNotFoundGetViewParameters() TestCase::assertSame($parameters, ['available' => [$contentId => false]]); } - public function testUnauthorizedGetViewParameters() + public function testUnauthorizedGetViewParameters(): void { $contentId = 123; diff --git a/tests/lib/MVC/Symfony/FieldType/User/ParameterProviderTest.php b/tests/lib/MVC/Symfony/FieldType/User/ParameterProviderTest.php index 4efcc292c7..2aeeacc9cf 100644 --- a/tests/lib/MVC/Symfony/FieldType/User/ParameterProviderTest.php +++ b/tests/lib/MVC/Symfony/FieldType/User/ParameterProviderTest.php @@ -16,6 +16,7 @@ use Ibexa\Contracts\Core\Repository\Values\User\User; use Ibexa\Core\FieldType\User\Value; use Ibexa\Core\MVC\Symfony\FieldType\User\ParameterProvider; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ParameterProviderTest extends TestCase @@ -23,13 +24,13 @@ class ParameterProviderTest extends TestCase private const EXAMPLE_USER_ID = 1; /** @var \Ibexa\Contracts\Core\Repository\UserService|\PHPUnit\Framework\MockObject\MockObject */ - private $userService; + private MockObject $userService; /** @var \Ibexa\Contracts\Core\Repository\Values\User\User|\PHPUnit\Framework\MockObject\MockObject */ - private $user; + private MockObject $user; /** @var \Ibexa\Core\MVC\Symfony\FieldType\User\ParameterProvider */ - private $parameterProvider; + private ParameterProvider $parameterProvider; protected function setUp(): void { diff --git a/tests/lib/MVC/Symfony/FieldType/View/ParameterProvider/LocaleParameterProviderTest.php b/tests/lib/MVC/Symfony/FieldType/View/ParameterProvider/LocaleParameterProviderTest.php index 3b76fdbefb..aaaa045157 100644 --- a/tests/lib/MVC/Symfony/FieldType/View/ParameterProvider/LocaleParameterProviderTest.php +++ b/tests/lib/MVC/Symfony/FieldType/View/ParameterProvider/LocaleParameterProviderTest.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Core\MVC\Symfony\FieldType\View\ParameterProvider\LocaleParameterProvider; use Ibexa\Core\MVC\Symfony\Locale\LocaleConverterInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\Request; @@ -17,7 +18,7 @@ class LocaleParameterProviderTest extends TestCase { - public function providerForTestGetViewParameters() + public function providerForTestGetViewParameters(): array { return [ [true, 'fr_FR'], @@ -28,7 +29,7 @@ public function providerForTestGetViewParameters() /** * @dataProvider providerForTestGetViewParameters */ - public function testGetViewParameters($hasRequestLocale, $expectedLocale) + public function testGetViewParameters(bool $hasRequestLocale, string $expectedLocale): void { $field = new Field(['languageCode' => 'cro-HR']); $parameterProvider = new LocaleParameterProvider($this->getLocaleConverterMock()); @@ -39,7 +40,7 @@ public function testGetViewParameters($hasRequestLocale, $expectedLocale) ); } - protected function getRequestStackMock($hasLocale) + protected function getRequestStackMock($hasLocale): RequestStack { $requestStack = new RequestStack(); $parameterBagMock = $this->createMock(ParameterBag::class); @@ -62,7 +63,7 @@ protected function getRequestStackMock($hasLocale) return $requestStack; } - protected function getLocaleConverterMock() + protected function getLocaleConverterMock(): MockObject { $mock = $this->createMock(LocaleConverterInterface::class); diff --git a/tests/lib/MVC/Symfony/FieldType/View/ParameterProviderRegistryTest.php b/tests/lib/MVC/Symfony/FieldType/View/ParameterProviderRegistryTest.php index cfe023e1e9..98c6897fd9 100644 --- a/tests/lib/MVC/Symfony/FieldType/View/ParameterProviderRegistryTest.php +++ b/tests/lib/MVC/Symfony/FieldType/View/ParameterProviderRegistryTest.php @@ -16,7 +16,7 @@ */ class ParameterProviderRegistryTest extends TestCase { - public function testSetHasParameterProvider() + public function testSetHasParameterProvider(): void { $registry = new ParameterProviderRegistry(); self::assertFalse($registry->hasParameterProvider('foo')); @@ -27,7 +27,7 @@ public function testSetHasParameterProvider() self::assertTrue($registry->hasParameterProvider('foo')); } - public function testGetParameterProviderFail() + public function testGetParameterProviderFail(): void { $this->expectException(\InvalidArgumentException::class); @@ -35,7 +35,7 @@ public function testGetParameterProviderFail() $registry->getParameterProvider('foo'); } - public function testGetParameterProvider() + public function testGetParameterProvider(): void { $provider = $this->createMock(ParameterProviderInterface::class); $registry = new ParameterProviderRegistry(); diff --git a/tests/lib/MVC/Symfony/Locale/UserLanguagePreferenceProviderTest.php b/tests/lib/MVC/Symfony/Locale/UserLanguagePreferenceProviderTest.php index 8c70d0bccf..48a2b4d3ef 100644 --- a/tests/lib/MVC/Symfony/Locale/UserLanguagePreferenceProviderTest.php +++ b/tests/lib/MVC/Symfony/Locale/UserLanguagePreferenceProviderTest.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Repository\Values\UserPreference\UserPreference; use Ibexa\Core\Base\Exceptions\NotFoundException; use Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProvider; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\HeaderBag; use Symfony\Component\HttpFoundation\Request; @@ -25,13 +26,13 @@ class UserLanguagePreferenceProviderTest extends TestCase private const LANGUAGE_PREFERENCE_VALUE = 'no'; /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ - private $userLanguagePreferenceProvider; + private UserLanguagePreferenceProvider $userLanguagePreferenceProvider; /** @var \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\HttpFoundation\RequestStack */ - private $requestStackMock; + private MockObject $requestStackMock; /** @var \Ibexa\Contracts\Core\Repository\UserPreferenceService */ - private $userPreferenceServiceMock; + private MockObject $userPreferenceServiceMock; protected function setUp(): void { diff --git a/tests/lib/MVC/Symfony/Matcher/ContentBased/DepthTest.php b/tests/lib/MVC/Symfony/Matcher/ContentBased/DepthTest.php index f3e8732076..98f0442fa6 100644 --- a/tests/lib/MVC/Symfony/Matcher/ContentBased/DepthTest.php +++ b/tests/lib/MVC/Symfony/Matcher/ContentBased/DepthTest.php @@ -10,12 +10,13 @@ use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Depth; use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Depth as DepthMatcher; class DepthTest extends BaseTest { /** @var \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Depth */ - private $matcher; + private Depth $matcher; protected function setUp(): void { @@ -33,13 +34,13 @@ protected function setUp(): void * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location * @param bool $expectedResult */ - public function testMatchLocation($matchingConfig, Location $location, $expectedResult) + public function testMatchLocation(int|array $matchingConfig, Location $location, bool $expectedResult): void { $this->matcher->setMatchingConfig($matchingConfig); self::assertSame($expectedResult, $this->matcher->matchLocation($location)); } - public function matchLocationProvider() + public function matchLocationProvider(): array { return [ [ @@ -86,7 +87,7 @@ public function matchLocationProvider() * @param \Ibexa\Contracts\Core\Repository\Repository $repository * @param bool $expectedResult */ - public function testMatchContentInfo($matchingConfig, Repository $repository, $expectedResult) + public function testMatchContentInfo(int|array $matchingConfig, Repository $repository, bool $expectedResult): void { $this->matcher->setRepository($repository); $this->matcher->setMatchingConfig($matchingConfig); @@ -96,7 +97,7 @@ public function testMatchContentInfo($matchingConfig, Repository $repository, $e ); } - public function matchContentInfoProvider() + public function matchContentInfoProvider(): array { return [ [ @@ -129,7 +130,7 @@ public function matchContentInfoProvider() * * @return \PHPUnit\Framework\MockObject\MockObject */ - private function generateRepositoryMockForDepth($depth) + private function generateRepositoryMockForDepth(int $depth) { $locationServiceMock = $this->createMock(LocationService::class); $locationServiceMock->expects(self::once()) diff --git a/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTest.php b/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTest.php index 2959b0219d..f268edf72e 100644 --- a/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTest.php +++ b/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTest.php @@ -9,13 +9,14 @@ use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\Content; use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\Content as ContentIdMatcher; use Ibexa\Tests\Core\MVC\Symfony\Matcher\ContentBased\BaseTest; class ContentTest extends BaseTest { /** @var \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\Content */ - private $matcher; + private Content $matcher; protected function setUp(): void { @@ -33,13 +34,13 @@ protected function setUp(): void * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location * @param bool $expectedResult */ - public function testMatchLocation($matchingConfig, Location $location, $expectedResult) + public function testMatchLocation(int|array $matchingConfig, Location $location, bool $expectedResult): void { $this->matcher->setMatchingConfig($matchingConfig); self::assertSame($expectedResult, $this->matcher->matchLocation($location)); } - public function matchLocationProvider() + public function matchLocationProvider(): array { return [ [ @@ -72,7 +73,7 @@ public function matchLocationProvider() * * @return \PHPUnit\Framework\MockObject\MockObject */ - private function generateLocationForContentId($contentId) + private function generateLocationForContentId(int $contentId) { $location = $this->getLocationMock(); $location @@ -97,13 +98,13 @@ private function generateLocationForContentId($contentId) * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo * @param bool $expectedResult */ - public function testMatchContentInfo($matchingConfig, ContentInfo $contentInfo, $expectedResult) + public function testMatchContentInfo(int|array $matchingConfig, ContentInfo $contentInfo, bool $expectedResult): void { $this->matcher->setMatchingConfig($matchingConfig); self::assertSame($expectedResult, $this->matcher->matchContentInfo($contentInfo)); } - public function matchContentInfoProvider() + public function matchContentInfoProvider(): array { return [ [ diff --git a/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTypeGroupTest.php b/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTypeGroupTest.php index 8c6370436c..03938bef84 100644 --- a/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTypeGroupTest.php +++ b/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTypeGroupTest.php @@ -17,7 +17,7 @@ class ContentTypeGroupTest extends BaseTest { /** @var \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\ContentTypeGroup */ - private $matcher; + private ContentTypeGroupIdMatcher $matcher; protected function setUp(): void { @@ -35,7 +35,7 @@ protected function setUp(): void * @param \Ibexa\Contracts\Core\Repository\Repository $repository * @param bool $expectedResult */ - public function testMatchLocation($matchingConfig, Repository $repository, $expectedResult) + public function testMatchLocation($matchingConfig, Repository $repository, $expectedResult): void { $this->matcher->setRepository($repository); $this->matcher->setMatchingConfig($matchingConfig); @@ -46,7 +46,7 @@ public function testMatchLocation($matchingConfig, Repository $repository, $expe ); } - public function matchLocationProvider() + public function matchLocationProvider(): array { $data = []; @@ -107,7 +107,7 @@ private function generateLocationMock() * @param \Ibexa\Contracts\Core\Repository\Repository $repository * @param bool $expectedResult */ - public function testMatchContentInfo($matchingConfig, Repository $repository, $expectedResult) + public function testMatchContentInfo($matchingConfig, Repository $repository, $expectedResult): void { $this->matcher->setRepository($repository); $this->matcher->setMatchingConfig($matchingConfig); @@ -118,7 +118,7 @@ public function testMatchContentInfo($matchingConfig, Repository $repository, $e ); } - public function matchContentInfoProvider() + public function matchContentInfoProvider(): array { $data = []; @@ -156,7 +156,7 @@ public function matchContentInfoProvider() * * @return \PHPUnit\Framework\MockObject\MockObject */ - private function generateRepositoryMockForContentTypeGroupId($contentTypeGroupId) + private function generateRepositoryMockForContentTypeGroupId(int $contentTypeGroupId) { $contentTypeServiceMock = $this->createMock(ContentTypeService::class); $contentTypeMock = $this->getMockForAbstractClass(ContentType::class); diff --git a/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTypeTest.php b/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTypeTest.php index df7b957a80..28b95f08f9 100644 --- a/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTypeTest.php +++ b/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ContentTypeTest.php @@ -9,13 +9,14 @@ use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\ContentType; use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\ContentType as ContentTypeIdMatcher; use Ibexa\Tests\Core\MVC\Symfony\Matcher\ContentBased\BaseTest; class ContentTypeTest extends BaseTest { /** @var \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\ContentType */ - private $matcher; + private ContentType $matcher; protected function setUp(): void { @@ -33,13 +34,13 @@ protected function setUp(): void * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location * @param bool $expectedResult */ - public function testMatchLocation($matchingConfig, Location $location, $expectedResult) + public function testMatchLocation($matchingConfig, Location $location, $expectedResult): void { $this->matcher->setMatchingConfig($matchingConfig); self::assertSame($expectedResult, $this->matcher->matchLocation($location)); } - public function matchLocationProvider() + public function matchLocationProvider(): array { $data = []; @@ -77,7 +78,7 @@ public function matchLocationProvider() * * @return \PHPUnit\Framework\MockObject\MockObject */ - private function generateLocationForContentType($contentTypeId) + private function generateLocationForContentType(int $contentTypeId) { $location = $this->getLocationMock(); $location @@ -114,13 +115,13 @@ private function generateContentInfoForContentType($contentTypeId) * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo * @param bool $expectedResult */ - public function testMatchContentInfo($matchingConfig, ContentInfo $contentInfo, $expectedResult) + public function testMatchContentInfo($matchingConfig, ContentInfo $contentInfo, $expectedResult): void { $this->matcher->setMatchingConfig($matchingConfig); self::assertSame($expectedResult, $this->matcher->matchContentInfo($contentInfo)); } - public function matchContentInfoProvider() + public function matchContentInfoProvider(): array { $data = []; diff --git a/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/LocationTest.php b/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/LocationTest.php index 6ad5d5464b..ac49ebf1b1 100644 --- a/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/LocationTest.php +++ b/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/LocationTest.php @@ -15,7 +15,7 @@ class LocationTest extends BaseTest { /** @var \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\Location */ - private $matcher; + private LocationIdMatcher $matcher; protected function setUp(): void { @@ -33,13 +33,13 @@ protected function setUp(): void * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location * @param bool $expectedResult */ - public function testMatchLocation($matchingConfig, Location $location, $expectedResult) + public function testMatchLocation(int|array $matchingConfig, Location $location, bool $expectedResult): void { $this->matcher->setMatchingConfig($matchingConfig); self::assertSame($expectedResult, $this->matcher->matchLocation($location)); } - public function matchLocationProvider() + public function matchLocationProvider(): array { return [ [ @@ -75,13 +75,13 @@ public function matchLocationProvider() * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo * @param bool $expectedResult */ - public function testMatchContentInfo($matchingConfig, ContentInfo $contentInfo, $expectedResult) + public function testMatchContentInfo(int|array $matchingConfig, ContentInfo $contentInfo, bool $expectedResult): void { $this->matcher->setMatchingConfig($matchingConfig); self::assertSame($expectedResult, $this->matcher->matchContentInfo($contentInfo)); } - public function matchContentInfoProvider() + public function matchContentInfoProvider(): array { return [ [ diff --git a/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentContentTypeTest.php b/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentContentTypeTest.php index 28f0db3723..45ee288337 100644 --- a/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentContentTypeTest.php +++ b/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentContentTypeTest.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Repository; +use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\ParentContentType; use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\ParentContentType as ParentContentTypeMatcher; use Ibexa\Tests\Core\MVC\Symfony\Matcher\ContentBased\BaseTest; @@ -18,7 +19,7 @@ class ParentContentTypeTest extends BaseTest private const EXAMPLE_PARENT_LOCATION_ID = 2; /** @var \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\ParentContentType */ - private $matcher; + private ParentContentType $matcher; protected function setUp(): void { @@ -33,7 +34,7 @@ protected function setUp(): void * * @return \PHPUnit\Framework\MockObject\MockObject */ - private function generateRepositoryMockForContentTypeId($contentTypeId) + private function generateRepositoryMockForContentTypeId(int $contentTypeId) { $parentContentInfo = $this->getContentInfoMock([ 'contentTypeId' => $contentTypeId, @@ -87,7 +88,7 @@ private function generateRepositoryMockForContentTypeId($contentTypeId) * @param \Ibexa\Contracts\Core\Repository\Repository $repository * @param bool $expectedResult */ - public function testMatchLocation($matchingConfig, Repository $repository, $expectedResult) + public function testMatchLocation(int|array $matchingConfig, Repository $repository, bool $expectedResult): void { $this->matcher->setRepository($repository); $this->matcher->setMatchingConfig($matchingConfig); @@ -97,7 +98,7 @@ public function testMatchLocation($matchingConfig, Repository $repository, $expe ); } - public function matchLocationProvider() + public function matchLocationProvider(): array { return [ [ @@ -134,7 +135,7 @@ public function matchLocationProvider() * @param \Ibexa\Contracts\Core\Repository\Repository $repository * @param bool $expectedResult */ - public function testMatchContentInfo($matchingConfig, Repository $repository, $expectedResult) + public function testMatchContentInfo(int|array $matchingConfig, Repository $repository, bool $expectedResult): void { $this->matcher->setRepository($repository); $this->matcher->setMatchingConfig($matchingConfig); diff --git a/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentLocationTest.php b/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentLocationTest.php index 08e3775115..1a2bd39937 100644 --- a/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentLocationTest.php +++ b/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/ParentLocationTest.php @@ -10,13 +10,14 @@ use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\ParentLocation; use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\ParentLocation as ParentLocationIdMatcher; use Ibexa\Tests\Core\MVC\Symfony\Matcher\ContentBased\BaseTest; class ParentLocationTest extends BaseTest { /** @var \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\ParentLocation */ - private $matcher; + private ParentLocation $matcher; protected function setUp(): void { @@ -34,13 +35,13 @@ protected function setUp(): void * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location * @param bool $expectedResult */ - public function testMatchLocation($matchingConfig, Location $location, $expectedResult) + public function testMatchLocation(int|array $matchingConfig, Location $location, bool $expectedResult): void { $this->matcher->setMatchingConfig($matchingConfig); self::assertSame($expectedResult, $this->matcher->matchLocation($location)); } - public function matchLocationProvider() + public function matchLocationProvider(): array { return [ [ @@ -77,7 +78,7 @@ public function matchLocationProvider() * @param \Ibexa\Contracts\Core\Repository\Repository $repository * @param bool $expectedResult */ - public function testMatchContentInfo($matchingConfig, Repository $repository, $expectedResult) + public function testMatchContentInfo(int|array $matchingConfig, Repository $repository, bool $expectedResult): void { $this->matcher->setRepository($repository); $this->matcher->setMatchingConfig($matchingConfig); @@ -87,7 +88,7 @@ public function testMatchContentInfo($matchingConfig, Repository $repository, $e ); } - public function matchContentInfoProvider() + public function matchContentInfoProvider(): array { return [ [ @@ -120,7 +121,7 @@ public function matchContentInfoProvider() * * @return \PHPUnit\Framework\MockObject\MockObject */ - private function generateRepositoryMockForParentLocationId($parentLocationId) + private function generateRepositoryMockForParentLocationId(int $parentLocationId) { $locationServiceMock = $this->createMock(LocationService::class); $locationServiceMock->expects(self::once()) diff --git a/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/RemoteTest.php b/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/RemoteTest.php index 8591a28605..18622d9311 100644 --- a/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/RemoteTest.php +++ b/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/RemoteTest.php @@ -9,13 +9,14 @@ use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\Remote; use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\Remote as RemoteIdMatcher; use Ibexa\Tests\Core\MVC\Symfony\Matcher\ContentBased\BaseTest; class RemoteTest extends BaseTest { /** @var \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\Remote */ - private $matcher; + private Remote $matcher; protected function setUp(): void { @@ -33,13 +34,13 @@ protected function setUp(): void * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location * @param bool $expectedResult */ - public function testMatchLocation($matchingConfig, Location $location, $expectedResult) + public function testMatchLocation(string|array $matchingConfig, Location $location, bool $expectedResult): void { $this->matcher->setMatchingConfig($matchingConfig); self::assertSame($expectedResult, $this->matcher->matchLocation($location)); } - public function matchLocationProvider() + public function matchLocationProvider(): array { return [ [ @@ -75,13 +76,13 @@ public function matchLocationProvider() * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo * @param bool $expectedResult */ - public function testMatchContentInfo($matchingConfig, ContentInfo $contentInfo, $expectedResult) + public function testMatchContentInfo(string|array $matchingConfig, ContentInfo $contentInfo, bool $expectedResult): void { $this->matcher->setMatchingConfig($matchingConfig); self::assertSame($expectedResult, $this->matcher->matchContentInfo($contentInfo)); } - public function matchContentInfoProvider() + public function matchContentInfoProvider(): array { return [ [ diff --git a/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/SectionTest.php b/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/SectionTest.php index 86961f1732..778d04a77b 100644 --- a/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/SectionTest.php +++ b/tests/lib/MVC/Symfony/Matcher/ContentBased/Id/SectionTest.php @@ -9,13 +9,14 @@ use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\Section; use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\Section as SectionIdMatcher; use Ibexa\Tests\Core\MVC\Symfony\Matcher\ContentBased\BaseTest; class SectionTest extends BaseTest { /** @var \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Id\Section */ - private $matcher; + private Section $matcher; protected function setUp(): void { @@ -33,13 +34,13 @@ protected function setUp(): void * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location * @param bool $expectedResult */ - public function testMatchLocation($matchingConfig, Location $location, $expectedResult) + public function testMatchLocation(int|array $matchingConfig, Location $location, bool $expectedResult): void { $this->matcher->setMatchingConfig($matchingConfig); self::assertSame($expectedResult, $this->matcher->matchLocation($location)); } - public function matchLocationProvider() + public function matchLocationProvider(): array { return [ [ @@ -72,7 +73,7 @@ public function matchLocationProvider() * * @return \PHPUnit\Framework\MockObject\MockObject */ - private function generateLocationForSectionId($sectionId) + private function generateLocationForSectionId(int $sectionId) { $location = $this->getLocationMock(); $location @@ -97,13 +98,13 @@ private function generateLocationForSectionId($sectionId) * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo * @param bool $expectedResult */ - public function testMatchContentInfo($matchingConfig, ContentInfo $contentInfo, $expectedResult) + public function testMatchContentInfo(int|array $matchingConfig, ContentInfo $contentInfo, bool $expectedResult): void { $this->matcher->setMatchingConfig($matchingConfig); self::assertSame($expectedResult, $this->matcher->matchContentInfo($contentInfo)); } - public function matchContentInfoProvider() + public function matchContentInfoProvider(): array { return [ [ diff --git a/tests/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ContentTypeTest.php b/tests/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ContentTypeTest.php index ae5cd0c989..b1ca1f6637 100644 --- a/tests/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ContentTypeTest.php +++ b/tests/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ContentTypeTest.php @@ -16,7 +16,7 @@ class ContentTypeTest extends BaseTest { /** @var \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Identifier\ContentType */ - private $matcher; + private ContentTypeIdentifierMatcher $matcher; protected function setUp(): void { @@ -34,7 +34,7 @@ protected function setUp(): void * @param \Ibexa\Contracts\Core\Repository\Repository $repository * @param bool $expectedResult */ - public function testMatchLocation($matchingConfig, Repository $repository, $expectedResult) + public function testMatchLocation($matchingConfig, Repository $repository, $expectedResult): void { $this->matcher->setRepository($repository); $this->matcher->setMatchingConfig($matchingConfig); @@ -45,7 +45,7 @@ public function testMatchLocation($matchingConfig, Repository $repository, $expe ); } - public function matchLocationProvider() + public function matchLocationProvider(): array { $data = []; @@ -106,7 +106,7 @@ private function generateLocationMock() * @param \Ibexa\Contracts\Core\Repository\Repository $repository * @param bool $expectedResult */ - public function testMatchContentInfo($matchingConfig, Repository $repository, $expectedResult) + public function testMatchContentInfo($matchingConfig, Repository $repository, $expectedResult): void { $this->matcher->setRepository($repository); $this->matcher->setMatchingConfig($matchingConfig); @@ -119,7 +119,7 @@ public function testMatchContentInfo($matchingConfig, Repository $repository, $e ); } - public function matchContentInfoProvider() + public function matchContentInfoProvider(): array { $data = []; @@ -157,7 +157,7 @@ public function matchContentInfoProvider() * * @return \PHPUnit\Framework\MockObject\MockObject */ - private function generateRepositoryMockForContentTypeIdentifier($contentTypeIdentifier) + private function generateRepositoryMockForContentTypeIdentifier(string $contentTypeIdentifier) { $contentTypeMock = $this ->getMockBuilder(ContentType::class) diff --git a/tests/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ParentContentTypeTest.php b/tests/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ParentContentTypeTest.php index 299acbe3ab..9e8f5a75dd 100644 --- a/tests/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ParentContentTypeTest.php +++ b/tests/lib/MVC/Symfony/Matcher/ContentBased/Identifier/ParentContentTypeTest.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; +use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Identifier\ParentContentType; use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Identifier\ParentContentType as ParentContentTypeMatcher; use Ibexa\Tests\Core\MVC\Symfony\Matcher\ContentBased\BaseTest; @@ -20,7 +21,7 @@ class ParentContentTypeTest extends BaseTest private const EXAMPLE_PARENT_LOCATION_ID = 2; /** @var \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Identifier\ParentContentType */ - private $matcher; + private ParentContentType $matcher; protected function setUp(): void { @@ -35,7 +36,7 @@ protected function setUp(): void * * @return \PHPUnit\Framework\MockObject\MockObject */ - private function generateRepositoryMockForContentTypeIdentifier($contentTypeIdentifier) + private function generateRepositoryMockForContentTypeIdentifier(string $contentTypeIdentifier) { $parentContentInfo = $this->getContentInfoMock([ 'mainLocationId' => self::EXAMPLE_LOCATION_ID, @@ -108,7 +109,7 @@ private function generateRepositoryMockForContentTypeIdentifier($contentTypeIden * @param \Ibexa\Contracts\Core\Repository\Repository $repository * @param bool $expectedResult */ - public function testMatchLocation($matchingConfig, Repository $repository, $expectedResult) + public function testMatchLocation(string|array $matchingConfig, Repository $repository, bool $expectedResult): void { $this->matcher->setRepository($repository); $this->matcher->setMatchingConfig($matchingConfig); @@ -120,7 +121,7 @@ public function testMatchLocation($matchingConfig, Repository $repository, $expe ); } - public function matchLocationProvider() + public function matchLocationProvider(): array { return [ [ @@ -157,7 +158,7 @@ public function matchLocationProvider() * @param \Ibexa\Contracts\Core\Repository\Repository $repository * @param bool $expectedResult */ - public function testMatchContentInfo($matchingConfig, Repository $repository, $expectedResult) + public function testMatchContentInfo(string|array $matchingConfig, Repository $repository, bool $expectedResult): void { $this->matcher->setRepository($repository); $this->matcher->setMatchingConfig($matchingConfig); diff --git a/tests/lib/MVC/Symfony/Matcher/ContentBased/Identifier/SectionTest.php b/tests/lib/MVC/Symfony/Matcher/ContentBased/Identifier/SectionTest.php index 0b9e0cd348..c88a6ac867 100644 --- a/tests/lib/MVC/Symfony/Matcher/ContentBased/Identifier/SectionTest.php +++ b/tests/lib/MVC/Symfony/Matcher/ContentBased/Identifier/SectionTest.php @@ -17,7 +17,7 @@ class SectionTest extends BaseTest { /** @var \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\Identifier\Section */ - private $matcher; + private SectionIdentifierMatcher $matcher; protected function setUp(): void { @@ -32,7 +32,7 @@ protected function setUp(): void * * @return \PHPUnit\Framework\MockObject\MockObject */ - private function generateRepositoryMockForSectionIdentifier($sectionIdentifier) + private function generateRepositoryMockForSectionIdentifier(string $sectionIdentifier) { $sectionServiceMock = $this->createMock(SectionService::class); $sectionServiceMock->expects(self::once()) @@ -74,7 +74,7 @@ private function generateRepositoryMockForSectionIdentifier($sectionIdentifier) * @param \Ibexa\Contracts\Core\Repository\Repository $repository * @param bool $expectedResult */ - public function testMatchLocation($matchingConfig, Repository $repository, $expectedResult) + public function testMatchLocation(string|array $matchingConfig, Repository $repository, bool $expectedResult): void { $this->matcher->setRepository($repository); $this->matcher->setMatchingConfig($matchingConfig); @@ -95,7 +95,7 @@ public function testMatchLocation($matchingConfig, Repository $repository, $expe ); } - public function matchSectionProvider() + public function matchSectionProvider(): array { return [ [ @@ -132,7 +132,7 @@ public function matchSectionProvider() * @param \Ibexa\Contracts\Core\Repository\Repository $repository * @param bool $expectedResult */ - public function testMatchContentInfo($matchingConfig, Repository $repository, $expectedResult) + public function testMatchContentInfo(string|array $matchingConfig, Repository $repository, bool $expectedResult): void { $this->matcher->setRepository($repository); $this->matcher->setMatchingConfig($matchingConfig); diff --git a/tests/lib/MVC/Symfony/Matcher/ContentBased/MultipleValuedTest.php b/tests/lib/MVC/Symfony/Matcher/ContentBased/MultipleValuedTest.php index 347751cfd8..5bbe30698d 100644 --- a/tests/lib/MVC/Symfony/Matcher/ContentBased/MultipleValuedTest.php +++ b/tests/lib/MVC/Symfony/Matcher/ContentBased/MultipleValuedTest.php @@ -8,6 +8,7 @@ namespace Ibexa\Tests\Core\MVC\Symfony\Matcher\ContentBased; use Ibexa\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued; +use PHPUnit\Framework\MockObject\MockObject; class MultipleValuedTest extends BaseTest { @@ -17,7 +18,7 @@ class MultipleValuedTest extends BaseTest * @covers \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued::setMatchingConfig * @covers \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued::getValues */ - public function testSetMatchingConfig($matchingConfig) + public function testSetMatchingConfig(string $matchingConfig): void { $matcher = $this->getMultipleValuedMatcherMock(); $matcher->setMatchingConfig($matchingConfig); @@ -35,7 +36,7 @@ public function testSetMatchingConfig($matchingConfig) * * @return array */ - public function matchingConfigProvider() + public function matchingConfigProvider(): array { return [ [ @@ -51,14 +52,14 @@ public function matchingConfigProvider() * @covers \Ibexa\Core\MVC\RepositoryAware::setRepository * @covers \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued::getRepository */ - public function testInjectRepository() + public function testInjectRepository(): void { $matcher = $this->getMultipleValuedMatcherMock(); $matcher->setRepository($this->repositoryMock); self::assertSame($this->repositoryMock, $matcher->getRepository()); } - private function getMultipleValuedMatcherMock() + private function getMultipleValuedMatcherMock(): MockObject { return $this->getMockForAbstractClass(MultipleValued::class); } diff --git a/tests/lib/MVC/Symfony/Matcher/ContentBased/UrlAliasTest.php b/tests/lib/MVC/Symfony/Matcher/ContentBased/UrlAliasTest.php index 614906d3fa..8221bf4b04 100644 --- a/tests/lib/MVC/Symfony/Matcher/ContentBased/UrlAliasTest.php +++ b/tests/lib/MVC/Symfony/Matcher/ContentBased/UrlAliasTest.php @@ -16,7 +16,7 @@ class UrlAliasTest extends BaseTest { /** @var \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\UrlAlias */ - private $matcher; + private UrlAliasMatcher $matcher; protected function setUp(): void { @@ -33,7 +33,7 @@ protected function setUp(): void * @param string $matchingConfig * @param string[] $expectedValues */ - public function testSetMatchingConfig($matchingConfig, $expectedValues) + public function testSetMatchingConfig(string|array $matchingConfig, array $expectedValues): void { $this->matcher->setMatchingConfig($matchingConfig); self::assertSame( @@ -42,7 +42,7 @@ public function testSetMatchingConfig($matchingConfig, $expectedValues) ); } - public function setMatchingConfigProvider() + public function setMatchingConfigProvider(): array { return [ ['/foo/bar/', ['foo/bar']], @@ -60,7 +60,7 @@ public function setMatchingConfigProvider() * * @return \PHPUnit\Framework\MockObject\MockObject */ - private function generateRepositoryMockForUrlAlias($path) + private function generateRepositoryMockForUrlAlias(string $path) { // First an url alias that will never match, then the right url alias. // This ensures to test even if the location has several url aliases. @@ -108,7 +108,7 @@ private function generateRepositoryMockForUrlAlias($path) * @param \Ibexa\Contracts\Core\Repository\Repository $repository * @param bool $expectedResult */ - public function testMatchLocation($matchingConfig, Repository $repository, $expectedResult) + public function testMatchLocation(string|array $matchingConfig, Repository $repository, bool $expectedResult): void { $this->matcher->setRepository($repository); $this->matcher->setMatchingConfig($matchingConfig); @@ -118,7 +118,7 @@ public function testMatchLocation($matchingConfig, Repository $repository, $expe ); } - public function matchLocationProvider() + public function matchLocationProvider(): array { return [ [ @@ -153,7 +153,7 @@ public function matchLocationProvider() * @covers \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\UrlAlias::matchContentInfo * @covers \Ibexa\Core\MVC\Symfony\Matcher\ContentBased\UrlAlias::setMatchingConfig */ - public function testMatchContentInfo() + public function testMatchContentInfo(): void { $this->expectException(\RuntimeException::class); diff --git a/tests/lib/MVC/Symfony/Matcher/DynamicallyConfiguredMatcherFactoryDecoratorTest.php b/tests/lib/MVC/Symfony/Matcher/DynamicallyConfiguredMatcherFactoryDecoratorTest.php index 89e4322bd1..f46d86f0dc 100644 --- a/tests/lib/MVC/Symfony/Matcher/DynamicallyConfiguredMatcherFactoryDecoratorTest.php +++ b/tests/lib/MVC/Symfony/Matcher/DynamicallyConfiguredMatcherFactoryDecoratorTest.php @@ -11,15 +11,16 @@ use Ibexa\Core\MVC\Symfony\Matcher\ClassNameMatcherFactory; use Ibexa\Core\MVC\Symfony\Matcher\DynamicallyConfiguredMatcherFactoryDecorator; use Ibexa\Core\MVC\Symfony\View\ContentView; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class DynamicallyConfiguredMatcherFactoryDecoratorTest extends TestCase { /** @var \Ibexa\Core\MVC\Symfony\Matcher\ConfigurableMatcherFactoryInterface */ - private $innerMatcherFactory; + private MockObject $innerMatcherFactory; /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private MockObject $configResolver; public function setUp(): void { @@ -33,7 +34,7 @@ public function setUp(): void /** * @dataProvider matchConfigProvider */ - public function testMatch($parameterName, $namespace, $scope, $viewsConfiguration, $matchedConfig): void + public function testMatch(string $parameterName, $namespace, $scope, array $viewsConfiguration, array $matchedConfig): void { $view = $this->createMock(ContentView::class); $this->configResolver->expects(self::atLeastOnce())->method('getParameter')->with( diff --git a/tests/lib/MVC/Symfony/Routing/GeneratorTest.php b/tests/lib/MVC/Symfony/Routing/GeneratorTest.php index 51fc9a6c9e..218bc3c99a 100644 --- a/tests/lib/MVC/Symfony/Routing/GeneratorTest.php +++ b/tests/lib/MVC/Symfony/Routing/GeneratorTest.php @@ -12,6 +12,7 @@ use Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessRouterInterface; use Ibexa\Core\MVC\Symfony\SiteAccess\URILexer; use Ibexa\Core\Repository\Values\Content\Location; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; @@ -20,13 +21,13 @@ class GeneratorTest extends TestCase { /** @var \Ibexa\Core\MVC\Symfony\Routing\Generator|\PHPUnit\Framework\MockObject\MockObject */ - private $generator; + private MockObject $generator; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $siteAccessRouter; + private MockObject $siteAccessRouter; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $logger; + private MockObject $logger; protected function setUp(): void { @@ -38,7 +39,7 @@ protected function setUp(): void $this->generator->setLogger($this->logger); } - public function generateProvider() + public function generateProvider(): array { return [ ['foo_bar', [], UrlGeneratorInterface::ABSOLUTE_PATH], @@ -56,7 +57,7 @@ public function generateProvider() /** * @dataProvider generateProvider */ - public function testSimpleGenerate($urlResource, array $parameters, $referenceType) + public function testSimpleGenerate(string|Location|\stdClass $urlResource, array $parameters, int $referenceType): void { $matcher = $this->createMock(URILexer::class); $this->generator->setSiteAccess(new SiteAccess('test', 'fake', $matcher)); @@ -89,7 +90,7 @@ public function testSimpleGenerate($urlResource, array $parameters, $referenceTy /** * @dataProvider generateProvider */ - public function testGenerateWithSiteAccessNoReverseMatch($urlResource, array $parameters, $referenceType) + public function testGenerateWithSiteAccessNoReverseMatch(string|Location|\stdClass $urlResource, array $parameters, int $referenceType): void { $matcher = $this->createMock(URILexer::class); $this->generator->setSiteAccess(new SiteAccess('test', 'test', $matcher)); diff --git a/tests/lib/MVC/Symfony/Routing/RouteReferenceGeneratorTest.php b/tests/lib/MVC/Symfony/Routing/RouteReferenceGeneratorTest.php index 91320c47b1..0ef6218ae3 100644 --- a/tests/lib/MVC/Symfony/Routing/RouteReferenceGeneratorTest.php +++ b/tests/lib/MVC/Symfony/Routing/RouteReferenceGeneratorTest.php @@ -12,6 +12,7 @@ use Ibexa\Core\MVC\Symfony\Routing\Generator\RouteReferenceGenerator; use Ibexa\Core\MVC\Symfony\Routing\RouteReference; use Ibexa\Core\Repository\Values\Content\Location; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Request; @@ -20,7 +21,7 @@ class RouteReferenceGeneratorTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $dispatcher; + private MockObject $dispatcher; protected function setUp(): void { @@ -28,7 +29,7 @@ protected function setUp(): void $this->dispatcher = $this->createMock(EventDispatcherInterface::class); } - public function testGenerateNullResource() + public function testGenerateNullResource(): void { $currentRouteName = 'my_route'; $currentRouteParams = ['foo' => 'bar']; @@ -53,7 +54,7 @@ public function testGenerateNullResource() self::assertSame($currentRouteParams, $reference->getParams()); } - public function testGenerateNullResourceAndPassedParams() + public function testGenerateNullResourceAndPassedParams(): void { $currentRouteName = 'my_route'; $currentRouteParams = ['foo' => 'bar']; @@ -83,7 +84,7 @@ public function testGenerateNullResourceAndPassedParams() /** * @dataProvider generateGenerator */ - public function testGenerate($resource, array $params) + public function testGenerate(string|Location $resource, array $params): void { $currentRouteName = 'my_route'; $currentRouteParams = ['foo' => 'bar']; @@ -108,7 +109,7 @@ public function testGenerate($resource, array $params) self::assertSame($params, $reference->getParams()); } - public function testGenerateNullResourceWithoutRoute() + public function testGenerateNullResourceWithoutRoute(): void { $currentRouteName = 'my_route'; $currentRouteParams = ['foo' => 'bar']; @@ -129,7 +130,7 @@ public function testGenerateNullResourceWithoutRoute() self::assertInstanceOf(RouteReference::class, $reference); } - public function generateGenerator() + public function generateGenerator(): array { return [ ['my_route', ['hello' => 'world', 'isIt' => true]], diff --git a/tests/lib/MVC/Symfony/Routing/RouteReferenceTest.php b/tests/lib/MVC/Symfony/Routing/RouteReferenceTest.php index f8d4dc37ed..c4c6ab8c85 100644 --- a/tests/lib/MVC/Symfony/Routing/RouteReferenceTest.php +++ b/tests/lib/MVC/Symfony/Routing/RouteReferenceTest.php @@ -12,7 +12,7 @@ class RouteReferenceTest extends TestCase { - public function testConstruct() + public function testConstruct(): void { $route = 'my_route'; $params = ['foo' => 'bar', 'some' => 'thing']; @@ -21,7 +21,7 @@ public function testConstruct() self::assertSame($params, $reference->getParams()); } - public function testGetSetRoute() + public function testGetSetRoute(): void { $initialRoute = 'foo'; $newRoute = 'bar'; @@ -32,7 +32,7 @@ public function testGetSetRoute() self::assertSame($newRoute, $reference->getRoute()); } - public function testGetSetParams() + public function testGetSetParams(): void { $reference = new RouteReference('foo'); self::assertSame([], $reference->getParams()); @@ -53,7 +53,7 @@ public function testGetSetParams() self::assertSame($defaultValue, $reference->get('url', $defaultValue)); } - public function testRemoveParam() + public function testRemoveParam(): void { $reference = new RouteReference('foo'); $reference->set('foo', 'bar'); diff --git a/tests/lib/MVC/Symfony/Routing/SimplifiedRequestTest.php b/tests/lib/MVC/Symfony/Routing/SimplifiedRequestTest.php index 0222afb723..1e59ac4f55 100644 --- a/tests/lib/MVC/Symfony/Routing/SimplifiedRequestTest.php +++ b/tests/lib/MVC/Symfony/Routing/SimplifiedRequestTest.php @@ -21,7 +21,7 @@ class SimplifiedRequestTest extends TestCase * * @dataProvider fromUrlProvider */ - public function testFromUrl($url, $expectedRequest) + public function testFromUrl(string $url, SimplifiedRequest $expectedRequest): void { self::assertEquals( $expectedRequest, @@ -49,7 +49,7 @@ public function testStrictGetters(): void self::assertSame(['param' => 'bar', 'param2' => 'bar2'], $request->getQueryParams()); } - public function fromUrlProvider() + public function fromUrlProvider(): array { return [ [ diff --git a/tests/lib/MVC/Symfony/Routing/UrlAliasGeneratorTest.php b/tests/lib/MVC/Symfony/Routing/UrlAliasGeneratorTest.php index 845f3bdcca..a562cf6974 100644 --- a/tests/lib/MVC/Symfony/Routing/UrlAliasGeneratorTest.php +++ b/tests/lib/MVC/Symfony/Routing/UrlAliasGeneratorTest.php @@ -21,6 +21,7 @@ use Ibexa\Core\Repository\Permission\PermissionResolver; use Ibexa\Core\Repository\Repository; use Ibexa\Core\Repository\Values\Content\Location; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Component\Routing\RouterInterface; @@ -28,28 +29,28 @@ class UrlAliasGeneratorTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $repository; + private MockObject $repository; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $urlAliasService; + private MockObject $urlAliasService; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $locationService; + private MockObject $locationService; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $router; + private MockObject $router; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $logger; + private MockObject $logger; /** @var \Ibexa\Core\MVC\Symfony\Routing\Generator\UrlAliasGenerator */ - private $urlAliasGenerator; + private UrlAliasGenerator $urlAliasGenerator; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $siteAccessRouter; + private MockObject $siteAccessRouter; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $configResolver; + private MockObject $configResolver; protected function setUp(): void { @@ -100,7 +101,7 @@ protected function setUp(): void $this->urlAliasGenerator->setSiteAccessRouter($this->siteAccessRouter); } - public function testGetPathPrefixByRootLocationId() + public function testGetPathPrefixByRootLocationId(): void { $rootLocationId = 123; $rootLocation = new Location(['id' => $rootLocationId]); @@ -123,7 +124,7 @@ public function testGetPathPrefixByRootLocationId() /** * @dataProvider providerTestIsPrefixExcluded */ - public function testIsPrefixExcluded($uri, $expectedIsExcluded) + public function testIsPrefixExcluded(string $uri, bool $expectedIsExcluded): void { $this->urlAliasGenerator->setExcludedUriPrefixes( [ @@ -135,7 +136,7 @@ public function testIsPrefixExcluded($uri, $expectedIsExcluded) self::assertSame($expectedIsExcluded, $this->urlAliasGenerator->isUriPrefixExcluded($uri)); } - public function providerTestIsPrefixExcluded() + public function providerTestIsPrefixExcluded(): array { return [ ['/foo/bar', false], @@ -152,7 +153,7 @@ public function providerTestIsPrefixExcluded() ]; } - public function testLoadLocation() + public function testLoadLocation(): void { $locationId = 123; $location = new Location(['id' => $locationId]); @@ -167,7 +168,7 @@ public function testLoadLocation() /** * @dataProvider providerTestDoGenerate */ - public function testDoGenerate(URLAlias $urlAlias, array $parameters, $expected) + public function testDoGenerate(URLAlias $urlAlias, array $parameters, string $expected): void { $location = new Location(['id' => 123]); $this->urlAliasService @@ -181,7 +182,7 @@ public function testDoGenerate(URLAlias $urlAlias, array $parameters, $expected) self::assertSame($expected, $this->urlAliasGenerator->doGenerate($location, $parameters)); } - public function providerTestDoGenerate() + public function providerTestDoGenerate(): array { return [ 'without_parameters' => [ @@ -212,7 +213,7 @@ public function providerTestDoGenerate() * * @param array $parameters */ - public function testDoGenerateWithSiteAccessParam(URLAlias $urlAlias, array $parameters, string $expected) + public function testDoGenerateWithSiteAccessParam(URLAlias $urlAlias, array $parameters, string $expected): void { $siteaccessName = 'foo'; $parameters += ['siteaccess' => $siteaccessName]; @@ -258,7 +259,7 @@ public function testDoGenerateWithSiteAccessParam(URLAlias $urlAlias, array $par ->method('loadLocation') ->will( self::returnCallback( - static function ($locationId) { + static function ($locationId): Location { return new Location(['id' => $locationId]); } ) @@ -268,7 +269,7 @@ static function ($locationId) { ->method('reverseLookup') ->will( self::returnCallback( - static function ($location) use ($treeRootUrlAlias) { + static function ($location) use ($treeRootUrlAlias): \Ibexa\Contracts\Core\Repository\Values\Content\URLAlias { return $treeRootUrlAlias[$location->id]; } ) @@ -279,7 +280,7 @@ static function ($location) use ($treeRootUrlAlias) { self::assertSame($expected, $this->urlAliasGenerator->doGenerate($location, $parameters)); } - public function providerTestDoGenerateWithSiteaccess() + public function providerTestDoGenerateWithSiteaccess(): array { return [ [ @@ -293,7 +294,7 @@ public function providerTestDoGenerateWithSiteaccess() '/baz', ], [ - new UrlAlias(['path' => '/special-chars-"<>\'']), + new URLAlias(['path' => '/special-chars-"<>\'']), [], '/special-chars-%22%3C%3E%27', ], @@ -308,12 +309,12 @@ public function providerTestDoGenerateWithSiteaccess() '/baz#qux', ], 'fragment_and_special_chars' => [ - new UrlAlias(['path' => '/special-chars-"<>\'']), + new URLAlias(['path' => '/special-chars-"<>\'']), ['_fragment' => 'qux'], '/special-chars-%22%3C%3E%27#qux', ], 'fragment_site_siteaccess_and_params' => [ - new UrlAlias(['path' => '/foo/bar/baz']), + new URLAlias(['path' => '/foo/bar/baz']), ['_fragment' => 'qux', 'siteaccess' => 'bar', 'some' => 'foo'], '/baz?some=foo#qux', ], @@ -398,7 +399,7 @@ public function testDoGenerateWithSiteAccessLoadsLocationWithLanguages(): void ); } - public function testDoGenerateNoUrlAlias() + public function testDoGenerateNoUrlAlias(): void { $location = new Location(['id' => 123, 'contentInfo' => new ContentInfo(['id' => 456])]); $uri = "/content/location/$location->id"; @@ -422,7 +423,7 @@ public function testDoGenerateNoUrlAlias() /** * @dataProvider providerTestDoGenerateRootLocation */ - public function testDoGenerateRootLocation(URLAlias $urlAlias, $isOutsideAndNotExcluded, $expected, $pathPrefix) + public function testDoGenerateRootLocation(URLAlias $urlAlias, bool $isOutsideAndNotExcluded, string $expected, string $pathPrefix): void { $excludedPrefixes = ['/products', '/shared']; $rootLocationId = 456; @@ -458,65 +459,65 @@ public function testDoGenerateRootLocation(URLAlias $urlAlias, $isOutsideAndNotE self::assertSame($expected, $this->urlAliasGenerator->doGenerate($location, [])); } - public function providerTestDoGenerateRootLocation() + public function providerTestDoGenerateRootLocation(): array { return [ [ - new UrlAlias(['path' => '/my/root-folder/foo/bar']), + new URLAlias(['path' => '/my/root-folder/foo/bar']), false, '/foo/bar', '/my/root-folder', ], [ - new UrlAlias(['path' => '/my/root-folder/something']), + new URLAlias(['path' => '/my/root-folder/something']), false, '/something', '/my/root-folder', ], [ - new UrlAlias(['path' => '/my/root-folder']), + new URLAlias(['path' => '/my/root-folder']), false, '/', '/my/root-folder', ], [ - new UrlAlias(['path' => '/foo/bar']), + new URLAlias(['path' => '/foo/bar']), false, '/foo/bar', '/', ], [ - new UrlAlias(['path' => '/something']), + new URLAlias(['path' => '/something']), false, '/something', '/', ], [ - new UrlAlias(['path' => '/']), + new URLAlias(['path' => '/']), false, '/', '/', ], [ - new UrlAlias(['path' => '/outside/tree/foo/bar']), + new URLAlias(['path' => '/outside/tree/foo/bar']), true, '/outside/tree/foo/bar', '/my/root-folder', ], [ - new UrlAlias(['path' => '/products/ibexa-dxp']), + new URLAlias(['path' => '/products/ibexa-dxp']), false, '/products/ibexa-dxp', '/my/root-folder', ], [ - new UrlAlias(['path' => '/shared/some-content']), + new URLAlias(['path' => '/shared/some-content']), false, '/shared/some-content', '/my/root-folder', ], [ - new UrlAlias(['path' => '/products/ibexa-dxp']), + new URLAlias(['path' => '/products/ibexa-dxp']), false, '/products/ibexa-dxp', '/prod', @@ -524,7 +525,7 @@ public function providerTestDoGenerateRootLocation() ]; } - protected function getPermissionResolverMock() + protected function getPermissionResolverMock(): MockObject { $configResolverMock = $this->createMock(ConfigResolverInterface::class); $configResolverMock diff --git a/tests/lib/MVC/Symfony/Routing/UrlAliasRouterTest.php b/tests/lib/MVC/Symfony/Routing/UrlAliasRouterTest.php index 52ebd9be49..2f008b5850 100644 --- a/tests/lib/MVC/Symfony/Routing/UrlAliasRouterTest.php +++ b/tests/lib/MVC/Symfony/Routing/UrlAliasRouterTest.php @@ -21,6 +21,7 @@ use Ibexa\Core\MVC\Symfony\View\Manager as ViewManager; use Ibexa\Core\Repository\Repository; use Ibexa\Core\Repository\Values\Content\Location; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Component\HttpFoundation\Request; @@ -34,19 +35,19 @@ class UrlAliasRouterTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - protected $repository; + protected MockObject $repository; /** @var \PHPUnit\Framework\MockObject\MockObject */ - protected $urlAliasService; + protected MockObject $urlAliasService; /** @var \PHPUnit\Framework\MockObject\MockObject */ - protected $locationService; + protected MockObject $locationService; /** @var \PHPUnit\Framework\MockObject\MockObject */ - protected $contentService; + protected MockObject $contentService; /** @var \PHPUnit\Framework\MockObject\MockObject */ - protected $urlALiasGenerator; + protected MockObject $urlALiasGenerator; protected $requestContext; @@ -94,12 +95,12 @@ protected function setUp(): void * * @return \Ibexa\Core\MVC\Symfony\Routing\UrlAliasRouter */ - protected function getRouter(LocationService $locationService, URLAliasService $urlAliasService, ContentService $contentService, UrlAliasGenerator $urlAliasGenerator, RequestContext $requestContext) + protected function getRouter(LocationService $locationService, URLAliasService $urlAliasService, ContentService $contentService, UrlAliasGenerator $urlAliasGenerator, RequestContext $requestContext): UrlAliasRouter { return new UrlAliasRouter($locationService, $urlAliasService, $contentService, $urlAliasGenerator, $requestContext); } - public function testRequestContext() + public function testRequestContext(): void { self::assertSame($this->requestContext, $this->router->getContext()); $newContext = new RequestContext(); @@ -111,7 +112,7 @@ public function testRequestContext() self::assertSame($newContext, $this->router->getContext()); } - public function testMatch() + public function testMatch(): void { $this->expectException(\RuntimeException::class); @@ -121,12 +122,12 @@ public function testMatch() /** * @dataProvider providerTestSupports */ - public function testSupports($routeReference, $isSupported) + public function testSupports(Location|\stdClass|string $routeReference, bool $isSupported): void { self::assertSame($isSupported, $this->router->supports($routeReference)); } - public function providerTestSupports() + public function providerTestSupports(): array { return [ [new Location(), true], @@ -136,7 +137,7 @@ public function providerTestSupports() ]; } - public function testGetRouteCollection() + public function testGetRouteCollection(): void { self::assertInstanceOf(RouteCollection::class, $this->router->getRouteCollection()); } @@ -162,14 +163,14 @@ protected function getRequestByPathInfo($pathInfo) return $request; } - public function testMatchRequestLocation() + public function testMatchRequestLocation(): void { $pathInfo = '/foo/bar'; $destinationId = 123; $urlAlias = new URLAlias( [ 'path' => $pathInfo, - 'type' => UrlAlias::LOCATION, + 'type' => URLAlias::LOCATION, 'destination' => $destinationId, 'isHistory' => false, ] @@ -196,7 +197,7 @@ public function testMatchRequestLocation() self::assertEquals($expected, $this->router->matchRequest($request)); } - public function testMatchRequestLocationWithCaseRedirect() + public function testMatchRequestLocationWithCaseRedirect(): void { $pathInfo = '/Foo/bAR'; $urlAliasPath = '/foo/bar'; @@ -204,7 +205,7 @@ public function testMatchRequestLocationWithCaseRedirect() $urlAlias = new URLAlias( [ 'path' => $urlAliasPath, - 'type' => UrlAlias::LOCATION, + 'type' => URLAlias::LOCATION, 'destination' => $destinationId, 'isHistory' => false, ] @@ -238,7 +239,7 @@ public function testMatchRequestLocationWithCaseRedirect() self::assertEquals($expected, $this->router->matchRequest($request)); } - public function testMatchRequestLocationWrongCaseUriPrefixExcluded() + public function testMatchRequestLocationWrongCaseUriPrefixExcluded(): void { $pathInfo = '/Foo/bAR'; $urlAliasPath = '/foo/bar'; @@ -246,7 +247,7 @@ public function testMatchRequestLocationWrongCaseUriPrefixExcluded() $urlAlias = new URLAlias( [ 'path' => $urlAliasPath, - 'type' => UrlAlias::LOCATION, + 'type' => URLAlias::LOCATION, 'destination' => $destinationId, 'isHistory' => false, ] @@ -280,14 +281,14 @@ public function testMatchRequestLocationWrongCaseUriPrefixExcluded() self::assertEquals($expected, $this->router->matchRequest($request)); } - public function testMatchRequestLocationCorrectCaseUriPrefixExcluded() + public function testMatchRequestLocationCorrectCaseUriPrefixExcluded(): void { $pathInfo = $urlAliasPath = '/foo/bar'; $destinationId = 123; $urlAlias = new URLAlias( [ 'path' => $urlAliasPath, - 'type' => UrlAlias::LOCATION, + 'type' => URLAlias::LOCATION, 'destination' => $destinationId, 'isHistory' => false, ] @@ -321,7 +322,7 @@ public function testMatchRequestLocationCorrectCaseUriPrefixExcluded() self::assertSame($pathInfo, $request->attributes->get('semanticPathinfo')); } - public function testMatchRequestLocationHistory() + public function testMatchRequestLocationHistory(): void { $pathInfo = '/foo/bar'; $newPathInfo = '/foo/bar-new'; @@ -333,7 +334,7 @@ public function testMatchRequestLocationHistory() $urlAlias = new URLAlias( [ 'path' => $pathInfo, - 'type' => UrlAlias::LOCATION, + 'type' => URLAlias::LOCATION, 'destination' => $destinationId, 'isHistory' => true, ] @@ -368,14 +369,14 @@ public function testMatchRequestLocationHistory() self::assertEquals($expected, $this->router->matchRequest($request)); } - public function testMatchRequestLocationCustom() + public function testMatchRequestLocationCustom(): void { $pathInfo = '/foo/bar'; $destinationId = 123; $urlAlias = new URLAlias( [ 'path' => $pathInfo, - 'type' => UrlAlias::LOCATION, + 'type' => URLAlias::LOCATION, 'destination' => $destinationId, 'isHistory' => false, 'isCustom' => true, @@ -404,7 +405,7 @@ public function testMatchRequestLocationCustom() self::assertEquals($expected, $this->router->matchRequest($request)); } - public function testMatchRequestLocationCustomForward() + public function testMatchRequestLocationCustomForward(): void { $pathInfo = '/foo/bar'; $newPathInfo = '/foo/bar-new'; @@ -416,7 +417,7 @@ public function testMatchRequestLocationCustomForward() $urlAlias = new URLAlias( [ 'path' => $pathInfo, - 'type' => UrlAlias::LOCATION, + 'type' => URLAlias::LOCATION, 'destination' => $destinationId, 'isHistory' => false, 'isCustom' => true, @@ -460,7 +461,7 @@ public function testMatchRequestLocationCustomForward() self::assertEquals($expected, $this->router->matchRequest($request)); } - public function testMatchRequestFail() + public function testMatchRequestFail(): void { $this->expectException(ResourceNotFoundException::class); @@ -474,7 +475,7 @@ public function testMatchRequestFail() $this->router->matchRequest($request); } - public function testMatchRequestResource() + public function testMatchRequestResource(): void { $pathInfo = '/hello_content/hello_search'; $destination = '/content/search'; @@ -482,7 +483,7 @@ public function testMatchRequestResource() [ 'destination' => $destination, 'path' => $pathInfo, - 'type' => UrlAlias::RESOURCE, + 'type' => URLAlias::RESOURCE, ] ); $request = $this->getRequestByPathInfo($pathInfo); @@ -500,7 +501,7 @@ public function testMatchRequestResource() self::assertEquals($expected, $this->router->matchRequest($request)); } - public function testMatchRequestResourceWithRedirect() + public function testMatchRequestResourceWithRedirect(): void { $pathInfo = '/hello_content/hello_search'; $destination = '/content/search'; @@ -508,7 +509,7 @@ public function testMatchRequestResourceWithRedirect() [ 'destination' => $destination, 'path' => $pathInfo, - 'type' => UrlAlias::RESOURCE, + 'type' => URLAlias::RESOURCE, 'forward' => true, ] ); @@ -527,7 +528,7 @@ public function testMatchRequestResourceWithRedirect() self::assertEquals($expected, $this->router->matchRequest($request)); } - public function testMatchRequestResourceWithCaseRedirect() + public function testMatchRequestResourceWithCaseRedirect(): void { $pathInfo = '/heLLo_contEnt/hEllo_SEarch'; $urlAliasPath = '/hello_content/hello_search'; @@ -536,7 +537,7 @@ public function testMatchRequestResourceWithCaseRedirect() [ 'destination' => $destination, 'path' => $urlAliasPath, - 'type' => UrlAlias::RESOURCE, + 'type' => URLAlias::RESOURCE, 'forward' => false, ] ); @@ -564,7 +565,7 @@ public function testMatchRequestResourceWithCaseRedirect() * Tests that forwarding custom alias will redirect to the resource destination rather than * to the case-corrected alias. */ - public function testMatchRequestResourceCaseIncorrectWithForwardRedirect() + public function testMatchRequestResourceCaseIncorrectWithForwardRedirect(): void { $pathInfo = '/heLLo_contEnt/hEllo_SEarch'; $urlAliasPath = '/hello_content/hello_search'; @@ -573,7 +574,7 @@ public function testMatchRequestResourceCaseIncorrectWithForwardRedirect() [ 'destination' => $destination, 'path' => $urlAliasPath, - 'type' => UrlAlias::RESOURCE, + 'type' => URLAlias::RESOURCE, 'forward' => true, ] ); @@ -592,13 +593,13 @@ public function testMatchRequestResourceCaseIncorrectWithForwardRedirect() self::assertEquals($expected, $this->router->matchRequest($request)); } - public function testMatchRequestVirtual() + public function testMatchRequestVirtual(): void { $pathInfo = '/foo/bar'; $urlAlias = new URLAlias( [ 'path' => $pathInfo, - 'type' => UrlAlias::VIRTUAL, + 'type' => URLAlias::VIRTUAL, ] ); $request = $this->getRequestByPathInfo($pathInfo); @@ -616,14 +617,14 @@ public function testMatchRequestVirtual() self::assertEquals($expected, $this->router->matchRequest($request)); } - public function testMatchRequestVirtualWithCaseRedirect() + public function testMatchRequestVirtualWithCaseRedirect(): void { $pathInfo = '/Foo/bAR'; $urlAliasPath = '/foo/bar'; $urlAlias = new URLAlias( [ 'path' => $urlAliasPath, - 'type' => UrlAlias::VIRTUAL, + 'type' => URLAlias::VIRTUAL, ] ); $request = $this->getRequestByPathInfo($pathInfo); @@ -646,7 +647,7 @@ public function testMatchRequestVirtualWithCaseRedirect() self::assertEquals($expected, $this->router->matchRequest($request)); } - public function testGenerateFail() + public function testGenerateFail(): void { $this->expectException(RouteNotFoundException::class); @@ -681,21 +682,21 @@ public function testGenerateWithRouteObject(): void ); } - public function testGenerateNoLocation() + public function testGenerateNoLocation(): void { $this->expectException(\InvalidArgumentException::class); $this->router->generate(UrlAliasRouter::URL_ALIAS_ROUTE_NAME, ['foo' => 'bar']); } - public function testGenerateInvalidLocation() + public function testGenerateInvalidLocation(): void { $this->expectException(\LogicException::class); $this->router->generate(UrlAliasRouter::URL_ALIAS_ROUTE_NAME, ['location' => new \stdClass()]); } - public function testGenerateWithLocationId() + public function testGenerateWithLocationId(): void { $locationId = 123; $location = new Location(['id' => $locationId]); @@ -722,7 +723,7 @@ public function testGenerateWithLocationId() ); } - public function testGenerateWithLocationAsParameter() + public function testGenerateWithLocationAsParameter(): void { $locationId = 123; $location = new Location(['id' => $locationId]); @@ -744,7 +745,7 @@ public function testGenerateWithLocationAsParameter() ); } - public function testGenerateWithContentId() + public function testGenerateWithContentId(): void { $locationId = 123; $contentId = 456; @@ -778,7 +779,7 @@ public function testGenerateWithContentId() ); } - public function testGenerateWithContentIdWithMissingMainLocation() + public function testGenerateWithContentIdWithMissingMainLocation(): void { $this->expectException(\LogicException::class); diff --git a/tests/lib/MVC/Symfony/Security/HttpUtilsTest.php b/tests/lib/MVC/Symfony/Security/HttpUtilsTest.php index d196b24bd0..09f251e5c1 100644 --- a/tests/lib/MVC/Symfony/Security/HttpUtilsTest.php +++ b/tests/lib/MVC/Symfony/Security/HttpUtilsTest.php @@ -18,7 +18,7 @@ class HttpUtilsTest extends TestCase /** * @dataProvider generateUriStandardProvider */ - public function testGenerateUriStandard($uri, $isUriRouteName, $expected) + public function testGenerateUriStandard(string $uri, bool $isUriRouteName, string $expected): void { $urlGenerator = $this->createMock(UrlGeneratorInterface::class); $httpUtils = new HttpUtils($urlGenerator); @@ -39,7 +39,7 @@ public function testGenerateUriStandard($uri, $isUriRouteName, $expected) self::assertSame($expected, $httpUtils->generateUri($request, $uri)); } - public function generateUriStandardProvider() + public function generateUriStandardProvider(): array { return [ ['http://localhost/foo/bar', false, 'http://localhost/foo/bar'], @@ -53,7 +53,7 @@ public function generateUriStandardProvider() /** * @dataProvider generateUriProvider */ - public function testGenerateUri($uri, $isUriRouteName, $siteAccessUri, $expected) + public function testGenerateUri(string $uri, bool $isUriRouteName, ?string $siteAccessUri, string $expected): void { $siteAccess = new SiteAccess('test', 'test'); if ($uri[0] === '/') { @@ -86,7 +86,7 @@ public function testGenerateUri($uri, $isUriRouteName, $siteAccessUri, $expected self::assertSame($expected, $res); } - public function generateUriProvider() + public function generateUriProvider(): array { return [ ['http://localhost/foo/bar', false, null, 'http://localhost/foo/bar'], @@ -97,7 +97,7 @@ public function generateUriProvider() ]; } - public function testCheckRequestPathStandard() + public function testCheckRequestPathStandard(): void { $httpUtils = new HttpUtils(); $httpUtils->setSiteAccess(new SiteAccess('test')); @@ -108,7 +108,7 @@ public function testCheckRequestPathStandard() /** * @dataProvider checkRequestPathProvider */ - public function testCheckRequestPath($path, $siteAccessUri, $requestUri, $expected) + public function testCheckRequestPath(string $path, ?string $siteAccessUri, string $requestUri, bool $expected): void { $siteAccess = new SiteAccess('test', 'test'); if ($siteAccessUri !== null) { @@ -127,7 +127,7 @@ public function testCheckRequestPath($path, $siteAccessUri, $requestUri, $expect self::assertSame($expected, $httpUtils->checkRequestPath($request, $path)); } - public function checkRequestPathProvider() + public function checkRequestPathProvider(): array { return [ ['/foo/bar', null, 'http://localhost/foo/bar', true], diff --git a/tests/lib/MVC/Symfony/Security/UserCheckerTest.php b/tests/lib/MVC/Symfony/Security/UserCheckerTest.php index 8760a1b6db..504ba21ab4 100644 --- a/tests/lib/MVC/Symfony/Security/UserCheckerTest.php +++ b/tests/lib/MVC/Symfony/Security/UserCheckerTest.php @@ -18,6 +18,7 @@ use Ibexa\Core\Repository\Values\Content\Content; use Ibexa\Core\Repository\Values\Content\VersionInfo; use Ibexa\Core\Repository\Values\User\User as APIUser; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Core\Exception\DisabledException; use Throwable; @@ -27,10 +28,10 @@ final class UserCheckerTest extends TestCase private const EXAMPLE_USER_ID = 14; /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $userServiceMock; + private MockObject $userServiceMock; /** @var \Ibexa\Core\MVC\Symfony\Security\UserChecker */ - private $userChecker; + private UserChecker $userChecker; protected function setUp(): void { diff --git a/tests/lib/MVC/Symfony/Security/UserTest.php b/tests/lib/MVC/Symfony/Security/UserTest.php index 5561078ba1..a4a34ad599 100644 --- a/tests/lib/MVC/Symfony/Security/UserTest.php +++ b/tests/lib/MVC/Symfony/Security/UserTest.php @@ -16,7 +16,7 @@ class UserTest extends TestCase { - public function testConstruct() + public function testConstruct(): void { $login = 'my_username'; $passwordHash = 'encoded_password'; @@ -48,7 +48,7 @@ public function testConstruct() self::assertNull($user->getSalt()); } - public function testIsEqualTo() + public function testIsEqualTo(): void { $userId = 123; $apiUser = $this->createMock(APIUser::class); @@ -70,7 +70,7 @@ public function testIsEqualTo() self::assertTrue($user->isEqualTo($user2)); } - public function testIsNotEqualTo() + public function testIsNotEqualTo(): void { $apiUser = $this->createMock(APIUser::class); $apiUser @@ -91,7 +91,7 @@ public function testIsNotEqualTo() self::assertFalse($user->isEqualTo($user2)); } - public function testIsEqualToNotSameUserType() + public function testIsEqualToNotSameUserType(): void { $user = new User($this->createMock(APIUser::class)); $user2 = $this->createMock(ReferenceUserInterface::class); @@ -102,7 +102,7 @@ public function testIsEqualToNotSameUserType() self::assertFalse($user->isEqualTo($user2)); } - public function testSetAPIUser() + public function testSetAPIUser(): void { $apiUserA = $this->createMock(APIUser::class); $apiUserB = $this->createMock(APIUser::class); diff --git a/tests/lib/MVC/Symfony/Security/UserWrappedTest.php b/tests/lib/MVC/Symfony/Security/UserWrappedTest.php index b4ac50d84b..49c72f69db 100644 --- a/tests/lib/MVC/Symfony/Security/UserWrappedTest.php +++ b/tests/lib/MVC/Symfony/Security/UserWrappedTest.php @@ -77,7 +77,7 @@ public function testRegularUser(): void self::assertSame($originalUser, $user->getWrappedUser()); } - public function testIsEqualTo() + public function testIsEqualTo(): void { $originalUser = $this->createMock(UserEquatableInterface::class); $user = new UserWrapped($originalUser, $this->apiUser); diff --git a/tests/lib/MVC/Symfony/Security/Voter/CoreVoterTest.php b/tests/lib/MVC/Symfony/Security/Voter/CoreVoterTest.php index 2d8261b14c..a98c03b74c 100644 --- a/tests/lib/MVC/Symfony/Security/Voter/CoreVoterTest.php +++ b/tests/lib/MVC/Symfony/Security/Voter/CoreVoterTest.php @@ -12,6 +12,7 @@ use Ibexa\Core\MVC\Symfony\Controller\Content\ViewController; use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute; use Ibexa\Core\MVC\Symfony\Security\Authorization\Voter\CoreVoter; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; @@ -19,7 +20,7 @@ class CoreVoterTest extends TestCase { /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver|\PHPUnit\Framework\MockObject\MockObject */ - private $permissionResolver; + private MockObject $permissionResolver; protected function setUp(): void { @@ -30,13 +31,13 @@ protected function setUp(): void /** * @dataProvider supportsAttributeProvider */ - public function testSupportsAttribute($attribute, $expectedResult) + public function testSupportsAttribute(string|Attribute|\stdClass|array $attribute, bool $expectedResult): void { $voter = new CoreVoter($this->permissionResolver); self::assertSame($expectedResult, $voter->supportsAttribute($attribute)); } - public function supportsAttributeProvider() + public function supportsAttributeProvider(): array { return [ ['foo', false], @@ -58,13 +59,13 @@ public function supportsAttributeProvider() /** * @dataProvider supportsClassProvider */ - public function testSupportsClass($class) + public function testSupportsClass(string $class): void { $voter = new CoreVoter($this->permissionResolver); self::assertTrue($voter->supportsClass($class)); } - public function supportsClassProvider() + public function supportsClassProvider(): array { return [ ['foo'], @@ -77,7 +78,7 @@ public function supportsClassProvider() /** * @dataProvider voteInvalidAttributeProvider */ - public function testVoteInvalidAttribute(array $attributes) + public function testVoteInvalidAttribute(array $attributes): void { $voter = new CoreVoter($this->permissionResolver); self::assertSame( @@ -90,7 +91,7 @@ public function testVoteInvalidAttribute(array $attributes) ); } - public function voteInvalidAttributeProvider() + public function voteInvalidAttributeProvider(): array { return [ [[]], @@ -113,7 +114,7 @@ public function voteInvalidAttributeProvider() /** * @dataProvider voteProvider */ - public function testVote(Attribute $attribute, $repositoryCanUser, $expectedResult) + public function testVote(Attribute $attribute, ?bool $repositoryCanUser, int $expectedResult): void { $voter = new CoreVoter($this->permissionResolver); if ($repositoryCanUser !== null) { @@ -138,7 +139,7 @@ public function testVote(Attribute $attribute, $repositoryCanUser, $expectedResu ); } - public function voteProvider() + public function voteProvider(): array { return [ [ diff --git a/tests/lib/MVC/Symfony/Security/Voter/ValueObjectVoterTest.php b/tests/lib/MVC/Symfony/Security/Voter/ValueObjectVoterTest.php index 971b646df8..140e35b84b 100644 --- a/tests/lib/MVC/Symfony/Security/Voter/ValueObjectVoterTest.php +++ b/tests/lib/MVC/Symfony/Security/Voter/ValueObjectVoterTest.php @@ -12,6 +12,7 @@ use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute; use Ibexa\Core\MVC\Symfony\Security\Authorization\Voter\ValueObjectVoter; use Ibexa\Core\Repository\Permission\PermissionResolver; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; @@ -19,7 +20,7 @@ class ValueObjectVoterTest extends TestCase { /** @var \Ibexa\Core\Repository\Permission\PermissionResolver|\PHPUnit\Framework\MockObject\MockObject */ - private $permissionResolver; + private MockObject $permissionResolver; protected function setUp(): void { @@ -30,13 +31,13 @@ protected function setUp(): void /** * @dataProvider supportsAttributeProvider */ - public function testSupportsAttribute($attribute, $expectedResult) + public function testSupportsAttribute(string|Attribute|\stdClass|array $attribute, bool $expectedResult): void { $voter = new ValueObjectVoter($this->permissionResolver); self::assertSame($expectedResult, $voter->supportsAttribute($attribute)); } - public function supportsAttributeProvider() + public function supportsAttributeProvider(): array { return [ ['foo', false], @@ -58,13 +59,13 @@ public function supportsAttributeProvider() /** * @dataProvider supportsClassProvider */ - public function testSupportsClass($class) + public function testSupportsClass(string $class): void { $voter = new ValueObjectVoter($this->permissionResolver); self::assertTrue($voter->supportsClass($class)); } - public function supportsClassProvider() + public function supportsClassProvider(): array { return [ ['foo'], @@ -77,7 +78,7 @@ public function supportsClassProvider() /** * @dataProvider voteInvalidAttributeProvider */ - public function testVoteInvalidAttribute(array $attributes) + public function testVoteInvalidAttribute(array $attributes): void { $voter = new ValueObjectVoter($this->permissionResolver); self::assertSame( @@ -90,7 +91,7 @@ public function testVoteInvalidAttribute(array $attributes) ); } - public function voteInvalidAttributeProvider() + public function voteInvalidAttributeProvider(): array { return [ [[]], @@ -104,7 +105,7 @@ public function voteInvalidAttributeProvider() /** * @dataProvider voteProvider */ - public function testVote(Attribute $attribute, $repositoryCanUser, $expectedResult) + public function testVote(Attribute $attribute, bool $repositoryCanUser, int $expectedResult): void { $voter = new ValueObjectVoter($this->permissionResolver); $targets = isset($attribute->limitations['targets']) ? $attribute->limitations['targets'] : []; @@ -124,7 +125,7 @@ public function testVote(Attribute $attribute, $repositoryCanUser, $expectedResu ); } - public function voteProvider() + public function voteProvider(): array { return [ [ diff --git a/tests/lib/MVC/Symfony/SiteAccess/Compound/CompoundAndTest.php b/tests/lib/MVC/Symfony/SiteAccess/Compound/CompoundAndTest.php index 8db7c5688b..692ba53a3c 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/Compound/CompoundAndTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/Compound/CompoundAndTest.php @@ -15,12 +15,13 @@ use Ibexa\Core\MVC\Symfony\SiteAccess\MatcherBuilder; use Ibexa\Core\MVC\Symfony\SiteAccess\MatcherBuilderInterface; use Ibexa\Core\MVC\Symfony\SiteAccess\VersatileMatcher; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class CompoundAndTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $matcherBuilder; + private MockObject $matcherBuilder; protected function setUp(): void { @@ -39,7 +40,7 @@ public function testConstruct() /** * @return \Ibexa\Core\MVC\Symfony\SiteAccess\Matcher\Compound\LogicalAnd */ - private function buildMatcher() + private function buildMatcher(): LogicalAnd { return new LogicalAnd( [ @@ -71,7 +72,7 @@ private function buildMatcher() /** * @depends testConstruct */ - public function testSetMatcherBuilder(Compound $compoundMatcher) + public function testSetMatcherBuilder(Compound $compoundMatcher): void { $this ->matcherBuilder @@ -94,7 +95,7 @@ public function testSetMatcherBuilder(Compound $compoundMatcher) * @param \Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest $request * @param $expectedMatch */ - public function testMatch(SimplifiedRequest $request, $expectedMatch) + public function testMatch(SimplifiedRequest $request, $expectedMatch): void { $compoundMatcher = $this->buildMatcher(); $compoundMatcher->setRequest($request); @@ -102,7 +103,7 @@ public function testMatch(SimplifiedRequest $request, $expectedMatch) self::assertSame($expectedMatch, $compoundMatcher->match()); } - public function testSetRequest() + public function testSetRequest(): void { $compoundMatcher = new LogicalAnd( [ @@ -138,7 +139,7 @@ public function testSetRequest() $compoundMatcher->setRequest($request); } - public function matchProvider() + public function matchProvider(): array { return [ [SimplifiedRequest::fromUrl('http://fr.ezpublish.dev/eng'), 'fr_eng'], @@ -152,7 +153,7 @@ public function matchProvider() ]; } - public function testReverseMatchSiteAccessNotConfigured() + public function testReverseMatchSiteAccessNotConfigured(): void { $compoundMatcher = $this->buildMatcher(); $this->matcherBuilder @@ -165,7 +166,7 @@ public function testReverseMatchSiteAccessNotConfigured() self::assertNull($compoundMatcher->reverseMatch('not_configured_sa')); } - public function testReverseMatchNotVersatile() + public function testReverseMatchNotVersatile(): void { $request = $this->createMock(SimplifiedRequest::class); $siteAccessName = 'fr_eng'; @@ -215,7 +216,7 @@ public function testReverseMatchNotVersatile() self::assertNull($compoundMatcher->reverseMatch($siteAccessName)); } - public function testReverseMatchFail() + public function testReverseMatchFail(): void { $request = $this->createMock(SimplifiedRequest::class); $siteAccessName = 'fr_eng'; @@ -263,7 +264,7 @@ public function testReverseMatchFail() self::assertNull($compoundMatcher->reverseMatch($siteAccessName)); } - public function testReverseMatch() + public function testReverseMatch(): void { $request = $this->createMock(SimplifiedRequest::class); $siteAccessName = 'fr_eng'; @@ -317,7 +318,7 @@ public function testReverseMatch() } } - public function testSerialize() + public function testSerialize(): void { $matcher = new LogicalAnd([]); $matcher->setRequest(new SimplifiedRequest('http', '', 80, '/foo/bar')); diff --git a/tests/lib/MVC/Symfony/SiteAccess/Compound/CompoundOrTest.php b/tests/lib/MVC/Symfony/SiteAccess/Compound/CompoundOrTest.php index dad491048d..cdeb4e41ee 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/Compound/CompoundOrTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/Compound/CompoundOrTest.php @@ -15,12 +15,13 @@ use Ibexa\Core\MVC\Symfony\SiteAccess\MatcherBuilder; use Ibexa\Core\MVC\Symfony\SiteAccess\MatcherBuilderInterface; use Ibexa\Core\MVC\Symfony\SiteAccess\VersatileMatcher; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class CompoundOrTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $matcherBuilder; + private MockObject $matcherBuilder; protected function setUp(): void { @@ -58,7 +59,7 @@ private function buildMatcher(): LogicalOr /** * @depends testConstruct */ - public function testSetMatcherBuilder(Compound $compoundMatcher) + public function testSetMatcherBuilder(Compound $compoundMatcher): void { $this->matcherBuilder ->expects(self::any()) @@ -80,7 +81,7 @@ public function testSetMatcherBuilder(Compound $compoundMatcher) * @param \Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest $request * @param string $expectedMatch */ - public function testMatch(SimplifiedRequest $request, $expectedMatch) + public function testMatch(SimplifiedRequest $request, $expectedMatch): void { $compoundMatcher = $this->buildMatcher(); $compoundMatcher->setRequest($request); @@ -88,7 +89,7 @@ public function testMatch(SimplifiedRequest $request, $expectedMatch) self::assertSame($expectedMatch, $compoundMatcher->match()); } - public function matchProvider() + public function matchProvider(): array { return [ [SimplifiedRequest::fromUrl('http://fr.ezpublish.dev/eng'), 'fr_eng'], @@ -103,7 +104,7 @@ public function matchProvider() ]; } - public function testReverseMatchSiteAccessNotConfigured() + public function testReverseMatchSiteAccessNotConfigured(): void { $compoundMatcher = $this->buildMatcher(); $this->matcherBuilder @@ -116,7 +117,7 @@ public function testReverseMatchSiteAccessNotConfigured() self::assertNull($compoundMatcher->reverseMatch('not_configured_sa')); } - public function testReverseMatchNotVersatile() + public function testReverseMatchNotVersatile(): void { $request = $this->createMock(SimplifiedRequest::class); $siteAccessName = 'fr_eng'; @@ -167,7 +168,7 @@ public function testReverseMatchNotVersatile() self::assertNull($compoundMatcher->reverseMatch($siteAccessName)); } - public function testReverseMatchFail() + public function testReverseMatchFail(): void { $request = $this->createMock(SimplifiedRequest::class); $siteAccessName = 'fr_eng'; @@ -215,7 +216,7 @@ public function testReverseMatchFail() self::assertNull($compoundMatcher->reverseMatch($siteAccessName)); } - public function testReverseMatch1() + public function testReverseMatch1(): void { $request = $this->createMock(SimplifiedRequest::class); $siteAccessName = 'fr_eng'; @@ -266,7 +267,7 @@ public function testReverseMatch1() } } - public function testReverseMatch2() + public function testReverseMatch2(): void { $request = $this->createMock(SimplifiedRequest::class); $siteAccessName = 'fr_eng'; @@ -319,7 +320,7 @@ public function testReverseMatch2() } } - public function testSerialize() + public function testSerialize(): void { $matcher = new LogicalOr([]); $matcher->setRequest(new SimplifiedRequest('http', '', 80, '/foo/bar')); diff --git a/tests/lib/MVC/Symfony/SiteAccess/MatcherSerializationTest.php b/tests/lib/MVC/Symfony/SiteAccess/MatcherSerializationTest.php index 4a053016fc..4721706753 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/MatcherSerializationTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/MatcherSerializationTest.php @@ -9,6 +9,8 @@ use Ibexa\Core\MVC\Symfony\Component\Serializer\SerializerTrait; use Ibexa\Core\MVC\Symfony\SiteAccess\Matcher; +use Ibexa\Core\MVC\Symfony\SiteAccess\Matcher\Compound\LogicalAnd; +use Ibexa\Core\MVC\Symfony\SiteAccess\Matcher\Compound\LogicalOr; use PHPUnit\Framework\TestCase; class MatcherSerializationTest extends TestCase @@ -20,7 +22,7 @@ class MatcherSerializationTest extends TestCase * * @dataProvider matcherProvider */ - public function testDeserialize(Matcher $matcher, $expected = null): void + public function testDeserialize(Matcher $matcher, LogicalAnd|LogicalOr $expected = null): void { $serializedMatcher = $this->serializeMatcher($matcher); @@ -42,7 +44,7 @@ public function testDeserialize(Matcher $matcher, $expected = null): void /** * @return string */ - private function serializeMatcher(Matcher $matcher) + private function serializeMatcher(Matcher $matcher): string { return $this->getSerializer()->serialize( $matcher, @@ -77,7 +79,7 @@ public function matcherProvider(): iterable Matcher\Map\URI::class => new Matcher\Map\URI([]), Matcher\Map\Host::class => new Matcher\Map\Host([]), ]; - $logicalAnd = new Matcher\Compound\LogicalAnd( + $logicalAnd = new LogicalAnd( [ [ 'match' => 'site_access_name', @@ -85,10 +87,10 @@ public function matcherProvider(): iterable ] ); $logicalAnd->setSubMatchers($subMatchers); - $expectedLogicalAnd = new Matcher\Compound\LogicalAnd([]); + $expectedLogicalAnd = new LogicalAnd([]); $expectedLogicalAnd->setSubMatchers($expectedSubMatchers); - $logicalOr = new Matcher\Compound\LogicalOr( + $logicalOr = new LogicalOr( [ [ 'match' => 'site_access_name', @@ -96,7 +98,7 @@ public function matcherProvider(): iterable ] ); $logicalOr->setSubMatchers($subMatchers); - $expectedLogicalOr = new Matcher\Compound\LogicalOr([]); + $expectedLogicalOr = new LogicalOr([]); $expectedLogicalOr->setSubMatchers($expectedSubMatchers); $expectedMapURI = new Matcher\Map\URI([]); diff --git a/tests/lib/MVC/Symfony/SiteAccess/Provider/ChainSiteAccessProviderTest.php b/tests/lib/MVC/Symfony/SiteAccess/Provider/ChainSiteAccessProviderTest.php index c774ec8d2b..e3c5b7f026 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/Provider/ChainSiteAccessProviderTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/Provider/ChainSiteAccessProviderTest.php @@ -24,10 +24,10 @@ final class ChainSiteAccessProviderTest extends TestCase private const SA_GROUP = 'group'; /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessProviderInterface[] */ - private $providers; + private array $providers; /** @var array */ - private $groupsBySiteAccess; + private array $groupsBySiteAccess; protected function setUp(): void { @@ -163,7 +163,7 @@ private function createSiteAcccess(string $name, array $groupNames = []): SiteAc StaticSiteAccessProvider::class ); $undefinedSiteAccess->groups = array_map( - static function (string $groupName) { + static function (string $groupName): SiteAccessGroup { return new SiteAccessGroup($groupName); }, $groupNames diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterBaseTest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterBaseTest.php index 79b9f905e4..f772e3253b 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterBaseTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterBaseTest.php @@ -43,7 +43,7 @@ public function testConstruct(): Router /** * @dataProvider matchProvider */ - public function testMatch(SimplifiedRequest $request, string $siteAccess) + public function testMatch(SimplifiedRequest $request, string $siteAccess): void { $router = $this->createRouter(); $sa = $router->match($request); diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterHostElementTest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterHostElementTest.php index 8a7eb4a0af..a6449ec02e 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterHostElementTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterHostElementTest.php @@ -73,7 +73,7 @@ public function matchProvider(): array ]; } - public function testGetName() + public function testGetName(): void { $matcher = new HostMapMatcher(['host' => 'foo'], []); self::assertSame('host:map', $matcher->getName()); @@ -85,7 +85,7 @@ public function testGetName() /** * @dataProvider reverseMatchProvider */ - public function testReverseMatch($siteAccessName, $elementNumber, SimplifiedRequest $request, $expectedHost) + public function testReverseMatch(string $siteAccessName, int $elementNumber, SimplifiedRequest $request, string $expectedHost): void { $matcher = new HostElement([$elementNumber]); $matcher->setRequest($request); @@ -94,7 +94,7 @@ public function testReverseMatch($siteAccessName, $elementNumber, SimplifiedRequ self::assertSame($expectedHost, $result->getRequest()->getHost()); } - public function reverseMatchProvider() + public function reverseMatchProvider(): array { return [ ['foo', 1, SimplifiedRequest::fromUrl('http://bar.example.com/'), 'foo.example.com'], @@ -104,14 +104,14 @@ public function reverseMatchProvider() ]; } - public function testReverseMatchFail() + public function testReverseMatchFail(): void { $matcher = new HostElement([3]); $matcher->setRequest(new SimplifiedRequest('http', 'ibexa.co')); self::assertNull($matcher->reverseMatch('foo')); } - public function testSerialize() + public function testSerialize(): void { $matcher = new HostElement([1]); $matcher->setRequest(new SimplifiedRequest('http', 'ibexa.co', 80, '/foo/bar')); diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterHostPortURITest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterHostPortURITest.php index 7e9d96c9c8..75d9e7c97f 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterHostPortURITest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterHostPortURITest.php @@ -83,7 +83,7 @@ public function matchProvider(): array ]; } - public function testSetGetRequestMapHost() + public function testSetGetRequestMapHost(): void { $mapKey = 'phoenix-rises.fm'; $request = new SimplifiedRequest('http', $mapKey); @@ -93,14 +93,14 @@ public function testSetGetRequestMapHost() self::assertSame($mapKey, $matcher->getMapKey()); } - public function testReverseHostMatchFail() + public function testReverseHostMatchFail(): void { $config = ['foo' => 'bar']; $matcher = new Host($config); self::assertNull($matcher->reverseMatch('non_existent')); } - public function testReverseMatchHost() + public function testReverseMatchHost(): void { $config = [ 'ibexa.co' => 'some_siteaccess', @@ -119,7 +119,7 @@ public function testReverseMatchHost() self::assertSame('phoenix-rises.fm', $result->getRequest()->getHost()); } - public function testSetGetRequestMapPort() + public function testSetGetRequestMapPort(): void { $mapKey = 8000; $request = new SimplifiedRequest('http', '', $mapKey); @@ -129,14 +129,14 @@ public function testSetGetRequestMapPort() self::assertSame((string)$mapKey, $matcher->getMapKey()); } - public function testReversePortMatchFail() + public function testReversePortMatchFail(): void { $config = ['foo' => 8080]; $matcher = new Port($config); self::assertNull($matcher->reverseMatch('non_existent')); } - public function testReverseMatchPort() + public function testReverseMatchPort(): void { $config = [ '80' => 'some_siteaccess', diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterHostTextTest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterHostTextTest.php index c185d744ef..2c7c7b1ae1 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterHostTextTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterHostTextTest.php @@ -71,13 +71,13 @@ public function matchProvider(): array ]; } - public function testGetName() + public function testGetName(): void { $matcher = new HostTextMatcher(['host' => 'foo'], []); self::assertSame('host:text', $matcher->getName()); } - public function testReverseMatch() + public function testReverseMatch(): void { $matcher = new HostTextMatcher( [ diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterMapURITest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterMapURITest.php index a78712c5cc..26f775a5f0 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterMapURITest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterMapURITest.php @@ -20,7 +20,7 @@ class RouterMapURITest extends TestCase * * @dataProvider setRequestProvider */ - public function testSetGetRequest($config, $pathinfo, $expectedMapKey) + public function testSetGetRequest(array $config, string $pathinfo, string $expectedMapKey): void { $request = new SimplifiedRequest('http', '', 80, $pathinfo); $matcher = new URIMapMatcher($config); @@ -35,7 +35,7 @@ public function testSetGetRequest($config, $pathinfo, $expectedMapKey) * * @dataProvider fixupURIProvider */ - public function testAnalyseURI($uri, $expectedFixedUpURI) + public function testAnalyseURI(string $uri, string $expectedFixedUpURI): void { $matcher = new URIMapMatcher([]); $matcher->setRequest( @@ -53,7 +53,7 @@ public function testAnalyseURI($uri, $expectedFixedUpURI) * * @dataProvider fixupURIProvider */ - public function testAnalyseLink($fullUri, $linkUri) + public function testAnalyseLink(string $fullUri, string $linkUri): void { $matcher = new URIMapMatcher([]); $matcher->setRequest( @@ -65,7 +65,7 @@ public function testAnalyseLink($fullUri, $linkUri) self::assertSame($fullUri, $unserializedMatcher->analyseLink($linkUri)); } - public function setRequestProvider() + public function setRequestProvider(): array { return [ [['foo' => 'bar'], '/bar/baz', 'bar'], @@ -73,7 +73,7 @@ public function setRequestProvider() ]; } - public function fixupURIProvider() + public function fixupURIProvider(): array { return [ ['/foo', '/'], @@ -86,14 +86,14 @@ public function fixupURIProvider() ]; } - public function testReverseMatchFail() + public function testReverseMatchFail(): void { $config = ['foo' => 'bar']; $matcher = new URIMapMatcher($config); self::assertNull($matcher->reverseMatch('non_existent')); } - public function testReverseMatch() + public function testReverseMatch(): void { $config = [ 'some_uri' => 'some_siteaccess', diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterSpecialPortsTest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterSpecialPortsTest.php index 20b5399ca3..9071ee3efb 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterSpecialPortsTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterSpecialPortsTest.php @@ -75,7 +75,7 @@ public function matchProvider(): array ]; } - public function testGetName() + public function testGetName(): void { $matcher = new PortMatcher(['port' => '8080', 'scheme' => 'http'], []); self::assertSame('port', $matcher->getName()); diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterTest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterTest.php index e18e03a063..85d518b4fd 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterTest.php @@ -25,7 +25,7 @@ protected function tearDown(): void parent::tearDown(); } - public function testConstructDebug() + public function testConstructDebug(): Router { return $this->createRouter(true); } @@ -33,7 +33,7 @@ public function testConstructDebug() /** * @dataProvider matchProvider */ - public function testMatch(SimplifiedRequest $request, $siteAccess) + public function testMatch(SimplifiedRequest $request, string $siteAccess): void { $router = $this->createRouter(); $sa = $router->match($request); @@ -44,7 +44,7 @@ public function testMatch(SimplifiedRequest $request, $siteAccess) $router->setSiteAccess(); } - public function testMatchWithDevEnvFail() + public function testMatchWithDevEnvFail(): void { $router = $this->createRouter(true); putenv('EZPUBLISH_SITEACCESS=' . self::UNDEFINED_SA_NAME); @@ -57,7 +57,7 @@ public function testMatchWithDevEnvFail() $router->match(new SimplifiedRequest()); } - public function testMatchWithProdEnvFail() + public function testMatchWithProdEnvFail(): void { $router = $this->createRouter(); putenv('EZPUBLISH_SITEACCESS=' . self::UNDEFINED_SA_NAME); @@ -70,7 +70,7 @@ public function testMatchWithProdEnvFail() $router->match(new SimplifiedRequest()); } - public function testMatchWithEnv() + public function testMatchWithEnv(): void { $router = $this->createRouter(); putenv('EZPUBLISH_SITEACCESS=' . self::ENV_SA_NAME); @@ -163,7 +163,7 @@ public function matchProvider(): array ]; } - public function testMatchByNameInvalidSiteAccess() + public function testMatchByNameInvalidSiteAccess(): void { $this->expectException(\InvalidArgumentException::class); @@ -178,7 +178,7 @@ public function testMatchByNameInvalidSiteAccess() $router->matchByName('bar'); } - public function testMatchByName() + public function testMatchByName(): void { $matcherBuilder = $this->createMock(MatcherBuilderInterface::class); $logger = $this->createMock(LoggerInterface::class); @@ -230,7 +230,7 @@ public function testMatchByName() self::assertSame($matchedSiteAccess, $siteAccess->name); } - public function testMatchByNameNoVersatileMatcher() + public function testMatchByNameNoVersatileMatcher(): void { $matcherBuilder = $this->createMock(MatcherBuilderInterface::class); $logger = $this->createMock(LoggerInterface::class); diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterURIElement2Test.php b/tests/lib/MVC/Symfony/SiteAccess/RouterURIElement2Test.php index b5367500ba..2639d21305 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterURIElement2Test.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterURIElement2Test.php @@ -74,7 +74,7 @@ public function matchProvider(): array * * @dataProvider analyseProvider */ - public function testAnalyseURI($level, $uri, $expectedFixedUpURI) + public function testAnalyseURI(int $level, string $uri, string $expectedFixedUpURI): void { $matcher = new URIElementMatcher([$level]); $matcher->setRequest( @@ -90,7 +90,7 @@ public function testAnalyseURI($level, $uri, $expectedFixedUpURI) * * @dataProvider analyseProvider */ - public function testAnalyseURILevelAsInt($level, $uri, $expectedFixedUpURI) + public function testAnalyseURILevelAsInt(int $level, string $uri, string $expectedFixedUpURI): void { $matcher = new URIElementMatcher($level); $matcher->setRequest( @@ -106,7 +106,7 @@ public function testAnalyseURILevelAsInt($level, $uri, $expectedFixedUpURI) * * @dataProvider analyseProvider */ - public function testAnalyseLink($level, $fullUri, $linkUri) + public function testAnalyseLink(int $level, string $fullUri, string $linkUri): void { $matcher = new URIElementMatcher([$level]); $matcher->setRequest( @@ -115,7 +115,7 @@ public function testAnalyseLink($level, $fullUri, $linkUri) self::assertSame($fullUri, $matcher->analyseLink($linkUri)); } - public function analyseProvider() + public function analyseProvider(): array { return [ [2, '/my/siteaccess/foo/bar', '/foo/bar'], @@ -136,7 +136,7 @@ public function analyseProvider() /** * @dataProvider reverseMatchProvider */ - public function testReverseMatch($siteAccessName, $originalPathinfo) + public function testReverseMatch(string $siteAccessName, string $originalPathinfo): void { $expectedSiteAccessPath = str_replace('_', '/', $siteAccessName); $matcher = new URIElementMatcher([2]); @@ -149,7 +149,7 @@ public function testReverseMatch($siteAccessName, $originalPathinfo) self::assertSame('/foo/bar/baz', $result->analyseURI("/$expectedSiteAccessPath/foo/bar/baz")); } - public function reverseMatchProvider() + public function reverseMatchProvider(): array { return [ ['some_thing', '/foo/bar'], @@ -157,14 +157,14 @@ public function reverseMatchProvider() ]; } - public function testReverseMatchFail() + public function testReverseMatchFail(): void { $matcher = new URIElementMatcher([2]); $matcher->setRequest(new SimplifiedRequest('http', '', 80, '/my/siteaccess/foo/bar')); self::assertNull($matcher->reverseMatch('another_siteaccess_again_dont_tell_me')); } - public function testSerialize() + public function testSerialize(): void { $matcher = new URIElementMatcher([2]); $matcher->setRequest(new SimplifiedRequest('http', '', 80, '/foo/bar')); diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterURIElementTest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterURIElementTest.php index 070ac79390..1b9cf1cecb 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterURIElementTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterURIElementTest.php @@ -67,7 +67,7 @@ public function matchProvider(): array ]; } - public function testGetName() + public function testGetName(): void { $matcher = new URIElementMatcher([]); self::assertSame('uri:element', $matcher->getName()); @@ -79,7 +79,7 @@ public function testGetName() * * @dataProvider analyseProvider */ - public function testAnalyseURI($uri, $expectedFixedUpURI) + public function testAnalyseURI(string $uri, string $expectedFixedUpURI): void { $matcher = new URIElementMatcher([1]); $matcher->setRequest( @@ -94,7 +94,7 @@ public function testAnalyseURI($uri, $expectedFixedUpURI) * * @dataProvider analyseProvider */ - public function testAnalyseLink($fullUri, $linkUri) + public function testAnalyseLink(string $fullUri, string $linkUri): void { $matcher = new URIElementMatcher([1]); $matcher->setRequest( @@ -103,7 +103,7 @@ public function testAnalyseLink($fullUri, $linkUri) self::assertSame($fullUri, $matcher->analyseLink($linkUri)); } - public function analyseProvider() + public function analyseProvider(): array { return [ ['/my_siteaccess/foo/bar', '/foo/bar'], @@ -114,7 +114,7 @@ public function analyseProvider() /** * @dataProvider reverseMatchProvider */ - public function testReverseMatch($siteAccessName, $originalPathinfo) + public function testReverseMatch(string $siteAccessName, string $originalPathinfo): void { $matcher = new URIElementMatcher([1]); $matcher->setRequest(new SimplifiedRequest('http', '', 80, $originalPathinfo)); @@ -125,7 +125,7 @@ public function testReverseMatch($siteAccessName, $originalPathinfo) self::assertSame('/foo/bar/baz', $result->analyseURI("/$siteAccessName/foo/bar/baz")); } - public function reverseMatchProvider() + public function reverseMatchProvider(): array { return [ ['something', '/foo/bar'], @@ -136,7 +136,7 @@ public function reverseMatchProvider() ]; } - public function testSerialize() + public function testSerialize(): void { $matcher = new URIElementMatcher([1]); $matcher->setRequest(new SimplifiedRequest('http', '', 80, '/foo/bar')); diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterURITextTest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterURITextTest.php index bcc90d3241..6904a08651 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterURITextTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterURITextTest.php @@ -73,13 +73,13 @@ public function matchProvider(): array ]; } - public function testGetName() + public function testGetName(): void { $matcher = new URITextMatcher([], []); self::assertSame('uri:text', $matcher->getName()); } - public function testAnalyseURI() + public function testAnalyseURI(): void { $siteAccessURI = '/footestbar'; $semanticURI = '/something/hoho'; @@ -94,7 +94,7 @@ public function testAnalyseURI() self::assertSame($semanticURI, $matcher->analyseURI($siteAccessURI . $semanticURI)); } - public function testAnalyseLink() + public function testAnalyseLink(): void { $siteAccessURI = '/footestbar'; $semanticURI = '/something/hoho'; @@ -109,7 +109,7 @@ public function testAnalyseLink() self::assertSame($siteAccessURI . $semanticURI, $matcher->analyseLink($semanticURI)); } - public function testReverseMatch() + public function testReverseMatch(): void { $semanticURI = '/hihi/hoho'; $matcher = new URITextMatcher( diff --git a/tests/lib/MVC/Symfony/SiteAccess/SiteAccessServiceTest.php b/tests/lib/MVC/Symfony/SiteAccess/SiteAccessServiceTest.php index 7ef230d7ee..641a145765 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/SiteAccessServiceTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/SiteAccessServiceTest.php @@ -15,6 +15,7 @@ use Ibexa\Core\MVC\Symfony\SiteAccess\Provider\StaticSiteAccessProvider; use Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessProviderInterface; use Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessService; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class SiteAccessServiceTest extends TestCase @@ -24,19 +25,19 @@ class SiteAccessServiceTest extends TestCase private const SA_GROUP = 'group'; /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessProviderInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $provider; + private MockObject $provider; /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $configResolver; + private MockObject $configResolver; /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ - private $siteAccess; + private SiteAccess $siteAccess; /** @var \ArrayIterator */ - private $availableSiteAccesses; + private ArrayIterator $availableSiteAccesses; /** @var array */ - private $configResolverParameters; + private array $configResolverParameters; protected function setUp(): void { diff --git a/tests/lib/MVC/Symfony/Templating/GlobalHelperTest.php b/tests/lib/MVC/Symfony/Templating/GlobalHelperTest.php index c4ada9c45b..6f93b233e2 100644 --- a/tests/lib/MVC/Symfony/Templating/GlobalHelperTest.php +++ b/tests/lib/MVC/Symfony/Templating/GlobalHelperTest.php @@ -14,6 +14,7 @@ use Ibexa\Core\MVC\Symfony\Routing\UrlAliasRouter; use Ibexa\Core\MVC\Symfony\SiteAccess; use Ibexa\Core\MVC\Symfony\Templating\GlobalHelper; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; @@ -26,19 +27,19 @@ class GlobalHelperTest extends TestCase protected $helper; /** @var \PHPUnit\Framework\MockObject\MockObject */ - protected $container; + protected MockObject $container; /** @var \PHPUnit\Framework\MockObject\MockObject */ - protected $locationService; + protected MockObject $locationService; /** @var \PHPUnit\Framework\MockObject\MockObject */ - protected $configResolver; + protected MockObject $configResolver; /** @var \PHPUnit\Framework\MockObject\MockObject */ - protected $router; + protected MockObject $router; /** @var \PHPUnit\Framework\MockObject\MockObject */ - protected $translationHelper; + protected MockObject $translationHelper; protected function setUp(): void { @@ -52,7 +53,7 @@ protected function setUp(): void $this->helper = new GlobalHelper($this->configResolver, $this->locationService, $this->router, $this->translationHelper); } - public function testGetSiteaccess() + public function testGetSiteaccess(): void { $request = new Request(); $requestStack = new RequestStack(); @@ -64,7 +65,7 @@ public function testGetSiteaccess() self::assertSame($siteAccess, $this->helper->getSiteaccess()); } - public function testGetViewParameters() + public function testGetViewParameters(): void { $request = Request::create('/foo'); $viewParameters = [ @@ -80,7 +81,7 @@ public function testGetViewParameters() self::assertSame($viewParameters, $this->helper->getViewParameters()); } - public function testGetViewParametersString() + public function testGetViewParametersString(): void { $request = Request::create('/foo'); $viewParametersString = '/(foo)/bar/(toto)/tata/(somethingelse)/héhé-høhø'; @@ -92,7 +93,7 @@ public function testGetViewParametersString() self::assertSame($viewParametersString, $this->helper->getViewParametersString()); } - public function testGetRequestedUriString() + public function testGetRequestedUriString(): void { $request = Request::create('/ibexa_demo_site/foo/bar'); $semanticPathinfo = '/foo/bar'; @@ -104,7 +105,7 @@ public function testGetRequestedUriString() self::assertSame($semanticPathinfo, $this->helper->getRequestedUriString()); } - public function testGetSystemUriStringNoUrlAlias() + public function testGetSystemUriStringNoUrlAlias(): void { $request = Request::create('/ibexa_demo_site/foo/bar'); $semanticPathinfo = '/foo/bar'; @@ -116,7 +117,7 @@ public function testGetSystemUriStringNoUrlAlias() self::assertSame($semanticPathinfo, $this->helper->getSystemUriString()); } - public function testGetSystemUriString() + public function testGetSystemUriString(): void { $locationId = 123; $contentId = 456; @@ -145,12 +146,12 @@ public function testGetSystemUriString() self::assertSame($expectedSystemUriString, $this->helper->getSystemUriString()); } - public function testGetConfigResolver() + public function testGetConfigResolver(): void { self::assertSame($this->configResolver, $this->helper->getConfigResolver()); } - public function testGetRootLocation() + public function testGetRootLocation(): void { $rootLocationId = 2; $this->configResolver @@ -173,7 +174,7 @@ public function testGetRootLocation() self::assertSame($rootLocation, $this->helper->getRootLocation()); } - public function testGetTranslationSiteAccess() + public function testGetTranslationSiteAccess(): void { $language = 'fre-FR'; $siteaccess = 'fre'; @@ -186,7 +187,7 @@ public function testGetTranslationSiteAccess() self::assertSame($siteaccess, $this->helper->getTranslationSiteAccess($language)); } - public function testGetAvailableLanguages() + public function testGetAvailableLanguages(): void { $languages = ['fre-FR', 'eng-GB', 'esl-ES']; $this->translationHelper diff --git a/tests/lib/MVC/Symfony/Templating/RenderStrategyTest.php b/tests/lib/MVC/Symfony/Templating/RenderStrategyTest.php index 9c3189249f..c5f054f624 100644 --- a/tests/lib/MVC/Symfony/Templating/RenderStrategyTest.php +++ b/tests/lib/MVC/Symfony/Templating/RenderStrategyTest.php @@ -22,11 +22,9 @@ private function createRenderStrategy( string $supportsClass = ValueObject::class ): SPIRenderStrategy { return new class($rendered, $supportsClass) implements SPIRenderStrategy { - /** @var string */ - private $rendered; + private string $rendered; - /** @var string */ - private $supportsClass; + private string $supportsClass; public function __construct(string $rendered, string $supportsClass) { diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtensionTest.php b/tests/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtensionTest.php index 788126e5dc..92fae1be58 100644 --- a/tests/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtensionTest.php +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/ContentExtensionTest.php @@ -23,6 +23,7 @@ use Ibexa\Core\Repository\Values\ContentType\ContentType; use Ibexa\Core\Repository\Values\ContentType\FieldDefinition; use Ibexa\Core\Repository\Values\ContentType\FieldDefinitionCollection; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; /** @@ -33,13 +34,13 @@ class ContentExtensionTest extends FileSystemTwigIntegrationTestCase { /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService|\PHPUnit\Framework\MockObject\MockObject */ - private $fieldHelperMock; + private ?MockObject $fieldHelperMock = null; /** @var array */ - private $fieldDefinitions = []; + private array $fieldDefinitions = []; /** @var int[] */ - private $identityMap = []; + private array $identityMap = []; public function getExtensions() { @@ -75,7 +76,7 @@ public function getFixturesDir() * * @return \Ibexa\Core\Repository\Values\Content\Content */ - protected function getContent(string $contentTypeIdentifier, array $fieldsData, array $namesData = []) + protected function getContent(string $contentTypeIdentifier, array $fieldsData, array $namesData = []): Content { if (!array_key_exists($contentTypeIdentifier, $this->identityMap)) { $this->identityMap[$contentTypeIdentifier] = count($this->identityMap) + 1; @@ -142,7 +143,7 @@ protected function getContentAwareObject(string $contentTypeIdentifier, array $f return $mock; } - private function getConfigResolverMock() + private function getConfigResolverMock(): MockObject { $mock = $this->createMock(ConfigResolverInterface::class); // Signature: ConfigResolverInterface->getParameter( $paramName, $namespace = null, $scope = null ) @@ -174,7 +175,7 @@ private function getFieldsGroupsListMock(): FieldsGroupsList return $fieldsGroupsList; } - protected function getField($isEmpty) + protected function getField($isEmpty): Field { $field = new Field(['fieldDefIdentifier' => 'testfield', 'value' => null]); @@ -189,7 +190,7 @@ protected function getField($isEmpty) /** * @return \PHPUnit\Framework\MockObject\MockObject */ - protected function getRepositoryMock() + protected function getRepositoryMock(): MockObject { $mock = $this->createMock(Repository::class); @@ -203,7 +204,7 @@ protected function getRepositoryMock() /** * @return \PHPUnit\Framework\MockObject\MockObject */ - protected function getContentTypeServiceMock() + protected function getContentTypeServiceMock(): MockObject { $mock = $this->createMock(ContentTypeService::class); @@ -211,7 +212,7 @@ protected function getContentTypeServiceMock() ->method('loadContentType') ->will( self::returnCallback( - function ($contentTypeId) { + function ($contentTypeId): ContentType { return new ContentType( [ 'identifier' => $contentTypeId, diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtensionIntegrationTest.php b/tests/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtensionIntegrationTest.php index 95c0a10644..315214b13d 100644 --- a/tests/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtensionIntegrationTest.php +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/FieldRenderingExtensionIntegrationTest.php @@ -22,12 +22,13 @@ use Ibexa\Core\Repository\Values\ContentType\ContentType; use Ibexa\Core\Repository\Values\ContentType\FieldDefinition; use Ibexa\Core\Repository\Values\ContentType\FieldDefinitionCollection; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Twig\Environment; class FieldRenderingExtensionIntegrationTest extends FileSystemTwigIntegrationTestCase { - private $fieldDefinitions = []; + private array $fieldDefinitions = []; public function getExtensions() { @@ -60,7 +61,7 @@ public function getFixturesDir() return __DIR__ . '/_fixtures/field_rendering_functions/'; } - public function getFieldDefinition($typeIdentifier, $id = null, $settings = []) + public function getFieldDefinition($typeIdentifier, $id = null, $settings = []): FieldDefinition { return new FieldDefinition( [ @@ -80,7 +81,7 @@ public function getFieldDefinition($typeIdentifier, $id = null, $settings = []) * * @return \Ibexa\Core\Repository\Values\Content\Content */ - protected function getContent($contentTypeIdentifier, array $fieldsData, array $namesData = []) + protected function getContent($contentTypeIdentifier, array $fieldsData, array $namesData = []): Content { $fields = []; foreach ($fieldsData as $fieldTypeIdentifier => $fieldsArray) { @@ -147,12 +148,12 @@ protected function getContentAwareObject(string $contentTypeIdentifier, array $f return $mock; } - private function getTemplatePath($tpl): string + private function getTemplatePath(string $tpl): string { return 'templates/' . $tpl; } - private function getConfigResolverMock() + private function getConfigResolverMock(): MockObject { $mock = $this->createMock(ConfigResolverInterface::class); // Signature: ConfigResolverInterface->getParameter( $paramName, $namespace = null, $scope = null ) diff --git a/tests/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtensionTest.php b/tests/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtensionTest.php index da79e8c9ee..41c266954d 100644 --- a/tests/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtensionTest.php +++ b/tests/lib/MVC/Symfony/Templating/Twig/Extension/FileSizeExtensionTest.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\MVC\Symfony\Locale\LocaleConverterInterface; use Ibexa\Core\MVC\Symfony\Templating\Twig\Extension\FileSizeExtension; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Contracts\Translation\TranslatorInterface; use Twig\Test\IntegrationTestCase; @@ -31,7 +32,7 @@ class FileSizeExtensionTest extends IntegrationTestCase /** * @param \Symfony\Contracts\Translation\TranslatorInterface|\PHPUnit\Framework\MockObject\MockObject */ - protected $translatorMock; + protected ?MockObject $translatorMock = null; /** * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface|\PHPUnit\Framework\MockObject\MockObject @@ -41,7 +42,7 @@ class FileSizeExtensionTest extends IntegrationTestCase /** * @param \Ibexa\Core\MVC\Symfony\Locale\LocaleConverterInterface|\PHPUnit\Framework\MockObject\MockObject */ - protected $localeConverterInterfaceMock; + protected ?MockObject $localeConverterInterfaceMock = null; /** * @param string $locale @@ -56,7 +57,7 @@ protected function setConfigurationLocale($locale, $defaultLocale) /** * @return string $locale */ - public function getLocale() + public function getLocale(): array { return [$this->locale]; } @@ -79,7 +80,7 @@ protected function getFixturesDir(): string /** * @return \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface|\PHPUnit\Framework\MockObject\MockObject */ - protected function getConfigResolverInterfaceMock() + protected function getConfigResolverInterfaceMock(): MockObject { $configResolverInterfaceMock = $this->createMock(ConfigResolverInterface::class); $configResolverInterfaceMock->expects(self::any()) @@ -93,7 +94,7 @@ protected function getConfigResolverInterfaceMock() /** * @return \Ibexa\Core\MVC\Symfony\Locale\LocaleConverterInterface|\PHPUnit\Framework\MockObject\MockObject */ - protected function getLocaleConverterInterfaceMock() + protected function getLocaleConverterInterfaceMock(): MockObject { $this->localeConverterInterfaceMock = $this->createMock(LocaleConverterInterface::class); $this->localeConverterInterfaceMock->expects(self::any()) @@ -113,14 +114,14 @@ protected function getLocaleConverterInterfaceMock() /** * @return \Symfony\Contracts\Translation\TranslatorInterface|\PHPUnit\Framework\MockObject\MockObject */ - protected function getTranslatorInterfaceMock() + protected function getTranslatorInterfaceMock(): MockObject { $that = $this; $this->translatorMock = $this->createMock(TranslatorInterface::class); $this->translatorMock ->expects(self::any())->method('trans')->will( self::returnCallback( - static function ($suffixes) use ($that) { + static function (string $suffixes) use ($that) { foreach ($that->getLocale() as $value) { if ($value === 'fre-FR') { return $suffixes . ' French version'; diff --git a/tests/lib/MVC/Symfony/Translation/fixtures/ContentValidationExceptionUsageStub.php b/tests/lib/MVC/Symfony/Translation/fixtures/ContentValidationExceptionUsageStub.php index 6235c3b8a0..c3c77fabfe 100644 --- a/tests/lib/MVC/Symfony/Translation/fixtures/ContentValidationExceptionUsageStub.php +++ b/tests/lib/MVC/Symfony/Translation/fixtures/ContentValidationExceptionUsageStub.php @@ -18,7 +18,7 @@ final class ContentValidationExceptionUsageStub /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException */ - public function foo(): void + public function foo(): never { throw new ContentValidationException( 'Content with ID %contentId% could not be found', diff --git a/tests/lib/MVC/Symfony/Translation/fixtures/ForbiddenExceptionUsageStub.php b/tests/lib/MVC/Symfony/Translation/fixtures/ForbiddenExceptionUsageStub.php index e40290d0bb..066545154a 100644 --- a/tests/lib/MVC/Symfony/Translation/fixtures/ForbiddenExceptionUsageStub.php +++ b/tests/lib/MVC/Symfony/Translation/fixtures/ForbiddenExceptionUsageStub.php @@ -18,7 +18,7 @@ final class ForbiddenExceptionUsageStub /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException */ - public function foo(): void + public function foo(): never { throw new ForbiddenException('Forbidden exception'); } diff --git a/tests/lib/MVC/Symfony/View/Builder/ContentViewBuilderTest.php b/tests/lib/MVC/Symfony/View/Builder/ContentViewBuilderTest.php index ce4d1b3007..9cf237b227 100644 --- a/tests/lib/MVC/Symfony/View/Builder/ContentViewBuilderTest.php +++ b/tests/lib/MVC/Symfony/View/Builder/ContentViewBuilderTest.php @@ -25,6 +25,7 @@ use Ibexa\Core\Repository\Values\Content\Content; use Ibexa\Core\Repository\Values\Content\Location; use Ibexa\Core\Repository\Values\Content\VersionInfo; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use ReflectionClass; use Symfony\Component\HttpFoundation\ParameterBag; @@ -37,25 +38,25 @@ class ContentViewBuilderTest extends TestCase { /** @var \Ibexa\Contracts\Core\Repository\Repository|\PHPUnit\Framework\MockObject\MockObject */ - private $repository; + private MockObject $repository; /** @var \Ibexa\Core\MVC\Symfony\View\Configurator|\PHPUnit\Framework\MockObject\MockObject */ - private $viewConfigurator; + private MockObject $viewConfigurator; /** @var \Ibexa\Core\MVC\Symfony\View\ParametersInjector|\PHPUnit\Framework\MockObject\MockObject */ - private $parametersInjector; + private MockObject $parametersInjector; /** @var \Ibexa\Core\Helper\ContentInfoLocationLoader|\PHPUnit\Framework\MockObject\MockObject */ - private $contentInfoLocationLoader; + private MockObject $contentInfoLocationLoader; /** @var \Ibexa\Core\MVC\Symfony\View\Builder\ContentViewBuilder|\PHPUnit\Framework\MockObject\MockObject */ - private $contentViewBuilder; + private ContentViewBuilder $contentViewBuilder; /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver|\PHPUnit\Framework\MockObject\MockObject */ - private $permissionResolver; + private MockObject $permissionResolver; /** @var \Symfony\Component\HttpFoundation\RequestStack|\PHPUnit\Framework\MockObject\MockObject */ - private $requestStack; + private MockObject $requestStack; protected function setUp(): void { diff --git a/tests/lib/MVC/Symfony/View/ContentViewTest.php b/tests/lib/MVC/Symfony/View/ContentViewTest.php index 0708c32dce..de2bea42be 100644 --- a/tests/lib/MVC/Symfony/View/ContentViewTest.php +++ b/tests/lib/MVC/Symfony/View/ContentViewTest.php @@ -21,22 +21,20 @@ class ContentViewTest extends AbstractViewTest { /** * Params that are always returned by this view. - * - * @var array */ - private $valueParams = ['content' => null]; + private array $valueParams = ['content' => null]; /** * @dataProvider constructProvider */ - public function testConstruct($templateIdentifier, array $params) + public function testConstruct(string|\Closure $templateIdentifier, array $params): void { $contentView = new ContentView($templateIdentifier, $params); self::assertSame($templateIdentifier, $contentView->getTemplateIdentifier()); self::assertSame($this->valueParams + $params, $contentView->getParameters()); } - public function constructProvider() + public function constructProvider(): array { return [ ['some:valid:identifier', ['foo' => 'bar']], @@ -60,14 +58,14 @@ static function (): bool { /** * @dataProvider constructFailProvider */ - public function testConstructFail($templateIdentifier) + public function testConstructFail(int|\stdClass|array $templateIdentifier): void { $this->expectException(InvalidArgumentType::class); new ContentView($templateIdentifier); } - public function constructFailProvider() + public function constructFailProvider(): array { return [ [123], diff --git a/tests/lib/MVC/Symfony/View/Renderer/TemplateRendererTest.php b/tests/lib/MVC/Symfony/View/Renderer/TemplateRendererTest.php index fec5439591..4c4b4838c2 100644 --- a/tests/lib/MVC/Symfony/View/Renderer/TemplateRendererTest.php +++ b/tests/lib/MVC/Symfony/View/Renderer/TemplateRendererTest.php @@ -12,6 +12,7 @@ use Ibexa\Core\MVC\Symfony\MVCEvents; use Ibexa\Core\MVC\Symfony\View\ContentView; use Ibexa\Core\MVC\Symfony\View\Renderer\TemplateRenderer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Twig\Environment; @@ -19,13 +20,13 @@ class TemplateRendererTest extends TestCase { /** @var \Ibexa\Core\MVC\Symfony\View\Renderer\TemplateRenderer */ - private $renderer; + private TemplateRenderer $renderer; /** @var \Twig\Environment|\PHPUnit\Framework\MockObject\MockObject */ - private $templateEngineMock; + private MockObject $templateEngineMock; /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $eventDispatcherMock; + private MockObject $eventDispatcherMock; protected function setUp(): void { @@ -37,7 +38,7 @@ protected function setUp(): void ); } - public function testRender() + public function testRender(): void { $view = $this->createView(); $view->setTemplateIdentifier('path/to/template.html.twig'); @@ -61,7 +62,7 @@ public function testRender() $this->renderer->render($view); } - public function testRenderNoViewTemplate() + public function testRenderNoViewTemplate(): void { $this->expectException(NoViewTemplateException::class); @@ -71,7 +72,7 @@ public function testRenderNoViewTemplate() /** * @return \Ibexa\Core\MVC\Symfony\View\View */ - protected function createView() + protected function createView(): ContentView { $view = new ContentView(); diff --git a/tests/lib/MVC/Symfony/View/VariableProviderRegistryTest.php b/tests/lib/MVC/Symfony/View/VariableProviderRegistryTest.php index a147ea4ae4..5cf2b31363 100644 --- a/tests/lib/MVC/Symfony/View/VariableProviderRegistryTest.php +++ b/tests/lib/MVC/Symfony/View/VariableProviderRegistryTest.php @@ -27,7 +27,7 @@ private function getRegistry(array $providers): GenericVariableProviderRegistry private function getProvider(string $identifier): VariableProvider { return new class($identifier) implements VariableProvider { - private $identifier; + private string $identifier; public function __construct(string $identifier) { diff --git a/tests/lib/MVC/Symfony/View/ViewManagerTest.php b/tests/lib/MVC/Symfony/View/ViewManagerTest.php index 0d5935bb4a..a869577535 100644 --- a/tests/lib/MVC/Symfony/View/ViewManagerTest.php +++ b/tests/lib/MVC/Symfony/View/ViewManagerTest.php @@ -18,6 +18,7 @@ use Ibexa\Core\Repository\Values\Content\Content; use Ibexa\Core\Repository\Values\Content\Location; use Ibexa\Core\Repository\Values\Content\VersionInfo; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Twig\Environment; @@ -28,24 +29,24 @@ class ViewManagerTest extends TestCase { /** @var \Ibexa\Core\MVC\Symfony\View\Manager */ - private $viewManager; + private Manager $viewManager; /** @var \PHPUnit\Framework\MockObject\MockObject|\Twig\Environment */ - private $templateEngineMock; + private MockObject $templateEngineMock; /** @var \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\EventDispatcher\EventDispatcherInterface */ - private $eventDispatcherMock; + private MockObject $eventDispatcherMock; /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\Repository\Repository */ - private $repositoryMock; + private MockObject $repositoryMock; /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolverMock; + private MockObject $configResolverMock; /** @var \Ibexa\Core\MVC\Symfony\View\Configurator|\PHPUnit\Framework\MockObject\MockObject */ - private $viewConfigurator; + private MockObject $viewConfigurator; - private $viewBaseLayout = 'IbexaCoreBundle::viewbase.html.twig'; + private string $viewBaseLayout = 'IbexaCoreBundle::viewbase.html.twig'; protected function setUp(): void { @@ -65,7 +66,7 @@ protected function setUp(): void ); } - public function testRenderContent() + public function testRenderContent(): void { $content = new Content( ['versionInfo' => new VersionInfo(['contentInfo' => new ContentInfo()])] @@ -78,7 +79,7 @@ public function testRenderContent() ->method('configure') ->will( self::returnCallback( - static function (View $view) use ($templateIdentifier) { + static function (View $view) use ($templateIdentifier): void { $view->setTemplateIdentifier($templateIdentifier); } ) @@ -98,7 +99,7 @@ static function (View $view) use ($templateIdentifier) { self::assertSame($expectedTemplateResult, $this->viewManager->renderContent($content, 'customViewType', $params)); } - public function testRenderContentWithClosure() + public function testRenderContentWithClosure(): void { $content = new Content( ['versionInfo' => new VersionInfo(['contentInfo' => new ContentInfo()])] @@ -114,7 +115,7 @@ public function testRenderContentWithClosure() ->method('configure') ->will( self::returnCallback( - static function (View $view) use ($closure) { + static function (View $view) use ($closure): void { $view->setTemplateIdentifier($closure); } ) @@ -132,7 +133,7 @@ static function (View $view) use ($closure) { self::assertEqualsCanonicalizing($expectedTemplateResult, $templateResult); } - public function testRenderLocation() + public function testRenderLocation(): void { $content = new Content(['versionInfo' => new VersionInfo(['contentInfo' => new ContentInfo()])]); $location = new Location(['contentInfo' => new ContentInfo()]); @@ -145,7 +146,7 @@ public function testRenderLocation() ->method('configure') ->will( self::returnCallback( - static function (View $view) use ($templateIdentifier) { + static function (View $view) use ($templateIdentifier): void { $view->setTemplateIdentifier($templateIdentifier); } ) @@ -181,7 +182,7 @@ static function (View $view) use ($templateIdentifier) { self::assertSame($expectedTemplateResult, $this->viewManager->renderLocation($location, 'customViewType', $params)); } - public function testRenderLocationWithContentPassed() + public function testRenderLocationWithContentPassed(): void { $content = new Content(['versionInfo' => new VersionInfo(['contentInfo' => new ContentInfo()])]); $location = new Location(['contentInfo' => new ContentInfo()]); @@ -194,7 +195,7 @@ public function testRenderLocationWithContentPassed() ->method('configure') ->will( self::returnCallback( - static function (View $view) use ($templateIdentifier) { + static function (View $view) use ($templateIdentifier): void { $view->setTemplateIdentifier($templateIdentifier); } ) @@ -232,7 +233,7 @@ static function (View $view) use ($templateIdentifier) { self::assertSame($expectedTemplateResult, $this->viewManager->renderLocation($location, 'customViewType', $params)); } - public function testRenderLocationWithClosure() + public function testRenderLocationWithClosure(): void { $content = new Content(['versionInfo' => new VersionInfo(['contentInfo' => new ContentInfo()])]); $location = new Location(['contentInfo' => new ContentInfo()]); @@ -247,7 +248,7 @@ public function testRenderLocationWithClosure() ->method('configure') ->will( self::returnCallback( - static function (View $view) use ($closure) { + static function (View $view) use ($closure): void { $view->setTemplateIdentifier($closure); } ) diff --git a/tests/lib/Pagination/AdapterFactory/SearchHitAdapterFactoryTest.php b/tests/lib/Pagination/AdapterFactory/SearchHitAdapterFactoryTest.php index a0e2be28d9..5b4297c253 100644 --- a/tests/lib/Pagination/AdapterFactory/SearchHitAdapterFactoryTest.php +++ b/tests/lib/Pagination/AdapterFactory/SearchHitAdapterFactoryTest.php @@ -17,6 +17,7 @@ use Ibexa\Core\Pagination\Pagerfanta\ContentSearchHitAdapter; use Ibexa\Core\Pagination\Pagerfanta\FixedSearchResultHitAdapter; use Ibexa\Core\Pagination\Pagerfanta\LocationSearchHitAdapter; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; final class SearchHitAdapterFactoryTest extends TestCase @@ -26,10 +27,10 @@ final class SearchHitAdapterFactoryTest extends TestCase ]; /** @var \Ibexa\Contracts\Core\Repository\SearchService|\PHPUnit\Framework\MockObject\MockObject */ - private $searchService; + private MockObject $searchService; /** @var \Ibexa\Core\Pagination\Pagerfanta\AdapterFactory\SearchHitAdapterFactory */ - private $searchHitAdapterFactory; + private SearchHitAdapterFactory $searchHitAdapterFactory; protected function setUp(): void { diff --git a/tests/lib/Pagination/ContentFilteringAdapterTest.php b/tests/lib/Pagination/ContentFilteringAdapterTest.php index d788e69013..8340009134 100644 --- a/tests/lib/Pagination/ContentFilteringAdapterTest.php +++ b/tests/lib/Pagination/ContentFilteringAdapterTest.php @@ -14,6 +14,7 @@ use Ibexa\Contracts\Core\Repository\Values\Filter\Filter; use Ibexa\Core\Pagination\Pagerfanta\ContentFilteringAdapter; use Ibexa\Tests\Core\Search\TestCase; +use PHPUnit\Framework\MockObject\MockObject; final class ContentFilteringAdapterTest extends TestCase { @@ -23,7 +24,7 @@ final class ContentFilteringAdapterTest extends TestCase ]; /** @var \Ibexa\Contracts\Core\Repository\ContentService|\PHPUnit\Framework\MockObject\MockObject */ - private $contentService; + private MockObject $contentService; protected function setUp(): void { diff --git a/tests/lib/Pagination/LocationFilteringAdapterTest.php b/tests/lib/Pagination/LocationFilteringAdapterTest.php index 794623e229..b92deeecee 100644 --- a/tests/lib/Pagination/LocationFilteringAdapterTest.php +++ b/tests/lib/Pagination/LocationFilteringAdapterTest.php @@ -14,6 +14,7 @@ use Ibexa\Contracts\Core\Repository\Values\Filter\Filter; use Ibexa\Core\Pagination\Pagerfanta\LocationFilteringAdapter; use Ibexa\Tests\Core\Search\TestCase; +use PHPUnit\Framework\MockObject\MockObject; final class LocationFilteringAdapterTest extends TestCase { @@ -23,7 +24,7 @@ final class LocationFilteringAdapterTest extends TestCase ]; /** @var \Ibexa\Contracts\Core\Repository\LocationService|\PHPUnit\Framework\MockObject\MockObject */ - private $locationService; + private MockObject $locationService; protected function setUp(): void { diff --git a/tests/lib/Persistence/Cache/AbstractBaseHandlerTest.php b/tests/lib/Persistence/Cache/AbstractBaseHandlerTest.php index a13c39df08..1bc6e0717d 100644 --- a/tests/lib/Persistence/Cache/AbstractBaseHandlerTest.php +++ b/tests/lib/Persistence/Cache/AbstractBaseHandlerTest.php @@ -33,6 +33,7 @@ use Ibexa\Core\Persistence\Cache\UrlWildcardHandler as CacheUrlWildcardHandler; use Ibexa\Core\Persistence\Cache\UserHandler as CacheUserHandler; use Ibexa\Core\Persistence\Cache\UserPreferenceHandler as CacheUserPreferenceHandler; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Cache\CacheItem; @@ -42,25 +43,25 @@ abstract class AbstractBaseHandlerTest extends TestCase { /** @var \Ibexa\Core\Persistence\Cache\Adapter\TransactionalInMemoryCacheAdapter|\PHPUnit\Framework\MockObject\MockObject */ - protected $cacheMock; + protected MockObject $cacheMock; /** @var \Ibexa\Contracts\Core\Persistence\Handler|\PHPUnit\Framework\MockObject\MockObject */ - protected $persistenceHandlerMock; + protected MockObject $persistenceHandlerMock; /** @var \Ibexa\Core\Persistence\Cache\Handler */ protected $persistenceCacheHandler; /** @var \Ibexa\Core\Persistence\Cache\PersistenceLogger|\PHPUnit\Framework\MockObject\MockObject */ - protected $loggerMock; + protected MockObject $loggerMock; /** @var \Ibexa\Core\Persistence\Cache\InMemory\InMemoryCache|\PHPUnit\Framework\MockObject\MockObject */ - protected $inMemoryMock; + protected MockObject $inMemoryMock; /** @var \Closure */ protected $cacheItemsClosure; /** @var \Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierGeneratorInterface|\PHPUnit\Framework\MockObject\MockObject */ - protected $cacheIdentifierGeneratorMock; + protected MockObject $cacheIdentifierGeneratorMock; /** @var \Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierSanitizer */ protected $cacheIdentifierSanitizer; @@ -69,7 +70,7 @@ abstract class AbstractBaseHandlerTest extends TestCase protected $locationPathConverter; /** @var \Ibexa\Core\Persistence\Cache\CacheIndicesValidatorInterface */ - protected $cacheIndicesValidator; + protected MockObject $cacheIndicesValidator; /** * Setup the HandlerTest. @@ -112,7 +113,7 @@ protected function setUp(): void ); $this->cacheItemsClosure = \Closure::bind( - static function ($key, $value, $isHit, $defaultLifetime = 0) { + static function ($key, $value, $isHit, $defaultLifetime = 0): CacheItem { $item = new CacheItem(); $item->key = $key; $item->value = $value; diff --git a/tests/lib/Persistence/Cache/AbstractCacheHandlerTest.php b/tests/lib/Persistence/Cache/AbstractCacheHandlerTest.php index ff2041a8e5..6d8b117deb 100644 --- a/tests/lib/Persistence/Cache/AbstractCacheHandlerTest.php +++ b/tests/lib/Persistence/Cache/AbstractCacheHandlerTest.php @@ -38,7 +38,7 @@ final public function testUnCachedMethods( array $tags = null, $key = null, $returnValue = null - ) { + ): void { $handlerMethodName = $this->getHandlerMethodName(); $this->loggerMock->expects(self::once())->method('logCall'); @@ -136,7 +136,7 @@ final public function testLoadMethodsCacheHit( $data = null, bool $multi = false, array $additionalCalls = [] - ) { + ): void { $cacheItem = $this->getCacheItem($key, $multi ? reset($data) : $data); $handlerMethodName = $this->getHandlerMethodName(); @@ -215,7 +215,7 @@ final public function testLoadMethodsCacheMiss( $data = null, bool $multi = false, array $additionalCalls = [] - ) { + ): void { $cacheItem = $this->getCacheItem($key, null); $handlerMethodName = $this->getHandlerMethodName(); diff --git a/tests/lib/Persistence/Cache/AbstractInMemoryCacheHandlerTest.php b/tests/lib/Persistence/Cache/AbstractInMemoryCacheHandlerTest.php index b7ed47a072..4ea92bb734 100644 --- a/tests/lib/Persistence/Cache/AbstractInMemoryCacheHandlerTest.php +++ b/tests/lib/Persistence/Cache/AbstractInMemoryCacheHandlerTest.php @@ -39,7 +39,7 @@ final public function testUnCachedMethods( array $key = null, $returnValue = null, bool $callInnerHandler = true - ) { + ): void { $handlerMethodName = $this->getHandlerMethodName(); $this->loggerMock->expects(self::once())->method('logCall'); @@ -136,7 +136,7 @@ final public function testLoadMethodsCacheHit( $data = null, bool $multi = false, array $additionalCalls = [] - ) { + ): void { $cacheItem = $this->getCacheItem($key, $multi ? reset($data) : $data); $handlerMethodName = $this->getHandlerMethodName(); @@ -217,7 +217,7 @@ final public function testLoadMethodsCacheMiss( $data = null, bool $multi = false, array $additionalCalls = [] - ) { + ): void { $cacheItem = $this->getCacheItem($key, null); $handlerMethodName = $this->getHandlerMethodName(); diff --git a/tests/lib/Persistence/Cache/Adapter/InMemoryClearingProxyAdapterTest.php b/tests/lib/Persistence/Cache/Adapter/InMemoryClearingProxyAdapterTest.php index a27674cb6d..56bcf5202e 100644 --- a/tests/lib/Persistence/Cache/Adapter/InMemoryClearingProxyAdapterTest.php +++ b/tests/lib/Persistence/Cache/Adapter/InMemoryClearingProxyAdapterTest.php @@ -10,6 +10,7 @@ use Ibexa\Core\Persistence\Cache\Adapter\TransactionalInMemoryCacheAdapter; use Ibexa\Core\Persistence\Cache\InMemory\InMemoryCache; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Cache\Adapter\TagAwareAdapterInterface; use Symfony\Component\Cache\CacheItem; @@ -23,13 +24,13 @@ class InMemoryClearingProxyAdapterTest extends TestCase protected $cache; /** @var \Symfony\Component\Cache\Adapter\TagAwareAdapterInterface|\PHPUnit\Framework\MockObject\MockObject */ - protected $innerPool; + protected MockObject $innerPool; /** @var \Ibexa\Core\Persistence\Cache\InMemory\InMemoryCache|\PHPUnit\Framework\MockObject\MockObject */ - protected $inMemory; + protected MockObject $inMemory; /** @var \Closure */ - private $cacheItemsClosure; + private ?\Closure $cacheItemsClosure; /** * Setup the HandlerTest. @@ -47,7 +48,7 @@ protected function setUp(): void ); $this->cacheItemsClosure = \Closure::bind( - static function ($key, $value, $isHit, $defaultLifetime = 0, $tags = []) { + static function ($key, $value, $isHit, $defaultLifetime = 0, $tags = []): CacheItem { $item = new CacheItem(); $item->isTaggable = true; $item->key = $key; @@ -75,7 +76,7 @@ protected function tearDown(): void parent::tearDown(); } - public function testGetItem() + public function testGetItem(): void { $item = $this->createCacheItem('first'); @@ -91,7 +92,7 @@ public function testGetItem() self::assertSame($item, $returnedItem); } - public function testGetItems() + public function testGetItems(): void { $items = [ 'first' => $this->createCacheItem('first'), @@ -113,7 +114,7 @@ public function testGetItems() /** * Symfony uses generators with getItems() so we need to make sure we handle that. */ - public function testGetItemsWithGenerator() + public function testGetItemsWithGenerator(): void { $items = [ 'first' => $this->createCacheItem('first'), @@ -132,7 +133,7 @@ public function testGetItemsWithGenerator() self::assertSame($items, $returnedItems); } - public function testHasItem() + public function testHasItem(): void { $this->innerPool ->expects(self::once()) @@ -148,7 +149,7 @@ public function testHasItem() /** * @dataProvider providerForDelete */ - public function testDelete(string $method, $argument) + public function testDelete(string $method, string|array $argument): void { $this->innerPool ->expects(self::once()) @@ -179,7 +180,7 @@ public function providerForDelete(): array * * @dataProvider providerForClearAndInvalidation */ - public function testClearAndInvalidation(string $method, $argument) + public function testClearAndInvalidation(string $method, string|array $argument): void { if ($argument) { $this->innerPool @@ -218,7 +219,7 @@ public function providerForClearAndInvalidation(): array * * @return \Symfony\Component\Cache\CacheItem */ - private function createCacheItem($key, $tags = [], $value = true) + private function createCacheItem(string $key, $tags = [], $value = true) { $cacheItemsClosure = $this->cacheItemsClosure; diff --git a/tests/lib/Persistence/Cache/ContentHandlerTest.php b/tests/lib/Persistence/Cache/ContentHandlerTest.php index 2ab1b775cd..546e8a2716 100644 --- a/tests/lib/Persistence/Cache/ContentHandlerTest.php +++ b/tests/lib/Persistence/Cache/ContentHandlerTest.php @@ -437,7 +437,7 @@ public function providerForCachedLoadMethodsMiss(): array ]; } - public function testDeleteContent() + public function testDeleteContent(): void { $this->loggerMock->expects(self::once())->method('logCall'); diff --git a/tests/lib/Persistence/Cache/ContentTypeHandlerTest.php b/tests/lib/Persistence/Cache/ContentTypeHandlerTest.php index 4798e79d7d..6c23fafd61 100644 --- a/tests/lib/Persistence/Cache/ContentTypeHandlerTest.php +++ b/tests/lib/Persistence/Cache/ContentTypeHandlerTest.php @@ -402,7 +402,7 @@ public function providerForCachedLoadMethodsMiss(): array /** * Test cache invalidation when publishing Content type. */ - public function testPublish() + public function testPublish(): void { $tags = ['t-5', 'tm', 'cft-5']; $method = 'publish'; diff --git a/tests/lib/Persistence/Cache/Identifier/CacheIdentifierGeneratorTest.php b/tests/lib/Persistence/Cache/Identifier/CacheIdentifierGeneratorTest.php index dcc7eb690d..e0ed76fb3f 100644 --- a/tests/lib/Persistence/Cache/Identifier/CacheIdentifierGeneratorTest.php +++ b/tests/lib/Persistence/Cache/Identifier/CacheIdentifierGeneratorTest.php @@ -18,7 +18,7 @@ final class CacheIdentifierGeneratorTest extends TestCase { /** @var \Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierGeneratorInterface */ - private $cacheIdentifierGenerator; + private CacheIdentifierGenerator $cacheIdentifierGenerator; public function setUp(): void { diff --git a/tests/lib/Persistence/Cache/Identifier/CacheIdentifierSanitizerTest.php b/tests/lib/Persistence/Cache/Identifier/CacheIdentifierSanitizerTest.php index 90f3c80055..ab01c8d20f 100644 --- a/tests/lib/Persistence/Cache/Identifier/CacheIdentifierSanitizerTest.php +++ b/tests/lib/Persistence/Cache/Identifier/CacheIdentifierSanitizerTest.php @@ -17,7 +17,7 @@ final class CacheIdentifierSanitizerTest extends TestCase { /** @var \Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierSanitizer */ - private $cacheIdentifierSanitizer; + private CacheIdentifierSanitizer $cacheIdentifierSanitizer; public function setUp(): void { diff --git a/tests/lib/Persistence/Cache/InMemory/InMemoryCacheTest.php b/tests/lib/Persistence/Cache/InMemory/InMemoryCacheTest.php index 4ae79bdc3d..9353040ec0 100644 --- a/tests/lib/Persistence/Cache/InMemory/InMemoryCacheTest.php +++ b/tests/lib/Persistence/Cache/InMemory/InMemoryCacheTest.php @@ -49,7 +49,7 @@ public function testGetByKey(): void self::assertNull($this->cache->get('first')); $obj = new \stdClass(); - $this->cache->setMulti([$obj], static function ($o) { return ['first']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['first']; }); self::assertSame($obj, $this->cache->get('first')); @@ -64,7 +64,7 @@ public function testGetBySecondaryIndex(): void self::assertNull($this->cache->get('secondary')); $obj = new \stdClass(); - $this->cache->setMulti([$obj], static function ($o) { return ['first', 'secondary']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['first', 'secondary']; }); self::assertSame($obj, $this->cache->get('first')); self::assertSame($obj, $this->cache->get('secondary')); @@ -81,7 +81,7 @@ public function testGetByList(): void self::assertNull($this->cache->get('list')); $obj = new \stdClass(); - $this->cache->setMulti([$obj], static function ($o) { return ['first']; }, 'list'); + $this->cache->setMulti([$obj], static function ($o): array { return ['first']; }, 'list'); self::assertSame($obj, $this->cache->get('first')); self::assertSame([$obj], $this->cache->get('list')); @@ -95,7 +95,7 @@ public function testGetByList(): void public function testDeleted(): void { $obj = new \stdClass(); - $this->cache->setMulti([$obj], static function ($o) { return ['first', 'second']; }, 'list'); + $this->cache->setMulti([$obj], static function ($o): array { return ['first', 'second']; }, 'list'); self::assertSame($obj, $this->cache->get('first')); self::assertSame($obj, $this->cache->get('second')); @@ -117,7 +117,7 @@ public function testDeleted(): void public function testClear(): void { $obj = new \stdClass(); - $this->cache->setMulti([$obj], static function ($o) { return ['first', 'second']; }, 'list'); + $this->cache->setMulti([$obj], static function ($o): array { return ['first', 'second']; }, 'list'); self::assertSame($obj, $this->cache->get('first')); self::assertSame($obj, $this->cache->get('second')); @@ -134,7 +134,7 @@ public function testClear(): void public function testSetWhenReachingSetLimit(): void { $obj = new \stdClass(); - $this->cache->setMulti([$obj, $obj], static function ($o) { return ['first', 'second']; }, 'list'); + $this->cache->setMulti([$obj, $obj], static function ($o): array { return ['first', 'second']; }, 'list'); self::assertNull($this->cache->get('first')); self::assertNull($this->cache->get('second')); @@ -144,14 +144,14 @@ public function testSetWhenReachingSetLimit(): void public function testSetWhenReachingTotalLimit(): void { $obj = new \stdClass(); - $this->cache->setMulti([$obj], static function ($o) { return ['first']; }); - $this->cache->setMulti([$obj], static function ($o) { return ['second']; }); - $this->cache->setMulti([$obj], static function ($o) { return ['third']; }); - $this->cache->setMulti([$obj], static function ($o) { return ['fourth']; }); - $this->cache->setMulti([$obj], static function ($o) { return ['fifth']; }); - $this->cache->setMulti([$obj], static function ($o) { return ['sixth']; }); - $this->cache->setMulti([$obj], static function ($o) { return ['seventh']; }); - $this->cache->setMulti([$obj], static function ($o) { return ['eight']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['first']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['second']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['third']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['fourth']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['fifth']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['sixth']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['seventh']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['eight']; }); self::assertNull($this->cache->get('first')); self::assertNull($this->cache->get('second')); @@ -169,19 +169,19 @@ public function testSetWhenReachingTotalLimit(): void public function testAccessCountsWhenReachingTotalLimit(): void { $obj = new \stdClass(); - $this->cache->setMulti([$obj], static function ($o) { return ['first']; }); - $this->cache->setMulti([$obj], static function ($o) { return ['second']; }); - $this->cache->setMulti([$obj], static function ($o) { return ['third']; }); - $this->cache->setMulti([$obj], static function ($o) { return ['fourth']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['first']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['second']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['third']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['fourth']; }); // Make sure these are read before we set further objects. $this->cache->get('first'); $this->cache->get('third'); - $this->cache->setMulti([$obj], static function ($o) { return ['fifth']; }); - $this->cache->setMulti([$obj], static function ($o) { return ['sixth']; }); - $this->cache->setMulti([$obj], static function ($o) { return ['seventh']; }); - $this->cache->setMulti([$obj], static function ($o) { return ['eight']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['fifth']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['sixth']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['seventh']; }); + $this->cache->setMulti([$obj], static function ($o): array { return ['eight']; }); self::assertSame($obj, $this->cache->get('first')); self::assertNull($this->cache->get('second')); diff --git a/tests/lib/Persistence/Cache/LocationPathConverterTest.php b/tests/lib/Persistence/Cache/LocationPathConverterTest.php index 49acecf2dc..0249666592 100644 --- a/tests/lib/Persistence/Cache/LocationPathConverterTest.php +++ b/tests/lib/Persistence/Cache/LocationPathConverterTest.php @@ -17,7 +17,7 @@ final class LocationPathConverterTest extends TestCase { /** @var \Ibexa\Core\Persistence\Cache\LocationPathConverter */ - private $locationPathConverter; + private LocationPathConverter $locationPathConverter; public function setUp(): void { diff --git a/tests/lib/Persistence/Cache/PersistenceHandlerTest.php b/tests/lib/Persistence/Cache/PersistenceHandlerTest.php index b25070b469..6c1f017f4e 100644 --- a/tests/lib/Persistence/Cache/PersistenceHandlerTest.php +++ b/tests/lib/Persistence/Cache/PersistenceHandlerTest.php @@ -17,13 +17,13 @@ */ class PersistenceHandlerTest extends AbstractBaseHandlerTest { - public function testHandler() + public function testHandler(): void { self::assertInstanceOf(SPIPersistence\Handler::class, $this->persistenceCacheHandler); self::assertInstanceOf(Cache\Handler::class, $this->persistenceCacheHandler); } - public function testContentHandler() + public function testContentHandler(): void { $this->loggerMock->expects(self::never())->method(self::anything()); $handler = $this->persistenceCacheHandler->contentHandler(); @@ -31,7 +31,7 @@ public function testContentHandler() self::assertInstanceOf(Cache\ContentHandler::class, $handler); } - public function testLanguageHandler() + public function testLanguageHandler(): void { $this->loggerMock->expects(self::never())->method(self::anything()); $handler = $this->persistenceCacheHandler->contentLanguageHandler(); @@ -39,7 +39,7 @@ public function testLanguageHandler() self::assertInstanceOf(Cache\ContentLanguageHandler::class, $handler); } - public function testContentTypeHandler() + public function testContentTypeHandler(): void { $this->loggerMock->expects(self::never())->method(self::anything()); $handler = $this->persistenceCacheHandler->contentTypeHandler(); @@ -47,7 +47,7 @@ public function testContentTypeHandler() self::assertInstanceOf(Cache\ContentTypeHandler::class, $handler); } - public function testContentLocationHandler() + public function testContentLocationHandler(): void { $this->loggerMock->expects(self::never())->method(self::anything()); $handler = $this->persistenceCacheHandler->locationHandler(); @@ -55,7 +55,7 @@ public function testContentLocationHandler() self::assertInstanceOf(Cache\LocationHandler::class, $handler); } - public function testTrashHandler() + public function testTrashHandler(): void { $this->loggerMock->expects(self::never())->method(self::anything()); $handler = $this->persistenceCacheHandler->trashHandler(); @@ -63,7 +63,7 @@ public function testTrashHandler() self::assertInstanceOf(Cache\TrashHandler::class, $handler); } - public function testObjectStateHandler() + public function testObjectStateHandler(): void { $this->loggerMock->expects(self::never())->method(self::anything()); $handler = $this->persistenceCacheHandler->objectStateHandler(); @@ -71,7 +71,7 @@ public function testObjectStateHandler() self::assertInstanceOf(Cache\ObjectStateHandler::class, $handler); } - public function testSectionHandler() + public function testSectionHandler(): void { $this->loggerMock->expects(self::never())->method(self::anything()); $handler = $this->persistenceCacheHandler->sectionHandler(); @@ -79,7 +79,7 @@ public function testSectionHandler() self::assertInstanceOf(Cache\SectionHandler::class, $handler); } - public function testUserHandler() + public function testUserHandler(): void { $this->loggerMock->expects(self::never())->method(self::anything()); $handler = $this->persistenceCacheHandler->userHandler(); @@ -87,7 +87,7 @@ public function testUserHandler() self::assertInstanceOf(Cache\UserHandler::class, $handler); } - public function testUrlAliasHandler() + public function testUrlAliasHandler(): void { $this->loggerMock->expects(self::never())->method(self::anything()); $handler = $this->persistenceCacheHandler->urlAliasHandler(); @@ -95,7 +95,7 @@ public function testUrlAliasHandler() self::assertInstanceOf(Cache\UrlAliasHandler::class, $handler); } - public function testUrlWildcardHandler() + public function testUrlWildcardHandler(): void { $this->loggerMock->expects(self::never())->method(self::anything()); $handler = $this->persistenceCacheHandler->urlWildcardHandler(); @@ -103,7 +103,7 @@ public function testUrlWildcardHandler() self::assertInstanceOf(Cache\UrlWildcardHandler::class, $handler); } - public function testTransactionHandler() + public function testTransactionHandler(): void { $this->loggerMock->expects(self::never())->method(self::anything()); $handler = $this->persistenceCacheHandler->transactionHandler(); diff --git a/tests/lib/Persistence/Cache/PersistenceLoggerTest.php b/tests/lib/Persistence/Cache/PersistenceLoggerTest.php index ca0ed86d59..3595df6593 100644 --- a/tests/lib/Persistence/Cache/PersistenceLoggerTest.php +++ b/tests/lib/Persistence/Cache/PersistenceLoggerTest.php @@ -36,12 +36,12 @@ protected function tearDown(): void parent::tearDown(); } - public function testGetName() + public function testGetName(): void { self::assertEquals(PersistenceLogger::NAME, $this->logger->getName()); } - public function testGetCalls() + public function testGetCalls(): void { self::assertEquals([], $this->logger->getCalls()); } @@ -61,7 +61,7 @@ public function testLogCall() * * @param \Ibexa\Core\Persistence\Cache\PersistenceLogger $logger */ - public function testGetCallValues($logger) + public function testGetCallValues($logger): void { $calls = $logger->getCalls(); // As we don't care about the hash index we get the array values instead diff --git a/tests/lib/Persistence/Cache/TransactionHandlerTest.php b/tests/lib/Persistence/Cache/TransactionHandlerTest.php index 702043ec60..d567798518 100644 --- a/tests/lib/Persistence/Cache/TransactionHandlerTest.php +++ b/tests/lib/Persistence/Cache/TransactionHandlerTest.php @@ -47,7 +47,7 @@ public function providerForCachedLoadMethodsMiss(): array ]; } - public function testRollback() + public function testRollback(): void { $this->loggerMock ->expects(self::once()) @@ -75,7 +75,7 @@ public function testRollback() $handler->rollback(); } - public function testCommitStopsCacheTransaction() + public function testCommitStopsCacheTransaction(): void { $this->loggerMock ->expects(self::once()) @@ -99,7 +99,7 @@ public function testCommitStopsCacheTransaction() $handler->commit(); } - public function testBeginTransactionStartsCacheTransaction() + public function testBeginTransactionStartsCacheTransaction(): void { $this->loggerMock ->expects(self::once()) diff --git a/tests/lib/Persistence/Cache/TrashHandlerTest.php b/tests/lib/Persistence/Cache/TrashHandlerTest.php index 05251183eb..82bcdd74c2 100644 --- a/tests/lib/Persistence/Cache/TrashHandlerTest.php +++ b/tests/lib/Persistence/Cache/TrashHandlerTest.php @@ -52,7 +52,7 @@ public function providerForCachedLoadMethodsMiss(): array ]; } - public function testRecover() + public function testRecover(): void { $originalLocationId = 6; $targetLocationId = 2; @@ -115,7 +115,7 @@ public function testRecover() $handler->recover($originalLocationId, $targetLocationId); } - public function testTrashSubtree() + public function testTrashSubtree(): void { $locationId = 6; $contentId = 42; @@ -174,7 +174,7 @@ public function testTrashSubtree() $handler->trashSubtree($locationId); } - public function testDeleteTrashItem() + public function testDeleteTrashItem(): void { $trashedId = 6; $contentId = 42; @@ -243,7 +243,7 @@ public function testDeleteTrashItem() $handler->deleteTrashItem($trashedId); } - public function testEmptyTrash() + public function testEmptyTrash(): void { $trashedId = 6; $contentId = 42; diff --git a/tests/lib/Persistence/Cache/URLHandlerTest.php b/tests/lib/Persistence/Cache/URLHandlerTest.php index 9188a2138c..9a362a78fc 100644 --- a/tests/lib/Persistence/Cache/URLHandlerTest.php +++ b/tests/lib/Persistence/Cache/URLHandlerTest.php @@ -122,7 +122,7 @@ public function testUpdateUrlWhenAddressIsUpdated(): void $handler->updateUrl($urlId, $updateStruct); } - public function testUpdateUrlStatusIsUpdated() + public function testUpdateUrlStatusIsUpdated(): void { $urlId = 1; $updateStruct = new URLUpdateStruct(); diff --git a/tests/lib/Persistence/Cache/UserHandlerTest.php b/tests/lib/Persistence/Cache/UserHandlerTest.php index 7d926db583..ca30d0866d 100644 --- a/tests/lib/Persistence/Cache/UserHandlerTest.php +++ b/tests/lib/Persistence/Cache/UserHandlerTest.php @@ -467,7 +467,7 @@ public function providerForCachedLoadMethodsMiss(): array ]; } - public function testPublishRoleDraftFromExistingRole() + public function testPublishRoleDraftFromExistingRole(): void { $this->loggerMock->expects(self::once())->method('logCall'); $innerHandlerMock = $this->createMock(SPIUserHandler::class); @@ -512,7 +512,7 @@ public function testPublishRoleDraftFromExistingRole() $handler->publishRoleDraft($roleDraftId); } - public function testPublishNewRoleDraft() + public function testPublishNewRoleDraft(): void { $this->loggerMock->expects(self::once())->method('logCall'); $innerHandlerMock = $this->createMock(SPIUserHandler::class); @@ -537,7 +537,7 @@ public function testPublishNewRoleDraft() $handler->publishRoleDraft($roleDraftId); } - public function testAssignRole() + public function testAssignRole(): void { $innerUserHandlerMock = $this->createMock(SPIUserHandler::class); $innerLocationHandlerMock = $this->createMock(SPILocationHandler::class); diff --git a/tests/lib/Persistence/DatabaseConnectionFactory.php b/tests/lib/Persistence/DatabaseConnectionFactory.php index 4dda3c350b..dde97680e7 100644 --- a/tests/lib/Persistence/DatabaseConnectionFactory.php +++ b/tests/lib/Persistence/DatabaseConnectionFactory.php @@ -19,13 +19,10 @@ class DatabaseConnectionFactory { /** * Associative array of [driver => AbstractPlatform]. - * - * @var array */ - private $databasePlatforms = []; + private array $databasePlatforms; - /** @var \Doctrine\Common\EventManager */ - private $eventManager; + private EventManager $eventManager; /** * Connection Pool for re-using already created connection. @@ -34,7 +31,7 @@ class DatabaseConnectionFactory * * @var \Doctrine\DBAL\Connection[] */ - private static $connectionPool; + private static ?array $connectionPool = null; /** * @param \Ibexa\DoctrineSchema\Database\DbPlatform\DbPlatformInterface[] $databasePlatforms diff --git a/tests/lib/Persistence/FieldTypeRegistryTest.php b/tests/lib/Persistence/FieldTypeRegistryTest.php index f8b7aff505..51f574d386 100644 --- a/tests/lib/Persistence/FieldTypeRegistryTest.php +++ b/tests/lib/Persistence/FieldTypeRegistryTest.php @@ -12,6 +12,7 @@ use Ibexa\Core\Base\Exceptions\NotFound\FieldTypeNotFoundException; use Ibexa\Core\Persistence\FieldTypeRegistry; use Ibexa\Tests\Core\Persistence\Legacy\TestCase; +use PHPUnit\Framework\MockObject\MockObject; /** * @covers \Ibexa\Core\Persistence\FieldTypeRegistry @@ -31,7 +32,7 @@ public function testConstructor(): void ); } - public function testGetFieldTypeInstance() + public function testGetFieldTypeInstance(): void { $instance = $this->getFieldTypeMock(); $registry = new FieldTypeRegistry([self::FIELD_TYPE_IDENTIFIER => $instance]); @@ -44,7 +45,7 @@ public function testGetFieldTypeInstance() /** * @since 5.3.2 */ - public function testGetNotFound() + public function testGetNotFound(): void { $this->expectException(FieldTypeNotFoundException::class); @@ -55,7 +56,7 @@ public function testGetNotFound() /** * BC with 5.0-5.3.2. */ - public function testGetNotFoundBCException() + public function testGetNotFoundBCException(): void { $this->expectException(\RuntimeException::class); @@ -63,7 +64,7 @@ public function testGetNotFoundBCException() $registry->getFieldType('not-found'); } - public function testGetNotInstance() + public function testGetNotInstance(): void { $this->expectException(\TypeError::class); @@ -71,7 +72,7 @@ public function testGetNotInstance() $registry->getFieldType(self::FIELD_TYPE_IDENTIFIER); } - public function testRegister() + public function testRegister(): void { $fieldType = $this->getFieldTypeMock(); $registry = new FieldTypeRegistry([]); @@ -88,7 +89,7 @@ public function testRegister() * * @return \Ibexa\Contracts\Core\Persistence\FieldType */ - protected function getFieldTypeMock() + protected function getFieldTypeMock(): MockObject { return $this->createMock(SPIFieldType::class); } diff --git a/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php b/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php index c3c70e7678..8ffcd66e50 100644 --- a/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php +++ b/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php @@ -14,6 +14,7 @@ use Ibexa\Core\IO\UrlRedecoratorInterface; use Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter\ImageConverter; use Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; final class ImageConverterTest extends TestCase @@ -26,13 +27,13 @@ final class ImageConverterTest extends TestCase private const MIME_TYPES_STORAGE_VALUE = '["image\/png","image\/jpeg"]'; /** @var \Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter\ImageConverter */ - private $imageConverter; + private ImageConverter $imageConverter; /** @var \Ibexa\Core\IO\UrlRedecoratorInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $urlRedecorator; + private MockObject $urlRedecorator; /** @var \Ibexa\Core\IO\IOServiceInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $ioService; + private MockObject $ioService; protected function setUp(): void { diff --git a/tests/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabaseTest.php index a79b51c757..0e48618b2a 100644 --- a/tests/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/Bookmark/Gateway/DoctrineDatabaseTest.php @@ -34,7 +34,7 @@ protected function setUp(): void $this->insertDatabaseFixture(__DIR__ . '/../_fixtures/bookmarks.php'); } - public function testInsertBookmark() + public function testInsertBookmark(): void { $id = $this->getGateway()->insertBookmark(new Bookmark([ 'userId' => 14, @@ -51,14 +51,14 @@ public function testInsertBookmark() ], $data); } - public function testDeleteBookmark() + public function testDeleteBookmark(): void { $this->getGateway()->deleteBookmark(self::EXISTING_BOOKMARK_ID); self::assertEmpty($this->loadBookmark(self::EXISTING_BOOKMARK_ID)); } - public function testLoadBookmarkDataById() + public function testLoadBookmarkDataById(): void { self::assertEquals( [self::EXISTING_BOOKMARK_DATA], @@ -66,7 +66,7 @@ public function testLoadBookmarkDataById() ); } - public function testLoadBookmarkDataByUserIdAndLocationId() + public function testLoadBookmarkDataByUserIdAndLocationId(): void { $data = $this->getGateway()->loadBookmarkDataByUserIdAndLocationId( (int) self::EXISTING_BOOKMARK_DATA['user_id'], @@ -79,7 +79,7 @@ public function testLoadBookmarkDataByUserIdAndLocationId() /** * @dataProvider dataProviderForLoadUserBookmarks */ - public function testLoadUserBookmarks(int $userId, int $offset, int $limit, array $expected) + public function testLoadUserBookmarks(int $userId, int $offset, int $limit, array $expected): void { self::assertEquals($expected, $this->getGateway()->loadUserBookmarks($userId, $offset, $limit)); } @@ -87,7 +87,7 @@ public function testLoadUserBookmarks(int $userId, int $offset, int $limit, arra /** * @dataProvider dataProviderForLoadUserBookmarks */ - public function testCountUserBookmarks(int $userId, int $offset, int $limit, array $expected) + public function testCountUserBookmarks(int $userId, int $offset, int $limit, array $expected): void { self::assertEquals(count($expected), $this->getGateway()->countUserBookmarks($userId)); } @@ -101,7 +101,7 @@ public function dataProviderForLoadUserBookmarks(): array return $row['user_id'] == $userId; }); - usort($rows, static function ($a, $b): int { + usort($rows, static function (array $a, array $b): int { return $b['id'] <=> $a['id']; }); @@ -117,7 +117,7 @@ public function dataProviderForLoadUserBookmarks(): array ]; } - public function testLocationSwapped() + public function testLocationSwapped(): void { $bookmark1Id = 3; $bookmark2Id = 4; diff --git a/tests/lib/Persistence/Legacy/Bookmark/HandlerTest.php b/tests/lib/Persistence/Legacy/Bookmark/HandlerTest.php index 1b9e0c99f6..52c7d0c561 100644 --- a/tests/lib/Persistence/Legacy/Bookmark/HandlerTest.php +++ b/tests/lib/Persistence/Legacy/Bookmark/HandlerTest.php @@ -13,6 +13,7 @@ use Ibexa\Core\Persistence\Legacy\Bookmark\Gateway; use Ibexa\Core\Persistence\Legacy\Bookmark\Handler; use Ibexa\Core\Persistence\Legacy\Bookmark\Mapper; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class HandlerTest extends TestCase @@ -20,13 +21,13 @@ class HandlerTest extends TestCase public const BOOKMARK_ID = 7; /** @var \Ibexa\Core\Persistence\Legacy\Bookmark\Gateway|\PHPUnit\Framework\MockObject\MockObject */ - private $gateway; + private MockObject $gateway; /** @var \Ibexa\Core\Persistence\Legacy\Bookmark\Mapper|\PHPUnit\Framework\MockObject\MockObject */ - private $mapper; + private MockObject $mapper; /** @var \Ibexa\Core\Persistence\Legacy\Bookmark\Handler */ - private $handler; + private Handler $handler; protected function setUp(): void { @@ -35,7 +36,7 @@ protected function setUp(): void $this->handler = new Handler($this->gateway, $this->mapper); } - public function testCreate() + public function testCreate(): void { $createStruct = new CreateStruct([ 'locationId' => 54, @@ -64,7 +65,7 @@ public function testCreate() self::assertEquals($bookmark->id, self::BOOKMARK_ID); } - public function testDelete() + public function testDelete(): void { $this->gateway ->expects(self::once()) @@ -74,7 +75,7 @@ public function testDelete() $this->handler->delete(self::BOOKMARK_ID); } - public function testLoadByUserIdAndLocationIdExistingBookmark() + public function testLoadByUserIdAndLocationIdExistingBookmark(): void { $userId = 87; $locationId = 54; @@ -107,7 +108,7 @@ public function testLoadByUserIdAndLocationIdExistingBookmark() self::assertEquals([$locationId => $object], $this->handler->loadByUserIdAndLocationId($userId, [$locationId])); } - public function testLoadByUserIdAndLocationIdNonExistingBookmark() + public function testLoadByUserIdAndLocationIdNonExistingBookmark(): void { $userId = 87; $locationId = 54; @@ -127,7 +128,7 @@ public function testLoadByUserIdAndLocationIdNonExistingBookmark() self::assertEmpty($this->handler->loadByUserIdAndLocationId($userId, [$locationId])); } - public function testLoadUserBookmarks() + public function testLoadUserBookmarks(): void { $userId = 87; $offset = 50; @@ -176,7 +177,7 @@ public function testLoadUserBookmarks() self::assertEquals($objects, $this->handler->loadUserBookmarks($userId, $offset, $limit)); } - public function testLocationSwapped() + public function testLocationSwapped(): void { $location1Id = 1; $location2Id = 2; diff --git a/tests/lib/Persistence/Legacy/Bookmark/MapperTest.php b/tests/lib/Persistence/Legacy/Bookmark/MapperTest.php index 3e88f1cd1e..b7887f773c 100644 --- a/tests/lib/Persistence/Legacy/Bookmark/MapperTest.php +++ b/tests/lib/Persistence/Legacy/Bookmark/MapperTest.php @@ -19,14 +19,14 @@ class MapperTest extends TestCase { /** @var \Ibexa\Core\Persistence\Legacy\Bookmark\Mapper */ - private $mapper; + private Mapper $mapper; protected function setUp(): void { $this->mapper = new Mapper(); } - public function testCreateBookmarkFromCreateStruct() + public function testCreateBookmarkFromCreateStruct(): void { $createStruct = new CreateStruct([ 'locationId' => 54, @@ -39,7 +39,7 @@ public function testCreateBookmarkFromCreateStruct() ]), $this->mapper->createBookmarkFromCreateStruct($createStruct)); } - public function testExtractBookmarksFromRows() + public function testExtractBookmarksFromRows(): void { $rows = [ [ diff --git a/tests/lib/Persistence/Legacy/Content/ContentHandlerTest.php b/tests/lib/Persistence/Legacy/Content/ContentHandlerTest.php index b3737f54c7..fd93f1e490 100644 --- a/tests/lib/Persistence/Legacy/Content/ContentHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Content/ContentHandlerTest.php @@ -33,6 +33,7 @@ use Ibexa\Core\Persistence\Legacy\Content\UrlAlias\Gateway as UrlAliasGateway; use Ibexa\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter; use Ibexa\Tests\Core\Persistence\Legacy\TestCase; +use PHPUnit\Framework\MockObject\MockObject; use ReflectionException; /** @@ -54,63 +55,63 @@ class ContentHandlerTest extends TestCase * * @var \Ibexa\Core\Persistence\Legacy\Content\Gateway */ - protected $gatewayMock; + protected ?MockObject $gatewayMock = null; /** * Location gateway mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Gateway */ - protected $locationGatewayMock; + protected ?MockObject $locationGatewayMock = null; /** * Type gateway mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\Type\Gateway */ - protected $typeGatewayMock; + protected ?MockObject $typeGatewayMock = null; /** * Mapper mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\Mapper */ - protected $mapperMock; + protected ?MockObject $mapperMock = null; /** * Field handler mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\FieldHandler */ - protected $fieldHandlerMock; + protected ?MockObject $fieldHandlerMock = null; /** * Location handler mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\TreeHandler */ - protected $treeHandlerMock; + protected ?MockObject $treeHandlerMock = null; /** * Slug converter mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter */ - protected $slugConverterMock; + protected ?MockObject $slugConverterMock = null; /** * Location handler mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\UrlAlias\Gateway */ - protected $urlAliasGatewayMock; + protected ?MockObject $urlAliasGatewayMock = null; /** * ContentType handler mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\Type\Handler */ - protected $contentTypeHandlerMock; + protected ?MockObject $contentTypeHandlerMock = null; /** * @var \PHPUnit\Framework\MockObject\MockObject&\Ibexa\Core\Persistence\Legacy\Content\Language\Handler @@ -120,7 +121,7 @@ class ContentHandlerTest extends TestCase /** * @todo Current method way to complex to test, refactor! */ - public function testCreate() + public function testCreate(): void { $handler = $this->getContentHandler(); @@ -215,7 +216,7 @@ public function testCreate() ); } - public function testPublishFirstVersion() + public function testPublishFirstVersion(): void { $handler = $this->getPartlyMockedHandler(['loadVersionInfo']); @@ -292,7 +293,7 @@ public function testPublishFirstVersion() $handler->publish(23, 1, $metadataUpdateStruct); } - public function testPublish() + public function testPublish(): void { $handler = $this->getPartlyMockedHandler(['loadVersionInfo', 'setStatus']); @@ -375,7 +376,7 @@ public function testPublish() $handler->publish(23, 2, $metadataUpdateStruct); } - public function testCreateDraftFromVersion() + public function testCreateDraftFromVersion(): void { $handler = $this->getPartlyMockedHandler(['load']); @@ -472,7 +473,7 @@ public function testCreateDraftFromVersion() ); } - public function testLoad() + public function testLoad(): void { $handler = $this->getContentHandler(); @@ -517,7 +518,7 @@ public function testLoad() ); } - public function testLoadContentList() + public function testLoadContentList(): void { $handler = $this->getContentHandler(); @@ -569,7 +570,7 @@ public function testLoadContentList() ); } - public function testLoadContentInfoByRemoteId() + public function testLoadContentInfoByRemoteId(): void { $contentInfoData = [new ContentInfo()]; $this->getGatewayMock()->expects(self::once()) @@ -591,7 +592,7 @@ public function testLoadContentInfoByRemoteId() ); } - public function testLoadErrorNotFound() + public function testLoadErrorNotFound(): void { $this->expectException(NotFoundException::class); @@ -616,7 +617,7 @@ public function testLoadErrorNotFound() * * @return \Ibexa\Contracts\Core\Persistence\Content */ - protected function getContentFixtureForDraft(int $id = 23, int $versionNo = 2) + protected function getContentFixtureForDraft(int $id = 23, int $versionNo = 2): Content { $content = new Content(); $content->versionInfo = new VersionInfo(); @@ -632,7 +633,7 @@ protected function getContentFixtureForDraft(int $id = 23, int $versionNo = 2) return $content; } - public function testUpdateContent() + public function testUpdateContent(): void { $handler = $this->getPartlyMockedHandler(['load', 'loadContentInfo']); @@ -730,7 +731,7 @@ public function testUpdateContent() ); } - public function testUpdateMetadata() + public function testUpdateMetadata(): void { $handler = $this->getPartlyMockedHandler(['load', 'loadContentInfo']); @@ -765,7 +766,7 @@ public function testUpdateMetadata() self::assertInstanceOf(ContentInfo::class, $resultContentInfo); } - public function testUpdateMetadataUpdatesPathIdentificationString() + public function testUpdateMetadataUpdatesPathIdentificationString(): void { $handler = $this->getPartlyMockedHandler(['load', 'loadContentInfo']); $locationGatewayMock = $this->getLocationGatewayMock(); @@ -888,7 +889,7 @@ public function testLoadRelationList(): void ); } - public function testLoadReverseRelations() + public function testLoadReverseRelations(): void { $handler = $this->getContentHandler(); @@ -917,7 +918,7 @@ public function testLoadReverseRelations() ); } - public function testAddRelation() + public function testAddRelation(): void { // expected relation object after creation $expectedRelationObject = new Relation(); @@ -928,7 +929,7 @@ public function testAddRelation() $expectedRelationObject->type = RelationValue::COMMON; // relation create struct - $relationCreateStruct = new Relation\CreateStruct(); + $relationCreateStruct = new RelationCreateStruct(); $relationCreateStruct->destinationContentId = 66; $relationCreateStruct->sourceContentId = 23; $relationCreateStruct->sourceContentVersionNo = 1; @@ -961,7 +962,7 @@ public function testAddRelation() ); } - public function testRemoveRelation() + public function testRemoveRelation(): void { $gatewayMock = $this->getGatewayMock(); @@ -975,7 +976,7 @@ public function testRemoveRelation() $this->getContentHandler()->removeRelation(1, RelationValue::COMMON); } - protected function getRelationFixture() + protected function getRelationFixture(): Relation { $relation = new Relation(); $relation->id = self::RELATION_ID; @@ -991,7 +992,7 @@ protected function getRelationFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content\CreateStruct */ - public function getCreateStructFixture() + public function getCreateStructFixture(): CreateStruct { $struct = new CreateStruct(); @@ -1020,7 +1021,7 @@ public function getCreateStructFixture() return $struct; } - public function testLoadDraftsForUser() + public function testLoadDraftsForUser(): void { $handler = $this->getContentHandler(); $rows = [['ezcontentobject_version_contentobject_id' => 42, 'ezcontentobject_version_version' => 2]]; @@ -1051,7 +1052,7 @@ public function testLoadDraftsForUser() ); } - public function testListVersions() + public function testListVersions(): void { $handler = $this->getContentHandler(); @@ -1071,7 +1072,7 @@ public function testListVersions() ); } - public function testRemoveRawContent() + public function testRemoveRawContent(): void { $handler = $this->getContentHandler(); $treeHandlerMock = $this->getTreeHandlerMock(); @@ -1087,7 +1088,7 @@ public function testRemoveRawContent() /** * Test for the deleteContent() method. */ - public function testDeleteContentWithLocations() + public function testDeleteContentWithLocations(): void { $handlerMock = $this->getPartlyMockedHandler(['getAllLocationIds']); $gatewayMock = $this->getGatewayMock(); @@ -1112,7 +1113,7 @@ public function testDeleteContentWithLocations() /** * Test for the deleteContent() method. */ - public function testDeleteContentWithoutLocations() + public function testDeleteContentWithoutLocations(): void { $handlerMock = $this->getPartlyMockedHandler(['removeRawContent']); $gatewayMock = $this->getGatewayMock(); @@ -1128,7 +1129,7 @@ public function testDeleteContentWithoutLocations() $handlerMock->deleteContent(23); } - public function testDeleteVersion() + public function testDeleteVersion(): void { $handler = $this->getContentHandler(); @@ -1190,7 +1191,7 @@ public function testDeleteVersion() $handler->deleteVersion(225, 2); } - public function testCopySingleVersion() + public function testCopySingleVersion(): void { $handler = $this->getPartlyMockedHandler(['load', 'internalCreate']); $gatewayMock = $this->getGatewayMock(); @@ -1251,7 +1252,7 @@ public function testCopySingleVersion() ); } - public function testCopyAllVersions() + public function testCopyAllVersions(): void { $handler = $this->getPartlyMockedHandler( [ @@ -1403,7 +1404,7 @@ public function testCopyAllVersions() ); } - public function testCopyThrowsNotFoundExceptionContentNotFound() + public function testCopyThrowsNotFoundExceptionContentNotFound(): void { $this->expectException(NotFoundException::class); @@ -1421,7 +1422,7 @@ public function testCopyThrowsNotFoundExceptionContentNotFound() $handler->copy(23); } - public function testCopyThrowsNotFoundExceptionVersionNotFound() + public function testCopyThrowsNotFoundExceptionVersionNotFound(): void { $this->expectException(NotFoundException::class); @@ -1439,7 +1440,7 @@ public function testCopyThrowsNotFoundExceptionVersionNotFound() $result = $handler->copy(23, 32); } - public function testSetStatus() + public function testSetStatus(): void { $handler = $this->getContentHandler(); @@ -1544,7 +1545,7 @@ protected function getContentHandler() * * @return \Ibexa\Core\Persistence\Legacy\Content\Handler */ - protected function getPartlyMockedHandler(array $methods) + protected function getPartlyMockedHandler(array $methods): MockObject { return $this->getMockBuilder(Handler::class) ->setMethods($methods) diff --git a/tests/lib/Persistence/Legacy/Content/FieldHandlerTest.php b/tests/lib/Persistence/Legacy/Content/FieldHandlerTest.php index 4325bff99a..2dcb93c603 100644 --- a/tests/lib/Persistence/Legacy/Content/FieldHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Content/FieldHandlerTest.php @@ -22,6 +22,7 @@ use Ibexa\Core\Persistence\Legacy\Content\Mapper; use Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue; use Ibexa\Core\Persistence\Legacy\Content\StorageHandler; +use PHPUnit\Framework\MockObject\MockObject; /** * @covers \Ibexa\Core\Persistence\Legacy\Content\FieldHandler @@ -33,35 +34,35 @@ class FieldHandlerTest extends LanguageAwareTestCase * * @var \Ibexa\Core\Persistence\Legacy\Content\Gateway */ - protected $contentGatewayMock; + protected ?MockObject $contentGatewayMock = null; /** * Mapper mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\Mapper */ - protected $mapperMock; + protected ?MockObject $mapperMock = null; /** * Storage handler mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\StorageHandler */ - protected $storageHandlerMock; + protected ?MockObject $storageHandlerMock = null; /** * Field type registry mock. * * @var \Ibexa\Core\Persistence\FieldTypeRegistry */ - protected $fieldTypeRegistryMock; + protected ?MockObject $fieldTypeRegistryMock = null; /** * Field type mock. * * @var \Ibexa\Contracts\Core\FieldType\FieldType */ - protected $fieldTypeMock; + protected ?MockObject $fieldTypeMock = null; /** * @param bool $storageHandlerUpdatesFields @@ -125,7 +126,7 @@ protected function assertCreateNewFields($storageHandlerUpdatesFields = false) )->will(self::returnValue($storageHandlerUpdatesFields)); } - public function testCreateNewFields() + public function testCreateNewFields(): void { $fieldHandler = $this->getFieldHandler(); $mapperMock = $this->getMapperMock(); @@ -143,7 +144,7 @@ public function testCreateNewFields() ); } - public function testCreateNewFieldsUpdatingStorageHandler() + public function testCreateNewFieldsUpdatingStorageHandler(): void { $fieldHandler = $this->getFieldHandler(); $contentGatewayMock = $this->getContentGatewayMock(); @@ -212,7 +213,7 @@ protected function assertCreateNewFieldsForMainLanguage($storageHandlerUpdatesFi } } - public function testCreateNewFieldsForMainLanguage() + public function testCreateNewFieldsForMainLanguage(): void { $fieldHandler = $this->getFieldHandler(); $mapperMock = $this->getMapperMock(); @@ -230,7 +231,7 @@ public function testCreateNewFieldsForMainLanguage() ); } - public function testCreateNewFieldsForMainLanguageUpdatingStorageHandler() + public function testCreateNewFieldsForMainLanguageUpdatingStorageHandler(): void { $fieldHandler = $this->getFieldHandler(); $contentGatewayMock = $this->getContentGatewayMock(); @@ -298,7 +299,7 @@ protected function assertCreateExistingFieldsInNewVersion($storageHandlerUpdates } } - public function testCreateExistingFieldsInNewVersion() + public function testCreateExistingFieldsInNewVersion(): void { $fieldHandler = $this->getFieldHandler(); $mapperMock = $this->getMapperMock(); @@ -313,7 +314,7 @@ public function testCreateExistingFieldsInNewVersion() $fieldHandler->createExistingFieldsInNewVersion($this->getContentFixture()); } - public function testCreateExistingFieldsInNewVersionUpdatingStorageHandler() + public function testCreateExistingFieldsInNewVersionUpdatingStorageHandler(): void { $fieldHandler = $this->getFieldHandler(); $contentGatewayMock = $this->getContentGatewayMock(); @@ -336,7 +337,7 @@ public function testCreateExistingFieldsInNewVersionUpdatingStorageHandler() $fieldHandler->createExistingFieldsInNewVersion($this->getContentFixture()); } - public function testLoadExternalFieldData() + public function testLoadExternalFieldData(): void { $fieldHandler = $this->getFieldHandler(); @@ -355,7 +356,7 @@ public function testLoadExternalFieldData() /** * @param bool $storageHandlerUpdatesFields */ - public function assertUpdateFieldsWithNewLanguage($storageHandlerUpdatesFields = false) + public function assertUpdateFieldsWithNewLanguage($storageHandlerUpdatesFields = false): void { $contentGatewayMock = $this->getContentGatewayMock(); $fieldTypeMock = $this->getFieldTypeMock(); @@ -412,7 +413,7 @@ public function assertUpdateFieldsWithNewLanguage($storageHandlerUpdatesFields = )->will(self::returnValue($storageHandlerUpdatesFields)); } - public function testUpdateFieldsWithNewLanguage() + public function testUpdateFieldsWithNewLanguage(): void { $mapperMock = $this->getMapperMock(); $fieldHandler = $this->getFieldHandler(); @@ -444,7 +445,7 @@ public function testUpdateFieldsWithNewLanguage() ); } - public function testUpdateFieldsWithNewLanguageUpdatingStorageHandler() + public function testUpdateFieldsWithNewLanguageUpdatingStorageHandler(): void { $fieldHandler = $this->getFieldHandler(); $mapperMock = $this->getMapperMock(); @@ -487,7 +488,7 @@ public function testUpdateFieldsWithNewLanguageUpdatingStorageHandler() /** * @param bool $storageHandlerUpdatesFields */ - public function assertUpdateFieldsExistingLanguages($storageHandlerUpdatesFields = false) + public function assertUpdateFieldsExistingLanguages($storageHandlerUpdatesFields = false): void { $storageHandlerMock = $this->getStorageHandlerMock(); @@ -537,7 +538,7 @@ public function assertUpdateFieldsExistingLanguages($storageHandlerUpdatesFields } } - public function testUpdateFieldsExistingLanguages() + public function testUpdateFieldsExistingLanguages(): void { $fieldHandler = $this->getFieldHandler(); $mapperMock = $this->getMapperMock(); @@ -564,7 +565,7 @@ public function testUpdateFieldsExistingLanguages() ); } - public function testUpdateFieldsExistingLanguagesUpdatingStorageHandler() + public function testUpdateFieldsExistingLanguagesUpdatingStorageHandler(): void { $fieldHandler = $this->getFieldHandler(); $mapperMock = $this->getMapperMock(); @@ -594,7 +595,7 @@ public function testUpdateFieldsExistingLanguagesUpdatingStorageHandler() /** * @param bool $storageHandlerUpdatesFields */ - public function assertUpdateFieldsForInitialLanguage($storageHandlerUpdatesFields = false) + public function assertUpdateFieldsForInitialLanguage($storageHandlerUpdatesFields = false): void { $storageHandlerMock = $this->getStorageHandlerMock(); @@ -643,7 +644,7 @@ public function assertUpdateFieldsForInitialLanguage($storageHandlerUpdatesField } } - public function testUpdateFieldsForInitialLanguage() + public function testUpdateFieldsForInitialLanguage(): void { $fieldHandler = $this->getFieldHandler(); $mapperMock = $this->getMapperMock(); @@ -665,7 +666,7 @@ public function testUpdateFieldsForInitialLanguage() ); } - public function testUpdateFieldsForInitialLanguageUpdatingStorageHandler() + public function testUpdateFieldsForInitialLanguageUpdatingStorageHandler(): void { $fieldHandler = $this->getFieldHandler(); $mapperMock = $this->getMapperMock(); @@ -695,7 +696,7 @@ public function testUpdateFieldsForInitialLanguageUpdatingStorageHandler() ); } - public function testDeleteFields() + public function testDeleteFields(): void { $fieldHandler = $this->getFieldHandler(); @@ -731,7 +732,7 @@ public function testDeleteFields() * * @return \Ibexa\Contracts\Core\Persistence\Content */ - protected function getContentPartialFieldsFixture() + protected function getContentPartialFieldsFixture(): Content { $content = new Content(); $content->versionInfo = new VersionInfo(); @@ -769,7 +770,7 @@ protected function getContentPartialFieldsFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content */ - protected function getContentNoFieldsFixture() + protected function getContentNoFieldsFixture(): Content { $content = new Content(); $content->versionInfo = new VersionInfo(); @@ -789,7 +790,7 @@ protected function getContentNoFieldsFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content */ - protected function getContentSingleLanguageFixture() + protected function getContentSingleLanguageFixture(): Content { $content = new Content(); $content->versionInfo = new VersionInfo(); @@ -866,7 +867,7 @@ protected function getContentFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content\Type */ - protected function getContentTypeFixture() + protected function getContentTypeFixture(): Type { $contentType = new Type(); $firstFieldDefinition = new FieldDefinition( @@ -904,7 +905,7 @@ protected function getContentTypeFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content\UpdateStruct */ - protected function getUpdateStructFixture() + protected function getUpdateStructFixture(): UpdateStruct { $struct = new UpdateStruct(); @@ -929,7 +930,7 @@ protected function getUpdateStructFixture() * * @return \Ibexa\Core\Persistence\Legacy\Content\FieldHandler */ - protected function getFieldHandler() + protected function getFieldHandler(): FieldHandler { $mock = new FieldHandler( $this->getContentGatewayMock(), diff --git a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorTest.php b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorTest.php index 9d606ac506..6f01b9641a 100644 --- a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorTest.php +++ b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/AuthorTest.php @@ -30,7 +30,7 @@ class AuthorTest extends TestCase protected $converter; /** @var \Ibexa\Core\FieldType\Author\Author[] */ - private $authors; + private array $authors; protected function setUp(): void { @@ -49,7 +49,7 @@ protected function tearDown(): void parent::tearDown(); } - public function testToStorageValue() + public function testToStorageValue(): void { $value = new FieldValue(); $value->data = $this->authors; @@ -79,7 +79,7 @@ public function testToStorageValue() self::assertEmpty($this->authors, 'All authors have not been converted as expected'); } - public function testToFieldValue() + public function testToFieldValue(): void { $storageFieldValue = new StorageFieldValue(); $storageFieldValue->dataText = <<data = true; @@ -49,7 +49,7 @@ public function testToStorageValue() * @group fieldType * @group ezboolean */ - public function testToFieldValue() + public function testToFieldValue(): void { $storageFieldValue = new StorageFieldValue(); $storageFieldValue->dataInt = 1; @@ -66,7 +66,7 @@ public function testToFieldValue() * @group fieldType * @group ezboolean */ - public function testToStorageFieldDefinition() + public function testToStorageFieldDefinition(): void { $defaultBool = false; $storageFieldDef = new StorageFieldDefinition(); @@ -89,7 +89,7 @@ public function testToStorageFieldDefinition() * @group fieldType * @group ezboolean */ - public function testToFieldDefinition() + public function testToFieldDefinition(): void { $defaultBool = true; $fieldDef = new PersistenceFieldDefinition(); diff --git a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/CountryTest.php b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/CountryTest.php index 7d2f97f0bc..df8bf969ab 100644 --- a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/CountryTest.php +++ b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/CountryTest.php @@ -30,7 +30,7 @@ protected function setUp(): void $this->converter = new CountryConverter(); } - public function providerForTestToStorageValue() + public function providerForTestToStorageValue(): array { return [ [['BE', 'FR'], 'belgium,france', 'BE,FR', 'belgium,france'], @@ -44,7 +44,7 @@ public function providerForTestToStorageValue() * * @dataProvider providerForTestToStorageValue */ - public function testToStorageValue($data, $sortKey, $dataText, $sortKeyString) + public function testToStorageValue(?array $data, string $sortKey, string $dataText, string $sortKeyString): void { $value = new FieldValue(); $value->data = $data; @@ -56,7 +56,7 @@ public function testToStorageValue($data, $sortKey, $dataText, $sortKeyString) self::assertSame($sortKeyString, $storageFieldValue->sortKeyString); } - public function providerForTestToFieldValue() + public function providerForTestToFieldValue(): array { return [ ['BE,FR', 'belgium,france', ['BE', 'FR']], @@ -70,7 +70,7 @@ public function providerForTestToFieldValue() * * @dataProvider providerForTestToFieldValue */ - public function testToFieldValue($dataText, $sortKeyString, $data) + public function testToFieldValue(string $dataText, string $sortKeyString, ?array $data): void { $storageFieldValue = new StorageFieldValue(); $storageFieldValue->dataText = $dataText; @@ -85,7 +85,7 @@ public function testToFieldValue($dataText, $sortKeyString, $data) * @group fieldType * @group country */ - public function testToStorageFieldDefinitionMultiple() + public function testToStorageFieldDefinitionMultiple(): void { $defaultValue = new FieldValue(); $defaultValue->data = ['BE', 'FR']; @@ -120,7 +120,7 @@ public function testToStorageFieldDefinitionMultiple() * @group fieldType * @group country */ - public function testToStorageFieldDefinitionSingle() + public function testToStorageFieldDefinitionSingle(): void { $fieldTypeConstraints = new FieldTypeConstraints(); $fieldTypeConstraints->fieldSettings = new FieldSettings( @@ -151,7 +151,7 @@ public function testToStorageFieldDefinitionSingle() * @group fieldType * @group country */ - public function testToFieldDefinitionMultiple() + public function testToFieldDefinitionMultiple(): void { $fieldDef = new PersistenceFieldDefinition(); @@ -178,7 +178,7 @@ public function testToFieldDefinitionMultiple() * @group fieldType * @group country */ - public function testToFieldDefinitionSingle() + public function testToFieldDefinitionSingle(): void { $fieldDef = new PersistenceFieldDefinition(); diff --git a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeTest.php b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeTest.php index 26e72c3ba8..e0ea03d4fd 100644 --- a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeTest.php +++ b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeTest.php @@ -44,12 +44,12 @@ protected function setUp(): void * @group fieldType * @group dateTime */ - public function testToStorageValue() + public function testToStorageValue(): void { $value = new FieldValue(); $value->data = [ 'timestamp' => $this->date->getTimestamp(), - 'rfc850' => $this->date->format(\DateTime::RFC850), + 'rfc850' => $this->date->format(DateTime::RFC850), ]; $value->sortKey = $this->date->getTimestamp(); $storageFieldValue = new StorageFieldValue(); @@ -64,7 +64,7 @@ public function testToStorageValue() * @group fieldType * @group dateTime */ - public function testToFieldValue() + public function testToFieldValue(): void { $storageFieldValue = new StorageFieldValue(); $storageFieldValue->dataInt = $this->date->getTimestamp(); @@ -88,7 +88,7 @@ public function testToFieldValue() * @group fieldType * @group dateTime */ - public function testToStorageFieldDefinitionWithAdjustment() + public function testToStorageFieldDefinitionWithAdjustment(): void { $storageFieldDef = new StorageFieldDefinition(); $dateInterval = DateInterval::createFromDateString('+10 years, -1 month, +3 days, -13 hours'); @@ -129,7 +129,7 @@ public function testToStorageFieldDefinitionWithAdjustment() * @group fieldType * @group dateTime */ - public function testToStorageFieldDefinitionNoDefault() + public function testToStorageFieldDefinitionNoDefault(): void { $storageFieldDef = new StorageFieldDefinition(); $fieldTypeConstraints = new FieldTypeConstraints(); @@ -162,7 +162,7 @@ public function testToStorageFieldDefinitionNoDefault() * @group fieldType * @group dateTime */ - public function testToStorageFieldDefinitionCurrentDate() + public function testToStorageFieldDefinitionCurrentDate(): void { $storageFieldDef = new StorageFieldDefinition(); $fieldTypeConstraints = new FieldTypeConstraints(); @@ -196,7 +196,7 @@ public function testToStorageFieldDefinitionCurrentDate() * * @return array Key is the XML node name, value is the DateInterval property */ - private function getXMLToDateIntervalMap() + private function getXMLToDateIntervalMap(): array { return [ 'year' => 'y', @@ -212,7 +212,7 @@ private function getXMLToDateIntervalMap() * @group fieldType * @group dateTime */ - public function testToFieldDefinitionNoDefault() + public function testToFieldDefinitionNoDefault(): void { $fieldDef = new PersistenceFieldDefinition(); $storageDef = new StorageFieldDefinition( @@ -230,7 +230,7 @@ public function testToFieldDefinitionNoDefault() * @group fieldType * @group dateTime */ - public function testToFieldDefinitionCurrentDate() + public function testToFieldDefinitionCurrentDate(): void { $time = time(); $fieldDef = new PersistenceFieldDefinition(); @@ -256,7 +256,7 @@ public function testToFieldDefinitionCurrentDate() * @group fieldType * @group dateTime */ - public function testToFieldDefinitionWithAdjustmentAndSeconds() + public function testToFieldDefinitionWithAdjustmentAndSeconds(): void { $fieldDef = new PersistenceFieldDefinition(); $dateInterval = DateInterval::createFromDateString('2 years, 1 month, -4 days, 2 hours, 0 minute, 34 seconds'); @@ -289,7 +289,7 @@ public function testToFieldDefinitionWithAdjustmentAndSeconds() * @group fieldType * @group dateTime */ - public function testToFieldDefinitionWithAdjustmentNoSeconds() + public function testToFieldDefinitionWithAdjustmentNoSeconds(): void { $fieldDef = new PersistenceFieldDefinition(); $seconds = 34; @@ -348,7 +348,7 @@ private function getXMLStringFromDateInterval(DateInterval $dateInterval): strin * @group fieldType * @group dateTime */ - public function testGetDateIntervalFromXML() + public function testGetDateIntervalFromXML(): void { $dateIntervalReference = DateInterval::createFromDateString('2 years, 1 months, -4 days, 2 hours, 0 minutes, 34 seconds'); @@ -366,7 +366,7 @@ public function testGetDateIntervalFromXML() * @group fieldType * @group dateTime */ - public function testGenerateDateIntervalXML() + public function testGenerateDateIntervalXML(): void { $dateIntervalReference = DateInterval::createFromDateString('2 years, 1 month, -4 days, 2 hours, 0 minute, 34 seconds'); $dom = new DOMDocument(); diff --git a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/DateTest.php b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/DateTest.php index 32b6760b8d..5063cd9a52 100644 --- a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/DateTest.php +++ b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/DateTest.php @@ -39,12 +39,12 @@ protected function setUp(): void $this->date = new DateTime('@1362614400'); } - public function testToStorageValue() + public function testToStorageValue(): void { $value = new FieldValue(); $value->data = [ 'timestamp' => $this->date->getTimestamp(), - 'rfc850' => $this->date->format(\DateTime::RFC850), + 'rfc850' => $this->date->format(DateTime::RFC850), ]; $value->sortKey = $this->date->getTimestamp(); $storageFieldValue = new StorageFieldValue(); @@ -55,7 +55,7 @@ public function testToStorageValue() self::assertSame('', $storageFieldValue->sortKeyString); } - public function testToFieldValue() + public function testToFieldValue(): void { $storageFieldValue = new StorageFieldValue(); $storageFieldValue->dataInt = $this->date->getTimestamp(); @@ -75,7 +75,7 @@ public function testToFieldValue() self::assertSame($storageFieldValue->sortKeyInt, $fieldValue->sortKey); } - public function testToStorageFieldDefinitionDefaultEmpty() + public function testToStorageFieldDefinitionDefaultEmpty(): void { $storageFieldDef = new StorageFieldDefinition(); $fieldTypeConstraints = new FieldTypeConstraints(); @@ -97,7 +97,7 @@ public function testToStorageFieldDefinitionDefaultEmpty() ); } - public function testToStorageFieldDefinitionDefaultCurrentDate() + public function testToStorageFieldDefinitionDefaultCurrentDate(): void { $storageFieldDef = new StorageFieldDefinition(); $fieldTypeConstraints = new FieldTypeConstraints(); @@ -119,7 +119,7 @@ public function testToStorageFieldDefinitionDefaultCurrentDate() ); } - public function testToFieldDefinitionDefaultEmpty() + public function testToFieldDefinitionDefaultEmpty(): void { $fieldDef = new PersistenceFieldDefinition(); $storageDef = new StorageFieldDefinition( @@ -132,7 +132,7 @@ public function testToFieldDefinitionDefaultEmpty() self::assertNull($fieldDef->defaultValue->data); } - public function testToFieldDefinitionDefaultCurrentDate() + public function testToFieldDefinitionDefaultCurrentDate(): void { $timestamp = time(); $fieldDef = new PersistenceFieldDefinition(); diff --git a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/ISBNTest.php b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/ISBNTest.php index a526c25ae2..1ce1ff4f20 100644 --- a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/ISBNTest.php +++ b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/ISBNTest.php @@ -28,7 +28,7 @@ protected function setUp(): void /** * @dataProvider providerForTestToFieldDefinition */ - public function testToFieldDefinition($dataInt, $excpectedIsbn13Value) + public function testToFieldDefinition(?int $dataInt, bool $excpectedIsbn13Value): void { $fieldDef = new PersistenceFieldDefinition(); $storageDefinition = new StorageFieldDefinition([ @@ -42,7 +42,7 @@ public function testToFieldDefinition($dataInt, $excpectedIsbn13Value) self::assertSame($excpectedIsbn13Value, $fieldSettings['isISBN13']); } - public function providerForTestToFieldDefinition() + public function providerForTestToFieldDefinition(): array { return [ [1, true], diff --git a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/KeywordTest.php b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/KeywordTest.php index efd77df1df..c7009a8b57 100644 --- a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/KeywordTest.php +++ b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/KeywordTest.php @@ -32,7 +32,7 @@ protected function setUp(): void * @group fieldType * @group keyword */ - public function testToStorageValue() + public function testToStorageValue(): void { $value = new FieldValue(); $value->data = ['key1', 'key2']; @@ -51,7 +51,7 @@ public function testToStorageValue() * @group fieldType * @group keyword */ - public function testToFieldValue() + public function testToFieldValue(): void { $storageFieldValue = new StorageFieldValue(); $fieldValue = new FieldValue(); @@ -65,7 +65,7 @@ public function testToFieldValue() * @group fieldType * @group keyword */ - public function testToStorageFieldDefinition() + public function testToStorageFieldDefinition(): void { $this->converter->toStorageFieldDefinition(new PersistenceFieldDefinition(), new StorageFieldDefinition()); } @@ -74,7 +74,7 @@ public function testToStorageFieldDefinition() * @group fieldType * @group keyword */ - public function testToFieldDefinition() + public function testToFieldDefinition(): void { $this->converter->toFieldDefinition(new StorageFieldDefinition(), new PersistenceFieldDefinition()); } diff --git a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/MediaTest.php b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/MediaTest.php index 544b257158..a331af314a 100644 --- a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/MediaTest.php +++ b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/MediaTest.php @@ -31,7 +31,7 @@ protected function setUp(): void * @group fieldType * @group ezmedia */ - public function testToStorageFieldDefinition() + public function testToStorageFieldDefinition(): void { $storageFieldDef = new StorageFieldDefinition(); @@ -69,7 +69,7 @@ public function testToStorageFieldDefinition() * @group fieldType * @group ezmedia */ - public function testToFieldDefinition() + public function testToFieldDefinition(): void { $fieldDef = new PersistenceFieldDefinition(); $storageDef = new StorageFieldDefinition( diff --git a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationListTest.php b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationListTest.php index 0370b60aea..ff50d4e8cd 100644 --- a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationListTest.php +++ b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/RelationListTest.php @@ -14,6 +14,7 @@ use Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter\RelationListConverter; use Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition; use Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -22,7 +23,7 @@ class RelationListTest extends TestCase { /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter\RelationListConverter */ - protected $converter; + protected MockObject $converter; protected function setUp(): void { @@ -38,7 +39,7 @@ protected function setUp(): void * @group fieldType * @group relationlist */ - public function testToStorageValue() + public function testToStorageValue(): void { $destinationContentIds = [3, 2, 1]; $fieldValue = new FieldValue(); @@ -107,7 +108,7 @@ public function testToStorageValue() * @group fieldType * @group relationlist */ - public function testToStorageValueEmpty() + public function testToStorageValueEmpty(): void { $destinationContentIds = []; $fieldValue = new FieldValue(); @@ -141,7 +142,7 @@ public function testToStorageValueEmpty() * @group fieldType * @group relationlist */ - public function testToFieldValue() + public function testToFieldValue(): void { $storageFieldValue = new StorageFieldValue(); $storageFieldValue->sortKeyString = ''; @@ -168,7 +169,7 @@ public function testToFieldValue() * @group fieldType * @group relationlist */ - public function testToFieldValueEmpty() + public function testToFieldValueEmpty(): void { $storageFieldValue = new StorageFieldValue(); $storageFieldValue->sortKeyString = ''; @@ -195,7 +196,7 @@ public function testToFieldValueEmpty() * @group fieldType * @group relationlist */ - public function testToStorageFieldDefinition() + public function testToStorageFieldDefinition(): void { $fieldDefinition = new PersistenceFieldDefinition( [ @@ -238,7 +239,7 @@ public function testToStorageFieldDefinition() * @group fieldType * @group relationlist */ - public function testToFieldDefinitionMultiple() + public function testToFieldDefinitionMultiple(): void { $storageFieldDefinition = new StorageFieldDefinition(); $storageFieldDefinition->dataText5 = <<data = [1, 3]; @@ -59,7 +59,7 @@ public function testToStorageValue() * @group fieldType * @group selection */ - public function testToStorageValueEmpty() + public function testToStorageValueEmpty(): void { $fieldValue = new FieldValue(); $fieldValue->data = []; @@ -83,7 +83,7 @@ public function testToStorageValueEmpty() * @group fieldType * @group selection */ - public function testToFieldValue() + public function testToFieldValue(): void { $storageFieldValue = new StorageFieldValue(); $storageFieldValue->dataText = '1-3'; @@ -107,7 +107,7 @@ public function testToFieldValue() * @group fieldType * @group selection */ - public function testToFieldValueEmpty() + public function testToFieldValueEmpty(): void { $storageFieldValue = new StorageFieldValue(); $storageFieldValue->dataText = ''; @@ -131,7 +131,7 @@ public function testToFieldValueEmpty() * @group fieldType * @group selection */ - public function testToStorageFieldDefinitionMultiple() + public function testToStorageFieldDefinitionMultiple(): void { $fieldDefinition = new PersistenceFieldDefinition( [ @@ -171,7 +171,7 @@ public function testToStorageFieldDefinitionMultiple() * @group fieldType * @group selection */ - public function testToStorageFieldDefinitionSingle() + public function testToStorageFieldDefinitionSingle(): void { $fieldDefinition = new PersistenceFieldDefinition( [ @@ -209,7 +209,7 @@ public function testToStorageFieldDefinitionSingle() * @group fieldType * @group selection */ - public function testToFieldDefinitionMultiple() + public function testToFieldDefinitionMultiple(): void { $storageFieldDefinition = new StorageFieldDefinition(); $storageFieldDefinition->dataInt1 = 1; @@ -278,7 +278,7 @@ public function testToFieldDefinitionMultiple() * @group fieldType * @group selection */ - public function testToFieldDefinitionSingleEmpty() + public function testToFieldDefinitionSingleEmpty(): void { $storageFieldDefinition = new StorageFieldDefinition(); $storageFieldDefinition->dataInt1 = 0; diff --git a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/SerializableConverterTest.php b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/SerializableConverterTest.php index b05cd2b2ae..cd3d026064 100644 --- a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/SerializableConverterTest.php +++ b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/SerializableConverterTest.php @@ -16,6 +16,7 @@ use Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter\SerializableConverter; use Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition; use Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -31,10 +32,10 @@ class SerializableConverterTest extends TestCase private const EXAMPLE_JSON = '{"foo":"foo","bar":"bar"}'; /** @var \Ibexa\Contracts\Core\FieldType\ValueSerializerInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $serializer; + private MockObject $serializer; /** @var \Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter\SerializableConverter */ - private $converter; + private SerializableConverter $converter; protected function setUp(): void { diff --git a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/TextBlockTest.php b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/TextBlockTest.php index 5fab303af7..8b73a08027 100644 --- a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/TextBlockTest.php +++ b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/TextBlockTest.php @@ -45,7 +45,7 @@ protected function setUp(): void * @group fieldType * @group textBlock */ - public function testToStorageValue() + public function testToStorageValue(): void { $value = new FieldValue(); $value->data = $this->longText; @@ -62,7 +62,7 @@ public function testToStorageValue() * @group fieldType * @group textBlock */ - public function testToFieldValue() + public function testToFieldValue(): void { $storageFieldValue = new StorageFieldValue(); $storageFieldValue->dataText = $this->longText; @@ -78,7 +78,7 @@ public function testToFieldValue() * @group fieldType * @group textBlock */ - public function testToStorageFieldDefinition() + public function testToStorageFieldDefinition(): void { $storageFieldDef = new StorageFieldDefinition(); $fieldTypeConstraints = new FieldTypeConstraints(); @@ -105,7 +105,7 @@ public function testToStorageFieldDefinition() * @group fieldType * @group textBlock */ - public function testToFieldDefinition() + public function testToFieldDefinition(): void { $fieldDef = new PersistenceFieldDefinition(); $storageDef = new StorageFieldDefinition( diff --git a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineTest.php b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineTest.php index 4c4c0c984c..8944a80b9e 100644 --- a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineTest.php +++ b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/TextLineTest.php @@ -34,7 +34,7 @@ protected function setUp(): void * @group fieldType * @group textLine */ - public function testToStorageValue() + public function testToStorageValue(): void { $value = new FieldValue(); $value->data = "He's holding a thermal detonator!"; @@ -51,7 +51,7 @@ public function testToStorageValue() * @group fieldType * @group textLine */ - public function testToFieldValue() + public function testToFieldValue(): void { $storageFieldValue = new StorageFieldValue(); $storageFieldValue->dataText = 'When 900 years old, you reach... Look as good, you will not.'; @@ -68,7 +68,7 @@ public function testToFieldValue() * @group fieldType * @group textLine */ - public function testToStorageFieldDefinitionWithValidator() + public function testToStorageFieldDefinitionWithValidator(): void { $defaultText = 'This is a default text'; $storageFieldDef = new StorageFieldDefinition(); @@ -105,7 +105,7 @@ public function testToStorageFieldDefinitionWithValidator() * @group fieldType * @group textLine */ - public function testToStorageFieldDefinitionNoValidator() + public function testToStorageFieldDefinitionNoValidator(): void { $defaultText = 'This is a default text'; $storageFieldDef = new StorageFieldDefinition(); @@ -134,7 +134,7 @@ public function testToStorageFieldDefinitionNoValidator() * @group fieldType * @group textLine */ - public function testToFieldDefinition() + public function testToFieldDefinition(): void { $defaultText = 'This is a default value'; $fieldDef = new PersistenceFieldDefinition(); diff --git a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/TimeTest.php b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/TimeTest.php index 17259a0f4d..87b256d679 100644 --- a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/TimeTest.php +++ b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/TimeTest.php @@ -39,7 +39,7 @@ protected function setUp(): void $this->time = 3661; } - public function testToStorageValue() + public function testToStorageValue(): void { $value = new FieldValue(); $value->data = $this->time; @@ -52,7 +52,7 @@ public function testToStorageValue() self::assertSame('', $storageFieldValue->sortKeyString); } - public function testToFieldValue() + public function testToFieldValue(): void { $storageFieldValue = new StorageFieldValue(); $storageFieldValue->dataInt = $this->time; @@ -66,7 +66,7 @@ public function testToFieldValue() self::assertSame($storageFieldValue->sortKeyInt, $fieldValue->sortKey); } - public function testToStorageFieldDefinitionDefaultEmpty() + public function testToStorageFieldDefinitionDefaultEmpty(): void { $storageFieldDef = new StorageFieldDefinition(); $fieldTypeConstraints = new FieldTypeConstraints(); @@ -87,7 +87,7 @@ public function testToStorageFieldDefinitionDefaultEmpty() self::assertSame(1, $storageFieldDef->dataInt2); } - public function testToStorageFieldDefinitionDefaultCurrentTime() + public function testToStorageFieldDefinitionDefaultCurrentTime(): void { $storageFieldDef = new StorageFieldDefinition(); $fieldTypeConstraints = new FieldTypeConstraints(); @@ -108,7 +108,7 @@ public function testToStorageFieldDefinitionDefaultCurrentTime() self::assertSame(0, $storageFieldDef->dataInt2); } - public function testToFieldDefinitionDefaultEmpty() + public function testToFieldDefinitionDefaultEmpty(): void { $fieldDef = new PersistenceFieldDefinition(); $storageDef = new StorageFieldDefinition( @@ -131,7 +131,7 @@ public function testToFieldDefinitionDefaultEmpty() ); } - public function testToFieldDefinitionDefaultCurrentTime() + public function testToFieldDefinitionDefaultCurrentTime(): void { $fieldDef = new PersistenceFieldDefinition(); $storageDef = new StorageFieldDefinition( diff --git a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/UrlTest.php b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/UrlTest.php index 0f3a167f4b..5117c38137 100644 --- a/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/UrlTest.php +++ b/tests/lib/Persistence/Legacy/Content/FieldValue/Converter/UrlTest.php @@ -32,7 +32,7 @@ protected function setUp(): void * @group fieldType * @group url */ - public function testToStorageValue() + public function testToStorageValue(): void { $value = new FieldValue(); $text = 'Ibexa'; @@ -49,7 +49,7 @@ public function testToStorageValue() * @group fieldType * @group url */ - public function testToFieldValue() + public function testToFieldValue(): void { $text = "A link's text"; $urlId = 842; @@ -71,7 +71,7 @@ public function testToFieldValue() * @group fieldType * @group url */ - public function testToStorageFieldDefinition() + public function testToStorageFieldDefinition(): void { $this->converter->toStorageFieldDefinition(new PersistenceFieldDefinition(), new StorageFieldDefinition()); } @@ -80,7 +80,7 @@ public function testToStorageFieldDefinition() * @group fieldType * @group url */ - public function testToFieldDefinition() + public function testToFieldDefinition(): void { $this->converter->toFieldDefinition(new StorageFieldDefinition(), new PersistenceFieldDefinition()); } diff --git a/tests/lib/Persistence/Legacy/Content/FieldValueConverterRegistryTest.php b/tests/lib/Persistence/Legacy/Content/FieldValueConverterRegistryTest.php index fa711c96a2..30781f3afb 100644 --- a/tests/lib/Persistence/Legacy/Content/FieldValueConverterRegistryTest.php +++ b/tests/lib/Persistence/Legacy/Content/FieldValueConverterRegistryTest.php @@ -10,6 +10,7 @@ use Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter; use Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry as Registry; use Ibexa\Tests\Core\Persistence\Legacy\TestCase; +use PHPUnit\Framework\MockObject\MockObject; /** * @covers \Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry @@ -18,7 +19,7 @@ class FieldValueConverterRegistryTest extends TestCase { private const TYPE_NAME = 'some-type'; - public function testRegister() + public function testRegister(): void { $converter = $this->getFieldValueConverterMock(); $registry = new Registry([self::TYPE_NAME => $converter]); @@ -26,7 +27,7 @@ public function testRegister() self::assertSame($converter, $registry->getConverter(self::TYPE_NAME)); } - public function testGetStorage() + public function testGetStorage(): void { $converter = $this->getFieldValueConverterMock(); $registry = new Registry([self::TYPE_NAME => $converter]); @@ -39,7 +40,7 @@ public function testGetStorage() ); } - public function testGetNotFound() + public function testGetNotFound(): void { $this->expectException(Converter\Exception\NotFound::class); @@ -51,7 +52,7 @@ public function testGetNotFound() /** * @return \Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter */ - protected function getFieldValueConverterMock() + protected function getFieldValueConverterMock(): MockObject { return $this->createMock(Converter::class); } diff --git a/tests/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php index 4ded4b9096..9da5955cf3 100644 --- a/tests/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabaseTest.php @@ -37,7 +37,7 @@ class DoctrineDatabaseTest extends LanguageAwareTestCase /** * @todo Fix not available fields */ - public function testInsertContentObject() + public function testInsertContentObject(): void { $struct = $this->getCreateStructFixture(); @@ -85,7 +85,7 @@ public function testInsertContentObject() * * @return \Ibexa\Contracts\Core\Persistence\Content\CreateStruct */ - protected function getCreateStructFixture() + protected function getCreateStructFixture(): CreateStruct { $struct = new CreateStruct(); @@ -112,7 +112,7 @@ protected function getCreateStructFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content */ - protected function getContentFixture() + protected function getContentFixture(): Content { $content = new Content(); @@ -142,7 +142,7 @@ protected function getContentFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content\VersionInfo */ - protected function getVersionFixture() + protected function getVersionFixture(): VersionInfo { $version = new VersionInfo(); @@ -163,7 +163,7 @@ protected function getVersionFixture() return $version; } - public function testInsertVersion() + public function testInsertVersion(): void { $version = $this->getVersionFixture(); @@ -204,7 +204,7 @@ public function testInsertVersion() ); } - public function testSetStatus() + public function testSetStatus(): void { $gateway = $this->getDatabaseGateway(); @@ -239,7 +239,7 @@ public function testSetStatus() ); } - public function testSetStatusPublished() + public function testSetStatusPublished(): void { $gateway = $this->getDatabaseGateway(); @@ -274,7 +274,7 @@ public function testSetStatusPublished() ); } - public function testSetStatusUnknownVersion() + public function testSetStatusUnknownVersion(): void { $gateway = $this->getDatabaseGateway(); @@ -283,7 +283,7 @@ public function testSetStatusUnknownVersion() ); } - public function testUpdateContent() + public function testUpdateContent(): void { $gateway = $this->getDatabaseGateway(); @@ -324,7 +324,7 @@ public function testUpdateContent() * * @return \Ibexa\Contracts\Core\Persistence\Content\UpdateStruct */ - protected function getUpdateStructFixture() + protected function getUpdateStructFixture(): UpdateStruct { $struct = new UpdateStruct(); $struct->creatorId = 23; @@ -340,7 +340,7 @@ protected function getUpdateStructFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content\MetadataUpdateStruct */ - protected function getMetadataUpdateStructFixture() + protected function getMetadataUpdateStructFixture(): MetadataUpdateStruct { $struct = new MetadataUpdateStruct(); $struct->ownerId = 42; @@ -353,7 +353,7 @@ protected function getMetadataUpdateStructFixture() return $struct; } - public function testUpdateVersion() + public function testUpdateVersion(): void { $gateway = $this->getDatabaseGateway(); @@ -390,7 +390,7 @@ public function testUpdateVersion() ); } - public function testInsertNewField() + public function testInsertNewField(): void { $content = $this->getContentFixture(); $content->versionInfo->contentInfo->id = 2342; @@ -437,7 +437,7 @@ public function testInsertNewField() ); } - public function testInsertNewAlwaysAvailableField() + public function testInsertNewAlwaysAvailableField(): void { $content = $this->getContentFixture(); $content->versionInfo->contentInfo->id = 2342; @@ -486,7 +486,7 @@ public function testInsertNewAlwaysAvailableField() ); } - public function testUpdateField() + public function testUpdateField(): void { $content = $this->getContentFixture(); $content->versionInfo->contentInfo->id = 2342; @@ -533,7 +533,7 @@ public function testUpdateField() ); } - public function testUpdateNonTranslatableField() + public function testUpdateNonTranslatableField(): void { $content = $this->getContentFixture(); $content->versionInfo->contentInfo->id = 2342; @@ -546,7 +546,7 @@ public function testUpdateNonTranslatableField() $fieldGb->id = $gateway->insertNewField($content, $fieldGb, $value); $fieldUs->id = $gateway->insertNewField($content, $fieldUs, $value); - $updateStruct = new Content\UpdateStruct(); + $updateStruct = new UpdateStruct(); $newValue = new StorageFieldValue( [ @@ -623,7 +623,7 @@ public function testListVersions(): void ); } - public function testListVersionNumbers() + public function testListVersionNumbers(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -635,7 +635,7 @@ public function testListVersionNumbers() self::assertEquals([1, 2], $res); } - public function testListVersionsForUser() + public function testListVersionsForUser(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -674,7 +674,7 @@ public function testListVersionsForUser() ); } - public function testLoadWithAllTranslations() + public function testLoadWithAllTranslations(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -696,7 +696,7 @@ public function testLoadWithAllTranslations() ); } - public function testCreateFixtureForMapperExtractContentFromRowsMultipleVersions() + public function testCreateFixtureForMapperExtractContentFromRowsMultipleVersions(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -719,7 +719,7 @@ public function testCreateFixtureForMapperExtractContentFromRowsMultipleVersions self::assertEquals($orig, $res, 'Fixtures differ between what was previously stored(expected) and what it now generates(actual), this hints either some mistake in impl or that the fixture (../_fixtures/extract_content_from_rows_multiple_versions.php) and tests needs to be adapted.'); } - public function testCreateFixtureForMapperExtractContentFromRows() + public function testCreateFixtureForMapperExtractContentFromRows(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -739,7 +739,7 @@ public function testCreateFixtureForMapperExtractContentFromRows() self::assertEquals($orig, $res, 'Fixtures differ between what was previously stored(expected) and what it now generates(actual), this hints either some mistake in impl or that the fixture (../_fixtures/extract_content_from_rows.php) and tests needs to be adapted.'); } - public function testLoadWithSingleTranslation() + public function testLoadWithSingleTranslation(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -764,7 +764,7 @@ public function testLoadWithSingleTranslation() ); } - public function testLoadNonExistentTranslation() + public function testLoadNonExistentTranslation(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -807,7 +807,7 @@ protected function assertValuesInRows($columnKey, array $expectedValues, array $ ); } - public function testGetAllLocationIds() + public function testGetAllLocationIds(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -821,7 +821,7 @@ public function testGetAllLocationIds() ); } - public function testGetFieldIdsByType() + public function testGetFieldIdsByType(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -839,7 +839,7 @@ public function testGetFieldIdsByType() ); } - public function testGetFieldIdsByTypeWithSecondArgument() + public function testGetFieldIdsByTypeWithSecondArgument(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -855,7 +855,7 @@ public function testGetFieldIdsByTypeWithSecondArgument() ); } - public function testDeleteRelationsTo() + public function testDeleteRelationsTo(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -885,7 +885,7 @@ public function testDeleteRelationsTo() ); } - public function testDeleteRelationsFrom() + public function testDeleteRelationsFrom(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -914,7 +914,7 @@ public function testDeleteRelationsFrom() ); } - public function testDeleteRelationsWithSecondArgument() + public function testDeleteRelationsWithSecondArgument(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -971,7 +971,7 @@ public function testDeleteField(): void ); } - public function testDeleteFields() + public function testDeleteFields(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -997,7 +997,7 @@ public function testDeleteFields() ); } - public function testDeleteFieldsWithSecondArgument() + public function testDeleteFieldsWithSecondArgument(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -1023,7 +1023,7 @@ public function testDeleteFieldsWithSecondArgument() ); } - public function testDeleteVersions() + public function testDeleteVersions(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -1049,7 +1049,7 @@ public function testDeleteVersions() ); } - public function testDeleteVersionsWithSecondArgument() + public function testDeleteVersionsWithSecondArgument(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -1078,7 +1078,7 @@ public function testDeleteVersionsWithSecondArgument() /** * @throws \Exception */ - public function testSetName() + public function testSetName(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -1112,7 +1112,7 @@ public function testSetName() ); } - public function testDeleteNames() + public function testDeleteNames(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -1138,7 +1138,7 @@ public function testDeleteNames() ); } - public function testDeleteNamesWithSecondArgument() + public function testDeleteNamesWithSecondArgument(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -1164,7 +1164,7 @@ public function testDeleteNamesWithSecondArgument() ); } - public function testDeleteContent() + public function testDeleteContent(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -1244,7 +1244,7 @@ public function testLoadRelations(): void ); } - public function testLoadRelationsByType() + public function testLoadRelationsByType(): void { $this->insertRelationFixture(); @@ -1267,7 +1267,7 @@ public function testLoadRelationsByType() ); } - public function testLoadRelationsByVersion() + public function testLoadRelationsByVersion(): void { $this->insertRelationFixture(); @@ -1284,7 +1284,7 @@ public function testLoadRelationsByVersion() ); } - public function testLoadRelationsNoResult() + public function testLoadRelationsNoResult(): void { $this->insertRelationFixture(); @@ -1295,7 +1295,7 @@ public function testLoadRelationsNoResult() self::assertCount(0, $relations, 'Expecting no relation to be loaded'); } - public function testLoadReverseRelations() + public function testLoadReverseRelations(): void { $this->insertRelationFixture(); @@ -1312,7 +1312,7 @@ public function testLoadReverseRelations() ); } - public function testLoadReverseRelationsWithType() + public function testLoadReverseRelationsWithType(): void { $this->insertRelationFixture(); @@ -1345,7 +1345,7 @@ protected function insertRelationFixture() ); } - public function testGetLastVersionNumber() + public function testGetLastVersionNumber(): void { $this->insertDatabaseFixture( __DIR__ . '/../_fixtures/contentobjects.php' @@ -1359,7 +1359,7 @@ public function testGetLastVersionNumber() ); } - public function testInsertRelation() + public function testInsertRelation(): void { $struct = $this->getRelationCreateStructFixture(); $gateway = $this->getDatabaseGateway(); @@ -1392,7 +1392,7 @@ public function testInsertRelation() ); } - public function testDeleteRelation() + public function testDeleteRelation(): void { $this->insertRelationFixture(); @@ -1874,7 +1874,7 @@ protected function storeFixture($file, $fixture) * * @return \Ibexa\Contracts\Core\Persistence\Content\Field */ - protected function getFieldFixture() + protected function getFieldFixture(): Field { $field = new Field(); @@ -1904,7 +1904,7 @@ protected function getOtherLanguageFieldFixture() * * @return \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue */ - protected function getStorageValueFixture() + protected function getStorageValueFixture(): StorageFieldValue { $value = new StorageFieldValue(); @@ -1943,7 +1943,7 @@ protected function getDatabaseGateway(): DoctrineDatabase * * @return \Ibexa\Contracts\Core\Persistence\Content\Relation\CreateStruct */ - protected function getRelationCreateStructFixture() + protected function getRelationCreateStructFixture(): RelationCreateStruct { $struct = new RelationCreateStruct(); diff --git a/tests/lib/Persistence/Legacy/Content/Gateway/RandomSortClauseHandlerFactoryTest.php b/tests/lib/Persistence/Legacy/Content/Gateway/RandomSortClauseHandlerFactoryTest.php index 7381cfecc8..610bc0ccb5 100644 --- a/tests/lib/Persistence/Legacy/Content/Gateway/RandomSortClauseHandlerFactoryTest.php +++ b/tests/lib/Persistence/Legacy/Content/Gateway/RandomSortClauseHandlerFactoryTest.php @@ -25,7 +25,7 @@ class RandomSortClauseHandlerFactoryTest extends TestCase * @throws \Doctrine\DBAL\DBALException * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException */ - public function testGetGateway(array $gateways) + public function testGetGateway(array $gateways): void { $platform = $this->createMock(AbstractPlatform::class); @@ -54,7 +54,7 @@ public function testGetGateway(array $gateways) * @throws \Doctrine\DBAL\DBALException * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException */ - public function testGetGatewayNotImplemented(array $gateways) + public function testGetGatewayNotImplemented(array $gateways): void { $platform = $this->createMock(AbstractPlatform::class); diff --git a/tests/lib/Persistence/Legacy/Content/Language/CachingLanguageHandlerTest.php b/tests/lib/Persistence/Legacy/Content/Language/CachingLanguageHandlerTest.php index 5a743d93b4..03dfa8cb77 100644 --- a/tests/lib/Persistence/Legacy/Content/Language/CachingLanguageHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Content/Language/CachingLanguageHandlerTest.php @@ -8,6 +8,7 @@ namespace Ibexa\Tests\Core\Persistence\Legacy\Content\Language; use Ibexa\Contracts\Core\Persistence\Content\Language; +use Ibexa\Contracts\Core\Persistence\Content\Language\CreateStruct; use Ibexa\Contracts\Core\Persistence\Content\Language\CreateStruct as SPILanguageCreateStruct; use Ibexa\Contracts\Core\Persistence\Content\Language\Handler as SPILanguageHandler; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException as APINotFoundException; @@ -16,6 +17,7 @@ use Ibexa\Core\Persistence\Cache\InMemory\InMemoryCache; use Ibexa\Core\Persistence\Legacy\Content\Language\CachingHandler; use Ibexa\Tests\Core\Persistence\Legacy\TestCase; +use PHPUnit\Framework\MockObject\MockObject; /** * @covers \Ibexa\Core\Persistence\Legacy\Content\Language\CachingHandler @@ -34,19 +36,19 @@ class CachingLanguageHandlerTest extends TestCase * * @var \Ibexa\Contracts\Core\Persistence\Content\Language\Handler */ - protected $innerHandlerMock; + protected ?MockObject $innerHandlerMock = null; /** * Language cache mock. * * @var \Ibexa\Core\Persistence\Cache\InMemory\InMemoryCache */ - protected $languageCacheMock; + protected ?MockObject $languageCacheMock = null; /** @var \Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierGeneratorInterface */ - protected $cacheIdentifierGeneratorMock; + protected ?MockObject $cacheIdentifierGeneratorMock = null; - public function testCreate() + public function testCreate(): void { $handler = $this->getLanguageHandler(); $innerHandlerMock = $this->getInnerLanguageHandlerMock(); @@ -81,9 +83,9 @@ public function testCreate() * * @return \Ibexa\Contracts\Core\Persistence\Content\Language\CreateStruct */ - protected function getCreateStructFixture() + protected function getCreateStructFixture(): CreateStruct { - return new Language\CreateStruct(); + return new CreateStruct(); } /** @@ -91,7 +93,7 @@ protected function getCreateStructFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content\Language */ - protected function getLanguageFixture() + protected function getLanguageFixture(): Language { $language = new Language(); $language->id = 8; @@ -100,7 +102,7 @@ protected function getLanguageFixture() return $language; } - public function testUpdate() + public function testUpdate(): void { $handler = $this->getLanguageHandler(); @@ -119,7 +121,7 @@ public function testUpdate() $handler->update($languageFixture); } - public function testLoad() + public function testLoad(): void { $handler = $this->getLanguageHandler(); $cacheMock = $this->getLanguageCacheMock(); @@ -143,7 +145,7 @@ public function testLoad() ); } - public function testLoadFailure() + public function testLoadFailure(): void { $handler = $this->getLanguageHandler(); $cacheMock = $this->getLanguageCacheMock(); @@ -173,7 +175,7 @@ public function testLoadFailure() $handler->load(2); } - public function testLoadByLanguageCode() + public function testLoadByLanguageCode(): void { $handler = $this->getLanguageHandler(); $cacheMock = $this->getLanguageCacheMock(); @@ -197,7 +199,7 @@ public function testLoadByLanguageCode() ); } - public function testLoadByLanguageCodeFailure() + public function testLoadByLanguageCodeFailure(): void { $handler = $this->getLanguageHandler(); $cacheMock = $this->getLanguageCacheMock(); @@ -227,7 +229,7 @@ public function testLoadByLanguageCodeFailure() $handler->loadByLanguageCode('eng-US'); } - public function testLoadAll() + public function testLoadAll(): void { $handler = $this->getLanguageHandler(); $cacheMock = $this->getLanguageCacheMock(); @@ -248,7 +250,7 @@ public function testLoadAll() self::assertIsArray($result); } - public function testDelete() + public function testDelete(): void { $handler = $this->getLanguageHandler(); $cacheMock = $this->getLanguageCacheMock(); @@ -340,7 +342,7 @@ protected function getCacheIdentifierGeneratorMock() * * @return \Ibexa\Contracts\Core\Persistence\Content\Language[] */ - protected function getLanguagesFixture() + protected function getLanguagesFixture(): array { $langUs = new Language(); $langUs->id = 2; diff --git a/tests/lib/Persistence/Legacy/Content/Language/Gateway/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/Content/Language/Gateway/DoctrineDatabaseTest.php index f0d60fc94a..472ed9541e 100644 --- a/tests/lib/Persistence/Legacy/Content/Language/Gateway/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/Content/Language/Gateway/DoctrineDatabaseTest.php @@ -35,7 +35,7 @@ protected function setUp(): void ); } - public function testInsertLanguage() + public function testInsertLanguage(): void { $gateway = $this->getDatabaseGateway(); @@ -62,7 +62,7 @@ public function testInsertLanguage() * * @return \Ibexa\Contracts\Core\Persistence\Content\Language */ - protected function getLanguageFixture() + protected function getLanguageFixture(): Language { $language = new Language(); @@ -73,7 +73,7 @@ protected function getLanguageFixture() return $language; } - public function testUpdateLanguage() + public function testUpdateLanguage(): void { $gateway = $this->getDatabaseGateway(); @@ -98,7 +98,7 @@ public function testUpdateLanguage() ); } - public function testLoadLanguageListData() + public function testLoadLanguageListData(): void { $gateway = $this->getDatabaseGateway(); @@ -117,7 +117,7 @@ public function testLoadLanguageListData() ); } - public function testLoadAllLanguagesData() + public function testLoadAllLanguagesData(): void { $gateway = $this->getDatabaseGateway(); @@ -142,7 +142,7 @@ public function testLoadAllLanguagesData() ); } - public function testDeleteLanguage() + public function testDeleteLanguage(): void { $gateway = $this->getDatabaseGateway(); diff --git a/tests/lib/Persistence/Legacy/Content/Language/LanguageHandlerTest.php b/tests/lib/Persistence/Legacy/Content/Language/LanguageHandlerTest.php index 7cbde56b28..9d2ce66613 100644 --- a/tests/lib/Persistence/Legacy/Content/Language/LanguageHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Content/Language/LanguageHandlerTest.php @@ -8,12 +8,14 @@ namespace Ibexa\Tests\Core\Persistence\Legacy\Content\Language; use Ibexa\Contracts\Core\Persistence\Content\Language; +use Ibexa\Contracts\Core\Persistence\Content\Language\CreateStruct; use Ibexa\Contracts\Core\Persistence\Content\Language\CreateStruct as SPILanguageCreateStruct; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Core\Persistence\Legacy\Content\Language\Gateway as LanguageGateway; use Ibexa\Core\Persistence\Legacy\Content\Language\Handler; use Ibexa\Core\Persistence\Legacy\Content\Language\Mapper as LanguageMapper; use Ibexa\Tests\Core\Persistence\Legacy\TestCase; +use PHPUnit\Framework\MockObject\MockObject; /** * @covers \Ibexa\Core\Persistence\Legacy\Content\Language\Handler @@ -32,16 +34,16 @@ class LanguageHandlerTest extends TestCase * * @var \Ibexa\Core\Persistence\Legacy\Content\Language\Gateway */ - protected $gatewayMock; + protected ?MockObject $gatewayMock = null; /** * Language mapper mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\Language\Mapper */ - protected $mapperMock; + protected ?MockObject $mapperMock = null; - public function testCreate() + public function testCreate(): void { $handler = $this->getLanguageHandler(); @@ -82,12 +84,12 @@ public function testCreate() * * @return \Ibexa\Contracts\Core\Persistence\Content\Language\CreateStruct */ - protected function getCreateStructFixture() + protected function getCreateStructFixture(): CreateStruct { - return new Language\CreateStruct(); + return new CreateStruct(); } - public function testUpdate() + public function testUpdate(): void { $handler = $this->getLanguageHandler(); @@ -104,12 +106,12 @@ public function testUpdate() * * @return \Ibexa\Contracts\Core\Persistence\Content\Language */ - protected function getLanguageFixture() + protected function getLanguageFixture(): Language { return new Language(); } - public function testLoad() + public function testLoad(): void { $handler = $this->getLanguageHandler(); $mapperMock = $this->getMapperMock(); @@ -133,7 +135,7 @@ public function testLoad() ); } - public function testLoadFailure() + public function testLoadFailure(): void { $this->expectException(NotFoundException::class); @@ -155,7 +157,7 @@ public function testLoadFailure() $result = $handler->load(2); } - public function testLoadByLanguageCode() + public function testLoadByLanguageCode(): void { $handler = $this->getLanguageHandler(); $mapperMock = $this->getMapperMock(); @@ -179,7 +181,7 @@ public function testLoadByLanguageCode() ); } - public function testLoadByLanguageCodeFailure() + public function testLoadByLanguageCodeFailure(): void { $this->expectException(NotFoundException::class); @@ -201,7 +203,7 @@ public function testLoadByLanguageCodeFailure() $result = $handler->loadByLanguageCode('eng-US'); } - public function testLoadAll() + public function testLoadAll(): void { $handler = $this->getLanguageHandler(); $mapperMock = $this->getMapperMock(); @@ -223,7 +225,7 @@ public function testLoadAll() ); } - public function testDeleteSuccess() + public function testDeleteSuccess(): void { $handler = $this->getLanguageHandler(); $gatewayMock = $this->getGatewayMock(); @@ -239,7 +241,7 @@ public function testDeleteSuccess() $result = $handler->delete(2); } - public function testDeleteFail() + public function testDeleteFail(): void { $this->expectException(\LogicException::class); diff --git a/tests/lib/Persistence/Legacy/Content/Language/MapperTest.php b/tests/lib/Persistence/Legacy/Content/Language/MapperTest.php index 55e19d5dfe..2be44bb489 100644 --- a/tests/lib/Persistence/Legacy/Content/Language/MapperTest.php +++ b/tests/lib/Persistence/Legacy/Content/Language/MapperTest.php @@ -17,7 +17,7 @@ */ class MapperTest extends TestCase { - public function testCreateLanguageFromCreateStruct() + public function testCreateLanguageFromCreateStruct(): void { $mapper = new Mapper(); @@ -32,7 +32,7 @@ public function testCreateLanguageFromCreateStruct() ); } - public function testExtractLanguagesFromRows() + public function testExtractLanguagesFromRows(): void { $mapper = new Mapper(); @@ -51,7 +51,7 @@ public function testExtractLanguagesFromRows() * * @return string[][] */ - protected function getRowsFixture() + protected function getRowsFixture(): array { return [ ['disabled' => '0', 'id' => '2', 'locale' => 'eng-US', 'name' => 'English (American)'], @@ -64,7 +64,7 @@ protected function getRowsFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content\Language[] */ - protected function getExtractReference() + protected function getExtractReference(): array { $langUs = new Language(); $langUs->id = 2; @@ -86,7 +86,7 @@ protected function getExtractReference() * * @return \Ibexa\Contracts\Core\Persistence\Content\Language\CreateStruct */ - protected function getCreateStructFixture() + protected function getCreateStructFixture(): CreateStruct { $struct = new CreateStruct(); @@ -102,7 +102,7 @@ protected function getCreateStructFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content\Language */ - protected function getLanguageFixture() + protected function getLanguageFixture(): Language { $struct = new Language(); diff --git a/tests/lib/Persistence/Legacy/Content/Language/MaskGeneratorTest.php b/tests/lib/Persistence/Legacy/Content/Language/MaskGeneratorTest.php index 14c39c2035..6dc31b6259 100644 --- a/tests/lib/Persistence/Legacy/Content/Language/MaskGeneratorTest.php +++ b/tests/lib/Persistence/Legacy/Content/Language/MaskGeneratorTest.php @@ -73,10 +73,10 @@ public static function getLanguageMaskData(): array * @dataProvider getLanguageIndicatorData */ public function testGenerateLanguageIndicator( - $languageCode, - $alwaysAvailable, - $expectedIndicator - ) { + string $languageCode, + bool $alwaysAvailable, + int $expectedIndicator + ): void { $generator = $this->getMaskGenerator(); self::assertSame( @@ -90,7 +90,7 @@ public function testGenerateLanguageIndicator( * * @return array */ - public static function getLanguageIndicatorData() + public static function getLanguageIndicatorData(): array { return [ 'not_available' => [ @@ -106,7 +106,7 @@ public static function getLanguageIndicatorData() ]; } - public function testIsLanguageAlwaysAvailable() + public function testIsLanguageAlwaysAvailable(): void { $generator = $this->getMaskGenerator(); @@ -121,7 +121,7 @@ public function testIsLanguageAlwaysAvailable() ); } - public function testIsLanguageAlwaysAvailableOtherLanguage() + public function testIsLanguageAlwaysAvailableOtherLanguage(): void { $generator = $this->getMaskGenerator(); @@ -136,7 +136,7 @@ public function testIsLanguageAlwaysAvailableOtherLanguage() ); } - public function testIsLanguageAlwaysAvailableNoDefault() + public function testIsLanguageAlwaysAvailableNoDefault(): void { $generator = $this->getMaskGenerator(); @@ -156,7 +156,7 @@ public function testIsLanguageAlwaysAvailableNoDefault() * * @dataProvider isAlwaysAvailableProvider */ - public function testIsAlwaysAvailable($langMask, $expectedResult) + public function testIsAlwaysAvailable(int $langMask, bool $expectedResult): void { $generator = $this->getMaskGenerator(); self::assertSame($expectedResult, $generator->isAlwaysAvailable($langMask)); @@ -167,7 +167,7 @@ public function testIsAlwaysAvailable($langMask, $expectedResult) * * @return array */ - public function isAlwaysAvailableProvider() + public function isAlwaysAvailableProvider(): array { return [ [2, false], @@ -181,7 +181,7 @@ public function isAlwaysAvailableProvider() /** * @dataProvider removeAlwaysAvailableFlagProvider */ - public function testRemoveAlwaysAvailableFlag($langMask, $expectedResult) + public function testRemoveAlwaysAvailableFlag(int $langMask, int $expectedResult): void { $generator = $this->getMaskGenerator(); self::assertSame($expectedResult, $generator->removeAlwaysAvailableFlag($langMask)); @@ -192,7 +192,7 @@ public function testRemoveAlwaysAvailableFlag($langMask, $expectedResult) * * @return array */ - public function removeAlwaysAvailableFlagProvider() + public function removeAlwaysAvailableFlagProvider(): array { return [ [3, 2], @@ -208,7 +208,7 @@ public function removeAlwaysAvailableFlagProvider() * * @dataProvider languageIdsFromMaskProvider */ - public function testExtractLanguageIdsFromMask($langMask, array $expectedResult) + public function testExtractLanguageIdsFromMask(int $langMask, array $expectedResult): void { $generator = $this->getMaskGenerator(); self::assertSame($expectedResult, $generator->extractLanguageIdsFromMask($langMask)); @@ -219,7 +219,7 @@ public function testExtractLanguageIdsFromMask($langMask, array $expectedResult) * * @return array */ - public function languageIdsFromMaskProvider() + public function languageIdsFromMaskProvider(): array { return [ [ @@ -242,7 +242,7 @@ public function languageIdsFromMaskProvider() * * @return \Ibexa\Core\Persistence\Legacy\Content\Language\MaskGenerator */ - protected function getMaskGenerator() + protected function getMaskGenerator(): MaskGenerator { return new MaskGenerator($this->getLanguageHandler()); } @@ -260,7 +260,7 @@ protected function getLanguageHandler() ->method(self::anything())// loadByLanguageCode && loadListByLanguageCodes ->will( self::returnCallback( - static function ($languageCodes) { + static function ($languageCodes): Language|array { if (is_string($languageCodes)) { $language = $languageCodes; $languageCodes = [$language]; diff --git a/tests/lib/Persistence/Legacy/Content/LanguageAwareTestCase.php b/tests/lib/Persistence/Legacy/Content/LanguageAwareTestCase.php index 95d26329b8..e8f60789d4 100644 --- a/tests/lib/Persistence/Legacy/Content/LanguageAwareTestCase.php +++ b/tests/lib/Persistence/Legacy/Content/LanguageAwareTestCase.php @@ -13,6 +13,7 @@ use Ibexa\Core\Search\Common\FieldRegistry; use Ibexa\Core\Search\Legacy\Content\Mapper\FullTextMapper; use Ibexa\Tests\Core\Persistence\Legacy\TestCase; +use PHPUnit\Framework\MockObject\MockObject; /** * Test case for Language aware classes. @@ -82,7 +83,7 @@ protected function getDefinitionBasedTransformationProcessor() } /** @var \Ibexa\Core\Search\Common\FieldNameGenerator|\PHPUnit\Framework\MockObject\MockObject */ - protected $fieldNameGeneratorMock; + protected ?MockObject $fieldNameGeneratorMock = null; /** * @return \Ibexa\Core\Search\Common\FieldNameGenerator|\PHPUnit\Framework\MockObject\MockObject diff --git a/tests/lib/Persistence/Legacy/Content/LanguageHandlerMock.php b/tests/lib/Persistence/Legacy/Content/LanguageHandlerMock.php index 642c5cf161..3e8364ea07 100644 --- a/tests/lib/Persistence/Legacy/Content/LanguageHandlerMock.php +++ b/tests/lib/Persistence/Legacy/Content/LanguageHandlerMock.php @@ -50,7 +50,7 @@ public function __construct() * * @return \Ibexa\Contracts\Core\Persistence\Content\Language */ - public function create(CreateStruct $struct) + public function create(CreateStruct $struct): never { throw new \RuntimeException('Not implemented yet.'); } @@ -60,7 +60,7 @@ public function create(CreateStruct $struct) * * @param \Ibexa\Contracts\Core\Persistence\Content\Language $struct */ - public function update(Language $struct) + public function update(Language $struct): never { throw new \RuntimeException('Not implemented yet.'); } @@ -122,7 +122,7 @@ public function loadAll() * * @param mixed $id */ - public function delete($id) + public function delete($id): never { throw new \RuntimeException('Not implemented yet.'); } diff --git a/tests/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabaseTest.php index df23d9998f..edbbd12c5e 100644 --- a/tests/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabaseTest.php @@ -23,7 +23,7 @@ */ class DoctrineDatabaseTest extends LanguageAwareTestCase { - protected function getLocationGateway() + protected function getLocationGateway(): DoctrineDatabase { return new DoctrineDatabase( $this->getDatabaseConnection(), @@ -64,7 +64,7 @@ private function assertLoadLocationProperties(array $locationData): void } } - public function testLoadLocationByRemoteId() + public function testLoadLocationByRemoteId(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -73,7 +73,7 @@ public function testLoadLocationByRemoteId() self::assertLoadLocationProperties($data); } - public function testLoadLocation() + public function testLoadLocation(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -82,7 +82,7 @@ public function testLoadLocation() self::assertLoadLocationProperties($data); } - public function testLoadLocationList() + public function testLoadLocationList(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -95,7 +95,7 @@ public function testLoadLocationList() self::assertLoadLocationProperties($locationRow); } - public function testLoadInvalidLocation() + public function testLoadInvalidLocation(): void { $this->expectException(NotFoundException::class); @@ -104,7 +104,7 @@ public function testLoadInvalidLocation() $gateway->getBasicNodeData(1337); } - public function testLoadLocationDataByContent() + public function testLoadLocationDataByContent(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); @@ -119,7 +119,7 @@ public function testLoadLocationDataByContent() self::assertLoadLocationProperties($locationRow); } - public function testLoadParentLocationDataForDraftContentAll() + public function testLoadParentLocationDataForDraftContentAll(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); @@ -134,7 +134,7 @@ public function testLoadParentLocationDataForDraftContentAll() self::assertLoadLocationProperties($locationRow); } - public function testLoadLocationDataByContentLimitSubtree() + public function testLoadLocationDataByContentLimitSubtree(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); @@ -145,7 +145,7 @@ public function testLoadLocationDataByContentLimitSubtree() self::assertCount(0, $locationsData); } - public function testMoveSubtreePathUpdate() + public function testMoveSubtreePathUpdate(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -190,7 +190,7 @@ public function testMoveSubtreePathUpdate() ); } - public function testMoveHiddenDestinationUpdate() + public function testMoveHiddenDestinationUpdate(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -236,7 +236,7 @@ public function testMoveHiddenDestinationUpdate() ); } - public function testMoveHiddenSourceUpdate() + public function testMoveHiddenSourceUpdate(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -282,7 +282,7 @@ public function testMoveHiddenSourceUpdate() ); } - public function testMoveHiddenSourceChildUpdate() + public function testMoveHiddenSourceChildUpdate(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -333,7 +333,7 @@ public function testMoveHiddenSourceChildUpdate() /** * @throws \Exception */ - public function testMoveSubtreeAssignmentUpdate() + public function testMoveSubtreeAssignmentUpdate(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -367,7 +367,7 @@ public function testMoveSubtreeAssignmentUpdate() ); } - public function testHideUpdateHidden() + public function testHideUpdateHidden(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -392,7 +392,7 @@ public function testHideUpdateHidden() /** * @depends testHideUpdateHidden */ - public function testHideUnhideUpdateHidden() + public function testHideUnhideUpdateHidden(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -418,7 +418,7 @@ public function testHideUnhideUpdateHidden() /** * @depends testHideUpdateHidden */ - public function testHideUnhideParentTree() + public function testHideUnhideParentTree(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -447,7 +447,7 @@ public function testHideUnhideParentTree() /** * @depends testHideUpdateHidden */ - public function testHideUnhidePartialSubtree() + public function testHideUnhidePartialSubtree(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -473,7 +473,7 @@ public function testHideUnhidePartialSubtree() ); } - public function testSwapLocations() + public function testSwapLocations(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -493,7 +493,7 @@ public function testSwapLocations() ); } - public function testCreateLocation() + public function testCreateLocation(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -529,7 +529,7 @@ public function testCreateLocation() /** * @depends testCreateLocation */ - public function testGetMainNodeId() + public function testGetMainNodeId(): void { $gateway = $this->getLocationGateway(); @@ -571,7 +571,7 @@ public function testGetMainNodeId() self::assertEquals($mainLocation->id, $res = $methodReflection->invoke($gateway, 68)); } - public static function getCreateLocationValues() + public static function getCreateLocationValues(): array { return [ ['contentobject_id', 68], @@ -595,7 +595,7 @@ public static function getCreateLocationValues() * * @dataProvider getCreateLocationValues */ - public function testCreateLocationValues($field, $value) + public function testCreateLocationValues(string $field, int|string $value): void { if ($value === null) { self::markTestIncomplete('Proper value setting yet unknown.'); @@ -632,7 +632,7 @@ public function testCreateLocationValues($field, $value) ); } - public static function getCreateLocationReturnValues() + public static function getCreateLocationReturnValues(): array { return [ ['id', 228], @@ -654,7 +654,7 @@ public static function getCreateLocationReturnValues() * * @dataProvider getCreateLocationReturnValues */ - public function testCreateLocationReturnValues($field, $value) + public function testCreateLocationReturnValues(string $field, int|bool|string $value): void { if ($value === null) { self::markTestIncomplete('Proper value setting yet unknown.'); @@ -685,7 +685,7 @@ public function testCreateLocationReturnValues($field, $value) self::assertEquals($value, $location->$field); } - public static function getUpdateLocationData() + public static function getUpdateLocationData(): array { return [ ['priority', 23], @@ -698,7 +698,7 @@ public static function getUpdateLocationData() /** * @dataProvider getUpdateLocationData */ - public function testUpdateLocation($field, $value) + public function testUpdateLocation(string $field, int|string $value): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -724,7 +724,7 @@ public function testUpdateLocation($field, $value) ); } - public static function getNodeAssignmentValues() + public static function getNodeAssignmentValues(): array { return [ ['contentobject_version', [1]], @@ -807,7 +807,7 @@ private function buildContentTreeSelectContentWithParentQuery( * @param string $field * @param array $expectedResult */ - public function testCreateLocationNodeAssignmentCreation(string $field, array $expectedResult) + public function testCreateLocationNodeAssignmentCreation(string $field, array $expectedResult): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -837,7 +837,7 @@ public function testCreateLocationNodeAssignmentCreation(string $field, array $e /** * @depends testCreateLocation */ - public function testCreateLocationNodeAssignmentCreationMainLocation() + public function testCreateLocationNodeAssignmentCreationMainLocation(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -863,7 +863,7 @@ public function testCreateLocationNodeAssignmentCreationMainLocation() ); } - public function testUpdateLocationsContentVersionNo() + public function testUpdateLocationsContentVersionNo(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -903,7 +903,7 @@ public function testUpdateLocationsContentVersionNo() ); } - public function testDeleteNodeAssignment() + public function testDeleteNodeAssignment(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -922,7 +922,7 @@ public function testDeleteNodeAssignment() ); } - public function testDeleteNodeAssignmentWithSecondArgument() + public function testDeleteNodeAssignmentWithSecondArgument(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); @@ -951,7 +951,7 @@ public function testDeleteNodeAssignmentWithSecondArgument() ); } - public static function getConvertNodeAssignmentsLocationValues() + public static function getConvertNodeAssignmentsLocationValues(): array { return [ ['contentobject_id', '68'], @@ -977,7 +977,7 @@ public static function getConvertNodeAssignmentsLocationValues() * * @dataProvider getConvertNodeAssignmentsLocationValues */ - public function testConvertNodeAssignments($field, $value) + public function testConvertNodeAssignments(string $field, string|int $value): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); @@ -1037,7 +1037,7 @@ public function testConvertNodeAssignments($field, $value) /** * @depends testCreateLocationNodeAssignmentCreation */ - public function testConvertNodeAssignmentsMainLocation() + public function testConvertNodeAssignmentsMainLocation(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); @@ -1073,7 +1073,7 @@ public function testConvertNodeAssignmentsMainLocation() /** * @depends testCreateLocationNodeAssignmentCreation */ - public function testConvertNodeAssignmentsParentHidden() + public function testConvertNodeAssignmentsParentHidden(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); @@ -1113,7 +1113,7 @@ public function testConvertNodeAssignmentsParentHidden() /** * @depends testCreateLocationNodeAssignmentCreation */ - public function testConvertNodeAssignmentsParentInvisible() + public function testConvertNodeAssignmentsParentInvisible(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); @@ -1153,7 +1153,7 @@ public function testConvertNodeAssignmentsParentInvisible() /** * @depends testCreateLocationNodeAssignmentCreation */ - public function testConvertNodeAssignmentsUpdateAssignment() + public function testConvertNodeAssignmentsUpdateAssignment(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); @@ -1185,7 +1185,7 @@ public function testConvertNodeAssignmentsUpdateAssignment() /** * Test for the setSectionForSubtree() method. */ - public function testSetSectionForSubtree() + public function testSetSectionForSubtree(): void { $this->insertDatabaseFixture(__DIR__ . '/../../_fixtures/contentobjects.php'); $gateway = $this->getLocationGateway(); @@ -1208,7 +1208,7 @@ public function testSetSectionForSubtree() * * @throws \Doctrine\DBAL\DBALException */ - public function testChangeMainLocation() + public function testChangeMainLocation(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); // Create additional location and assignment for test purpose @@ -1343,7 +1343,7 @@ public function testChangeMainLocation() /** * Test for the getChildren() method. */ - public function testGetChildren() + public function testGetChildren(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); @@ -1407,7 +1407,7 @@ public function testGetFallbackMainNodeData(): void /** * Test for the removeLocation() method. */ - public function testRemoveLocation() + public function testRemoveLocation(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); @@ -1422,7 +1422,7 @@ public function testRemoveLocation() } } - public function providerForTestUpdatePathIdentificationString() + public function providerForTestUpdatePathIdentificationString(): array { return [ [77, 2, 'new_solutions', 'new_solutions'], @@ -1437,11 +1437,11 @@ public function providerForTestUpdatePathIdentificationString() * @dataProvider providerForTestUpdatePathIdentificationString */ public function testUpdatePathIdentificationString( - $locationId, - $parentLocationId, - $text, - $expected - ) { + int $locationId, + int $parentLocationId, + string $text, + string $expected + ): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $gateway = $this->getLocationGateway(); diff --git a/tests/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabaseTrashTest.php b/tests/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabaseTrashTest.php index f8f6c4b221..b0ab11a0f4 100644 --- a/tests/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabaseTrashTest.php +++ b/tests/lib/Persistence/Legacy/Content/Location/Gateway/DoctrineDatabaseTrashTest.php @@ -19,7 +19,7 @@ */ class DoctrineDatabaseTrashTest extends LanguageAwareTestCase { - protected function getLocationGateway() + protected function getLocationGateway(): DoctrineDatabase { return new DoctrineDatabase( $this->getDatabaseConnection(), @@ -32,7 +32,7 @@ protected function getLocationGateway() /** * @todo test updated content status */ - public function testTrashLocation() + public function testTrashLocation(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $handler = $this->getLocationGateway(); @@ -53,7 +53,7 @@ public function testTrashLocation() ); } - public function testTrashLocationUpdateTrashTable() + public function testTrashLocationUpdateTrashTable(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $handler = $this->getLocationGateway(); @@ -70,7 +70,7 @@ public function testTrashLocationUpdateTrashTable() ); } - public static function getUntrashedLocationValues() + public static function getUntrashedLocationValues(): array { return [ ['contentobject_is_published', 1], @@ -93,7 +93,7 @@ public static function getUntrashedLocationValues() /** * @dataProvider getUntrashedLocationValues */ - public function testUntrashLocationDefault($property, $value) + public function testUntrashLocationDefault(string $property, int|string $value): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $handler = $this->getLocationGateway(); @@ -111,7 +111,7 @@ public function testUntrashLocationDefault($property, $value) ); } - public function testUntrashLocationNewParent() + public function testUntrashLocationNewParent(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $handler = $this->getLocationGateway(); @@ -129,7 +129,7 @@ public function testUntrashLocationNewParent() ); } - public function testUntrashInvalidLocation() + public function testUntrashInvalidLocation(): void { $this->expectException(NotFoundException::class); @@ -139,7 +139,7 @@ public function testUntrashInvalidLocation() $handler->untrashLocation(23); } - public function testUntrashLocationInvalidParent() + public function testUntrashLocationInvalidParent(): void { $this->expectException(NotFoundException::class); @@ -150,7 +150,7 @@ public function testUntrashLocationInvalidParent() $handler->untrashLocation(71, 1337); } - public function testUntrashLocationInvalidOldParent() + public function testUntrashLocationInvalidOldParent(): void { $this->expectException(NotFoundException::class); @@ -163,7 +163,7 @@ public function testUntrashLocationInvalidOldParent() $handler->untrashLocation(71); } - public static function getLoadTrashValues() + public static function getLoadTrashValues(): array { return [ ['node_id', 71], @@ -186,7 +186,7 @@ public static function getLoadTrashValues() /** * @dataProvider getLoadTrashValues */ - public function testLoadTrashByLocationId($field, $value) + public function testLoadTrashByLocationId(string $field, int|string $value): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $handler = $this->getLocationGateway(); @@ -201,7 +201,7 @@ public function testLoadTrashByLocationId($field, $value) ); } - public function testCountTrashed() + public function testCountTrashed(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $handler = $this->getLocationGateway(); @@ -219,7 +219,7 @@ public function testCountTrashed() ); } - public function testListEmptyTrash() + public function testListEmptyTrash(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $handler = $this->getLocationGateway(); @@ -243,7 +243,7 @@ protected function trashSubtree() $handler->trashLocation(76); } - public function testListFullTrash() + public function testListFullTrash(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $handler = $this->getLocationGateway(); @@ -255,7 +255,7 @@ public function testListFullTrash() ); } - public function testListTrashLimited() + public function testListTrashLimited(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $handler = $this->getLocationGateway(); @@ -267,7 +267,7 @@ public function testListTrashLimited() ); } - public static function getTrashValues() + public static function getTrashValues(): array { return [ ['contentobject_id', 67], @@ -291,7 +291,7 @@ public static function getTrashValues() /** * @dataProvider getTrashValues */ - public function testListTrashItem($key, $value) + public function testListTrashItem(string $key, int|string $value): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $handler = $this->getLocationGateway(); @@ -301,7 +301,7 @@ public function testListTrashItem($key, $value) self::assertEquals($value, $trashList[0][$key]); } - public function testListTrashSortedPathStringDesc() + public function testListTrashSortedPathStringDesc(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $handler = $this->getLocationGateway(); @@ -319,7 +319,7 @@ public function testListTrashSortedPathStringDesc() '/1/2/69/', ], array_map( - static function ($trashItem) { + static function (array $trashItem) { return $trashItem['path_string']; }, $trashList = $handler->listTrashed( @@ -333,7 +333,7 @@ static function ($trashItem) { ); } - public function testListTrashSortedDepth() + public function testListTrashSortedDepth(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $handler = $this->getLocationGateway(); @@ -351,7 +351,7 @@ public function testListTrashSortedDepth() '/1/2/69/70/71/', ], array_map( - static function ($trashItem) { + static function (array $trashItem) { return $trashItem['path_string']; }, $trashList = $handler->listTrashed( @@ -366,7 +366,7 @@ static function ($trashItem) { ); } - public function testCleanupTrash() + public function testCleanupTrash(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $handler = $this->getLocationGateway(); @@ -382,7 +382,7 @@ public function testCleanupTrash() ); } - public function testRemoveElementFromTrash() + public function testRemoveElementFromTrash(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $handler = $this->getLocationGateway(); @@ -399,7 +399,7 @@ public function testRemoveElementFromTrash() ); } - public function testCountLocationsByContentId() + public function testCountLocationsByContentId(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/full_example_tree.php'); $handler = $this->getLocationGateway(); diff --git a/tests/lib/Persistence/Legacy/Content/Location/MapperTest.php b/tests/lib/Persistence/Legacy/Content/Location/MapperTest.php index b4b66a462c..4f63d5e999 100644 --- a/tests/lib/Persistence/Legacy/Content/Location/MapperTest.php +++ b/tests/lib/Persistence/Legacy/Content/Location/MapperTest.php @@ -75,7 +75,7 @@ class MapperTest extends TestCase 'sortOrder' => 1, ]; - public function testCreateLocationFromRow() + public function testCreateLocationFromRow(): void { $mapper = new Mapper(); @@ -89,7 +89,7 @@ public function testCreateLocationFromRow() ); } - public function testCreateLocationsFromRows() + public function testCreateLocationsFromRows(): void { $inputRows = []; for ($i = 0; $i < 3; ++$i) { @@ -111,7 +111,7 @@ public function testCreateLocationsFromRows() } } - public function testCreateTrashedFromRow() + public function testCreateTrashedFromRow(): void { $mapper = new Mapper(); @@ -128,7 +128,7 @@ public function testCreateTrashedFromRow() ); } - public function testCreateLocationFromRowWithPrefix() + public function testCreateLocationFromRowWithPrefix(): void { $prefix = 'some_prefix_'; @@ -147,7 +147,7 @@ public function testCreateLocationFromRowWithPrefix() ); } - public function testGetLocationCreateStruct() + public function testGetLocationCreateStruct(): void { $mapper = new Mapper(); diff --git a/tests/lib/Persistence/Legacy/Content/Location/TrashHandlerTest.php b/tests/lib/Persistence/Legacy/Content/Location/TrashHandlerTest.php index 3a4beafc3f..44a7f427aa 100644 --- a/tests/lib/Persistence/Legacy/Content/Location/TrashHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Content/Location/TrashHandlerTest.php @@ -14,6 +14,7 @@ use Ibexa\Core\Persistence\Legacy\Content as CoreContent; use Ibexa\Core\Persistence\Legacy\Content\Location\Trash\Handler; use Ibexa\Tests\Core\Persistence\Legacy\TestCase; +use PHPUnit\Framework\MockObject\MockObject; /** * @covers \Ibexa\Core\Persistence\Legacy\Content\Location\Trash\Handler @@ -25,30 +26,30 @@ class TrashHandlerTest extends TestCase * * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Handler */ - protected $locationHandler; + protected ?MockObject $locationHandler = null; /** * Mocked location gateway instance. * * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Gateway */ - protected $locationGateway; + protected ?MockObject $locationGateway = null; /** * Mocked location mapper instance. * * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Mapper */ - protected $locationMapper; + protected ?MockObject $locationMapper = null; /** * Mocked content handler instance. * * @var \PHPUnit\Framework\MockObject\MockObject */ - protected $contentHandler; + protected ?MockObject $contentHandler = null; - protected function getTrashHandler() + protected function getTrashHandler(): Handler { return new Handler( $this->locationHandler = $this->createMock(CoreContent\Location\Handler::class), @@ -58,7 +59,7 @@ protected function getTrashHandler() ); } - public function testTrashSubtree() + public function testTrashSubtree(): void { $handler = $this->getTrashHandler(); @@ -124,7 +125,7 @@ public function testTrashSubtree() self::assertSame(20, $trashedObject->id); } - public function testTrashSubtreeReturnsNull() + public function testTrashSubtreeReturnsNull(): void { $handler = $this->getTrashHandler(); @@ -177,7 +178,7 @@ public function testTrashSubtreeReturnsNull() self::assertNull($returnValue); } - public function testTrashSubtreeUpdatesMainLocation() + public function testTrashSubtreeUpdatesMainLocation(): void { $handler = $this->getTrashHandler(); @@ -262,7 +263,7 @@ public function testTrashSubtreeUpdatesMainLocation() self::assertSame(20, $trashedObject->id); } - public function testRecover() + public function testRecover(): void { $handler = $this->getTrashHandler(); @@ -279,7 +280,7 @@ public function testRecover() self::assertSame(70, $handler->recover(69, 23)); } - public function testLoadTrashItem() + public function testLoadTrashItem(): void { $handler = $this->getTrashHandler(); @@ -446,7 +447,7 @@ public function testDeleteTrashItemNoMoreLocations(): void self::assertTrue($trashItemDeleteResult->contentRemoved); } - public function testDeleteTrashItemStillHaveLocations() + public function testDeleteTrashItemStillHaveLocations(): void { $handler = $this->getTrashHandler(); @@ -504,7 +505,7 @@ public function testDeleteTrashItemStillHaveLocations() self::assertFalse($trashItemDeleteResult->contentRemoved); } - public function testFindTrashItemsWhenEmpty() + public function testFindTrashItemsWhenEmpty(): void { $handler = $this->getTrashHandler(); @@ -531,7 +532,7 @@ public function testFindTrashItemsWhenEmpty() self::assertCount(0, $trashResult);// Can't assert as empty, however we can count it. } - public function testFindTrashItemsWithLimits() + public function testFindTrashItemsWithLimits(): void { $handler = $this->getTrashHandler(); diff --git a/tests/lib/Persistence/Legacy/Content/LocationHandlerTest.php b/tests/lib/Persistence/Legacy/Content/LocationHandlerTest.php index 36a4d82d89..6a1d48892b 100644 --- a/tests/lib/Persistence/Legacy/Content/LocationHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Content/LocationHandlerTest.php @@ -23,6 +23,7 @@ use Ibexa\Core\Persistence\Legacy\Content\ObjectState\Handler as ObjectStateHandler; use Ibexa\Core\Persistence\Legacy\Content\TreeHandler; use Ibexa\Tests\Core\Persistence\Legacy\TestCase; +use PHPUnit\Framework\MockObject\MockObject; /** * @covers \Ibexa\Core\Persistence\Legacy\Content\Location\Handler @@ -34,35 +35,35 @@ class LocationHandlerTest extends TestCase * * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Gateway */ - protected $locationGateway; + protected MockObject $locationGateway; /** * Mocked location mapper instance. * * @var \Ibexa\Core\Persistence\Legacy\Content\Location\Mapper */ - protected $locationMapper; + protected MockObject $locationMapper; /** * Mocked content handler instance. * * @var \Ibexa\Core\Persistence\Legacy\Content\Handler */ - protected $contentHandler; + protected MockObject $contentHandler; /** * Mocked object state handler instance. * * @var \Ibexa\Core\Persistence\Legacy\Content\ObjectState\Handler|\PHPUnit\Framework\MockObject\MockObject */ - protected $objectStateHandler; + protected ?MockObject $objectStateHandler = null; /** * Mocked Tree handler instance. * * @var \Ibexa\Core\Persistence\Legacy\Content\TreeHandler|\PHPUnit\Framework\MockObject\MockObject */ - protected $treeHandler; + protected MockObject $treeHandler; protected function setUp(): void { @@ -74,7 +75,7 @@ protected function setUp(): void $this->contentHandler = $this->createMock(ContentHandler::class); } - protected function getLocationHandler() + protected function getLocationHandler(): LocationHandler { return new Handler( $this->locationGateway, @@ -85,7 +86,7 @@ protected function getLocationHandler() ); } - public function testLoadLocation() + public function testLoadLocation(): void { $handler = $this->getLocationHandler(); @@ -100,7 +101,7 @@ public function testLoadLocation() self::assertInstanceOf(Location::class, $location); } - public function testLoadLocationSubtree() + public function testLoadLocationSubtree(): void { $this->locationGateway ->expects(self::once()) @@ -118,7 +119,7 @@ public function testLoadLocationSubtree() self::assertCount(2, $this->getLocationHandler()->loadSubtreeIds(77)); } - public function testLoadLocationByRemoteId() + public function testLoadLocationByRemoteId(): void { $handler = $this->getLocationHandler(); @@ -143,7 +144,7 @@ public function testLoadLocationByRemoteId() self::assertInstanceOf(Location::class, $location); } - public function testLoadLocationsByContent() + public function testLoadLocationsByContent(): void { $handler = $this->getLocationHandler(); @@ -168,7 +169,7 @@ public function testLoadLocationsByContent() self::assertIsArray($locations); } - public function loadParentLocationsForDraftContent() + public function loadParentLocationsForDraftContent(): void { $handler = $this->getLocationHandler(); @@ -193,7 +194,7 @@ public function loadParentLocationsForDraftContent() self::assertIsArray($locations); } - public function testMoveSubtree() + public function testMoveSubtree(): void { $handler = $this->getLocationHandler(); @@ -269,7 +270,7 @@ public function testMoveSubtree() $handler->move(69, 77); } - public function testHideUpdateHidden() + public function testHideUpdateHidden(): void { $handler = $this->getLocationHandler(); @@ -298,7 +299,7 @@ public function testHideUpdateHidden() /** * @depends testHideUpdateHidden */ - public function testHideUnhideUpdateHidden() + public function testHideUnhideUpdateHidden(): void { $handler = $this->getLocationHandler(); @@ -324,7 +325,7 @@ public function testHideUnhideUpdateHidden() $handler->unhide(69); } - public function testSwapLocations() + public function testSwapLocations(): void { $handler = $this->getLocationHandler(); @@ -336,7 +337,7 @@ public function testSwapLocations() $handler->swap(70, 78); } - public function testCreateLocation() + public function testCreateLocation(): void { $handler = $this->getLocationHandler(); @@ -374,7 +375,7 @@ public function testCreateLocation() $handler->create($createStruct); } - public function testUpdateLocation() + public function testUpdateLocation(): void { $handler = $this->getLocationHandler(); @@ -389,7 +390,7 @@ public function testUpdateLocation() $handler->update($updateStruct, 23); } - public function testSetSectionForSubtree() + public function testSetSectionForSubtree(): void { $handler = $this->getLocationHandler(); @@ -401,7 +402,7 @@ public function testSetSectionForSubtree() $handler->setSectionForSubtree(69, 3); } - public function testChangeMainLocation() + public function testChangeMainLocation(): void { $handler = $this->getLocationHandler(); @@ -416,7 +417,7 @@ public function testChangeMainLocation() /** * Test for the removeSubtree() method. */ - public function testRemoveSubtree() + public function testRemoveSubtree(): void { $handler = $this->getLocationHandler(); @@ -443,7 +444,7 @@ public function testDeleteChildrenDrafts(): void /** * Test for the copySubtree() method. */ - public function testCopySubtree() + public function testCopySubtree(): void { $handler = $this->getPartlyMockedHandler( [ @@ -675,7 +676,7 @@ public function testCountLocationsByContent(): void * * @return \Ibexa\Core\Persistence\Legacy\Content\Location\Handler */ - protected function getPartlyMockedHandler(array $methods) + protected function getPartlyMockedHandler(array $methods): MockObject { return $this->getMockBuilder(LocationHandler::class) ->setMethods($methods) diff --git a/tests/lib/Persistence/Legacy/Content/Mapper/ResolveVirtualFieldSubscriberTest.php b/tests/lib/Persistence/Legacy/Content/Mapper/ResolveVirtualFieldSubscriberTest.php index 90d22e8f3d..150bbca166 100644 --- a/tests/lib/Persistence/Legacy/Content/Mapper/ResolveVirtualFieldSubscriberTest.php +++ b/tests/lib/Persistence/Legacy/Content/Mapper/ResolveVirtualFieldSubscriberTest.php @@ -18,9 +18,11 @@ use Ibexa\Core\FieldType\NullStorage; use Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter; use Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry; +use Ibexa\Core\Persistence\Legacy\Content\Gateway; use Ibexa\Core\Persistence\Legacy\Content\Gateway as ContentGateway; use Ibexa\Core\Persistence\Legacy\Content\Mapper\ResolveVirtualFieldSubscriber; use Ibexa\Core\Persistence\Legacy\Content\StorageRegistry; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcher; @@ -53,7 +55,7 @@ public function testResolveVirtualField(): void ]) ); - $expected = new Content\Field([ + $expected = new Field([ 'id' => null, 'fieldDefinitionId' => 123, 'type' => 'some_type', @@ -114,7 +116,7 @@ static function (VersionInfo $versionInfo, Field $field): void { ]) ); - $expected = new Content\Field([ + $expected = new Field([ 'id' => null, 'fieldDefinitionId' => 678, 'type' => 'external_type_virtual', @@ -148,7 +150,7 @@ public function testPersistEmptyExternalStorageField(): void $storage->expects(self::once()) ->method('getFieldData') - ->willReturnCallback(static function (VersionInfo $versionInfo, Field $field) { + ->willReturnCallback(static function (VersionInfo $versionInfo, Field $field): void { $field->value->externalData = [ 'some_default' => 'external_data', ]; @@ -176,7 +178,7 @@ public function testPersistEmptyExternalStorageField(): void ]) ); - $expected = new Content\Field([ + $expected = new Field([ 'id' => 567, 'fieldDefinitionId' => 123, 'type' => 'external_type', @@ -212,7 +214,7 @@ public function testPersistExternalStorageField(): void $storage = $this->createMock(FieldStorage::class); $storage->expects(self::once()) ->method('storeFieldData') - ->willReturnCallback(static function (VersionInfo $versionInfo, Field $field) { + ->willReturnCallback(static function (VersionInfo $versionInfo, Field $field): void { $field->value->externalData = $field->value->data; }); @@ -242,7 +244,7 @@ public function testPersistExternalStorageField(): void ]) ); - $expected = new Content\Field([ + $expected = new Field([ 'id' => 456, 'fieldDefinitionId' => 123, 'type' => 'external_type', @@ -296,7 +298,7 @@ private function getVersionInfo(): VersionInfo private function getEventDispatcher( ConverterRegistry $converterRegistry, StorageRegistry $storageRegistry, - ContentGateway $contentGateway + Gateway&MockObject $contentGateway ): TraceableEventDispatcher { $eventDispatcher = new EventDispatcher(); $eventDispatcher->addSubscriber( diff --git a/tests/lib/Persistence/Legacy/Content/MapperTest.php b/tests/lib/Persistence/Legacy/Content/MapperTest.php index b1227ed65a..a0e80a34cd 100644 --- a/tests/lib/Persistence/Legacy/Content/MapperTest.php +++ b/tests/lib/Persistence/Legacy/Content/MapperTest.php @@ -26,6 +26,7 @@ use Ibexa\Core\Persistence\Legacy\Content\Mapper\ResolveVirtualFieldSubscriber; use Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue; use Ibexa\Core\Persistence\Legacy\Content\StorageRegistry; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; @@ -39,12 +40,12 @@ class MapperTest extends LanguageAwareTestCase * * @var \Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry */ - protected $valueConverterRegistryMock; + protected ?MockObject $valueConverterRegistryMock = null; /** * @return \Ibexa\Contracts\Core\Persistence\Content\CreateStruct */ - protected function getCreateStructFixture() + protected function getCreateStructFixture(): CreateStruct { $struct = new CreateStruct(); @@ -69,7 +70,7 @@ protected function getCreateStructFixture() return $struct; } - public function testCreateVersionInfoForContent() + public function testCreateVersionInfoForContent(): void { $content = $this->getFullContentFixture(); $time = time(); @@ -102,7 +103,7 @@ public function testCreateVersionInfoForContent() * * @return \Ibexa\Contracts\Core\Persistence\Content */ - protected function getFullContentFixture() + protected function getFullContentFixture(): Content { $content = new Content(); @@ -126,7 +127,7 @@ protected function getFullContentFixture() return $content; } - public function testConvertToStorageValue() + public function testConvertToStorageValue(): void { $convMock = $this->createMock(Converter::class); $convMock->expects(self::once()) @@ -160,7 +161,7 @@ public function testConvertToStorageValue() ); } - public function testExtractContentFromRows() + public function testExtractContentFromRows(): void { $rowsFixture = $this->getContentExtractFixture(); $nameRowsFixture = $this->getNamesExtractFixture(); @@ -290,7 +291,7 @@ static function (Content\Type\FieldDefinition $fieldDefinition): bool { ); } - public function testExtractContentFromRowsMultipleVersions() + public function testExtractContentFromRowsMultipleVersions(): void { $convMock = $this->createMock(Converter::class); $convMock->expects(self::any()) @@ -368,7 +369,7 @@ private function getFieldRegistry( return new Registry($converters); } - public function testCreateCreateStructFromContent() + public function testCreateCreateStructFromContent(): array { $time = time(); $mapper = $this->getMapper(); @@ -392,7 +393,7 @@ public function testCreateCreateStructFromContent() /** * @depends testCreateCreateStructFromContent */ - public function testCreateCreateStructFromContentBasicProperties($data) + public function testCreateCreateStructFromContentBasicProperties(array $data): void { $content = $data['original']; $struct = $data['result']; @@ -412,7 +413,7 @@ public function testCreateCreateStructFromContentBasicProperties($data) /** * @depends testCreateCreateStructFromContent */ - public function testCreateCreateStructFromContentParentLocationsEmpty($data) + public function testCreateCreateStructFromContentParentLocationsEmpty(array $data): void { self::assertEquals( [], @@ -423,7 +424,7 @@ public function testCreateCreateStructFromContentParentLocationsEmpty($data) /** * @depends testCreateCreateStructFromContent */ - public function testCreateCreateStructFromContentFieldCount($data) + public function testCreateCreateStructFromContentFieldCount(array $data): void { self::assertEquals( count($data['original']->fields), @@ -434,14 +435,14 @@ public function testCreateCreateStructFromContentFieldCount($data) /** * @depends testCreateCreateStructFromContent */ - public function testCreateCreateStructFromContentFieldsNoId($data) + public function testCreateCreateStructFromContentFieldsNoId(array $data): void { foreach ($data['result']->fields as $field) { self::assertNull($field->id); } } - public function testExtractRelationsFromRows() + public function testExtractRelationsFromRows(): void { $mapper = $this->getMapper(); @@ -455,7 +456,7 @@ public function testExtractRelationsFromRows() ); } - public function testCreateCreateStructFromContentWithPreserveOriginalLanguage() + public function testCreateCreateStructFromContentWithPreserveOriginalLanguage(): void { $time = time(); $mapper = $this->getMapper(); @@ -481,7 +482,7 @@ public function testCreateCreateStructFromContentWithPreserveOriginalLanguage() * @param array $fixtures * @param string $prefix */ - public function testExtractContentInfoFromRow(array $fixtures, $prefix) + public function testExtractContentInfoFromRow(array $fixtures, $prefix): void { $contentInfoReference = $this->getContentExtractReference()->versionInfo->contentInfo; $mapper = new Mapper( @@ -498,7 +499,7 @@ public function testExtractContentInfoFromRow(array $fixtures, $prefix) * * @return array */ - public function extractContentInfoFromRowProvider() + public function extractContentInfoFromRowProvider(): array { $fixtures = $this->getContentExtractFixture(); $fixturesNoPrefix = []; @@ -515,7 +516,7 @@ public function extractContentInfoFromRowProvider() ]; } - public function testCreateRelationFromCreateStruct() + public function testCreateRelationFromCreateStruct(): void { $struct = $this->getRelationCreateStructFixture(); @@ -533,7 +534,7 @@ public function testCreateRelationFromCreateStruct() * * @return array */ - public function extractVersionInfoFromRowProvider() + public function extractVersionInfoFromRowProvider(): array { $fixturesAll = $this->getContentExtractFixture(); $fixtures = $fixturesAll[0]; @@ -641,7 +642,7 @@ protected function getRelationExtractReference() * * @return \Ibexa\Core\Persistence\Legacy\Content\Mapper */ - protected function getMapper($valueConverter = null) + protected function getMapper($valueConverter = null): Mapper { return new Mapper( $this->getValueConverterRegistryMock(), @@ -731,7 +732,7 @@ protected function getLanguageHandler(): Language\Handler ->method('load') ->will( self::returnCallback( - static function ($id) use ($languages) { + static function ($id) use ($languages): ?\Ibexa\Contracts\Core\Persistence\Content\Language { foreach ($languages as $language) { if ($language->id == $id) { return $language; @@ -746,7 +747,7 @@ static function ($id) use ($languages) { ->method('loadByLanguageCode') ->will( self::returnCallback( - static function ($languageCode) use ($languages) { + static function ($languageCode) use ($languages): ?\Ibexa\Contracts\Core\Persistence\Content\Language { foreach ($languages as $language) { if ($language->languageCode == $languageCode) { return $language; diff --git a/tests/lib/Persistence/Legacy/Content/ObjectState/Gateway/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/Content/ObjectState/Gateway/DoctrineDatabaseTest.php index 743d885dd9..dd48f79f93 100644 --- a/tests/lib/Persistence/Legacy/Content/ObjectState/Gateway/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/Content/ObjectState/Gateway/DoctrineDatabaseTest.php @@ -47,7 +47,7 @@ protected function setUp(): void ); } - public function testLoadObjectStateData() + public function testLoadObjectStateData(): void { $gateway = $this->getDatabaseGateway(); @@ -71,7 +71,7 @@ public function testLoadObjectStateData() ); } - public function testLoadObjectStateDataByIdentifier() + public function testLoadObjectStateDataByIdentifier(): void { $gateway = $this->getDatabaseGateway(); @@ -95,7 +95,7 @@ public function testLoadObjectStateDataByIdentifier() ); } - public function testLoadObjectStateListData() + public function testLoadObjectStateListData(): void { $gateway = $this->getDatabaseGateway(); @@ -134,7 +134,7 @@ public function testLoadObjectStateListData() ); } - public function testLoadObjectStateGroupData() + public function testLoadObjectStateGroupData(): void { $gateway = $this->getDatabaseGateway(); @@ -157,7 +157,7 @@ public function testLoadObjectStateGroupData() ); } - public function testLoadObjectStateGroupDataByIdentifier() + public function testLoadObjectStateGroupDataByIdentifier(): void { $gateway = $this->getDatabaseGateway(); @@ -180,7 +180,7 @@ public function testLoadObjectStateGroupDataByIdentifier() ); } - public function testLoadObjectStateGroupListData() + public function testLoadObjectStateGroupListData(): void { $gateway = $this->getDatabaseGateway(); @@ -205,7 +205,7 @@ public function testLoadObjectStateGroupListData() ); } - public function testInsertObjectState() + public function testInsertObjectState(): void { $gateway = $this->getDatabaseGateway(); @@ -232,7 +232,7 @@ public function testInsertObjectState() ); } - public function testInsertObjectStateInEmptyGroup() + public function testInsertObjectStateInEmptyGroup(): void { $gateway = $this->getDatabaseGateway(); @@ -267,7 +267,7 @@ public function testInsertObjectStateInEmptyGroup() ); } - public function testUpdateObjectState() + public function testUpdateObjectState(): void { $gateway = $this->getDatabaseGateway(); @@ -294,7 +294,7 @@ public function testUpdateObjectState() ); } - public function testDeleteObjectState() + public function testDeleteObjectState(): void { $gateway = $this->getDatabaseGateway(); @@ -306,7 +306,7 @@ public function testDeleteObjectState() ); } - public function testUpdateObjectStateLinks() + public function testUpdateObjectStateLinks(): void { $gateway = $this->getDatabaseGateway(); @@ -316,7 +316,7 @@ public function testUpdateObjectStateLinks() self::assertSame(185, $gateway->getContentCount(2)); } - public function testDeleteObjectStateLinks() + public function testDeleteObjectStateLinks(): void { $gateway = $this->getDatabaseGateway(); @@ -325,7 +325,7 @@ public function testDeleteObjectStateLinks() self::assertSame(0, $gateway->getContentCount(1)); } - public function testInsertObjectStateGroup() + public function testInsertObjectStateGroup(): void { $gateway = $this->getDatabaseGateway(); @@ -350,7 +350,7 @@ public function testInsertObjectStateGroup() ); } - public function testUpdateObjectStateGroup() + public function testUpdateObjectStateGroup(): void { $gateway = $this->getDatabaseGateway(); @@ -376,7 +376,7 @@ public function testUpdateObjectStateGroup() ); } - public function testDeleteObjectStateGroup() + public function testDeleteObjectStateGroup(): void { $gateway = $this->getDatabaseGateway(); @@ -388,7 +388,7 @@ public function testDeleteObjectStateGroup() ); } - public function testSetContentState() + public function testSetContentState(): void { $gateway = $this->getDatabaseGateway(); @@ -408,7 +408,7 @@ public function testSetContentState() ); } - public function testLoadObjectStateDataForContent() + public function testLoadObjectStateDataForContent(): void { $gateway = $this->getDatabaseGateway(); @@ -432,7 +432,7 @@ public function testLoadObjectStateDataForContent() ); } - public function testGetContentCount() + public function testGetContentCount(): void { $gateway = $this->getDatabaseGateway(); @@ -442,7 +442,7 @@ public function testGetContentCount() self::assertEquals(185, $result); } - public function testUpdateObjectStatePriority() + public function testUpdateObjectStatePriority(): void { $gateway = $this->getDatabaseGateway(); @@ -473,7 +473,7 @@ public function testUpdateObjectStatePriority() * * @return \Ibexa\Contracts\Core\Persistence\Content\ObjectState */ - protected function getObjectStateFixture() + protected function getObjectStateFixture(): ObjectState { $objectState = new ObjectState(); $objectState->identifier = 'test_state'; @@ -490,7 +490,7 @@ protected function getObjectStateFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content\ObjectState\Group */ - protected function getObjectStateGroupFixture() + protected function getObjectStateGroupFixture(): Group { $group = new Group(); $group->identifier = 'test_group'; diff --git a/tests/lib/Persistence/Legacy/Content/ObjectState/MapperTest.php b/tests/lib/Persistence/Legacy/Content/ObjectState/MapperTest.php index 8c72159c9a..e2a18d08b5 100644 --- a/tests/lib/Persistence/Legacy/Content/ObjectState/MapperTest.php +++ b/tests/lib/Persistence/Legacy/Content/ObjectState/MapperTest.php @@ -18,7 +18,7 @@ */ class MapperTest extends LanguageAwareTestCase { - public function testCreateObjectStateFromData() + public function testCreateObjectStateFromData(): void { $mapper = $this->getMapper(); @@ -33,7 +33,7 @@ public function testCreateObjectStateFromData() ); } - public function testCreateObjectStateListFromData() + public function testCreateObjectStateListFromData(): void { $mapper = $this->getMapper(); @@ -48,7 +48,7 @@ public function testCreateObjectStateListFromData() ); } - public function testCreateObjectStateGroupFromData() + public function testCreateObjectStateGroupFromData(): void { $mapper = $this->getMapper(); @@ -63,7 +63,7 @@ public function testCreateObjectStateGroupFromData() ); } - public function testCreateObjectStateGroupListFromData() + public function testCreateObjectStateGroupListFromData(): void { $mapper = $this->getMapper(); @@ -78,7 +78,7 @@ public function testCreateObjectStateGroupListFromData() ); } - public function testCreateObjectStateFromInputStruct() + public function testCreateObjectStateFromInputStruct(): void { $mapper = $this->getMapper(); @@ -93,7 +93,7 @@ public function testCreateObjectStateFromInputStruct() ); } - public function testCreateObjectStateGroupFromInputStruct() + public function testCreateObjectStateGroupFromInputStruct(): void { $mapper = $this->getMapper(); @@ -113,7 +113,7 @@ public function testCreateObjectStateGroupFromInputStruct() * * @return \Ibexa\Core\Persistence\Legacy\Content\ObjectState\Mapper */ - protected function getMapper() + protected function getMapper(): Mapper { return new Mapper( $this->getLanguageHandler() @@ -125,7 +125,7 @@ protected function getMapper() * * @return array[][] */ - protected function getObjectStateRowsFixture() + protected function getObjectStateRowsFixture(): array { return [ [ @@ -147,7 +147,7 @@ protected function getObjectStateRowsFixture() * * @return array[][] */ - protected function getObjectStateGroupRowsFixture() + protected function getObjectStateGroupRowsFixture(): array { return [ [ @@ -168,7 +168,7 @@ protected function getObjectStateGroupRowsFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content\ObjectState */ - protected function getObjectStateFixture() + protected function getObjectStateFixture(): ObjectState { $objectState = new ObjectState(); $objectState->identifier = 'not_locked'; @@ -185,7 +185,7 @@ protected function getObjectStateFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content\ObjectState\Group */ - protected function getObjectStateGroupFixture() + protected function getObjectStateGroupFixture(): Group { $group = new Group(); $group->identifier = 'ez_lock'; @@ -202,7 +202,7 @@ protected function getObjectStateGroupFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content\ObjectState\InputStruct */ - protected function getObjectStateInputStructFixture() + protected function getObjectStateInputStructFixture(): InputStruct { $inputStruct = new InputStruct(); @@ -219,7 +219,7 @@ protected function getObjectStateInputStructFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content\ObjectState\InputStruct */ - protected function getObjectStateGroupInputStructFixture() + protected function getObjectStateGroupInputStructFixture(): InputStruct { $inputStruct = new InputStruct(); diff --git a/tests/lib/Persistence/Legacy/Content/ObjectState/ObjectStateHandlerTest.php b/tests/lib/Persistence/Legacy/Content/ObjectState/ObjectStateHandlerTest.php index 2eccd484af..e389922586 100644 --- a/tests/lib/Persistence/Legacy/Content/ObjectState/ObjectStateHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Content/ObjectState/ObjectStateHandlerTest.php @@ -16,6 +16,7 @@ use Ibexa\Core\Persistence\Legacy\Content\ObjectState\Mapper; use Ibexa\Tests\Core\Persistence\Legacy\Content\LanguageAwareTestCase; use Ibexa\Tests\Integration\Core\Repository\BaseTest as APIBaseTest; +use PHPUnit\Framework\MockObject\MockObject; /** * @covers \Ibexa\Core\Persistence\Legacy\Content\ObjectState\Handler @@ -34,16 +35,16 @@ class ObjectStateHandlerTest extends LanguageAwareTestCase * * @var \Ibexa\Core\Persistence\Legacy\Content\ObjectState\Gateway */ - protected $gatewayMock; + protected ?MockObject $gatewayMock = null; /** * Object state mapper mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\ObjectState\Mapper */ - protected $mapperMock; + protected ?MockObject $mapperMock = null; - public function testCreateGroup() + public function testCreateGroup(): void { $handler = $this->getObjectStateHandler(); $mapperMock = $this->getMapperMock(); @@ -67,7 +68,7 @@ public function testCreateGroup() ); } - public function testLoadGroup() + public function testLoadGroup(): void { $handler = $this->getObjectStateHandler(); $mapperMock = $this->getMapperMock(); @@ -91,7 +92,7 @@ public function testLoadGroup() ); } - public function testLoadGroupThrowsNotFoundException() + public function testLoadGroupThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -106,7 +107,7 @@ public function testLoadGroupThrowsNotFoundException() $handler->loadGroup(APIBaseTest::DB_INT_MAX); } - public function testLoadGroupByIdentifier() + public function testLoadGroupByIdentifier(): void { $handler = $this->getObjectStateHandler(); $mapperMock = $this->getMapperMock(); @@ -130,7 +131,7 @@ public function testLoadGroupByIdentifier() ); } - public function testLoadGroupByIdentifierThrowsNotFoundException() + public function testLoadGroupByIdentifierThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -145,7 +146,7 @@ public function testLoadGroupByIdentifierThrowsNotFoundException() $handler->loadGroupByIdentifier('unknown'); } - public function testLoadAllGroups() + public function testLoadAllGroups(): void { $handler = $this->getObjectStateHandler(); $mapperMock = $this->getMapperMock(); @@ -171,7 +172,7 @@ public function testLoadAllGroups() } } - public function testLoadObjectStates() + public function testLoadObjectStates(): void { $handler = $this->getObjectStateHandler(); $mapperMock = $this->getMapperMock(); @@ -197,7 +198,7 @@ public function testLoadObjectStates() } } - public function testUpdateGroup() + public function testUpdateGroup(): void { $handler = $this->getObjectStateHandler(); $mapperMock = $this->getMapperMock(); @@ -230,7 +231,7 @@ public function testUpdateGroup() ); } - public function testDeleteGroup() + public function testDeleteGroup(): void { $handler = $this->getObjectStateHandler(); $mapperMock = $this->getMapperMock(); @@ -282,7 +283,7 @@ public function testDeleteGroup() $handler->deleteGroup(2); } - public function testCreate() + public function testCreate(): void { $handler = $this->getObjectStateHandler(); $mapperMock = $this->getMapperMock(); @@ -306,7 +307,7 @@ public function testCreate() ); } - public function testLoad() + public function testLoad(): void { $handler = $this->getObjectStateHandler(); $mapperMock = $this->getMapperMock(); @@ -330,7 +331,7 @@ public function testLoad() ); } - public function testLoadThrowsNotFoundException() + public function testLoadThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -345,7 +346,7 @@ public function testLoadThrowsNotFoundException() $handler->load(APIBaseTest::DB_INT_MAX); } - public function testLoadByIdentifier() + public function testLoadByIdentifier(): void { $handler = $this->getObjectStateHandler(); $mapperMock = $this->getMapperMock(); @@ -369,7 +370,7 @@ public function testLoadByIdentifier() ); } - public function testLoadByIdentifierThrowsNotFoundException() + public function testLoadByIdentifierThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -384,7 +385,7 @@ public function testLoadByIdentifierThrowsNotFoundException() $handler->loadByIdentifier('unknown', 2); } - public function testUpdate() + public function testUpdate(): void { $handler = $this->getObjectStateHandler(); $mapperMock = $this->getMapperMock(); @@ -417,7 +418,7 @@ public function testUpdate() ); } - public function testSetPriority() + public function testSetPriority(): void { $handler = $this->getObjectStateHandler(); $mapperMock = $this->getMapperMock(); @@ -469,7 +470,7 @@ public function testSetPriority() $handler->setPriority(2, 0); } - public function testDelete() + public function testDelete(): void { $handler = $this->getObjectStateHandler(); $mapperMock = $this->getMapperMock(); @@ -510,7 +511,7 @@ public function testDelete() $handler->delete(1); } - public function testDeleteThrowsNotFoundException() + public function testDeleteThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -525,7 +526,7 @@ public function testDeleteThrowsNotFoundException() $handler->delete(APIBaseTest::DB_INT_MAX); } - public function testSetContentState() + public function testSetContentState(): void { $handler = $this->getObjectStateHandler(); $gatewayMock = $this->getGatewayMock(); @@ -539,7 +540,7 @@ public function testSetContentState() self::assertTrue($result); } - public function testGetContentState() + public function testGetContentState(): void { $handler = $this->getObjectStateHandler(); $mapperMock = $this->getMapperMock(); @@ -563,7 +564,7 @@ public function testGetContentState() ); } - public function testGetContentCount() + public function testGetContentCount(): void { $handler = $this->getObjectStateHandler(); $gatewayMock = $this->getGatewayMock(); @@ -583,7 +584,7 @@ public function testGetContentCount() * * @return \Ibexa\Contracts\Core\Persistence\Content\ObjectState */ - protected function getObjectStateFixture() + protected function getObjectStateFixture(): ObjectState { return new ObjectState(); } @@ -593,7 +594,7 @@ protected function getObjectStateFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content\ObjectState\Group */ - protected function getObjectStateGroupFixture() + protected function getObjectStateGroupFixture(): Group { return new Group(); } @@ -603,7 +604,7 @@ protected function getObjectStateGroupFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content\ObjectState\InputStruct */ - protected function getInputStructFixture() + protected function getInputStructFixture(): InputStruct { return new InputStruct(); } diff --git a/tests/lib/Persistence/Legacy/Content/Section/Gateway/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/Content/Section/Gateway/DoctrineDatabaseTest.php index ec9cf92c25..11a651531b 100644 --- a/tests/lib/Persistence/Legacy/Content/Section/Gateway/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/Content/Section/Gateway/DoctrineDatabaseTest.php @@ -35,7 +35,7 @@ protected function setUp(): void ); } - public function testInsertSection() + public function testInsertSection(): void { $gateway = $this->getDatabaseGateway(); @@ -63,7 +63,7 @@ public function testInsertSection() ); } - public function testUpdateSection() + public function testUpdateSection(): void { $gateway = $this->getDatabaseGateway(); @@ -85,7 +85,7 @@ public function testUpdateSection() ); } - public function testLoadSectionData() + public function testLoadSectionData(): void { $gateway = $this->getDatabaseGateway(); @@ -103,7 +103,7 @@ public function testLoadSectionData() ); } - public function testLoadAllSectionData() + public function testLoadAllSectionData(): void { $gateway = $this->getDatabaseGateway(); @@ -152,7 +152,7 @@ public function testLoadAllSectionData() ); } - public function testLoadSectionDataByIdentifier() + public function testLoadSectionDataByIdentifier(): void { $gateway = $this->getDatabaseGateway(); @@ -170,7 +170,7 @@ public function testLoadSectionDataByIdentifier() ); } - public function testCountContentObjectsInSection() + public function testCountContentObjectsInSection(): void { $this->insertDatabaseFixture( __DIR__ . '/../../_fixtures/contentobjects.php' @@ -186,7 +186,7 @@ public function testCountContentObjectsInSection() ); } - public function testCountRoleAssignmentsUsingSection() + public function testCountRoleAssignmentsUsingSection(): void { $this->insertDatabaseFixture( __DIR__ . '/../../../User/_fixtures/roles.php' @@ -202,7 +202,7 @@ public function testCountRoleAssignmentsUsingSection() ); } - public function testDeleteSection() + public function testDeleteSection(): void { $gateway = $this->getDatabaseGateway(); @@ -235,7 +235,7 @@ public function testDeleteSection() /** * @depends testCountContentObjectsInSection */ - public function testAssignSectionToContent() + public function testAssignSectionToContent(): void { $this->insertDatabaseFixture( __DIR__ . '/../../_fixtures/contentobjects.php' diff --git a/tests/lib/Persistence/Legacy/Content/Section/SectionHandlerTest.php b/tests/lib/Persistence/Legacy/Content/Section/SectionHandlerTest.php index 21b5808771..35e9171dfe 100644 --- a/tests/lib/Persistence/Legacy/Content/Section/SectionHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Content/Section/SectionHandlerTest.php @@ -11,6 +11,7 @@ use Ibexa\Core\Persistence\Legacy\Content\Section\Gateway; use Ibexa\Core\Persistence\Legacy\Content\Section\Handler; use Ibexa\Tests\Core\Persistence\Legacy\TestCase; +use PHPUnit\Framework\MockObject\MockObject; /** * @covers \Ibexa\Core\Persistence\Legacy\Content\Section\Handler @@ -29,9 +30,9 @@ class SectionHandlerTest extends TestCase * * @var \Ibexa\Core\Persistence\Legacy\Content\Section\Gateway */ - protected $gatewayMock; + protected ?MockObject $gatewayMock = null; - public function testCreate() + public function testCreate(): void { $handler = $this->getSectionHandler(); @@ -57,7 +58,7 @@ public function testCreate() ); } - public function testUpdate() + public function testUpdate(): void { $handler = $this->getSectionHandler(); @@ -84,7 +85,7 @@ public function testUpdate() ); } - public function testLoad() + public function testLoad(): void { $handler = $this->getSectionHandler(); @@ -119,7 +120,7 @@ public function testLoad() ); } - public function testLoadAll() + public function testLoadAll(): void { $handler = $this->getSectionHandler(); @@ -162,7 +163,7 @@ public function testLoadAll() ); } - public function testLoadByIdentifier() + public function testLoadByIdentifier(): void { $handler = $this->getSectionHandler(); @@ -197,7 +198,7 @@ public function testLoadByIdentifier() ); } - public function testDelete() + public function testDelete(): void { $handler = $this->getSectionHandler(); @@ -217,7 +218,7 @@ public function testDelete() $result = $handler->delete(23); } - public function testDeleteFailure() + public function testDeleteFailure(): void { $this->expectException(\RuntimeException::class); @@ -236,7 +237,7 @@ public function testDeleteFailure() $result = $handler->delete(23); } - public function testAssign() + public function testAssign(): void { $handler = $this->getSectionHandler(); @@ -252,7 +253,7 @@ public function testAssign() $result = $handler->assign(23, 42); } - public function testPoliciesCount() + public function testPoliciesCount(): void { $handler = $this->getSectionHandler(); @@ -270,7 +271,7 @@ public function testPoliciesCount() $result = $handler->policiesCount(1); } - public function testCountRoleAssignmentsUsingSection() + public function testCountRoleAssignmentsUsingSection(): void { $handler = $this->getSectionHandler(); diff --git a/tests/lib/Persistence/Legacy/Content/StorageRegistryTest.php b/tests/lib/Persistence/Legacy/Content/StorageRegistryTest.php index 1b3b31a113..e3fd03aad4 100644 --- a/tests/lib/Persistence/Legacy/Content/StorageRegistryTest.php +++ b/tests/lib/Persistence/Legacy/Content/StorageRegistryTest.php @@ -11,6 +11,7 @@ use Ibexa\Core\FieldType\NullStorage; use Ibexa\Core\Persistence\Legacy\Content\StorageRegistry; use Ibexa\Tests\Core\Persistence\Legacy\TestCase; +use PHPUnit\Framework\MockObject\MockObject; /** * @covers \Ibexa\Core\Persistence\Legacy\Content\StorageRegistry @@ -27,7 +28,7 @@ public function testRegister(): void self::assertSame($storage, $registry->getStorage(self::TYPE_NAME)); } - public function testGetStorage() + public function testGetStorage(): void { $storage = $this->getStorageMock(); $registry = new StorageRegistry([self::TYPE_NAME => $storage]); @@ -40,7 +41,7 @@ public function testGetStorage() ); } - public function testGetNotFound() + public function testGetNotFound(): void { $registry = new StorageRegistry([]); self::assertInstanceOf( @@ -54,7 +55,7 @@ public function testGetNotFound() * * @return \Ibexa\Contracts\Core\FieldType\FieldStorage */ - protected function getStorageMock() + protected function getStorageMock(): MockObject { return $this->createMock(FieldStorage::class); } diff --git a/tests/lib/Persistence/Legacy/Content/TreeHandlerTest.php b/tests/lib/Persistence/Legacy/Content/TreeHandlerTest.php index f1d185bf1a..62281085c6 100644 --- a/tests/lib/Persistence/Legacy/Content/TreeHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Content/TreeHandlerTest.php @@ -17,13 +17,14 @@ use Ibexa\Core\Persistence\Legacy\Content\Mapper; use Ibexa\Core\Persistence\Legacy\Content\TreeHandler; use Ibexa\Tests\Core\Persistence\Legacy\TestCase; +use PHPUnit\Framework\MockObject\MockObject; /** * Test case for Tree Handler. */ class TreeHandlerTest extends TestCase { - public function testLoadContentInfoByRemoteId() + public function testLoadContentInfoByRemoteId(): void { $contentInfoData = [new ContentInfo()]; @@ -45,7 +46,7 @@ public function testLoadContentInfoByRemoteId() ); } - public function testListVersions() + public function testListVersions(): void { $this->getContentGatewayMock() ->expects(self::once()) @@ -73,7 +74,7 @@ public function testListVersions() ); } - public function testRemoveRawContent() + public function testRemoveRawContent(): void { $treeHandler = $this->getPartlyMockedTreeHandler( [ @@ -125,7 +126,7 @@ public function testRemoveRawContent() $treeHandler->removeRawContent(23); } - public function testRemoveSubtree() + public function testRemoveSubtree(): void { $treeHandler = $this->getPartlyMockedTreeHandler( [ @@ -259,7 +260,7 @@ public function testRemoveSubtree() $treeHandler->removeSubtree(42); } - public function testSetSectionForSubtree() + public function testSetSectionForSubtree(): void { $treeHandler = $this->getTreeHandler(); @@ -285,7 +286,7 @@ public function testSetSectionForSubtree() $treeHandler->setSectionForSubtree(69, 3); } - public function testChangeMainLocation() + public function testChangeMainLocation(): void { $treeHandler = $this->getPartlyMockedTreeHandler( [ @@ -332,7 +333,7 @@ public function testChangeMainLocation() $treeHandler->changeMainLocation(12, 34); } - public function testChangeMainLocationToLocationWithoutContentInfo() + public function testChangeMainLocationToLocationWithoutContentInfo(): void { $treeHandler = $this->getPartlyMockedTreeHandler( [ @@ -374,7 +375,7 @@ public function testChangeMainLocationToLocationWithoutContentInfo() $treeHandler->changeMainLocation(12, 34); } - public function testLoadLocation() + public function testLoadLocation(): void { $treeHandler = $this->getTreeHandler(); @@ -457,7 +458,7 @@ public function testDeleteChildrenDraftsRecursive(): void } /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\Persistence\Legacy\Content\Location\Gateway */ - protected $locationGatewayMock; + protected ?MockObject $locationGatewayMock = null; /** * Returns Location Gateway mock. @@ -474,7 +475,7 @@ protected function getLocationGatewayMock() } /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\Persistence\Legacy\Content\Location\Mapper */ - protected $locationMapperMock; + protected ?MockObject $locationMapperMock = null; /** * Returns a Location Mapper mock. @@ -491,7 +492,7 @@ protected function getLocationMapperMock() } /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\Persistence\Legacy\Content\Gateway */ - protected $contentGatewayMock; + protected ?MockObject $contentGatewayMock = null; /** * Returns Content Gateway mock. @@ -508,7 +509,7 @@ protected function getContentGatewayMock() } /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\Persistence\Legacy\Content\Mapper */ - protected $contentMapper; + protected ?MockObject $contentMapper = null; /** * Returns a Content Mapper mock. @@ -525,7 +526,7 @@ protected function getContentMapperMock() } /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\Persistence\Legacy\Content\FieldHandler */ - protected $fieldHandlerMock; + protected ?MockObject $fieldHandlerMock = null; /** * Returns a FieldHandler mock. @@ -546,7 +547,7 @@ protected function getFieldHandlerMock() * * @return \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\Persistence\Legacy\Content\TreeHandler */ - protected function getPartlyMockedTreeHandler(array $methods) + protected function getPartlyMockedTreeHandler(array $methods): MockObject { return $this->getMockBuilder(TreeHandler::class) ->setMethods($methods) @@ -565,7 +566,7 @@ protected function getPartlyMockedTreeHandler(array $methods) /** * @return \Ibexa\Core\Persistence\Legacy\Content\TreeHandler */ - protected function getTreeHandler() + protected function getTreeHandler(): TreeHandler { return new TreeHandler( $this->getLocationGatewayMock(), diff --git a/tests/lib/Persistence/Legacy/Content/Type/ContentTypeHandlerTest.php b/tests/lib/Persistence/Legacy/Content/Type/ContentTypeHandlerTest.php index 12032a9057..021ddcc056 100644 --- a/tests/lib/Persistence/Legacy/Content/Type/ContentTypeHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Content/Type/ContentTypeHandlerTest.php @@ -22,6 +22,7 @@ use Ibexa\Core\Persistence\Legacy\Content\Type\StorageDispatcherInterface; use Ibexa\Core\Persistence\Legacy\Content\Type\Update\Handler as UpdateHandler; use Ibexa\Core\Persistence\Legacy\Exception; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -34,26 +35,26 @@ class ContentTypeHandlerTest extends TestCase * * @var \Ibexa\Core\Persistence\Legacy\Content\Type\Gateway */ - protected $gatewayMock; + protected ?MockObject $gatewayMock = null; /** * Mapper mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\Type\Mapper */ - protected $mapperMock; + protected ?MockObject $mapperMock = null; /** * Update\Handler mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\Type\Update\Handler */ - protected $updateHandlerMock; + protected ?MockObject $updateHandlerMock = null; /** @var \Ibexa\Core\Persistence\Legacy\Content\Type\StorageDispatcherInterface&\PHPUnit\Framework\MockObject\MockObject */ - protected $storageDispatcherMock; + protected ?MockObject $storageDispatcherMock = null; - public function testCreateGroup() + public function testCreateGroup(): void { $createStruct = new GroupCreateStruct(); @@ -94,7 +95,7 @@ public function testCreateGroup() ); } - public function testUpdateGroup() + public function testUpdateGroup(): void { $updateStruct = new GroupUpdateStruct(); $updateStruct->id = 23; @@ -138,7 +139,7 @@ public function testUpdateGroup() ); } - public function testDeleteGroupSuccess() + public function testDeleteGroupSuccess(): void { $gatewayMock = $this->getGatewayMock(); $gatewayMock->expects(self::once()) @@ -153,7 +154,7 @@ public function testDeleteGroupSuccess() $handler->deleteGroup(23); } - public function testDeleteGroupFailure() + public function testDeleteGroupFailure(): void { $this->expectException(Exception\GroupNotEmpty::class); $this->expectExceptionMessage('Group with ID "23" is not empty.'); @@ -170,7 +171,7 @@ public function testDeleteGroupFailure() $handler->deleteGroup(23); } - public function testLoadGroup() + public function testLoadGroup(): void { $gatewayMock = $this->getGatewayMock(); $gatewayMock->expects(self::once()) @@ -193,7 +194,7 @@ public function testLoadGroup() ); } - public function testLoadGroupByIdentifier() + public function testLoadGroupByIdentifier(): void { $gatewayMock = $this->getGatewayMock(); $gatewayMock->expects(self::once()) @@ -216,7 +217,7 @@ public function testLoadGroupByIdentifier() ); } - public function testLoadAllGroups() + public function testLoadAllGroups(): void { $gatewayMock = $this->getGatewayMock(); $gatewayMock->expects(self::once()) @@ -238,7 +239,7 @@ public function testLoadAllGroups() ); } - public function testLoadContentTypes() + public function testLoadContentTypes(): void { $gatewayMock = $this->getGatewayMock(); $gatewayMock->expects(self::once()) @@ -309,7 +310,7 @@ public function testLoadContentTypesByFieldDefinitionIdentifier(): void ); } - public function testLoad() + public function testLoad(): void { $gatewayMock = $this->getGatewayMock(); $gatewayMock->expects(self::once()) @@ -340,7 +341,7 @@ public function testLoad() ); } - public function testLoadNotFound() + public function testLoadNotFound(): void { $this->expectException(Exception\TypeNotFound::class); @@ -367,7 +368,7 @@ public function testLoadNotFound() $type = $handler->load(23, 1); } - public function testLoadDefaultVersion() + public function testLoadDefaultVersion(): void { $gatewayMock = $this->getGatewayMock(); $gatewayMock->expects(self::once()) @@ -397,7 +398,7 @@ public function testLoadDefaultVersion() ); } - public function testLoadByIdentifier() + public function testLoadByIdentifier(): void { $gatewayMock = $this->getGatewayMock(); $gatewayMock->expects(self::once()) @@ -427,7 +428,7 @@ public function testLoadByIdentifier() ); } - public function testLoadByRemoteId() + public function testLoadByRemoteId(): void { $gatewayMock = $this->getGatewayMock(); $gatewayMock->expects(self::once()) @@ -457,7 +458,7 @@ public function testLoadByRemoteId() ); } - public function testCreate() + public function testCreate(): void { $createStructFix = $this->getContentTypeCreateStructFixture(); $createStructClone = clone $createStructFix; @@ -534,7 +535,7 @@ public function testCreate() ); } - public function testUpdate() + public function testUpdate(): void { $gatewayMock = $this->getGatewayMock(); $gatewayMock->expects(self::once()) @@ -573,7 +574,7 @@ public function testUpdate() ); } - public function testDeleteSuccess() + public function testDeleteSuccess(): void { $gatewayMock = $this->getGatewayMock(); @@ -607,7 +608,7 @@ public function testDeleteSuccess() self::assertTrue($res); } - public function testDeleteThrowsBadStateException() + public function testDeleteThrowsBadStateException(): void { $this->expectException(BadStateException::class); @@ -629,7 +630,7 @@ public function testDeleteThrowsBadStateException() $res = $handler->delete(23, 0); } - public function testCreateVersion() + public function testCreateVersion(): void { $userId = 42; $contentTypeId = 23; @@ -685,7 +686,7 @@ public function testCreateVersion() ); } - public function testCopy() + public function testCopy(): void { $gatewayMock = $this->getGatewayMock(); $mapperMock = $this->getMapperMock(['createCreateStructFromType']); @@ -756,7 +757,7 @@ public function testCopy() ); } - public function testLink() + public function testLink(): void { $gatewayMock = $this->getGatewayMock(); $gatewayMock->expects(self::once()) @@ -775,7 +776,7 @@ public function testLink() self::assertTrue($res); } - public function testUnlinkSuccess() + public function testUnlinkSuccess(): void { $gatewayMock = $this->getGatewayMock(); $gatewayMock->expects(self::once()) @@ -801,7 +802,7 @@ public function testUnlinkSuccess() self::assertTrue($res); } - public function testUnlinkFailure() + public function testUnlinkFailure(): void { $this->expectException(Exception\RemoveLastGroupFromType::class); $this->expectExceptionMessage('Type with ID "23" in status "1" cannot be unlinked from its last group.'); @@ -822,7 +823,7 @@ public function testUnlinkFailure() $res = $handler->unlink(3, 23, 1); } - public function testGetFieldDefinition() + public function testGetFieldDefinition(): void { $mapperMock = $this->getMapperMock( [ @@ -869,7 +870,7 @@ public function testGetFieldDefinition() ); } - public function testAddFieldDefinition() + public function testAddFieldDefinition(): void { $mapperMock = $this->getMapperMock( ['toStorageFieldDefinition'] @@ -918,7 +919,7 @@ public function testAddFieldDefinition() ); } - public function testGetContentCount() + public function testGetContentCount(): void { $gatewayMock = $this->getGatewayMock(); $gatewayMock->expects(self::once()) @@ -937,7 +938,7 @@ public function testGetContentCount() ); } - public function testRemoveFieldDefinition() + public function testRemoveFieldDefinition(): void { $storageDispatcherMock = $this->getStorageDispatcherMock(); $storageDispatcherMock @@ -958,7 +959,7 @@ public function testRemoveFieldDefinition() $handler->removeFieldDefinition(23, 1, new FieldDefinition(['id' => 42, 'fieldType' => 'ezstring'])); } - public function testUpdateFieldDefinition() + public function testUpdateFieldDefinition(): void { $fieldDef = new FieldDefinition(); @@ -991,7 +992,7 @@ public function testUpdateFieldDefinition() $handler->updateFieldDefinition(23, 1, $fieldDef); } - public function testPublish() + public function testPublish(): void { $handler = $this->getPartlyMockedHandler(['load']); $updateHandlerMock = $this->getUpdateHandlerMock(); @@ -1025,7 +1026,7 @@ public function testPublish() $handler->publish(23); } - public function testPublishNoOldType() + public function testPublishNoOldType(): void { $handler = $this->getPartlyMockedHandler(['load']); $updateHandlerMock = $this->getUpdateHandlerMock(); @@ -1067,7 +1068,7 @@ public function testPublishNoOldType() * * @return \Ibexa\Core\Persistence\Legacy\Content\Type\Handler */ - protected function getHandler() + protected function getHandler(): Handler { return new Handler( $this->getGatewayMock(), @@ -1084,7 +1085,7 @@ protected function getHandler() * * @return \Ibexa\Core\Persistence\Legacy\Content\Type\Handler */ - protected function getPartlyMockedHandler(array $methods) + protected function getPartlyMockedHandler(array $methods): MockObject { return $this->getMockBuilder(Handler::class) ->setMethods($methods) @@ -1122,7 +1123,7 @@ protected function getGatewayMock() * * @return \Ibexa\Core\Persistence\Legacy\Content\Type\Mapper */ - protected function getMapperMock($methods = []) + protected function getMapperMock(?array $methods = []) { if (!isset($this->mapperMock)) { $this->mapperMock = $this->getMockBuilder(Mapper::class) @@ -1168,7 +1169,7 @@ public function getStorageDispatcherMock(): StorageDispatcherInterface * * @return \Ibexa\Contracts\Core\Persistence\Content\Type\CreateStruct */ - protected function getContentTypeCreateStructFixture() + protected function getContentTypeCreateStructFixture(): CreateStruct { $struct = new CreateStruct(); $struct->status = 1; @@ -1190,7 +1191,7 @@ protected function getContentTypeCreateStructFixture() return $struct; } - public function testRemoveContentTypeTranslation() + public function testRemoveContentTypeTranslation(): void { $mapperMock = $this->getMapperMock(); $mapperMock->expects(self::once()) diff --git a/tests/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action/AddFieldTest.php b/tests/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action/AddFieldTest.php index 291d81c397..52c25f3b8c 100644 --- a/tests/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action/AddFieldTest.php +++ b/tests/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action/AddFieldTest.php @@ -9,12 +9,14 @@ use Ibexa\Contracts\Core\Persistence\Content; use Ibexa\Contracts\Core\Persistence\Content\Field; +use Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition; use Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter; use Ibexa\Core\Persistence\Legacy\Content\Gateway; use Ibexa\Core\Persistence\Legacy\Content\Mapper as ContentMapper; use Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue; use Ibexa\Core\Persistence\Legacy\Content\StorageHandler; use Ibexa\Core\Persistence\Legacy\Content\Type\ContentUpdater\Action\AddField; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use ReflectionObject; @@ -28,24 +30,24 @@ class AddFieldTest extends TestCase * * @var \Ibexa\Core\Persistence\Legacy\Content\Gateway */ - protected $contentGatewayMock; + protected ?MockObject $contentGatewayMock = null; /** * Content gateway mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\StorageHandler */ - protected $contentStorageHandlerMock; + protected ?MockObject $contentStorageHandlerMock = null; /** * FieldValue converter mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter */ - protected $fieldValueConverterMock; + protected ?MockObject $fieldValueConverterMock = null; /** @var \Ibexa\Core\Persistence\Legacy\Content\Mapper */ - protected $contentMapperMock; + protected ?MockObject $contentMapperMock = null; /** * AddField action to test. @@ -57,7 +59,7 @@ class AddFieldTest extends TestCase /** * @covers \Ibexa\Core\Persistence\Legacy\Content\Type\ContentUpdater::__construct */ - public function testConstructor() + public function testConstructor(): void { $action = new AddField( $this->getContentGatewayMock(), @@ -70,7 +72,7 @@ public function testConstructor() self::assertInstanceOf(AddField::class, $action); } - public function testApplySingleVersionSingleTranslation() + public function testApplySingleVersionSingleTranslation(): void { $contentId = 42; $versionNumbers = [1]; @@ -110,7 +112,7 @@ public function testApplySingleVersionSingleTranslation() $action->apply($contentId); } - public function testApplySingleVersionMultipleTranslations() + public function testApplySingleVersionMultipleTranslations(): void { $contentId = 42; $versionNumbers = [1]; @@ -156,7 +158,7 @@ public function testApplySingleVersionMultipleTranslations() $action->apply($contentId); } - public function testApplyMultipleVersionsSingleTranslation() + public function testApplyMultipleVersionsSingleTranslation(): void { $contentId = 42; $versionNumbers = [1, 2]; @@ -215,7 +217,7 @@ public function testApplyMultipleVersionsSingleTranslation() $action->apply($contentId); } - public function testApplyMultipleVersionsMultipleTranslations() + public function testApplyMultipleVersionsMultipleTranslations(): void { $contentId = 42; $versionNumbers = [1, 2]; @@ -286,7 +288,7 @@ public function testApplyMultipleVersionsMultipleTranslations() $action->apply($contentId); } - public function testInsertNewField() + public function testInsertNewField(): void { $versionInfo = new Content\VersionInfo(); $content = new Content(); @@ -335,7 +337,7 @@ public function testInsertNewField() self::assertEquals(23, $field->id); } - public function testInsertNewFieldUpdating() + public function testInsertNewFieldUpdating(): void { $versionInfo = new Content\VersionInfo(); $content = new Content(); @@ -390,7 +392,7 @@ public function testInsertNewFieldUpdating() self::assertEquals(23, $field->id); } - public function testInsertExistingField() + public function testInsertExistingField(): void { $versionInfo = new Content\VersionInfo(); $content = new Content(); @@ -438,7 +440,7 @@ public function testInsertExistingField() self::assertEquals(32, $field->id); } - public function testInsertExistingFieldUpdating() + public function testInsertExistingFieldUpdating(): void { $versionInfo = new Content\VersionInfo(); $content = new Content(); @@ -500,7 +502,7 @@ public function testInsertExistingFieldUpdating() * * @return \Ibexa\Contracts\Core\Persistence\Content */ - protected function getContentFixture($versionNo, array $languageCodes) + protected function getContentFixture($versionNo, array $languageCodes): Content { $contentInfo = new Content\ContentInfo(); $contentInfo->id = 'contentId'; @@ -582,9 +584,9 @@ protected function getContentMapperMock() * * @return \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition */ - protected function getFieldDefinitionFixture() + protected function getFieldDefinitionFixture(): FieldDefinition { - $fieldDef = new Content\Type\FieldDefinition(); + $fieldDef = new FieldDefinition(); $fieldDef->id = 42; $fieldDef->isTranslatable = true; $fieldDef->fieldType = 'ezstring'; @@ -602,7 +604,7 @@ protected function getFieldDefinitionFixture() * * @return \Ibexa\Contracts\Core\Persistence\Content\Field */ - public function getFieldReference($id, $versionNo, $languageCode) + public function getFieldReference($id, $versionNo, $languageCode): Field { $field = new Field(); @@ -621,7 +623,7 @@ public function getFieldReference($id, $versionNo, $languageCode) * * @return \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\Persistence\Legacy\Content\Type\ContentUpdater\Action\AddField */ - protected function getMockedAction($methods = []) + protected function getMockedAction($methods = []): MockObject { return $this ->getMockBuilder(AddField::class) diff --git a/tests/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action/RemoveFieldTest.php b/tests/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action/RemoveFieldTest.php index b15af30134..c6c8218cc4 100644 --- a/tests/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action/RemoveFieldTest.php +++ b/tests/lib/Persistence/Legacy/Content/Type/ContentUpdater/Action/RemoveFieldTest.php @@ -8,10 +8,12 @@ namespace Ibexa\Tests\Core\Persistence\Legacy\Content\Type\ContentUpdater\Action; use Ibexa\Contracts\Core\Persistence\Content; +use Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition; use Ibexa\Core\Persistence\Legacy\Content\Gateway; use Ibexa\Core\Persistence\Legacy\Content\Mapper as ContentMapper; use Ibexa\Core\Persistence\Legacy\Content\StorageHandler; use Ibexa\Core\Persistence\Legacy\Content\Type\ContentUpdater\Action\RemoveField; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -24,17 +26,17 @@ class RemoveFieldTest extends TestCase * * @var \Ibexa\Core\Persistence\Legacy\Content\Gateway */ - protected $contentGatewayMock; + protected ?MockObject $contentGatewayMock = null; /** * Content gateway mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\StorageHandler */ - protected $contentStorageHandlerMock; + protected ?MockObject $contentStorageHandlerMock = null; /** @var \Ibexa\Core\Persistence\Legacy\Content\Mapper */ - protected $contentMapperMock; + protected ?MockObject $contentMapperMock = null; /** * RemoveField action to test. @@ -43,7 +45,7 @@ class RemoveFieldTest extends TestCase */ protected $removeFieldAction; - public function testApplySingleVersionSingleTranslation() + public function testApplySingleVersionSingleTranslation(): void { $contentId = 42; $versionNumbers = [1]; @@ -91,7 +93,7 @@ public function testApplySingleVersionSingleTranslation() $action->apply($contentId); } - public function testApplyMultipleVersionsSingleTranslation() + public function testApplyMultipleVersionsSingleTranslation(): void { $contentId = 42; $versionNumbers = [1, 2]; @@ -162,7 +164,7 @@ public function testApplyMultipleVersionsSingleTranslation() $action->apply($contentId); } - public function testApplyMultipleVersionsMultipleTranslations() + public function testApplyMultipleVersionsMultipleTranslations(): void { $contentId = 42; $versionNumbers = [1, 2]; @@ -323,9 +325,9 @@ protected function getContentMapperMock() * * @return \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition */ - protected function getFieldDefinitionFixture() + protected function getFieldDefinitionFixture(): FieldDefinition { - $fieldDef = new Content\Type\FieldDefinition(); + $fieldDef = new FieldDefinition(); $fieldDef->id = 42; $fieldDef->fieldType = 'ezstring'; $fieldDef->defaultValue = new Content\FieldValue(); diff --git a/tests/lib/Persistence/Legacy/Content/Type/ContentUpdaterTest.php b/tests/lib/Persistence/Legacy/Content/Type/ContentUpdaterTest.php index 8fad3490ab..cfb471af18 100644 --- a/tests/lib/Persistence/Legacy/Content/Type/ContentUpdaterTest.php +++ b/tests/lib/Persistence/Legacy/Content/Type/ContentUpdaterTest.php @@ -15,6 +15,7 @@ use Ibexa\Core\Persistence\Legacy\Content\StorageHandler; use Ibexa\Core\Persistence\Legacy\Content\Type\ContentUpdater; use Ibexa\Core\Persistence\Legacy\Content\Type\ContentUpdater\Action; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -27,14 +28,14 @@ class ContentUpdaterTest extends TestCase * * @var \Ibexa\Core\Persistence\Legacy\Content\Gateway */ - protected $contentGatewayMock; + protected ?MockObject $contentGatewayMock = null; /** * FieldValue converter registry mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry */ - protected $converterRegistryMock; + protected ?MockObject $converterRegistryMock = null; /** * Search handler mock. @@ -48,7 +49,7 @@ class ContentUpdaterTest extends TestCase * * @var \Ibexa\Core\Persistence\Legacy\Content\StorageHandler */ - protected $contentStorageHandlerMock; + protected ?MockObject $contentStorageHandlerMock = null; /** * Content Updater to test. @@ -58,9 +59,9 @@ class ContentUpdaterTest extends TestCase protected $contentUpdater; /** @var \Ibexa\Core\Persistence\Legacy\Content\Mapper */ - protected $contentMapperMock; + protected ?MockObject $contentMapperMock = null; - public function testDetermineActions() + public function testDetermineActions(): void { $fromType = $this->getFromTypeFixture(); $toType = $this->getToTypeFixture(); @@ -81,13 +82,13 @@ public function testDetermineActions() self::assertEquals( [ - new ContentUpdater\Action\RemoveField( + new Action\RemoveField( $this->getContentGatewayMock(), $fromType->fieldDefinitions[0], $this->getContentStorageHandlerMock(), $this->getContentMapperMock() ), - new ContentUpdater\Action\AddField( + new Action\AddField( $this->getContentGatewayMock(), $toType->fieldDefinitions[2], $converterMock, @@ -99,7 +100,7 @@ public function testDetermineActions() ); } - public function testApplyUpdates() + public function testApplyUpdates(): void { $updater = $this->getContentUpdater(); @@ -146,7 +147,7 @@ public function testApplyUpdates() * * @return \Ibexa\Contracts\Core\Persistence\Content\Type */ - protected function getFromTypeFixture() + protected function getFromTypeFixture(): Type { $type = new Type(); diff --git a/tests/lib/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabaseTest.php index a505662e16..27564a6e5f 100644 --- a/tests/lib/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabaseTest.php @@ -12,6 +12,7 @@ // For SORT_ORDER_* constants use Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition; use Ibexa\Contracts\Core\Persistence\Content\Type\Group; +use Ibexa\Contracts\Core\Persistence\Content\Type\Group\UpdateStruct; use Ibexa\Contracts\Core\Persistence\Content\Type\Group\UpdateStruct as GroupUpdateStruct; use Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition; use Ibexa\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase; @@ -36,7 +37,7 @@ protected function setUp(): void $this->insertDatabaseFixture(__DIR__ . '/_fixtures/languages.php'); } - public function testInsertGroup() + public function testInsertGroup(): void { $gateway = $this->getGateway(); @@ -73,7 +74,7 @@ public function testInsertGroup() * * @return \Ibexa\Contracts\Core\Persistence\Content\Type\Group */ - protected function getGroupFixture() + protected function getGroupFixture(): Group { $group = new Group(); @@ -94,7 +95,7 @@ protected function getGroupFixture() return $group; } - public function testUpdateGroup() + public function testUpdateGroup(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_groups.php' @@ -171,7 +172,7 @@ public function testUpdateGroup() * * @return \Ibexa\Contracts\Core\Persistence\Content\Type\Group\UpdateStruct */ - protected function getGroupUpdateStructFixture() + protected function getGroupUpdateStructFixture(): UpdateStruct { $struct = new GroupUpdateStruct(); @@ -191,7 +192,7 @@ protected function getGroupUpdateStructFixture() return $struct; } - public function testCountTypesInGroup() + public function testCountTypesInGroup(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -209,7 +210,7 @@ public function testCountTypesInGroup() ); } - public function testCountGroupsForType() + public function testCountGroupsForType(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -227,7 +228,7 @@ public function testCountGroupsForType() ); } - public function testDeleteGroup() + public function testDeleteGroup(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_groups.php' @@ -249,7 +250,7 @@ public function testDeleteGroup() ); } - public function testLoadGroupData() + public function testLoadGroupData(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_groups.php' @@ -274,7 +275,7 @@ public function testLoadGroupData() ); } - public function testLoadGroupDataByIdentifier() + public function testLoadGroupDataByIdentifier(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_groups.php' @@ -299,7 +300,7 @@ public function testLoadGroupDataByIdentifier() ); } - public function testLoadAllGroupsData() + public function testLoadAllGroupsData(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_groups.php' @@ -327,7 +328,7 @@ public function testLoadAllGroupsData() ); } - public function testLoadTypesDataForGroup() + public function testLoadTypesDataForGroup(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -342,7 +343,7 @@ public function testLoadTypesDataForGroup() ); } - public function testLoadTypeData() + public function testLoadTypeData(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -370,7 +371,7 @@ public function testLoadTypeData() */ } - public function testLoadTypeDataByIdentifier() + public function testLoadTypeDataByIdentifier(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -389,7 +390,7 @@ public function testLoadTypeDataByIdentifier() ); } - public function testLoadTypeDataByRemoteId() + public function testLoadTypeDataByRemoteId(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -413,7 +414,7 @@ public function testLoadTypeDataByRemoteId() * * @return string[][] */ - public static function getTypeCreationExpectations() + public static function getTypeCreationExpectations(): array { return [ ['always_available', 0], @@ -439,7 +440,7 @@ public static function getTypeCreationExpectations() /** * @dataProvider getTypeCreationExpectations */ - public function testInsertType($column, $expectation) + public function testInsertType(string $column, int|string $expectation): void { $gateway = $this->getGateway(); $type = $this->getTypeFixture(); @@ -460,7 +461,7 @@ public function testInsertType($column, $expectation) * * @return string[][] */ - public static function getTypeCreationContentClassNameExpectations() + public static function getTypeCreationContentClassNameExpectations(): array { return [ ['contentclass_version', [0, 0]], @@ -473,7 +474,7 @@ public static function getTypeCreationContentClassNameExpectations() /** * @dataProvider getTypeCreationContentClassNameExpectations */ - public function testInsertTypeContentClassName($column, $expectation) + public function testInsertTypeContentClassName(string $column, array $expectation): void { $gateway = $this->getGateway(); $type = $this->getTypeFixture(); @@ -482,7 +483,7 @@ public function testInsertTypeContentClassName($column, $expectation) $this->assertQueryResult( array_map( - static function ($value) { + static function ($value): array { return [$value]; }, $expectation @@ -499,7 +500,7 @@ static function ($value) { * * @return \Ibexa\Contracts\Core\Persistence\Content\Type */ - protected function getTypeFixture() + protected function getTypeFixture(): Type { $type = new Type(); @@ -533,7 +534,7 @@ protected function getTypeFixture() return $type; } - public function testInsertFieldDefinition() + public function testInsertFieldDefinition(): void { $gateway = $this->getGateway(); @@ -611,7 +612,7 @@ public function testInsertFieldDefinition() * * @return \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition */ - protected function getFieldDefinitionFixture() + protected function getFieldDefinitionFixture(): FieldDefinition { $field = new FieldDefinition(); @@ -644,7 +645,7 @@ protected function getFieldDefinitionFixture() * * @return \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition */ - protected function getStorageFieldDefinitionFixture() + protected function getStorageFieldDefinitionFixture(): StorageFieldDefinition { $fieldDef = new StorageFieldDefinition(); @@ -671,7 +672,7 @@ protected function getStorageFieldDefinitionFixture() return $fieldDef; } - public function testDeleteFieldDefinition() + public function testDeleteFieldDefinition(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -689,7 +690,7 @@ public function testDeleteFieldDefinition() ); } - public function testUpdateFieldDefinition() + public function testUpdateFieldDefinition(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -761,7 +762,7 @@ public function testUpdateFieldDefinition() ); } - public function testInsertGroupAssignment() + public function testInsertGroupAssignment(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_groups.php' @@ -790,7 +791,7 @@ public function testInsertGroupAssignment() ); } - public function testDeleteGroupAssignment() + public function testDeleteGroupAssignment(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -813,7 +814,7 @@ public function testDeleteGroupAssignment() /** * @dataProvider getTypeUpdateExpectations */ - public function testUpdateType($fieldName, $expectedValue) + public function testUpdateType(string $fieldName, string $expectedValue): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -840,7 +841,7 @@ public function testUpdateType($fieldName, $expectedValue) ); } - public function testUpdateTypeName() + public function testUpdateTypeName(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -883,7 +884,7 @@ public function testUpdateTypeName() * * @return string[][] */ - public static function getTypeUpdateExpectations() + public static function getTypeUpdateExpectations(): array { return [ ['serialized_name_list', 'a:3:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:10:"New Folder";s:6:"eng-GB";s:18:"New Folder for you";}'], @@ -933,7 +934,7 @@ protected function getUpdateTypeFixture(): Type return $type; } - public function testCountInstancesOfTypeExist() + public function testCountInstancesOfTypeExist(): void { $this->insertDatabaseFixture( // Fixture for content objects @@ -949,7 +950,7 @@ public function testCountInstancesOfTypeExist() ); } - public function testCountInstancesOfTypeNotExist() + public function testCountInstancesOfTypeNotExist(): void { $this->insertDatabaseFixture( // Fixture for content objects @@ -965,7 +966,7 @@ public function testCountInstancesOfTypeNotExist() ); } - public function testDeleteFieldDefinitionsForTypeExisting() + public function testDeleteFieldDefinitionsForTypeExisting(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -1001,7 +1002,7 @@ public function testDeleteFieldDefinitionsForTypeExisting() ); } - public function testDeleteFieldDefinitionsForTypeNotExisting() + public function testDeleteFieldDefinitionsForTypeNotExisting(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -1021,7 +1022,7 @@ public function testDeleteFieldDefinitionsForTypeNotExisting() ); } - public function testDeleteGroupAssignmentsForTypeExisting() + public function testDeleteGroupAssignmentsForTypeExisting(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -1041,7 +1042,7 @@ public function testDeleteGroupAssignmentsForTypeExisting() ); } - public function testDeleteGroupAssignmentsForTypeNotExisting() + public function testDeleteGroupAssignmentsForTypeNotExisting(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -1061,7 +1062,7 @@ public function testDeleteGroupAssignmentsForTypeNotExisting() ); } - public function testDeleteTypeExisting() + public function testDeleteTypeExisting(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -1081,7 +1082,7 @@ public function testDeleteTypeExisting() ); } - public function testDeleteTypeNotExisting() + public function testDeleteTypeNotExisting(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/existing_types.php' @@ -1101,7 +1102,7 @@ public function testDeleteTypeNotExisting() ); } - public function testPublishTypeAndFields() + public function testPublishTypeAndFields(): void { $this->insertDatabaseFixture( __DIR__ . '/_fixtures/type_to_publish.php' diff --git a/tests/lib/Persistence/Legacy/Content/Type/MapperTest.php b/tests/lib/Persistence/Legacy/Content/Type/MapperTest.php index 6615a94aee..d9b44f519d 100644 --- a/tests/lib/Persistence/Legacy/Content/Type/MapperTest.php +++ b/tests/lib/Persistence/Legacy/Content/Type/MapperTest.php @@ -22,13 +22,14 @@ use Ibexa\Core\Persistence\Legacy\Content\Type\Mapper; use Ibexa\Core\Persistence\Legacy\Content\Type\StorageDispatcherInterface; use Ibexa\Tests\Core\Persistence\Legacy\TestCase; +use PHPUnit\Framework\MockObject\MockObject; /** * @covers \Ibexa\Core\Persistence\Legacy\Content\Type\Mapper */ class MapperTest extends TestCase { - public function testCreateGroupFromCreateStruct() + public function testCreateGroupFromCreateStruct(): void { $createStruct = $this->getGroupCreateStructFixture(); @@ -66,7 +67,7 @@ public function testCreateGroupFromCreateStruct() * * @return \Ibexa\Contracts\Core\Persistence\Content\Type\Group\CreateStruct */ - protected function getGroupCreateStructFixture() + protected function getGroupCreateStructFixture(): GroupCreateStruct { $struct = new GroupCreateStruct(); @@ -83,7 +84,7 @@ protected function getGroupCreateStructFixture() return $struct; } - public function testTypeFromCreateStruct() + public function testTypeFromCreateStruct(): void { $struct = $this->getContentTypeCreateStructFixture(); @@ -103,7 +104,7 @@ public function testTypeFromCreateStruct() } } - public function testTypeFromUpdateStruct() + public function testTypeFromUpdateStruct(): void { $struct = $this->getContentTypeUpdateStructFixture(); @@ -125,7 +126,7 @@ public function testTypeFromUpdateStruct() * * @return \Ibexa\Contracts\Core\Persistence\Content\Type\CreateStruct */ - protected function getContentTypeCreateStructFixture() + protected function getContentTypeCreateStructFixture(): CreateStruct { // Taken from example DB $struct = new CreateStruct(); @@ -192,7 +193,7 @@ protected function getContentTypeUpdateStructFixture(): UpdateStruct return $struct; } - public function testCreateStructFromType() + public function testCreateStructFromType(): void { $type = $this->getContentTypeFixture(); @@ -218,7 +219,7 @@ public function testCreateStructFromType() * * @return \Ibexa\Contracts\Core\Persistence\Content\Type */ - protected function getContentTypeFixture() + protected function getContentTypeFixture(): Type { // Taken from example DB $type = new Type(); @@ -259,7 +260,7 @@ protected function getContentTypeFixture() return $type; } - public function testExtractGroupsFromRows() + public function testExtractGroupsFromRows(): void { $rows = $this->getLoadGroupFixture(); @@ -294,7 +295,7 @@ public function testExtractGroupsFromRows() ); } - public function testExtractTypesFromRowsSingle() + public function testExtractTypesFromRowsSingle(): void { $rows = $this->getLoadTypeFixture(); @@ -375,7 +376,7 @@ public function testExtractTypesFromRowsSingle() ); } - public function testToStorageFieldDefinition() + public function testToStorageFieldDefinition(): void { $converterMock = $this->createMock(Converter::class); $converterMock->expects(self::once()) @@ -408,7 +409,7 @@ public function testToStorageFieldDefinition() $mapper->toStorageFieldDefinition($fieldDef, $storageFieldDef); } - public function testToFieldDefinition() + public function testToFieldDefinition(): void { $storageFieldDef = new StorageFieldDefinition(); @@ -441,7 +442,7 @@ public function testToFieldDefinition() * * @return \Ibexa\Core\Persistence\Legacy\Content\Type\Mapper */ - protected function getNonConvertingMapper() + protected function getNonConvertingMapper(): MockObject { $mapper = $this->getMockBuilder(Mapper::class) ->setMethods(['toFieldDefinition']) @@ -461,7 +462,7 @@ protected function getNonConvertingMapper() ) )->will( self::returnCallback( - static function () { + static function (): FieldDefinition { return new FieldDefinition(); } ) @@ -475,7 +476,7 @@ static function () { * * @return \Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry */ - protected function getConverterRegistryMock() + protected function getConverterRegistryMock(): MockObject { return $this->createMock(ConverterRegistry::class); } @@ -500,7 +501,7 @@ protected function getLoadGroupFixture() return require __DIR__ . '/_fixtures/map_load_group.php'; } - protected function getMaskGeneratorMock() + protected function getMaskGeneratorMock(): MockObject { return $this->createMock(MaskGenerator::class); } diff --git a/tests/lib/Persistence/Legacy/Content/Type/Update/Handler/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/Content/Type/Update/Handler/DoctrineDatabaseTest.php index 32485ecfe9..5dde3b6cc8 100644 --- a/tests/lib/Persistence/Legacy/Content/Type/Update/Handler/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/Content/Type/Update/Handler/DoctrineDatabaseTest.php @@ -11,6 +11,7 @@ use Ibexa\Core\Persistence\Legacy\Content\Type\ContentUpdater; use Ibexa\Core\Persistence\Legacy\Content\Type\Gateway; use Ibexa\Core\Persistence\Legacy\Content\Type\Update\Handler\DoctrineDatabase; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -23,16 +24,16 @@ class DoctrineDatabaseTest extends TestCase * * @var \Ibexa\Core\Persistence\Legacy\Content\Type\Gateway */ - protected $gatewayMock; + protected ?MockObject $gatewayMock = null; /** * Content Updater mock. * * @var \Ibexa\Core\Persistence\Legacy\Content\Type\ContentUpdater */ - protected $contentUpdaterMock; + protected ?MockObject $contentUpdaterMock = null; - public function testUpdateContentObjects() + public function testUpdateContentObjects(): void { $handler = $this->getUpdateHandler(); @@ -49,7 +50,7 @@ public function testUpdateContentObjects() $handler->updateContentObjects($types['from'], $types['to']); } - public function testDeleteOldType() + public function testDeleteOldType(): void { $handler = $this->getUpdateHandler(); @@ -67,7 +68,7 @@ public function testDeleteOldType() $handler->deleteOldType($types['from'], $types['to']); } - public function testPublishNewType() + public function testPublishNewType(): void { $handler = $this->getUpdateHandler(); @@ -88,7 +89,7 @@ public function testPublishNewType() * * @return \Ibexa\Contracts\Core\Persistence\Content\Type[] */ - protected function getTypeFixtures() + protected function getTypeFixtures(): array { $types = []; @@ -108,7 +109,7 @@ protected function getTypeFixtures() * * @return \Ibexa\Core\Persistence\Legacy\Content\Type\Update\Handler\DoctrineDatabase */ - protected function getUpdateHandler() + protected function getUpdateHandler(): DoctrineDatabase { return new DoctrineDatabase($this->getGatewayMock()); } diff --git a/tests/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabaseTest.php index 33f2f7c0d0..ffa338c01e 100644 --- a/tests/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabaseTest.php @@ -31,7 +31,7 @@ class DoctrineDatabaseTest extends TestCase /** * Test for the loadUrlAliasData() method. */ - public function testLoadUrlaliasDataNonExistent() + public function testLoadUrlaliasDataNonExistent(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_simple.php'); $gateway = $this->getGateway(); @@ -44,7 +44,7 @@ public function testLoadUrlaliasDataNonExistent() /** * Test for the loadUrlAliasData() method. */ - public function testLoadUrlaliasData() + public function testLoadUrlaliasData(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_simple.php'); $gateway = $this->getGateway(); @@ -85,7 +85,7 @@ public function testLoadUrlaliasData() * * Test with fixture containing language mask with multiple languages. */ - public function testLoadUrlaliasDataMultipleLanguages() + public function testLoadUrlaliasDataMultipleLanguages(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_multilang.php'); $gateway = $this->getGateway(); @@ -124,7 +124,7 @@ public function testLoadUrlaliasDataMultipleLanguages() /** * @return array */ - public function providerForTestLoadPathData() + public function providerForTestLoadPathData(): array { return [ [ @@ -173,7 +173,7 @@ public function providerForTestLoadPathData() * * @dataProvider providerForTestLoadPathData */ - public function testLoadPathData($id, $pathData) + public function testLoadPathData(int $id, array $pathData): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_fallback.php'); $gateway = $this->getGateway(); @@ -189,7 +189,7 @@ public function testLoadPathData($id, $pathData) /** * @return array */ - public function providerForTestLoadPathDataMultipleLanguages() + public function providerForTestLoadPathDataMultipleLanguages(): array { return [ [ @@ -235,7 +235,7 @@ public function providerForTestLoadPathDataMultipleLanguages() * * @dataProvider providerForTestLoadPathDataMultipleLanguages */ - public function testLoadPathDataMultipleLanguages($id, $pathData) + public function testLoadPathDataMultipleLanguages(int $id, array $pathData): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_multilang.php'); $gateway = $this->getGateway(); @@ -251,7 +251,7 @@ public function testLoadPathDataMultipleLanguages($id, $pathData) /** * @return array */ - public function providerForTestCleanupAfterPublishHistorize() + public function providerForTestCleanupAfterPublishHistorize(): array { return [ [ @@ -276,7 +276,7 @@ public function providerForTestCleanupAfterPublishHistorize() * * @return array */ - public function providerForTestArchiveUrlAliasesForDeletedTranslations() + public function providerForTestArchiveUrlAliasesForDeletedTranslations(): array { return [ [314, [2]], @@ -294,7 +294,7 @@ public function providerForTestArchiveUrlAliasesForDeletedTranslations() * * @dataProvider providerForTestCleanupAfterPublishHistorize */ - public function testCleanupAfterPublishHistorize($action, $languageId, $parentId, $textMD5) + public function testCleanupAfterPublishHistorize(string $action, int $languageId, int $parentId, string $textMD5): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_downgrade.php'); $gateway = $this->getGateway(); @@ -314,7 +314,7 @@ public function testCleanupAfterPublishHistorize($action, $languageId, $parentId /** * @return array */ - public function providerForTestCleanupAfterPublishRemovesLanguage() + public function providerForTestCleanupAfterPublishRemovesLanguage(): array { return [ [ @@ -339,7 +339,7 @@ public function providerForTestCleanupAfterPublishRemovesLanguage() * * @dataProvider providerForTestCleanupAfterPublishRemovesLanguage */ - public function testCleanupAfterPublishRemovesLanguage($action, $languageId, $parentId, $textMD5) + public function testCleanupAfterPublishRemovesLanguage(string $action, int $languageId, int $parentId, string $textMD5): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_downgrade.php'); $gateway = $this->getGateway(); @@ -359,7 +359,7 @@ public function testCleanupAfterPublishRemovesLanguage($action, $languageId, $pa * * @todo document */ - public function testReparent() + public function testReparent(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_simple.php'); $gateway = $this->getGateway(); @@ -387,7 +387,7 @@ public function testReparent() /** * Test for the remove() method. */ - public function testRemove() + public function testRemove(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_remove.php'); $gateway = $this->getGateway(); @@ -405,7 +405,7 @@ public function testRemove() /** * Test for the remove() method. */ - public function testRemoveWithId() + public function testRemoveWithId(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_remove.php'); $gateway = $this->getGateway(); @@ -423,7 +423,7 @@ public function testRemoveWithId() /** * Test for the removeCustomAlias() method. */ - public function testRemoveCustomAlias() + public function testRemoveCustomAlias(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_remove.php'); $gateway = $this->getGateway(); @@ -439,7 +439,7 @@ public function testRemoveCustomAlias() /** * Test for the removeByAction() method. */ - public function testRemoveCustomAliasFails() + public function testRemoveCustomAliasFails(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_remove.php'); $gateway = $this->getGateway(); @@ -453,7 +453,7 @@ public function testRemoveCustomAliasFails() /** * Test for the getNextId() method. */ - public function testGetNextId() + public function testGetNextId(): void { $gateway = $this->getGateway(); @@ -467,7 +467,7 @@ public function testGetNextId() * @param int $locationId * @param int[] $removedLanguageIds */ - public function testArchiveUrlAliasesForDeletedTranslations($locationId, array $removedLanguageIds) + public function testArchiveUrlAliasesForDeletedTranslations(int $locationId, array $removedLanguageIds): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_multilang.php'); $gateway = $this->getGateway(); diff --git a/tests/lib/Persistence/Legacy/Content/UrlAlias/SlugConverterTest.php b/tests/lib/Persistence/Legacy/Content/UrlAlias/SlugConverterTest.php index 2056c6a360..5d0f0a59a7 100644 --- a/tests/lib/Persistence/Legacy/Content/UrlAlias/SlugConverterTest.php +++ b/tests/lib/Persistence/Legacy/Content/UrlAlias/SlugConverterTest.php @@ -13,6 +13,7 @@ use Ibexa\Core\Persistence\TransformationProcessor\PreprocessedBased; use Ibexa\Core\Persistence\Utf8Converter; use Ibexa\Tests\Core\Persistence\Legacy\TestCase; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestSuite; /** @@ -23,7 +24,7 @@ class SlugConverterTest extends TestCase /** * Test for the convert() method. */ - public function testConvert() + public function testConvert(): void { $slugConverter = $this->getSlugConverterMock(['cleanupText']); $transformationProcessor = $this->getTransformationProcessorMock(); @@ -51,7 +52,7 @@ public function testConvert() /** * Test for the convert() method. */ - public function testConvertWithDefaultTextFallback() + public function testConvertWithDefaultTextFallback(): void { $slugConverter = $this->getSlugConverterMock(['cleanupText']); $transformationProcessor = $this->getTransformationProcessorMock(); @@ -79,7 +80,7 @@ public function testConvertWithDefaultTextFallback() /** * Test for the convert() method. */ - public function testConvertWithGivenTransformation() + public function testConvertWithGivenTransformation(): void { $slugConverter = $this->getSlugConverterMock(['cleanupText']); $transformationProcessor = $this->getTransformationProcessorMock(); @@ -104,7 +105,7 @@ public function testConvertWithGivenTransformation() ); } - public function providerForTestGetUniqueCounterValue() + public function providerForTestGetUniqueCounterValue(): array { return [ ['reserved', true, 2], @@ -119,7 +120,7 @@ public function providerForTestGetUniqueCounterValue() * * @dataProvider providerForTestGetUniqueCounterValue */ - public function testGetUniqueCounterValue($text, $isRootLevel, $returnValue) + public function testGetUniqueCounterValue(string $text, bool $isRootLevel, int $returnValue): void { $slugConverter = $this->getMockedSlugConverter(); @@ -129,7 +130,7 @@ public function testGetUniqueCounterValue($text, $isRootLevel, $returnValue) ); } - public function cleanupTextData() + public function cleanupTextData(): array { return [ [ @@ -155,7 +156,7 @@ public function cleanupTextData() * * @dataProvider cleanupTextData */ - public function testCleanupText($text, $method, $expected) + public function testCleanupText(string $text, string $method, string $expected): void { $testMethod = new \ReflectionMethod( SlugConverter::class, @@ -171,7 +172,7 @@ public function testCleanupText($text, $method, $expected) ); } - public function convertData() + public function convertData(): array { return [ [ @@ -202,7 +203,7 @@ public function convertData() * * @depends testCleanupText */ - public function testConvertNoMocking($text, $defaultText, $transformation, $expected) + public function testConvertNoMocking(string $text, string $defaultText, string $transformation, string $expected): void { $transformationProcessor = new PreprocessedBased( new PcreCompiler( @@ -249,10 +250,10 @@ public function testConvertNoMocking($text, $defaultText, $transformation, $expe protected $slugConverter; /** @var \PHPUnit\Framework\MockObject\MockObject */ - protected $slugConverterMock; + protected ?MockObject $slugConverterMock = null; /** @var \PHPUnit\Framework\MockObject\MockObject */ - protected $transformationProcessorMock; + protected ?MockObject $transformationProcessorMock = null; /** * @return \Ibexa\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter @@ -316,7 +317,7 @@ protected function getTransformationProcessorMock() * * @return \PHPUnit\Framework\TestSuite */ - public static function suite() + public static function suite(): TestSuite { return new TestSuite(__CLASS__); } diff --git a/tests/lib/Persistence/Legacy/Content/UrlAlias/UrlAliasHandlerTest.php b/tests/lib/Persistence/Legacy/Content/UrlAlias/UrlAliasHandlerTest.php index 0455d10b2f..21d4aac118 100644 --- a/tests/lib/Persistence/Legacy/Content/UrlAlias/UrlAliasHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Content/UrlAlias/UrlAliasHandlerTest.php @@ -30,6 +30,7 @@ use Ibexa\Core\Persistence\Utf8Converter; use Ibexa\Core\Search\Legacy\Content; use Ibexa\Tests\Core\Persistence\Legacy\TestCase; +use PHPUnit\Framework\MockObject\MockObject; /** * @covers \Ibexa\Core\Persistence\Legacy\Content\UrlAlias\Handler @@ -49,7 +50,7 @@ class UrlAliasHandlerTest extends TestCase * @group case-correction * @group multiple-languages */ - public function testLookup() + public function testLookup(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location.php'); @@ -68,7 +69,7 @@ public function testLookup() * @group virtual * @group resource */ - public function testLookupThrowsNotFoundException() + public function testLookupThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -84,7 +85,7 @@ public function testLookupThrowsNotFoundException() * @group location * @group case-correction */ - public function testLookupThrowsInvalidArgumentException() + public function testLookupThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -92,7 +93,7 @@ public function testLookupThrowsInvalidArgumentException() $handler->lookup(str_repeat('/1', 99)); } - public function providerForTestLookupLocationUrlAlias() + public function providerForTestLookupLocationUrlAlias(): array { return [ [ @@ -349,13 +350,13 @@ public function providerForTestLookupLocationUrlAlias() * @group location */ public function testLookupLocationUrlAlias( - $url, + string $url, array $pathData, array $languageCodes, - $alwaysAvailable, - $locationId, - $id - ) { + bool $alwaysAvailable, + int $locationId, + string $id + ): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location.php'); @@ -402,13 +403,13 @@ public function testLookupLocationUrlAlias( * @todo refactor, only forward pertinent */ public function testLookupLocationCaseCorrection( - $url, + string $url, array $pathData, array $languageCodes, - $alwaysAvailable, - $locationId, - $id - ) { + bool $alwaysAvailable, + int $locationId, + string $id + ): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location.php'); @@ -433,7 +434,7 @@ public function testLookupLocationCaseCorrection( ); } - public function providerForTestLookupLocationMultipleLanguages() + public function providerForTestLookupLocationMultipleLanguages(): array { return [ [ @@ -530,13 +531,13 @@ public function providerForTestLookupLocationMultipleLanguages() * @group location */ public function testLookupLocationMultipleLanguages( - $url, + string $url, array $pathData, array $languageCodes, - $alwaysAvailable, - $locationId, - $id - ) { + bool $alwaysAvailable, + int $locationId, + string $id + ): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location_multilang.php'); @@ -571,7 +572,7 @@ public function testLookupLocationMultipleLanguages( * @group history * @group location */ - public function testLookupLocationHistoryUrlAlias() + public function testLookupLocationHistoryUrlAlias(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location.php'); @@ -584,7 +585,7 @@ public function testLookupLocationHistoryUrlAlias() ); } - public function providerForTestLookupCustomLocationUrlAlias() + public function providerForTestLookupCustomLocationUrlAlias(): array { return [ [ @@ -713,14 +714,14 @@ public function providerForTestLookupCustomLocationUrlAlias() * @group custom */ public function testLookupCustomLocationUrlAlias( - $url, + string $url, array $pathData, array $languageCodes, - $forward, - $alwaysAvailable, - $destination, - $id - ) { + bool $forward, + bool $alwaysAvailable, + int $destination, + string $id + ): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location_custom.php'); @@ -757,14 +758,14 @@ public function testLookupCustomLocationUrlAlias( * @group custom */ public function testLookupCustomLocationUrlAliasCaseCorrection( - $url, + string $url, array $pathData, array $languageCodes, - $forward, - $alwaysAvailable, - $destination, - $id - ) { + bool $forward, + bool $alwaysAvailable, + int $destination, + string $id + ): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location_custom.php'); @@ -789,7 +790,7 @@ public function testLookupCustomLocationUrlAliasCaseCorrection( ); } - public function providerForTestLookupVirtualUrlAlias() + public function providerForTestLookupVirtualUrlAlias(): array { return [ [ @@ -814,7 +815,7 @@ public function providerForTestLookupVirtualUrlAlias() * * @group virtual */ - public function testLookupVirtualUrlAlias($url, $id) + public function testLookupVirtualUrlAlias(string $url, string $id): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location_custom.php'); @@ -824,7 +825,7 @@ public function testLookupVirtualUrlAlias($url, $id) $this->assertVirtualUrlAliasValid($urlAlias, $id); } - public function providerForTestLookupResourceUrlAlias() + public function providerForTestLookupResourceUrlAlias(): array { return [ [ @@ -886,14 +887,14 @@ public function providerForTestLookupResourceUrlAlias() * @group resource */ public function testLookupResourceUrlAlias( - $url, - $pathData, + string $url, + array $pathData, array $languageCodes, - $forward, - $alwaysAvailable, - $destination, - $id - ) { + bool $forward, + bool $alwaysAvailable, + string $destination, + string $id + ): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_resource.php'); @@ -930,14 +931,14 @@ public function testLookupResourceUrlAlias( * @group resource */ public function testLookupResourceUrlAliasCaseInsensitive( - $url, - $pathData, + string $url, + array $pathData, array $languageCodes, - $forward, - $alwaysAvailable, - $destination, - $id - ) { + bool $forward, + bool $alwaysAvailable, + string $destination, + string $id + ): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_resource.php'); @@ -968,7 +969,7 @@ public function testLookupResourceUrlAliasCaseInsensitive( * * @depends testLookup */ - public function testLookupUppercaseIri() + public function testLookupUppercaseIri(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location_iri.php'); @@ -987,7 +988,7 @@ protected function assertVirtualUrlAliasValid(UrlAlias $urlAlias, $id) /** * Test for the listURLAliasesForLocation() method. */ - public function testListURLAliasesForLocation() + public function testListURLAliasesForLocation(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location.php'); @@ -1060,7 +1061,7 @@ public function testListURLAliasesForLocation() * * @group publish */ - public function testPublishUrlAliasForLocation() + public function testPublishUrlAliasForLocation(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); @@ -1104,7 +1105,7 @@ public function testPublishUrlAliasForLocation() * * @group publish */ - public function testPublishUrlAliasForLocationRepublish() + public function testPublishUrlAliasForLocationRepublish(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); @@ -1130,7 +1131,7 @@ public function testPublishUrlAliasForLocationRepublish() * * @group publish */ - public function testPublishUrlAliasCreatesUniqueAlias() + public function testPublishUrlAliasCreatesUniqueAlias(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); @@ -1191,7 +1192,7 @@ public function testPublishUrlAliasForLocationComplex( $alwaysAvailable, $locationId, $id - ) { + ): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); @@ -1232,7 +1233,7 @@ public function testPublishUrlAliasForLocationComplex( * * @group publish */ - public function testPublishUrlAliasForLocationSameAliasForMultipleLanguages() + public function testPublishUrlAliasForLocationSameAliasForMultipleLanguages(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); @@ -1281,7 +1282,7 @@ public function testPublishUrlAliasForLocationSameAliasForMultipleLanguages() * * @group publish */ - public function testPublishUrlAliasForLocationDowngradesOldEntryToHistory() + public function testPublishUrlAliasForLocationDowngradesOldEntryToHistory(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); @@ -1355,7 +1356,7 @@ public function testPublishUrlAliasForLocationDowngradesOldEntryToHistory() * @group publish * @group downgrade */ - public function testPublishUrlAliasForLocationDowngradesOldEntryRemovesLanguage() + public function testPublishUrlAliasForLocationDowngradesOldEntryRemovesLanguage(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); @@ -1429,7 +1430,7 @@ public function testPublishUrlAliasForLocationDowngradesOldEntryRemovesLanguage( * * @group publish */ - public function testPublishUrlAliasForLocationReusesHistory() + public function testPublishUrlAliasForLocationReusesHistory(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); @@ -1462,7 +1463,7 @@ public function testPublishUrlAliasForLocationReusesHistory() * * @group publish */ - public function testPublishUrlAliasForLocationReusesHistoryOfDifferentLanguage() + public function testPublishUrlAliasForLocationReusesHistoryOfDifferentLanguage(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); @@ -1514,7 +1515,7 @@ public function testPublishUrlAliasForLocationReusesHistoryOfDifferentLanguage() * * @group publish */ - public function testPublishUrlAliasForLocationReusesCustomAlias() + public function testPublishUrlAliasForLocationReusesCustomAlias(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php'); @@ -1537,7 +1538,7 @@ public function testPublishUrlAliasForLocationReusesCustomAlias() * * @depends testPublishUrlAliasForLocation */ - public function testPublishUrlAliasForLocationReusingNopElement() + public function testPublishUrlAliasForLocationReusingNopElement(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php'); @@ -1608,7 +1609,7 @@ public function testPublishUrlAliasForLocationReusingNopElement() * @depends testPublishUrlAliasForLocation * @depends testPublishUrlAliasForLocationReusingNopElement */ - public function testPublishUrlAliasForLocationReusingNopElementChangesCustomPath() + public function testPublishUrlAliasForLocationReusingNopElementChangesCustomPath(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php'); @@ -1656,7 +1657,7 @@ public function testPublishUrlAliasForLocationReusingNopElementChangesCustomPath * @depends testPublishUrlAliasForLocation * @depends testPublishUrlAliasForLocationReusingNopElementChangesCustomPath */ - public function testPublishUrlAliasForLocationReusingNopElementChangesCustomPathAndCreatesHistory() + public function testPublishUrlAliasForLocationReusingNopElementChangesCustomPathAndCreatesHistory(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php'); @@ -1678,7 +1679,7 @@ public function testPublishUrlAliasForLocationReusingNopElementChangesCustomPath /** * Test for the publishUrlAliasForLocation() method. */ - public function testPublishUrlAliasForLocationUpdatesLocationPathIdentificationString() + public function testPublishUrlAliasForLocationUpdatesLocationPathIdentificationString(): void { $handler = $this->getHandler(); $locationGateway = $this->getLocationGateway(); @@ -1697,7 +1698,7 @@ public function testPublishUrlAliasForLocationUpdatesLocationPathIdentificationS * * @group cleanup */ - public function testPublishUrlAliasReuseNopCleanupCustomAliasIsDestroyed() + public function testPublishUrlAliasReuseNopCleanupCustomAliasIsDestroyed(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_cleanup_nop.php'); @@ -1771,7 +1772,7 @@ public function testPublishUrlAliasReuseNopCleanupCustomAliasIsDestroyed() * * @group cleanup */ - public function testPublishUrlAliasReuseHistoryCleanup() + public function testPublishUrlAliasReuseHistoryCleanup(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_cleanup_history.php'); @@ -1835,7 +1836,7 @@ public function testPublishUrlAliasReuseHistoryCleanup() * * @group cleanup */ - public function testPublishUrlAliasReuseAutogeneratedCleanup() + public function testPublishUrlAliasReuseAutogeneratedCleanup(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_cleanup_reusing.php'); @@ -1902,7 +1903,7 @@ public function testPublishUrlAliasReuseAutogeneratedCleanup() * @group create * @group custom */ - public function testCreateCustomUrlAliasBehaviour() + public function testCreateCustomUrlAliasBehaviour(): void { $handlerMock = $this->getPartlyMockedHandler(['createUrlAlias']); @@ -1935,7 +1936,7 @@ public function testCreateCustomUrlAliasBehaviour() * @group create * @group global */ - public function testCreateGlobalUrlAliasBehaviour() + public function testCreateGlobalUrlAliasBehaviour(): void { $handlerMock = $this->getPartlyMockedHandler(['createUrlAlias']); @@ -1968,7 +1969,7 @@ public function testCreateGlobalUrlAliasBehaviour() * @group create * @group custom */ - public function testCreateCustomUrlAlias() + public function testCreateCustomUrlAlias(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); @@ -2015,7 +2016,7 @@ public function testCreateCustomUrlAlias() * @group create * @group custom */ - public function testCreateCustomUrlAliasWithNonameParts() + public function testCreateCustomUrlAliasWithNonameParts(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); @@ -2089,7 +2090,7 @@ public function testCreateCustomUrlAliasWithNonameParts() * * @todo pathData */ - public function testCreatedCustomUrlAliasIsLoadable() + public function testCreatedCustomUrlAliasIsLoadable(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); @@ -2195,7 +2196,7 @@ public function testCreateCustomUrlAliasWithNopElement(): void * @group create * @group custom */ - public function testCreateCustomUrlAliasReusesHistory() + public function testCreateCustomUrlAliasReusesHistory(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php'); @@ -2294,7 +2295,7 @@ public function testCreateCustomUrlAliasAddLanguage(): void * @group create * @group custom */ - public function testCreateCustomUrlAliasReusesHistoryOfDifferentLanguage() + public function testCreateCustomUrlAliasReusesHistoryOfDifferentLanguage(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php'); @@ -2342,7 +2343,7 @@ public function testCreateCustomUrlAliasReusesHistoryOfDifferentLanguage() * @group create * @group custom */ - public function testCreateCustomUrlAliasReusesNopElement() + public function testCreateCustomUrlAliasReusesNopElement(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php'); @@ -2396,7 +2397,7 @@ public function testCreateCustomUrlAliasReusesNopElement() * @group create * @group custom */ - public function testCreateCustomUrlAliasReusesLocationElement() + public function testCreateCustomUrlAliasReusesLocationElement(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_reusing.php'); @@ -2429,7 +2430,7 @@ public function testCreateCustomUrlAliasReusesLocationElement() * * @depends testLookupResourceUrlAlias */ - public function testListGlobalURLAliases() + public function testListGlobalURLAliases(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_resource.php'); @@ -2452,7 +2453,7 @@ public function testListGlobalURLAliases() * * @depends testLookupResourceUrlAlias */ - public function testListGlobalURLAliasesWithLanguageCode() + public function testListGlobalURLAliasesWithLanguageCode(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_resource.php'); @@ -2474,7 +2475,7 @@ public function testListGlobalURLAliasesWithLanguageCode() * * @depends testLookupResourceUrlAlias */ - public function testListGlobalURLAliasesWithOffset() + public function testListGlobalURLAliasesWithOffset(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_resource.php'); @@ -2495,7 +2496,7 @@ public function testListGlobalURLAliasesWithOffset() * * @depends testLookupResourceUrlAlias */ - public function testListGlobalURLAliasesWithOffsetAndLimit() + public function testListGlobalURLAliasesWithOffsetAndLimit(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_resource.php'); @@ -2513,7 +2514,7 @@ public function testListGlobalURLAliasesWithOffsetAndLimit() /** * Test for the locationDeleted() method. */ - public function testLocationDeleted() + public function testLocationDeleted(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location_delete.php'); @@ -2566,7 +2567,7 @@ public function testLocationDeleted() /** * Test for the locationMoved() method. */ - public function testLocationMovedHistorize() + public function testLocationMovedHistorize(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); @@ -2601,7 +2602,7 @@ public function testLocationMovedHistorize() /** * Test for the locationMoved() method. */ - public function testLocationMovedHistory() + public function testLocationMovedHistory(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); @@ -2636,7 +2637,7 @@ public function testLocationMovedHistory() /** * Test for the locationMoved() method. */ - public function testLocationMovedHistorySubtree() + public function testLocationMovedHistorySubtree(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); @@ -2679,7 +2680,7 @@ public function testLocationMovedHistorySubtree() /** * Test for the locationMoved() method. */ - public function testLocationMovedReparent() + public function testLocationMovedReparent(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); @@ -2722,7 +2723,7 @@ public function testLocationMovedReparent() /** * Test for the locationMoved() method. */ - public function testLocationMovedReparentHistory() + public function testLocationMovedReparentHistory(): void { $this->expectException(NotFoundException::class); @@ -2738,7 +2739,7 @@ public function testLocationMovedReparentHistory() /** * Test for the locationMoved() method. */ - public function testLocationMovedReparentSubtree() + public function testLocationMovedReparentSubtree(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); @@ -2785,7 +2786,7 @@ public function testLocationMovedReparentSubtree() /** * Test for the locationMoved() method. */ - public function testLocationMovedReparentSubtreeHistory() + public function testLocationMovedReparentSubtreeHistory(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_move.php'); @@ -2899,7 +2900,7 @@ public function testLocationMovedReparentWithCustomAlias(): void /** * Test for the locationCopied() method. */ - public function testLocationCopiedCopiedLocationAliasIsValid() + public function testLocationCopiedCopiedLocationAliasIsValid(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_copy.php'); @@ -2917,7 +2918,7 @@ public function testLocationCopiedCopiedLocationAliasIsValid() /** * Test for the locationCopied() method. */ - public function testLocationCopiedCopiedSubtreeIsValid() + public function testLocationCopiedCopiedSubtreeIsValid(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_copy.php'); @@ -2935,7 +2936,7 @@ public function testLocationCopiedCopiedSubtreeIsValid() /** * Test for the locationCopied() method. */ - public function testLocationCopiedHistoryNotCopied() + public function testLocationCopiedHistoryNotCopied(): void { $this->expectException(NotFoundException::class); @@ -2950,7 +2951,7 @@ public function testLocationCopiedHistoryNotCopied() /** * Test for the locationCopied() method. */ - public function testLocationCopiedSubtreeHistoryNotCopied() + public function testLocationCopiedSubtreeHistoryNotCopied(): void { $this->expectException(NotFoundException::class); @@ -2965,7 +2966,7 @@ public function testLocationCopiedSubtreeHistoryNotCopied() /** * Test for the locationCopied() method. */ - public function testLocationCopiedSubtree() + public function testLocationCopiedSubtree(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_copy.php'); @@ -3022,13 +3023,13 @@ public function testLocationCopiedSubtree() * @dataProvider providerForTestLookupLocationMultipleLanguages */ public function testLoadAutogeneratedUrlAlias( - $url, + string $url, array $pathData, array $languageCodes, - $alwaysAvailable, - $locationId, - $id - ) { + bool $alwaysAvailable, + int $locationId, + string $id + ): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location_multilang.php'); @@ -3060,14 +3061,14 @@ public function testLoadAutogeneratedUrlAlias( * @dataProvider providerForTestLookupResourceUrlAlias */ public function testLoadResourceUrlAlias( - $url, - $pathData, + string $url, + array $pathData, array $languageCodes, - $forward, - $alwaysAvailable, - $destination, - $id - ) { + bool $forward, + bool $alwaysAvailable, + string $destination, + string $id + ): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_resource.php'); @@ -3098,7 +3099,7 @@ public function testLoadResourceUrlAlias( * * @dataProvider providerForTestLookupVirtualUrlAlias */ - public function testLoadVirtualUrlAlias($url, $id) + public function testLoadVirtualUrlAlias(string $url, string $id): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location_custom.php'); @@ -3108,7 +3109,7 @@ public function testLoadVirtualUrlAlias($url, $id) $this->assertVirtualUrlAliasValid($urlAlias, $id); } - protected function getHistoryAlias() + protected function getHistoryAlias(): UrlAlias { return new UrlAlias( [ @@ -3146,7 +3147,7 @@ protected function getHistoryAlias() /** * Test for the loadUrlAlias() method. */ - public function testLoadHistoryUrlAlias() + public function testLoadHistoryUrlAlias(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_location.php'); @@ -3163,7 +3164,7 @@ public function testLoadHistoryUrlAlias() /** * Test for the loadUrlAlias() method. */ - public function testLoadUrlAliasThrowsNotFoundException() + public function testLoadUrlAliasThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -3172,7 +3173,7 @@ public function testLoadUrlAliasThrowsNotFoundException() $handler->loadUrlAlias('non-existent'); } - public function providerForTestPublishUrlAliasForLocationSkipsReservedWord() + public function providerForTestPublishUrlAliasForLocationSkipsReservedWord(): array { return [ [ @@ -3195,7 +3196,7 @@ public function providerForTestPublishUrlAliasForLocationSkipsReservedWord() * * @group publish */ - public function testPublishUrlAliasForLocationSkipsReservedWord($text, $alias) + public function testPublishUrlAliasForLocationSkipsReservedWord(string $text, string $alias): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_base.php'); @@ -3213,7 +3214,7 @@ public function testPublishUrlAliasForLocationSkipsReservedWord($text, $alias) * * @group swap */ - public function testLocationSwappedSimple() + public function testLocationSwappedSimple(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_simple.php'); @@ -3299,7 +3300,7 @@ public function testLocationSwappedSimple() * * @group swap */ - public function testLocationSwappedSimpleWithHistory() + public function testLocationSwappedSimpleWithHistory(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_simple_history.php'); @@ -3451,7 +3452,7 @@ public function testLocationSwappedSimpleWithHistory() * * @group swap */ - public function testLocationSwappedSimpleWithConflict() + public function testLocationSwappedSimpleWithConflict(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_simple_conflict.php'); @@ -3557,7 +3558,7 @@ public function testLocationSwappedSimpleWithConflict() * * @group swap */ - public function testLocationSwappedSiblingsSimple() + public function testLocationSwappedSiblingsSimple(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_simple.php'); @@ -3631,7 +3632,7 @@ public function testLocationSwappedSiblingsSimple() * * @group swap */ - public function testLocationSwappedSiblingsSimpleReverse() + public function testLocationSwappedSiblingsSimpleReverse(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_simple.php'); @@ -3705,7 +3706,7 @@ public function testLocationSwappedSiblingsSimpleReverse() * * @group swap */ - public function testLocationSwappedSiblingsSimpleWithHistory() + public function testLocationSwappedSiblingsSimpleWithHistory(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_simple_history.php'); @@ -3833,7 +3834,7 @@ public function testLocationSwappedSiblingsSimpleWithHistory() * * @group swap */ - public function testLocationSwappedSiblingsSimpleWithHistoryReverse() + public function testLocationSwappedSiblingsSimpleWithHistoryReverse(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_simple_history.php'); @@ -3961,7 +3962,7 @@ public function testLocationSwappedSiblingsSimpleWithHistoryReverse() * * @group swap */ - public function testLocationSwappedSiblingsSameName() + public function testLocationSwappedSiblingsSameName(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_same_name.php'); @@ -4035,7 +4036,7 @@ public function testLocationSwappedSiblingsSameName() * * @group swap */ - public function testLocationSwappedSiblingsSameNameReverse() + public function testLocationSwappedSiblingsSameNameReverse(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_same_name.php'); @@ -4109,7 +4110,7 @@ public function testLocationSwappedSiblingsSameNameReverse() * * @group swap */ - public function testLocationSwappedSiblingsSameNameMultipleLanguages() + public function testLocationSwappedSiblingsSameNameMultipleLanguages(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_siblings_same_name_multilang.php'); @@ -4241,7 +4242,7 @@ public function testLocationSwappedSiblingsSameNameMultipleLanguages() * * @group swap */ - public function testLocationSwappedMultipleLanguagesSimple() + public function testLocationSwappedMultipleLanguagesSimple(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_multilang_simple.php'); @@ -4276,7 +4277,7 @@ public function testLocationSwappedMultipleLanguagesSimple() * * @group swap */ - public function testLocationSwappedMultipleLanguagesDifferentLanguagesSimple() + public function testLocationSwappedMultipleLanguagesDifferentLanguagesSimple(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_multilang_diff_simple.php'); @@ -4498,7 +4499,7 @@ public function testLocationSwappedMultipleLanguagesDifferentLanguagesSimple() * * @group swap */ - public function testLocationSwappedMultipleLanguagesDifferentLanguages() + public function testLocationSwappedMultipleLanguagesDifferentLanguages(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_multilang_diff.php'); @@ -4656,7 +4657,7 @@ public function testLocationSwappedMultipleLanguagesDifferentLanguages() * * @group swap */ - public function testLocationSwappedMultipleLanguagesWithCompositeHistory() + public function testLocationSwappedMultipleLanguagesWithCompositeHistory(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_multilang_cleanup_composite.php'); @@ -4949,7 +4950,7 @@ public function testLocationSwappedMultipleLanguagesWithCompositeHistory() * * @group swap */ - public function testLocationSwappedWithReusingExternalHistory() + public function testLocationSwappedWithReusingExternalHistory(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_reusing_external_history.php'); @@ -5101,7 +5102,7 @@ public function testLocationSwappedWithReusingExternalHistory() * * @group swap */ - public function testLocationSwappedWithReusingNopEntry() + public function testLocationSwappedWithReusingNopEntry(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_reusing_nop.php'); @@ -5255,7 +5256,7 @@ public function testLocationSwappedWithReusingNopEntry() * * @group swap */ - public function testLocationSwappedWithReusingNopEntryCustomAliasIsDestroyed() + public function testLocationSwappedWithReusingNopEntryCustomAliasIsDestroyed(): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlaliases_swap_reusing_nop.php'); @@ -5278,7 +5279,7 @@ public function testLocationSwappedWithReusingNopEntryCustomAliasIsDestroyed() * * @group swap */ - public function testLocationSwappedUpdatesLocationPathIdentificationString() + public function testLocationSwappedUpdatesLocationPathIdentificationString(): void { $handler = $this->getHandler(); $locationGateway = $this->getLocationGateway(); @@ -5305,7 +5306,7 @@ public function testLocationSwappedUpdatesLocationPathIdentificationString() * * @group swap */ - public function testLocationSwappedMultipleLanguagesUpdatesLocationPathIdentificationString() + public function testLocationSwappedMultipleLanguagesUpdatesLocationPathIdentificationString(): void { $handler = $this->getHandler(); $locationGateway = $this->getLocationGateway(); @@ -5354,7 +5355,7 @@ protected function countRows(): int * * @return \Ibexa\Core\Persistence\Legacy\Content\UrlAlias\Handler|\PHPUnit\Framework\MockObject\MockObject */ - protected function getPartlyMockedHandler(array $methods) + protected function getPartlyMockedHandler(array $methods): MockObject { return $this->getMockBuilder(Handler::class) ->setConstructorArgs( @@ -5460,7 +5461,7 @@ protected function getLocationGateway() /** * @return \Ibexa\Core\Persistence\TransformationProcessor */ - public function getProcessor() + public function getProcessor(): DefinitionBased { return new DefinitionBased( new Parser(), @@ -5476,7 +5477,7 @@ public function getProcessor() * * @return array */ - public function providerForArchiveUrlAliasesForDeletedTranslations() + public function providerForArchiveUrlAliasesForDeletedTranslations(): array { return [ [2, ['eng-GB', 'pol-PL'], 'pol-PL'], @@ -5492,10 +5493,10 @@ public function providerForArchiveUrlAliasesForDeletedTranslations() * @param string $removeLanguage language code to be deleted */ public function testArchiveUrlAliasesForDeletedTranslations( - $locationId, + int $locationId, array $expectedLanguages, - $removeLanguage - ) { + string $removeLanguage + ): void { $handler = $this->getHandler(); $this->insertDatabaseFixture(__DIR__ . '/_fixtures/publish_multilingual.php'); diff --git a/tests/lib/Persistence/Legacy/Content/UrlAlias/UrlAliasMapperTest.php b/tests/lib/Persistence/Legacy/Content/UrlAlias/UrlAliasMapperTest.php index 1831d801aa..1b16280e76 100644 --- a/tests/lib/Persistence/Legacy/Content/UrlAlias/UrlAliasMapperTest.php +++ b/tests/lib/Persistence/Legacy/Content/UrlAlias/UrlAliasMapperTest.php @@ -115,7 +115,7 @@ class UrlAliasMapperTest extends LanguageAwareTestCase ], ]; - protected function getExpectation() + protected function getExpectation(): array { return [ 0 => new UrlAlias( @@ -229,7 +229,7 @@ protected function getExpectation() ]; } - public function providerForTestExtractUrlAliasFromData() + public function providerForTestExtractUrlAliasFromData(): array { return [[0], [1], [2], [3]]; } @@ -239,7 +239,7 @@ public function providerForTestExtractUrlAliasFromData() * * @dataProvider providerForTestExtractUrlAliasFromData */ - public function testExtractUrlAliasFromData($index) + public function testExtractUrlAliasFromData(int $index): void { $mapper = $this->getMapper(); @@ -257,7 +257,7 @@ public function testExtractUrlAliasFromData($index) * * @depends testExtractUrlAliasFromData */ - public function testExtractUrlAliasListFromData() + public function testExtractUrlAliasListFromData(): void { $mapper = $this->getMapper(); @@ -270,7 +270,7 @@ public function testExtractUrlAliasListFromData() /** * Test for the extractLanguageCodesFromData method. */ - public function testExtractLanguageCodesFromData() + public function testExtractLanguageCodesFromData(): void { $mapper = $this->getMapper(); @@ -283,7 +283,7 @@ public function testExtractLanguageCodesFromData() /** * @return \Ibexa\Core\Persistence\Legacy\Content\UrlAlias\Mapper */ - protected function getMapper() + protected function getMapper(): Mapper { $languageHandler = $this->getLanguageHandler(); $languageMaskGenerator = new LanguageMaskGenerator($languageHandler); diff --git a/tests/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/DoctrineDatabaseTest.php index 6484c31584..5ec43d3f70 100644 --- a/tests/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/Content/UrlWildcard/Gateway/DoctrineDatabaseTest.php @@ -50,7 +50,7 @@ class DoctrineDatabaseTest extends TestCase /** * Test for the loadUrlWildcardData() method. */ - public function testLoadUrlWildcardData() + public function testLoadUrlWildcardData(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlwildcards.php'); $gateway = $this->getGateway(); @@ -66,7 +66,7 @@ public function testLoadUrlWildcardData() /** * Test for the loadUrlWildcardsData() method. */ - public function testLoadUrlWildcardsData() + public function testLoadUrlWildcardsData(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlwildcards.php'); $gateway = $this->getGateway(); @@ -82,7 +82,7 @@ public function testLoadUrlWildcardsData() /** * Test for the loadUrlWildcardsData() method. */ - public function testLoadUrlWildcardsDataWithOffset() + public function testLoadUrlWildcardsDataWithOffset(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlwildcards.php'); $gateway = $this->getGateway(); @@ -101,7 +101,7 @@ public function testLoadUrlWildcardsDataWithOffset() /** * Test for the loadUrlWildcardsData() method. */ - public function testLoadUrlWildcardsDataWithOffsetAndLimit() + public function testLoadUrlWildcardsDataWithOffsetAndLimit(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlwildcards.php'); $gateway = $this->getGateway(); @@ -121,7 +121,7 @@ public function testLoadUrlWildcardsDataWithOffsetAndLimit() * * @depends testLoadUrlWildcardData */ - public function testInsertUrlWildcard() + public function testInsertUrlWildcard(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlwildcards.php'); $gateway = $this->getGateway(); @@ -152,7 +152,7 @@ public function testInsertUrlWildcard() * * @depends testLoadUrlWildcardData */ - public function testDeleteUrlWildcard() + public function testDeleteUrlWildcard(): void { $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urlwildcards.php'); $gateway = $this->getGateway(); diff --git a/tests/lib/Persistence/Legacy/Content/UrlWildcard/UrlWildcardHandlerTest.php b/tests/lib/Persistence/Legacy/Content/UrlWildcard/UrlWildcardHandlerTest.php index 790c4aceee..a551c69bb8 100644 --- a/tests/lib/Persistence/Legacy/Content/UrlWildcard/UrlWildcardHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Content/UrlWildcard/UrlWildcardHandlerTest.php @@ -22,7 +22,7 @@ */ class UrlWildcardHandlerTest extends TestCase { - public function testLoad() + public function testLoad(): void { $this->insertDatabaseFixture(__DIR__ . '/Gateway/_fixtures/urlwildcards.php'); $handler = $this->getHandler(); @@ -45,7 +45,7 @@ public function testLoad() /** * Test for the load() method. */ - public function testLoadThrowsNotFoundException() + public function testLoadThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -61,7 +61,7 @@ public function testLoadThrowsNotFoundException() * * @depends testLoad */ - public function testCreate() + public function testCreate(): void { $this->insertDatabaseFixture(__DIR__ . '/Gateway/_fixtures/urlwildcards.php'); $handler = $this->getHandler(); @@ -130,7 +130,7 @@ public function testUpdate(): void * * @depends testLoad */ - public function testRemove() + public function testRemove(): void { $this->expectException(NotFoundException::class); @@ -144,7 +144,7 @@ public function testRemove() /** * Test for the loadAll() method. */ - public function testLoadAll() + public function testLoadAll(): void { $this->insertDatabaseFixture(__DIR__ . '/Gateway/_fixtures/urlwildcards.php'); $handler = $this->getHandler(); @@ -164,7 +164,7 @@ public function testLoadAll() /** * Test for the loadAll() method. */ - public function testLoadAllWithOffset() + public function testLoadAllWithOffset(): void { $this->insertDatabaseFixture(__DIR__ . '/Gateway/_fixtures/urlwildcards.php'); $handler = $this->getHandler(); @@ -182,7 +182,7 @@ public function testLoadAllWithOffset() /** * Test for the loadAll() method. */ - public function testLoadAllWithOffsetAndLimit() + public function testLoadAllWithOffsetAndLimit(): void { $this->insertDatabaseFixture(__DIR__ . '/Gateway/_fixtures/urlwildcards.php'); $handler = $this->getHandler(); diff --git a/tests/lib/Persistence/Legacy/Content/UrlWildcard/UrlWildcardMapperTest.php b/tests/lib/Persistence/Legacy/Content/UrlWildcard/UrlWildcardMapperTest.php index 3f334bed5b..353b71621f 100644 --- a/tests/lib/Persistence/Legacy/Content/UrlWildcard/UrlWildcardMapperTest.php +++ b/tests/lib/Persistence/Legacy/Content/UrlWildcard/UrlWildcardMapperTest.php @@ -19,7 +19,7 @@ class UrlWildcardMapperTest extends TestCase /** * Test for the createUrlWildcard() method. */ - public function testCreateUrlWildcard() + public function testCreateUrlWildcard(): void { $mapper = $this->getMapper(); @@ -45,7 +45,7 @@ public function testCreateUrlWildcard() /** * Test for the extractUrlWildcardFromRow() method. */ - public function testExtractUrlWildcardFromRow() + public function testExtractUrlWildcardFromRow(): void { $mapper = $this->getMapper(); $row = [ @@ -73,7 +73,7 @@ public function testExtractUrlWildcardFromRow() /** * Test for the extractUrlWildcardFromRow() method. */ - public function testExtractUrlWildcardsFromRows() + public function testExtractUrlWildcardsFromRows(): void { $mapper = $this->getMapper(); $rows = [ @@ -119,7 +119,7 @@ public function testExtractUrlWildcardsFromRows() /** * @return \Ibexa\Core\Persistence\Legacy\Content\UrlWildcard\Mapper */ - protected function getMapper() + protected function getMapper(): Mapper { return new Mapper(); } diff --git a/tests/lib/Persistence/Legacy/FieldValue/Converter/ImageConverterTest.php b/tests/lib/Persistence/Legacy/FieldValue/Converter/ImageConverterTest.php index 7d25304b03..58c5105a9b 100644 --- a/tests/lib/Persistence/Legacy/FieldValue/Converter/ImageConverterTest.php +++ b/tests/lib/Persistence/Legacy/FieldValue/Converter/ImageConverterTest.php @@ -14,19 +14,20 @@ use Ibexa\Core\IO\Values\BinaryFile; use Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter\ImageConverter; use Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Bridge\PhpUnit\ClockMock; final class ImageConverterTest extends TestCase { /** @var \Ibexa\Core\Persistence\Legacy\Content\FieldValue\Converter\ImageConverter */ - private $imageConverter; + private ImageConverter $imageConverter; /** @var \Ibexa\Core\IO\UrlRedecoratorInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $urlRedecorator; + private MockObject $urlRedecorator; /** @var \Ibexa\Core\IO\IOServiceInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $ioService; + private MockObject $ioService; protected function setUp(): void { diff --git a/tests/lib/Persistence/Legacy/Filter/BaseCriterionVisitorQueryBuilderTestCase.php b/tests/lib/Persistence/Legacy/Filter/BaseCriterionVisitorQueryBuilderTestCase.php index 0372364174..3d357a9db0 100644 --- a/tests/lib/Persistence/Legacy/Filter/BaseCriterionVisitorQueryBuilderTestCase.php +++ b/tests/lib/Persistence/Legacy/Filter/BaseCriterionVisitorQueryBuilderTestCase.php @@ -19,7 +19,7 @@ abstract class BaseCriterionVisitorQueryBuilderTestCase extends TestCase { /** @var \Ibexa\Core\Persistence\Legacy\Filter\CriterionVisitor */ - private $criterionVisitor; + private CriterionVisitor $criterionVisitor; /** * @return \Ibexa\Contracts\Core\Repository\Values\Filter\CriterionQueryBuilder[] diff --git a/tests/lib/Persistence/Legacy/Notification/Gateway/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/Notification/Gateway/DoctrineDatabaseTest.php index da80077eea..943d96a454 100644 --- a/tests/lib/Persistence/Legacy/Notification/Gateway/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/Notification/Gateway/DoctrineDatabaseTest.php @@ -38,7 +38,7 @@ protected function setUp(): void ); } - public function testInsert() + public function testInsert(): void { $id = $this->getGateway()->insert(new CreateStruct([ 'ownerId' => 14, @@ -60,7 +60,7 @@ public function testInsert() ], $data); } - public function testGetNotificationById() + public function testGetNotificationById(): void { $data = $this->getGateway()->getNotificationById(self::EXISTING_NOTIFICATION_ID); @@ -69,7 +69,7 @@ public function testGetNotificationById() ], $data); } - public function testUpdateNotification() + public function testUpdateNotification(): void { $notification = new Notification([ 'id' => self::EXISTING_NOTIFICATION_ID, @@ -92,14 +92,14 @@ public function testUpdateNotification() ], $this->loadNotification(self::EXISTING_NOTIFICATION_ID)); } - public function testCountUserNotifications() + public function testCountUserNotifications(): void { self::assertEquals(5, $this->getGateway()->countUserNotifications( self::EXISTING_NOTIFICATION_DATA['owner_id'] )); } - public function testCountUserPendingNotifications() + public function testCountUserPendingNotifications(): void { self::assertEquals( 3, @@ -109,7 +109,7 @@ public function testCountUserPendingNotifications() ); } - public function testLoadUserNotifications() + public function testLoadUserNotifications(): void { $userId = 14; $offset = 1; @@ -145,7 +145,7 @@ public function testLoadUserNotifications() ], $results); } - public function testDelete() + public function testDelete(): void { $this->getGateway()->delete(self::EXISTING_NOTIFICATION_ID); diff --git a/tests/lib/Persistence/Legacy/Notification/HandlerTest.php b/tests/lib/Persistence/Legacy/Notification/HandlerTest.php index 2fa49af860..b6a2ebc55a 100644 --- a/tests/lib/Persistence/Legacy/Notification/HandlerTest.php +++ b/tests/lib/Persistence/Legacy/Notification/HandlerTest.php @@ -15,6 +15,7 @@ use Ibexa\Core\Persistence\Legacy\Notification\Gateway; use Ibexa\Core\Persistence\Legacy\Notification\Handler; use Ibexa\Core\Persistence\Legacy\Notification\Mapper; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -25,13 +26,13 @@ class HandlerTest extends TestCase public const NOTIFICATION_ID = 1; /** @var \Ibexa\Core\Persistence\Legacy\Notification\Gateway|\PHPUnit\Framework\MockObject\MockObject */ - private $gateway; + private MockObject $gateway; /** @var \Ibexa\Core\Persistence\Legacy\Notification\Mapper|\PHPUnit\Framework\MockObject\MockObject */ - private $mapper; + private MockObject $mapper; /** @var \Ibexa\Core\Persistence\Legacy\Notification\Handler */ - private $handler; + private Handler $handler; protected function setUp(): void { @@ -40,7 +41,7 @@ protected function setUp(): void $this->handler = new Handler($this->gateway, $this->mapper); } - public function testCreateNotification() + public function testCreateNotification(): void { $createStruct = new CreateStruct([ 'ownerId' => 5, @@ -68,7 +69,7 @@ public function testCreateNotification() self::assertEquals($notification->id, self::NOTIFICATION_ID); } - public function testCountPendingNotifications() + public function testCountPendingNotifications(): void { $ownerId = 10; $expectedCount = 12; @@ -82,7 +83,7 @@ public function testCountPendingNotifications() self::assertEquals($expectedCount, $this->handler->countPendingNotifications($ownerId)); } - public function testGetNotificationById() + public function testGetNotificationById(): void { $rows = [ [ @@ -109,7 +110,7 @@ public function testGetNotificationById() self::assertEquals($object, $this->handler->getNotificationById(self::NOTIFICATION_ID)); } - public function testUpdateNotification() + public function testUpdateNotification(): void { $updateStruct = new UpdateStruct([ 'isPending' => false, @@ -148,7 +149,7 @@ public function testUpdateNotification() $this->handler->updateNotification($apiNotification, $updateStruct); } - public function testCountNotifications() + public function testCountNotifications(): void { $ownerId = 10; $expectedCount = 12; @@ -162,7 +163,7 @@ public function testCountNotifications() self::assertEquals($expectedCount, $this->handler->countNotifications($ownerId)); } - public function testLoadUserNotifications() + public function testLoadUserNotifications(): void { $ownerId = 9; $limit = 5; @@ -195,7 +196,7 @@ public function testLoadUserNotifications() self::assertEquals($objects, $this->handler->loadUserNotifications($ownerId, $offset, $limit)); } - public function testDelete() + public function testDelete(): void { $notification = new APINotification([ 'id' => self::NOTIFICATION_ID, /* ... */ diff --git a/tests/lib/Persistence/Legacy/Notification/MapperTest.php b/tests/lib/Persistence/Legacy/Notification/MapperTest.php index 9925250d1b..6f3ace8093 100644 --- a/tests/lib/Persistence/Legacy/Notification/MapperTest.php +++ b/tests/lib/Persistence/Legacy/Notification/MapperTest.php @@ -19,14 +19,14 @@ class MapperTest extends TestCase { /** @var \Ibexa\Core\Persistence\Legacy\Notification\Mapper */ - private $mapper; + private Mapper $mapper; protected function setUp(): void { $this->mapper = new Mapper(); } - public function testExtractNotificationsFromRows() + public function testExtractNotificationsFromRows(): void { $rows = [ [ @@ -77,7 +77,7 @@ public function testExtractNotificationsFromRows() self::assertEquals($objects, $this->mapper->extractNotificationsFromRows($rows)); } - public function testExtractNotificationsFromRowsThrowsRuntimeException() + public function testExtractNotificationsFromRowsThrowsRuntimeException(): void { $this->expectException(\RuntimeException::class); @@ -95,7 +95,7 @@ public function testExtractNotificationsFromRowsThrowsRuntimeException() $this->mapper->extractNotificationsFromRows($rows); } - public function testCreateNotificationFromUpdateStruct() + public function testCreateNotificationFromUpdateStruct(): void { $updateStruct = new UpdateStruct([ 'isPending' => false, diff --git a/tests/lib/Persistence/Legacy/Setting/SettingHandlerTest.php b/tests/lib/Persistence/Legacy/Setting/SettingHandlerTest.php index 32feb226b5..a4206809e4 100644 --- a/tests/lib/Persistence/Legacy/Setting/SettingHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Setting/SettingHandlerTest.php @@ -19,11 +19,10 @@ */ final class SettingHandlerTest extends TestCase { - /** @var \Ibexa\Core\Persistence\Legacy\Setting\Handler */ - private $settingHandler; + private ?Handler $settingHandler = null; /** @var \Ibexa\Core\Persistence\Legacy\Setting\Gateway */ - private $gatewayMock; + private ?MockObject $gatewayMock = null; public function testCreate(): void { diff --git a/tests/lib/Persistence/Legacy/SharedGateway/GatewayFactoryTest.php b/tests/lib/Persistence/Legacy/SharedGateway/GatewayFactoryTest.php index eaa58621ac..dce138ecea 100644 --- a/tests/lib/Persistence/Legacy/SharedGateway/GatewayFactoryTest.php +++ b/tests/lib/Persistence/Legacy/SharedGateway/GatewayFactoryTest.php @@ -22,7 +22,7 @@ final class GatewayFactoryTest extends TestCase { /** @var \Ibexa\Core\Persistence\Legacy\SharedGateway\GatewayFactory */ - private $factory; + private GatewayFactory $factory; /** * @throws \Doctrine\DBAL\DBALException diff --git a/tests/lib/Persistence/Legacy/TestCase.php b/tests/lib/Persistence/Legacy/TestCase.php index d087e5ba7e..1ba1246df5 100644 --- a/tests/lib/Persistence/Legacy/TestCase.php +++ b/tests/lib/Persistence/Legacy/TestCase.php @@ -18,6 +18,7 @@ use Ibexa\Contracts\Core\Test\Persistence\Fixture\YamlFixture; use Ibexa\Contracts\Core\Test\Repository\SetupFactory\Legacy; use Ibexa\Core\Persistence\Legacy\SharedGateway; +use Ibexa\Core\Persistence\Legacy\SharedGateway\Gateway; use Ibexa\Core\Search\Legacy\Content; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriteriaConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\CriterionHandler; @@ -59,8 +60,7 @@ abstract class TestCase extends BaseTestCase */ protected $connection; - /** @var \Ibexa\Core\Persistence\Legacy\SharedGateway\Gateway */ - private $sharedGateway; + private ?Gateway $sharedGateway = null; /** * Get data source name. @@ -108,7 +108,7 @@ final public function getDatabaseConnection(): Connection /** * @throws \Doctrine\DBAL\DBALException */ - final public function getSharedGateway(): SharedGateway\Gateway + final public function getSharedGateway(): Gateway { if (!$this->sharedGateway) { $connection = $this->getDatabaseConnection(); diff --git a/tests/lib/Persistence/Legacy/TransactionHandlerTest.php b/tests/lib/Persistence/Legacy/TransactionHandlerTest.php index 98ae8e3372..685f15d142 100644 --- a/tests/lib/Persistence/Legacy/TransactionHandlerTest.php +++ b/tests/lib/Persistence/Legacy/TransactionHandlerTest.php @@ -12,6 +12,7 @@ use Ibexa\Core\Persistence\Legacy\Content\Language\CachingHandler; use Ibexa\Core\Persistence\Legacy\Content\Type\MemoryCachingHandler; use Ibexa\Core\Persistence\Legacy\TransactionHandler; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -27,15 +28,15 @@ class TransactionHandlerTest extends TestCase protected $transactionHandler; /** @var \Doctrine\DBAL\Connection|\PHPUnit\Framework\MockObject\MockObject */ - protected $connectionMock; + protected ?MockObject $connectionMock = null; /** @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler|\PHPUnit\Framework\MockObject\MockObject */ - protected $contentTypeHandlerMock; + protected ?MockObject $contentTypeHandlerMock = null; /** @var \Ibexa\Contracts\Core\Persistence\Content\Language\Handler|\PHPUnit\Framework\MockObject\MockObject */ - protected $languageHandlerMock; + protected ?MockObject $languageHandlerMock = null; - public function testBeginTransaction() + public function testBeginTransaction(): void { $handler = $this->getTransactionHandler(); $this->getConnectionMock() @@ -51,7 +52,7 @@ public function testBeginTransaction() $handler->beginTransaction(); } - public function testCommit() + public function testCommit(): void { $handler = $this->getTransactionHandler(); $this->getConnectionMock() @@ -67,7 +68,7 @@ public function testCommit() $handler->commit(); } - public function testCommitException() + public function testCommitException(): void { $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('test'); @@ -87,7 +88,7 @@ public function testCommitException() $handler->commit(); } - public function testRollback() + public function testRollback(): void { $handler = $this->getTransactionHandler(); $this->getConnectionMock() @@ -103,7 +104,7 @@ public function testRollback() $handler->rollback(); } - public function testRollbackException() + public function testRollbackException(): void { $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('test'); diff --git a/tests/lib/Persistence/Legacy/URL/Gateway/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/URL/Gateway/DoctrineDatabaseTest.php index 39a8a89e67..4989906794 100644 --- a/tests/lib/Persistence/Legacy/URL/Gateway/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/URL/Gateway/DoctrineDatabaseTest.php @@ -21,10 +21,8 @@ class DoctrineDatabaseTest extends TestCase { /** * Database gateway to test. - * - * @var \Ibexa\Core\Persistence\Legacy\URL\Gateway\DoctrineDatabase */ - private $gateway; + private ?DoctrineDatabase $gateway = null; /** @var array[] */ private $fixtureData; diff --git a/tests/lib/Persistence/Legacy/URL/HandlerTest.php b/tests/lib/Persistence/Legacy/URL/HandlerTest.php index bcf3201ffc..57d3fc78ec 100644 --- a/tests/lib/Persistence/Legacy/URL/HandlerTest.php +++ b/tests/lib/Persistence/Legacy/URL/HandlerTest.php @@ -16,18 +16,19 @@ use Ibexa\Core\Persistence\Legacy\URL\Gateway; use Ibexa\Core\Persistence\Legacy\URL\Handler; use Ibexa\Core\Persistence\Legacy\URL\Mapper; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class HandlerTest extends TestCase { /** @var \Ibexa\Core\Persistence\Legacy\URL\Gateway|\PHPUnit\Framework\MockObject\MockObject */ - private $gateway; + private MockObject $gateway; /** @var \Ibexa\Core\Persistence\Legacy\URL\Mapper|\PHPUnit\Framework\MockObject\MockObject */ - private $mapper; + private MockObject $mapper; /** @var \Ibexa\Core\Persistence\Legacy\URL\Handler */ - private $handler; + private Handler $handler; protected function setUp(): void { @@ -37,7 +38,7 @@ protected function setUp(): void $this->handler = new Handler($this->gateway, $this->mapper); } - public function testUpdateUrl() + public function testUpdateUrl(): void { $urlUpdateStruct = new URLUpdateStruct(); $url = $this->getUrl(1, 'http://ibexa.co'); @@ -56,7 +57,7 @@ public function testUpdateUrl() self::assertEquals($url, $this->handler->updateUrl($url->id, $urlUpdateStruct)); } - public function testFind() + public function testFind(): void { $query = new URLQuery(); $query->filter = new Criterion\Validity(true); @@ -98,7 +99,7 @@ public function testFind() self::assertEquals($expected, $this->handler->find($query)); } - public function testLoadByIdWithoutUrlData() + public function testLoadByIdWithoutUrlData(): void { $this->expectException(NotFoundException::class); @@ -119,7 +120,7 @@ public function testLoadByIdWithoutUrlData() $this->handler->loadById($id); } - public function testLoadByIdWithUrlData() + public function testLoadByIdWithUrlData(): void { $url = $this->getUrl(1, 'http://ibexa.co'); @@ -138,7 +139,7 @@ public function testLoadByIdWithUrlData() self::assertEquals($url, $this->handler->loadById($url->id)); } - public function testLoadByUrlWithoutUrlData() + public function testLoadByUrlWithoutUrlData(): void { $this->expectException(NotFoundException::class); @@ -159,7 +160,7 @@ public function testLoadByUrlWithoutUrlData() $this->handler->loadByUrl($url); } - public function testLoadByUrlWithUrlData() + public function testLoadByUrlWithUrlData(): void { $url = $this->getUrl(1, 'http://ibexa.co'); @@ -178,7 +179,7 @@ public function testLoadByUrlWithUrlData() self::assertEquals($url, $this->handler->loadByUrl($url->url)); } - public function testFindUsages() + public function testFindUsages(): void { $url = $this->getUrl(); $ids = [1, 2, 3]; @@ -192,7 +193,7 @@ public function testFindUsages() self::assertEquals($ids, $this->handler->findUsages($url->id)); } - private function getUrl($id = 1, $urlAddr = 'http://ibexa.co') + private function getUrl(int $id = 1, string $urlAddr = 'http://ibexa.co'): URL { $url = new URL(); $url->id = $id; diff --git a/tests/lib/Persistence/Legacy/URL/MapperTest.php b/tests/lib/Persistence/Legacy/URL/MapperTest.php index c60cd23725..5690df7fae 100644 --- a/tests/lib/Persistence/Legacy/URL/MapperTest.php +++ b/tests/lib/Persistence/Legacy/URL/MapperTest.php @@ -15,7 +15,7 @@ class MapperTest extends TestCase { /** @var \Ibexa\Core\Persistence\Legacy\URL\Mapper */ - private $mapper; + private Mapper $mapper; protected function setUp(): void { @@ -23,7 +23,7 @@ protected function setUp(): void $this->mapper = new Mapper(); } - public function testCreateURLFromUpdateStruct() + public function testCreateURLFromUpdateStruct(): void { $urlUpdateStruct = new URLUpdateStruct(); $urlUpdateStruct->url = 'https://ibexa.co'; @@ -42,7 +42,7 @@ public function testCreateURLFromUpdateStruct() self::assertEquals($expected, $this->mapper->createURLFromUpdateStruct($urlUpdateStruct)); } - public function testExtractURLsFromRows() + public function testExtractURLsFromRows(): void { $rows = [ [ diff --git a/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/CriterionHandlerTest.php b/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/CriterionHandlerTest.php index 790ac83442..191ae2eb1a 100644 --- a/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/CriterionHandlerTest.php +++ b/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/CriterionHandlerTest.php @@ -27,7 +27,7 @@ abstract public function testHandle(); * @param \Ibexa\Core\Persistence\Legacy\URL\Query\CriterionHandler $handler * @param string $criterionClass */ - protected function assertHandlerAcceptsCriterion(CriterionHandler $handler, $criterionClass) + protected function assertHandlerAcceptsCriterion(CriterionHandler $handler, string $criterionClass) { self::assertTrue($handler->accept($this->createMock($criterionClass))); } @@ -38,7 +38,7 @@ protected function assertHandlerAcceptsCriterion(CriterionHandler $handler, $cri * @param \Ibexa\Core\Persistence\Legacy\URL\Query\CriterionHandler $handler * @param string $criterionClass */ - protected function assertHandlerRejectsCriterion(CriterionHandler $handler, $criterionClass) + protected function assertHandlerRejectsCriterion(CriterionHandler $handler, string $criterionClass) { self::assertFalse($handler->accept($this->createMock($criterionClass))); } diff --git a/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalAndTest.php b/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalAndTest.php index 618d5c98ae..a54c888f9a 100644 --- a/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalAndTest.php +++ b/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalAndTest.php @@ -18,7 +18,7 @@ class LogicalAndTest extends CriterionHandlerTest /** * {@inheritdoc} */ - public function testAccept() + public function testAccept(): void { $handler = new LogicalAndHandler(); diff --git a/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalNotTest.php b/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalNotTest.php index 526cf4194e..18503ab417 100644 --- a/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalNotTest.php +++ b/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalNotTest.php @@ -18,7 +18,7 @@ class LogicalNotTest extends CriterionHandlerTest /** * {@inheritdoc} */ - public function testAccept() + public function testAccept(): void { $handler = new LogicalNotHandler(); diff --git a/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalOrTest.php b/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalOrTest.php index dfcfec0b65..23bb74b4cc 100644 --- a/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalOrTest.php +++ b/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/LogicalOrTest.php @@ -18,7 +18,7 @@ class LogicalOrTest extends CriterionHandlerTest /** * {@inheritdoc} */ - public function testAccept() + public function testAccept(): void { $handler = new LogicalOrHandler(); diff --git a/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/MatchAllTest.php b/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/MatchAllTest.php index c6f19e1e45..4d9aa2e015 100644 --- a/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/MatchAllTest.php +++ b/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/MatchAllTest.php @@ -18,7 +18,7 @@ class MatchAllTest extends CriterionHandlerTest /** * {@inheritdoc} */ - public function testAccept() + public function testAccept(): void { $handler = new MatchAllHandler(); @@ -29,7 +29,7 @@ public function testAccept() /** * {@inheritdoc} */ - public function testHandle() + public function testHandle(): void { $criterion = new MatchAll(); $expected = '1 = 1'; diff --git a/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/MatchNoneTest.php b/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/MatchNoneTest.php index a770d82cbd..01643dcdc3 100644 --- a/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/MatchNoneTest.php +++ b/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/MatchNoneTest.php @@ -18,7 +18,7 @@ class MatchNoneTest extends CriterionHandlerTest /** * {@inheritdoc} */ - public function testAccept() + public function testAccept(): void { $handler = new MatchNoneHandler(); @@ -29,7 +29,7 @@ public function testAccept() /** * {@inheritdoc} */ - public function testHandle() + public function testHandle(): void { $criterion = new MatchNone(); $expected = '1 = 0'; diff --git a/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/PatternTest.php b/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/PatternTest.php index 9d561f2cc1..a63555872d 100644 --- a/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/PatternTest.php +++ b/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/PatternTest.php @@ -20,7 +20,7 @@ class PatternTest extends CriterionHandlerTest /** * {@inheritdoc} */ - public function testAccept() + public function testAccept(): void { $handler = new PatternHandler(); @@ -31,7 +31,7 @@ public function testAccept() /** * {@inheritdoc} */ - public function testHandle() + public function testHandle(): void { $criterion = new Pattern('google.com'); $expected = 'url LIKE :pattern'; diff --git a/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/ValidityTest.php b/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/ValidityTest.php index ef925377df..8f7d995896 100644 --- a/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/ValidityTest.php +++ b/tests/lib/Persistence/Legacy/URL/Query/CriterionHandler/ValidityTest.php @@ -20,7 +20,7 @@ class ValidityTest extends CriterionHandlerTest /** * {@inheritdoc} */ - public function testAccept() + public function testAccept(): void { $handler = new ValidityHandler(); @@ -31,7 +31,7 @@ public function testAccept() /** * {@inheritdoc} */ - public function testHandle() + public function testHandle(): void { $criterion = new Validity(true); $expected = 'is_valid = :is_valid'; diff --git a/tests/lib/Persistence/Legacy/User/Role/LimitationConverterTest.php b/tests/lib/Persistence/Legacy/User/Role/LimitationConverterTest.php index bfae2fa626..f984cca20d 100644 --- a/tests/lib/Persistence/Legacy/User/Role/LimitationConverterTest.php +++ b/tests/lib/Persistence/Legacy/User/Role/LimitationConverterTest.php @@ -18,7 +18,7 @@ */ class LimitationConverterTest extends TestCase { - protected function getLimitationConverter() + protected function getLimitationConverter(): LimitationConverter { $connection = $this->getDatabaseConnection(); @@ -28,7 +28,7 @@ protected function getLimitationConverter() /** * Test Object State from SPI value (supported by API) to legacy value (database). */ - public function testObjectStateToLegacy() + public function testObjectStateToLegacy(): void { $this->insertSharedDatabaseFixture(); @@ -81,7 +81,7 @@ public function testObjectStateToLegacy() /** * Test Object State from legacy value (database) to SPI value (supported by API). */ - public function testObjectStateToSPI() + public function testObjectStateToSPI(): void { $this->insertSharedDatabaseFixture(); diff --git a/tests/lib/Persistence/Legacy/User/UserHandlerTest.php b/tests/lib/Persistence/Legacy/User/UserHandlerTest.php index 4aba1f9964..4e1fe6f1b3 100644 --- a/tests/lib/Persistence/Legacy/User/UserHandlerTest.php +++ b/tests/lib/Persistence/Legacy/User/UserHandlerTest.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Persistence; use Ibexa\Contracts\Core\Persistence\User\Handler; use Ibexa\Contracts\Core\Persistence\User\Role; +use Ibexa\Contracts\Core\Persistence\User\UserTokenUpdateStruct; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException; use Ibexa\Contracts\Core\Repository\Values\User\Role as APIRole; @@ -43,7 +44,7 @@ protected function getUserHandler(User\Gateway $userGateway = null): Handler ); } - protected function getValidUser() + protected function getValidUser(): Persistence\User { $user = new Persistence\User(); $user->id = self::TEST_USER_ID; @@ -58,9 +59,9 @@ protected function getValidUser() return $user; } - protected function getValidUserToken($time = null) + protected function getValidUserToken($time = null): UserTokenUpdateStruct { - $userToken = new Persistence\User\UserTokenUpdateStruct(); + $userToken = new UserTokenUpdateStruct(); $userToken->userId = self::TEST_USER_ID; $userToken->hashKey = md5('hash'); $userToken->time = $time ?? (new DateTime())->add(new DateInterval('P1D'))->getTimestamp(); @@ -68,7 +69,7 @@ protected function getValidUserToken($time = null) return $userToken; } - public function testCreateUser() + public function testCreateUser(): void { $handler = $this->getUserHandler(); @@ -104,7 +105,7 @@ protected function getDummyUser( ]; } - public function testLoadUser() + public function testLoadUser(): void { $gatewayMock = $this ->createMock(User\Gateway::class); @@ -124,7 +125,7 @@ public function testLoadUser() ); } - public function testLoadUnknownUser() + public function testLoadUnknownUser(): void { $this->expectException(NotFoundException::class); $gatewayMock = $this @@ -140,7 +141,7 @@ public function testLoadUnknownUser() $handler->load(1337); } - public function testLoadUserByLogin() + public function testLoadUserByLogin(): void { $gatewayMock = $this ->createMock(User\Gateway::class); @@ -160,7 +161,7 @@ public function testLoadUserByLogin() ); } - public function testLoadMultipleUsersByLogin() + public function testLoadMultipleUsersByLogin(): void { $this->expectException(LogicException::class); @@ -181,7 +182,7 @@ public function testLoadMultipleUsersByLogin() $handler->loadByLogin($user->login); } - public function testLoadMultipleUsersByEmail() + public function testLoadMultipleUsersByEmail(): void { $this->expectException(LogicException::class); @@ -202,7 +203,7 @@ public function testLoadMultipleUsersByEmail() $handler->loadByEmail($user->email); } - public function testLoadUserByEmailNotFound() + public function testLoadUserByEmailNotFound(): void { $this->expectException(NotFoundException::class); @@ -212,7 +213,7 @@ public function testLoadUserByEmailNotFound() $handler->loadByLogin($user->email); } - public function testLoadUserByEmail() + public function testLoadUserByEmail(): void { $gatewayMock = $this ->createMock(User\Gateway::class); @@ -232,7 +233,7 @@ public function testLoadUserByEmail() ); } - public function testLoadUsersByEmail() + public function testLoadUsersByEmail(): void { $gatewayMock = $this ->createMock(User\Gateway::class); @@ -252,7 +253,7 @@ public function testLoadUsersByEmail() ); } - public function testLoadUserByTokenNotFound() + public function testLoadUserByTokenNotFound(): void { $this->expectException(NotFoundException::class); @@ -262,7 +263,7 @@ public function testLoadUserByTokenNotFound() $handler->loadUserByToken('asd'); } - public function testLoadUserByToken() + public function testLoadUserByToken(): void { $gatewayMock = $this ->createMock(User\Gateway::class); @@ -284,7 +285,7 @@ public function testLoadUserByToken() ); } - public function testUpdateUserToken() + public function testUpdateUserToken(): void { $handler = $this->getUserHandler(); @@ -309,7 +310,7 @@ public function testUpdateUserToken() ); } - public function testExpireUserToken() + public function testExpireUserToken(): void { $handler = $this->getUserHandler(); @@ -334,7 +335,7 @@ public function testExpireUserToken() ); } - public function testDeleteNonExistingUser() + public function testDeleteNonExistingUser(): void { $handler = $this->getUserHandler(); @@ -342,7 +343,7 @@ public function testDeleteNonExistingUser() $handler->delete(1337); } - public function testUpdateUser() + public function testUpdateUser(): void { $handler = $this->getUserHandler(); $user = $this->getValidUser(); @@ -352,7 +353,7 @@ public function testUpdateUser() $handler->update($user); } - public function testUpdateUserSettings() + public function testUpdateUserSettings(): void { $handler = $this->getUserHandler(); $user = $this->getValidUser(); @@ -362,7 +363,7 @@ public function testUpdateUserSettings() $handler->update($user); } - public function testCreateNewRoleWithoutPolicies() + public function testCreateNewRoleWithoutPolicies(): void { $handler = $this->getUserHandler(); @@ -378,7 +379,7 @@ public function testCreateNewRoleWithoutPolicies() ); } - public function testCreateRoleDraftWithoutPolicies() + public function testCreateRoleDraftWithoutPolicies(): void { $handler = $this->getUserHandler(); @@ -401,7 +402,7 @@ public function testCreateRoleDraftWithoutPolicies() ); } - public function testCreateNewRoleRoleId() + public function testCreateNewRoleRoleId(): void { $handler = $this->getUserHandler(); @@ -413,7 +414,7 @@ public function testCreateNewRoleRoleId() self::assertSame(1, $roleDraft->id); } - public function testLoadRole() + public function testLoadRole(): void { $handler = $this->getUserHandler(); @@ -430,7 +431,7 @@ public function testLoadRole() ); } - public function testLoadRoleWithPolicies() + public function testLoadRoleWithPolicies(): void { $handler = $this->getUserHandler(); @@ -464,7 +465,7 @@ public function testLoadRoleWithPolicies() ); } - public function testLoadRoleWithPoliciesAndGroups() + public function testLoadRoleWithPoliciesAndGroups(): void { $handler = $this->getUserHandler(); @@ -502,7 +503,7 @@ public function testLoadRoleWithPoliciesAndGroups() ); } - public function testLoadRoleWithPolicyLimitations() + public function testLoadRoleWithPolicyLimitations(): void { $handler = $this->getUserHandler(); @@ -543,7 +544,7 @@ public function testLoadRoleWithPolicyLimitations() ); } - public function testLoadRoles() + public function testLoadRoles(): void { $handler = $this->getUserHandler(); @@ -560,7 +561,7 @@ public function testLoadRoles() ); } - public function testUpdateRole() + public function testUpdateRole(): void { $handler = $this->getUserHandler(); @@ -579,7 +580,7 @@ public function testUpdateRole() ); } - public function testDeleteRole() + public function testDeleteRole(): void { $this->insertSharedDatabaseFixture(); $handler = $this->getUserHandler(); @@ -606,7 +607,7 @@ public function testDeleteRole() ); } - public function testDeleteRoleDraft() + public function testDeleteRoleDraft(): void { $this->insertSharedDatabaseFixture(); $handler = $this->getUserHandler(); @@ -634,7 +635,7 @@ public function testDeleteRoleDraft() ); } - public function testAddPolicyToRoleLimitations() + public function testAddPolicyToRoleLimitations(): void { $handler = $this->getUserHandler(); @@ -653,7 +654,7 @@ public function testAddPolicyToRoleLimitations() ); } - public function testAddPolicyPolicyId() + public function testAddPolicyPolicyId(): void { $handler = $this->getUserHandler(); @@ -668,7 +669,7 @@ public function testAddPolicyPolicyId() self::assertEquals(1, $policy->id); } - public function testAddPolicyLimitations() + public function testAddPolicyLimitations(): void { $this->createTestRoleWithTestPolicy(); @@ -682,7 +683,7 @@ public function testAddPolicyLimitations() ); } - public function testAddPolicyLimitationValues() + public function testAddPolicyLimitationValues(): void { $this->createTestRoleWithTestPolicy(); @@ -723,7 +724,7 @@ protected function createRole() return $handler->createRole($createStruct); } - public function testImplicitlyCreatePolicies() + public function testImplicitlyCreatePolicies(): void { $this->createRole(); @@ -737,7 +738,7 @@ public function testImplicitlyCreatePolicies() ); } - public function testDeletePolicy() + public function testDeletePolicy(): void { $handler = $this->getUserHandler(); @@ -754,7 +755,7 @@ public function testDeletePolicy() ); } - public function testDeletePolicyLimitations() + public function testDeletePolicyLimitations(): void { $handler = $this->getUserHandler(); @@ -767,7 +768,7 @@ public function testDeletePolicyLimitations() ); } - public function testDeletePolicyLimitationValues() + public function testDeletePolicyLimitationValues(): void { $handler = $this->getUserHandler(); @@ -780,7 +781,7 @@ public function testDeletePolicyLimitationValues() ); } - public function testUpdatePolicies() + public function testUpdatePolicies(): void { $handler = $this->getUserHandler(); @@ -810,7 +811,7 @@ public function testUpdatePolicies() ); } - public function testAddRoleToUser() + public function testAddRoleToUser(): void { $handler = $this->getUserHandler(); @@ -830,7 +831,7 @@ public function testAddRoleToUser() ); } - public function testAddRoleToUserWithLimitation() + public function testAddRoleToUserWithLimitation(): void { $handler = $this->getUserHandler(); @@ -856,7 +857,7 @@ public function testAddRoleToUserWithLimitation() ); } - public function testAddRoleToUserWithComplexLimitation() + public function testAddRoleToUserWithComplexLimitation(): void { $handler = $this->getUserHandler(); @@ -885,7 +886,7 @@ public function testAddRoleToUserWithComplexLimitation() ); } - public function testRemoveUserRoleAssociation() + public function testRemoveUserRoleAssociation(): void { $handler = $this->getUserHandler(); @@ -912,7 +913,7 @@ public function testRemoveUserRoleAssociation() ); } - public function testLoadRoleAssignmentsByGroupId() + public function testLoadRoleAssignmentsByGroupId(): void { $this->insertSharedDatabaseFixture(); $handler = $this->getUserHandler(); @@ -956,7 +957,7 @@ public function testLoadRoleAssignmentsByGroupId() ); } - public function testLoadRoleAssignmentsByGroupIdInherited() + public function testLoadRoleAssignmentsByGroupIdInherited(): void { $this->insertSharedDatabaseFixture(); $handler = $this->getUserHandler(); @@ -975,7 +976,7 @@ public function testLoadRoleAssignmentsByGroupIdInherited() ); } - public function testLoadComplexRoleAssignments() + public function testLoadComplexRoleAssignments(): void { $this->insertSharedDatabaseFixture(); $handler = $this->getUserHandler(); @@ -1102,7 +1103,7 @@ public function testLoadRoleAssignmentsByRoleIdWithOffsetAndLimit(): void ); } - public function testLoadRoleDraftByRoleId() + public function testLoadRoleDraftByRoleId(): void { $this->insertSharedDatabaseFixture(); $handler = $this->getUserHandler(); @@ -1115,7 +1116,7 @@ public function testLoadRoleDraftByRoleId() self::assertEquals($draft, $loadedDraft); } - public function testRoleDraftOnlyHavePolicyDraft() + public function testRoleDraftOnlyHavePolicyDraft(): void { $this->insertSharedDatabaseFixture(); $handler = $this->getUserHandler(); diff --git a/tests/lib/Persistence/Legacy/UserPreference/Gateway/DoctrineDatabaseTest.php b/tests/lib/Persistence/Legacy/UserPreference/Gateway/DoctrineDatabaseTest.php index 29ebce5b2d..54c3dd60b5 100644 --- a/tests/lib/Persistence/Legacy/UserPreference/Gateway/DoctrineDatabaseTest.php +++ b/tests/lib/Persistence/Legacy/UserPreference/Gateway/DoctrineDatabaseTest.php @@ -37,7 +37,7 @@ protected function setUp(): void ); } - public function testInsert() + public function testInsert(): void { $id = $this->getGateway()->setUserPreference(new UserPreferenceSetStruct([ 'userId' => 14, @@ -55,7 +55,7 @@ public function testInsert() ], $data); } - public function testUpdateUserPreference() + public function testUpdateUserPreference(): void { $userPreference = new UserPreferenceSetStruct([ 'userId' => 14, @@ -73,14 +73,14 @@ public function testUpdateUserPreference() ], $this->loadUserPreference(self::EXISTING_USER_PREFERENCE_ID)); } - public function testCountUserPreferences() + public function testCountUserPreferences(): void { self::assertEquals(3, $this->getGateway()->countUserPreferences( self::EXISTING_USER_PREFERENCE_DATA['user_id'] )); } - public function testLoadUserPreferences() + public function testLoadUserPreferences(): void { $userId = 14; $offset = 1; diff --git a/tests/lib/Persistence/Legacy/UserPreference/HandlerTest.php b/tests/lib/Persistence/Legacy/UserPreference/HandlerTest.php index 5a4f89fb28..b87e53d465 100644 --- a/tests/lib/Persistence/Legacy/UserPreference/HandlerTest.php +++ b/tests/lib/Persistence/Legacy/UserPreference/HandlerTest.php @@ -13,6 +13,7 @@ use Ibexa\Core\Persistence\Legacy\UserPreference\Gateway; use Ibexa\Core\Persistence\Legacy\UserPreference\Handler; use Ibexa\Core\Persistence\Legacy\UserPreference\Mapper; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -23,13 +24,13 @@ class HandlerTest extends TestCase public const USER_PREFERENCE_ID = 1; /** @var \Ibexa\Core\Persistence\Legacy\UserPreference\Gateway|\PHPUnit\Framework\MockObject\MockObject */ - private $gateway; + private MockObject $gateway; /** @var \Ibexa\Core\Persistence\Legacy\UserPreference\Mapper|\PHPUnit\Framework\MockObject\MockObject */ - private $mapper; + private MockObject $mapper; /** @var \Ibexa\Core\Persistence\Legacy\UserPreference\Handler */ - private $handler; + private Handler $handler; protected function setUp(): void { @@ -38,7 +39,7 @@ protected function setUp(): void $this->handler = new Handler($this->gateway, $this->mapper); } - public function testSetUserPreference() + public function testSetUserPreference(): void { $setStruct = new UserPreferenceSetStruct([ 'userId' => 5, @@ -64,7 +65,7 @@ public function testSetUserPreference() self::assertEquals($userPreference->id, self::USER_PREFERENCE_ID); } - public function testCountUserPreferences() + public function testCountUserPreferences(): void { $ownerId = 10; $expectedCount = 12; @@ -78,7 +79,7 @@ public function testCountUserPreferences() self::assertEquals($expectedCount, $this->handler->countUserPreferences($ownerId)); } - public function testLoadUserPreferences() + public function testLoadUserPreferences(): void { $ownerId = 9; $limit = 5; diff --git a/tests/lib/Persistence/Legacy/UserPreference/MapperTest.php b/tests/lib/Persistence/Legacy/UserPreference/MapperTest.php index d0a6c322e1..1eea2a0439 100644 --- a/tests/lib/Persistence/Legacy/UserPreference/MapperTest.php +++ b/tests/lib/Persistence/Legacy/UserPreference/MapperTest.php @@ -18,14 +18,14 @@ class MapperTest extends TestCase { /** @var \Ibexa\Core\Persistence\Legacy\UserPreference\Mapper */ - private $mapper; + private Mapper $mapper; protected function setUp(): void { $this->mapper = new Mapper(); } - public function testExtractUserPreferencesFromRows() + public function testExtractUserPreferencesFromRows(): void { $rows = [ [ diff --git a/tests/lib/Persistence/TransformationProcessor/TransformationProcessorDefinitionBasedParserTest.php b/tests/lib/Persistence/TransformationProcessor/TransformationProcessorDefinitionBasedParserTest.php index 4ad3164640..2be1d14060 100644 --- a/tests/lib/Persistence/TransformationProcessor/TransformationProcessorDefinitionBasedParserTest.php +++ b/tests/lib/Persistence/TransformationProcessor/TransformationProcessorDefinitionBasedParserTest.php @@ -24,7 +24,7 @@ public static function getTestFiles(): array return false !== $glob ? array_map( - static function (string $file) { + static function (string $file): array { return [realpath($file)]; }, $glob @@ -35,7 +35,7 @@ static function (string $file) { /** * @dataProvider getTestFiles */ - public function testParse($file) + public function testParse(string $file): void { $parser = new Persistence\TransformationProcessor\DefinitionBased\Parser(); diff --git a/tests/lib/Persistence/TransformationProcessor/TransformationProcessorDefinitionBasedTest.php b/tests/lib/Persistence/TransformationProcessor/TransformationProcessorDefinitionBasedTest.php index 35aff7f339..6cf956acbf 100644 --- a/tests/lib/Persistence/TransformationProcessor/TransformationProcessorDefinitionBasedTest.php +++ b/tests/lib/Persistence/TransformationProcessor/TransformationProcessorDefinitionBasedTest.php @@ -16,16 +16,16 @@ */ class TransformationProcessorDefinitionBasedTest extends TestCase { - public function getProcessor() + public function getProcessor(): DefinitionBased { return new DefinitionBased( - new Persistence\TransformationProcessor\DefinitionBased\Parser(), + new DefinitionBased\Parser(), new Persistence\TransformationProcessor\PcreCompiler(new Persistence\Utf8Converter()), glob(__DIR__ . '/_fixtures/transformations/*.tr') ); } - public function testSimpleNormalizationLowercase() + public function testSimpleNormalizationLowercase(): void { $processor = $this->getProcessor(); @@ -35,7 +35,7 @@ public function testSimpleNormalizationLowercase() ); } - public function testSimpleNormalizationUppercase() + public function testSimpleNormalizationUppercase(): void { $processor = $this->getProcessor(); @@ -45,7 +45,7 @@ public function testSimpleNormalizationUppercase() ); } - public function testApplyAllLowercaseNormalizations() + public function testApplyAllLowercaseNormalizations(): void { $processor = $this->getProcessor(); @@ -60,7 +60,7 @@ public function testApplyAllLowercaseNormalizations() * available can be compiled without errors. The actual expectation is not * important. */ - public function testAllNormalizations() + public function testAllNormalizations(): void { $processor = $this->getProcessor(); diff --git a/tests/lib/Persistence/TransformationProcessor/TransformationProcessorPcreCompilerTest.php b/tests/lib/Persistence/TransformationProcessor/TransformationProcessorPcreCompilerTest.php index bda7c272a3..03dcf91940 100644 --- a/tests/lib/Persistence/TransformationProcessor/TransformationProcessorPcreCompilerTest.php +++ b/tests/lib/Persistence/TransformationProcessor/TransformationProcessorPcreCompilerTest.php @@ -34,7 +34,7 @@ protected function applyTransformations(array $transformations, $string) return $string; } - public function testCompileMap() + public function testCompileMap(): void { $parser = new Persistence\TransformationProcessor\DefinitionBased\Parser(self::getInstallationDir()); $compiler = new Persistence\TransformationProcessor\PcreCompiler(new Persistence\Utf8Converter()); @@ -52,7 +52,7 @@ public function testCompileMap() ); } - public function testCompileMapRemove() + public function testCompileMapRemove(): void { $parser = new Persistence\TransformationProcessor\DefinitionBased\Parser(self::getInstallationDir()); $compiler = new Persistence\TransformationProcessor\PcreCompiler(new Persistence\Utf8Converter()); @@ -70,7 +70,7 @@ public function testCompileMapRemove() ); } - public function testCompileMapKeep() + public function testCompileMapKeep(): void { $parser = new Persistence\TransformationProcessor\DefinitionBased\Parser(self::getInstallationDir()); $compiler = new Persistence\TransformationProcessor\PcreCompiler(new Persistence\Utf8Converter()); @@ -88,7 +88,7 @@ public function testCompileMapKeep() ); } - public function testCompileMapAscii() + public function testCompileMapAscii(): void { $parser = new Persistence\TransformationProcessor\DefinitionBased\Parser(self::getInstallationDir()); $compiler = new Persistence\TransformationProcessor\PcreCompiler(new Persistence\Utf8Converter()); @@ -106,7 +106,7 @@ public function testCompileMapAscii() ); } - public function testCompileMapUnicode() + public function testCompileMapUnicode(): void { $parser = new Persistence\TransformationProcessor\DefinitionBased\Parser(self::getInstallationDir()); $compiler = new Persistence\TransformationProcessor\PcreCompiler(new Persistence\Utf8Converter()); @@ -124,7 +124,7 @@ public function testCompileMapUnicode() ); } - public function testCompileReplace() + public function testCompileReplace(): void { $parser = new Persistence\TransformationProcessor\DefinitionBased\Parser(self::getInstallationDir()); $compiler = new Persistence\TransformationProcessor\PcreCompiler(new Persistence\Utf8Converter()); @@ -142,7 +142,7 @@ public function testCompileReplace() ); } - public function testCompileTranspose() + public function testCompileTranspose(): void { $parser = new Persistence\TransformationProcessor\DefinitionBased\Parser(self::getInstallationDir()); $compiler = new Persistence\TransformationProcessor\PcreCompiler(new Persistence\Utf8Converter()); @@ -160,7 +160,7 @@ public function testCompileTranspose() ); } - public function testCompileTransposeAsciiLowercase() + public function testCompileTransposeAsciiLowercase(): void { $parser = new Persistence\TransformationProcessor\DefinitionBased\Parser(self::getInstallationDir()); $compiler = new Persistence\TransformationProcessor\PcreCompiler(new Persistence\Utf8Converter()); @@ -178,7 +178,7 @@ public function testCompileTransposeAsciiLowercase() ); } - public function testCompileTransposePlus() + public function testCompileTransposePlus(): void { $parser = new Persistence\TransformationProcessor\DefinitionBased\Parser(self::getInstallationDir()); $compiler = new Persistence\TransformationProcessor\PcreCompiler(new Persistence\Utf8Converter()); @@ -196,7 +196,7 @@ public function testCompileTransposePlus() ); } - public function testCompileModuloTranspose() + public function testCompileModuloTranspose(): void { $parser = new Persistence\TransformationProcessor\DefinitionBased\Parser(self::getInstallationDir()); $compiler = new Persistence\TransformationProcessor\PcreCompiler(new Persistence\Utf8Converter()); diff --git a/tests/lib/Persistence/TransformationProcessor/TransformationProcessorPreprocessedBasedTest.php b/tests/lib/Persistence/TransformationProcessor/TransformationProcessorPreprocessedBasedTest.php index 64402965da..60a185a7e1 100644 --- a/tests/lib/Persistence/TransformationProcessor/TransformationProcessorPreprocessedBasedTest.php +++ b/tests/lib/Persistence/TransformationProcessor/TransformationProcessorPreprocessedBasedTest.php @@ -16,7 +16,7 @@ */ class TransformationProcessorPreprocessedBasedTest extends TestCase { - public function getProcessor() + public function getProcessor(): PreprocessedBased { return new PreprocessedBased( new Persistence\TransformationProcessor\PcreCompiler(new Persistence\Utf8Converter()), @@ -24,7 +24,7 @@ public function getProcessor() ); } - public function testSimpleNormalizationLowercase() + public function testSimpleNormalizationLowercase(): void { $processor = $this->getProcessor(); @@ -34,7 +34,7 @@ public function testSimpleNormalizationLowercase() ); } - public function testSimpleNormalizationUppercase() + public function testSimpleNormalizationUppercase(): void { $processor = $this->getProcessor(); @@ -49,7 +49,7 @@ public function testSimpleNormalizationUppercase() * available can be compiled without errors. The actual expectation is not * important. */ - public function testAllNormalizations() + public function testAllNormalizations(): void { $processor = $this->getProcessor(); diff --git a/tests/lib/Query/QueryFactoryTest.php b/tests/lib/Query/QueryFactoryTest.php index bd5b015cd2..d80e85b38c 100644 --- a/tests/lib/Query/QueryFactoryTest.php +++ b/tests/lib/Query/QueryFactoryTest.php @@ -13,6 +13,7 @@ use Ibexa\Core\QueryType\QueryType; use Ibexa\Core\QueryType\QueryTypeRegistry; use Ibexa\Tests\Core\Search\TestCase; +use PHPUnit\Framework\MockObject\MockObject; final class QueryFactoryTest extends TestCase { @@ -24,10 +25,10 @@ final class QueryFactoryTest extends TestCase ]; /** @var \Ibexa\Core\QueryType\QueryTypeRegistry|\PHPUnit\Framework\MockObject\MockObject */ - private $queryTypeRegistry; + private MockObject $queryTypeRegistry; /** @var \Ibexa\Core\Query\QueryFactory */ - private $queryFactory; + private QueryFactory $queryFactory; protected function setUp(): void { diff --git a/tests/lib/QueryType/BuiltIn/AbstractQueryTypeTest.php b/tests/lib/QueryType/BuiltIn/AbstractQueryTypeTest.php index cfd3a21155..e06d458768 100644 --- a/tests/lib/QueryType/BuiltIn/AbstractQueryTypeTest.php +++ b/tests/lib/QueryType/BuiltIn/AbstractQueryTypeTest.php @@ -15,6 +15,7 @@ use Ibexa\Core\QueryType\BuiltIn\SortClausesFactoryInterface; use Ibexa\Core\QueryType\QueryType; use Ibexa\Core\Repository\Values\Content\Location; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; abstract class AbstractQueryTypeTest extends TestCase @@ -23,16 +24,16 @@ abstract class AbstractQueryTypeTest extends TestCase protected const ROOT_LOCATION_PATH_STRING = '/1/2/'; /** @var \Ibexa\Contracts\Core\Repository\Repository|\PHPUnit\Framework\MockObject\MockObject */ - private $repository; + private MockObject $repository; /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $configResolver; + private MockObject $configResolver; /** @var \Ibexa\Core\QueryType\BuiltIn\SortClausesFactoryInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $sortClausesFactory; + private MockObject $sortClausesFactory; /** @var \Ibexa\Core\QueryType\QueryType */ - private $queryType; + private QueryType $queryType; protected function setUp(): void { diff --git a/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/CustomFieldSortClauseParserTest.php b/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/CustomFieldSortClauseParserTest.php index 05d1ba39da..888293578b 100644 --- a/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/CustomFieldSortClauseParserTest.php +++ b/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/CustomFieldSortClauseParserTest.php @@ -20,7 +20,7 @@ final class CustomFieldSortClauseParserTest extends TestCase private const EXAMPLE_SEARCH_INDEX_FIELD = 'custom_field_s'; /** @var \Ibexa\Core\QueryType\BuiltIn\SortSpec\SortClauseParser\CustomFieldSortClauseParser */ - private $parser; + private CustomFieldSortClauseParser $parser; protected function setUp(): void { diff --git a/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/DefaultSortClauseParserTest.php b/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/DefaultSortClauseParserTest.php index a59ee3c171..dc60e1610b 100644 --- a/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/DefaultSortClauseParserTest.php +++ b/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/DefaultSortClauseParserTest.php @@ -19,7 +19,7 @@ final class DefaultSortClauseParserTest extends TestCase { /** @var \Ibexa\Core\QueryType\BuiltIn\SortSpec\SortClauseParser\DefaultSortClauseParser */ - private $defaultSortClauseParser; + private DefaultSortClauseParser $defaultSortClauseParser; protected function setUp(): void { diff --git a/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/FieldSortClauseParserTest.php b/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/FieldSortClauseParserTest.php index 82be846943..3477ecf50c 100644 --- a/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/FieldSortClauseParserTest.php +++ b/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/FieldSortClauseParserTest.php @@ -21,7 +21,7 @@ final class FieldSortClauseParserTest extends TestCase private const EXAMPLE_FIELD_ID = 'title'; /** @var \Ibexa\Core\QueryType\BuiltIn\SortSpec\SortClauseParser\FieldSortClauseParser */ - private $fieldSortClauseParser; + private FieldSortClauseParser $fieldSortClauseParser; protected function setUp(): void { diff --git a/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/MapDistanceSortClauseParserTest.php b/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/MapDistanceSortClauseParserTest.php index d7bcdc903e..518c8e5579 100644 --- a/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/MapDistanceSortClauseParserTest.php +++ b/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/MapDistanceSortClauseParserTest.php @@ -23,7 +23,7 @@ final class MapDistanceSortClauseParserTest extends TestCase private const EXAMPLE_LON = 19.9450; /** @var \Ibexa\Core\QueryType\BuiltIn\SortSpec\SortClauseParser\MapDistanceSortClauseParser */ - private $mapDistanceSortClauseParser; + private MapDistanceSortClauseParser $mapDistanceSortClauseParser; protected function setUp(): void { diff --git a/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/RandomSortClauseParserTest.php b/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/RandomSortClauseParserTest.php index 80bb57f29a..c540d045e5 100644 --- a/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/RandomSortClauseParserTest.php +++ b/tests/lib/QueryType/BuiltIn/SortSpec/SortClauseParser/RandomSortClauseParserTest.php @@ -20,7 +20,7 @@ final class RandomSortClauseParserTest extends TestCase private const EXAMPLE_SEED = 1; /** @var \Ibexa\Core\QueryType\BuiltIn\SortSpec\SortClauseParser\RandomSortClauseParser */ - private $randomSortClauseParser; + private RandomSortClauseParser $randomSortClauseParser; protected function setUp(): void { diff --git a/tests/lib/QueryType/BuiltIn/SortSpec/SortSpecLexerStub.php b/tests/lib/QueryType/BuiltIn/SortSpec/SortSpecLexerStub.php index 373bfe0954..3b12c477f5 100644 --- a/tests/lib/QueryType/BuiltIn/SortSpec/SortSpecLexerStub.php +++ b/tests/lib/QueryType/BuiltIn/SortSpec/SortSpecLexerStub.php @@ -17,13 +17,11 @@ final class SortSpecLexerStub implements SortSpecLexerInterface { /** @var \Ibexa\Core\QueryType\BuiltIn\SortSpec\Token[] */ - private $tokens; + private array $tokens; - /** @var string|null */ - private $input; + private ?string $input = null; - /** @var int */ - private $position; + private int $position; public function __construct(array $tokens = []) { diff --git a/tests/lib/Repository/ContentServiceTest.php b/tests/lib/Repository/ContentServiceTest.php index ce2e14a2aa..d7b859d7c5 100644 --- a/tests/lib/Repository/ContentServiceTest.php +++ b/tests/lib/Repository/ContentServiceTest.php @@ -28,7 +28,7 @@ final class ContentServiceTest extends TestCase { /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; protected function setUp(): void { diff --git a/tests/lib/Repository/ContentThumbnail/ContentFieldStrategyTest.php b/tests/lib/Repository/ContentThumbnail/ContentFieldStrategyTest.php index 01477368eb..6bc97eb4fd 100644 --- a/tests/lib/Repository/ContentThumbnail/ContentFieldStrategyTest.php +++ b/tests/lib/Repository/ContentThumbnail/ContentFieldStrategyTest.php @@ -22,8 +22,7 @@ class ContentFieldStrategyTest extends TestCase private function getFieldTypeBasedThumbnailStrategy(string $fieldTypeIdentifier): FieldTypeBasedThumbnailStrategy { return new class($fieldTypeIdentifier) implements FieldTypeBasedThumbnailStrategy { - /** @var string */ - private $fieldTypeIdentifier; + private string $fieldTypeIdentifier; public function __construct(string $fieldTypeIdentifier) { diff --git a/tests/lib/Repository/ContentThumbnail/StaticStrategyTest.php b/tests/lib/Repository/ContentThumbnail/StaticStrategyTest.php index 8466f7b65e..83449fed90 100644 --- a/tests/lib/Repository/ContentThumbnail/StaticStrategyTest.php +++ b/tests/lib/Repository/ContentThumbnail/StaticStrategyTest.php @@ -16,7 +16,7 @@ class StaticStrategyTest extends TestCase { - public function testStaticStrategy() + public function testStaticStrategy(): void { $resource = 'static-test-resource'; diff --git a/tests/lib/Repository/ContentValidator/ContentValidatorStrategyTest.php b/tests/lib/Repository/ContentValidator/ContentValidatorStrategyTest.php index 72b6225415..cbc700a3c1 100644 --- a/tests/lib/Repository/ContentValidator/ContentValidatorStrategyTest.php +++ b/tests/lib/Repository/ContentValidator/ContentValidatorStrategyTest.php @@ -86,11 +86,9 @@ public function testMergeValidationErrors(): void private function buildContentValidator(string $classSupport, array $validationReturn): ContentValidator { return new class($classSupport, $validationReturn) implements ContentValidator { - /** @var string */ - private $classSupport; + private string $classSupport; - /** @var array */ - private $validationReturn; + private array $validationReturn; public function __construct( string $classSupport, diff --git a/tests/lib/Repository/Decorator/BookmarkServiceDecoratorTest.php b/tests/lib/Repository/Decorator/BookmarkServiceDecoratorTest.php index f261461ddf..9a7fa128c5 100644 --- a/tests/lib/Repository/Decorator/BookmarkServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/BookmarkServiceDecoratorTest.php @@ -27,7 +27,7 @@ protected function createServiceMock(): MockObject return $this->createMock(BookmarkService::class); } - public function testCreateBookmarkDecorator() + public function testCreateBookmarkDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -39,7 +39,7 @@ public function testCreateBookmarkDecorator() $decoratedService->createBookmark(...$parameters); } - public function testDeleteBookmarkDecorator() + public function testDeleteBookmarkDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -51,7 +51,7 @@ public function testDeleteBookmarkDecorator() $decoratedService->deleteBookmark(...$parameters); } - public function testLoadBookmarksDecorator() + public function testLoadBookmarksDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -66,7 +66,7 @@ public function testLoadBookmarksDecorator() $decoratedService->loadBookmarks(...$parameters); } - public function testIsBookmarkedDecorator() + public function testIsBookmarkedDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php b/tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php index 60d41317d4..8c5d9e2a2b 100644 --- a/tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php @@ -43,7 +43,7 @@ protected function createServiceMock(): ContentService&MockObject return $this->createMock(ContentService::class); } - public function testLoadContentInfoDecorator() + public function testLoadContentInfoDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -55,7 +55,7 @@ public function testLoadContentInfoDecorator() $decoratedService->loadContentInfo(...$parameters); } - public function testLoadContentInfoListDecorator() + public function testLoadContentInfoListDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -67,7 +67,7 @@ public function testLoadContentInfoListDecorator() $decoratedService->loadContentInfoList(...$parameters); } - public function testLoadContentInfoByRemoteIdDecorator() + public function testLoadContentInfoByRemoteIdDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -79,7 +79,7 @@ public function testLoadContentInfoByRemoteIdDecorator() $decoratedService->loadContentInfoByRemoteId(...$parameters); } - public function testLoadVersionInfoDecorator() + public function testLoadVersionInfoDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -94,7 +94,7 @@ public function testLoadVersionInfoDecorator() $decoratedService->loadVersionInfo(...$parameters); } - public function testLoadVersionInfoByIdDecorator() + public function testLoadVersionInfoByIdDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -109,7 +109,7 @@ public function testLoadVersionInfoByIdDecorator() $decoratedService->loadVersionInfoById(...$parameters); } - public function testLoadContentByContentInfoDecorator() + public function testLoadContentByContentInfoDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -126,7 +126,7 @@ public function testLoadContentByContentInfoDecorator() $decoratedService->loadContentByContentInfo(...$parameters); } - public function testLoadContentByVersionInfoDecorator() + public function testLoadContentByVersionInfoDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -142,7 +142,7 @@ public function testLoadContentByVersionInfoDecorator() $decoratedService->loadContentByVersionInfo(...$parameters); } - public function testLoadContentDecorator() + public function testLoadContentDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -159,7 +159,7 @@ public function testLoadContentDecorator() $decoratedService->loadContent(...$parameters); } - public function testLoadContentByRemoteIdDecorator() + public function testLoadContentByRemoteIdDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -176,7 +176,7 @@ public function testLoadContentByRemoteIdDecorator() $decoratedService->loadContentByRemoteId(...$parameters); } - public function testLoadContentListByContentInfoDecorator() + public function testLoadContentListByContentInfoDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -192,7 +192,7 @@ public function testLoadContentListByContentInfoDecorator() $decoratedService->loadContentListByContentInfo(...$parameters); } - public function testCreateContentDecorator() + public function testCreateContentDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -207,7 +207,7 @@ public function testCreateContentDecorator() $decoratedService->createContent(...$parameters); } - public function testUpdateContentMetadataDecorator() + public function testUpdateContentMetadataDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -222,7 +222,7 @@ public function testUpdateContentMetadataDecorator() $decoratedService->updateContentMetadata(...$parameters); } - public function testDeleteContentDecorator() + public function testDeleteContentDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -234,7 +234,7 @@ public function testDeleteContentDecorator() $decoratedService->deleteContent(...$parameters); } - public function testCreateContentDraftDecorator() + public function testCreateContentDraftDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -262,7 +262,7 @@ public function testLoadContentDraftListDecorator(): void $decoratedService->loadContentDraftList(...$parameters); } - public function testUpdateContentDecorator() + public function testUpdateContentDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -277,7 +277,7 @@ public function testUpdateContentDecorator() $decoratedService->updateContent(...$parameters); } - public function testPublishVersionDecorator() + public function testPublishVersionDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -289,7 +289,7 @@ public function testPublishVersionDecorator() $decoratedService->publishVersion(...$parameters); } - public function testDeleteVersionDecorator() + public function testDeleteVersionDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -301,7 +301,7 @@ public function testDeleteVersionDecorator() $decoratedService->deleteVersion(...$parameters); } - public function testLoadVersionsDecorator() + public function testLoadVersionsDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -313,7 +313,7 @@ public function testLoadVersionsDecorator() $decoratedService->loadVersions(...$parameters); } - public function testCopyContentDecorator() + public function testCopyContentDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -341,7 +341,7 @@ public function testLoadRelationListDecorator(): void $decoratedService->loadRelationList(...$parameters); } - public function testLoadReverseRelationsDecorator() + public function testLoadReverseRelationsDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -353,7 +353,7 @@ public function testLoadReverseRelationsDecorator() $decoratedService->loadReverseRelations(...$parameters); } - public function testAddRelationDecorator() + public function testAddRelationDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -368,7 +368,7 @@ public function testAddRelationDecorator() $decoratedService->addRelation(...$parameters); } - public function testDeleteRelationDecorator() + public function testDeleteRelationDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -383,7 +383,7 @@ public function testDeleteRelationDecorator() $decoratedService->deleteRelation(...$parameters); } - public function testDeleteTranslationDecorator() + public function testDeleteTranslationDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -398,7 +398,7 @@ public function testDeleteTranslationDecorator() $decoratedService->deleteTranslation(...$parameters); } - public function testDeleteTranslationFromDraftDecorator() + public function testDeleteTranslationFromDraftDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -413,7 +413,7 @@ public function testDeleteTranslationFromDraftDecorator() $decoratedService->deleteTranslationFromDraft(...$parameters); } - public function testHideContentDecorator() + public function testHideContentDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -425,7 +425,7 @@ public function testHideContentDecorator() $decoratedService->hideContent(...$parameters); } - public function testRevealContentDecorator() + public function testRevealContentDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -437,7 +437,7 @@ public function testRevealContentDecorator() $decoratedService->revealContent(...$parameters); } - public function testNewContentCreateStructDecorator() + public function testNewContentCreateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -452,7 +452,7 @@ public function testNewContentCreateStructDecorator() $decoratedService->newContentCreateStruct(...$parameters); } - public function testNewContentMetadataUpdateStructDecorator() + public function testNewContentMetadataUpdateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -464,7 +464,7 @@ public function testNewContentMetadataUpdateStructDecorator() $decoratedService->newContentMetadataUpdateStruct(...$parameters); } - public function testNewContentUpdateStructDecorator() + public function testNewContentUpdateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/ContentTypeServiceDecoratorTest.php b/tests/lib/Repository/Decorator/ContentTypeServiceDecoratorTest.php index 7a7b4c175b..3d96f82c6d 100644 --- a/tests/lib/Repository/Decorator/ContentTypeServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/ContentTypeServiceDecoratorTest.php @@ -37,7 +37,7 @@ protected function createServiceMock(): MockObject return $this->createMock(ContentTypeService::class); } - public function testCreateContentTypeGroupDecorator() + public function testCreateContentTypeGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -49,7 +49,7 @@ public function testCreateContentTypeGroupDecorator() $decoratedService->createContentTypeGroup(...$parameters); } - public function testLoadContentTypeGroupDecorator() + public function testLoadContentTypeGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -64,7 +64,7 @@ public function testLoadContentTypeGroupDecorator() $decoratedService->loadContentTypeGroup(...$parameters); } - public function testLoadContentTypeGroupByIdentifierDecorator() + public function testLoadContentTypeGroupByIdentifierDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -79,7 +79,7 @@ public function testLoadContentTypeGroupByIdentifierDecorator() $decoratedService->loadContentTypeGroupByIdentifier(...$parameters); } - public function testLoadContentTypeGroupsDecorator() + public function testLoadContentTypeGroupsDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -91,7 +91,7 @@ public function testLoadContentTypeGroupsDecorator() $decoratedService->loadContentTypeGroups(...$parameters); } - public function testUpdateContentTypeGroupDecorator() + public function testUpdateContentTypeGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -106,7 +106,7 @@ public function testUpdateContentTypeGroupDecorator() $decoratedService->updateContentTypeGroup(...$parameters); } - public function testDeleteContentTypeGroupDecorator() + public function testDeleteContentTypeGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -118,7 +118,7 @@ public function testDeleteContentTypeGroupDecorator() $decoratedService->deleteContentTypeGroup(...$parameters); } - public function testCreateContentTypeDecorator() + public function testCreateContentTypeDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -133,7 +133,7 @@ public function testCreateContentTypeDecorator() $decoratedService->createContentType(...$parameters); } - public function testLoadContentTypeDecorator() + public function testLoadContentTypeDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -148,7 +148,7 @@ public function testLoadContentTypeDecorator() $decoratedService->loadContentType(...$parameters); } - public function testLoadContentTypeByIdentifierDecorator() + public function testLoadContentTypeByIdentifierDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -163,7 +163,7 @@ public function testLoadContentTypeByIdentifierDecorator() $decoratedService->loadContentTypeByIdentifier(...$parameters); } - public function testLoadContentTypeByRemoteIdDecorator() + public function testLoadContentTypeByRemoteIdDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -178,7 +178,7 @@ public function testLoadContentTypeByRemoteIdDecorator() $decoratedService->loadContentTypeByRemoteId(...$parameters); } - public function testLoadContentTypeDraftDecorator() + public function testLoadContentTypeDraftDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -190,7 +190,7 @@ public function testLoadContentTypeDraftDecorator() $decoratedService->loadContentTypeDraft(...$parameters); } - public function testLoadContentTypeListDecorator() + public function testLoadContentTypeListDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -205,7 +205,7 @@ public function testLoadContentTypeListDecorator() $decoratedService->loadContentTypeList(...$parameters); } - public function testLoadContentTypesDecorator() + public function testLoadContentTypesDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -220,7 +220,7 @@ public function testLoadContentTypesDecorator() $decoratedService->loadContentTypes(...$parameters); } - public function testCreateContentTypeDraftDecorator() + public function testCreateContentTypeDraftDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -232,7 +232,7 @@ public function testCreateContentTypeDraftDecorator() $decoratedService->createContentTypeDraft(...$parameters); } - public function testUpdateContentTypeDraftDecorator() + public function testUpdateContentTypeDraftDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -247,7 +247,7 @@ public function testUpdateContentTypeDraftDecorator() $decoratedService->updateContentTypeDraft(...$parameters); } - public function testDeleteContentTypeDecorator() + public function testDeleteContentTypeDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -259,7 +259,7 @@ public function testDeleteContentTypeDecorator() $decoratedService->deleteContentType(...$parameters); } - public function testCopyContentTypeDecorator() + public function testCopyContentTypeDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -274,7 +274,7 @@ public function testCopyContentTypeDecorator() $decoratedService->copyContentType(...$parameters); } - public function testAssignContentTypeGroupDecorator() + public function testAssignContentTypeGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -289,7 +289,7 @@ public function testAssignContentTypeGroupDecorator() $decoratedService->assignContentTypeGroup(...$parameters); } - public function testUnassignContentTypeGroupDecorator() + public function testUnassignContentTypeGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -304,7 +304,7 @@ public function testUnassignContentTypeGroupDecorator() $decoratedService->unassignContentTypeGroup(...$parameters); } - public function testAddFieldDefinitionDecorator() + public function testAddFieldDefinitionDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -319,7 +319,7 @@ public function testAddFieldDefinitionDecorator() $decoratedService->addFieldDefinition(...$parameters); } - public function testRemoveFieldDefinitionDecorator() + public function testRemoveFieldDefinitionDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -334,7 +334,7 @@ public function testRemoveFieldDefinitionDecorator() $decoratedService->removeFieldDefinition(...$parameters); } - public function testUpdateFieldDefinitionDecorator() + public function testUpdateFieldDefinitionDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -350,7 +350,7 @@ public function testUpdateFieldDefinitionDecorator() $decoratedService->updateFieldDefinition(...$parameters); } - public function testPublishContentTypeDraftDecorator() + public function testPublishContentTypeDraftDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -362,7 +362,7 @@ public function testPublishContentTypeDraftDecorator() $decoratedService->publishContentTypeDraft(...$parameters); } - public function testNewContentTypeGroupCreateStructDecorator() + public function testNewContentTypeGroupCreateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -374,7 +374,7 @@ public function testNewContentTypeGroupCreateStructDecorator() $decoratedService->newContentTypeGroupCreateStruct(...$parameters); } - public function testNewContentTypeCreateStructDecorator() + public function testNewContentTypeCreateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -386,7 +386,7 @@ public function testNewContentTypeCreateStructDecorator() $decoratedService->newContentTypeCreateStruct(...$parameters); } - public function testNewContentTypeUpdateStructDecorator() + public function testNewContentTypeUpdateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -398,7 +398,7 @@ public function testNewContentTypeUpdateStructDecorator() $decoratedService->newContentTypeUpdateStruct(...$parameters); } - public function testNewContentTypeGroupUpdateStructDecorator() + public function testNewContentTypeGroupUpdateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -410,7 +410,7 @@ public function testNewContentTypeGroupUpdateStructDecorator() $decoratedService->newContentTypeGroupUpdateStruct(...$parameters); } - public function testNewFieldDefinitionCreateStructDecorator() + public function testNewFieldDefinitionCreateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -425,7 +425,7 @@ public function testNewFieldDefinitionCreateStructDecorator() $decoratedService->newFieldDefinitionCreateStruct(...$parameters); } - public function testNewFieldDefinitionUpdateStructDecorator() + public function testNewFieldDefinitionUpdateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -437,7 +437,7 @@ public function testNewFieldDefinitionUpdateStructDecorator() $decoratedService->newFieldDefinitionUpdateStruct(...$parameters); } - public function testIsContentTypeUsedDecorator() + public function testIsContentTypeUsedDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -449,7 +449,7 @@ public function testIsContentTypeUsedDecorator() $decoratedService->isContentTypeUsed(...$parameters); } - public function testRemoveContentTypeTranslationDecorator() + public function testRemoveContentTypeTranslationDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/FieldTypeServiceDecoratorTest.php b/tests/lib/Repository/Decorator/FieldTypeServiceDecoratorTest.php index d26802b682..cf28c52084 100644 --- a/tests/lib/Repository/Decorator/FieldTypeServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/FieldTypeServiceDecoratorTest.php @@ -26,7 +26,7 @@ protected function createServiceMock(): MockObject return $this->createMock(FieldTypeService::class); } - public function testGetFieldTypesDecorator() + public function testGetFieldTypesDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -38,7 +38,7 @@ public function testGetFieldTypesDecorator() $decoratedService->getFieldTypes(...$parameters); } - public function testGetFieldTypeDecorator() + public function testGetFieldTypeDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -50,7 +50,7 @@ public function testGetFieldTypeDecorator() $decoratedService->getFieldType(...$parameters); } - public function testHasFieldTypeDecorator() + public function testHasFieldTypeDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/LanguageServiceDecoratorTest.php b/tests/lib/Repository/Decorator/LanguageServiceDecoratorTest.php index 5b7ccda1c5..86e21d9cf3 100644 --- a/tests/lib/Repository/Decorator/LanguageServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/LanguageServiceDecoratorTest.php @@ -28,7 +28,7 @@ protected function createServiceMock(): MockObject return $this->createMock(LanguageService::class); } - public function testCreateLanguageDecorator() + public function testCreateLanguageDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -40,7 +40,7 @@ public function testCreateLanguageDecorator() $decoratedService->createLanguage(...$parameters); } - public function testUpdateLanguageNameDecorator() + public function testUpdateLanguageNameDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -55,7 +55,7 @@ public function testUpdateLanguageNameDecorator() $decoratedService->updateLanguageName(...$parameters); } - public function testEnableLanguageDecorator() + public function testEnableLanguageDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -67,7 +67,7 @@ public function testEnableLanguageDecorator() $decoratedService->enableLanguage(...$parameters); } - public function testDisableLanguageDecorator() + public function testDisableLanguageDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -79,7 +79,7 @@ public function testDisableLanguageDecorator() $decoratedService->disableLanguage(...$parameters); } - public function testLoadLanguageDecorator() + public function testLoadLanguageDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -91,7 +91,7 @@ public function testLoadLanguageDecorator() $decoratedService->loadLanguage(...$parameters); } - public function testLoadLanguagesDecorator() + public function testLoadLanguagesDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -103,7 +103,7 @@ public function testLoadLanguagesDecorator() $decoratedService->loadLanguages(...$parameters); } - public function testLoadLanguageByIdDecorator() + public function testLoadLanguageByIdDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -115,7 +115,7 @@ public function testLoadLanguageByIdDecorator() $decoratedService->loadLanguageById(...$parameters); } - public function testLoadLanguageListByCodeDecorator() + public function testLoadLanguageListByCodeDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -127,7 +127,7 @@ public function testLoadLanguageListByCodeDecorator() $decoratedService->loadLanguageListByCode(...$parameters); } - public function testLoadLanguageListByIdDecorator() + public function testLoadLanguageListByIdDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -139,7 +139,7 @@ public function testLoadLanguageListByIdDecorator() $decoratedService->loadLanguageListById(...$parameters); } - public function testDeleteLanguageDecorator() + public function testDeleteLanguageDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -151,7 +151,7 @@ public function testDeleteLanguageDecorator() $decoratedService->deleteLanguage(...$parameters); } - public function testGetDefaultLanguageCodeDecorator() + public function testGetDefaultLanguageCodeDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -163,7 +163,7 @@ public function testGetDefaultLanguageCodeDecorator() $decoratedService->getDefaultLanguageCode(...$parameters); } - public function testNewLanguageCreateStructDecorator() + public function testNewLanguageCreateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/LocationServiceDecoratorTest.php b/tests/lib/Repository/Decorator/LocationServiceDecoratorTest.php index 906c9575ac..3d47905826 100644 --- a/tests/lib/Repository/Decorator/LocationServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/LocationServiceDecoratorTest.php @@ -35,7 +35,7 @@ protected function createServiceMock(): MockObject return $this->createMock(LocationService::class); } - public function testCopySubtreeDecorator() + public function testCopySubtreeDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -50,7 +50,7 @@ public function testCopySubtreeDecorator() $decoratedService->copySubtree(...$parameters); } - public function testLoadLocationDecorator() + public function testLoadLocationDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -66,7 +66,7 @@ public function testLoadLocationDecorator() $decoratedService->loadLocation(...$parameters); } - public function testLoadLocationListDecorator() + public function testLoadLocationListDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -82,7 +82,7 @@ public function testLoadLocationListDecorator() $decoratedService->loadLocationList(...$parameters); } - public function testLoadLocationByRemoteIdDecorator() + public function testLoadLocationByRemoteIdDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -98,7 +98,7 @@ public function testLoadLocationByRemoteIdDecorator() $decoratedService->loadLocationByRemoteId(...$parameters); } - public function testLoadLocationsDecorator() + public function testLoadLocationsDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -114,7 +114,7 @@ public function testLoadLocationsDecorator() $decoratedService->loadLocations(...$parameters); } - public function testLoadLocationChildrenDecorator() + public function testLoadLocationChildrenDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -131,7 +131,7 @@ public function testLoadLocationChildrenDecorator() $decoratedService->loadLocationChildren(...$parameters); } - public function testLoadParentLocationsForDraftContentDecorator() + public function testLoadParentLocationsForDraftContentDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -146,7 +146,7 @@ public function testLoadParentLocationsForDraftContentDecorator() $decoratedService->loadParentLocationsForDraftContent(...$parameters); } - public function testGetLocationChildCountDecorator() + public function testGetLocationChildCountDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -158,7 +158,7 @@ public function testGetLocationChildCountDecorator() $decoratedService->getLocationChildCount(...$parameters); } - public function testCreateLocationDecorator() + public function testCreateLocationDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -173,7 +173,7 @@ public function testCreateLocationDecorator() $decoratedService->createLocation(...$parameters); } - public function testUpdateLocationDecorator() + public function testUpdateLocationDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -188,7 +188,7 @@ public function testUpdateLocationDecorator() $decoratedService->updateLocation(...$parameters); } - public function testSwapLocationDecorator() + public function testSwapLocationDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -203,7 +203,7 @@ public function testSwapLocationDecorator() $decoratedService->swapLocation(...$parameters); } - public function testHideLocationDecorator() + public function testHideLocationDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -215,7 +215,7 @@ public function testHideLocationDecorator() $decoratedService->hideLocation(...$parameters); } - public function testUnhideLocationDecorator() + public function testUnhideLocationDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -227,7 +227,7 @@ public function testUnhideLocationDecorator() $decoratedService->unhideLocation(...$parameters); } - public function testMoveSubtreeDecorator() + public function testMoveSubtreeDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -242,7 +242,7 @@ public function testMoveSubtreeDecorator() $decoratedService->moveSubtree(...$parameters); } - public function testDeleteLocationDecorator() + public function testDeleteLocationDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -254,7 +254,7 @@ public function testDeleteLocationDecorator() $decoratedService->deleteLocation(...$parameters); } - public function testNewLocationCreateStructDecorator() + public function testNewLocationCreateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -266,7 +266,7 @@ public function testNewLocationCreateStructDecorator() $decoratedService->newLocationCreateStruct(...$parameters); } - public function testNewLocationUpdateStructDecorator() + public function testNewLocationUpdateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -278,7 +278,7 @@ public function testNewLocationUpdateStructDecorator() $decoratedService->newLocationUpdateStruct(...$parameters); } - public function testGetAllLocationsCountDecorator() + public function testGetAllLocationsCountDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -290,7 +290,7 @@ public function testGetAllLocationsCountDecorator() $decoratedService->getAllLocationsCount(...$parameters); } - public function testLoadAllLocationsDecorator() + public function testLoadAllLocationsDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/NotificationServiceDecoratorTest.php b/tests/lib/Repository/Decorator/NotificationServiceDecoratorTest.php index e21c47e5d8..6861794309 100644 --- a/tests/lib/Repository/Decorator/NotificationServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/NotificationServiceDecoratorTest.php @@ -28,7 +28,7 @@ protected function createServiceMock(): MockObject return $this->createMock(NotificationService::class); } - public function testLoadNotificationsDecorator() + public function testLoadNotificationsDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -43,7 +43,7 @@ public function testLoadNotificationsDecorator() $decoratedService->loadNotifications(...$parameters); } - public function testGetNotificationDecorator() + public function testGetNotificationDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -55,7 +55,7 @@ public function testGetNotificationDecorator() $decoratedService->getNotification(...$parameters); } - public function testMarkNotificationAsReadDecorator() + public function testMarkNotificationAsReadDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -67,7 +67,7 @@ public function testMarkNotificationAsReadDecorator() $decoratedService->markNotificationAsRead(...$parameters); } - public function testGetPendingNotificationCountDecorator() + public function testGetPendingNotificationCountDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -79,7 +79,7 @@ public function testGetPendingNotificationCountDecorator() $decoratedService->getPendingNotificationCount(...$parameters); } - public function testGetNotificationCountDecorator() + public function testGetNotificationCountDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -91,7 +91,7 @@ public function testGetNotificationCountDecorator() $decoratedService->getNotificationCount(...$parameters); } - public function testCreateNotificationDecorator() + public function testCreateNotificationDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -103,7 +103,7 @@ public function testCreateNotificationDecorator() $decoratedService->createNotification(...$parameters); } - public function testDeleteNotificationDecorator() + public function testDeleteNotificationDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/ObjectStateServiceDecoratorTest.php b/tests/lib/Repository/Decorator/ObjectStateServiceDecoratorTest.php index 86a3f9abb0..13c057d710 100644 --- a/tests/lib/Repository/Decorator/ObjectStateServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/ObjectStateServiceDecoratorTest.php @@ -33,7 +33,7 @@ protected function createServiceMock(): MockObject return $this->createMock(ObjectStateService::class); } - public function testCreateObjectStateGroupDecorator() + public function testCreateObjectStateGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -45,7 +45,7 @@ public function testCreateObjectStateGroupDecorator() $decoratedService->createObjectStateGroup(...$parameters); } - public function testLoadObjectStateGroupDecorator() + public function testLoadObjectStateGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -85,7 +85,7 @@ public function testLoadObjectStateGroupByIdentifierDecorator(): void ); } - public function testLoadObjectStateGroupsDecorator() + public function testLoadObjectStateGroupsDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -101,7 +101,7 @@ public function testLoadObjectStateGroupsDecorator() $decoratedService->loadObjectStateGroups(...$parameters); } - public function testLoadObjectStatesDecorator() + public function testLoadObjectStatesDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -116,7 +116,7 @@ public function testLoadObjectStatesDecorator() $decoratedService->loadObjectStates(...$parameters); } - public function testUpdateObjectStateGroupDecorator() + public function testUpdateObjectStateGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -131,7 +131,7 @@ public function testUpdateObjectStateGroupDecorator() $decoratedService->updateObjectStateGroup(...$parameters); } - public function testDeleteObjectStateGroupDecorator() + public function testDeleteObjectStateGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -143,7 +143,7 @@ public function testDeleteObjectStateGroupDecorator() $decoratedService->deleteObjectStateGroup(...$parameters); } - public function testCreateObjectStateDecorator() + public function testCreateObjectStateDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -158,7 +158,7 @@ public function testCreateObjectStateDecorator() $decoratedService->createObjectState(...$parameters); } - public function testLoadObjectStateDecorator() + public function testLoadObjectStateDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -199,7 +199,7 @@ public function testLoadObjectStateDecoratorByIdentifier(): void ); } - public function testUpdateObjectStateDecorator() + public function testUpdateObjectStateDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -214,7 +214,7 @@ public function testUpdateObjectStateDecorator() $decoratedService->updateObjectState(...$parameters); } - public function testSetPriorityOfObjectStateDecorator() + public function testSetPriorityOfObjectStateDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -229,7 +229,7 @@ public function testSetPriorityOfObjectStateDecorator() $decoratedService->setPriorityOfObjectState(...$parameters); } - public function testDeleteObjectStateDecorator() + public function testDeleteObjectStateDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -241,7 +241,7 @@ public function testDeleteObjectStateDecorator() $decoratedService->deleteObjectState(...$parameters); } - public function testSetContentStateDecorator() + public function testSetContentStateDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -257,7 +257,7 @@ public function testSetContentStateDecorator() $decoratedService->setContentState(...$parameters); } - public function testGetContentStateDecorator() + public function testGetContentStateDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -272,7 +272,7 @@ public function testGetContentStateDecorator() $decoratedService->getContentState(...$parameters); } - public function testGetContentCountDecorator() + public function testGetContentCountDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -284,7 +284,7 @@ public function testGetContentCountDecorator() $decoratedService->getContentCount(...$parameters); } - public function testNewObjectStateGroupCreateStructDecorator() + public function testNewObjectStateGroupCreateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -296,7 +296,7 @@ public function testNewObjectStateGroupCreateStructDecorator() $decoratedService->newObjectStateGroupCreateStruct(...$parameters); } - public function testNewObjectStateGroupUpdateStructDecorator() + public function testNewObjectStateGroupUpdateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -308,7 +308,7 @@ public function testNewObjectStateGroupUpdateStructDecorator() $decoratedService->newObjectStateGroupUpdateStruct(...$parameters); } - public function testNewObjectStateCreateStructDecorator() + public function testNewObjectStateCreateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -320,7 +320,7 @@ public function testNewObjectStateCreateStructDecorator() $decoratedService->newObjectStateCreateStruct(...$parameters); } - public function testNewObjectStateUpdateStructDecorator() + public function testNewObjectStateUpdateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/RoleServiceDecoratorTest.php b/tests/lib/Repository/Decorator/RoleServiceDecoratorTest.php index d25283d6ab..0abceabf7f 100644 --- a/tests/lib/Repository/Decorator/RoleServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/RoleServiceDecoratorTest.php @@ -40,7 +40,7 @@ protected function createServiceMock(): MockObject return $this->createMock(RoleService::class); } - public function testCreateRoleDecorator() + public function testCreateRoleDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -52,7 +52,7 @@ public function testCreateRoleDecorator() $decoratedService->createRole(...$parameters); } - public function testCreateRoleDraftDecorator() + public function testCreateRoleDraftDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -64,7 +64,7 @@ public function testCreateRoleDraftDecorator() $decoratedService->createRoleDraft(...$parameters); } - public function testLoadRoleDraftDecorator() + public function testLoadRoleDraftDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -76,7 +76,7 @@ public function testLoadRoleDraftDecorator() $decoratedService->loadRoleDraft(...$parameters); } - public function testLoadRoleDraftByRoleIdDecorator() + public function testLoadRoleDraftByRoleIdDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -88,7 +88,7 @@ public function testLoadRoleDraftByRoleIdDecorator() $decoratedService->loadRoleDraftByRoleId(...$parameters); } - public function testUpdateRoleDraftDecorator() + public function testUpdateRoleDraftDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -103,7 +103,7 @@ public function testUpdateRoleDraftDecorator() $decoratedService->updateRoleDraft(...$parameters); } - public function testAddPolicyByRoleDraftDecorator() + public function testAddPolicyByRoleDraftDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -118,7 +118,7 @@ public function testAddPolicyByRoleDraftDecorator() $decoratedService->addPolicyByRoleDraft(...$parameters); } - public function testRemovePolicyByRoleDraftDecorator() + public function testRemovePolicyByRoleDraftDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -133,7 +133,7 @@ public function testRemovePolicyByRoleDraftDecorator() $decoratedService->removePolicyByRoleDraft(...$parameters); } - public function testUpdatePolicyByRoleDraftDecorator() + public function testUpdatePolicyByRoleDraftDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -149,7 +149,7 @@ public function testUpdatePolicyByRoleDraftDecorator() $decoratedService->updatePolicyByRoleDraft(...$parameters); } - public function testDeleteRoleDraftDecorator() + public function testDeleteRoleDraftDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -161,7 +161,7 @@ public function testDeleteRoleDraftDecorator() $decoratedService->deleteRoleDraft(...$parameters); } - public function testPublishRoleDraftDecorator() + public function testPublishRoleDraftDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -173,7 +173,7 @@ public function testPublishRoleDraftDecorator() $decoratedService->publishRoleDraft(...$parameters); } - public function testLoadRoleDecorator() + public function testLoadRoleDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -185,7 +185,7 @@ public function testLoadRoleDecorator() $decoratedService->loadRole(...$parameters); } - public function testLoadRoleByIdentifierDecorator() + public function testLoadRoleByIdentifierDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -197,7 +197,7 @@ public function testLoadRoleByIdentifierDecorator() $decoratedService->loadRoleByIdentifier(...$parameters); } - public function testLoadRolesDecorator() + public function testLoadRolesDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -209,7 +209,7 @@ public function testLoadRolesDecorator() $decoratedService->loadRoles(...$parameters); } - public function testDeleteRoleDecorator() + public function testDeleteRoleDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -221,7 +221,7 @@ public function testDeleteRoleDecorator() $decoratedService->deleteRole(...$parameters); } - public function testAssignRoleToUserGroupDecorator() + public function testAssignRoleToUserGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -237,7 +237,7 @@ public function testAssignRoleToUserGroupDecorator() $decoratedService->assignRoleToUserGroup(...$parameters); } - public function testAssignRoleToUserDecorator() + public function testAssignRoleToUserDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -253,7 +253,7 @@ public function testAssignRoleToUserDecorator() $decoratedService->assignRoleToUser(...$parameters); } - public function testLoadRoleAssignmentDecorator() + public function testLoadRoleAssignmentDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -265,7 +265,7 @@ public function testLoadRoleAssignmentDecorator() $decoratedService->loadRoleAssignment(...$parameters); } - public function testGetRoleAssignmentsDecorator() + public function testGetRoleAssignmentsDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -277,7 +277,7 @@ public function testGetRoleAssignmentsDecorator() $decoratedService->getRoleAssignments(...$parameters); } - public function testGetRoleAssignmentsForUserDecorator() + public function testGetRoleAssignmentsForUserDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -292,7 +292,7 @@ public function testGetRoleAssignmentsForUserDecorator() $decoratedService->getRoleAssignmentsForUser(...$parameters); } - public function testGetRoleAssignmentsForUserGroupDecorator() + public function testGetRoleAssignmentsForUserGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -304,7 +304,7 @@ public function testGetRoleAssignmentsForUserGroupDecorator() $decoratedService->getRoleAssignmentsForUserGroup(...$parameters); } - public function testRemoveRoleAssignmentDecorator() + public function testRemoveRoleAssignmentDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -316,7 +316,7 @@ public function testRemoveRoleAssignmentDecorator() $decoratedService->removeRoleAssignment(...$parameters); } - public function testNewRoleCreateStructDecorator() + public function testNewRoleCreateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -328,7 +328,7 @@ public function testNewRoleCreateStructDecorator() $decoratedService->newRoleCreateStruct(...$parameters); } - public function testNewPolicyCreateStructDecorator() + public function testNewPolicyCreateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -343,7 +343,7 @@ public function testNewPolicyCreateStructDecorator() $decoratedService->newPolicyCreateStruct(...$parameters); } - public function testNewPolicyUpdateStructDecorator() + public function testNewPolicyUpdateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -355,7 +355,7 @@ public function testNewPolicyUpdateStructDecorator() $decoratedService->newPolicyUpdateStruct(...$parameters); } - public function testNewRoleUpdateStructDecorator() + public function testNewRoleUpdateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -367,7 +367,7 @@ public function testNewRoleUpdateStructDecorator() $decoratedService->newRoleUpdateStruct(...$parameters); } - public function testGetLimitationTypeDecorator() + public function testGetLimitationTypeDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -379,7 +379,7 @@ public function testGetLimitationTypeDecorator() $decoratedService->getLimitationType(...$parameters); } - public function testGetLimitationTypesByModuleFunctionDecorator() + public function testGetLimitationTypesByModuleFunctionDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/SearchServiceDecoratorTest.php b/tests/lib/Repository/Decorator/SearchServiceDecoratorTest.php index b761c104ce..86f0a06928 100644 --- a/tests/lib/Repository/Decorator/SearchServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/SearchServiceDecoratorTest.php @@ -29,7 +29,7 @@ protected function createServiceMock(): MockObject return $this->createMock(SearchService::class); } - public function testFindContentDecorator() + public function testFindContentDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -45,7 +45,7 @@ public function testFindContentDecorator() $decoratedService->findContent(...$parameters); } - public function testFindContentInfoDecorator() + public function testFindContentInfoDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -61,7 +61,7 @@ public function testFindContentInfoDecorator() $decoratedService->findContentInfo(...$parameters); } - public function testFindSingleDecorator() + public function testFindSingleDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -77,7 +77,7 @@ public function testFindSingleDecorator() $decoratedService->findSingle(...$parameters); } - public function testSuggestDecorator() + public function testSuggestDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -94,7 +94,7 @@ public function testSuggestDecorator() $decoratedService->suggest(...$parameters); } - public function testFindLocationsDecorator() + public function testFindLocationsDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/SectionServiceDecoratorTest.php b/tests/lib/Repository/Decorator/SectionServiceDecoratorTest.php index 39b9df17ff..d2bf7e188f 100644 --- a/tests/lib/Repository/Decorator/SectionServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/SectionServiceDecoratorTest.php @@ -33,7 +33,7 @@ protected function createServiceMock(): MockObject return $this->createMock(SectionService::class); } - public function testCreateSectionDecorator() + public function testCreateSectionDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -45,7 +45,7 @@ public function testCreateSectionDecorator() $decoratedService->createSection(...$parameters); } - public function testUpdateSectionDecorator() + public function testUpdateSectionDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -60,7 +60,7 @@ public function testUpdateSectionDecorator() $decoratedService->updateSection(...$parameters); } - public function testLoadSectionDecorator() + public function testLoadSectionDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -72,7 +72,7 @@ public function testLoadSectionDecorator() $decoratedService->loadSection(...$parameters); } - public function testLoadSectionsDecorator() + public function testLoadSectionsDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -84,7 +84,7 @@ public function testLoadSectionsDecorator() $decoratedService->loadSections(...$parameters); } - public function testLoadSectionByIdentifierDecorator() + public function testLoadSectionByIdentifierDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -96,7 +96,7 @@ public function testLoadSectionByIdentifierDecorator() $decoratedService->loadSectionByIdentifier(...$parameters); } - public function testCountAssignedContentsDecorator() + public function testCountAssignedContentsDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -108,7 +108,7 @@ public function testCountAssignedContentsDecorator() $decoratedService->countAssignedContents(...$parameters); } - public function testIsSectionUsedDecorator() + public function testIsSectionUsedDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -120,7 +120,7 @@ public function testIsSectionUsedDecorator() $decoratedService->isSectionUsed(...$parameters); } - public function testAssignSectionDecorator() + public function testAssignSectionDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -135,7 +135,7 @@ public function testAssignSectionDecorator() $decoratedService->assignSection(...$parameters); } - public function testAssignSectionToSubtreeDecorator() + public function testAssignSectionToSubtreeDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -150,7 +150,7 @@ public function testAssignSectionToSubtreeDecorator() $decoratedService->assignSectionToSubtree(...$parameters); } - public function testDeleteSectionDecorator() + public function testDeleteSectionDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -162,7 +162,7 @@ public function testDeleteSectionDecorator() $decoratedService->deleteSection(...$parameters); } - public function testNewSectionCreateStructDecorator() + public function testNewSectionCreateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -174,7 +174,7 @@ public function testNewSectionCreateStructDecorator() $decoratedService->newSectionCreateStruct(...$parameters); } - public function testNewSectionUpdateStructDecorator() + public function testNewSectionUpdateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/SettingServiceDecoratorTest.php b/tests/lib/Repository/Decorator/SettingServiceDecoratorTest.php index 3da5a68674..195ca65109 100644 --- a/tests/lib/Repository/Decorator/SettingServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/SettingServiceDecoratorTest.php @@ -32,7 +32,7 @@ protected function createServiceMock(): MockObject return $this->createMock(SettingService::class); } - public function testCreateSettingDecorator() + public function testCreateSettingDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -44,7 +44,7 @@ public function testCreateSettingDecorator() $decoratedService->createSetting(...$parameters); } - public function testUpdateSettingDecorator() + public function testUpdateSettingDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -59,7 +59,7 @@ public function testUpdateSettingDecorator() $decoratedService->updateSetting(...$parameters); } - public function testLoadSettingDecorator() + public function testLoadSettingDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -74,7 +74,7 @@ public function testLoadSettingDecorator() $decoratedService->loadSetting(...$parameters); } - public function testDeleteSettingDecorator() + public function testDeleteSettingDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -86,7 +86,7 @@ public function testDeleteSettingDecorator() $decoratedService->deleteSetting(...$parameters); } - public function testNewSettingCreateStructDecorator() + public function testNewSettingCreateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -98,7 +98,7 @@ public function testNewSettingCreateStructDecorator() $decoratedService->newSettingCreateStruct(...$parameters); } - public function testNewSettingUpdateStructDecorator() + public function testNewSettingUpdateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/TranslationServiceDecoratorTest.php b/tests/lib/Repository/Decorator/TranslationServiceDecoratorTest.php index 3be4c7cc25..9db0b0ed6d 100644 --- a/tests/lib/Repository/Decorator/TranslationServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/TranslationServiceDecoratorTest.php @@ -27,7 +27,7 @@ protected function createServiceMock(): MockObject return $this->createMock(TranslationService::class); } - public function testTranslateDecorator() + public function testTranslateDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -42,7 +42,7 @@ public function testTranslateDecorator() $decoratedService->translate(...$parameters); } - public function testTranslateStringDecorator() + public function testTranslateStringDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/TrashServiceDecoratorTest.php b/tests/lib/Repository/Decorator/TrashServiceDecoratorTest.php index 65babf43c3..2c9456ac81 100644 --- a/tests/lib/Repository/Decorator/TrashServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/TrashServiceDecoratorTest.php @@ -29,7 +29,7 @@ protected function createServiceMock(): MockObject return $this->createMock(TrashService::class); } - public function testLoadTrashItemDecorator() + public function testLoadTrashItemDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -41,7 +41,7 @@ public function testLoadTrashItemDecorator() $decoratedService->loadTrashItem(...$parameters); } - public function testTrashDecorator() + public function testTrashDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -53,7 +53,7 @@ public function testTrashDecorator() $decoratedService->trash(...$parameters); } - public function testRecoverDecorator() + public function testRecoverDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -68,7 +68,7 @@ public function testRecoverDecorator() $decoratedService->recover(...$parameters); } - public function testEmptyTrashDecorator() + public function testEmptyTrashDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -80,7 +80,7 @@ public function testEmptyTrashDecorator() $decoratedService->emptyTrash(...$parameters); } - public function testDeleteTrashItemDecorator() + public function testDeleteTrashItemDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -92,7 +92,7 @@ public function testDeleteTrashItemDecorator() $decoratedService->deleteTrashItem(...$parameters); } - public function testFindTrashItemsDecorator() + public function testFindTrashItemsDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/URLAliasServiceDecoratorTest.php b/tests/lib/Repository/Decorator/URLAliasServiceDecoratorTest.php index de9b5e2e69..24084e99d7 100644 --- a/tests/lib/Repository/Decorator/URLAliasServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/URLAliasServiceDecoratorTest.php @@ -30,7 +30,7 @@ protected function createServiceMock(): MockObject return $this->createMock(URLAliasService::class); } - public function testCreateUrlAliasDecorator() + public function testCreateUrlAliasDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -48,7 +48,7 @@ public function testCreateUrlAliasDecorator() $decoratedService->createUrlAlias(...$parameters); } - public function testCreateGlobalUrlAliasDecorator() + public function testCreateGlobalUrlAliasDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -66,7 +66,7 @@ public function testCreateGlobalUrlAliasDecorator() $decoratedService->createGlobalUrlAlias(...$parameters); } - public function testListLocationAliasesDecorator() + public function testListLocationAliasesDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -82,7 +82,7 @@ public function testListLocationAliasesDecorator() $decoratedService->listLocationAliases(...$parameters); } - public function testListGlobalAliasesDecorator() + public function testListGlobalAliasesDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -98,7 +98,7 @@ public function testListGlobalAliasesDecorator() $decoratedService->listGlobalAliases(...$parameters); } - public function testRemoveAliasesDecorator() + public function testRemoveAliasesDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -110,7 +110,7 @@ public function testRemoveAliasesDecorator() $decoratedService->removeAliases(...$parameters); } - public function testLookupDecorator() + public function testLookupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -125,7 +125,7 @@ public function testLookupDecorator() $decoratedService->lookup(...$parameters); } - public function testReverseLookupDecorator() + public function testReverseLookupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -140,7 +140,7 @@ public function testReverseLookupDecorator() $decoratedService->reverseLookup(...$parameters); } - public function testLoadDecorator() + public function testLoadDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -152,7 +152,7 @@ public function testLoadDecorator() $decoratedService->load(...$parameters); } - public function testRefreshSystemUrlAliasesForLocationDecorator() + public function testRefreshSystemUrlAliasesForLocationDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -164,7 +164,7 @@ public function testRefreshSystemUrlAliasesForLocationDecorator() $decoratedService->refreshSystemUrlAliasesForLocation(...$parameters); } - public function testDeleteCorruptedUrlAliasesDecorator() + public function testDeleteCorruptedUrlAliasesDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/URLServiceDecoratorTest.php b/tests/lib/Repository/Decorator/URLServiceDecoratorTest.php index 0214072cba..a4d2458945 100644 --- a/tests/lib/Repository/Decorator/URLServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/URLServiceDecoratorTest.php @@ -29,7 +29,7 @@ protected function createServiceMock(): MockObject return $this->createMock(URLService::class); } - public function testCreateUpdateStructDecorator() + public function testCreateUpdateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -41,7 +41,7 @@ public function testCreateUpdateStructDecorator() $decoratedService->createUpdateStruct(...$parameters); } - public function testFindUrlsDecorator() + public function testFindUrlsDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -53,7 +53,7 @@ public function testFindUrlsDecorator() $decoratedService->findUrls(...$parameters); } - public function testFindUsagesDecorator() + public function testFindUsagesDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -69,7 +69,7 @@ public function testFindUsagesDecorator() $decoratedService->findUsages(...$parameters); } - public function testLoadByIdDecorator() + public function testLoadByIdDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -81,7 +81,7 @@ public function testLoadByIdDecorator() $decoratedService->loadById(...$parameters); } - public function testLoadByUrlDecorator() + public function testLoadByUrlDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -93,7 +93,7 @@ public function testLoadByUrlDecorator() $decoratedService->loadByUrl(...$parameters); } - public function testUpdateUrlDecorator() + public function testUpdateUrlDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/URLWildcardServiceDecoratorTest.php b/tests/lib/Repository/Decorator/URLWildcardServiceDecoratorTest.php index b0c7e05c7b..0cb812d720 100644 --- a/tests/lib/Repository/Decorator/URLWildcardServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/URLWildcardServiceDecoratorTest.php @@ -27,7 +27,7 @@ protected function createServiceMock(): MockObject return $this->createMock(URLWildcardService::class); } - public function testCreateDecorator() + public function testCreateDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -43,7 +43,7 @@ public function testCreateDecorator() $decoratedService->create(...$parameters); } - public function testRemoveDecorator() + public function testRemoveDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -55,7 +55,7 @@ public function testRemoveDecorator() $decoratedService->remove(...$parameters); } - public function testLoadDecorator() + public function testLoadDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -67,7 +67,7 @@ public function testLoadDecorator() $decoratedService->load(...$parameters); } - public function testLoadAllDecorator() + public function testLoadAllDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -82,7 +82,7 @@ public function testLoadAllDecorator() $decoratedService->loadAll(...$parameters); } - public function testTranslateDecorator() + public function testTranslateDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/UserPreferenceServiceDecoratorTest.php b/tests/lib/Repository/Decorator/UserPreferenceServiceDecoratorTest.php index 52943f41a9..f2282564cb 100644 --- a/tests/lib/Repository/Decorator/UserPreferenceServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/UserPreferenceServiceDecoratorTest.php @@ -26,7 +26,7 @@ protected function createServiceMock(): MockObject return $this->createMock(UserPreferenceService::class); } - public function testSetUserPreferenceDecorator() + public function testSetUserPreferenceDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -38,7 +38,7 @@ public function testSetUserPreferenceDecorator() $decoratedService->setUserPreference(...$parameters); } - public function testGetUserPreferenceDecorator() + public function testGetUserPreferenceDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -50,7 +50,7 @@ public function testGetUserPreferenceDecorator() $decoratedService->getUserPreference(...$parameters); } - public function testLoadUserPreferencesDecorator() + public function testLoadUserPreferencesDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -65,7 +65,7 @@ public function testLoadUserPreferencesDecorator() $decoratedService->loadUserPreferences(...$parameters); } - public function testGetUserPreferenceCountDecorator() + public function testGetUserPreferenceCountDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Decorator/UserServiceDecoratorTest.php b/tests/lib/Repository/Decorator/UserServiceDecoratorTest.php index ba068a783e..668464c737 100644 --- a/tests/lib/Repository/Decorator/UserServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/UserServiceDecoratorTest.php @@ -43,7 +43,7 @@ protected function createServiceMock(): MockObject return $this->createMock(UserService::class); } - public function testCreateUserGroupDecorator() + public function testCreateUserGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -58,7 +58,7 @@ public function testCreateUserGroupDecorator() $decoratedService->createUserGroup(...$parameters); } - public function testLoadUserGroupDecorator() + public function testLoadUserGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -88,7 +88,7 @@ public function testLoadUserGroupByRemoteIdDecorator(): void $decoratedService->loadUserGroupByRemoteId(...$parameters); } - public function testLoadSubUserGroupsDecorator() + public function testLoadSubUserGroupsDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -105,7 +105,7 @@ public function testLoadSubUserGroupsDecorator() $decoratedService->loadSubUserGroups(...$parameters); } - public function testDeleteUserGroupDecorator() + public function testDeleteUserGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -117,7 +117,7 @@ public function testDeleteUserGroupDecorator() $decoratedService->deleteUserGroup(...$parameters); } - public function testMoveUserGroupDecorator() + public function testMoveUserGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -132,7 +132,7 @@ public function testMoveUserGroupDecorator() $decoratedService->moveUserGroup(...$parameters); } - public function testUpdateUserGroupDecorator() + public function testUpdateUserGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -147,7 +147,7 @@ public function testUpdateUserGroupDecorator() $decoratedService->updateUserGroup(...$parameters); } - public function testCreateUserDecorator() + public function testCreateUserDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -162,7 +162,7 @@ public function testCreateUserDecorator() $decoratedService->createUser(...$parameters); } - public function testLoadUserDecorator() + public function testLoadUserDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -177,7 +177,7 @@ public function testLoadUserDecorator() $decoratedService->loadUser(...$parameters); } - public function testCheckUserCredentialsDecorator() + public function testCheckUserCredentialsDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -192,7 +192,7 @@ public function testCheckUserCredentialsDecorator() $decoratedService->checkUserCredentials(...$parameters); } - public function testLoadUserByLoginDecorator() + public function testLoadUserByLoginDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -207,7 +207,7 @@ public function testLoadUserByLoginDecorator() $decoratedService->loadUserByLogin(...$parameters); } - public function testLoadUsersByEmailDecorator() + public function testLoadUsersByEmailDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -222,7 +222,7 @@ public function testLoadUsersByEmailDecorator() $decoratedService->loadUsersByEmail(...$parameters); } - public function testLoadUserByTokenDecorator() + public function testLoadUserByTokenDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -237,7 +237,7 @@ public function testLoadUserByTokenDecorator() $decoratedService->loadUserByToken(...$parameters); } - public function testDeleteUserDecorator() + public function testDeleteUserDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -249,7 +249,7 @@ public function testDeleteUserDecorator() $decoratedService->deleteUser(...$parameters); } - public function testUpdateUserDecorator() + public function testUpdateUserDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -279,7 +279,7 @@ public function testUpdateUserPasswordDecorator(): void $decoratedService->updateUserPassword(...$parameters); } - public function testUpdateUserTokenDecorator() + public function testUpdateUserTokenDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -294,7 +294,7 @@ public function testUpdateUserTokenDecorator() $decoratedService->updateUserToken(...$parameters); } - public function testExpireUserTokenDecorator() + public function testExpireUserTokenDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -306,7 +306,7 @@ public function testExpireUserTokenDecorator() $decoratedService->expireUserToken(...$parameters); } - public function testAssignUserToUserGroupDecorator() + public function testAssignUserToUserGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -321,7 +321,7 @@ public function testAssignUserToUserGroupDecorator() $decoratedService->assignUserToUserGroup(...$parameters); } - public function testUnAssignUserFromUserGroupDecorator() + public function testUnAssignUserFromUserGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -336,7 +336,7 @@ public function testUnAssignUserFromUserGroupDecorator() $decoratedService->unAssignUserFromUserGroup(...$parameters); } - public function testLoadUserGroupsOfUserDecorator() + public function testLoadUserGroupsOfUserDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -353,7 +353,7 @@ public function testLoadUserGroupsOfUserDecorator() $decoratedService->loadUserGroupsOfUser(...$parameters); } - public function testLoadUsersOfUserGroupDecorator() + public function testLoadUsersOfUserGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -370,7 +370,7 @@ public function testLoadUsersOfUserGroupDecorator() $decoratedService->loadUsersOfUserGroup(...$parameters); } - public function testIsUserDecorator() + public function testIsUserDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -382,7 +382,7 @@ public function testIsUserDecorator() $decoratedService->isUser(...$parameters); } - public function testIsUserGroupDecorator() + public function testIsUserGroupDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -394,7 +394,7 @@ public function testIsUserGroupDecorator() $decoratedService->isUserGroup(...$parameters); } - public function testNewUserCreateStructDecorator() + public function testNewUserCreateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -412,7 +412,7 @@ public function testNewUserCreateStructDecorator() $decoratedService->newUserCreateStruct(...$parameters); } - public function testNewUserGroupCreateStructDecorator() + public function testNewUserGroupCreateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -427,7 +427,7 @@ public function testNewUserGroupCreateStructDecorator() $decoratedService->newUserGroupCreateStruct(...$parameters); } - public function testNewUserUpdateStructDecorator() + public function testNewUserUpdateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -439,7 +439,7 @@ public function testNewUserUpdateStructDecorator() $decoratedService->newUserUpdateStruct(...$parameters); } - public function testNewUserGroupUpdateStructDecorator() + public function testNewUserGroupUpdateStructDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); @@ -451,7 +451,7 @@ public function testNewUserGroupUpdateStructDecorator() $decoratedService->newUserGroupUpdateStruct(...$parameters); } - public function testValidatePasswordDecorator() + public function testValidatePasswordDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); diff --git a/tests/lib/Repository/Filtering/TestContentProvider.php b/tests/lib/Repository/Filtering/TestContentProvider.php index 703f272d97..443ebf3b4a 100644 --- a/tests/lib/Repository/Filtering/TestContentProvider.php +++ b/tests/lib/Repository/Filtering/TestContentProvider.php @@ -28,11 +28,9 @@ class TestContentProvider 'article3' => 'remote-id-article-3', ]; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - private $repository; + private Repository $repository; - /** @var \Ibexa\Tests\Integration\Core\Repository\BaseTest */ - private $testInstance; + private BaseTest $testInstance; public function __construct(Repository $repository, BaseTest $testInstance) { diff --git a/tests/lib/Repository/Helper/FieldTypeRegistryTest.php b/tests/lib/Repository/Helper/FieldTypeRegistryTest.php index e28e538d0d..5048aa9e2f 100644 --- a/tests/lib/Repository/Helper/FieldTypeRegistryTest.php +++ b/tests/lib/Repository/Helper/FieldTypeRegistryTest.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\FieldType\FieldType; use Ibexa\Core\Base\Exceptions\NotFound\FieldTypeNotFoundException; use Ibexa\Core\FieldType\FieldTypeRegistry; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -19,7 +20,7 @@ class FieldTypeRegistryTest extends TestCase { private const FIELD_TYPE_ID = 'one'; - public function testConstructor() + public function testConstructor(): void { $fieldType = $this->getFieldTypeMock(); $fieldTypes = [self::FIELD_TYPE_ID => $fieldType]; @@ -28,12 +29,12 @@ public function testConstructor() self::assertTrue($registry->hasFieldType(self::FIELD_TYPE_ID)); } - protected function getFieldTypeMock() + protected function getFieldTypeMock(): MockObject { return $this->createMock(FieldType::class); } - public function testGetFieldType() + public function testGetFieldType(): void { $fieldTypes = [ self::FIELD_TYPE_ID => $this->getFieldTypeMock(), @@ -49,7 +50,7 @@ public function testGetFieldType() ); } - public function testGetFieldTypeThrowsNotFoundException() + public function testGetFieldTypeThrowsNotFoundException(): void { $this->expectException(FieldTypeNotFoundException::class); @@ -58,7 +59,7 @@ public function testGetFieldTypeThrowsNotFoundException() $registry->getFieldType('none'); } - public function testGetFieldTypeThrowsRuntimeExceptionIncorrectType() + public function testGetFieldTypeThrowsRuntimeExceptionIncorrectType(): void { $this->expectException(\TypeError::class); @@ -71,7 +72,7 @@ public function testGetFieldTypeThrowsRuntimeExceptionIncorrectType() $registry->getFieldType('none'); } - public function testGetFieldTypes() + public function testGetFieldTypes(): void { $fieldTypes = [ self::FIELD_TYPE_ID => $this->getFieldTypeMock(), diff --git a/tests/lib/Repository/Iterator/BatchIteratorTestAdapter.php b/tests/lib/Repository/Iterator/BatchIteratorTestAdapter.php index ecaa88840f..52e9d0d343 100644 --- a/tests/lib/Repository/Iterator/BatchIteratorTestAdapter.php +++ b/tests/lib/Repository/Iterator/BatchIteratorTestAdapter.php @@ -14,11 +14,9 @@ final class BatchIteratorTestAdapter implements BatchIteratorAdapter { - /** @var array */ - private $data; + private array $data; - /** @var int */ - private $fetchCounter; + private int $fetchCounter; public function __construct(array $data) { diff --git a/tests/lib/Repository/LegacySchemaImporter.php b/tests/lib/Repository/LegacySchemaImporter.php index 9f298bd0dc..0480bb30cb 100644 --- a/tests/lib/Repository/LegacySchemaImporter.php +++ b/tests/lib/Repository/LegacySchemaImporter.php @@ -24,8 +24,7 @@ */ final class LegacySchemaImporter { - /** @var \Doctrine\DBAL\Connection */ - private $connection; + private Connection $connection; public function __construct(Connection $connection) { diff --git a/tests/lib/Repository/LocationResolver/PermissionAwareLocationResolverTest.php b/tests/lib/Repository/LocationResolver/PermissionAwareLocationResolverTest.php index 1a100ef2f8..9701e31b4a 100644 --- a/tests/lib/Repository/LocationResolver/PermissionAwareLocationResolverTest.php +++ b/tests/lib/Repository/LocationResolver/PermissionAwareLocationResolverTest.php @@ -15,6 +15,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Core\Repository\LocationResolver\PermissionAwareLocationResolver; use Ibexa\Core\Repository\Values\Content\Location; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -23,10 +24,10 @@ final class PermissionAwareLocationResolverTest extends TestCase { /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - private $locationService; + private MockObject $locationService; /** @var \Ibexa\Core\Repository\LocationResolver\LocationResolver */ - private $locationResolver; + private PermissionAwareLocationResolver $locationResolver; public function setUp(): void { diff --git a/tests/lib/Repository/LocationServiceTest.php b/tests/lib/Repository/LocationServiceTest.php index 443e4020ab..d42fac48bb 100644 --- a/tests/lib/Repository/LocationServiceTest.php +++ b/tests/lib/Repository/LocationServiceTest.php @@ -23,7 +23,7 @@ final class LocationServiceTest extends TestCase { /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - private $locationService; + private LocationService $locationService; protected function setUp(): void { diff --git a/tests/lib/Repository/Mapper/ContentLocationMapper/DecoratedLocationServiceTest.php b/tests/lib/Repository/Mapper/ContentLocationMapper/DecoratedLocationServiceTest.php index 7904333c0c..db40899cd3 100644 --- a/tests/lib/Repository/Mapper/ContentLocationMapper/DecoratedLocationServiceTest.php +++ b/tests/lib/Repository/Mapper/ContentLocationMapper/DecoratedLocationServiceTest.php @@ -14,18 +14,19 @@ use Ibexa\Core\Repository\Mapper\ContentLocationMapper\ContentLocationMapper; use Ibexa\Core\Repository\Mapper\ContentLocationMapper\DecoratedLocationService; use Ibexa\Core\Repository\Values\Content\Location; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class DecoratedLocationServiceTest extends TestCase { /** @var \Ibexa\Core\Repository\Mapper\ContentLocationMapper\DecoratedLocationService */ - private $locationService; + private DecoratedLocationService $locationService; /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - private $innerLocationService; + private MockObject $innerLocationService; /** @var \Ibexa\Core\Repository\Mapper\ContentLocationMapper\ContentLocationMapper */ - private $mapper; + private MockObject $mapper; protected function setUp(): void { diff --git a/tests/lib/Repository/Mapper/ContentLocationMapper/InMemoryContentLocationMapperTest.php b/tests/lib/Repository/Mapper/ContentLocationMapper/InMemoryContentLocationMapperTest.php index 516b201ed4..1b0fe6fbf3 100644 --- a/tests/lib/Repository/Mapper/ContentLocationMapper/InMemoryContentLocationMapperTest.php +++ b/tests/lib/Repository/Mapper/ContentLocationMapper/InMemoryContentLocationMapperTest.php @@ -14,7 +14,7 @@ class InMemoryContentLocationMapperTest extends TestCase { /** @var \Ibexa\Core\Repository\Mapper\ContentLocationMapper\ContentLocationMapper */ - private $mapper; + private InMemoryContentLocationMapper $mapper; protected function setUp(): void { diff --git a/tests/lib/Repository/NameSchema/NameSchemaServiceTest.php b/tests/lib/Repository/NameSchema/NameSchemaServiceTest.php index d0099d92dd..9786635e93 100644 --- a/tests/lib/Repository/NameSchema/NameSchemaServiceTest.php +++ b/tests/lib/Repository/NameSchema/NameSchemaServiceTest.php @@ -327,7 +327,7 @@ protected function getFieldDefinitions(): APIFieldDefinitionCollection * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - protected function buildTestContentObject() + protected function buildTestContentObject(): Content { return new Content( [ diff --git a/tests/lib/Repository/PHPUnitConstraint/AllValidationErrorsOccur.php b/tests/lib/Repository/PHPUnitConstraint/AllValidationErrorsOccur.php index 96866bb90b..96d147e9a4 100644 --- a/tests/lib/Repository/PHPUnitConstraint/AllValidationErrorsOccur.php +++ b/tests/lib/Repository/PHPUnitConstraint/AllValidationErrorsOccur.php @@ -24,12 +24,12 @@ class AllValidationErrorsOccur extends AbstractPHPUnitConstraint { /** @var string[] */ - private $expectedValidationErrorMessages; + private array $expectedValidationErrorMessages; /** * @var string[] */ - private $missingValidationErrorMessages = []; + private array $missingValidationErrorMessages = []; /** * @param string[] $expectedValidationErrorMessages diff --git a/tests/lib/Repository/PHPUnitConstraint/ContentItemEquals.php b/tests/lib/Repository/PHPUnitConstraint/ContentItemEquals.php index 3a76c7c053..14b46eac65 100644 --- a/tests/lib/Repository/PHPUnitConstraint/ContentItemEquals.php +++ b/tests/lib/Repository/PHPUnitConstraint/ContentItemEquals.php @@ -19,8 +19,7 @@ class ContentItemEquals extends AbstractPHPUnitConstraint { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - private $expectedContent; + private Content $expectedContent; public function __construct(Content $expectedContent) { diff --git a/tests/lib/Repository/PHPUnitConstraint/ValidationErrorOccurs.php b/tests/lib/Repository/PHPUnitConstraint/ValidationErrorOccurs.php index d27a1983a7..29a967687d 100644 --- a/tests/lib/Repository/PHPUnitConstraint/ValidationErrorOccurs.php +++ b/tests/lib/Repository/PHPUnitConstraint/ValidationErrorOccurs.php @@ -16,8 +16,7 @@ */ class ValidationErrorOccurs extends AllValidationErrorsOccur { - /** @var string */ - private $expectedValidationErrorMessage; + private string $expectedValidationErrorMessage; /** * @param string $expectedValidationErrorMessage diff --git a/tests/lib/Repository/Parallel/ParallelProcessList.php b/tests/lib/Repository/Parallel/ParallelProcessList.php index 60293d22a0..de1585d918 100644 --- a/tests/lib/Repository/Parallel/ParallelProcessList.php +++ b/tests/lib/Repository/Parallel/ParallelProcessList.php @@ -13,7 +13,7 @@ final class ParallelProcessList implements \IteratorAggregate { /** @var \Jenner\SimpleFork\Process[] */ - private $pool = []; + private array $pool = []; public function addProcess(Process $process): void { diff --git a/tests/lib/Repository/Permission/CachedPermissionServiceTest.php b/tests/lib/Repository/Permission/CachedPermissionServiceTest.php index 81e50df53e..2df8be4afa 100644 --- a/tests/lib/Repository/Permission/CachedPermissionServiceTest.php +++ b/tests/lib/Repository/Permission/CachedPermissionServiceTest.php @@ -13,7 +13,7 @@ * * @return int */ -function time() +function time(): int|float { static $time = 1417624981; @@ -29,6 +29,7 @@ function time() use Ibexa\Contracts\Core\Repository\Values\User\UserReference; use Ibexa\Contracts\Core\Repository\Values\ValueObject; use Ibexa\Core\Repository\Permission\CachedPermissionService; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -36,7 +37,7 @@ function time() */ class CachedPermissionServiceTest extends TestCase { - public function providerForTestPermissionResolverPassTrough() + public function providerForTestPermissionResolverPassTrough(): array { $valueObject = $this ->getMockBuilder(ValueObject::class) @@ -58,7 +59,7 @@ public function providerForTestPermissionResolverPassTrough() ['setCurrentUserReference', [$userRef], null], ['hasAccess', ['content', 'remove', $userRef], false], ['canUser', ['content', 'remove', $valueObject, [new \stdClass()]], true], - ['sudo', [static function () {}, $repository], null], + ['sudo', [static function (): void {}, $repository], null], ]; } @@ -71,7 +72,7 @@ public function providerForTestPermissionResolverPassTrough() * @param array $arguments * @param $expectedReturn */ - public function testPermissionResolverPassTrough($method, array $arguments, $expectedReturn) + public function testPermissionResolverPassTrough(string $method, array $arguments, (UserReference&MockObject)|bool|null $expectedReturn): void { if ($expectedReturn !== null) { $this->getPermissionResolverMock([$method]) @@ -92,7 +93,7 @@ public function testPermissionResolverPassTrough($method, array $arguments, $exp self::assertSame($expectedReturn, $actualReturn); } - public function testGetPermissionsCriterionPassTrough() + public function testGetPermissionsCriterionPassTrough(): void { $criterionMock = $this ->getMockBuilder(Criterion::class) @@ -111,7 +112,7 @@ public function testGetPermissionsCriterionPassTrough() self::assertSame($criterionMock, $actualReturn); } - public function testGetPermissionsCriterionCaching() + public function testGetPermissionsCriterionCaching(): void { $criterionMock = $this ->getMockBuilder(Criterion::class) @@ -169,7 +170,7 @@ public function testSetCurrentUserReferenceCacheClear(): void * * @return \Ibexa\Core\Repository\Permission\CachedPermissionService */ - protected function getCachedPermissionService($ttl = 5) + protected function getCachedPermissionService($ttl = 5): CachedPermissionService { return new CachedPermissionService( $this->getPermissionResolverMock(), @@ -178,9 +179,9 @@ protected function getCachedPermissionService($ttl = 5) ); } - protected $permissionResolverMock; + protected ?MockObject $permissionResolverMock = null; - protected function getPermissionResolverMock($methods = []) + protected function getPermissionResolverMock(?array $methods = []) { // Tests first calls here with methods set before initiating PermissionCriterionResolver with same instance. if ($this->permissionResolverMock !== null) { @@ -194,9 +195,9 @@ protected function getPermissionResolverMock($methods = []) ->getMockForAbstractClass(); } - protected $permissionCriterionResolverMock; + protected ?MockObject $permissionCriterionResolverMock = null; - protected function getPermissionCriterionResolverMock($methods = []) + protected function getPermissionCriterionResolverMock(?array $methods = []) { // Tests first calls here with methods set before initiating PermissionCriterionResolver with same instance. if ($this->permissionCriterionResolverMock !== null) { diff --git a/tests/lib/Repository/Permission/PermissionCriterionResolverTest.php b/tests/lib/Repository/Permission/PermissionCriterionResolverTest.php index 693d62c45a..d40af91736 100644 --- a/tests/lib/Repository/Permission/PermissionCriterionResolverTest.php +++ b/tests/lib/Repository/Permission/PermissionCriterionResolverTest.php @@ -10,12 +10,15 @@ use Ibexa\Contracts\Core\Limitation\Type; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalOr; use Ibexa\Contracts\Core\Repository\Values\User\Limitation; use Ibexa\Contracts\Core\Repository\Values\User\User; use Ibexa\Core\Limitation\TargetOnlyLimitationType; use Ibexa\Core\Repository\Permission\LimitationService; use Ibexa\Core\Repository\Permission\PermissionCriterionResolver; use Ibexa\Core\Repository\Values\User\Policy; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -23,7 +26,7 @@ */ class PermissionCriterionResolverTest extends TestCase { - public function providerForTestGetPermissionsCriterion() + public function providerForTestGetPermissionsCriterion(): array { $criterionMock = $this ->getMockBuilder(Criterion::class) @@ -68,7 +71,7 @@ public function providerForTestGetPermissionsCriterion() 'policies' => [$policy1, $policy1], ], ], - new Criterion\LogicalOr([$criterionMock, $criterionMock]), + new LogicalOr([$criterionMock, $criterionMock]), ], [ $criterionMock, @@ -90,7 +93,7 @@ public function providerForTestGetPermissionsCriterion() 'policies' => [$policy2], ], ], - new Criterion\LogicalAnd([$criterionMock, $criterionMock]), + new LogicalAnd([$criterionMock, $criterionMock]), ], [ $criterionMock, @@ -101,10 +104,10 @@ public function providerForTestGetPermissionsCriterion() 'policies' => [$policy1, $policy2], ], ], - new Criterion\LogicalOr( + new LogicalOr( [ $criterionMock, - new Criterion\LogicalAnd([$criterionMock, $criterionMock]), + new LogicalAnd([$criterionMock, $criterionMock]), ] ), ], @@ -121,7 +124,7 @@ public function providerForTestGetPermissionsCriterion() 'policies' => [$policy1], ], ], - new Criterion\LogicalOr([$criterionMock, $criterionMock]), + new LogicalOr([$criterionMock, $criterionMock]), ], [ $criterionMock, @@ -136,7 +139,7 @@ public function providerForTestGetPermissionsCriterion() 'policies' => [$policy1, $policy1], ], ], - new Criterion\LogicalOr([$criterionMock, $criterionMock, $criterionMock]), + new LogicalOr([$criterionMock, $criterionMock, $criterionMock]), ], [ $criterionMock, @@ -151,9 +154,9 @@ public function providerForTestGetPermissionsCriterion() 'policies' => [$policy1], ], ], - new Criterion\LogicalOr( + new LogicalOr( [ - new Criterion\LogicalAnd([$criterionMock, $criterionMock]), + new LogicalAnd([$criterionMock, $criterionMock]), $criterionMock, ] ), @@ -167,7 +170,7 @@ public function providerForTestGetPermissionsCriterion() 'policies' => [$policy1], ], ], - new Criterion\LogicalAnd([$criterionMock, $criterionMock]), + new LogicalAnd([$criterionMock, $criterionMock]), ], [ $criterionMock, @@ -182,10 +185,10 @@ public function providerForTestGetPermissionsCriterion() 'policies' => [$policy1], ], ], - new Criterion\LogicalOr( + new LogicalOr( [ - new Criterion\LogicalAnd([$criterionMock, $criterionMock]), - new Criterion\LogicalAnd([$criterionMock, $criterionMock]), + new LogicalAnd([$criterionMock, $criterionMock]), + new LogicalAnd([$criterionMock, $criterionMock]), ] ), ], @@ -213,7 +216,7 @@ public function providerForTestGetPermissionsCriterion() 'policies' => [new Policy(['limitations' => []])], ], ], - new Criterion\LogicalOr([$criterionMock, $criterionMock]), + new LogicalOr([$criterionMock, $criterionMock]), ], [ $criterionMock, @@ -224,12 +227,12 @@ public function providerForTestGetPermissionsCriterion() 'policies' => [$policy3], ], ], - new Criterion\LogicalAnd([$criterionMock, $criterionMock]), + new LogicalAnd([$criterionMock, $criterionMock]), ], ]; } - protected function mockServices($criterionMock, $limitationCount, $permissionSets) + protected function mockServices($criterionMock, int $limitationCount, $permissionSets) { $userMock = $this->getMockBuilder(User::class)->getMockForAbstractClass(); $limitationServiceMock = $this->getLimitationServiceMock(['getLimitationType']); @@ -291,11 +294,11 @@ protected function mockServices($criterionMock, $limitationCount, $permissionSet * @dataProvider providerForTestGetPermissionsCriterion */ public function testGetPermissionsCriterion( - $criterionMock, - $limitationCount, - $permissionSets, - $expectedCriterion - ) { + MockObject&Criterion $criterionMock, + int $limitationCount, + array $permissionSets, + (Criterion&MockObject)|LogicalOr|bool|LogicalAnd $expectedCriterion + ): void { $this->mockServices($criterionMock, $limitationCount, $permissionSets); $criterionResolver = $this->getPermissionCriterionResolverMock(null); @@ -304,7 +307,7 @@ public function testGetPermissionsCriterion( self::assertEquals($expectedCriterion, $permissionsCriterion); } - public function providerForTestGetPermissionsCriterionBooleanPermissionSets() + public function providerForTestGetPermissionsCriterionBooleanPermissionSets(): array { return [ [true], @@ -317,7 +320,7 @@ public function providerForTestGetPermissionsCriterionBooleanPermissionSets() * * @dataProvider providerForTestGetPermissionsCriterionBooleanPermissionSets */ - public function testGetPermissionsCriterionBooleanPermissionSets($permissionSets) + public function testGetPermissionsCriterionBooleanPermissionSets(bool $permissionSets): void { $permissionResolverMock = $this->getPermissionResolverMock(['hasAccess']); $permissionResolverMock @@ -340,7 +343,7 @@ public function testGetPermissionsCriterionBooleanPermissionSets($permissionSets * * @return \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\Repository\Permission\PermissionCriterionResolver */ - protected function getPermissionCriterionResolverMock($methods = []) + protected function getPermissionCriterionResolverMock(?array $methods = []): MockObject { return $this ->getMockBuilder(PermissionCriterionResolver::class) @@ -354,9 +357,9 @@ protected function getPermissionCriterionResolverMock($methods = []) ->getMock(); } - protected $permissionResolverMock; + protected ?MockObject $permissionResolverMock = null; - protected function getPermissionResolverMock($methods = []) + protected function getPermissionResolverMock(?array $methods = []) { // Tests first calls here with methods set before initiating PermissionCriterionResolver with same instance. if ($this->permissionResolverMock !== null) { @@ -370,9 +373,9 @@ protected function getPermissionResolverMock($methods = []) ->getMockForAbstractClass(); } - protected $limitationServiceMock; + protected ?MockObject $limitationServiceMock = null; - protected function getLimitationServiceMock($methods = []) + protected function getLimitationServiceMock(?array $methods = []) { // Tests first calls here with methods set before initiating PermissionCriterionResolver with same instance. if ($this->limitationServiceMock !== null) { diff --git a/tests/lib/Repository/Service/Mock/Base.php b/tests/lib/Repository/Service/Mock/Base.php index c8586cf24d..3893e7e670 100644 --- a/tests/lib/Repository/Service/Mock/Base.php +++ b/tests/lib/Repository/Service/Mock/Base.php @@ -48,20 +48,19 @@ */ abstract class Base extends TestCase { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - private $repository; + private ?Repository $repository = null; /** @var \Ibexa\Contracts\Core\Repository\Repository|\PHPUnit\Framework\MockObject\MockObject */ - private $repositoryMock; + private ?MockObject $repositoryMock = null; /** @var \Ibexa\Contracts\Core\Repository\PermissionService|\PHPUnit\Framework\MockObject\MockObject */ - private $permissionServiceMock; + private ?MockObject $permissionServiceMock = null; /** @var \Ibexa\Contracts\Core\Persistence\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $persistenceMock; + private ?MockObject $persistenceMock = null; /** @var \Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\ThumbnailStrategy|\PHPUnit\Framework\MockObject\MockObject */ - private $thumbnailStrategyMock; + private ?MockObject $thumbnailStrategyMock = null; /** * The Content / Location / Search ... handlers for the persistence / Search / .. handler mocks. @@ -70,22 +69,22 @@ abstract class Base extends TestCase * * @see getPersistenceMockHandler() */ - private $spiMockHandlers = []; + private array $spiMockHandlers = []; /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\Repository\Mapper\ContentTypeDomainMapper */ - private $contentTypeDomainMapperMock; + private ?MockObject $contentTypeDomainMapperMock = null; /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\Repository\Mapper\ContentDomainMapper */ - private $contentDomainMapperMock; + private ?MockObject $contentDomainMapperMock = null; /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\Repository\Permission\LimitationService */ - private $limitationServiceMock; + private ?MockObject $limitationServiceMock = null; /** @var \Ibexa\Contracts\Core\Repository\LanguageResolver|\PHPUnit\Framework\MockObject\MockObject */ - private $languageResolverMock; + private ?MockObject $languageResolverMock = null; /** @var \Ibexa\Core\Repository\Mapper\RoleDomainMapper|\PHPUnit\Framework\MockObject\MockObject */ - protected $roleDomainMapperMock; + protected ?MockObject $roleDomainMapperMock = null; /** @var \Ibexa\Core\Repository\Mapper\ContentMapper|\PHPUnit\Framework\MockObject\MockObject */ protected $contentMapperMock; @@ -94,10 +93,10 @@ abstract class Base extends TestCase protected $contentValidatorStrategyMock; /** @var \Ibexa\Contracts\Core\Persistence\Filter\Content\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $contentFilteringHandlerMock; + private ?MockObject $contentFilteringHandlerMock = null; /** @var \Ibexa\Contracts\Core\Persistence\Filter\Location\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $locationFilteringHandlerMock; + private ?MockObject $locationFilteringHandlerMock = null; private TransactionHandler&MockObject $transactionHandlerMock; @@ -146,7 +145,7 @@ protected function getRepository(array $serviceSettings = []) return $this->repository; } - protected $fieldTypeServiceMock; + protected ?MockObject $fieldTypeServiceMock = null; /** * @return \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\Repository\FieldTypeService @@ -160,7 +159,7 @@ protected function getFieldTypeServiceMock() return $this->fieldTypeServiceMock; } - protected $fieldTypeRegistryMock; + protected ?MockObject $fieldTypeRegistryMock = null; /** * @return \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\FieldType\FieldTypeRegistry diff --git a/tests/lib/Repository/Service/Mock/BookmarkTest.php b/tests/lib/Repository/Service/Mock/BookmarkTest.php index ec5e1c4937..531699c447 100644 --- a/tests/lib/Repository/Service/Mock/BookmarkTest.php +++ b/tests/lib/Repository/Service/Mock/BookmarkTest.php @@ -52,7 +52,7 @@ protected function setUp(): void /** * @covers \Ibexa\Contracts\Core\Repository\BookmarkService::createBookmark */ - public function testCreateBookmark() + public function testCreateBookmark(): void { $location = $this->createLocation(self::LOCATION_ID); @@ -64,11 +64,11 @@ public function testCreateBookmark() ->with(self::CURRENT_USER_ID, [self::LOCATION_ID]) ->willReturn([]); - $this->assertTransactionIsCommitted(function () { + $this->assertTransactionIsCommitted(function (): void { $this->bookmarkHandler ->expects($this->once()) ->method('create') - ->willReturnCallback(function (CreateStruct $createStruct) { + ->willReturnCallback(function (CreateStruct $createStruct): Bookmark { $this->assertEquals(self::LOCATION_ID, $createStruct->locationId); $this->assertEquals(self::CURRENT_USER_ID, $createStruct->userId); @@ -82,7 +82,7 @@ public function testCreateBookmark() /** * @covers \Ibexa\Contracts\Core\Repository\BookmarkService::createBookmark */ - public function testCreateBookmarkThrowsInvalidArgumentException() + public function testCreateBookmarkThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -96,7 +96,7 @@ public function testCreateBookmarkThrowsInvalidArgumentException() ->with(self::CURRENT_USER_ID, [self::LOCATION_ID]) ->willReturn([self::LOCATION_ID => new Bookmark()]); - $this->assertTransactionIsNotStarted(function () { + $this->assertTransactionIsNotStarted(function (): void { $this->bookmarkHandler->expects($this->never())->method('create'); }); @@ -106,9 +106,9 @@ public function testCreateBookmarkThrowsInvalidArgumentException() /** * @covers \Ibexa\Contracts\Core\Repository\BookmarkService::createBookmark */ - public function testCreateBookmarkWithRollback() + public function testCreateBookmarkWithRollback(): void { - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $location = $this->createLocation(self::LOCATION_ID); @@ -120,7 +120,7 @@ public function testCreateBookmarkWithRollback() ->with(self::CURRENT_USER_ID, [self::LOCATION_ID]) ->willReturn([]); - $this->assertTransactionIsRollback(function () { + $this->assertTransactionIsRollback(function (): void { $this->bookmarkHandler ->expects($this->once()) ->method('create') @@ -133,7 +133,7 @@ public function testCreateBookmarkWithRollback() /** * @covers \Ibexa\Contracts\Core\Repository\BookmarkService::deleteBookmark */ - public function testDeleteBookmarkExisting() + public function testDeleteBookmarkExisting(): void { $location = $this->createLocation(self::LOCATION_ID); @@ -147,7 +147,7 @@ public function testDeleteBookmarkExisting() ->with(self::CURRENT_USER_ID, [self::LOCATION_ID]) ->willReturn([self::LOCATION_ID => $bookmark]); - $this->assertTransactionIsCommitted(function () use ($bookmark) { + $this->assertTransactionIsCommitted(function () use ($bookmark): void { $this->bookmarkHandler ->expects($this->once()) ->method('delete') @@ -160,9 +160,9 @@ public function testDeleteBookmarkExisting() /** * @covers \Ibexa\Contracts\Core\Repository\BookmarkService::deleteBookmark */ - public function testDeleteBookmarkWithRollback() + public function testDeleteBookmarkWithRollback(): void { - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $location = $this->createLocation(self::LOCATION_ID); @@ -174,7 +174,7 @@ public function testDeleteBookmarkWithRollback() ->with(self::CURRENT_USER_ID, [self::LOCATION_ID]) ->willReturn([self::LOCATION_ID => new Bookmark(['id' => self::BOOKMARK_ID])]); - $this->assertTransactionIsRollback(function () { + $this->assertTransactionIsRollback(function (): void { $this->bookmarkHandler ->expects($this->once()) ->method('delete') @@ -187,7 +187,7 @@ public function testDeleteBookmarkWithRollback() /** * @covers \Ibexa\Contracts\Core\Repository\BookmarkService::deleteBookmark */ - public function testDeleteBookmarkNonExisting() + public function testDeleteBookmarkNonExisting(): void { $this->expectException(InvalidArgumentException::class); @@ -201,7 +201,7 @@ public function testDeleteBookmarkNonExisting() ->with(self::CURRENT_USER_ID, [self::LOCATION_ID]) ->willReturn([]); - $this->assertTransactionIsNotStarted(function () { + $this->assertTransactionIsNotStarted(function (): void { $this->bookmarkHandler->expects($this->never())->method('delete'); }); @@ -211,13 +211,13 @@ public function testDeleteBookmarkNonExisting() /** * @covers \Ibexa\Contracts\Core\Repository\BookmarkService::loadBookmarks */ - public function testLoadBookmarks() + public function testLoadBookmarks(): void { $offset = 0; $limit = 25; $expectedTotalCount = 10; - $expectedItems = array_map(function ($locationId) { + $expectedItems = array_map(function ($locationId): Location { return $this->createLocation($locationId); }, range(1, $expectedTotalCount)); @@ -231,7 +231,7 @@ public function testLoadBookmarks() ->expects(self::once()) ->method('loadUserBookmarks') ->with(self::CURRENT_USER_ID, $offset, $limit) - ->willReturn(array_map(static function ($locationId) { + ->willReturn(array_map(static function ($locationId): Bookmark { return new Bookmark(['locationId' => $locationId]); }, range(1, $expectedTotalCount))); @@ -239,7 +239,7 @@ public function testLoadBookmarks() $locationServiceMock ->expects(self::exactly($expectedTotalCount)) ->method('loadLocation') - ->willReturnCallback(function ($locationId) { + ->willReturnCallback(function ($locationId): Location { return $this->createLocation($locationId); }); @@ -258,7 +258,7 @@ public function testLoadBookmarks() /** * @covers \Ibexa\Contracts\Core\Repository\BookmarkService::loadBookmarks */ - public function testLoadBookmarksEmptyList() + public function testLoadBookmarksEmptyList(): void { $this->bookmarkHandler ->expects(self::once()) @@ -279,7 +279,7 @@ public function testLoadBookmarksEmptyList() /** * @covers \Ibexa\Contracts\Core\Repository\BookmarkService::isBookmarked */ - public function testLocationShouldNotBeBookmarked() + public function testLocationShouldNotBeBookmarked(): void { $this->bookmarkHandler ->expects(self::once()) @@ -293,7 +293,7 @@ public function testLocationShouldNotBeBookmarked() /** * @covers \Ibexa\Contracts\Core\Repository\BookmarkService::isBookmarked */ - public function testLocationShouldBeBookmarked() + public function testLocationShouldBeBookmarked(): void { $this->bookmarkHandler ->expects(self::once()) @@ -361,7 +361,7 @@ private function createLocation(int $id = self::CURRENT_USER_ID, string $name = /** * @return \Ibexa\Contracts\Core\Repository\BookmarkService|\PHPUnit\Framework\MockObject\MockObject */ - private function createBookmarkService(array $methods = null) + private function createBookmarkService(array $methods = null): MockObject { return $this ->getMockBuilder(BookmarkService::class) diff --git a/tests/lib/Repository/Service/Mock/ContentDomainMapperTest.php b/tests/lib/Repository/Service/Mock/ContentDomainMapperTest.php index 7eba82e583..2d5fb51e45 100644 --- a/tests/lib/Repository/Service/Mock/ContentDomainMapperTest.php +++ b/tests/lib/Repository/Service/Mock/ContentDomainMapperTest.php @@ -47,7 +47,7 @@ final class ContentDomainMapperTest extends BaseServiceMockTest /** * @dataProvider providerForBuildVersionInfo */ - public function testBuildVersionInfo(SPIVersionInfo $spiVersionInfo) + public function testBuildVersionInfo(SPIVersionInfo $spiVersionInfo): void { $languageHandlerMock = $this->getLanguageHandlerMock(); $languageHandlerMock->expects(self::never())->method('load'); @@ -57,7 +57,7 @@ public function testBuildVersionInfo(SPIVersionInfo $spiVersionInfo) self::assertInstanceOf(APIVersionInfo::class, $versionInfo); } - public function testBuildLocationWithContentForRootLocation() + public function testBuildLocationWithContentForRootLocation(): void { $spiRootLocation = new Location(['id' => 1, 'parentId' => 1]); $apiRootLocation = $this->getContentDomainMapper()->buildLocationWithContent($spiRootLocation, null); @@ -100,7 +100,7 @@ public function testBuildLocationWithContentForRootLocation() self::assertEquals($expectedContent, $apiRootLocation->getContent()); } - public function testBuildLocationWithContentThrowsInvalidArgumentException() + public function testBuildLocationWithContentThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$content\' is invalid: Location 2 has missing Content'); @@ -110,7 +110,7 @@ public function testBuildLocationWithContentThrowsInvalidArgumentException() $this->getContentDomainMapper()->buildLocationWithContent($nonRootLocation, null); } - public function testBuildLocationWithContentIsAlignedWithBuildLocation() + public function testBuildLocationWithContentIsAlignedWithBuildLocation(): void { $spiRootLocation = new Location(['id' => 1, 'parentId' => 1]); @@ -148,7 +148,7 @@ public function testBuildDomainFieldsDeprecatedBehavior(): void $this->getContentDomainMapper()->buildDomainFields($persistenceFields, $persistenceContentType); } - public function providerForBuildVersionInfo() + public function providerForBuildVersionInfo(): array { $properties = [ 'contentInfo' => new SPIContentInfo([ @@ -202,7 +202,7 @@ public function providerForBuildVersionInfo() ]; } - public function providerForBuildLocationDomainObjectsOnSearchResult() + public function providerForBuildLocationDomainObjectsOnSearchResult(): array { $properties = [ 'contentTypeId' => self::EXAMPLE_CONTENT_TYPE_ID, @@ -262,7 +262,7 @@ public function testBuildLocationDomainObjectsOnSearchResult( array $languageFilter, array $contentInfoList, int $missing - ) { + ): void { $contentHandlerMock = $this->getContentHandlerMock(); $contentHandlerMock ->expects(self::once()) diff --git a/tests/lib/Repository/Service/Mock/ContentTest.php b/tests/lib/Repository/Service/Mock/ContentTest.php index 7fab4d7e47..f013a5fc41 100644 --- a/tests/lib/Repository/Service/Mock/ContentTest.php +++ b/tests/lib/Repository/Service/Mock/ContentTest.php @@ -58,6 +58,7 @@ use Ibexa\Core\Repository\Values\ContentType\FieldDefinitionCollection; use Ibexa\Core\Repository\Values\User\UserReference; use Ibexa\Tests\Core\Repository\Service\Mock\Base as BaseServiceMockTest; +use PHPUnit\Framework\MockObject\MockObject; /** * Mock test case for Content service. @@ -109,7 +110,7 @@ public function testConstructor(): void * * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadVersionInfoById */ - public function testLoadVersionInfoById() + public function testLoadVersionInfoById(): void { $contentServiceMock = $this->getPartlyMockedContentService(['loadContentInfo']); /** @var \PHPUnit\Framework\MockObject\MockObject $contentHandler */ @@ -159,7 +160,7 @@ public function testLoadVersionInfoById() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadVersionInfoById */ - public function testLoadVersionInfoByIdAndVersionNumber() + public function testLoadVersionInfoByIdAndVersionNumber(): void { $permissionResolver = $this->getPermissionResolverMock(); $contentServiceMock = $this->getPartlyMockedContentService(['loadContentInfo']); @@ -206,7 +207,7 @@ public function testLoadVersionInfoByIdAndVersionNumber() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadVersionInfoById */ - public function testLoadVersionInfoByIdThrowsNotFoundException() + public function testLoadVersionInfoByIdThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -239,7 +240,7 @@ public function testLoadVersionInfoByIdThrowsNotFoundException() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadVersionInfoById */ - public function testLoadVersionInfoByIdThrowsUnauthorizedExceptionNonPublishedVersion() + public function testLoadVersionInfoByIdThrowsUnauthorizedExceptionNonPublishedVersion(): void { $this->expectException(UnauthorizedException::class); @@ -284,7 +285,7 @@ public function testLoadVersionInfoByIdThrowsUnauthorizedExceptionNonPublishedVe * * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadVersionInfoById */ - public function testLoadVersionInfoByIdPublishedVersion() + public function testLoadVersionInfoByIdPublishedVersion(): void { $contentServiceMock = $this->getPartlyMockedContentService(); /** @var \PHPUnit\Framework\MockObject\MockObject $contentHandler */ @@ -329,7 +330,7 @@ public function testLoadVersionInfoByIdPublishedVersion() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadVersionInfoById */ - public function testLoadVersionInfoByIdNonPublishedVersion() + public function testLoadVersionInfoByIdNonPublishedVersion(): void { $contentServiceMock = $this->getPartlyMockedContentService(); /** @var \PHPUnit\Framework\MockObject\MockObject $contentHandler */ @@ -380,7 +381,7 @@ public function testLoadVersionInfoByIdNonPublishedVersion() * @depends Ibexa\Tests\Core\Repository\Service\Mock\ContentTest::testLoadVersionInfoByIdPublishedVersion * @depends Ibexa\Tests\Core\Repository\Service\Mock\ContentTest::testLoadVersionInfoByIdNonPublishedVersion */ - public function testLoadVersionInfo() + public function testLoadVersionInfo(): void { $expectedResult = $this->createMock(VersionInfo::class); @@ -406,7 +407,7 @@ public function testLoadVersionInfo() self::assertEquals($expectedResult, $result); } - public function testLoadContent() + public function testLoadContent(): void { $contentService = $this->getPartlyMockedContentService(['internalLoadContentById']); $content = $this->createMock(APIContent::class); @@ -437,7 +438,7 @@ public function testLoadContent() self::assertSame($content, $contentService->loadContent($contentId)); } - public function testLoadContentNonPublished() + public function testLoadContentNonPublished(): void { $contentService = $this->getPartlyMockedContentService(['internalLoadContentById']); $content = $this->createMock(APIContent::class); @@ -470,7 +471,7 @@ public function testLoadContentNonPublished() self::assertSame($content, $contentService->loadContent($contentId)); } - public function testLoadContentUnauthorized() + public function testLoadContentUnauthorized(): void { $this->expectException(UnauthorizedException::class); @@ -494,7 +495,7 @@ public function testLoadContentUnauthorized() $contentService->loadContent($contentId); } - public function testLoadContentNotPublishedStatusUnauthorized() + public function testLoadContentNotPublishedStatusUnauthorized(): void { $this->expectException(UnauthorizedException::class); @@ -575,7 +576,7 @@ public function testInternalLoadContentById(int $id, ?array $languages, ?int $ve /** * @dataProvider internalLoadContentProviderByRemoteId */ - public function testInternalLoadContentByRemoteId(string $remoteId, ?array $languages, ?int $versionNo, bool $useAlwaysAvailable) + public function testInternalLoadContentByRemoteId(string $remoteId, ?array $languages, ?int $versionNo, bool $useAlwaysAvailable): void { $realId = 123; @@ -657,7 +658,7 @@ public function testInternalLoadContentByIdNotFound(): void ->expects(self::once()) ->method('loadContentInfo') ->with($id) - ->willReturn(new SPIContent\ContentInfo(['id' => $id])); + ->willReturn(new SPIContentInfo(['id' => $id])); $contentHandler ->expects(self::once()) @@ -688,7 +689,7 @@ public function testInternalLoadContentByRemoteIdNotFound(): void ->expects(self::once()) ->method('loadContentInfoByRemoteId') ->with($remoteId) - ->willReturn(new SPIContent\ContentInfo(['id' => $id])); + ->willReturn(new SPIContentInfo(['id' => $id])); $contentHandler ->expects(self::once()) @@ -707,7 +708,7 @@ public function testInternalLoadContentByRemoteIdNotFound(): void * * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentByContentInfo */ - public function testLoadContentByContentInfo() + public function testLoadContentByContentInfo(): void { $versionInfo = $this->createMock(APIVersionInfo::class); $content = $this->createMock(APIContent::class); @@ -749,7 +750,7 @@ public function testLoadContentByContentInfo() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentByVersionInfo */ - public function testLoadContentByVersionInfo() + public function testLoadContentByVersionInfo(): void { $expectedResult = $this->createMock(Content::class); @@ -787,7 +788,7 @@ public function testLoadContentByVersionInfo() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteContent */ - public function testDeleteContentThrowsUnauthorizedException() + public function testDeleteContentThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -836,7 +837,7 @@ public function testDeleteContentThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteContent */ - public function testDeleteContent() + public function testDeleteContent(): void { $repository = $this->getRepositoryMock(); $permissionResolver = $this->getPermissionResolverMock(); @@ -912,9 +913,9 @@ public function testDeleteContent() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteContent */ - public function testDeleteContentWithRollback() + public function testDeleteContentWithRollback(): void { - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $repository = $this->getRepositoryMock(); $permissionResolver = $this->getPermissionResolverMock(); @@ -962,7 +963,7 @@ public function testDeleteContentWithRollback() $locationHandler->expects(self::once()) ->method('loadLocationsByContent') ->with(42) - ->will(self::throwException(new \Exception())); + ->will(self::throwException(new Exception())); $repository->expects(self::once())->method('rollback'); @@ -975,7 +976,7 @@ public function testDeleteContentWithRollback() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteVersion */ - public function testDeleteVersionThrowsBadStateExceptionLastVersion() + public function testDeleteVersionThrowsBadStateExceptionLastVersion(): void { $this->expectException(BadStateException::class); @@ -1034,7 +1035,7 @@ public function testDeleteVersionThrowsBadStateExceptionLastVersion() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::createContent */ - public function testCreateContentThrowsInvalidArgumentExceptionMainLanguageCodeNotSet() + public function testCreateContentThrowsInvalidArgumentExceptionMainLanguageCodeNotSet(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$contentCreateStruct\' is invalid: the \'mainLanguageCode\' property must be set'); @@ -1048,7 +1049,7 @@ public function testCreateContentThrowsInvalidArgumentExceptionMainLanguageCodeN * * @covers \Ibexa\Contracts\Core\Repository\ContentService::createContent */ - public function testCreateContentThrowsInvalidArgumentExceptionContentTypeNotSet() + public function testCreateContentThrowsInvalidArgumentExceptionContentTypeNotSet(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Argument \'$contentCreateStruct\' is invalid: the \'contentType\' property must be set'); @@ -1065,7 +1066,7 @@ public function testCreateContentThrowsInvalidArgumentExceptionContentTypeNotSet * * @covers \Ibexa\Contracts\Core\Repository\ContentService::createContent */ - public function testCreateContentThrowsUnauthorizedException() + public function testCreateContentThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -1129,7 +1130,7 @@ public function testCreateContentThrowsUnauthorizedException() * * @exceptionMessage Argument '$contentCreateStruct' is invalid: Another content with remoteId 'faraday' exists */ - public function testCreateContentThrowsInvalidArgumentExceptionDuplicateRemoteId() + public function testCreateContentThrowsInvalidArgumentExceptionDuplicateRemoteId(): void { $this->expectException(InvalidArgumentException::class); @@ -1200,7 +1201,7 @@ public function testCreateContentThrowsInvalidArgumentExceptionDuplicateRemoteId * * @return array */ - protected function mapStructFieldsForCreate($mainLanguageCode, $structFields, $fieldDefinitions) + protected function mapStructFieldsForCreate($mainLanguageCode, $structFields, $fieldDefinitions): array { $mappedFieldDefinitions = []; foreach ($fieldDefinitions as $fieldDefinition) { @@ -1446,9 +1447,9 @@ static function (ValueStub $value): string { $spiContent = new SPIContent( [ - 'versionInfo' => new SPIContent\VersionInfo( + 'versionInfo' => new SPIVersionInfo( [ - 'contentInfo' => new SPIContent\ContentInfo(['id' => 42]), + 'contentInfo' => new SPIContentInfo(['id' => 42]), 'versionNo' => 7, ] ), @@ -1475,7 +1476,7 @@ static function (ValueStub $value): string { return $contentCreateStruct; } - public function providerForTestCreateContentNonRedundantFieldSet1() + public function providerForTestCreateContentNonRedundantFieldSet1(): array { $spiFields = [ new SPIField( @@ -1533,7 +1534,7 @@ public function providerForTestCreateContentNonRedundantFieldSet1() * * @dataProvider providerForTestCreateContentNonRedundantFieldSet1 */ - public function testCreateContentNonRedundantFieldSet1($mainLanguageCode, $structFields, $spiFields) + public function testCreateContentNonRedundantFieldSet1(string $mainLanguageCode, array $structFields, array $spiFields): void { $fieldDefinitions = [ new FieldDefinition( @@ -1556,7 +1557,7 @@ public function testCreateContentNonRedundantFieldSet1($mainLanguageCode, $struc ); } - public function providerForTestCreateContentNonRedundantFieldSet2() + public function providerForTestCreateContentNonRedundantFieldSet2(): array { $spiFields = [ new SPIField( @@ -1636,7 +1637,7 @@ public function providerForTestCreateContentNonRedundantFieldSet2() * * @dataProvider providerForTestCreateContentNonRedundantFieldSet2 */ - public function testCreateContentNonRedundantFieldSet2($mainLanguageCode, $structFields, $spiFields) + public function testCreateContentNonRedundantFieldSet2(string $mainLanguageCode, array $structFields, array $spiFields): void { $fieldDefinitions = [ new FieldDefinition( @@ -1669,7 +1670,7 @@ public function testCreateContentNonRedundantFieldSet2($mainLanguageCode, $struc ); } - public function providerForTestCreateContentNonRedundantFieldSetComplex() + public function providerForTestCreateContentNonRedundantFieldSetComplex(): array { $spiFields0 = [ new SPIField( @@ -1790,7 +1791,7 @@ public function providerForTestCreateContentNonRedundantFieldSetComplex() ]; } - protected function fixturesForTestCreateContentNonRedundantFieldSetComplex() + protected function fixturesForTestCreateContentNonRedundantFieldSetComplex(): array { return [ new FieldDefinition( @@ -1849,7 +1850,7 @@ protected function fixturesForTestCreateContentNonRedundantFieldSetComplex() * * @dataProvider providerForTestCreateContentNonRedundantFieldSetComplex */ - public function testCreateContentNonRedundantFieldSetComplex($mainLanguageCode, $structFields, $spiFields) + public function testCreateContentNonRedundantFieldSetComplex(string $mainLanguageCode, array $structFields, array $spiFields): void { $fieldDefinitions = $this->fixturesForTestCreateContentNonRedundantFieldSetComplex(); @@ -1861,7 +1862,7 @@ public function testCreateContentNonRedundantFieldSetComplex($mainLanguageCode, ); } - public function providerForTestCreateContentWithInvalidLanguage() + public function providerForTestCreateContentWithInvalidLanguage(): array { return [ [ @@ -1899,7 +1900,7 @@ public function providerForTestCreateContentWithInvalidLanguage() * * @dataProvider providerForTestCreateContentWithInvalidLanguage */ - public function testCreateContentWithInvalidLanguage($mainLanguageCode, $structFields) + public function testCreateContentWithInvalidLanguage(string $mainLanguageCode, array $structFields): void { $this->expectException(APINotFoundException::class); $this->expectExceptionMessage('Could not find \'Language\' with identifier \'Klingon\''); @@ -1948,7 +1949,7 @@ public function testCreateContentWithInvalidLanguage($mainLanguageCode, $structF ->with(self::isType('string')) ->will( self::returnCallback( - static function ($languageCode) { + static function ($languageCode): Language { if ($languageCode === 'Klingon') { throw new NotFoundException('Language', 'Klingon'); } @@ -2016,7 +2017,7 @@ protected function assertForCreateContentContentValidationException( ->method('acceptValue') ->will( self::returnCallback( - static function ($valueString) { + static function ($valueString): ValueStub { return new ValueStub($valueString); } ) @@ -2070,7 +2071,7 @@ static function ($valueString) { $mockedService->createContent($contentCreateStruct, []); } - public function providerForTestCreateContentThrowsContentValidationExceptionFieldDefinition() + public function providerForTestCreateContentThrowsContentValidationExceptionFieldDefinition(): array { return [ [ @@ -2097,7 +2098,7 @@ public function providerForTestCreateContentThrowsContentValidationExceptionFiel * * @dataProvider providerForTestCreateContentThrowsContentValidationExceptionFieldDefinition */ - public function testCreateContentThrowsContentValidationExceptionFieldDefinition($mainLanguageCode, $structFields) + public function testCreateContentThrowsContentValidationExceptionFieldDefinition(string $mainLanguageCode, array $structFields): void { $this->expectException(ContentValidationException::class); $this->expectExceptionMessage('Field definition \'identifier\' does not exist in the given content type'); @@ -2109,7 +2110,7 @@ public function testCreateContentThrowsContentValidationExceptionFieldDefinition ); } - public function providerForTestCreateContentThrowsContentValidationExceptionTranslation() + public function providerForTestCreateContentThrowsContentValidationExceptionTranslation(): array { return [ [ @@ -2136,7 +2137,7 @@ public function providerForTestCreateContentThrowsContentValidationExceptionTran * * @dataProvider providerForTestCreateContentThrowsContentValidationExceptionTranslation */ - public function testCreateContentThrowsContentValidationExceptionTranslation($mainLanguageCode, $structFields) + public function testCreateContentThrowsContentValidationExceptionTranslation(string $mainLanguageCode, array $structFields): void { $this->expectException(ContentValidationException::class); $this->expectExceptionMessage('You cannot set a value for the non-translatable Field definition \'identifier\' in language \'eng-US\''); @@ -2185,9 +2186,9 @@ private function provideCommonCreateContentObjects(array $fieldDefinitions, arra } private function commonContentCreateMocks( - \PHPUnit\Framework\MockObject\MockObject $languageHandlerMock, - \PHPUnit\Framework\MockObject\MockObject $contentTypeServiceMock, - \PHPUnit\Framework\MockObject\MockObject $repositoryMock, + MockObject $languageHandlerMock, + MockObject $contentTypeServiceMock, + Repository $repositoryMock, ContentType $contentType ): void { $this->loadByLanguageCodeMock($languageHandlerMock); @@ -2202,14 +2203,14 @@ private function commonContentCreateMocks( ->will(self::returnValue($contentTypeServiceMock)); } - private function loadByLanguageCodeMock(\PHPUnit\Framework\MockObject\MockObject $languageHandlerMock): void + private function loadByLanguageCodeMock(MockObject $languageHandlerMock): void { $languageHandlerMock->expects(self::any()) ->method('loadByLanguageCode') ->with(self::isType('string')) ->will( self::returnCallback( - static function () { + static function (): Language { return new Language(['id' => 4242]); } ) @@ -2288,7 +2289,7 @@ static function () use ($that, $contentCreateStruct): bool { return $contentCreateStruct; } - public function providerForTestCreateContentThrowsContentValidationExceptionRequiredField() + public function providerForTestCreateContentThrowsContentValidationExceptionRequiredField(): array { return [ [ @@ -2318,11 +2319,11 @@ public function providerForTestCreateContentThrowsContentValidationExceptionRequ * @dataProvider providerForTestCreateContentThrowsContentValidationExceptionRequiredField */ public function testCreateContentRequiredField( - $mainLanguageCode, - $structFields, - $identifier, - $languageCode - ) { + string $mainLanguageCode, + array $structFields, + string $identifier, + string $languageCode + ): void { $this->expectException(ContentFieldValidationException::class); $fieldDefinitions = [ @@ -2453,7 +2454,7 @@ static function () use ($that, $contentCreateStruct): bool { ->method('acceptValue') ->will( self::returnCallback( - static function ($value) { + static function ($value): SPIValue { return $value instanceof SPIValue ? $value : new ValueStub($value); @@ -2505,7 +2506,7 @@ public function providerForTestCreateContentThrowsContentFieldValidationExceptio * * @dataProvider providerForTestCreateContentThrowsContentFieldValidationException */ - public function testCreateContentThrowsContentFieldValidationException($mainLanguageCode, $structFields): void + public function testCreateContentThrowsContentFieldValidationException($mainLanguageCode, array $structFields): void { $this->expectException(ContentFieldValidationException::class); $this->expectExceptionMessage('Content fields did not validate'); @@ -2528,36 +2529,36 @@ public function testCreateContentThrowsContentFieldValidationException($mainLang } } - private function acceptFieldTypeValueMock(\PHPUnit\Framework\MockObject\MockObject $fieldTypeMock): void + private function acceptFieldTypeValueMock(MockObject $fieldTypeMock): void { $fieldTypeMock->expects(self::any()) ->method('acceptValue') ->will( self::returnCallback( - static function ($valueString) { + static function ($valueString): ValueStub { return new ValueStub($valueString); } ) ); } - private function toHashFieldTypeMock(\PHPUnit\Framework\MockObject\MockObject $fieldTypeMock): void + private function toHashFieldTypeMock(MockObject $fieldTypeMock): void { $fieldTypeMock ->method('toHash') - ->willReturnCallback(static function (SPIValue $value) { + ->willReturnCallback(static function (SPIValue $value): array { return ['value' => $value->value]; }); } - private function getFieldTypeFieldTypeRegistryMock(\PHPUnit\Framework\MockObject\MockObject $fieldTypeMock): void + private function getFieldTypeFieldTypeRegistryMock(MockObject $fieldTypeMock): void { $this->getFieldTypeRegistryMock()->expects(self::any()) ->method('getFieldType') ->will(self::returnValue($fieldTypeMock)); } - private function isEmptyValueFieldTypeMock(\PHPUnit\Framework\MockObject\MockObject $fieldTypeMock): void + private function isEmptyValueFieldTypeMock(MockObject $fieldTypeMock): void { $emptyValue = new ValueStub(self::EMPTY_FIELD_VALUE); $fieldTypeMock->expects(self::any()) @@ -2572,7 +2573,7 @@ static function (ValueStub $value) use ($emptyValue): bool { } private function getUniqueHashDomainMapperMock( - \PHPUnit\Framework\MockObject\MockObject $domainMapperMock, + MockObject $domainMapperMock, self $that, ContentCreateStruct $contentCreateStruct ): void { @@ -2598,7 +2599,7 @@ static function ($object) use ($that, $contentCreateStruct): string { * @covers \Ibexa\Contracts\Core\Repository\ContentService::buildSPILocationCreateStructs * @covers \Ibexa\Contracts\Core\Repository\ContentService::createContent */ - public function testCreateContentWithLocations() + public function testCreateContentWithLocations(): void { $spiFields = [ new SPIField( @@ -2701,9 +2702,9 @@ public function testCreateContentWithLocations() $spiContent = new SPIContent( [ - 'versionInfo' => new SPIContent\VersionInfo( + 'versionInfo' => new SPIVersionInfo( [ - 'contentInfo' => new SPIContent\ContentInfo(['id' => 42]), + 'contentInfo' => new SPIContentInfo(['id' => 42]), 'versionNo' => 7, ] ), @@ -2737,7 +2738,7 @@ public function testCreateContentWithLocations() * @covers \Ibexa\Contracts\Core\Repository\ContentService::buildSPILocationCreateStructs * @covers \Ibexa\Contracts\Core\Repository\ContentService::createContent */ - public function testCreateContentWithLocationsDuplicateUnderParent() + public function testCreateContentWithLocationsDuplicateUnderParent(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('You provided multiple LocationCreateStructs with the same parent Location \'321\''); @@ -2797,7 +2798,7 @@ public function testCreateContentWithLocationsDuplicateUnderParent() ->with(self::isType('string')) ->will( self::returnCallback( - static function () { + static function (): Language { return new Language(['id' => 4242]); } ) @@ -2808,7 +2809,7 @@ static function () { ->method('acceptValue') ->will( self::returnCallback( - static function ($valueString) { + static function ($valueString): ValueStub { return new ValueStub($valueString); } ) @@ -2882,7 +2883,7 @@ static function ($object) use ($that, $contentCreateStruct): string { ->method('acceptValue') ->will( self::returnCallback( - static function ($valueString) { + static function ($valueString): ValueStub { return new ValueStub($valueString); } ) @@ -2906,7 +2907,7 @@ static function ($valueString) { * @covers \Ibexa\Contracts\Core\Repository\ContentService::getDefaultObjectStates * @covers \Ibexa\Contracts\Core\Repository\ContentService::createContent */ - public function testCreateContentObjectStates() + public function testCreateContentObjectStates(): void { $spiFields = [ new SPIField( @@ -2976,9 +2977,9 @@ public function testCreateContentObjectStates() $spiContent = new SPIContent( [ - 'versionInfo' => new SPIContent\VersionInfo( + 'versionInfo' => new SPIVersionInfo( [ - 'contentInfo' => new SPIContent\ContentInfo(['id' => 42]), + 'contentInfo' => new SPIContentInfo(['id' => 42]), 'versionNo' => 7, ] ), @@ -3014,9 +3015,9 @@ public function testCreateContentObjectStates() * * @dataProvider providerForTestCreateContentThrowsContentValidationExceptionTranslation */ - public function testCreateContentWithRollback() + public function testCreateContentWithRollback(): void { - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $this->expectExceptionMessage('Store failed'); $fieldDefinitions = [ @@ -3053,13 +3054,13 @@ public function testCreateContentWithRollback() $contentHandlerMock->expects(self::once()) ->method('create') ->with(self::anything()) - ->will(self::throwException(new \Exception('Store failed'))); + ->will(self::throwException(new Exception('Store failed'))); // Execute $this->partlyMockedContentService->createContent($contentCreateStruct, []); } - public function providerForTestUpdateContentThrowsBadStateException() + public function providerForTestUpdateContentThrowsBadStateException(): array { return [ [VersionInfo::STATUS_PUBLISHED], @@ -3074,7 +3075,7 @@ public function providerForTestUpdateContentThrowsBadStateException() * * @dataProvider providerForTestUpdateContentThrowsBadStateException */ - public function testUpdateContentThrowsBadStateException($status) + public function testUpdateContentThrowsBadStateException(int $status): void { $this->expectException(BadStateException::class); @@ -3124,7 +3125,7 @@ public function testUpdateContentThrowsBadStateException($status) * * @covers \Ibexa\Contracts\Core\Repository\ContentService::updateContent */ - public function testUpdateContentThrowsUnauthorizedException() + public function testUpdateContentThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -3201,7 +3202,7 @@ protected function determineLanguageCodesForUpdate($initialLanguageCode, array $ * * @return array */ - protected function mapStructFieldsForUpdate($initialLanguageCode, $structFields, $mainLanguageCode, $fieldDefinitions) + protected function mapStructFieldsForUpdate($initialLanguageCode, $structFields, $mainLanguageCode, $fieldDefinitions): array { $initialLanguageCode = $initialLanguageCode ?: $mainLanguageCode; @@ -3287,7 +3288,7 @@ protected function determineValuesForUpdate( return $this->stubValues($values); } - protected function stubValues(array $fieldValues) + protected function stubValues(array $fieldValues): array { foreach ($fieldValues as &$languageValues) { foreach ($languageValues as &$value) { @@ -3318,7 +3319,7 @@ protected function assertForTestUpdateContentNonRedundantFieldSet( array $existingFields, array $fieldDefinitions, $execute = true - ) { + ): array { $repositoryMock = $this->getRepositoryMock(); $permissionResolverMock = $this->getPermissionResolverMock(); $permissionResolverMock @@ -3379,7 +3380,7 @@ static function (Field $field) { ->with(self::isType('string')) ->will( self::returnCallback( - static function () { + static function (): Language { return new Language(['id' => 4242]); } ) @@ -3414,7 +3415,7 @@ static function () { ->method('acceptValue') ->will( self::returnCallback( - static function ($value) { + static function ($value): SPIValue { return $value instanceof SPIValue ? $value : new ValueStub($value); @@ -3518,9 +3519,9 @@ static function (SPIValue $value) use ($emptyValue): bool { $spiContent = new SPIContent( [ - 'versionInfo' => new SPIContent\VersionInfo( + 'versionInfo' => new SPIVersionInfo( [ - 'contentInfo' => new SPIContent\ContentInfo(['id' => 42]), + 'contentInfo' => new SPIContentInfo(['id' => 42]), 'versionNo' => 7, ] ), @@ -3551,7 +3552,7 @@ static function (SPIValue $value) use ($emptyValue): bool { return [$content->versionInfo, $contentUpdateStruct]; } - public function providerForTestUpdateContentNonRedundantFieldSet1() + public function providerForTestUpdateContentNonRedundantFieldSet1(): array { $spiFields = [ new SPIField( @@ -3615,7 +3616,7 @@ public function providerForTestUpdateContentNonRedundantFieldSet1() * * @dataProvider providerForTestUpdateContentNonRedundantFieldSet1 */ - public function testUpdateContentNonRedundantFieldSet1($initialLanguageCode, $structFields, $spiFields) + public function testUpdateContentNonRedundantFieldSet1(?string $initialLanguageCode, array $structFields, array $spiFields): void { $existingFields = [ new Field( @@ -3650,7 +3651,7 @@ public function testUpdateContentNonRedundantFieldSet1($initialLanguageCode, $st ); } - public function providerForTestUpdateContentNonRedundantFieldSet2() + public function providerForTestUpdateContentNonRedundantFieldSet2(): array { $spiFields0 = [ new SPIField( @@ -3829,7 +3830,7 @@ public function providerForTestUpdateContentNonRedundantFieldSet2() * * @dataProvider providerForTestUpdateContentNonRedundantFieldSet2 */ - public function testUpdateContentNonRedundantFieldSet2($initialLanguageCode, $structFields, $spiFields) + public function testUpdateContentNonRedundantFieldSet2(?string $initialLanguageCode, array $structFields, array $spiFields): void { $existingFields = [ new Field( @@ -3864,7 +3865,7 @@ public function testUpdateContentNonRedundantFieldSet2($initialLanguageCode, $st ); } - public function providerForTestUpdateContentNonRedundantFieldSet3() + public function providerForTestUpdateContentNonRedundantFieldSet3(): array { $spiFields0 = [ new SPIField( @@ -4092,7 +4093,7 @@ public function providerForTestUpdateContentNonRedundantFieldSet3() * * @dataProvider providerForTestUpdateContentNonRedundantFieldSet3 */ - public function testUpdateContentNonRedundantFieldSet3($initialLanguageCode, $structFields, $spiFields) + public function testUpdateContentNonRedundantFieldSet3(string $initialLanguageCode, array $structFields, array $spiFields): void { $existingFields = [ new Field( @@ -4145,7 +4146,7 @@ public function testUpdateContentNonRedundantFieldSet3($initialLanguageCode, $st ); } - public function providerForTestUpdateContentNonRedundantFieldSet4() + public function providerForTestUpdateContentNonRedundantFieldSet4(): array { $spiFields0 = [ new SPIField( @@ -4398,7 +4399,7 @@ public function providerForTestUpdateContentNonRedundantFieldSet4() * * @dataProvider providerForTestUpdateContentNonRedundantFieldSet4 */ - public function testUpdateContentNonRedundantFieldSet4($initialLanguageCode, $structFields, $spiFields) + public function testUpdateContentNonRedundantFieldSet4(string $initialLanguageCode, array $structFields, array $spiFields): void { $existingFields = [ new Field( @@ -4456,7 +4457,7 @@ public function testUpdateContentNonRedundantFieldSet4($initialLanguageCode, $st * * @todo add first field empty */ - public function providerForTestUpdateContentNonRedundantFieldSetComplex() + public function providerForTestUpdateContentNonRedundantFieldSetComplex(): array { $spiFields0 = [ new SPIField( @@ -4685,7 +4686,7 @@ public function providerForTestUpdateContentNonRedundantFieldSetComplex() ]; } - protected function fixturesForTestUpdateContentNonRedundantFieldSetComplex() + protected function fixturesForTestUpdateContentNonRedundantFieldSetComplex(): array { $existingFields = [ new Field( @@ -4779,7 +4780,7 @@ protected function fixturesForTestUpdateContentNonRedundantFieldSetComplex() * * @dataProvider providerForTestUpdateContentNonRedundantFieldSetComplex */ - public function testUpdateContentNonRedundantFieldSetComplex($initialLanguageCode, $structFields, $spiFields) + public function testUpdateContentNonRedundantFieldSetComplex(string $initialLanguageCode, array $structFields, array $spiFields): void { list($existingFields, $fieldDefinitions) = $this->fixturesForTestUpdateContentNonRedundantFieldSetComplex(); @@ -4792,7 +4793,7 @@ public function testUpdateContentNonRedundantFieldSetComplex($initialLanguageCod ); } - public function providerForTestUpdateContentWithInvalidLanguage() + public function providerForTestUpdateContentWithInvalidLanguage(): array { return [ [ @@ -4830,7 +4831,7 @@ public function providerForTestUpdateContentWithInvalidLanguage() * * @dataProvider providerForTestUpdateContentWithInvalidLanguage */ - public function testUpdateContentWithInvalidLanguage($initialLanguageCode, $structFields) + public function testUpdateContentWithInvalidLanguage(string $initialLanguageCode, array $structFields): void { $this->expectException(APINotFoundException::class); $this->expectExceptionMessage('Could not find \'Language\' with identifier \'Klingon\''); @@ -4889,7 +4890,7 @@ public function testUpdateContentWithInvalidLanguage($initialLanguageCode, $stru ->with(self::isType('string')) ->will( self::returnCallback( - static function ($languageCode) { + static function ($languageCode): Language { if ($languageCode === 'Klingon') { throw new NotFoundException('Language', 'Klingon'); } @@ -4974,7 +4975,7 @@ protected function assertForUpdateContentContentValidationException( ->method('acceptValue') ->will( self::returnCallback( - static function ($value) { + static function ($value): SPIValue { return $value instanceof SPIValue ? $value : new ValueStub($value); @@ -4992,7 +4993,7 @@ static function ($value) { ->with(self::isType('string')) ->will( self::returnCallback( - static function ($languageCode) { + static function ($languageCode): Language { if ($languageCode === 'Klingon') { throw new NotFoundException('Language', 'Klingon'); } @@ -5080,7 +5081,7 @@ private function prepareContentForTestCreateAndUpdateContent( ); } - public function providerForTestUpdateContentThrowsContentValidationExceptionFieldDefinition() + public function providerForTestUpdateContentThrowsContentValidationExceptionFieldDefinition(): array { return [ [ @@ -5107,7 +5108,7 @@ public function providerForTestUpdateContentThrowsContentValidationExceptionFiel * * @dataProvider providerForTestUpdateContentThrowsContentValidationExceptionFieldDefinition */ - public function testUpdateContentThrowsContentValidationExceptionFieldDefinition($initialLanguageCode, $structFields) + public function testUpdateContentThrowsContentValidationExceptionFieldDefinition(string $initialLanguageCode, array $structFields): void { $this->expectException(ContentValidationException::class); $this->expectExceptionMessage('Field definition \'identifier\' does not exist in given content type'); @@ -5119,7 +5120,7 @@ public function testUpdateContentThrowsContentValidationExceptionFieldDefinition ); } - public function providerForTestUpdateContentThrowsContentValidationExceptionTranslation() + public function providerForTestUpdateContentThrowsContentValidationExceptionTranslation(): array { return [ [ @@ -5146,7 +5147,7 @@ public function providerForTestUpdateContentThrowsContentValidationExceptionTran * * @dataProvider providerForTestUpdateContentThrowsContentValidationExceptionTranslation */ - public function testUpdateContentThrowsContentValidationExceptionTranslation($initialLanguageCode, $structFields) + public function testUpdateContentThrowsContentValidationExceptionTranslation(string $initialLanguageCode, array $structFields): void { $this->expectException(ContentValidationException::class); $this->expectExceptionMessage('You cannot set a value for the non-translatable Field definition \'identifier\' in language \'eng-US\''); @@ -5174,9 +5175,9 @@ public function testUpdateContentThrowsContentValidationExceptionTranslation($in public function assertForTestUpdateContentRequiredField( $initialLanguageCode, $structFields, - $existingFields, - $fieldDefinitions - ) { + array $existingFields, + array $fieldDefinitions + ): array { $permissionResolver = $this->getPermissionResolverMock(); $mockedService = $this->getPartlyMockedContentService(['internalLoadContentById', 'loadContent']); /** @var \PHPUnit\Framework\MockObject\MockObject $languageHandlerMock */ @@ -5247,7 +5248,7 @@ static function (Field $field) { return [$content->versionInfo, $contentUpdateStruct]; } - public function providerForTestUpdateContentRequiredField() + public function providerForTestUpdateContentRequiredField(): array { return [ [ @@ -5281,7 +5282,7 @@ public function testUpdateContentRequiredField( $structFields, $identifier, $languageCode - ) { + ): void { $this->expectException(ContentFieldValidationException::class); $existingFields = [ @@ -5329,8 +5330,8 @@ public function testUpdateContentRequiredField( public function assertForTestUpdateContentThrowsContentFieldValidationException( $initialLanguageCode, $structFields, - $existingFields, - $fieldDefinitions, + array $existingFields, + array $fieldDefinitions, array $allFieldErrors ): array { $permissionResolverMock = $this->getPermissionResolverMock(); @@ -5375,7 +5376,7 @@ static function (Field $field) { ->method('acceptValue') ->will( self::returnCallback( - static function ($value) { + static function ($value): SPIValue { return $value instanceof SPIValue ? $value : new ValueStub($value); @@ -5535,9 +5536,9 @@ public function testUpdateContentThrowsContentFieldValidationException( * @covers \Ibexa\Contracts\Core\Repository\ContentService::mapFieldsForUpdate * @covers \Ibexa\Contracts\Core\Repository\ContentService::updateContent */ - public function testUpdateContentTransactionRollback() + public function testUpdateContentTransactionRollback(): void { - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $this->expectExceptionMessage('Store failed'); $existingFields = [ @@ -5587,7 +5588,7 @@ public function testUpdateContentTransactionRollback() self::anything(), self::anything(), self::anything() - )->will(self::throwException(new \Exception('Store failed'))); + )->will(self::throwException(new Exception('Store failed'))); // Execute $this->partlyMockedContentService->updateContent($versionInfo, $contentUpdateStruct); @@ -5598,7 +5599,7 @@ public function testUpdateContentTransactionRollback() * * @covers \Ibexa\Contracts\Core\Repository\ContentService::copyContent */ - public function testCopyContentThrowsUnauthorizedException() + public function testCopyContentThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -5649,7 +5650,7 @@ public function testCopyContentThrowsUnauthorizedException() * @covers \Ibexa\Contracts\Core\Repository\ContentService::getDefaultObjectStates * @covers \Ibexa\Contracts\Core\Repository\ContentService::internalPublishVersion */ - public function testCopyContent() + public function testCopyContent(): void { $repositoryMock = $this->getRepositoryMock(); $contentService = $this->getPartlyMockedContentService([ @@ -5786,7 +5787,7 @@ public function testCopyContent() * @covers \Ibexa\Contracts\Core\Repository\ContentService::getDefaultObjectStates * @covers \Ibexa\Contracts\Core\Repository\ContentService::internalPublishVersion */ - public function testCopyContentWithVersionInfo() + public function testCopyContentWithVersionInfo(): void { $repositoryMock = $this->getRepositoryMock(); $contentService = $this->getPartlyMockedContentService([ @@ -5914,9 +5915,9 @@ public function testCopyContentWithVersionInfo() * @covers \Ibexa\Contracts\Core\Repository\ContentService::getDefaultObjectStates * @covers \Ibexa\Contracts\Core\Repository\ContentService::internalPublishVersion */ - public function testCopyContentWithRollback() + public function testCopyContentWithRollback(): void { - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $this->expectExceptionMessage('Handler threw an exception'); $repositoryMock = $this->getRepositoryMock(); @@ -5988,7 +5989,7 @@ public function testCopyContentWithRollback() * * @return \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\Repository\Values\Content\Content */ - private function mockBuildContentDomainObject(SPIContent $spiContent, array $translations = null, bool $useAlwaysAvailable = null) + private function mockBuildContentDomainObject(SPIContent $spiContent, array $translations = null, bool $useAlwaysAvailable = null): MockObject { $contentTypeId = $spiContent->versionInfo->contentInfo->contentTypeId; $contentTypeServiceMock = $this->getContentTypeServiceMock(); @@ -6216,7 +6217,7 @@ protected function mockPublishUrlAliasesForContent(APIContent $content) ->with(123, 456, ['eng-GB']); } - protected $relationProcessorMock; + protected ?MockObject $relationProcessorMock = null; /** * @return \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\Repository\Helper\RelationProcessor @@ -6249,7 +6250,7 @@ protected function getNameSchemaServiceMock(): NameSchemaServiceInterface return $this->nameSchemaServiceMock; } - protected $contentTypeServiceMock; + protected ?MockObject $contentTypeServiceMock = null; /** * @return \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\Repository\ContentTypeService @@ -6263,7 +6264,7 @@ protected function getContentTypeServiceMock() return $this->contentTypeServiceMock; } - protected $locationServiceMock; + protected ?MockObject $locationServiceMock = null; /** * @return \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\Repository\LocationService @@ -6278,7 +6279,7 @@ protected function getLocationServiceMock() } /** @var \Ibexa\Core\Repository\ContentService */ - protected $partlyMockedContentService; + protected ?MockObject $partlyMockedContentService = null; /** * Returns the content service to test with $methods mocked. diff --git a/tests/lib/Repository/Service/Mock/PermissionTest.php b/tests/lib/Repository/Service/Mock/PermissionTest.php index 4f78cd918d..395d26d9e1 100644 --- a/tests/lib/Repository/Service/Mock/PermissionTest.php +++ b/tests/lib/Repository/Service/Mock/PermissionTest.php @@ -21,6 +21,7 @@ use Ibexa\Core\Repository\Repository as CoreRepository; use Ibexa\Core\Repository\Values\User\UserReference; use Ibexa\Tests\Core\Repository\Service\Mock\Base as BaseServiceMockTest; +use PHPUnit\Framework\MockObject\MockObject; /** * Mock test case for PermissionResolver. @@ -29,7 +30,7 @@ */ class PermissionTest extends BaseServiceMockTest { - public function providerForTestHasAccessReturnsTrue() + public function providerForTestHasAccessReturnsTrue(): array { return [ [ @@ -103,7 +104,7 @@ public function providerForTestHasAccessReturnsTrue() * * @dataProvider providerForTestHasAccessReturnsTrue */ - public function testHasAccessReturnsTrue(array $roles, array $roleAssignments) + public function testHasAccessReturnsTrue(array $roles, array $roleAssignments): void { /** @var $userHandlerMock \PHPUnit\Framework\MockObject\MockObject */ $userHandlerMock = $this->getPersistenceMock()->userHandler(); @@ -128,7 +129,7 @@ public function testHasAccessReturnsTrue(array $roles, array $roleAssignments) self::assertTrue($result); } - public function providerForTestHasAccessReturnsFalse() + public function providerForTestHasAccessReturnsFalse(): array { return [ [[], []], @@ -174,7 +175,7 @@ public function providerForTestHasAccessReturnsFalse() * * @dataProvider providerForTestHasAccessReturnsFalse */ - public function testHasAccessReturnsFalse(array $roles, array $roleAssignments) + public function testHasAccessReturnsFalse(array $roles, array $roleAssignments): void { /** @var $userHandlerMock \PHPUnit\Framework\MockObject\MockObject */ $userHandlerMock = $this->getPersistenceMock()->userHandler(); @@ -202,7 +203,7 @@ public function testHasAccessReturnsFalse(array $roles, array $roleAssignments) /** * Test for the sudo() & hasAccess() method. */ - public function testHasAccessReturnsFalseButSudoSoTrue() + public function testHasAccessReturnsFalseButSudoSoTrue(): void { /** @var $userHandlerMock \PHPUnit\Framework\MockObject\MockObject */ $userHandlerMock = $this->getPersistenceMock()->userHandler(); @@ -230,7 +231,7 @@ static function (Repository $repo) { /** * @return array */ - public function providerForTestHasAccessReturnsPermissionSets() + public function providerForTestHasAccessReturnsPermissionSets(): array { return [ [ @@ -286,7 +287,7 @@ public function providerForTestHasAccessReturnsPermissionSets() * * @dataProvider providerForTestHasAccessReturnsPermissionSets */ - public function testHasAccessReturnsPermissionSets(array $roles, array $roleAssignments) + public function testHasAccessReturnsPermissionSets(array $roles, array $roleAssignments): void { /** @var $userHandlerMock \PHPUnit\Framework\MockObject\MockObject */ $userHandlerMock = $this->getPersistenceMock()->userHandler(); @@ -344,7 +345,7 @@ public function testHasAccessReturnsPermissionSets(array $roles, array $roleAssi /** * @return array */ - public function providerForTestHasAccessReturnsLimitationNotFoundException() + public function providerForTestHasAccessReturnsLimitationNotFoundException(): array { return [ [ @@ -400,7 +401,7 @@ public function providerForTestHasAccessReturnsLimitationNotFoundException() * * @dataProvider providerForTestHasAccessReturnsLimitationNotFoundException */ - public function testHasAccessReturnsLimitationNotFoundException(array $roles, array $roleAssignments) + public function testHasAccessReturnsLimitationNotFoundException(array $roles, array $roleAssignments): void { $this->expectException(LimitationNotFoundException::class); @@ -459,7 +460,7 @@ public function testHasAccessReturnsLimitationNotFoundException(array $roles, ar /** * @return array */ - public function providerForTestHasAccessReturnsInvalidArgumentValueException() + public function providerForTestHasAccessReturnsInvalidArgumentValueException(): array { return [ [ @@ -515,7 +516,7 @@ public function providerForTestHasAccessReturnsInvalidArgumentValueException() * * @dataProvider providerForTestHasAccessReturnsInvalidArgumentValueException */ - public function testHasAccessReturnsInvalidArgumentValueException(array $roles, array $roleAssignments) + public function testHasAccessReturnsInvalidArgumentValueException(array $roles, array $roleAssignments): void { $this->expectException(InvalidArgumentValue::class); @@ -530,7 +531,7 @@ public function testHasAccessReturnsInvalidArgumentValueException(array $roles, } } - public function providerForTestHasAccessReturnsPermissionSetsWithRoleLimitation() + public function providerForTestHasAccessReturnsPermissionSetsWithRoleLimitation(): array { return [ [ @@ -580,7 +581,7 @@ public function providerForTestHasAccessReturnsPermissionSetsWithRoleLimitation( * * @dataProvider providerForTestHasAccessReturnsPermissionSetsWithRoleLimitation */ - public function testHasAccessReturnsPermissionSetsWithRoleLimitation(array $roles, array $roleAssignments) + public function testHasAccessReturnsPermissionSetsWithRoleLimitation(array $roles, array $roleAssignments): void { /** @var $userHandlerMock \PHPUnit\Framework\MockObject\MockObject */ $userHandlerMock = $this->getPersistenceMock()->userHandler(); @@ -651,7 +652,7 @@ public function testHasAccessReturnsPermissionSetsWithRoleLimitation(array $role * * @return \Ibexa\Contracts\Core\Persistence\User\Role */ - private function createRole(array $policiesData, $roleId = null) + private function createRole(array $policiesData, $roleId = null): Role { $policies = []; foreach ($policiesData as $policyData) { @@ -672,7 +673,7 @@ private function createRole(array $policiesData, $roleId = null) ); } - public function providerForTestCanUserSimple() + public function providerForTestCanUserSimple(): array { return [ [true, true], @@ -688,7 +689,7 @@ public function providerForTestCanUserSimple() * * @dataProvider providerForTestCanUserSimple */ - public function testCanUserSimple($permissionSets, $result) + public function testCanUserSimple(bool|array $permissionSets, bool $result): void { $permissionResolverMock = $this->getPermissionResolverMock(['hasAccess']); @@ -712,7 +713,7 @@ public function testCanUserSimple($permissionSets, $result) * * Tests execution path with permission set defining no limitations. */ - public function testCanUserWithoutLimitations() + public function testCanUserWithoutLimitations(): void { $permissionResolverMock = $this->getPermissionResolverMock( [ @@ -764,7 +765,7 @@ public function testCanUserWithoutLimitations() /** * @return array */ - private function getPermissionSetsMock() + private function getPermissionSetsMock(): array { $roleLimitationMock = $this->createMock(Limitation::class); $roleLimitationMock @@ -803,7 +804,7 @@ private function getPermissionSetsMock() * * @return array */ - public function providerForTestCanUserComplex() + public function providerForTestCanUserComplex(): array { return [ [ @@ -886,7 +887,7 @@ public function providerForTestCanUserComplex() * * @dataProvider providerForTestCanUserComplex */ - public function testCanUserComplex(array $roleLimitationEvaluations, array $policyLimitationEvaluations, $userCan) + public function testCanUserComplex(array $roleLimitationEvaluations, array $policyLimitationEvaluations, bool $userCan): void { /** @var $valueObject \Ibexa\Contracts\Core\Repository\Values\ValueObject */ $valueObject = $this->createMock(ValueObject::class); @@ -974,7 +975,7 @@ public function testCanUserComplex(array $roleLimitationEvaluations, array $poli /** * Test for the setCurrentUserReference() and getCurrentUserReference() methods. */ - public function testSetAndGetCurrentUserReference() + public function testSetAndGetCurrentUserReference(): void { $permissionResolverMock = $this->getPermissionResolverMock(null); $userReferenceMock = $this->getUserReferenceMock(); @@ -995,14 +996,14 @@ public function testSetAndGetCurrentUserReference() /** * Test for the getCurrentUserReference() method. */ - public function testGetCurrentUserReferenceReturnsAnonymousUser() + public function testGetCurrentUserReferenceReturnsAnonymousUser(): void { $permissionResolverMock = $this->getPermissionResolverMock(null); self::assertEquals(new UserReference(10), $permissionResolverMock->getCurrentUserReference()); } - protected $permissionResolverMock; + protected ?MockObject $permissionResolverMock = null; /** * @return \Ibexa\Contracts\Core\Repository\PermissionResolver|\PHPUnit\Framework\MockObject\MockObject @@ -1051,7 +1052,7 @@ protected function getPermissionResolverMock($methods = []) return $this->permissionResolverMock; } - protected $userReferenceMock; + protected ?MockObject $userReferenceMock = null; protected function getUserReferenceMock() { @@ -1062,7 +1063,7 @@ protected function getUserReferenceMock() return $this->userReferenceMock; } - protected $repositoryMock; + protected ?MockObject $repositoryMock = null; /** * @return \Ibexa\Contracts\Core\Repository\Repository|\PHPUnit\Framework\MockObject\MockObject diff --git a/tests/lib/Repository/Service/Mock/RelationProcessorTest.php b/tests/lib/Repository/Service/Mock/RelationProcessorTest.php index c5cfa2529b..ad0679aa6d 100644 --- a/tests/lib/Repository/Service/Mock/RelationProcessorTest.php +++ b/tests/lib/Repository/Service/Mock/RelationProcessorTest.php @@ -20,6 +20,7 @@ use Ibexa\Core\Repository\Values\Content\Relation as RelationValue; use Ibexa\Core\Repository\Values\ContentType\FieldDefinition; use Ibexa\Tests\Core\Repository\Service\Mock\Base as BaseServiceMockTest; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; /** @@ -27,7 +28,7 @@ */ class RelationProcessorTest extends BaseServiceMockTest { - public function providerForTestAppendRelations() + public function providerForTestAppendRelations(): array { return [ [ @@ -164,7 +165,7 @@ public function providerForTestAppendRelations() * * @dataProvider providerForTestAppendRelations */ - public function testAppendFieldRelations(array $fieldRelations, array $expected) + public function testAppendFieldRelations(array $fieldRelations, array $expected): void { $locationHandler = $this->getPersistenceMock()->locationHandler(); $relationProcessor = $this->getPartlyMockedRelationProcessor(); @@ -207,7 +208,7 @@ public function testAppendFieldRelations(array $fieldRelations, array $expected) /** * Assert loading Locations to find Content id in {@link RelationProcessor::appendFieldRelations()} method. */ - protected function assertLocationHandlerExpectation($locationHandlerMock, $fieldRelations, $type, &$callCounter) + protected function assertLocationHandlerExpectation($locationHandlerMock, array $fieldRelations, $type, int &$callCounter) { if (isset($fieldRelations[$type]['locationIds'])) { foreach ($fieldRelations[$type]['locationIds'] as $locationId) { @@ -230,7 +231,7 @@ protected function assertLocationHandlerExpectation($locationHandlerMock, $field /** * Test for the appendFieldRelations() method. */ - public function testAppendFieldRelationsLocationMappingWorks() + public function testAppendFieldRelationsLocationMappingWorks(): void { $locationHandler = $this->getPersistenceMock()->locationHandler(); $relationProcessor = $this->getPartlyMockedRelationProcessor(); @@ -290,7 +291,7 @@ public function testAppendFieldRelationsLocationMappingWorks() ); } - public function testAppendFieldRelationsLogsMissingLocations() + public function testAppendFieldRelationsLogsMissingLocations(): void { $fieldValueMock = $this->getMockForAbstractClass(Value::class); $fieldTypeMock = $this->createMock(FieldType::class); @@ -345,7 +346,7 @@ public function testAppendFieldRelationsLogsMissingLocations() /** * Test for the processFieldRelations() method. */ - public function testProcessFieldRelationsNoChanges() + public function testProcessFieldRelationsNoChanges(): void { $relationProcessor = $this->getPartlyMockedRelationProcessor(); $contentHandlerMock = $this->getPersistenceMockHandler('Content\\Handler'); @@ -415,7 +416,7 @@ public function testProcessFieldRelationsNoChanges() /** * Test for the processFieldRelations() method. */ - public function testProcessFieldRelationsAddsRelations() + public function testProcessFieldRelationsAddsRelations(): void { $relationProcessor = $this->getPartlyMockedRelationProcessor(); $contentHandlerMock = $this->getPersistenceMockHandler('Content\\Handler'); @@ -523,7 +524,7 @@ public function testProcessFieldRelationsAddsRelations() /** * Test for the processFieldRelations() method. */ - public function testProcessFieldRelationsRemovesRelations() + public function testProcessFieldRelationsRemovesRelations(): void { $relationProcessor = $this->getPartlyMockedRelationProcessor(); $contentHandlerMock = $this->getPersistenceMockHandler('Content\\Handler'); @@ -621,7 +622,7 @@ public function testProcessFieldRelationsRemovesRelations() /** * Test for the processFieldRelations() method. */ - public function testProcessFieldRelationsWhenRelationFieldNoLongerExists() + public function testProcessFieldRelationsWhenRelationFieldNoLongerExists(): void { $existingRelations = [ $this->getStubbedRelation(2, Relation::FIELD, 43, 17), @@ -645,7 +646,7 @@ public function testProcessFieldRelationsWhenRelationFieldNoLongerExists() $relationProcessor->processFieldRelations([], 24, 2, $contentTypeMock, $existingRelations); } - protected function getStubbedRelation($id, $type, $fieldDefinitionId, $contentId) + protected function getStubbedRelation($id, $type, ?string $fieldDefinitionId, $contentId): RelationValue { return new RelationValue( [ @@ -668,7 +669,7 @@ protected function getStubbedRelation($id, $type, $fieldDefinitionId, $contentId * * @return \Ibexa\Core\Repository\Helper\RelationProcessor|\PHPUnit\Framework\MockObject\MockObject */ - protected function getPartlyMockedRelationProcessor(array $methods = null) + protected function getPartlyMockedRelationProcessor(array $methods = null): MockObject { return $this->getMockBuilder(RelationProcessor::class) ->setMethods($methods) @@ -683,7 +684,7 @@ protected function getPartlyMockedRelationProcessor(array $methods = null) /** * @return \PHPUnit\Framework\MockObject\MockObject */ - protected function getFieldTypeServiceMock() + protected function getFieldTypeServiceMock(): MockObject { return $this->createMock(FieldTypeService::class); } diff --git a/tests/lib/Repository/Service/Mock/RepositoryTest.php b/tests/lib/Repository/Service/Mock/RepositoryTest.php index f098ed8858..60aa80ffac 100644 --- a/tests/lib/Repository/Service/Mock/RepositoryTest.php +++ b/tests/lib/Repository/Service/Mock/RepositoryTest.php @@ -19,7 +19,7 @@ class RepositoryTest extends BaseServiceMockTest * * @covers \Ibexa\Contracts\Core\Repository\Repository::beginTransaction */ - public function testBeginTransaction() + public function testBeginTransaction(): void { $mockedRepository = $this->getRepository(); $transactionHandlerMock = $this->getTransactionHandlerMock(); @@ -38,7 +38,7 @@ public function testBeginTransaction() * * @covers \Ibexa\Contracts\Core\Repository\Repository::commit */ - public function testCommit() + public function testCommit(): void { $mockedRepository = $this->getRepository(); $transactionHandlerMock = $this->getTransactionHandlerMock(); @@ -57,7 +57,7 @@ public function testCommit() * * @covers \Ibexa\Contracts\Core\Repository\Repository::commit */ - public function testCommitThrowsRuntimeException() + public function testCommitThrowsRuntimeException(): void { $this->expectException(\RuntimeException::class); @@ -80,7 +80,7 @@ public function testCommitThrowsRuntimeException() * * @covers \Ibexa\Contracts\Core\Repository\Repository::rollback */ - public function testRollback() + public function testRollback(): void { $mockedRepository = $this->getRepository(); $transactionHandlerMock = $this->getTransactionHandlerMock(); @@ -99,7 +99,7 @@ public function testRollback() * * @covers \Ibexa\Contracts\Core\Repository\Repository::rollback */ - public function testRollbackThrowsRuntimeException() + public function testRollbackThrowsRuntimeException(): void { $this->expectException(\RuntimeException::class); diff --git a/tests/lib/Repository/Service/Mock/RoleTest.php b/tests/lib/Repository/Service/Mock/RoleTest.php index d44e615251..7786226631 100644 --- a/tests/lib/Repository/Service/Mock/RoleTest.php +++ b/tests/lib/Repository/Service/Mock/RoleTest.php @@ -30,6 +30,7 @@ use Ibexa\Core\Repository\Permission\LimitationService; use Ibexa\Core\Repository\RoleService; use Ibexa\Tests\Core\Repository\Service\Mock\Base as BaseServiceMockTest; +use PHPUnit\Framework\MockObject\MockObject; /** * @covers \Ibexa\Contracts\Core\Repository\RoleService @@ -41,7 +42,7 @@ class RoleTest extends BaseServiceMockTest /** * Test for the createRole() method. */ - public function testCreateRoleThrowsLimitationValidationException() + public function testCreateRoleThrowsLimitationValidationException(): void { $this->expectException(LimitationValidationException::class); @@ -106,7 +107,7 @@ public function testCreateRoleThrowsLimitationValidationException() /** * Test for the addPolicy() method. */ - public function testAddPolicyThrowsLimitationValidationException() + public function testAddPolicyThrowsLimitationValidationException(): void { $this->expectException(LimitationValidationException::class); @@ -170,7 +171,7 @@ public function testAddPolicyThrowsLimitationValidationException() /** * Test for the updatePolicyByRoleDraft() method. */ - public function testUpdatePolicyThrowsLimitationValidationException() + public function testUpdatePolicyThrowsLimitationValidationException(): void { $this->expectException(LimitationValidationException::class); @@ -243,7 +244,7 @@ static function ($propertyName): ?string { /** * Test for the assignRoleToUser() method. */ - public function testAssignRoleToUserThrowsUnauthorizedException() + public function testAssignRoleToUserThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -269,7 +270,7 @@ public function testAssignRoleToUserThrowsUnauthorizedException() /** * Test for the assignRoleToUser() method. */ - public function testAssignRoleToUserThrowsLimitationValidationException() + public function testAssignRoleToUserThrowsLimitationValidationException(): void { $this->expectException(LimitationValidationException::class); @@ -316,7 +317,7 @@ public function testAssignRoleToUserThrowsLimitationValidationException() /** * Test for the assignRoleToUser() method. */ - public function testAssignRoleToUserThrowsBadStateException() + public function testAssignRoleToUserThrowsBadStateException(): void { $this->expectException(BadStateException::class); @@ -348,7 +349,7 @@ public function testAssignRoleToUserThrowsBadStateException() /** * Test for the assignRoleToUser() method. */ - public function testAssignRoleToUser() + public function testAssignRoleToUser(): void { $limitationMock = $this->createMock(RoleLimitation::class); $limitationTypeMock = $this->createMock(SPIType::class); @@ -431,7 +432,7 @@ public function testAssignRoleToUser() /** * Test for the assignRoleToUser() method. */ - public function testAssignRoleToUserWithNullLimitation() + public function testAssignRoleToUserWithNullLimitation(): void { $repository = $this->getRepositoryMock(); $roleServiceMock = $this->getPartlyMockedRoleService(['checkAssignmentAndFilterLimitationValues']); @@ -493,7 +494,7 @@ public function testAssignRoleToUserWithNullLimitation() /** * Test for the assignRoleToUser() method. */ - public function testAssignRoleToUserWithRollback() + public function testAssignRoleToUserWithRollback(): void { $this->expectException(\Exception::class); @@ -557,7 +558,7 @@ public function testAssignRoleToUserWithRollback() /** * Test for the assignRoleToUserGroup() method. */ - public function testAssignRoleToUserGroupThrowsUnauthorizedException() + public function testAssignRoleToUserGroupThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -584,7 +585,7 @@ public function testAssignRoleToUserGroupThrowsUnauthorizedException() /** * Test for the assignRoleToUserGroup() method. */ - public function testAssignRoleToUserGroupThrowsLimitationValidationException() + public function testAssignRoleToUserGroupThrowsLimitationValidationException(): void { $this->expectException(LimitationValidationException::class); @@ -632,7 +633,7 @@ public function testAssignRoleToUserGroupThrowsLimitationValidationException() /** * Test for the assignRoleToUserGroup() method. */ - public function testAssignRoleGroupToUserThrowsBadStateException() + public function testAssignRoleGroupToUserThrowsBadStateException(): void { $this->expectException(BadStateException::class); @@ -665,7 +666,7 @@ public function testAssignRoleGroupToUserThrowsBadStateException() /** * Test for the assignRoleToUserGroup() method. */ - public function testAssignRoleToUserGroup() + public function testAssignRoleToUserGroup(): void { $limitationMock = $this->createMock(RoleLimitation::class); $limitationTypeMock = $this->createMock(SPIType::class); @@ -752,7 +753,7 @@ public function testAssignRoleToUserGroup() /** * Test for the assignRoleToUserGroup() method. */ - public function testAssignRoleToUserGroupWithNullLimitation() + public function testAssignRoleToUserGroupWithNullLimitation(): void { $repository = $this->getRepositoryMock(); $roleServiceMock = $this->getPartlyMockedRoleService(['checkAssignmentAndFilterLimitationValues']); @@ -818,7 +819,7 @@ public function testAssignRoleToUserGroupWithNullLimitation() /** * Test for the assignRoleToUserGroup() method. */ - public function testAssignRoleToUserGroupWithRollback() + public function testAssignRoleToUserGroupWithRollback(): void { $this->expectException(\Exception::class); @@ -883,7 +884,7 @@ public function testAssignRoleToUserGroupWithRollback() $roleServiceMock->assignRoleToUserGroup($roleMock, $userGroupMock, null); } - public function testRemovePolicyByRoleDraftThrowsUnauthorizedException() + public function testRemovePolicyByRoleDraftThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -922,7 +923,7 @@ public function testRemovePolicyByRoleDraftThrowsUnauthorizedException() /** * Test for the removePolicyByRoleDraft() method. */ - public function testRemovePolicyByRoleDraftWithRollback() + public function testRemovePolicyByRoleDraftWithRollback(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('Handler threw an exception'); @@ -977,7 +978,7 @@ public function testRemovePolicyByRoleDraftWithRollback() $roleServiceMock->removePolicyByRoleDraft($roleDraftMock, $policyDraftMock); } - public function testRemovePolicyByRoleDraft() + public function testRemovePolicyByRoleDraft(): void { $repository = $this->getRepositoryMock(); $roleDraftMock = $this->createMock(RoleDraft::class); @@ -1037,7 +1038,7 @@ public function testRemovePolicyByRoleDraft() } /** @var \Ibexa\Core\Repository\RoleService */ - protected $partlyMockedRoleService; + protected ?MockObject $partlyMockedRoleService = null; /** * Returns the role service to test with $methods mocked. diff --git a/tests/lib/Repository/Service/Mock/SearchTest.php b/tests/lib/Repository/Service/Mock/SearchTest.php index fdd14abe7b..a7ec089a11 100644 --- a/tests/lib/Repository/Service/Mock/SearchTest.php +++ b/tests/lib/Repository/Service/Mock/SearchTest.php @@ -17,6 +17,8 @@ use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Location\Depth; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult; @@ -26,6 +28,7 @@ use Ibexa\Core\Search\Common\BackgroundIndexer; use Ibexa\Core\Search\Common\BackgroundIndexer\NullIndexer; use Ibexa\Tests\Core\Repository\Service\Mock\Base as BaseServiceMockTest; +use PHPUnit\Framework\MockObject\MockObject; /** * Mock test case for Search service. @@ -36,14 +39,14 @@ class SearchTest extends BaseServiceMockTest protected $contentDomainMapperMock; - protected $permissionsCriterionResolverMock; + protected ?MockObject $permissionsCriterionResolverMock = null; /** * Test for the __construct() method. * * @covers \Ibexa\Contracts\Core\Repository\SearchService::__construct */ - public function testConstructor() + public function testConstructor(): void { $repositoryMock = $this->getRepositoryMock(); /** @var \Ibexa\Contracts\Core\Search\Handler $searchHandlerMock */ @@ -62,23 +65,23 @@ public function testConstructor() ); } - public function providerForFindContentValidatesLocationCriteriaAndSortClauses() + public function providerForFindContentValidatesLocationCriteriaAndSortClauses(): array { return [ [ - new Query(['filter' => new Criterion\Location\Depth(Criterion\Operator::LT, 2)]), + new Query(['filter' => new Depth(Criterion\Operator::LT, 2)]), "Argument '\$query' is invalid: Location Criteria cannot be used in Content search", ], [ - new Query(['query' => new Criterion\Location\Depth(Criterion\Operator::LT, 2)]), + new Query(['query' => new Depth(Criterion\Operator::LT, 2)]), "Argument '\$query' is invalid: Location Criteria cannot be used in Content search", ], [ new Query( [ - 'query' => new Criterion\LogicalAnd( + 'query' => new LogicalAnd( [ - new Criterion\Location\Depth(Criterion\Operator::LT, 2), + new Depth(Criterion\Operator::LT, 2), ] ), ] @@ -95,7 +98,7 @@ public function providerForFindContentValidatesLocationCriteriaAndSortClauses() /** * @dataProvider providerForFindContentValidatesLocationCriteriaAndSortClauses */ - public function testFindContentValidatesLocationCriteriaAndSortClauses($query, $exceptionMessage) + public function testFindContentValidatesLocationCriteriaAndSortClauses(Query $query, string $exceptionMessage): void { $this->expectException(InvalidArgumentException::class); @@ -123,17 +126,17 @@ public function testFindContentValidatesLocationCriteriaAndSortClauses($query, $ self::fail('Expected exception was not thrown'); } - public function providerForFindSingleValidatesLocationCriteria() + public function providerForFindSingleValidatesLocationCriteria(): array { return [ [ - new Criterion\Location\Depth(Criterion\Operator::LT, 2), + new Depth(Criterion\Operator::LT, 2), "Argument '\$filter' is invalid: Location Criteria cannot be used in Content search", ], [ - new Criterion\LogicalAnd( + new LogicalAnd( [ - new Criterion\Location\Depth(Criterion\Operator::LT, 2), + new Depth(Criterion\Operator::LT, 2), ] ), "Argument '\$filter' is invalid: Location Criteria cannot be used in Content search", @@ -144,7 +147,7 @@ public function providerForFindSingleValidatesLocationCriteria() /** * @dataProvider providerForFindSingleValidatesLocationCriteria */ - public function testFindSingleValidatesLocationCriteria($criterion, $exceptionMessage) + public function testFindSingleValidatesLocationCriteria(Depth|LogicalAnd $criterion, string $exceptionMessage): void { $this->expectException(InvalidArgumentException::class); @@ -177,9 +180,9 @@ public function testFindSingleValidatesLocationCriteria($criterion, $exceptionMe * @covers \Ibexa\Contracts\Core\Repository\SearchService::addPermissionsCriterion * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent */ - public function testFindContentThrowsHandlerException() + public function testFindContentThrowsHandlerException(): void { - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $this->expectExceptionMessage('Handler threw an exception'); $repositoryMock = $this->getRepositoryMock(); @@ -216,7 +219,7 @@ public function testFindContentThrowsHandlerException() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent */ - public function testFindContentWhenDomainMapperThrowsException() + public function testFindContentWhenDomainMapperThrowsException(): void { $indexer = $this->createMock(BackgroundIndexer::class); $indexer->expects(self::once()) @@ -243,7 +246,7 @@ public function testFindContentWhenDomainMapperThrowsException() $mapper->expects(self::once()) ->method('buildContentDomainObjectsOnSearchResult') ->with(self::equalTo($result), self::equalTo([])) - ->willReturnCallback(static function (SearchResult $spiResult) use ($info) { + ->willReturnCallback(static function (SearchResult $spiResult) use ($info): array { unset($spiResult->searchHits[0]); $spiResult->totalCount = $spiResult->totalCount > 0 ? --$spiResult->totalCount : 0; @@ -262,7 +265,7 @@ public function testFindContentWhenDomainMapperThrowsException() * @covers \Ibexa\Contracts\Core\Repository\SearchService::addPermissionsCriterion * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent */ - public function testFindContentNoPermissionsFilter() + public function testFindContentNoPermissionsFilter(): void { /** @var \Ibexa\Contracts\Core\Search\Handler $searchHandlerMock */ $searchHandlerMock = $this->getSPIMockHandler('Search\\Handler'); @@ -302,7 +305,7 @@ public function testFindContentNoPermissionsFilter() $mapper->expects(self::once()) ->method('buildContentDomainObjectsOnSearchResult') ->with(self::isInstanceOf(SearchResult::class), self::equalTo([])) - ->willReturnCallback(static function (SearchResult $spiResult) use ($contentMock) { + ->willReturnCallback(static function (SearchResult $spiResult) use ($contentMock): array { $spiResult->searchHits[0]->valueObject = $contentMock; return []; @@ -327,7 +330,7 @@ public function testFindContentNoPermissionsFilter() * @covers \Ibexa\Contracts\Core\Repository\SearchService::addPermissionsCriterion * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent */ - public function testFindContentWithPermission() + public function testFindContentWithPermission(): void { /** @var \Ibexa\Contracts\Core\Search\Handler $searchHandlerMock */ $searchHandlerMock = $this->getSPIMockHandler('Search\\Handler'); @@ -375,7 +378,7 @@ public function testFindContentWithPermission() ->expects(self::once()) ->method('buildContentDomainObjectsOnSearchResult') ->with(self::isInstanceOf(SearchResult::class), self::equalTo([])) - ->willReturnCallback(static function (SearchResult $spiResult) use ($contentMock) { + ->willReturnCallback(static function (SearchResult $spiResult) use ($contentMock): array { $spiResult->searchHits[0]->valueObject = $contentMock; return []; @@ -400,7 +403,7 @@ public function testFindContentWithPermission() * @covers \Ibexa\Contracts\Core\Repository\SearchService::addPermissionsCriterion * @covers \Ibexa\Contracts\Core\Repository\SearchService::findContent */ - public function testFindContentWithNoPermission() + public function testFindContentWithNoPermission(): void { /** @var \Ibexa\Contracts\Core\Search\Handler $searchHandlerMock */ $searchHandlerMock = $this->getSPIMockHandler('Search\\Handler'); @@ -444,7 +447,7 @@ public function testFindContentWithNoPermission() /** * Test for the findContent() method. */ - public function testFindContentWithDefaultQueryValues() + public function testFindContentWithDefaultQueryValues(): void { /** @var \Ibexa\Contracts\Core\Search\Handler $searchHandlerMock */ $searchHandlerMock = $this->getSPIMockHandler('Search\\Handler'); @@ -490,7 +493,7 @@ public function testFindContentWithDefaultQueryValues() ->expects(self::once()) ->method('buildContentDomainObjectsOnSearchResult') ->with(self::isInstanceOf(SearchResult::class), self::equalTo([])) - ->willReturnCallback(static function (SearchResult $spiResult) use ($contentMock) { + ->willReturnCallback(static function (SearchResult $spiResult) use ($contentMock): array { $spiResult->searchHits[0]->valueObject = $contentMock; return []; @@ -515,7 +518,7 @@ public function testFindContentWithDefaultQueryValues() * @covers \Ibexa\Contracts\Core\Repository\SearchService::addPermissionsCriterion * @covers \Ibexa\Contracts\Core\Repository\SearchService::findSingle */ - public function testFindSingleThrowsNotFoundException() + public function testFindSingleThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -551,9 +554,9 @@ public function testFindSingleThrowsNotFoundException() * @covers \Ibexa\Contracts\Core\Repository\SearchService::addPermissionsCriterion * @covers \Ibexa\Contracts\Core\Repository\SearchService::findSingle */ - public function testFindSingleThrowsHandlerException() + public function testFindSingleThrowsHandlerException(): void { - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $this->expectExceptionMessage('Handler threw an exception'); $repositoryMock = $this->getRepositoryMock(); @@ -646,7 +649,7 @@ public function testFindSingle(): void /** * Test for the findLocations() method. */ - public function testFindLocationsWithPermission() + public function testFindLocationsWithPermission(): void { $repositoryMock = $this->getRepositoryMock(); /** @var \Ibexa\Contracts\Core\Search\Handler $searchHandlerMock */ @@ -700,7 +703,7 @@ public function testFindLocationsWithPermission() $domainMapperMock->expects(self::once()) ->method('buildLocationDomainObjectsOnSearchResult') ->with(self::equalTo($spiResult)) - ->willReturnCallback(static function (SearchResult $spiResult) use ($endResult) { + ->willReturnCallback(static function (SearchResult $spiResult) use ($endResult): array { $spiResult->searchHits[0] = $endResult->searchHits[0]; return []; @@ -717,7 +720,7 @@ public function testFindLocationsWithPermission() /** * Test for the findLocations() method. */ - public function testFindLocationsWithNoPermissionsFilter() + public function testFindLocationsWithNoPermissionsFilter(): void { $repositoryMock = $this->getRepositoryMock(); /** @var \Ibexa\Contracts\Core\Search\Handler $searchHandlerMock */ @@ -767,7 +770,7 @@ public function testFindLocationsWithNoPermissionsFilter() $domainMapperMock->expects(self::once()) ->method('buildLocationDomainObjectsOnSearchResult') ->with(self::equalTo($spiResult)) - ->willReturnCallback(static function (SearchResult $spiResult) use ($endResult) { + ->willReturnCallback(static function (SearchResult $spiResult) use ($endResult): array { $spiResult->searchHits[0] = $endResult->searchHits[0]; return []; @@ -786,7 +789,7 @@ public function testFindLocationsWithNoPermissionsFilter() * * @covers \Ibexa\Contracts\Core\Repository\SearchService::findLocations */ - public function testFindLocationsBackgroundIndexerWhenDomainMapperThrowsException() + public function testFindLocationsBackgroundIndexerWhenDomainMapperThrowsException(): void { $indexer = $this->createMock(BackgroundIndexer::class); $indexer->expects(self::once()) @@ -818,7 +821,7 @@ public function testFindLocationsBackgroundIndexerWhenDomainMapperThrowsExceptio $mapper->expects(self::once()) ->method('buildLocationDomainObjectsOnSearchResult') ->with(self::equalTo($result)) - ->willReturnCallback(static function (SearchResult $spiResult) use ($location) { + ->willReturnCallback(static function (SearchResult $spiResult) use ($location): array { unset($spiResult->searchHits[0]); $spiResult->totalCount = $spiResult->totalCount > 0 ? --$spiResult->totalCount : 0; @@ -834,9 +837,9 @@ public function testFindLocationsBackgroundIndexerWhenDomainMapperThrowsExceptio /** * Test for the findLocations() method. */ - public function testFindLocationsThrowsHandlerException() + public function testFindLocationsThrowsHandlerException(): void { - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $this->expectExceptionMessage('Handler threw an exception'); $repositoryMock = $this->getRepositoryMock(); @@ -871,7 +874,7 @@ public function testFindLocationsThrowsHandlerException() /** * Test for the findLocations() method. */ - public function testFindLocationsWithDefaultQueryValues() + public function testFindLocationsWithDefaultQueryValues(): void { $repositoryMock = $this->getRepositoryMock(); /** @var \Ibexa\Contracts\Core\Search\Handler $searchHandlerMock */ @@ -922,7 +925,7 @@ public function testFindLocationsWithDefaultQueryValues() $domainMapperMock->expects(self::once()) ->method('buildLocationDomainObjectsOnSearchResult') ->with(self::equalTo($spiResult)) - ->willReturnCallback(static function (SearchResult $spiResult) use ($endResult) { + ->willReturnCallback(static function (SearchResult $spiResult) use ($endResult): array { $spiResult->searchHits[0] = $endResult->searchHits[0]; return []; diff --git a/tests/lib/Repository/Service/Mock/UrlAliasTest.php b/tests/lib/Repository/Service/Mock/UrlAliasTest.php index e8e67f5da9..a65b0d31fb 100644 --- a/tests/lib/Repository/Service/Mock/UrlAliasTest.php +++ b/tests/lib/Repository/Service/Mock/UrlAliasTest.php @@ -51,11 +51,11 @@ protected function setUp(): void /** * Test for the __construct() method. */ - public function testConstructor() + public function testConstructor(): void { $repositoryMock = $this->getRepositoryMock(); - new UrlALiasService( + new URLAliasService( $repositoryMock, $this->urlAliasHandler, $this->getNameSchemaServiceMock(), @@ -67,7 +67,7 @@ public function testConstructor() /** * Test for the load() method. */ - public function testLoad() + public function testLoad(): void { $mockedService = $this->getPartlyMockedURLAliasServiceService(['extractPath']); /** @var \PHPUnit\Framework\MockObject\MockObject $urlAliasHandlerMock */ @@ -93,7 +93,7 @@ public function testLoad() /** * Test for the load() method. */ - public function testLoadThrowsNotFoundException() + public function testLoadThrowsNotFoundException(): void { $mockedService = $this->getPartlyMockedURLAliasServiceService(['extractPath']); /** @var \PHPUnit\Framework\MockObject\MockObject $urlAliasHandlerMock */ @@ -109,7 +109,7 @@ public function testLoadThrowsNotFoundException() $mockedService->load(self::EXAMPLE_ID); } - protected function getSpiUrlAlias() + protected function getSpiUrlAlias(): SPIUrlAlias { $pathElement1 = [ 'always-available' => true, @@ -146,7 +146,7 @@ protected function getSpiUrlAlias() /** * Test for the load() method. */ - public function testLoadThrowsNotFoundExceptionPath() + public function testLoadThrowsNotFoundExceptionPath(): void { $spiUrlAlias = $this->getSpiUrlAlias(); $urlAliasService = $this->getPartlyMockedURLAliasServiceService( @@ -168,7 +168,7 @@ public function testLoadThrowsNotFoundExceptionPath() /** * Test for the removeAliases() method. */ - public function testRemoveAliasesThrowsInvalidArgumentException() + public function testRemoveAliasesThrowsInvalidArgumentException(): void { $aliasList = [new URLAlias(['isCustom' => false])]; $mockedService = $this->getPartlyMockedURLAliasServiceService(); @@ -188,7 +188,7 @@ public function testRemoveAliasesThrowsInvalidArgumentException() /** * Test for the removeAliases() method. */ - public function testRemoveAliases() + public function testRemoveAliases(): void { $aliasList = [new URLAlias(['isCustom' => true])]; $spiAliasList = [new SPIUrlAlias(['isCustom' => true])]; @@ -223,7 +223,7 @@ public function testRemoveAliases() /** * Test for the removeAliases() method. */ - public function testRemoveAliasesWithRollback() + public function testRemoveAliasesWithRollback(): void { $aliasList = [new URLAlias(['isCustom' => true])]; $spiAliasList = [new SPIUrlAlias(['isCustom' => true])]; @@ -259,7 +259,7 @@ public function testRemoveAliasesWithRollback() $mockedService->removeAliases($aliasList); } - public function providerForTestListAutogeneratedLocationAliasesPath() + public function providerForTestListAutogeneratedLocationAliasesPath(): array { $pathElement1 = [ 'always-available' => true, @@ -631,7 +631,7 @@ public function providerForTestListAutogeneratedLocationAliasesPath() * * @dataProvider providerForTestListAutogeneratedLocationAliasesPath */ - public function testListAutogeneratedLocationAliasesPath($spiUrlAliases, $prioritizedLanguageCodes, $paths) + public function testListAutogeneratedLocationAliasesPath(array $spiUrlAliases, array $prioritizedLanguageCodes, array $paths): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, @@ -667,10 +667,10 @@ public function testListAutogeneratedLocationAliasesPath($spiUrlAliases, $priori * @dataProvider providerForTestListAutogeneratedLocationAliasesPath */ public function testListAutogeneratedLocationAliasesPathCustomConfiguration( - $spiUrlAliases, - $prioritizedLanguageCodes, - $paths - ) { + array $spiUrlAliases, + array $prioritizedLanguageCodes, + array $paths + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, [] @@ -707,7 +707,7 @@ public function testListAutogeneratedLocationAliasesPathCustomConfiguration( /** * Test for the load() method. */ - public function testListLocationAliasesWithShowAllTranslations() + public function testListLocationAliasesWithShowAllTranslations(): void { $pathElement1 = [ 'always-available' => true, @@ -764,7 +764,7 @@ public function testListLocationAliasesWithShowAllTranslations() /** * Test for the load() method. */ - public function testListLocationAliasesWithShowAllTranslationsCustomConfiguration() + public function testListLocationAliasesWithShowAllTranslationsCustomConfiguration(): void { $pathElement1 = [ 'always-available' => true, @@ -825,7 +825,7 @@ public function testListLocationAliasesWithShowAllTranslationsCustomConfiguratio self::assertEquals('/jedan/dva/tri', $urlAliases[0]->path); } - public function providerForTestListAutogeneratedLocationAliasesEmpty() + public function providerForTestListAutogeneratedLocationAliasesEmpty(): array { $pathElement1 = [ 'always-available' => true, @@ -907,7 +907,7 @@ public function providerForTestListAutogeneratedLocationAliasesEmpty() * * @dataProvider providerForTestListAutogeneratedLocationAliasesEmpty */ - public function testListAutogeneratedLocationAliasesEmpty($spiUrlAliases, $prioritizedLanguageCodes) + public function testListAutogeneratedLocationAliasesEmpty(array $spiUrlAliases, array $prioritizedLanguageCodes): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, @@ -928,9 +928,9 @@ public function testListAutogeneratedLocationAliasesEmpty($spiUrlAliases, $prior * @dataProvider providerForTestListAutogeneratedLocationAliasesEmpty */ public function testListAutogeneratedLocationAliasesEmptyCustomConfiguration( - $spiUrlAliases, - $prioritizedLanguageCodes - ) { + array $spiUrlAliases, + array $prioritizedLanguageCodes + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, [] @@ -950,7 +950,7 @@ public function testListAutogeneratedLocationAliasesEmptyCustomConfiguration( self::assertEmpty($urlAliases); } - public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodePath() + public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodePath(): array { $pathElement1 = [ 'always-available' => true, @@ -1275,11 +1275,11 @@ public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeP * @dataProvider providerForTestListAutogeneratedLocationAliasesWithLanguageCodePath */ public function testListAutogeneratedLocationAliasesWithLanguageCodePath( - $spiUrlAliases, - $languageCode, - $prioritizedLanguageCodes, - $paths - ) { + array $spiUrlAliases, + string $languageCode, + array $prioritizedLanguageCodes, + array $paths + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, $prioritizedLanguageCodes @@ -1309,11 +1309,11 @@ public function testListAutogeneratedLocationAliasesWithLanguageCodePath( * @dataProvider providerForTestListAutogeneratedLocationAliasesWithLanguageCodePath */ public function testListAutogeneratedLocationAliasesWithLanguageCodePathCustomConfiguration( - $spiUrlAliases, - $languageCode, - $prioritizedLanguageCodes, - $paths - ) { + array $spiUrlAliases, + string $languageCode, + array $prioritizedLanguageCodes, + array $paths + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, [] @@ -1343,7 +1343,7 @@ public function testListAutogeneratedLocationAliasesWithLanguageCodePathCustomCo } } - public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeEmpty() + public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeEmpty(): array { $pathElement1 = [ 'always-available' => true, @@ -1538,10 +1538,10 @@ public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeE * @dataProvider providerForTestListAutogeneratedLocationAliasesWithLanguageCodeEmpty */ public function testListAutogeneratedLocationAliasesWithLanguageCodeEmpty( - $spiUrlAliases, - $languageCode, - $prioritizedLanguageCodes - ) { + array $spiUrlAliases, + string $languageCode, + array $prioritizedLanguageCodes + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, $prioritizedLanguageCodes @@ -1561,10 +1561,10 @@ public function testListAutogeneratedLocationAliasesWithLanguageCodeEmpty( * @dataProvider providerForTestListAutogeneratedLocationAliasesWithLanguageCodeEmpty */ public function testListAutogeneratedLocationAliasesWithLanguageCodeEmptyCustomConfiguration( - $spiUrlAliases, - $languageCode, - $prioritizedLanguageCodes - ) { + array $spiUrlAliases, + string $languageCode, + array $prioritizedLanguageCodes + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, [] @@ -1584,7 +1584,7 @@ public function testListAutogeneratedLocationAliasesWithLanguageCodeEmptyCustomC self::assertEmpty($urlAliases); } - public function providerForTestListAutogeneratedLocationAliasesMultipleLanguagesPath() + public function providerForTestListAutogeneratedLocationAliasesMultipleLanguagesPath(): array { $spiUrlAliases = [ new SPIUrlAlias( @@ -1648,7 +1648,7 @@ public function providerForTestListAutogeneratedLocationAliasesMultipleLanguages * * @dataProvider providerForTestListAutogeneratedLocationAliasesMultipleLanguagesPath */ - public function testListAutogeneratedLocationAliasesMultipleLanguagesPath($spiUrlAliases, $prioritizedLanguageCodes, $paths) + public function testListAutogeneratedLocationAliasesMultipleLanguagesPath(array $spiUrlAliases, array $prioritizedLanguageCodes, array $paths): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, @@ -1679,10 +1679,10 @@ public function testListAutogeneratedLocationAliasesMultipleLanguagesPath($spiUr * @dataProvider providerForTestListAutogeneratedLocationAliasesMultipleLanguagesPath */ public function testListAutogeneratedLocationAliasesMultipleLanguagesPathCustomConfiguration( - $spiUrlAliases, - $prioritizedLanguageCodes, - $paths - ) { + array $spiUrlAliases, + array $prioritizedLanguageCodes, + array $paths + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, [] @@ -1712,7 +1712,7 @@ public function testListAutogeneratedLocationAliasesMultipleLanguagesPathCustomC } } - public function providerForTestListAutogeneratedLocationAliasesMultipleLanguagesEmpty() + public function providerForTestListAutogeneratedLocationAliasesMultipleLanguagesEmpty(): array { $spiUrlAliases = [ new SPIUrlAlias( @@ -1756,7 +1756,7 @@ public function providerForTestListAutogeneratedLocationAliasesMultipleLanguages * * @dataProvider providerForTestListAutogeneratedLocationAliasesMultipleLanguagesEmpty */ - public function testListAutogeneratedLocationAliasesMultipleLanguagesEmpty($spiUrlAliases, $prioritizedLanguageCodes) + public function testListAutogeneratedLocationAliasesMultipleLanguagesEmpty(array $spiUrlAliases, array $prioritizedLanguageCodes): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, @@ -1777,9 +1777,9 @@ public function testListAutogeneratedLocationAliasesMultipleLanguagesEmpty($spiU * @dataProvider providerForTestListAutogeneratedLocationAliasesMultipleLanguagesEmpty */ public function testListAutogeneratedLocationAliasesMultipleLanguagesEmptyCustomConfiguration( - $spiUrlAliases, - $prioritizedLanguageCodes - ) { + array $spiUrlAliases, + array $prioritizedLanguageCodes + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, [] @@ -1798,7 +1798,7 @@ public function testListAutogeneratedLocationAliasesMultipleLanguagesEmptyCustom self::assertEmpty($urlAliases); } - public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeMultipleLanguagesPath() + public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeMultipleLanguagesPath(): array { $spiUrlAliases = [ new SPIUrlAlias( @@ -1867,11 +1867,11 @@ public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeM * @dataProvider providerForTestListAutogeneratedLocationAliasesWithLanguageCodeMultipleLanguagesPath */ public function testListAutogeneratedLocationAliasesWithLanguageCodeMultipleLanguagesPath( - $spiUrlAliases, - $languageCode, - $prioritizedLanguageCodes, - $paths - ) { + array $spiUrlAliases, + string $languageCode, + array $prioritizedLanguageCodes, + array $paths + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, $prioritizedLanguageCodes @@ -1900,11 +1900,11 @@ public function testListAutogeneratedLocationAliasesWithLanguageCodeMultipleLang * @dataProvider providerForTestListAutogeneratedLocationAliasesWithLanguageCodeMultipleLanguagesPath */ public function testListAutogeneratedLocationAliasesWithLanguageCodeMultipleLanguagesPathCustomConfiguration( - $spiUrlAliases, - $languageCode, - $prioritizedLanguageCodes, - $paths - ) { + array $spiUrlAliases, + string $languageCode, + array $prioritizedLanguageCodes, + array $paths + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, [] @@ -1933,7 +1933,7 @@ public function testListAutogeneratedLocationAliasesWithLanguageCodeMultipleLang } } - public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeMultipleLanguagesEmpty() + public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeMultipleLanguagesEmpty(): array { $spiUrlAliases = [ new SPIUrlAlias( @@ -1990,10 +1990,10 @@ public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeM * @dataProvider providerForTestListAutogeneratedLocationAliasesWithLanguageCodeMultipleLanguagesEmpty */ public function testListAutogeneratedLocationAliasesWithLanguageCodeMultipleLanguagesEmpty( - $spiUrlAliases, - $languageCode, - $prioritizedLanguageCodes - ) { + array $spiUrlAliases, + string $languageCode, + array $prioritizedLanguageCodes + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, $prioritizedLanguageCodes @@ -2012,10 +2012,10 @@ public function testListAutogeneratedLocationAliasesWithLanguageCodeMultipleLang * @dataProvider providerForTestListAutogeneratedLocationAliasesWithLanguageCodeMultipleLanguagesEmpty */ public function testListAutogeneratedLocationAliasesWithLanguageCodeMultipleLanguagesEmptyCustomConfiguration( - $spiUrlAliases, - $languageCode, - $prioritizedLanguageCodes - ) { + array $spiUrlAliases, + string $languageCode, + array $prioritizedLanguageCodes + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, [] @@ -2034,7 +2034,7 @@ public function testListAutogeneratedLocationAliasesWithLanguageCodeMultipleLang self::assertEmpty($urlAliases); } - public function providerForTestListAutogeneratedLocationAliasesAlwaysAvailablePath() + public function providerForTestListAutogeneratedLocationAliasesAlwaysAvailablePath(): array { $spiUrlAliases = [ new SPIUrlAlias( @@ -2105,10 +2105,10 @@ public function providerForTestListAutogeneratedLocationAliasesAlwaysAvailablePa * @dataProvider providerForTestListAutogeneratedLocationAliasesAlwaysAvailablePath */ public function testListAutogeneratedLocationAliasesAlwaysAvailablePath( - $spiUrlAliases, - $prioritizedLanguageCodes, - $paths - ) { + array $spiUrlAliases, + array $prioritizedLanguageCodes, + array $paths + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, $prioritizedLanguageCodes @@ -2137,10 +2137,10 @@ public function testListAutogeneratedLocationAliasesAlwaysAvailablePath( * @dataProvider providerForTestListAutogeneratedLocationAliasesAlwaysAvailablePath */ public function testListAutogeneratedLocationAliasesAlwaysAvailablePathCustomConfiguration( - $spiUrlAliases, - $prioritizedLanguageCodes, - $paths - ) { + array $spiUrlAliases, + array $prioritizedLanguageCodes, + array $paths + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, [] @@ -2169,7 +2169,7 @@ public function testListAutogeneratedLocationAliasesAlwaysAvailablePathCustomCon } } - public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvailablePath() + public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvailablePath(): array { $spiUrlAliases = [ new SPIUrlAlias( @@ -2221,11 +2221,11 @@ public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeA * @dataProvider providerForTestListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvailablePath */ public function testListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvailablePath( - $spiUrlAliases, - $languageCode, - $prioritizedLanguageCodes, - $paths - ) { + array $spiUrlAliases, + string $languageCode, + array $prioritizedLanguageCodes, + array $paths + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, $prioritizedLanguageCodes @@ -2254,11 +2254,11 @@ public function testListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvaila * @dataProvider providerForTestListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvailablePath */ public function testListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvailablePathCustomConfiguration( - $spiUrlAliases, - $languageCode, - $prioritizedLanguageCodes, - $paths - ) { + array $spiUrlAliases, + string $languageCode, + array $prioritizedLanguageCodes, + array $paths + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, [] @@ -2287,7 +2287,7 @@ public function testListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvaila } } - public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvailableEmpty() + public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvailableEmpty(): array { $spiUrlAliases = [ new SPIUrlAlias( @@ -2338,10 +2338,10 @@ public function providerForTestListAutogeneratedLocationAliasesWithLanguageCodeA * @dataProvider providerForTestListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvailableEmpty */ public function testListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvailableEmpty( - $spiUrlAliases, - $languageCode, - $prioritizedLanguageCodes - ) { + array $spiUrlAliases, + string $languageCode, + array $prioritizedLanguageCodes + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, $prioritizedLanguageCodes @@ -2360,10 +2360,10 @@ public function testListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvaila * @dataProvider providerForTestListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvailableEmpty */ public function testListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvailableEmptyCustomConfiguration( - $spiUrlAliases, - $languageCode, - $prioritizedLanguageCodes - ) { + array $spiUrlAliases, + string $languageCode, + array $prioritizedLanguageCodes + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, [] @@ -2385,7 +2385,7 @@ public function testListAutogeneratedLocationAliasesWithLanguageCodeAlwaysAvaila /** * Test for the listGlobalAliases() method. */ - public function testListGlobalAliases() + public function testListGlobalAliases(): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, @@ -2429,7 +2429,7 @@ public function testListGlobalAliases() /** * Test for the listGlobalAliases() method. */ - public function testListGlobalAliasesEmpty() + public function testListGlobalAliasesEmpty(): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService(); @@ -2468,7 +2468,7 @@ public function testListGlobalAliasesEmpty() /** * Test for the listGlobalAliases() method. */ - public function testListGlobalAliasesWithParameters() + public function testListGlobalAliasesWithParameters(): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService(); @@ -2496,7 +2496,7 @@ public function testListGlobalAliasesWithParameters() /** * Test for the lookup() method. */ - public function testLookupThrowsNotFoundException() + public function testLookupThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -2515,7 +2515,7 @@ public function testLookupThrowsNotFoundException() $urlAliasService->lookup('url'); } - public function providerForTestLookupThrowsNotFoundExceptionPath() + public function providerForTestLookupThrowsNotFoundExceptionPath(): array { return [ // alias does not exist in requested language @@ -2534,7 +2534,7 @@ public function providerForTestLookupThrowsNotFoundExceptionPath() * * @dataProvider providerForTestLookupThrowsNotFoundExceptionPath */ - public function testLookupThrowsNotFoundExceptionPathNotMatchedOrNotLoadable($url, $prioritizedLanguageList, $languageCode) + public function testLookupThrowsNotFoundExceptionPathNotMatchedOrNotLoadable(string $url, array $prioritizedLanguageList, string $languageCode): void { $this->expectException(NotFoundException::class); @@ -2574,7 +2574,7 @@ public function testLookupThrowsNotFoundExceptionPathNotMatchedOrNotLoadable($ur $urlAliasService->lookup($url, $languageCode); } - public function providerForTestLookup() + public function providerForTestLookup(): array { return [ // showAllTranslations setting is true @@ -2591,7 +2591,7 @@ public function providerForTestLookup() * * @dataProvider providerForTestLookup */ - public function testLookup($prioritizedLanguageList, $showAllTranslations, $alwaysAvailable, $languageCode) + public function testLookup(array $prioritizedLanguageList, bool $showAllTranslations, bool $alwaysAvailable, ?string $languageCode): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, @@ -2635,7 +2635,7 @@ public function testLookup($prioritizedLanguageList, $showAllTranslations, $alwa ); } - public function providerForTestLookupWithSharedTranslation() + public function providerForTestLookupWithSharedTranslation(): array { return [ // showAllTranslations setting is true @@ -2662,11 +2662,11 @@ public function providerForTestLookupWithSharedTranslation() * @dataProvider providerForTestLookupWithSharedTranslation */ public function testLookupWithSharedTranslation( - $prioritizedLanguageList, - $showAllTranslations, - $alwaysAvailable, - $languageCode - ) { + array $prioritizedLanguageList, + bool $showAllTranslations, + bool $alwaysAvailable, + ?string $languageCode + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, $prioritizedLanguageList, @@ -2712,7 +2712,7 @@ public function testLookupWithSharedTranslation( /** * Test for the reverseLookup() method. */ - public function testReverseLookupCustomConfiguration() + public function testReverseLookupCustomConfiguration(): void { $this->expectException(NotFoundException::class); @@ -2738,7 +2738,7 @@ public function testReverseLookupCustomConfiguration() /** * Test for the reverseLookup() method. */ - public function testReverseLookupThrowsNotFoundException() + public function testReverseLookupThrowsNotFoundException(): void { $this->expectException(NotFoundException::class); @@ -2760,7 +2760,7 @@ public function testReverseLookupThrowsNotFoundException() self::equalTo($languageCode) )->willReturn( [ - new UrlAlias( + new URLAlias( [ 'languageCodes' => ['eng-GB'], 'alwaysAvailable' => false, @@ -2782,7 +2782,7 @@ public function providerForTestReverseLookup() * * @dataProvider providerForTestReverseLookup */ - public function testReverseLookupPath($spiUrlAliases, $prioritizedLanguageCodes, $paths, $reverseLookupLanguageCode) + public function testReverseLookupPath(array $spiUrlAliases, array $prioritizedLanguageCodes, array $paths, $reverseLookupLanguageCode): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, @@ -2814,10 +2814,10 @@ public function providerForTestReverseLookupAlwaysAvailablePath() * @dataProvider providerForTestReverseLookupAlwaysAvailablePath */ public function testReverseLookupAlwaysAvailablePath( - $spiUrlAliases, - $prioritizedLanguageCodes, + array $spiUrlAliases, + array $prioritizedLanguageCodes, $paths - ) { + ): void { $urlAliasService = $this->getPartlyMockedURLAliasServiceService( null, $prioritizedLanguageCodes @@ -2836,7 +2836,7 @@ public function testReverseLookupAlwaysAvailablePath( /** * Test for the reverseLookup() method. */ - public function testReverseLookupWithShowAllTranslations() + public function testReverseLookupWithShowAllTranslations(): void { $spiUrlAlias = $this->getSpiUrlAlias(); $urlAliasService = $this->getPartlyMockedURLAliasServiceService( @@ -2855,7 +2855,7 @@ public function testReverseLookupWithShowAllTranslations() /** * Test for the createUrlAlias() method. */ - public function testCreateUrlAlias() + public function testCreateUrlAlias(): void { $location = $this->getLocationStub(); $this->permissionResolver @@ -2908,9 +2908,9 @@ public function testCreateUrlAlias() /** * Test for the createUrlAlias() method. */ - public function testCreateUrlAliasWithRollback() + public function testCreateUrlAliasWithRollback(): void { - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $this->expectExceptionMessage('Handler threw an exception'); $location = $this->getLocationStub(); @@ -2964,7 +2964,7 @@ public function testCreateUrlAliasWithRollback() /** * Test for the createUrlAlias() method. */ - public function testCreateUrlAliasThrowsInvalidArgumentException() + public function testCreateUrlAliasThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -3010,7 +3010,7 @@ public function testCreateUrlAliasThrowsInvalidArgumentException() /** * Test for the createGlobalUrlAlias() method. */ - public function testCreateGlobalUrlAlias() + public function testCreateGlobalUrlAlias(): void { $resource = 'module:content/search'; @@ -3064,9 +3064,9 @@ public function testCreateGlobalUrlAlias() /** * Test for the createGlobalUrlAlias() method. */ - public function testCreateGlobalUrlAliasWithRollback() + public function testCreateGlobalUrlAliasWithRollback(): void { - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $this->expectExceptionMessage('Handler threw an exception'); $resource = 'module:content/search'; @@ -3119,7 +3119,7 @@ public function testCreateGlobalUrlAliasWithRollback() /** * Test for the createGlobalUrlAlias() method. */ - public function testCreateGlobalUrlAliasThrowsInvalidArgumentExceptionResource() + public function testCreateGlobalUrlAliasThrowsInvalidArgumentExceptionResource(): void { $this->expectException(InvalidArgumentException::class); @@ -3144,7 +3144,7 @@ public function testCreateGlobalUrlAliasThrowsInvalidArgumentExceptionResource() /** * Test for the createGlobalUrlAlias() method. */ - public function testCreateGlobalUrlAliasThrowsInvalidArgumentExceptionPath() + public function testCreateGlobalUrlAliasThrowsInvalidArgumentExceptionPath(): void { $this->expectException(InvalidArgumentException::class); @@ -3190,7 +3190,7 @@ public function testCreateGlobalUrlAliasThrowsInvalidArgumentExceptionPath() * @depends Ibexa\Tests\Core\Repository\Service\Mock\UrlAliasTest::testCreateUrlAliasWithRollback * @depends Ibexa\Tests\Core\Repository\Service\Mock\UrlAliasTest::testCreateUrlAliasThrowsInvalidArgumentException */ - public function testCreateGlobalUrlAliasForLocation() + public function testCreateGlobalUrlAliasForLocation(): void { $repositoryMock = $this->getRepositoryMock(); $mockedService = $this->getPartlyMockedURLAliasServiceService(['createUrlAlias']); @@ -3257,7 +3257,7 @@ public function testCreateGlobalUrlAliasForLocation() * * @return \Ibexa\Core\Repository\Values\Content\Location */ - protected function getLocationStub($id = 42) + protected function getLocationStub($id = 42): Location { return new Location(['id' => $id]); } @@ -3290,7 +3290,7 @@ protected function getPartlyMockedURLAliasServiceService( array $methods = null, array $prioritizedLanguages = ['eng-GB'], bool $showAllTranslations = false - ) { + ): MockObject { $languageResolverMock = $this->createMock(LanguageResolver::class); $languageResolverMock @@ -3320,7 +3320,7 @@ protected function getPartlyMockedURLAliasServiceService( * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::createUrlAlias */ - public function testCreateUrlAliasThrowsUnauthorizedException() + public function testCreateUrlAliasThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -3348,7 +3348,7 @@ public function testCreateUrlAliasThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::createGlobalUrlAlias */ - public function testCreateGlobalUrlAliasThrowsUnauthorizedException() + public function testCreateGlobalUrlAliasThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -3375,7 +3375,7 @@ public function testCreateGlobalUrlAliasThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\URLAliasService::removeAliases */ - public function testRemoveAliasesThrowsUnauthorizedException() + public function testRemoveAliasesThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); diff --git a/tests/lib/Repository/Service/Mock/UrlTest.php b/tests/lib/Repository/Service/Mock/UrlTest.php index 65132a6346..eb0e4d8dc9 100644 --- a/tests/lib/Repository/Service/Mock/UrlTest.php +++ b/tests/lib/Repository/Service/Mock/UrlTest.php @@ -25,6 +25,7 @@ use Ibexa\Core\Base\Exceptions\UnauthorizedException; use Ibexa\Core\Repository\URLService; use Ibexa\Tests\Core\Repository\Service\Mock\Base as BaseServiceMockTest; +use PHPUnit\Framework\MockObject\MockObject; class UrlTest extends BaseServiceMockTest { @@ -45,7 +46,7 @@ protected function setUp(): void $this->permissionResolver = $this->getPermissionResolverMock(); } - public function testFindUrlsUnauthorized() + public function testFindUrlsUnauthorized(): void { $this->configureUrlViewPermissionForHasAccess(false); @@ -53,7 +54,7 @@ public function testFindUrlsUnauthorized() $this->createUrlService()->findUrls(new URLQuery()); } - public function testFindUrlsNonNumericOffset() + public function testFindUrlsNonNumericOffset(): void { $this->expectException(InvalidArgumentValue::class); @@ -63,7 +64,7 @@ public function testFindUrlsNonNumericOffset() $this->createUrlService()->findUrls($query); } - public function testFindUrlsNonNumericLimit() + public function testFindUrlsNonNumericLimit(): void { $this->expectException(InvalidArgumentValue::class); @@ -73,7 +74,7 @@ public function testFindUrlsNonNumericLimit() $this->createUrlService()->findUrls($query); } - public function testFindUrls() + public function testFindUrls(): void { $url = $this->getApiUrl(); @@ -102,7 +103,7 @@ public function testFindUrls() self::assertEquals($expected, $this->createUrlService()->findUrls($query)); } - public function testUpdateUrlUnauthorized() + public function testUpdateUrlUnauthorized(): void { $this->expectException(UnauthorizedException::class); @@ -113,7 +114,7 @@ public function testUpdateUrlUnauthorized() $this->createUrlService()->updateUrl($url, new URLUpdateStruct()); } - public function testUpdateUrlNonUnique() + public function testUpdateUrlNonUnique(): void { $this->expectException(InvalidArgumentException::class); @@ -135,7 +136,7 @@ public function testUpdateUrlNonUnique() $urlService->updateUrl($url, $struct); } - public function testUpdateUrl() + public function testUpdateUrl(): void { $apiUrl = $this->getApiUrl(self::URL_ID, self::URL_IBEXA_CO); $apiStruct = new URLUpdateStruct([ @@ -160,7 +161,7 @@ public function testUpdateUrl() $this->urlHandler ->expects(self::once()) ->method('updateUrl') - ->willReturnCallback(function ($id, $struct) use ($apiUrl, $apiStruct) { + ->willReturnCallback(function ($id, $struct) use ($apiUrl, $apiStruct): void { $this->assertEquals($apiUrl->id, $id); $this->assertEquals($apiStruct->url, $struct->url); @@ -194,7 +195,7 @@ public function testUpdateUrl() ]), $urlService->updateUrl($apiUrl, $apiStruct)); } - public function testUpdateUrlStatus() + public function testUpdateUrlStatus(): void { $apiUrl = $this->getApiUrl(self::URL_ID, self::URL_IBEXA_CO); $apiStruct = new URLUpdateStruct([ @@ -220,7 +221,7 @@ public function testUpdateUrlStatus() $this->urlHandler ->expects(self::once()) ->method('updateUrl') - ->willReturnCallback(function ($id, $struct) use ($apiUrl, $apiStruct) { + ->willReturnCallback(function ($id, $struct) use ($apiUrl, $apiStruct): void { $this->assertEquals($apiUrl->id, $id); $this->assertEquals($apiUrl->url, $struct->url); @@ -254,7 +255,7 @@ public function testUpdateUrlStatus() ]), $urlService->updateUrl($apiUrl, $apiStruct)); } - public function testLoadByIdUnauthorized() + public function testLoadByIdUnauthorized(): void { $this->expectException(UnauthorizedException::class); @@ -276,7 +277,7 @@ public function testLoadByIdUnauthorized() $this->createUrlService()->loadById(self::URL_ID); } - public function testLoadById() + public function testLoadById(): void { $url = new URL([ 'id' => self::URL_ID, @@ -295,7 +296,7 @@ public function testLoadById() self::assertEquals($url, $this->createUrlService()->loadById(self::URL_ID)); } - public function testLoadByUrlUnauthorized() + public function testLoadByUrlUnauthorized(): void { $this->expectException(UnauthorizedException::class); @@ -319,7 +320,7 @@ public function testLoadByUrlUnauthorized() $this->createUrlService()->loadByUrl(self::URL_IBEXA_CO); } - public function testLoadByUrl() + public function testLoadByUrl(): void { $url = self::URL_IBEXA_CO; @@ -343,7 +344,7 @@ public function testLoadByUrl() /** * @dataProvider dateProviderForFindUsages */ - public function testFindUsages($offset, $limit, ContentQuery $expectedQuery, array $usages) + public function testFindUsages(int $offset, int $limit, ContentQuery $expectedQuery, array $usages): void { $url = $this->getApiUrl(self::URL_ID, self::URL_IBEXA_CO); @@ -352,11 +353,11 @@ public function testFindUsages($offset, $limit, ContentQuery $expectedQuery, arr $searchService ->expects(self::once()) ->method('findContentInfo') - ->willReturnCallback(function ($query) use ($expectedQuery, $usages) { + ->willReturnCallback(function ($query) use ($expectedQuery, $usages): \Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult { $this->assertEquals($expectedQuery, $query); return new ContentSearchResults([ - 'searchHits' => array_map(static function ($id) { + 'searchHits' => array_map(static function ($id): SearchHit { return new SearchHit([ 'valueObject' => new ContentInfo([ 'id' => $id, @@ -388,7 +389,7 @@ public function testFindUsages($offset, $limit, ContentQuery $expectedQuery, arr } } - public function dateProviderForFindUsages() + public function dateProviderForFindUsages(): array { return [ [ @@ -419,7 +420,7 @@ public function dateProviderForFindUsages() ]; } - public function testCreateUpdateStruct() + public function testCreateUpdateStruct(): void { self::assertEquals(new URLUpdateStruct(), $this->createUrlService()->createUpdateStruct()); } @@ -471,7 +472,7 @@ protected function configurePermissions(array $permissions) /** * @return \Ibexa\Contracts\Core\Repository\URLService|\PHPUnit\Framework\MockObject\MockObject */ - private function createUrlService(array $methods = null) + private function createUrlService(array $methods = null): MockObject { return $this ->getMockBuilder(URLService::class) @@ -480,7 +481,7 @@ private function createUrlService(array $methods = null) ->getMock(); } - private function getApiUrl($id = null, $url = null) + private function getApiUrl($id = null, $url = null): URL { return new URL(['id' => $id, 'url' => $url]); } diff --git a/tests/lib/Repository/Service/Mock/UrlWildcardTest.php b/tests/lib/Repository/Service/Mock/UrlWildcardTest.php index 1a21ebd83b..9ef6323b43 100644 --- a/tests/lib/Repository/Service/Mock/UrlWildcardTest.php +++ b/tests/lib/Repository/Service/Mock/UrlWildcardTest.php @@ -19,6 +19,7 @@ use Ibexa\Core\Base\Exceptions\NotFoundException as APINotFoundException; use Ibexa\Core\Repository\URLWildcardService; use Ibexa\Tests\Core\Repository\Service\Mock\Base as BaseServiceMockTest; +use PHPUnit\Framework\MockObject\MockObject; /** * Mock Test case for UrlWildcard Service. @@ -45,7 +46,7 @@ protected function setUp(): void * * @covers \Ibexa\Contracts\Core\Repository\URLWildcardService::create */ - public function testCreateThrowsUnauthorizedException() + public function testCreateThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -72,7 +73,7 @@ public function testCreateThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\URLWildcardService::create */ - public function testCreateThrowsInvalidArgumentException() + public function testCreateThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -100,7 +101,7 @@ public function testCreateThrowsInvalidArgumentException() $mockedService->create('/lorem/ipsum', 'opossum', true); } - public function providerForTestCreateThrowsContentValidationException() + public function providerForTestCreateThrowsContentValidationException(): array { return [ ['fruit', 'food/{1}', true], @@ -116,7 +117,7 @@ public function providerForTestCreateThrowsContentValidationException() * * @dataProvider providerForTestCreateThrowsContentValidationException */ - public function testCreateThrowsContentValidationException($sourceUrl, $destinationUrl, $forward) + public function testCreateThrowsContentValidationException(string $sourceUrl, string $destinationUrl, bool $forward): void { $this->expectException(ContentValidationException::class); @@ -144,7 +145,7 @@ public function testCreateThrowsContentValidationException($sourceUrl, $destinat $mockedService->create($sourceUrl, $destinationUrl, $forward); } - public function providerForTestCreate() + public function providerForTestCreate(): array { return [ ['fruit', 'food', true], @@ -164,7 +165,7 @@ public function providerForTestCreate() * * @dataProvider providerForTestCreate */ - public function testCreate($sourceUrl, $destinationUrl, $forward) + public function testCreate(string $sourceUrl, string $destinationUrl, bool $forward): void { $mockedService = $this->getPartlyMockedURLWildcardService(); @@ -233,9 +234,9 @@ public function testCreate($sourceUrl, $destinationUrl, $forward) * * @covers \Ibexa\Contracts\Core\Repository\URLWildcardService::create */ - public function testCreateWithRollback() + public function testCreateWithRollback(): void { - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $mockedService = $this->getPartlyMockedURLWildcardService(); @@ -286,7 +287,7 @@ public function testCreateWithRollback() * * @covers \Ibexa\Contracts\Core\Repository\URLWildcardService::remove */ - public function testRemoveThrowsUnauthorizedException() + public function testRemoveThrowsUnauthorizedException(): void { $this->expectException(UnauthorizedException::class); @@ -319,7 +320,7 @@ public function testRemoveThrowsUnauthorizedException() * * @covers \Ibexa\Contracts\Core\Repository\URLWildcardService::remove */ - public function testRemove() + public function testRemove(): void { $wildcard = new URLWildcard(['id' => 'McBomb']); @@ -357,9 +358,9 @@ public function testRemove() * * @covers \Ibexa\Contracts\Core\Repository\URLWildcardService::remove */ - public function testRemoveWithRollback() + public function testRemoveWithRollback(): void { - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $wildcard = new URLWildcard(['id' => 'McBoo']); @@ -401,9 +402,9 @@ public function testRemoveWithRollback() * * @covers \Ibexa\Contracts\Core\Repository\URLWildcardService::remove */ - public function testLoadThrowsException() + public function testLoadThrowsException(): void { - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $mockedService = $this->getPartlyMockedURLWildcardService(); @@ -427,7 +428,7 @@ public function testLoadThrowsException() * * @covers \Ibexa\Contracts\Core\Repository\URLWildcardService::remove */ - public function testLoad() + public function testLoad(): void { $mockedService = $this->getPartlyMockedURLWildcardService(); @@ -470,7 +471,7 @@ public function testLoad() * * @covers \Ibexa\Contracts\Core\Repository\URLWildcardService::loadAll */ - public function testLoadAll() + public function testLoadAll(): void { $mockedService = $this->getPartlyMockedURLWildcardService(); @@ -493,7 +494,7 @@ public function testLoadAll() * * @covers \Ibexa\Contracts\Core\Repository\URLWildcardService::loadAll */ - public function testLoadAllWithLimitAndOffset() + public function testLoadAllWithLimitAndOffset(): void { $mockedService = $this->getPartlyMockedURLWildcardService(); @@ -539,7 +540,7 @@ public function testLoadAllWithLimitAndOffset() /** * @return array */ - public function providerForTestTranslateThrowsNotFoundException() + public function providerForTestTranslateThrowsNotFoundException(): array { return [ [ @@ -584,7 +585,7 @@ public function providerForTestTranslateThrowsNotFoundException() * * @dataProvider providerForTestTranslateThrowsNotFoundException */ - public function testTranslateThrowsNotFoundException($createArray, $url) + public function testTranslateThrowsNotFoundException(array $createArray, string $url): void { $this->expectException(NotFoundException::class); @@ -606,7 +607,7 @@ public function testTranslateThrowsNotFoundException($createArray, $url) /** * @return array */ - public function providerForTestTranslate() + public function providerForTestTranslate(): array { return [ [ @@ -691,7 +692,7 @@ public function providerForTestTranslate() * * @dataProvider providerForTestTranslate */ - public function testTranslate($createArray, $url, $uri) + public function testTranslate(array $createArray, string $url, string $uri): void { $mockedService = $this->getPartlyMockedURLWildcardService(); @@ -726,7 +727,7 @@ public function testTranslate($createArray, $url, $uri) * * @covers \Ibexa\Contracts\Core\Repository\URLWildcardService::translate */ - public function testTranslateUsesLongestMatchingWildcard() + public function testTranslateUsesLongestMatchingWildcard(): void { $mockedService = $this->getPartlyMockedURLWildcardService(); @@ -764,7 +765,7 @@ public function testTranslateUsesLongestMatchingWildcard() * * @return \Ibexa\Core\Repository\URLWildcardService|\PHPUnit\Framework\MockObject\MockObject */ - protected function getPartlyMockedURLWildcardService(array $methods = null) + protected function getPartlyMockedURLWildcardService(array $methods = null): MockObject { return $this->getMockBuilder(URLWildcardService::class) ->setMethods($methods) diff --git a/tests/lib/Repository/Service/Mock/UserPasswordValidatorTest.php b/tests/lib/Repository/Service/Mock/UserPasswordValidatorTest.php index ebee11608b..ca4ee6362a 100644 --- a/tests/lib/Repository/Service/Mock/UserPasswordValidatorTest.php +++ b/tests/lib/Repository/Service/Mock/UserPasswordValidatorTest.php @@ -20,7 +20,7 @@ class UserPasswordValidatorTest extends TestCase /** * @dataProvider dateProviderForValidate */ - public function testValidate(array $constraints, string $password, array $expectedErrors) + public function testValidate(array $constraints, string $password, array $expectedErrors): void { $validator = new UserPasswordValidator($constraints); diff --git a/tests/lib/Repository/Service/Mock/UserPreferenceTest.php b/tests/lib/Repository/Service/Mock/UserPreferenceTest.php index 9503fbbfe0..363c75a7f3 100644 --- a/tests/lib/Repository/Service/Mock/UserPreferenceTest.php +++ b/tests/lib/Repository/Service/Mock/UserPreferenceTest.php @@ -18,6 +18,7 @@ use Ibexa\Core\Repository\UserPreferenceService; use Ibexa\Core\Repository\Values\User\UserReference; use Ibexa\Tests\Core\Repository\Service\Mock\Base as BaseServiceMockTest; +use PHPUnit\Framework\MockObject\MockObject; class UserPreferenceTest extends BaseServiceMockTest { @@ -45,18 +46,18 @@ protected function setUp(): void /** * @covers \Ibexa\Contracts\Core\Repository\UserPreferenceService::setUserPreference() */ - public function testSetUserPreference() + public function testSetUserPreference(): void { $apiUserPreferenceSetStruct = new APIUserPreferenceSetStruct([ 'name' => 'setting', 'value' => 'value', ]); - $this->assertTransactionIsCommitted(function () { + $this->assertTransactionIsCommitted(function (): void { $this->userSPIPreferenceHandler ->expects($this->once()) ->method('setUserPreference') - ->willReturnCallback(function (UserPreferenceSetStruct $setStruct) { + ->willReturnCallback(function (UserPreferenceSetStruct $setStruct): UserPreference { $this->assertEquals(self::USER_PREFERENCE_NAME, $setStruct->name); $this->assertEquals(self::USER_PREFERENCE_VALUE, $setStruct->value); $this->assertEquals(self::CURRENT_USER_ID, $setStruct->userId); @@ -71,7 +72,7 @@ public function testSetUserPreference() /** * @covers \Ibexa\Contracts\Core\Repository\UserPreferenceService::setUserPreference */ - public function testSetUserPreferenceThrowsInvalidArgumentException() + public function testSetUserPreferenceThrowsInvalidArgumentException(): void { $this->expectException(InvalidArgumentException::class); @@ -79,7 +80,7 @@ public function testSetUserPreferenceThrowsInvalidArgumentException() 'value' => 'value', ]); - $this->assertTransactionIsNotStarted(function () { + $this->assertTransactionIsNotStarted(function (): void { $this->userSPIPreferenceHandler->expects($this->never())->method('setUserPreference'); }); @@ -89,16 +90,16 @@ public function testSetUserPreferenceThrowsInvalidArgumentException() /** * @covers \Ibexa\Contracts\Core\Repository\UserPreferenceService::setUserPreference */ - public function testSetUserPreferenceWithRollback() + public function testSetUserPreferenceWithRollback(): void { - $this->expectException(\Exception::class); + $this->expectException(Exception::class); $apiUserPreferenceSetStruct = new APIUserPreferenceSetStruct([ 'name' => 'setting', 'value' => 'value', ]); - $this->assertTransactionIsRollback(function () { + $this->assertTransactionIsRollback(function (): void { $this->userSPIPreferenceHandler ->expects($this->once()) ->method('setUserPreference') @@ -111,7 +112,7 @@ public function testSetUserPreferenceWithRollback() /** * @covers \Ibexa\Contracts\Core\Repository\UserPreferenceService::getUserPreference() */ - public function testGetUserPreference() + public function testGetUserPreference(): void { $userPreferenceName = 'setting'; $userPreferenceValue = 'value'; @@ -137,13 +138,13 @@ public function testGetUserPreference() /** * @covers \Ibexa\Contracts\Core\Repository\UserPreferenceService::loadUserPreferences */ - public function testLoadUserPreferences() + public function testLoadUserPreferences(): void { $offset = 0; $limit = 25; $expectedTotalCount = 10; - $expectedItems = array_map(function () { + $expectedItems = array_map(function (): APIUserPreference { return $this->createAPIUserPreference(); }, range(1, $expectedTotalCount)); @@ -157,7 +158,7 @@ public function testLoadUserPreferences() ->expects(self::once()) ->method('loadUserPreferences') ->with(self::CURRENT_USER_ID, $offset, $limit) - ->willReturn(array_map(static function ($locationId) { + ->willReturn(array_map(static function ($locationId): UserPreference { return new UserPreference([ 'name' => 'setting', 'value' => 'value', @@ -173,7 +174,7 @@ public function testLoadUserPreferences() /** * @covers \Ibexa\Contracts\Core\Repository\UserPreferenceService::getUserPreferenceCount() */ - public function testGetUserPreferenceCount() + public function testGetUserPreferenceCount(): void { $expectedTotalCount = 10; @@ -191,7 +192,7 @@ public function testGetUserPreferenceCount() /** * @return \Ibexa\Contracts\Core\Repository\UserPreferenceService|\PHPUnit\Framework\MockObject\MockObject */ - private function createAPIUserPreferenceService(array $methods = null) + private function createAPIUserPreferenceService(array $methods = null): MockObject { return $this ->getMockBuilder(UserPreferenceService::class) diff --git a/tests/lib/Repository/Service/Mock/UserTest.php b/tests/lib/Repository/Service/Mock/UserTest.php index 4788095a12..169108e537 100644 --- a/tests/lib/Repository/Service/Mock/UserTest.php +++ b/tests/lib/Repository/Service/Mock/UserTest.php @@ -10,10 +10,12 @@ use Exception; use Ibexa\Contracts\Core\Persistence\User\Handler as PersistenceUserHandler; use Ibexa\Contracts\Core\Persistence\User\RoleAssignment; +use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentService as APIContentService; use Ibexa\Contracts\Core\Repository\PasswordHashService; use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\UserService as APIUserService; +use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo as APIContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo as APIVersionInfo; use Ibexa\Contracts\Core\Repository\Values\User\User; @@ -22,6 +24,7 @@ use Ibexa\Core\Repository\User\PasswordValidatorInterface; use Ibexa\Core\Repository\UserService; use Ibexa\Tests\Core\Repository\Service\Mock\Base as BaseServiceMockTest; +use PHPUnit\Framework\MockObject\MockObject; /** * @covers \Ibexa\Core\Repository\UserService @@ -116,10 +119,10 @@ protected function getPartlyMockedUserService(array $methods = null): APIUserSer */ private function mockDeleteUserFlow( Repository $repository, - APIUserService $userService, - APIContentService $contentService, + APIUserService&MockObject $userService, + ContentService&MockObject $contentService, User $user, - APIContentInfo $contentInfo, + ContentInfo&MockObject $contentInfo, PersistenceUserHandler $userHandler ): void { $loadedUser = $this->createMock(APIUser::class); diff --git a/tests/lib/Repository/Service/Mock/ValueStub.php b/tests/lib/Repository/Service/Mock/ValueStub.php index c889d0c2f5..da90fd28f0 100644 --- a/tests/lib/Repository/Service/Mock/ValueStub.php +++ b/tests/lib/Repository/Service/Mock/ValueStub.php @@ -27,7 +27,7 @@ public function __construct($value) $this->value = $value; } - public function __toString() + public function __toString(): string { return (string)$this->value; } diff --git a/tests/lib/Repository/SiteAccessAware/AbstractServiceTest.php b/tests/lib/Repository/SiteAccessAware/AbstractServiceTest.php index 6a0f7160c8..38c2637299 100644 --- a/tests/lib/Repository/SiteAccessAware/AbstractServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/AbstractServiceTest.php @@ -9,6 +9,7 @@ use Closure; use Ibexa\Contracts\Core\Repository\LanguageResolver; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use ReflectionClass; use ReflectionMethod; @@ -32,13 +33,13 @@ abstract class AbstractServiceTest extends TestCase public const LANG_ARG = 0; /** @var \object|\PHPUnit\Framework\MockObject\MockObject */ - protected $innerApiServiceMock; + protected MockObject $innerApiServiceMock; /** @var object */ protected $service; /** @var \Ibexa\Contracts\Core\Repository\LanguageResolver|\PHPUnit\Framework\MockObject\MockObject */ - protected $languageResolverMock; + protected MockObject $languageResolverMock; abstract public function getAPIServiceClassName(); @@ -83,7 +84,7 @@ abstract public function providerForPassTroughMethods(); * @param array $arguments * @param mixed $return */ - final public function testForPassTrough($method, array $arguments, $return = true) + final public function testForPassTrough($method, array $arguments, $return = true): void { if ($return) { $this->innerApiServiceMock @@ -152,7 +153,7 @@ protected function setLanguagesLookupArguments(array $arguments, $languageArgume * @param mixed|null $return * @param int $languageArgumentIndex From 0 and up, so the array index on $arguments. */ - final public function testForLanguagesLookup($method, array $arguments, $return, $languageArgumentIndex, callable $callback = null, int $alwaysAvailableArgumentIndex = null) + final public function testForLanguagesLookup($method, array $arguments, $return, $languageArgumentIndex, callable $callback = null, int $alwaysAvailableArgumentIndex = null): void { $languages = ['eng-GB', 'eng-US']; @@ -219,7 +220,7 @@ protected function setLanguagesPassTroughArguments(array $arguments, $languageAr * @param mixed|null $return * @param int $languageArgumentIndex From 0 and up, so the array index on $arguments. */ - final public function testForLanguagesPassTrough($method, array $arguments, $return, $languageArgumentIndex, callable $callback = null, int $alwaysAvailableArgumentIndex = null) + final public function testForLanguagesPassTrough($method, array $arguments, $return, $languageArgumentIndex, callable $callback = null, int $alwaysAvailableArgumentIndex = null): void { $languages = ['eng-GB', 'eng-US']; $arguments = $this->setLanguagesPassTroughArguments($arguments, $languageArgumentIndex, $languages); diff --git a/tests/lib/Repository/SiteAccessAware/ContentTypeServiceTest.php b/tests/lib/Repository/SiteAccessAware/ContentTypeServiceTest.php index 7327d4eee9..5ac43a0d11 100644 --- a/tests/lib/Repository/SiteAccessAware/ContentTypeServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/ContentTypeServiceTest.php @@ -33,7 +33,7 @@ public function getSiteAccessAwareServiceClassName(): string return ContentTypeService::class; } - public function providerForPassTroughMethods() + public function providerForPassTroughMethods(): array { $contentTypeGroupCreateStruct = new ContentTypeGroupCreateStruct(); $contentTypeGroupUpdateStruct = new ContentTypeGroupUpdateStruct(); @@ -103,7 +103,7 @@ public function providerForPassTroughMethods() ]; } - public function providerForLanguagesLookupMethods() + public function providerForLanguagesLookupMethods(): array { $contentType = new ContentType(); $contentTypeGroup = new ContentTypeGroup(); diff --git a/tests/lib/Repository/SiteAccessAware/Language/LanguageResolverTest.php b/tests/lib/Repository/SiteAccessAware/Language/LanguageResolverTest.php index 9832182548..b272f1f5b4 100644 --- a/tests/lib/Repository/SiteAccessAware/Language/LanguageResolverTest.php +++ b/tests/lib/Repository/SiteAccessAware/Language/LanguageResolverTest.php @@ -32,7 +32,7 @@ public function testGetPrioritizedLanguages( bool $defaultShowAllTranslations, ?array $forcedLanguages, ?string $contextLanguage - ) { + ): void { // note: "use always available" does not affect this test $defaultUseAlwaysAvailable = true; diff --git a/tests/lib/Repository/SiteAccessAware/LanguageServiceTest.php b/tests/lib/Repository/SiteAccessAware/LanguageServiceTest.php index 666ee1d01e..5d8004047c 100644 --- a/tests/lib/Repository/SiteAccessAware/LanguageServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/LanguageServiceTest.php @@ -24,7 +24,7 @@ public function getSiteAccessAwareServiceClassName(): string return LanguageService::class; } - public function providerForPassTroughMethods() + public function providerForPassTroughMethods(): array { $languageCreateStruct = new LanguageCreateStruct(); $language = new Language(); @@ -55,7 +55,7 @@ public function providerForPassTroughMethods() ]; } - public function providerForLanguagesLookupMethods() + public function providerForLanguagesLookupMethods(): array { // string $method, array $arguments, bool $return, int $languageArgumentIndex return []; diff --git a/tests/lib/Repository/SiteAccessAware/ObjectStateServiceTest.php b/tests/lib/Repository/SiteAccessAware/ObjectStateServiceTest.php index 178367644b..925727a593 100644 --- a/tests/lib/Repository/SiteAccessAware/ObjectStateServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/ObjectStateServiceTest.php @@ -29,7 +29,7 @@ public function getSiteAccessAwareServiceClassName(): string return ObjectStateService::class; } - public function providerForPassTroughMethods() + public function providerForPassTroughMethods(): array { $objectStateGroupCreateStruct = new ObjectStateGroupCreateStruct(); $objectStateGroupUpdateStruct = new ObjectStateGroupUpdateStruct(); @@ -63,7 +63,7 @@ public function providerForPassTroughMethods() ]; } - public function providerForLanguagesLookupMethods() + public function providerForLanguagesLookupMethods(): array { $objectStateGroup = new ObjectStateGroup(); $objectState = new ObjectState(); diff --git a/tests/lib/Repository/SiteAccessAware/SearchServiceTest.php b/tests/lib/Repository/SiteAccessAware/SearchServiceTest.php index 9d7e85a428..45e391eba3 100644 --- a/tests/lib/Repository/SiteAccessAware/SearchServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/SearchServiceTest.php @@ -26,7 +26,7 @@ public function getSiteAccessAwareServiceClassName(): string return SearchService::class; } - public function providerForPassTroughMethods() + public function providerForPassTroughMethods(): array { // string $method, array $arguments, bool $return = true return [ @@ -35,7 +35,7 @@ public function providerForPassTroughMethods() ]; } - public function providerForLanguagesLookupMethods() + public function providerForLanguagesLookupMethods(): array { $query = new Query(); $locationQuery = new LocationQuery(); @@ -43,7 +43,7 @@ public function providerForLanguagesLookupMethods() $content = new Content(); $searchResults = new SearchResult(); - $callback = function ($languageLookup) { + $callback = function ($languageLookup): void { $this->languageResolverMock ->expects($this->once()) ->method('getUseAlwaysAvailable') @@ -60,7 +60,7 @@ public function providerForLanguagesLookupMethods() ]; } - protected function setLanguagesLookupArguments(array $arguments, $languageArgumentIndex) + protected function setLanguagesLookupArguments(array $arguments, $languageArgumentIndex): array { $arguments[$languageArgumentIndex] = [ 'languages' => [], @@ -70,7 +70,7 @@ protected function setLanguagesLookupArguments(array $arguments, $languageArgume return $arguments; } - protected function setLanguagesLookupExpectedArguments(array $arguments, $languageArgumentIndex, array $languages) + protected function setLanguagesLookupExpectedArguments(array $arguments, $languageArgumentIndex, array $languages): array { $arguments[$languageArgumentIndex] = [ 'languages' => $languages, @@ -80,7 +80,7 @@ protected function setLanguagesLookupExpectedArguments(array $arguments, $langua return $arguments; } - protected function setLanguagesPassTroughArguments(array $arguments, $languageArgumentIndex, array $languages) + protected function setLanguagesPassTroughArguments(array $arguments, $languageArgumentIndex, array $languages): array { $arguments[$languageArgumentIndex] = [ 'languages' => $languages, diff --git a/tests/lib/Repository/SiteAccessAware/TrashServiceTest.php b/tests/lib/Repository/SiteAccessAware/TrashServiceTest.php index 30279d2456..c42742f92f 100644 --- a/tests/lib/Repository/SiteAccessAware/TrashServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/TrashServiceTest.php @@ -28,7 +28,7 @@ public function getSiteAccessAwareServiceClassName(): string return TrashService::class; } - public function providerForPassTroughMethods() + public function providerForPassTroughMethods(): array { $location = new Location(); $newLocation = new Location(); @@ -49,7 +49,7 @@ public function providerForPassTroughMethods() ]; } - public function providerForLanguagesLookupMethods() + public function providerForLanguagesLookupMethods(): array { // string $method, array $arguments, bool $return, int $languageArgumentIndex return []; diff --git a/tests/lib/Repository/SiteAccessAware/UrlAliasServiceTest.php b/tests/lib/Repository/SiteAccessAware/UrlAliasServiceTest.php index fc600a2f80..a40c46f9a5 100644 --- a/tests/lib/Repository/SiteAccessAware/UrlAliasServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/UrlAliasServiceTest.php @@ -24,7 +24,7 @@ public function getSiteAccessAwareServiceClassName(): string return URLAliasService::class; } - public function providerForPassTroughMethods() + public function providerForPassTroughMethods(): array { $location = new Location(); $urlAlias = new URLAlias(); @@ -42,12 +42,12 @@ public function providerForPassTroughMethods() ]; } - public function providerForLanguagesLookupMethods() + public function providerForLanguagesLookupMethods(): array { $location = new Location(); $urlAlias = new URLAlias(); - $callback = function ($languageLookup) { + $callback = function ($languageLookup): void { $this->languageResolverMock ->expects($this->once()) ->method('getShowAllTranslations') @@ -62,7 +62,7 @@ public function providerForLanguagesLookupMethods() ]; } - protected function setLanguagesLookupExpectedArguments(array $arguments, $languageArgumentIndex, array $languages) + protected function setLanguagesLookupExpectedArguments(array $arguments, $languageArgumentIndex, array $languages): array { $arguments[$languageArgumentIndex] = $languages; $arguments[$languageArgumentIndex - 1] = true; diff --git a/tests/lib/Repository/SiteAccessAware/UserServiceTest.php b/tests/lib/Repository/SiteAccessAware/UserServiceTest.php index c37cc72a85..e18f848a9b 100644 --- a/tests/lib/Repository/SiteAccessAware/UserServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/UserServiceTest.php @@ -34,7 +34,7 @@ public function getSiteAccessAwareServiceClassName(): string return UserService::class; } - public function providerForPassTroughMethods() + public function providerForPassTroughMethods(): array { $userGroupCreateStruct = new UserGroupCreateStruct(); $userGroupUpdateStruct = new UserGroupUpdateStruct(); @@ -84,7 +84,7 @@ public function providerForPassTroughMethods() ]; } - public function providerForLanguagesLookupMethods() + public function providerForLanguagesLookupMethods(): array { $userGroup = new UserGroup(); $user = new User(); diff --git a/tests/lib/Repository/Validator/TargetContentValidatorTest.php b/tests/lib/Repository/Validator/TargetContentValidatorTest.php index b7c0f07e1a..3ae1e67376 100644 --- a/tests/lib/Repository/Validator/TargetContentValidatorTest.php +++ b/tests/lib/Repository/Validator/TargetContentValidatorTest.php @@ -12,18 +12,19 @@ use Ibexa\Contracts\Core\Persistence\Content; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Core\Repository\Validator\TargetContentValidator; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; final class TargetContentValidatorTest extends TestCase { /** @var \Ibexa\Contracts\Core\Persistence\Content\Handler|\PHPUnit_Framework_MockObject_MockObject */ - private $contentHandler; + private MockObject $contentHandler; /** @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler|\PHPUnit_Framework_MockObject_MockObject */ - private $contentTypeHandler; + private MockObject $contentTypeHandler; /** @var \Ibexa\Core\Repository\Validator\TargetContentValidator */ - private $targetContentValidator; + private TargetContentValidator $targetContentValidator; public function setUp(): void { diff --git a/tests/lib/Repository/Values/Content/ContentTest.php b/tests/lib/Repository/Values/Content/ContentTest.php index f1bdd191d1..59c3f58321 100644 --- a/tests/lib/Repository/Values/Content/ContentTest.php +++ b/tests/lib/Repository/Values/Content/ContentTest.php @@ -21,10 +21,10 @@ final class ContentTest extends TestCase { /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Field[] */ - private $internalFields; + private array $internalFields; /** @var \Ibexa\Core\Repository\Values\Content\Content */ - private $content; + private Content $content; protected function setUp(): void { diff --git a/tests/lib/Repository/Values/Content/LanguageTest.php b/tests/lib/Repository/Values/Content/LanguageTest.php index 10c32866bc..ebe2a3b825 100644 --- a/tests/lib/Repository/Values/Content/LanguageTest.php +++ b/tests/lib/Repository/Values/Content/LanguageTest.php @@ -23,7 +23,7 @@ class LanguageTest extends TestCase /** * Test default properties of just created class. */ - public function testNewClass() + public function testNewClass(): void { $language = new Language(); @@ -41,7 +41,7 @@ public function testNewClass() /** * Test retrieving missing property. */ - public function testMissingProperty() + public function testMissingProperty(): void { $this->expectException(PropertyNotFoundException::class); $this->expectExceptionMessage('Property \'notDefined\' not found on class'); @@ -54,7 +54,7 @@ public function testMissingProperty() /** * Test setting read only property. */ - public function testReadOnlyProperty() + public function testReadOnlyProperty(): void { $this->expectException(PropertyReadOnlyException::class); $this->expectExceptionMessage('Property \'id\' is readonly on class'); @@ -67,7 +67,7 @@ public function testReadOnlyProperty() /** * Test if property exists. */ - public function testIsPropertySet() + public function testIsPropertySet(): void { $language = new Language(); $value = isset($language->notDefined); @@ -80,7 +80,7 @@ public function testIsPropertySet() /** * Test unsetting a property. */ - public function testUnsetProperty() + public function testUnsetProperty(): void { $this->expectException(PropertyReadOnlyException::class); $this->expectExceptionMessage('Property \'id\' is readonly on class'); diff --git a/tests/lib/Repository/Values/Content/Query/Criterion/DateMetadataTest.php b/tests/lib/Repository/Values/Content/Query/Criterion/DateMetadataTest.php index ccf8f75215..97bb997a13 100644 --- a/tests/lib/Repository/Values/Content/Query/Criterion/DateMetadataTest.php +++ b/tests/lib/Repository/Values/Content/Query/Criterion/DateMetadataTest.php @@ -15,7 +15,7 @@ final class DateMetadataTest extends TestCase /** * @dataProvider provideValidConstructorArguments */ - public function testConstruction(string $target, string $operator, $value): void + public function testConstruction(string $target, string $operator, int $value): void { $criterion = new DateMetadata($target, $operator, $value); self::assertSame($target, $criterion->target); diff --git a/tests/lib/Repository/Values/Content/SectionTest.php b/tests/lib/Repository/Values/Content/SectionTest.php index c64f66e726..932831e8b5 100644 --- a/tests/lib/Repository/Values/Content/SectionTest.php +++ b/tests/lib/Repository/Values/Content/SectionTest.php @@ -22,7 +22,7 @@ class SectionTest extends TestCase * * @covers \Ibexa\Contracts\Core\Repository\Values\Content\Section::__construct */ - public function testNewClass() + public function testNewClass(): void { $section = new Section(); @@ -41,7 +41,7 @@ public function testNewClass() * * @covers \Ibexa\Contracts\Core\Repository\Values\Content\Section::__get */ - public function testMissingProperty() + public function testMissingProperty(): void { $this->expectException(PropertyNotFoundException::class); @@ -55,7 +55,7 @@ public function testMissingProperty() * * @covers \Ibexa\Contracts\Core\Repository\Values\Content\Section::__set */ - public function testReadOnlyProperty() + public function testReadOnlyProperty(): void { $this->expectException(PropertyReadOnlyException::class); @@ -69,7 +69,7 @@ public function testReadOnlyProperty() * * @covers \Ibexa\Contracts\Core\Repository\Values\Content\Section::__isset */ - public function testIsPropertySet() + public function testIsPropertySet(): void { $section = new Section(); $value = isset($section->notDefined); @@ -84,7 +84,7 @@ public function testIsPropertySet() * * @covers \Ibexa\Contracts\Core\Repository\Values\Content\Section::__unset */ - public function testUnsetProperty() + public function testUnsetProperty(): void { $this->expectException(PropertyReadOnlyException::class); diff --git a/tests/lib/Repository/Values/Content/TrashItemTest.php b/tests/lib/Repository/Values/Content/TrashItemTest.php index 41e3ca2f9c..8350a8ca8d 100644 --- a/tests/lib/Repository/Values/Content/TrashItemTest.php +++ b/tests/lib/Repository/Values/Content/TrashItemTest.php @@ -21,7 +21,7 @@ class TrashItemTest extends TestCase { use ValueObjectTestTrait; - public function testNewClass() + public function testNewClass(): void { // create ContentInfo to be able to retrieve the contentId property via magic method $contentInfo = new ContentInfo(); @@ -50,7 +50,7 @@ public function testNewClass() /** * Test retrieving missing property. */ - public function testMissingProperty() + public function testMissingProperty(): void { $this->expectException(PropertyNotFoundException::class); @@ -62,7 +62,7 @@ public function testMissingProperty() /** * Test setting read only property. */ - public function testReadOnlyProperty() + public function testReadOnlyProperty(): void { $this->expectException(PropertyReadOnlyException::class); @@ -74,7 +74,7 @@ public function testReadOnlyProperty() /** * Test if property exists. */ - public function testIsPropertySet() + public function testIsPropertySet(): void { $trashItem = new TrashItem(); $value = isset($trashItem->notDefined); @@ -89,7 +89,7 @@ public function testIsPropertySet() * * @covers \Ibexa\Core\Repository\Values\Content\TrashItem::__unset */ - public function testUnsetProperty() + public function testUnsetProperty(): void { $this->expectException(PropertyReadOnlyException::class); diff --git a/tests/lib/Repository/Values/ContentType/ContentTypeDraftTest.php b/tests/lib/Repository/Values/ContentType/ContentTypeDraftTest.php index afb8eb15b5..43393acef1 100644 --- a/tests/lib/Repository/Values/ContentType/ContentTypeDraftTest.php +++ b/tests/lib/Repository/Values/ContentType/ContentTypeDraftTest.php @@ -16,7 +16,7 @@ */ class ContentTypeDraftTest extends TestCase { - public function testObjectProperties() + public function testObjectProperties(): void { $object = new ContentTypeDraft( [ diff --git a/tests/lib/Repository/Values/MultiLanguageTestTrait.php b/tests/lib/Repository/Values/MultiLanguageTestTrait.php index 24495987c7..5451a17d59 100644 --- a/tests/lib/Repository/Values/MultiLanguageTestTrait.php +++ b/tests/lib/Repository/Values/MultiLanguageTestTrait.php @@ -23,7 +23,7 @@ trait MultiLanguageTestTrait * * @param \Ibexa\Contracts\Core\Repository\Values\MultiLanguageName $object tested ValueObject */ - public function testGetMultiLanguagePrioritizedName($object) + public function testGetMultiLanguagePrioritizedName($object): void { if (!$object instanceof MultiLanguageName) { self::markTestSkipped( @@ -42,7 +42,7 @@ public function testGetMultiLanguagePrioritizedName($object) * * @param \Ibexa\Contracts\Core\Repository\Values\MultiLanguageName $object tested ValueObject */ - public function testGetMultiLanguageDefaultName($object) + public function testGetMultiLanguageDefaultName($object): void { if (!$object instanceof MultiLanguageName) { self::markTestSkipped( @@ -72,7 +72,7 @@ public function testGetMultiLanguageDefaultName($object) * * @param \Ibexa\Contracts\Core\Repository\Values\MultiLanguageDescription $object tested ValueObject */ - public function testGetMultiLanguagePrioritizedDescription($object) + public function testGetMultiLanguagePrioritizedDescription($object): void { if (!$object instanceof MultiLanguageDescription) { self::markTestSkipped( @@ -91,7 +91,7 @@ public function testGetMultiLanguagePrioritizedDescription($object) * * @param \Ibexa\Contracts\Core\Repository\Values\MultiLanguageDescription $object tested ValueObject */ - public function testGetMultiLanguageDefaultDescription($object) + public function testGetMultiLanguageDefaultDescription($object): void { if (!$object instanceof MultiLanguageDescription) { self::markTestSkipped( diff --git a/tests/lib/Repository/Values/ObjectState/ObjectStateGroupTest.php b/tests/lib/Repository/Values/ObjectState/ObjectStateGroupTest.php index f9d0f70a2b..cc5e12406b 100644 --- a/tests/lib/Repository/Values/ObjectState/ObjectStateGroupTest.php +++ b/tests/lib/Repository/Values/ObjectState/ObjectStateGroupTest.php @@ -25,7 +25,7 @@ class ObjectStateGroupTest extends TestCase /** * Test a new class and default values on properties. */ - public function testNewClass() + public function testNewClass(): void { $objectStateGroup = new ObjectStateGroup(); @@ -47,7 +47,7 @@ public function testNewClass() * * @return \Ibexa\Core\Repository\Values\ObjectState\ObjectStateGroup */ - public function testNewClassWithMultiLanguageProperties() + public function testNewClassWithMultiLanguageProperties(): ObjectStateGroup { $properties = [ 'names' => [ @@ -77,7 +77,7 @@ public function testNewClassWithMultiLanguageProperties() * * @covers \Ibexa\Core\Repository\Values\ObjectState\ObjectStateGroup::__get */ - public function testMissingProperty() + public function testMissingProperty(): void { $this->expectException(PropertyNotFoundException::class); @@ -91,7 +91,7 @@ public function testMissingProperty() * * @covers \Ibexa\Core\Repository\Values\ObjectState\ObjectStateGroup::__set */ - public function testReadOnlyProperty() + public function testReadOnlyProperty(): void { $this->expectException(PropertyReadOnlyException::class); @@ -103,7 +103,7 @@ public function testReadOnlyProperty() /** * Test if property exists. */ - public function testIsPropertySet() + public function testIsPropertySet(): void { $objectStateGroup = new ObjectStateGroup(); $value = isset($objectStateGroup->notDefined); @@ -118,7 +118,7 @@ public function testIsPropertySet() * * @covers \Ibexa\Core\Repository\Values\ObjectState\ObjectStateGroup::__unset */ - public function testUnsetProperty() + public function testUnsetProperty(): void { $this->expectException(PropertyReadOnlyException::class); diff --git a/tests/lib/Repository/Values/ObjectState/ObjectStateTest.php b/tests/lib/Repository/Values/ObjectState/ObjectStateTest.php index e5e4cbb321..3706157cbf 100644 --- a/tests/lib/Repository/Values/ObjectState/ObjectStateTest.php +++ b/tests/lib/Repository/Values/ObjectState/ObjectStateTest.php @@ -25,7 +25,7 @@ class ObjectStateTest extends TestCase /** * Test a new class and default values on properties. */ - public function testNewClass() + public function testNewClass(): void { $objectState = new ObjectState(); @@ -48,7 +48,7 @@ public function testNewClass() * * @return \Ibexa\Core\Repository\Values\ObjectState\ObjectState */ - public function testNewClassWithMultiLanguageProperties() + public function testNewClassWithMultiLanguageProperties(): ObjectState { $properties = [ 'names' => [ @@ -79,7 +79,7 @@ public function testNewClassWithMultiLanguageProperties() * @covers \Ibexa\Core\Repository\Values\ObjectState\ObjectState::__get * @covers \Ibexa\Core\Repository\Values\ObjectState\ObjectStateGroup::__get */ - public function testMissingProperty() + public function testMissingProperty(): void { $this->expectException(PropertyNotFoundException::class); @@ -94,7 +94,7 @@ public function testMissingProperty() * @covers \Ibexa\Core\Repository\Values\ObjectState\ObjectState::__set * @covers \Ibexa\Core\Repository\Values\ObjectState\ObjectStateGroup::__set */ - public function testReadOnlyProperty() + public function testReadOnlyProperty(): void { $this->expectException(PropertyReadOnlyException::class); @@ -106,7 +106,7 @@ public function testReadOnlyProperty() /** * Test if property exists. */ - public function testIsPropertySet() + public function testIsPropertySet(): void { $objectState = new ObjectState(); $value = isset($objectState->notDefined); @@ -122,7 +122,7 @@ public function testIsPropertySet() * @covers \Ibexa\Core\Repository\Values\ObjectState\ObjectState::__unset * @covers \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup::__unset */ - public function testUnsetProperty() + public function testUnsetProperty(): void { $this->expectException(PropertyReadOnlyException::class); diff --git a/tests/lib/Repository/Values/User/PolicyTest.php b/tests/lib/Repository/Values/User/PolicyTest.php index 72245b8545..d6e2158ebf 100644 --- a/tests/lib/Repository/Values/User/PolicyTest.php +++ b/tests/lib/Repository/Values/User/PolicyTest.php @@ -22,7 +22,7 @@ class PolicyTest extends TestCase * * @covers \Ibexa\Core\Repository\Values\User\Policy::__construct */ - public function testNewClass() + public function testNewClass(): void { $this->assertPropertiesCorrect( [ @@ -41,7 +41,7 @@ public function testNewClass() * * @covers \Ibexa\Core\Repository\Values\User\Policy::__get */ - public function testMissingProperty() + public function testMissingProperty(): void { $this->expectException(PropertyNotFoundException::class); @@ -55,7 +55,7 @@ public function testMissingProperty() * * @covers \Ibexa\Core\Repository\Values\User\Policy::__set */ - public function testReadOnlyProperty() + public function testReadOnlyProperty(): void { $this->expectException(PropertyReadOnlyException::class); @@ -69,7 +69,7 @@ public function testReadOnlyProperty() * * @covers \Ibexa\Core\Repository\Values\User\Policy::__isset */ - public function testIsPropertySet() + public function testIsPropertySet(): void { $policy = new Policy(); $value = isset($policy->notDefined); @@ -84,7 +84,7 @@ public function testIsPropertySet() * * @covers \Ibexa\Core\Repository\Values\User\Policy::__unset */ - public function testUnsetProperty() + public function testUnsetProperty(): void { $this->expectException(PropertyReadOnlyException::class); diff --git a/tests/lib/Repository/Values/User/RoleTest.php b/tests/lib/Repository/Values/User/RoleTest.php index de08368001..3e4078ec31 100644 --- a/tests/lib/Repository/Values/User/RoleTest.php +++ b/tests/lib/Repository/Values/User/RoleTest.php @@ -23,7 +23,7 @@ class RoleTest extends TestCase /** * Test a new class and default values on properties. */ - public function testNewClass() + public function testNewClass(): void { $this->assertPropertiesCorrect( [ @@ -40,7 +40,7 @@ public function testNewClass() * * @covers \Ibexa\Core\Repository\Values\User\Role::__get */ - public function testMissingProperty() + public function testMissingProperty(): void { $this->expectException(PropertyNotFoundException::class); @@ -54,7 +54,7 @@ public function testMissingProperty() * * @covers \Ibexa\Core\Repository\Values\User\Role::__set */ - public function testReadOnlyProperty() + public function testReadOnlyProperty(): void { $this->expectException(PropertyReadOnlyException::class); @@ -66,7 +66,7 @@ public function testReadOnlyProperty() /** * Test if property exists. */ - public function testIsPropertySet() + public function testIsPropertySet(): void { $role = new Role(); $value = isset($role->notDefined); @@ -81,7 +81,7 @@ public function testIsPropertySet() * * @covers \Ibexa\Core\Repository\Values\User\Role::__unset */ - public function testUnsetProperty() + public function testUnsetProperty(): void { $this->expectException(PropertyReadOnlyException::class); diff --git a/tests/lib/Repository/Values/User/UserGroupTest.php b/tests/lib/Repository/Values/User/UserGroupTest.php index 8ff052cc6c..64dd0931cc 100644 --- a/tests/lib/Repository/Values/User/UserGroupTest.php +++ b/tests/lib/Repository/Values/User/UserGroupTest.php @@ -22,7 +22,7 @@ class UserGroupTest extends TestCase { use ValueObjectTestTrait; - public function testNewClass() + public function testNewClass(): void { $group = new UserGroup(); self::assertNull($group->parentId); @@ -38,7 +38,7 @@ public function testNewClass() /** * Test getName method. */ - public function testGetName() + public function testGetName(): void { $name = 'Translated name'; $contentMock = $this->createMock(Content::class); @@ -60,7 +60,7 @@ public function testGetName() /** * Test retrieving missing property. */ - public function testMissingProperty() + public function testMissingProperty(): void { $this->expectException(PropertyNotFoundException::class); @@ -69,7 +69,7 @@ public function testMissingProperty() self::fail('Succeeded getting non existing property'); } - public function testObjectProperties() + public function testObjectProperties(): void { $object = new UserGroup(); $properties = $object->attributes(); @@ -94,7 +94,7 @@ public function testObjectProperties() /** * Test setting read only property. */ - public function testReadOnlyProperty() + public function testReadOnlyProperty(): void { $this->expectException(PropertyReadOnlyException::class); @@ -106,7 +106,7 @@ public function testReadOnlyProperty() /** * Test if property exists. */ - public function testIsPropertySet() + public function testIsPropertySet(): void { $userGroup = new UserGroup(); $value = isset($userGroup->notDefined); @@ -119,7 +119,7 @@ public function testIsPropertySet() /** * Test unsetting a property. */ - public function testUnsetProperty() + public function testUnsetProperty(): void { $this->expectException(PropertyReadOnlyException::class); diff --git a/tests/lib/Repository/Values/ValueObjectTestTrait.php b/tests/lib/Repository/Values/ValueObjectTestTrait.php index 5334cd612a..7381f59060 100644 --- a/tests/lib/Repository/Values/ValueObjectTestTrait.php +++ b/tests/lib/Repository/Values/ValueObjectTestTrait.php @@ -18,7 +18,7 @@ trait ValueObjectTestTrait * @param mixed[] $expectedValues * @param \Ibexa\Contracts\Core\Repository\Values\ValueObject $actualValueObject */ - public function assertPropertiesCorrect(array $expectedValues, ValueObject $actualValueObject) + public function assertPropertiesCorrect(array $expectedValues, ValueObject $actualValueObject): void { foreach ($expectedValues as $propertyName => $propertyValue) { self::assertSame( diff --git a/tests/lib/Search/Common/EventSubscriber/TrashEventSubscriberTest.php b/tests/lib/Search/Common/EventSubscriber/TrashEventSubscriberTest.php index 4fb72112c8..349d3d3f9a 100644 --- a/tests/lib/Search/Common/EventSubscriber/TrashEventSubscriberTest.php +++ b/tests/lib/Search/Common/EventSubscriber/TrashEventSubscriberTest.php @@ -16,18 +16,19 @@ use Ibexa\Contracts\Core\Search\Handler as SearchHandler; use Ibexa\Core\Repository\Values\Content\TrashItem; use Ibexa\Core\Search\Common\EventSubscriber\TrashEventSubscriber; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; final class TrashEventSubscriberTest extends TestCase { /** @var \Ibexa\Contracts\Core\Search\Handler&\PHPUnit\Framework\MockObject\MockObject */ - private $searchHandler; + private MockObject $searchHandler; /** @var \Ibexa\Contracts\Core\Persistence\Handler&\PHPUnit\Framework\MockObject\MockObject */ - private $persistenceHandler; + private MockObject $persistenceHandler; /** @var \Ibexa\Core\Search\Common\EventSubscriber\TrashEventSubscriber */ - private $subscriber; + private TrashEventSubscriber $subscriber; protected function setUp(): void { diff --git a/tests/lib/Search/Common/FieldValueMapper/AggregateTest.php b/tests/lib/Search/Common/FieldValueMapper/AggregateTest.php index ee34111799..a4e30fa9b8 100644 --- a/tests/lib/Search/Common/FieldValueMapper/AggregateTest.php +++ b/tests/lib/Search/Common/FieldValueMapper/AggregateTest.php @@ -24,7 +24,7 @@ final class AggregateTest extends TestCase private const MAPPED_VALUE = true; /** @var \Ibexa\Core\Search\Common\FieldValueMapper\Aggregate */ - private $aggregateMapper; + private Aggregate $aggregateMapper; public function setUp(): void { diff --git a/tests/lib/Search/Common/FieldValueMapper/RemoteIdentifierMapperTest.php b/tests/lib/Search/Common/FieldValueMapper/RemoteIdentifierMapperTest.php index 16812d8a77..12b6c7ab0d 100644 --- a/tests/lib/Search/Common/FieldValueMapper/RemoteIdentifierMapperTest.php +++ b/tests/lib/Search/Common/FieldValueMapper/RemoteIdentifierMapperTest.php @@ -22,7 +22,7 @@ final class RemoteIdentifierMapperTest extends TestCase { /** @var \Ibexa\Core\Search\Common\FieldValueMapper\RemoteIdentifierMapper */ - private $mapper; + private RemoteIdentifierMapper $mapper; protected function setUp(): void { diff --git a/tests/lib/Search/Common/LocationEventSubscriber/LocationEventSubscriberTest.php b/tests/lib/Search/Common/LocationEventSubscriber/LocationEventSubscriberTest.php index d4672d30a2..74f2ceb39c 100644 --- a/tests/lib/Search/Common/LocationEventSubscriber/LocationEventSubscriberTest.php +++ b/tests/lib/Search/Common/LocationEventSubscriber/LocationEventSubscriberTest.php @@ -21,6 +21,7 @@ use Ibexa\Core\Repository\Values\Content\Location; use Ibexa\Core\Search\Common\EventSubscriber\LocationEventSubscriber; use Ibexa\Core\Search\Legacy\Content\Handler as SearchHandler; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; final class LocationEventSubscriberTest extends TestCase @@ -30,13 +31,13 @@ final class LocationEventSubscriberTest extends TestCase private const EXAMPLE_VERSION_NO = 3; /** @var \Ibexa\Core\Search\Legacy\Content\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $searchHandler; + private MockObject $searchHandler; /** @var \Ibexa\Contracts\Core\Persistence\Handler|\PHPUnit\Framework\MockObject\MockObject */ - private $persistenceHandler; + private MockObject $persistenceHandler; /** @var \Ibexa\Core\Search\Common\EventSubscriber\LocationEventSubscriber */ - private $subscriber; + private LocationEventSubscriber $subscriber; protected function setUp(): void { diff --git a/tests/lib/Search/FieldNameResolverTest.php b/tests/lib/Search/FieldNameResolverTest.php index 04482068d6..43c0456f69 100644 --- a/tests/lib/Search/FieldNameResolverTest.php +++ b/tests/lib/Search/FieldNameResolverTest.php @@ -17,13 +17,14 @@ use Ibexa\Core\Search\Common\FieldNameGenerator; use Ibexa\Core\Search\Common\FieldNameResolver; use Ibexa\Core\Search\Common\FieldRegistry; +use PHPUnit\Framework\MockObject\MockObject; /** * @covers \Ibexa\Core\Search\Common\FieldNameResolver */ class FieldNameResolverTest extends TestCase { - public function testGetFieldNamesReturnsEmptyArray() + public function testGetFieldNamesReturnsEmptyArray(): void { $mockedFieldNameResolver = $this->getMockedFieldNameResolver(['getSearchableFieldMap', 'getIndexFieldName']); $criterionMock = $this->getCriterionMock(); @@ -61,7 +62,7 @@ public function testGetFieldNamesReturnsEmptyArray() self::assertEmpty($fieldNames); } - public function testGetFieldNames() + public function testGetFieldNames(): void { $mockedFieldNameResolver = $this->getMockedFieldNameResolver(['getSearchableFieldMap', 'getIndexFieldName']); $criterionMock = $this->getCriterionMock(); @@ -135,7 +136,7 @@ public function testGetFieldNames() ); } - public function testGetFieldNamesWithNamedField() + public function testGetFieldNamesWithNamedField(): void { $mockedFieldNameResolver = $this->getMockedFieldNameResolver(['getSearchableFieldMap', 'getIndexFieldName']); $criterionMock = $this->getCriterionMock(); @@ -211,7 +212,7 @@ public function testGetFieldNamesWithNamedField() ); } - public function testGetFieldNamesWithTypedField() + public function testGetFieldNamesWithTypedField(): void { $mockedFieldNameResolver = $this->getMockedFieldNameResolver(['getSearchableFieldMap', 'getIndexFieldName']); $criterionMock = $this->getCriterionMock(); @@ -272,7 +273,7 @@ public function testGetFieldNamesWithTypedField() ); } - public function testGetFieldNamesWithTypedAndNamedField() + public function testGetFieldNamesWithTypedAndNamedField(): void { $mockedFieldNameResolver = $this->getMockedFieldNameResolver(['getSearchableFieldMap', 'getIndexFieldName']); $criterionMock = $this->getCriterionMock(); @@ -333,7 +334,7 @@ public function testGetFieldNamesWithTypedAndNamedField() ); } - public function testGetSortFieldName() + public function testGetSortFieldName(): void { $mockedFieldNameResolver = $this->getMockedFieldNameResolver(['getSearchableFieldMap', 'getIndexFieldName']); $sortClauseMock = $this->getSortClauseMock(); @@ -378,7 +379,7 @@ public function testGetSortFieldName() self::assertEquals('index_field_name', $fieldName); } - public function testGetSortFieldNameReturnsNull() + public function testGetSortFieldNameReturnsNull(): void { $mockedFieldNameResolver = $this->getMockedFieldNameResolver(['getSearchableFieldMap', 'getIndexFieldName']); $sortClauseMock = $this->getSortClauseMock(); @@ -409,7 +410,7 @@ public function testGetSortFieldNameReturnsNull() self::assertNull($fieldName); } - public function testGetIndexFieldNameCustomField() + public function testGetIndexFieldNameCustomField(): void { $mockedFieldNameResolver = $this->getMockedFieldNameResolver(['getSearchableFieldMap']); @@ -437,7 +438,7 @@ public function testGetIndexFieldNameCustomField() self::assertEquals('custom_field_name', key($customFieldName)); } - public function testGetIndexFieldNameNamedField() + public function testGetIndexFieldNameNamedField(): void { $mockedFieldNameResolver = $this->getMockedFieldNameResolver(['getSearchableFieldMap']); $indexFieldType = $this->getIndexFieldTypeMock(); @@ -499,7 +500,7 @@ public function testGetIndexFieldNameNamedField() self::assertEquals('generated_typed_field_name', key($fieldName)); } - public function testGetIndexFieldNameDefaultMatchField() + public function testGetIndexFieldNameDefaultMatchField(): void { $mockedFieldNameResolver = $this->getMockedFieldNameResolver(['getSearchableFieldMap']); $indexFieldType = $this->getIndexFieldTypeMock(); @@ -566,7 +567,7 @@ public function testGetIndexFieldNameDefaultMatchField() self::assertEquals('generated_typed_field_name', key($fieldName)); } - public function testGetIndexFieldNameDefaultSortField() + public function testGetIndexFieldNameDefaultSortField(): void { $mockedFieldNameResolver = $this->getMockedFieldNameResolver(['getSearchableFieldMap']); $indexFieldType = $this->getIndexFieldTypeMock(); @@ -633,7 +634,7 @@ public function testGetIndexFieldNameDefaultSortField() self::assertEquals('generated_typed_field_name', key($fieldName)); } - public function testGetIndexFieldNameDefaultMatchFieldThrowsRuntimeException() + public function testGetIndexFieldNameDefaultMatchFieldThrowsRuntimeException(): void { $this->expectException(\RuntimeException::class); @@ -677,7 +678,7 @@ public function testGetIndexFieldNameDefaultMatchFieldThrowsRuntimeException() ); } - public function testGetIndexFieldNameDefaultSortFieldThrowsRuntimeException() + public function testGetIndexFieldNameDefaultSortFieldThrowsRuntimeException(): void { $this->expectException(\RuntimeException::class); @@ -721,7 +722,7 @@ public function testGetIndexFieldNameDefaultSortFieldThrowsRuntimeException() ); } - public function testGetIndexFieldNameNamedFieldThrowsRuntimeException() + public function testGetIndexFieldNameNamedFieldThrowsRuntimeException(): void { $this->expectException(\RuntimeException::class); @@ -767,7 +768,7 @@ public function testGetIndexFieldNameNamedFieldThrowsRuntimeException() * * @return \Ibexa\Core\Search\Common\FieldNameResolver|\PHPUnit\Framework\MockObject\MockObject */ - protected function getMockedFieldNameResolver(array $methods = []) + protected function getMockedFieldNameResolver(array $methods = []): MockObject { $fieldNameResolver = $this ->getMockBuilder(FieldNameResolver::class) @@ -785,7 +786,7 @@ protected function getMockedFieldNameResolver(array $methods = []) } /** @var \Ibexa\Core\Search\Common\FieldRegistry|\PHPUnit\Framework\MockObject\MockObject */ - protected $fieldRegistryMock; + protected ?MockObject $fieldRegistryMock = null; /** * @return \Ibexa\Core\Search\Common\FieldRegistry|\PHPUnit\Framework\MockObject\MockObject @@ -802,7 +803,7 @@ protected function getFieldRegistryMock() /** * @return \Ibexa\Contracts\Core\FieldType\Indexable|\PHPUnit\Framework\MockObject\MockObject */ - protected function getIndexFieldTypeMock() + protected function getIndexFieldTypeMock(): MockObject { return $this->createMock(Indexable::class); } @@ -810,13 +811,13 @@ protected function getIndexFieldTypeMock() /** * @return \Ibexa\Contracts\Core\Search\FieldType|\PHPUnit\Framework\MockObject\MockObject */ - protected function getSearchFieldTypeMock() + protected function getSearchFieldTypeMock(): MockObject { return $this->createMock(SPIFieldType::class); } /** @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler|\PHPUnit\Framework\MockObject\MockObject */ - protected $contentTypeHandlerMock; + protected ?MockObject $contentTypeHandlerMock = null; /** * @return \Ibexa\Contracts\Core\Persistence\Content\Type\Handler|\PHPUnit\Framework\MockObject\MockObject @@ -831,7 +832,7 @@ protected function getContentTypeHandlerMock() } /** @var \Ibexa\Core\Search\Common\FieldNameGenerator|\PHPUnit\Framework\MockObject\MockObject */ - protected $fieldNameGeneratorMock; + protected ?MockObject $fieldNameGeneratorMock = null; /** * @return \Ibexa\Core\Search\Common\FieldNameGenerator|\PHPUnit\Framework\MockObject\MockObject @@ -848,7 +849,7 @@ protected function getFieldNameGeneratorMock() /** * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion|\PHPUnit\Framework\MockObject\MockObject */ - protected function getCriterionMock() + protected function getCriterionMock(): MockObject { return $this->createMock(APICriterion::class); } @@ -856,7 +857,7 @@ protected function getCriterionMock() /** * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause|\PHPUnit\Framework\MockObject\MockObject */ - protected function getSortClauseMock() + protected function getSortClauseMock(): MockObject { return $this->createMock(APISortClause::class); } diff --git a/tests/lib/Search/Legacy/Content/AbstractTestCase.php b/tests/lib/Search/Legacy/Content/AbstractTestCase.php index a53b70569a..9baa54db48 100644 --- a/tests/lib/Search/Legacy/Content/AbstractTestCase.php +++ b/tests/lib/Search/Legacy/Content/AbstractTestCase.php @@ -14,6 +14,7 @@ use Ibexa\Core\Persistence\Legacy\Content\Mapper\ResolveVirtualFieldSubscriber; use Ibexa\Core\Persistence\Legacy\Content\StorageRegistry; use Ibexa\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase as ContentTypeGateway; +use Ibexa\Core\Persistence\Legacy\Content\Type\Handler; use Ibexa\Core\Persistence\Legacy\Content\Type\Handler as ContentTypeHandler; use Ibexa\Core\Persistence\Legacy\Content\Type\Mapper as ContentTypeMapper; use Ibexa\Core\Persistence\Legacy\Content\Type\StorageDispatcherInterface; @@ -28,17 +29,14 @@ class AbstractTestCase extends LanguageAwareTestCase { /** @var bool */ - private static $databaseInitialized = false; + private static bool $databaseInitialized = false; /** * Field registry mock. - * - * @var \Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry */ - private $converterRegistry; + private ?ConverterRegistry $converterRegistry = null; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Type\Handler */ - private $contentTypeHandler; + private ?Handler $contentTypeHandler = null; /** * Only set up once for these read only tests on a large fixture. @@ -65,7 +63,10 @@ protected function assertSearchResults($expectedIds, $searchResult) self::assertEquals($expectedIds, $ids); } - protected function getIds($searchResult) + /** + * @return mixed[] + */ + protected function getIds($searchResult): array { $ids = array_map( static function ($hit) { diff --git a/tests/lib/Search/Legacy/Content/HandlerContentSortTest.php b/tests/lib/Search/Legacy/Content/HandlerContentSortTest.php index 75c42f537f..b909796a18 100644 --- a/tests/lib/Search/Legacy/Content/HandlerContentSortTest.php +++ b/tests/lib/Search/Legacy/Content/HandlerContentSortTest.php @@ -16,7 +16,9 @@ use Ibexa\Core\Persistence\Legacy\Content\Location\Mapper as LocationMapper; use Ibexa\Core\Persistence\Legacy\Content\Mapper as ContentMapper; use Ibexa\Core\Search\Legacy\Content; +use Ibexa\Core\Search\Legacy\Content\Handler; use Ibexa\Core\Search\Legacy\Content\Location\Gateway as LocationGateway; +use PHPUnit\Framework\MockObject\MockObject; /** * Content Search test case for ContentSearchHandler. @@ -28,7 +30,7 @@ class HandlerContentSortTest extends AbstractTestCase * * @var \Ibexa\Core\Persistence\Legacy\Content\FieldValue\ConverterRegistry */ - protected $fieldRegistry; + protected ?MockObject $fieldRegistry = null; /** * Returns the content search handler to test. @@ -40,11 +42,11 @@ class HandlerContentSortTest extends AbstractTestCase * * @return \Ibexa\Core\Search\Legacy\Content\Handler */ - protected function getContentSearchHandler(array $fullTextSearchConfiguration = []) + protected function getContentSearchHandler(array $fullTextSearchConfiguration = []): Handler { $connection = $this->getDatabaseConnection(); - return new Content\Handler( + return new Handler( new Content\Gateway\DoctrineDatabase( $connection, new Content\Common\Gateway\CriteriaConverter( @@ -95,7 +97,7 @@ protected function getContentSearchHandler(array $fullTextSearchConfiguration = * * @return \Ibexa\Core\Persistence\Legacy\Content\Mapper */ - protected function getContentMapperMock() + protected function getContentMapperMock(): MockObject { $mapperMock = $this->getMockBuilder(ContentMapper::class) ->setConstructorArgs( @@ -153,7 +155,7 @@ protected function getFieldRegistry() * * @return \Ibexa\Core\Persistence\Legacy\Content\FieldHandler */ - protected function getContentFieldHandlerMock() + protected function getContentFieldHandlerMock(): MockObject { return $this->getMockBuilder(FieldHandler::class) ->disableOriginalConstructor() @@ -161,7 +163,7 @@ protected function getContentFieldHandlerMock() ->getMock(); } - public function testNoSorting() + public function testNoSorting(): void { $locator = $this->getContentSearchHandler(); @@ -188,7 +190,7 @@ static function ($hit) { ); } - public function testSortDateModified() + public function testSortDateModified(): void { $locator = $this->getContentSearchHandler(); @@ -216,7 +218,7 @@ static function ($hit) { ); } - public function testSortDatePublished() + public function testSortDatePublished(): void { $locator = $this->getContentSearchHandler(); @@ -244,7 +246,7 @@ static function ($hit) { ); } - public function testSortSectionIdentifier() + public function testSortSectionIdentifier(): void { $locator = $this->getContentSearchHandler(); @@ -289,7 +291,7 @@ static function ($hit) { } } - public function testSortSectionName() + public function testSortSectionName(): void { $locator = $this->getContentSearchHandler(); @@ -342,7 +344,7 @@ static function ($hit) { } } - public function testSortContentName() + public function testSortContentName(): void { $locator = $this->getContentSearchHandler(); @@ -370,7 +372,7 @@ static function ($hit) { ); } - public function testSortFieldText() + public function testSortFieldText(): void { $locator = $this->getContentSearchHandler(); @@ -439,7 +441,7 @@ static function ($hit) { } } - public function testSortFieldNumeric() + public function testSortFieldNumeric(): void { $locator = $this->getContentSearchHandler(); diff --git a/tests/lib/Search/Legacy/Content/HandlerContentTest.php b/tests/lib/Search/Legacy/Content/HandlerContentTest.php index 26befbcdcf..c2331e63f7 100644 --- a/tests/lib/Search/Legacy/Content/HandlerContentTest.php +++ b/tests/lib/Search/Legacy/Content/HandlerContentTest.php @@ -19,7 +19,9 @@ use Ibexa\Core\Persistence\Legacy\Content\Location\Mapper as LocationMapper; use Ibexa\Core\Persistence\Legacy\Content\Mapper as ContentMapper; use Ibexa\Core\Search\Legacy\Content; +use Ibexa\Core\Search\Legacy\Content\Handler; use Ibexa\Core\Search\Legacy\Content\Location\Gateway as LocationGateway; +use PHPUnit\Framework\MockObject\MockObject; /** * Content Search test case for ContentSearchHandler. @@ -36,7 +38,7 @@ class HandlerContentTest extends AbstractTestCase * * @return \Ibexa\Core\Search\Legacy\Content\Handler */ - protected function getContentSearchHandler(array $fullTextSearchConfiguration = []) + protected function getContentSearchHandler(array $fullTextSearchConfiguration = []): Handler { $transformationProcessor = new Persistence\TransformationProcessor\DefinitionBased( new Persistence\TransformationProcessor\DefinitionBased\Parser(), @@ -65,7 +67,7 @@ protected function getContentSearchHandler(array $fullTextSearchConfiguration = $transformationProcessor ); - return new Content\Handler( + return new Handler( new Content\Gateway\DoctrineDatabase( $connection, new Content\Common\Gateway\CriteriaConverter( @@ -194,7 +196,7 @@ protected function getContentSearchHandler(array $fullTextSearchConfiguration = * * @return \Ibexa\Core\Persistence\Legacy\Content\Mapper */ - protected function getContentMapperMock() + protected function getContentMapperMock(): MockObject { $mapperMock = $this->getMockBuilder(ContentMapper::class) ->setConstructorArgs( @@ -235,7 +237,7 @@ static function ($rows): array { * * @return \Ibexa\Core\Persistence\Legacy\Content\FieldHandler */ - protected function getContentFieldHandlerMock() + protected function getContentFieldHandlerMock(): MockObject { return $this->getMockBuilder(FieldHandler::class) ->disableOriginalConstructor() @@ -246,7 +248,7 @@ protected function getContentFieldHandlerMock() /** * Bug #80. */ - public function testFindWithoutOffsetLimit() + public function testFindWithoutOffsetLimit(): void { $locator = $this->getContentSearchHandler(); @@ -267,7 +269,7 @@ public function testFindWithoutOffsetLimit() /** * Bug #81, bug #82. */ - public function testFindWithZeroLimit() + public function testFindWithZeroLimit(): void { $locator = $this->getContentSearchHandler(); @@ -294,7 +296,7 @@ public function testFindWithZeroLimit() /** * Issue with PHP_MAX_INT limit overflow in databases. */ - public function testFindWithNullLimit() + public function testFindWithNullLimit(): void { $locator = $this->getContentSearchHandler(); @@ -321,7 +323,7 @@ public function testFindWithNullLimit() /** * Issue with offsetting to the nonexistent results produces \ezcQueryInvalidParameterException exception. */ - public function testFindWithOffsetToNonexistent() + public function testFindWithOffsetToNonexistent(): void { $locator = $this->getContentSearchHandler(); @@ -345,7 +347,7 @@ public function testFindWithOffsetToNonexistent() ); } - public function testFindSingle() + public function testFindSingle(): void { $locator = $this->getContentSearchHandler(); @@ -354,7 +356,7 @@ public function testFindSingle() self::assertEquals(10, $contentInfo->id); } - public function testFindSingleWithNonSearchableField() + public function testFindSingleWithNonSearchableField(): void { $this->expectException(InvalidArgumentException::class); @@ -368,7 +370,7 @@ public function testFindSingleWithNonSearchableField() ); } - public function testFindContentWithNonSearchableField() + public function testFindContentWithNonSearchableField(): void { $this->expectException(InvalidArgumentException::class); @@ -387,7 +389,7 @@ public function testFindContentWithNonSearchableField() ); } - public function testFindSingleTooMany() + public function testFindSingleTooMany(): void { $this->expectException(InvalidArgumentException::class); @@ -395,7 +397,7 @@ public function testFindSingleTooMany() $locator->findSingle(new Criterion\ContentId([4, 10, 12, 23])); } - public function testFindSingleZero() + public function testFindSingleZero(): void { $this->expectException(NotFoundException::class); @@ -403,7 +405,7 @@ public function testFindSingleZero() $locator->findSingle(new Criterion\ContentId(0)); } - public function testContentIdFilter() + public function testContentIdFilter(): void { $this->assertSearchResults( [4, 10], @@ -420,7 +422,7 @@ public function testContentIdFilter() ); } - public function testContentIdFilterCount() + public function testContentIdFilterCount(): void { $locator = $this->getContentSearchHandler(); @@ -438,7 +440,7 @@ public function testContentIdFilterCount() self::assertSame(2, $result->totalCount); } - public function testContentAndCombinatorFilter() + public function testContentAndCombinatorFilter(): void { $this->assertSearchResults( [4], @@ -462,7 +464,7 @@ public function testContentAndCombinatorFilter() ); } - public function testContentOrCombinatorFilter() + public function testContentOrCombinatorFilter(): void { $locator = $this->getContentSearchHandler(); @@ -498,7 +500,7 @@ public function testContentOrCombinatorFilter() } } - public function testContentNotCombinatorFilter() + public function testContentNotCombinatorFilter(): void { $this->assertSearchResults( [4], @@ -524,7 +526,7 @@ public function testContentNotCombinatorFilter() ); } - public function testContentSubtreeFilterIn() + public function testContentSubtreeFilterIn(): void { $this->assertSearchResults( [67, 68, 69, 70, 71, 72, 73, 74], @@ -541,7 +543,7 @@ public function testContentSubtreeFilterIn() ); } - public function testContentSubtreeFilterEq() + public function testContentSubtreeFilterEq(): void { $this->assertSearchResults( [67, 68, 69, 70, 71, 72, 73, 74], @@ -556,7 +558,7 @@ public function testContentSubtreeFilterEq() ); } - public function testContentTypeIdFilter() + public function testContentTypeIdFilter(): void { $this->assertSearchResults( [10, 14, 226], @@ -571,7 +573,7 @@ public function testContentTypeIdFilter() ); } - public function testContentTypeIdentifierFilter() + public function testContentTypeIdentifierFilter(): void { $this->assertSearchResults( [41, 45, 49, 50, 51], @@ -587,7 +589,7 @@ public function testContentTypeIdentifierFilter() ); } - public function testContentTypeGroupFilter() + public function testContentTypeGroupFilter(): void { $this->assertSearchResults( [4, 10, 11, 12, 13, 14, 42, 225, 226], @@ -602,7 +604,7 @@ public function testContentTypeGroupFilter() ); } - public function testDateMetadataFilterModifiedGreater() + public function testDateMetadataFilterModifiedGreater(): void { $this->assertSearchResults( [11, 225, 226], @@ -621,7 +623,7 @@ public function testDateMetadataFilterModifiedGreater() ); } - public function testDateMetadataFilterModifiedGreaterOrEqual() + public function testDateMetadataFilterModifiedGreaterOrEqual(): void { $this->assertSearchResults( [11, 14, 225, 226], @@ -640,7 +642,7 @@ public function testDateMetadataFilterModifiedGreaterOrEqual() ); } - public function testDateMetadataFilterModifiedIn() + public function testDateMetadataFilterModifiedIn(): void { $this->assertSearchResults( [11, 14, 225, 226], @@ -659,7 +661,7 @@ public function testDateMetadataFilterModifiedIn() ); } - public function testDateMetadataFilterModifiedBetween() + public function testDateMetadataFilterModifiedBetween(): void { $this->assertSearchResults( [11, 14, 225, 226], @@ -678,7 +680,7 @@ public function testDateMetadataFilterModifiedBetween() ); } - public function testDateMetadataFilterCreatedBetween() + public function testDateMetadataFilterCreatedBetween(): void { $this->assertSearchResults( [66, 131, 225], @@ -697,7 +699,7 @@ public function testDateMetadataFilterCreatedBetween() ); } - public function testLocationIdFilter() + public function testLocationIdFilter(): void { $this->assertSearchResults( [4, 65], @@ -712,7 +714,7 @@ public function testLocationIdFilter() ); } - public function testParentLocationIdFilter() + public function testParentLocationIdFilter(): void { $this->assertSearchResults( [4, 41, 45, 56, 65], @@ -727,7 +729,7 @@ public function testParentLocationIdFilter() ); } - public function testRemoteIdFilter() + public function testRemoteIdFilter(): void { $this->assertSearchResults( [4, 10], @@ -744,7 +746,7 @@ public function testRemoteIdFilter() ); } - public function testLocationRemoteIdFilter() + public function testLocationRemoteIdFilter(): void { $this->assertSearchResults( [4, 65], @@ -761,7 +763,7 @@ public function testLocationRemoteIdFilter() ); } - public function testSectionFilter() + public function testSectionFilter(): void { $this->assertSearchResults( [4, 10, 11, 12, 13, 14, 42, 226], @@ -776,7 +778,7 @@ public function testSectionFilter() ); } - public function testStatusFilter() + public function testStatusFilter(): void { $this->assertSearchResults( [4, 10, 11, 12, 13, 14, 41, 42, 45, 49], @@ -802,7 +804,7 @@ public function testStatusFilter() ); } - public function testFieldFilter() + public function testFieldFilter(): void { $this->assertSearchResults( [11], @@ -821,7 +823,7 @@ public function testFieldFilter() ); } - public function testFieldFilterIn() + public function testFieldFilterIn(): void { $this->assertSearchResults( [11, 42], @@ -840,7 +842,7 @@ public function testFieldFilterIn() ); } - public function testFieldFilterContainsPartial() + public function testFieldFilterContainsPartial(): void { $this->assertSearchResults( [42], @@ -859,7 +861,7 @@ public function testFieldFilterContainsPartial() ); } - public function testFieldFilterContainsSimple() + public function testFieldFilterContainsSimple(): void { $this->assertSearchResults( [77], @@ -878,7 +880,7 @@ public function testFieldFilterContainsSimple() ); } - public function testFieldFilterContainsSimpleNoMatch() + public function testFieldFilterContainsSimpleNoMatch(): void { $this->assertSearchResults( [], @@ -897,7 +899,7 @@ public function testFieldFilterContainsSimpleNoMatch() ); } - public function testFieldFilterBetween() + public function testFieldFilterBetween(): void { $this->assertSearchResults( [186, 187], @@ -916,7 +918,7 @@ public function testFieldFilterBetween() ); } - public function testFieldFilterOr() + public function testFieldFilterOr(): void { $this->assertSearchResults( [11, 186, 187], @@ -944,7 +946,7 @@ public function testFieldFilterOr() ); } - public function testFullTextFilter() + public function testFullTextFilter(): void { $this->assertSearchResults( [191], @@ -959,7 +961,7 @@ public function testFullTextFilter() ); } - public function testFullTextWildcardFilter() + public function testFullTextWildcardFilter(): void { $this->assertSearchResults( [191], @@ -974,7 +976,7 @@ public function testFullTextWildcardFilter() ); } - public function testFullTextDisabledWildcardFilter() + public function testFullTextDisabledWildcardFilter(): void { $this->assertSearchResults( [], @@ -991,7 +993,7 @@ public function testFullTextDisabledWildcardFilter() ); } - public function testFullTextFilterStopwordRemoval() + public function testFullTextFilterStopwordRemoval(): void { $handler = $this->getContentSearchHandler( [ @@ -1012,7 +1014,7 @@ public function testFullTextFilterStopwordRemoval() ); } - public function testFullTextFilterNoStopwordRemoval() + public function testFullTextFilterNoStopwordRemoval(): void { $handler = $this->getContentSearchHandler( [ @@ -1042,7 +1044,7 @@ static function ($hit) { ); } - public function testFullTextFilterInvalidStopwordThreshold() + public function testFullTextFilterInvalidStopwordThreshold(): void { $this->expectException(InvalidArgumentException::class); @@ -1053,7 +1055,7 @@ public function testFullTextFilterInvalidStopwordThreshold() ); } - public function testObjectStateIdFilter() + public function testObjectStateIdFilter(): void { $this->assertSearchResults( [4, 10, 11, 12, 13, 14, 41, 42, 45, 49], @@ -1069,7 +1071,7 @@ public function testObjectStateIdFilter() ); } - public function testObjectStateIdFilterIn() + public function testObjectStateIdFilterIn(): void { $this->assertSearchResults( [4, 10, 11, 12, 13, 14, 41, 42, 45, 49], @@ -1085,7 +1087,7 @@ public function testObjectStateIdFilterIn() ); } - public function testLanguageCodeFilter() + public function testLanguageCodeFilter(): void { $this->assertSearchResults( [4, 10, 11, 12, 13, 14, 41, 42, 45, 49], @@ -1101,7 +1103,7 @@ public function testLanguageCodeFilter() ); } - public function testLanguageCodeFilterIn() + public function testLanguageCodeFilterIn(): void { $this->assertSearchResults( [4, 10, 11, 12, 13, 14, 41, 42, 45, 49], @@ -1117,7 +1119,7 @@ public function testLanguageCodeFilterIn() ); } - public function testLanguageCodeFilterWithAlwaysAvailable() + public function testLanguageCodeFilterWithAlwaysAvailable(): void { $this->assertSearchResults( [4, 10, 11, 12, 13, 14, 41, 42, 45, 49, 50, 51, 56, 57, 65, 68, 70, 74, 76, 80], @@ -1133,7 +1135,7 @@ public function testLanguageCodeFilterWithAlwaysAvailable() ); } - public function testVisibilityFilter() + public function testVisibilityFilter(): void { $this->assertSearchResults( [4, 10, 11, 12, 13, 14, 41, 42, 45, 49], @@ -1151,7 +1153,7 @@ public function testVisibilityFilter() ); } - public function testUserMetadataFilterOwnerWrongUserId() + public function testUserMetadataFilterOwnerWrongUserId(): void { $this->assertSearchResults( [], @@ -1169,7 +1171,7 @@ public function testUserMetadataFilterOwnerWrongUserId() ); } - public function testUserMetadataFilterOwnerAdministrator() + public function testUserMetadataFilterOwnerAdministrator(): void { $this->assertSearchResults( [4, 10, 11, 12, 13, 14, 41, 42, 45, 49], @@ -1189,7 +1191,7 @@ public function testUserMetadataFilterOwnerAdministrator() ); } - public function testUserMetadataFilterOwnerEqAMember() + public function testUserMetadataFilterOwnerEqAMember(): void { $this->assertSearchResults( [223], @@ -1207,7 +1209,7 @@ public function testUserMetadataFilterOwnerEqAMember() ); } - public function testUserMetadataFilterOwnerInAMember() + public function testUserMetadataFilterOwnerInAMember(): void { $this->assertSearchResults( [223], @@ -1225,7 +1227,7 @@ public function testUserMetadataFilterOwnerInAMember() ); } - public function testUserMetadataFilterCreatorEqAMember() + public function testUserMetadataFilterCreatorEqAMember(): void { $this->assertSearchResults( [223], @@ -1243,7 +1245,7 @@ public function testUserMetadataFilterCreatorEqAMember() ); } - public function testUserMetadataFilterCreatorInAMember() + public function testUserMetadataFilterCreatorInAMember(): void { $this->assertSearchResults( [223], @@ -1261,7 +1263,7 @@ public function testUserMetadataFilterCreatorInAMember() ); } - public function testUserMetadataFilterEqGroupMember() + public function testUserMetadataFilterEqGroupMember(): void { $this->assertSearchResults( [223], @@ -1279,7 +1281,7 @@ public function testUserMetadataFilterEqGroupMember() ); } - public function testUserMetadataFilterInGroupMember() + public function testUserMetadataFilterInGroupMember(): void { $this->assertSearchResults( [223], @@ -1297,7 +1299,7 @@ public function testUserMetadataFilterInGroupMember() ); } - public function testUserMetadataFilterEqGroupMemberNoMatch() + public function testUserMetadataFilterEqGroupMemberNoMatch(): void { $this->assertSearchResults( [], @@ -1315,7 +1317,7 @@ public function testUserMetadataFilterEqGroupMemberNoMatch() ); } - public function testUserMetadataFilterInGroupMemberNoMatch() + public function testUserMetadataFilterInGroupMemberNoMatch(): void { $this->assertSearchResults( [], @@ -1333,7 +1335,7 @@ public function testUserMetadataFilterInGroupMemberNoMatch() ); } - public function testFieldRelationFilterContainsSingle() + public function testFieldRelationFilterContainsSingle(): void { $this->assertSearchResults( [67], @@ -1351,7 +1353,7 @@ public function testFieldRelationFilterContainsSingle() ); } - public function testFieldRelationFilterContainsSingleNoMatch() + public function testFieldRelationFilterContainsSingleNoMatch(): void { $this->assertSearchResults( [], @@ -1369,7 +1371,7 @@ public function testFieldRelationFilterContainsSingleNoMatch() ); } - public function testFieldRelationFilterContainsArray() + public function testFieldRelationFilterContainsArray(): void { $this->assertSearchResults( [67], @@ -1387,7 +1389,7 @@ public function testFieldRelationFilterContainsArray() ); } - public function testFieldRelationFilterContainsArrayNotMatch() + public function testFieldRelationFilterContainsArrayNotMatch(): void { $this->assertSearchResults( [], @@ -1405,7 +1407,7 @@ public function testFieldRelationFilterContainsArrayNotMatch() ); } - public function testFieldRelationFilterInArray() + public function testFieldRelationFilterInArray(): void { $this->assertSearchResults( [67, 75], @@ -1423,7 +1425,7 @@ public function testFieldRelationFilterInArray() ); } - public function testFieldRelationFilterInArrayNotMatch() + public function testFieldRelationFilterInArrayNotMatch(): void { $this->assertSearchResults( [], diff --git a/tests/lib/Search/Legacy/Content/HandlerLocationSortTest.php b/tests/lib/Search/Legacy/Content/HandlerLocationSortTest.php index 9c9865ea75..0429ff25c0 100644 --- a/tests/lib/Search/Legacy/Content/HandlerLocationSortTest.php +++ b/tests/lib/Search/Legacy/Content/HandlerLocationSortTest.php @@ -19,15 +19,20 @@ use Ibexa\Core\Search\Legacy\Content\Common\Gateway\SortClauseConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\SortClauseHandler as CommonSortClauseHandler; use Ibexa\Core\Search\Legacy\Content\Gateway as ContentGateway; +use Ibexa\Core\Search\Legacy\Content\Handler; use Ibexa\Core\Search\Legacy\Content\Location\Gateway\CriterionHandler as LocationCriterionHandler; use Ibexa\Core\Search\Legacy\Content\Location\Gateway\SortClauseHandler as LocationSortClauseHandler; +use PHPUnit\Framework\MockObject\MockObject; /** * Location Search test case for ContentSearchHandler. */ class HandlerLocationSortTest extends AbstractTestCase { - protected function getIds($searchResult) + /** + * @return mixed[] + */ + protected function getIds($searchResult): array { $ids = array_map( static function ($hit) { @@ -46,11 +51,11 @@ static function ($hit) { * * @return \Ibexa\Core\Search\Legacy\Content\Handler */ - protected function getContentSearchHandler() + protected function getContentSearchHandler(): Handler { $connection = $this->getDatabaseConnection(); - return new Content\Handler( + return new Handler( $this->createMock(ContentGateway::class), new Content\Location\Gateway\DoctrineDatabase( $connection, @@ -110,7 +115,7 @@ protected function getContentSearchHandler() * * @return \Ibexa\Core\Persistence\Legacy\Content\Location\Mapper */ - protected function getLocationMapperMock() + protected function getLocationMapperMock(): MockObject { $mapperMock = $this->getMockBuilder(LocationMapper::class) ->setMethods(['createLocationsFromRows']) @@ -139,7 +144,7 @@ static function ($rows): array { return $mapperMock; } - public function testNoSorting() + public function testNoSorting(): void { $handler = $this->getContentSearchHandler(); @@ -161,7 +166,7 @@ public function testNoSorting() ); } - public function testSortLocationPath() + public function testSortLocationPath(): void { $handler = $this->getContentSearchHandler(); @@ -182,7 +187,7 @@ public function testSortLocationPath() ); } - public function testSortLocationDepth() + public function testSortLocationDepth(): void { $handler = $this->getContentSearchHandler(); @@ -203,7 +208,7 @@ public function testSortLocationDepth() ); } - public function testSortLocationDepthAndPath() + public function testSortLocationDepthAndPath(): void { $handler = $this->getContentSearchHandler(); @@ -227,7 +232,7 @@ public function testSortLocationDepthAndPath() ); } - public function testSortLocationPriority() + public function testSortLocationPriority(): void { $handler = $this->getContentSearchHandler(); @@ -250,7 +255,7 @@ public function testSortLocationPriority() ); } - public function testSortDateModified() + public function testSortDateModified(): void { $handler = $this->getContentSearchHandler(); @@ -273,7 +278,7 @@ public function testSortDateModified() ); } - public function testSortDatePublished() + public function testSortDatePublished(): void { $handler = $this->getContentSearchHandler(); @@ -296,7 +301,7 @@ public function testSortDatePublished() ); } - public function testSortSectionIdentifier() + public function testSortSectionIdentifier(): void { $handler = $this->getContentSearchHandler(); @@ -338,7 +343,7 @@ public function testSortSectionIdentifier() } } - public function testSortContentName() + public function testSortContentName(): void { $handler = $this->getContentSearchHandler(); @@ -361,7 +366,7 @@ public function testSortContentName() ); } - public function testSortContentId() + public function testSortContentId(): void { $handler = $this->getContentSearchHandler(); @@ -384,7 +389,7 @@ public function testSortContentId() ); } - public function testSortLocationId() + public function testSortLocationId(): void { $handler = $this->getContentSearchHandler(); @@ -407,7 +412,7 @@ public function testSortLocationId() ); } - public function testSortLocationVisibilityAscending() + public function testSortLocationVisibilityAscending(): void { $handler = $this->getContentSearchHandler(); @@ -430,7 +435,7 @@ public function testSortLocationVisibilityAscending() ); } - public function testSortLocationVisibilityDescending() + public function testSortLocationVisibilityDescending(): void { $handler = $this->getContentSearchHandler(); @@ -453,7 +458,7 @@ public function testSortLocationVisibilityDescending() ); } - public function testSortSectionName() + public function testSortSectionName(): void { $handler = $this->getContentSearchHandler(); @@ -506,7 +511,7 @@ static function ($hit) { } } - public function testSortFieldText() + public function testSortFieldText(): void { $handler = $this->getContentSearchHandler(); @@ -575,7 +580,7 @@ static function ($hit) { } } - public function testSortFieldNumeric() + public function testSortFieldNumeric(): void { $handler = $this->getContentSearchHandler(); @@ -608,7 +613,7 @@ static function ($hit) { ); } - public function testSortIsMainLocationAscending() + public function testSortIsMainLocationAscending(): void { $handler = $this->getContentSearchHandler(); @@ -631,7 +636,7 @@ public function testSortIsMainLocationAscending() ); } - public function testSortIsMainLocationDescending() + public function testSortIsMainLocationDescending(): void { $handler = $this->getContentSearchHandler(); diff --git a/tests/lib/Search/Legacy/Content/HandlerLocationTest.php b/tests/lib/Search/Legacy/Content/HandlerLocationTest.php index 3d6ef6da82..cb71d655a6 100644 --- a/tests/lib/Search/Legacy/Content/HandlerLocationTest.php +++ b/tests/lib/Search/Legacy/Content/HandlerLocationTest.php @@ -21,8 +21,10 @@ use Ibexa\Core\Search\Legacy\Content\Common\Gateway\SortClauseConverter; use Ibexa\Core\Search\Legacy\Content\Common\Gateway\SortClauseHandler as CommonSortClauseHandler; use Ibexa\Core\Search\Legacy\Content\Gateway as ContentGateway; +use Ibexa\Core\Search\Legacy\Content\Handler; use Ibexa\Core\Search\Legacy\Content\Location\Gateway\CriterionHandler as LocationCriterionHandler; use Ibexa\Core\Search\Legacy\Content\Location\Gateway\SortClauseHandler as LocationSortClauseHandler; +use PHPUnit\Framework\MockObject\MockObject; /** * Location Search test case for ContentSearchHandler. @@ -38,7 +40,7 @@ class HandlerLocationTest extends AbstractTestCase * * @return \Ibexa\Core\Search\Legacy\Content\Handler */ - protected function getContentSearchHandler(array $fullTextSearchConfiguration = []) + protected function getContentSearchHandler(array $fullTextSearchConfiguration = []): Handler { $transformationProcessor = new Persistence\TransformationProcessor\DefinitionBased( new Persistence\TransformationProcessor\DefinitionBased\Parser(), @@ -67,7 +69,7 @@ protected function getContentSearchHandler(array $fullTextSearchConfiguration = $transformationProcessor ); - return new Content\Handler( + return new Handler( $this->createMock(ContentGateway::class), new Content\Location\Gateway\DoctrineDatabase( $connection, @@ -171,7 +173,7 @@ protected function getContentSearchHandler(array $fullTextSearchConfiguration = * * @return \Ibexa\Core\Persistence\Legacy\Content\Location\Mapper */ - protected function getLocationMapperMock() + protected function getLocationMapperMock(): MockObject { $mapperMock = $this->getMockBuilder(LocationMapper::class) ->setMethods(['createLocationsFromRows']) @@ -200,7 +202,7 @@ static function ($rows): array { return $mapperMock; } - public function testFindWithoutOffsetLimit() + public function testFindWithoutOffsetLimit(): void { $handler = $this->getContentSearchHandler(); @@ -216,7 +218,7 @@ public function testFindWithoutOffsetLimit() self::assertCount(1, $searchResult->searchHits); } - public function testFindWithZeroLimit() + public function testFindWithZeroLimit(): void { $handler = $this->getContentSearchHandler(); @@ -237,7 +239,7 @@ public function testFindWithZeroLimit() /** * Issue with PHP_MAX_INT limit overflow in databases. */ - public function testFindWithNullLimit() + public function testFindWithNullLimit(): void { $handler = $this->getContentSearchHandler(); @@ -258,7 +260,7 @@ public function testFindWithNullLimit() /** * Issue with offsetting to the nonexistent results produces \ezcQueryInvalidParameterException exception. */ - public function testFindWithOffsetToNonexistent() + public function testFindWithOffsetToNonexistent(): void { $handler = $this->getContentSearchHandler(); @@ -276,7 +278,7 @@ public function testFindWithOffsetToNonexistent() self::assertEquals([], $searchResult->searchHits); } - public function testLocationIdFilter() + public function testLocationIdFilter(): void { $this->assertSearchResults( [12, 13], @@ -293,7 +295,7 @@ public function testLocationIdFilter() ); } - public function testParentLocationIdFilter() + public function testParentLocationIdFilter(): void { $this->assertSearchResults( [12, 13, 14, 44, 227], @@ -308,7 +310,7 @@ public function testParentLocationIdFilter() ); } - public function testLocationIdAndCombinatorFilter() + public function testLocationIdAndCombinatorFilter(): void { $this->assertSearchResults( [13], @@ -332,7 +334,7 @@ public function testLocationIdAndCombinatorFilter() ); } - public function testLocationIdParentLocationIdAndCombinatorFilter() + public function testLocationIdParentLocationIdAndCombinatorFilter(): void { $this->assertSearchResults( [44, 160], @@ -356,7 +358,7 @@ public function testLocationIdParentLocationIdAndCombinatorFilter() ); } - public function testContentDepthFilterEq() + public function testContentDepthFilterEq(): void { $this->assertSearchResults( [2, 5, 43, 48, 58], @@ -371,7 +373,7 @@ public function testContentDepthFilterEq() ); } - public function testContentDepthFilterIn() + public function testContentDepthFilterIn(): void { $this->assertSearchResults( [2, 5, 12, 13, 14, 43, 44, 48, 51, 52, 53, 54, 56, 58, 59, 69, 77, 86, 96, 107, 153, 156, 167, 190, 227], @@ -386,7 +388,7 @@ public function testContentDepthFilterIn() ); } - public function testContentDepthFilterBetween() + public function testContentDepthFilterBetween(): void { $this->assertSearchResults( [2, 5, 43, 48, 58], @@ -400,7 +402,7 @@ public function testContentDepthFilterBetween() ); } - public function testContentDepthFilterGreaterThan() + public function testContentDepthFilterGreaterThan(): void { $this->assertSearchResults( [99, 102, 135, 136, 137, 139, 140, 142, 143, 144, 145, 148, 151, 174, 175, 177, 194, 196, 197, 198, 199, 200, 201, 202, 203, 205, 206, 207, 208, 209, 210, 211, 212, 214, 215], @@ -415,7 +417,7 @@ public function testContentDepthFilterGreaterThan() ); } - public function testContentDepthFilterGreaterThanOrEqual() + public function testContentDepthFilterGreaterThanOrEqual(): void { $this->assertSearchResults( [99, 102, 135, 136, 137, 139, 140, 142, 143, 144, 145, 148, 151, 174, 175, 177, 194, 196, 197, 198, 199, 200, 201, 202, 203, 205, 206, 207, 208, 209, 210, 211, 212, 214, 215], @@ -430,7 +432,7 @@ public function testContentDepthFilterGreaterThanOrEqual() ); } - public function testContentDepthFilterLessThan() + public function testContentDepthFilterLessThan(): void { $this->assertSearchResults( [2, 5, 43, 48, 58], @@ -445,7 +447,7 @@ public function testContentDepthFilterLessThan() ); } - public function testContentDepthFilterLessThanOrEqual() + public function testContentDepthFilterLessThanOrEqual(): void { $this->assertSearchResults( [2, 5, 12, 13, 14, 43, 44, 48, 51, 52, 53, 54, 56, 58, 59, 69, 77, 86, 96, 107, 153, 156, 167, 190, 227], @@ -460,7 +462,7 @@ public function testContentDepthFilterLessThanOrEqual() ); } - public function testLocationPriorityFilter() + public function testLocationPriorityFilter(): void { $this->assertSearchResults( [156, 167, 190], @@ -478,7 +480,7 @@ public function testLocationPriorityFilter() ); } - public function testLocationRemoteIdFilter() + public function testLocationRemoteIdFilter(): void { $this->assertSearchResults( [2, 5], @@ -495,7 +497,7 @@ public function testLocationRemoteIdFilter() ); } - public function testVisibilityFilterVisible() + public function testVisibilityFilterVisible(): void { $this->assertSearchResults( [2, 5, 12, 13, 14], @@ -513,7 +515,7 @@ public function testVisibilityFilterVisible() ); } - public function testVisibilityFilterHidden() + public function testVisibilityFilterHidden(): void { $this->assertSearchResults( [228], @@ -529,7 +531,7 @@ public function testVisibilityFilterHidden() ); } - public function testLocationNotCombinatorFilter() + public function testLocationNotCombinatorFilter(): void { $this->assertSearchResults( [2, 5], @@ -555,7 +557,7 @@ public function testLocationNotCombinatorFilter() ); } - public function testLocationOrCombinatorFilter() + public function testLocationOrCombinatorFilter(): void { $this->assertSearchResults( [2, 5, 12, 13, 14], @@ -579,7 +581,7 @@ public function testLocationOrCombinatorFilter() ); } - public function testContentIdFilterEquals() + public function testContentIdFilterEquals(): void { $this->assertSearchResults( [225], @@ -593,7 +595,7 @@ public function testContentIdFilterEquals() ); } - public function testContentIdFilterIn() + public function testContentIdFilterIn(): void { $this->assertSearchResults( [225, 226, 227], @@ -609,7 +611,7 @@ public function testContentIdFilterIn() ); } - public function testContentTypeGroupFilter() + public function testContentTypeGroupFilter(): void { $this->assertSearchResults( [5, 12, 13, 14, 15, 44, 45, 227, 228], @@ -624,7 +626,7 @@ public function testContentTypeGroupFilter() ); } - public function testContentTypeIdFilter() + public function testContentTypeIdFilter(): void { $this->assertSearchResults( [15, 45, 228], @@ -639,7 +641,7 @@ public function testContentTypeIdFilter() ); } - public function testContentTypeIdentifierFilter() + public function testContentTypeIdentifierFilter(): void { $this->assertSearchResults( [43, 48, 51, 52, 53], @@ -655,7 +657,7 @@ public function testContentTypeIdentifierFilter() ); } - public function testObjectStateIdFilter() + public function testObjectStateIdFilter(): void { $this->assertSearchResults( [5, 12, 13, 14, 15, 43, 44, 45, 48, 51], @@ -671,7 +673,7 @@ public function testObjectStateIdFilter() ); } - public function testObjectStateIdFilterIn() + public function testObjectStateIdFilterIn(): void { $this->assertSearchResults( [2, 5, 12, 13, 14, 15, 43, 44, 45, 48], @@ -687,7 +689,7 @@ public function testObjectStateIdFilterIn() ); } - public function testRemoteIdFilter() + public function testRemoteIdFilter(): void { $this->assertSearchResults( [5, 45], @@ -704,7 +706,7 @@ public function testRemoteIdFilter() ); } - public function testSectionFilter() + public function testSectionFilter(): void { $this->assertSearchResults( [5, 12, 13, 14, 15, 44, 45, 228], @@ -719,7 +721,7 @@ public function testSectionFilter() ); } - public function testDateMetadataFilterModifiedGreater() + public function testDateMetadataFilterModifiedGreater(): void { $this->assertSearchResults( [12, 227, 228], @@ -738,7 +740,7 @@ public function testDateMetadataFilterModifiedGreater() ); } - public function testDateMetadataFilterModifiedGreaterOrEqual() + public function testDateMetadataFilterModifiedGreaterOrEqual(): void { $this->assertSearchResults( [12, 15, 227, 228], @@ -757,7 +759,7 @@ public function testDateMetadataFilterModifiedGreaterOrEqual() ); } - public function testDateMetadataFilterModifiedIn() + public function testDateMetadataFilterModifiedIn(): void { $this->assertSearchResults( [12, 15, 227, 228], @@ -776,7 +778,7 @@ public function testDateMetadataFilterModifiedIn() ); } - public function testDateMetadataFilterModifiedBetween() + public function testDateMetadataFilterModifiedBetween(): void { $this->assertSearchResults( [12, 15, 227, 228], @@ -795,7 +797,7 @@ public function testDateMetadataFilterModifiedBetween() ); } - public function testDateMetadataFilterCreatedBetween() + public function testDateMetadataFilterCreatedBetween(): void { $this->assertSearchResults( [68, 133, 227], @@ -814,7 +816,7 @@ public function testDateMetadataFilterCreatedBetween() ); } - public function testUserMetadataFilterOwnerWrongUserId() + public function testUserMetadataFilterOwnerWrongUserId(): void { $this->assertSearchResults( [], @@ -832,7 +834,7 @@ public function testUserMetadataFilterOwnerWrongUserId() ); } - public function testUserMetadataFilterOwnerAdministrator() + public function testUserMetadataFilterOwnerAdministrator(): void { $this->assertSearchResults( [2, 5, 12, 13, 14, 15, 43, 44, 45, 48], @@ -852,7 +854,7 @@ public function testUserMetadataFilterOwnerAdministrator() ); } - public function testUserMetadataFilterOwnerEqAMember() + public function testUserMetadataFilterOwnerEqAMember(): void { $this->assertSearchResults( [225], @@ -870,7 +872,7 @@ public function testUserMetadataFilterOwnerEqAMember() ); } - public function testUserMetadataFilterOwnerInAMember() + public function testUserMetadataFilterOwnerInAMember(): void { $this->assertSearchResults( [225], @@ -888,7 +890,7 @@ public function testUserMetadataFilterOwnerInAMember() ); } - public function testUserMetadataFilterCreatorEqAMember() + public function testUserMetadataFilterCreatorEqAMember(): void { $this->assertSearchResults( [225], @@ -906,7 +908,7 @@ public function testUserMetadataFilterCreatorEqAMember() ); } - public function testUserMetadataFilterCreatorInAMember() + public function testUserMetadataFilterCreatorInAMember(): void { $this->assertSearchResults( [225], @@ -924,7 +926,7 @@ public function testUserMetadataFilterCreatorInAMember() ); } - public function testUserMetadataFilterEqGroupMember() + public function testUserMetadataFilterEqGroupMember(): void { $this->assertSearchResults( [225], @@ -942,7 +944,7 @@ public function testUserMetadataFilterEqGroupMember() ); } - public function testUserMetadataFilterInGroupMember() + public function testUserMetadataFilterInGroupMember(): void { $this->assertSearchResults( [225], @@ -960,7 +962,7 @@ public function testUserMetadataFilterInGroupMember() ); } - public function testUserMetadataFilterEqGroupMemberNoMatch() + public function testUserMetadataFilterEqGroupMemberNoMatch(): void { $this->assertSearchResults( [], @@ -978,7 +980,7 @@ public function testUserMetadataFilterEqGroupMemberNoMatch() ); } - public function testUserMetadataFilterInGroupMemberNoMatch() + public function testUserMetadataFilterInGroupMemberNoMatch(): void { $this->assertSearchResults( [], @@ -996,7 +998,7 @@ public function testUserMetadataFilterInGroupMemberNoMatch() ); } - public function testLanguageCodeFilter() + public function testLanguageCodeFilter(): void { $this->assertSearchResults( [2, 5, 12, 13, 14, 15, 43, 44, 45, 48], @@ -1012,7 +1014,7 @@ public function testLanguageCodeFilter() ); } - public function testLanguageCodeFilterIn() + public function testLanguageCodeFilterIn(): void { $this->assertSearchResults( [2, 5, 12, 13, 14, 15, 43, 44, 45, 48], @@ -1028,7 +1030,7 @@ public function testLanguageCodeFilterIn() ); } - public function testLanguageCodeFilterWithAlwaysAvailable() + public function testLanguageCodeFilterWithAlwaysAvailable(): void { $this->assertSearchResults( [2, 5, 12, 13, 14, 15, 43, 44, 45, 48, 51, 52, 53, 58, 59, 70, 72, 76, 78, 82], @@ -1044,7 +1046,7 @@ public function testLanguageCodeFilterWithAlwaysAvailable() ); } - public function testMatchAllFilter() + public function testMatchAllFilter(): void { $result = $this->getContentSearchHandler()->findLocations( new LocationQuery( @@ -1064,7 +1066,7 @@ public function testMatchAllFilter() ); } - public function testFullTextFilter() + public function testFullTextFilter(): void { $this->assertSearchResults( [193], @@ -1079,7 +1081,7 @@ public function testFullTextFilter() ); } - public function testFullTextWildcardFilter() + public function testFullTextWildcardFilter(): void { $this->assertSearchResults( [193], @@ -1094,7 +1096,7 @@ public function testFullTextWildcardFilter() ); } - public function testFullTextDisabledWildcardFilter() + public function testFullTextDisabledWildcardFilter(): void { $this->assertSearchResults( [], @@ -1109,7 +1111,7 @@ public function testFullTextDisabledWildcardFilter() ); } - public function testFullTextFilterStopwordRemoval() + public function testFullTextFilterStopwordRemoval(): void { $handler = $this->getContentSearchHandler( [ @@ -1129,7 +1131,7 @@ public function testFullTextFilterStopwordRemoval() ); } - public function testFullTextFilterNoStopwordRemoval() + public function testFullTextFilterNoStopwordRemoval(): void { $handler = $this->getContentSearchHandler( [ @@ -1161,7 +1163,7 @@ static function ($hit) { ); } - public function testFullTextFilterInvalidStopwordThreshold() + public function testFullTextFilterInvalidStopwordThreshold(): void { $this->expectException(InvalidArgumentException::class); @@ -1172,7 +1174,7 @@ public function testFullTextFilterInvalidStopwordThreshold() ); } - public function testFieldRelationFilterContainsSingle() + public function testFieldRelationFilterContainsSingle(): void { $this->assertSearchResults( [69], @@ -1190,7 +1192,7 @@ public function testFieldRelationFilterContainsSingle() ); } - public function testFieldRelationFilterContainsSingleNoMatch() + public function testFieldRelationFilterContainsSingleNoMatch(): void { $this->assertSearchResults( [], @@ -1208,7 +1210,7 @@ public function testFieldRelationFilterContainsSingleNoMatch() ); } - public function testFieldRelationFilterContainsArray() + public function testFieldRelationFilterContainsArray(): void { $this->assertSearchResults( [69], @@ -1226,7 +1228,7 @@ public function testFieldRelationFilterContainsArray() ); } - public function testFieldRelationFilterContainsArrayNotMatch() + public function testFieldRelationFilterContainsArrayNotMatch(): void { $this->assertSearchResults( [], @@ -1244,7 +1246,7 @@ public function testFieldRelationFilterContainsArrayNotMatch() ); } - public function testFieldRelationFilterInArray() + public function testFieldRelationFilterInArray(): void { $this->assertSearchResults( [69, 77], @@ -1262,7 +1264,7 @@ public function testFieldRelationFilterInArray() ); } - public function testFieldRelationFilterInArrayNotMatch() + public function testFieldRelationFilterInArrayNotMatch(): void { $this->assertSearchResults( [], @@ -1280,7 +1282,7 @@ public function testFieldRelationFilterInArrayNotMatch() ); } - public function testFieldFilter() + public function testFieldFilter(): void { $this->assertSearchResults( [12], @@ -1299,7 +1301,7 @@ public function testFieldFilter() ); } - public function testFieldFilterIn() + public function testFieldFilterIn(): void { $this->assertSearchResults( [12, 44], @@ -1318,7 +1320,7 @@ public function testFieldFilterIn() ); } - public function testFieldFilterContainsPartial() + public function testFieldFilterContainsPartial(): void { $this->assertSearchResults( [44], @@ -1337,7 +1339,7 @@ public function testFieldFilterContainsPartial() ); } - public function testFieldFilterContainsSimple() + public function testFieldFilterContainsSimple(): void { $this->assertSearchResults( [79], @@ -1356,7 +1358,7 @@ public function testFieldFilterContainsSimple() ); } - public function testFieldFilterContainsSimpleNoMatch() + public function testFieldFilterContainsSimpleNoMatch(): void { $this->assertSearchResults( [], @@ -1375,7 +1377,7 @@ public function testFieldFilterContainsSimpleNoMatch() ); } - public function testFieldFilterBetween() + public function testFieldFilterBetween(): void { $this->assertSearchResults( [188, 189], @@ -1394,7 +1396,7 @@ public function testFieldFilterBetween() ); } - public function testFieldFilterOr() + public function testFieldFilterOr(): void { $this->assertSearchResults( [12, 188, 189], @@ -1422,7 +1424,7 @@ public function testFieldFilterOr() ); } - public function testIsMainLocationFilter() + public function testIsMainLocationFilter(): void { $this->assertSearchResults( [225], @@ -1444,7 +1446,7 @@ public function testIsMainLocationFilter() ); } - public function testIsNotMainLocationFilter() + public function testIsNotMainLocationFilter(): void { $this->assertSearchResults( [510],