diff --git a/composer.json b/composer.json index 04fdb1d0..d02860f0 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ "symfony/form": "^7.3" }, "require-dev": { - "ibexa/code-style": "~2.0.0", + "ibexa/code-style": "~2.3.0", "ibexa/doctrine-schema": "~5.0.0@dev", "ibexa/rector": "~5.0.x-dev", "mikey179/vfsstream": "^1.6", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 25194721..c2db6114 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -78,12 +78,6 @@ parameters: count: 1 path: src/bundle/Controller/RenderController.php - - - message: '#^Method Ibexa\\Bundle\\Behat\\DependencyInjection\\IbexaBehatExtension\:\:load\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/bundle/DependencyInjection/IbexaBehatExtension.php - - message: '#^Method Ibexa\\Bundle\\Behat\\DependencyInjection\\IbexaBehatExtension\:\:shouldLoadDxpServices\(\) has no return type specified\.$#' identifier: missingType.return @@ -1986,7 +1980,6 @@ parameters: count: 1 path: src/lib/Browser/FileUpload/FileUploadHelper.php - - message: '#^Method Ibexa\\Behat\\Browser\\Filter\\BrowserLogFilter\:\:filter\(\) has parameter \$logEntries with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -2551,7 +2544,6 @@ parameters: count: 1 path: src/lib/Core/Log/LogFileReader.php - - message: '#^Method Ibexa\\Behat\\Core\\Log\\TestLogProvider\:\:cacheLogs\(\) has parameter \$logs with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue diff --git a/src/bundle/Cache/JsRoutingDirectoryCacheDirectoryCreator.php b/src/bundle/Cache/JsRoutingDirectoryCacheDirectoryCreator.php index 62861510..8054829c 100644 --- a/src/bundle/Cache/JsRoutingDirectoryCacheDirectoryCreator.php +++ b/src/bundle/Cache/JsRoutingDirectoryCacheDirectoryCreator.php @@ -19,8 +19,10 @@ public function isOptional(): bool return true; } - public function warmUp(string $cacheDir, ?string $buildDir = null): array - { + public function warmUp( + string $cacheDir, + ?string $buildDir = null + ): array { // Workaround for https://github.com/FriendsOfSymfony/FOSJsRoutingBundle/pull/434 $cachePath = $cacheDir . \DIRECTORY_SEPARATOR . self::FOS_JS_ROUTING_CACHE_DIR; if (!file_exists($cachePath) && !mkdir($cachePath) && !is_dir($cachePath)) { diff --git a/src/bundle/Command/CreateExampleDataCommand.php b/src/bundle/Command/CreateExampleDataCommand.php index d92e66af..faa0590e 100644 --- a/src/bundle/Command/CreateExampleDataCommand.php +++ b/src/bundle/Command/CreateExampleDataCommand.php @@ -28,20 +28,22 @@ class CreateExampleDataCommand extends Command { public const string NAME = 'ibexa:behat:create-data'; - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ + /** @var EventDispatcherInterface */ private $eventDispatcher; - /** @var \Psr\Log\LoggerInterface */ + /** @var LoggerInterface */ private $logger; - /** @var \Symfony\Component\Serializer\Serializer */ + /** @var Serializer */ private $serializer; - /** @var \Symfony\Component\Stopwatch\Stopwatch */ + /** @var Stopwatch */ private $stopwatch; - public function __construct(EventDispatcherInterface $eventDispatcher, LoggerInterface $logger) - { + public function __construct( + EventDispatcherInterface $eventDispatcher, + LoggerInterface $logger + ) { parent::__construct(); $encoders = [new JsonEncoder()]; $normalizers = [new ObjectNormalizer()]; @@ -58,8 +60,10 @@ protected function configure() ->addArgument('serializedTransitionData', InputArgument::REQUIRED); } - public function execute(InputInterface $input, OutputInterface $output): int - { + public function execute( + InputInterface $input, + OutputInterface $output + ): int { $iterations = $input->getArgument('iterations'); $initialData = $this->parseInputData($input->getArgument('serializedTransitionData')); diff --git a/src/bundle/Command/CreateExampleDataManagerCommand.php b/src/bundle/Command/CreateExampleDataManagerCommand.php index b805c11d..5a1c9221 100644 --- a/src/bundle/Command/CreateExampleDataManagerCommand.php +++ b/src/bundle/Command/CreateExampleDataManagerCommand.php @@ -27,7 +27,7 @@ class CreateExampleDataManagerCommand extends Command { private const BATCH_SIZE = 100; - /** @var \Symfony\Component\Stopwatch\Stopwatch */ + /** @var Stopwatch */ private $stopwatch; /** @var string */ @@ -39,11 +39,13 @@ class CreateExampleDataManagerCommand extends Command /** @var array */ private $processes; - /** @var \Symfony\Component\Serializer\Serializer */ + /** @var Serializer */ private $serializer; - public function __construct(string $env, string $projectDir) - { + public function __construct( + string $env, + string $projectDir + ) { parent::__construct(); $encoders = [new JsonEncoder()]; @@ -54,8 +56,10 @@ public function __construct(string $env, string $projectDir) $this->stopwatch = new Stopwatch(); } - public function execute(InputInterface $input, OutputInterface $output): int - { + public function execute( + InputInterface $input, + OutputInterface $output + ): int { $data = $this->getData(); $this->stopwatch->start('timer'); @@ -67,8 +71,11 @@ public function execute(InputInterface $input, OutputInterface $output): int return self::SUCCESS; } - private function executeCommand(OutputInterface $output, $cmd, float $timeout = 1200) - { + private function executeCommand( + OutputInterface $output, + $cmd, + float $timeout = 1200 + ) { $phpFinder = new PhpExecutableFinder(); if (!$phpPath = $phpFinder->find(false)) { throw new \RuntimeException('The php executable could not be found. Add it to your PATH environment variable and try again'); @@ -119,8 +126,10 @@ private function getData() return $data['countries']; } - private function createProcesses(OutputInterface $output, $data) - { + private function createProcesses( + OutputInterface $output, + $data + ) { foreach ($data as $row) { $eventData = $this->parseData($row); $command = sprintf('%s %d %s', CreateExampleDataCommand::NAME, self::BATCH_SIZE, $this->serialize($eventData)); diff --git a/src/bundle/Command/CreateLanguageCommand.php b/src/bundle/Command/CreateLanguageCommand.php index 5b2fe068..04b0a0ce 100644 --- a/src/bundle/Command/CreateLanguageCommand.php +++ b/src/bundle/Command/CreateLanguageCommand.php @@ -20,13 +20,13 @@ #[AsCommand(name: 'ibexa:behat:create-language', description: 'Create a Language')] class CreateLanguageCommand extends Command { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; public function __construct( @@ -55,8 +55,10 @@ protected function configure() ; } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { // set user with proper permissions to create language (content / translations) $this->permissionResolver->setCurrentUserReference( $this->userService->loadUserByLogin( diff --git a/src/bundle/Command/TestSiteaccessCommand.php b/src/bundle/Command/TestSiteaccessCommand.php index 4e9d5fa4..6849b239 100644 --- a/src/bundle/Command/TestSiteaccessCommand.php +++ b/src/bundle/Command/TestSiteaccessCommand.php @@ -17,7 +17,7 @@ #[AsCommand(name: 'ibexa:behat:test-siteaccess', description: 'Outputs the name of the active siteaccess')] class TestSiteaccessCommand extends Command { - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ + /** @var SiteAccess */ private $siteaccess; public function __construct(SiteAccess $siteaccess) @@ -27,12 +27,12 @@ public function __construct(SiteAccess $siteaccess) parent::__construct(); } - protected function configure() - { - } + protected function configure() {} - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $output->writeln($this->siteaccess->name); return self::SUCCESS; diff --git a/src/bundle/Controller/CurrentUserDataController.php b/src/bundle/Controller/CurrentUserDataController.php index 72878716..c49bfd1f 100644 --- a/src/bundle/Controller/CurrentUserDataController.php +++ b/src/bundle/Controller/CurrentUserDataController.php @@ -17,17 +17,19 @@ class CurrentUserDataController extends AbstractController { /** - * @var \Ibexa\Contracts\Core\Repository\PermissionResolver + * @var PermissionResolver */ private $permissionResolver; /** - * @var \Ibexa\Contracts\Core\Repository\UserService + * @var UserService */ private $userService; - public function __construct(PermissionResolver $permissionResolver, UserService $userService) - { + public function __construct( + PermissionResolver $permissionResolver, + UserService $userService + ) { $this->permissionResolver = $permissionResolver; $this->userService = $userService; } diff --git a/src/bundle/Controller/ExceptionController.php b/src/bundle/Controller/ExceptionController.php index e4d68f9e..84ff6a9e 100644 --- a/src/bundle/Controller/ExceptionController.php +++ b/src/bundle/Controller/ExceptionController.php @@ -12,8 +12,11 @@ class ExceptionController { - public function throwRepositoryUnauthorizedAction($module = 'foo', $function = 'bar', $properties = []) - { + public function throwRepositoryUnauthorizedAction( + $module = 'foo', + $function = 'bar', + $properties = [] + ) { throw new UnauthorizedException($module, $function, $properties); } } diff --git a/src/bundle/DependencyInjection/IbexaBehatExtension.php b/src/bundle/DependencyInjection/IbexaBehatExtension.php index 107e81f7..21c9d690 100644 --- a/src/bundle/DependencyInjection/IbexaBehatExtension.php +++ b/src/bundle/DependencyInjection/IbexaBehatExtension.php @@ -45,8 +45,10 @@ public function prepend(ContainerBuilder $container) $container->setParameter(self::BROWSER_DEBUG_INTERACTIVE_ENABLED, false); } - public function load(array $config, ContainerBuilder $container) - { + public function load( + array $config, + ContainerBuilder $container + ) { $loader = new Loader\YamlFileLoader( $container, new FileLocator(__DIR__ . '/../Resources/config') diff --git a/src/bundle/Form/RetryChoiceListFactory.php b/src/bundle/Form/RetryChoiceListFactory.php index 29256de6..ffb0645b 100644 --- a/src/bundle/Form/RetryChoiceListFactory.php +++ b/src/bundle/Form/RetryChoiceListFactory.php @@ -28,7 +28,7 @@ public function __construct(ChoiceListFactoryInterface $choiceListFactory) /** * @param iterable $choices * - * @throws \ErrorException + * @throws ErrorException */ public function createListFromChoices( iterable $choices, @@ -41,7 +41,7 @@ public function createListFromChoices( } /** - * @throws \ErrorException + * @throws ErrorException */ public function createListFromLoader( ChoiceLoaderInterface $loader, @@ -58,7 +58,7 @@ public function createListFromLoader( * @param array|callable|null $attr * @param array|callable $labelTranslationParameters * - * @throws \ErrorException + * @throws ErrorException */ public function createView( ChoiceListInterface $list, @@ -92,7 +92,7 @@ function () use ($list, $preferredChoices, $label, $index, $groupBy, $attr, $lab * * @return T * - * @throws \ErrorException + * @throws ErrorException */ private function executeWithRetry(callable $fn) { diff --git a/src/bundle/IbexaExtension.php b/src/bundle/IbexaExtension.php index ad4e520d..02e3679e 100644 --- a/src/bundle/IbexaExtension.php +++ b/src/bundle/IbexaExtension.php @@ -42,9 +42,7 @@ public function process(ContainerBuilder $container): void } } - public function initialize(ExtensionManager $extensionManager) - { - } + public function initialize(ExtensionManager $extensionManager) {} public function configure(ArrayNodeDefinition $builder) { @@ -60,8 +58,10 @@ public function configure(ArrayNodeDefinition $builder) ->end(); } - public function load(ContainerBuilder $container, array $config) - { + public function load( + ContainerBuilder $container, + array $config + ) { $this->loadSiteAccessInitializer($container); $this->loadStartScenarioSubscriber($container); $this->setMinkParameters($container, $config); @@ -80,8 +80,10 @@ private function loadSiteAccessInitializer(ContainerBuilder $container): void $container->setDefinition(BehatSiteAccessInitializer::class, $definition); } - private function setMinkParameters(ContainerBuilder $container, array $config): void - { + private function setMinkParameters( + ContainerBuilder $container, + array $config + ): void { if (!array_key_exists('mink', $config)) { return; } @@ -101,8 +103,10 @@ private function setMinkParameters(ContainerBuilder $container, array $config): $container->setParameter(self::HEIGHT_PARAMETER, (int) $config['mink']['height']); } - private function setDefaultJavascriptSession(ContainerBuilder $container, string $defaultJavascriptSession): void - { + private function setDefaultJavascriptSession( + ContainerBuilder $container, + string $defaultJavascriptSession + ): void { $container->setParameter('mink.javascript_session', $defaultJavascriptSession); } diff --git a/src/bundle/Initializer/BehatSiteAccessInitializer.php b/src/bundle/Initializer/BehatSiteAccessInitializer.php index 5be3a927..0237a050 100644 --- a/src/bundle/Initializer/BehatSiteAccessInitializer.php +++ b/src/bundle/Initializer/BehatSiteAccessInitializer.php @@ -22,7 +22,7 @@ final class BehatSiteAccessInitializer implements EventSubscriberInterface private const DEFAULT_SITEACCESS_PARAMETER = 'ibexa.site_access.default'; private const EVENT_DISPATCHER_SERVICE_ID = 'event_dispatcher'; - /** @var \Symfony\Component\HttpKernel\KernelInterface */ + /** @var KernelInterface */ private $kernel; public function __construct(KernelInterface $kernel) diff --git a/src/bundle/Subscriber/StartScenarioSubscriber.php b/src/bundle/Subscriber/StartScenarioSubscriber.php index fb331954..7c3710a2 100644 --- a/src/bundle/Subscriber/StartScenarioSubscriber.php +++ b/src/bundle/Subscriber/StartScenarioSubscriber.php @@ -27,8 +27,11 @@ class StartScenarioSubscriber implements EventSubscriberInterface private int $height; - public function __construct(KernelInterface $kernel, int $width, int $height) - { + public function __construct( + KernelInterface $kernel, + int $width, + int $height + ) { $this->kernel = $kernel; $this->width = $width; $this->height = $height; diff --git a/src/lib/API/ContentData/ContentDataProvider.php b/src/lib/API/ContentData/ContentDataProvider.php index b2b85618..f1893d97 100644 --- a/src/lib/API/ContentData/ContentDataProvider.php +++ b/src/lib/API/ContentData/ContentDataProvider.php @@ -24,14 +24,17 @@ class ContentDataProvider private $contentService; - /** @var \Ibexa\Behat\API\ContentData\FieldTypeData\FieldTypeDataProviderInterface[] */ + /** @var FieldTypeDataProviderInterface[] */ private $fieldTypeDataProviders; - /** @var \Ibexa\Behat\API\ContentData\RandomDataGenerator */ + /** @var RandomDataGenerator */ private $randomDataGenerator; - public function __construct(ContentTypeService $contentTypeService, ContentService $contentService, RandomDataGenerator $randomDataGenerator) - { + public function __construct( + ContentTypeService $contentTypeService, + ContentService $contentService, + RandomDataGenerator $randomDataGenerator + ) { $this->contentTypeService = $contentTypeService; $this->contentService = $contentService; $this->randomDataGenerator = $randomDataGenerator; @@ -55,8 +58,10 @@ public function getRandomContentData($language): ContentCreateStruct return $this->fillContentStructWithData($contentType, $language, $language, $contentCreateStruct); } - public function getRandomContentUpdateData(string $mainLanguage, string $language): ContentUpdateStruct - { + public function getRandomContentUpdateData( + string $mainLanguage, + string $language + ): ContentUpdateStruct { $contentType = $this->contentTypeService->loadContentTypeByIdentifier($this->contentTypeIdentifier); $contentUpdateStruct = $this->contentService->newContentUpdateStruct(); $contentUpdateStruct->initialLanguageCode = $language; @@ -64,8 +69,11 @@ public function getRandomContentUpdateData(string $mainLanguage, string $languag return $this->fillContentStructWithData($contentType, $mainLanguage, $language, $contentUpdateStruct); } - public function getFilledContentDataStruct(ContentStruct $contentStruct, $contentItemData, $language): ContentStruct - { + public function getFilledContentDataStruct( + ContentStruct $contentStruct, + $contentItemData, + $language + ): ContentStruct { $contentType = $this->contentTypeService->loadContentTypeByIdentifier($this->contentTypeIdentifier); foreach ($contentItemData as $fieldIdentifier => $value) { @@ -82,8 +90,12 @@ public function getFilledContentDataStruct(ContentStruct $contentStruct, $conten return $contentStruct; } - public function getRandomFieldData(string $contentTypeIdentifier, string $fieldIdentifier, string $fieldTypeIdentifier, $language = 'eng-GB') - { + public function getRandomFieldData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $fieldTypeIdentifier, + $language = 'eng-GB' + ) { foreach ($this->fieldTypeDataProviders as $provider) { if ($provider->supports($fieldTypeIdentifier)) { return $provider->generateData($contentTypeIdentifier, $fieldIdentifier, $language); @@ -91,8 +103,10 @@ public function getRandomFieldData(string $contentTypeIdentifier, string $fieldI } } - public function getFieldDataFromString($fieldIdentifier, $value) - { + public function getFieldDataFromString( + $fieldIdentifier, + $value + ) { foreach ($this->fieldTypeDataProviders as $provider) { if ($provider->supports($fieldIdentifier)) { return $provider->parseFromString($value); @@ -100,8 +114,12 @@ public function getFieldDataFromString($fieldIdentifier, $value) } } - private function fillContentStructWithData(ContentType $contentType, string $mainLanguage, string $language, ContentStruct $contentStruct): ContentStruct - { + private function fillContentStructWithData( + ContentType $contentType, + string $mainLanguage, + string $language, + ContentStruct $contentStruct + ): ContentStruct { $fieldDefinitions = $contentType->getFieldDefinitions()->toArray(); foreach ($fieldDefinitions as $field) { diff --git a/src/lib/API/ContentData/FieldTypeData/AuthorDataProvider.php b/src/lib/API/ContentData/FieldTypeData/AuthorDataProvider.php index 12122def..73255561 100644 --- a/src/lib/API/ContentData/FieldTypeData/AuthorDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/AuthorDataProvider.php @@ -18,8 +18,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_author' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB'): Value - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ): Value { return new Value([$this->getSingleAuthor($language), $this->getSingleAuthor($language)]); } diff --git a/src/lib/API/ContentData/FieldTypeData/BinaryFileDataProvider.php b/src/lib/API/ContentData/FieldTypeData/BinaryFileDataProvider.php index 83bca988..4eb1cf7f 100644 --- a/src/lib/API/ContentData/FieldTypeData/BinaryFileDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/BinaryFileDataProvider.php @@ -30,8 +30,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_binaryfile' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { $filename = self::FILES[array_rand(self::FILES, 1)]; $filePath = sprintf('%s/%s/%s', __DIR__, self::FILES_PATH, $filename); diff --git a/src/lib/API/ContentData/FieldTypeData/BooleanDataProvider.php b/src/lib/API/ContentData/FieldTypeData/BooleanDataProvider.php index 28970457..1105b650 100644 --- a/src/lib/API/ContentData/FieldTypeData/BooleanDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/BooleanDataProvider.php @@ -13,11 +13,13 @@ class BooleanDataProvider extends AbstractFieldTypeDataProvider { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - public function __construct(RandomDataGenerator $randomDataGenerator, ContentTypeService $contentTypeService) - { + public function __construct( + RandomDataGenerator $randomDataGenerator, + ContentTypeService $contentTypeService + ) { parent::__construct($randomDataGenerator); $this->contentTypeService = $contentTypeService; } @@ -27,8 +29,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_boolean' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { $contentType = $this->contentTypeService->loadContentTypeByIdentifier($contentTypeIdentifier); if ($contentType->getFieldDefinition($fieldIdentifier)->isRequired) { // if the field is required then the value has to be true. diff --git a/src/lib/API/ContentData/FieldTypeData/CountryDataProvider.php b/src/lib/API/ContentData/FieldTypeData/CountryDataProvider.php index 906ed412..a7c458aa 100644 --- a/src/lib/API/ContentData/FieldTypeData/CountryDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/CountryDataProvider.php @@ -32,8 +32,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_country' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { $randomCountry = array_rand(self::COUNTRY_DATA, 1); return new Value([$randomCountry => self::COUNTRY_DATA[$randomCountry]]); diff --git a/src/lib/API/ContentData/FieldTypeData/DateDataProvider.php b/src/lib/API/ContentData/FieldTypeData/DateDataProvider.php index d1c21df9..473525c5 100644 --- a/src/lib/API/ContentData/FieldTypeData/DateDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/DateDataProvider.php @@ -18,8 +18,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_date' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { return new Value($this->getFaker()->dateTimeThisCentury()); } diff --git a/src/lib/API/ContentData/FieldTypeData/DateTimeDataProvider.php b/src/lib/API/ContentData/FieldTypeData/DateTimeDataProvider.php index 527441b7..ea940991 100644 --- a/src/lib/API/ContentData/FieldTypeData/DateTimeDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/DateTimeDataProvider.php @@ -18,8 +18,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_datetime' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { return new Value($this->getFaker()->dateTimeThisCentury()); } diff --git a/src/lib/API/ContentData/FieldTypeData/EmailDataProvider.php b/src/lib/API/ContentData/FieldTypeData/EmailDataProvider.php index b5ffaabc..be8c9ad2 100644 --- a/src/lib/API/ContentData/FieldTypeData/EmailDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/EmailDataProvider.php @@ -15,8 +15,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_email' === $fieldTypeIdentifier || 'email' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB'): string - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ): string { $this->setLanguage($language); return $this->getFaker()->companyEmail; diff --git a/src/lib/API/ContentData/FieldTypeData/FieldTypeDataProviderInterface.php b/src/lib/API/ContentData/FieldTypeData/FieldTypeDataProviderInterface.php index de382813..5855aefb 100644 --- a/src/lib/API/ContentData/FieldTypeData/FieldTypeDataProviderInterface.php +++ b/src/lib/API/ContentData/FieldTypeData/FieldTypeDataProviderInterface.php @@ -12,7 +12,11 @@ interface FieldTypeDataProviderInterface { public function supports(string $fieldTypeIdentifier): bool; - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB'); + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ); public function parseFromString(string $value); } diff --git a/src/lib/API/ContentData/FieldTypeData/FloatDataProvider.php b/src/lib/API/ContentData/FieldTypeData/FloatDataProvider.php index 04fb0875..071bfc04 100644 --- a/src/lib/API/ContentData/FieldTypeData/FloatDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/FloatDataProvider.php @@ -15,8 +15,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_float' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { return $this->getFaker()->randomFloat(4); } diff --git a/src/lib/API/ContentData/FieldTypeData/ISBNDataProvider.php b/src/lib/API/ContentData/FieldTypeData/ISBNDataProvider.php index 04f2f06a..9279f74b 100644 --- a/src/lib/API/ContentData/FieldTypeData/ISBNDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/ISBNDataProvider.php @@ -15,8 +15,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_isbn' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { return $this->getFaker()->isbn13; } } diff --git a/src/lib/API/ContentData/FieldTypeData/ImageAssetDataProvider.php b/src/lib/API/ContentData/FieldTypeData/ImageAssetDataProvider.php index 37ecb249..d0230e1c 100644 --- a/src/lib/API/ContentData/FieldTypeData/ImageAssetDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/ImageAssetDataProvider.php @@ -19,7 +19,7 @@ class ImageAssetDataProvider extends AbstractFieldTypeDataProvider { /** - * @var \Ibexa\Core\FieldType\ImageAsset\AssetMapper + * @var AssetMapper */ private $assetMapper; @@ -29,22 +29,22 @@ class ImageAssetDataProvider extends AbstractFieldTypeDataProvider private $imageDataProvider; /** - * @var \Ibexa\Behat\Core\Behat\ArgumentParser + * @var ArgumentParser */ private $argumentParser; /** - * @var \Ibexa\Contracts\Core\Repository\LocationService + * @var LocationService */ private $locationService; /** - * @var \Ibexa\Contracts\Core\Repository\URLAliasService + * @var URLAliasService */ private $urlAliasService; /** - * @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface + * @var ConfigResolverInterface */ private $configResolver; @@ -71,8 +71,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_image_asset' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { $this->setLanguage($language); $mappings = $this->configResolver->getParameter('fieldtypes.ibexa_image_asset.mappings'); diff --git a/src/lib/API/ContentData/FieldTypeData/ImageDataProvider.php b/src/lib/API/ContentData/FieldTypeData/ImageDataProvider.php index 3d70ca4b..8af6c58a 100644 --- a/src/lib/API/ContentData/FieldTypeData/ImageDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/ImageDataProvider.php @@ -28,8 +28,10 @@ class ImageDataProvider extends AbstractFieldTypeDataProvider private $projectDir; - public function __construct(RandomDataGenerator $randomDataGenerator, $projectDir) - { + public function __construct( + RandomDataGenerator $randomDataGenerator, + $projectDir + ) { parent::__construct($randomDataGenerator); $this->projectDir = $projectDir; } @@ -39,8 +41,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_image' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { $this->setLanguage($language); $filename = self::IMAGES[array_rand(self::IMAGES, 1)]; diff --git a/src/lib/API/ContentData/FieldTypeData/IntegerDataProvider.php b/src/lib/API/ContentData/FieldTypeData/IntegerDataProvider.php index 9df4bb3c..c1d5f432 100644 --- a/src/lib/API/ContentData/FieldTypeData/IntegerDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/IntegerDataProvider.php @@ -15,8 +15,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_integer' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { return (int) $this->getFaker()->numerify('########'); } diff --git a/src/lib/API/ContentData/FieldTypeData/MapDataProvider.php b/src/lib/API/ContentData/FieldTypeData/MapDataProvider.php index cde2f120..785e9255 100644 --- a/src/lib/API/ContentData/FieldTypeData/MapDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/MapDataProvider.php @@ -40,8 +40,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_gmap_location' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { return new Value(self::LOCATION_DATA[array_rand(self::LOCATION_DATA, 1)]); } diff --git a/src/lib/API/ContentData/FieldTypeData/MatrixDataProvider.php b/src/lib/API/ContentData/FieldTypeData/MatrixDataProvider.php index 28bbdbae..21bd4ea1 100644 --- a/src/lib/API/ContentData/FieldTypeData/MatrixDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/MatrixDataProvider.php @@ -19,8 +19,10 @@ class MatrixDataProvider extends AbstractFieldTypeDataProvider private $contentTypeService; - public function __construct(RandomDataGenerator $randomDataGenerator, ContentTypeService $contentTypeService) - { + public function __construct( + RandomDataGenerator $randomDataGenerator, + ContentTypeService $contentTypeService + ) { parent::__construct($randomDataGenerator); $this->contentTypeService = $contentTypeService; } @@ -30,8 +32,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_matrix' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { $this->setLanguage($language); $fieldDefinition = $this->contentTypeService->loadContentTypeByIdentifier($contentTypeIdentifier)->getFieldDefinition($fieldIdentifier); diff --git a/src/lib/API/ContentData/FieldTypeData/MediaDataProvider.php b/src/lib/API/ContentData/FieldTypeData/MediaDataProvider.php index 3657406c..10ba1ac8 100644 --- a/src/lib/API/ContentData/FieldTypeData/MediaDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/MediaDataProvider.php @@ -31,8 +31,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_media' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { $filename = self::VIDEOS[array_rand(self::VIDEOS, 1)]; $filePath = sprintf('%s/%s/%s', __DIR__, self::VIDEOS_PATH, $filename); diff --git a/src/lib/API/ContentData/FieldTypeData/ObjectRelationDataProvider.php b/src/lib/API/ContentData/FieldTypeData/ObjectRelationDataProvider.php index 4d2011ab..dd586ca6 100644 --- a/src/lib/API/ContentData/FieldTypeData/ObjectRelationDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/ObjectRelationDataProvider.php @@ -17,23 +17,28 @@ class ObjectRelationDataProvider implements FieldTypeDataProviderInterface { - /** @var \Ibexa\Behat\API\Facade\SearchFacade */ + /** @var SearchFacade */ protected $searchFacade; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Ibexa\Contracts\Core\Repository\URLAliasService */ + /** @var URLAliasService */ private $urlAliasService; - /** @var \Ibexa\Behat\Core\Behat\ArgumentParser */ + /** @var ArgumentParser */ private $argumentParser; - public function __construct(SearchFacade $searchFacade, ContentService $contentService, LocationService $locationSerice, URLAliasService $urlAliasSerivce, ArgumentParser $argumentParser) - { + public function __construct( + SearchFacade $searchFacade, + ContentService $contentService, + LocationService $locationSerice, + URLAliasService $urlAliasSerivce, + ArgumentParser $argumentParser + ) { $this->contentService = $contentService; $this->locationService = $locationSerice; $this->urlAliasService = $urlAliasSerivce; @@ -46,8 +51,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_object_relation' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { return new Value($this->searchFacade->getRandomContentIds(1)); } diff --git a/src/lib/API/ContentData/FieldTypeData/ObjectRelationListDataProvider.php b/src/lib/API/ContentData/FieldTypeData/ObjectRelationListDataProvider.php index 119b4740..392dd4a4 100644 --- a/src/lib/API/ContentData/FieldTypeData/ObjectRelationListDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/ObjectRelationListDataProvider.php @@ -17,8 +17,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_object_relation_list' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { return new Value($this->searchFacade->getRandomContentIds(5)); } diff --git a/src/lib/API/ContentData/FieldTypeData/PasswordProvider.php b/src/lib/API/ContentData/FieldTypeData/PasswordProvider.php index 2f49eae4..3eebcc31 100644 --- a/src/lib/API/ContentData/FieldTypeData/PasswordProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/PasswordProvider.php @@ -17,8 +17,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'password' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB'): string - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ): string { return self::DEFAUlT_PASSWORD; } } diff --git a/src/lib/API/ContentData/FieldTypeData/RichTextDataProvider.php b/src/lib/API/ContentData/FieldTypeData/RichTextDataProvider.php index 02c5bad0..f113a34b 100644 --- a/src/lib/API/ContentData/FieldTypeData/RichTextDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/RichTextDataProvider.php @@ -25,12 +25,14 @@ class RichTextDataProvider extends AbstractFieldTypeDataProvider '; /** - * @var \Ibexa\Behat\API\Facade\SearchFacade + * @var SearchFacade */ private $searchFacade; - public function __construct(RandomDataGenerator $randomDataGenerator, SearchFacade $searchFacade) - { + public function __construct( + RandomDataGenerator $randomDataGenerator, + SearchFacade $searchFacade + ) { parent::__construct($randomDataGenerator); $this->searchFacade = $searchFacade; } @@ -40,8 +42,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_richtext' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB'): string - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ): string { $this->setLanguage($language); $randomNumber = $this->randomDataGenerator->getRandomProbability(); diff --git a/src/lib/API/ContentData/FieldTypeData/SelectionDataProvider.php b/src/lib/API/ContentData/FieldTypeData/SelectionDataProvider.php index 22d062af..728d222d 100644 --- a/src/lib/API/ContentData/FieldTypeData/SelectionDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/SelectionDataProvider.php @@ -25,8 +25,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_selection' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { $fieldSettings = $this->contentTypeService->loadContentTypeByIdentifier($contentTypeIdentifier)->getFieldDefinition($fieldIdentifier)->getFieldSettings(); $isMultiple = $fieldSettings['isMultiple']; diff --git a/src/lib/API/ContentData/FieldTypeData/TextBlockDataProvider.php b/src/lib/API/ContentData/FieldTypeData/TextBlockDataProvider.php index ce21ffba..9d3532f7 100644 --- a/src/lib/API/ContentData/FieldTypeData/TextBlockDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/TextBlockDataProvider.php @@ -15,8 +15,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_text' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB'): string - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ): string { $this->setLanguage($language); return $this->getFaker()->paragraphs(5, true); diff --git a/src/lib/API/ContentData/FieldTypeData/TextLineDataProvider.php b/src/lib/API/ContentData/FieldTypeData/TextLineDataProvider.php index 204dee85..a2f03058 100644 --- a/src/lib/API/ContentData/FieldTypeData/TextLineDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/TextLineDataProvider.php @@ -17,8 +17,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_string' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB'): Value - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ): Value { $this->setLanguage($language); return new Value($this->getFaker()->realText(80, 1)); diff --git a/src/lib/API/ContentData/FieldTypeData/TimeDataProvider.php b/src/lib/API/ContentData/FieldTypeData/TimeDataProvider.php index 4c727642..1707b9cd 100644 --- a/src/lib/API/ContentData/FieldTypeData/TimeDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/TimeDataProvider.php @@ -18,8 +18,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_time' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { return Value::fromDateTime($this->getFaker()->dateTimeThisCentury()); } diff --git a/src/lib/API/ContentData/FieldTypeData/URLDataProvider.php b/src/lib/API/ContentData/FieldTypeData/URLDataProvider.php index 5529959c..547b09fa 100644 --- a/src/lib/API/ContentData/FieldTypeData/URLDataProvider.php +++ b/src/lib/API/ContentData/FieldTypeData/URLDataProvider.php @@ -17,8 +17,11 @@ public function supports(string $fieldTypeIdentifier): bool return 'ibexa_url' === $fieldTypeIdentifier; } - public function generateData(string $contentTypeIdentifier, string $fieldIdentifier, string $language = 'eng-GB') - { + public function generateData( + string $contentTypeIdentifier, + string $fieldIdentifier, + string $language = 'eng-GB' + ) { return new Value($this->getFaker()->url, $this->getFaker()->realText(80, 1)); } diff --git a/src/lib/API/Context/ContentContext.php b/src/lib/API/Context/ContentContext.php index 6d7aedfb..66b8dc55 100644 --- a/src/lib/API/Context/ContentContext.php +++ b/src/lib/API/Context/ContentContext.php @@ -15,14 +15,16 @@ class ContentContext implements Context { - /** @var \Ibexa\Behat\API\Facade\ContentFacade */ + /** @var ContentFacade */ private $contentFacade; - /** @var \Ibexa\Behat\Core\Behat\ArgumentParser */ + /** @var ArgumentParser */ private $argumentParser; - public function __construct(ContentFacade $contentFacade, ArgumentParser $argumentParser) - { + public function __construct( + ContentFacade $contentFacade, + ArgumentParser $argumentParser + ) { $this->contentFacade = $contentFacade; $this->argumentParser = $argumentParser; } @@ -32,8 +34,12 @@ public function __construct(ContentFacade $contentFacade, ArgumentParser $argume * * @param mixed $language */ - public function createMultipleContentItems(string $numberOfItems, string $contentTypeIdentifier, string $parentUrl, $language): void - { + public function createMultipleContentItems( + string $numberOfItems, + string $contentTypeIdentifier, + string $parentUrl, + $language + ): void { $parentUrl = $this->argumentParser->parseUrl($parentUrl); for ($i = 0; $i < $numberOfItems; ++$i) { @@ -44,8 +50,12 @@ public function createMultipleContentItems(string $numberOfItems, string $conten /** * @Given a :contentTypeIdentifier Content item named :contentName exists in :parentUrl */ - public function contentItemExists(string $contentTypeIdentifier, string $contentName, string $parentUrl, TableNode $contentItemData): void - { + public function contentItemExists( + string $contentTypeIdentifier, + string $contentName, + string $parentUrl, + TableNode $contentItemData + ): void { $parentUrl = $this->argumentParser->parseUrl($parentUrl); $contentUrl = sprintf('%s/%s', $parentUrl, $this->argumentParser->parseUrl($contentName)); $contentData = $this->parseData($contentItemData)[0]; @@ -59,8 +69,12 @@ public function contentItemExists(string $contentTypeIdentifier, string $content * @param mixed $parentUrl * @param mixed $language */ - public function createContentItems($contentTypeIdentifier, $parentUrl, $language, TableNode $contentItemsData): void - { + public function createContentItems( + $contentTypeIdentifier, + $parentUrl, + $language, + TableNode $contentItemsData + ): void { $parentUrl = $this->argumentParser->parseUrl($parentUrl); $parsedContentItemData = $this->parseData($contentItemsData); @@ -74,8 +88,10 @@ public function createContentItems($contentTypeIdentifier, $parentUrl, $language * * @param mixed $contentTypeIdentifier */ - public function createContentItemsInDifferentLocations($contentTypeIdentifier, TableNode $contentItemsData): void - { + public function createContentItemsInDifferentLocations( + $contentTypeIdentifier, + TableNode $contentItemsData + ): void { $parsedContentItemData = $this->parseData($contentItemsData); foreach ($parsedContentItemData as $contentItemData) { @@ -92,8 +108,10 @@ public function createContentItemsInDifferentLocations($contentTypeIdentifier, T * * @param mixed $contentTypeIdentifier */ - public function createContentDraftsInDifferentLocations($contentTypeIdentifier, TableNode $contentItemsData): void - { + public function createContentDraftsInDifferentLocations( + $contentTypeIdentifier, + TableNode $contentItemsData + ): void { $parsedContentItemData = $this->parseData($contentItemsData); foreach ($parsedContentItemData as $contentItemData) { @@ -111,8 +129,11 @@ public function createContentDraftsInDifferentLocations($contentTypeIdentifier, * @param mixed $locationURL * @param mixed $language */ - public function editContentItem($locationURL, $language, TableNode $contentItemsData): void - { + public function editContentItem( + $locationURL, + $language, + TableNode $contentItemsData + ): void { $locationURL = $this->argumentParser->parseUrl($locationURL); $parsedContentItemData = $this->parseData($contentItemsData); @@ -127,8 +148,11 @@ public function editContentItem($locationURL, $language, TableNode $contentItems * @param mixed $locationURL * @param mixed $language */ - public function createNewDraftForExistingItem($locationURL, $language, TableNode $contentItemsData): void - { + public function createNewDraftForExistingItem( + $locationURL, + $language, + TableNode $contentItemsData + ): void { $locationURL = $this->argumentParser->parseUrl($locationURL); $parsedContentItemData = $this->parseData($contentItemsData); diff --git a/src/lib/API/Context/ContentTypeContext.php b/src/lib/API/Context/ContentTypeContext.php index f1130580..82cb4e4b 100644 --- a/src/lib/API/Context/ContentTypeContext.php +++ b/src/lib/API/Context/ContentTypeContext.php @@ -15,7 +15,7 @@ class ContentTypeContext implements Context { - /** @var \Ibexa\Behat\API\Facade\ContentTypeFacade */ + /** @var ContentTypeFacade */ private $contentTypeFacade; public function __construct(ContentTypeFacade $contentTypeFacade) @@ -30,8 +30,12 @@ public function __construct(ContentTypeFacade $contentTypeFacade) * @param mixed $contentTypeGroupName * @param mixed $contentTypeIdentifier */ - public function iCreateAContentTypeWithIdentifier($contentTypeName, $contentTypeGroupName, $contentTypeIdentifier, TableNode $fieldDetails): void - { + public function iCreateAContentTypeWithIdentifier( + $contentTypeName, + $contentTypeGroupName, + $contentTypeIdentifier, + TableNode $fieldDetails + ): void { if ($this->contentTypeFacade->contentTypeExists($contentTypeIdentifier)) { return; } @@ -73,8 +77,10 @@ private function parseBool(string $value): bool return 'yes' === $value || 'true' === $value; } - private function parseFieldSettings(string $fieldTypeIdentifier, string $settings) - { + private function parseFieldSettings( + string $fieldTypeIdentifier, + string $settings + ) { $parsedSettings = []; switch ($fieldTypeIdentifier) { case 'ibexa_content_query': diff --git a/src/lib/API/Context/LanguageContext.php b/src/lib/API/Context/LanguageContext.php index f399c888..b67fcf92 100644 --- a/src/lib/API/Context/LanguageContext.php +++ b/src/lib/API/Context/LanguageContext.php @@ -14,7 +14,7 @@ class LanguageContext implements Context { /** - * @var \Ibexa\Behat\API\Facade\LanguageFacade + * @var LanguageFacade */ private $languageFacade; @@ -26,8 +26,10 @@ public function __construct(LanguageFacade $languageFacade) /** * @Given Language :name with code :languageCode exists */ - public function createLanguageIfNotExists(string $name, string $languageCode) - { + public function createLanguageIfNotExists( + string $name, + string $languageCode + ) { $this->languageFacade->createLanguageIfNotExists($name, $languageCode); } } diff --git a/src/lib/API/Context/LimitationParser/LimitationParsersCollector.php b/src/lib/API/Context/LimitationParser/LimitationParsersCollector.php index a077215b..4cab3314 100644 --- a/src/lib/API/Context/LimitationParser/LimitationParsersCollector.php +++ b/src/lib/API/Context/LimitationParser/LimitationParsersCollector.php @@ -10,11 +10,11 @@ class LimitationParsersCollector { - /** @var \Ibexa\Behat\API\Context\LimitationParser\LimitationParserInterface[] */ + /** @var LimitationParserInterface[] */ private $limitationParsers; /** - * @param \Ibexa\Behat\API\Context\LimitationParser\LimitationParserInterface[] $limitationParsers + * @param LimitationParserInterface[] $limitationParsers */ public function __construct(array $limitationParsers = []) { @@ -27,7 +27,7 @@ public function addLimitationParser(LimitationParserInterface $limitationParser) } /** - * @return \Ibexa\Behat\API\Context\LimitationParser\LimitationParserInterface[] + * @return LimitationParserInterface[] */ public function getLimitationParsers(): array { diff --git a/src/lib/API/Context/LimitationParser/LocationLimitationParser.php b/src/lib/API/Context/LimitationParser/LocationLimitationParser.php index 97bf6167..34551d7c 100644 --- a/src/lib/API/Context/LimitationParser/LocationLimitationParser.php +++ b/src/lib/API/Context/LimitationParser/LocationLimitationParser.php @@ -23,8 +23,11 @@ class LocationLimitationParser implements LimitationParserInterface private $argumentParser; - public function __construct(URLAliasService $urlAliasService, LocationService $locationService, ArgumentParser $argumentParser) - { + public function __construct( + URLAliasService $urlAliasService, + LocationService $locationService, + ArgumentParser $argumentParser + ) { $this->urlAliasService = $urlAliasService; $this->locationService = $locationService; $this->argumentParser = $argumentParser; diff --git a/src/lib/API/Context/LimitationParser/SubtreeLimitationParser.php b/src/lib/API/Context/LimitationParser/SubtreeLimitationParser.php index 3ba24f69..0c1ad881 100644 --- a/src/lib/API/Context/LimitationParser/SubtreeLimitationParser.php +++ b/src/lib/API/Context/LimitationParser/SubtreeLimitationParser.php @@ -19,8 +19,10 @@ class SubtreeLimitationParser implements LimitationParserInterface private $urlAliasService; - public function __construct(URLAliasService $urlAliasService, LocationService $locationService) - { + public function __construct( + URLAliasService $urlAliasService, + LocationService $locationService + ) { $this->urlAliasService = $urlAliasService; $this->locationService = $locationService; } diff --git a/src/lib/API/Context/ObjectStateContext.php b/src/lib/API/Context/ObjectStateContext.php index 6c56bca2..4e4fbfef 100644 --- a/src/lib/API/Context/ObjectStateContext.php +++ b/src/lib/API/Context/ObjectStateContext.php @@ -15,7 +15,7 @@ class ObjectStateContext implements Context { - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ + /** @var ObjectStateService */ private $objectStateService; public function __construct(ObjectStateService $objectStateService) @@ -26,8 +26,11 @@ public function __construct(ObjectStateService $objectStateService) /** * @Given Object State Group :objectStateGroupName with identifier :objectStateGroupIdentifier exists */ - public function objectStateWithIdentifierExists(string $objectStateGroupName, string $objectStateGroupIdentifier, TableNode $objectStates): void - { + public function objectStateWithIdentifierExists( + string $objectStateGroupName, + string $objectStateGroupIdentifier, + TableNode $objectStates + ): void { $objectStateGroupStruct = $this->objectStateService->newObjectStateGroupCreateStruct($objectStateGroupIdentifier); $objectStateGroupStruct->defaultLanguageCode = 'eng-GB'; $objectStateGroupStruct->names = ['eng-GB' => $objectStateGroupName]; diff --git a/src/lib/API/Context/RoleContext.php b/src/lib/API/Context/RoleContext.php index b44477d6..86460c69 100644 --- a/src/lib/API/Context/RoleContext.php +++ b/src/lib/API/Context/RoleContext.php @@ -15,14 +15,16 @@ class RoleContext implements Context { - /** @var \Ibexa\Behat\API\Facade\RoleFacade */ + /** @var RoleFacade */ private $roleFacade; - /** @var \Ibexa\Behat\Core\Behat\ArgumentParser */ + /** @var ArgumentParser */ private $argumentParser; - public function __construct(RoleFacade $roleFacade, ArgumentParser $argumentParser) - { + public function __construct( + RoleFacade $roleFacade, + ArgumentParser $argumentParser + ) { $this->roleFacade = $roleFacade; $this->argumentParser = $argumentParser; } @@ -42,8 +44,10 @@ public function createRole(string $roleName): void /** * @Given I create a role :roleName with policies */ - public function createRoleWithPolicies(string $roleName, TableNode $policies): void - { + public function createRoleWithPolicies( + string $roleName, + TableNode $policies + ): void { if ($this->roleFacade->roleExist($roleName)) { return; } @@ -60,8 +64,10 @@ public function createRoleWithPolicies(string $roleName, TableNode $policies): v * * @param mixed $roleName */ - public function addPolicyToRole($roleName, TableNode $policies): void - { + public function addPolicyToRole( + $roleName, + TableNode $policies + ): void { foreach ($policies as $policy) { $this->roleFacade->addPolicyToRole($roleName, $policy['module'], $policy['function']); } @@ -72,8 +78,12 @@ public function addPolicyToRole($roleName, TableNode $policies): void * * @param mixed $roleName */ - public function addPolicyToRoleWithLimitation(string $module, string $function, $roleName, TableNode $limitations): void - { + public function addPolicyToRoleWithLimitation( + string $module, + string $function, + $roleName, + TableNode $limitations + ): void { $parsedLimitations = $this->argumentParser->parseLimitations($limitations); $this->roleFacade->addPolicyToRole($roleName, $module, $function, $parsedLimitations); } diff --git a/src/lib/API/Context/TestContext.php b/src/lib/API/Context/TestContext.php index 0ea415e2..1eff2b91 100644 --- a/src/lib/API/Context/TestContext.php +++ b/src/lib/API/Context/TestContext.php @@ -18,8 +18,10 @@ class TestContext implements Context private $userService; - public function __construct(UserService $userService, PermissionResolver $permissionResolver) - { + public function __construct( + UserService $userService, + PermissionResolver $permissionResolver + ) { $this->userService = $userService; $this->permissionResolver = $permissionResolver; } diff --git a/src/lib/API/Context/TrashContext.php b/src/lib/API/Context/TrashContext.php index a5d86588..b489ceea 100644 --- a/src/lib/API/Context/TrashContext.php +++ b/src/lib/API/Context/TrashContext.php @@ -14,14 +14,16 @@ class TrashContext implements Context { - /** @var \Ibexa\Behat\API\Facade\TrashFacade */ + /** @var TrashFacade */ private $trashFacade; - /** @var \Ibexa\Behat\Core\Behat\ArgumentParser */ + /** @var ArgumentParser */ private $argumentParser; - public function __construct(TrashFacade $trashFacade, ArgumentParser $argumentParser) - { + public function __construct( + TrashFacade $trashFacade, + ArgumentParser $argumentParser + ) { $this->trashFacade = $trashFacade; $this->argumentParser = $argumentParser; } diff --git a/src/lib/API/Context/UserContext.php b/src/lib/API/Context/UserContext.php index 4cb876f7..4c0eb23f 100644 --- a/src/lib/API/Context/UserContext.php +++ b/src/lib/API/Context/UserContext.php @@ -16,14 +16,16 @@ class UserContext implements Context { - /** @var \Ibexa\Behat\API\Facade\UserFacade */ + /** @var UserFacade */ private $userFacade; - /** @var \Ibexa\Behat\Core\Behat\ArgumentParser */ + /** @var ArgumentParser */ private $argumentParser; - public function __construct(UserFacade $userFacade, ArgumentParser $argumentParser) - { + public function __construct( + UserFacade $userFacade, + ArgumentParser $argumentParser + ) { $this->userFacade = $userFacade; $this->argumentParser = $argumentParser; } @@ -42,24 +44,32 @@ public function createUseGroup(string $userGroupName): void * @Given I create a user :userName with last name :userLastName with email :userEmail * @Given I create a user :userName with last name :userLastName in group :userGroupName with email :userEmail */ - public function createUserInGroupWithEmail(string $userName, string $userLastName, ?string $userGroupName = null, ?string $userEmail = null): void - { + public function createUserInGroupWithEmail( + string $userName, + string $userLastName, + ?string $userGroupName = null, + ?string $userEmail = null + ): void { $this->userFacade->createUser($userName, $userLastName, $userGroupName, $userEmail); } /** * @Given I assign user :userName to role :roleName */ - public function assignUserToRole(string $userName, string $roleName): void - { + public function assignUserToRole( + string $userName, + string $roleName + ): void { $this->userFacade->assignUserToRole($userName, $roleName); } /** * @Given I assign user :userName to role :roleIdentifier if possible */ - public function assignUserToRoleIfPossible(string $userName, string $roleIdentifier): void - { + public function assignUserToRoleIfPossible( + string $userName, + string $roleIdentifier + ): void { try { $this->assignUserToRole($userName, $roleIdentifier); } catch (NotFoundException $e) { @@ -69,8 +79,10 @@ public function assignUserToRoleIfPossible(string $userName, string $roleIdentif /** * @Given I assign user group :userGroupName to role :roleIdentifier if possible */ - public function assignUserGroupToRoleIfPossible(string $userGroupName, string $roleIdentifier): void - { + public function assignUserGroupToRoleIfPossible( + string $userGroupName, + string $roleIdentifier + ): void { try { $this->assignUserGroupToRole($userGroupName, $roleIdentifier); } catch (NotFoundException $e) { @@ -81,8 +93,11 @@ public function assignUserGroupToRoleIfPossible(string $userGroupName, string $r * @Given I assign user group :groupName to role :roleName * @Given I assign user group :groupName to role :roleName with limitations: */ - public function assignUserGroupToRole(string $userGroupName, string $roleName, ?TableNode $limitationData = null): void - { + public function assignUserGroupToRole( + string $userGroupName, + string $roleName, + ?TableNode $limitationData = null + ): void { $parsedLimitations = null === $limitationData ? null : $this->argumentParser->parseLimitations($limitationData); if (is_array($parsedLimitations) && count($parsedLimitations) > 1) { diff --git a/src/lib/API/Facade/ContentFacade.php b/src/lib/API/Facade/ContentFacade.php index d729bac8..a68d2d33 100644 --- a/src/lib/API/Facade/ContentFacade.php +++ b/src/lib/API/Facade/ContentFacade.php @@ -22,22 +22,22 @@ class ContentFacade { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Ibexa\Contracts\Core\Repository\URLAliasService */ + /** @var URLAliasService */ private $urlAliasService; - /** @var \Ibexa\Behat\API\ContentData\ContentDataProvider */ + /** @var ContentDataProvider */ private $contentDataProvider; - /** @var \FOS\HttpCacheBundle\CacheManager */ + /** @var CacheManager */ private $cacheManager; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ + /** @var Repository */ private $repository; public function __construct( @@ -56,8 +56,12 @@ public function __construct( $this->repository = $repository; } - public function createContentDraft($contentTypeIdentifier, $parentUrl, $language, $contentItemData = null): Content - { + public function createContentDraft( + $contentTypeIdentifier, + $parentUrl, + $language, + $contentItemData = null + ): Content { $parentUrlAlias = $this->urlAliasService->lookup($parentUrl); Assert::assertEquals(URLAlias::LOCATION, $parentUrlAlias->type); @@ -75,8 +79,12 @@ public function createContentDraft($contentTypeIdentifier, $parentUrl, $language return $this->contentService->createContent($contentCreateStruct, [$locationCreateStruct]); } - public function createContent($contentTypeIdentifier, $parentUrl, $language, $contentItemData = null): Content - { + public function createContent( + $contentTypeIdentifier, + $parentUrl, + $language, + $contentItemData = null + ): Content { $draft = $this->createContentDraft($contentTypeIdentifier, $parentUrl, $language, $contentItemData); $publishedContent = $this->contentService->publishVersion($draft->versionInfo); @@ -85,8 +93,11 @@ public function createContent($contentTypeIdentifier, $parentUrl, $language, $co return $publishedContent; } - public function editContent($locationURL, $language, $contentItemData): Content - { + public function editContent( + $locationURL, + $language, + $contentItemData + ): Content { $updatedDraft = $this->createDraftForExistingContent($locationURL, $language, $contentItemData); $publishedContent = $this->contentService->publishVersion($updatedDraft->getVersionInfo()); $this->flushHTTPcache(); @@ -94,8 +105,11 @@ public function editContent($locationURL, $language, $contentItemData): Content return $publishedContent; } - public function createDraftForExistingContent($locationURL, $language, $contentItemData): Content - { + public function createDraftForExistingContent( + $locationURL, + $language, + $contentItemData + ): Content { $urlAlias = $this->urlAliasService->lookup($locationURL); Assert::assertEquals(URLAlias::LOCATION, $urlAlias->type); @@ -130,8 +144,13 @@ private function flushHTTPcache(): void $this->cacheManager->flush(); } - public function createContentIfNotExists(string $contentTypeIdentifier, string $contentUrl, string $parentUrl, array $contentItemData, string $language = 'eng-GB'): void - { + public function createContentIfNotExists( + string $contentTypeIdentifier, + string $contentUrl, + string $parentUrl, + array $contentItemData, + string $language = 'eng-GB' + ): void { if ($this->contentExists($contentUrl)) { return; } diff --git a/src/lib/API/Facade/ContentTypeFacade.php b/src/lib/API/Facade/ContentTypeFacade.php index fe4d5e13..54c98bb0 100644 --- a/src/lib/API/Facade/ContentTypeFacade.php +++ b/src/lib/API/Facade/ContentTypeFacade.php @@ -22,13 +22,13 @@ class ContentTypeFacade private const CONTENT_TYPE_LIST_BY_GROUP_IDENTIFIER = 'content_type_list_by_group'; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Symfony\Component\Cache\Adapter\TagAwareAdapterInterface */ + /** @var TagAwareAdapterInterface */ private $cachePool; - /** @var \Ibexa\Core\Persistence\Cache\Identifier\CacheIdentifierGeneratorInterface */ + /** @var CacheIdentifierGeneratorInterface */ private $cacheIdentifierGenerator; public function __construct( @@ -41,8 +41,14 @@ public function __construct( $this->cacheIdentifierGenerator = $cacheIdentifierGenerator; } - public function createContentType(string $contentTypeName, string $contentTypeIdentifier, string $contentTypeGroupName, string $mainLanguageCode, bool $isContainer, array $fieldDefinitions) - { + public function createContentType( + string $contentTypeName, + string $contentTypeIdentifier, + string $contentTypeGroupName, + string $mainLanguageCode, + bool $isContainer, + array $fieldDefinitions + ) { $contentTypeCreateStruct = $this->contentTypeService->newContentTypeCreateStruct($contentTypeIdentifier); $contentTypeCreateStruct->names = [$mainLanguageCode => $contentTypeName]; $contentTypeCreateStruct->mainLanguageCode = $mainLanguageCode; @@ -84,8 +90,10 @@ private function getNameSchema(array $fieldDefinitions): string return sprintf('<%s>', implode('|', $fieldDefinitionIdentifiers)); } - private function assertContentTypeExistsInGroup(string $contentTypeIdentifier, ContentTypeGroup $contentTypeGroup): void - { + private function assertContentTypeExistsInGroup( + string $contentTypeIdentifier, + ContentTypeGroup $contentTypeGroup + ): void { // Workaround for https://jira.ez.no/browse/EZP-32102: make sure the Content Type is loadable $contentTypeIdentifiersInGroup = array_map(static function (ContentType $contentType) { return $contentType->identifier; diff --git a/src/lib/API/Facade/LanguageFacade.php b/src/lib/API/Facade/LanguageFacade.php index 9b6d5166..aac71c7d 100644 --- a/src/lib/API/Facade/LanguageFacade.php +++ b/src/lib/API/Facade/LanguageFacade.php @@ -13,7 +13,7 @@ class LanguageFacade { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; public function __construct(LanguageService $languageService) @@ -21,8 +21,10 @@ public function __construct(LanguageService $languageService) $this->languageService = $languageService; } - public function createLanguageIfNotExists(string $name, string $languageCode) - { + public function createLanguageIfNotExists( + string $name, + string $languageCode + ) { try { $this->languageService->loadLanguage($languageCode); } catch (NotFoundException $e) { @@ -30,8 +32,10 @@ public function createLanguageIfNotExists(string $name, string $languageCode) } } - public function createLanguage(string $name, string $languageCode) - { + public function createLanguage( + string $name, + string $languageCode + ) { $languageCreateStruct = $this->languageService->newLanguageCreateStruct(); $languageCreateStruct->languageCode = $languageCode; $languageCreateStruct->name = $name; diff --git a/src/lib/API/Facade/RoleFacade.php b/src/lib/API/Facade/RoleFacade.php index ee7594bd..23ce9dbc 100644 --- a/src/lib/API/Facade/RoleFacade.php +++ b/src/lib/API/Facade/RoleFacade.php @@ -8,20 +8,23 @@ namespace Ibexa\Behat\API\Facade; +use Ibexa\Behat\API\Context\LimitationParser\LimitationParserInterface; use Ibexa\Behat\API\Context\LimitationParser\LimitationParsersCollector; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\RoleService; class RoleFacade { - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ private $roleService; - /** @var \Ibexa\Behat\API\Context\LimitationParser\LimitationParsersCollector */ + /** @var LimitationParsersCollector */ private $limitationParsersCollector; - public function __construct(RoleService $roleService, LimitationParsersCollector $limitationParsersCollector) - { + public function __construct( + RoleService $roleService, + LimitationParsersCollector $limitationParsersCollector + ) { $this->roleService = $roleService; $this->limitationParsersCollector = $limitationParsersCollector; } @@ -33,8 +36,12 @@ public function createRole($roleName) $this->roleService->publishRoleDraft($roleDraft); } - public function addPolicyToRole($roleName, $module, $function, $limitations = null) - { + public function addPolicyToRole( + $roleName, + $module, + $function, + $limitations = null + ) { $role = $this->roleService->loadRoleByIdentifier($roleName); $roleDraft = $this->roleService->createRoleDraft($role); $policyCreateStruct = $this->roleService->newPolicyCreateStruct($module, $function); @@ -62,7 +69,7 @@ public function roleExist($roleName): bool } /** - * @return \Ibexa\Behat\API\Context\LimitationParser\LimitationParserInterface[] + * @return LimitationParserInterface[] */ public function getLimitationParsers(): array { diff --git a/src/lib/API/Facade/SearchFacade.php b/src/lib/API/Facade/SearchFacade.php index 991597a7..2bf602bf 100644 --- a/src/lib/API/Facade/SearchFacade.php +++ b/src/lib/API/Facade/SearchFacade.php @@ -23,24 +23,28 @@ class SearchFacade { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Ibexa\Contracts\Core\Repository\URLAliasService */ + /** @var URLAliasService */ private $urlAliasService; - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ + /** @var SearchService */ private $searchService; /** - * @var \Ibexa\Contracts\Core\Repository\ContentService + * @var ContentService */ private $contentService; private const ROOT_LOCATION_ID = 2; - public function __construct(URLAliasService $urlAliasService, LocationService $locationService, SearchService $searchService, ContentService $contentService) - { + public function __construct( + URLAliasService $urlAliasService, + LocationService $locationService, + SearchService $searchService, + ContentService $contentService + ) { $this->urlAliasService = $urlAliasService; $this->locationService = $locationService; $this->searchService = $searchService; diff --git a/src/lib/API/Facade/TrashFacade.php b/src/lib/API/Facade/TrashFacade.php index 7c989508..8c6dd793 100644 --- a/src/lib/API/Facade/TrashFacade.php +++ b/src/lib/API/Facade/TrashFacade.php @@ -16,17 +16,20 @@ class TrashFacade { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Ibexa\Contracts\Core\Repository\URLAliasService */ + /** @var URLAliasService */ private $urlAliasService; - /** @var \Ibexa\Contracts\Core\Repository\TrashService */ + /** @var TrashService */ private $trashService; - public function __construct(LocationService $locationService, URLAliasService $urlAliasService, TrashService $trashService) - { + public function __construct( + LocationService $locationService, + URLAliasService $urlAliasService, + TrashService $trashService + ) { $this->locationService = $locationService; $this->urlAliasService = $urlAliasService; $this->trashService = $trashService; diff --git a/src/lib/API/Facade/UserFacade.php b/src/lib/API/Facade/UserFacade.php index 3efef45a..2eed6385 100644 --- a/src/lib/API/Facade/UserFacade.php +++ b/src/lib/API/Facade/UserFacade.php @@ -14,6 +14,7 @@ use Ibexa\Contracts\Core\Repository\RoleService; use Ibexa\Contracts\Core\Repository\SearchService; use Ibexa\Contracts\Core\Repository\UserService; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\RoleLimitation; @@ -26,25 +27,30 @@ class UserFacade public const USERGROUP_CONTENT_IDENTIFIER = 'user_group'; public const ROOT_USERGROUP_CONTENT_ID = 4; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ private $roleService; - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ + /** @var SearchService */ private $searchService; /** - * @var \Ibexa\Behat\API\ContentData\RandomDataGenerator + * @var RandomDataGenerator */ private $randomDataGenerator; - public function __construct(UserService $userService, ContentTypeService $contentTypeService, RoleService $roleService, SearchService $searchService, RandomDataGenerator $randomDataGenerator) - { + public function __construct( + UserService $userService, + ContentTypeService $contentTypeService, + RoleService $roleService, + SearchService $searchService, + RandomDataGenerator $randomDataGenerator + ) { $this->userService = $userService; $this->contentTypeService = $contentTypeService; $this->roleService = $roleService; @@ -64,8 +70,13 @@ public function createUserGroup(string $groupName) $this->userService->createUserGroup($userGroupStruct, $parentGroup); } - public function createUser($userName, $userLastName, $userGroupName = null, $userEmail = null, $languageCode = 'eng-GB') - { + public function createUser( + $userName, + $userLastName, + $userGroupName = null, + $userEmail = null, + $languageCode = 'eng-GB' + ) { $userEmail = $userEmail ?? $this->randomDataGenerator->getFaker()->email; $userCreateStruct = $this->userService->newUserCreateStruct( $userName, @@ -85,16 +96,21 @@ public function createUser($userName, $userLastName, $userGroupName = null, $use $this->userService->createUser($userCreateStruct, [$parentGroup]); } - public function assignUserToRole($userName, $roleName) - { + public function assignUserToRole( + $userName, + $roleName + ) { $user = $this->userService->loadUserByLogin($userName); $role = $this->roleService->loadRoleByIdentifier($roleName); $this->roleService->assignRoleToUser($role, $user); } - public function assignUserGroupToRole($userGroupName, $roleName, ?RoleLimitation $roleLimitation = null) - { + public function assignUserGroupToRole( + $userGroupName, + $roleName, + ?RoleLimitation $roleLimitation = null + ) { $group = $this->loadUserGroupByName($userGroupName); $role = $this->roleService->loadRoleByIdentifier($roleName); @@ -141,7 +157,7 @@ private function loadLegacyUserGroupByName(string $userGroupName): UserGroup $result = $this->searchService->findContent($query); foreach ($result->searchHits as $searchHit) { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $searchHit->valueObject; if ($content->contentInfo->name === $userGroupName) { diff --git a/src/lib/Browser/Assert/CollectionAssert.php b/src/lib/Browser/Assert/CollectionAssert.php index 7119d9b9..23c90d36 100644 --- a/src/lib/Browser/Assert/CollectionAssert.php +++ b/src/lib/Browser/Assert/CollectionAssert.php @@ -16,17 +16,19 @@ class CollectionAssert implements CollectionAssertInterface { /** - * @var \Ibexa\Behat\Browser\Locator\LocatorInterface + * @var LocatorInterface */ private $locator; /** - * @var \Ibexa\Behat\Browser\Element\ElementCollectionInterface + * @var ElementCollectionInterface */ private $elementCollection; - public function __construct(LocatorInterface $locator, ElementCollectionInterface $elementCollection) - { + public function __construct( + LocatorInterface $locator, + ElementCollectionInterface $elementCollection + ) { $this->locator = $locator; $this->elementCollection = $elementCollection; } diff --git a/src/lib/Browser/Assert/Debug/Interactive/CollectionAssert.php b/src/lib/Browser/Assert/Debug/Interactive/CollectionAssert.php index 7873a299..29351c2f 100644 --- a/src/lib/Browser/Assert/Debug/Interactive/CollectionAssert.php +++ b/src/lib/Browser/Assert/Debug/Interactive/CollectionAssert.php @@ -17,7 +17,7 @@ class CollectionAssert implements CollectionAssertInterface { use InteractiveDebuggerTrait; - /** @var \Ibexa\Behat\Browser\Assert\CollectionAssertInterface */ + /** @var CollectionAssertInterface */ private $baseCollectionAssert; public function __construct(CollectionAssertInterface $baseCollectionAssert) diff --git a/src/lib/Browser/Assert/ElementAssert.php b/src/lib/Browser/Assert/ElementAssert.php index a133212a..a6fd27d5 100644 --- a/src/lib/Browser/Assert/ElementAssert.php +++ b/src/lib/Browser/Assert/ElementAssert.php @@ -15,17 +15,19 @@ class ElementAssert implements ElementAssertInterface { /** - * @var \Ibexa\Behat\Browser\Locator\LocatorInterface + * @var LocatorInterface */ private $locator; /** - * @var \Ibexa\Behat\Browser\Element\ElementInterface + * @var ElementInterface */ private $element; - public function __construct(LocatorInterface $locator, ElementInterface $element) - { + public function __construct( + LocatorInterface $locator, + ElementInterface $element + ) { $this->locator = $locator; $this->element = $element; } diff --git a/src/lib/Browser/Component/Component.php b/src/lib/Browser/Component/Component.php index 7e4f0794..6d1f086a 100644 --- a/src/lib/Browser/Component/Component.php +++ b/src/lib/Browser/Component/Component.php @@ -10,6 +10,7 @@ use Behat\Mink\Session; use Facebook\WebDriver\Chrome\ChromeDevToolsDriver; +use Facebook\WebDriver\Remote\RemoteWebDriver; use Ibexa\Behat\Browser\Element\ElementCollectionInterface; use Ibexa\Behat\Browser\Element\ElementInterface; use Ibexa\Behat\Browser\Element\Factory\Debug\Highlighting\ElementFactory as HighlightingDebugElementFactory; @@ -22,19 +23,17 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException; use OAndreyev\Mink\Driver\WebDriver; -class DevToolsDriverUnavailableException extends \RuntimeException -{ -} +class DevToolsDriverUnavailableException extends \RuntimeException {} abstract class Component implements ComponentInterface { - /** @var \Ibexa\Behat\Browser\Locator\LocatorCollection */ + /** @var LocatorCollection */ protected $locators; - /** @var \Behat\Mink\Session */ + /** @var Session */ private $session; - /** @var \Ibexa\Behat\Browser\Element\Factory\ElementFactoryInterface */ + /** @var ElementFactoryInterface */ private $elementFactory; public function __construct(Session $session) @@ -85,7 +84,7 @@ protected function getDevToolsDriver(): ChromeDevToolsDriver throw new DevToolsDriverUnavailableException('Error happened when accessing the WebDriver'); } - if (!($webDriver instanceof \Facebook\WebDriver\Remote\RemoteWebDriver)) { + if (!($webDriver instanceof RemoteWebDriver)) { throw new DevToolsDriverUnavailableException('Expected instance of Facebook\\WebDriver\\Remote\\RemoteWebDriver, got ' . (is_object($webDriver) ? get_class($webDriver) : gettype($webDriver))); } @@ -93,7 +92,7 @@ protected function getDevToolsDriver(): ChromeDevToolsDriver } /** - * @return \Ibexa\Behat\Browser\Locator\LocatorInterface[] + * @return LocatorInterface[] */ abstract protected function specifyLocators(): array; @@ -102,8 +101,10 @@ final protected function getLocator(string $identifier): LocatorInterface return $this->locators->get($identifier); } - public function enableDebugging(bool $interactive = true, bool $highlighting = true): ElementFactoryInterface - { + public function enableDebugging( + bool $interactive = true, + bool $highlighting = true + ): ElementFactoryInterface { $oldFactory = $this->elementFactory; $factory = new ElementFactory(); diff --git a/src/lib/Browser/Context/AuthenticationContext.php b/src/lib/Browser/Context/AuthenticationContext.php index c1c45d9f..0e7c5327 100644 --- a/src/lib/Browser/Context/AuthenticationContext.php +++ b/src/lib/Browser/Context/AuthenticationContext.php @@ -19,8 +19,10 @@ class AuthenticationContext extends RawMinkContext private RedirectLoginPage $redirectLoginPage; - public function __construct(LoginPage $loginPage, RedirectLoginPage $redirectLoginPage) - { + public function __construct( + LoginPage $loginPage, + RedirectLoginPage $redirectLoginPage + ) { $this->loginPage = $loginPage; $this->redirectLoginPage = $redirectLoginPage; } @@ -29,8 +31,10 @@ public function __construct(LoginPage $loginPage, RedirectLoginPage $redirectLog * @Given I log in as :username * @Given I log in as :username with password :password */ - public function iLogInIn(string $username, ?string $password = null) - { + public function iLogInIn( + string $username, + ?string $password = null + ) { $password = $password ?? PasswordProvider::DEFAUlT_PASSWORD; $this->loginPage->loginSuccessfully($username, $password); } @@ -50,8 +54,11 @@ public function loggedAsAdmin() * @Given I am viewing the pages on siteaccess :siteaccess as :username :password * @Given I am viewing the pages on siteaccess :siteaccess as :username with password :password */ - public function iAmViewingThePagesAsUserOnSiteaccess(string $siteaccess, string $username, ?string $password = null) - { + public function iAmViewingThePagesAsUserOnSiteaccess( + string $siteaccess, + string $username, + ?string $password = null + ) { $this->loginPage->open($siteaccess); $this->loginPage->logout($siteaccess); diff --git a/src/lib/Browser/Context/BrowserContext.php b/src/lib/Browser/Context/BrowserContext.php index 255c3d75..c1128da7 100644 --- a/src/lib/Browser/Context/BrowserContext.php +++ b/src/lib/Browser/Context/BrowserContext.php @@ -16,7 +16,7 @@ class BrowserContext extends RawMinkContext { - /** @var \Ibexa\Behat\Core\Behat\ArgumentParser */ + /** @var ArgumentParser */ private $argumentParser; public function __construct(ArgumentParser $argumentParser) @@ -27,8 +27,10 @@ public function __construct(ArgumentParser $argumentParser) /** * @Given I visit :url on siteaccess :siteaccess */ - public function iVisitItemOnSiteaccess(string $url, string $siteaccess): void - { + public function iVisitItemOnSiteaccess( + string $url, + string $siteaccess + ): void { $url = $this->argumentParser->parseUrl($url); $url = sprintf('/%s%s', $siteaccess, $url); $this->getSession()->visit($this->locatePath($url)); @@ -60,8 +62,10 @@ public function responseHeadersMatchPattern(TableNode $expectedHeadersData): voi } } - private function getHeaderValue($responseHeaders, $header): string - { + private function getHeaderValue( + $responseHeaders, + $header + ): string { if ($this->getSession()->getDriver() instanceof ChromeDriver) { return $responseHeaders[$header]; } diff --git a/src/lib/Browser/Context/ContentPreviewContext.php b/src/lib/Browser/Context/ContentPreviewContext.php index 67f47585..7d4eecea 100644 --- a/src/lib/Browser/Context/ContentPreviewContext.php +++ b/src/lib/Browser/Context/ContentPreviewContext.php @@ -14,7 +14,7 @@ class ContentPreviewContext implements Context { - /** @var \Ibexa\Behat\Browser\Page\Preview\PagePreviewRegistry */ + /** @var PagePreviewRegistry */ private $pagePreviewRegistry; public function __construct(PagePreviewRegistry $pagePreviewRegistry) @@ -25,8 +25,10 @@ public function __construct(PagePreviewRegistry $pagePreviewRegistry) /** * @Given I see correct preview data for :contentTypeName content type */ - public function iSeeCorrectPreviewDataFor(string $contentType, TableNode $previewData): void - { + public function iSeeCorrectPreviewDataFor( + string $contentType, + TableNode $previewData + ): void { $preview = $this->pagePreviewRegistry->getPreview($contentType); $preview->setExpectedPreviewData(['title' => $previewData->getHash()[0]['value']]); $preview->verifyPreviewData(); diff --git a/src/lib/Browser/Context/DebuggingContext.php b/src/lib/Browser/Context/DebuggingContext.php index 319dfea6..8e8d4bb6 100644 --- a/src/lib/Browser/Context/DebuggingContext.php +++ b/src/lib/Browser/Context/DebuggingContext.php @@ -21,16 +21,16 @@ class DebuggingContext extends RawMinkContext { - /** @var \Psr\Log\LoggerInterface */ + /** @var LoggerInterface */ private $logger; /** @var string */ private $logDir; - /** @var \Ibexa\Behat\Core\Log\KnownIssuesRegistry */ + /** @var KnownIssuesRegistry */ private $knownIssuesRegistry; - /** @var \Behat\Testwork\Tester\Result\TestResult */ + /** @var TestResult */ private $failedStepResult; public function __construct( @@ -103,8 +103,10 @@ public function getLogsAfterFailedStep(AfterStepScope $scope) $this->display($this->formatForDisplay($applicationsLogs, 'Application logs:')); } - private function formatForDisplay(array $logEntries, string $sectionName) - { + private function formatForDisplay( + array $logEntries, + string $sectionName + ) { $output = sprintf('%s' . PHP_EOL, $sectionName); if (empty($logEntries)) { diff --git a/src/lib/Browser/Element/BaseElement.php b/src/lib/Browser/Element/BaseElement.php index a00b72c8..1faa0f1a 100644 --- a/src/lib/Browser/Element/BaseElement.php +++ b/src/lib/Browser/Element/BaseElement.php @@ -55,8 +55,10 @@ public function waitUntilCondition(ConditionInterface $condition): BaseElementIn throw new TimeoutException($condition->getErrorMessage($this)); } - public function waitUntil(callable $callback, string $errorMessage) - { + public function waitUntil( + callable $callback, + string $errorMessage + ) { $start = time(); $end = $start + $this->timeout; $caughtException = null; diff --git a/src/lib/Browser/Element/BaseElementInterface.php b/src/lib/Browser/Element/BaseElementInterface.php index 5209bb27..59d78a95 100644 --- a/src/lib/Browser/Element/BaseElementInterface.php +++ b/src/lib/Browser/Element/BaseElementInterface.php @@ -28,5 +28,8 @@ public function waitUntilCondition(ConditionInterface $condition): BaseElementIn * * @return mixed */ - public function waitUntil(callable $callback, string $errorMessage); + public function waitUntil( + callable $callback, + string $errorMessage + ); } diff --git a/src/lib/Browser/Element/Condition/ElementExistsCondition.php b/src/lib/Browser/Element/Condition/ElementExistsCondition.php index 47aec447..0899218d 100644 --- a/src/lib/Browser/Element/Condition/ElementExistsCondition.php +++ b/src/lib/Browser/Element/Condition/ElementExistsCondition.php @@ -13,14 +13,16 @@ class ElementExistsCondition implements ConditionInterface { - /** @var \Ibexa\Behat\Browser\Locator\LocatorInterface */ + /** @var LocatorInterface */ private $elementLocator; - /** @var \Ibexa\Behat\Browser\Element\BaseElementInterface */ + /** @var BaseElementInterface */ private $searchedNode; - public function __construct(BaseElementInterface $searchedNode, LocatorInterface $elementLocator) - { + public function __construct( + BaseElementInterface $searchedNode, + LocatorInterface $elementLocator + ) { $this->elementLocator = $elementLocator; $this->searchedNode = $searchedNode; } diff --git a/src/lib/Browser/Element/Condition/ElementHasTextCondition.php b/src/lib/Browser/Element/Condition/ElementHasTextCondition.php index 46b3ea53..9a233798 100644 --- a/src/lib/Browser/Element/Condition/ElementHasTextCondition.php +++ b/src/lib/Browser/Element/Condition/ElementHasTextCondition.php @@ -15,12 +15,12 @@ class ElementHasTextCondition implements ConditionInterface { /** - * @var \Ibexa\Behat\Browser\Element\BaseElementInterface + * @var BaseElementInterface */ private $searchedNode; /** - * @var \Ibexa\Behat\Browser\Locator\LocatorInterface + * @var LocatorInterface */ private $elementLocator; @@ -34,8 +34,11 @@ class ElementHasTextCondition implements ConditionInterface */ private $foundElementsText; - public function __construct(BaseElementInterface $searchedNode, LocatorInterface $elementLocator, string $expectedText) - { + public function __construct( + BaseElementInterface $searchedNode, + LocatorInterface $elementLocator, + string $expectedText + ) { $this->searchedNode = $searchedNode; $this->elementLocator = $elementLocator; $this->expectedText = $expectedText; diff --git a/src/lib/Browser/Element/Condition/ElementNotExistsCondition.php b/src/lib/Browser/Element/Condition/ElementNotExistsCondition.php index c43afcc6..f64bd658 100644 --- a/src/lib/Browser/Element/Condition/ElementNotExistsCondition.php +++ b/src/lib/Browser/Element/Condition/ElementNotExistsCondition.php @@ -13,14 +13,16 @@ class ElementNotExistsCondition implements ConditionInterface { - /** @var \Ibexa\Behat\Browser\Locator\LocatorInterface */ + /** @var LocatorInterface */ private $elementLocator; - /** @var \Ibexa\Behat\Browser\Element\BaseElementInterface */ + /** @var BaseElementInterface */ private $searchedNode; - public function __construct(BaseElementInterface $searchedNode, LocatorInterface $elementLocator) - { + public function __construct( + BaseElementInterface $searchedNode, + LocatorInterface $elementLocator + ) { $this->elementLocator = $elementLocator; $this->searchedNode = $searchedNode; } diff --git a/src/lib/Browser/Element/Condition/ElementTransitionHasEndedCondition.php b/src/lib/Browser/Element/Condition/ElementTransitionHasEndedCondition.php index f14b0e34..6bd1f402 100644 --- a/src/lib/Browser/Element/Condition/ElementTransitionHasEndedCondition.php +++ b/src/lib/Browser/Element/Condition/ElementTransitionHasEndedCondition.php @@ -17,17 +17,19 @@ class ElementTransitionHasEndedCondition implements ConditionInterface private const TRANSITION_STARTED_CLASS = 'ibexa-selenium-transition-started'; - /** @var \Ibexa\Behat\Browser\Locator\LocatorInterface */ + /** @var LocatorInterface */ private $elementLocator; - /** @var \Ibexa\Behat\Browser\Element\BaseElementInterface */ + /** @var BaseElementInterface */ private $searchedNode; /** @var bool */ private $hasStartedTransitioning; - public function __construct(BaseElementInterface $searchedNode, LocatorInterface $elementLocator) - { + public function __construct( + BaseElementInterface $searchedNode, + LocatorInterface $elementLocator + ) { $this->elementLocator = $elementLocator; $this->searchedNode = $searchedNode; } diff --git a/src/lib/Browser/Element/Condition/ElementsCountCondition.php b/src/lib/Browser/Element/Condition/ElementsCountCondition.php index 2b4a1418..7cd300d8 100644 --- a/src/lib/Browser/Element/Condition/ElementsCountCondition.php +++ b/src/lib/Browser/Element/Condition/ElementsCountCondition.php @@ -13,10 +13,10 @@ class ElementsCountCondition implements ConditionInterface { - /** @var \Ibexa\Behat\Browser\Locator\LocatorInterface */ + /** @var LocatorInterface */ private $elementsLocator; - /** @var \Ibexa\Behat\Browser\Element\BaseElementInterface */ + /** @var BaseElementInterface */ private $searchedNode; /** @var int */ @@ -25,8 +25,11 @@ class ElementsCountCondition implements ConditionInterface /** @var int */ private $actualNumberOfItemsFound; - public function __construct(BaseElementInterface $searchedNode, LocatorInterface $elementsLocator, int $expectedElementsCount) - { + public function __construct( + BaseElementInterface $searchedNode, + LocatorInterface $elementsLocator, + int $expectedElementsCount + ) { $this->elementsLocator = $elementsLocator; $this->searchedNode = $searchedNode; $this->expectedElementsCount = $expectedElementsCount; diff --git a/src/lib/Browser/Element/Condition/ElementsCountGreaterThanCondition.php b/src/lib/Browser/Element/Condition/ElementsCountGreaterThanCondition.php index a2616144..4258dbfa 100644 --- a/src/lib/Browser/Element/Condition/ElementsCountGreaterThanCondition.php +++ b/src/lib/Browser/Element/Condition/ElementsCountGreaterThanCondition.php @@ -13,10 +13,10 @@ class ElementsCountGreaterThanCondition implements ConditionInterface { - /** @var \Ibexa\Behat\Browser\Locator\LocatorInterface */ + /** @var LocatorInterface */ private $elementsLocator; - /** @var \Ibexa\Behat\Browser\Element\BaseElementInterface */ + /** @var BaseElementInterface */ private $searchedNode; /** @var int */ @@ -25,8 +25,11 @@ class ElementsCountGreaterThanCondition implements ConditionInterface /** @var int */ private $actualNumberOfItemsFound; - public function __construct(BaseElementInterface $searchedNode, LocatorInterface $elementsLocator, int $expectedElementsCount) - { + public function __construct( + BaseElementInterface $searchedNode, + LocatorInterface $elementsLocator, + int $expectedElementsCount + ) { $this->elementsLocator = $elementsLocator; $this->searchedNode = $searchedNode; $this->expectedElementsCount = $expectedElementsCount; diff --git a/src/lib/Browser/Element/Criterion/ChildElementTextCriterion.php b/src/lib/Browser/Element/Criterion/ChildElementTextCriterion.php index 1959c63a..f751d44c 100644 --- a/src/lib/Browser/Element/Criterion/ChildElementTextCriterion.php +++ b/src/lib/Browser/Element/Criterion/ChildElementTextCriterion.php @@ -20,15 +20,17 @@ class ChildElementTextCriterion implements CriterionInterface private $expectedChildElementText; /** - * @var \Ibexa\Behat\Browser\Locator\LocatorInterface + * @var LocatorInterface */ private $childLocator; /** @var array */ private $results; - public function __construct(LocatorInterface $childLocator, string $expectedChildElementText) - { + public function __construct( + LocatorInterface $childLocator, + string $expectedChildElementText + ) { $this->expectedChildElementText = $expectedChildElementText; $this->childLocator = $childLocator; $this->results = []; diff --git a/src/lib/Browser/Element/Criterion/ElementAttributeCriterion.php b/src/lib/Browser/Element/Criterion/ElementAttributeCriterion.php index 3b9a16bf..7098dc18 100644 --- a/src/lib/Browser/Element/Criterion/ElementAttributeCriterion.php +++ b/src/lib/Browser/Element/Criterion/ElementAttributeCriterion.php @@ -22,8 +22,10 @@ class ElementAttributeCriterion implements CriterionInterface /** @var string */ private $attribute; - public function __construct(string $attribute, string $expectedAttributeValue) - { + public function __construct( + string $attribute, + string $expectedAttributeValue + ) { $this->attribute = $attribute; $this->expectedAttributeValue = $expectedAttributeValue; $this->results = []; diff --git a/src/lib/Browser/Element/Criterion/LogicalOrCriterion.php b/src/lib/Browser/Element/Criterion/LogicalOrCriterion.php index 37e44f1b..96c960d9 100644 --- a/src/lib/Browser/Element/Criterion/LogicalOrCriterion.php +++ b/src/lib/Browser/Element/Criterion/LogicalOrCriterion.php @@ -13,7 +13,7 @@ class LogicalOrCriterion implements CriterionInterface { - /** @var \Ibexa\Behat\Browser\Element\Criterion\CriterionInterface[] */ + /** @var CriterionInterface[] */ private $criterions; /** @var string[] */ diff --git a/src/lib/Browser/Element/Debug/Highlighting/BaseElement.php b/src/lib/Browser/Element/Debug/Highlighting/BaseElement.php index ed7e69fb..bbc585fc 100644 --- a/src/lib/Browser/Element/Debug/Highlighting/BaseElement.php +++ b/src/lib/Browser/Element/Debug/Highlighting/BaseElement.php @@ -18,10 +18,10 @@ class BaseElement implements BaseElementInterface { - /** @var \Behat\Mink\Session */ + /** @var Session */ protected $session; - /** @var \Ibexa\Behat\Browser\Element\BaseElementInterface */ + /** @var BaseElementInterface */ protected $element; private const HIGHLIGHT_CLASS = 'ibexa-selenium-highlighted'; @@ -30,8 +30,10 @@ class BaseElement implements BaseElementInterface private const COLORS = ['fuchsia', 'green', 'lime', 'maroon', 'navy', 'olive', 'purple', 'red', 'silver', 'teal', 'yellow']; - public function __construct(Session $session, BaseElementInterface $element) - { + public function __construct( + Session $session, + BaseElementInterface $element + ) { $this->session = $session; $this->element = $element; } @@ -76,19 +78,25 @@ public function waitUntilCondition(ConditionInterface $condition): BaseElementIn return $this; } - public function waitUntil(callable $callback, string $errorMessage) - { + public function waitUntil( + callable $callback, + string $errorMessage + ) { return $this->element->waitUntil($callback, $errorMessage); } - private function highlight(ElementInterface $element, string $color): void - { + private function highlight( + ElementInterface $element, + string $color + ): void { $this->setAttribute($element, 'style', sprintf('--ibexa-selenium-color: %s', $color)); $this->addClass($element, self::HIGHLIGHT_CLASS); } - private function addClass(ElementInterface $element, string $class): void - { + private function addClass( + ElementInterface $element, + string $class + ): void { $this->session->executeScript( sprintf( "%s.classList.add('%s')", @@ -103,8 +111,11 @@ protected function markRead(ElementInterface $element): void $this->addClass($element, self::READ_CLASS); } - private function setAttribute(ElementInterface $element, string $attribute, string $value): void - { + private function setAttribute( + ElementInterface $element, + string $attribute, + string $value + ): void { $this->session->executeScript( sprintf( "%s.setAttribute('%s', '%s')", diff --git a/src/lib/Browser/Element/Debug/Highlighting/Element.php b/src/lib/Browser/Element/Debug/Highlighting/Element.php index b66042a5..82a670d1 100644 --- a/src/lib/Browser/Element/Debug/Highlighting/Element.php +++ b/src/lib/Browser/Element/Debug/Highlighting/Element.php @@ -15,8 +15,10 @@ final class Element extends BaseElement implements ElementInterface { - public function __construct(Session $session, ElementInterface $element) - { + public function __construct( + Session $session, + ElementInterface $element + ) { parent::__construct($session, $element); } diff --git a/src/lib/Browser/Element/Debug/Highlighting/RootElement.php b/src/lib/Browser/Element/Debug/Highlighting/RootElement.php index 99bdfba9..659af250 100644 --- a/src/lib/Browser/Element/Debug/Highlighting/RootElement.php +++ b/src/lib/Browser/Element/Debug/Highlighting/RootElement.php @@ -13,13 +13,18 @@ final class RootElement extends BaseElement implements RootElementInterface { - public function __construct(Session $session, RootElementInterface $element) - { + public function __construct( + Session $session, + RootElementInterface $element + ) { parent::__construct($session, $element); } - public function dragAndDrop(string $from, string $hover, string $to): void - { + public function dragAndDrop( + string $from, + string $hover, + string $to + ): void { $this->element->dragAndDrop($from, $hover, $to); } diff --git a/src/lib/Browser/Element/Debug/Interactive/BaseElement.php b/src/lib/Browser/Element/Debug/Interactive/BaseElement.php index 1cea0037..62a75c91 100644 --- a/src/lib/Browser/Element/Debug/Interactive/BaseElement.php +++ b/src/lib/Browser/Element/Debug/Interactive/BaseElement.php @@ -20,7 +20,7 @@ class BaseElement implements BaseElementInterface { use InteractiveDebuggerTrait; - /** @var \Ibexa\Behat\Browser\Element\BaseElementInterface */ + /** @var BaseElementInterface */ protected $element; public function __construct(BaseElementInterface $element) @@ -67,8 +67,10 @@ public function waitUntilCondition(ConditionInterface $condition): BaseElementIn return $this; } - public function waitUntil(callable $callback, string $errorMessage) - { + public function waitUntil( + callable $callback, + string $errorMessage + ) { return $this->element->waitUntil($callback, $errorMessage); } } diff --git a/src/lib/Browser/Element/Debug/Interactive/RootElement.php b/src/lib/Browser/Element/Debug/Interactive/RootElement.php index d39c80dc..badce635 100644 --- a/src/lib/Browser/Element/Debug/Interactive/RootElement.php +++ b/src/lib/Browser/Element/Debug/Interactive/RootElement.php @@ -21,8 +21,11 @@ public function __construct(RootElementInterface $element) parent::__construct($element); } - public function dragAndDrop(string $from, string $hover, string $to): void - { + public function dragAndDrop( + string $from, + string $hover, + string $to + ): void { $this->element->dragAndDrop($from, $hover, $to); } diff --git a/src/lib/Browser/Element/Element.php b/src/lib/Browser/Element/Element.php index 8bbf549f..c14f7abe 100644 --- a/src/lib/Browser/Element/Element.php +++ b/src/lib/Browser/Element/Element.php @@ -24,8 +24,11 @@ final class Element extends BaseElement implements ElementInterface private NodeElement $decoratedElement; - public function __construct(ElementFactoryInterface $elementFactory, LocatorInterface $locator, NodeElement $baseElement) - { + public function __construct( + ElementFactoryInterface $elementFactory, + LocatorInterface $locator, + NodeElement $baseElement + ) { parent::__construct($elementFactory); $this->decoratedElement = $baseElement; $this->locator = $locator; diff --git a/src/lib/Browser/Element/ElementCollection.php b/src/lib/Browser/Element/ElementCollection.php index 101824a8..a8e639dc 100644 --- a/src/lib/Browser/Element/ElementCollection.php +++ b/src/lib/Browser/Element/ElementCollection.php @@ -24,8 +24,10 @@ class ElementCollection implements ElementCollectionInterface private LocatorInterface $locator; - public function __construct(LocatorInterface $locator, iterable $elements) - { + public function __construct( + LocatorInterface $locator, + iterable $elements + ) { $this->elements = $elements; $this->locator = $locator; } @@ -110,7 +112,7 @@ public function last(): ElementInterface } /** - * @return \Ibexa\Behat\Browser\Element\ElementInterface[] + * @return ElementInterface[] */ public function toArray(): array { diff --git a/src/lib/Browser/Element/ElementCollectionInterface.php b/src/lib/Browser/Element/ElementCollectionInterface.php index 7b0f9a21..c43c19e9 100644 --- a/src/lib/Browser/Element/ElementCollectionInterface.php +++ b/src/lib/Browser/Element/ElementCollectionInterface.php @@ -37,7 +37,7 @@ public function first(): ElementInterface; public function last(): ElementInterface; /** - * @return \Ibexa\Behat\Browser\Element\ElementInterface[] + * @return ElementInterface[] */ public function toArray(): array; diff --git a/src/lib/Browser/Element/Factory/Debug/Highlighting/ElementFactory.php b/src/lib/Browser/Element/Factory/Debug/Highlighting/ElementFactory.php index e5ff4660..4586f0ff 100644 --- a/src/lib/Browser/Element/Factory/Debug/Highlighting/ElementFactory.php +++ b/src/lib/Browser/Element/Factory/Debug/Highlighting/ElementFactory.php @@ -19,27 +19,34 @@ final class ElementFactory implements ElementFactoryInterface { - /** @var \Behat\Mink\Session */ + /** @var Session */ private $session; - /** @var \Ibexa\Behat\Browser\Element\Factory\ElementFactoryInterface */ + /** @var ElementFactoryInterface */ private $decoratedElementFactory; - public function __construct(Session $session, ElementFactoryInterface $decoratedElementFactory) - { + public function __construct( + Session $session, + ElementFactoryInterface $decoratedElementFactory + ) { $this->session = $session; $this->decoratedElementFactory = $decoratedElementFactory; } - public function createElement(ElementFactoryInterface $elementFactory, LocatorInterface $locator, NodeElement $nodeElement): ElementInterface - { + public function createElement( + ElementFactoryInterface $elementFactory, + LocatorInterface $locator, + NodeElement $nodeElement + ): ElementInterface { $baseElement = $this->decoratedElementFactory->createElement($elementFactory, $locator, $nodeElement); return new Element($this->session, $baseElement); } - public function createRootElement(Session $session, ElementFactoryInterface $elementFactory): RootElementInterface - { + public function createRootElement( + Session $session, + ElementFactoryInterface $elementFactory + ): RootElementInterface { $baseElement = $this->decoratedElementFactory->createRootElement($session, $elementFactory); return new RootElement($this->session, $baseElement); diff --git a/src/lib/Browser/Element/Factory/Debug/Interactive/ElementFactory.php b/src/lib/Browser/Element/Factory/Debug/Interactive/ElementFactory.php index adadda79..bbd3c6c7 100644 --- a/src/lib/Browser/Element/Factory/Debug/Interactive/ElementFactory.php +++ b/src/lib/Browser/Element/Factory/Debug/Interactive/ElementFactory.php @@ -19,7 +19,7 @@ final class ElementFactory implements ElementFactoryInterface { - /** @var \Ibexa\Behat\Browser\Element\Factory\ElementFactoryInterface */ + /** @var ElementFactoryInterface */ private $decoratedElementFactory; public function __construct(ElementFactoryInterface $decoratedElementFactory) @@ -27,15 +27,20 @@ public function __construct(ElementFactoryInterface $decoratedElementFactory) $this->decoratedElementFactory = $decoratedElementFactory; } - public function createElement(ElementFactoryInterface $elementFactory, LocatorInterface $locator, NodeElement $nodeElement): ElementInterface - { + public function createElement( + ElementFactoryInterface $elementFactory, + LocatorInterface $locator, + NodeElement $nodeElement + ): ElementInterface { $baseElement = $this->decoratedElementFactory->createElement($elementFactory, $locator, $nodeElement); return new Element($baseElement); } - public function createRootElement(Session $session, ElementFactoryInterface $elementFactory): RootElementInterface - { + public function createRootElement( + Session $session, + ElementFactoryInterface $elementFactory + ): RootElementInterface { $baseElement = $this->decoratedElementFactory->createRootElement($session, $elementFactory); return new RootElement($baseElement); diff --git a/src/lib/Browser/Element/Factory/ElementFactory.php b/src/lib/Browser/Element/Factory/ElementFactory.php index 1bce26d8..bbd7f11e 100644 --- a/src/lib/Browser/Element/Factory/ElementFactory.php +++ b/src/lib/Browser/Element/Factory/ElementFactory.php @@ -18,13 +18,18 @@ final class ElementFactory implements ElementFactoryInterface { - public function createElement(ElementFactoryInterface $elementFactory, LocatorInterface $locator, NodeElement $nodeElement): ElementInterface - { + public function createElement( + ElementFactoryInterface $elementFactory, + LocatorInterface $locator, + NodeElement $nodeElement + ): ElementInterface { return new Element($elementFactory, $locator, $nodeElement); } - public function createRootElement(Session $session, ElementFactoryInterface $elementFactory): RootElementInterface - { + public function createRootElement( + Session $session, + ElementFactoryInterface $elementFactory + ): RootElementInterface { return new RootElement($elementFactory, $session, $session->getPage()); } } diff --git a/src/lib/Browser/Element/Factory/ElementFactoryInterface.php b/src/lib/Browser/Element/Factory/ElementFactoryInterface.php index ac5b3885..cd859f28 100644 --- a/src/lib/Browser/Element/Factory/ElementFactoryInterface.php +++ b/src/lib/Browser/Element/Factory/ElementFactoryInterface.php @@ -16,7 +16,14 @@ interface ElementFactoryInterface { - public function createElement(ElementFactoryInterface $elementFactory, LocatorInterface $locator, NodeElement $nodeElement): ElementInterface; + public function createElement( + ElementFactoryInterface $elementFactory, + LocatorInterface $locator, + NodeElement $nodeElement + ): ElementInterface; - public function createRootElement(Session $session, ElementFactoryInterface $elementFactory): RootElementInterface; + public function createRootElement( + Session $session, + ElementFactoryInterface $elementFactory + ): RootElementInterface; } diff --git a/src/lib/Browser/Element/RootElement.php b/src/lib/Browser/Element/RootElement.php index b4892b97..036385e6 100644 --- a/src/lib/Browser/Element/RootElement.php +++ b/src/lib/Browser/Element/RootElement.php @@ -19,15 +19,21 @@ final class RootElement extends BaseElement implements RootElementInterface private DocumentElement $decoratedElement; - public function __construct(ElementFactoryInterface $elementFactory, Session $session, DocumentElement $baseElement) - { + public function __construct( + ElementFactoryInterface $elementFactory, + Session $session, + DocumentElement $baseElement + ) { parent::__construct($elementFactory); $this->session = $session; $this->decoratedElement = $baseElement; } - public function dragAndDrop(string $from, string $hover, string $to): void - { + public function dragAndDrop( + string $from, + string $hover, + string $to + ): void { if (!$this->isDraggingLibraryLoaded()) { throw new RuntimeException('drag-mock library has to be added to the page in order to use this method. Refer to README in BehatBundle for more information.'); } diff --git a/src/lib/Browser/Element/RootElementInterface.php b/src/lib/Browser/Element/RootElementInterface.php index c4b1a9b9..41de4bef 100644 --- a/src/lib/Browser/Element/RootElementInterface.php +++ b/src/lib/Browser/Element/RootElementInterface.php @@ -10,7 +10,11 @@ interface RootElementInterface extends BaseElementInterface { - public function dragAndDrop(string $from, string $hover, string $to): void; + public function dragAndDrop( + string $from, + string $hover, + string $to + ): void; public function executeJavaScript(string $script): string; } diff --git a/src/lib/Browser/Environment/ParameterProvider.php b/src/lib/Browser/Environment/ParameterProvider.php index a23fc7ba..3b76f55b 100644 --- a/src/lib/Browser/Environment/ParameterProvider.php +++ b/src/lib/Browser/Environment/ParameterProvider.php @@ -19,8 +19,10 @@ public function __construct() $this->setParameter('root_content_name', 'Ibexa Platform'); } - public function setParameter(string $key, $value): void - { + public function setParameter( + string $key, + $value + ): void { $this->parameters[$key] = $value; } diff --git a/src/lib/Browser/Environment/ParameterProviderInterface.php b/src/lib/Browser/Environment/ParameterProviderInterface.php index f250da81..1da17c6a 100644 --- a/src/lib/Browser/Environment/ParameterProviderInterface.php +++ b/src/lib/Browser/Environment/ParameterProviderInterface.php @@ -12,5 +12,8 @@ interface ParameterProviderInterface { public function getParameter(string $parameterName): string; - public function setParameter(string $key, $value): void; + public function setParameter( + string $key, + $value + ): void; } diff --git a/src/lib/Browser/Exception/ElementNotFoundException.php b/src/lib/Browser/Exception/ElementNotFoundException.php index c99e79e0..a0f1c940 100644 --- a/src/lib/Browser/Exception/ElementNotFoundException.php +++ b/src/lib/Browser/Exception/ElementNotFoundException.php @@ -10,6 +10,4 @@ use Exception; -class ElementNotFoundException extends Exception -{ -} +class ElementNotFoundException extends Exception {} diff --git a/src/lib/Browser/Exception/TimeoutException.php b/src/lib/Browser/Exception/TimeoutException.php index 3b8198f6..07b58267 100644 --- a/src/lib/Browser/Exception/TimeoutException.php +++ b/src/lib/Browser/Exception/TimeoutException.php @@ -10,6 +10,4 @@ use Exception; -class TimeoutException extends Exception -{ -} +class TimeoutException extends Exception {} diff --git a/src/lib/Browser/FileUpload/FileUploadHelper.php b/src/lib/Browser/FileUpload/FileUploadHelper.php index 80843592..a05320c9 100644 --- a/src/lib/Browser/FileUpload/FileUploadHelper.php +++ b/src/lib/Browser/FileUpload/FileUploadHelper.php @@ -12,20 +12,20 @@ use Behat\Mink\Session; use FriendsOfBehat\SymfonyExtension\Mink\MinkParameters; -class FileReadException extends \RuntimeException -{ -} +class FileReadException extends \RuntimeException {} class FileUploadHelper { - /** @var \Behat\Mink\Session */ + /** @var Session */ private $session; - /** @var \FriendsOfBehat\SymfonyExtension\Mink\MinkParameters */ + /** @var MinkParameters */ private $minkParameters; - public function __construct(Session $session, MinkParameters $minkParameters) - { + public function __construct( + Session $session, + MinkParameters $minkParameters + ) { $this->session = $session; $this->minkParameters = $minkParameters; } diff --git a/src/lib/Browser/Locator/BaseLocator.php b/src/lib/Browser/Locator/BaseLocator.php index 9dcf7d51..2cef4c4a 100644 --- a/src/lib/Browser/Locator/BaseLocator.php +++ b/src/lib/Browser/Locator/BaseLocator.php @@ -16,8 +16,10 @@ abstract class BaseLocator implements LocatorInterface protected string $identifier; - public function __construct(string $identifier, string $selector) - { + public function __construct( + string $identifier, + string $selector + ) { $this->identifier = $identifier; $this->selector = $selector; } diff --git a/src/lib/Browser/Locator/CSSLocator.php b/src/lib/Browser/Locator/CSSLocator.php index 52ef174f..9811e920 100644 --- a/src/lib/Browser/Locator/CSSLocator.php +++ b/src/lib/Browser/Locator/CSSLocator.php @@ -12,8 +12,10 @@ class CSSLocator extends BaseLocator { - public function __construct(string $identifier, string $selector) - { + public function __construct( + string $identifier, + string $selector + ) { parent::__construct($identifier, $selector); $validator = new CssLocatorValidator(); if (str_contains($selector, '%d') || str_contains($selector, '%s')) { diff --git a/src/lib/Browser/Locator/CSSLocatorBuilder.php b/src/lib/Browser/Locator/CSSLocatorBuilder.php index d4397e0f..c54b55e0 100644 --- a/src/lib/Browser/Locator/CSSLocatorBuilder.php +++ b/src/lib/Browser/Locator/CSSLocatorBuilder.php @@ -41,8 +41,10 @@ public function withParent(CSSLocator $locator): self return $this; } - public static function combine(string $format, ...$locators): CSSLocator - { + public static function combine( + string $format, + ...$locators + ): CSSLocator { $joinedLocatorIDs = 'combined-' . implode('-', array_map(static function (CSSLocator $locator) { return $locator->getIdentifier(); }, $locators)); diff --git a/src/lib/Browser/Locator/LocatorCollection.php b/src/lib/Browser/Locator/LocatorCollection.php index 0c7fb649..cb044353 100644 --- a/src/lib/Browser/Locator/LocatorCollection.php +++ b/src/lib/Browser/Locator/LocatorCollection.php @@ -10,7 +10,7 @@ class LocatorCollection { - /** @var \Ibexa\Behat\Browser\Locator\LocatorInterface[] */ + /** @var LocatorInterface[] */ private $locators; public function __construct(array $locators) diff --git a/src/lib/Browser/Page/LoginPage.php b/src/lib/Browser/Page/LoginPage.php index 66f974bf..b686a1d3 100644 --- a/src/lib/Browser/Page/LoginPage.php +++ b/src/lib/Browser/Page/LoginPage.php @@ -22,8 +22,10 @@ public function logout(): void $this->getSession()->visit($logoutUrl); } - public function loginSuccessfully($username, $password): void - { + public function loginSuccessfully( + $username, + $password + ): void { $this->find($this->getLocator('username'))->setValue($username); $this->find($this->getLocator('password'))->setValue($password); $this->findAll($this->getLocator('button')) diff --git a/src/lib/Browser/Page/Page.php b/src/lib/Browser/Page/Page.php index 4319d91d..1d9245db 100644 --- a/src/lib/Browser/Page/Page.php +++ b/src/lib/Browser/Page/Page.php @@ -14,11 +14,13 @@ abstract class Page extends Component implements PageInterface { - /** @var \Ibexa\Behat\Browser\Routing\Router */ + /** @var Router */ private $router; - public function __construct(Session $session, Router $router) - { + public function __construct( + Session $session, + Router $router + ) { parent::__construct($session); $this->router = $router; } diff --git a/src/lib/Browser/Page/PageRegistry.php b/src/lib/Browser/Page/PageRegistry.php index 07298fa5..36145edd 100644 --- a/src/lib/Browser/Page/PageRegistry.php +++ b/src/lib/Browser/Page/PageRegistry.php @@ -10,7 +10,7 @@ class PageRegistry { - /** @var \Ibexa\Behat\Browser\Page\PageInterface[] */ + /** @var PageInterface[] */ private $pages; public function __construct(iterable $pages) diff --git a/src/lib/Browser/Page/Preview/FolderPreview.php b/src/lib/Browser/Page/Preview/FolderPreview.php index 4160686f..a3b96713 100644 --- a/src/lib/Browser/Page/Preview/FolderPreview.php +++ b/src/lib/Browser/Page/Preview/FolderPreview.php @@ -26,8 +26,10 @@ public function verifyPreviewData() $this->find($this->getLocator('title'))->assert()->textEquals($this->expectedPageTitle); } - public function supports(string $contentTypeIdentifier, string $viewType): bool - { + public function supports( + string $contentTypeIdentifier, + string $viewType + ): bool { $contentTypeIdentifier = strtolower($contentTypeIdentifier); return 'folder' === $contentTypeIdentifier || 'dedicatedfolder' === $contentTypeIdentifier; diff --git a/src/lib/Browser/Page/Preview/PagePreviewInterface.php b/src/lib/Browser/Page/Preview/PagePreviewInterface.php index b407562f..19d7370e 100644 --- a/src/lib/Browser/Page/Preview/PagePreviewInterface.php +++ b/src/lib/Browser/Page/Preview/PagePreviewInterface.php @@ -14,5 +14,8 @@ public function setExpectedPreviewData(array $data); public function verifyPreviewData(); - public function supports(string $contentTypeIdentifier, string $viewType): bool; + public function supports( + string $contentTypeIdentifier, + string $viewType + ): bool; } diff --git a/src/lib/Browser/Page/Preview/PagePreviewRegistry.php b/src/lib/Browser/Page/Preview/PagePreviewRegistry.php index 09cd02c9..1f64bcd2 100644 --- a/src/lib/Browser/Page/Preview/PagePreviewRegistry.php +++ b/src/lib/Browser/Page/Preview/PagePreviewRegistry.php @@ -10,7 +10,7 @@ class PagePreviewRegistry { - /** @var \Ibexa\Behat\Browser\Page\Preview\PagePreviewInterface[] */ + /** @var PagePreviewInterface[] */ private $pagePreviews; public function __construct(iterable $pagePreviews) @@ -26,8 +26,10 @@ public function __construct(iterable $pagePreviews) $this->pagePreviews = $pagePreviews; } - public function getPreview(string $contentTypeIdentifier, string $viewType = 'full'): PagePreviewInterface - { + public function getPreview( + string $contentTypeIdentifier, + string $viewType = 'full' + ): PagePreviewInterface { foreach ($this->pagePreviews as $pagePreview) { if ($pagePreview->supports($contentTypeIdentifier, $viewType)) { return $pagePreview; diff --git a/src/lib/Browser/Page/RedirectLoginPage.php b/src/lib/Browser/Page/RedirectLoginPage.php index 77cc540c..3e48f351 100644 --- a/src/lib/Browser/Page/RedirectLoginPage.php +++ b/src/lib/Browser/Page/RedirectLoginPage.php @@ -22,8 +22,10 @@ public function verifyIsLoaded(): void Assert::assertStringContainsString('/login', $this->getSession()->getCurrentUrl()); } - public function loginSuccessfully($username, $password): void - { + public function loginSuccessfully( + $username, + $password + ): void { parent::loginSuccessfully($username, $password); // TODO Reimplement login success assertion } diff --git a/src/lib/Browser/Routing/Router.php b/src/lib/Browser/Routing/Router.php index e0b12e88..4e3f8ed7 100644 --- a/src/lib/Browser/Routing/Router.php +++ b/src/lib/Browser/Routing/Router.php @@ -14,20 +14,24 @@ final class Router { - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\Router */ + /** @var CoreRouter */ private $router; - /** @var \FriendsOfBehat\SymfonyExtension\Mink\MinkParameters */ + /** @var MinkParameters */ private $minkParameters; - public function __construct(CoreRouter $router, MinkParameters $minkParameters) - { + public function __construct( + CoreRouter $router, + MinkParameters $minkParameters + ) { $this->router = $router; $this->minkParameters = $minkParameters; } - public function reverseMatchRoute(string $siteAccessName, string $route): string - { + public function reverseMatchRoute( + string $siteAccessName, + string $route + ): string { $route = strpos($route, '/') === 0 ? $route : sprintf('/%s', $route); $matcher = $this->router->matchByName($siteAccessName)->matcher; diff --git a/src/lib/Core/Behat/ArgumentParser.php b/src/lib/Core/Behat/ArgumentParser.php index bff8a4d8..efe1991b 100644 --- a/src/lib/Core/Behat/ArgumentParser.php +++ b/src/lib/Core/Behat/ArgumentParser.php @@ -20,8 +20,10 @@ class ArgumentParser private RoleFacade $roleFacade; - public function __construct(RoleFacade $roleFacade, ParameterProviderInterface $parameterProvider) - { + public function __construct( + RoleFacade $roleFacade, + ParameterProviderInterface $parameterProvider + ) { $this->roleFacade = $roleFacade; $this->parameterProvider = $parameterProvider; } diff --git a/src/lib/Core/Behat/TableNodeExtension.php b/src/lib/Core/Behat/TableNodeExtension.php index f3db0d6d..69eca93e 100644 --- a/src/lib/Core/Behat/TableNodeExtension.php +++ b/src/lib/Core/Behat/TableNodeExtension.php @@ -8,6 +8,7 @@ namespace Ibexa\Behat\Core\Behat; +use Behat\Gherkin\Exception\NodeException; use Behat\Gherkin\Node\TableNode; class TableNodeExtension extends TableNode @@ -15,10 +16,12 @@ class TableNodeExtension extends TableNode /** * Adds a column (in form: ['header' => [values]] or ['header' => 'value']) to a given table. * - * @throws \Behat\Gherkin\Exception\NodeException + * @throws NodeException */ - public static function addColumn(TableNode $table, array $columnData): TableNode - { + public static function addColumn( + TableNode $table, + array $columnData + ): TableNode { $headers = array_keys($columnData); $newParameters = $table->getTable(); @@ -41,10 +44,12 @@ public static function addColumn(TableNode $table, array $columnData): TableNode /** * Removes a column from a Table. * - * @throws \Behat\Gherkin\Exception\NodeException + * @throws NodeException */ - public static function removeColumn(TableNode $table, string $columnName): TableNode - { + public static function removeColumn( + TableNode $table, + string $columnName + ): TableNode { $newTable = []; $columns = current($table->getTable()) ?: []; diff --git a/src/lib/Core/Configuration/ConfigurationEditor.php b/src/lib/Core/Configuration/ConfigurationEditor.php index fd0dd74b..b045c17e 100644 --- a/src/lib/Core/Configuration/ConfigurationEditor.php +++ b/src/lib/Core/Configuration/ConfigurationEditor.php @@ -22,8 +22,11 @@ class ConfigurationEditor implements ConfigurationEditorInterface * * @return mixed YAML config */ - public function append($config, string $key, $value) - { + public function append( + $config, + string $key, + $value + ) { $this->modifyValue($config, $key, $value, true); return $config; @@ -38,15 +41,20 @@ public function append($config, string $key, $value) * * @return mixed YAML config */ - public function set($config, string $key, $value) - { + public function set( + $config, + string $key, + $value + ) { $this->modifyValue($config, $key, $value, false); return $config; } - public function get($config, string $key) - { + public function get( + $config, + string $key + ) { $propertyAccessor = PropertyAccess::createPropertyAccessor(); $key = $this->parseKey($key); @@ -65,13 +73,19 @@ public function getConfigFromFile(string $filePath) * @param $filePath * @param $config YAML config */ - public function saveConfigToFile($filePath, $config): void - { + public function saveConfigToFile( + $filePath, + $config + ): void { file_put_contents($filePath, Yaml::dump($config, 8, 5)); } - private function modifyValue(&$config, string $key, $value, bool $appendToExisting): void - { + private function modifyValue( + &$config, + string $key, + $value, + bool $appendToExisting + ): void { $propertyAccessor = PropertyAccess::createPropertyAccessor(); $key = $this->parseKey($key); @@ -92,8 +106,11 @@ private function parseKey(string $key): string return $parsed; } - private function getNewValue($currentValue, $value, bool $appendToExisting) - { + private function getNewValue( + $currentValue, + $value, + bool $appendToExisting + ) { if (!$appendToExisting) { return $value; } @@ -113,8 +130,11 @@ private function getNewValue($currentValue, $value, bool $appendToExisting) return array_merge($currentValue, $value); } - public function copyKey($config, string $keyName, string $newKeyName) - { + public function copyKey( + $config, + string $keyName, + string $newKeyName + ) { $propertyAccessor = PropertyAccess::createPropertyAccessor(); $key = $this->parseKey($keyName); diff --git a/src/lib/Core/Configuration/ConfigurationEditorInterface.php b/src/lib/Core/Configuration/ConfigurationEditorInterface.php index d196250a..cfa98dfd 100644 --- a/src/lib/Core/Configuration/ConfigurationEditorInterface.php +++ b/src/lib/Core/Configuration/ConfigurationEditorInterface.php @@ -19,7 +19,11 @@ interface ConfigurationEditorInterface * * @return mixed YAML config */ - public function append($config, string $key, $value); + public function append( + $config, + string $key, + $value + ); /** * Sets given value under key. Existing settings are overwritten. @@ -30,9 +34,16 @@ public function append($config, string $key, $value); * * @return mixed YAML config */ - public function set($config, string $key, $value); + public function set( + $config, + string $key, + $value + ); - public function get($config, string $key); + public function get( + $config, + string $key + ); /** * @return mixed YAML config @@ -43,7 +54,14 @@ public function getConfigFromFile(string $filePath); * @param $filePath * @param $config */ - public function saveConfigToFile($filePath, $config): void; + public function saveConfigToFile( + $filePath, + $config + ): void; - public function copyKey($config, string $keyName, string $newKeyName); + public function copyKey( + $config, + string $keyName, + string $newKeyName + ); } diff --git a/src/lib/Core/Configuration/LocationAwareConfigurationEditor.php b/src/lib/Core/Configuration/LocationAwareConfigurationEditor.php index 7df3e69f..aba44df7 100644 --- a/src/lib/Core/Configuration/LocationAwareConfigurationEditor.php +++ b/src/lib/Core/Configuration/LocationAwareConfigurationEditor.php @@ -12,34 +12,44 @@ class LocationAwareConfigurationEditor implements ConfigurationEditorInterface { - /** @var \Ibexa\Behat\Core\Configuration\ConfigurationEditorInterface */ + /** @var ConfigurationEditorInterface */ private $innerConfigurationEditor; - /** @var \Ibexa\Behat\API\Facade\ContentFacade */ + /** @var ContentFacade */ private $contentFacade; - public function __construct(ConfigurationEditorInterface $innerConfigurationEditor, ContentFacade $contentFacade) - { + public function __construct( + ConfigurationEditorInterface $innerConfigurationEditor, + ContentFacade $contentFacade + ) { $this->innerConfigurationEditor = $innerConfigurationEditor; $this->contentFacade = $contentFacade; } - public function append($config, string $key, $value) - { + public function append( + $config, + string $key, + $value + ) { $config = $this->innerConfigurationEditor->append($config, $key, $value); return $this->resolveLocationReference($config); } - public function set($config, string $key, $value) - { + public function set( + $config, + string $key, + $value + ) { $config = $this->innerConfigurationEditor->set($config, $key, $value); return $this->resolveLocationReference($config); } - public function get($config, string $key) - { + public function get( + $config, + string $key + ) { $config = $this->resolveLocationReference($config); return $this->innerConfigurationEditor->get($config, $key); @@ -50,8 +60,10 @@ public function getConfigFromFile(string $filePath) return $this->innerConfigurationEditor->getConfigFromFile($filePath); } - public function saveConfigToFile($filePath, $config): void - { + public function saveConfigToFile( + $filePath, + $config + ): void { $this->innerConfigurationEditor->saveConfigToFile($filePath, $config); } @@ -76,8 +88,11 @@ private function replaceSingleValue(&$value): void } } - public function copyKey($config, string $keyName, string $newKeyName) - { + public function copyKey( + $config, + string $keyName, + string $newKeyName + ) { $config = $this->innerConfigurationEditor->copyKey($config, $keyName, $newKeyName); return $this->resolveLocationReference($config); diff --git a/src/lib/Core/Context/ConfigurationContext.php b/src/lib/Core/Context/ConfigurationContext.php index 02343059..583781fd 100644 --- a/src/lib/Core/Context/ConfigurationContext.php +++ b/src/lib/Core/Context/ConfigurationContext.php @@ -25,12 +25,14 @@ class ConfigurationContext implements Context private $projectDir; /** - * @var \Ibexa\Behat\Core\Configuration\ConfigurationEditorInterface + * @var ConfigurationEditorInterface */ private $configurationEditor; - public function __construct(string $projectDir, ConfigurationEditorInterface $configurationEditor) - { + public function __construct( + string $projectDir, + ConfigurationEditorInterface $configurationEditor + ) { $this->projectDir = $projectDir; $this->mainProjectConfigFilePath = sprintf('%s/config/packages/ibexa.yaml', $projectDir); $this->configurationEditor = $configurationEditor; @@ -42,8 +44,11 @@ public function __construct(string $projectDir, ConfigurationEditorInterface $co * @param mixed $siteaccessName * @param mixed $siteaccessGroup */ - public function iAddSiteaccessWithSettings($siteaccessName, $siteaccessGroup, TableNode $settings) - { + public function iAddSiteaccessWithSettings( + $siteaccessName, + $siteaccessGroup, + TableNode $settings + ) { $config = $this->configurationEditor->getConfigFromFile($this->mainProjectConfigFilePath); $config = $this->configurationEditor->append($config, 'ibexa.siteaccess.list', $siteaccessName); @@ -64,8 +69,12 @@ public function iAddSiteaccessWithSettings($siteaccessName, $siteaccessGroup, Ta * * @param mixed $siteaccessName */ - public function iAppendOrSetConfigurationToSiteaccess(string $mode, $siteaccessName, TableNode $settings, ?string $configFilePath = null) - { + public function iAppendOrSetConfigurationToSiteaccess( + string $mode, + $siteaccessName, + TableNode $settings, + ?string $configFilePath = null + ) { $appendToExisting = $this->shouldAppendValue($mode); $configFilePath = $configFilePath ? sprintf('%s/%s', $this->projectDir, $configFilePath) : $this->mainProjectConfigFilePath; @@ -92,8 +101,12 @@ public function iAppendOrSetConfigurationToSiteaccess(string $mode, $siteaccessN * * @param mixed $parentNode */ - public function iModifyConfigurationUnderKey(string $mode, $parentNode, PyStringNode $configFragment, ?string $configFilePath = null) - { + public function iModifyConfigurationUnderKey( + string $mode, + $parentNode, + PyStringNode $configFragment, + ?string $configFilePath = null + ) { $appendToExisting = $this->shouldAppendValue($mode); $configFilePath = $configFilePath ? sprintf('%s/%s', $this->projectDir, $configFilePath) : $this->mainProjectConfigFilePath; @@ -113,8 +126,12 @@ public function iModifyConfigurationUnderKey(string $mode, $parentNode, PyString * @param mixed $siteaccessName * @param mixed $keyName */ - public function iModifyConfigurationForSiteaccessUnderKey(string $mode, $siteaccessName, $keyName, PyStringNode $configFragment) - { + public function iModifyConfigurationForSiteaccessUnderKey( + string $mode, + $siteaccessName, + $keyName, + PyStringNode $configFragment + ) { $parentNode = sprintf(self::SITEACCESS_KEY_FORMAT, $siteaccessName, $keyName); $this->iModifyConfigurationUnderKey($mode, $parentNode, $configFragment); } @@ -122,8 +139,10 @@ public function iModifyConfigurationForSiteaccessUnderKey(string $mode, $siteacc /** * @Given I :mode siteaccess matcher configuration */ - public function iModifySiteaccessMatcherConfiguration(string $mode, PyStringNode $configFragment) - { + public function iModifySiteaccessMatcherConfiguration( + string $mode, + PyStringNode $configFragment + ) { $this->iModifyConfigurationUnderKey($mode, self::SITEACCESS_MATCHER_KEY, $configFragment); } @@ -160,8 +179,11 @@ private function shouldAppendValue(string $value): bool * @Given I copy the configuration from :keyName to :newKeyName * @Given I copy the configuration from :keyName to :newKeyName in :configFilePath */ - public function iCopyTheConfigurationFromTo(string $keyName, string $newKeyName, ?string $configFilePath = null) - { + public function iCopyTheConfigurationFromTo( + string $keyName, + string $newKeyName, + ?string $configFilePath = null + ) { $configFilePath = $configFilePath ? sprintf('%s/%s', $this->projectDir, $configFilePath) : $this->mainProjectConfigFilePath; $config = $this->configurationEditor->getConfigFromFile($configFilePath); $config = $this->configurationEditor->copyKey($config, $keyName, $newKeyName); diff --git a/src/lib/Core/Context/FileContext.php b/src/lib/Core/Context/FileContext.php index e2e1ad69..1b157569 100644 --- a/src/lib/Core/Context/FileContext.php +++ b/src/lib/Core/Context/FileContext.php @@ -31,8 +31,10 @@ public function __construct($projectDirectory) * @param mixed $path * @param mixed $sourceFile */ - public function createFileFromSourceFile($path, $sourceFile): void - { + public function createFileFromSourceFile( + $path, + $sourceFile + ): void { $content = file_get_contents(sprintf('%s/%s/%s', $this->projectDirectory, self::SOURCE_FILE_DIRECTORY, $sourceFile)); $destinationPath = sprintf('%s/%s', $this->projectDirectory, $path); $this->createDirectoryStructure($destinationPath); @@ -45,8 +47,10 @@ public function createFileFromSourceFile($path, $sourceFile): void * @param mixed $file * @param mixed $sourceFile */ - public function appendToFile($file, $sourceFile): void - { + public function appendToFile( + $file, + $sourceFile + ): void { $content = file_get_contents(sprintf('%s/%s/%s', $this->projectDirectory, self::SOURCE_FILE_DIRECTORY, $sourceFile)); file_put_contents($file, $content, FILE_APPEND | LOCK_EX); } @@ -54,8 +58,10 @@ public function appendToFile($file, $sourceFile): void /** * @Given I create a file :path with contents */ - public function createFileFromContent(string $path, PyStringNode $fileContent): void - { + public function createFileFromContent( + string $path, + PyStringNode $fileContent + ): void { $destinationPath = sprintf('%s/%s', $this->projectDirectory, $path); $this->createDirectoryStructure($destinationPath); file_put_contents($destinationPath, $fileContent->getRaw()); diff --git a/src/lib/Core/Debug/Command/GoBackCommand.php b/src/lib/Core/Debug/Command/GoBackCommand.php index 99639df2..ac86ffc6 100644 --- a/src/lib/Core/Debug/Command/GoBackCommand.php +++ b/src/lib/Core/Debug/Command/GoBackCommand.php @@ -17,7 +17,7 @@ #[AsCommand(name: 'back', description: "Goes back one page in browser's history")] class GoBackCommand extends Command { - /** @var \Behat\Mink\Session */ + /** @var Session */ protected $session; public function __construct(Session $session) @@ -33,8 +33,10 @@ protected function configure() ->setHelp(''); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $this->session->back(); $output->writeln("The last page from browser's history has been visited."); diff --git a/src/lib/Core/Debug/Command/RefreshPageCommand.php b/src/lib/Core/Debug/Command/RefreshPageCommand.php index 08eac751..ea359ea2 100644 --- a/src/lib/Core/Debug/Command/RefreshPageCommand.php +++ b/src/lib/Core/Debug/Command/RefreshPageCommand.php @@ -10,13 +10,14 @@ use Behat\Mink\Session; use Psy\Command\Command; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -#[\Symfony\Component\Console\Attribute\AsCommand(name: 'refresh', description: 'Refreshes the currently opened website')] +#[AsCommand(name: 'refresh', description: 'Refreshes the currently opened website')] class RefreshPageCommand extends Command { - /** @var \Behat\Mink\Session */ + /** @var Session */ protected $session; public function __construct(Session $session) @@ -32,8 +33,10 @@ protected function configure() ->setHelp(''); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $this->session->reload(); $output->writeln('Page has been refreshed.'); diff --git a/src/lib/Core/Debug/Command/ShowHTMLCommand.php b/src/lib/Core/Debug/Command/ShowHTMLCommand.php index 341afefc..f49e6775 100644 --- a/src/lib/Core/Debug/Command/ShowHTMLCommand.php +++ b/src/lib/Core/Debug/Command/ShowHTMLCommand.php @@ -10,13 +10,14 @@ use Behat\Mink\Session; use Psy\Command\Command; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -#[\Symfony\Component\Console\Attribute\AsCommand(name: 'html', description: 'Displays the HTML of the currently opened website')] +#[AsCommand(name: 'html', description: 'Displays the HTML of the currently opened website')] class ShowHTMLCommand extends Command { - /** @var \Behat\Mink\Session */ + /** @var Session */ protected $session; public function __construct(Session $session) @@ -32,8 +33,10 @@ protected function configure() ->setHelp(''); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $output->writeln($this->session->getPage()->getOuterHtml()); return self::SUCCESS; diff --git a/src/lib/Core/Debug/Command/ShowURLCommand.php b/src/lib/Core/Debug/Command/ShowURLCommand.php index fdbb4c9f..3fc6554e 100644 --- a/src/lib/Core/Debug/Command/ShowURLCommand.php +++ b/src/lib/Core/Debug/Command/ShowURLCommand.php @@ -10,13 +10,14 @@ use Behat\Mink\Session; use Psy\Command\Command; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -#[\Symfony\Component\Console\Attribute\AsCommand(name: 'url', description: 'Displays the URL of the currently opened website')] +#[AsCommand(name: 'url', description: 'Displays the URL of the currently opened website')] class ShowURLCommand extends Command { - /** @var \Behat\Mink\Session */ + /** @var Session */ protected $session; public function __construct(Session $session) @@ -32,8 +33,10 @@ protected function configure() ->setHelp(''); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $output->writeln($this->session->getCurrentUrl()); return self::SUCCESS; diff --git a/src/lib/Core/Debug/Command/TakeScreenshotCommand.php b/src/lib/Core/Debug/Command/TakeScreenshotCommand.php index cf43305b..3745b724 100644 --- a/src/lib/Core/Debug/Command/TakeScreenshotCommand.php +++ b/src/lib/Core/Debug/Command/TakeScreenshotCommand.php @@ -25,7 +25,7 @@ class TakeScreenshotCommand extends Command private const CLOUD_NAME = 'ezplatformtravis'; private const PRESET = 'ezplatform'; - /** @var \Behat\Mink\Session */ + /** @var Session */ private $session; public function __construct(Session $session) @@ -41,8 +41,10 @@ protected function configure() ->setHelp(''); } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $image = $this->session->getScreenshot(); $filePath = sys_get_temp_dir() . \DIRECTORY_SEPARATOR . uniqid('debug') . '.png'; diff --git a/src/lib/Core/Debug/InteractiveDebuggerTrait.php b/src/lib/Core/Debug/InteractiveDebuggerTrait.php index bceefd36..3962dab4 100644 --- a/src/lib/Core/Debug/InteractiveDebuggerTrait.php +++ b/src/lib/Core/Debug/InteractiveDebuggerTrait.php @@ -28,13 +28,18 @@ public function setInteractiveBreakpoint(array $variables = []): void $this->startInteractiveSession(null, false, $variables); } - public function startInteractiveSessionOnException(Exception $exception, bool $expectsReturnValue) - { + public function startInteractiveSessionOnException( + Exception $exception, + bool $expectsReturnValue + ) { return $this->startInteractiveSession($exception, $expectsReturnValue, []); } - protected function startInteractiveSession(?Exception $exception, bool $isReturnValueExpected, array $variables) - { + protected function startInteractiveSession( + ?Exception $exception, + bool $isReturnValueExpected, + array $variables + ) { if ($this->isRunningInteractive()) { if ($exception !== null) { throw $exception; @@ -111,8 +116,10 @@ private function isRunningInteractive(): bool return false; } - private function addCommands(Shell $sh, Component $component): void - { + private function addCommands( + Shell $sh, + Component $component + ): void { // This method should not be public to avoid incorrect usage in Context classess $r = new \ReflectionObject($component); $getSessionMethod = $r->getMethod('getSession'); diff --git a/src/lib/Core/Debug/Matcher/ObjectFunctionCallChainMatcher.php b/src/lib/Core/Debug/Matcher/ObjectFunctionCallChainMatcher.php index a411851e..a0acf033 100644 --- a/src/lib/Core/Debug/Matcher/ObjectFunctionCallChainMatcher.php +++ b/src/lib/Core/Debug/Matcher/ObjectFunctionCallChainMatcher.php @@ -19,8 +19,10 @@ class ObjectFunctionCallChainMatcher extends ObjectMethodsMatcher * * @return list */ - public function getMatches(array $tokens, array $info = []): array - { + public function getMatches( + array $tokens, + array $info = [] + ): array { $input = $this->getInput($tokens); // 1) Split tokens into groups separated by -> - {group1}->{group2}->{group3} @@ -91,7 +93,7 @@ static function ($var) use ($input) { /** * @phpstan-param list $token */ - protected function getTokenName(array|string $token): string + protected function getTokenName(array | string $token): string { if (!is_array($token)) { return $token; diff --git a/src/lib/Core/Debug/Matcher/ThisObjectMethodsMatcher.php b/src/lib/Core/Debug/Matcher/ThisObjectMethodsMatcher.php index 42f8be6f..4e83ff44 100644 --- a/src/lib/Core/Debug/Matcher/ThisObjectMethodsMatcher.php +++ b/src/lib/Core/Debug/Matcher/ThisObjectMethodsMatcher.php @@ -22,8 +22,10 @@ class ThisObjectMethodsMatcher extends ObjectMethodsMatcher * * @return list */ - public function getMatches(array $tokens, array $info = []): array - { + public function getMatches( + array $tokens, + array $info = [] + ): array { $input = $this->getInput($tokens); $firstToken = \array_pop($tokens); @@ -48,7 +50,7 @@ public function getMatches(array $tokens, array $info = []): array } $reflectionClass = new ReflectionClass(get_class($object)); - $methods = array_column($reflectionClass->getMethods(\ReflectionMethod::IS_PROTECTED | ReflectionMethod::IS_PRIVATE), 'name'); + $methods = array_column($reflectionClass->getMethods(ReflectionMethod::IS_PROTECTED | ReflectionMethod::IS_PRIVATE), 'name'); return array_map(static function (string $function) { return $function . '()'; diff --git a/src/lib/Core/Debug/Shell/Shell.php b/src/lib/Core/Debug/Shell/Shell.php index 5aa2bb28..a84ce709 100644 --- a/src/lib/Core/Debug/Shell/Shell.php +++ b/src/lib/Core/Debug/Shell/Shell.php @@ -18,7 +18,7 @@ class Shell extends BaseShell { /** - * @return \Psy\TabCompletion\Matcher\AbstractMatcher[] + * @return AbstractMatcher[] */ protected function getDefaultMatchers(): array { diff --git a/src/lib/Core/Log/Failure/AnalysisResult.php b/src/lib/Core/Log/Failure/AnalysisResult.php index 27975439..0e193c35 100644 --- a/src/lib/Core/Log/Failure/AnalysisResult.php +++ b/src/lib/Core/Log/Failure/AnalysisResult.php @@ -16,8 +16,10 @@ final class AnalysisResult /** @var string|null */ private $jiraReference; - public function __construct(bool $isKnownFailure, string $jiraReference = '') - { + public function __construct( + bool $isKnownFailure, + string $jiraReference = '' + ) { $this->isKnownFailure = $isKnownFailure; $this->jiraReference = $jiraReference; } diff --git a/src/lib/Core/Log/Failure/TestFailureData.php b/src/lib/Core/Log/Failure/TestFailureData.php index 787522f7..c1cae34a 100644 --- a/src/lib/Core/Log/Failure/TestFailureData.php +++ b/src/lib/Core/Log/Failure/TestFailureData.php @@ -12,7 +12,7 @@ class TestFailureData { - /** @var \Behat\Testwork\Tester\Result\ExceptionResult */ + /** @var ExceptionResult */ private $failedStepResult; /** @var string[] */ @@ -21,8 +21,11 @@ class TestFailureData /** @var string[] */ private $browserLogs; - public function __construct(ExceptionResult $failedStepResult, array $applicationLogs, array $browserLogs) - { + public function __construct( + ExceptionResult $failedStepResult, + array $applicationLogs, + array $browserLogs + ) { $this->failedStepResult = $failedStepResult; $this->applicationLogs = $applicationLogs; $this->browserLogs = $browserLogs; diff --git a/src/lib/Core/Log/KnownIssuesRegistry.php b/src/lib/Core/Log/KnownIssuesRegistry.php index f29a1d16..fe2ee9a7 100644 --- a/src/lib/Core/Log/KnownIssuesRegistry.php +++ b/src/lib/Core/Log/KnownIssuesRegistry.php @@ -9,11 +9,12 @@ namespace Ibexa\Behat\Core\Log; use Ibexa\Behat\Core\Log\Failure\AnalysisResult; +use Ibexa\Behat\Core\Log\Failure\KnownIssues\KnownIssueInterface; use Ibexa\Behat\Core\Log\Failure\TestFailureData; final class KnownIssuesRegistry { - /** @var \Ibexa\Behat\Core\Log\Failure\KnownIssues\KnownIssueInterface[] */ + /** @var KnownIssueInterface[] */ private $knownIssues; public function __construct(iterable $knownIssues) diff --git a/src/lib/Core/Log/LogFileReader.php b/src/lib/Core/Log/LogFileReader.php index c88ea5fb..5a66b909 100644 --- a/src/lib/Core/Log/LogFileReader.php +++ b/src/lib/Core/Log/LogFileReader.php @@ -10,8 +10,10 @@ class LogFileReader { - public function getLastLines($filePath, $numberOfLines): array - { + public function getLastLines( + $filePath, + $numberOfLines + ): array { $logEntries = []; $counter = 0; diff --git a/src/lib/Core/Log/TestLogProvider.php b/src/lib/Core/Log/TestLogProvider.php index dfce3c1e..dab0848d 100644 --- a/src/lib/Core/Log/TestLogProvider.php +++ b/src/lib/Core/Log/TestLogProvider.php @@ -21,7 +21,7 @@ final class TestLogProvider private static $LOGS; /** - * @var \Behat\Mink\Session + * @var Session */ private $session; @@ -30,8 +30,10 @@ final class TestLogProvider */ private $logDirectory; - public function __construct(Session $session, string $logDirectory) - { + public function __construct( + Session $session, + string $logDirectory + ) { $this->session = $session; $this->logDirectory = $logDirectory; } diff --git a/src/lib/Event/InitialEvent.php b/src/lib/Event/InitialEvent.php index 3669252a..f734972b 100644 --- a/src/lib/Event/InitialEvent.php +++ b/src/lib/Event/InitialEvent.php @@ -30,8 +30,14 @@ class InitialEvent extends Event /** @var string */ public $mainLanguage; - public function __construct(string $country, string $mainLanguage, array $editors, string $subtreePath, array $languages, array $contentTypes) - { + public function __construct( + string $country, + string $mainLanguage, + array $editors, + string $subtreePath, + array $languages, + array $contentTypes + ) { $this->editors = $editors; $this->subtreePath = $subtreePath; $this->languages = $languages; diff --git a/src/lib/Event/TransitionEvent.php b/src/lib/Event/TransitionEvent.php index f1107935..022e748e 100644 --- a/src/lib/Event/TransitionEvent.php +++ b/src/lib/Event/TransitionEvent.php @@ -8,6 +8,7 @@ namespace Ibexa\Behat\Event; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Symfony\Contracts\EventDispatcher\Event; class TransitionEvent extends Event @@ -18,7 +19,7 @@ class TransitionEvent extends Event /** @var string */ public $contentTypeIdentifier; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ + /** @var Content */ public $content; /** @var array */ @@ -33,8 +34,13 @@ class TransitionEvent extends Event /** @var string */ public $mainLanguage; - public function __construct(array $editors, string $contentTypeIdentifier, string $locationPath, array $availableLanguages, string $mainLanguage) - { + public function __construct( + array $editors, + string $contentTypeIdentifier, + string $locationPath, + array $availableLanguages, + string $mainLanguage + ) { $this->locationPath = $locationPath; $this->availableLanguages = $availableLanguages; $this->contentTypeIdentifier = $contentTypeIdentifier; diff --git a/src/lib/QueryType/FoldersUnderMediaQueryType.php b/src/lib/QueryType/FoldersUnderMediaQueryType.php index e332921e..aa190a94 100644 --- a/src/lib/QueryType/FoldersUnderMediaQueryType.php +++ b/src/lib/QueryType/FoldersUnderMediaQueryType.php @@ -17,7 +17,7 @@ class FoldersUnderMediaQueryType implements QueryType public function getQuery(array $parameters = []) { return new Query([ - 'filter' => new Query\Criterion\LogicalAnd([ + 'filter' => new Criterion\LogicalAnd([ new Criterion\ContentTypeIdentifier($parameters['contentTypeId']), new Criterion\ParentLocationId((int)$parameters['locationId']), ]), diff --git a/src/lib/Subscriber/AbstractProcessStage.php b/src/lib/Subscriber/AbstractProcessStage.php index 493d201b..914412e8 100644 --- a/src/lib/Subscriber/AbstractProcessStage.php +++ b/src/lib/Subscriber/AbstractProcessStage.php @@ -16,24 +16,25 @@ use PHPUnit\Framework\Assert; use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; +use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Contracts\EventDispatcher\Event; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; abstract class AbstractProcessStage { - /** @var \Psr\Log\LoggerInterface */ + /** @var LoggerInterface */ protected $logger; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Symfony\Component\EventDispatcher\EventDispatcher */ + /** @var EventDispatcher */ private $eventDispatcher; - /** @var \Ibexa\Behat\API\ContentData\RandomDataGenerator */ + /** @var RandomDataGenerator */ protected $randomDataGenerator; public function __construct( diff --git a/src/lib/Subscriber/CreateContentDraft.php b/src/lib/Subscriber/CreateContentDraft.php index f7f37406..9dec0b83 100644 --- a/src/lib/Subscriber/CreateContentDraft.php +++ b/src/lib/Subscriber/CreateContentDraft.php @@ -21,10 +21,10 @@ class CreateContentDraft extends AbstractProcessStage implements EventSubscriberInterface { - /** @var \Ibexa\Behat\API\Facade\ContentFacade */ + /** @var ContentFacade */ private $contentFacade; - /** @var \Ibexa\Workflow\Behat\Facade\WorkflowFacade */ + /** @var WorkflowFacade */ private $workflowFacade; public static function getSubscribedEvents(): array diff --git a/src/lib/Subscriber/EditContent.php b/src/lib/Subscriber/EditContent.php index f5fba55a..fba6408e 100644 --- a/src/lib/Subscriber/EditContent.php +++ b/src/lib/Subscriber/EditContent.php @@ -22,13 +22,13 @@ class EditContent extends AbstractProcessStage implements EventSubscriberInterface { - /** @var \Ibexa\Behat\API\ContentData\ContentDataProvider */ + /** @var ContentDataProvider */ private $contentDataProvider; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Workflow\Behat\Facade\WorkflowFacade */ + /** @var WorkflowFacade */ private $workflowFacade; protected function getTransitions(): array diff --git a/src/lib/Subscriber/InitialStage.php b/src/lib/Subscriber/InitialStage.php index 264d2fef..986afef1 100644 --- a/src/lib/Subscriber/InitialStage.php +++ b/src/lib/Subscriber/InitialStage.php @@ -21,7 +21,7 @@ class InitialStage extends AbstractProcessStage implements EventSubscriberInterface { - /** @var \Ibexa\Behat\API\Facade\SearchFacade */ + /** @var SearchFacade */ private $searchFacade; protected function getTransitions(): array @@ -82,7 +82,5 @@ public function onStart(InitialEvent $event): void $this->transitionToNextStage($transitionEvent); } - protected function doExecute(TransitionEvent $event): void - { - } + protected function doExecute(TransitionEvent $event): void {} } diff --git a/src/lib/Subscriber/PublishDraft.php b/src/lib/Subscriber/PublishDraft.php index ab480aa6..ed492caf 100644 --- a/src/lib/Subscriber/PublishDraft.php +++ b/src/lib/Subscriber/PublishDraft.php @@ -21,10 +21,10 @@ class PublishDraft extends AbstractProcessStage implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Workflow\Behat\Facade\WorkflowFacade */ + /** @var WorkflowFacade */ private $workflowFacade; protected function getTransitions(): array diff --git a/src/lib/Subscriber/PublishInTheFuture.php b/src/lib/Subscriber/PublishInTheFuture.php index 4617e7ab..558ad226 100644 --- a/src/lib/Subscriber/PublishInTheFuture.php +++ b/src/lib/Subscriber/PublishInTheFuture.php @@ -21,10 +21,10 @@ class PublishInTheFuture extends AbstractProcessStage implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Scheduler\Repository\DateBasedPublishServiceInterface */ + /** @var DateBasedPublishServiceInterface */ private $dateBasedPublisherService; - /** @var \Ibexa\Workflow\Behat\Facade\WorkflowFacade */ + /** @var WorkflowFacade */ private $workflowFacade; public function __construct( diff --git a/src/lib/Subscriber/Review.php b/src/lib/Subscriber/Review.php index 2372f2b3..ac9e70e6 100644 --- a/src/lib/Subscriber/Review.php +++ b/src/lib/Subscriber/Review.php @@ -22,13 +22,13 @@ class Review extends AbstractProcessStage implements EventSubscriberInterface { - /** @var \Ibexa\Behat\API\ContentData\ContentDataProvider */ + /** @var ContentDataProvider */ private $contentDataProvider; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Workflow\Behat\Facade\WorkflowFacade */ + /** @var WorkflowFacade */ private $workflowFacade; protected function getTransitions(): array diff --git a/tests/Browser/Element/Assert/CollectionAssertTest.php b/tests/Browser/Element/Assert/CollectionAssertTest.php index 63325b51..dfcc4b11 100644 --- a/tests/Browser/Element/Assert/CollectionAssertTest.php +++ b/tests/Browser/Element/Assert/CollectionAssertTest.php @@ -6,7 +6,7 @@ */ declare(strict_types=1); -namespace Ibexa\Tests\Behat\Browser\Element\Assert; +namespace Ibexa\Tests\Behat\Browser\Element\Assert; use Ibexa\Behat\Browser\Assert\CollectionAssert; use Ibexa\Behat\Browser\Element\ElementCollection; @@ -16,7 +16,7 @@ class CollectionAssertTest extends BaseTestCase { - /** @var \Ibexa\Behat\Browser\Locator\XPathLocator */ + /** @var XPathLocator */ private $locator; protected function setUp(): void @@ -27,8 +27,10 @@ protected function setUp(): void /** * @dataProvider provideForTestAssertionPasses */ - public function testAssertionPasses(array $expectedElementTexts, array $actualElementTexts): void - { + public function testAssertionPasses( + array $expectedElementTexts, + array $actualElementTexts + ): void { $collection = $this->createElementCollection($actualElementTexts); $collectionAssert = new CollectionAssert($this->locator, $collection); $returnedCollection = $collectionAssert->containsElementsWithText($expectedElementTexts); @@ -39,8 +41,10 @@ public function testAssertionPasses(array $expectedElementTexts, array $actualEl /** * @dataProvider provideForTestAssertionFails */ - public function testAssertionFails(array $expectedElementTexts, array $actualElementTexts): void - { + public function testAssertionFails( + array $expectedElementTexts, + array $actualElementTexts + ): void { $this->expectException(ExpectationFailedException::class); $collectionAssert = new CollectionAssert($this->locator, $this->createElementCollection($actualElementTexts)); $collectionAssert->containsElementsWithText($expectedElementTexts); diff --git a/tests/Browser/Locator/Validator/CssLocatorValidatorTest.php b/tests/Browser/Locator/Validator/CssLocatorValidatorTest.php index 0ca02c72..d8692b19 100644 --- a/tests/Browser/Locator/Validator/CssLocatorValidatorTest.php +++ b/tests/Browser/Locator/Validator/CssLocatorValidatorTest.php @@ -6,7 +6,7 @@ */ declare(strict_types=1); -namespace Ibexa\Tests\Behat\Browser\Locator\Validator; +namespace Ibexa\Tests\Behat\Browser\Locator\Validator; use Ibexa\Behat\Browser\Locator\CSSLocator; use Ibexa\Behat\Browser\Locator\Validator\CssLocatorValidator; diff --git a/tests/bundle/Form/Stub/UnstableChoiceListFactory.php b/tests/bundle/Form/Stub/UnstableChoiceListFactory.php index eb2a99c1..b273623e 100644 --- a/tests/bundle/Form/Stub/UnstableChoiceListFactory.php +++ b/tests/bundle/Form/Stub/UnstableChoiceListFactory.php @@ -33,10 +33,13 @@ public function __construct(int $successfulCallAfterNthTry) /** * @param iterable $choices * - * @throws \ErrorException + * @throws ErrorException */ - public function createListFromChoices(iterable $choices, ?callable $value = null, ?callable $filter = null): ChoiceListInterface - { + public function createListFromChoices( + iterable $choices, + ?callable $value = null, + ?callable $filter = null + ): ChoiceListInterface { ++$this->createListFromChoicesCounter; $this->failIfNeeded($this->createListFromChoicesCounter); @@ -44,7 +47,7 @@ public function createListFromChoices(iterable $choices, ?callable $value = null } /** - * @throws \ErrorException + * @throws ErrorException */ public function createListFromLoader( ChoiceLoaderInterface $loader, @@ -62,16 +65,16 @@ public function createListFromLoader( * @param array|callable|null $attr * @param array|callable $labelTranslationParameters * - * @throws \ErrorException + * @throws ErrorException */ public function createView( ChoiceListInterface $list, - array|callable|null $preferredChoices = null, - callable|false|null $label = null, + array | callable | null $preferredChoices = null, + callable | false | null $label = null, ?callable $index = null, ?callable $groupBy = null, - array|callable|null $attr = null, - array|callable $labelTranslationParameters = [], + array | callable | null $attr = null, + array | callable $labelTranslationParameters = [], bool $duplicatePreferredChoices = true ): ChoiceListView { ++$this->createViewCounter; @@ -81,7 +84,7 @@ public function createView( } /** - * @throws \ErrorException + * @throws ErrorException */ private function failIfNeeded(int $callNumber): void { diff --git a/tests/lib/Browser/Element/BaseTestCase.php b/tests/lib/Browser/Element/BaseTestCase.php index 1b9b2ac4..ce751d57 100644 --- a/tests/lib/Browser/Element/BaseTestCase.php +++ b/tests/lib/Browser/Element/BaseTestCase.php @@ -17,9 +17,11 @@ class BaseTestCase extends TestCase { - protected function createValidMinkNodeElement(string $elementText, bool $isVisible = true): NodeElement - { - $elementStub = $this->createStub(NodeElement::class); + protected function createValidMinkNodeElement( + string $elementText, + bool $isVisible = true + ): NodeElement { + $elementStub = self::createStub(NodeElement::class); $elementStub->method('isValid')->willReturn(true); $elementStub->method('getText')->willReturn($elementText); @@ -30,19 +32,22 @@ protected function createValidMinkNodeElement(string $elementText, bool $isVisib protected function createElement(string $elementText): ElementInterface { - $element = $this->createStub(ElementInterface::class); + $element = self::createStub(ElementInterface::class); $element->method('getText')->willReturn($elementText); return $element; } - protected function createElementWithChildElement(string $elementText, LocatorInterface $childLocator, ElementInterface $childElement): ElementInterface - { + protected function createElementWithChildElement( + string $elementText, + LocatorInterface $childLocator, + ElementInterface $childElement + ): ElementInterface { $element = $this->createMock(ElementInterface::class); $element->method('getText')->willReturn($elementText); $element->method('getTimeout')->willReturn(1); $element->method('find')->willReturnCallback(static function () use ($childLocator, $childElement) { - /** @var \Ibexa\Behat\Browser\Locator\LocatorInterface $locator */ + /** @var LocatorInterface $locator */ $locator = func_get_args()[0]; if ($locator == $childLocator) { return $childElement; @@ -52,7 +57,7 @@ protected function createElementWithChildElement(string $elementText, LocatorInt }); $element->method('findAll')->willReturnCallback(function () use ($childLocator, $childElement) { - /** @var \Ibexa\Behat\Browser\Locator\LocatorInterface $locator */ + /** @var LocatorInterface $locator */ $locator = func_get_args()[0]; if ($locator == $childLocator) { return $this->createCollection($childLocator, $childElement->getText()); @@ -64,8 +69,10 @@ protected function createElementWithChildElement(string $elementText, LocatorInt return $element; } - public function createCollection(LocatorInterface $locator, ...$elementTexts): ElementCollection - { + public function createCollection( + LocatorInterface $locator, + ...$elementTexts + ): ElementCollection { $elements = array_map(function (string $elementText) { return $this->createElement($elementText); }, $elementTexts); diff --git a/tests/lib/Browser/Element/Condition/ElementTransitionHasEndedConditionTest.php b/tests/lib/Browser/Element/Condition/ElementTransitionHasEndedConditionTest.php index b8cdde79..25ca923d 100644 --- a/tests/lib/Browser/Element/Condition/ElementTransitionHasEndedConditionTest.php +++ b/tests/lib/Browser/Element/Condition/ElementTransitionHasEndedConditionTest.php @@ -62,9 +62,11 @@ public function testElementTransitionHasNotStarted(): void ); } - private function createChildElement(bool $hasStartedTransition, bool $hasEndedTransition): ElementInterface - { - $childElement = $this->createStub(ElementInterface::class); + private function createChildElement( + bool $hasStartedTransition, + bool $hasEndedTransition + ): ElementInterface { + $childElement = self::createStub(ElementInterface::class); $childElement->method('getText')->willReturn('ChildText'); $childElement->method('hasClass')->will(self::returnValueMap( [ diff --git a/tests/lib/Browser/Element/Criterion/ChildElementTextCriterionTest.php b/tests/lib/Browser/Element/Criterion/ChildElementTextCriterionTest.php index 27feb1cf..b9cb7c6e 100644 --- a/tests/lib/Browser/Element/Criterion/ChildElementTextCriterionTest.php +++ b/tests/lib/Browser/Element/Criterion/ChildElementTextCriterionTest.php @@ -20,8 +20,11 @@ class ChildElementTextCriterionTest extends BaseTestCase /** * @dataProvider dataProviderTestMatches */ - public function testMatches(LocatorInterface $locator, string $childElementText, bool $shouldMatch): void - { + public function testMatches( + LocatorInterface $locator, + string $childElementText, + bool $shouldMatch + ): void { $criterion = new ChildElementTextCriterion(new XPathLocator('id', 'selector'), 'expectedChildText'); $element = $this->createElementWithChildElement('ignore', $locator, $this->createElement($childElementText)); diff --git a/tests/lib/Browser/Element/Criterion/ElementAttributeCriterionTest.php b/tests/lib/Browser/Element/Criterion/ElementAttributeCriterionTest.php index bc0bd775..0fb4a4e6 100644 --- a/tests/lib/Browser/Element/Criterion/ElementAttributeCriterionTest.php +++ b/tests/lib/Browser/Element/Criterion/ElementAttributeCriterionTest.php @@ -19,8 +19,11 @@ class ElementAttributeCriterionTest extends BaseTestCase /** * @dataProvider dataProviderTestMatches */ - public function testMatches(string $attributeName, string $attributeValue, bool $shouldMatch): void - { + public function testMatches( + string $attributeName, + string $attributeValue, + bool $shouldMatch + ): void { $criterion = new ElementAttributeCriterion('expectedAttribute', 'expectedValue'); $element = $this->createElementWithAttribute($attributeName, $attributeValue); @@ -58,9 +61,11 @@ public function testGetErrorMessageWhenNoElementFound(): void ); } - private function createElementWithAttribute($attribute, $value): ElementInterface - { - $element = $this->createStub(ElementInterface::class); + private function createElementWithAttribute( + $attribute, + $value + ): ElementInterface { + $element = self::createStub(ElementInterface::class); $element->method('getAttribute')->with($attribute)->willReturn($value); return $element; diff --git a/tests/lib/Browser/Element/Criterion/ElementTextCriterionTest.php b/tests/lib/Browser/Element/Criterion/ElementTextCriterionTest.php index 482d5d0c..dcf9dfa9 100644 --- a/tests/lib/Browser/Element/Criterion/ElementTextCriterionTest.php +++ b/tests/lib/Browser/Element/Criterion/ElementTextCriterionTest.php @@ -18,8 +18,10 @@ class ElementTextCriterionTest extends BaseTestCase /** * @dataProvider dataProviderTestMatches */ - public function testMatches(string $elementText, bool $shouldMatch): void - { + public function testMatches( + string $elementText, + bool $shouldMatch + ): void { $criterion = new ElementTextCriterion('expectedText'); $element = $this->createElement($elementText); diff --git a/tests/lib/Browser/Element/Criterion/ElementTextFragmentCriterionTest.php b/tests/lib/Browser/Element/Criterion/ElementTextFragmentCriterionTest.php index 2774ea3a..d294b2e1 100644 --- a/tests/lib/Browser/Element/Criterion/ElementTextFragmentCriterionTest.php +++ b/tests/lib/Browser/Element/Criterion/ElementTextFragmentCriterionTest.php @@ -18,8 +18,10 @@ class ElementTextFragmentCriterionTest extends BaseTestCase /** * @dataProvider dataProviderTestMatches */ - public function testMatches(string $elementText, bool $shouldMatch): void - { + public function testMatches( + string $elementText, + bool $shouldMatch + ): void { $criterion = new ElementTextFragmentCriterion('text'); $element = $this->createElement($elementText); Assert::assertEquals($shouldMatch, $criterion->matches($element)); diff --git a/tests/lib/Browser/Element/Debug/HighlightingElementTest.php b/tests/lib/Browser/Element/Debug/HighlightingElementTest.php index 4a3dd2c2..9900950a 100644 --- a/tests/lib/Browser/Element/Debug/HighlightingElementTest.php +++ b/tests/lib/Browser/Element/Debug/HighlightingElementTest.php @@ -18,7 +18,7 @@ class HighlightingElementTest extends TestCase { public function testShouldBeInitializable(): void { - $element = new Element($this->createMock(Session::class), $this->createStub(ElementInterface::class)); + $element = new Element($this->createMock(Session::class), self::createStub(ElementInterface::class)); Assert::assertInstanceOf(Element::class, $element); } diff --git a/tests/lib/Browser/Element/Debug/InteractiveElementTest.php b/tests/lib/Browser/Element/Debug/InteractiveElementTest.php index 91b3a85b..6a31df07 100644 --- a/tests/lib/Browser/Element/Debug/InteractiveElementTest.php +++ b/tests/lib/Browser/Element/Debug/InteractiveElementTest.php @@ -17,7 +17,7 @@ class InteractiveElementTest extends TestCase { public function testShouldBeInitializable(): void { - $element = new Element($this->createStub(ElementInterface::class)); + $element = new Element(self::createStub(ElementInterface::class)); Assert::assertInstanceOf(Element::class, $element); } diff --git a/tests/lib/Browser/Element/ElementCollectionTest.php b/tests/lib/Browser/Element/ElementCollectionTest.php index 431d213a..15283181 100644 --- a/tests/lib/Browser/Element/ElementCollectionTest.php +++ b/tests/lib/Browser/Element/ElementCollectionTest.php @@ -9,6 +9,7 @@ namespace Ibexa\Tests\Behat\Browser\Element; use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion; +use Ibexa\Behat\Browser\Element\ElementCollection; use Ibexa\Behat\Browser\Element\ElementInterface; use Ibexa\Behat\Browser\Element\Mapper\ElementTextMapper; use Ibexa\Behat\Browser\Exception\ElementNotFoundException; @@ -18,7 +19,7 @@ class ElementCollectionTest extends BaseTestCase { - /** @var \Ibexa\Behat\Browser\Element\ElementCollection */ + /** @var ElementCollection */ private $collection; protected function setUp(): void @@ -63,8 +64,11 @@ public function testCount(): void /** * @dataProvider dataProviderTestAny */ - public function testAny(LocatorInterface $locator, array $elementNames, bool $expectedAnyValue): void - { + public function testAny( + LocatorInterface $locator, + array $elementNames, + bool $expectedAnyValue + ): void { $collection = $this->createCollection($locator, ...$elementNames); Assert::assertEquals($expectedAnyValue, $collection->any()); } @@ -88,8 +92,11 @@ public static function dataProviderTestAny(): array /** * @dataProvider dataProviderTestEmpty */ - public function testEmpty(LocatorInterface $locator, array $elementNames, bool $expectedEmptyValue): void - { + public function testEmpty( + LocatorInterface $locator, + array $elementNames, + bool $expectedEmptyValue + ): void { $collection = $this->createCollection($locator, ...$elementNames); Assert::assertEquals($expectedEmptyValue, $collection->empty()); } @@ -129,7 +136,9 @@ public function testMap(): void { Assert::assertEquals( ['Element1', 'Element2', 'Element3'], - $this->collection->map(static function (ElementInterface $element) { return $element->getText(); }) + $this->collection->map(static function (ElementInterface $element) { + return $element->getText(); + }) ); } diff --git a/tests/lib/Browser/Element/ElementTest.php b/tests/lib/Browser/Element/ElementTest.php index e9f12ffe..7d05e518 100644 --- a/tests/lib/Browser/Element/ElementTest.php +++ b/tests/lib/Browser/Element/ElementTest.php @@ -9,6 +9,7 @@ namespace Ibexa\Tests\Behat\Browser\Element; use Behat\Mink\Element\NodeElement; +use Behat\Mink\Session; use Ibexa\Behat\Browser\Element\Condition\ElementExistsCondition; use Ibexa\Behat\Browser\Element\Element; use Ibexa\Behat\Browser\Element\Factory\ElementFactory; @@ -20,13 +21,13 @@ class ElementTest extends BaseTestCase { - /** @var \Ibexa\Behat\Browser\Locator\LocatorInterface */ + /** @var LocatorInterface */ private $irrelevantLocator; - /** @var \Ibexa\Behat\Browser\Locator\LocatorInterface */ + /** @var LocatorInterface */ private $invalidLocator; - /** @var \Behat\Mink\Session */ + /** @var Session */ private $session; public function setUp(): void @@ -134,8 +135,10 @@ public function testWaitUntilConditionWhenNotMet(): void /** * @dataProvider dataProvidertestAdditionalLocatorConditionsAreAppliedWhenUsingFind */ - public function testAdditionalLocatorConditionsAreAppliedWhenUsingFind(LocatorInterface $locator, string $expectedElementText): void - { + public function testAdditionalLocatorConditionsAreAppliedWhenUsingFind( + LocatorInterface $locator, + string $expectedElementText + ): void { $invisbleMinkElement = $this->createValidMinkNodeElement('InvisibleElement', false); $visibleMinkElement = $this->createValidMinkNodeElement('VisibleElement', true); @@ -158,8 +161,10 @@ public static function dataProvidertestAdditionalLocatorConditionsAreAppliedWhen /** * @dataProvider dataProvidertestAdditionalLocatorConditionsAreAppliedWhenUsingFindAll */ - public function testAdditionalLocatorConditionsAreAppliedWhenUsingFindAll(LocatorInterface $locator, int $expectedElementCount): void - { + public function testAdditionalLocatorConditionsAreAppliedWhenUsingFindAll( + LocatorInterface $locator, + int $expectedElementCount + ): void { $invisbleMinkElement = $this->createValidMinkNodeElement('InvisibleElement', false); $visibleMinkElement = $this->createValidMinkNodeElement('VisibleElement', true); diff --git a/tests/lib/Browser/Element/Mapper/ElementAttributeMapperTest.php b/tests/lib/Browser/Element/Mapper/ElementAttributeMapperTest.php index 3d049e32..90129ddd 100644 --- a/tests/lib/Browser/Element/Mapper/ElementAttributeMapperTest.php +++ b/tests/lib/Browser/Element/Mapper/ElementAttributeMapperTest.php @@ -24,7 +24,7 @@ protected function setUp(): void public function testMapsSingleElement(): void { - $element = $this->createStub(ElementInterface::class); + $element = self::createStub(ElementInterface::class); $element->method('getAttribute')->willReturn('AttributeValue'); Assert::assertEquals('AttributeValue', $this->mapper->map($element)); diff --git a/tests/lib/Browser/Element/Mapper/ElementTextMapperTest.php b/tests/lib/Browser/Element/Mapper/ElementTextMapperTest.php index 18c0011c..6df9eaf7 100644 --- a/tests/lib/Browser/Element/Mapper/ElementTextMapperTest.php +++ b/tests/lib/Browser/Element/Mapper/ElementTextMapperTest.php @@ -14,7 +14,7 @@ class ElementTextMapperTest extends BaseTestCase { - /** @var \Ibexa\Behat\Browser\Element\Mapper\ElementTextMapper */ + /** @var ElementTextMapper */ private $mapper; protected function setUp(): void diff --git a/tests/lib/Core/Behat/ArgumentParserTest.php b/tests/lib/Core/Behat/ArgumentParserTest.php index 59f1e67e..ec857025 100644 --- a/tests/lib/Core/Behat/ArgumentParserTest.php +++ b/tests/lib/Core/Behat/ArgumentParserTest.php @@ -24,8 +24,10 @@ class ArgumentParserTest extends TestCase /** * @dataProvider provideUrlData */ - public function testParserGivenUrlCorrectly(string $valueToParse, string $expectedResult) - { + public function testParserGivenUrlCorrectly( + string $valueToParse, + string $expectedResult + ) { $roleFacadeStub = $this->createMock(RoleFacade::class); $parameterProviderStub = $this->createMock(ParameterProvider::class); diff --git a/tests/lib/Core/Configuration/LocationAwareConfigurationEditorTest.php b/tests/lib/Core/Configuration/LocationAwareConfigurationEditorTest.php index e248546d..01686053 100644 --- a/tests/lib/Core/Configuration/LocationAwareConfigurationEditorTest.php +++ b/tests/lib/Core/Configuration/LocationAwareConfigurationEditorTest.php @@ -26,7 +26,7 @@ class LocationAwareConfigurationEditorTest extends TestCase public function setUp(): void { - $contentFacadeStub = $this->createStub(ContentFacade::class); + $contentFacadeStub = self::createStub(ContentFacade::class); $contentFacadeStub ->method('getLocationByLocationURL') ->willReturnMap( diff --git a/tests/lib/Core/Log/LogFileReaderTest.php b/tests/lib/Core/Log/LogFileReaderTest.php index ece363d5..34531877 100644 --- a/tests/lib/Core/Log/LogFileReaderTest.php +++ b/tests/lib/Core/Log/LogFileReaderTest.php @@ -10,6 +10,7 @@ use Ibexa\Behat\Core\Log\LogFileReader; use org\bovigo\vfs\vfsStream; +use org\bovigo\vfs\vfsStreamDirectory; use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; @@ -22,10 +23,10 @@ class LogFileReaderTest extends TestCase { private const FILENAME = 'application.logs'; - /** @var \org\bovigo\vfs\vfsStreamDirectory */ + /** @var vfsStreamDirectory */ private $fileSystemRoot; - /** @var \Ibexa\Behat\Core\Log\LogFileReader */ + /** @var LogFileReader */ private $logReader; public function setUp(): void