diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0212f4458d..3436ee5d30 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,21 +14,14 @@ jobs: strategy: matrix: php: - - '8.0' + - '8.3' steps: - - uses: actions/checkout@v4 - - - name: Setup PHP Action - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none - extensions: 'pdo_sqlite, gd' - tools: cs2pr + - uses: actions/checkout@v5 - - uses: "ramsey/composer-install@v3" + - uses: ibexa/gh-workflows/actions/composer-install@main with: - dependency-versions: "highest" + gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} + gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} - name: Run code style check run: composer run-script check-cs -- --format=checkstyle | cs2pr @@ -47,20 +40,12 @@ jobs: - '8.1' steps: - - uses: actions/checkout@v4 - - - name: Setup PHP Action - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none - extensions: pdo_sqlite, gd - tools: cs2pr + - uses: actions/checkout@v5 - - uses: "ramsey/composer-install@v3" + - uses: ibexa/gh-workflows/actions/composer-install@main with: - dependency-versions: "highest" - composer-options: "--prefer-dist --no-progress" + gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} + gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" @@ -99,19 +84,13 @@ jobs: - '8.1' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v5 - - name: Setup PHP Action - uses: shivammathur/setup-php@v2 + - uses: ibexa/gh-workflows/actions/composer-install@main with: - php-version: ${{ matrix.php }} - coverage: none - extensions: pdo_pgsql, gd - tools: cs2pr - - - uses: ramsey/composer-install@v2 - with: - dependency-versions: "highest" + gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} + gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} + php-extensions: 'pdo_pgsql, gd' - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" @@ -154,19 +133,13 @@ jobs: - '8.1' steps: - - uses: actions/checkout@v3 - - - name: Setup PHP Action - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: none - extensions: pdo_mysql, gd - tools: cs2pr + - uses: actions/checkout@v5 - - uses: ramsey/composer-install@v2 + - uses: ibexa/gh-workflows/actions/composer-install@main with: - dependency-versions: "highest" + gh-client-id: ${{ secrets.AUTOMATION_CLIENT_ID }} + gh-client-secret: ${{ secrets.AUTOMATION_CLIENT_SECRET }} + php-extensions: 'pdo_mysql, gd' - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" diff --git a/composer.json b/composer.json index 5b7cf12e7c..c93f02e145 100644 --- a/composer.json +++ b/composer.json @@ -74,7 +74,7 @@ "matthiasnoback/symfony-dependency-injection-test": "^4.0", "ibexa/doctrine-schema": "~4.6.0@dev", "ibexa/http-cache": "~4.6.0@dev", - "ibexa/code-style": "^1.3.x-dev", + "ibexa/code-style": "^2.2.x-dev", "ibexa/notifications": "~4.6.0@dev", "ibexa/phpstan": "~4.6.x-dev", "ibexa/test-rest": "^0.1.x-dev", diff --git a/phpstan-baseline-8.0.neon b/phpstan-baseline-8.0.neon index 199f1d4121..5da71ea6ff 100644 --- a/phpstan-baseline-8.0.neon +++ b/phpstan-baseline-8.0.neon @@ -1,211 +1,241 @@ parameters: ignoreErrors: - - message: "#^Parameter \\#1 \\$array of function array_shift expects array, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$array of function array_shift expects array, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/bundle/Controller/Content/VersionDraftConflictController.php - - message: "#^Parameter \\#1 \\$array of function array_keys expects array, array\\|null given\\.$#" + message: '#^Parameter \#1 \$array of function array_keys expects array, array\|null given\.$#' + identifier: argument.type count: 1 path: src/bundle/Controller/ContentDraftController.php - - message: "#^Parameter \\#1 \\$array of function usort expects TArray of array\\, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$array of function usort expects TArray of array\, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/bundle/Controller/ContentTypeController.php - - message: "#^Parameter \\#1 \\$string1 of function strnatcasecmp expects string, string\\|null given\\.$#" + message: '#^Parameter \#1 \$string1 of function strnatcasecmp expects string, string\|null given\.$#' + identifier: argument.type count: 1 path: src/bundle/Controller/ContentTypeController.php - - message: "#^Parameter \\#2 \\$string2 of function strnatcasecmp expects string, string\\|null given\\.$#" + message: '#^Parameter \#2 \$string2 of function strnatcasecmp expects string, string\|null given\.$#' + identifier: argument.type count: 1 path: src/bundle/Controller/ContentTypeController.php - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$value of function count expects array\|Countable, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/bundle/Controller/ContentTypeGroupController.php - - message: "#^Parameter \\#1 \\$array of function array_shift expects array, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$array of function array_shift expects array, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/bundle/Controller/ContentViewController.php - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$value of function count expects array\|Countable, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/bundle/Controller/ContentViewController.php - - message: "#^Parameter \\#1 \\$separator of function explode expects non\\-empty\\-string, string given\\.$#" + message: '#^Parameter \#1 \$separator of function explode expects non\-empty\-string, string given\.$#' + identifier: argument.type count: 1 path: src/bundle/Templating/Twig/UniversalDiscoveryExtension.php - - message: "#^Parameter \\#1 \\$object of function date_format expects DateTimeInterface, DateTime\\|false given\\.$#" + message: '#^Parameter \#1 \$object of function date_format expects DateTimeInterface, DateTime\|false given\.$#' + identifier: argument.type count: 4 path: src/lib/Behat/Component/Fields/DateAndTime.php - - message: "#^Parameter \\#1 \\$object of function date_format expects DateTimeInterface, DateTime\\|false given\\.$#" + message: '#^Parameter \#1 \$object of function date_format expects DateTimeInterface, DateTime\|false given\.$#' + identifier: argument.type count: 4 path: src/lib/Behat/Component/Fields/Time.php - - message: "#^Parameter \\#2 \\$offset of function substr expects int, int\\<0, max\\>\\|false given\\.$#" + message: '#^Parameter \#2 \$offset of function substr expects int, int\<0, max\>\|false given\.$#' + identifier: argument.type count: 1 path: src/lib/Behat/Page/RolePage.php - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$array of function array_filter expects array, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/lib/EventListener/ContentProxyCreateDraftListener.php - - message: "#^Parameter \\#1 \\.\\.\\.\\$arrays of function array_merge expects array, array\\|null given\\.$#" + message: '#^Parameter \#1 \.\.\.\$arrays of function array_merge expects array, array\|null given\.$#' + identifier: argument.type count: 1 path: src/lib/Form/DataTransformer/FieldType/BinaryFileValueTransformer.php - - message: "#^Parameter \\#1 \\.\\.\\.\\$arrays of function array_merge expects array, array\\|null given\\.$#" + message: '#^Parameter \#1 \.\.\.\$arrays of function array_merge expects array, array\|null given\.$#' + identifier: argument.type count: 1 path: src/lib/Form/DataTransformer/FieldType/ImageAssetValueTransformer.php - - message: "#^Parameter \\#1 \\.\\.\\.\\$arrays of function array_merge expects array, array\\|null given\\.$#" + message: '#^Parameter \#1 \.\.\.\$arrays of function array_merge expects array, array\|null given\.$#' + identifier: argument.type count: 1 path: src/lib/Form/DataTransformer/FieldType/ImageValueTransformer.php - - message: "#^Parameter \\#1 \\.\\.\\.\\$arrays of function array_merge expects array, array\\|null given\\.$#" + message: '#^Parameter \#1 \.\.\.\$arrays of function array_merge expects array, array\|null given\.$#' + identifier: argument.type count: 1 path: src/lib/Form/DataTransformer/FieldType/MediaValueTransformer.php - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$array of function array_filter expects array, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/lib/Form/EventListener/AddLanguageFieldBasedOnContentListener.php - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$array of function array_filter expects array, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/lib/Form/Type/ChoiceList/Loader/AvailableTranslationLanguageChoiceLoader.php - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$array of function array_filter expects array, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/lib/Form/Type/ChoiceList/Loader/BaseTranslationLanguageChoiceLoader.php - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$array of function array_filter expects array, iterable\ given\.$#' + identifier: argument.type count: 2 path: src/lib/Form/Type/ChoiceList/Loader/ContentEditTranslationChoiceLoader.php - - message: "#^Parameter \\#1 \\$array of function usort expects TArray of array\\, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$array of function usort expects TArray of array\, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/lib/Form/Type/ChoiceList/Loader/ContentTypeChoiceLoader.php - - message: "#^Parameter \\#1 \\$string1 of function strnatcasecmp expects string, string\\|null given\\.$#" + message: '#^Parameter \#1 \$string1 of function strnatcasecmp expects string, string\|null given\.$#' + identifier: argument.type count: 1 path: src/lib/Form/Type/ChoiceList/Loader/ContentTypeChoiceLoader.php - - message: "#^Parameter \\#2 \\$string2 of function strnatcasecmp expects string, string\\|null given\\.$#" + message: '#^Parameter \#2 \$string2 of function strnatcasecmp expects string, string\|null given\.$#' + identifier: argument.type count: 1 path: src/lib/Form/Type/ChoiceList/Loader/ContentTypeChoiceLoader.php - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$array of function array_filter expects array, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/lib/Form/Type/Content/Translation/TranslationAddType.php - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$array of function array_filter expects array, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/lib/Form/Type/ContentType/Translation/TranslationAddType.php - - message: "#^Parameter \\#1 \\$string of function strtolower expects string, string\\|null given\\.$#" + message: '#^Parameter \#1 \$string of function strtolower expects string, string\|null given\.$#' + identifier: argument.type count: 1 path: src/lib/Form/Type/FieldDefinition/User/PasswordConstraintCheckboxType.php - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$array of function array_filter expects array, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/lib/Form/Type/ObjectState/ContentObjectStateUpdateType.php - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$array of function array_filter expects array, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/lib/Pagination/Mapper/AbstractPagerContentToDataMapper.php - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$value of function count expects array\|Countable, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/lib/Permission/PermissionChecker.php - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$iterator of function iterator_to_array expects Traversable, iterable\ given\.$#' + identifier: argument.type + count: 1 + path: src/lib/Siteaccess/SiteaccessResolver.php + + - + message: '#^Parameter \#1 \$array of function array_filter expects array, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/lib/Tab/Dashboard/PagerLocationToDataMapper.php - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$array of function array_filter expects array, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/lib/Tab/LocationView/ContentTab.php - - message: "#^Parameter \\#1 \\$string of function strtolower expects string, string\\|null given\\.$#" + message: '#^Parameter \#1 \$string of function strtolower expects string, string\|null given\.$#' + identifier: argument.type count: 1 path: src/lib/Translation/Extractor/PolicyTranslationExtractor.php - - message: "#^Parameter \\#1 \\$array of function usort expects TArray of array\\, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$array of function usort expects TArray of array\, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/lib/UI/Config/Provider/ContentTypes.php - - message: "#^Parameter \\#1 \\$string1 of function strnatcasecmp expects string, string\\|null given\\.$#" + message: '#^Parameter \#1 \$string1 of function strnatcasecmp expects string, string\|null given\.$#' + identifier: argument.type count: 1 path: src/lib/UI/Config/Provider/ContentTypes.php - - message: "#^Parameter \\#2 \\$string2 of function strnatcasecmp expects string, string\\|null given\\.$#" + message: '#^Parameter \#2 \$string2 of function strnatcasecmp expects string, string\|null given\.$#' + identifier: argument.type count: 1 path: src/lib/UI/Config/Provider/ContentTypes.php - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\ given\\.$#" + message: '#^Parameter \#1 \$array of function array_filter expects array, iterable\ given\.$#' + identifier: argument.type count: 1 path: src/lib/UI/Dataset/ContentDraftsDataset.php - - message: "#^Parameter \\#2 \\$length of function array_chunk expects int\\<1, max\\>, int given\\.$#" + message: '#^Parameter \#2 \$length of function array_chunk expects int\<1, max\>, int given\.$#' + identifier: argument.type count: 1 path: src/lib/UI/Module/ContentTree/NodeFactory.php - - message: "#^Deprecated in PHP 8\\.0\\: Required parameter \\$translator follows optional parameter \\$name\\.$#" - count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - - - message: "#^Deprecated in PHP 8\\.0\\: Required parameter \\$twig follows optional parameter \\$name\\.$#" + message: '#^Parameter \#1 \$iterator of function iterator_to_array expects Traversable, iterable\ given\.$#' + identifier: argument.type count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - - - message: "#^Parameter \\#1 \\$iterator of function iterator_to_array expects Traversable, iterable\\ given\\.$#" - count: 1 - path: src/lib/Siteaccess/SiteaccessResolver.php - - - - message: "#^Parameter \\#1 \\$iterator of function iterator_to_array expects Traversable, iterable\\ given\\.$#" - count: 1 - path: tests/lib/Form/Data/ContentTypeDataTest.php + path: tests/lib/Form/Data/ContentTypeDataTest.php diff --git a/phpstan-baseline-8.3.neon b/phpstan-baseline-8.3.neon index 9c45740199..da5c8dc331 100644 --- a/phpstan-baseline-8.3.neon +++ b/phpstan-baseline-8.3.neon @@ -189,13 +189,3 @@ parameters: message: "#^Parameter \\#2 \\$length of function array_chunk expects int\\<1, max\\>, int given\\.$#" count: 1 path: src/lib/UI/Module/ContentTree/NodeFactory.php - - - - message: "#^Deprecated in PHP 8\\.0\\: Required parameter \\$translator follows optional parameter \\$name\\.$#" - count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - - - message: "#^Deprecated in PHP 8\\.0\\: Required parameter \\$twig follows optional parameter \\$name\\.$#" - count: 1 - path: tests/lib/Tab/TabRegistryTest.php diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 17059dbcbe..129dadb8e4 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -12798,12 +12798,6 @@ parameters: count: 1 path: src/lib/UI/Config/Provider/Languages.php - - - message: '#^Method Ibexa\\AdminUi\\UI\\Config\\Provider\\Languages\:\:__construct\(\) has parameter \$siteAccesses with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/UI/Config/Provider/Languages.php - - message: '#^Method Ibexa\\AdminUi\\UI\\Config\\Provider\\Languages\:\:getConfig\(\) return type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -12828,12 +12822,6 @@ parameters: count: 1 path: src/lib/UI/Config/Provider/Languages.php - - - message: '#^PHPDoc tag @param has invalid value \(string\[\]\)\: Unexpected token "\\n ", expected variable at offset 193 on line 4$#' - identifier: phpDoc.parseError - count: 1 - path: src/lib/UI/Config/Provider/Languages.php - - message: '#^Method Ibexa\\AdminUi\\UI\\Config\\Provider\\Locations\:\:getConfig\(\) return type has no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -14694,12 +14682,6 @@ parameters: count: 1 path: tests/bundle/Templating/Twig/LimitationValueRenderingExtensionTest.php - - - message: '#^Method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) invoked with 3 parameters, 1\-2 required\.$#' - identifier: arguments.count - count: 1 - path: tests/bundle/Templating/Twig/LimitationValueRenderingExtensionTest.php - - message: '#^Parameter \#1 \$name of method Twig\\Loader\\LoaderInterface\:\:getSourceContext\(\) expects string, int\|string given\.$#' identifier: argument.type @@ -14844,12 +14826,6 @@ parameters: count: 2 path: tests/lib/EventListener/RequestLocaleListenerTest.php - - - message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertNull\(\) with null will always evaluate to true\.$#' - identifier: method.alreadyNarrowedType - count: 2 - path: tests/lib/EventListener/SetViewParametersListenerTest.php - - message: '#^Method Ibexa\\Tests\\AdminUi\\EventListener\\SetViewParametersListenerTest\:\:createFieldMock\(\) should return Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\Field&PHPUnit\\Framework\\MockObject\\MockObject but returns PHPUnit\\Framework\\MockObject\\MockObject&Symfony\\Component\\Form\\FormInterface\.$#' identifier: return.type @@ -14868,18 +14844,6 @@ parameters: count: 1 path: tests/lib/EventListener/SetViewParametersListenerTest.php - - - message: '#^Result of method Ibexa\\AdminUi\\EventListener\\SetViewParametersListener\:\:setContentEditViewTemplateParameters\(\) \(void\) is used\.$#' - identifier: method.void - count: 1 - path: tests/lib/EventListener/SetViewParametersListenerTest.php - - - - message: '#^Result of method Ibexa\\AdminUi\\EventListener\\SetViewParametersListener\:\:setUserUpdateViewTemplateParameters\(\) \(void\) is used\.$#' - identifier: method.void - count: 1 - path: tests/lib/EventListener/SetViewParametersListenerTest.php - - message: '#^Access to protected property Ibexa\\AdminUi\\Form\\Data\\ContentTranslationData\:\:\$fieldsData\.$#' identifier: property.protected @@ -16878,90 +16842,6 @@ parameters: count: 1 path: tests/lib/Tab/TabGroupTest.php - - - message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertSame\(\) with array\{''tab1'', ''tab2''\} and array\ will always evaluate to false\.$#' - identifier: method.impossibleType - count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - - - message: '#^Method Ibexa\\Contracts\\AdminUi\\Tab\\AbstractTab@anonymous/tests/lib/Tab/TabRegistryTest\.php\:158\:\:renderView\(\) has parameter \$parameters with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - - - message: '#^Method Ibexa\\Contracts\\AdminUi\\Tab\\AbstractTab@anonymous/tests/lib/Tab/TabRegistryTest\.php\:158\:\:renderView\(\) should return string but returns null\.$#' - identifier: return.type - count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - - - message: '#^Method Ibexa\\Tests\\AdminUi\\Tab\\TabRegistryTest\:\:createTabGroup\(\) has parameter \$tabs with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - - - message: '#^Method Ibexa\\Tests\\AdminUi\\Tab\\TabRegistryTest\:\:testAddTabGroup\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - - - message: '#^Method Ibexa\\Tests\\AdminUi\\Tab\\TabRegistryTest\:\:testAddTabGroupWithSameIdentifier\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - - - message: '#^Method Ibexa\\Tests\\AdminUi\\Tab\\TabRegistryTest\:\:testAddTabToExistingGroup\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - - - message: '#^Method Ibexa\\Tests\\AdminUi\\Tab\\TabRegistryTest\:\:testAddTabToNonExistentGroup\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - - - message: '#^Method Ibexa\\Tests\\AdminUi\\Tab\\TabRegistryTest\:\:testGetTabFromGroup\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - - - message: '#^Method Ibexa\\Tests\\AdminUi\\Tab\\TabRegistryTest\:\:testGetTabFromGroupWhenGroupDoesNotExist\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - - - message: '#^Method Ibexa\\Tests\\AdminUi\\Tab\\TabRegistryTest\:\:testGetTabFromGroupWhenTabDoesNotExist\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - - - message: '#^Method Ibexa\\Tests\\AdminUi\\Tab\\TabRegistryTest\:\:testGetTabsByGroupName\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - - - message: '#^Method Ibexa\\Tests\\AdminUi\\Tab\\TabRegistryTest\:\:testGetTabsByGroupNameWhenGroupDoesNotExist\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - - - message: '#^Property Ibexa\\Tests\\AdminUi\\Tab\\TabRegistryTest\:\:\$groupName has no type specified\.$#' - identifier: missingType.property - count: 1 - path: tests/lib/Tab/TabRegistryTest.php - - message: '#^Method Ibexa\\Tests\\AdminUi\\Translation\\Extractor\\LimitationTranslationExtractorTest\:\:testExtract\(\) has no return type specified\.$#' identifier: missingType.return diff --git a/src/bundle/Command/CompileAssetsCommand.php b/src/bundle/Command/CompileAssetsCommand.php index f6a4a67b35..af3d1dca44 100644 --- a/src/bundle/Command/CompileAssetsCommand.php +++ b/src/bundle/Command/CompileAssetsCommand.php @@ -58,8 +58,10 @@ protected function configure(): void ; } - protected function initialize(InputInterface $input, OutputInterface $output): void - { + protected function initialize( + InputInterface $input, + OutputInterface $output + ): void { $timeout = $input->getOption('timeout'); if (!is_numeric($timeout)) { @@ -67,8 +69,10 @@ protected function initialize(InputInterface $input, OutputInterface $output): v } } - protected function execute(InputInterface $input, OutputInterface $output): int - { + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { $timeout = (float)$input->getOption('timeout'); $env = $input->getOption('env'); $configName = $input->getOption('config-name'); @@ -98,7 +102,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int sprintf('Evaluating command %s', $yarnEncoreCommand) )); - $process->run(static function ($type, $buffer) use ($output, $debugFormatter, $process) { + $process->run(static function ( + $type, + $buffer + ) use ($output, $debugFormatter, $process) { $output->write( $debugFormatter->progress( spl_object_hash($process), diff --git a/src/bundle/Controller/AllNotificationsController.php b/src/bundle/Controller/AllNotificationsController.php index 036312de44..726c74b9bb 100644 --- a/src/bundle/Controller/AllNotificationsController.php +++ b/src/bundle/Controller/AllNotificationsController.php @@ -14,8 +14,10 @@ final class AllNotificationsController extends Controller { - public function renderAllNotificationsPageAction(Request $request, int $page): Response - { + public function renderAllNotificationsPageAction( + Request $request, + int $page + ): Response { return $this->forward( NotificationController::class . '::renderNotificationsPageAction', [ diff --git a/src/bundle/Controller/AssetController.php b/src/bundle/Controller/AssetController.php index bbc1784a5b..8e4ddb59f9 100644 --- a/src/bundle/Controller/AssetController.php +++ b/src/bundle/Controller/AssetController.php @@ -11,7 +11,9 @@ use Exception; use Ibexa\AdminUi\Form\Data\Asset\ImageAssetUploadData; use Ibexa\Contracts\AdminUi\Controller\Controller; +use Ibexa\Core\Base\Exceptions\InvalidArgumentType; use Ibexa\Core\FieldType\Image\Value as ImageValue; +use Ibexa\Core\FieldType\ImageAsset\AssetMapper; use Ibexa\Core\FieldType\ImageAsset\AssetMapper as ImageAssetMapper; use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\HttpFoundation\JsonResponse; @@ -30,23 +32,23 @@ class AssetController extends Controller public const LANGUAGE_CODE_KEY = 'languageCode'; public const FILE_KEY = 'file'; - /** @var \Symfony\Component\Validator\Validator\ValidatorInterface */ + /** @var ValidatorInterface */ private $validator; - /** @var \Symfony\Component\Security\Csrf\CsrfTokenManagerInterface */ + /** @var CsrfTokenManagerInterface */ private $csrfTokenManager; - /** @var \Ibexa\Core\FieldType\ImageAsset\AssetMapper */ + /** @var AssetMapper */ private $imageAssetMapper; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; /** - * @param \Symfony\Component\Validator\Validator\ValidatorInterface $validator - * @param \Symfony\Component\Security\Csrf\CsrfTokenManagerInterface $csrfTokenManager - * @param \Ibexa\Core\FieldType\ImageAsset\AssetMapper $imageAssetMapper - * @param \Symfony\Contracts\Translation\TranslatorInterface $translator + * @param ValidatorInterface $validator + * @param CsrfTokenManagerInterface $csrfTokenManager + * @param AssetMapper $imageAssetMapper + * @param TranslatorInterface $translator */ public function __construct( ValidatorInterface $validator, @@ -61,11 +63,11 @@ public function __construct( } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * - * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType + * @throws InvalidArgumentType */ public function uploadImageAction(Request $request): Response { @@ -111,7 +113,7 @@ public function uploadImageAction(Request $request): Response } /** - * @return \Symfony\Component\HttpFoundation\JsonResponse + * @return JsonResponse */ private function createInvalidCsrfResponse(): JsonResponse { @@ -126,9 +128,9 @@ private function createInvalidCsrfResponse(): JsonResponse } /** - * @param \Symfony\Component\Validator\ConstraintViolationListInterface $errors + * @param ConstraintViolationListInterface $errors * - * @return \Symfony\Component\HttpFoundation\JsonResponse + * @return JsonResponse */ private function createInvalidInputResponse(ConstraintViolationListInterface $errors): JsonResponse { @@ -143,7 +145,7 @@ private function createInvalidInputResponse(ConstraintViolationListInterface $er /** * @param string $errorMessage * - * @return \Symfony\Component\HttpFoundation\JsonResponse + * @return JsonResponse */ private function createGenericErrorResponse(string $errorMessage): JsonResponse { @@ -158,7 +160,7 @@ private function createGenericErrorResponse(string $errorMessage): JsonResponse } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * * @return bool */ diff --git a/src/bundle/Controller/BookmarkController.php b/src/bundle/Controller/BookmarkController.php index 56a2fc2e81..c07aebbe6b 100644 --- a/src/bundle/Controller/BookmarkController.php +++ b/src/bundle/Controller/BookmarkController.php @@ -24,22 +24,22 @@ class BookmarkController extends Controller { - /** @var \Ibexa\Contracts\Core\Repository\BookmarkService */ + /** @var BookmarkService */ private $bookmarkService; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ + /** @var DatasetFactory */ private $datasetFactory; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( @@ -59,9 +59,9 @@ public function __construct( } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function listAction(Request $request): Response { @@ -93,9 +93,9 @@ public function listAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function removeAction(Request $request): Response { diff --git a/src/bundle/Controller/BulkOperation/BulkOperationController.php b/src/bundle/Controller/BulkOperation/BulkOperationController.php index 39e95b1f1b..862f289ae3 100644 --- a/src/bundle/Controller/BulkOperation/BulkOperationController.php +++ b/src/bundle/Controller/BulkOperation/BulkOperationController.php @@ -8,6 +8,7 @@ namespace Ibexa\Bundle\AdminUi\Controller\BulkOperation; +use Ibexa\AdminUi\REST\Value\BulkOperation; use Ibexa\AdminUi\REST\Value\BulkOperationResponse; use Ibexa\AdminUi\REST\Value\Operation; use Ibexa\AdminUi\REST\Value\OperationResponse; @@ -18,11 +19,11 @@ class BulkOperationController extends RestController { - /** @var \Symfony\Component\HttpKernel\HttpKernelInterface */ + /** @var HttpKernelInterface */ private $httpKernel; /** - * @param \Symfony\Component\HttpKernel\HttpKernelInterface $httpKernel + * @param HttpKernelInterface $httpKernel */ public function __construct( HttpKernelInterface $httpKernel @@ -31,15 +32,15 @@ public function __construct( } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Ibexa\AdminUi\REST\Value\BulkOperationResponse + * @return BulkOperationResponse * * @throws \Exception */ public function bulkAction(Request $request): BulkOperationResponse { - /** @var \Ibexa\AdminUi\REST\Value\BulkOperation $operationList */ + /** @var BulkOperation $operationList */ $operationList = $this->inputDispatcher->parse( new Message( ['Content-Type' => $request->headers->get('Content-Type')], @@ -65,13 +66,15 @@ public function bulkAction(Request $request): BulkOperationResponse } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\AdminUi\REST\Value\Operation $operation + * @param Request $request + * @param Operation $operation * - * @return \Symfony\Component\HttpFoundation\Request + * @return Request */ - private function buildSubRequest(Request $request, Operation $operation): Request - { + private function buildSubRequest( + Request $request, + Operation $operation + ): Request { $subRequest = Request::create( $operation->uri, $operation->method, diff --git a/src/bundle/Controller/Content/ContentTreeController.php b/src/bundle/Controller/Content/ContentTreeController.php index 4d04c34ece..645f95019f 100644 --- a/src/bundle/Controller/Content/ContentTreeController.php +++ b/src/bundle/Controller/Content/ContentTreeController.php @@ -9,6 +9,7 @@ namespace Ibexa\Bundle\AdminUi\Controller\Content; use Ibexa\AdminUi\Permission\LookupLimitationsTransformer; +use Ibexa\AdminUi\REST\Value\ContentTree\LoadSubtreeRequest; use Ibexa\AdminUi\REST\Value\ContentTree\LoadSubtreeRequestNode; use Ibexa\AdminUi\REST\Value\ContentTree\Node; use Ibexa\AdminUi\REST\Value\ContentTree\NodeExtendedInfo; @@ -18,6 +19,10 @@ use Ibexa\AdminUi\UI\Module\ContentTree\NodeFactory; use Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface; use Ibexa\Contracts\Core\Limitation\Target; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Values\Content\Content; @@ -70,9 +75,9 @@ public function __construct( } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws NotFoundException + * @throws UnauthorizedException + * @throws InvalidArgumentException */ public function loadChildrenAction( Request $request, @@ -99,17 +104,17 @@ public function loadChildrenAction( } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Ibexa\AdminUi\REST\Value\ContentTree\Root + * @return Root * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws InvalidArgumentException + * @throws NotFoundException + * @throws UnauthorizedException */ public function loadSubtreeAction(Request $request): Root { - /** @var \Ibexa\AdminUi\REST\Value\ContentTree\LoadSubtreeRequest $loadSubtreeRequest */ + /** @var LoadSubtreeRequest $loadSubtreeRequest */ $loadSubtreeRequest = $this->inputDispatcher->parse( new Message( ['Content-Type' => $request->headers->get('Content-Type')], @@ -178,9 +183,9 @@ private function prepareLocationsArray(array $locationIdList): array /** * @internal for internal use by this package * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws BadStateException + * @throws InvalidArgumentException + * @throws NotFoundException */ public function loadNodeExtendedInfoAction(Location $location): NodeExtendedInfo { @@ -200,9 +205,9 @@ public function loadNodeExtendedInfoAction(Location $location): NodeExtendedInfo /** * @return TPermissionRestrictions * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws BadStateException + * @throws InvalidArgumentException + * @throws NotFoundException */ private function getLocationPermissionRestrictions(Location $location): array { @@ -242,8 +247,8 @@ private function getLocationPermissionRestrictions(Location $location): array } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws BadStateException + * @throws InvalidArgumentException */ private function canUserRemoveContent(Location $location): bool { @@ -277,8 +282,8 @@ private function canUserRemoveContent(Location $location): bool } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws BadStateException + * @throws InvalidArgumentException */ private function canUserHideContent(Location $location): bool { @@ -296,8 +301,8 @@ private function canUserHideContent(Location $location): bool } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws BadStateException + * @throws InvalidArgumentException */ private function isPreviewable( Location $location, @@ -327,8 +332,8 @@ private function isPreviewable( } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws BadStateException + * @throws InvalidArgumentException */ private function canUserEditContent(Location $location): bool { diff --git a/src/bundle/Controller/Content/VersionDraftConflictController.php b/src/bundle/Controller/Content/VersionDraftConflictController.php index e3d137458c..f4f330d083 100644 --- a/src/bundle/Controller/Content/VersionDraftConflictController.php +++ b/src/bundle/Controller/Content/VersionDraftConflictController.php @@ -13,6 +13,8 @@ use Ibexa\AdminUi\UI\Dataset\DatasetFactory; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\UserService; @@ -22,27 +24,27 @@ class VersionDraftConflictController extends Controller { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ + /** @var DatasetFactory */ private $datasetFactory; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; /** - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\AdminUi\UI\Dataset\DatasetFactory $datasetFactory - * @param \Ibexa\Contracts\Core\Repository\UserService $userService - * @param \Symfony\Contracts\Translation\TranslatorInterface $translator + * @param LocationService $locationService + * @param ContentService $contentService + * @param DatasetFactory $datasetFactory + * @param UserService $userService + * @param TranslatorInterface $translator */ public function __construct( LocationService $locationService, @@ -63,11 +65,11 @@ public function __construct( * @param string $languageCode * @param int|null $locationId * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws BadStateException + * @throws NotFoundException + * @throws UnauthorizedException */ public function draftHasNoConflictAction( int $contentId, diff --git a/src/bundle/Controller/ContentController.php b/src/bundle/Controller/ContentController.php index 866c9ead9a..b151a0e122 100644 --- a/src/bundle/Controller/ContentController.php +++ b/src/bundle/Controller/ContentController.php @@ -51,50 +51,51 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; class ContentController extends Controller { - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\AdminUi\Form\DataMapper\ContentMainLocationUpdateMapper */ + /** @var ContentMainLocationUpdateMapper */ private $contentMainLocationUpdateMapper; - /** @var \Ibexa\AdminUi\Siteaccess\SiteaccessResolverInterface */ + /** @var SiteaccessResolverInterface */ private $siteaccessResolver; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\AdminUi\Permission\LookupLimitationsTransformer */ + /** @var LookupLimitationsTransformer */ private $lookupLimitationsTransformer; - /** @var \Ibexa\Core\Helper\TranslationHelper */ + /** @var TranslationHelper */ private $translationHelper; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; - /** @var \Ibexa\AdminUi\Siteaccess\SiteAccessNameGeneratorInterface */ + /** @var SiteAccessNameGeneratorInterface */ private $siteAccessNameGenerator; - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ + /** @var EventDispatcherInterface */ private $eventDispatcher; private FormFactoryInterface $baseFormFactory; @@ -146,13 +147,13 @@ public function __construct( } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException * @throws ApiException\ContentValidationException * @throws ApiException\ContentFieldValidationException @@ -197,7 +198,7 @@ public function proxyCreateAction( string $languageCode, int $parentLocationId ): Response { - /** @var \Ibexa\Contracts\AdminUi\Event\ContentProxyCreateEvent $event */ + /** @var ContentProxyCreateEvent $event */ $event = $this->eventDispatcher->dispatch( new ContentProxyCreateEvent( $contentType, @@ -220,13 +221,13 @@ public function proxyCreateAction( } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws UnauthorizedException + * @throws InvalidOptionsException */ public function editAction(Request $request): Response { @@ -259,7 +260,7 @@ public function editAction(Request $request): Response ]); } - /** @var \Ibexa\Contracts\AdminUi\Event\ContentEditEvent $event */ + /** @var ContentEditEvent $event */ $event = $this->eventDispatcher->dispatch( new ContentEditEvent( $content, @@ -299,7 +300,7 @@ public function editAction(Request $request): Response } } - /** @var \Ibexa\AdminUi\Form\Data\Content\Draft\ContentEditData $data */ + /** @var ContentEditData $data */ $data = $form->getData(); $contentInfo = $data->getContentInfo(); @@ -314,16 +315,16 @@ public function editAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException * @throws \InvalidArgumentException * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws ApiException\InvalidArgumentException + * @throws UnauthorizedException + * @throws InvalidOptionsException */ public function updateMainLocationAction(Request $request): Response { @@ -357,7 +358,7 @@ public function updateMainLocationAction(Request $request): Response } } - /** @var \Ibexa\AdminUi\Form\Data\Content\Draft\ContentEditData $data */ + /** @var ContentEditData $data */ $data = $form->getData(); $contentInfo = $data->getContentInfo(); @@ -373,12 +374,12 @@ public function updateMainLocationAction(Request $request): Response } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param Content $content * @param string|null $languageCode * @param int|null $versionNo - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function previewAction( Request $request, @@ -457,9 +458,9 @@ public function previewAction( } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function updateMainTranslationAction(Request $request): Response { @@ -490,7 +491,7 @@ public function updateMainTranslationAction(Request $request): Response return $result; } } - /** @var \Ibexa\AdminUi\Form\Data\Content\Translation\MainTranslationUpdateData $data */ + /** @var MainTranslationUpdateData $data */ $data = $form->getData(); $contentInfo = $data->getContentInfo(); if (null !== $contentInfo) { @@ -505,9 +506,9 @@ public function updateMainTranslationAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function updateVisibilityAction(Request $request): Response { @@ -571,16 +572,18 @@ public function updateVisibilityAction(Request $request): Response } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param Content $content * @param string|null $languageCode * - * @return \Symfony\Component\HttpFoundation\JsonResponse + * @return JsonResponse * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws ApiException\BadStateException + * @throws ApiException\InvalidArgumentException */ - public function checkEditPermissionAction(Content $content, ?string $languageCode): JsonResponse - { + public function checkEditPermissionAction( + Content $content, + ?string $languageCode + ): JsonResponse { $targets = []; if (null !== $languageCode) { diff --git a/src/bundle/Controller/ContentDraftController.php b/src/bundle/Controller/ContentDraftController.php index 592f0c22d5..601033365c 100644 --- a/src/bundle/Controller/ContentDraftController.php +++ b/src/bundle/Controller/ContentDraftController.php @@ -13,6 +13,7 @@ use Ibexa\AdminUi\Form\SubmitHandler; use Ibexa\AdminUi\Pagination\Pagerfanta\ContentDraftAdapter; use Ibexa\AdminUi\UI\Dataset\DatasetFactory; +use Ibexa\AdminUi\UI\Value\Content\ContentDraftInterface; use Ibexa\AdminUi\UI\Value\Content\VersionId; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\Core\Repository\ContentService; @@ -25,19 +26,19 @@ class ContentDraftController extends Controller { private const PAGINATION_PARAM_NAME = 'page'; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ + /** @var DatasetFactory */ private $datasetFactory; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( @@ -55,9 +56,9 @@ public function __construct( } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function listAction(Request $request): Response { @@ -80,9 +81,9 @@ public function listAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function removeAction(Request $request): Response { @@ -114,14 +115,14 @@ public function removeAction(Request $request): Response } /** - * @param \Pagerfanta\Pagerfanta $pagerfanta + * @param Pagerfanta $pagerfanta * - * @return \Ibexa\AdminUi\Form\Data\Content\Draft\ContentRemoveData + * @return ContentRemoveData */ private function createContentRemoveData(Pagerfanta $pagerfanta): ContentRemoveData { $versions = []; - /** @var \Ibexa\AdminUi\UI\Value\Content\ContentDraftInterface $contentDraft */ + /** @var ContentDraftInterface $contentDraft */ foreach ($pagerfanta->getCurrentPageResults() as $contentDraft) { if ($contentDraft->isAccessible()) { $versions[] = $contentDraft->getVersionId(); diff --git a/src/bundle/Controller/ContentEditController.php b/src/bundle/Controller/ContentEditController.php index a6176bdb1a..c12c47e1ee 100644 --- a/src/bundle/Controller/ContentEditController.php +++ b/src/bundle/Controller/ContentEditController.php @@ -19,13 +19,13 @@ class ContentEditController extends Controller { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ + /** @var EventDispatcherInterface */ private $eventDispatcher; public function __construct( @@ -44,7 +44,7 @@ public function proxyTranslateAction( string $toLanguageCode, ?int $locationId = null ): Response { - /** @var \Ibexa\Contracts\AdminUi\Event\ContentProxyTranslateEvent $event */ + /** @var ContentProxyTranslateEvent $event */ $event = $this->eventDispatcher->dispatch( new ContentProxyTranslateEvent( $contentId, @@ -68,9 +68,9 @@ public function proxyTranslateAction( } /** - * @param \Ibexa\AdminUi\View\ContentTranslateView $view + * @param ContentTranslateView $view * - * @return \Ibexa\AdminUi\View\ContentTranslateView + * @return ContentTranslateView */ public function translateAction(ContentTranslateView $view): ContentTranslateView { @@ -78,9 +78,9 @@ public function translateAction(ContentTranslateView $view): ContentTranslateVie } /** - * @param \Ibexa\AdminUi\View\ContentTranslateSuccessView $view + * @param ContentTranslateSuccessView $view * - * @return \Ibexa\AdminUi\View\ContentTranslateSuccessView + * @return ContentTranslateSuccessView */ public function translationSuccessAction(ContentTranslateSuccessView $view): ContentTranslateSuccessView { diff --git a/src/bundle/Controller/ContentOnTheFlyController.php b/src/bundle/Controller/ContentOnTheFlyController.php index 735643e2a8..2754b0acef 100644 --- a/src/bundle/Controller/ContentOnTheFlyController.php +++ b/src/bundle/Controller/ContentOnTheFlyController.php @@ -23,6 +23,7 @@ use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\Exceptions as ApiException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\PermissionResolver; @@ -36,46 +37,48 @@ use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\Base\Exceptions\UnauthorizedException; use Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface; +use Ibexa\Core\MVC\Symfony\View\BaseView; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; class ContentOnTheFlyController extends Controller { private const AUTOSAVE_ACTION_NAME = 'autosave'; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\Contracts\ContentForms\Content\Form\Provider\GroupedContentFormFieldsProviderInterface */ + /** @var GroupedContentFormFieldsProviderInterface */ private $groupedContentFormFieldsProvider; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ + /** @var UserLanguagePreferenceProviderInterface */ private $userLanguagePreferenceProvider; - /** @var \Ibexa\AdminUi\Form\ActionDispatcher\CreateContentOnTheFlyDispatcher */ + /** @var CreateContentOnTheFlyDispatcher */ private $createContentActionDispatcher; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ + /** @var EventDispatcherInterface */ private $eventDispatcher; - /** @var \Ibexa\ContentForms\Form\ActionDispatcher\ActionDispatcherInterface */ + /** @var ActionDispatcherInterface */ private $contentActionDispatcher; public function __construct( @@ -105,8 +108,8 @@ public function __construct( } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws ApiException\BadStateException + * @throws ApiException\InvalidArgumentException */ public function hasCreateAccessAction( string $languageCode, @@ -157,10 +160,10 @@ public function hasCreateAccessAction( } /** - * @return \Ibexa\Core\MVC\Symfony\View\BaseView|\Symfony\Component\HttpFoundation\Response + * @return BaseView|Response * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws NotFoundException + * @throws ApiException\InvalidArgumentException */ public function createContentAction( Request $request, @@ -176,7 +179,7 @@ public function createContentAction( ]); } - /** @var \Ibexa\Contracts\AdminUi\Event\ContentProxyCreateEvent $event */ + /** @var ContentProxyCreateEvent $event */ $event = $this->eventDispatcher->dispatch( new ContentProxyCreateEvent( $contentType, @@ -228,13 +231,13 @@ public function createContentAction( } /** - * @return \Ibexa\Core\MVC\Symfony\View\BaseView|\Symfony\Component\HttpFoundation\Response + * @return BaseView|Response * * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Core\Base\Exceptions\BadStateException - * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException + * @throws NotFoundException + * @throws ApiException\UnauthorizedException + * @throws BadStateException + * @throws InvalidArgumentException */ public function editContentAction( Request $request, diff --git a/src/bundle/Controller/ContentTypeController.php b/src/bundle/Controller/ContentTypeController.php index 5f0d946114..070ed844e0 100644 --- a/src/bundle/Controller/ContentTypeController.php +++ b/src/bundle/Controller/ContentTypeController.php @@ -28,6 +28,7 @@ use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LanguageService; @@ -40,53 +41,59 @@ use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute; use JMS\TranslationBundle\Annotation\Desc; use Pagerfanta\Adapter\ArrayAdapter; +use Pagerfanta\Exception\LessThan1CurrentPageException; +use Pagerfanta\Exception\LessThan1MaxPerPageException; +use Pagerfanta\Exception\NotIntegerCurrentPageException; +use Pagerfanta\Exception\NotIntegerMaxPerPageException; +use Pagerfanta\Exception\OutOfRangeCurrentPageException; use Pagerfanta\Pagerfanta; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; use Symfony\Contracts\Translation\TranslatorInterface; class ContentTypeController extends Controller { private const PRIMARY_UPDATE_ACTION = 'publishContentType'; - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\ContentForms\Form\ActionDispatcher\ActionDispatcherInterface */ + /** @var ActionDispatcherInterface */ private $contentTypeActionDispatcher; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; - /** @var \Ibexa\AdminUi\Form\Factory\ContentTypeFormFactory */ + /** @var ContentTypeFormFactory */ private $contentTypeFormFactory; - /** @var \Ibexa\AdminUi\Form\Data\FormMapper\ContentTypeDraftMapper */ + /** @var ContentTypeDraftMapper */ private $contentTypeDraftMapper; /** - * @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface + * @var ConfigResolverInterface */ private $configResolver; - /** @var \Ibexa\AdminUi\UI\Module\FieldTypeToolbar\FieldTypeToolbarFactory */ + /** @var FieldTypeToolbarFactory */ private $fieldTypeToolbarFactory; private MetaFieldDefinitionServiceInterface $metaFieldDefinitionService; @@ -122,19 +129,25 @@ public function __construct( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @throws \Pagerfanta\Exception\OutOfRangeCurrentPageException - * @throws \Pagerfanta\Exception\NotIntegerCurrentPageException - * @throws \Pagerfanta\Exception\NotIntegerMaxPerPageException - * @throws \Pagerfanta\Exception\LessThan1CurrentPageException - * @throws \Pagerfanta\Exception\LessThan1MaxPerPageException + * @throws InvalidOptionsException + * @throws OutOfRangeCurrentPageException + * @throws NotIntegerCurrentPageException + * @throws NotIntegerMaxPerPageException + * @throws LessThan1CurrentPageException + * @throws LessThan1MaxPerPageException */ - public function listAction(ContentTypeGroup $group, string $routeName, int $page): Response - { + public function listAction( + ContentTypeGroup $group, + string $routeName, + int $page + ): Response { $deletableTypes = []; $contentTypes = $this->contentTypeService->loadContentTypes($group, $this->configResolver->getParameter('languages')); - usort($contentTypes, static function (ContentType $contentType1, ContentType $contentType2) { + usort($contentTypes, static function ( + ContentType $contentType1, + ContentType $contentType2 + ) { return strnatcasecmp($contentType1->getName(), $contentType2->getName()); }); @@ -145,7 +158,7 @@ public function listAction(ContentTypeGroup $group, string $routeName, int $page $pagerfanta->setMaxPerPage($this->configResolver->getParameter('pagination.content_type_limit')); $pagerfanta->setCurrentPage(min($page, $pagerfanta->getNbPages())); - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup[] $contentTypeGroupList */ + /** @var ContentTypeGroup[] $contentTypeGroupList */ $types = $pagerfanta->getCurrentPageResults(); $deleteContentTypesForm = $this->formFactory->deleteContentTypes( @@ -174,11 +187,11 @@ public function listAction(ContentTypeGroup $group, string $routeName, int $page } /** - * @return \Symfony\Component\HttpFoundation\Response|\Ibexa\AdminUi\View\ContentTypeCreateView + * @return Response|ContentTypeCreateView * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException + * @throws ContentTypeFieldDefinitionValidationException */ public function addAction(ContentTypeGroup $group) { @@ -226,7 +239,7 @@ public function addTranslationAction(Request $request): Response ); $form->handleRequest($request); - /** @var \Ibexa\AdminUi\Form\Data\ContentType\Translation\TranslationAddData $data */ + /** @var TranslationAddData $data */ $data = $form->getData(); $contentType = $data->getContentType(); $contentTypeGroup = $data->getContentTypeGroup(); @@ -281,7 +294,7 @@ public function removeTranslationAction(Request $request): Response ); $form->handleRequest($request); - /** @var \Ibexa\AdminUi\Form\Data\ContentType\Translation\TranslationRemoveData $data */ + /** @var TranslationRemoveData $data */ $data = $form->getData(); $contentType = $data->getContentType(); $contentTypeGroup = $data->getContentTypeGroup(); @@ -331,11 +344,14 @@ public function removeTranslationAction(Request $request): Response } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws UnauthorizedException + * @throws BadStateException */ - public function editAction(Request $request, ContentTypeGroup $group, ContentType $contentType): Response - { + public function editAction( + Request $request, + ContentTypeGroup $group, + ContentType $contentType + ): Response { $this->denyAccessUnlessGranted(new Attribute('class', 'update')); try { $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentType->id, true); @@ -392,10 +408,13 @@ public function editAction(Request $request, ContentTypeGroup $group, ContentTyp } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException */ - public function copyAction(Request $request, ContentTypeGroup $group, ContentType $contentType): Response - { + public function copyAction( + Request $request, + ContentTypeGroup $group, + ContentType $contentType + ): Response { $this->denyAccessUnlessGranted(new Attribute('class', 'create')); $contentTypeService = $this->contentTypeService; @@ -444,9 +463,9 @@ public function copyAction(Request $request, ContentTypeGroup $group, ContentTyp } /** - * @return \Symfony\Component\HttpFoundation\Response|\Ibexa\AdminUi\View\ContentTypeEditView + * @return Response|ContentTypeEditView * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ public function updateAction( Request $request, @@ -567,8 +586,11 @@ public function addFieldDefinitionFormAction( /** * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException */ - public function deleteAction(Request $request, ContentTypeGroup $group, ContentType $contentType): Response - { + public function deleteAction( + Request $request, + ContentTypeGroup $group, + ContentType $contentType + ): Response { $this->denyAccessUnlessGranted(new Attribute('class', 'delete')); $form = $this->createDeleteForm($group, $contentType); $form->handleRequest($request); @@ -599,11 +621,13 @@ public function deleteAction(Request $request, ContentTypeGroup $group, ContentT * Handles removing content types based on submitted form. * * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException * @throws \InvalidArgumentException */ - public function bulkDeleteAction(Request $request, ContentTypeGroup $group): Response - { + public function bulkDeleteAction( + Request $request, + ContentTypeGroup $group + ): Response { $this->denyAccessUnlessGranted(new Attribute('class', 'delete')); $form = $this->formFactory->deleteContentTypes( new ContentTypesDeleteData() @@ -635,7 +659,7 @@ public function bulkDeleteAction(Request $request, ContentTypeGroup $group): Res } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ public function viewAction( ContentTypeGroup $group, @@ -715,8 +739,10 @@ public function createUpdateForm( ]); } - protected function createDeleteForm(ContentTypeGroup $group, ContentType $contentType): FormInterface - { + protected function createDeleteForm( + ContentTypeGroup $group, + ContentType $contentType + ): FormInterface { $formBuilder = $this->createFormBuilder(null, [ 'method' => Request::METHOD_DELETE, 'action' => $this->generateUrl('ibexa.content_type.delete', [ @@ -729,7 +755,7 @@ protected function createDeleteForm(ContentTypeGroup $group, ContentType $conten } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[] $contentTypes + * @param ContentType[] $contentTypes * * @return array */ @@ -760,7 +786,7 @@ private function getUserNameById(int $userId): ?string } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ private function getDefaultLanguage(ContentTypeDraft $contentTypeDraft): Language { @@ -778,8 +804,8 @@ private function getDefaultLanguage(ContentTypeDraft $contentTypeDraft): Languag } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws BadStateException + * @throws UnauthorizedException */ private function tryToCreateContentTypeDraft(ContentType $contentType): ContentTypeDraft { diff --git a/src/bundle/Controller/ContentTypeGroupController.php b/src/bundle/Controller/ContentTypeGroupController.php index 80288025a1..47864d4e08 100644 --- a/src/bundle/Controller/ContentTypeGroupController.php +++ b/src/bundle/Controller/ContentTypeGroupController.php @@ -25,25 +25,26 @@ use Pagerfanta\Adapter\ArrayAdapter; use Pagerfanta\Pagerfanta; use Symfony\Component\Form\Button; +use Symfony\Component\Form\Form; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; class ContentTypeGroupController extends Controller { - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( @@ -61,9 +62,9 @@ public function __construct( } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function listAction(Request $request): Response { @@ -79,7 +80,7 @@ public function listAction(Request $request): Response $pagerfanta->setMaxPerPage($this->configResolver->getParameter('pagination.content_type_group_limit')); $pagerfanta->setCurrentPage(min($page, $pagerfanta->getNbPages())); - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup[] $contentTypeGroupList */ + /** @var ContentTypeGroup[] $contentTypeGroupList */ $contentTypeGroupList = $pagerfanta->getCurrentPageResults(); $deleteContentTypeGroupsForm = $this->formFactory->deleteContentTypeGroups( @@ -104,14 +105,14 @@ public function listAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function createAction(Request $request): Response { $this->denyAccessUnlessGranted(new Attribute('class', 'create')); - /** @var \Symfony\Component\Form\Form $form */ + /** @var Form $form */ $form = $this->formFactory->createContentTypeGroup( new ContentTypeGroupCreateData() ); @@ -155,15 +156,17 @@ public function createAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $group + * @param Request $request + * @param ContentTypeGroup $group * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function updateAction(Request $request, ContentTypeGroup $group): Response - { + public function updateAction( + Request $request, + ContentTypeGroup $group + ): Response { $this->denyAccessUnlessGranted(new Attribute('class', 'update')); - /** @var \Symfony\Component\Form\Form $form */ + /** @var Form $form */ $form = $this->formFactory->updateContentTypeGroup( new ContentTypeGroupUpdateData($group) ); @@ -209,13 +212,15 @@ public function updateAction(Request $request, ContentTypeGroup $group): Respons } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $group + * @param Request $request + * @param ContentTypeGroup $group * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function deleteAction(Request $request, ContentTypeGroup $group): Response - { + public function deleteAction( + Request $request, + ContentTypeGroup $group + ): Response { $this->denyAccessUnlessGranted(new Attribute('class', 'delete')); $form = $this->formFactory->deleteContentTypeGroup( new ContentTypeGroupDeleteData($group) @@ -246,9 +251,9 @@ public function deleteAction(Request $request, ContentTypeGroup $group): Respons /** * Handles removing content type groups based on submitted form. * - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function bulkDeleteAction(Request $request): Response { @@ -282,14 +287,17 @@ public function bulkDeleteAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $group + * @param Request $request + * @param ContentTypeGroup $group * @param int $page * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function viewAction(Request $request, ContentTypeGroup $group, int $page = 1): Response - { + public function viewAction( + Request $request, + ContentTypeGroup $group, + int $page = 1 + ): Response { return $this->render('@ibexadesign/content_type/content_type_group/index.html.twig', [ 'content_type_group' => $group, 'page' => $page, @@ -299,7 +307,7 @@ public function viewAction(Request $request, ContentTypeGroup $group, int $page } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup[] $contentTypeGroups + * @param ContentTypeGroup[] $contentTypeGroups * * @return array */ diff --git a/src/bundle/Controller/ContentViewController.php b/src/bundle/Controller/ContentViewController.php index c6d9199d59..a6f19d8fc9 100644 --- a/src/bundle/Controller/ContentViewController.php +++ b/src/bundle/Controller/ContentViewController.php @@ -8,6 +8,7 @@ namespace Ibexa\Bundle\AdminUi\Controller; +use Ibexa\AdminUi\Exception\InvalidArgumentException; use Ibexa\AdminUi\Form\Data\Content\ContentVisibilityUpdateData; use Ibexa\AdminUi\Form\Data\Content\Draft\ContentCreateData; use Ibexa\AdminUi\Form\Data\Content\Draft\ContentEditData; @@ -24,12 +25,14 @@ use Ibexa\AdminUi\Permission\LookupLimitationsTransformer; use Ibexa\AdminUi\Specification\ContentIsUser; use Ibexa\AdminUi\Specification\ContentType\ContentTypeIsUserGroup; +use Ibexa\AdminUi\UI\Module\Subitems\ContentViewParameterSupplier; use Ibexa\AdminUi\UI\Module\Subitems\ContentViewParameterSupplier as SubitemsContentViewParameterSupplier; use Ibexa\AdminUi\UI\Service\PathService; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\Core\Repository\BookmarkService; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\PermissionResolver; @@ -50,67 +53,67 @@ class ContentViewController extends Controller { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; - /** @var \Ibexa\AdminUi\UI\Service\PathService */ + /** @var PathService */ private $pathService; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\UI\Module\Subitems\ContentViewParameterSupplier */ + /** @var ContentViewParameterSupplier */ private $subitemsContentViewParameterSupplier; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; - /** @var \Ibexa\Contracts\Core\Repository\BookmarkService */ + /** @var BookmarkService */ private $bookmarkService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ + /** @var UserLanguagePreferenceProviderInterface */ private $userLanguagePreferenceProvider; - /** @var \Symfony\Component\Form\FormFactoryInterface */ + /** @var FormFactoryInterface */ private $sfFormFactory; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ + /** @var Repository */ private $repository; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\AdminUi\Permission\LookupLimitationsTransformer */ + /** @var LookupLimitationsTransformer */ private $lookupLimitationsTransformer; /** - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService - * @param \Ibexa\AdminUi\UI\Service\PathService $pathService - * @param \Ibexa\AdminUi\Form\Factory\FormFactory $formFactory - * @param \Symfony\Component\Form\FormFactoryInterface $sfFormFactory - * @param \Ibexa\AdminUi\UI\Module\Subitems\ContentViewParameterSupplier $subitemsContentViewParameterSupplier - * @param \Ibexa\Contracts\Core\Repository\UserService $userService - * @param \Ibexa\Contracts\Core\Repository\BookmarkService $bookmarkService - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService - * @param \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider - * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver - * @param \Ibexa\Contracts\Core\Repository\Repository $repository - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver - * @param \Ibexa\AdminUi\Permission\LookupLimitationsTransformer $lookupLimitationsTransformer + * @param ContentTypeService $contentTypeService + * @param LanguageService $languageService + * @param PathService $pathService + * @param FormFactory $formFactory + * @param FormFactoryInterface $sfFormFactory + * @param ContentViewParameterSupplier $subitemsContentViewParameterSupplier + * @param UserService $userService + * @param BookmarkService $bookmarkService + * @param ContentService $contentService + * @param LocationService $locationService + * @param UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider + * @param ConfigResolverInterface $configResolver + * @param Repository $repository + * @param PermissionResolver $permissionResolver + * @param LookupLimitationsTransformer $lookupLimitationsTransformer */ public function __construct( ContentTypeService $contentTypeService, @@ -147,18 +150,20 @@ public function __construct( } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view + * @param Request $request + * @param ContentView $view * - * @return \Ibexa\Core\MVC\Symfony\View\ContentView + * @return ContentView * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException */ - public function locationViewAction(Request $request, ContentView $view): ContentView - { + public function locationViewAction( + Request $request, + ContentView $view + ): ContentView { $location = $view->getLocation(); if ($location === null) { $contentId = $view->getContent()->getId(); @@ -192,9 +197,9 @@ public function locationViewAction(Request $request, ContentView $view): Content } /** - * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view + * @param ContentView $view * - * @return \Ibexa\Core\MVC\Symfony\View\ContentView + * @return ContentView * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ @@ -211,7 +216,7 @@ public function embedViewAction(ContentView $view): ContentView } /** - * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view + * @param ContentView $view */ private function supplyPathLocations(ContentView $view): void { @@ -221,7 +226,7 @@ private function supplyPathLocations(ContentView $view): void } /** - * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view + * @param ContentView $view * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ @@ -235,11 +240,11 @@ private function supplyContentType(ContentView $view): void } /** - * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view + * @param ContentView $view * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException */ private function supplyContentActionForms(ContentView $view): void { @@ -315,12 +320,12 @@ private function supplyContentActionForms(ContentView $view): void } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null $contentInfo - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo|null $versionInfo - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $language - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param ContentInfo|null $contentInfo + * @param VersionInfo|null $versionInfo + * @param Language|null $language + * @param Location|null $location * - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface */ private function createContentEditForm( ?ContentInfo $contentInfo = null, @@ -348,11 +353,13 @@ private function createContentEditForm( } /** - * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view - * @param \Symfony\Component\HttpFoundation\Request $request + * @param ContentView $view + * @param Request $request */ - private function supplyDraftPagination(ContentView $view, Request $request): void - { + private function supplyDraftPagination( + ContentView $view, + Request $request + ): void { $page = $request->query->get('page'); $view->addParameters([ @@ -366,8 +373,10 @@ private function supplyDraftPagination(ContentView $view, Request $request): voi ]); } - private function supplyRelationPagination(ContentView $view, Request $request): void - { + private function supplyRelationPagination( + ContentView $view, + Request $request + ): void { $page = $request->query->all('page'); $view->addParameters([ @@ -382,11 +391,13 @@ private function supplyRelationPagination(ContentView $view, Request $request): } /** - * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view - * @param \Symfony\Component\HttpFoundation\Request $request + * @param ContentView $view + * @param Request $request */ - private function supplyReverseRelationPagination(ContentView $view, Request $request): void - { + private function supplyReverseRelationPagination( + ContentView $view, + Request $request + ): void { $page = $request->query->get('page'); $view->addParameters([ @@ -401,11 +412,13 @@ private function supplyReverseRelationPagination(ContentView $view, Request $req } /** - * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view - * @param \Symfony\Component\HttpFoundation\Request $request + * @param ContentView $view + * @param Request $request */ - private function supplyCustomUrlPagination(ContentView $view, Request $request): void - { + private function supplyCustomUrlPagination( + ContentView $view, + Request $request + ): void { $page = $request->query->get('page'); $view->addParameters([ @@ -419,11 +432,13 @@ private function supplyCustomUrlPagination(ContentView $view, Request $request): } /** - * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view - * @param \Symfony\Component\HttpFoundation\Request $request + * @param ContentView $view + * @param Request $request */ - private function supplySystemUrlPagination(ContentView $view, Request $request): void - { + private function supplySystemUrlPagination( + ContentView $view, + Request $request + ): void { $page = $request->query->get('page'); $view->addParameters([ @@ -437,11 +452,13 @@ private function supplySystemUrlPagination(ContentView $view, Request $request): } /** - * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view - * @param \Symfony\Component\HttpFoundation\Request $request + * @param ContentView $view + * @param Request $request */ - private function supplyRolePagination(ContentView $view, Request $request): void - { + private function supplyRolePagination( + ContentView $view, + Request $request + ): void { $page = $request->query->get('page'); $view->addParameters([ @@ -455,11 +472,13 @@ private function supplyRolePagination(ContentView $view, Request $request): void } /** - * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view - * @param \Symfony\Component\HttpFoundation\Request $request + * @param ContentView $view + * @param Request $request */ - private function supplyPolicyPagination(ContentView $view, Request $request): void - { + private function supplyPolicyPagination( + ContentView $view, + Request $request + ): void { $page = $request->query->get('page'); $view->addParameters([ @@ -473,7 +492,7 @@ private function supplyPolicyPagination(ContentView $view, Request $request): vo } /** - * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view + * @param ContentView $view */ private function supplyContentTreeParameters(ContentView $view): void { @@ -483,7 +502,7 @@ private function supplyContentTreeParameters(ContentView $view): void } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location * * @return int * @@ -512,9 +531,9 @@ private function resolveTreeRootLocationId(?Location $location): int } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location * - * @return \Ibexa\AdminUi\Form\Data\Content\Draft\ContentCreateData + * @return ContentCreateData */ private function getContentCreateData(?Location $location): ContentCreateData { @@ -527,7 +546,7 @@ private function getContentCreateData(?Location $location): ContentCreateData } /** - * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view + * @param ContentView $view */ private function supplyIsLocationBookmarked(ContentView $view): void { @@ -537,7 +556,7 @@ private function supplyIsLocationBookmarked(ContentView $view): void } /** - * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view + * @param ContentView $view */ private function supplyContentReverseRelations(ContentView $view): void { diff --git a/src/bundle/Controller/DashboardController.php b/src/bundle/Controller/DashboardController.php index 3d4ff718b9..374b68d0e8 100644 --- a/src/bundle/Controller/DashboardController.php +++ b/src/bundle/Controller/DashboardController.php @@ -11,20 +11,21 @@ use Ibexa\AdminUi\Form\Data\Content\Draft\ContentEditData; use Ibexa\AdminUi\Form\Factory\FormFactory; use Ibexa\Contracts\AdminUi\Controller\Controller; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Symfony\Component\HttpFoundation\Response; class DashboardController extends Controller { - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ protected $formFactory; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; /** - * @param \Ibexa\AdminUi\Form\Factory\FormFactory $formFactory - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver + * @param FormFactory $formFactory + * @param PermissionResolver $permissionResolver */ public function __construct( FormFactory $formFactory, @@ -35,9 +36,9 @@ public function __construct( } /** - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ public function dashboardAction(): Response { diff --git a/src/bundle/Controller/DownloadImageController.php b/src/bundle/Controller/DownloadImageController.php index b40e80c00c..202b00cf03 100644 --- a/src/bundle/Controller/DownloadImageController.php +++ b/src/bundle/Controller/DownloadImageController.php @@ -9,9 +9,12 @@ namespace Ibexa\Bundle\AdminUi\Controller; use DateTimeImmutable; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException; use Ibexa\Contracts\Core\Repository\SearchService; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Query; +use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult; use Ibexa\Core\FieldType\Image\Value; use Ibexa\Rest\Server\Controller; @@ -52,8 +55,8 @@ public function __construct( } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws InvalidArgumentException + * @throws InvalidCriterionArgumentException * @throws \Exception */ public function downloadAction(string $contentIdList): Response @@ -110,9 +113,9 @@ private function processDownloading(SearchResult $result): Response $contentList = []; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit $image */ + /** @var SearchHit $image */ foreach ($result as $image) { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $image->valueObject; $contentList[] = $content; } @@ -149,7 +152,7 @@ private function downloadSingleImage(Content $content): Response } /** - * @param array<\Ibexa\Contracts\Core\Repository\Values\Content\Content> $contentList + * @param array $contentList * * @throws \Exception */ @@ -289,12 +292,14 @@ private function createResponse( } /** - * @param array<\Ibexa\Contracts\Core\Repository\Values\Content\Content> $contentList + * @param array $contentList * * @throws \Exception */ - private function createArchive(string $name, array $contentList): void - { + private function createArchive( + string $name, + array $contentList + ): void { $zipArchive = new ZipArchive(); $zipArchive->open($name, ZipArchive::CREATE); diff --git a/src/bundle/Controller/FieldDefinitionController.php b/src/bundle/Controller/FieldDefinitionController.php index 26a802b200..294318774f 100644 --- a/src/bundle/Controller/FieldDefinitionController.php +++ b/src/bundle/Controller/FieldDefinitionController.php @@ -9,6 +9,9 @@ namespace Ibexa\Bundle\AdminUi\Controller; use Exception; +use Ibexa\AdminUi\REST\Value\ContentType\FieldDefinitionCreate; +use Ibexa\AdminUi\REST\Value\ContentType\FieldDefinitionDelete; +use Ibexa\AdminUi\REST\Value\ContentType\FieldDefinitionReorder; use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\Values\Content\Language; @@ -25,14 +28,16 @@ final class FieldDefinitionController extends RestController { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ + /** @var UrlGeneratorInterface */ private $urlGenerator; - public function __construct(ContentTypeService $contentTypeService, UrlGeneratorInterface $urlGenerator) - { + public function __construct( + ContentTypeService $contentTypeService, + UrlGeneratorInterface $urlGenerator + ) { $this->contentTypeService = $contentTypeService; $this->urlGenerator = $urlGenerator; } @@ -44,7 +49,7 @@ public function addFieldDefinitionAction( Language $language, ?Language $baseLanguage = null ): RedirectResponse { - /** @var \Ibexa\AdminUi\REST\Value\ContentType\FieldDefinitionCreate $input */ + /** @var FieldDefinitionCreate $input */ $input = $this->inputDispatcher->parse( new Message( ['Content-Type' => $request->headers->get('Content-Type')], @@ -88,7 +93,7 @@ public function removeFieldDefinitionAction( ContentTypeGroup $group, ContentTypeDraft $contentTypeDraft ): Values\OK { - /** @var \Ibexa\AdminUi\REST\Value\ContentType\FieldDefinitionDelete $input */ + /** @var FieldDefinitionDelete $input */ $input = $this->inputDispatcher->parse( new Message( ['Content-Type' => $request->headers->get('Content-Type')], @@ -128,7 +133,7 @@ public function reorderFieldDefinitionsAction( ContentTypeGroup $group, ContentTypeDraft $contentTypeDraft ): Values\OK { - /** @var \Ibexa\AdminUi\REST\Value\ContentType\FieldDefinitionReorder $input */ + /** @var FieldDefinitionReorder $input */ $input = $this->inputDispatcher->parse( new Message( ['Content-Type' => $request->headers->get('Content-Type')], diff --git a/src/bundle/Controller/LanguageController.php b/src/bundle/Controller/LanguageController.php index 277e041b7d..15d8e1719c 100644 --- a/src/bundle/Controller/LanguageController.php +++ b/src/bundle/Controller/LanguageController.php @@ -18,6 +18,8 @@ use Ibexa\AdminUi\Form\Type\Language\LanguageUpdateType; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; @@ -26,28 +28,30 @@ use Pagerfanta\Adapter\ArrayAdapter; use Pagerfanta\Pagerfanta; use Symfony\Component\Form\Button; +use Symfony\Component\Form\Form; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; class LanguageController extends Controller { - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; - /** @var \Ibexa\AdminUi\Form\DataMapper\LanguageCreateMapper */ + /** @var LanguageCreateMapper */ private $languageCreateMapper; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( @@ -69,9 +73,9 @@ public function __construct( /** * Renders the language list. * - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function listAction(Request $request): Response { @@ -84,7 +88,7 @@ public function listAction(Request $request): Response $pagerfanta->setMaxPerPage($this->configResolver->getParameter('pagination.language_limit')); $pagerfanta->setCurrentPage(min($page, $pagerfanta->getNbPages())); - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language[] $languageList */ + /** @var Language[] $languageList */ $languageList = $pagerfanta->getCurrentPageResults(); $deleteLanguagesForm = $this->formFactory->deleteLanguages( @@ -101,9 +105,9 @@ public function listAction(Request $request): Response /** * Renders the view of a language. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language $language + * @param Language $language * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function viewAction(Language $language): Response { @@ -121,13 +125,15 @@ public function viewAction(Language $language): Response /** * Deletes a language. * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language $language + * @param Request $request + * @param Language $language * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function deleteAction(Request $request, Language $language): Response - { + public function deleteAction( + Request $request, + Language $language + ): Response { $form = $this->formFactory->deleteLanguage( new LanguageDeleteData($language) ); @@ -157,15 +163,15 @@ public function deleteAction(Request $request, Language $language): Response /** * Handles removing languages based on submitted form. * - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws UnauthorizedException + * @throws InvalidOptionsException * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException * @throws \InvalidArgumentException */ public function bulkDeleteAction(Request $request): Response @@ -200,7 +206,7 @@ public function bulkDeleteAction(Request $request): Response public function createAction(Request $request): Response { - /** @var \Symfony\Component\Form\Form $form */ + /** @var Form $form */ $form = $this->formFactory->createLanguage(); $form->handleRequest($request); @@ -240,9 +246,11 @@ public function createAction(Request $request): Response ]); } - public function editAction(Request $request, Language $language): Response - { - /** @var \Symfony\Component\Form\Form $form */ + public function editAction( + Request $request, + Language $language + ): Response { + /** @var Form $form */ $form = $this->formFactory->updateLanguage( new LanguageUpdateData($language) ); @@ -289,7 +297,7 @@ public function editAction(Request $request, Language $language): Response } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language[] $languages + * @param Language[] $languages * * @return array */ diff --git a/src/bundle/Controller/LinkManagerController.php b/src/bundle/Controller/LinkManagerController.php index b60dbb1667..01272c38f6 100644 --- a/src/bundle/Controller/LinkManagerController.php +++ b/src/bundle/Controller/LinkManagerController.php @@ -15,11 +15,14 @@ use Ibexa\AdminUi\Pagination\Pagerfanta\URLUsagesAdapter; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\URLService; use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute; use JMS\TranslationBundle\Annotation\Desc; use Pagerfanta\Pagerfanta; use Symfony\Component\Form\Button; +use Symfony\Component\Form\Form; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -27,23 +30,23 @@ final class LinkManagerController extends Controller { public const DEFAULT_MAX_PER_PAGE = 10; - /** @var \Ibexa\Contracts\Core\Repository\URLService */ + /** @var URLService */ private $urlService; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; /** - * @param \Ibexa\Contracts\Core\Repository\URLService $urlService - * @param \Ibexa\AdminUi\Form\Factory\FormFactory $formFactory - * @param \Ibexa\AdminUi\Form\SubmitHandler $submitHandler - * @param \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface $notificationHandler + * @param URLService $urlService + * @param FormFactory $formFactory + * @param SubmitHandler $submitHandler + * @param TranslatableNotificationHandlerInterface $notificationHandler */ public function __construct( URLService $urlService, @@ -58,19 +61,21 @@ public function __construct( } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * @param int $urlId * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ - public function editAction(Request $request, int $urlId): Response - { + public function editAction( + Request $request, + int $urlId + ): Response { $url = $this->urlService->loadById($urlId); - /** @var \Symfony\Component\Form\Form $form */ + /** @var Form $form */ $form = $this->formFactory->createUrlEditForm(new URLUpdateData([ 'id' => $url->id, 'url' => $url->url, @@ -111,16 +116,18 @@ public function editAction(Request $request, int $urlId): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * @param int $urlId * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ - public function viewAction(Request $request, int $urlId): Response - { + public function viewAction( + Request $request, + int $urlId + ): Response { $url = $this->urlService->loadById($urlId); $usages = new Pagerfanta(new URLUsagesAdapter($url, $this->urlService)); diff --git a/src/bundle/Controller/LocationController.php b/src/bundle/Controller/LocationController.php index 55cfb42d9e..2410502dd6 100644 --- a/src/bundle/Controller/LocationController.php +++ b/src/bundle/Controller/LocationController.php @@ -27,6 +27,8 @@ use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException as APIRepositoryUnauthorizedException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\PermissionResolver; @@ -34,6 +36,7 @@ use Ibexa\Contracts\Core\Repository\SectionService; use Ibexa\Contracts\Core\Repository\TrashService; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\LocationUpdateStruct; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\Helper\TranslationHelper; @@ -46,55 +49,55 @@ class LocationController extends Controller { - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; - /** @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\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\TrashService */ + /** @var TrashService */ private $trashService; - /** @var \Ibexa\Contracts\Core\Repository\SectionService */ + /** @var SectionService */ private $sectionService; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ + /** @var Repository */ private $repository; - /** @var \Ibexa\Core\Helper\TranslationHelper */ + /** @var TranslationHelper */ private $translationHelper; /** - * @param \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface $notificationHandler - * @param \Symfony\Contracts\Translation\TranslatorInterface $translator - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\Contracts\Core\Repository\TrashService $trashService - * @param \Ibexa\Contracts\Core\Repository\SectionService $sectionService - * @param \Ibexa\AdminUi\Form\Factory\FormFactory $formFactory - * @param \Ibexa\AdminUi\Form\SubmitHandler $submitHandler - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver - * @param \Ibexa\Contracts\Core\Repository\Repository $repository - * @param \Ibexa\Core\Helper\TranslationHelper $translationHelper + * @param TranslatableNotificationHandlerInterface $notificationHandler + * @param TranslatorInterface $translator + * @param LocationService $locationService + * @param ContentTypeService $contentTypeService + * @param ContentService $contentService + * @param TrashService $trashService + * @param SectionService $sectionService + * @param FormFactory $formFactory + * @param SubmitHandler $submitHandler + * @param PermissionResolver $permissionResolver + * @param Repository $repository + * @param TranslationHelper $translationHelper */ public function __construct( TranslatableNotificationHandlerInterface $notificationHandler, @@ -125,9 +128,9 @@ public function __construct( } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function moveAction(Request $request): Response { @@ -178,9 +181,9 @@ public function moveAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function copyAction(Request $request): Response { @@ -244,9 +247,9 @@ public function copyAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function copySubtreeAction(Request $request): Response { @@ -291,9 +294,9 @@ public function copySubtreeAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function swapAction(Request $request): Response { @@ -346,9 +349,9 @@ public function swapAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function trashAction(Request $request): Response { @@ -388,12 +391,12 @@ private function trashRelatedAsset(ContentInfo $contentInfo): void } /** - * @param \Ibexa\AdminUi\Form\Data\Location\LocationTrashData $data + * @param LocationTrashData $data * - * @return \Symfony\Component\HttpFoundation\RedirectResponse + * @return RedirectResponse * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ private function handleTrashLocation(LocationTrashData $data): RedirectResponse { @@ -430,9 +433,9 @@ private function handleTrashLocation(LocationTrashData $data): RedirectResponse /** * Handles removing locations assigned to content item based on submitted form. * - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function removeAction(Request $request): Response { @@ -441,7 +444,7 @@ public function removeAction(Request $request): Response ); $form->handleRequest($request); - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo */ + /** @var ContentInfo $contentInfo */ $contentInfo = $form->getData()->getContentInfo(); if ($form->isSubmitted()) { @@ -482,9 +485,9 @@ public function removeAction(Request $request): Response /** * Handles assigning new location to the content item based on submitted form. * - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function addAction(Request $request): Response { @@ -543,9 +546,9 @@ function (ContentLocationAddData $data) use ($referer): RedirectResponse { /** * Handles toggling visibility location of a content item based on submitted form. * - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function updateVisibilityAction(Request $request): Response { @@ -555,7 +558,7 @@ public function updateVisibilityAction(Request $request): Response if ($form->isSubmitted() && $form->isValid()) { $data = $form->getData(); - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $data->getLocation(); $hidden = $data->getHidden(); @@ -597,9 +600,9 @@ public function updateVisibilityAction(Request $request): Response /** * Handles update existing location. * - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function updateAction(Request $request): Response { @@ -646,9 +649,9 @@ public function updateAction(Request $request): Response /** * Handles assigning section to subtree. * - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function assignSectionAction(Request $request): Response { @@ -658,7 +661,7 @@ public function assignSectionAction(Request $request): Response if ($form->isSubmitted()) { $result = $this->submitHandler->handle($form, function (LocationAssignSubtreeData $data) { $section = $data->getSection(); - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $data->getLocation(); $this->sectionService->assignSectionToSubtree($location, $section); diff --git a/src/bundle/Controller/NotificationController.php b/src/bundle/Controller/NotificationController.php index 778c63e09a..f9fc254e95 100644 --- a/src/bundle/Controller/NotificationController.php +++ b/src/bundle/Controller/NotificationController.php @@ -19,6 +19,7 @@ use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\NotificationService; +use Ibexa\Contracts\Core\Repository\Values\Notification\Notification; use Ibexa\Contracts\Core\Repository\Values\Notification\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Notification\Query\NotificationQuery; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; @@ -88,8 +89,11 @@ private function handleJsonErrors(callable $callback): JsonResponse } } - public function getNotificationsAction(Request $request, int $offset, int $limit): JsonResponse - { + public function getNotificationsAction( + Request $request, + int $offset, + int $limit + ): JsonResponse { return $this->handleJsonErrors(function () use ($offset, $limit) { $notificationList = $this->notificationService->loadNotifications($offset, $limit); @@ -101,8 +105,10 @@ public function getNotificationsAction(Request $request, int $offset, int $limit }); } - public function renderNotificationsPageAction(Request $request, int $page): Response - { + public function renderNotificationsPageAction( + Request $request, + int $page + ): Response { $searchForm = $this->createForm(SearchType::class); $searchForm->handleRequest($request); @@ -133,10 +139,12 @@ public function renderNotificationsPageAction(Request $request, int $page): Resp } /** - * @param \Symfony\Component\Form\FormInterface $searchForm + * @param FormInterface $searchForm */ - private function getNotificationQuery(Request $request, FormInterface $searchForm): NotificationQuery - { + private function getNotificationQuery( + Request $request, + FormInterface $searchForm + ): NotificationQuery { $session = $request->getSession(); if ($searchForm->isSubmitted() && $searchForm->isValid()) { @@ -159,7 +167,7 @@ private function getNotificationQuery(Request $request, FormInterface $searchFor /** * Renders notifications from any iterable source or Pagerfanta page. * - * @param iterable<\Ibexa\Contracts\Core\Repository\Values\Notification\Notification> $notifications + * @param iterable $notifications * * @return string[] */ @@ -178,7 +186,7 @@ private function renderNotifications(iterable $notifications): array /** * Renders current page of Pagerfanta notifications. * - * @param \Pagerfanta\Pagerfanta<\Ibexa\Contracts\Core\Repository\Values\Notification\Notification> $pagerfanta + * @param Pagerfanta $pagerfanta * * @return string[] */ @@ -217,7 +225,7 @@ private function buildQuery(?SearchQueryData $data): NotificationQuery } /** - * @param \Pagerfanta\Pagerfanta<\Ibexa\Contracts\Core\Repository\Values\Notification\Notification> $pagerfanta + * @param Pagerfanta $pagerfanta */ private function createNotificationSelectionData(Pagerfanta $pagerfanta): NotificationSelectionData { @@ -243,8 +251,10 @@ public function countNotificationsAction(): JsonResponse * server service for websocket connection), so * we need a way to mark notification * as read. AJAX call is fine. */ - public function markNotificationAsReadAction(Request $request, int $notificationId): JsonResponse - { + public function markNotificationAsReadAction( + Request $request, + int $notificationId + ): JsonResponse { return $this->handleJsonErrors(function () use ($notificationId) { $notification = $this->notificationService->getNotification($notificationId); @@ -291,8 +301,10 @@ public function markAllNotificationsAsReadAction(Request $request): JsonResponse }); } - public function markNotificationAsUnreadAction(Request $request, int $notificationId): JsonResponse - { + public function markNotificationAsUnreadAction( + Request $request, + int $notificationId + ): JsonResponse { return $this->handleJsonErrors(function () use ($notificationId) { $notification = $this->notificationService->getNotification($notificationId); @@ -302,8 +314,10 @@ public function markNotificationAsUnreadAction(Request $request, int $notificati }); } - public function deleteNotificationAction(Request $request, int $notificationId): JsonResponse - { + public function deleteNotificationAction( + Request $request, + int $notificationId + ): JsonResponse { return $this->handleJsonErrors(function () use ($notificationId) { $notification = $this->notificationService->getNotification($notificationId); diff --git a/src/bundle/Controller/ObjectStateController.php b/src/bundle/Controller/ObjectStateController.php index a44d7217b8..4361f4db77 100644 --- a/src/bundle/Controller/ObjectStateController.php +++ b/src/bundle/Controller/ObjectStateController.php @@ -21,6 +21,7 @@ use Ibexa\AdminUi\Form\Type\ObjectState\ObjectStateUpdateType; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\ObjectStateService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; @@ -30,28 +31,29 @@ use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute; use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\Form\Button; +use Symfony\Component\Form\Form; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; class ObjectStateController extends Controller { - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ + /** @var ObjectStateService */ private $objectStateService; - /** @var \Symfony\Component\Form\FormFactoryInterface */ + /** @var FormFactoryInterface */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( @@ -71,13 +73,13 @@ public function __construct( } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup + * @param ObjectStateGroup $objectStateGroup * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function listAction(ObjectStateGroup $objectStateGroup): Response { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState[] $objectStates */ + /** @var ObjectState[] $objectStates */ $objectStates = $this->objectStateService->loadObjectStates($objectStateGroup); $deleteObjectStatesForm = $this->formFactory->create( @@ -101,9 +103,9 @@ public function listAction(ObjectStateGroup $objectStateGroup): Response } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState $objectState + * @param ObjectState $objectState * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function viewAction(ObjectState $objectState): Response { @@ -121,18 +123,20 @@ public function viewAction(ObjectState $objectState): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup + * @param Request $request + * @param ObjectStateGroup $objectStateGroup * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function addAction(Request $request, ObjectStateGroup $objectStateGroup): Response - { + public function addAction( + Request $request, + ObjectStateGroup $objectStateGroup + ): Response { $this->denyAccessUnlessGranted(new Attribute('state', 'administrate')); $languages = $this->configResolver->getParameter('languages'); $defaultLanguageCode = reset($languages); - /** @var \Symfony\Component\Form\Form $form */ + /** @var Form $form */ $form = $this->formFactory->create( ObjectStateCreateType::class, new ObjectStateCreateData() @@ -182,13 +186,15 @@ function (ObjectStateCreateData $data) use ($defaultLanguageCode, $objectStateGr } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState $objectState + * @param Request $request + * @param ObjectState $objectState * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function deleteAction(Request $request, ObjectState $objectState): Response - { + public function deleteAction( + Request $request, + ObjectState $objectState + ): Response { $this->denyAccessUnlessGranted(new Attribute('state', 'administrate')); $form = $this->formFactory->create( ObjectStateDeleteType::class, @@ -222,13 +228,15 @@ public function deleteAction(Request $request, ObjectState $objectState): Respon /** * Handles removing object state groups based on submitted form. * - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * @param int $objectStateGroupId * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function bulkDeleteAction(Request $request, int $objectStateGroupId): Response - { + public function bulkDeleteAction( + Request $request, + int $objectStateGroupId + ): Response { $this->denyAccessUnlessGranted(new Attribute('state', 'administrate')); $form = $this->formFactory->create( ObjectStatesDeleteType::class, @@ -262,15 +270,17 @@ public function bulkDeleteAction(Request $request, int $objectStateGroupId): Res } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState $objectState + * @param Request $request + * @param ObjectState $objectState * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function updateAction(Request $request, ObjectState $objectState): Response - { + public function updateAction( + Request $request, + ObjectState $objectState + ): Response { $this->denyAccessUnlessGranted(new Attribute('state', 'administrate')); - /** @var \Symfony\Component\Form\Form $form */ + /** @var Form $form */ $form = $this->formFactory->create( ObjectStateUpdateType::class, new ObjectStateUpdateData($objectState) @@ -319,13 +329,13 @@ public function updateAction(Request $request, ObjectState $objectState): Respon } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup + * @param Request $request + * @param ContentInfo $contentInfo + * @param ObjectStateGroup $objectStateGroup * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ public function updateContentStateAction( Request $request, diff --git a/src/bundle/Controller/ObjectStateGroupController.php b/src/bundle/Controller/ObjectStateGroupController.php index c2c8cc8db5..6ca92dfdda 100644 --- a/src/bundle/Controller/ObjectStateGroupController.php +++ b/src/bundle/Controller/ObjectStateGroupController.php @@ -24,24 +24,25 @@ use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute; use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\Form\Button; +use Symfony\Component\Form\Form; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; class ObjectStateGroupController extends Controller { - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ + /** @var ObjectStateService */ private $objectStateService; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( @@ -59,11 +60,11 @@ public function __construct( } /** - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function listAction(): Response { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup[] $objectStateGroups */ + /** @var ObjectStateGroup[] $objectStateGroups */ $objectStateGroups = $this->objectStateService->loadObjectStateGroups(); $emptyObjectStateGroups = []; @@ -84,9 +85,9 @@ public function listAction(): Response } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup + * @param ObjectStateGroup $objectStateGroup * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function viewAction(ObjectStateGroup $objectStateGroup): Response { @@ -102,9 +103,9 @@ public function viewAction(ObjectStateGroup $objectStateGroup): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function addAction(Request $request): Response { @@ -112,7 +113,7 @@ public function addAction(Request $request): Response $languages = $this->configResolver->getParameter('languages'); $defaultLanguageCode = reset($languages); - /** @var \Symfony\Component\Form\Form $form */ + /** @var Form $form */ $form = $this->formFactory->createObjectStateGroup( new ObjectStateGroupCreateData() ); @@ -161,13 +162,15 @@ function (ObjectStateGroupCreateData $data) use ($defaultLanguageCode, $form): R } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup $group + * @param Request $request + * @param ObjectStateGroup $group * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function deleteAction(Request $request, ObjectStateGroup $group): Response - { + public function deleteAction( + Request $request, + ObjectStateGroup $group + ): Response { $this->denyAccessUnlessGranted(new Attribute('state', 'administrate')); $form = $this->formFactory->deleteObjectStateGroup( new ObjectStateGroupDeleteData($group) @@ -198,9 +201,9 @@ public function deleteAction(Request $request, ObjectStateGroup $group): Respons /** * Handles removing object state groups based on submitted form. * - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function bulkDeleteAction(Request $request): Response { @@ -234,15 +237,17 @@ public function bulkDeleteAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup $group + * @param Request $request + * @param ObjectStateGroup $group * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function updateAction(Request $request, ObjectStateGroup $group): Response - { + public function updateAction( + Request $request, + ObjectStateGroup $group + ): Response { $this->denyAccessUnlessGranted(new Attribute('state', 'administrate')); - /** @var \Symfony\Component\Form\Form $form */ + /** @var Form $form */ $form = $this->formFactory->updateObjectStateGroup( new ObjectStateGroupUpdateData($group) ); @@ -289,7 +294,7 @@ public function updateAction(Request $request, ObjectStateGroup $group): Respons } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup[] $groups + * @param ObjectStateGroup[] $groups * * @return array */ diff --git a/src/bundle/Controller/PolicyController.php b/src/bundle/Controller/PolicyController.php index cf0eb5f72f..78f0273ed1 100644 --- a/src/bundle/Controller/PolicyController.php +++ b/src/bundle/Controller/PolicyController.php @@ -19,6 +19,7 @@ use Ibexa\AdminUi\Form\Type\Policy\PolicyUpdateType; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\RoleService; use Ibexa\Contracts\Core\Repository\Values\User\Policy; @@ -27,33 +28,40 @@ use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute; use JMS\TranslationBundle\Annotation\Desc; use Pagerfanta\Adapter\ArrayAdapter; +use Pagerfanta\Exception\LessThan1CurrentPageException; +use Pagerfanta\Exception\LessThan1MaxPerPageException; +use Pagerfanta\Exception\NotIntegerCurrentPageException; +use Pagerfanta\Exception\NotIntegerMaxPerPageException; +use Pagerfanta\Exception\OutOfRangeCurrentPageException; use Pagerfanta\Pagerfanta; use Symfony\Component\Form\Button; +use Symfony\Component\Form\Form; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; class PolicyController extends Controller { - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ private $roleService; - /** @var \Ibexa\AdminUi\Form\DataMapper\PolicyCreateMapper */ + /** @var PolicyCreateMapper */ private $policyCreateMapper; - /** @var \Ibexa\AdminUi\Form\DataMapper\PolicyUpdateMapper */ + /** @var PolicyUpdateMapper */ private $policyUpdateMapper; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( @@ -75,22 +83,25 @@ public function __construct( } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role $role + * @param Role $role * @param string $routeName * @param int $policyPage * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Pagerfanta\Exception\OutOfRangeCurrentPageException - * @throws \Pagerfanta\Exception\NotIntegerCurrentPageException - * @throws \Pagerfanta\Exception\LessThan1CurrentPageException - * @throws \Pagerfanta\Exception\NotIntegerMaxPerPageException - * @throws \Pagerfanta\Exception\LessThan1MaxPerPageException + * @throws InvalidOptionsException + * @throws BadStateException + * @throws OutOfRangeCurrentPageException + * @throws NotIntegerCurrentPageException + * @throws LessThan1CurrentPageException + * @throws NotIntegerMaxPerPageException + * @throws LessThan1MaxPerPageException */ - public function listAction(Role $role, string $routeName, int $policyPage = 1): Response - { + public function listAction( + Role $role, + string $routeName, + int $policyPage = 1 + ): Response { $pagerfanta = new Pagerfanta( new ArrayAdapter($role->getPolicies()) ); @@ -98,7 +109,7 @@ public function listAction(Role $role, string $routeName, int $policyPage = 1): $pagerfanta->setMaxPerPage($this->configResolver->getParameter('pagination.policy_limit')); $pagerfanta->setCurrentPage(min($policyPage, $pagerfanta->getNbPages())); - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Policy[] $policies */ + /** @var Policy[] $policies */ $policies = $pagerfanta->getCurrentPageResults(); $isEditable = []; @@ -125,16 +136,18 @@ public function listAction(Role $role, string $routeName, int $policyPage = 1): } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role $role + * @param Request $request + * @param Role $role * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException * @throws \InvalidArgumentException */ - public function createAction(Request $request, Role $role): Response - { + public function createAction( + Request $request, + Role $role + ): Response { $this->denyAccessUnlessGranted(new Attribute('role', 'update')); $form = $this->formFactory->createPolicy( new PolicyCreateData() @@ -199,18 +212,21 @@ public function createAction(Request $request, Role $role): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role $role - * @param \Ibexa\Contracts\Core\Repository\Values\User\Policy $policy + * @param Request $request + * @param Role $role + * @param Policy $policy * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws BadStateException * @throws \InvalidArgumentException */ - public function updateAction(Request $request, Role $role, Policy $policy): Response - { + public function updateAction( + Request $request, + Role $role, + Policy $policy + ): Response { $this->denyAccessUnlessGranted(new Attribute('role', 'update')); $limitationTypes = $policy->module ? $this->roleService->getLimitationTypesByModuleFunction($policy->module, $policy->function) @@ -231,7 +247,7 @@ public function updateAction(Request $request, Role $role, Policy $policy): Resp ])); } - /** @var \Symfony\Component\Form\Form $form */ + /** @var Form $form */ $form = $this->formFactory->updatePolicy( new PolicyUpdateData($policy) ); @@ -285,15 +301,19 @@ public function updateAction(Request $request, Role $role, Policy $policy): Resp } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role $role + * @param Request $request + * @param Role $role * @param string $policyModule * @param string $policyFunction * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function createWithLimitationAction(Request $request, Role $role, string $policyModule, string $policyFunction): Response - { + public function createWithLimitationAction( + Request $request, + Role $role, + string $policyModule, + string $policyFunction + ): Response { $this->denyAccessUnlessGranted(new Attribute('role', 'update')); $form = $this->formFactory->createPolicyWithLimitation( (new PolicyCreateData())->setPolicy([ @@ -334,17 +354,20 @@ public function createWithLimitationAction(Request $request, Role $role, string } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role $role - * @param \Ibexa\Contracts\Core\Repository\Values\User\Policy $policy + * @param Request $request + * @param Role $role + * @param Policy $policy * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException * @throws \InvalidArgumentException */ - public function deleteAction(Request $request, Role $role, Policy $policy): Response - { + public function deleteAction( + Request $request, + Role $role, + Policy $policy + ): Response { $this->denyAccessUnlessGranted(new Attribute('role', 'update')); $form = $this->formFactory->deletePolicy( new PolicyDeleteData($policy) @@ -387,17 +410,19 @@ public function deleteAction(Request $request, Role $role, Policy $policy): Resp /** * Handles removing policies based on submitted form. * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role $role + * @param Request $request + * @param Role $role * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException * @throws \InvalidArgumentException */ - public function bulkDeleteAction(Request $request, Role $role): Response - { + public function bulkDeleteAction( + Request $request, + Role $role + ): Response { $this->denyAccessUnlessGranted(new Attribute('role', 'update')); $form = $this->formFactory->deletePolicies( new PoliciesDeleteData() @@ -441,7 +466,7 @@ public function bulkDeleteAction(Request $request, Role $role): Response } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\Policy[] $policies + * @param Policy[] $policies * * @return array */ diff --git a/src/bundle/Controller/RoleAssignmentController.php b/src/bundle/Controller/RoleAssignmentController.php index e99da323a2..cd9d8132aa 100644 --- a/src/bundle/Controller/RoleAssignmentController.php +++ b/src/bundle/Controller/RoleAssignmentController.php @@ -18,6 +18,7 @@ use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\RoleService; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\RoleLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\SectionLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\SubtreeLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Role; @@ -32,19 +33,19 @@ class RoleAssignmentController extends Controller { - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ private $roleService; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( @@ -97,13 +98,15 @@ public function listAction( } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role $role + * @param Request $request + * @param Role $role * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function createAction(Request $request, Role $role): Response - { + public function createAction( + Request $request, + Role $role + ): Response { $this->denyAccessUnlessGranted(new Attribute('role', 'assign')); $form = $this->formFactory->createRoleAssignment(new RoleAssignmentCreateData()); $form->handleRequest($request); @@ -144,14 +147,17 @@ public function createAction(Request $request, Role $role): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role $role - * @param \Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment $roleAssignment + * @param Request $request + * @param Role $role + * @param RoleAssignment $roleAssignment * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function deleteAction(Request $request, Role $role, RoleAssignment $roleAssignment): Response - { + public function deleteAction( + Request $request, + Role $role, + RoleAssignment $roleAssignment + ): Response { $this->denyAccessUnlessGranted(new Attribute('role', 'assign')); $form = $this->formFactory->deleteRoleAssignment( new RoleAssignmentDeleteData($roleAssignment) @@ -188,13 +194,15 @@ public function deleteAction(Request $request, Role $role, RoleAssignment $roleA /** * Handles removing role assignments based on submitted form. * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role $role + * @param Request $request + * @param Role $role * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function bulkDeleteAction(Request $request, Role $role): Response - { + public function bulkDeleteAction( + Request $request, + Role $role + ): Response { $this->denyAccessUnlessGranted(new Attribute('role', 'assign')); $form = $this->formFactory->deleteRoleAssignments( new RoleAssignmentsDeleteData() @@ -232,7 +240,7 @@ public function bulkDeleteAction(Request $request, Role $role): Response } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment[] $roleAssignments + * @param RoleAssignment[] $roleAssignments * * @return array */ @@ -244,9 +252,9 @@ private function getRoleAssignmentsNumbers(array $roleAssignments): array } /** - * @param \Ibexa\AdminUi\Form\Data\Role\RoleAssignmentCreateData $data + * @param RoleAssignmentCreateData $data * - * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation\RoleLimitation[] + * @return RoleLimitation[] */ private function createLimitations(RoleAssignmentCreateData $data): array { diff --git a/src/bundle/Controller/RoleController.php b/src/bundle/Controller/RoleController.php index f0d6d4e9d7..100172eb25 100644 --- a/src/bundle/Controller/RoleController.php +++ b/src/bundle/Controller/RoleController.php @@ -31,34 +31,36 @@ use Pagerfanta\Adapter\ArrayAdapter; use Pagerfanta\Pagerfanta; use Symfony\Component\Form\Button; +use Symfony\Component\Form\Form; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; class RoleController extends Controller { - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ private $roleService; - /** @var \Ibexa\AdminUi\Form\DataMapper\RoleCreateMapper */ + /** @var RoleCreateMapper */ private $roleCreateMapper; - /** @var \Ibexa\AdminUi\Form\DataMapper\RoleCopyMapper */ + /** @var RoleCopyMapper */ private $roleCopyMapper; - /** @var \Ibexa\AdminUi\Form\DataMapper\RoleUpdateMapper */ + /** @var RoleUpdateMapper */ private $roleUpdateMapper; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( @@ -92,7 +94,7 @@ public function listAction(Request $request): Response $pagerfanta->setMaxPerPage($this->configResolver->getParameter('pagination.role_limit')); $pagerfanta->setCurrentPage(min($page, $pagerfanta->getNbPages())); - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role[] $sectionList */ + /** @var Role[] $sectionList */ $roles = $pagerfanta->getCurrentPageResults(); $rolesNumbers = array_column($roles, 'id'); @@ -113,8 +115,12 @@ public function listAction(Request $request): Response ]); } - public function viewAction(Request $request, Role $role, int $policyPage = 1, int $assignmentPage = 1): Response - { + public function viewAction( + Request $request, + Role $role, + int $policyPage = 1, + int $assignmentPage = 1 + ): Response { $deleteForm = $this->formFactory->deleteRole( new RoleDeleteData($role) ); @@ -129,14 +135,14 @@ public function viewAction(Request $request, Role $role, int $policyPage = 1, in } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function createAction(Request $request): Response { $this->denyAccessUnlessGranted(new Attribute('role', 'create')); - /** @var \Symfony\Component\Form\Form $form */ + /** @var Form $form */ $form = $this->formFactory->createRole(); $form->handleRequest($request); @@ -176,8 +182,10 @@ public function createAction(Request $request): Response ]); } - public function copyAction(Request $request, Role $role): Response - { + public function copyAction( + Request $request, + Role $role + ): Response { $this->denyAccessUnlessGranted(new Attribute('role', 'create')); $form = $this->createForm(RoleCopyType::class, new RoleCopyData($role)); @@ -212,15 +220,17 @@ public function copyAction(Request $request, Role $role): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role $role + * @param Request $request + * @param Role $role * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function updateAction(Request $request, Role $role): Response - { + public function updateAction( + Request $request, + Role $role + ): Response { $this->denyAccessUnlessGranted(new Attribute('role', 'update')); - /** @var \Symfony\Component\Form\Form $form */ + /** @var Form $form */ $form = $this->formFactory->updateRole( new RoleUpdateData($role) ); @@ -228,7 +238,7 @@ public function updateAction(Request $request, Role $role): Response if ($form->isSubmitted()) { $result = $this->submitHandler->handle($form, function (RoleUpdateData $data) use ($form): Response { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role $role */ + /** @var Role $role */ $role = $data->getRole(); $roleUpdateStruct = $this->roleUpdateMapper->reverseMap($data); @@ -269,13 +279,15 @@ public function updateAction(Request $request, Role $role): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role $role + * @param Request $request + * @param Role $role * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function deleteAction(Request $request, Role $role): Response - { + public function deleteAction( + Request $request, + Role $role + ): Response { $this->denyAccessUnlessGranted(new Attribute('role', 'delete')); $form = $this->formFactory->deleteRole( new RoleDeleteData($role) @@ -310,13 +322,13 @@ public function deleteAction(Request $request, Role $role): Response /** * Handles removing roles based on submitted form. * - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * * @throws \InvalidArgumentException * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function bulkDeleteAction(Request $request): Response { diff --git a/src/bundle/Controller/SectionController.php b/src/bundle/Controller/SectionController.php index 57330061ca..29d209bc26 100644 --- a/src/bundle/Controller/SectionController.php +++ b/src/bundle/Controller/SectionController.php @@ -26,6 +26,9 @@ use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; use Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\SearchService; @@ -41,6 +44,7 @@ use Pagerfanta\Adapter\ArrayAdapter; use Pagerfanta\Pagerfanta; use Symfony\Component\Form\Button; +use Symfony\Component\Form\Form; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -48,43 +52,43 @@ class SectionController extends Controller { - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; - /** @var \Ibexa\Contracts\Core\Repository\SectionService */ + /** @var SectionService */ private $sectionService; - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ + /** @var SearchService */ private $searchService; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\DataMapper\SectionCreateMapper */ + /** @var SectionCreateMapper */ private $sectionCreateMapper; - /** @var \Ibexa\AdminUi\Form\DataMapper\SectionUpdateMapper */ + /** @var SectionUpdateMapper */ private $sectionUpdateMapper; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Ibexa\AdminUi\UI\Service\PathService */ + /** @var PathService */ private $pathService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface */ + /** @var PermissionCheckerInterface */ private $permissionChecker; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( @@ -124,12 +128,12 @@ public function performAccessCheck(): void } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws InvalidArgumentException + * @throws UnauthorizedException */ public function listAction(Request $request): Response { @@ -142,7 +146,7 @@ public function listAction(Request $request): Response $pagerfanta->setMaxPerPage($this->configResolver->getParameter('pagination.section_limit')); $pagerfanta->setCurrentPage(min($page, $pagerfanta->getNbPages())); - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section[] $sectionList */ + /** @var Section[] $sectionList */ $sectionList = $pagerfanta->getCurrentPageResults(); $contentCountBySectionId = []; $deletableSections = []; @@ -184,9 +188,9 @@ public function listAction(Request $request): Response } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section $section + * @param Section $section * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function viewAction(Section $section): Response { @@ -205,18 +209,21 @@ public function viewAction(Section $section): Response /** * Fragment action which renders list of contents assigned to section. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section $section + * @param Section $section * @param int $page Current page * @param int $limit Number of items per page * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws NotFoundException + * @throws UnauthorizedException + * @throws InvalidArgumentException */ - public function viewSectionContentAction(Section $section, int $page = 1, int $limit = 10): Response - { + public function viewSectionContentAction( + Section $section, + int $page = 1, + int $limit = 10 + ): Response { $sectionContentAssignForm = $this->formFactory->assignContentSectionForm( new SectionContentAssignData($section) )->createView(); @@ -263,13 +270,15 @@ public function viewSectionContentAction(Section $section, int $page = 1, int $l } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section $section + * @param Request $request + * @param Section $section * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function deleteAction(Request $request, Section $section): Response - { + public function deleteAction( + Request $request, + Section $section + ): Response { $this->denyAccessUnlessGranted(new Attribute('section', 'edit')); $form = $this->formFactory->deleteSection( new SectionDeleteData($section) @@ -303,9 +312,9 @@ public function deleteAction(Request $request, Section $section): Response /** * Handles removing sections based on submitted form. * - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function bulkDeleteAction(Request $request): Response { @@ -339,13 +348,15 @@ public function bulkDeleteAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section $section + * @param Request $request + * @param Section $section * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function assignContentAction(Request $request, Section $section): Response - { + public function assignContentAction( + Request $request, + Section $section + ): Response { if (!$this->canUserAssignSectionToSomeContent($section)) { $exception = $this->createAccessDeniedException(); $exception->setAttributes('state'); @@ -392,14 +403,14 @@ public function assignContentAction(Request $request, Section $section): Respons } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function createAction(Request $request): Response { $this->denyAccessUnlessGranted(new Attribute('section', 'edit')); - /** @var \Symfony\Component\Form\Form $form */ + /** @var Form $form */ $form = $this->formFactory->createSection( new SectionCreateData() ); @@ -442,15 +453,17 @@ public function createAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section $section + * @param Request $request + * @param Section $section * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function updateAction(Request $request, Section $section): Response - { + public function updateAction( + Request $request, + Section $section + ): Response { $this->denyAccessUnlessGranted(new Attribute('section', 'edit')); - /** @var \Symfony\Component\Form\Form $form */ + /** @var Form $form */ $form = $this->formFactory->updateSection( new SectionUpdateData($section) ); @@ -490,7 +503,7 @@ public function updateAction(Request $request, Section $section): Response } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section[] $sections + * @param Section[] $sections * * @return array */ @@ -504,11 +517,11 @@ private function getSectionsNumbers(array $sections): array /** * Specifies if the User has access to assigning a given Section to Content. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section $section + * @param Section $section * * @return bool * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ private function canUserAssignSectionToSomeContent(Section $section): bool { diff --git a/src/bundle/Controller/TranslationController.php b/src/bundle/Controller/TranslationController.php index 9e0254d9a5..ac90f208ee 100644 --- a/src/bundle/Controller/TranslationController.php +++ b/src/bundle/Controller/TranslationController.php @@ -15,6 +15,7 @@ use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Core\Helper\TranslationHelper; use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -23,26 +24,26 @@ class TranslationController extends Controller { - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\Core\Helper\TranslationHelper */ + /** @var TranslationHelper */ private $translationHelper; /** - * @param \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface $notificationHandler - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\AdminUi\Form\Factory\FormFactory $formFactory - * @param \Ibexa\AdminUi\Form\SubmitHandler $submitHandler + * @param TranslatableNotificationHandlerInterface $notificationHandler + * @param ContentService $contentService + * @param FormFactory $formFactory + * @param SubmitHandler $submitHandler */ public function __construct( TranslatableNotificationHandlerInterface $notificationHandler, @@ -59,9 +60,9 @@ public function __construct( } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function addAction(Request $request): Response { @@ -69,7 +70,7 @@ public function addAction(Request $request): Response $form = $this->formFactory->addTranslation(null, $formName); $form->handleRequest($request); - /** @var \Ibexa\AdminUi\Form\Data\Content\Translation\TranslationAddData $data */ + /** @var TranslationAddData $data */ $data = $form->getData(); $location = $data->getLocation(); @@ -104,16 +105,16 @@ public function addAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function removeAction(Request $request): Response { $form = $this->formFactory->deleteTranslation(); $form->handleRequest($request); - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo */ + /** @var ContentInfo $contentInfo */ $contentInfo = $form->getData()->getContentInfo(); if ($form->isSubmitted()) { diff --git a/src/bundle/Controller/TrashController.php b/src/bundle/Controller/TrashController.php index d5c83f52bd..1f82517b4a 100644 --- a/src/bundle/Controller/TrashController.php +++ b/src/bundle/Controller/TrashController.php @@ -19,10 +19,12 @@ use Ibexa\AdminUi\Pagination\Pagerfanta\TrashItemAdapter; use Ibexa\AdminUi\QueryType\TrashSearchQueryType; use Ibexa\AdminUi\Specification\UserExists; +use Ibexa\AdminUi\UI\Service\PathService; use Ibexa\AdminUi\UI\Service\PathService as UiPathService; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\TrashService; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\TrashItem; @@ -31,42 +33,48 @@ use Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface; use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute; use JMS\TranslationBundle\Annotation\Desc; +use Pagerfanta\Exception\LessThan1CurrentPageException; +use Pagerfanta\Exception\LessThan1MaxPerPageException; +use Pagerfanta\Exception\NotIntegerCurrentPageException; +use Pagerfanta\Exception\NotIntegerMaxPerPageException; +use Pagerfanta\Exception\OutOfRangeCurrentPageException; use Pagerfanta\Pagerfanta; use Symfony\Component\Form\Util\StringUtil; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; class TrashController extends Controller { - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Ibexa\Contracts\Core\Repository\TrashService */ + /** @var TrashService */ private $trashService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\AdminUi\Form\Factory\TrashFormFactory */ + /** @var TrashFormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\AdminUi\UI\Service\PathService */ + /** @var PathService */ private $uiPathService; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ + /** @var UserLanguagePreferenceProviderInterface */ private $userLanguagePreferenceProvider; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; - /** @var \Ibexa\AdminUi\QueryType\TrashSearchQueryType */ + /** @var TrashSearchQueryType */ private $trashSearchQueryType; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; public function __construct( @@ -100,18 +108,18 @@ public function performAccessCheck(): void } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * * @throws \LogicException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Pagerfanta\Exception\OutOfRangeCurrentPageException - * @throws \Pagerfanta\Exception\NotIntegerCurrentPageException - * @throws \Pagerfanta\Exception\LessThan1CurrentPageException - * @throws \Pagerfanta\Exception\NotIntegerMaxPerPageException - * @throws \Pagerfanta\Exception\LessThan1MaxPerPageException - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws NotFoundException + * @throws OutOfRangeCurrentPageException + * @throws NotIntegerCurrentPageException + * @throws LessThan1CurrentPageException + * @throws NotIntegerMaxPerPageException + * @throws LessThan1MaxPerPageException + * @throws InvalidOptionsException */ public function listAction(Request $request): Response { @@ -136,7 +144,7 @@ public function listAction(Request $request): Response $pagerfanta->setMaxPerPage($this->configResolver->getParameter('pagination.trash_limit')); $pagerfanta->setCurrentPage(min($page, $pagerfanta->getNbPages())); - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem $item */ + /** @var TrashItem $item */ foreach ($pagerfanta->getCurrentPageResults() as $item) { $contentType = $this->contentTypeService->loadContentType( $item->getContentInfo()->contentTypeId, @@ -176,9 +184,9 @@ public function listAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException * @throws \LogicException @@ -218,9 +226,9 @@ public function emptyAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException * @throws \LogicException @@ -274,11 +282,11 @@ function (TrashItemRestoreData $data) use ($request) { } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException * @throws \LogicException * @throws \InvalidArgumentException @@ -330,7 +338,7 @@ private function redirectToTrashList(Request $request): RedirectResponse } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ private function getCreatorFromTrashItem(TrashItem $trashItem): ?User { diff --git a/src/bundle/Controller/URLWildcardController.php b/src/bundle/Controller/URLWildcardController.php index 97704886e1..8fab6b436e 100644 --- a/src/bundle/Controller/URLWildcardController.php +++ b/src/bundle/Controller/URLWildcardController.php @@ -22,21 +22,22 @@ use Ibexa\Contracts\Core\Repository\Values\Content\URLWildcardUpdateStruct; use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\Form\Button; +use Symfony\Component\Form\Form; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; final class URLWildcardController extends Controller { - /** @var \Ibexa\Contracts\Core\Repository\URLWildcardService */ + /** @var URLWildcardService */ private $urlWildcardService; - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; public function __construct( @@ -52,13 +53,13 @@ public function __construct( } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function addAction(Request $request): Response { - /** @var \Symfony\Component\Form\Form $form */ + /** @var Form $form */ $form = $this->formFactory->createURLWildcard(); $form->handleRequest($request); @@ -98,14 +99,16 @@ public function addAction(Request $request): Response } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard $urlWildcard - * @param \Symfony\Component\HttpFoundation\Request $request + * @param URLWildcard $urlWildcard + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ - public function updateAction(URLWildcard $urlWildcard, Request $request): Response - { - /** @var \Symfony\Component\Form\Form $form */ + public function updateAction( + URLWildcard $urlWildcard, + Request $request + ): Response { + /** @var Form $form */ $form = $this->formFactory->createURLWildcardUpdate( new URLWildcardUpdateData($urlWildcard) ); @@ -165,9 +168,9 @@ function (URLWildcardUpdateData $data) use ($urlWildcard, $form): Response { } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function bulkDeleteAction(Request $request): Response { diff --git a/src/bundle/Controller/UniversalDiscoveryController.php b/src/bundle/Controller/UniversalDiscoveryController.php index 3842ad7fcc..2d3351c4d0 100644 --- a/src/bundle/Controller/UniversalDiscoveryController.php +++ b/src/bundle/Controller/UniversalDiscoveryController.php @@ -18,7 +18,7 @@ class UniversalDiscoveryController extends Controller { - /** @var \Ibexa\Contracts\AdminUi\UniversalDiscovery\Provider */ + /** @var Provider */ private $provider; public function __construct( diff --git a/src/bundle/Controller/UrlAliasController.php b/src/bundle/Controller/UrlAliasController.php index a2e8a6c9d9..1222ca6aec 100644 --- a/src/bundle/Controller/UrlAliasController.php +++ b/src/bundle/Controller/UrlAliasController.php @@ -20,19 +20,19 @@ class UrlAliasController extends Controller { - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ protected $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ protected $submitHandler; - /** @var \Ibexa\Contracts\Core\Repository\URLAliasService */ + /** @var URLAliasService */ protected $urlAliasService; /** - * @param \Ibexa\AdminUi\Form\Factory\FormFactory $formFactory - * @param \Ibexa\AdminUi\Form\SubmitHandler $submitHandler - * @param \Ibexa\Contracts\Core\Repository\URLAliasService $urlAliasService + * @param FormFactory $formFactory + * @param SubmitHandler $submitHandler + * @param URLAliasService $urlAliasService */ public function __construct( FormFactory $formFactory, @@ -45,16 +45,16 @@ public function __construct( } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function addAction(Request $request): Response { $form = $this->formFactory->addCustomUrl(); $form->handleRequest($request); - /** @var \Ibexa\AdminUi\Form\Data\Content\CustomUrl\CustomUrlAddData $data */ + /** @var CustomUrlAddData $data */ $data = $form->getData(); $location = $data->getLocation(); @@ -83,9 +83,9 @@ public function addAction(Request $request): Response } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response */ public function removeAction(Request $request): Response { diff --git a/src/bundle/Controller/User/FocusModeController.php b/src/bundle/Controller/User/FocusModeController.php index cba8aea1af..166311a1a5 100644 --- a/src/bundle/Controller/User/FocusModeController.php +++ b/src/bundle/Controller/User/FocusModeController.php @@ -13,6 +13,7 @@ use Ibexa\AdminUi\UserSetting\FocusMode; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Event\FocusModeChangedEvent; +use Ibexa\Contracts\AdminUi\FocusMode\RedirectStrategyInterface; use Ibexa\User\UserSetting\UserSettingService; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -30,11 +31,11 @@ final class FocusModeController extends Controller private UrlMatcherInterface $urlMatcher; - /** @var iterable<\Ibexa\Contracts\AdminUi\FocusMode\RedirectStrategyInterface> */ + /** @var iterable */ private iterable $redirectStrategies; /** - * @param iterable<\Ibexa\Contracts\AdminUi\FocusMode\RedirectStrategyInterface> $redirectStrategies + * @param iterable $redirectStrategies */ public function __construct( EventDispatcherInterface $eventDispatcher, @@ -48,8 +49,10 @@ public function __construct( $this->redirectStrategies = $redirectStrategies; } - public function changeAction(Request $request, ?string $returnPath): Response - { + public function changeAction( + Request $request, + ?string $returnPath + ): Response { $data = new FocusModeChangeData(); $data->setEnabled( $this->userSettingService->getUserSetting(FocusMode::IDENTIFIER)->value === FocusMode::FOCUS_MODE_ON @@ -102,8 +105,10 @@ private function createRedirectToReturnPath(Request $request): RedirectResponse return new RedirectResponse($path); } - private function isSafeUrl(string $referer, string $baseUrl): bool - { + private function isSafeUrl( + string $referer, + string $baseUrl + ): bool { return str_starts_with($referer, $baseUrl); } diff --git a/src/bundle/Controller/User/InvitationController.php b/src/bundle/Controller/User/InvitationController.php index e73eefc4d2..ec30338016 100644 --- a/src/bundle/Controller/User/InvitationController.php +++ b/src/bundle/Controller/User/InvitationController.php @@ -63,8 +63,10 @@ public function __construct( $this->urlGenerator = $urlGenerator; } - public function sendInvitationsAction(int $userGroupId, Request $request): Response - { + public function sendInvitationsAction( + int $userGroupId, + Request $request + ): Response { $group = $this->userService->loadUserGroup($userGroupId); $form = $this->formFactory->create( diff --git a/src/bundle/Controller/User/ProfileEditController.php b/src/bundle/Controller/User/ProfileEditController.php index eb7086a489..23812f7433 100644 --- a/src/bundle/Controller/User/ProfileEditController.php +++ b/src/bundle/Controller/User/ProfileEditController.php @@ -28,6 +28,7 @@ use Ibexa\Core\FieldType\User\Type as UserFieldType; use Symfony\Component\Form\Form; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; final class ProfileEditController extends Controller { @@ -68,10 +69,12 @@ public function __construct( } /** - * @return \Ibexa\ContentForms\User\View\UserUpdateView|\Symfony\Component\HttpFoundation\Response + * @return UserUpdateView|Response */ - public function editAction(Request $request, ?string $languageCode) - { + public function editAction( + Request $request, + ?string $languageCode + ) { $user = $this->userService->loadUser($this->permissionResolver->getCurrentUserReference()->getUserId()); if (!$this->isUserProfileAvailable($user)) { throw $this->createNotFoundException(); diff --git a/src/bundle/Controller/User/ProfileViewController.php b/src/bundle/Controller/User/ProfileViewController.php index b99f125f48..8f2c89f92f 100644 --- a/src/bundle/Controller/User/ProfileViewController.php +++ b/src/bundle/Controller/User/ProfileViewController.php @@ -16,6 +16,7 @@ use Ibexa\Contracts\Core\Repository\RoleService; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\User\Role; +use Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment; use Ibexa\Contracts\Core\Repository\Values\User\User; use Symfony\Component\HttpFoundation\Response; @@ -66,7 +67,7 @@ public function viewAction(int $userId): Response } /** - * @return \Ibexa\Contracts\Core\Repository\Values\User\Role[] + * @return Role[] */ private function getUserRoles(User $user): iterable { @@ -74,7 +75,7 @@ private function getUserRoles(User $user): iterable return []; } - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment[] $assignments */ + /** @var RoleAssignment[] $assignments */ $assignments = $this->repository->sudo(function () use ($user): iterable { return $this->roleService->getRoleAssignmentsForUser($user, true); }); @@ -87,7 +88,10 @@ private function getUserRoles(User $user): iterable } } - usort($roles, static function (Role $roleA, Role $roleB): int { + usort($roles, static function ( + Role $roleA, + Role $roleB + ): int { return strcmp($roleA->identifier, $roleB->identifier); }); diff --git a/src/bundle/Controller/User/UserDeleteController.php b/src/bundle/Controller/User/UserDeleteController.php index 2657249d8b..76d7e17a97 100644 --- a/src/bundle/Controller/User/UserDeleteController.php +++ b/src/bundle/Controller/User/UserDeleteController.php @@ -12,6 +12,8 @@ use Ibexa\AdminUi\Form\SubmitHandler; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\UserService; use JMS\TranslationBundle\Annotation\Desc; @@ -21,27 +23,27 @@ class UserDeleteController extends Controller { - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; /** - * @param \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface $notificationHandler - * @param \Ibexa\AdminUi\Form\Factory\FormFactory $formFactory - * @param \Ibexa\AdminUi\Form\SubmitHandler $submitHandler - * @param \Ibexa\Contracts\Core\Repository\UserService $userService - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService + * @param TranslatableNotificationHandlerInterface $notificationHandler + * @param FormFactory $formFactory + * @param SubmitHandler $submitHandler + * @param UserService $userService + * @param LocationService $locationService */ public function __construct( TranslatableNotificationHandlerInterface $notificationHandler, @@ -58,14 +60,14 @@ public function __construct( } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * * @throws \InvalidArgumentException * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws UnauthorizedException + * @throws NotFoundException */ public function userDeleteAction(Request $request): Response { diff --git a/src/bundle/Controller/UserOnTheFlyController.php b/src/bundle/Controller/UserOnTheFlyController.php index 418f902957..6e4e7a62a5 100644 --- a/src/bundle/Controller/UserOnTheFlyController.php +++ b/src/bundle/Controller/UserOnTheFlyController.php @@ -20,6 +20,7 @@ use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\Exceptions as ApiException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\PermissionResolver; @@ -36,34 +37,35 @@ use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; class UserOnTheFlyController extends Controller { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @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\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ + /** @var UserLanguagePreferenceProviderInterface */ private $userLanguagePreferenceProvider; - /** @var \Ibexa\AdminUi\Form\ActionDispatcher\CreateUserOnTheFlyDispatcher */ + /** @var CreateUserOnTheFlyDispatcher */ private $createUserActionDispatcher; - /** @var \Ibexa\AdminUi\Form\ActionDispatcher\EditUserOnTheFlyDispatcher */ + /** @var EditUserOnTheFlyDispatcher */ private $editUserActionDispatcher; public function __construct( @@ -89,11 +91,11 @@ public function __construct( } /** - * @return \Ibexa\Core\MVC\Symfony\View\BaseView|\Symfony\Component\HttpFoundation\Response + * @return BaseView|Response * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws NotFoundException + * @throws ApiException\UnauthorizedException + * @throws ApiException\InvalidArgumentException */ public function createUserAction( Request $request, @@ -178,9 +180,9 @@ public function hasCreateAccessAction( } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws NotFoundException + * @throws ApiException\UnauthorizedException + * @throws ApiException\InvalidArgumentException */ public function editUserAction( Request $request, diff --git a/src/bundle/Controller/Version/VersionConflictController.php b/src/bundle/Controller/Version/VersionConflictController.php index 1db812d4d1..a874668513 100644 --- a/src/bundle/Controller/Version/VersionConflictController.php +++ b/src/bundle/Controller/Version/VersionConflictController.php @@ -11,18 +11,20 @@ use Ibexa\AdminUi\Specification\Version\VersionHasConflict; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Core\Base\Exceptions\BadStateException; use Symfony\Component\HttpFoundation\Response; class VersionConflictController extends Controller { /** - * @var \Ibexa\Contracts\Core\Repository\ContentService + * @var ContentService */ private $contentService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @param ContentService $contentService */ public function __construct(ContentService $contentService) { @@ -38,14 +40,17 @@ public function __construct(ContentService $contentService) * @param int $versionNo * @param string $languageCode * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Core\Base\Exceptions\BadStateException + * @throws NotFoundException + * @throws UnauthorizedException + * @throws BadStateException */ - public function versionHasNoConflictAction(int $contentId, int $versionNo, string $languageCode): Response - { + public function versionHasNoConflictAction( + int $contentId, + int $versionNo, + string $languageCode + ): Response { $versionInfo = $this->contentService->loadVersionInfoById($contentId, $versionNo); if (!$versionInfo->isDraft()) { diff --git a/src/bundle/Controller/VersionController.php b/src/bundle/Controller/VersionController.php index 07d9eca913..e96bb94c26 100644 --- a/src/bundle/Controller/VersionController.php +++ b/src/bundle/Controller/VersionController.php @@ -14,35 +14,40 @@ use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; +use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Core\Helper\TranslationHelper; use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; class VersionController extends Controller { - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\Core\Helper\TranslationHelper */ + /** @var TranslationHelper */ private $translationHelper; /** - * @param \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface $notificationHandler - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\AdminUi\Form\Factory\FormFactory $formFactory - * @param \Ibexa\AdminUi\Form\SubmitHandler $submitHandler - * @param \Ibexa\Core\Helper\TranslationHelper $translationHelper + * @param TranslatableNotificationHandlerInterface $notificationHandler + * @param ContentService $contentService + * @param FormFactory $formFactory + * @param SubmitHandler $submitHandler + * @param TranslationHelper $translationHelper */ public function __construct( TranslatableNotificationHandlerInterface $notificationHandler, @@ -59,15 +64,15 @@ public function __construct( } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * - * @return \Symfony\Component\HttpFoundation\Response + * @return Response * * @throws \InvalidArgumentException - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws InvalidOptionsException + * @throws UnauthorizedException + * @throws NotFoundException + * @throws BadStateException * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException */ public function removeAction(Request $request): Response @@ -86,7 +91,7 @@ public function removeAction(Request $request): Response ); $form->handleRequest($request); - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo */ + /** @var ContentInfo $contentInfo */ $contentInfo = $form->getData()->getContentInfo(); if ($form->isSubmitted()) { $result = $this->submitHandler->handle($form, function (VersionRemoveData $data) { diff --git a/src/bundle/ControllerArgumentResolver/ContentTreeChildrenQueryArgumentResolver.php b/src/bundle/ControllerArgumentResolver/ContentTreeChildrenQueryArgumentResolver.php index 653bfd48ed..48a584f4db 100644 --- a/src/bundle/ControllerArgumentResolver/ContentTreeChildrenQueryArgumentResolver.php +++ b/src/bundle/ControllerArgumentResolver/ContentTreeChildrenQueryArgumentResolver.php @@ -8,10 +8,13 @@ namespace Ibexa\Bundle\AdminUi\ControllerArgumentResolver; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd; use Ibexa\Contracts\Rest\Input\Parser\Query\Criterion\CriterionProcessorInterface; + use function Ibexa\PolyfillPhp82\iterator_to_array; + use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata; @@ -33,19 +36,23 @@ public function __construct( $this->criterionProcessor = $criterionProcessor; } - public function supports(Request $request, ArgumentMetadata $argument): bool - { + public function supports( + Request $request, + ArgumentMetadata $argument + ): bool { return Criterion::class === $argument->getType() && 'filter' === $argument->getName(); } /** - * @return iterable<\Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion|null> + * @return iterable * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ - public function resolve(Request $request, ArgumentMetadata $argument): iterable - { + public function resolve( + Request $request, + ArgumentMetadata $argument + ): iterable { $criteria = $this->processFilterQueryCriteria($request); if ($argument->isNullable() && empty($criteria)) { yield null; @@ -57,7 +64,7 @@ public function resolve(Request $request, ArgumentMetadata $argument): iterable } /** - * @return array<\Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion> + * @return array */ private function processFilterQueryCriteria(Request $request): array { diff --git a/src/bundle/ControllerArgumentResolver/UniversalDiscoveryRequestQueryArgumentResolver.php b/src/bundle/ControllerArgumentResolver/UniversalDiscoveryRequestQueryArgumentResolver.php index 6b0ac424a3..1dfb00f8a6 100644 --- a/src/bundle/ControllerArgumentResolver/UniversalDiscoveryRequestQueryArgumentResolver.php +++ b/src/bundle/ControllerArgumentResolver/UniversalDiscoveryRequestQueryArgumentResolver.php @@ -33,17 +33,21 @@ public function __construct( $this->validator = $validator; } - public function supports(Request $request, ArgumentMetadata $argument): bool - { + public function supports( + Request $request, + ArgumentMetadata $argument + ): bool { return RequestQuery::class === $argument->getType() && 'requestQuery' === $argument->getName(); } /** - * @return iterable<\Ibexa\AdminUi\REST\Value\UniversalDiscovery\RequestQuery> + * @return iterable */ - public function resolve(Request $request, ArgumentMetadata $argument): iterable - { + public function resolve( + Request $request, + ArgumentMetadata $argument + ): iterable { $this->validate($request); $query = $request->query; diff --git a/src/bundle/DependencyInjection/Compiler/ComponentPass.php b/src/bundle/DependencyInjection/Compiler/ComponentPass.php index c672d70ff0..16a012418b 100644 --- a/src/bundle/DependencyInjection/Compiler/ComponentPass.php +++ b/src/bundle/DependencyInjection/Compiler/ComponentPass.php @@ -15,7 +15,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; /** - * @deprecated 4.6.19 The {@see \Ibexa\Bundle\AdminUi\DependencyInjection\Compiler\ComponentPass} class is deprecated, will be removed in 6.0. + * @deprecated 4.6.19 The {@see ComponentPass} class is deprecated, will be removed in 6.0. * Use {@see \Ibexa\Bundle\TwigComponents\DependencyInjection\Compiler\ComponentPass} instead */ class ComponentPass implements CompilerPassInterface @@ -25,10 +25,10 @@ class ComponentPass implements CompilerPassInterface public const TAG_NAME = 'ibexa.admin_ui.component'; /** - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container + * @param ContainerBuilder $container * * @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException When a service is abstract - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException When a tag is missing 'group' attribute + * @throws InvalidArgumentException When a tag is missing 'group' attribute */ public function process(ContainerBuilder $container): void { diff --git a/src/bundle/DependencyInjection/Compiler/TabPass.php b/src/bundle/DependencyInjection/Compiler/TabPass.php index 1a0d82b7ca..fbeda00bee 100644 --- a/src/bundle/DependencyInjection/Compiler/TabPass.php +++ b/src/bundle/DependencyInjection/Compiler/TabPass.php @@ -21,10 +21,10 @@ class TabPass implements CompilerPassInterface public const TAG_TAB = 'ibexa.admin_ui.tab'; /** - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container + * @param ContainerBuilder $container * * @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException When a service is abstract - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException When a tag is missing 'group' attribute + * @throws InvalidArgumentException When a tag is missing 'group' attribute */ public function process(ContainerBuilder $container): void { diff --git a/src/bundle/DependencyInjection/Compiler/UiConfigProviderPass.php b/src/bundle/DependencyInjection/Compiler/UiConfigProviderPass.php index b3dda6881e..e4fcf5cdc6 100644 --- a/src/bundle/DependencyInjection/Compiler/UiConfigProviderPass.php +++ b/src/bundle/DependencyInjection/Compiler/UiConfigProviderPass.php @@ -11,6 +11,8 @@ use Ibexa\AdminUi\UI\Config\Aggregator; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; use Symfony\Component\DependencyInjection\Reference; /** @@ -21,10 +23,10 @@ class UiConfigProviderPass implements CompilerPassInterface public const TAG_CONFIG_PROVIDER = 'ibexa.admin_ui.config.provider'; /** - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container + * @param ContainerBuilder $container * - * @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException - * @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException + * @throws InvalidArgumentException + * @throws ServiceNotFoundException */ public function process(ContainerBuilder $container): void { diff --git a/src/bundle/DependencyInjection/Configuration/Parser/AdminUiForms.php b/src/bundle/DependencyInjection/Configuration/Parser/AdminUiForms.php index 70ea3fd2d9..078ffd372f 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/AdminUiForms.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/AdminUiForms.php @@ -39,7 +39,7 @@ class AdminUiForms extends AbstractParser /** * Adds semantic configuration definition. * - * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system. + * @param NodeBuilder $nodeBuilder Node just under ezpublish.system. */ public function addSemanticConfig(NodeBuilder $nodeBuilder) { @@ -211,8 +211,10 @@ public function mapConfig( /** * {@inheritdoc} */ - public function postMap(array $config, ContextualizerInterface $contextualizer) - { + public function postMap( + array $config, + ContextualizerInterface $contextualizer + ) { $contextualizer->mapConfigArray('admin_ui_forms.content_edit_form_templates', $config); $contextualizer->mapConfigArray('admin_ui_forms.content_edit.fieldtypes', $config); $contextualizer->mapConfigArray('admin_ui_forms.content_edit.meta_field_groups_list', $config); diff --git a/src/bundle/DependencyInjection/Configuration/Parser/Assets.php b/src/bundle/DependencyInjection/Configuration/Parser/Assets.php index 4bb40db082..7aa052e7ab 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/Assets.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/Assets.php @@ -52,8 +52,11 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder): void ->end(); } - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void - { + public function mapConfig( + array &$scopeSettings, + $currentScope, + ContextualizerInterface $contextualizer + ): void { if (empty($scopeSettings[self::ASSETS_NODE])) { return; } diff --git a/src/bundle/DependencyInjection/Configuration/Parser/ContentType.php b/src/bundle/DependencyInjection/Configuration/Parser/ContentType.php index 21c2a2e9f1..c8b0fea87a 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/ContentType.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/ContentType.php @@ -33,8 +33,11 @@ class ContentType extends AbstractParser /** * {@inheritdoc} */ - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) - { + public function mapConfig( + array &$scopeSettings, + $currentScope, + ContextualizerInterface $contextualizer + ) { if (empty($scopeSettings['content_type'])) { return; } diff --git a/src/bundle/DependencyInjection/Configuration/Parser/ContentTypeGroup.php b/src/bundle/DependencyInjection/Configuration/Parser/ContentTypeGroup.php index 6f9bcd170d..cab4240b6d 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/ContentTypeGroup.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/ContentTypeGroup.php @@ -48,8 +48,11 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder): void /** * @param array $scopeSettings */ - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void - { + public function mapConfig( + array &$scopeSettings, + $currentScope, + ContextualizerInterface $contextualizer + ): void { if (empty($scopeSettings['content_type_group'])) { return; } diff --git a/src/bundle/DependencyInjection/Configuration/Parser/LocationIds.php b/src/bundle/DependencyInjection/Configuration/Parser/LocationIds.php index 963f433977..a54da78ec5 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/LocationIds.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/LocationIds.php @@ -31,7 +31,7 @@ class LocationIds extends AbstractParser /** * Adds semantic configuration definition. * - * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system. + * @param NodeBuilder $nodeBuilder Node just under ezpublish.system. */ public function addSemanticConfig(NodeBuilder $nodeBuilder) { @@ -49,8 +49,11 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) /** * {@inheritdoc} */ - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void - { + public function mapConfig( + array &$scopeSettings, + $currentScope, + ContextualizerInterface $contextualizer + ): void { if (empty($scopeSettings['location_ids'])) { return; } diff --git a/src/bundle/DependencyInjection/Configuration/Parser/Module/ContentTree.php b/src/bundle/DependencyInjection/Configuration/Parser/Module/ContentTree.php index 014e02ad32..8726940004 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/Module/ContentTree.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/Module/ContentTree.php @@ -101,8 +101,11 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) /** * {@inheritdoc} */ - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void - { + public function mapConfig( + array &$scopeSettings, + $currentScope, + ContextualizerInterface $contextualizer + ): void { if (empty($scopeSettings['content_tree_module'])) { return; } diff --git a/src/bundle/DependencyInjection/Configuration/Parser/Module/Subitems.php b/src/bundle/DependencyInjection/Configuration/Parser/Module/Subitems.php index 989ad84aea..a243e9bd27 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/Module/Subitems.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/Module/Subitems.php @@ -29,7 +29,7 @@ class Subitems extends AbstractParser /** * Adds semantic configuration definition. * - * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system. + * @param NodeBuilder $nodeBuilder Node just under ezpublish.system. */ public function addSemanticConfig(NodeBuilder $nodeBuilder) { @@ -45,8 +45,11 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) /** * {@inheritdoc} */ - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void - { + public function mapConfig( + array &$scopeSettings, + $currentScope, + ContextualizerInterface $contextualizer + ): void { if (empty($scopeSettings['subitems_module'])) { return; } diff --git a/src/bundle/DependencyInjection/Configuration/Parser/Module/UniversalDiscoveryWidget.php b/src/bundle/DependencyInjection/Configuration/Parser/Module/UniversalDiscoveryWidget.php index f8c207f303..1b3cb0eb9c 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/Module/UniversalDiscoveryWidget.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/Module/UniversalDiscoveryWidget.php @@ -20,7 +20,7 @@ class UniversalDiscoveryWidget extends AbstractParser /** * Adds semantic configuration definition. * - * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system. + * @param NodeBuilder $nodeBuilder Node just under ezpublish.system. */ public function addSemanticConfig(NodeBuilder $nodeBuilder) { @@ -40,8 +40,11 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) /** * {@inheritdoc} */ - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void - { + public function mapConfig( + array &$scopeSettings, + $currentScope, + ContextualizerInterface $contextualizer + ): void { if (empty($scopeSettings['universal_discovery_widget_module'])) { return; } diff --git a/src/bundle/DependencyInjection/Configuration/Parser/Notifications.php b/src/bundle/DependencyInjection/Configuration/Parser/Notifications.php index 6ee675d0e6..804f491b05 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/Notifications.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/Notifications.php @@ -32,8 +32,11 @@ class Notifications extends AbstractParser /** * {@inheritdoc} */ - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) - { + public function mapConfig( + array &$scopeSettings, + $currentScope, + ContextualizerInterface $contextualizer + ) { if (!empty($scopeSettings['notifications'])) { $settings = $scopeSettings['notifications']; $nodes = ['timeout']; diff --git a/src/bundle/DependencyInjection/Configuration/Parser/Pagination.php b/src/bundle/DependencyInjection/Configuration/Parser/Pagination.php index d038c42bf0..47f37c26f1 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/Pagination.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/Pagination.php @@ -32,7 +32,7 @@ class Pagination extends AbstractParser /** * Adds semantic configuration definition. * - * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system. + * @param NodeBuilder $nodeBuilder Node just under ezpublish.system. */ public function addSemanticConfig(NodeBuilder $nodeBuilder) { @@ -68,8 +68,11 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) /** * {@inheritdoc} */ - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void - { + public function mapConfig( + array &$scopeSettings, + $currentScope, + ContextualizerInterface $contextualizer + ): void { if (empty($scopeSettings['pagination'])) { return; } diff --git a/src/bundle/DependencyInjection/Configuration/Parser/Security.php b/src/bundle/DependencyInjection/Configuration/Parser/Security.php index 83a253cee6..d2772c390b 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/Security.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/Security.php @@ -29,7 +29,7 @@ class Security extends AbstractParser /** * Adds semantic configuration definition. * - * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system. + * @param NodeBuilder $nodeBuilder Node just under ezpublish.system. */ public function addSemanticConfig(NodeBuilder $nodeBuilder) { @@ -48,8 +48,11 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) /** * {@inheritdoc} */ - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void - { + public function mapConfig( + array &$scopeSettings, + $currentScope, + ContextualizerInterface $contextualizer + ): void { if (empty($scopeSettings['security'])) { return; } diff --git a/src/bundle/DependencyInjection/Configuration/Parser/SubtreeOperations.php b/src/bundle/DependencyInjection/Configuration/Parser/SubtreeOperations.php index 066539d54d..f44d6ec38e 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/SubtreeOperations.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/SubtreeOperations.php @@ -27,8 +27,11 @@ */ class SubtreeOperations extends AbstractParser { - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void - { + public function mapConfig( + array &$scopeSettings, + $currentScope, + ContextualizerInterface $contextualizer + ): void { if (!isset($scopeSettings['subtree_operations']['copy_subtree']['limit'])) { return; } diff --git a/src/bundle/DependencyInjection/Configuration/Parser/SubtreePath.php b/src/bundle/DependencyInjection/Configuration/Parser/SubtreePath.php index 880817ca49..23265cd9a1 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/SubtreePath.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/SubtreePath.php @@ -49,8 +49,11 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) ->end(); } - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void - { + public function mapConfig( + array &$scopeSettings, + $currentScope, + ContextualizerInterface $contextualizer + ): void { if (empty($scopeSettings['subtree_paths'])) { return; } diff --git a/src/bundle/DependencyInjection/Configuration/Parser/UserGroupIdentifier.php b/src/bundle/DependencyInjection/Configuration/Parser/UserGroupIdentifier.php index d14be55825..0bb6ef618a 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/UserGroupIdentifier.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/UserGroupIdentifier.php @@ -28,7 +28,7 @@ class UserGroupIdentifier extends AbstractParser /** * Adds semantic configuration definition. * - * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system. + * @param NodeBuilder $nodeBuilder Node just under ezpublish.system. */ public function addSemanticConfig(NodeBuilder $nodeBuilder) { @@ -44,8 +44,11 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) /** * {@inheritdoc} */ - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void - { + public function mapConfig( + array &$scopeSettings, + $currentScope, + ContextualizerInterface $contextualizer + ): void { if (empty($scopeSettings['user_group_content_type_identifier'])) { return; } diff --git a/src/bundle/DependencyInjection/Configuration/Parser/UserProfile.php b/src/bundle/DependencyInjection/Configuration/Parser/UserProfile.php index 60f611cda9..c5aa3c01ec 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/UserProfile.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/UserProfile.php @@ -41,8 +41,11 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder): void * @param array $scopeSettings * @param string $currentScope */ - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void - { + public function mapConfig( + array &$scopeSettings, + $currentScope, + ContextualizerInterface $contextualizer + ): void { if (empty($scopeSettings['user_profile'])) { return; } diff --git a/src/bundle/DependencyInjection/IbexaAdminUiExtension.php b/src/bundle/DependencyInjection/IbexaAdminUiExtension.php index c924dd2541..63b91373a1 100644 --- a/src/bundle/DependencyInjection/IbexaAdminUiExtension.php +++ b/src/bundle/DependencyInjection/IbexaAdminUiExtension.php @@ -49,13 +49,15 @@ class IbexaAdminUiExtension extends Extension implements PrependExtensionInterfa * Loads a specific configuration. * * @param array $configs An array of configuration values - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container A ContainerBuilder instance + * @param ContainerBuilder $container A ContainerBuilder instance * * @throws \InvalidArgumentException When provided tag is not defined in this extension * @throws \Exception */ - public function load(array $configs, ContainerBuilder $container) - { + public function load( + array $configs, + ContainerBuilder $container + ) { $loader = new YamlFileLoader( $container, new FileLocator(__DIR__ . '/../Resources/config') diff --git a/src/bundle/IbexaAdminUiBundle.php b/src/bundle/IbexaAdminUiBundle.php index beff75700c..40b3eb1fa0 100644 --- a/src/bundle/IbexaAdminUiBundle.php +++ b/src/bundle/IbexaAdminUiBundle.php @@ -14,7 +14,10 @@ use Ibexa\Bundle\AdminUi\DependencyInjection\Compiler\TabPass; use Ibexa\Bundle\AdminUi\DependencyInjection\Compiler\UiConfigProviderPass; use Ibexa\Bundle\AdminUi\DependencyInjection\Configuration\Parser; +use Ibexa\Bundle\Core\DependencyInjection\Configuration\ParserInterface; +use Ibexa\Bundle\Core\DependencyInjection\IbexaCoreExtension; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Exception\LogicException; use Symfony\Component\HttpKernel\Bundle\Bundle; class IbexaAdminUiBundle extends Bundle @@ -24,11 +27,11 @@ class IbexaAdminUiBundle extends Bundle /** * {@inheritdoc} * - * @throws \Symfony\Component\DependencyInjection\Exception\LogicException + * @throws LogicException */ public function build(ContainerBuilder $container) { - /** @var \Ibexa\Bundle\Core\DependencyInjection\IbexaCoreExtension $core */ + /** @var IbexaCoreExtension $core */ $core = $container->getExtension('ibexa'); $configParsers = $this->getConfigParsers(); @@ -40,7 +43,7 @@ public function build(ContainerBuilder $container) } /** - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container + * @param ContainerBuilder $container */ private function addCompilerPasses(ContainerBuilder $container) { @@ -53,7 +56,7 @@ private function addCompilerPasses(ContainerBuilder $container) } /** - * @return \Ibexa\Bundle\Core\DependencyInjection\Configuration\ParserInterface[] + * @return ParserInterface[] */ private function getConfigParsers(): array { diff --git a/src/bundle/ParamConverter/ContentInfoParamConverter.php b/src/bundle/ParamConverter/ContentInfoParamConverter.php index a9800deee8..e0dcf38bfe 100644 --- a/src/bundle/ParamConverter/ContentInfoParamConverter.php +++ b/src/bundle/ParamConverter/ContentInfoParamConverter.php @@ -19,11 +19,11 @@ class ContentInfoParamConverter implements ParamConverterInterface { public const PARAMETER_CONTENT_INFO_ID = 'contentInfoId'; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentTypeService + * @param ContentService $contentTypeService */ public function __construct(ContentService $contentTypeService) { @@ -33,8 +33,10 @@ public function __construct(ContentService $contentTypeService) /** * {@inheritdoc} */ - public function apply(Request $request, ParamConverter $configuration) - { + public function apply( + Request $request, + ParamConverter $configuration + ) { $id = (int)$request->get(self::PARAMETER_CONTENT_INFO_ID); $contentInfo = $this->contentService->loadContentInfo($id); diff --git a/src/bundle/ParamConverter/ContentParamConverter.php b/src/bundle/ParamConverter/ContentParamConverter.php index eedc519ab3..e8d5c5dab5 100644 --- a/src/bundle/ParamConverter/ContentParamConverter.php +++ b/src/bundle/ParamConverter/ContentParamConverter.php @@ -9,6 +9,8 @@ namespace Ibexa\Bundle\AdminUi\ParamConverter; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterInterface; @@ -24,12 +26,12 @@ class ContentParamConverter implements ParamConverterInterface public const PARAMETER_LANGUAGE_CODE = 'languageCode'; /** - * @var \Ibexa\Contracts\Core\Repository\ContentService + * @var ContentService */ private $contentService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @param ContentService $contentService */ public function __construct(ContentService $contentService) { @@ -39,11 +41,13 @@ public function __construct(ContentService $contentService) /** * {@inheritdoc} * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ - public function apply(Request $request, ParamConverter $configuration): bool - { + public function apply( + Request $request, + ParamConverter $configuration + ): bool { $contentId = $request->get(self::PARAMETER_CONTENT_ID); $versionNo = $request->get(self::PARAMETER_VERSION_NO); $languageCode = $request->get(self::PARAMETER_LANGUAGE_CODE); diff --git a/src/bundle/ParamConverter/ContentTypeDraftParamConverter.php b/src/bundle/ParamConverter/ContentTypeDraftParamConverter.php index 4a9f8cee8f..8f1167783d 100644 --- a/src/bundle/ParamConverter/ContentTypeDraftParamConverter.php +++ b/src/bundle/ParamConverter/ContentTypeDraftParamConverter.php @@ -17,7 +17,7 @@ class ContentTypeDraftParamConverter implements ParamConverterInterface { public const PARAMETER_CONTENT_TYPE_ID = 'contentTypeId'; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; public function __construct(ContentTypeService $contentTypeGroupService) @@ -28,8 +28,10 @@ public function __construct(ContentTypeService $contentTypeGroupService) /** * {@inheritdoc} */ - public function apply(Request $request, ParamConverter $configuration) - { + public function apply( + Request $request, + ParamConverter $configuration + ) { if (!$request->get(self::PARAMETER_CONTENT_TYPE_ID)) { return false; } diff --git a/src/bundle/ParamConverter/ContentTypeGroupParamConverter.php b/src/bundle/ParamConverter/ContentTypeGroupParamConverter.php index 300051a231..03a1f26998 100644 --- a/src/bundle/ParamConverter/ContentTypeGroupParamConverter.php +++ b/src/bundle/ParamConverter/ContentTypeGroupParamConverter.php @@ -20,13 +20,13 @@ class ContentTypeGroupParamConverter implements ParamConverterInterface { public const PARAMETER_CONTENT_TYPE_GROUP_ID = 'contentTypeGroupId'; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; /** * ContentTypeGroupParamConverter constructor. * - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService + * @param ContentTypeService $contentTypeService */ public function __construct(ContentTypeService $contentTypeService) { @@ -36,8 +36,10 @@ public function __construct(ContentTypeService $contentTypeService) /** * {@inheritdoc} */ - public function apply(Request $request, ParamConverter $configuration) - { + public function apply( + Request $request, + ParamConverter $configuration + ) { if (!$request->get(self::PARAMETER_CONTENT_TYPE_GROUP_ID)) { return false; } diff --git a/src/bundle/ParamConverter/ContentTypeParamConverter.php b/src/bundle/ParamConverter/ContentTypeParamConverter.php index 927109d2d5..3af0cf5052 100644 --- a/src/bundle/ParamConverter/ContentTypeParamConverter.php +++ b/src/bundle/ParamConverter/ContentTypeParamConverter.php @@ -22,15 +22,15 @@ class ContentTypeParamConverter implements ParamConverterInterface public const PARAMETER_CONTENT_TYPE_ID = 'contentTypeId'; public const PARAMETER_CONTENT_TYPE_IDENTIFIER = 'contentTypeIdentifier'; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ + /** @var UserLanguagePreferenceProviderInterface */ private $languagePreferenceProvider; /** - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeGroupService - * @param \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface $languagePreferenceProvider + * @param ContentTypeService $contentTypeGroupService + * @param UserLanguagePreferenceProviderInterface $languagePreferenceProvider */ public function __construct( ContentTypeService $contentTypeGroupService, @@ -43,8 +43,10 @@ public function __construct( /** * {@inheritdoc} */ - public function apply(Request $request, ParamConverter $configuration) - { + public function apply( + Request $request, + ParamConverter $configuration + ) { if (!$request->get(self::PARAMETER_CONTENT_TYPE_ID) && !$request->get(self::PARAMETER_CONTENT_TYPE_IDENTIFIER)) { return false; } diff --git a/src/bundle/ParamConverter/LanguageParamConverter.php b/src/bundle/ParamConverter/LanguageParamConverter.php index 86c54912db..a1cafa0ac2 100644 --- a/src/bundle/ParamConverter/LanguageParamConverter.php +++ b/src/bundle/ParamConverter/LanguageParamConverter.php @@ -21,11 +21,11 @@ class LanguageParamConverter implements ParamConverterInterface public const PARAMETER_LANGUAGE_ID = 'languageId'; public const PARAMETER_LANGUAGE_CODE = 'languageCode'; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService + * @param LanguageService $languageService */ public function __construct(LanguageService $languageService) { @@ -35,8 +35,10 @@ public function __construct(LanguageService $languageService) /** * {@inheritdoc} */ - public function apply(Request $request, ParamConverter $configuration) - { + public function apply( + Request $request, + ParamConverter $configuration + ) { if (!$request->get(self::PARAMETER_LANGUAGE_ID) && !$request->get(self::PARAMETER_LANGUAGE_CODE)) { return false; } diff --git a/src/bundle/ParamConverter/ObjectStateGroupParamConverter.php b/src/bundle/ParamConverter/ObjectStateGroupParamConverter.php index 1644b24aa8..32ae068a24 100644 --- a/src/bundle/ParamConverter/ObjectStateGroupParamConverter.php +++ b/src/bundle/ParamConverter/ObjectStateGroupParamConverter.php @@ -8,6 +8,7 @@ namespace Ibexa\Bundle\AdminUi\ParamConverter; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\ObjectStateService; use Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; @@ -19,11 +20,11 @@ class ObjectStateGroupParamConverter implements ParamConverterInterface { public const PARAMETER_OBJECT_STATE_GROUP_ID = 'objectStateGroupId'; - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ + /** @var ObjectStateService */ private $objectStateService; /** - * @param \Ibexa\Contracts\Core\Repository\ObjectStateService $objectStateService + * @param ObjectStateService $objectStateService */ public function __construct(ObjectStateService $objectStateService) { @@ -31,15 +32,17 @@ public function __construct(ObjectStateService $objectStateService) } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter $configuration + * @param Request $request + * @param ParamConverter $configuration * * @return bool * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ - public function apply(Request $request, ParamConverter $configuration) - { + public function apply( + Request $request, + ParamConverter $configuration + ) { $id = (int)$request->get(self::PARAMETER_OBJECT_STATE_GROUP_ID); $objectStateGroup = $this->objectStateService->loadObjectStateGroup($id); @@ -53,7 +56,7 @@ public function apply(Request $request, ParamConverter $configuration) } /** - * @param \Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter $configuration + * @param ParamConverter $configuration * * @return bool */ diff --git a/src/bundle/ParamConverter/ObjectStateParamConverter.php b/src/bundle/ParamConverter/ObjectStateParamConverter.php index a7eb55ae68..15cfe403a2 100644 --- a/src/bundle/ParamConverter/ObjectStateParamConverter.php +++ b/src/bundle/ParamConverter/ObjectStateParamConverter.php @@ -8,6 +8,7 @@ namespace Ibexa\Bundle\AdminUi\ParamConverter; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\ObjectStateService; use Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; @@ -19,11 +20,11 @@ class ObjectStateParamConverter implements ParamConverterInterface { public const PARAMETER_OBJECT_STATE_ID = 'objectStateId'; - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ + /** @var ObjectStateService */ private $objectStateService; /** - * @param \Ibexa\Contracts\Core\Repository\ObjectStateService $objectStateService + * @param ObjectStateService $objectStateService */ public function __construct(ObjectStateService $objectStateService) { @@ -31,15 +32,17 @@ public function __construct(ObjectStateService $objectStateService) } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter $configuration + * @param Request $request + * @param ParamConverter $configuration * * @return bool * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ - public function apply(Request $request, ParamConverter $configuration) - { + public function apply( + Request $request, + ParamConverter $configuration + ) { $id = (int)$request->get(self::PARAMETER_OBJECT_STATE_ID); $objectState = $this->objectStateService->loadObjectState($id); @@ -53,7 +56,7 @@ public function apply(Request $request, ParamConverter $configuration) } /** - * @param \Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter $configuration + * @param ParamConverter $configuration * * @return bool */ diff --git a/src/bundle/ParamConverter/PolicyDraftParamConverter.php b/src/bundle/ParamConverter/PolicyDraftParamConverter.php index 43751180ba..9a2f9e6452 100644 --- a/src/bundle/ParamConverter/PolicyDraftParamConverter.php +++ b/src/bundle/ParamConverter/PolicyDraftParamConverter.php @@ -20,13 +20,13 @@ class PolicyDraftParamConverter implements ParamConverterInterface public const PARAMETER_ROLE_ID = 'roleId'; public const PARAMETER_POLICY_ID = 'policyId'; - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ private $roleService; /** * RoleParamConverter constructor. * - * @param \Ibexa\Contracts\Core\Repository\RoleService $roleService + * @param RoleService $roleService */ public function __construct(RoleService $roleService) { @@ -36,8 +36,10 @@ public function __construct(RoleService $roleService) /** * {@inheritdoc} */ - public function apply(Request $request, ParamConverter $configuration) - { + public function apply( + Request $request, + ParamConverter $configuration + ) { if (!$request->get(self::PARAMETER_ROLE_ID) || !$request->get(self::PARAMETER_POLICY_ID)) { return false; } diff --git a/src/bundle/ParamConverter/PolicyParamConverter.php b/src/bundle/ParamConverter/PolicyParamConverter.php index 0442f8aa7d..47009bf3a1 100644 --- a/src/bundle/ParamConverter/PolicyParamConverter.php +++ b/src/bundle/ParamConverter/PolicyParamConverter.php @@ -21,13 +21,13 @@ class PolicyParamConverter implements ParamConverterInterface public const PARAMETER_ROLE_ID = 'roleId'; public const PARAMETER_POLICY_ID = 'policyId'; - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ private $roleService; /** * RoleParamConverter constructor. * - * @param \Ibexa\Contracts\Core\Repository\RoleService $roleService + * @param RoleService $roleService */ public function __construct(RoleService $roleService) { @@ -37,8 +37,10 @@ public function __construct(RoleService $roleService) /** * {@inheritdoc} */ - public function apply(Request $request, ParamConverter $configuration) - { + public function apply( + Request $request, + ParamConverter $configuration + ) { if (!$request->get(self::PARAMETER_ROLE_ID) || !$request->get(self::PARAMETER_POLICY_ID)) { return false; } diff --git a/src/bundle/ParamConverter/RoleAssignmentParamConverter.php b/src/bundle/ParamConverter/RoleAssignmentParamConverter.php index c0b1918604..52bcac7152 100644 --- a/src/bundle/ParamConverter/RoleAssignmentParamConverter.php +++ b/src/bundle/ParamConverter/RoleAssignmentParamConverter.php @@ -19,13 +19,13 @@ class RoleAssignmentParamConverter implements ParamConverterInterface { public const PRAMETER_ROLE_ASSIGNMENT_ID = 'assignmentId'; - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ private $roleService; /** * RoleParamConverter constructor. * - * @param \Ibexa\Contracts\Core\Repository\RoleService $roleService + * @param RoleService $roleService */ public function __construct(RoleService $roleService) { @@ -35,8 +35,10 @@ public function __construct(RoleService $roleService) /** * {@inheritdoc} */ - public function apply(Request $request, ParamConverter $configuration) - { + public function apply( + Request $request, + ParamConverter $configuration + ) { if (!$request->get(self::PRAMETER_ROLE_ASSIGNMENT_ID)) { return false; } diff --git a/src/bundle/ParamConverter/RoleParamConverter.php b/src/bundle/ParamConverter/RoleParamConverter.php index a646986479..3f2caacec0 100644 --- a/src/bundle/ParamConverter/RoleParamConverter.php +++ b/src/bundle/ParamConverter/RoleParamConverter.php @@ -20,13 +20,13 @@ class RoleParamConverter implements ParamConverterInterface { public const PARAMETER_ROLE_ID = 'roleId'; - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ private $roleService; /** * RoleParamConverter constructor. * - * @param \Ibexa\Contracts\Core\Repository\RoleService $roleService + * @param RoleService $roleService */ public function __construct(RoleService $roleService) { @@ -36,8 +36,10 @@ public function __construct(RoleService $roleService) /** * {@inheritdoc} */ - public function apply(Request $request, ParamConverter $configuration) - { + public function apply( + Request $request, + ParamConverter $configuration + ) { if (!$request->get(self::PARAMETER_ROLE_ID)) { return false; } diff --git a/src/bundle/ParamConverter/SectionParamConverter.php b/src/bundle/ParamConverter/SectionParamConverter.php index dcfdd14936..400b67c154 100644 --- a/src/bundle/ParamConverter/SectionParamConverter.php +++ b/src/bundle/ParamConverter/SectionParamConverter.php @@ -21,14 +21,14 @@ class SectionParamConverter implements ParamConverterInterface public const PARAMETER_SECTION_ID = 'sectionId'; /** - * @var \Ibexa\Contracts\Core\Repository\SectionService + * @var SectionService */ private $sectionService; /** * SectionParamConverter constructor. * - * @param \Ibexa\Contracts\Core\Repository\SectionService $sectionService + * @param SectionService $sectionService */ public function __construct(SectionService $sectionService) { @@ -38,8 +38,10 @@ public function __construct(SectionService $sectionService) /** * {@inheritdoc} */ - public function apply(Request $request, ParamConverter $configuration) - { + public function apply( + Request $request, + ParamConverter $configuration + ) { if (!$request->get(self::PARAMETER_SECTION_ID)) { return false; } diff --git a/src/bundle/ParamConverter/TranslationLanguageParamConverter.php b/src/bundle/ParamConverter/TranslationLanguageParamConverter.php index eed060b879..2b02b09ab2 100644 --- a/src/bundle/ParamConverter/TranslationLanguageParamConverter.php +++ b/src/bundle/ParamConverter/TranslationLanguageParamConverter.php @@ -21,11 +21,11 @@ class TranslationLanguageParamConverter implements ParamConverterInterface public const PARAMETER_LANGUAGE_CODE_TO = 'toLanguageCode'; public const PARAMETER_LANGUAGE_CODE_FROM = 'fromLanguageCode'; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService + * @param LanguageService $languageService */ public function __construct(LanguageService $languageService) { @@ -35,8 +35,10 @@ public function __construct(LanguageService $languageService) /** * {@inheritdoc} */ - public function apply(Request $request, ParamConverter $configuration) - { + public function apply( + Request $request, + ParamConverter $configuration + ) { if ($request->get(self::PARAMETER_LANGUAGE_CODE_TO) && 'language' === $configuration->getName()) { $languageCode = $request->get(self::PARAMETER_LANGUAGE_CODE_TO); } elseif ($request->get(self::PARAMETER_LANGUAGE_CODE_FROM) && 'baseLanguage' === $configuration->getName()) { @@ -61,7 +63,7 @@ public function supports(ParamConverter $configuration) /** * @param string $languageCode * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language + * @return Language */ private function getLanguage(string $languageCode): Language { diff --git a/src/bundle/ParamConverter/URLWildcardParamConverter.php b/src/bundle/ParamConverter/URLWildcardParamConverter.php index 5c1db7deaf..4ba16bf56d 100644 --- a/src/bundle/ParamConverter/URLWildcardParamConverter.php +++ b/src/bundle/ParamConverter/URLWildcardParamConverter.php @@ -20,11 +20,11 @@ class URLWildcardParamConverter implements ParamConverterInterface { private const PARAMETER_URL_WILDCARD_ID = 'urlWildcardId'; - /** @var \Ibexa\Contracts\Core\Repository\URLWildcardService */ + /** @var URLWildcardService */ private $urlWildcardService; /** - * @param \Ibexa\Contracts\Core\Repository\URLWildcardService $urlWildcardService + * @param URLWildcardService $urlWildcardService */ public function __construct(URLWildcardService $urlWildcardService) { @@ -34,8 +34,10 @@ public function __construct(URLWildcardService $urlWildcardService) /** * {@inheritdoc} */ - public function apply(Request $request, ParamConverter $configuration): bool - { + public function apply( + Request $request, + ParamConverter $configuration + ): bool { if (empty($request->get(self::PARAMETER_URL_WILDCARD_ID))) { return false; } diff --git a/src/bundle/ParamConverter/VersionInfoParamConverter.php b/src/bundle/ParamConverter/VersionInfoParamConverter.php index 05cb246529..037faef4d5 100644 --- a/src/bundle/ParamConverter/VersionInfoParamConverter.php +++ b/src/bundle/ParamConverter/VersionInfoParamConverter.php @@ -9,6 +9,8 @@ namespace Ibexa\Bundle\AdminUi\ParamConverter; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterInterface; @@ -20,12 +22,12 @@ class VersionInfoParamConverter implements ParamConverterInterface public const PARAMETER_CONTENT_ID = 'contentId'; /** - * @var \Ibexa\Contracts\Core\Repository\ContentService + * @var ContentService */ private $contentService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @param ContentService $contentService */ public function __construct(ContentService $contentService) { @@ -35,11 +37,13 @@ public function __construct(ContentService $contentService) /** * {@inheritdoc} * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ - public function apply(Request $request, ParamConverter $configuration): bool - { + public function apply( + Request $request, + ParamConverter $configuration + ): bool { if (!$request->get(self::PARAMETER_VERSION_NO) || !$request->get(self::PARAMETER_CONTENT_ID)) { return false; } diff --git a/src/bundle/Templating/Twig/ComponentExtension.php b/src/bundle/Templating/Twig/ComponentExtension.php index 22c42301ce..29b9e4f0e2 100644 --- a/src/bundle/Templating/Twig/ComponentExtension.php +++ b/src/bundle/Templating/Twig/ComponentExtension.php @@ -69,13 +69,18 @@ public function getFunctions() ]; } - public function renderComponentGroup(string $group, array $parameters = []) - { + public function renderComponentGroup( + string $group, + array $parameters = [] + ) { return implode('', $this->renderer->renderGroup($group, $parameters)); } - public function renderComponent(string $group, string $id, array $parameters = []) - { + public function renderComponent( + string $group, + string $id, + array $parameters = [] + ) { return $this->renderer->renderSingle($group, $id, $parameters); } } diff --git a/src/bundle/Templating/Twig/FieldEditRenderingExtension.php b/src/bundle/Templating/Twig/FieldEditRenderingExtension.php index f838310502..1110163387 100644 --- a/src/bundle/Templating/Twig/FieldEditRenderingExtension.php +++ b/src/bundle/Templating/Twig/FieldEditRenderingExtension.php @@ -11,13 +11,14 @@ use Ibexa\AdminUi\Form\Data\FieldDefinitionData; use Ibexa\Core\MVC\Symfony\Templating\Exception\MissingFieldBlockException; use Ibexa\Core\MVC\Symfony\Templating\FieldBlockRendererInterface; +use Ibexa\Core\MVC\Symfony\Templating\Twig\FieldBlockRenderer; use Twig\Environment; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; class FieldEditRenderingExtension extends AbstractExtension { - /** @var \Ibexa\Core\MVC\Symfony\Templating\FieldBlockRendererInterface|\Ibexa\Core\MVC\Symfony\Templating\Twig\FieldBlockRenderer */ + /** @var FieldBlockRendererInterface|FieldBlockRenderer */ private $fieldBlockRenderer; public function __construct(FieldBlockRendererInterface $fieldBlockRenderer) @@ -26,11 +27,15 @@ public function __construct(FieldBlockRendererInterface $fieldBlockRenderer) } /** - * @return \Twig\TwigFunction[] + * @return TwigFunction[] */ public function getFunctions(): array { - $fieldDefinitionEditCallable = function (Environment $twig, FieldDefinitionData $fieldDefinitionData, array $params = []) { + $fieldDefinitionEditCallable = function ( + Environment $twig, + FieldDefinitionData $fieldDefinitionData, + array $params = [] + ) { $this->fieldBlockRenderer->setTwig($twig); return $this->renderFieldDefinitionEdit($fieldDefinitionData, $params); @@ -58,8 +63,10 @@ public function getFunctions(): array ]; } - public function renderFieldDefinitionEdit(FieldDefinitionData $fieldDefinitionData, array $params = []): string - { + public function renderFieldDefinitionEdit( + FieldDefinitionData $fieldDefinitionData, + array $params = [] + ): string { $params += ['data' => $fieldDefinitionData]; try { return $this->fieldBlockRenderer->renderFieldDefinitionEdit($fieldDefinitionData->fieldDefinition, $params); diff --git a/src/bundle/Templating/Twig/FieldGroupRenderingExtension.php b/src/bundle/Templating/Twig/FieldGroupRenderingExtension.php index 055a4bf58a..5f08ab0e84 100644 --- a/src/bundle/Templating/Twig/FieldGroupRenderingExtension.php +++ b/src/bundle/Templating/Twig/FieldGroupRenderingExtension.php @@ -14,11 +14,11 @@ final class FieldGroupRenderingExtension extends AbstractExtension { - /** @var \Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList */ + /** @var FieldsGroupsList */ private $fieldsGroupsList; /** - * @param \Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList $fieldsGroupsListHelper + * @param FieldsGroupsList $fieldsGroupsListHelper */ public function __construct(FieldsGroupsList $fieldsGroupsListHelper) { @@ -26,7 +26,7 @@ public function __construct(FieldsGroupsList $fieldsGroupsListHelper) } /** - * @return \Twig\TwigFilter[] + * @return TwigFilter[] */ public function getFilters(): array { diff --git a/src/bundle/Templating/Twig/FormatIntervalExtension.php b/src/bundle/Templating/Twig/FormatIntervalExtension.php index bf3b4e02eb..a50fa7c414 100644 --- a/src/bundle/Templating/Twig/FormatIntervalExtension.php +++ b/src/bundle/Templating/Twig/FormatIntervalExtension.php @@ -26,7 +26,7 @@ class FormatIntervalExtension extends AbstractExtension implements TranslationCo 's' => 'seconds', ]; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct(TranslatorInterface $translator) diff --git a/src/bundle/Templating/Twig/IconPathExtension.php b/src/bundle/Templating/Twig/IconPathExtension.php index e9d32d2396..824547b5ce 100644 --- a/src/bundle/Templating/Twig/IconPathExtension.php +++ b/src/bundle/Templating/Twig/IconPathExtension.php @@ -14,7 +14,7 @@ final class IconPathExtension extends AbstractExtension { - /** @var \Ibexa\Contracts\AdminUi\Resolver\IconPathResolverInterface */ + /** @var IconPathResolverInterface */ private $iconPathResolver; public function __construct(IconPathResolverInterface $iconPathResolver) @@ -44,8 +44,10 @@ public function getFunctions(): array ]; } - public function getIconPath(string $icon, ?string $set = null): string - { + public function getIconPath( + string $icon, + ?string $set = null + ): string { return $this->iconPathResolver->resolve($icon, $set); } } diff --git a/src/bundle/Templating/Twig/LimitationValueRenderingExtension.php b/src/bundle/Templating/Twig/LimitationValueRenderingExtension.php index 82f33c504d..83e6addb6b 100644 --- a/src/bundle/Templating/Twig/LimitationValueRenderingExtension.php +++ b/src/bundle/Templating/Twig/LimitationValueRenderingExtension.php @@ -8,6 +8,7 @@ namespace Ibexa\Bundle\AdminUi\Templating\Twig; +use Ibexa\AdminUi\Limitation\Templating\LimitationBlockRenderer; use Ibexa\AdminUi\Limitation\Templating\LimitationBlockRendererInterface; use Ibexa\Contracts\Core\Repository\Values\User\Limitation; use Twig\Environment; @@ -16,7 +17,7 @@ class LimitationValueRenderingExtension extends AbstractExtension { - /** @var \Ibexa\AdminUi\Limitation\Templating\LimitationBlockRenderer */ + /** @var LimitationBlockRenderer */ private $limitationRenderer; public function __construct(LimitationBlockRendererInterface $limitationRenderer) @@ -25,11 +26,15 @@ public function __construct(LimitationBlockRendererInterface $limitationRenderer } /** - * @return \Twig\TwigFunction[] + * @return TwigFunction[] */ public function getFunctions(): array { - $limitationValueCallable = function (Environment $twig, Limitation $limitation, array $params = []) { + $limitationValueCallable = function ( + Environment $twig, + Limitation $limitation, + array $params = [] + ) { return $this->limitationRenderer->renderLimitationValue($limitation, $params); }; diff --git a/src/bundle/Templating/Twig/PathStringExtension.php b/src/bundle/Templating/Twig/PathStringExtension.php index 3ea8dc02b4..60b189c993 100644 --- a/src/bundle/Templating/Twig/PathStringExtension.php +++ b/src/bundle/Templating/Twig/PathStringExtension.php @@ -9,6 +9,7 @@ namespace Ibexa\Bundle\AdminUi\Templating\Twig; use Ibexa\Contracts\Core\Repository\LocationService; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; @@ -44,7 +45,7 @@ public function getFunctions(): array } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location[] + * @return Location[] */ public function getLocationList(string $pathString): array { diff --git a/src/bundle/Templating/Twig/TimeDiffExtension.php b/src/bundle/Templating/Twig/TimeDiffExtension.php index 0a888f0ace..2592779fff 100644 --- a/src/bundle/Templating/Twig/TimeDiffExtension.php +++ b/src/bundle/Templating/Twig/TimeDiffExtension.php @@ -16,7 +16,7 @@ class TimeDiffExtension extends AbstractExtension { - /** @var \Ibexa\AdminUi\UI\Service\DateTimeFormatter */ + /** @var DateTimeFormatter */ private $dateTimeFormatter; public function __construct(DateTimeFormatter $dateTimeFormatter) @@ -44,8 +44,10 @@ public function getFilters() ]; } - public function diff(DateTimeInterface $from, ?DateTimeInterface $to = null): string - { + public function diff( + DateTimeInterface $from, + ?DateTimeInterface $to = null + ): string { return $this->dateTimeFormatter->formatDiff($from, $to ?? new DateTime()); } } diff --git a/src/bundle/Templating/Twig/UiConfigExtension.php b/src/bundle/Templating/Twig/UiConfigExtension.php index a9bca3ca17..50977c55fc 100644 --- a/src/bundle/Templating/Twig/UiConfigExtension.php +++ b/src/bundle/Templating/Twig/UiConfigExtension.php @@ -21,18 +21,20 @@ */ class UiConfigExtension extends AbstractExtension implements GlobalsInterface { - /** @var \Twig\Environment */ + /** @var Environment */ protected $twig; - /** @var \Ibexa\AdminUi\UI\Config\Aggregator */ + /** @var Aggregator */ protected $aggregator; /** - * @param \Twig\Environment $twig - * @param \Ibexa\AdminUi\UI\Config\Aggregator $aggregator + * @param Environment $twig + * @param Aggregator $aggregator */ - public function __construct(Environment $twig, Aggregator $aggregator) - { + public function __construct( + Environment $twig, + Aggregator $aggregator + ) { $this->twig = $twig; $this->aggregator = $aggregator; } @@ -54,12 +56,18 @@ public function getGlobals(): array /** * Create lazy loaded configuration. * - * @return \Ibexa\AdminUi\UI\Config\ConfigWrapper + * @return ConfigWrapper */ private function createConfigWrapper(): ConfigWrapper { $factory = new LazyLoadingValueHolderFactory(); - $initializer = function (&$wrappedObject, LazyLoadingInterface $proxy, $method, array $parameters, &$initializer) { + $initializer = function ( + &$wrappedObject, + LazyLoadingInterface $proxy, + $method, + array $parameters, + &$initializer + ) { $initializer = null; $wrappedObject = new ConfigWrapper($this->aggregator->getConfig()); diff --git a/src/bundle/Templating/Twig/UniversalDiscoveryExtension.php b/src/bundle/Templating/Twig/UniversalDiscoveryExtension.php index defa126dd2..c6a2f4fc14 100644 --- a/src/bundle/Templating/Twig/UniversalDiscoveryExtension.php +++ b/src/bundle/Templating/Twig/UniversalDiscoveryExtension.php @@ -14,11 +14,11 @@ class UniversalDiscoveryExtension extends AbstractExtension { - /** @var \Ibexa\AdminUi\UniversalDiscovery\ConfigResolver */ + /** @var ConfigResolver */ protected $udwConfigResolver; /** - * @param \Ibexa\AdminUi\UniversalDiscovery\ConfigResolver $udwConfigResolver + * @param ConfigResolver $udwConfigResolver */ public function __construct( ConfigResolver $udwConfigResolver @@ -55,8 +55,10 @@ public function getFunctions() * * @return string */ - public function renderUniversalDiscoveryWidgetConfig(string $configName, array $context = []): string - { + public function renderUniversalDiscoveryWidgetConfig( + string $configName, + array $context = [] + ): string { $config = $this->udwConfigResolver->getConfig($configName, $context); $normalized = $this->recursiveConfigurationArrayNormalize($config); @@ -78,8 +80,10 @@ private function recursiveConfigurationArrayNormalize(array $config): array return $normalized; } - private function toCamelCase(string $input, string $delimiter = '_'): string - { + private function toCamelCase( + string $input, + string $delimiter = '_' + ): string { $words = explode($delimiter, ucwords($input, $delimiter)); return lcfirst(implode('', $words)); diff --git a/src/bundle/Templating/Twig/UserPreferencesGlobalExtension.php b/src/bundle/Templating/Twig/UserPreferencesGlobalExtension.php index 25767e9599..a26e8d6581 100644 --- a/src/bundle/Templating/Twig/UserPreferencesGlobalExtension.php +++ b/src/bundle/Templating/Twig/UserPreferencesGlobalExtension.php @@ -19,11 +19,11 @@ */ class UserPreferencesGlobalExtension extends AbstractExtension implements GlobalsInterface { - /** @var \Ibexa\User\UserSetting\UserSettingArrayAccessor */ + /** @var UserSettingArrayAccessor */ protected $userSettingArrayAccessor; /** - * @param \Ibexa\User\UserSetting\UserSettingArrayAccessor $userSettingArrayAccessor + * @param UserSettingArrayAccessor $userSettingArrayAccessor */ public function __construct( UserSettingArrayAccessor $userSettingArrayAccessor diff --git a/src/bundle/View/EzPagerfantaView.php b/src/bundle/View/EzPagerfantaView.php index a63c5259eb..a4f655f6c0 100644 --- a/src/bundle/View/EzPagerfantaView.php +++ b/src/bundle/View/EzPagerfantaView.php @@ -9,13 +9,14 @@ use Ibexa\Bundle\AdminUi\View\Template\EzPagerfantaTemplate; use Pagerfanta\View\DefaultView; +use Symfony\Contracts\Translation\TranslatorInterface; /** * View to render Pagerfanta pagination. */ class EzPagerfantaView extends DefaultView { - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; protected function createDefaultTemplate() diff --git a/src/bundle/View/Template/EzPagerfantaTemplate.php b/src/bundle/View/Template/EzPagerfantaTemplate.php index 5f3b1b171b..c30814a585 100644 --- a/src/bundle/View/Template/EzPagerfantaTemplate.php +++ b/src/bundle/View/Template/EzPagerfantaTemplate.php @@ -8,6 +8,7 @@ namespace Ibexa\Bundle\AdminUi\View\Template; use Pagerfanta\View\Template\TwitterBootstrap4Template; +use Symfony\Component\Translation\Exception\InvalidArgumentException; use Symfony\Contracts\Translation\TranslatorInterface; /** @@ -16,9 +17,9 @@ class EzPagerfantaTemplate extends TwitterBootstrap4Template { /** - * @param \Symfony\Contracts\Translation\TranslatorInterface $translator + * @param TranslatorInterface $translator * - * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function __construct(TranslatorInterface $translator) { diff --git a/src/contracts/Component/Renderable.php b/src/contracts/Component/Renderable.php index cad59db4b5..15e1ced2d2 100644 --- a/src/contracts/Component/Renderable.php +++ b/src/contracts/Component/Renderable.php @@ -11,11 +11,9 @@ use Ibexa\Contracts\TwigComponents\ComponentInterface; /** - * @deprecated 4.6.19 The {@see \Ibexa\Contracts\AdminUi\Component\Renderable} class is deprecated, will be removed in 6.0. - * Use {@see \Ibexa\Contracts\TwigComponents\ComponentInterface} instead + * @deprecated 4.6.19 The {@see Renderable} class is deprecated, will be removed in 6.0. + * Use {@see ComponentInterface} instead */ -interface Renderable extends ComponentInterface -{ -} +interface Renderable extends ComponentInterface {} class_alias(Renderable::class, 'EzSystems\EzPlatformAdminUi\Component\Renderable'); diff --git a/src/contracts/Component/Renderer/RendererInterface.php b/src/contracts/Component/Renderer/RendererInterface.php index 708f5e0ee5..1e50ea05b4 100644 --- a/src/contracts/Component/Renderer/RendererInterface.php +++ b/src/contracts/Component/Renderer/RendererInterface.php @@ -9,14 +9,21 @@ namespace Ibexa\Contracts\AdminUi\Component\Renderer; /** - * @deprecated 4.6.19 The {@see \Ibexa\Contracts\AdminUi\Component\Renderer\RendererInterface} class is deprecated, will be removed in 6.0. + * @deprecated 4.6.19 The {@see RendererInterface} class is deprecated, will be removed in 6.0. * Use {@see \Ibexa\Contracts\TwigComponents\Renderer\RendererInterface} instead */ interface RendererInterface { - public function renderGroup(string $groupName, array $parameters = []): array; + public function renderGroup( + string $groupName, + array $parameters = [] + ): array; - public function renderSingle(string $name, $groupName, array $parameters = []): string; + public function renderSingle( + string $name, + $groupName, + array $parameters = [] + ): string; } class_alias(RendererInterface::class, 'EzSystems\EzPlatformAdminUi\Component\Renderer\RendererInterface'); diff --git a/src/contracts/ContentType/ContentTypeFieldsByExpressionServiceInterface.php b/src/contracts/ContentType/ContentTypeFieldsByExpressionServiceInterface.php index fdb52b8fc4..2d911726fe 100644 --- a/src/contracts/ContentType/ContentTypeFieldsByExpressionServiceInterface.php +++ b/src/contracts/ContentType/ContentTypeFieldsByExpressionServiceInterface.php @@ -8,19 +8,23 @@ namespace Ibexa\Contracts\AdminUi\ContentType; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition; interface ContentTypeFieldsByExpressionServiceInterface { /** - * @return list<\Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition> + * @return list * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ public function getFieldsFromExpression(string $expression): array; /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ - public function isFieldIncludedInExpression(FieldDefinition $fieldDefinition, string $expression): bool; + public function isFieldIncludedInExpression( + FieldDefinition $fieldDefinition, + string $expression + ): bool; } diff --git a/src/contracts/Controller/Controller.php b/src/contracts/Controller/Controller.php index ae9a2fec65..c987abfbaf 100644 --- a/src/contracts/Controller/Controller.php +++ b/src/contracts/Controller/Controller.php @@ -19,13 +19,15 @@ public function performAccessCheck() } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * @param string $uriFragment * - * @return \Symfony\Component\HttpFoundation\RedirectResponse + * @return RedirectResponse */ - public function redirectToLocation(Location $location, string $uriFragment = ''): RedirectResponse - { + public function redirectToLocation( + Location $location, + string $uriFragment = '' + ): RedirectResponse { return $this->redirectToRoute('ibexa.content.view', [ 'contentId' => $location->contentId, 'locationId' => $location->id, diff --git a/src/contracts/Event/ContentProxyCreateEvent.php b/src/contracts/Event/ContentProxyCreateEvent.php index 2438b17b97..b1a4c62469 100644 --- a/src/contracts/Event/ContentProxyCreateEvent.php +++ b/src/contracts/Event/ContentProxyCreateEvent.php @@ -21,10 +21,10 @@ class ContentProxyCreateEvent extends Event public const OPTION_CONTENT_DRAFT = 'contentDraft'; public const OPTION_IS_ON_THE_FLY = 'isOnTheFly'; - /** @var \Symfony\Component\HttpFoundation\Response|null */ + /** @var Response|null */ private $response; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ + /** @var ContentType */ private $contentType; /** @var string */ @@ -33,7 +33,7 @@ class ContentProxyCreateEvent extends Event /** @var int */ private $parentLocationId; - /** @var \Ibexa\AdminUi\Event\Options */ + /** @var Options */ private $options; public function __construct( diff --git a/src/contracts/Event/ContentProxyTranslateEvent.php b/src/contracts/Event/ContentProxyTranslateEvent.php index df9e93f93d..59008a729e 100644 --- a/src/contracts/Event/ContentProxyTranslateEvent.php +++ b/src/contracts/Event/ContentProxyTranslateEvent.php @@ -17,7 +17,7 @@ */ class ContentProxyTranslateEvent extends Event { - /** @var \Symfony\Component\HttpFoundation\Response|null */ + /** @var Response|null */ private $response; /** @var int */ @@ -29,7 +29,7 @@ class ContentProxyTranslateEvent extends Event /** @var string */ private $toLanguageCode; - /** @var \Ibexa\AdminUi\Event\Options */ + /** @var Options */ private $options; /** @var int|null */ diff --git a/src/contracts/Event/FieldDefinitionMappingEvent.php b/src/contracts/Event/FieldDefinitionMappingEvent.php index 2ce1218b38..b0606bfff3 100644 --- a/src/contracts/Event/FieldDefinitionMappingEvent.php +++ b/src/contracts/Event/FieldDefinitionMappingEvent.php @@ -20,13 +20,13 @@ class FieldDefinitionMappingEvent extends Event */ public const NAME = 'field_definition.mapping'; - /** @var \Ibexa\AdminUi\Form\Data\FieldDefinitionData */ + /** @var FieldDefinitionData */ private $fieldDefinitionData; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null */ + /** @var Language|null */ private $baseLanguage; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null */ + /** @var Language|null */ private $targetLanguage; public function __construct( diff --git a/src/contracts/Event/FormActionEvent.php b/src/contracts/Event/FormActionEvent.php index 009b37c0fe..098c0ec641 100644 --- a/src/contracts/Event/FormActionEvent.php +++ b/src/contracts/Event/FormActionEvent.php @@ -30,7 +30,7 @@ class FormActionEvent extends FormEvent /** * Response to return after form post-processing. Typically a RedirectResponse. * - * @var \Symfony\Component\HttpFoundation\Response|null + * @var Response|null */ private $response; @@ -70,8 +70,10 @@ public function getOptions(): array * * @return mixed */ - public function getOption($optionName, $defaultValue = null) - { + public function getOption( + $optionName, + $defaultValue = null + ) { if (!isset($this->options[$optionName])) { return $defaultValue; } @@ -119,8 +121,10 @@ public function getPayload(string $name) return $this->payloads[$name]; } - public function setPayload(string $name, $payload): void - { + public function setPayload( + string $name, + $payload + ): void { $this->payloads[$name] = $payload; } } diff --git a/src/contracts/Exception/UnresolvedPreviewUrlException.php b/src/contracts/Exception/UnresolvedPreviewUrlException.php index 4599921a03..fff3b060dd 100644 --- a/src/contracts/Exception/UnresolvedPreviewUrlException.php +++ b/src/contracts/Exception/UnresolvedPreviewUrlException.php @@ -11,6 +11,4 @@ use Ibexa\Contracts\Core\Repository\Exceptions\Exception as RepositoryException; use RuntimeException; -final class UnresolvedPreviewUrlException extends RuntimeException implements RepositoryException -{ -} +final class UnresolvedPreviewUrlException extends RuntimeException implements RepositoryException {} diff --git a/src/contracts/Form/ActionDispatcher/ActionDispatcherInterface.php b/src/contracts/Form/ActionDispatcher/ActionDispatcherInterface.php index 8c101a826b..b6914957dc 100644 --- a/src/contracts/Form/ActionDispatcher/ActionDispatcherInterface.php +++ b/src/contracts/Form/ActionDispatcher/ActionDispatcherInterface.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Repository\Values\ValueObject; use Symfony\Component\Form\FormInterface; +use Symfony\Component\HttpFoundation\Response; /** * Form action dispatchers can be used to abstract actions when a complex form is submitted. @@ -22,18 +23,23 @@ interface ActionDispatcherInterface /** * Dispatches the action of a given form. * - * @param \Symfony\Component\Form\FormInterface $form the form that has been submitted - * @param \Ibexa\Contracts\Core\Repository\Values\ValueObject $data Underlying data for the form. Most likely a create or update struct. + * @param FormInterface $form the form that has been submitted + * @param ValueObject $data Underlying data for the form. Most likely a create or update struct. * @param string|null $actionName The form action itself. Typically the form clicked button name, * or null if the default action is used (e.g. when pressing enter). * @param array $options arbitrary hash of options */ - public function dispatchFormAction(FormInterface $form, ValueObject $data, $actionName = null, array $options = []); + public function dispatchFormAction( + FormInterface $form, + ValueObject $data, + $actionName = null, + array $options = [] + ); /** * Returns the generated response, if any. Typically a RedirectResponse. * - * @return \Symfony\Component\HttpFoundation\Response|null + * @return Response|null */ public function getResponse(); } diff --git a/src/contracts/Form/Data/FormMapper/FormDataMapperInterface.php b/src/contracts/Form/Data/FormMapper/FormDataMapperInterface.php index 0d0c302b28..fdc6cd6fa8 100644 --- a/src/contracts/Form/Data/FormMapper/FormDataMapperInterface.php +++ b/src/contracts/Form/Data/FormMapper/FormDataMapperInterface.php @@ -18,12 +18,15 @@ interface FormDataMapperInterface /** * Maps a ValueObject from Ibexa content repository to a data usable as underlying form data (e.g. create/update struct). * - * @param \Ibexa\Contracts\Core\Repository\Values\ValueObject $repositoryValueObject + * @param ValueObject $repositoryValueObject * @param array $params * * @return mixed */ - public function mapToFormData(ValueObject $repositoryValueObject, array $params = []); + public function mapToFormData( + ValueObject $repositoryValueObject, + array $params = [] + ); } class_alias(FormDataMapperInterface::class, 'EzSystems\EzPlatformAdminUi\Form\Data\FormMapper\FormDataMapperInterface'); diff --git a/src/contracts/Form/DataMapper/DataMapperInterface.php b/src/contracts/Form/DataMapper/DataMapperInterface.php index 4fc3a55e2a..f98c9cffb8 100644 --- a/src/contracts/Form/DataMapper/DataMapperInterface.php +++ b/src/contracts/Form/DataMapper/DataMapperInterface.php @@ -17,7 +17,7 @@ interface DataMapperInterface /** * Maps Struct object to Data object. * - * @param \Ibexa\Contracts\Core\Repository\Values\ValueObject $value + * @param ValueObject $value * * @return mixed */ diff --git a/src/contracts/Menu/AbstractActionBuilder.php b/src/contracts/Menu/AbstractActionBuilder.php index 426352569c..a61501faf7 100644 --- a/src/contracts/Menu/AbstractActionBuilder.php +++ b/src/contracts/Menu/AbstractActionBuilder.php @@ -52,8 +52,10 @@ public function __construct( /** * @param array $options */ - protected function createActionItem(string $name, array $options = []): ItemInterface - { + protected function createActionItem( + string $name, + array $options = [] + ): ItemInterface { if (empty($options['extras']['translation_domain'])) { $options['extras']['translation_domain'] = self::TRANSLATION_DOMAIN; } diff --git a/src/contracts/Menu/AbstractBuilder.php b/src/contracts/Menu/AbstractBuilder.php index 4ac69186f3..aead743829 100644 --- a/src/contracts/Menu/AbstractBuilder.php +++ b/src/contracts/Menu/AbstractBuilder.php @@ -18,18 +18,20 @@ */ abstract class AbstractBuilder { - /** @var \Ibexa\Contracts\AdminUi\Menu\MenuItemFactoryInterface */ + /** @var MenuItemFactoryInterface */ protected $factory; - /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ + /** @var EventDispatcherInterface */ protected $eventDispatcher; /** - * @param \Ibexa\Contracts\AdminUi\Menu\MenuItemFactoryInterface $factory - * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher + * @param MenuItemFactoryInterface $factory + * @param EventDispatcherInterface $eventDispatcher */ - public function __construct(MenuItemFactoryInterface $factory, EventDispatcherInterface $eventDispatcher) - { + public function __construct( + MenuItemFactoryInterface $factory, + EventDispatcherInterface $eventDispatcher + ) { $this->factory = $factory; $this->eventDispatcher = $eventDispatcher; } @@ -38,36 +40,42 @@ public function __construct(MenuItemFactoryInterface $factory, EventDispatcherIn * @param string $id * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface */ - protected function createMenuItem(string $id, array $options = []): ItemInterface - { + protected function createMenuItem( + string $id, + array $options = [] + ): ItemInterface { return $this->factory->createItem($id, $options); } /** * @param string $name - * @param \Symfony\Contracts\EventDispatcher\Event $event + * @param Event $event */ - protected function dispatchMenuEvent(string $name, Event $event): void - { + protected function dispatchMenuEvent( + string $name, + Event $event + ): void { $this->eventDispatcher->dispatch($event, $name); } /** - * @param \Knp\Menu\ItemInterface $menu + * @param ItemInterface $menu * - * @return \Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent + * @return ConfigureMenuEvent */ - protected function createConfigureMenuEvent(ItemInterface $menu, array $options = []): ConfigureMenuEvent - { + protected function createConfigureMenuEvent( + ItemInterface $menu, + array $options = [] + ): ConfigureMenuEvent { return new ConfigureMenuEvent($this->factory, $menu, $options); } /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface */ public function build(array $options): ItemInterface { diff --git a/src/contracts/Menu/AbstractFormContextMenuBuilder.php b/src/contracts/Menu/AbstractFormContextMenuBuilder.php index 7e3a1229a8..bdc738e577 100644 --- a/src/contracts/Menu/AbstractFormContextMenuBuilder.php +++ b/src/contracts/Menu/AbstractFormContextMenuBuilder.php @@ -50,7 +50,7 @@ protected function getConfigureEventName(): string */ protected function createStructure(array $options): ItemInterface { - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $menu->addChild( @@ -93,7 +93,7 @@ private function getCancelItemId(): string } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/contracts/Menu/MenuItemFactoryInterface.php b/src/contracts/Menu/MenuItemFactoryInterface.php index fc18c9ea4f..5b8c0e78f5 100644 --- a/src/contracts/Menu/MenuItemFactoryInterface.php +++ b/src/contracts/Menu/MenuItemFactoryInterface.php @@ -17,7 +17,11 @@ interface MenuItemFactoryInterface extends FactoryInterface * * @param array $options * - * @return \Knp\Menu\ItemInterface|null + * @return ItemInterface|null */ - public function createLocationMenuItem(string $name, int $locationId, array $options = []): ?ItemInterface; + public function createLocationMenuItem( + string $name, + int $locationId, + array $options = [] + ): ?ItemInterface; } diff --git a/src/contracts/Notification/TranslatableNotificationHandlerInterface.php b/src/contracts/Notification/TranslatableNotificationHandlerInterface.php index a26d22f0e2..e4d561277b 100644 --- a/src/contracts/Notification/TranslatableNotificationHandlerInterface.php +++ b/src/contracts/Notification/TranslatableNotificationHandlerInterface.php @@ -13,13 +13,33 @@ */ interface TranslatableNotificationHandlerInterface { - public function info(string $message, array $parameters = [], ?string $domain = null, ?string $locale = null): void; + public function info( + string $message, + array $parameters = [], + ?string $domain = null, + ?string $locale = null + ): void; - public function success(string $message, array $parameters = [], ?string $domain = null, ?string $locale = null): void; + public function success( + string $message, + array $parameters = [], + ?string $domain = null, + ?string $locale = null + ): void; - public function warning(string $message, array $parameters = [], ?string $domain = null, ?string $locale = null): void; + public function warning( + string $message, + array $parameters = [], + ?string $domain = null, + ?string $locale = null + ): void; - public function error(string $message, array $parameters = [], ?string $domain = null, ?string $locale = null): void; + public function error( + string $message, + array $parameters = [], + ?string $domain = null, + ?string $locale = null + ): void; } class_alias(TranslatableNotificationHandlerInterface::class, 'EzSystems\EzPlatformAdminUi\Notification\TranslatableNotificationHandlerInterface'); diff --git a/src/contracts/Permission/PermissionCheckerInterface.php b/src/contracts/Permission/PermissionCheckerInterface.php index 6acbdf3377..fe523eb64d 100644 --- a/src/contracts/Permission/PermissionCheckerInterface.php +++ b/src/contracts/Permission/PermissionCheckerInterface.php @@ -7,22 +7,32 @@ namespace Ibexa\Contracts\AdminUi\Permission; +use Ibexa\AdminUi\Permission\LimitationResolverInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\User\LookupLimitationResult; interface PermissionCheckerInterface { - public function getRestrictions(array $hasAccess, string $class): array; + public function getRestrictions( + array $hasAccess, + string $class + ): array; /** * @param array|bool $hasAccess */ - public function canCreateInLocation(Location $location, $hasAccess): bool; + public function canCreateInLocation( + Location $location, + $hasAccess + ): bool; /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws BadStateException + * @throws InvalidArgumentException + * @throws NotFoundException * * @internal * @@ -32,14 +42,14 @@ public function canCreateInLocation(Location $location, $hasAccess): bool; public function getContentCreateLimitations(Location $parentLocation): LookupLimitationResult; /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws BadStateException + * @throws InvalidArgumentException + * @throws NotFoundException * * @internal * * @deprecated 4.6.0 The "\Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface::getContentUpdateLimitations()" method is deprecated, will be removed in 5.0. - * Use { @see \Ibexa\AdminUi\Permission\LimitationResolverInterface::getContentUpdateLimitations } instead. + * Use { @see LimitationResolverInterface::getContentUpdateLimitations } instead. */ public function getContentUpdateLimitations(Location $location): LookupLimitationResult; } diff --git a/src/contracts/REST/ApplicationConfigRestGeneratorInterface.php b/src/contracts/REST/ApplicationConfigRestGeneratorInterface.php index eedeb7dca9..92857e2e7c 100644 --- a/src/contracts/REST/ApplicationConfigRestGeneratorInterface.php +++ b/src/contracts/REST/ApplicationConfigRestGeneratorInterface.php @@ -20,5 +20,9 @@ public function supportsParameter(string $parameterName): bool; /** * @param mixed $parameter */ - public function generate($parameter, Generator $generator, Visitor $visitor): void; + public function generate( + $parameter, + Generator $generator, + Visitor $visitor + ): void; } diff --git a/src/contracts/REST/ApplicationConfigRestGeneratorRegistryInterface.php b/src/contracts/REST/ApplicationConfigRestGeneratorRegistryInterface.php index c4537830b8..7f4c43403b 100644 --- a/src/contracts/REST/ApplicationConfigRestGeneratorRegistryInterface.php +++ b/src/contracts/REST/ApplicationConfigRestGeneratorRegistryInterface.php @@ -10,14 +10,20 @@ interface ApplicationConfigRestGeneratorRegistryInterface { - public function hasGenerator(string $namespace, string $parameter): bool; + public function hasGenerator( + string $namespace, + string $parameter + ): bool; public function hasGenerators(string $namespace): bool; - public function getGenerator(string $namespace, string $parameter): ApplicationConfigRestGeneratorInterface; + public function getGenerator( + string $namespace, + string $parameter + ): ApplicationConfigRestGeneratorInterface; /** - * @return iterable<\Ibexa\Contracts\AdminUi\REST\ApplicationConfigRestGeneratorInterface> + * @return iterable */ public function getGenerators(string $namespace): iterable; } diff --git a/src/contracts/REST/ApplicationConfigRestResolverRegistryInterface.php b/src/contracts/REST/ApplicationConfigRestResolverRegistryInterface.php index 53a51817c8..44d873a334 100644 --- a/src/contracts/REST/ApplicationConfigRestResolverRegistryInterface.php +++ b/src/contracts/REST/ApplicationConfigRestResolverRegistryInterface.php @@ -10,14 +10,20 @@ interface ApplicationConfigRestResolverRegistryInterface { - public function hasResolver(string $namespace, string $parameter): bool; + public function hasResolver( + string $namespace, + string $parameter + ): bool; public function hasResolvers(string $namespace): bool; - public function getResolver(string $namespace, string $parameter): ?ApplicationConfigRestResolverInterface; + public function getResolver( + string $namespace, + string $parameter + ): ?ApplicationConfigRestResolverInterface; /** - * @return iterable<\Ibexa\Contracts\AdminUi\REST\ApplicationConfigRestResolverInterface> + * @return iterable */ public function getResolvers(string $namespace): iterable; } diff --git a/src/contracts/Resolver/IconPathResolverInterface.php b/src/contracts/Resolver/IconPathResolverInterface.php index 63bed849ad..2301250bfa 100644 --- a/src/contracts/Resolver/IconPathResolverInterface.php +++ b/src/contracts/Resolver/IconPathResolverInterface.php @@ -10,7 +10,10 @@ interface IconPathResolverInterface { - public function resolve(string $icon, ?string $set = null): string; + public function resolve( + string $icon, + ?string $set = null + ): string; } class_alias(IconPathResolverInterface::class, 'Ibexa\Platform\Assets\Resolver\IconPathResolverInterface'); diff --git a/src/contracts/Tab/AbstractControllerBasedTab.php b/src/contracts/Tab/AbstractControllerBasedTab.php index 1c9ad17ebc..1ecf6bcdda 100644 --- a/src/contracts/Tab/AbstractControllerBasedTab.php +++ b/src/contracts/Tab/AbstractControllerBasedTab.php @@ -18,7 +18,7 @@ */ abstract class AbstractControllerBasedTab extends AbstractTab { - /** @var \Symfony\Bridge\Twig\Extension\HttpKernelRuntime */ + /** @var HttpKernelRuntime */ protected $httpKernelRuntime; public function __construct( diff --git a/src/contracts/Tab/AbstractEventDispatchingTab.php b/src/contracts/Tab/AbstractEventDispatchingTab.php index 09f1bdbd07..5ef4650b93 100644 --- a/src/contracts/Tab/AbstractEventDispatchingTab.php +++ b/src/contracts/Tab/AbstractEventDispatchingTab.php @@ -21,7 +21,7 @@ */ abstract class AbstractEventDispatchingTab extends AbstractTab { - /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ + /** @var EventDispatcherInterface */ protected $eventDispatcher; public function __construct( diff --git a/src/contracts/Tab/AbstractRouteBasedTab.php b/src/contracts/Tab/AbstractRouteBasedTab.php index 961577a4a3..aacedbb16f 100644 --- a/src/contracts/Tab/AbstractRouteBasedTab.php +++ b/src/contracts/Tab/AbstractRouteBasedTab.php @@ -18,10 +18,10 @@ */ abstract class AbstractRouteBasedTab extends AbstractTab { - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ + /** @var UrlGeneratorInterface */ protected $urlGenerator; - /** @var \Symfony\Bridge\Twig\Extension\HttpKernelRuntime */ + /** @var HttpKernelRuntime */ private $httpKernelRuntime; public function __construct( diff --git a/src/contracts/Tab/AbstractTab.php b/src/contracts/Tab/AbstractTab.php index edb71ea566..1d479d1b7e 100644 --- a/src/contracts/Tab/AbstractTab.php +++ b/src/contracts/Tab/AbstractTab.php @@ -17,14 +17,16 @@ */ abstract class AbstractTab implements TabInterface { - /** @var \Twig\Environment */ + /** @var Environment */ protected $twig; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ protected $translator; - public function __construct(Environment $twig, TranslatorInterface $translator) - { + public function __construct( + Environment $twig, + TranslatorInterface $translator + ) { $this->twig = $twig; $this->translator = $translator; } diff --git a/src/contracts/UI/Action/EventDispatcherInterface.php b/src/contracts/UI/Action/EventDispatcherInterface.php index 8b492fc600..10ac420c0c 100644 --- a/src/contracts/UI/Action/EventDispatcherInterface.php +++ b/src/contracts/UI/Action/EventDispatcherInterface.php @@ -13,7 +13,7 @@ interface EventDispatcherInterface public const EVENT_NAME_PREFIX = 'ezplatform.admin_ui.action'; /** - * @param \Ibexa\Contracts\AdminUi\UI\Action\UiActionEventInterface $event + * @param UiActionEventInterface $event */ public function dispatch(UiActionEventInterface $event): void; } diff --git a/src/contracts/UI/Action/FormUiActionMapperInterface.php b/src/contracts/UI/Action/FormUiActionMapperInterface.php index 72e3538ab2..3a0b41f3a1 100644 --- a/src/contracts/UI/Action/FormUiActionMapperInterface.php +++ b/src/contracts/UI/Action/FormUiActionMapperInterface.php @@ -16,16 +16,16 @@ interface FormUiActionMapperInterface /** * Maps $form object to UiActionEvent object. * - * @param \Symfony\Component\Form\FormInterface $form + * @param FormInterface $form * - * @return \Ibexa\AdminUi\UI\Action\UiActionEvent + * @return UiActionEvent */ public function map(FormInterface $form): UiActionEvent; /** * Returns true if FormUiActionMapper is able to create Event from the $form;. * - * @param \Symfony\Component\Form\FormInterface $form + * @param FormInterface $form * * @return bool */ diff --git a/src/contracts/UI/Action/UiActionEventInterface.php b/src/contracts/UI/Action/UiActionEventInterface.php index aeffea6c60..f898e81390 100644 --- a/src/contracts/UI/Action/UiActionEventInterface.php +++ b/src/contracts/UI/Action/UiActionEventInterface.php @@ -37,22 +37,22 @@ public function getType(): string; public function setType(string $type): void; /** - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface */ public function getForm(): FormInterface; /** - * @param \Symfony\Component\Form\FormInterface $form + * @param FormInterface $form */ public function setForm(FormInterface $form): void; /** - * @return \Symfony\Component\HttpFoundation\Response|null + * @return Response|null */ public function getResponse(): ?Response; /** - * @param \Symfony\Component\HttpFoundation\Response|null $response + * @param Response|null $response */ public function setResponse(?Response $response): void; } diff --git a/src/contracts/UniversalDiscovery/Provider.php b/src/contracts/UniversalDiscovery/Provider.php index f0582c6dc2..1cdb4fca85 100644 --- a/src/contracts/UniversalDiscovery/Provider.php +++ b/src/contracts/UniversalDiscovery/Provider.php @@ -68,7 +68,10 @@ public function getLocations(array $locationIds): array; */ public function getRestFormat($valueObject): array; - public function getSortClause(string $sortClauseName, string $sortOrder): Query\SortClause; + public function getSortClause( + string $sortClauseName, + string $sortOrder + ): Query\SortClause; } class_alias(Provider::class, 'EzSystems\EzPlatformAdminUi\UniversalDiscovery\Provider'); diff --git a/src/lib/Behat/BrowserContext/AdminUpdateContext.php b/src/lib/Behat/BrowserContext/AdminUpdateContext.php index a251a19b9c..dcd3c6fd8b 100644 --- a/src/lib/Behat/BrowserContext/AdminUpdateContext.php +++ b/src/lib/Behat/BrowserContext/AdminUpdateContext.php @@ -14,7 +14,7 @@ class AdminUpdateContext implements Context { - /** @var \Ibexa\AdminUi\Behat\Page\AdminUpdateItemPage */ + /** @var AdminUpdateItemPage */ private $adminUpdateItemPage; public function __construct(AdminUpdateItemPage $adminUpdateItemPage) diff --git a/src/lib/Behat/BrowserContext/BookmarkContext.php b/src/lib/Behat/BrowserContext/BookmarkContext.php index ce1f448203..c85f7f0090 100644 --- a/src/lib/Behat/BrowserContext/BookmarkContext.php +++ b/src/lib/Behat/BrowserContext/BookmarkContext.php @@ -14,14 +14,16 @@ class BookmarkContext implements Context { - /** @var \Ibexa\AdminUi\Behat\Page\ContentViewPage */ + /** @var ContentViewPage */ private $contentViewPage; - /** @var \Ibexa\AdminUi\Behat\Page\BookmarksPage */ + /** @var BookmarksPage */ private $bookmarksPage; - public function __construct(ContentViewPage $contentViewPage, BookmarksPage $bookmarksPage) - { + public function __construct( + ContentViewPage $contentViewPage, + BookmarksPage $bookmarksPage + ) { $this->contentViewPage = $contentViewPage; $this->bookmarksPage = $bookmarksPage; } diff --git a/src/lib/Behat/BrowserContext/ContentActionsMenuContext.php b/src/lib/Behat/BrowserContext/ContentActionsMenuContext.php index bc46b00ceb..869830ead8 100644 --- a/src/lib/Behat/BrowserContext/ContentActionsMenuContext.php +++ b/src/lib/Behat/BrowserContext/ContentActionsMenuContext.php @@ -15,7 +15,7 @@ class ContentActionsMenuContext implements Context { - /** @var \Ibexa\AdminUi\Behat\Component\ContentActionsMenu */ + /** @var ContentActionsMenu */ private $contentActionsMenu; public function __construct(ContentActionsMenu $contentActionsMenu) @@ -28,8 +28,10 @@ public function __construct(ContentActionsMenu $contentActionsMenu) * @Given I perform the :buttonName action * @Given I perform the :buttonName action from the :groupName group */ - public function clickEditActionBar(string $buttonName, ?string $groupName = null): void - { + public function clickEditActionBar( + string $buttonName, + ?string $groupName = null + ): void { $this->contentActionsMenu->clickButton($buttonName, $groupName); } diff --git a/src/lib/Behat/BrowserContext/ContentPreviewContext.php b/src/lib/Behat/BrowserContext/ContentPreviewContext.php index c6d9d3e142..058bd27b2e 100644 --- a/src/lib/Behat/BrowserContext/ContentPreviewContext.php +++ b/src/lib/Behat/BrowserContext/ContentPreviewContext.php @@ -13,7 +13,7 @@ class ContentPreviewContext implements Context { - /** @var \Ibexa\AdminUi\Behat\Page\ContentPreviewPage */ + /** @var ContentPreviewPage */ private $contentPreviewPage; public function __construct(ContentPreviewPage $contentPreviewPage) diff --git a/src/lib/Behat/BrowserContext/ContentTypeContext.php b/src/lib/Behat/BrowserContext/ContentTypeContext.php index 768355e999..b89dc4dccd 100644 --- a/src/lib/Behat/BrowserContext/ContentTypeContext.php +++ b/src/lib/Behat/BrowserContext/ContentTypeContext.php @@ -18,16 +18,16 @@ class ContentTypeContext implements Context { - /** @var \Ibexa\AdminUi\Behat\Page\ContentTypePage */ + /** @var ContentTypePage */ private $contentTypePage; - /** @var \Ibexa\AdminUi\Behat\Page\ContentTypeUpdatePage */ + /** @var ContentTypeUpdatePage */ private $contentTypeUpdatePage; - /** @var \Ibexa\AdminUi\Behat\Page\ContentTypeGroupPage */ + /** @var ContentTypeGroupPage */ private $contentTypeGroupPage; - /** @var \Ibexa\AdminUi\Behat\Page\ContentTypeGroupsPage */ + /** @var ContentTypeGroupsPage */ private $contentTypeGroupsPage; public function __construct( @@ -133,8 +133,11 @@ public function iAddField(string $fieldName): void /** * @When I set :field to :value for :fieldName field */ - public function iSetFieldDefinitionData(string $label, string $value, string $fieldName): void - { + public function iSetFieldDefinitionData( + string $label, + string $value, + string $fieldName + ): void { $this->contentTypeUpdatePage->fillFieldDefinitionFieldWithValue($fieldName, $label, $value); } diff --git a/src/lib/Behat/BrowserContext/ContentUpdateContext.php b/src/lib/Behat/BrowserContext/ContentUpdateContext.php index 28d7221512..a4e050ac07 100644 --- a/src/lib/Behat/BrowserContext/ContentUpdateContext.php +++ b/src/lib/Behat/BrowserContext/ContentUpdateContext.php @@ -17,14 +17,16 @@ class ContentUpdateContext implements Context { - /** @var \Ibexa\AdminUi\Behat\Page\ContentUpdateItemPage */ + /** @var ContentUpdateItemPage */ private $contentUpdateItemPage; - /** @var \Ibexa\AdminUi\Behat\Page\UserUpdatePage */ + /** @var UserUpdatePage */ private $userUpdatePage; - public function __construct(ContentUpdateItemPage $contentUpdateItemPage, UserUpdatePage $userUpdatePage) - { + public function __construct( + ContentUpdateItemPage $contentUpdateItemPage, + UserUpdatePage $userUpdatePage + ) { $this->contentUpdateItemPage = $contentUpdateItemPage; $this->userUpdatePage = $userUpdatePage; } @@ -45,8 +47,10 @@ public function iSetFields(TableNode $table): void /** * @When field :fieldName contains validation error :errorMessage */ - public function fieldContainsValidationError(string $fieldName, string $errorMessage): void - { + public function fieldContainsValidationError( + string $fieldName, + string $errorMessage + ): void { $this->contentUpdateItemPage->verifyValidationMessage($fieldName, $errorMessage); } @@ -82,8 +86,10 @@ public function iSetFieldsForUser(TableNode $table): void /** * @When I select :contentPath from Image Asset Repository for :fieldName field */ - public function selectContentFromIARepository(string $contentPath, string $fieldName): void - { + public function selectContentFromIARepository( + string $contentPath, + string $fieldName + ): void { $this->contentUpdateItemPage->getField($fieldName)->selectFromRepository($contentPath); } diff --git a/src/lib/Behat/BrowserContext/ContentViewContext.php b/src/lib/Behat/BrowserContext/ContentViewContext.php index df5d09b9ea..f70c835f23 100644 --- a/src/lib/Behat/BrowserContext/ContentViewContext.php +++ b/src/lib/Behat/BrowserContext/ContentViewContext.php @@ -19,10 +19,10 @@ final class ContentViewContext implements Context { private $argumentParser; - /** @var \Ibexa\AdminUi\Behat\Page\ContentViewPage */ + /** @var ContentViewPage */ private $contentViewPage; - /** @var \Ibexa\AdminUi\Behat\Component\DraftConflictDialog */ + /** @var DraftConflictDialog */ private $draftConflictDialog; public function __construct( @@ -39,8 +39,10 @@ public function __construct( * @Given I start creating a new Content :contentType * @Given I start creating a new Content :contentType in :language language */ - public function startCreatingContent(string $contentType, ?string $language = null): void - { + public function startCreatingContent( + string $contentType, + ?string $language = null + ): void { $this->contentViewPage->startCreatingContent($contentType, $language); } @@ -81,8 +83,10 @@ public function iAddNewLocation(string $newLocationPath): void * @Given I add new translation :language without base translation * @Given I add new translation :language basing on :base translation */ - public function iAddNewTranslation(string $language, string $base = 'none'): void - { + public function iAddNewTranslation( + string $language, + string $base = 'none' + ): void { $this->contentViewPage->addTranslation($language, $base); } @@ -115,8 +119,10 @@ public function startEditingContent(?string $language = null): void /** * @Then there's a :itemName :itemType on Subitems list */ - public function verifyThereIsItemInSubItemList(string $itemName, string $itemType): void - { + public function verifyThereIsItemInSubItemList( + string $itemName, + string $itemType + ): void { $this->contentViewPage->verifyIsLoaded(); Assert::assertTrue($this->contentViewPage->isChildElementPresent(['Name' => $itemName, 'Content type' => $itemType])); } @@ -124,8 +130,10 @@ public function verifyThereIsItemInSubItemList(string $itemName, string $itemTyp /** * @Then there's no :itemName :itemType on Subitems list */ - public function verifyThereIsNoItemInSubItemListInRoot(string $itemName, string $itemType): void - { + public function verifyThereIsNoItemInSubItemListInRoot( + string $itemName, + string $itemType + ): void { $this->contentViewPage->verifyIsLoaded(); Assert::assertFalse($this->contentViewPage->isChildElementPresent(['Name' => $itemName, 'Content type' => $itemType])); } @@ -181,8 +189,11 @@ public function iShouldSeeAlertAppears(string $alertMessage): void /** * @When I create a new Url Alias called :path in :languageName language with redirect value set to :redirect */ - public function iCreateNewUrlAlias(string $path, string $languageName, string $redirect_string): void - { + public function iCreateNewUrlAlias( + string $path, + string $languageName, + string $redirect_string + ): void { $redirect = filter_var($redirect_string, FILTER_VALIDATE_BOOLEAN); $this->contentViewPage->createNewUrlAlias($path, $languageName, $redirect); } @@ -190,8 +201,10 @@ public function iCreateNewUrlAlias(string $path, string $languageName, string $r /** * @Then there should be a :path Url Alias on the list with :type type */ - public function verifyUrlAliasExists(string $path, string $type): void - { + public function verifyUrlAliasExists( + string $path, + string $type + ): void { Assert::assertTrue( $this->contentViewPage->isUrlAliasOnTheList($path, $type), sprintf('Url alias "%s" with type "%s" not found', $path, $type) diff --git a/src/lib/Behat/BrowserContext/DashboardContext.php b/src/lib/Behat/BrowserContext/DashboardContext.php index 68c2040207..6fe53c8633 100644 --- a/src/lib/Behat/BrowserContext/DashboardContext.php +++ b/src/lib/Behat/BrowserContext/DashboardContext.php @@ -16,17 +16,20 @@ class DashboardContext implements Context { - /** @var \Ibexa\AdminUi\Behat\Component\UpperMenu */ + /** @var UpperMenu */ private $upperMenu; - /** @var \Ibexa\AdminUi\Behat\Page\DashboardPage */ + /** @var DashboardPage */ private $dashboardPage; - /** @var \Ibexa\AdminUi\Behat\Page\ContentUpdateItemPage */ + /** @var ContentUpdateItemPage */ private $contentUpdateItemPage; - public function __construct(UpperMenu $upperMenu, DashboardPage $dashboardPage, ContentUpdateItemPage $contentUpdateItemPage) - { + public function __construct( + UpperMenu $upperMenu, + DashboardPage $dashboardPage, + ContentUpdateItemPage $contentUpdateItemPage + ) { $this->upperMenu = $upperMenu; $this->dashboardPage = $dashboardPage; $this->contentUpdateItemPage = $contentUpdateItemPage; diff --git a/src/lib/Behat/BrowserContext/LanguageContext.php b/src/lib/Behat/BrowserContext/LanguageContext.php index 8d499e6da7..e9df734c5d 100644 --- a/src/lib/Behat/BrowserContext/LanguageContext.php +++ b/src/lib/Behat/BrowserContext/LanguageContext.php @@ -16,14 +16,16 @@ class LanguageContext implements Context { - /** @var \Ibexa\AdminUi\Behat\Page\LanguagesPage */ + /** @var LanguagesPage */ private $languagesPage; - /** @var \Ibexa\AdminUi\Behat\Page\LanguagePage */ + /** @var LanguagePage */ private $languagePage; - public function __construct(LanguagePage $languagePage, LanguagesPage $languagesPage) - { + public function __construct( + LanguagePage $languagePage, + LanguagesPage $languagesPage + ) { $this->languagePage = $languagePage; $this->languagesPage = $languagesPage; } diff --git a/src/lib/Behat/BrowserContext/NavigationContext.php b/src/lib/Behat/BrowserContext/NavigationContext.php index 70f05ae0b8..23d56ec112 100644 --- a/src/lib/Behat/BrowserContext/NavigationContext.php +++ b/src/lib/Behat/BrowserContext/NavigationContext.php @@ -19,25 +19,25 @@ class NavigationContext implements Context { - /** @var \Ibexa\Behat\Core\Behat\ArgumentParser */ + /** @var ArgumentParser */ private $argumentParser; - /** @var \Ibexa\Behat\Browser\Page\PageRegistry[] */ + /** @var PageRegistry[] */ private $pageRegistry; - /** @var \Ibexa\AdminUi\Behat\Component\UpperMenu */ + /** @var UpperMenu */ private $upperMenu; - /** @var \Ibexa\AdminUi\Behat\Component\LeftMenu */ + /** @var LeftMenu */ private $leftMenu; - /** @var \Ibexa\AdminUi\Behat\Component\Breadcrumb */ + /** @var Breadcrumb */ private $breadcrumb; - /** @var \Ibexa\AdminUi\Behat\Page\ContentViewPage */ + /** @var ContentViewPage */ private $contentViewPage; - /** @var \Ibexa\AdminUi\Behat\Page\ContentUpdateItemPage */ + /** @var ContentUpdateItemPage */ private $contentUpdateItemPage; public function __construct( @@ -112,8 +112,10 @@ public function iGoToTab(string $tabName): void /** * @Then I go to :subTab in :tab tab */ - public function iGoToSubTab(string $tab, string $subTab): void - { + public function iGoToSubTab( + string $tab, + string $subTab + ): void { $this->leftMenu->goToSubTab($tab, $subTab); } @@ -137,8 +139,11 @@ public function iClickOnBreadcrumbLink(string $element): void /** * @Given I navigate to content :contentName of type :contentType in :path */ - public function iNavigateToContent(string $contentName, string $contentType, ?string $path = null) - { + public function iNavigateToContent( + string $contentName, + string $contentType, + ?string $path = null + ) { $expectedContentPath = sprintf('%s/%s', $path, $contentName); $pathParts = explode('/', $expectedContentPath); if ('root' === $pathParts[0]) { diff --git a/src/lib/Behat/BrowserContext/NotificationContext.php b/src/lib/Behat/BrowserContext/NotificationContext.php index 48de5c041b..9061fe7ef7 100644 --- a/src/lib/Behat/BrowserContext/NotificationContext.php +++ b/src/lib/Behat/BrowserContext/NotificationContext.php @@ -16,14 +16,16 @@ /** Context for actions on notifications */ class NotificationContext implements Context { - /** @var \Ibexa\AdminUi\Behat\Component\Notification */ + /** @var Notification */ private $notification; - /** @var \Ibexa\Behat\Core\Behat\ArgumentParser */ + /** @var ArgumentParser */ private $argumentParser; - public function __construct(Notification $notification, ArgumentParser $argumentParser) - { + public function __construct( + Notification $notification, + ArgumentParser $argumentParser + ) { $this->notification = $notification; $this->argumentParser = $argumentParser; } @@ -31,8 +33,11 @@ public function __construct(Notification $notification, ArgumentParser $argument /** * @Then notification that :itemType :itemName is :action appears */ - public function notificationAppears(string $itemType, string $itemName, string $action): void - { + public function notificationAppears( + string $itemType, + string $itemName, + string $action + ): void { $expectedMessage = sprintf('%s \'%s\' %s.', $itemType, $itemName, $action); $this->notification->verifyIsLoaded(); diff --git a/src/lib/Behat/BrowserContext/ObjectStatesContext.php b/src/lib/Behat/BrowserContext/ObjectStatesContext.php index 452e304d1b..94e682eafd 100644 --- a/src/lib/Behat/BrowserContext/ObjectStatesContext.php +++ b/src/lib/Behat/BrowserContext/ObjectStatesContext.php @@ -17,13 +17,13 @@ class ObjectStatesContext implements Context { - /** @var \Ibexa\AdminUi\Behat\Page\ObjectStateGroupPage */ + /** @var ObjectStateGroupPage */ private $objectStateGroupPage; - /** @var \Ibexa\AdminUi\Behat\Page\ObjectStateGroupsPage */ + /** @var ObjectStateGroupsPage */ private $objectStateGroupsPage; - /** @var \Ibexa\AdminUi\Behat\Page\ObjectStatePage */ + /** @var ObjectStatePage */ private $objectStatePage; public function __construct( @@ -134,8 +134,10 @@ public function editObjectStateGroup() /** * @Then there's no :objectStateName Object State on Object States list for :objectStateGroupName */ - public function thereIsNoObjectStateOnTheList(string $objectStateName, string $objectStateGroupName): void - { + public function thereIsNoObjectStateOnTheList( + string $objectStateName, + string $objectStateGroupName + ): void { $this->objectStateGroupPage->setExpectedObjectStateGroupName($objectStateGroupName); $this->objectStateGroupPage->verifyIsLoaded(); @@ -147,8 +149,10 @@ public function thereIsNoObjectStateOnTheList(string $objectStateName, string $o /** * @Then there's a :objectStateName Object State on Object States list for :objectStateGroupName */ - public function thereIsObjectStateOnTheList(string $objectStateName, string $objectStateGroupName): void - { + public function thereIsObjectStateOnTheList( + string $objectStateName, + string $objectStateGroupName + ): void { $this->objectStateGroupPage->setExpectedObjectStateGroupName($objectStateGroupName); $this->objectStateGroupPage->verifyIsLoaded(); diff --git a/src/lib/Behat/BrowserContext/RolesContext.php b/src/lib/Behat/BrowserContext/RolesContext.php index e8b81bc8bf..4617d92bd8 100644 --- a/src/lib/Behat/BrowserContext/RolesContext.php +++ b/src/lib/Behat/BrowserContext/RolesContext.php @@ -17,13 +17,13 @@ class RolesContext implements Context { - /** @var \Ibexa\AdminUi\Behat\Page\RolesPage */ + /** @var RolesPage */ private $rolesPage; - /** @var \Ibexa\AdminUi\Behat\Page\RolePage */ + /** @var RolePage */ private $rolePage; - /** @var \Ibexa\AdminUi\Behat\Page\RoleUpdatePage */ + /** @var RoleUpdatePage */ private $roleUpdatePage; public function __construct( @@ -47,8 +47,10 @@ public function iStartAssigningUsersToRole(): void /** * @When I delete assignment from :roleName role */ - public function iDeleteAssignmentsFromRole(string $roleName, TableNode $items): void - { + public function iDeleteAssignmentsFromRole( + string $roleName, + TableNode $items + ): void { $itemNames = array_column($items->getHash(), 'item'); $this->rolePage->setExpectedRoleName($roleName); @@ -58,8 +60,10 @@ public function iDeleteAssignmentsFromRole(string $roleName, TableNode $items): /** * @When I delete policy from :roleName role */ - public function iDeleteAPolicyFromRole(string $roleName, TableNode $items): void - { + public function iDeleteAPolicyFromRole( + string $roleName, + TableNode $items + ): void { $itemNames = array_column($items->getHash(), 'item'); $this->rolePage->setExpectedRoleName($roleName); @@ -69,8 +73,11 @@ public function iDeleteAPolicyFromRole(string $roleName, TableNode $items): void /** * @Then there is a policy :moduleAndFunction with :limitation limitation on the :roleName policies list */ - public function thereIsAPolicy(string $moduleAndFunction, string $limitation, string $roleName): void - { + public function thereIsAPolicy( + string $moduleAndFunction, + string $limitation, + string $roleName + ): void { $this->rolePage->setExpectedRoleName($roleName); Assert::assertTrue($this->rolePage->isRoleWithLimitationPresent($moduleAndFunction, $limitation)); } @@ -78,8 +85,11 @@ public function thereIsAPolicy(string $moduleAndFunction, string $limitation, st /** * @Then there is no policy :moduleAndFunction with :limitation limitation on the :roleName policies list */ - public function thereIsNoPolicy(string $moduleAndFunction, string $limitation, string $roleName): void - { + public function thereIsNoPolicy( + string $moduleAndFunction, + string $limitation, + string $roleName + ): void { $this->rolePage->setExpectedRoleName($roleName); Assert::assertFalse($this->rolePage->isRoleWithLimitationPresent($moduleAndFunction, $limitation)); } @@ -87,8 +97,10 @@ public function thereIsNoPolicy(string $moduleAndFunction, string $limitation, s /** * @Then there are policies on the :roleName policies list */ - public function thereArePolicies(string $roleName, TableNode $settings): void - { + public function thereArePolicies( + string $roleName, + TableNode $settings + ): void { $policies = $settings->getHash(); foreach ($policies as $policy) { $this->thereIsAPolicy($policy['policy'], $policy['limitation'], $roleName); @@ -122,8 +134,10 @@ public function iSelectSectionLimitation(string $limitationName): void /** * @When I assign :itemType to role */ - public function iAssignToRole(string $itemType, TableNode $items): void - { + public function iAssignToRole( + string $itemType, + TableNode $items + ): void { $itemPaths = array_column($items->getHash(), 'path'); $this->roleUpdatePage->assign($itemPaths, $itemType); } @@ -131,8 +145,10 @@ public function iAssignToRole(string $itemType, TableNode $items): void /** * @When I select limitation for :selectName */ - public function iSelectOptionsFrom(string $selectName, TableNode $options): void - { + public function iSelectOptionsFrom( + string $selectName, + TableNode $options + ): void { $values = array_column($options->getHash(), 'option'); $this->roleUpdatePage->selectLimitationValues($selectName, $values); } @@ -231,8 +247,10 @@ public function openRolePage(string $roleName) /** * @Then I start editing the policy :policyName :functionName */ - public function editPolicy(string $policyName, string $functionName) - { + public function editPolicy( + string $policyName, + string $functionName + ) { $this->rolePage->editPolicy($policyName, $functionName); } diff --git a/src/lib/Behat/BrowserContext/SearchContext.php b/src/lib/Behat/BrowserContext/SearchContext.php index e380772428..250ba6d423 100644 --- a/src/lib/Behat/BrowserContext/SearchContext.php +++ b/src/lib/Behat/BrowserContext/SearchContext.php @@ -19,8 +19,10 @@ class SearchContext implements Context private UpperMenu $upperMenu; - public function __construct(SearchPage $searchPage, UpperMenu $upperMenu) - { + public function __construct( + SearchPage $searchPage, + UpperMenu $upperMenu + ) { $this->searchPage = $searchPage; $this->upperMenu = $upperMenu; } diff --git a/src/lib/Behat/BrowserContext/SectionsContext.php b/src/lib/Behat/BrowserContext/SectionsContext.php index a2db22c444..3945a5bd36 100644 --- a/src/lib/Behat/BrowserContext/SectionsContext.php +++ b/src/lib/Behat/BrowserContext/SectionsContext.php @@ -16,14 +16,16 @@ class SectionsContext implements Context { - /** @var \Ibexa\AdminUi\Behat\Page\SectionPage */ + /** @var SectionPage */ private $sectionPage; - /** @var \Ibexa\AdminUi\Behat\Page\SectionsPage */ + /** @var SectionsPage */ private $sectionsPage; - public function __construct(SectionPage $sectionPage, SectionsPage $sectionsPage) - { + public function __construct( + SectionPage $sectionPage, + SectionsPage $sectionsPage + ) { $this->sectionPage = $sectionPage; $this->sectionsPage = $sectionsPage; } @@ -47,8 +49,10 @@ public function deleteSection(): void /** * @Then content items list in section :sectionName contains items */ - public function sectionContainsProperContentItems(string $sectionName, TableNode $contentItems): void - { + public function sectionContainsProperContentItems( + string $sectionName, + TableNode $contentItems + ): void { $this->sectionPage->setExpectedSectionName($sectionName); foreach ($contentItems->getHash() as $contentItem) { diff --git a/src/lib/Behat/BrowserContext/SystemInfoContext.php b/src/lib/Behat/BrowserContext/SystemInfoContext.php index 6f71176307..c0a3292d65 100644 --- a/src/lib/Behat/BrowserContext/SystemInfoContext.php +++ b/src/lib/Behat/BrowserContext/SystemInfoContext.php @@ -14,7 +14,7 @@ class SystemInfoContext implements Context { - /** @var \Ibexa\AdminUi\Behat\Page\SystemInfoPage */ + /** @var SystemInfoPage */ private $systemInfoPage; public function __construct(SystemInfoPage $systemInfoPage) diff --git a/src/lib/Behat/BrowserContext/TrashContext.php b/src/lib/Behat/BrowserContext/TrashContext.php index af3afe865e..0854b1dd90 100644 --- a/src/lib/Behat/BrowserContext/TrashContext.php +++ b/src/lib/Behat/BrowserContext/TrashContext.php @@ -15,7 +15,7 @@ class TrashContext implements Context { - /** @var \Ibexa\AdminUi\Behat\Page\TrashPage */ + /** @var TrashPage */ private $trashPage; public function __construct(TrashPage $trashPage) @@ -80,8 +80,10 @@ public function iRestoreItemFromTrash(TableNode $itemsTable): void /** * @When I restore item from trash under new location :pathToContent */ - public function iRestoreItemFromTrashUnderNewLocation(TableNode $itemsTable, string $pathToContent): void - { + public function iRestoreItemFromTrashUnderNewLocation( + TableNode $itemsTable, + string $pathToContent + ): void { foreach ($itemsTable->getHash() as $itemTable) { $this->trashPage->select(['Name' => $itemTable['item']]); } @@ -92,16 +94,20 @@ public function iRestoreItemFromTrashUnderNewLocation(TableNode $itemsTable, str /** * @Then there is a :itemType :itemName on Trash list */ - public function thereIsItemOnTrashList(string $itemType, string $itemName): void - { + public function thereIsItemOnTrashList( + string $itemType, + string $itemName + ): void { Assert::assertTrue($this->trashPage->hasElement($itemType, $itemName)); } /** * @Then there is no :itemType :itemName on Trash list */ - public function thereIsNoItemOnTrashList(string $itemType, string $itemName): void - { + public function thereIsNoItemOnTrashList( + string $itemType, + string $itemName + ): void { Assert::assertFalse($this->trashPage->hasElement($itemType, $itemName)); } diff --git a/src/lib/Behat/BrowserContext/UDWContext.php b/src/lib/Behat/BrowserContext/UDWContext.php index b919a47a75..43ba52faef 100644 --- a/src/lib/Behat/BrowserContext/UDWContext.php +++ b/src/lib/Behat/BrowserContext/UDWContext.php @@ -17,11 +17,13 @@ class UDWContext implements Context { private $argumentParser; - /** @var \Ibexa\AdminUi\Behat\Component\UniversalDiscoveryWidget */ + /** @var UniversalDiscoveryWidget */ private $universalDiscoveryWidget; - public function __construct(ArgumentParser $argumentParser, UniversalDiscoveryWidget $universalDiscoveryWidget) - { + public function __construct( + ArgumentParser $argumentParser, + UniversalDiscoveryWidget $universalDiscoveryWidget + ) { $this->argumentParser = $argumentParser; $this->universalDiscoveryWidget = $universalDiscoveryWidget; } diff --git a/src/lib/Behat/BrowserContext/UserNotificationContext.php b/src/lib/Behat/BrowserContext/UserNotificationContext.php index 1d4bb7506e..d1db7e4f29 100644 --- a/src/lib/Behat/BrowserContext/UserNotificationContext.php +++ b/src/lib/Behat/BrowserContext/UserNotificationContext.php @@ -16,14 +16,16 @@ class UserNotificationContext implements Context { - /** @var \Ibexa\AdminUi\Behat\Component\UpperMenu */ + /** @var UpperMenu */ private $upperMenu; - /** @var \Ibexa\AdminUi\Behat\Component\UserNotificationPopup */ + /** @var UserNotificationPopup */ private $userNotificationPopup; - public function __construct(UpperMenu $upperMenu, UserNotificationPopup $userNotificationPopup) - { + public function __construct( + UpperMenu $upperMenu, + UserNotificationPopup $userNotificationPopup + ) { $this->upperMenu = $upperMenu; $this->userNotificationPopup = $userNotificationPopup; } diff --git a/src/lib/Behat/BrowserContext/UserPreferencesContext.php b/src/lib/Behat/BrowserContext/UserPreferencesContext.php index 03e6715c45..0af1dfe811 100644 --- a/src/lib/Behat/BrowserContext/UserPreferencesContext.php +++ b/src/lib/Behat/BrowserContext/UserPreferencesContext.php @@ -17,8 +17,10 @@ class UserPreferencesContext implements Context private UserSettingsPage $userSettingsPage; - public function __construct(ChangePasswordPage $changePasswordPage, UserSettingsPage $userSettingsPage) - { + public function __construct( + ChangePasswordPage $changePasswordPage, + UserSettingsPage $userSettingsPage + ) { $this->changePasswordPage = $changePasswordPage; $this->userSettingsPage = $userSettingsPage; } @@ -42,8 +44,10 @@ public function iClickChangePasswordButton(): void /** * @When I change password from :oldPassword to :newPassword */ - public function iChangePassword($oldPassword, $newPassword): void - { + public function iChangePassword( + $oldPassword, + $newPassword + ): void { $this->changePasswordPage->verifyIsLoaded(); $this->changePasswordPage->setOldPassword($oldPassword); $this->changePasswordPage->setNewPassword($newPassword); diff --git a/src/lib/Behat/Component/ContentActionsMenu.php b/src/lib/Behat/Component/ContentActionsMenu.php index f17756d139..535a467bb0 100644 --- a/src/lib/Behat/Component/ContentActionsMenu.php +++ b/src/lib/Behat/Component/ContentActionsMenu.php @@ -15,8 +15,10 @@ class ContentActionsMenu extends Component { - public function clickButton(string $buttonName, ?string $groupName = null): void - { + public function clickButton( + string $buttonName, + ?string $groupName = null + ): void { if ($groupName === null) { $this->clickStandaloneButton($buttonName); @@ -44,8 +46,10 @@ private function clickStandaloneButton(string $buttonName): void ->getByCriterion(new ElementTextCriterion($buttonName))->click(); } - private function clickButtonInGroup(string $groupName, string $buttonName): void - { + private function clickButtonInGroup( + string $groupName, + string $buttonName + ): void { $group = $this->getHTMLPage() ->findAll($this->getLocator('splitButton')) ->filterBy(new ElementTextCriterion($groupName)); diff --git a/src/lib/Behat/Component/ContentItemAdminPreview.php b/src/lib/Behat/Component/ContentItemAdminPreview.php index b32d8be656..ff21209077 100644 --- a/src/lib/Behat/Component/ContentItemAdminPreview.php +++ b/src/lib/Behat/Component/ContentItemAdminPreview.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Behat\Component; use Behat\Mink\Session; +use Ibexa\AdminUi\Behat\Component\Fields\FieldTypeComponentInterface; use Ibexa\Behat\Browser\Component\Component; use Ibexa\Behat\Browser\Locator\CSSLocator; use Ibexa\Behat\Browser\Locator\CSSLocatorBuilder; @@ -17,17 +18,22 @@ class ContentItemAdminPreview extends Component { - /** @var \Ibexa\AdminUi\Behat\Component\Fields\FieldTypeComponentInterface[] */ + /** @var FieldTypeComponentInterface[] */ protected $fieldTypeComponents; - public function __construct(Session $session, iterable $fieldTypeComponents) - { + public function __construct( + Session $session, + iterable $fieldTypeComponents + ) { parent::__construct($session); $this->fieldTypeComponents = $fieldTypeComponents; } - public function verifyFieldHasValues(string $fieldLabel, array $expectedValues, ?string $fieldTypeIdentifier) - { + public function verifyFieldHasValues( + string $fieldLabel, + array $expectedValues, + ?string $fieldTypeIdentifier + ) { $fieldPosition = $this->getFieldPosition($fieldLabel); $nthFieldLocator = new VisibleCSSLocator('', sprintf($this->getLocator('nthFieldContainer')->getSelector(), $fieldPosition)); @@ -44,9 +50,7 @@ public function verifyFieldHasValues(string $fieldLabel, array $expectedValues, } } - public function verifyIsLoaded(): void - { - } + public function verifyIsLoaded(): void {} protected function specifyLocators(): array { diff --git a/src/lib/Behat/Component/ContentTypePicker.php b/src/lib/Behat/Component/ContentTypePicker.php index 0c3aad5266..94feb21d13 100644 --- a/src/lib/Behat/Component/ContentTypePicker.php +++ b/src/lib/Behat/Component/ContentTypePicker.php @@ -19,8 +19,10 @@ class ContentTypePicker extends Component public const MINIMUM_ITEMS_COUNT_FOR_SEARCH_INPUT = 10; - public function __construct(Session $session, IbexaDropdown $ibexaDropdown) - { + public function __construct( + Session $session, + IbexaDropdown $ibexaDropdown + ) { parent::__construct($session); $this->ibexaDropdown = $ibexaDropdown; } diff --git a/src/lib/Behat/Component/CreateNewPopup.php b/src/lib/Behat/Component/CreateNewPopup.php index 247d6a1c13..e0d85c9f87 100644 --- a/src/lib/Behat/Component/CreateNewPopup.php +++ b/src/lib/Behat/Component/CreateNewPopup.php @@ -19,8 +19,10 @@ class CreateNewPopup extends Component { private IbexaDropdown $ibexaDropdown; - public function __construct(Session $session, IbexaDropdown $ibexaDropdown) - { + public function __construct( + Session $session, + IbexaDropdown $ibexaDropdown + ) { parent::__construct($session); $this->ibexaDropdown = $ibexaDropdown; } @@ -38,8 +40,10 @@ public function verifyHeaderText(string $expectedHeader): void $this->getHTMLPage()->setTimeout(5)->find($this->getLocator('popupHeader'))->assert()->textEquals($expectedHeader); } - public function selectFromDropdown(string $dropdownLabel, string $dropdownValue): void - { + public function selectFromDropdown( + string $dropdownLabel, + string $dropdownValue + ): void { $definition = $this->getHTMLPage()->setTimeout(5)->find($this->getLocator('popup'))->findAll($this->getLocator('formGroup')) ->getByCriterion(new ChildElementTextCriterion($this->getLocator('label'), $dropdownLabel)); if ($definition->find($this->getLocator('dropdownValue'))->getText() === $dropdownValue) { @@ -51,8 +55,10 @@ public function selectFromDropdown(string $dropdownLabel, string $dropdownValue) $this->ibexaDropdown->selectOption($dropdownValue); } - public function selectRadio(string $radioLabel, string $radioValue): void - { + public function selectRadio( + string $radioLabel, + string $radioValue + ): void { $definition = $this->getHTMLPage()->setTimeout(5)->find($this->getLocator('popup'))->findAll($this->getLocator('formGroup')) ->getByCriterion(new ChildElementTextCriterion($this->getLocator('label'), $radioLabel)); if ($definition->find($this->getLocator('radioValue'))->getText() === $radioValue) { diff --git a/src/lib/Behat/Component/CreateUrlAliasModal.php b/src/lib/Behat/Component/CreateUrlAliasModal.php index e5117fc2fe..aa6f4adcff 100644 --- a/src/lib/Behat/Component/CreateUrlAliasModal.php +++ b/src/lib/Behat/Component/CreateUrlAliasModal.php @@ -15,8 +15,10 @@ final class CreateUrlAliasModal extends Component { private IbexaDropdown $ibexaDropdown; - public function __construct(Session $session, IbexaDropdown $ibexaDropdown) - { + public function __construct( + Session $session, + IbexaDropdown $ibexaDropdown + ) { parent::__construct($session); $this->ibexaDropdown = $ibexaDropdown; } @@ -26,8 +28,11 @@ public function verifyIsLoaded(): void $this->getHTMLPage()->setTimeout(3)->find($this->getLocator('title'))->assert()->textEquals('Create a new URL alias'); } - public function createNewUrlAlias(string $path, string $languageName, bool $redirect): void - { + public function createNewUrlAlias( + string $path, + string $languageName, + bool $redirect + ): void { $this->getHTMLPage()->find($this->getLocator('pathInput'))->setValue($path); $this->getHTMLPage()->find($this->getLocator('languageDropdown'))->click(); $this->ibexaDropdown->verifyIsLoaded(); diff --git a/src/lib/Behat/Component/DateAndTimePopup.php b/src/lib/Behat/Component/DateAndTimePopup.php index 742abba324..6460ea6fa4 100644 --- a/src/lib/Behat/Component/DateAndTimePopup.php +++ b/src/lib/Behat/Component/DateAndTimePopup.php @@ -34,7 +34,7 @@ class DateAndTimePopup extends Component fi._flatpickr.config.onChange = onChangeNew; }'; - /** @var \Ibexa\Behat\Browser\Locator\VisibleCSSLocator */ + /** @var VisibleCSSLocator */ private $parentLocator; public function __construct(Session $session) @@ -43,8 +43,10 @@ public function __construct(Session $session) $this->parentLocator = VisibleCSSLocator::empty(); } - public function setDate(DateTimeInterface $date, string $dateFormat = self::DATETIME_FORMAT): void - { + public function setDate( + DateTimeInterface $date, + string $dateFormat = self::DATETIME_FORMAT + ): void { $this->getSession()->executeScript( sprintf( self::ADD_CALLBACK_TO_DATEPICKER_SCRIPT_FORMAT, @@ -68,8 +70,10 @@ public function setDate(DateTimeInterface $date, string $dateFormat = self::DATE ->isVisible(); } - public function setTime(int $hour, int $minute): void - { + public function setTime( + int $hour, + int $minute + ): void { $calendarContainerClassesScript = sprintf( self::CALENDAR_CONTAINER_CLASSES_SCRIPT, $this->parentLocator->getSelector(), diff --git a/src/lib/Behat/Component/DraftConflictDialog.php b/src/lib/Behat/Component/DraftConflictDialog.php index aa269cf7fd..8b96954a9c 100644 --- a/src/lib/Behat/Component/DraftConflictDialog.php +++ b/src/lib/Behat/Component/DraftConflictDialog.php @@ -9,17 +9,20 @@ namespace Ibexa\AdminUi\Behat\Component; use Behat\Mink\Session; +use Ibexa\AdminUi\Behat\Component\Table\Table; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; use Ibexa\Behat\Browser\Component\Component; use Ibexa\Behat\Browser\Locator\VisibleCSSLocator; class DraftConflictDialog extends Component { - /** @var \Ibexa\AdminUi\Behat\Component\Table\Table */ + /** @var Table */ private $table; - public function __construct(Session $session, TableBuilder $tableBuilder) - { + public function __construct( + Session $session, + TableBuilder $tableBuilder + ) { parent::__construct($session); $this->table = $tableBuilder->newTable()->withParentLocator($this->getLocator('table'))->build(); } diff --git a/src/lib/Behat/Component/Fields/ContentRelationMultiple.php b/src/lib/Behat/Component/Fields/ContentRelationMultiple.php index e928d83cd1..9ecc7b21f5 100644 --- a/src/lib/Behat/Component/Fields/ContentRelationMultiple.php +++ b/src/lib/Behat/Component/Fields/ContentRelationMultiple.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Behat\Component\Fields; use Behat\Mink\Session; +use Ibexa\AdminUi\Behat\Component\Table\Table; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; use Ibexa\AdminUi\Behat\Component\UniversalDiscoveryWidget; use Ibexa\Behat\Browser\Locator\CSSLocatorBuilder; @@ -17,17 +18,20 @@ class ContentRelationMultiple extends FieldTypeComponent { - /** @var \Ibexa\AdminUi\Behat\Component\UniversalDiscoveryWidget */ + /** @var UniversalDiscoveryWidget */ private $universalDiscoveryWidget; - /** @var \Ibexa\AdminUi\Behat\Component\Table\Table */ + /** @var Table */ private $table; - /** @var \Ibexa\AdminUi\Behat\Component\Table\TableBuilder */ + /** @var TableBuilder */ private $tableBuilder; - public function __construct(Session $session, UniversalDiscoveryWidget $universalDiscoveryWidget, TableBuilder $tableBuilder) - { + public function __construct( + Session $session, + UniversalDiscoveryWidget $universalDiscoveryWidget, + TableBuilder $tableBuilder + ) { parent::__construct($session); $this->universalDiscoveryWidget = $universalDiscoveryWidget; $this->tableBuilder = $tableBuilder; @@ -160,8 +164,10 @@ private function startAddingRelations() } } - private function selectRelationsAndConfirm($items, $paths) - { + private function selectRelationsAndConfirm( + $items, + $paths + ) { $this->universalDiscoveryWidget->verifyIsLoaded(); $itemsToSet = array_keys($items); diff --git a/src/lib/Behat/Component/Fields/ContentRelationSingle.php b/src/lib/Behat/Component/Fields/ContentRelationSingle.php index f92808ab64..7bd48df21c 100644 --- a/src/lib/Behat/Component/Fields/ContentRelationSingle.php +++ b/src/lib/Behat/Component/Fields/ContentRelationSingle.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Behat\Component\Fields; use Behat\Mink\Session; +use Ibexa\AdminUi\Behat\Component\Table\Table; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; use Ibexa\AdminUi\Behat\Component\UniversalDiscoveryWidget; use Ibexa\Behat\Browser\Element\Action\MouseOverAndClick; @@ -18,13 +19,13 @@ class ContentRelationSingle extends FieldTypeComponent { - /** @var \Ibexa\AdminUi\Behat\Component\UniversalDiscoveryWidget */ + /** @var UniversalDiscoveryWidget */ private $universalDiscoveryWidget; - /** @var \Ibexa\AdminUi\Behat\Component\Table\Table */ + /** @var Table */ private $table; - /** @var \Ibexa\AdminUi\Behat\Component\Table\TableBuilder */ + /** @var TableBuilder */ private $tableBuilder; public function specifyLocators(): array @@ -37,8 +38,11 @@ public function specifyLocators(): array ]; } - public function __construct(Session $session, UniversalDiscoveryWidget $universalDiscoveryWidget, TableBuilder $tableBuilder) - { + public function __construct( + Session $session, + UniversalDiscoveryWidget $universalDiscoveryWidget, + TableBuilder $tableBuilder + ) { parent::__construct($session); $this->universalDiscoveryWidget = $universalDiscoveryWidget; $this->tableBuilder = $tableBuilder; diff --git a/src/lib/Behat/Component/Fields/Country.php b/src/lib/Behat/Component/Fields/Country.php index f46a36357d..69fd34c633 100644 --- a/src/lib/Behat/Component/Fields/Country.php +++ b/src/lib/Behat/Component/Fields/Country.php @@ -16,8 +16,10 @@ class Country extends FieldTypeComponent { private IbexaDropdown $dropdown; - public function __construct(Session $session, IbexaDropdown $dropdown) - { + public function __construct( + Session $session, + IbexaDropdown $dropdown + ) { parent::__construct($session); $this->dropdown = $dropdown; } diff --git a/src/lib/Behat/Component/Fields/Date.php b/src/lib/Behat/Component/Fields/Date.php index 100427b09b..9679244d4f 100644 --- a/src/lib/Behat/Component/Fields/Date.php +++ b/src/lib/Behat/Component/Fields/Date.php @@ -18,11 +18,13 @@ class Date extends FieldTypeComponent { private const DATE_FORMAT = 'm/d/Y'; - /** @var \Ibexa\AdminUi\Behat\Component\DateAndTimePopup */ + /** @var DateAndTimePopup */ private $dateAndTimePopup; - public function __construct(Session $session, DateAndTimePopup $dateAndTimePopup) - { + public function __construct( + Session $session, + DateAndTimePopup $dateAndTimePopup + ) { parent::__construct($session); $this->dateAndTimePopup = $dateAndTimePopup; } diff --git a/src/lib/Behat/Component/Fields/DateAndTime.php b/src/lib/Behat/Component/Fields/DateAndTime.php index 05ce118ee0..b277506a40 100644 --- a/src/lib/Behat/Component/Fields/DateAndTime.php +++ b/src/lib/Behat/Component/Fields/DateAndTime.php @@ -20,11 +20,13 @@ class DateAndTime extends FieldTypeComponent private const FIELD_DISPLAY_FORMAT = 'd/m/Y G:i'; - /** @var \Ibexa\AdminUi\Behat\Component\DateAndTimePopup */ + /** @var DateAndTimePopup */ private $dateAndTimePopup; - public function __construct(Session $session, DateAndTimePopup $dateAndTimePopup) - { + public function __construct( + Session $session, + DateAndTimePopup $dateAndTimePopup + ) { parent::__construct($session); $this->dateAndTimePopup = $dateAndTimePopup; } diff --git a/src/lib/Behat/Component/Fields/FieldTypeComponent.php b/src/lib/Behat/Component/Fields/FieldTypeComponent.php index 137d352b47..c0a5f97bc7 100644 --- a/src/lib/Behat/Component/Fields/FieldTypeComponent.php +++ b/src/lib/Behat/Component/Fields/FieldTypeComponent.php @@ -15,7 +15,7 @@ abstract class FieldTypeComponent extends Component implements FieldTypeComponentInterface { - /** @var \Ibexa\Behat\Browser\Locator\VisibleCSSLocator */ + /** @var VisibleCSSLocator */ protected $parentLocator; public function setValue(array $parameters): void @@ -71,7 +71,5 @@ public function verifyValueInEditView(array $value): void ); } - public function verifyIsLoaded(): void - { - } + public function verifyIsLoaded(): void {} } diff --git a/src/lib/Behat/Component/Fields/File.php b/src/lib/Behat/Component/Fields/File.php index 7debee66a8..cae86fbd0d 100644 --- a/src/lib/Behat/Component/Fields/File.php +++ b/src/lib/Behat/Component/Fields/File.php @@ -17,11 +17,13 @@ class File extends FieldTypeComponent { - /** @var \Ibexa\Behat\Browser\FileUpload\FileUploadHelper */ + /** @var FileUploadHelper */ private $fileUploadHelper; - public function __construct(Session $session, FileUploadHelper $fileUploadHelper) - { + public function __construct( + Session $session, + FileUploadHelper $fileUploadHelper + ) { parent::__construct($session); $this->fileUploadHelper = $fileUploadHelper; } diff --git a/src/lib/Behat/Component/Fields/Image.php b/src/lib/Behat/Component/Fields/Image.php index b02735dc21..8028425b06 100644 --- a/src/lib/Behat/Component/Fields/Image.php +++ b/src/lib/Behat/Component/Fields/Image.php @@ -17,11 +17,13 @@ class Image extends FieldTypeComponent { - /** @var \Ibexa\Behat\Browser\FileUpload\FileUploadHelper */ + /** @var FileUploadHelper */ protected $fileUploadHelper; - public function __construct(Session $session, FileUploadHelper $fileUploadHelper) - { + public function __construct( + Session $session, + FileUploadHelper $fileUploadHelper + ) { parent::__construct($session); $this->fileUploadHelper = $fileUploadHelper; } diff --git a/src/lib/Behat/Component/Fields/ImageAsset.php b/src/lib/Behat/Component/Fields/ImageAsset.php index 2ffb0199d5..f4adea1f39 100644 --- a/src/lib/Behat/Component/Fields/ImageAsset.php +++ b/src/lib/Behat/Component/Fields/ImageAsset.php @@ -19,10 +19,10 @@ class ImageAsset extends Image { - /** @var \Ibexa\AdminUi\Behat\Component\UniversalDiscoveryWidget */ + /** @var UniversalDiscoveryWidget */ private $universalDiscoveryWidget; - /** @var \Ibexa\AdminUi\Behat\Component\Notification */ + /** @var Notification */ private $notification; public function __construct( diff --git a/src/lib/Behat/Component/Fields/MapLocation.php b/src/lib/Behat/Component/Fields/MapLocation.php index d649e34bdf..17dff86a80 100644 --- a/src/lib/Behat/Component/Fields/MapLocation.php +++ b/src/lib/Behat/Component/Fields/MapLocation.php @@ -117,8 +117,10 @@ public function specifyLocators(): array ]; } - private function setSpecificCoordinate(string $coordinateName, string $value): void - { + private function setSpecificCoordinate( + string $coordinateName, + string $value + ): void { $fieldSelector = CSSLocatorBuilder::base($this->parentLocator) ->withDescendant($this->getLocator($coordinateName)) ->build() diff --git a/src/lib/Behat/Component/Fields/Matrix.php b/src/lib/Behat/Component/Fields/Matrix.php index cc3bb162d3..f6670d0c4e 100644 --- a/src/lib/Behat/Component/Fields/Matrix.php +++ b/src/lib/Behat/Component/Fields/Matrix.php @@ -90,15 +90,20 @@ private function addRows(int $numberOfRows): void } } - private function internalSetValue(int $rowIndex, string $column, $value): void - { + private function internalSetValue( + int $rowIndex, + string $column, + $value + ): void { $matrixCellSelector = new VisibleCSSLocator('matrixCell', sprintf('[name="ezplatform_content_forms_content_edit[fieldsData][ezmatrix][value][entries][%d][%s]"]', $rowIndex, $column)); $this->getHTMLPage()->find($matrixCellSelector)->setValue($value); } - private function getParsedTableValue(LocatorInterface $headerSelector, LocatorInterface $rowSelector): string - { + private function getParsedTableValue( + LocatorInterface $headerSelector, + LocatorInterface $rowSelector + ): string { $parsedTable = ''; $headers = $this->getHTMLPage()->find($this->parentLocator)->findAll($headerSelector)->mapBy(new ElementTextMapper()); diff --git a/src/lib/Behat/Component/Fields/Media.php b/src/lib/Behat/Component/Fields/Media.php index 1f668fd71a..8e365141ea 100644 --- a/src/lib/Behat/Component/Fields/Media.php +++ b/src/lib/Behat/Component/Fields/Media.php @@ -17,11 +17,13 @@ class Media extends FieldTypeComponent { - /** @var \Ibexa\Behat\Browser\FileUpload\FileUploadHelper */ + /** @var FileUploadHelper */ private $fileUploadHelper; - public function __construct(Session $session, FileUploadHelper $fileUploadHelper) - { + public function __construct( + Session $session, + FileUploadHelper $fileUploadHelper + ) { parent::__construct($session); $this->fileUploadHelper = $fileUploadHelper; } diff --git a/src/lib/Behat/Component/Fields/RichText.php b/src/lib/Behat/Component/Fields/RichText.php index eb3d9416b0..1fa9bad2fb 100644 --- a/src/lib/Behat/Component/Fields/RichText.php +++ b/src/lib/Behat/Component/Fields/RichText.php @@ -80,8 +80,10 @@ public function insertNewLine(): void $this->executeCommand('enter'); } - public function insertLine($value, $style = ''): void - { + public function insertLine( + $value, + $style = '' + ): void { $this->getFieldInput()->setValue($value); if ($style === '') { diff --git a/src/lib/Behat/Component/Fields/TextLine.php b/src/lib/Behat/Component/Fields/TextLine.php index 1f58d8cb71..9a6e163957 100644 --- a/src/lib/Behat/Component/Fields/TextLine.php +++ b/src/lib/Behat/Component/Fields/TextLine.php @@ -26,8 +26,8 @@ public function setValue(array $parameters): void public function specifyLocators(): array { return [ - new VisibleCSSLocator('fieldInput', 'input'), - ]; + new VisibleCSSLocator('fieldInput', 'input'), + ]; } public function getFieldTypeIdentifier(): string diff --git a/src/lib/Behat/Component/Fields/Time.php b/src/lib/Behat/Component/Fields/Time.php index 8d3c718fdc..b724931409 100644 --- a/src/lib/Behat/Component/Fields/Time.php +++ b/src/lib/Behat/Component/Fields/Time.php @@ -18,11 +18,13 @@ class Time extends FieldTypeComponent { private const VALUE_TIME_FORMAT = 'G:i'; - /** @var \Ibexa\AdminUi\Behat\Component\DateAndTimePopup */ + /** @var DateAndTimePopup */ private $dateAndTimePopup; - public function __construct(Session $session, DateAndTimePopup $dateAndTimePopup) - { + public function __construct( + Session $session, + DateAndTimePopup $dateAndTimePopup + ) { parent::__construct($session); $this->dateAndTimePopup = $dateAndTimePopup; } diff --git a/src/lib/Behat/Component/Fields/URL.php b/src/lib/Behat/Component/Fields/URL.php index ccc2ffada2..f06c07208a 100644 --- a/src/lib/Behat/Component/Fields/URL.php +++ b/src/lib/Behat/Component/Fields/URL.php @@ -20,8 +20,10 @@ public function setValue(array $parameters): void $this->setSpecificFieldValue('text', $parameters['text']); } - public function setSpecificFieldValue(string $fieldName, string $value): void - { + public function setSpecificFieldValue( + string $fieldName, + string $value + ): void { $fieldSelector = CSSLocatorBuilder::base($this->parentLocator) ->withDescendant($this->getLocator($fieldName)) ->build(); @@ -34,7 +36,7 @@ public function getValue(): array return [ 'url' => $this->getSpecificFieldValue('url'), 'text' => $this->getSpecificFieldValue('text'), - ]; + ]; } public function getSpecificFieldValue(string $fieldName): string diff --git a/src/lib/Behat/Component/Fields/User.php b/src/lib/Behat/Component/Fields/User.php index a04d71d92d..b10d38903b 100644 --- a/src/lib/Behat/Component/Fields/User.php +++ b/src/lib/Behat/Component/Fields/User.php @@ -29,8 +29,10 @@ public function setValue(array $parameters): void $this->setEnabledField(true); } - public function setSpecificFieldValue(string $fieldName, string $value): void - { + public function setSpecificFieldValue( + string $fieldName, + string $value + ): void { $this->getHTMLPage()->find($this->parentLocator)->find($this->getLocator($fieldName))->setValue($value); } diff --git a/src/lib/Behat/Component/LeftMenu.php b/src/lib/Behat/Component/LeftMenu.php index d941fae826..e8ef8dc7b5 100644 --- a/src/lib/Behat/Component/LeftMenu.php +++ b/src/lib/Behat/Component/LeftMenu.php @@ -25,8 +25,10 @@ public function goToTab(string $tabName): void $menuButton->find(new VisibleCSSLocator('activeMarker', '.ibexa-main-menu__item-action.active'))->assert()->isVisible(); } - public function goToSubTab(string $tabName, string $subTabName): void - { + public function goToSubTab( + string $tabName, + string $subTabName + ): void { $menuButton = $this->getHTMLPage()->setTimeout(5) ->findAll($this->getLocator('menuItem')) ->getByCriterion(new ElementAttributeCriterion('data-original-title', $tabName)); diff --git a/src/lib/Behat/Component/PropertiesList.php b/src/lib/Behat/Component/PropertiesList.php index 86479842b1..94349d9df1 100644 --- a/src/lib/Behat/Component/PropertiesList.php +++ b/src/lib/Behat/Component/PropertiesList.php @@ -19,8 +19,10 @@ public function verifyIsLoaded(): void $this->getHTMLPage()->find($this->getLocator('tabContent'))->assert()->isVisible(); } - public function verifyValue(string $label, string $value): void - { + public function verifyValue( + string $label, + string $value + ): void { $this->getHTMLPage() ->findAll($this->getLocator('globalPropertiesItem')) ->getByCriterion(new ChildElementTextCriterion($this->getLocator('globalPropertiesLabel'), $label)) diff --git a/src/lib/Behat/Component/SubItemsList.php b/src/lib/Behat/Component/SubItemsList.php index f1ab660025..7303e4bb36 100644 --- a/src/lib/Behat/Component/SubItemsList.php +++ b/src/lib/Behat/Component/SubItemsList.php @@ -10,6 +10,7 @@ use Behat\Mink\Session; use Ibexa\AdminUi\Behat\Component\Table\SubitemsGrid; +use Ibexa\AdminUi\Behat\Component\Table\Table; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; use Ibexa\AdminUi\Behat\Component\Table\TableInterface; use Ibexa\Behat\Browser\Component\Component; @@ -22,16 +23,19 @@ class SubItemsList extends Component { - /** @var \Ibexa\AdminUi\Behat\Component\Table\Table */ + /** @var Table */ protected $table; protected $isGridViewEnabled; - /** @var \Ibexa\AdminUi\Behat\Component\Table\SubitemsGrid */ + /** @var SubitemsGrid */ private $grid; - public function __construct(Session $session, TableBuilder $tableBuilder, SubitemsGrid $grid) - { + public function __construct( + Session $session, + TableBuilder $tableBuilder, + SubitemsGrid $grid + ) { parent::__construct($session); $this->table = $tableBuilder ->newTable() @@ -41,8 +45,10 @@ public function __construct(Session $session, TableBuilder $tableBuilder, Subite $this->grid = $grid; } - public function sortBy(string $columnName, bool $ascending): void - { + public function sortBy( + string $columnName, + bool $ascending + ): void { if ($this->isGridViewEnabled) { return; } @@ -91,8 +97,10 @@ public function verifyIsLoaded(): void ->assert()->textContains('Viewing'); } - public function clickListElement(string $contentName, string $contentType) - { + public function clickListElement( + string $contentName, + string $contentType + ) { $this->getTable()->getTableRow(['Name' => $contentName, 'Content type' => $contentType])->goToItem(); } diff --git a/src/lib/Behat/Component/Table/SubitemsGrid.php b/src/lib/Behat/Component/Table/SubitemsGrid.php index c8f263f19a..9be6536c43 100644 --- a/src/lib/Behat/Component/Table/SubitemsGrid.php +++ b/src/lib/Behat/Component/Table/SubitemsGrid.php @@ -23,9 +23,7 @@ protected function specifyLocators(): array ]; } - public function verifyIsLoaded(): void - { - } + public function verifyIsLoaded(): void {} public function isEmpty(): bool { diff --git a/src/lib/Behat/Component/Table/Table.php b/src/lib/Behat/Component/Table/Table.php index 6e4ffb6ccf..68fc70e1cf 100644 --- a/src/lib/Behat/Component/Table/Table.php +++ b/src/lib/Behat/Component/Table/Table.php @@ -26,7 +26,7 @@ final class Table extends Component implements TableInterface /** @var TableRowFactory */ protected $tableFactory; - /** @var \Ibexa\AdminUi\Behat\Component\Pagination */ + /** @var Pagination */ private $pagination; private $parentElement; @@ -207,9 +207,7 @@ public function getTableRowByIndex(int $rowIndex): TableRow return $this->tableFactory->createRow($rowElement, new LocatorCollection($filteredCellLocators)); } - public function verifyIsLoaded(): void - { - } + public function verifyIsLoaded(): void {} private function setParentElement() { @@ -222,8 +220,10 @@ private function setParentElement() $this->isParentElementSet = true; } - private function getTableCellLocator(int $headerPosition, string $identifier = 'tableCell'): CSSLocator - { + private function getTableCellLocator( + int $headerPosition, + string $identifier = 'tableCell' + ): CSSLocator { // +1: headerPosition is 0-indexed, but CSS selectors are 1-indexed return new CSSLocator($identifier, sprintf($this->getLocator('cell')->getSelector(), $headerPosition + 1, $headerPosition + 1)); } @@ -237,8 +237,10 @@ protected function specifyLocators(): array /** * @param array $elementData */ - private function getHeaderPositions(array $searchedHeaders, array $allHeaders): array - { + private function getHeaderPositions( + array $searchedHeaders, + array $allHeaders + ): array { $foundHeaders = array_filter($allHeaders, static function (string $header) use ($searchedHeaders) { return in_array($header, $searchedHeaders, true); }); @@ -252,8 +254,10 @@ private function getHeaderPositions(array $searchedHeaders, array $allHeaders): return $foundHeaders; } - private function getMatchingTableRow(array $foundHeaders, array $elementData): ?ElementInterface - { + private function getMatchingTableRow( + array $foundHeaders, + array $elementData + ): ?ElementInterface { foreach ($this->parentElement->setTimeout(3)->findAll($this->getLocator('row')) as $row) { foreach ($foundHeaders as $headerPosition => $header) { $foundHeader = $row->setTimeout(0)->findAll($this->getTableCellLocator($headerPosition)); diff --git a/src/lib/Behat/Component/Table/TableBuilder.php b/src/lib/Behat/Component/Table/TableBuilder.php index 384903b60c..1097201282 100644 --- a/src/lib/Behat/Component/Table/TableBuilder.php +++ b/src/lib/Behat/Component/Table/TableBuilder.php @@ -16,16 +16,16 @@ class TableBuilder { - /** @var \Behat\Mink\Session */ + /** @var Session */ private $session; - /** @var \Ibexa\AdminUi\Behat\Component\Table\TableRowFactory */ + /** @var TableRowFactory */ private $tableRowFactory; - /** @var \Ibexa\AdminUi\Behat\Component\Pagination */ + /** @var Pagination */ private $pagination; - /** @var \Ibexa\Behat\Browser\Locator\LocatorCollection */ + /** @var LocatorCollection */ private $locators; /** @@ -33,8 +33,11 @@ class TableBuilder */ private $buildInProgress; - public function __construct(Session $session, TableRowFactory $tableRowFactory, Pagination $pagination) - { + public function __construct( + Session $session, + TableRowFactory $tableRowFactory, + Pagination $pagination + ) { $this->session = $session; $this->tableRowFactory = $tableRowFactory; $this->pagination = $pagination; diff --git a/src/lib/Behat/Component/Table/TableRow.php b/src/lib/Behat/Component/Table/TableRow.php index cde0a4a8f7..6cd0e85caf 100644 --- a/src/lib/Behat/Component/Table/TableRow.php +++ b/src/lib/Behat/Component/Table/TableRow.php @@ -19,14 +19,17 @@ class TableRow extends Component { - /** @var \Ibexa\Behat\Browser\Element\ElementInterface */ + /** @var ElementInterface */ private $element; - /** @var \Ibexa\Behat\Browser\Locator\LocatorCollection */ + /** @var LocatorCollection */ private $locatorCollection; - public function __construct(Session $session, ElementInterface $element, LocatorCollection $locatorCollection) - { + public function __construct( + Session $session, + ElementInterface $element, + LocatorCollection $locatorCollection + ) { parent::__construct($session); $this->element = $element; $this->locatorCollection = $locatorCollection; @@ -81,9 +84,7 @@ public function getCell(string $headerName): ElementInterface return $this->element->find($this->locatorCollection->get($headerName)); } - public function verifyIsLoaded(): void - { - } + public function verifyIsLoaded(): void {} public function click(LocatorInterface $locator) { diff --git a/src/lib/Behat/Component/Table/TableRowFactory.php b/src/lib/Behat/Component/Table/TableRowFactory.php index 42859a3d30..834ccd3279 100644 --- a/src/lib/Behat/Component/Table/TableRowFactory.php +++ b/src/lib/Behat/Component/Table/TableRowFactory.php @@ -13,7 +13,7 @@ class TableRowFactory { - /** @var \Behat\Mink\Session */ + /** @var Session */ private $session; public function __construct(Session $session) @@ -21,8 +21,10 @@ public function __construct(Session $session) $this->session = $session; } - public function createRow(ElementInterface $element, LocatorCollection $locatorCollection): TableRow - { + public function createRow( + ElementInterface $element, + LocatorCollection $locatorCollection + ): TableRow { return new TableRow( $this->session, $element, diff --git a/src/lib/Behat/Component/TranslationDialog.php b/src/lib/Behat/Component/TranslationDialog.php index a9ea703ae4..a695391949 100644 --- a/src/lib/Behat/Component/TranslationDialog.php +++ b/src/lib/Behat/Component/TranslationDialog.php @@ -15,8 +15,10 @@ class TranslationDialog extends Dialog { private IbexaDropdown $ibexaDropdown; - public function __construct(Session $session, IbexaDropdown $ibexaDropdown) - { + public function __construct( + Session $session, + IbexaDropdown $ibexaDropdown + ) { parent::__construct($session); $this->ibexaDropdown = $ibexaDropdown; } diff --git a/src/lib/Behat/Component/TrashSearch.php b/src/lib/Behat/Component/TrashSearch.php index 9a5ed8204a..d9867acc77 100644 --- a/src/lib/Behat/Component/TrashSearch.php +++ b/src/lib/Behat/Component/TrashSearch.php @@ -18,8 +18,10 @@ class TrashSearch extends Component { private IbexaDropdown $ibexaDropdown; - public function __construct(Session $session, IbexaDropdown $ibexaDropdown) - { + public function __construct( + Session $session, + IbexaDropdown $ibexaDropdown + ) { parent::__construct($session); $this->ibexaDropdown = $ibexaDropdown; } @@ -72,13 +74,13 @@ protected function specifyLocators(): array { return [ - new VisibleCSSLocator('mainSearchBox', '.ibexa-adaptive-filters--inside-container'), - new VisibleCSSLocator('mainSearchBoxInput', '#trash_search_content_name'), - new VisibleCSSLocator('creatorSearchBoxInput', '.ibexa-trash-search-form__item--creator .ibexa-input--text'), - new VisibleCSSLocator('mainSearchBoxConfirmButton', '.ibexa-adaptive-filters__static-left .ibexa-input-text-wrapper--type-text .ibexa-input-text-wrapper__action-btn--search'), - new VisibleCSSLocator('contentTypeFilterDropdown', 'label[for="trash_search_content_type"] ~ .ibexa-dropdown'), - new VisibleCSSLocator('sectionFilterDropdown', 'label[for="trash_search_section"] ~ .ibexa-dropdown'), - new VisibleCSSLocator('creatorFilterDropdown', '.ibexa-trash-search-form__user-list li'), - ]; + new VisibleCSSLocator('mainSearchBox', '.ibexa-adaptive-filters--inside-container'), + new VisibleCSSLocator('mainSearchBoxInput', '#trash_search_content_name'), + new VisibleCSSLocator('creatorSearchBoxInput', '.ibexa-trash-search-form__item--creator .ibexa-input--text'), + new VisibleCSSLocator('mainSearchBoxConfirmButton', '.ibexa-adaptive-filters__static-left .ibexa-input-text-wrapper--type-text .ibexa-input-text-wrapper__action-btn--search'), + new VisibleCSSLocator('contentTypeFilterDropdown', 'label[for="trash_search_content_type"] ~ .ibexa-dropdown'), + new VisibleCSSLocator('sectionFilterDropdown', 'label[for="trash_search_section"] ~ .ibexa-dropdown'), + new VisibleCSSLocator('creatorFilterDropdown', '.ibexa-trash-search-form__user-list li'), + ]; } } diff --git a/src/lib/Behat/Component/UniversalDiscoveryWidget.php b/src/lib/Behat/Component/UniversalDiscoveryWidget.php index 28585e6dea..35774f8682 100644 --- a/src/lib/Behat/Component/UniversalDiscoveryWidget.php +++ b/src/lib/Behat/Component/UniversalDiscoveryWidget.php @@ -78,14 +78,18 @@ protected function isMultiSelect(): bool return $this->getHTMLPage()->setTimeout(0)->findAll($this->getLocator('multiselect'))->any(); } - protected function addItemToMultiSelection(string $itemName, int $level): void - { + protected function addItemToMultiSelection( + string $itemName, + int $level + ): void { $treeElementsLocator = new CSSLocator('', sprintf($this->getLocator('treeLevelElementsFormat')->getSelector(), $level)); $this->getHTMLPage()->findAll($treeElementsLocator)->getByCriterion(new ElementTextCriterion($itemName))->find($this->getLocator('input'))->click(); } - protected function selectTreeBranch(string $itemName, int $level): void - { + protected function selectTreeBranch( + string $itemName, + int $level + ): void { $treeLevelLocator = new VisibleCSSLocator('treeLevelLocator', sprintf($this->getLocator('treeLevelElementsFormat')->getSelector(), $level)); $this->getHTMLPage()->setTimeout(self::LONG_TIMEOUT)->find($treeLevelLocator)->assert()->isVisible(); diff --git a/src/lib/Behat/Component/UpperMenu.php b/src/lib/Behat/Component/UpperMenu.php index 6a244d7ba5..094922aaf7 100644 --- a/src/lib/Behat/Component/UpperMenu.php +++ b/src/lib/Behat/Component/UpperMenu.php @@ -17,8 +17,10 @@ class UpperMenu extends Component { private IbexaDropdown $ibexaDropdown; - public function __construct(Session $session, IbexaDropdown $ibexaDropdown) - { + public function __construct( + Session $session, + IbexaDropdown $ibexaDropdown + ) { parent::__construct($session); $this->ibexaDropdown = $ibexaDropdown; } diff --git a/src/lib/Behat/Component/UserNotificationPopup.php b/src/lib/Behat/Component/UserNotificationPopup.php index 4b8c780c89..cdce898a12 100644 --- a/src/lib/Behat/Component/UserNotificationPopup.php +++ b/src/lib/Behat/Component/UserNotificationPopup.php @@ -14,8 +14,10 @@ class UserNotificationPopup extends Component { - public function clickNotification(string $expectedType, string $expectedDescription) - { + public function clickNotification( + string $expectedType, + string $expectedDescription + ) { $notifications = $this->getHTMLPage()->findAll($this->getLocator('notificationItem')); foreach ($notifications as $notification) { diff --git a/src/lib/Behat/Page/AdminUpdateItemPage.php b/src/lib/Behat/Page/AdminUpdateItemPage.php index c64b057496..19fcd0e6fc 100644 --- a/src/lib/Behat/Page/AdminUpdateItemPage.php +++ b/src/lib/Behat/Page/AdminUpdateItemPage.php @@ -21,11 +21,14 @@ class AdminUpdateItemPage extends Page { - /** @var \Ibexa\AdminUi\Behat\Component\ContentActionsMenu */ + /** @var ContentActionsMenu */ protected $contentActionsMenu; - public function __construct(Session $session, Router $router, ContentActionsMenu $contentActionsMenu) - { + public function __construct( + Session $session, + Router $router, + ContentActionsMenu $contentActionsMenu + ) { parent::__construct($session, $router); $this->contentActionsMenu = $contentActionsMenu; } @@ -50,8 +53,10 @@ public function getName(): string return 'Admin item update'; } - public function fillFieldWithValue(string $fieldName, $value): void - { + public function fillFieldWithValue( + string $fieldName, + $value + ): void { $field = $this->getField($fieldName); $fieldType = $field->getAttribute('type'); diff --git a/src/lib/Behat/Page/BookmarksPage.php b/src/lib/Behat/Page/BookmarksPage.php index d848d61300..00c3ce7a58 100644 --- a/src/lib/Behat/Page/BookmarksPage.php +++ b/src/lib/Behat/Page/BookmarksPage.php @@ -19,8 +19,11 @@ class BookmarksPage extends Page { private TableInterface $table; - public function __construct(Session $session, Router $router, TableBuilder $tableBuilder) - { + public function __construct( + Session $session, + Router $router, + TableBuilder $tableBuilder + ) { parent::__construct($session, $router); $this->table = $tableBuilder->newTable()->build(); } diff --git a/src/lib/Behat/Page/ChangePasswordPage.php b/src/lib/Behat/Page/ChangePasswordPage.php index 30cc30e77e..71c794023e 100644 --- a/src/lib/Behat/Page/ChangePasswordPage.php +++ b/src/lib/Behat/Page/ChangePasswordPage.php @@ -17,8 +17,11 @@ class ChangePasswordPage extends Page { private ContentActionsMenu $contentActionsMenu; - public function __construct(Session $session, Router $router, ContentActionsMenu $contentActionsMenu) - { + public function __construct( + Session $session, + Router $router, + ContentActionsMenu $contentActionsMenu + ) { parent::__construct($session, $router); $this->contentActionsMenu = $contentActionsMenu; } diff --git a/src/lib/Behat/Page/ContentTypeGroupPage.php b/src/lib/Behat/Page/ContentTypeGroupPage.php index a7c11f2f24..d31aa23310 100644 --- a/src/lib/Behat/Page/ContentTypeGroupPage.php +++ b/src/lib/Behat/Page/ContentTypeGroupPage.php @@ -9,7 +9,9 @@ namespace Ibexa\AdminUi\Behat\Page; use Behat\Mink\Session; +use Ibexa\AdminUi\Behat\Component\AdminList; use Ibexa\AdminUi\Behat\Component\Dialog; +use Ibexa\AdminUi\Behat\Component\Table\Table; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion; use Ibexa\Behat\Browser\Locator\VisibleCSSLocator; @@ -19,26 +21,31 @@ class ContentTypeGroupPage extends Page { - /** @var \Ibexa\AdminUi\Behat\Component\AdminList */ + /** @var AdminList */ protected $adminList; /** @var string */ protected $expectedName; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; /** @var mixed */ private $contentTypeGroupId; - /** @var \Ibexa\AdminUi\Behat\Component\Table\Table */ + /** @var Table */ private $table; - /** @var \Ibexa\AdminUi\Behat\Component\Dialog */ + /** @var Dialog */ private $dialog; - public function __construct(Session $session, Router $router, ContentTypeService $contentTypeService, TableBuilder $tableBuilder, Dialog $dialog) - { + public function __construct( + Session $session, + Router $router, + ContentTypeService $contentTypeService, + TableBuilder $tableBuilder, + Dialog $dialog + ) { parent::__construct($session, $router); $this->contentTypeService = $contentTypeService; $this->table = $tableBuilder->newTable()->withParentLocator($this->getLocator('tableContainer'))->build(); diff --git a/src/lib/Behat/Page/ContentTypeGroupsPage.php b/src/lib/Behat/Page/ContentTypeGroupsPage.php index 541e78f917..3235dc0494 100644 --- a/src/lib/Behat/Page/ContentTypeGroupsPage.php +++ b/src/lib/Behat/Page/ContentTypeGroupsPage.php @@ -10,6 +10,7 @@ use Behat\Mink\Session; use Ibexa\AdminUi\Behat\Component\Dialog; +use Ibexa\AdminUi\Behat\Component\Table\Table; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; use Ibexa\Behat\Browser\Locator\VisibleCSSLocator; use Ibexa\Behat\Browser\Page\Page; @@ -18,14 +19,18 @@ class ContentTypeGroupsPage extends Page { - /** @var \Ibexa\AdminUi\Behat\Component\Table\Table */ + /** @var Table */ private $table; - /** @var \Ibexa\AdminUi\Behat\Component\Dialog */ + /** @var Dialog */ private $dialog; - public function __construct(Session $session, Router $router, TableBuilder $tableBuilder, Dialog $dialog) - { + public function __construct( + Session $session, + Router $router, + TableBuilder $tableBuilder, + Dialog $dialog + ) { parent::__construct($session, $router); $this->table = $tableBuilder->newTable()->build(); $this->dialog = $dialog; diff --git a/src/lib/Behat/Page/ContentTypePage.php b/src/lib/Behat/Page/ContentTypePage.php index 6a89bc4839..d0a3e3fca6 100644 --- a/src/lib/Behat/Page/ContentTypePage.php +++ b/src/lib/Behat/Page/ContentTypePage.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Behat\Page; use Behat\Mink\Session; +use Ibexa\AdminUi\Behat\Component\Table\Table; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; use Ibexa\Behat\Browser\Element\Criterion\ChildElementTextCriterion; use Ibexa\Behat\Browser\Locator\VisibleCSSLocator; @@ -21,7 +22,7 @@ class ContentTypePage extends Page /** @var string */ private $expectedContentTypeName; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; /** @var mixed */ @@ -30,7 +31,7 @@ class ContentTypePage extends Page /** @var mixed */ private $expectedContenTypeId; - /** @var \Ibexa\AdminUi\Behat\Component\Table\Table */ + /** @var Table */ private $fieldTable; public function __construct( @@ -44,8 +45,10 @@ public function __construct( $this->fieldTable = $tableBuilder->newTable()->withParentLocator($this->getLocator('contentFieldsTable'))->build(); } - public function hasProperty($label, $value): bool - { + public function hasProperty( + $label, + $value + ): bool { return $this->getHTMLPage() ->findAll($this->getLocator('globalPropertiesItem')) ->getByCriterion(new ChildElementTextCriterion($this->getLocator('globalPropertiesLabel'), $label)) diff --git a/src/lib/Behat/Page/ContentTypeUpdatePage.php b/src/lib/Behat/Page/ContentTypeUpdatePage.php index cc2a6ccb54..6841aba0de 100644 --- a/src/lib/Behat/Page/ContentTypeUpdatePage.php +++ b/src/lib/Behat/Page/ContentTypeUpdatePage.php @@ -20,8 +20,11 @@ class ContentTypeUpdatePage extends AdminUpdateItemPage { - public function fillFieldDefinitionFieldWithValue(string $fieldName, string $label, string $value) - { + public function fillFieldDefinitionFieldWithValue( + string $fieldName, + string $label, + string $value + ) { $this->expandLastFieldDefinition(); $this->getHTMLPage() ->find($this->getLocator('fieldDefinitionOpenContainer')) diff --git a/src/lib/Behat/Page/ContentUpdateItemPage.php b/src/lib/Behat/Page/ContentUpdateItemPage.php index bfecdb2c43..d728b98292 100644 --- a/src/lib/Behat/Page/ContentUpdateItemPage.php +++ b/src/lib/Behat/Page/ContentUpdateItemPage.php @@ -25,15 +25,15 @@ class ContentUpdateItemPage extends Page { - /** @var \Ibexa\AdminUi\Behat\Component\ContentActionsMenu */ + /** @var ContentActionsMenu */ private $contentActionsMenu; private $pageTitle; - /** @var \Ibexa\AdminUi\Behat\Component\Fields\FieldTypeComponent[] */ + /** @var FieldTypeComponent[] */ protected $fieldTypeComponents; - /** @var \Ibexa\AdminUi\Behat\Component\Notification */ + /** @var Notification */ private $notification; private string $languageCode; @@ -92,13 +92,18 @@ public function getName(): string return 'Content Update'; } - public function fillFieldWithValue(string $label, array $value, ?int $fieldPosition = null): void - { + public function fillFieldWithValue( + string $label, + array $value, + ?int $fieldPosition = null + ): void { $this->getField($label, $fieldPosition)->setValue($value); } - public function verifyValidationMessage(string $fieldName, string $expectedMessage): void - { + public function verifyValidationMessage( + string $fieldName, + string $expectedMessage + ): void { $this->getField($fieldName)->verifyValidationMessage($expectedMessage); } @@ -132,15 +137,20 @@ protected function getRoute(): string ); } - public function setExpectedContentDraftData(string $contentTypeIdentifier, string $languageCode, string $locationPath): void - { + public function setExpectedContentDraftData( + string $contentTypeIdentifier, + string $languageCode, + string $locationPath + ): void { $this->contentTypeIdentifier = $contentTypeIdentifier; $this->languageCode = $languageCode; $this->locationPath = $locationPath; } - public function getField(string $fieldName, ?int $fieldPosition = null): FieldTypeComponent - { + public function getField( + string $fieldName, + ?int $fieldPosition = null + ): FieldTypeComponent { if ($fieldPosition === null) { $fieldPosition = $this->getFieldPosition($fieldName); } @@ -204,13 +214,17 @@ protected function getFieldPosition(string $fieldName): int Assert::fail(sprintf('Field %s not found. Found: %s', $fieldName, implode(',', $foundFields))); } - public function verifyFieldHasValue(string $label, array $fieldData): void - { + public function verifyFieldHasValue( + string $label, + array $fieldData + ): void { $this->getField($label)->verifyValueInEditView($fieldData); } - private function getFieldtypeIdentifier(VisibleCSSLocator $fieldLocator, string $fieldName): string - { + private function getFieldtypeIdentifier( + VisibleCSSLocator $fieldLocator, + string $fieldName + ): string { $isEditable = !$this->getHTMLPage() ->find($fieldLocator) ->hasClass($this->getLocator('noneditableFieldClass')->getSelector()); diff --git a/src/lib/Behat/Page/ContentViewPage.php b/src/lib/Behat/Page/ContentViewPage.php index 64a78ee31a..5744aa7463 100644 --- a/src/lib/Behat/Page/ContentViewPage.php +++ b/src/lib/Behat/Page/ContentViewPage.php @@ -25,6 +25,7 @@ use Ibexa\AdminUi\Behat\Component\UpperMenu; use Ibexa\Behat\Browser\Element\Condition\ElementExistsCondition; use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion; +use Ibexa\Behat\Browser\Locator\CSSLocator; use Ibexa\Behat\Browser\Locator\VisibleCSSLocator; use Ibexa\Behat\Browser\Page\Page; use Ibexa\Behat\Browser\Routing\Router; @@ -36,51 +37,51 @@ class ContentViewPage extends Page { - /** @var \Ibexa\AdminUi\Behat\Component\ContentActionsMenu Element representing the right menu */ + /** @var ContentActionsMenu Element representing the right menu */ private $contentActionsMenu; - /** @var \Ibexa\AdminUi\Behat\Component\SubItemsList */ + /** @var SubItemsList */ private $subItemList; /** @var string */ private $locationPath; - /** @var \Ibexa\AdminUi\Behat\Component\ContentTypePicker */ + /** @var ContentTypePicker */ private $contentTypePicker; /** @var string */ private $expectedContentType; - /** @var \Ibexa\AdminUi\Behat\Component\LanguagePicker */ + /** @var LanguagePicker */ private $languagePicker; /** @var string */ private $expectedContentName; - /** @var \Ibexa\AdminUi\Behat\Component\Dialog */ + /** @var Dialog */ private $dialog; - /** @var \Ibexa\AdminUi\Behat\Component\TranslationDialog */ + /** @var TranslationDialog */ private $translationDialog; private $route; - /** @var \Ibexa\AdminUi\Behat\Component\Breadcrumb */ + /** @var Breadcrumb */ private $breadcrumb; - /** @var \Ibexa\AdminUi\Behat\Component\ContentItemAdminPreview */ + /** @var ContentItemAdminPreview */ private $contentItemAdminPreview; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ + /** @var Repository */ private $repository; /** @var \Ibexa\Behat\Core\Behat\ArgumentParser; */ private $argumentParser; - /** @var \Ibexa\AdminUi\Behat\Component\UniversalDiscoveryWidget */ + /** @var UniversalDiscoveryWidget */ private $universalDiscoveryWidget; - /** @var \Ibexa\AdminUi\Behat\Component\IbexaDropdown */ + /** @var IbexaDropdown */ private $ibexaDropdown; private UpperMenu $upperMenu; @@ -131,8 +132,10 @@ public function __construct( $this->tableBuilder = $tableBuilder; } - public function startCreatingContent(string $contentTypeName, ?string $language = null) - { + public function startCreatingContent( + string $contentTypeName, + ?string $language = null + ) { $this->contentActionsMenu->clickButton('Create content'); $this->contentTypePicker->verifyIsLoaded(); if ($language !== null) { @@ -179,8 +182,10 @@ public function addLocation(string $newLocationPath): void $this->universalDiscoveryWidget->confirm(); } - public function addTranslation(string $language, string $base): void - { + public function addTranslation( + string $language, + string $base + ): void { $this->getHTMLPage()->find($this->getLocator('addTranslationButton'))->click(); $this->translationDialog->verifyIsLoaded(); $this->translationDialog->selectNewTranslation($language); @@ -287,8 +292,11 @@ public function sendToTrash() $this->dialog->confirm(); } - public function verifyFieldHasValues(string $fieldLabel, array $expectedFieldValues, ?string $fieldTypeIdentifier) - { + public function verifyFieldHasValues( + string $fieldLabel, + array $expectedFieldValues, + ?string $fieldTypeIdentifier + ) { $this->contentItemAdminPreview->verifyFieldHasValues($fieldLabel, $expectedFieldValues, $fieldTypeIdentifier); } @@ -305,15 +313,20 @@ public function isBookmarked(): bool return $this->getHTMLPage()->find($this->getLocator('isBookmarked'))->isVisible(); } - public function createNewUrlAlias(string $path, string $languageName, bool $redirect): void - { + public function createNewUrlAlias( + string $path, + string $languageName, + bool $redirect + ): void { $this->getHTMLPage()->find($this->getLocator('addUrlAliasButton'))->click(); $this->createUrlAliasModal->createNewUrlAlias($path, $languageName, $redirect); } - public function isUrlAliasOnTheList(string $path, string $type): bool - { - /** @var \Ibexa\Behat\Browser\Locator\CSSLocator $locator */ + public function isUrlAliasOnTheList( + string $path, + string $type + ): bool { + /** @var CSSLocator $locator */ $locator = $this->getLocator('customUrlAliasesTable'); $customUrlAliasesTable = $this->tableBuilder->newTable()->withParentLocator($locator)->build(); @@ -364,8 +377,10 @@ private function getContentData(string $locationPath): array }); } - private function loadContent(Repository $repository, string $locationPath): Content - { + private function loadContent( + Repository $repository, + string $locationPath + ): Content { $this->getHTMLPage()->setTimeout(3)->waitUntil(static function () use ($repository, $locationPath) { $urlAlias = $repository->getURLAliasService()->lookup($locationPath); diff --git a/src/lib/Behat/Page/DashboardPage.php b/src/lib/Behat/Page/DashboardPage.php index 09a6dadc9b..f478a0f957 100644 --- a/src/lib/Behat/Page/DashboardPage.php +++ b/src/lib/Behat/Page/DashboardPage.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Behat\Page; use Behat\Mink\Session; +use Ibexa\AdminUi\Behat\Component\Table\Table; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; use Ibexa\Behat\Browser\Element\Criterion\ChildElementTextCriterion; use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion; @@ -18,17 +19,22 @@ class DashboardPage extends Page { - /** @var \Ibexa\AdminUi\Behat\Component\Table\Table */ + /** @var Table */ protected $table; - public function __construct(Session $session, Router $router, TableBuilder $tableBuilder) - { + public function __construct( + Session $session, + Router $router, + TableBuilder $tableBuilder + ) { parent::__construct($session, $router); $this->table = $tableBuilder->newTable()->withParentLocator($this->getLocator('table'))->build(); } - public function switchTab(string $tableName, string $tabName) - { + public function switchTab( + string $tableName, + string $tabName + ) { if ($this->getActiveTabName($tableName) == $tabName) { return; } else { diff --git a/src/lib/Behat/Page/LanguagePage.php b/src/lib/Behat/Page/LanguagePage.php index fe85fd8fe2..ffea7ada30 100644 --- a/src/lib/Behat/Page/LanguagePage.php +++ b/src/lib/Behat/Page/LanguagePage.php @@ -10,6 +10,7 @@ use Behat\Mink\Session; use Ibexa\AdminUi\Behat\Component\Dialog; +use Ibexa\AdminUi\Behat\Component\Table\Table; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; use Ibexa\Behat\Browser\Element\Criterion\ChildElementTextCriterion; use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion; @@ -24,20 +25,25 @@ class LanguagePage extends Page /** @var string */ private $expectedLanguageName; - /** @var \Ibexa\AdminUi\Behat\Component\Table\Table */ + /** @var Table */ private $table; - /** @var \Ibexa\AdminUi\Behat\Component\Dialog */ + /** @var Dialog */ private $dialog; /** @var int */ private $expectedLanguageId; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ + /** @var Repository */ private $repository; - public function __construct(Session $session, Router $router, TableBuilder $tableBuilder, Dialog $dialog, Repository $repository) - { + public function __construct( + Session $session, + Router $router, + TableBuilder $tableBuilder, + Dialog $dialog, + Repository $repository + ) { parent::__construct($session, $router); $this->table = $tableBuilder->newTable()->build(); $this->dialog = $dialog; diff --git a/src/lib/Behat/Page/LanguagesPage.php b/src/lib/Behat/Page/LanguagesPage.php index 9b739ae338..2a5840f2c0 100644 --- a/src/lib/Behat/Page/LanguagesPage.php +++ b/src/lib/Behat/Page/LanguagesPage.php @@ -10,6 +10,7 @@ use Behat\Mink\Session; use Ibexa\AdminUi\Behat\Component\Dialog; +use Ibexa\AdminUi\Behat\Component\Table\Table; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; use Ibexa\Behat\Browser\Locator\VisibleCSSLocator; use Ibexa\Behat\Browser\Page\Page; @@ -17,14 +18,18 @@ class LanguagesPage extends Page { - /** @var \Ibexa\AdminUi\Behat\Component\Table\Table */ + /** @var Table */ private $table; - /** @var \Ibexa\AdminUi\Behat\Component\Dialog */ + /** @var Dialog */ private $dialog; - public function __construct(Session $session, Router $router, TableBuilder $tableBuilder, Dialog $dialog) - { + public function __construct( + Session $session, + Router $router, + TableBuilder $tableBuilder, + Dialog $dialog + ) { parent::__construct($session, $router); $this->table = $tableBuilder->newTable()->build(); $this->dialog = $dialog; diff --git a/src/lib/Behat/Page/MyDraftsPage.php b/src/lib/Behat/Page/MyDraftsPage.php index 69270b6acc..33007f2c93 100644 --- a/src/lib/Behat/Page/MyDraftsPage.php +++ b/src/lib/Behat/Page/MyDraftsPage.php @@ -21,8 +21,12 @@ final class MyDraftsPage extends Page private Dialog $dialog; - public function __construct(Session $session, Router $router, TableBuilder $tableBuilder, Dialog $dialog) - { + public function __construct( + Session $session, + Router $router, + TableBuilder $tableBuilder, + Dialog $dialog + ) { parent::__construct($session, $router); $this->table = $tableBuilder->newTable()->build(); $this->dialog = $dialog; diff --git a/src/lib/Behat/Page/ObjectStateGroupPage.php b/src/lib/Behat/Page/ObjectStateGroupPage.php index 283a1be9c9..a09950018d 100644 --- a/src/lib/Behat/Page/ObjectStateGroupPage.php +++ b/src/lib/Behat/Page/ObjectStateGroupPage.php @@ -10,6 +10,7 @@ use Behat\Mink\Session; use Ibexa\AdminUi\Behat\Component\Dialog; +use Ibexa\AdminUi\Behat\Component\Table\Table; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; use Ibexa\Behat\Browser\Element\Condition\ElementExistsCondition; use Ibexa\Behat\Browser\Element\Criterion\ChildElementTextCriterion; @@ -18,26 +19,32 @@ use Ibexa\Behat\Browser\Page\Page; use Ibexa\Behat\Browser\Routing\Router; use Ibexa\Contracts\Core\Repository\Repository; +use Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup; class ObjectStateGroupPage extends Page { /** @var string */ protected $expectedObjectStateGroupName; - /** @var \Ibexa\AdminUi\Behat\Component\Dialog */ + /** @var Dialog */ private $dialog; - /** @var \Ibexa\AdminUi\Behat\Component\Table\Table */ + /** @var Table */ private $objectStates; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ + /** @var Repository */ private $repository; /** @var mixed */ private $expectedObjectStateGroupId; - public function __construct(Session $session, Router $router, TableBuilder $tableBuilder, Dialog $dialog, Repository $repository) - { + public function __construct( + Session $session, + Router $router, + TableBuilder $tableBuilder, + Dialog $dialog, + Repository $repository + ) { parent::__construct($session, $router); $this->dialog = $dialog; $this->objectStates = $tableBuilder->newTable()->withParentLocator($this->getLocator('objectStatesTable'))->build(); @@ -58,7 +65,7 @@ public function setExpectedObjectStateGroupName(string $objectStateGroupName): v { $this->expectedObjectStateGroupName = $objectStateGroupName; - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup[] $objectStateGroups */ + /** @var ObjectStateGroup[] $objectStateGroups */ $objectStateGroups = $this->repository->sudo(function () { return $this->repository->getObjectStateService()->loadObjectStateGroups(); }); @@ -75,8 +82,10 @@ public function hasObjectStates(): bool return count($this->objectStates->getColumnValues(['Object state name'])) > 0; } - public function hasAttribute($label, $value): bool - { + public function hasAttribute( + $label, + $value + ): bool { return $this->getHTMLPage() ->findAll($this->getLocator('objectStateGroupAttribute')) ->getByCriterion(new ChildElementTextCriterion($this->getLocator('label'), $label)) diff --git a/src/lib/Behat/Page/ObjectStateGroupsPage.php b/src/lib/Behat/Page/ObjectStateGroupsPage.php index 6557c65b37..4fcf5fcc55 100644 --- a/src/lib/Behat/Page/ObjectStateGroupsPage.php +++ b/src/lib/Behat/Page/ObjectStateGroupsPage.php @@ -10,6 +10,7 @@ use Behat\Mink\Session; use Ibexa\AdminUi\Behat\Component\Dialog; +use Ibexa\AdminUi\Behat\Component\Table\Table; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; use Ibexa\Behat\Browser\Locator\VisibleCSSLocator; use Ibexa\Behat\Browser\Page\Page; @@ -18,14 +19,18 @@ class ObjectStateGroupsPage extends Page { - /** @var \Ibexa\AdminUi\Behat\Component\Table\Table */ + /** @var Table */ private $table; - /** @var \Ibexa\AdminUi\Behat\Component\Dialog */ + /** @var Dialog */ private $dialog; - public function __construct(Session $session, Router $router, TableBuilder $tableBuilder, Dialog $dialog) - { + public function __construct( + Session $session, + Router $router, + TableBuilder $tableBuilder, + Dialog $dialog + ) { parent::__construct($session, $router); $this->table = $tableBuilder->newTable()->build(); $this->dialog = $dialog; diff --git a/src/lib/Behat/Page/ObjectStatePage.php b/src/lib/Behat/Page/ObjectStatePage.php index deb8ab0af4..fe6767574e 100644 --- a/src/lib/Behat/Page/ObjectStatePage.php +++ b/src/lib/Behat/Page/ObjectStatePage.php @@ -23,20 +23,25 @@ class ObjectStatePage extends Page /** @var string */ private $expectedObjectStateName; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ + /** @var Repository */ private $repository; /** @var mixed */ private $expectedObjectStateId; - public function __construct(Session $session, Router $router, Repository $repository) - { + public function __construct( + Session $session, + Router $router, + Repository $repository + ) { parent::__construct($session, $router); $this->repository = $repository; } - public function hasAttribute($label, $value) - { + public function hasAttribute( + $label, + $value + ) { return $this->getHTMLPage() ->findAll($this->getLocator('objectStateAttribute')) ->getByCriterion(new ChildElementTextCriterion($this->getLocator('label'), $label)) diff --git a/src/lib/Behat/Page/RolePage.php b/src/lib/Behat/Page/RolePage.php index d76d3dd981..fe09c31911 100644 --- a/src/lib/Behat/Page/RolePage.php +++ b/src/lib/Behat/Page/RolePage.php @@ -10,6 +10,7 @@ use Behat\Mink\Session; use Ibexa\AdminUi\Behat\Component\Dialog; +use Ibexa\AdminUi\Behat\Component\Table\Table; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; use Ibexa\AdminUi\Behat\Component\TableNavigationTab; use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion; @@ -17,28 +18,29 @@ use Ibexa\Behat\Browser\Page\Page; use Ibexa\Behat\Browser\Routing\Router; use Ibexa\Contracts\Core\Repository\Repository; +use Ibexa\Contracts\Core\Repository\Values\User\Role; use PHPUnit\Framework\Assert; class RolePage extends Page { - /** @var \Ibexa\AdminUi\Behat\Component\Dialog */ + /** @var Dialog */ public $dialog; /** @var string */ private $expectedRoleName; - /** @var \Ibexa\AdminUi\Behat\Component\TableNavigationTab */ + /** @var TableNavigationTab */ private $tableNavigationTab; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ + /** @var Repository */ private $repository; private $expectedRoleId; - /** @var \Ibexa\AdminUi\Behat\Component\Table\Table */ + /** @var Table */ private $policies; - /** @var \Ibexa\AdminUi\Behat\Component\Table\Table */ + /** @var Table */ private $assignments; public function __construct( @@ -66,8 +68,10 @@ public function __construct( * * @return bool */ - public function isRoleWithLimitationPresent(string $moduleAndFunction, string $limitation): bool - { + public function isRoleWithLimitationPresent( + string $moduleAndFunction, + string $limitation + ): bool { $this->tableNavigationTab->goToTab('Policies'); $actualPoliciesList = $this->policies->getColumnValues(['Module', 'Function', 'Limitations']); @@ -86,8 +90,10 @@ public function isRoleWithLimitationPresent(string $moduleAndFunction, string $l return false; } - private function isLimitationCorrect(string $expectedLimitation, string $actualLimitations): bool - { + private function isLimitationCorrect( + string $expectedLimitation, + string $actualLimitations + ): bool { if ($expectedLimitation === 'None') { return $actualLimitations === 'None'; } @@ -121,7 +127,7 @@ public function setExpectedRoleName(string $roleName) { $this->expectedRoleName = $roleName; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role[] $roles */ + /** @var Role[] $roles */ $roles = $this->repository->sudo(static function (Repository $repository) { return $repository->getRoleService()->loadRoles(); }); @@ -245,8 +251,10 @@ public function createPolicy(): void ->click(); } - public function editPolicy(string $moduleName, string $functionName): void - { + public function editPolicy( + string $moduleName, + string $functionName + ): void { $this->policies->getTableRow(['Module' => $moduleName, 'Function' => $functionName])->edit(); } } diff --git a/src/lib/Behat/Page/RoleUpdatePage.php b/src/lib/Behat/Page/RoleUpdatePage.php index 7d912c0c63..8fd7609790 100644 --- a/src/lib/Behat/Page/RoleUpdatePage.php +++ b/src/lib/Behat/Page/RoleUpdatePage.php @@ -21,22 +21,29 @@ class RoleUpdatePage extends AdminUpdateItemPage { - /** @var \Ibexa\AdminUi\Behat\Component\UniversalDiscoveryWidget */ + /** @var UniversalDiscoveryWidget */ private $universalDiscoveryWidget; - /** @var \Ibexa\AdminUi\Behat\Component\IbexaDropdown */ + /** @var IbexaDropdown */ private $ibexaDropdown; - public function __construct(Session $session, Router $router, ContentActionsMenu $contentActionsMenu, UniversalDiscoveryWidget $universalDiscoveryWidget, IbexaDropdown $ibexaDropdown) - { + public function __construct( + Session $session, + Router $router, + ContentActionsMenu $contentActionsMenu, + UniversalDiscoveryWidget $universalDiscoveryWidget, + IbexaDropdown $ibexaDropdown + ) { parent::__construct($session, $router, $contentActionsMenu); $this->universalDiscoveryWidget = $universalDiscoveryWidget; $this->ibexaDropdown = $ibexaDropdown; $this->locators->replace(new VisibleCSSLocator('button', '.ibexa-edit-content__container button')); } - public function selectLimitationValues(string $selectName, array $values): void - { + public function selectLimitationValues( + string $selectName, + array $values + ): void { try { $currentlySelectedElementsCount = $this->getHTMLPage() ->findAll($this->getLocator('limitationField')) @@ -92,8 +99,10 @@ public function specifyLocators(): array ); } - public function assign(array $itemPaths, string $itemType) - { + public function assign( + array $itemPaths, + string $itemType + ) { $itemTypeToLabelMapping = [ 'users' => 'Select Users', 'groups' => 'Select User Groups', diff --git a/src/lib/Behat/Page/RolesPage.php b/src/lib/Behat/Page/RolesPage.php index 51cd576460..50f3b6e435 100644 --- a/src/lib/Behat/Page/RolesPage.php +++ b/src/lib/Behat/Page/RolesPage.php @@ -10,6 +10,7 @@ use Behat\Mink\Session; use Ibexa\AdminUi\Behat\Component\Dialog; +use Ibexa\AdminUi\Behat\Component\Table\Table; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion; use Ibexa\Behat\Browser\Locator\VisibleCSSLocator; @@ -19,21 +20,28 @@ class RolesPage extends Page { - /** @var \Ibexa\AdminUi\Behat\Component\Table\Table */ + /** @var Table */ private $table; - /** @var \Ibexa\AdminUi\Behat\Component\Dialog */ + /** @var Dialog */ private $dialog; - public function __construct(Session $session, Router $router, TableBuilder $tableBuilder, Dialog $dialog) - { + public function __construct( + Session $session, + Router $router, + TableBuilder $tableBuilder, + Dialog $dialog + ) { parent::__construct($session, $router); $this->table = $tableBuilder->newTable()->build(); $this->dialog = $dialog; } - public function verifyItemAttribute(string $label, string $value, string $itemName): void - { + public function verifyItemAttribute( + string $label, + string $value, + string $itemName + ): void { Assert::assertEquals( $value, $this->adminList->table->getTableCellValue($itemName, $label), diff --git a/src/lib/Behat/Page/SearchPage.php b/src/lib/Behat/Page/SearchPage.php index f8dd4f3d70..4ee5c23161 100644 --- a/src/lib/Behat/Page/SearchPage.php +++ b/src/lib/Behat/Page/SearchPage.php @@ -22,8 +22,12 @@ class SearchPage extends Page private UpperMenu $upperMenu; - public function __construct(Session $session, Router $router, TableBuilder $tableBuilder, UpperMenu $upperMenu) - { + public function __construct( + Session $session, + Router $router, + TableBuilder $tableBuilder, + UpperMenu $upperMenu + ) { parent::__construct($session, $router); $this->table = $tableBuilder ->newTable() diff --git a/src/lib/Behat/Page/SectionPage.php b/src/lib/Behat/Page/SectionPage.php index 072365ff37..45110c9781 100644 --- a/src/lib/Behat/Page/SectionPage.php +++ b/src/lib/Behat/Page/SectionPage.php @@ -11,6 +11,7 @@ use Behat\Mink\Session; use Ibexa\AdminUi\Behat\Component\Dialog; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; +use Ibexa\AdminUi\Behat\Component\Table\TableInterface; use Ibexa\Behat\Browser\Element\Condition\ElementExistsCondition; use Ibexa\Behat\Browser\Element\Criterion\ChildElementTextCriterion; use Ibexa\Behat\Browser\Element\Criterion\ElementTextCriterion; @@ -27,13 +28,13 @@ class SectionPage extends Page /** @var int */ private $expectedSectionId; - /** @var \Ibexa\AdminUi\Behat\Component\Table\TableInterface */ + /** @var TableInterface */ private $contentItemsTable; - /** @var \Ibexa\AdminUi\Behat\Component\Dialog */ + /** @var Dialog */ private $dialog; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ + /** @var Repository */ private $repository; public function __construct( diff --git a/src/lib/Behat/Page/SectionsPage.php b/src/lib/Behat/Page/SectionsPage.php index 3dd0babe13..bc8b50e3be 100644 --- a/src/lib/Behat/Page/SectionsPage.php +++ b/src/lib/Behat/Page/SectionsPage.php @@ -11,6 +11,7 @@ use Behat\Mink\Session; use Ibexa\AdminUi\Behat\Component\Dialog; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; +use Ibexa\AdminUi\Behat\Component\Table\TableInterface; use Ibexa\Behat\Browser\Locator\VisibleCSSLocator; use Ibexa\Behat\Browser\Page\Page; use Ibexa\Behat\Browser\Routing\Router; @@ -18,14 +19,18 @@ class SectionsPage extends Page { - /** @var \Ibexa\AdminUi\Behat\Component\Table\TableInterface */ + /** @var TableInterface */ private $table; - /** @var \Ibexa\AdminUi\Behat\Component\Dialog */ + /** @var Dialog */ private $dialog; - public function __construct(Session $session, Router $router, TableBuilder $tableBuilder, Dialog $dialog) - { + public function __construct( + Session $session, + Router $router, + TableBuilder $tableBuilder, + Dialog $dialog + ) { parent::__construct($session, $router); $this->table = $tableBuilder->newTable()->withParentLocator($this->getLocator('tableContainer'))->build(); $this->dialog = $dialog; diff --git a/src/lib/Behat/Page/SystemInfoPage.php b/src/lib/Behat/Page/SystemInfoPage.php index 5775e810b5..c38ace377f 100644 --- a/src/lib/Behat/Page/SystemInfoPage.php +++ b/src/lib/Behat/Page/SystemInfoPage.php @@ -10,6 +10,7 @@ use Behat\Mink\Session; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; +use Ibexa\AdminUi\Behat\Component\Table\TableInterface; use Ibexa\AdminUi\Behat\Component\TableNavigationTab; use Ibexa\Behat\Browser\Locator\LocatorInterface; use Ibexa\Behat\Browser\Locator\VisibleCSSLocator; @@ -20,14 +21,18 @@ class SystemInfoPage extends Page { - /** @var \Ibexa\AdminUi\Behat\Component\TableNavigationTab */ + /** @var TableNavigationTab */ protected $tableNavigationTab; - /** @var \Ibexa\AdminUi\Behat\Component\Table\TableInterface */ + /** @var TableInterface */ private $table; - public function __construct(Session $session, Router $router, TableNavigationTab $tableNavigationTab, TableBuilder $tableBuilder) - { + public function __construct( + Session $session, + Router $router, + TableNavigationTab $tableNavigationTab, + TableBuilder $tableBuilder + ) { parent::__construct($session, $router); $this->tableNavigationTab = $tableNavigationTab; diff --git a/src/lib/Behat/Page/TrashPage.php b/src/lib/Behat/Page/TrashPage.php index 4c56a3472c..35e6243b4b 100644 --- a/src/lib/Behat/Page/TrashPage.php +++ b/src/lib/Behat/Page/TrashPage.php @@ -11,6 +11,7 @@ use Behat\Mink\Session; use Ibexa\AdminUi\Behat\Component\ContentActionsMenu; use Ibexa\AdminUi\Behat\Component\Dialog; +use Ibexa\AdminUi\Behat\Component\Table\Table; use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; use Ibexa\AdminUi\Behat\Component\TrashSearch; use Ibexa\AdminUi\Behat\Component\UniversalDiscoveryWidget; @@ -21,19 +22,19 @@ class TrashPage extends Page { - /** @var \Ibexa\AdminUi\Behat\Component\Dialog */ + /** @var Dialog */ public $dialog; - /** @var \Ibexa\AdminUi\Behat\Component\UniversalDiscoveryWidget */ + /** @var UniversalDiscoveryWidget */ private $universalDiscoveryWidget; - /** @var \Ibexa\AdminUi\Behat\Component\ContentActionsMenu */ + /** @var ContentActionsMenu */ private $contentActionsMenu; - /** @var \Ibexa\AdminUi\Behat\Component\Table\Table */ + /** @var Table */ private $table; - /** @var \Ibexa\AdminUi\Behat\Component\TrashSearch */ + /** @var TrashSearch */ private TrashSearch $trashSearch; public function __construct( @@ -53,8 +54,10 @@ public function __construct( $this->trashSearch = $trashSearch; } - public function hasElement(string $itemType, string $itemName): bool - { + public function hasElement( + string $itemType, + string $itemName + ): bool { return $this->table->hasElement(['Name' => $itemName, 'Content type' => $itemType]); } diff --git a/src/lib/Behat/Page/UserProfilePage.php b/src/lib/Behat/Page/UserProfilePage.php index b2c7d742b4..592db148f0 100644 --- a/src/lib/Behat/Page/UserProfilePage.php +++ b/src/lib/Behat/Page/UserProfilePage.php @@ -20,8 +20,11 @@ final class UserProfilePage extends Page private ContentFacade $contentFacade; - public function __construct(Session $session, Router $router, ContentFacade $contentFacade) - { + public function __construct( + Session $session, + Router $router, + ContentFacade $contentFacade + ) { parent::__construct($session, $router); $this->contentFacade = $contentFacade; } @@ -39,8 +42,13 @@ public function editSummary(): void $this->getHTMLPage()->find($this->getLocator('editButton'))->click(); } - public function verifyUserProfileSummary(string $fullName, string $email, string $jobTitle, string $department, string $location): void - { + public function verifyUserProfileSummary( + string $fullName, + string $email, + string $jobTitle, + string $department, + string $location + ): void { $this->getHTMLPage()->setTimeout(5)->find($this->getLocator('fullName'))->assert()->textContains($fullName); $this->getHTMLPage()->setTimeout(5)->find($this->getLocator('email'))->assert()->textEquals($email); $this->getHTMLPage()->setTimeout(5)->find($this->getLocator('jobTitle'))->assert()->textEquals($jobTitle); diff --git a/src/lib/Behat/Page/UserSettingsPage.php b/src/lib/Behat/Page/UserSettingsPage.php index fbcf7bcb06..ca058aaffb 100644 --- a/src/lib/Behat/Page/UserSettingsPage.php +++ b/src/lib/Behat/Page/UserSettingsPage.php @@ -26,8 +26,13 @@ class UserSettingsPage extends Page private IbexaDropdown $ibexaDropdown; - public function __construct(Session $session, Router $router, ContentActionsMenu $contentActionsMenu, TableNavigationTab $tableNavigationTab, IbexaDropdown $ibexaDropdown) - { + public function __construct( + Session $session, + Router $router, + ContentActionsMenu $contentActionsMenu, + TableNavigationTab $tableNavigationTab, + IbexaDropdown $ibexaDropdown + ) { parent::__construct($session, $router); $this->contentActionsMenu = $contentActionsMenu; $this->tableNavigationTab = $tableNavigationTab; diff --git a/src/lib/Component/Content/ContentEditMetaFieldsComponent.php b/src/lib/Component/Content/ContentEditMetaFieldsComponent.php index eded49ad20..71649945f8 100644 --- a/src/lib/Component/Content/ContentEditMetaFieldsComponent.php +++ b/src/lib/Component/Content/ContentEditMetaFieldsComponent.php @@ -38,7 +38,7 @@ public function __construct( */ public function render(array $parameters = []): string { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType */ + /** @var ContentType $contentType */ $contentType = $parameters['content_type']; $metaFieldTypeIdentifiers = $this->getMetaFieldTypeIdentifiers(); diff --git a/src/lib/Component/Content/PreviewUnavailableTwigComponent.php b/src/lib/Component/Content/PreviewUnavailableTwigComponent.php index 1c6fef07f0..668e8ad245 100644 --- a/src/lib/Component/Content/PreviewUnavailableTwigComponent.php +++ b/src/lib/Component/Content/PreviewUnavailableTwigComponent.php @@ -8,29 +8,31 @@ namespace Ibexa\AdminUi\Component\Content; +use Ibexa\AdminUi\Siteaccess\NonAdminSiteaccessResolver; use Ibexa\AdminUi\Siteaccess\SiteaccessResolverInterface; use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Values\Content\Content; +use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\TwigComponents\ComponentInterface; use Twig\Environment; class PreviewUnavailableTwigComponent implements ComponentInterface { - /** @var \Twig\Environment */ + /** @var Environment */ private $twig; - /** @var \Ibexa\AdminUi\Siteaccess\NonAdminSiteaccessResolver */ + /** @var NonAdminSiteaccessResolver */ private $siteaccessResolver; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; /** - * @param \Twig\Environment $twig - * @param \Ibexa\AdminUi\Siteaccess\NonAdminSiteaccessResolver $siteaccessResolver - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService + * @param Environment $twig + * @param NonAdminSiteaccessResolver $siteaccessResolver + * @param LocationService $locationService */ public function __construct( Environment $twig, @@ -49,11 +51,11 @@ public function __construct( */ public function render(array $parameters = []): string { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $parameters['location']; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $parameters['content']; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language $language */ + /** @var Language $language */ $language = $parameters['language']; $versionNo = $content->getVersionInfo()->versionNo; diff --git a/src/lib/Component/ContentType/ContentTypeEditMetaFieldsComponent.php b/src/lib/Component/ContentType/ContentTypeEditMetaFieldsComponent.php index cc58efedd9..8f920c055b 100644 --- a/src/lib/Component/ContentType/ContentTypeEditMetaFieldsComponent.php +++ b/src/lib/Component/ContentType/ContentTypeEditMetaFieldsComponent.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Component\ContentType; use Ibexa\AdminUi\Config\AdminUiForms\ContentTypeFieldTypesResolverInterface; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\TwigComponents\ComponentInterface; use Twig\Environment; @@ -33,7 +34,7 @@ public function __construct( */ public function render(array $parameters = []): string { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType */ + /** @var ContentType $contentType */ $contentType = $parameters['content_type']; $metaFieldTypeIdentifiers = $this->contentTypeFieldTypesResolver->getMetaFieldTypeIdentifiers(); diff --git a/src/lib/Component/Event/RenderGroupEvent.php b/src/lib/Component/Event/RenderGroupEvent.php index a2e5e2cba2..b8855782a7 100644 --- a/src/lib/Component/Event/RenderGroupEvent.php +++ b/src/lib/Component/Event/RenderGroupEvent.php @@ -12,14 +12,14 @@ use Symfony\Contracts\EventDispatcher\Event; /** - * @deprecated 4.6.19 The {@see \Ibexa\AdminUi\Component\Event\RenderGroupEvent} class is deprecated, will be removed in 6.0. + * @deprecated 4.6.19 The {@see RenderGroupEvent} class is deprecated, will be removed in 6.0. * Use {@see \Ibexa\Contracts\TwigComponents\Event\RenderGroupEvent} instead */ class RenderGroupEvent extends Event { public const NAME = 'ezplatform_admin_ui.component.render_group'; - /** @var \Ibexa\AdminUi\Component\Registry */ + /** @var Registry */ private $registry; /** @var string */ @@ -29,12 +29,15 @@ class RenderGroupEvent extends Event private $parameters; /** - * @param \Ibexa\AdminUi\Component\Registry $registry + * @param Registry $registry * @param string $groupName * @param array $parameters */ - public function __construct(Registry $registry, string $groupName, array $parameters = []) - { + public function __construct( + Registry $registry, + string $groupName, + array $parameters = [] + ) { $this->registry = $registry; $this->groupName = $groupName; $this->parameters = $parameters; diff --git a/src/lib/Component/Event/RenderSingleEvent.php b/src/lib/Component/Event/RenderSingleEvent.php index 6db624a092..3aa0983bb1 100644 --- a/src/lib/Component/Event/RenderSingleEvent.php +++ b/src/lib/Component/Event/RenderSingleEvent.php @@ -13,14 +13,14 @@ use Symfony\Contracts\EventDispatcher\Event; /** - * @deprecated 4.6.19 The {@see \Ibexa\AdminUi\Component\Event\RenderSingleEvent} class is deprecated, will be removed in 6.0. + * @deprecated 4.6.19 The {@see RenderSingleEvent} class is deprecated, will be removed in 6.0. * Use {@see \Ibexa\Contracts\TwigComponents\Event\RenderSingleEvent} instead */ class RenderSingleEvent extends Event { public const NAME = 'ezplatform_admin_ui.component.render_single'; - /** @var \Ibexa\AdminUi\Component\Registry */ + /** @var Registry */ private $registry; /** @var string */ @@ -33,12 +33,16 @@ class RenderSingleEvent extends Event private $parameters; /** - * @param \Ibexa\AdminUi\Component\Registry $registry + * @param Registry $registry * @param string $groupName * @param array $parameters */ - public function __construct(Registry $registry, string $groupName, string $serviceId, array $parameters = []) - { + public function __construct( + Registry $registry, + string $groupName, + string $serviceId, + array $parameters = [] + ) { $this->registry = $registry; $this->groupName = $groupName; $this->serviceId = $serviceId; @@ -62,7 +66,7 @@ public function getName(): string } /** - * @return \Ibexa\Contracts\TwigComponents\ComponentInterface + * @return ComponentInterface */ public function getComponent(): ComponentInterface { @@ -72,7 +76,7 @@ public function getComponent(): ComponentInterface } /** - * @param \Ibexa\Contracts\TwigComponents\ComponentInterface $component + * @param ComponentInterface $component */ public function setComponent(ComponentInterface $component) { diff --git a/src/lib/Component/LinkComponent.php b/src/lib/Component/LinkComponent.php index 4837dd911a..884f6a1ea3 100644 --- a/src/lib/Component/LinkComponent.php +++ b/src/lib/Component/LinkComponent.php @@ -12,12 +12,12 @@ use Twig\Environment; /** - * @deprecated 4.6.19 The {@see \Ibexa\AdminUi\Component\LinkComponent} class is deprecated, will be removed in 6.0. + * @deprecated 4.6.19 The {@see LinkComponent} class is deprecated, will be removed in 6.0. * Use {@see \Ibexa\TwigComponents\Component\LinkComponent} instead */ class LinkComponent implements ComponentInterface { - /** @var \Twig\Environment */ + /** @var Environment */ protected $twig; /** @var string */ diff --git a/src/lib/Component/Registry.php b/src/lib/Component/Registry.php index 15500e0e45..352da9b23f 100644 --- a/src/lib/Component/Registry.php +++ b/src/lib/Component/Registry.php @@ -12,8 +12,8 @@ use Ibexa\TwigComponents\Component\Registry as TwigComponentsRegistry; /** - * @deprecated 4.6.19 The {@see \Ibexa\AdminUi\Component\Registry} class is deprecated, will be removed in 6.0. - * Use {@see \Ibexa\TwigComponents\Component\Registry} instead + * @deprecated 4.6.19 The {@see Registry} class is deprecated, will be removed in 6.0. + * Use {@see TwigComponentsRegistry} instead */ class Registry { @@ -89,8 +89,11 @@ public function __construct(TwigComponentsRegistry $inner) $this->inner = $inner; } - public function addComponent(string $group, string $serviceId, ComponentInterface $component): void - { + public function addComponent( + string $group, + string $serviceId, + ComponentInterface $component + ): void { $this->triggerDeprecation(); $group = $this->prefixGroupIfNeeded($group); @@ -98,7 +101,7 @@ public function addComponent(string $group, string $serviceId, ComponentInterfac } /** - * @return \Ibexa\Contracts\TwigComponents\ComponentInterface[] + * @return ComponentInterface[] */ public function getComponents(string $group): array { @@ -109,10 +112,12 @@ public function getComponents(string $group): array } /** - * @param \Ibexa\Contracts\TwigComponents\ComponentInterface[] $components + * @param ComponentInterface[] $components */ - public function setComponents(string $group, array $components) - { + public function setComponents( + string $group, + array $components + ) { $this->triggerDeprecation(); $group = $this->prefixGroupIfNeeded($group); diff --git a/src/lib/Component/Renderer/DefaultRenderer.php b/src/lib/Component/Renderer/DefaultRenderer.php index c704c0e98a..bb03dba787 100644 --- a/src/lib/Component/Renderer/DefaultRenderer.php +++ b/src/lib/Component/Renderer/DefaultRenderer.php @@ -12,8 +12,8 @@ use Ibexa\TwigComponents\Component\Renderer\DefaultRenderer as TwigComponentsDefaultRenderer; /** - * @deprecated 4.6.19 The {@see \Ibexa\AdminUi\Component\Renderer\DefaultRenderer} class is deprecated, will be removed in 6.0. - * Use {@see \Ibexa\TwigComponents\Component\Renderer\DefaultRenderer} instead + * @deprecated 4.6.19 The {@see DefaultRenderer} class is deprecated, will be removed in 6.0. + * Use {@see TwigComponentsDefaultRenderer} instead */ class DefaultRenderer implements RendererInterface { @@ -24,13 +24,18 @@ public function __construct(TwigComponentsDefaultRenderer $inner) $this->inner = $inner; } - public function renderGroup(string $groupName, array $parameters = []): array - { + public function renderGroup( + string $groupName, + array $parameters = [] + ): array { return $this->inner->renderGroup($groupName, $parameters); } - public function renderSingle(string $name, $groupName, array $parameters = []): string - { + public function renderSingle( + string $name, + $groupName, + array $parameters = [] + ): string { return $this->inner->renderSingle($name, $groupName, $parameters); } } diff --git a/src/lib/Component/ScriptComponent.php b/src/lib/Component/ScriptComponent.php index 91bc4f29fa..3775cd0b34 100644 --- a/src/lib/Component/ScriptComponent.php +++ b/src/lib/Component/ScriptComponent.php @@ -12,12 +12,12 @@ use Twig\Environment; /** - * @deprecated 4.6.19 The {@see \Ibexa\AdminUi\Component\ScriptComponent} class is deprecated, will be removed in 6.0. + * @deprecated 4.6.19 The {@see ScriptComponent} class is deprecated, will be removed in 6.0. * Use {@see \Ibexa\TwigComponents\Component\ScriptComponent} instead */ class ScriptComponent implements ComponentInterface { - /** @var \Twig\Environment */ + /** @var Environment */ protected $twig; /** @var string */ diff --git a/src/lib/Component/Search/GlobalSearchTwigComponent.php b/src/lib/Component/Search/GlobalSearchTwigComponent.php index 218f4e5b25..65d5b7dbe8 100644 --- a/src/lib/Component/Search/GlobalSearchTwigComponent.php +++ b/src/lib/Component/Search/GlobalSearchTwigComponent.php @@ -17,13 +17,13 @@ final class GlobalSearchTwigComponent implements ComponentInterface { - /** @var \Twig\Environment */ + /** @var Environment */ private $twig; - /** @var \Symfony\Component\Form\FormFactoryInterface */ + /** @var FormFactoryInterface */ private $formFactory; - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ + /** @var UrlGeneratorInterface */ private $urlGenerator; public function __construct( diff --git a/src/lib/Component/TabsComponent.php b/src/lib/Component/TabsComponent.php index 664963efb4..552843afb2 100644 --- a/src/lib/Component/TabsComponent.php +++ b/src/lib/Component/TabsComponent.php @@ -19,10 +19,10 @@ class TabsComponent implements ComponentInterface { - /** @var \Twig\Environment */ + /** @var Environment */ protected $twig; - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ + /** @var EventDispatcherInterface */ protected $eventDispatcher; /** @var string */ @@ -73,8 +73,10 @@ public function render(array $parameters = []): string ); } - private function dispatchTabPreRenderEvent(TabInterface $tab, array $parameters): TabEvent - { + private function dispatchTabPreRenderEvent( + TabInterface $tab, + array $parameters + ): TabEvent { $tabEvent = new TabEvent(); $tabEvent->setData($tab); $tabEvent->setParameters($parameters); @@ -84,8 +86,10 @@ private function dispatchTabPreRenderEvent(TabInterface $tab, array $parameters) return $tabEvent; } - private function composeTabParameters(TabInterface $tab, array $parameters): array - { + private function composeTabParameters( + TabInterface $tab, + array $parameters + ): array { return [ 'name' => $tab->getName(), 'view' => $tab->renderView($parameters), diff --git a/src/lib/Component/TwigComponent.php b/src/lib/Component/TwigComponent.php index 01d69f0630..13d30d30b6 100644 --- a/src/lib/Component/TwigComponent.php +++ b/src/lib/Component/TwigComponent.php @@ -9,25 +9,26 @@ namespace Ibexa\AdminUi\Component; use Ibexa\Contracts\TwigComponents\ComponentInterface; +use Ibexa\TwigComponents\Component\TemplateComponent; use Twig\Environment; /** - * @deprecated 4.6.19 The {@see \Ibexa\AdminUi\Component\TwigComponent} class is deprecated, will be removed in 6.0. - * Use {@see \Ibexa\TwigComponents\Component\TemplateComponent} instead + * @deprecated 4.6.19 The {@see TwigComponent} class is deprecated, will be removed in 6.0. + * Use {@see TemplateComponent} instead */ class TwigComponent implements ComponentInterface { /** @var string */ protected $template; - /** @var \Twig\Environment */ + /** @var Environment */ protected $twig; /** @var array */ protected $parameters; /** - * @param \Twig\Environment $twig + * @param Environment $twig * @param string $template * @param array $parameters */ diff --git a/src/lib/ContentType/ContentTypeFieldsByExpressionService.php b/src/lib/ContentType/ContentTypeFieldsByExpressionService.php index 69e5044ece..d30b3cf4dd 100644 --- a/src/lib/ContentType/ContentTypeFieldsByExpressionService.php +++ b/src/lib/ContentType/ContentTypeFieldsByExpressionService.php @@ -54,8 +54,10 @@ public function getFieldsFromExpression(string $expression): array return $contentTypeFieldDefinitions; } - public function isFieldIncludedInExpression(FieldDefinition $fieldDefinition, string $expression): bool - { + public function isFieldIncludedInExpression( + FieldDefinition $fieldDefinition, + string $expression + ): bool { return $this->fieldsExtractor->isFieldWithinExpression($fieldDefinition->getId(), $expression); } } diff --git a/src/lib/Event/AddContentTypeGroupToUIConfigEvent.php b/src/lib/Event/AddContentTypeGroupToUIConfigEvent.php index 7eba95894c..6704956462 100644 --- a/src/lib/Event/AddContentTypeGroupToUIConfigEvent.php +++ b/src/lib/Event/AddContentTypeGroupToUIConfigEvent.php @@ -13,11 +13,11 @@ final class AddContentTypeGroupToUIConfigEvent extends Event { - /** @var array<\Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup> */ + /** @var array */ private array $contentTypeGroups; /** - * @param array<\Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup> $contentTypeGroups + * @param array $contentTypeGroups */ public function __construct(array $contentTypeGroups) { @@ -25,7 +25,7 @@ public function __construct(array $contentTypeGroups) } /** - * @return array<\Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup> + * @return array */ public function getContentTypeGroups(): array { diff --git a/src/lib/Event/CancelEditVersionDraftEvent.php b/src/lib/Event/CancelEditVersionDraftEvent.php index ce97b6ed62..384b45d875 100644 --- a/src/lib/Event/CancelEditVersionDraftEvent.php +++ b/src/lib/Event/CancelEditVersionDraftEvent.php @@ -15,13 +15,13 @@ final class CancelEditVersionDraftEvent extends Event { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ + /** @var Content */ private $content; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ + /** @var Location */ private $referrerLocation; - /** @var \Symfony\Component\HttpFoundation\Response|null */ + /** @var Response|null */ private $response; public function __construct( diff --git a/src/lib/Event/Options.php b/src/lib/Event/Options.php index d196e9d61f..a4ff1143e5 100644 --- a/src/lib/Event/Options.php +++ b/src/lib/Event/Options.php @@ -40,8 +40,10 @@ public function has(string $key): bool return isset($this->options[$key]); } - public function set(string $key, $value): void - { + public function set( + string $key, + $value + ): void { $this->options[$key] = $value; } diff --git a/src/lib/EventListener/AdminExceptionListener.php b/src/lib/EventListener/AdminExceptionListener.php index 3d4ce1e3da..5fe3679124 100644 --- a/src/lib/EventListener/AdminExceptionListener.php +++ b/src/lib/EventListener/AdminExceptionListener.php @@ -13,6 +13,7 @@ use Ibexa\Core\MVC\Symfony\SiteAccess; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; +use Psr\Log\LogLevel; use SplFileInfo; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpFoundation\Response; @@ -28,16 +29,16 @@ class AdminExceptionListener implements LoggerAwareInterface { use LoggerAwareTrait; - /** @var \Ibexa\Contracts\AdminUi\Notification\NotificationHandlerInterface */ + /** @var NotificationHandlerInterface */ protected $notificationHandler; - /** @var \Twig\Environment */ + /** @var Environment */ protected $twig; - /** @var \Symfony\WebpackEncoreBundle\Asset\TagRenderer */ + /** @var TagRenderer */ protected $encoreTagRenderer; - /** @var \Symfony\WebpackEncoreBundle\Asset\EntrypointLookupCollectionInterface */ + /** @var EntrypointLookupCollectionInterface */ private $entrypointLookupCollection; /** @var array */ @@ -49,18 +50,18 @@ class AdminExceptionListener implements LoggerAwareInterface /** @var string */ protected $kernelEnvironment; - /** @var \Psr\Log\LogLevel::* */ + /** @var LogLevel::* */ private $logLevel; /** - * @param \Twig\Environment $twig - * @param \Ibexa\Contracts\AdminUi\Notification\NotificationHandlerInterface $notificationHandler - * @param \Symfony\WebpackEncoreBundle\Asset\TagRenderer $encoreTagRenderer - * @param \Symfony\WebpackEncoreBundle\Asset\EntrypointLookupCollectionInterface $entrypointLookupCollection + * @param Environment $twig + * @param NotificationHandlerInterface $notificationHandler + * @param TagRenderer $encoreTagRenderer + * @param EntrypointLookupCollectionInterface $entrypointLookupCollection * @param array $siteAccessGroups * @param string $kernelRootDir * @param string $kernelEnvironment - * @param \Psr\Log\LogLevel::* $logLevel + * @param LogLevel::* $logLevel */ public function __construct( Environment $twig, @@ -83,7 +84,7 @@ public function __construct( } /** - * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event + * @param ExceptionEvent $event */ public function onKernelException(ExceptionEvent $event) { @@ -140,7 +141,7 @@ public function onKernelException(ExceptionEvent $event) } /** - * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event + * @param ExceptionEvent $event * * @return bool */ @@ -148,14 +149,14 @@ private function isAdminException(ExceptionEvent $event): bool { $request = $event->getRequest(); - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess $siteAccess */ + /** @var SiteAccess $siteAccess */ $siteAccess = $request->get('siteaccess', new SiteAccess('default')); return \in_array($siteAccess->name, $this->siteAccessGroups[IbexaAdminUiBundle::ADMIN_GROUP_NAME]); } /** - * @param \Throwable $exception + * @param Throwable $exception * * @return string */ diff --git a/src/lib/EventListener/ContentDownloadRouteReferenceListener.php b/src/lib/EventListener/ContentDownloadRouteReferenceListener.php index a898ccb88a..1315a519c6 100644 --- a/src/lib/EventListener/ContentDownloadRouteReferenceListener.php +++ b/src/lib/EventListener/ContentDownloadRouteReferenceListener.php @@ -46,7 +46,7 @@ public function onRouteReferenceGeneration(RouteReferenceGenerationEvent $event) return; } - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess $siteaccess */ + /** @var SiteAccess $siteaccess */ $siteaccess = $event->getRequest()->attributes->get('siteaccess'); if ($this->isAdminSiteAccess($siteaccess)) { $routeReference->set('siteaccess', $siteaccess->name); diff --git a/src/lib/EventListener/ContentProxyCreateDraftListener.php b/src/lib/EventListener/ContentProxyCreateDraftListener.php index 1f3d3f4f54..9ad2863d45 100644 --- a/src/lib/EventListener/ContentProxyCreateDraftListener.php +++ b/src/lib/EventListener/ContentProxyCreateDraftListener.php @@ -136,8 +136,10 @@ public function translate(ContentProxyTranslateEvent $event): void $event->setResponse($response); } - private function getTranslatedContentFields(Content $content, string $languageCode): array - { + private function getTranslatedContentFields( + Content $content, + string $languageCode + ): array { $contentType = $content->getContentType(); $translatableFields = array_filter($content->getFields(), static function (Field $field) use ($contentType): bool { diff --git a/src/lib/EventListener/ContentTranslateViewFilterParametersListener.php b/src/lib/EventListener/ContentTranslateViewFilterParametersListener.php index fdafa42d00..7d10fe4868 100644 --- a/src/lib/EventListener/ContentTranslateViewFilterParametersListener.php +++ b/src/lib/EventListener/ContentTranslateViewFilterParametersListener.php @@ -9,6 +9,7 @@ use Ibexa\AdminUi\View\ContentTranslateView; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Core\MVC\Symfony\View\Event\FilterViewParametersEvent; use Ibexa\Core\MVC\Symfony\View\ViewEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -18,11 +19,11 @@ */ class ContentTranslateViewFilterParametersListener implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ protected $contentTypeService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService + * @param ContentTypeService $contentTypeService */ public function __construct( ContentTypeService $contentTypeService @@ -41,9 +42,9 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\Core\MVC\Symfony\View\Event\FilterViewParametersEvent $event + * @param FilterViewParametersEvent $event * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ public function onFilterViewParameters(FilterViewParametersEvent $event) { diff --git a/src/lib/EventListener/ContentTypeSuggestionsListener.php b/src/lib/EventListener/ContentTypeSuggestionsListener.php index fa5d15f023..b49d1a5762 100644 --- a/src/lib/EventListener/ContentTypeSuggestionsListener.php +++ b/src/lib/EventListener/ContentTypeSuggestionsListener.php @@ -14,6 +14,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Aggregation\ContentTypeTermAggregation; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ParentLocationId; +use Ibexa\Contracts\Core\Repository\Values\Content\Search\AggregationResult\TermAggregationResult; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -29,8 +30,11 @@ final class ContentTypeSuggestionsListener implements EventSubscriberInterface private int $limit; - public function __construct(SearchService $searchService, TranslatorInterface $translator, int $limit = 4) - { + public function __construct( + SearchService $searchService, + TranslatorInterface $translator, + int $limit = 4 + ) { $this->searchService = $searchService; $this->translator = $translator; $this->limit = $limit; @@ -70,10 +74,12 @@ public function onResolveContentTypes(ContentCreateContentTypeChoiceLoaderEvent } /** - * @param array $contentTypes + * @param array $contentTypes */ - private function isContentTypeAvailable(array $contentTypes, ContentType $needle): bool - { + private function isContentTypeAvailable( + array $contentTypes, + ContentType $needle + ): bool { foreach ($contentTypes as $group) { foreach ($group as $contentType) { if ($contentType->identifier === $needle->identifier) { @@ -96,7 +102,7 @@ private function getSuggestionsGroupLabel(): string } /** - * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[] + * @return ContentType[] */ private function getSuggestions(Location $location): array { @@ -112,7 +118,7 @@ private function getSuggestions(Location $location): array $results = $this->searchService->findLocations($query); if ($results->aggregations->has(self::SUGGESTIONS_AGGREGATION_KEY)) { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Search\AggregationResult\TermAggregationResult $aggregationResult */ + /** @var TermAggregationResult $aggregationResult */ $aggregationResult = $results->aggregations->get(self::SUGGESTIONS_AGGREGATION_KEY); $suggestions = []; diff --git a/src/lib/EventListener/CredentialsExpirationWarningListener.php b/src/lib/EventListener/CredentialsExpirationWarningListener.php index 7c7eb83e2d..bc1a5be4a9 100644 --- a/src/lib/EventListener/CredentialsExpirationWarningListener.php +++ b/src/lib/EventListener/CredentialsExpirationWarningListener.php @@ -23,16 +23,16 @@ final class CredentialsExpirationWarningListener implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\AdminUi\Notification\NotificationHandlerInterface */ + /** @var NotificationHandlerInterface */ private $notificationHandler; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ + /** @var UrlGeneratorInterface */ private $urlGenerator; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; /** @var string[][] */ diff --git a/src/lib/EventListener/CredentialsExpiredListener.php b/src/lib/EventListener/CredentialsExpiredListener.php index 54ffa427ed..f77d05fd60 100644 --- a/src/lib/EventListener/CredentialsExpiredListener.php +++ b/src/lib/EventListener/CredentialsExpiredListener.php @@ -19,18 +19,20 @@ final class CredentialsExpiredListener implements EventSubscriberInterface { - /** @var \Symfony\Component\HttpFoundation\RequestStack */ + /** @var RequestStack */ private $requestStack; /** @var string[][] */ private $siteAccessGroups; /** - * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack + * @param RequestStack $requestStack * @param string[] $siteAccessGroups */ - public function __construct(RequestStack $requestStack, array $siteAccessGroups) - { + public function __construct( + RequestStack $requestStack, + array $siteAccessGroups + ) { $this->requestStack = $requestStack; $this->siteAccessGroups = $siteAccessGroups; } diff --git a/src/lib/EventListener/MenuPermissionsListener.php b/src/lib/EventListener/MenuPermissionsListener.php index dc82899f6b..102ea954a2 100644 --- a/src/lib/EventListener/MenuPermissionsListener.php +++ b/src/lib/EventListener/MenuPermissionsListener.php @@ -10,16 +10,17 @@ use Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent; use Ibexa\AdminUi\Menu\MainMenuBuilder; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class MenuPermissionsListener implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; /** - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver + * @param PermissionResolver $permissionResolver */ public function __construct(PermissionResolver $permissionResolver) { @@ -35,9 +36,9 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent $event + * @param ConfigureMenuEvent $event * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ public function checkPermissions(ConfigureMenuEvent $event): void { diff --git a/src/lib/EventListener/RequestAttributesListener.php b/src/lib/EventListener/RequestAttributesListener.php index 83d6124e33..30cf9c4039 100644 --- a/src/lib/EventListener/RequestAttributesListener.php +++ b/src/lib/EventListener/RequestAttributesListener.php @@ -8,6 +8,8 @@ namespace Ibexa\AdminUi\EventListener; use Ibexa\Bundle\AdminUi\IbexaAdminUiBundle; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Location; @@ -24,7 +26,7 @@ class RequestAttributesListener implements EventSubscriberInterface { private const TRANSLATED_CONTENT_VIEW_ROUTE_NAME = 'ibexa.content.translation.view'; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ + /** @var Repository */ private $repository; /** @var array */ @@ -32,10 +34,12 @@ class RequestAttributesListener implements EventSubscriberInterface /** * @param array $siteAccessGroups - * @param \Ibexa\Contracts\Core\Repository\Repository $repository + * @param Repository $repository */ - public function __construct(array $siteAccessGroups, Repository $repository) - { + public function __construct( + array $siteAccessGroups, + Repository $repository + ) { $this->repository = $repository; $this->siteAccessGroups = $siteAccessGroups; } @@ -48,10 +52,10 @@ public static function getSubscribedEvents() /** * Adds all the request attributes to the parameters. * - * @param \Ibexa\Core\MVC\Symfony\View\Event\FilterViewBuilderParametersEvent $event + * @param FilterViewBuilderParametersEvent $event * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ public function addRequestAttributes(FilterViewBuilderParametersEvent $event) { @@ -69,7 +73,7 @@ public function addRequestAttributes(FilterViewBuilderParametersEvent $event) } if ($this->hasContentLanguage($request, $parameterBag)) { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $parameterBag->get('location'); $languageCode = $parameterBag->get('languageCode'); @@ -80,13 +84,15 @@ public function addRequestAttributes(FilterViewBuilderParametersEvent $event) } /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Symfony\Component\HttpFoundation\ParameterBag $parameterBag + * @param Request $request + * @param ParameterBag $parameterBag * * @return bool */ - private function hasContentLanguage(Request $request, ParameterBag $parameterBag): bool - { + private function hasContentLanguage( + Request $request, + ParameterBag $parameterBag + ): bool { return $parameterBag->has('languageCode') && $parameterBag->has('location') && $request->get('_route') === self::TRANSLATED_CONTENT_VIEW_ROUTE_NAME; @@ -95,7 +101,7 @@ private function hasContentLanguage(Request $request, ParameterBag $parameterBag /** * @param int $locationId * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location + * @return Location */ private function loadLocation(int $locationId): Location { @@ -112,13 +118,15 @@ static function (Repository $repository) use ($locationId) { * @param int $contentId * @param string $language * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content + * @return Content * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws UnauthorizedException + * @throws NotFoundException */ - private function loadContent(int $contentId, ?string $language): Content - { + private function loadContent( + int $contentId, + ?string $language + ): Content { return $this->repository->getContentService()->loadContent($contentId, $language ? [$language] : null); } diff --git a/src/lib/EventListener/RequestLocaleListener.php b/src/lib/EventListener/RequestLocaleListener.php index 8b82e32d4c..6d8483c3ac 100644 --- a/src/lib/EventListener/RequestLocaleListener.php +++ b/src/lib/EventListener/RequestLocaleListener.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\EventListener; +use Ibexa\AdminUi\Exception\InvalidArgumentException; use Ibexa\AdminUi\Specification\SiteAccess\IsAdmin; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface; @@ -26,21 +27,21 @@ class RequestLocaleListener implements EventSubscriberInterface /** @var array */ private $availableTranslations; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ + /** @var UserLanguagePreferenceProviderInterface */ private $userLanguagePreferenceProvider; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; /** * @param array $siteAccessGroups * @param array $availableTranslations - * @param \Symfony\Contracts\Translation\TranslatorInterface $translator - * @param \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider - * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver + * @param TranslatorInterface $translator + * @param UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider + * @param ConfigResolverInterface $configResolver */ public function __construct( array $siteAccessGroups, @@ -67,9 +68,9 @@ public static function getSubscribedEvents(): array } /** - * @param \Symfony\Component\HttpKernel\Event\RequestEvent $event + * @param RequestEvent $event * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function onKernelRequest(RequestEvent $event): void { @@ -100,11 +101,11 @@ public function onKernelRequest(RequestEvent $event): void } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * * @return bool * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ protected function isAdminSiteAccess(Request $request): bool { diff --git a/src/lib/EventListener/SearchViewFilterParametersListener.php b/src/lib/EventListener/SearchViewFilterParametersListener.php index 9363c1a5d1..96a8aab1f3 100644 --- a/src/lib/EventListener/SearchViewFilterParametersListener.php +++ b/src/lib/EventListener/SearchViewFilterParametersListener.php @@ -21,13 +21,13 @@ final class SearchViewFilterParametersListener implements EventSubscriberInterface { - /** @var \Symfony\Component\Form\FormFactoryInterface */ + /** @var FormFactoryInterface */ private $formFactory; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; - /** @var \Symfony\Component\HttpFoundation\RequestStack */ + /** @var RequestStack */ private $requestStack; /** @var string[][] */ diff --git a/src/lib/EventListener/SetViewParametersListener.php b/src/lib/EventListener/SetViewParametersListener.php index 627a68181a..3b88565c16 100644 --- a/src/lib/EventListener/SetViewParametersListener.php +++ b/src/lib/EventListener/SetViewParametersListener.php @@ -14,12 +14,14 @@ use Ibexa\ContentForms\User\View\UserUpdateView; use Ibexa\Contracts\ContentForms\Content\Form\Provider\GroupedContentFormFieldsProviderInterface; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Contracts\Core\Repository\Values\User\User; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\MVC\Symfony\Event\PreContentViewEvent; @@ -77,11 +79,11 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\Core\MVC\Symfony\Event\PreContentViewEvent $event + * @param PreContentViewEvent $event * - * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws InvalidArgumentException + * @throws UnauthorizedException + * @throws NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ public function setContentEditViewTemplateParameters(PreContentViewEvent $event): void @@ -92,7 +94,7 @@ public function setContentEditViewTemplateParameters(PreContentViewEvent $event) return; } - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $contentView->getParameter('content'); $location = $contentView->hasParameter('location') ? $contentView->getParameter('location') : null; $isPublished = null !== $content->contentInfo->mainLocationId && $content->contentInfo->published; @@ -114,11 +116,11 @@ public function setContentEditViewTemplateParameters(PreContentViewEvent $event) } /** - * @param \Ibexa\Core\MVC\Symfony\Event\PreContentViewEvent $event + * @param PreContentViewEvent $event * - * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws InvalidArgumentException + * @throws UnauthorizedException + * @throws NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ public function setContentTranslateViewTemplateParameters(PreContentViewEvent $event): void @@ -129,7 +131,7 @@ public function setContentTranslateViewTemplateParameters(PreContentViewEvent $e return; } - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $contentView->getContent(); $location = $contentView->getLocation(); $isPublished = null !== $content->contentInfo->mainLocationId && $content->contentInfo->published; @@ -151,7 +153,7 @@ public function setContentTranslateViewTemplateParameters(PreContentViewEvent $e } /** - * @param \Ibexa\Core\MVC\Symfony\Event\PreContentViewEvent $event + * @param PreContentViewEvent $event */ public function setUserUpdateViewTemplateParameters(PreContentViewEvent $event): void { @@ -161,7 +163,7 @@ public function setUserUpdateViewTemplateParameters(PreContentViewEvent $event): return; } - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User $user */ + /** @var User $user */ $user = $contentView->getParameter('user'); $contentInfo = $user->versionInfo->contentInfo; @@ -169,7 +171,7 @@ public function setUserUpdateViewTemplateParameters(PreContentViewEvent $event): } /** - * @param \Ibexa\Core\MVC\Symfony\Event\PreContentViewEvent $event + * @param PreContentViewEvent $event */ public function setContentCreateViewTemplateParameters(PreContentViewEvent $event): void { @@ -201,11 +203,13 @@ public function setContentFieldsParameters(PreContentViewEvent $event): void } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo - * @param \Ibexa\Core\MVC\Symfony\View\View $contentView + * @param ContentInfo $contentInfo + * @param View $contentView */ - private function processCreator(ContentInfo $contentInfo, View $contentView): void - { + private function processCreator( + ContentInfo $contentInfo, + View $contentView + ): void { try { $creator = $this->userService->loadUser($contentInfo->ownerId); } catch (NotFoundException $exception) { @@ -218,19 +222,22 @@ private function processCreator(ContentInfo $contentInfo, View $contentView): vo } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Content $content + * @param Location|null $location * @param bool $isPublished * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location + * @return Location * - * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws InvalidArgumentException + * @throws UnauthorizedException + * @throws NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ - private function resolveParentLocation(Content $content, ?Location $location, bool $isPublished): Location - { + private function resolveParentLocation( + Content $content, + ?Location $location, + bool $isPublished + ): Location { if (!$isPublished) { $parentLocations = $this->repository->sudo( static function (Repository $repository) use ($content) { @@ -253,7 +260,7 @@ static function (Repository $repository) use ($location) { } /** - * @param array<\Symfony\Component\Form\FormInterface> $fieldsData + * @param array $fieldsData * * @return array */ diff --git a/src/lib/EventListener/UserPasswordChangeRightSidebarListener.php b/src/lib/EventListener/UserPasswordChangeRightSidebarListener.php index d2b877474a..86b8240030 100644 --- a/src/lib/EventListener/UserPasswordChangeRightSidebarListener.php +++ b/src/lib/EventListener/UserPasswordChangeRightSidebarListener.php @@ -20,7 +20,7 @@ class UserPasswordChangeRightSidebarListener implements EventSubscriberInterface public const ITEM__UPDATE = 'user_password_change__sidebar_right__update'; public const ITEM__CANCEL = 'user_password_change__sidebar_right__cancel'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct(TranslatorInterface $translator) @@ -37,7 +37,7 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent $event + * @param ConfigureMenuEvent $event */ public function onUserPasswordChangeRightSidebarConfigure(ConfigureMenuEvent $event): void { @@ -66,7 +66,7 @@ public function onUserPasswordChangeRightSidebarConfigure(ConfigureMenuEvent $ev } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/EventListener/UserProfileListener.php b/src/lib/EventListener/UserProfileListener.php index 83eebc85d5..066480a918 100644 --- a/src/lib/EventListener/UserProfileListener.php +++ b/src/lib/EventListener/UserProfileListener.php @@ -119,8 +119,10 @@ private function isSupported(UserUpdateData $data): bool $this->canEditUserProfile($data->user); } - private function createUpdateStruct(UserUpdateData $data, string $languageCode): UserUpdateStruct - { + private function createUpdateStruct( + UserUpdateData $data, + string $languageCode + ): UserUpdateStruct { $updateStruct = $this->userService->newUserUpdateStruct(); $updateStruct->contentUpdateStruct = $this->contentService->newContentUpdateStruct(); diff --git a/src/lib/EventListener/ViewTemplatesListener.php b/src/lib/EventListener/ViewTemplatesListener.php index 7b39ad9721..099e4ba03b 100644 --- a/src/lib/EventListener/ViewTemplatesListener.php +++ b/src/lib/EventListener/ViewTemplatesListener.php @@ -20,7 +20,7 @@ */ class ViewTemplatesListener implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct(ConfigResolverInterface $configResolver) diff --git a/src/lib/Exception/ContentTypeIconNotFoundException.php b/src/lib/Exception/ContentTypeIconNotFoundException.php index 9e01bc3296..692372059f 100644 --- a/src/lib/Exception/ContentTypeIconNotFoundException.php +++ b/src/lib/Exception/ContentTypeIconNotFoundException.php @@ -13,8 +13,11 @@ class ContentTypeIconNotFoundException extends RuntimeException { - public function __construct($contentType, $code = 0, ?Exception $previous = null) - { + public function __construct( + $contentType, + $code = 0, + ?Exception $previous = null + ) { parent::__construct("No icon found for '$contentType' content type", $code, $previous); } } diff --git a/src/lib/Exception/FieldTypeExpressionParserException.php b/src/lib/Exception/FieldTypeExpressionParserException.php index 0686621f3e..a2c0b045cc 100644 --- a/src/lib/Exception/FieldTypeExpressionParserException.php +++ b/src/lib/Exception/FieldTypeExpressionParserException.php @@ -10,6 +10,4 @@ use RuntimeException; -final class FieldTypeExpressionParserException extends RuntimeException -{ -} +final class FieldTypeExpressionParserException extends RuntimeException {} diff --git a/src/lib/Exception/InvalidArgumentException.php b/src/lib/Exception/InvalidArgumentException.php index eb6bde072e..fbd6865e06 100644 --- a/src/lib/Exception/InvalidArgumentException.php +++ b/src/lib/Exception/InvalidArgumentException.php @@ -10,8 +10,6 @@ use Ibexa\Core\Base\Exceptions\InvalidArgumentException as BaseInvalidArgumentException; -class InvalidArgumentException extends BaseInvalidArgumentException -{ -} +class InvalidArgumentException extends BaseInvalidArgumentException {} class_alias(InvalidArgumentException::class, 'EzSystems\EzPlatformAdminUi\Exception\InvalidArgumentException'); diff --git a/src/lib/Exception/MenuItemExists.php b/src/lib/Exception/MenuItemExists.php index 0f2acbb6bc..ed0f7f8628 100644 --- a/src/lib/Exception/MenuItemExists.php +++ b/src/lib/Exception/MenuItemExists.php @@ -9,8 +9,6 @@ use Exception; -class MenuItemExists extends Exception -{ -} +class MenuItemExists extends Exception {} class_alias(MenuItemExists::class, 'EzSystems\EzPlatformAdminUi\Exception\MenuItemExists'); diff --git a/src/lib/Exception/MenuItemNotExists.php b/src/lib/Exception/MenuItemNotExists.php index 6aabc54dbd..075634a8e4 100644 --- a/src/lib/Exception/MenuItemNotExists.php +++ b/src/lib/Exception/MenuItemNotExists.php @@ -9,8 +9,6 @@ use Exception; -class MenuItemNotExists extends Exception -{ -} +class MenuItemNotExists extends Exception {} class_alias(MenuItemNotExists::class, 'EzSystems\EzPlatformAdminUi\Exception\MenuItemNotExists'); diff --git a/src/lib/Exception/MissingLimitationBlockException.php b/src/lib/Exception/MissingLimitationBlockException.php index e5e61cdfd1..64deff0aee 100644 --- a/src/lib/Exception/MissingLimitationBlockException.php +++ b/src/lib/Exception/MissingLimitationBlockException.php @@ -9,8 +9,6 @@ use RuntimeException; -class MissingLimitationBlockException extends RuntimeException -{ -} +class MissingLimitationBlockException extends RuntimeException {} class_alias(MissingLimitationBlockException::class, 'EzSystems\EzPlatformAdminUi\Exception\MissingLimitationBlockException'); diff --git a/src/lib/Exception/ValidationFailedException.php b/src/lib/Exception/ValidationFailedException.php index a97adb6284..44603303ae 100644 --- a/src/lib/Exception/ValidationFailedException.php +++ b/src/lib/Exception/ValidationFailedException.php @@ -31,8 +31,10 @@ public function getErrors(): ConstraintViolationListInterface return $this->errors; } - private function createMessage(string $argumentName, ConstraintViolationListInterface $errors): string - { + private function createMessage( + string $argumentName, + ConstraintViolationListInterface $errors + ): string { if ($errors->count() > 1) { return sprintf( "Argument '%s->%s' is invalid: %s", diff --git a/src/lib/Exception/ValueMapperNotFoundException.php b/src/lib/Exception/ValueMapperNotFoundException.php index 61fc7ce6c8..370e0f6d8e 100644 --- a/src/lib/Exception/ValueMapperNotFoundException.php +++ b/src/lib/Exception/ValueMapperNotFoundException.php @@ -12,8 +12,11 @@ class ValueMapperNotFoundException extends InvalidArgumentException { - public function __construct($limitationType, $code = 0, ?Exception $previous = null) - { + public function __construct( + $limitationType, + $code = 0, + ?Exception $previous = null + ) { parent::__construct("No LimitationValueMapper found for '$limitationType'", $code, $previous); } } diff --git a/src/lib/FieldType/FieldDefinitionFormMapperInterface.php b/src/lib/FieldType/FieldDefinitionFormMapperInterface.php index 42a4c5e432..7f56b10736 100644 --- a/src/lib/FieldType/FieldDefinitionFormMapperInterface.php +++ b/src/lib/FieldType/FieldDefinitionFormMapperInterface.php @@ -24,10 +24,13 @@ interface FieldDefinitionFormMapperInterface * - field settings * - default value. * - * @param \Symfony\Component\Form\FormInterface $fieldDefinitionForm form for current FieldDefinition - * @param \Ibexa\AdminUi\Form\Data\FieldDefinitionData $data underlying data for current FieldDefinition form + * @param FormInterface $fieldDefinitionForm form for current FieldDefinition + * @param FieldDefinitionData $data underlying data for current FieldDefinition form */ - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void; + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void; } class_alias( diff --git a/src/lib/FieldType/FieldTypeDefinitionFormMapperDispatcher.php b/src/lib/FieldType/FieldTypeDefinitionFormMapperDispatcher.php index d58dd84b4b..5fccc26bc7 100644 --- a/src/lib/FieldType/FieldTypeDefinitionFormMapperDispatcher.php +++ b/src/lib/FieldType/FieldTypeDefinitionFormMapperDispatcher.php @@ -20,25 +20,29 @@ class FieldTypeDefinitionFormMapperDispatcher implements FieldTypeDefinitionForm /** * FieldType form mappers, indexed by FieldType identifier. * - * @var \Ibexa\AdminUi\FieldType\FieldDefinitionFormMapperInterface[] + * @var FieldDefinitionFormMapperInterface[] */ private $mappers = []; /** - * @param \Ibexa\AdminUi\FieldType\FieldDefinitionFormMapperInterface[] $mappers + * @param FieldDefinitionFormMapperInterface[] $mappers */ public function __construct(array $mappers = []) { $this->mappers = $mappers; } - public function addMapper(FieldDefinitionFormMapperInterface $mapper, string $fieldTypeIdentifier): void - { + public function addMapper( + FieldDefinitionFormMapperInterface $mapper, + string $fieldTypeIdentifier + ): void { $this->mappers[$fieldTypeIdentifier] = $mapper; } - public function map(FormInterface $fieldForm, FieldDefinitionData $data): void - { + public function map( + FormInterface $fieldForm, + FieldDefinitionData $data + ): void { $fieldTypeIdentifier = $data->getFieldTypeIdentifier(); if (!isset($this->mappers[$fieldTypeIdentifier])) { diff --git a/src/lib/FieldType/FieldTypeDefinitionFormMapperDispatcherInterface.php b/src/lib/FieldType/FieldTypeDefinitionFormMapperDispatcherInterface.php index 7bd27fd861..52931ebc92 100644 --- a/src/lib/FieldType/FieldTypeDefinitionFormMapperDispatcherInterface.php +++ b/src/lib/FieldType/FieldTypeDefinitionFormMapperDispatcherInterface.php @@ -15,9 +15,15 @@ */ interface FieldTypeDefinitionFormMapperDispatcherInterface { - public function addMapper(FieldDefinitionFormMapperInterface $mapper, string $fieldTypeIdentifier): void; + public function addMapper( + FieldDefinitionFormMapperInterface $mapper, + string $fieldTypeIdentifier + ): void; - public function map(FormInterface $form, FieldDefinitionData $data): void; + public function map( + FormInterface $form, + FieldDefinitionData $data + ): void; } class_alias(FieldTypeDefinitionFormMapperDispatcherInterface::class, 'EzSystems\EzPlatformAdminUi\FieldType\FieldTypeDefinitionFormMapperDispatcherInterface'); diff --git a/src/lib/FieldType/Mapper/AbstractRelationFormMapper.php b/src/lib/FieldType/Mapper/AbstractRelationFormMapper.php index a1df1a36dd..4eb5fc4b99 100644 --- a/src/lib/FieldType/Mapper/AbstractRelationFormMapper.php +++ b/src/lib/FieldType/Mapper/AbstractRelationFormMapper.php @@ -13,14 +13,16 @@ abstract class AbstractRelationFormMapper implements FieldDefinitionFormMapperInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ protected $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ protected $locationService; - public function __construct(ContentTypeService $contentTypeService, LocationService $locationService) - { + public function __construct( + ContentTypeService $contentTypeService, + LocationService $locationService + ) { $this->contentTypeService = $contentTypeService; $this->locationService = $locationService; } diff --git a/src/lib/FieldType/Mapper/AuthorFormMapper.php b/src/lib/FieldType/Mapper/AuthorFormMapper.php index fe68ada1a5..255fe1d30d 100644 --- a/src/lib/FieldType/Mapper/AuthorFormMapper.php +++ b/src/lib/FieldType/Mapper/AuthorFormMapper.php @@ -23,8 +23,10 @@ */ class AuthorFormMapper implements FieldDefinitionFormMapperInterface, FieldValueFormMapperInterface { - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void { $isTranslation = $data->contentTypeData->languageCode !== $data->contentTypeData->mainLanguageCode; $fieldDefinitionForm ->add( @@ -47,8 +49,10 @@ public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, Field ); } - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) - { + public function mapFieldValueForm( + FormInterface $fieldForm, + FieldData $data + ) { $fieldDefinition = $data->fieldDefinition; $fieldSettings = $fieldDefinition->getFieldSettings(); $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/BinaryFileFormMapper.php b/src/lib/FieldType/Mapper/BinaryFileFormMapper.php index 3c844fe9e0..e4ebf777e6 100644 --- a/src/lib/FieldType/Mapper/BinaryFileFormMapper.php +++ b/src/lib/FieldType/Mapper/BinaryFileFormMapper.php @@ -18,16 +18,20 @@ class BinaryFileFormMapper implements FieldDefinitionFormMapperInterface { - /** @var \Ibexa\ContentForms\ConfigResolver\MaxUploadSize */ + /** @var MaxUploadSize */ private $maxUploadSize; - public function __construct(FieldTypeService $fieldTypeService, MaxUploadSize $maxUploadSize) - { + public function __construct( + FieldTypeService $fieldTypeService, + MaxUploadSize $maxUploadSize + ) { $this->maxUploadSize = $maxUploadSize; } - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void { $isTranslation = $data->contentTypeData->languageCode !== $data->contentTypeData->mainLanguageCode; $fieldDefinitionForm ->add('maxSize', IntegerType::class, [ diff --git a/src/lib/FieldType/Mapper/CheckboxFormMapper.php b/src/lib/FieldType/Mapper/CheckboxFormMapper.php index 61d5dd848f..eb9c46c746 100644 --- a/src/lib/FieldType/Mapper/CheckboxFormMapper.php +++ b/src/lib/FieldType/Mapper/CheckboxFormMapper.php @@ -19,8 +19,10 @@ */ class CheckboxFormMapper implements FieldDefinitionFormMapperInterface { - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $fieldDefinition): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $fieldDefinition + ): void { $isTranslation = $fieldDefinition->contentTypeData->languageCode !== $fieldDefinition->contentTypeData->mainLanguageCode; $defaultValueForm = $fieldDefinitionForm ->getConfig() diff --git a/src/lib/FieldType/Mapper/CountryFormMapper.php b/src/lib/FieldType/Mapper/CountryFormMapper.php index a5286ec755..2a57f83a9a 100644 --- a/src/lib/FieldType/Mapper/CountryFormMapper.php +++ b/src/lib/FieldType/Mapper/CountryFormMapper.php @@ -17,8 +17,10 @@ class CountryFormMapper implements FieldDefinitionFormMapperInterface { - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void { $isTranslation = $data->contentTypeData->languageCode !== $data->contentTypeData->mainLanguageCode; $fieldDefinitionForm ->add( diff --git a/src/lib/FieldType/Mapper/DateFormMapper.php b/src/lib/FieldType/Mapper/DateFormMapper.php index 9190f79943..53dd4b808e 100644 --- a/src/lib/FieldType/Mapper/DateFormMapper.php +++ b/src/lib/FieldType/Mapper/DateFormMapper.php @@ -20,8 +20,10 @@ */ class DateFormMapper implements FieldDefinitionFormMapperInterface { - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void { $isTranslation = $data->contentTypeData->languageCode !== $data->contentTypeData->mainLanguageCode; $fieldDefinitionForm ->add( diff --git a/src/lib/FieldType/Mapper/DateTimeFormMapper.php b/src/lib/FieldType/Mapper/DateTimeFormMapper.php index c7e6a3d1a0..65d757f0c2 100644 --- a/src/lib/FieldType/Mapper/DateTimeFormMapper.php +++ b/src/lib/FieldType/Mapper/DateTimeFormMapper.php @@ -22,8 +22,10 @@ */ class DateTimeFormMapper implements FieldDefinitionFormMapperInterface { - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void { $isTranslation = $data->contentTypeData->languageCode !== $data->contentTypeData->mainLanguageCode; $fieldDefinitionForm ->add('useSeconds', CheckboxType::class, [ diff --git a/src/lib/FieldType/Mapper/FloatFormMapper.php b/src/lib/FieldType/Mapper/FloatFormMapper.php index b1cb09752b..125cb21263 100644 --- a/src/lib/FieldType/Mapper/FloatFormMapper.php +++ b/src/lib/FieldType/Mapper/FloatFormMapper.php @@ -20,8 +20,10 @@ */ class FloatFormMapper implements FieldDefinitionFormMapperInterface { - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $fieldDefinition): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $fieldDefinition + ): void { $isTranslation = $fieldDefinition->contentTypeData->languageCode !== $fieldDefinition->contentTypeData->mainLanguageCode; $defaultValueForm = $fieldDefinitionForm ->getConfig() diff --git a/src/lib/FieldType/Mapper/ISBNFormMapper.php b/src/lib/FieldType/Mapper/ISBNFormMapper.php index 63d376fa56..a98f926b06 100644 --- a/src/lib/FieldType/Mapper/ISBNFormMapper.php +++ b/src/lib/FieldType/Mapper/ISBNFormMapper.php @@ -17,8 +17,10 @@ class ISBNFormMapper implements FieldDefinitionFormMapperInterface { - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $fieldDefinition): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $fieldDefinition + ): void { $isTranslation = $fieldDefinition->contentTypeData->languageCode !== $fieldDefinition->contentTypeData->mainLanguageCode; $defaultValueForm = $fieldDefinitionForm ->getConfig() diff --git a/src/lib/FieldType/Mapper/ImageFormMapper.php b/src/lib/FieldType/Mapper/ImageFormMapper.php index 6ff944effe..752fbe21ef 100644 --- a/src/lib/FieldType/Mapper/ImageFormMapper.php +++ b/src/lib/FieldType/Mapper/ImageFormMapper.php @@ -16,6 +16,7 @@ use Symfony\Component\Form\Extension\Core\Type\NumberType; use Symfony\Component\Form\FormInterface; use Symfony\Component\Mime\MimeTypesInterface; +use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\Range; @@ -24,7 +25,7 @@ class ImageFormMapper implements FieldDefinitionFormMapperInterface /** @var array */ private array $allowedMimeTypes; - /** @var \Ibexa\ContentForms\ConfigResolver\MaxUploadSize */ + /** @var MaxUploadSize */ private $maxUploadSize; private MimeTypesInterface $mimeTypes; @@ -42,8 +43,10 @@ public function __construct( $this->mimeTypes = $mimeTypes; } - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void { $isTranslation = $data->contentTypeData->languageCode !== $data->contentTypeData->mainLanguageCode; if (!empty($this->allowedMimeTypes)) { @@ -86,7 +89,7 @@ public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, Field /** * Fake method to set the translation domain for the extractor. * - * @throws \Symfony\Component\OptionsResolver\Exception\AccessException + * @throws AccessException */ public function configureOptions(OptionsResolver $resolver) { diff --git a/src/lib/FieldType/Mapper/IntegerFormMapper.php b/src/lib/FieldType/Mapper/IntegerFormMapper.php index ff25401ab1..d77848ea17 100644 --- a/src/lib/FieldType/Mapper/IntegerFormMapper.php +++ b/src/lib/FieldType/Mapper/IntegerFormMapper.php @@ -20,8 +20,10 @@ */ class IntegerFormMapper implements FieldDefinitionFormMapperInterface { - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $fieldDefinition): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $fieldDefinition + ): void { $isTranslation = $fieldDefinition->contentTypeData->languageCode !== $fieldDefinition->contentTypeData->mainLanguageCode; $defaultValueForm = $fieldDefinitionForm ->getConfig() diff --git a/src/lib/FieldType/Mapper/MediaFormMapper.php b/src/lib/FieldType/Mapper/MediaFormMapper.php index f4e5de96c4..84b08ec5bc 100644 --- a/src/lib/FieldType/Mapper/MediaFormMapper.php +++ b/src/lib/FieldType/Mapper/MediaFormMapper.php @@ -21,19 +21,23 @@ class MediaFormMapper implements FieldDefinitionFormMapperInterface { - /** @var \Ibexa\ContentForms\ConfigResolver\MaxUploadSize */ + /** @var MaxUploadSize */ private $maxUploadSize; protected const ACCEPT_VIDEO = 'video/*'; protected const ACCEPT_AUDIO = 'audio/*'; - public function __construct(FieldTypeService $fieldTypeService, MaxUploadSize $maxUploadSize) - { + public function __construct( + FieldTypeService $fieldTypeService, + MaxUploadSize $maxUploadSize + ) { $this->maxUploadSize = $maxUploadSize; } - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void { $isTranslation = $data->contentTypeData->languageCode !== $data->contentTypeData->mainLanguageCode; $fieldDefinitionForm ->add('maxSize', IntegerType::class, [ diff --git a/src/lib/FieldType/Mapper/RelationFormMapper.php b/src/lib/FieldType/Mapper/RelationFormMapper.php index c940f5f421..6e8fa8a16c 100644 --- a/src/lib/FieldType/Mapper/RelationFormMapper.php +++ b/src/lib/FieldType/Mapper/RelationFormMapper.php @@ -17,8 +17,10 @@ class RelationFormMapper extends AbstractRelationFormMapper { - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void { $isTranslation = $data->contentTypeData->languageCode !== $data->contentTypeData->mainLanguageCode; $fieldDefinitionForm ->add('selectionRoot', RelationType::class, [ diff --git a/src/lib/FieldType/Mapper/RelationListFormMapper.php b/src/lib/FieldType/Mapper/RelationListFormMapper.php index 036f85d05f..af9e87b451 100644 --- a/src/lib/FieldType/Mapper/RelationListFormMapper.php +++ b/src/lib/FieldType/Mapper/RelationListFormMapper.php @@ -18,8 +18,10 @@ class RelationListFormMapper extends AbstractRelationFormMapper { - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void { $isTranslation = $data->contentTypeData->languageCode !== $data->contentTypeData->mainLanguageCode; $fieldDefinitionForm ->add('selectionDefaultLocation', RelationType::class, [ diff --git a/src/lib/FieldType/Mapper/SelectionFormMapper.php b/src/lib/FieldType/Mapper/SelectionFormMapper.php index 8e3b021e59..d1387d1784 100644 --- a/src/lib/FieldType/Mapper/SelectionFormMapper.php +++ b/src/lib/FieldType/Mapper/SelectionFormMapper.php @@ -33,8 +33,10 @@ class SelectionFormMapper implements FieldDefinitionFormMapperInterface * `multilingualOptions` if those are provided. * `multilingualOptions` is an array with keys equal to used languageCodes. */ - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void { $isTranslation = $data->contentTypeData->languageCode !== $data->contentTypeData->mainLanguageCode; $options = $fieldDefinitionForm->getConfig()->getOptions(); $languageCode = $options['languageCode']; diff --git a/src/lib/FieldType/Mapper/TextBlockFormMapper.php b/src/lib/FieldType/Mapper/TextBlockFormMapper.php index 436636c6e5..1e4c021296 100644 --- a/src/lib/FieldType/Mapper/TextBlockFormMapper.php +++ b/src/lib/FieldType/Mapper/TextBlockFormMapper.php @@ -19,8 +19,10 @@ */ class TextBlockFormMapper implements FieldDefinitionFormMapperInterface { - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void { $isTranslation = $data->contentTypeData->languageCode !== $data->contentTypeData->mainLanguageCode; $fieldDefinitionForm ->add( diff --git a/src/lib/FieldType/Mapper/TextLineFormMapper.php b/src/lib/FieldType/Mapper/TextLineFormMapper.php index 8b8a676736..c91760f63e 100644 --- a/src/lib/FieldType/Mapper/TextLineFormMapper.php +++ b/src/lib/FieldType/Mapper/TextLineFormMapper.php @@ -20,8 +20,10 @@ */ class TextLineFormMapper implements FieldDefinitionFormMapperInterface { - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void { $isTranslation = $data->contentTypeData->languageCode !== $data->contentTypeData->mainLanguageCode; $fieldDefinitionForm ->add('minLength', IntegerType::class, [ diff --git a/src/lib/FieldType/Mapper/TimeFormMapper.php b/src/lib/FieldType/Mapper/TimeFormMapper.php index 762f446633..9ffd8a561a 100644 --- a/src/lib/FieldType/Mapper/TimeFormMapper.php +++ b/src/lib/FieldType/Mapper/TimeFormMapper.php @@ -21,8 +21,10 @@ */ class TimeFormMapper implements FieldDefinitionFormMapperInterface { - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void { $isTranslation = $data->contentTypeData->languageCode !== $data->contentTypeData->mainLanguageCode; $fieldDefinitionForm ->add( diff --git a/src/lib/FieldType/Mapper/UserAccountFormMapper.php b/src/lib/FieldType/Mapper/UserAccountFormMapper.php index 3be6e733c5..750ecf1f65 100644 --- a/src/lib/FieldType/Mapper/UserAccountFormMapper.php +++ b/src/lib/FieldType/Mapper/UserAccountFormMapper.php @@ -17,6 +17,7 @@ use Symfony\Component\Form\Extension\Core\Type\IntegerType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormInterface; +use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\Range; @@ -28,8 +29,10 @@ final class UserAccountFormMapper implements FieldDefinitionFormMapperInterface, /** * {@inheritdoc} */ - public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void - { + public function mapFieldDefinitionForm( + FormInterface $fieldDefinitionForm, + FieldDefinitionData $data + ): void { $validatorPropertyPathPrefix = 'validatorConfiguration[PasswordValueValidator]'; $fieldDefinitionForm->add('requireAtLeastOneUpperCaseCharacter', PasswordConstraintCheckboxType::class, [ @@ -110,9 +113,9 @@ public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, Field /** * Fake method to set the translation domain for the extractor. * - * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * @param OptionsResolver $resolver * - * @throws \Symfony\Component\OptionsResolver\Exception\AccessException + * @throws AccessException */ public function configureOptions(OptionsResolver $resolver) { diff --git a/src/lib/Form/Data/Asset/ImageAssetUploadData.php b/src/lib/Form/Data/Asset/ImageAssetUploadData.php index 45ed3cc32c..e132a950fc 100644 --- a/src/lib/Form/Data/Asset/ImageAssetUploadData.php +++ b/src/lib/Form/Data/Asset/ImageAssetUploadData.php @@ -18,7 +18,7 @@ class ImageAssetUploadData * * @Assert\Image(detectCorrupted = true) * - * @var \Symfony\Component\HttpFoundation\File\UploadedFile + * @var UploadedFile */ private $file; @@ -29,8 +29,10 @@ class ImageAssetUploadData */ private $languageCode; - public function __construct(?UploadedFile $file = null, ?string $languageCode = null) - { + public function __construct( + ?UploadedFile $file = null, + ?string $languageCode = null + ) { $this->file = $file; $this->languageCode = $languageCode; } diff --git a/src/lib/Form/Data/Content/ContentVisibilityUpdateData.php b/src/lib/Form/Data/Content/ContentVisibilityUpdateData.php index 45ef21cdf8..85cc33c815 100644 --- a/src/lib/Form/Data/Content/ContentVisibilityUpdateData.php +++ b/src/lib/Form/Data/Content/ContentVisibilityUpdateData.php @@ -13,14 +13,14 @@ class ContentVisibilityUpdateData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null */ + /** @var ContentInfo|null */ private $contentInfo; /** @var bool|null */ private $visible; /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @var Location|null */ private $location; diff --git a/src/lib/Form/Data/Content/CustomUrl/CustomUrlAddData.php b/src/lib/Form/Data/Content/CustomUrl/CustomUrlAddData.php index c52cb3a1fd..995fc27a5a 100644 --- a/src/lib/Form/Data/Content/CustomUrl/CustomUrlAddData.php +++ b/src/lib/Form/Data/Content/CustomUrl/CustomUrlAddData.php @@ -13,13 +13,13 @@ class CustomUrlAddData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ private $location; /** @var string|null */ private $path; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null */ + /** @var Language|null */ private $language; /** @var bool */ @@ -48,7 +48,7 @@ public function __construct( } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @return Location|null */ public function getLocation(): ?Location { @@ -56,7 +56,7 @@ public function getLocation(): ?Location } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location * * @return CustomUrlAddData */ @@ -68,7 +68,7 @@ public function setLocation(?Location $location): self } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language|null + * @return Language|null */ public function getLanguage(): ?Language { @@ -76,7 +76,7 @@ public function getLanguage(): ?Language } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $language + * @param Language|null $language * * @return CustomUrlAddData */ diff --git a/src/lib/Form/Data/Content/CustomUrl/CustomUrlRemoveData.php b/src/lib/Form/Data/Content/CustomUrl/CustomUrlRemoveData.php index 7555c5f9ed..3043663c1d 100644 --- a/src/lib/Form/Data/Content/CustomUrl/CustomUrlRemoveData.php +++ b/src/lib/Form/Data/Content/CustomUrl/CustomUrlRemoveData.php @@ -12,14 +12,14 @@ class CustomUrlRemoveData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ private $location; /** @var array */ private $urlAliases; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location * @param array $urlAliases */ public function __construct( @@ -31,7 +31,7 @@ public function __construct( } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @return Location|null */ public function getLocation(): ?Location { @@ -39,9 +39,9 @@ public function getLocation(): ?Location } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location * - * @return \Ibexa\AdminUi\Form\Data\Content\CustomUrl\CustomUrlRemoveData + * @return CustomUrlRemoveData */ public function setLocation(?Location $location): self { @@ -61,7 +61,7 @@ public function getUrlAliases(): array /** * @param array $urlAliases * - * @return \Ibexa\AdminUi\Form\Data\Content\CustomUrl\CustomUrlRemoveData + * @return CustomUrlRemoveData */ public function setUrlAliases(array $urlAliases): self { diff --git a/src/lib/Form/Data/Content/Draft/ContentCreateData.php b/src/lib/Form/Data/Content/Draft/ContentCreateData.php index 6ebfa2a23c..45e2f89191 100644 --- a/src/lib/Form/Data/Content/Draft/ContentCreateData.php +++ b/src/lib/Form/Data/Content/Draft/ContentCreateData.php @@ -18,23 +18,23 @@ */ class ContentCreateData { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|null */ + /** @var ContentType|null */ protected $contentType; /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @var Location|null * * @AdminUiAssert\LocationIsContainer() */ protected $parentLocation; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null */ + /** @var Language|null */ protected $language; /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|null $contentType - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $parentLocation - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $language + * @param ContentType|null $contentType + * @param Location|null $parentLocation + * @param Language|null $language */ public function __construct( ?ContentType $contentType = null, @@ -47,7 +47,7 @@ public function __construct( } /** - * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|null + * @return ContentType|null */ public function getContentType(): ?ContentType { @@ -55,7 +55,7 @@ public function getContentType(): ?ContentType } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param ContentType $contentType * * @return self */ @@ -67,7 +67,7 @@ public function setContentType(ContentType $contentType): self } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @return Location|null */ public function getParentLocation(): ?Location { @@ -75,7 +75,7 @@ public function getParentLocation(): ?Location } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $parentLocation + * @param Location $parentLocation * * @return self */ @@ -87,7 +87,7 @@ public function setParentLocation(Location $parentLocation): self } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language|null + * @return Language|null */ public function getLanguage(): ?Language { @@ -95,7 +95,7 @@ public function getLanguage(): ?Language } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language $language + * @param Language $language * * @return self */ diff --git a/src/lib/Form/Data/Content/Draft/ContentEditData.php b/src/lib/Form/Data/Content/Draft/ContentEditData.php index 0bda17d64c..02927bd276 100644 --- a/src/lib/Form/Data/Content/Draft/ContentEditData.php +++ b/src/lib/Form/Data/Content/Draft/ContentEditData.php @@ -18,23 +18,23 @@ */ class ContentEditData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ protected $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null */ + /** @var ContentInfo|null */ protected $contentInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo|null */ + /** @var VersionInfo|null */ protected $versionInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null */ + /** @var Language|null */ protected $language; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null $contentInfo - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo|null $versionInfo - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $language - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param ContentInfo|null $contentInfo + * @param VersionInfo|null $versionInfo + * @param Language|null $language + * @param Location|null $location */ public function __construct( ?ContentInfo $contentInfo = null, @@ -49,7 +49,7 @@ public function __construct( } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @return Location|null */ public function getLocation(): ?Location { @@ -57,7 +57,7 @@ public function getLocation(): ?Location } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location * * @return self */ @@ -69,7 +69,7 @@ public function setLocation(Location $location): self } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null + * @return ContentInfo|null */ public function getContentInfo(): ?ContentInfo { @@ -77,7 +77,7 @@ public function getContentInfo(): ?ContentInfo } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null $contentInfo + * @param ContentInfo|null $contentInfo * * @return self */ @@ -89,7 +89,7 @@ public function setContentInfo(?ContentInfo $contentInfo): self } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo|null + * @return VersionInfo|null */ public function getVersionInfo(): ?VersionInfo { @@ -97,7 +97,7 @@ public function getVersionInfo(): ?VersionInfo } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo|null $versionInfo + * @param VersionInfo|null $versionInfo * * @return self */ @@ -109,7 +109,7 @@ public function setVersionInfo(?VersionInfo $versionInfo): self } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language|null + * @return Language|null */ public function getLanguage(): ?Language { @@ -117,7 +117,7 @@ public function getLanguage(): ?Language } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $language + * @param Language|null $language * * @return self */ diff --git a/src/lib/Form/Data/Content/Draft/ContentRemoveData.php b/src/lib/Form/Data/Content/Draft/ContentRemoveData.php index 31390efc25..c61a942ad3 100644 --- a/src/lib/Form/Data/Content/Draft/ContentRemoveData.php +++ b/src/lib/Form/Data/Content/Draft/ContentRemoveData.php @@ -32,7 +32,7 @@ public function getVersions(): ?array /** * @param array|null $versions * - * @return \Ibexa\AdminUi\Form\Data\Content\Draft\ContentRemoveData + * @return ContentRemoveData */ public function setVersions(?array $versions): self { diff --git a/src/lib/Form/Data/Content/Location/ContentLocationAddData.php b/src/lib/Form/Data/Content/Location/ContentLocationAddData.php index 2ef6791833..f2b3e78f21 100644 --- a/src/lib/Form/Data/Content/Location/ContentLocationAddData.php +++ b/src/lib/Form/Data/Content/Location/ContentLocationAddData.php @@ -9,17 +9,18 @@ namespace Ibexa\AdminUi\Form\Data\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; class ContentLocationAddData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null */ + /** @var ContentInfo|null */ protected $contentInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location[] */ + /** @var Location[] */ protected $newLocations; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null $currentLocation + * @param ContentInfo|null $currentLocation * @param array $newLocations */ public function __construct( @@ -31,7 +32,7 @@ public function __construct( } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null + * @return ContentInfo|null */ public function getContentInfo(): ?ContentInfo { @@ -39,7 +40,7 @@ public function getContentInfo(): ?ContentInfo } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null $contentInfo + * @param ContentInfo|null $contentInfo */ public function setContentInfo(?ContentInfo $contentInfo) { @@ -47,7 +48,7 @@ public function setContentInfo(?ContentInfo $contentInfo) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location[] + * @return Location[] */ public function getNewLocations(): array { @@ -55,7 +56,7 @@ public function getNewLocations(): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location[] $newLocations + * @param Location[] $newLocations */ public function setNewLocations(array $newLocations) { diff --git a/src/lib/Form/Data/Content/Location/ContentLocationRemoveData.php b/src/lib/Form/Data/Content/Location/ContentLocationRemoveData.php index 0b6639238c..6b91a8138f 100644 --- a/src/lib/Form/Data/Content/Location/ContentLocationRemoveData.php +++ b/src/lib/Form/Data/Content/Location/ContentLocationRemoveData.php @@ -16,7 +16,7 @@ class ContentLocationRemoveData /** * @Assert\NotBlank() * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null + * @var ContentInfo|null */ public $contentInfo; @@ -30,7 +30,7 @@ class ContentLocationRemoveData public $locations; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null $contentInfo + * @param ContentInfo|null $contentInfo * @param array $selectedLocations */ public function __construct( @@ -42,7 +42,7 @@ public function __construct( } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null + * @return ContentInfo|null */ public function getContentInfo(): ?ContentInfo { @@ -50,7 +50,7 @@ public function getContentInfo(): ?ContentInfo } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null $contentInfo + * @param ContentInfo|null $contentInfo */ public function setContentInfo(?ContentInfo $contentInfo) { diff --git a/src/lib/Form/Data/Content/Location/ContentMainLocationUpdateData.php b/src/lib/Form/Data/Content/Location/ContentMainLocationUpdateData.php index 8ce110662d..9dd06c3788 100644 --- a/src/lib/Form/Data/Content/Location/ContentMainLocationUpdateData.php +++ b/src/lib/Form/Data/Content/Location/ContentMainLocationUpdateData.php @@ -20,7 +20,7 @@ class ContentMainLocationUpdateData /** * @Assert\NotBlank() * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null + * @var ContentInfo|null */ public $contentInfo; @@ -29,7 +29,7 @@ class ContentMainLocationUpdateData * * @Assert\NotBlank() * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location + * @var Location */ public $location; diff --git a/src/lib/Form/Data/Content/Translation/MainTranslationUpdateData.php b/src/lib/Form/Data/Content/Translation/MainTranslationUpdateData.php index 406f31cf61..6dfb9a3fb4 100644 --- a/src/lib/Form/Data/Content/Translation/MainTranslationUpdateData.php +++ b/src/lib/Form/Data/Content/Translation/MainTranslationUpdateData.php @@ -16,7 +16,7 @@ class MainTranslationUpdateData /** * @Assert\NotBlank() * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Content|null + * @var Content|null */ public $content; @@ -28,7 +28,7 @@ class MainTranslationUpdateData public $languageCode; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content|null $content + * @param Content|null $content * @param string|null $languageCode */ public function __construct( @@ -40,7 +40,7 @@ public function __construct( } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content|null + * @return Content|null */ public function getContent(): ?Content { @@ -48,7 +48,7 @@ public function getContent(): ?Content } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content|null $contentInfo + * @param Content|null $contentInfo */ public function setContent(?Content $contentInfo = null) { diff --git a/src/lib/Form/Data/Content/Translation/TranslationAddData.php b/src/lib/Form/Data/Content/Translation/TranslationAddData.php index b9296991fd..f17a4cc3a1 100644 --- a/src/lib/Form/Data/Content/Translation/TranslationAddData.php +++ b/src/lib/Form/Data/Content/Translation/TranslationAddData.php @@ -17,19 +17,19 @@ class TranslationAddData /** * @Assert\NotBlank() * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @var Location|null */ protected $location; /** * @Assert\NotBlank() * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null + * @var Language|null */ protected $language; /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null + * @var Language|null */ protected $baseLanguage; diff --git a/src/lib/Form/Data/Content/Translation/TranslationDeleteData.php b/src/lib/Form/Data/Content/Translation/TranslationDeleteData.php index b5374f34f7..440e6a6f89 100644 --- a/src/lib/Form/Data/Content/Translation/TranslationDeleteData.php +++ b/src/lib/Form/Data/Content/Translation/TranslationDeleteData.php @@ -12,24 +12,26 @@ class TranslationDeleteData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null */ + /** @var ContentInfo|null */ protected $contentInfo; /** @var array|null */ protected $languageCodes; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null $contentInfo + * @param ContentInfo|null $contentInfo * @param array|null $languageCodes */ - public function __construct(?ContentInfo $contentInfo = null, array $languageCodes = []) - { + public function __construct( + ?ContentInfo $contentInfo = null, + array $languageCodes = [] + ) { $this->contentInfo = $contentInfo; $this->languageCodes = $languageCodes; } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null + * @return ContentInfo|null */ public function getContentInfo(): ?ContentInfo { @@ -37,7 +39,7 @@ public function getContentInfo(): ?ContentInfo } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null $contentInfo + * @param ContentInfo|null $contentInfo */ public function setContentInfo(?ContentInfo $contentInfo) { diff --git a/src/lib/Form/Data/ContentTranslationData.php b/src/lib/Form/Data/ContentTranslationData.php index 2e54026ed2..38b59492ab 100644 --- a/src/lib/Form/Data/ContentTranslationData.php +++ b/src/lib/Form/Data/ContentTranslationData.php @@ -9,22 +9,24 @@ namespace Ibexa\AdminUi\Form\Data; use Ibexa\Contracts\ContentForms\Data\Content\FieldData; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Core\Repository\Values\Content\ContentUpdateStruct; use Symfony\Component\Validator\Constraints as Assert; class ContentTranslationData extends ContentUpdateStruct implements NewnessCheckable { /** - * @var \Ibexa\Contracts\ContentForms\Data\Content\FieldData[] + * @var FieldData[] * * @Assert\Valid() */ protected $fieldsData; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ + /** @var Content */ protected $content; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ + /** @var ContentType */ protected $contentType; public function addFieldData(FieldData $fieldData): void diff --git a/src/lib/Form/Data/ContentType/ContentTypeCopyData.php b/src/lib/Form/Data/ContentType/ContentTypeCopyData.php index fbd32ed833..48ad23c552 100644 --- a/src/lib/Form/Data/ContentType/ContentTypeCopyData.php +++ b/src/lib/Form/Data/ContentType/ContentTypeCopyData.php @@ -13,15 +13,15 @@ class ContentTypeCopyData { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ + /** @var ContentType */ private $contentType; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup */ + /** @var ContentTypeGroup */ private $contentTypeGroup; /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup + * @param ContentType $contentType + * @param ContentTypeGroup $contentTypeGroup */ public function __construct( ?ContentType $contentType, @@ -32,7 +32,7 @@ public function __construct( } /** - * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|null + * @return ContentType|null */ public function getContentType(): ?ContentType { @@ -40,7 +40,7 @@ public function getContentType(): ?ContentType } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|null $contentType + * @param ContentType|null $contentType */ public function setContentType(?ContentType $contentType): void { @@ -48,7 +48,7 @@ public function setContentType(?ContentType $contentType): void } /** - * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup|null + * @return ContentTypeGroup|null */ public function getContentTypeGroup(): ?ContentTypeGroup { @@ -56,7 +56,7 @@ public function getContentTypeGroup(): ?ContentTypeGroup } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup|null $contentTypeGroup + * @param ContentTypeGroup|null $contentTypeGroup */ public function setContentTypeGroup(?ContentTypeGroup $contentTypeGroup): void { diff --git a/src/lib/Form/Data/ContentType/ContentTypeEditData.php b/src/lib/Form/Data/ContentType/ContentTypeEditData.php index 45bfedc19f..feead7d984 100644 --- a/src/lib/Form/Data/ContentType/ContentTypeEditData.php +++ b/src/lib/Form/Data/ContentType/ContentTypeEditData.php @@ -14,19 +14,19 @@ class ContentTypeEditData { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|null */ + /** @var ContentType|null */ private $contentType; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup|null */ + /** @var ContentTypeGroup|null */ private $contentTypeGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null */ + /** @var Language|null */ private $language; /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|null $contentType - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup|null $contentTypeGroup - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $language + * @param ContentType|null $contentType + * @param ContentTypeGroup|null $contentTypeGroup + * @param Language|null $language */ public function __construct( ?ContentType $contentType = null, @@ -39,7 +39,7 @@ public function __construct( } /** - * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|null + * @return ContentType|null */ public function getContentType(): ?ContentType { @@ -47,7 +47,7 @@ public function getContentType(): ?ContentType } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|null $contentType + * @param ContentType|null $contentType */ public function setContentType(?ContentType $contentType): void { @@ -55,7 +55,7 @@ public function setContentType(?ContentType $contentType): void } /** - * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup|null + * @return ContentTypeGroup|null */ public function getContentTypeGroup(): ?ContentTypeGroup { @@ -63,7 +63,7 @@ public function getContentTypeGroup(): ?ContentTypeGroup } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup|null $contentTypeGroup + * @param ContentTypeGroup|null $contentTypeGroup */ public function setContentTypeGroup(?ContentTypeGroup $contentTypeGroup): void { @@ -71,7 +71,7 @@ public function setContentTypeGroup(?ContentTypeGroup $contentTypeGroup): void } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language|null + * @return Language|null */ public function getLanguage(): ?Language { @@ -79,7 +79,7 @@ public function getLanguage(): ?Language } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $language + * @param Language|null $language */ public function setLanguage(?Language $language): void { diff --git a/src/lib/Form/Data/ContentType/ContentTypesDeleteData.php b/src/lib/Form/Data/ContentType/ContentTypesDeleteData.php index 8ae03a2f52..a15ebbc212 100644 --- a/src/lib/Form/Data/ContentType/ContentTypesDeleteData.php +++ b/src/lib/Form/Data/ContentType/ContentTypesDeleteData.php @@ -8,16 +8,18 @@ namespace Ibexa\AdminUi\Form\Data\ContentType; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; + /** * @todo Add validation */ class ContentTypesDeleteData { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[]|null */ + /** @var ContentType[]|null */ protected $contentTypes; /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[]|null $contentTypes + * @param ContentType[]|null $contentTypes */ public function __construct(array $contentTypes = []) { @@ -33,7 +35,7 @@ public function getContentTypes(): ?array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[]|null $contentTypes + * @param ContentType[]|null $contentTypes */ public function setContentTypes(?array $contentTypes) { diff --git a/src/lib/Form/Data/ContentType/Translation/TranslationAddData.php b/src/lib/Form/Data/ContentType/Translation/TranslationAddData.php index b222604a8f..9ba72f4ba6 100644 --- a/src/lib/Form/Data/ContentType/Translation/TranslationAddData.php +++ b/src/lib/Form/Data/ContentType/Translation/TranslationAddData.php @@ -18,26 +18,26 @@ class TranslationAddData /** * @Assert\NotBlank() * - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|null + * @var ContentType|null */ private $contentType; /** * @Assert\NotBlank() * - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup|null + * @var ContentTypeGroup|null */ private $contentTypeGroup; /** * @Assert\NotBlank() * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null + * @var Language|null */ private $language; /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null + * @var Language|null */ private $baseLanguage; diff --git a/src/lib/Form/Data/ContentType/Translation/TranslationRemoveData.php b/src/lib/Form/Data/ContentType/Translation/TranslationRemoveData.php index 5783714d11..7607891bda 100644 --- a/src/lib/Form/Data/ContentType/Translation/TranslationRemoveData.php +++ b/src/lib/Form/Data/ContentType/Translation/TranslationRemoveData.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\Form\Data\ContentType\Translation; +use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup; use Symfony\Component\Validator\Constraints as Assert; @@ -17,21 +18,21 @@ class TranslationRemoveData /** * @Assert\NotBlank() * - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|null + * @var ContentType|null */ private $contentType; /** * @Assert\NotBlank() * - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup|null + * @var ContentTypeGroup|null */ private $contentTypeGroup; /** * @Assert\NotBlank() * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Language[] + * @var Language[] */ private $languageCodes; @@ -73,7 +74,7 @@ public function setContentTypeGroup(ContentTypeGroup $contentTypeGroup): self } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language[] + * @return Language[] */ public function getLanguageCodes(): array { @@ -81,7 +82,7 @@ public function getLanguageCodes(): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language[] $languageCodes + * @param Language[] $languageCodes */ public function setLanguageCodes(array $languageCodes): void { diff --git a/src/lib/Form/Data/ContentTypeData.php b/src/lib/Form/Data/ContentTypeData.php index 13907fb8e7..7f9ea36764 100644 --- a/src/lib/Form/Data/ContentTypeData.php +++ b/src/lib/Form/Data/ContentTypeData.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\Form\Data; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeUpdateStruct; use JMS\TranslationBundle\Model\Message; use JMS\TranslationBundle\Translation\TranslationContainerInterface; @@ -15,7 +16,7 @@ /** * Base data class for ContentType update form, with FieldDefinitions data and ContentTypeDraft. * - * @property \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft + * @property ContentTypeDraft $contentTypeDraft */ class ContentTypeData extends ContentTypeUpdateStruct implements NewnessCheckable, TranslationContainerInterface { @@ -26,10 +27,10 @@ class ContentTypeData extends ContentTypeUpdateStruct implements NewnessCheckabl NewnessChecker::isNew as private isIdentifierNew; } - /** @var \Ibexa\AdminUi\Form\Data\FieldDefinitionData[][] */ + /** @var FieldDefinitionData[][] */ public $fieldDefinitionsData = []; - /** @var \Ibexa\AdminUi\Form\Data\FieldDefinitionData[][] */ + /** @var FieldDefinitionData[][] */ public array $metaFieldDefinitionsData = []; /** @@ -39,7 +40,7 @@ class ContentTypeData extends ContentTypeUpdateStruct implements NewnessCheckabl */ public $languageCode = null; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ + /** @var ContentTypeDraft */ protected $contentTypeDraft; private bool $isNew; @@ -65,7 +66,7 @@ protected function getIdentifierValue(): string } /** - * @return iterable + * @return iterable */ public function getFlatFieldDefinitionsData(): iterable { @@ -77,7 +78,7 @@ public function getFlatFieldDefinitionsData(): iterable } /** - * @return iterable + * @return iterable */ public function getFlatMetaFieldDefinitionsData(): iterable { @@ -101,8 +102,10 @@ public function addMetaFieldDefinitionData(FieldDefinitionData $fieldDefinitionD $this->metaFieldDefinitionsData[$fieldGroup][$identifier] = $fieldDefinitionData; } - public function replaceFieldDefinitionData(string $fieldDefinitionIdentifier, FieldDefinitionData $fieldDefinitionData): void - { + public function replaceFieldDefinitionData( + string $fieldDefinitionIdentifier, + FieldDefinitionData $fieldDefinitionData + ): void { foreach ($this->fieldDefinitionsData as $key => $fieldDefinitionsByGroup) { if (isset($this->fieldDefinitionsData[$key][$fieldDefinitionIdentifier])) { unset($this->fieldDefinitionsData[$key][$fieldDefinitionIdentifier]); @@ -120,7 +123,10 @@ public function sortFieldDefinitions(): void foreach ($this->fieldDefinitionsData as $key => $fieldDefinitionByGroup) { uasort( $fieldDefinitionByGroup, - static function ($a, $b): int { + static function ( + $a, + $b + ): int { if ($a->fieldDefinition->position === $b->fieldDefinition->position) { return $a->fieldDefinition->identifier <=> $b->fieldDefinition->identifier; } diff --git a/src/lib/Form/Data/ContentTypeGroup/ContentTypeGroupDeleteData.php b/src/lib/Form/Data/ContentTypeGroup/ContentTypeGroupDeleteData.php index 7dc77d6c1a..2b4d91a537 100644 --- a/src/lib/Form/Data/ContentTypeGroup/ContentTypeGroupDeleteData.php +++ b/src/lib/Form/Data/ContentTypeGroup/ContentTypeGroupDeleteData.php @@ -12,7 +12,7 @@ class ContentTypeGroupDeleteData { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup */ + /** @var ContentTypeGroup */ private $contentTypeGroup; public function __construct(?ContentTypeGroup $contentTypeGroup = null) @@ -21,7 +21,7 @@ public function __construct(?ContentTypeGroup $contentTypeGroup = null) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup + * @return ContentTypeGroup */ public function getContentTypeGroup(): ContentTypeGroup { @@ -29,7 +29,7 @@ public function getContentTypeGroup(): ContentTypeGroup } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup + * @param ContentTypeGroup $contentTypeGroup */ public function setContentTypeGroup(ContentTypeGroup $contentTypeGroup) { diff --git a/src/lib/Form/Data/ContentTypeGroup/ContentTypeGroupUpdateData.php b/src/lib/Form/Data/ContentTypeGroup/ContentTypeGroupUpdateData.php index b03082804a..b6196b37e6 100644 --- a/src/lib/Form/Data/ContentTypeGroup/ContentTypeGroupUpdateData.php +++ b/src/lib/Form/Data/ContentTypeGroup/ContentTypeGroupUpdateData.php @@ -12,7 +12,7 @@ class ContentTypeGroupUpdateData { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup */ + /** @var ContentTypeGroup */ private $contentTypeGroup; /** @var string */ @@ -43,7 +43,7 @@ public function setIdentifier(string $identifier) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup + * @return ContentTypeGroup */ public function getContentTypeGroup(): ContentTypeGroup { @@ -51,7 +51,7 @@ public function getContentTypeGroup(): ContentTypeGroup } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup $contentTypeGroup + * @param ContentTypeGroup $contentTypeGroup */ public function setContentTypeGroup(ContentTypeGroup $contentTypeGroup) { diff --git a/src/lib/Form/Data/ContentTypeGroup/ContentTypeGroupsDeleteData.php b/src/lib/Form/Data/ContentTypeGroup/ContentTypeGroupsDeleteData.php index 71f8aa7ff4..090a38eced 100644 --- a/src/lib/Form/Data/ContentTypeGroup/ContentTypeGroupsDeleteData.php +++ b/src/lib/Form/Data/ContentTypeGroup/ContentTypeGroupsDeleteData.php @@ -8,16 +8,18 @@ namespace Ibexa\AdminUi\Form\Data\ContentTypeGroup; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup; + /** * @todo Add validation */ class ContentTypeGroupsDeleteData { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup[]|null */ + /** @var ContentTypeGroup[]|null */ protected $contentTypeGroups; /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup[]|null $contentTypeGroups + * @param ContentTypeGroup[]|null $contentTypeGroups */ public function __construct(array $contentTypeGroups = []) { diff --git a/src/lib/Form/Data/DateRangeData.php b/src/lib/Form/Data/DateRangeData.php index 26336fd7b4..b000ad4587 100644 --- a/src/lib/Form/Data/DateRangeData.php +++ b/src/lib/Form/Data/DateRangeData.php @@ -16,8 +16,10 @@ final class DateRangeData private ?DateTimeInterface $max; - public function __construct(?DateTimeInterface $min = null, ?DateTimeInterface $max = null) - { + public function __construct( + ?DateTimeInterface $min = null, + ?DateTimeInterface $max = null + ) { $this->min = $min; $this->max = $max; } diff --git a/src/lib/Form/Data/FieldDefinitionData.php b/src/lib/Form/Data/FieldDefinitionData.php index a47f6f1654..c33d9d7bfb 100644 --- a/src/lib/Form/Data/FieldDefinitionData.php +++ b/src/lib/Form/Data/FieldDefinitionData.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\Form\Data; +use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition; use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinitionUpdateStruct; use JMS\TranslationBundle\Model\Message; use JMS\TranslationBundle\Translation\TranslationContainerInterface; @@ -15,15 +16,15 @@ /** * Base class for FieldDefinition forms, with corresponding FieldDefinition object. * - * @property \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition $fieldDefinition - * @property \Ibexa\AdminUi\Form\Data\ContentTypeData $contentTypeData + * @property FieldDefinition $fieldDefinition + * @property ContentTypeData $contentTypeData */ class FieldDefinitionData extends FieldDefinitionUpdateStruct implements TranslationContainerInterface { public bool $enabled; /** - * @var \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition + * @var FieldDefinition */ protected $fieldDefinition; @@ -31,7 +32,7 @@ class FieldDefinitionData extends FieldDefinitionUpdateStruct implements Transla * ContentTypeData holding current FieldDefinitionData. * Mainly used for validation. * - * @var \Ibexa\AdminUi\Form\Data\ContentTypeData + * @var ContentTypeData */ protected $contentTypeData; diff --git a/src/lib/Form/Data/FormMapper/ContentCreateMapper.php b/src/lib/Form/Data/FormMapper/ContentCreateMapper.php index 9b60189b5f..212844164d 100644 --- a/src/lib/Form/Data/FormMapper/ContentCreateMapper.php +++ b/src/lib/Form/Data/FormMapper/ContentCreateMapper.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\AdminUi\Form\Data\FormMapper\FormDataMapperInterface; use Ibexa\Contracts\ContentForms\Data\Content\FieldData; use Ibexa\Contracts\Core\Repository\Values\Content\Field; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Repository\Values\ValueObject; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -23,13 +24,15 @@ class ContentCreateMapper implements FormDataMapperInterface /** * Maps a ValueObject from Ibexa content repository to a data usable as underlying form data (e.g. create/update struct). * - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|\Ibexa\Contracts\Core\Repository\Values\ValueObject $contentType + * @param ContentType|ValueObject $contentType * @param array $params * - * @return \Ibexa\ContentForms\Data\Content\ContentCreateData + * @return ContentCreateData */ - public function mapToFormData(ValueObject $contentType, array $params = []) - { + public function mapToFormData( + ValueObject $contentType, + array $params = [] + ) { $resolver = new OptionsResolver(); $this->configureOptions($resolver); $params = $resolver->resolve($params); diff --git a/src/lib/Form/Data/FormMapper/ContentTranslationMapper.php b/src/lib/Form/Data/FormMapper/ContentTranslationMapper.php index 96455e905b..1d522c5ad9 100644 --- a/src/lib/Form/Data/FormMapper/ContentTranslationMapper.php +++ b/src/lib/Form/Data/FormMapper/ContentTranslationMapper.php @@ -11,9 +11,16 @@ use Ibexa\AdminUi\Form\Data\ContentTranslationData; use Ibexa\Contracts\AdminUi\Form\Data\FormMapper\FormDataMapperInterface; use Ibexa\Contracts\ContentForms\Data\Content\FieldData; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Repository\Values\ValueObject; +use Symfony\Component\OptionsResolver\Exception\AccessException; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; +use Symfony\Component\OptionsResolver\Exception\MissingOptionsException; +use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; +use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; +use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; use Symfony\Component\OptionsResolver\OptionsResolver; class ContentTranslationMapper implements FormDataMapperInterface @@ -22,32 +29,34 @@ class ContentTranslationMapper implements FormDataMapperInterface * Maps a ValueObject from Ibexa content repository to a data usable as underlying form data (e.g. create/update * struct). * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content|\Ibexa\Contracts\Core\Repository\Values\ValueObject $content + * @param Content|ValueObject $content * @param array $params * - * @return \Ibexa\AdminUi\Form\Data\ContentTranslationData + * @return ContentTranslationData * - * @throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException - * @throws \Symfony\Component\OptionsResolver\Exception\NoSuchOptionException - * @throws \Symfony\Component\OptionsResolver\Exception\MissingOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\AccessException + * @throws UndefinedOptionsException + * @throws OptionDefinitionException + * @throws NoSuchOptionException + * @throws MissingOptionsException + * @throws InvalidOptionsException + * @throws AccessException */ - public function mapToFormData(ValueObject $content, array $params = []) - { + public function mapToFormData( + ValueObject $content, + array $params = [] + ) { $optionsResolver = new OptionsResolver(); $this->configureOptions($optionsResolver); $params = $optionsResolver->resolve($params); - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language $language */ + /** @var Language $language */ $language = $params['language']; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $baseLanguage */ + /** @var Language|null $baseLanguage */ $baseLanguage = $params['baseLanguage']; $baseLanguageCode = $baseLanguage ? $baseLanguage->languageCode : null; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType */ + /** @var ContentType $contentType */ $contentType = $params['contentType']; $data = new ContentTranslationData(['content' => $content, 'contentType' => $contentType]); @@ -71,10 +80,10 @@ public function mapToFormData(ValueObject $content, array $params = []) } /** - * @param \Symfony\Component\OptionsResolver\OptionsResolver $optionsResolver + * @param OptionsResolver $optionsResolver * - * @throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\AccessException + * @throws UndefinedOptionsException + * @throws AccessException */ private function configureOptions(OptionsResolver $optionsResolver) { diff --git a/src/lib/Form/Data/FormMapper/ContentTypeDraftMapper.php b/src/lib/Form/Data/FormMapper/ContentTypeDraftMapper.php index f80eabc4e9..3fdcaa9dd8 100644 --- a/src/lib/Form/Data/FormMapper/ContentTypeDraftMapper.php +++ b/src/lib/Form/Data/FormMapper/ContentTypeDraftMapper.php @@ -16,9 +16,12 @@ use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Values\Content\Language; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft; use Ibexa\Contracts\Core\Repository\Values\ValueObject; use Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\OptionsResolver\Exception\AccessException; +use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; use Symfony\Component\OptionsResolver\OptionsResolver; class ContentTypeDraftMapper implements FormDataMapperInterface @@ -27,14 +30,14 @@ class ContentTypeDraftMapper implements FormDataMapperInterface private ContentTypeService $contentTypeService; - /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ + /** @var EventDispatcherInterface */ private $eventDispatcher; - /** @var \Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList */ + /** @var FieldsGroupsList */ private $fieldsGroupsList; /** - * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher + * @param EventDispatcherInterface $eventDispatcher */ public function __construct( ContentTypeFieldTypesResolverInterface $contentTypeFieldTypesResolver, @@ -51,21 +54,23 @@ public function __construct( /** * Maps a ValueObject from Ibexa content repository to a data usable as underlying form data (e.g. create/update struct). * - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft|\Ibexa\Contracts\Core\Repository\Values\ValueObject $contentTypeDraft + * @param ContentTypeDraft|ValueObject $contentTypeDraft * @param array $params * - * @return \Ibexa\AdminUi\Form\Data\ContentTypeData + * @return ContentTypeData */ - public function mapToFormData(ValueObject $contentTypeDraft, array $params = []) - { + public function mapToFormData( + ValueObject $contentTypeDraft, + array $params = [] + ) { $optionsResolver = new OptionsResolver(); $this->configureOptions($optionsResolver); $params = $optionsResolver->resolve($params); - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language $language */ + /** @var Language $language */ $language = $params['language'] ?? null; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $baseLanguage */ + /** @var Language|null $baseLanguage */ $baseLanguage = $params['baseLanguage'] ?? null; $contentTypeData = new ContentTypeData(['contentTypeDraft' => $contentTypeDraft]); @@ -136,10 +141,10 @@ public function mapToFormData(ValueObject $contentTypeDraft, array $params = []) } /** - * @param \Symfony\Component\OptionsResolver\OptionsResolver $optionsResolver + * @param OptionsResolver $optionsResolver * - * @throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\AccessException + * @throws UndefinedOptionsException + * @throws AccessException */ private function configureOptions(OptionsResolver $optionsResolver) { diff --git a/src/lib/Form/Data/FormMapper/ContentUpdateMapper.php b/src/lib/Form/Data/FormMapper/ContentUpdateMapper.php index d24bc0c548..81c8bdc108 100644 --- a/src/lib/Form/Data/FormMapper/ContentUpdateMapper.php +++ b/src/lib/Form/Data/FormMapper/ContentUpdateMapper.php @@ -11,6 +11,7 @@ use Ibexa\ContentForms\Data\Content\ContentUpdateData; use Ibexa\Contracts\AdminUi\Form\Data\FormMapper\FormDataMapperInterface; use Ibexa\Contracts\ContentForms\Data\Content\FieldData; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Repository\Values\ValueObject; use Symfony\Component\OptionsResolver\OptionsResolver; @@ -20,13 +21,15 @@ class ContentUpdateMapper implements FormDataMapperInterface /** * Maps a ValueObject from Ibexa content repository to a data usable as underlying form data (e.g. create/update struct). * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content|\Ibexa\Contracts\Core\Repository\Values\ValueObject $contentDraft + * @param Content|ValueObject $contentDraft * @param array $params * - * @return \Ibexa\ContentForms\Data\Content\ContentUpdateData + * @return ContentUpdateData */ - public function mapToFormData(ValueObject $contentDraft, array $params = []) - { + public function mapToFormData( + ValueObject $contentDraft, + array $params = [] + ) { $optionsResolver = new OptionsResolver(); $this->configureOptions($optionsResolver); diff --git a/src/lib/Form/Data/FormMapper/UserCreateMapper.php b/src/lib/Form/Data/FormMapper/UserCreateMapper.php index c47271d2c4..3367966ae7 100644 --- a/src/lib/Form/Data/FormMapper/UserCreateMapper.php +++ b/src/lib/Form/Data/FormMapper/UserCreateMapper.php @@ -12,6 +12,13 @@ use Ibexa\Contracts\ContentForms\Data\Content\FieldData; use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; +use Ibexa\Contracts\Core\Repository\Values\User\UserGroup; +use Symfony\Component\OptionsResolver\Exception\AccessException; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; +use Symfony\Component\OptionsResolver\Exception\MissingOptionsException; +use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; +use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; +use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; use Symfony\Component\OptionsResolver\OptionsResolver; /** @@ -20,21 +27,24 @@ class UserCreateMapper { /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType - * @param \Ibexa\Contracts\Core\Repository\Values\User\UserGroup[] $parentGroups + * @param ContentType $contentType + * @param UserGroup[] $parentGroups * @param array $params * - * @return \Ibexa\ContentForms\Data\User\UserCreateData + * @return UserCreateData * - * @throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException - * @throws \Symfony\Component\OptionsResolver\Exception\NoSuchOptionException - * @throws \Symfony\Component\OptionsResolver\Exception\MissingOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\AccessException + * @throws UndefinedOptionsException + * @throws OptionDefinitionException + * @throws NoSuchOptionException + * @throws MissingOptionsException + * @throws InvalidOptionsException + * @throws AccessException */ - public function mapToFormData(ContentType $contentType, array $parentGroups, array $params = []): UserCreateData - { + public function mapToFormData( + ContentType $contentType, + array $parentGroups, + array $params = [] + ): UserCreateData { $resolver = new OptionsResolver(); $this->configureOptions($resolver); $params = $resolver->resolve($params); diff --git a/src/lib/Form/Data/FormMapper/UserUpdateMapper.php b/src/lib/Form/Data/FormMapper/UserUpdateMapper.php index 12e7d02387..356ab9680e 100644 --- a/src/lib/Form/Data/FormMapper/UserUpdateMapper.php +++ b/src/lib/Form/Data/FormMapper/UserUpdateMapper.php @@ -12,6 +12,12 @@ use Ibexa\Contracts\ContentForms\Data\Content\FieldData; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Repository\Values\User\User; +use Symfony\Component\OptionsResolver\Exception\AccessException; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; +use Symfony\Component\OptionsResolver\Exception\MissingOptionsException; +use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; +use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; +use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; use Symfony\Component\OptionsResolver\OptionsResolver; /** @@ -22,21 +28,24 @@ class UserUpdateMapper /** * Maps a ValueObject from Ibexa content repository to a data usable as underlying form data (e.g. create/update struct). * - * @param \Ibexa\Contracts\Core\Repository\Values\User\User $user - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param User $user + * @param ContentType $contentType * @param array $params * - * @return \Ibexa\ContentForms\Data\User\UserUpdateData + * @return UserUpdateData * - * @throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException - * @throws \Symfony\Component\OptionsResolver\Exception\NoSuchOptionException - * @throws \Symfony\Component\OptionsResolver\Exception\MissingOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\AccessException + * @throws UndefinedOptionsException + * @throws OptionDefinitionException + * @throws NoSuchOptionException + * @throws MissingOptionsException + * @throws InvalidOptionsException + * @throws AccessException */ - public function mapToFormData(User $user, ContentType $contentType, array $params = []): UserUpdateData - { + public function mapToFormData( + User $user, + ContentType $contentType, + array $params = [] + ): UserUpdateData { $optionsResolver = new OptionsResolver(); $this->configureOptions($optionsResolver); $params = $optionsResolver->resolve($params); diff --git a/src/lib/Form/Data/Language/LanguageDeleteData.php b/src/lib/Form/Data/Language/LanguageDeleteData.php index 408fab3410..1ca076c946 100644 --- a/src/lib/Form/Data/Language/LanguageDeleteData.php +++ b/src/lib/Form/Data/Language/LanguageDeleteData.php @@ -11,7 +11,7 @@ class LanguageDeleteData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ + /** @var Language */ private $language; public function __construct(?Language $language = null) @@ -20,7 +20,7 @@ public function __construct(?Language $language = null) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language + * @return Language */ public function getLanguage(): ?Language { @@ -28,7 +28,7 @@ public function getLanguage(): ?Language } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language $language + * @param Language $language */ public function setLanguage(Language $language) { diff --git a/src/lib/Form/Data/Language/LanguageUpdateData.php b/src/lib/Form/Data/Language/LanguageUpdateData.php index 149e8823c0..164d6879bd 100644 --- a/src/lib/Form/Data/Language/LanguageUpdateData.php +++ b/src/lib/Form/Data/Language/LanguageUpdateData.php @@ -12,7 +12,7 @@ class LanguageUpdateData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ + /** @var Language */ private $language; /** diff --git a/src/lib/Form/Data/Language/LanguagesDeleteData.php b/src/lib/Form/Data/Language/LanguagesDeleteData.php index 4400f2b2ed..f51151884e 100644 --- a/src/lib/Form/Data/Language/LanguagesDeleteData.php +++ b/src/lib/Form/Data/Language/LanguagesDeleteData.php @@ -8,6 +8,8 @@ namespace Ibexa\AdminUi\Form\Data\Language; +use Ibexa\Contracts\Core\Repository\Values\Content\Language; + /** * @todo Add validation */ @@ -17,7 +19,7 @@ class LanguagesDeleteData protected $languages; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language[]|null $languages + * @param Language[]|null $languages */ public function __construct(array $languages = []) { diff --git a/src/lib/Form/Data/Location/AbstractLocationCopyData.php b/src/lib/Form/Data/Location/AbstractLocationCopyData.php index ac43b288a2..9e27cc678b 100644 --- a/src/lib/Form/Data/Location/AbstractLocationCopyData.php +++ b/src/lib/Form/Data/Location/AbstractLocationCopyData.php @@ -12,14 +12,16 @@ abstract class AbstractLocationCopyData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ protected $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ protected $newParentLocation; - public function __construct(?Location $location = null, ?Location $newParentLocation = null) - { + public function __construct( + ?Location $location = null, + ?Location $newParentLocation = null + ) { $this->location = $location; $this->newParentLocation = $newParentLocation; } diff --git a/src/lib/Form/Data/Location/LocationAssignSubtreeData.php b/src/lib/Form/Data/Location/LocationAssignSubtreeData.php index 40ff9ab897..a34b8c6c00 100644 --- a/src/lib/Form/Data/Location/LocationAssignSubtreeData.php +++ b/src/lib/Form/Data/Location/LocationAssignSubtreeData.php @@ -15,27 +15,29 @@ class LocationAssignSubtreeData { /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Section|null + * @var Section|null * * @Assert\NotBlank() */ protected $section; /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @var Location|null * * @Assert\NotBlank() */ protected $location; - public function __construct(?Section $section = null, ?Location $location = null) - { + public function __construct( + ?Section $section = null, + ?Location $location = null + ) { $this->section = $section; $this->location = $location; } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Section|null + * @return Section|null */ public function getSection(): ?Section { @@ -43,7 +45,7 @@ public function getSection(): ?Section } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section|null $section + * @param Section|null $section */ public function setSection(?Section $section): void { @@ -51,7 +53,7 @@ public function setSection(?Section $section): void } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @return Location|null */ public function getLocation(): ?Location { @@ -59,7 +61,7 @@ public function getLocation(): ?Location } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location */ public function setLocation(?Location $location): void { diff --git a/src/lib/Form/Data/Location/LocationCopyData.php b/src/lib/Form/Data/Location/LocationCopyData.php index 6dc8a4bd53..48e75d080e 100644 --- a/src/lib/Form/Data/Location/LocationCopyData.php +++ b/src/lib/Form/Data/Location/LocationCopyData.php @@ -8,8 +8,6 @@ namespace Ibexa\AdminUi\Form\Data\Location; -class LocationCopyData extends AbstractLocationCopyData -{ -} +class LocationCopyData extends AbstractLocationCopyData {} class_alias(LocationCopyData::class, 'EzSystems\EzPlatformAdminUi\Form\Data\Location\LocationCopyData'); diff --git a/src/lib/Form/Data/Location/LocationCopySubtreeData.php b/src/lib/Form/Data/Location/LocationCopySubtreeData.php index 35a9dc8694..a0fee2a864 100644 --- a/src/lib/Form/Data/Location/LocationCopySubtreeData.php +++ b/src/lib/Form/Data/Location/LocationCopySubtreeData.php @@ -8,12 +8,13 @@ namespace Ibexa\AdminUi\Form\Data\Location; use Ibexa\AdminUi\Validator\Constraints as AdminUiAssert; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Symfony\Component\Validator\Constraints as Assert; class LocationCopySubtreeData extends AbstractLocationCopyData { /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @var Location|null * * @AdminUiAssert\LocationIsWithinCopySubtreeLimit() * @@ -24,7 +25,7 @@ class LocationCopySubtreeData extends AbstractLocationCopyData protected $location; /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @var Location|null * * @AdminUiAssert\LocationIsContainer() * diff --git a/src/lib/Form/Data/Location/LocationMoveData.php b/src/lib/Form/Data/Location/LocationMoveData.php index c04857744c..125a341fa5 100644 --- a/src/lib/Form/Data/Location/LocationMoveData.php +++ b/src/lib/Form/Data/Location/LocationMoveData.php @@ -15,14 +15,16 @@ */ class LocationMoveData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ protected $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ protected $newParentLocation; - public function __construct(?Location $location = null, ?Location $newParentLocation = null) - { + public function __construct( + ?Location $location = null, + ?Location $newParentLocation = null + ) { $this->location = $location; $this->newParentLocation = $newParentLocation; } diff --git a/src/lib/Form/Data/Location/LocationSwapData.php b/src/lib/Form/Data/Location/LocationSwapData.php index 36e0855da7..3fc7ccda03 100644 --- a/src/lib/Form/Data/Location/LocationSwapData.php +++ b/src/lib/Form/Data/Location/LocationSwapData.php @@ -15,14 +15,16 @@ */ class LocationSwapData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ protected $currentLocation; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ protected $newLocation; - public function __construct(?Location $currentLocation = null, ?Location $newLocation = null) - { + public function __construct( + ?Location $currentLocation = null, + ?Location $newLocation = null + ) { $this->currentLocation = $currentLocation; $this->newLocation = $newLocation; } diff --git a/src/lib/Form/Data/Location/LocationTrashData.php b/src/lib/Form/Data/Location/LocationTrashData.php index 4eaa511395..ca21c2be80 100644 --- a/src/lib/Form/Data/Location/LocationTrashData.php +++ b/src/lib/Form/Data/Location/LocationTrashData.php @@ -12,14 +12,14 @@ class LocationTrashData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ private $location; /** @var array|null */ private $trashOptions; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location * @param array|null $trashOptions */ public function __construct( @@ -31,7 +31,7 @@ public function __construct( } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @return Location|null */ public function getLocation(): ?Location { @@ -39,7 +39,7 @@ public function getLocation(): ?Location } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location */ public function setLocation(?Location $location): void { diff --git a/src/lib/Form/Data/Location/LocationUpdateData.php b/src/lib/Form/Data/Location/LocationUpdateData.php index abf72048e5..17e08dc615 100644 --- a/src/lib/Form/Data/Location/LocationUpdateData.php +++ b/src/lib/Form/Data/Location/LocationUpdateData.php @@ -15,7 +15,7 @@ */ class LocationUpdateData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ protected $location; /** @var string|null */ @@ -25,7 +25,7 @@ class LocationUpdateData protected $sortOrder; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location */ public function __construct(?Location $location = null) { @@ -35,7 +35,7 @@ public function __construct(?Location $location = null) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @return Location|null */ public function getLocation(): ?Location { @@ -43,7 +43,7 @@ public function getLocation(): ?Location } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location */ public function setLocation(?Location $location) { diff --git a/src/lib/Form/Data/Location/LocationUpdateVisibilityData.php b/src/lib/Form/Data/Location/LocationUpdateVisibilityData.php index cb5bfedcd8..5777a23946 100644 --- a/src/lib/Form/Data/Location/LocationUpdateVisibilityData.php +++ b/src/lib/Form/Data/Location/LocationUpdateVisibilityData.php @@ -15,14 +15,14 @@ */ class LocationUpdateVisibilityData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ private $location; /** @var bool|null */ private $hidden; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location */ public function __construct(?Location $location = null) { @@ -35,7 +35,7 @@ public function __construct(?Location $location = null) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @return Location|null */ public function getLocation(): ?Location { @@ -43,7 +43,7 @@ public function getLocation(): ?Location } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location */ public function setLocation(?Location $location) { diff --git a/src/lib/Form/Data/ObjectState/ContentObjectStateUpdateData.php b/src/lib/Form/Data/ObjectState/ContentObjectStateUpdateData.php index 203257dc45..a330175cd4 100644 --- a/src/lib/Form/Data/ObjectState/ContentObjectStateUpdateData.php +++ b/src/lib/Form/Data/ObjectState/ContentObjectStateUpdateData.php @@ -15,17 +15,17 @@ class ContentObjectStateUpdateData { /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo + * @var ContentInfo */ private $contentInfo; /** - * @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup + * @var ObjectStateGroup */ private $objectStateGroup; /** - * @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState + * @var ObjectState */ private $objectState; diff --git a/src/lib/Form/Data/ObjectState/ObjectStateDeleteData.php b/src/lib/Form/Data/ObjectState/ObjectStateDeleteData.php index c5b7bd1f82..aaa512defd 100644 --- a/src/lib/Form/Data/ObjectState/ObjectStateDeleteData.php +++ b/src/lib/Form/Data/ObjectState/ObjectStateDeleteData.php @@ -13,12 +13,12 @@ class ObjectStateDeleteData { /** - * @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState|null + * @var ObjectState|null */ private $objectState; /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState|null $objectState + * @param ObjectState|null $objectState */ public function __construct(?ObjectState $objectState = null) { @@ -26,7 +26,7 @@ public function __construct(?ObjectState $objectState = null) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState + * @return ObjectState */ public function getObjectState(): ObjectState { @@ -34,7 +34,7 @@ public function getObjectState(): ObjectState } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState $objectState + * @param ObjectState $objectState */ public function setObjectState(ObjectState $objectState) { diff --git a/src/lib/Form/Data/ObjectState/ObjectStateGroupDeleteData.php b/src/lib/Form/Data/ObjectState/ObjectStateGroupDeleteData.php index c0270e4d46..ca828c43ab 100644 --- a/src/lib/Form/Data/ObjectState/ObjectStateGroupDeleteData.php +++ b/src/lib/Form/Data/ObjectState/ObjectStateGroupDeleteData.php @@ -13,12 +13,12 @@ class ObjectStateGroupDeleteData { /** - * @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup|null + * @var ObjectStateGroup|null */ private $objectStateGroup; /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup|null $objectStateGroup + * @param ObjectStateGroup|null $objectStateGroup */ public function __construct(?ObjectStateGroup $objectStateGroup = null) { @@ -26,7 +26,7 @@ public function __construct(?ObjectStateGroup $objectStateGroup = null) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup + * @return ObjectStateGroup */ public function getObjectStateGroup(): ObjectStateGroup { @@ -34,7 +34,7 @@ public function getObjectStateGroup(): ObjectStateGroup } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup + * @param ObjectStateGroup $objectStateGroup */ public function setObjectStateGroup(ObjectStateGroup $objectStateGroup) { diff --git a/src/lib/Form/Data/ObjectState/ObjectStateGroupUpdateData.php b/src/lib/Form/Data/ObjectState/ObjectStateGroupUpdateData.php index 8f46bfd76d..152d7e503e 100644 --- a/src/lib/Form/Data/ObjectState/ObjectStateGroupUpdateData.php +++ b/src/lib/Form/Data/ObjectState/ObjectStateGroupUpdateData.php @@ -12,7 +12,7 @@ class ObjectStateGroupUpdateData { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup|null */ + /** @var ObjectStateGroup|null */ private $objectStateGroup; /** @var string */ @@ -22,7 +22,7 @@ class ObjectStateGroupUpdateData private $name; /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup|null $objectStateGroup + * @param ObjectStateGroup|null $objectStateGroup */ public function __construct(?ObjectStateGroup $objectStateGroup = null) { @@ -66,7 +66,7 @@ public function setName(string $name) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup + * @return ObjectStateGroup */ public function getObjectStateGroup(): ObjectStateGroup { @@ -74,7 +74,7 @@ public function getObjectStateGroup(): ObjectStateGroup } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup + * @param ObjectStateGroup $objectStateGroup */ public function setObjectStateGroup(ObjectStateGroup $objectStateGroup) { diff --git a/src/lib/Form/Data/ObjectState/ObjectStateGroupsDeleteData.php b/src/lib/Form/Data/ObjectState/ObjectStateGroupsDeleteData.php index 49fec8d066..70ce2cfa01 100644 --- a/src/lib/Form/Data/ObjectState/ObjectStateGroupsDeleteData.php +++ b/src/lib/Form/Data/ObjectState/ObjectStateGroupsDeleteData.php @@ -8,13 +8,15 @@ namespace Ibexa\AdminUi\Form\Data\ObjectState; +use Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup; + class ObjectStateGroupsDeleteData { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup[]|null */ + /** @var ObjectStateGroup[]|null */ protected $objectStateGroups; /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup[]|null $objectStateGroups + * @param ObjectStateGroup[]|null $objectStateGroups */ public function __construct(array $objectStateGroups = []) { @@ -22,7 +24,7 @@ public function __construct(array $objectStateGroups = []) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup[]|null + * @return ObjectStateGroup[]|null */ public function getObjectStateGroups(): ?array { @@ -30,7 +32,7 @@ public function getObjectStateGroups(): ?array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup[]|null $objectStateGroups + * @param ObjectStateGroup[]|null $objectStateGroups */ public function setObjectStateGroups(?array $objectStateGroups) { diff --git a/src/lib/Form/Data/ObjectState/ObjectStateUpdateData.php b/src/lib/Form/Data/ObjectState/ObjectStateUpdateData.php index e94f3f8f13..01fd9a43c4 100644 --- a/src/lib/Form/Data/ObjectState/ObjectStateUpdateData.php +++ b/src/lib/Form/Data/ObjectState/ObjectStateUpdateData.php @@ -13,7 +13,7 @@ class ObjectStateUpdateData { /** - * @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState|null + * @var ObjectState|null */ private $objectState; @@ -24,7 +24,7 @@ class ObjectStateUpdateData private $name; /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState|null $objectState + * @param ObjectState|null $objectState */ public function __construct(?ObjectState $objectState = null) { @@ -68,7 +68,7 @@ public function setName(string $name) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState + * @return ObjectState */ public function getObjectState(): ObjectState { @@ -76,7 +76,7 @@ public function getObjectState(): ObjectState } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState $objectState + * @param ObjectState $objectState */ public function setObjectState(ObjectState $objectState) { diff --git a/src/lib/Form/Data/ObjectState/ObjectStatesDeleteData.php b/src/lib/Form/Data/ObjectState/ObjectStatesDeleteData.php index 1e93ebbcfe..17906be295 100644 --- a/src/lib/Form/Data/ObjectState/ObjectStatesDeleteData.php +++ b/src/lib/Form/Data/ObjectState/ObjectStatesDeleteData.php @@ -8,13 +8,15 @@ namespace Ibexa\AdminUi\Form\Data\ObjectState; +use Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState; + class ObjectStatesDeleteData { - /** @var \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState[]|null */ + /** @var ObjectState[]|null */ protected $objectStates; /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState[]|null $objectStates + * @param ObjectState[]|null $objectStates */ public function __construct(array $objectStates = []) { @@ -22,7 +24,7 @@ public function __construct(array $objectStates = []) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState[]|null + * @return ObjectState[]|null */ public function getObjectStates(): ?array { @@ -30,7 +32,7 @@ public function getObjectStates(): ?array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState[]|null $objectStates + * @param ObjectState[]|null $objectStates */ public function setObjectStates(?array $objectStates) { diff --git a/src/lib/Form/Data/Policy/PoliciesDeleteData.php b/src/lib/Form/Data/Policy/PoliciesDeleteData.php index 9cb5e0308e..a1afefee88 100644 --- a/src/lib/Form/Data/Policy/PoliciesDeleteData.php +++ b/src/lib/Form/Data/Policy/PoliciesDeleteData.php @@ -15,24 +15,26 @@ */ class PoliciesDeleteData { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role|null */ + /** @var Role|null */ protected $role; /** @var array|null */ protected $policies; /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role|null $role + * @param Role|null $role * @param array|null $policies */ - public function __construct(?Role $role = null, array $policies = []) - { + public function __construct( + ?Role $role = null, + array $policies = [] + ) { $this->role = $role; $this->policies = $policies; } /** - * @return \Ibexa\Contracts\Core\Repository\Values\User\Role|null + * @return Role|null */ public function getRole(): ?Role { @@ -40,7 +42,7 @@ public function getRole(): ?Role } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role|null $role + * @param Role|null $role */ public function setRole(?Role $role) { diff --git a/src/lib/Form/Data/PolicyData.php b/src/lib/Form/Data/PolicyData.php index e95516f2af..469d760bff 100644 --- a/src/lib/Form/Data/PolicyData.php +++ b/src/lib/Form/Data/PolicyData.php @@ -28,8 +28,11 @@ class PolicyData * @param string $function * @param array $limitations */ - public function __construct($module = null, $function = null, array $limitations = []) - { + public function __construct( + $module = null, + $function = null, + array $limitations = [] + ) { $this->module = $module; $this->function = $function; $this->limitations = $limitations; diff --git a/src/lib/Form/Data/Role/RoleAssignmentCreateData.php b/src/lib/Form/Data/Role/RoleAssignmentCreateData.php index 537e4d5efd..1c49c2e388 100644 --- a/src/lib/Form/Data/Role/RoleAssignmentCreateData.php +++ b/src/lib/Form/Data/Role/RoleAssignmentCreateData.php @@ -10,6 +10,8 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\Section; +use Ibexa\Contracts\Core\Repository\Values\User\User; +use Ibexa\Contracts\Core\Repository\Values\User\UserGroup; use JMS\TranslationBundle\Model\Message; use JMS\TranslationBundle\Translation\TranslationContainerInterface; use Symfony\Component\Validator\Constraints as Assert; @@ -21,14 +23,14 @@ class RoleAssignmentCreateData implements TranslationContainerInterface public const LIMITATION_TYPE_SECTION = 'section'; public const LIMITATION_TYPE_LOCATION = 'location'; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup[] */ + /** @var UserGroup[] */ private $groups; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User[] */ + /** @var User[] */ private $users; /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Section[] + * @var Section[] * * @Assert\Expression( * "this.getLimitationType() != 'section' or (this.getLimitationType() == 'section' and value != [])", @@ -38,7 +40,7 @@ class RoleAssignmentCreateData implements TranslationContainerInterface private $sections; /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location[] + * @var Location[] * * @Assert\Expression( * "this.getLimitationType() != 'location' or (this.getLimitationType() == 'location' and value != [])", @@ -61,10 +63,10 @@ class RoleAssignmentCreateData implements TranslationContainerInterface private $limitationType; /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\UserGroup[] $groups - * @param \Ibexa\Contracts\Core\Repository\Values\User\User[] $users - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section[] $sections - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location[] $locations + * @param UserGroup[] $groups + * @param User[] $users + * @param Section[] $sections + * @param Location[] $locations * @param string $limitationType */ public function __construct( @@ -82,7 +84,7 @@ public function __construct( } /** - * @return \Ibexa\Contracts\Core\Repository\Values\User\UserGroup[] + * @return UserGroup[] */ public function getGroups(): ?array { @@ -90,7 +92,7 @@ public function getGroups(): ?array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\UserGroup[] $groups + * @param UserGroup[] $groups * * @return self */ @@ -102,7 +104,7 @@ public function setGroups(array $groups): self } /** - * @return \Ibexa\Contracts\Core\Repository\Values\User\User[] + * @return User[] */ public function getUsers(): ?array { @@ -110,7 +112,7 @@ public function getUsers(): ?array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\User[] $users + * @param User[] $users * * @return self */ @@ -122,7 +124,7 @@ public function setUsers(array $users): self } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Section[] + * @return Section[] */ public function getSections(): ?array { @@ -130,7 +132,7 @@ public function getSections(): ?array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section[] $sections + * @param Section[] $sections * * @return self */ @@ -142,7 +144,7 @@ public function setSections(array $sections): self } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location[] + * @return Location[] */ public function getLocations(): ?array { @@ -150,7 +152,7 @@ public function getLocations(): ?array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location[] $locations + * @param Location[] $locations * * @return self */ @@ -182,13 +184,15 @@ public function setLimitationType(string $limitationType): self } /** - * @param \Symfony\Component\Validator\Context\ExecutionContextInterface $context + * @param ExecutionContextInterface $context * @param $payload * * @Assert\Callback */ - public function validate(ExecutionContextInterface $context, $payload) - { + public function validate( + ExecutionContextInterface $context, + $payload + ) { if (empty($this->getUsers()) && empty($this->getGroups())) { $context->buildViolation( 'validator.assign_users_or_groups' diff --git a/src/lib/Form/Data/Role/RoleAssignmentDeleteData.php b/src/lib/Form/Data/Role/RoleAssignmentDeleteData.php index b51f327fcb..0a725c0d05 100644 --- a/src/lib/Form/Data/Role/RoleAssignmentDeleteData.php +++ b/src/lib/Form/Data/Role/RoleAssignmentDeleteData.php @@ -12,7 +12,7 @@ class RoleAssignmentDeleteData { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment */ + /** @var RoleAssignment */ private $roleAssignment; public function __construct(?RoleAssignment $roleAssignment = null) @@ -21,7 +21,7 @@ public function __construct(?RoleAssignment $roleAssignment = null) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment + * @return RoleAssignment */ public function getRoleAssignment(): ?RoleAssignment { @@ -29,7 +29,7 @@ public function getRoleAssignment(): ?RoleAssignment } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment $roleAssignment + * @param RoleAssignment $roleAssignment */ public function setRoleAssignment(RoleAssignment $roleAssignment) { diff --git a/src/lib/Form/Data/Role/RoleAssignmentsDeleteData.php b/src/lib/Form/Data/Role/RoleAssignmentsDeleteData.php index bf0d16dd43..1f6ed221a0 100644 --- a/src/lib/Form/Data/Role/RoleAssignmentsDeleteData.php +++ b/src/lib/Form/Data/Role/RoleAssignmentsDeleteData.php @@ -15,24 +15,26 @@ */ class RoleAssignmentsDeleteData { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role|null */ + /** @var Role|null */ protected $role; /** @var array|null */ protected $roleAssignments; /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role|null $role + * @param Role|null $role * @param array|null $roleAssignments */ - public function __construct(?Role $role = null, array $roleAssignments = []) - { + public function __construct( + ?Role $role = null, + array $roleAssignments = [] + ) { $this->role = $role; $this->roleAssignments = $roleAssignments; } /** - * @return \Ibexa\Contracts\Core\Repository\Values\User\Role|null + * @return Role|null */ public function getRole(): ?Role { @@ -40,7 +42,7 @@ public function getRole(): ?Role } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role|null $role + * @param Role|null $role */ public function setRole(?Role $role) { diff --git a/src/lib/Form/Data/Role/RoleCopyData.php b/src/lib/Form/Data/Role/RoleCopyData.php index 5fbbc74b53..bdb01dc3c3 100644 --- a/src/lib/Form/Data/Role/RoleCopyData.php +++ b/src/lib/Form/Data/Role/RoleCopyData.php @@ -12,14 +12,16 @@ class RoleCopyData { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role */ + /** @var Role */ private $copiedRole; /** @var string */ private $newIdentifier; - public function __construct(Role $role, ?string $identifier = null) - { + public function __construct( + Role $role, + ?string $identifier = null + ) { $this->copiedRole = $role; $this->newIdentifier = $identifier; } diff --git a/src/lib/Form/Data/Role/RoleDeleteData.php b/src/lib/Form/Data/Role/RoleDeleteData.php index 51e95afdc1..02a7bb5a8b 100644 --- a/src/lib/Form/Data/Role/RoleDeleteData.php +++ b/src/lib/Form/Data/Role/RoleDeleteData.php @@ -12,7 +12,7 @@ class RoleDeleteData { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role */ + /** @var Role */ private $role; public function __construct(?Role $role = null) @@ -21,7 +21,7 @@ public function __construct(?Role $role = null) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\User\Role + * @return Role */ public function getRole(): ?Role { @@ -29,7 +29,7 @@ public function getRole(): ?Role } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role $role + * @param Role $role */ public function setRole(Role $role) { diff --git a/src/lib/Form/Data/Role/RoleUpdateData.php b/src/lib/Form/Data/Role/RoleUpdateData.php index bbb2ca7527..eb9a172967 100644 --- a/src/lib/Form/Data/Role/RoleUpdateData.php +++ b/src/lib/Form/Data/Role/RoleUpdateData.php @@ -12,14 +12,14 @@ class RoleUpdateData { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role */ + /** @var Role */ private $role; /** @var string */ private $identifier; /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role|null $role + * @param Role|null $role */ public function __construct(?Role $role = null) { @@ -32,7 +32,7 @@ public function __construct(?Role $role = null) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\User\Role + * @return Role */ public function getRole(): ?Role { @@ -40,7 +40,7 @@ public function getRole(): ?Role } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\Role $role + * @param Role $role * * @return RoleUpdateData */ diff --git a/src/lib/Form/Data/RoleAssignmentData.php b/src/lib/Form/Data/RoleAssignmentData.php index 6faa1db0ca..3b0a32c390 100644 --- a/src/lib/Form/Data/RoleAssignmentData.php +++ b/src/lib/Form/Data/RoleAssignmentData.php @@ -7,22 +7,27 @@ namespace Ibexa\AdminUi\Form\Data; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Contracts\Core\Repository\Values\Content\Section; +use Ibexa\Contracts\Core\Repository\Values\User\User; +use Ibexa\Contracts\Core\Repository\Values\User\UserGroup; + class RoleAssignmentData { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup[] */ + /** @var UserGroup[] */ private $groups; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User[] */ + /** @var User[] */ private $users; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section[] */ + /** @var Section[] */ private $sections; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location[] */ + /** @var Location[] */ private $locations; /** - * @return \Ibexa\Contracts\Core\Repository\Values\User\UserGroup[] + * @return UserGroup[] */ public function getGroups(): array { @@ -30,7 +35,7 @@ public function getGroups(): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\UserGroup[] $groups + * @param UserGroup[] $groups */ public function setGroups(array $groups) { @@ -38,7 +43,7 @@ public function setGroups(array $groups) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\User\User[] + * @return User[] */ public function getUsers(): array { @@ -46,7 +51,7 @@ public function getUsers(): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\User[] $users + * @param User[] $users */ public function setUsers(array $users) { @@ -54,7 +59,7 @@ public function setUsers(array $users) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Section[] + * @return Section[] */ public function getSections(): array { @@ -62,7 +67,7 @@ public function getSections(): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section[] $sections + * @param Section[] $sections */ public function setSections(array $sections) { @@ -70,7 +75,7 @@ public function setSections(array $sections) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location[] + * @return Location[] */ public function getLocations(): array { @@ -78,7 +83,7 @@ public function getLocations(): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location[] $locations + * @param Location[] $locations */ public function setLocations(array $locations) { diff --git a/src/lib/Form/Data/Search/TrashSearchData.php b/src/lib/Form/Data/Search/TrashSearchData.php index 1c53925c7c..74d1bcbd31 100644 --- a/src/lib/Form/Data/Search/TrashSearchData.php +++ b/src/lib/Form/Data/Search/TrashSearchData.php @@ -20,10 +20,10 @@ class TrashSearchData /** @var int|null */ private $page; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section|null */ + /** @var Section|null */ private $section; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|null */ + /** @var ContentType|null */ private $contentType; /** @var array|null */ @@ -32,7 +32,7 @@ class TrashSearchData /** @var string|null */ private $trashed; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User|null */ + /** @var User|null */ private $creator; /** @var array|null */ diff --git a/src/lib/Form/Data/Section/SectionContentAssignData.php b/src/lib/Form/Data/Section/SectionContentAssignData.php index 951baebd2c..1b4b372955 100644 --- a/src/lib/Form/Data/Section/SectionContentAssignData.php +++ b/src/lib/Form/Data/Section/SectionContentAssignData.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\Form\Data\Section; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\Section; /** @@ -15,24 +16,26 @@ */ class SectionContentAssignData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section|null */ + /** @var Section|null */ protected $section; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location[] */ + /** @var Location[] */ protected $locations; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section|null $section - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location[] $locations + * @param Section|null $section + * @param Location[] $locations */ - public function __construct(?Section $section = null, array $locations = []) - { + public function __construct( + ?Section $section = null, + array $locations = [] + ) { $this->section = $section; $this->locations = $locations; } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Section|null + * @return Section|null */ public function getSection(): ?Section { @@ -40,7 +43,7 @@ public function getSection(): ?Section } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section|null $section + * @param Section|null $section */ public function setSection(?Section $section) { @@ -48,7 +51,7 @@ public function setSection(?Section $section) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location[] + * @return Location[] */ public function getLocations(): array { @@ -56,7 +59,7 @@ public function getLocations(): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location[] $locations + * @param Location[] $locations */ public function setLocations(array $locations) { diff --git a/src/lib/Form/Data/Section/SectionCreateData.php b/src/lib/Form/Data/Section/SectionCreateData.php index ab0ff0b648..c302b286eb 100644 --- a/src/lib/Form/Data/Section/SectionCreateData.php +++ b/src/lib/Form/Data/Section/SectionCreateData.php @@ -40,8 +40,10 @@ class SectionCreateData implements TranslationContainerInterface * @param string|null $identifier * @param string|null $name */ - public function __construct(?string $identifier = null, ?string $name = null) - { + public function __construct( + ?string $identifier = null, + ?string $name = null + ) { $this->identifier = $identifier; $this->name = $name; } diff --git a/src/lib/Form/Data/Section/SectionDeleteData.php b/src/lib/Form/Data/Section/SectionDeleteData.php index c8ea3e7858..7a585dab58 100644 --- a/src/lib/Form/Data/Section/SectionDeleteData.php +++ b/src/lib/Form/Data/Section/SectionDeleteData.php @@ -15,11 +15,11 @@ */ class SectionDeleteData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section|null */ + /** @var Section|null */ protected $section; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section|null $section + * @param Section|null $section */ public function __construct(?Section $section = null) { @@ -27,7 +27,7 @@ public function __construct(?Section $section = null) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Section|null + * @return Section|null */ public function getSection(): ?Section { @@ -35,7 +35,7 @@ public function getSection(): ?Section } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section|null $section + * @param Section|null $section */ public function setSection(?Section $section) { diff --git a/src/lib/Form/Data/Section/SectionUpdateData.php b/src/lib/Form/Data/Section/SectionUpdateData.php index 65c96025e7..02837433ec 100644 --- a/src/lib/Form/Data/Section/SectionUpdateData.php +++ b/src/lib/Form/Data/Section/SectionUpdateData.php @@ -16,7 +16,7 @@ */ class SectionUpdateData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section|null */ + /** @var Section|null */ protected $section; /** @@ -39,7 +39,7 @@ class SectionUpdateData protected $name; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section|null $section + * @param Section|null $section */ public function __construct(?Section $section = null) { diff --git a/src/lib/Form/Data/Section/SectionsDeleteData.php b/src/lib/Form/Data/Section/SectionsDeleteData.php index 9ce922d7c2..10b6a2a048 100644 --- a/src/lib/Form/Data/Section/SectionsDeleteData.php +++ b/src/lib/Form/Data/Section/SectionsDeleteData.php @@ -8,6 +8,8 @@ namespace Ibexa\AdminUi\Form\Data\Section; +use Ibexa\Contracts\Core\Repository\Values\Content\Section; + /** * @todo Add validation */ @@ -17,7 +19,7 @@ class SectionsDeleteData protected $sections; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Section[]|null $sections + * @param Section[]|null $sections */ public function __construct(array $sections = []) { diff --git a/src/lib/Form/Data/Trash/TrashItemDeleteData.php b/src/lib/Form/Data/Trash/TrashItemDeleteData.php index b21db240b5..63d1feeb6e 100644 --- a/src/lib/Form/Data/Trash/TrashItemDeleteData.php +++ b/src/lib/Form/Data/Trash/TrashItemDeleteData.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\Form\Data\Trash; +use Ibexa\Contracts\Core\Repository\Values\Content\TrashItem; use Symfony\Component\Validator\Constraints as Assert; /** @@ -18,12 +19,12 @@ class TrashItemDeleteData /** * @Assert\NotBlank() * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem[] + * @var TrashItem[] */ public $trashItems; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem[] $trashItems + * @param TrashItem[] $trashItems */ public function __construct(array $trashItems = []) { @@ -31,7 +32,7 @@ public function __construct(array $trashItems = []) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem[] + * @return TrashItem[] */ public function getTrashItems(): array { @@ -39,7 +40,7 @@ public function getTrashItems(): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem[] $trashItems + * @param TrashItem[] $trashItems */ public function setTrashItems(array $trashItems): void { diff --git a/src/lib/Form/Data/Trash/TrashItemRestoreData.php b/src/lib/Form/Data/Trash/TrashItemRestoreData.php index b22c56f7b2..c8fd15d0a1 100644 --- a/src/lib/Form/Data/Trash/TrashItemRestoreData.php +++ b/src/lib/Form/Data/Trash/TrashItemRestoreData.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Form\Data\Trash; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Contracts\Core\Repository\Values\Content\TrashItem; use Symfony\Component\Validator\Constraints as Assert; /** @@ -19,25 +20,27 @@ class TrashItemRestoreData /** * @Assert\NotBlank() * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem[] + * @var TrashItem[] */ public $trashItems; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ public $location; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem[] $trashItems - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param TrashItem[] $trashItems + * @param Location|null $location */ - public function __construct(array $trashItems = [], ?Location $location = null) - { + public function __construct( + array $trashItems = [], + ?Location $location = null + ) { $this->trashItems = $trashItems; $this->location = $location; } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem[] + * @return TrashItem[] */ public function getTrashItems(): array { @@ -45,7 +48,7 @@ public function getTrashItems(): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem[] $trashItems + * @param TrashItem[] $trashItems */ public function setTrashItems(array $trashItems) { @@ -53,7 +56,7 @@ public function setTrashItems(array $trashItems) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @return Location|null */ public function getLocation(): ?Location { @@ -61,7 +64,7 @@ public function getLocation(): ?Location } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location */ public function setLocation(?Location $location) { diff --git a/src/lib/Form/Data/TrashItemData.php b/src/lib/Form/Data/TrashItemData.php index 6c2f150740..6aa1047bdb 100644 --- a/src/lib/Form/Data/TrashItemData.php +++ b/src/lib/Form/Data/TrashItemData.php @@ -7,6 +7,8 @@ namespace Ibexa\AdminUi\Form\Data; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Contracts\Core\Repository\Values\Content\TrashItem; use Ibexa\Contracts\Core\Repository\Values\Content\TrashItem as APITrashItem; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Repository\Values\User\User; @@ -16,20 +18,20 @@ */ class TrashItemData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem */ + /** @var TrashItem */ protected $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ + /** @var ContentType */ protected $contentType; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location[] */ + /** @var Location[] */ protected $ancestors; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ + /** @var User */ private $creator; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location[] $ancestors + * @param Location[] $ancestors */ public function __construct( APITrashItem $location, @@ -64,7 +66,7 @@ public function setContentType(ContentType $contentType) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location[] + * @return Location[] */ public function getAncestors(): array { @@ -72,7 +74,7 @@ public function getAncestors(): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location[] $ancestors + * @param Location[] $ancestors */ public function setAncestors(array $ancestors) { diff --git a/src/lib/Form/Data/URLWildcard/URLWildcardData.php b/src/lib/Form/Data/URLWildcard/URLWildcardData.php index 742eba0031..f11484d6ea 100644 --- a/src/lib/Form/Data/URLWildcard/URLWildcardData.php +++ b/src/lib/Form/Data/URLWildcard/URLWildcardData.php @@ -22,7 +22,7 @@ class URLWildcardData private $forward = false; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard|null $urlWildcard + * @param URLWildcard|null $urlWildcard */ public function __construct(?URLWildcard $urlWildcard = null) { diff --git a/src/lib/Form/Data/URLWildcard/URLWildcardUpdateData.php b/src/lib/Form/Data/URLWildcard/URLWildcardUpdateData.php index 9e7619c9d3..d79dcf19ee 100644 --- a/src/lib/Form/Data/URLWildcard/URLWildcardUpdateData.php +++ b/src/lib/Form/Data/URLWildcard/URLWildcardUpdateData.php @@ -12,11 +12,11 @@ class URLWildcardUpdateData extends URLWildcardData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard|null */ + /** @var URLWildcard|null */ private $urlWildcard; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard|null $urlWildcard + * @param URLWildcard|null $urlWildcard */ public function __construct(?URLWildcard $urlWildcard = null) { @@ -26,13 +26,13 @@ public function __construct(?URLWildcard $urlWildcard = null) } } - /** @return \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard|null */ + /** @return URLWildcard|null */ public function getUrlWildcard(): ?URLWildcard { return $this->urlWildcard; } - /** @param \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard|null $urlWildcard */ + /** @param URLWildcard|null $urlWildcard */ public function setUrlWildcard(?URLWildcard $urlWildcard): void { $this->urlWildcard = $urlWildcard; diff --git a/src/lib/Form/Data/User/Setting/UserSettingUpdateData.php b/src/lib/Form/Data/User/Setting/UserSettingUpdateData.php index eb1b22bb43..a3599e24e4 100644 --- a/src/lib/Form/Data/User/Setting/UserSettingUpdateData.php +++ b/src/lib/Form/Data/User/Setting/UserSettingUpdateData.php @@ -28,8 +28,10 @@ class UserSettingUpdateData * @param string $identifier * @param string $value */ - public function __construct(?string $identifier = null, ?string $value = null) - { + public function __construct( + ?string $identifier = null, + ?string $value = null + ) { $this->identifier = $identifier; $this->value = $value; } diff --git a/src/lib/Form/Data/User/UserDeleteData.php b/src/lib/Form/Data/User/UserDeleteData.php index 38c2104210..36541329e7 100644 --- a/src/lib/Form/Data/User/UserDeleteData.php +++ b/src/lib/Form/Data/User/UserDeleteData.php @@ -12,11 +12,11 @@ class UserDeleteData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null */ + /** @var ContentInfo|null */ private $contentInfo; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null $contentInfo + * @param ContentInfo|null $contentInfo */ public function __construct(?ContentInfo $contentInfo = null) { @@ -24,7 +24,7 @@ public function __construct(?ContentInfo $contentInfo = null) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null + * @return ContentInfo|null */ public function getContentInfo(): ?ContentInfo { @@ -32,7 +32,7 @@ public function getContentInfo(): ?ContentInfo } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null $contentInfo + * @param ContentInfo|null $contentInfo */ public function setContentInfo(?ContentInfo $contentInfo) { diff --git a/src/lib/Form/Data/User/UserEditData.php b/src/lib/Form/Data/User/UserEditData.php index f7ef60897a..52309a07f1 100644 --- a/src/lib/Form/Data/User/UserEditData.php +++ b/src/lib/Form/Data/User/UserEditData.php @@ -15,16 +15,16 @@ class UserEditData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null */ + /** @var ContentInfo|null */ private $contentInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo|null */ + /** @var VersionInfo|null */ private $versionInfo; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null */ + /** @var Language|null */ private $language; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ private $location; public function __construct( @@ -40,7 +40,7 @@ public function __construct( } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null + * @return ContentInfo|null */ public function getContentInfo(): ?ContentInfo { @@ -48,7 +48,7 @@ public function getContentInfo(): ?ContentInfo } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null $contentInfo + * @param ContentInfo|null $contentInfo */ public function setContentInfo(?ContentInfo $contentInfo): void { @@ -56,7 +56,7 @@ public function setContentInfo(?ContentInfo $contentInfo): void } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo|null + * @return VersionInfo|null */ public function getVersionInfo(): ?VersionInfo { @@ -64,7 +64,7 @@ public function getVersionInfo(): ?VersionInfo } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo|null $versionInfo + * @param VersionInfo|null $versionInfo */ public function setVersionInfo(?VersionInfo $versionInfo): void { @@ -72,7 +72,7 @@ public function setVersionInfo(?VersionInfo $versionInfo): void } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language|null + * @return Language|null */ public function getLanguage(): ?Language { @@ -80,7 +80,7 @@ public function getLanguage(): ?Language } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $language + * @param Language|null $language */ public function setLanguage(?Language $language): void { @@ -88,7 +88,7 @@ public function setLanguage(?Language $language): void } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @return Location|null */ public function getLocation(): ?Location { @@ -96,7 +96,7 @@ public function getLocation(): ?Location } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location */ public function setLocation(?Location $location): void { diff --git a/src/lib/Form/Data/Version/VersionRemoveData.php b/src/lib/Form/Data/Version/VersionRemoveData.php index be5738b670..bae7b8f49a 100644 --- a/src/lib/Form/Data/Version/VersionRemoveData.php +++ b/src/lib/Form/Data/Version/VersionRemoveData.php @@ -15,24 +15,26 @@ */ class VersionRemoveData { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null */ + /** @var ContentInfo|null */ protected $contentInfo; /** @var array|null */ protected $versions; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null $contentInfo + * @param ContentInfo|null $contentInfo * @param array|null $versions */ - public function __construct(?ContentInfo $contentInfo = null, array $versions = []) - { + public function __construct( + ?ContentInfo $contentInfo = null, + array $versions = [] + ) { $this->contentInfo = $contentInfo; $this->versions = $versions; } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null + * @return ContentInfo|null */ public function getContentInfo(): ?ContentInfo { @@ -40,7 +42,7 @@ public function getContentInfo(): ?ContentInfo } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null $contentInfo + * @param ContentInfo|null $contentInfo */ public function setContentInfo(?ContentInfo $contentInfo) { diff --git a/src/lib/Form/DataMapper/ContentMainLocationUpdateMapper.php b/src/lib/Form/DataMapper/ContentMainLocationUpdateMapper.php index 458657909e..4e54dae8fa 100644 --- a/src/lib/Form/DataMapper/ContentMainLocationUpdateMapper.php +++ b/src/lib/Form/DataMapper/ContentMainLocationUpdateMapper.php @@ -10,6 +10,8 @@ use Ibexa\AdminUi\Exception\InvalidArgumentException; use Ibexa\AdminUi\Form\Data\Content\Location\ContentMainLocationUpdateData; use Ibexa\Contracts\AdminUi\Form\DataMapper\DataMapperInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Values\Content\ContentMetadataUpdateStruct; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -29,11 +31,11 @@ public function __construct(LocationService $locationService) /** * Maps given ContentMetadataUpdateStruct object to a ContentMainLocationUpdateData object. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentMetadataUpdateStruct|\Ibexa\Contracts\Core\Repository\Values\ValueObject $value + * @param ContentMetadataUpdateStruct|ValueObject $value * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ public function map(ValueObject $value): ContentMainLocationUpdateData { @@ -53,11 +55,11 @@ public function map(ValueObject $value): ContentMainLocationUpdateData /** * Maps given ContentMainLocationUpdateData object to a ContentMetadataUpdateStruct object. * - * @param \Ibexa\AdminUi\Form\Data\Content\Location\ContentMainLocationUpdateData $data + * @param ContentMainLocationUpdateData $data * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentMetadataUpdateStruct + * @return ContentMetadataUpdateStruct * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function reverseMap($data): ContentMetadataUpdateStruct { diff --git a/src/lib/Form/DataMapper/LanguageCreateMapper.php b/src/lib/Form/DataMapper/LanguageCreateMapper.php index e8ddf7ada2..f6fe8eb98c 100644 --- a/src/lib/Form/DataMapper/LanguageCreateMapper.php +++ b/src/lib/Form/DataMapper/LanguageCreateMapper.php @@ -21,11 +21,11 @@ class LanguageCreateMapper implements DataMapperInterface /** * Maps given LanguageCreateStruct object to a LanguageCreateData object. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\LanguageCreateStruct|\Ibexa\Contracts\Core\Repository\Values\ValueObject $value + * @param LanguageCreateStruct|ValueObject $value * - * @return \Ibexa\AdminUi\Form\Data\Language\LanguageCreateData + * @return LanguageCreateData * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function map(ValueObject $value): LanguageCreateData { @@ -45,11 +45,11 @@ public function map(ValueObject $value): LanguageCreateData /** * Maps given LanguageCreateData object to a LanguageCreateStruct object. * - * @param \Ibexa\AdminUi\Form\Data\Language\LanguageCreateData $data + * @param LanguageCreateData $data * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\LanguageCreateStruct + * @return LanguageCreateStruct * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function reverseMap($data): LanguageCreateStruct { diff --git a/src/lib/Form/DataMapper/MainTranslationUpdateMapper.php b/src/lib/Form/DataMapper/MainTranslationUpdateMapper.php index 7d0379ba52..27ee796169 100644 --- a/src/lib/Form/DataMapper/MainTranslationUpdateMapper.php +++ b/src/lib/Form/DataMapper/MainTranslationUpdateMapper.php @@ -16,9 +16,9 @@ class MainTranslationUpdateMapper implements DataMapperInterface { /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentMetadataUpdateStruct|\Ibexa\Contracts\Core\Repository\Values\ValueObject $value + * @param ContentMetadataUpdateStruct|ValueObject $value * - * @return \Ibexa\AdminUi\Form\Data\Content\Translation\MainTranslationUpdateData + * @return MainTranslationUpdateData */ public function map(ValueObject $value) { @@ -33,9 +33,9 @@ public function map(ValueObject $value) } /** - * @param \Ibexa\AdminUi\Form\Data\Content\Translation\MainTranslationUpdateData $data + * @param MainTranslationUpdateData $data * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentMetadataUpdateStruct + * @return ContentMetadataUpdateStruct */ public function reverseMap($data) { diff --git a/src/lib/Form/DataMapper/PolicyCreateMapper.php b/src/lib/Form/DataMapper/PolicyCreateMapper.php index e1bb99c378..e3efded47d 100644 --- a/src/lib/Form/DataMapper/PolicyCreateMapper.php +++ b/src/lib/Form/DataMapper/PolicyCreateMapper.php @@ -21,11 +21,11 @@ class PolicyCreateMapper implements DataMapperInterface /** * Maps given PolicyCreateStruct object to a PolicyCreateData object. * - * @param \Ibexa\Core\Repository\Values\User\PolicyCreateStruct|\Ibexa\Contracts\Core\Repository\Values\ValueObject $value + * @param PolicyCreateStruct|ValueObject $value * - * @return \Ibexa\AdminUi\Form\Data\Policy\PolicyCreateData + * @return PolicyCreateData * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function map(ValueObject $value): PolicyCreateData { @@ -45,11 +45,11 @@ public function map(ValueObject $value): PolicyCreateData /** * Maps given PolicyCreateData object to a PolicyCreateStruct object. * - * @param \Ibexa\AdminUi\Form\Data\Policy\PolicyCreateData $data + * @param PolicyCreateData $data * - * @return \Ibexa\Core\Repository\Values\User\PolicyCreateStruct + * @return PolicyCreateStruct * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function reverseMap($data): PolicyCreateStruct { diff --git a/src/lib/Form/DataMapper/PolicyUpdateMapper.php b/src/lib/Form/DataMapper/PolicyUpdateMapper.php index 2347335b85..5f62407f07 100644 --- a/src/lib/Form/DataMapper/PolicyUpdateMapper.php +++ b/src/lib/Form/DataMapper/PolicyUpdateMapper.php @@ -20,9 +20,9 @@ class PolicyUpdateMapper implements DataMapperInterface /** * Maps given PolicyUpdateStruct object to a PolicyUpdateData object. * - * @param \Ibexa\Core\Repository\Values\User\PolicyUpdateStruct|\Ibexa\Contracts\Core\Repository\Values\ValueObject $value + * @param PolicyUpdateStruct|ValueObject $value * - * @return \Ibexa\AdminUi\Form\Data\Policy\PolicyUpdateData + * @return PolicyUpdateData */ public function map(ValueObject $value): PolicyUpdateData { @@ -38,9 +38,9 @@ public function map(ValueObject $value): PolicyUpdateData /** * Maps given PolicyUpdateData object to a PolicyUpdateStruct object. * - * @param \Ibexa\AdminUi\Form\Data\Policy\PolicyUpdateData $data + * @param PolicyUpdateData $data * - * @return \Ibexa\Core\Repository\Values\User\PolicyUpdateStruct + * @return PolicyUpdateStruct */ public function reverseMap($data): PolicyUpdateStruct { diff --git a/src/lib/Form/DataMapper/RoleCopyMapper.php b/src/lib/Form/DataMapper/RoleCopyMapper.php index 46a0023afb..6ffed7addc 100644 --- a/src/lib/Form/DataMapper/RoleCopyMapper.php +++ b/src/lib/Form/DataMapper/RoleCopyMapper.php @@ -21,7 +21,7 @@ class RoleCopyMapper implements DataMapperInterface /** * Maps given RoleCopyStruct object to a RoleCopyData object. * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function map(ValueObject $value): RoleCopyData { @@ -35,9 +35,9 @@ public function map(ValueObject $value): RoleCopyData /** * Maps given RoleCopyData object to a RoleCopyStruct object. * - * @param \Ibexa\AdminUi\Form\Data\Role\RoleCopyData $data + * @param RoleCopyData $data * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function reverseMap($data): RoleCopyStruct { diff --git a/src/lib/Form/DataMapper/RoleCreateMapper.php b/src/lib/Form/DataMapper/RoleCreateMapper.php index ce7343d3f2..3fb8dd1615 100644 --- a/src/lib/Form/DataMapper/RoleCreateMapper.php +++ b/src/lib/Form/DataMapper/RoleCreateMapper.php @@ -21,11 +21,11 @@ class RoleCreateMapper implements DataMapperInterface /** * Maps given RoleCreateStruct object to a RoleCreateData object. * - * @param \Ibexa\Core\Repository\Values\User\RoleCreateStruct|\Ibexa\Contracts\Core\Repository\Values\ValueObject $value + * @param RoleCreateStruct|ValueObject $value * - * @return \Ibexa\AdminUi\Form\Data\Role\RoleCreateData + * @return RoleCreateData * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function map(ValueObject $value): RoleCreateData { @@ -43,11 +43,11 @@ public function map(ValueObject $value): RoleCreateData /** * Maps given RoleCreateData object to a RoleCreateStruct object. * - * @param \Ibexa\AdminUi\Form\Data\Role\RoleCreateData $data + * @param RoleCreateData $data * - * @return \Ibexa\Core\Repository\Values\User\RoleCreateStruct + * @return RoleCreateStruct * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function reverseMap($data): RoleCreateStruct { diff --git a/src/lib/Form/DataMapper/RoleUpdateMapper.php b/src/lib/Form/DataMapper/RoleUpdateMapper.php index 2e555ec522..7b3cf86a8f 100644 --- a/src/lib/Form/DataMapper/RoleUpdateMapper.php +++ b/src/lib/Form/DataMapper/RoleUpdateMapper.php @@ -21,11 +21,11 @@ class RoleUpdateMapper implements DataMapperInterface /** * Maps given RoleUpdateStruct object to a RoleUpdateData object. * - * @param \Ibexa\Contracts\Core\Repository\Values\User\RoleUpdateStruct|\Ibexa\Contracts\Core\Repository\Values\ValueObject $value + * @param RoleUpdateStruct|ValueObject $value * - * @return \Ibexa\AdminUi\Form\Data\Role\RoleUpdateData + * @return RoleUpdateData * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function map(ValueObject $value): RoleUpdateData { @@ -43,11 +43,11 @@ public function map(ValueObject $value): RoleUpdateData /** * Maps given RoleUpdateData object to a RoleUpdateStruct object. * - * @param \Ibexa\AdminUi\Form\Data\Role\RoleUpdateData $data + * @param RoleUpdateData $data * - * @return \Ibexa\Contracts\Core\Repository\Values\User\RoleUpdateStruct + * @return RoleUpdateStruct * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function reverseMap($data): RoleUpdateStruct { diff --git a/src/lib/Form/DataMapper/SectionCreateMapper.php b/src/lib/Form/DataMapper/SectionCreateMapper.php index 60cdaf0cd8..74290f614d 100644 --- a/src/lib/Form/DataMapper/SectionCreateMapper.php +++ b/src/lib/Form/DataMapper/SectionCreateMapper.php @@ -21,11 +21,11 @@ class SectionCreateMapper implements DataMapperInterface /** * Maps given SectionCreateStruct object to a SectionCreateData object. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\SectionCreateStruct|\Ibexa\Contracts\Core\Repository\Values\ValueObject $value + * @param SectionCreateStruct|ValueObject $value * - * @return \Ibexa\AdminUi\Form\Data\Section\SectionCreateData + * @return SectionCreateData * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function map(ValueObject $value): SectionCreateData { @@ -39,11 +39,11 @@ public function map(ValueObject $value): SectionCreateData /** * Maps given SectionCreateData object to a SectionCreateStruct object. * - * @param \Ibexa\AdminUi\Form\Data\Section\SectionCreateData $data + * @param SectionCreateData $data * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\SectionCreateStruct + * @return SectionCreateStruct * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function reverseMap($data): SectionCreateStruct { diff --git a/src/lib/Form/DataMapper/SectionUpdateMapper.php b/src/lib/Form/DataMapper/SectionUpdateMapper.php index 86abd69014..618dd683bb 100644 --- a/src/lib/Form/DataMapper/SectionUpdateMapper.php +++ b/src/lib/Form/DataMapper/SectionUpdateMapper.php @@ -22,11 +22,11 @@ class SectionUpdateMapper implements DataMapperInterface /** * Maps given SectionUpdateStruct object to a SectionUpdateData object. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\SectionUpdateStruct|\Ibexa\Contracts\Core\Repository\Values\ValueObject $value + * @param SectionUpdateStruct|ValueObject $value * - * @return \Ibexa\AdminUi\Form\Data\Section\SectionUpdateData + * @return SectionUpdateData * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function map(ValueObject $value): SectionUpdateData { @@ -40,11 +40,11 @@ public function map(ValueObject $value): SectionUpdateData /** * Maps given SectionUpdateData object to a SectionUpdateStruct object. * - * @param \Ibexa\AdminUi\Form\Data\Section\SectionUpdateData $data + * @param SectionUpdateData $data * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\SectionUpdateStruct + * @return SectionUpdateStruct * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function reverseMap($data): SectionUpdateStruct { diff --git a/src/lib/Form/DataTransformer/ContentInfoTransformer.php b/src/lib/Form/DataTransformer/ContentInfoTransformer.php index 53a59bed74..cfb6daa5d4 100644 --- a/src/lib/Form/DataTransformer/ContentInfoTransformer.php +++ b/src/lib/Form/DataTransformer/ContentInfoTransformer.php @@ -19,7 +19,7 @@ */ final class ContentInfoTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; public function __construct(ContentService $contentService) @@ -28,7 +28,7 @@ public function __construct(ContentService $contentService) } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null $value + * @param ContentInfo|null $value */ public function transform($value): ?int { diff --git a/src/lib/Form/DataTransformer/ContentTransformer.php b/src/lib/Form/DataTransformer/ContentTransformer.php index f15767dc33..27451bf85a 100644 --- a/src/lib/Form/DataTransformer/ContentTransformer.php +++ b/src/lib/Form/DataTransformer/ContentTransformer.php @@ -10,17 +10,18 @@ use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; class ContentTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ protected $contentService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @param ContentService $contentService */ public function __construct(ContentService $contentService) { @@ -30,7 +31,7 @@ public function __construct(ContentService $contentService) /** * Transforms a domain specific Content object into a Content's ID. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content|null $value + * @param Content|null $value * * @return int|null */ @@ -52,9 +53,9 @@ public function transform($value): ?int * * @param string|null $value * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content|null + * @return Content|null * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException */ public function reverseTransform($value): ?Content { diff --git a/src/lib/Form/DataTransformer/ContentTypeGroupTransformer.php b/src/lib/Form/DataTransformer/ContentTypeGroupTransformer.php index 96bd0818cb..f70d9d1c31 100644 --- a/src/lib/Form/DataTransformer/ContentTypeGroupTransformer.php +++ b/src/lib/Form/DataTransformer/ContentTypeGroupTransformer.php @@ -19,7 +19,7 @@ */ final class ContentTypeGroupTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; public function __construct(ContentTypeService $contentTypeService) diff --git a/src/lib/Form/DataTransformer/ContentTypeTransformer.php b/src/lib/Form/DataTransformer/ContentTypeTransformer.php index aea4159dac..31a53be044 100644 --- a/src/lib/Form/DataTransformer/ContentTypeTransformer.php +++ b/src/lib/Form/DataTransformer/ContentTypeTransformer.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Form\DataTransformer; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Symfony\Component\Form\DataTransformerInterface; @@ -17,11 +18,11 @@ */ class ContentTypeTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ protected $contentTypeService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService + * @param ContentTypeService $contentTypeService */ public function __construct(ContentTypeService $contentTypeService) { @@ -29,7 +30,7 @@ public function __construct(ContentTypeService $contentTypeService) } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $value + * @param ContentType $value * * @return string|null */ @@ -43,9 +44,9 @@ public function transform($value) /** * @param mixed $value * - * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|null + * @return ContentType|null * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ public function reverseTransform($value) { diff --git a/src/lib/Form/DataTransformer/DateIntervalToArrayTransformer.php b/src/lib/Form/DataTransformer/DateIntervalToArrayTransformer.php index a2a253da10..28c462df64 100644 --- a/src/lib/Form/DataTransformer/DateIntervalToArrayTransformer.php +++ b/src/lib/Form/DataTransformer/DateIntervalToArrayTransformer.php @@ -19,11 +19,11 @@ class DateIntervalToArrayTransformer implements DataTransformerInterface /** * Transforms a date interval into an array of date interval elements. * - * @param \DateInterval $dateInterval date interval + * @param DateInterval $dateInterval date interval * * @return array date interval elements * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException If the given value is not an instance of DateInterval + * @throws TransformationFailedException If the given value is not an instance of DateInterval */ public function transform($dateInterval) { @@ -59,9 +59,9 @@ public function transform($dateInterval) * * @param array $value date interval elements * - * @return \DateInterval date interval + * @return DateInterval date interval * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException if the given value is not an array, + * @throws TransformationFailedException if the given value is not an array, * or if the value could not be transformed */ public function reverseTransform($value) diff --git a/src/lib/Form/DataTransformer/DateIntervalTransformer.php b/src/lib/Form/DataTransformer/DateIntervalTransformer.php index 623ab2de7d..9e7342bacc 100644 --- a/src/lib/Form/DataTransformer/DateIntervalTransformer.php +++ b/src/lib/Form/DataTransformer/DateIntervalTransformer.php @@ -23,7 +23,7 @@ class DateIntervalTransformer implements DataTransformerInterface * * @return array|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function transform($value) { diff --git a/src/lib/Form/DataTransformer/DateTimePickerTransformer.php b/src/lib/Form/DataTransformer/DateTimePickerTransformer.php index 436ca1e410..ec1bb3ca97 100644 --- a/src/lib/Form/DataTransformer/DateTimePickerTransformer.php +++ b/src/lib/Form/DataTransformer/DateTimePickerTransformer.php @@ -22,7 +22,7 @@ class DateTimePickerTransformer implements DataTransformerInterface * * @return mixed The value in the transformed representation * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException when the transformation fails + * @throws TransformationFailedException when the transformation fails */ public function transform($value) { @@ -47,7 +47,7 @@ public function transform($value) * * @return mixed The value in the original representation * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException when the transformation fails + * @throws TransformationFailedException when the transformation fails */ public function reverseTransform($value) { diff --git a/src/lib/Form/DataTransformer/FieldType/AbstractBinaryBaseTransformer.php b/src/lib/Form/DataTransformer/FieldType/AbstractBinaryBaseTransformer.php index 69de1e3bd3..28b0d32c4e 100644 --- a/src/lib/Form/DataTransformer/FieldType/AbstractBinaryBaseTransformer.php +++ b/src/lib/Form/DataTransformer/FieldType/AbstractBinaryBaseTransformer.php @@ -18,22 +18,25 @@ */ abstract class AbstractBinaryBaseTransformer { - /** @var \Ibexa\Contracts\Core\Repository\FieldType */ + /** @var FieldType */ protected $fieldType; - /** @var \Ibexa\Core\FieldType\Value */ + /** @var Value */ protected $initialValue; /** @var string */ protected $valueClass; /** - * @param \Ibexa\Contracts\Core\Repository\FieldType $fieldType - * @param \Ibexa\Core\FieldType\Value $initialValue + * @param FieldType $fieldType + * @param Value $initialValue * @param string $valueClass */ - public function __construct(FieldType $fieldType, Value $initialValue, $valueClass) - { + public function __construct( + FieldType $fieldType, + Value $initialValue, + $valueClass + ) { $this->fieldType = $fieldType; $this->initialValue = $initialValue; $this->valueClass = $valueClass; @@ -53,9 +56,9 @@ public function getDefaultProperties() /** * @param array $value * - * @return \Ibexa\Core\FieldType\Value + * @return Value * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function getReverseTransformedValue($value) { diff --git a/src/lib/Form/DataTransformer/FieldType/BinaryFileValueTransformer.php b/src/lib/Form/DataTransformer/FieldType/BinaryFileValueTransformer.php index 2075eeb3d2..4313d7d970 100644 --- a/src/lib/Form/DataTransformer/FieldType/BinaryFileValueTransformer.php +++ b/src/lib/Form/DataTransformer/FieldType/BinaryFileValueTransformer.php @@ -7,7 +7,9 @@ namespace Ibexa\AdminUi\Form\DataTransformer\FieldType; +use Ibexa\Core\FieldType\BinaryFile\Value; use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; /** * Data transformer for ezbinaryfile field type. @@ -17,7 +19,7 @@ class BinaryFileValueTransformer extends AbstractBinaryBaseTransformer implements DataTransformerInterface { /** - * @param \Ibexa\Core\FieldType\BinaryFile\Value $value + * @param Value $value * * @return array */ @@ -36,13 +38,13 @@ public function transform($value) /** * @param array $value * - * @return \Ibexa\Core\FieldType\BinaryFile\Value + * @return Value * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function reverseTransform($value) { - /** @var \Ibexa\Core\FieldType\BinaryFile\Value $valueObject */ + /** @var Value $valueObject */ $valueObject = $this->getReverseTransformedValue($value); if ($this->fieldType->isEmptyValue($valueObject)) { diff --git a/src/lib/Form/DataTransformer/FieldType/DateTimeValueTransformer.php b/src/lib/Form/DataTransformer/FieldType/DateTimeValueTransformer.php index 0f9ad9d173..e7c6bd05ac 100644 --- a/src/lib/Form/DataTransformer/FieldType/DateTimeValueTransformer.php +++ b/src/lib/Form/DataTransformer/FieldType/DateTimeValueTransformer.php @@ -21,7 +21,7 @@ class DateTimeValueTransformer implements DataTransformerInterface * * @return int|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function transform($value) { @@ -45,9 +45,9 @@ public function transform($value) /** * @param mixed $value * - * @return \Ibexa\Core\FieldType\DateAndTime\Value|null + * @return Value|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function reverseTransform($value) { diff --git a/src/lib/Form/DataTransformer/FieldType/DateValueTransformer.php b/src/lib/Form/DataTransformer/FieldType/DateValueTransformer.php index 2606e961c7..b16d9de1de 100644 --- a/src/lib/Form/DataTransformer/FieldType/DateValueTransformer.php +++ b/src/lib/Form/DataTransformer/FieldType/DateValueTransformer.php @@ -7,6 +7,7 @@ namespace Ibexa\AdminUi\Form\DataTransformer\FieldType; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Core\FieldType\Date\Value; use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; @@ -21,7 +22,7 @@ class DateValueTransformer implements DataTransformerInterface * * @return int|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function transform($value) { @@ -45,10 +46,10 @@ public function transform($value) /** * @param int|mixed $value * - * @return \Ibexa\Core\FieldType\Date\Value|null + * @return Value|null * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws InvalidArgumentException + * @throws TransformationFailedException */ public function reverseTransform($value) { diff --git a/src/lib/Form/DataTransformer/FieldType/FieldValueTransformer.php b/src/lib/Form/DataTransformer/FieldType/FieldValueTransformer.php index dec9f3a2ce..dc32165645 100644 --- a/src/lib/Form/DataTransformer/FieldType/FieldValueTransformer.php +++ b/src/lib/Form/DataTransformer/FieldType/FieldValueTransformer.php @@ -18,7 +18,7 @@ class FieldValueTransformer implements DataTransformerInterface { /** - * @var \Ibexa\Contracts\Core\Repository\FieldType + * @var FieldType */ private $fieldType; @@ -50,7 +50,7 @@ public function transform($value) * * @param mixed $value * - * @return \Ibexa\Contracts\Core\FieldType\Value + * @return Value */ public function reverseTransform($value) { diff --git a/src/lib/Form/DataTransformer/FieldType/ImageAssetValueTransformer.php b/src/lib/Form/DataTransformer/FieldType/ImageAssetValueTransformer.php index a58440a97a..18330889f4 100644 --- a/src/lib/Form/DataTransformer/FieldType/ImageAssetValueTransformer.php +++ b/src/lib/Form/DataTransformer/FieldType/ImageAssetValueTransformer.php @@ -15,9 +15,9 @@ class ImageAssetValueTransformer extends AbstractBinaryBaseTransformer implements DataTransformerInterface { /** - * @param \Ibexa\Core\FieldType\ImageAsset\Value|null $value + * @param Value|null $value * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException * * @return array|null */ @@ -45,9 +45,9 @@ public function transform($value): ?array /** * @param array|null $value * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException * - * @return \Ibexa\Core\FieldType\ImageAsset\Value|null + * @return Value|null */ public function reverseTransform($value): ?Value { diff --git a/src/lib/Form/DataTransformer/FieldType/ImageValueTransformer.php b/src/lib/Form/DataTransformer/FieldType/ImageValueTransformer.php index be6a6086fd..536a757e04 100644 --- a/src/lib/Form/DataTransformer/FieldType/ImageValueTransformer.php +++ b/src/lib/Form/DataTransformer/FieldType/ImageValueTransformer.php @@ -7,7 +7,9 @@ namespace Ibexa\AdminUi\Form\DataTransformer\FieldType; +use Ibexa\Core\FieldType\Image\Value; use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; /** * Data transformer for ezimage field type. @@ -17,7 +19,7 @@ class ImageValueTransformer extends AbstractBinaryBaseTransformer implements DataTransformerInterface { /** - * @param \Ibexa\Core\FieldType\Image\Value $value + * @param Value $value * * @return array */ @@ -36,13 +38,13 @@ public function transform($value) /** * @param array $value * - * @return \Ibexa\Core\FieldType\Image\Value + * @return Value * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function reverseTransform($value) { - /** @var \Ibexa\Core\FieldType\Image\Value $valueObject */ + /** @var Value $valueObject */ $valueObject = $this->getReverseTransformedValue($value); if ($this->fieldType->isEmptyValue($valueObject)) { diff --git a/src/lib/Form/DataTransformer/FieldType/MediaValueTransformer.php b/src/lib/Form/DataTransformer/FieldType/MediaValueTransformer.php index 018ebc2d5a..c420155ad6 100644 --- a/src/lib/Form/DataTransformer/FieldType/MediaValueTransformer.php +++ b/src/lib/Form/DataTransformer/FieldType/MediaValueTransformer.php @@ -7,7 +7,9 @@ namespace Ibexa\AdminUi\Form\DataTransformer\FieldType; +use Ibexa\Core\FieldType\Media\Value; use Symfony\Component\Form\DataTransformerInterface; +use Symfony\Component\Form\Exception\TransformationFailedException; /** * Data transformer for ezmedia field type. @@ -17,7 +19,7 @@ class MediaValueTransformer extends AbstractBinaryBaseTransformer implements DataTransformerInterface { /** - * @param \Ibexa\Core\FieldType\Media\Value $value + * @param Value $value * * @return array */ @@ -42,13 +44,13 @@ public function transform($value) /** * @param array $value * - * @return \Ibexa\Core\FieldType\Media\Value + * @return Value * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function reverseTransform($value) { - /** @var \Ibexa\Core\FieldType\Media\Value $valueObject */ + /** @var Value $valueObject */ $valueObject = $this->getReverseTransformedValue($value); if ($this->fieldType->isEmptyValue($valueObject)) { diff --git a/src/lib/Form/DataTransformer/FieldType/TimeValueTransformer.php b/src/lib/Form/DataTransformer/FieldType/TimeValueTransformer.php index 3fff9d5c34..1ce6e66f3d 100644 --- a/src/lib/Form/DataTransformer/FieldType/TimeValueTransformer.php +++ b/src/lib/Form/DataTransformer/FieldType/TimeValueTransformer.php @@ -7,6 +7,7 @@ namespace Ibexa\AdminUi\Form\DataTransformer\FieldType; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Core\FieldType\Time\Value; use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; @@ -17,11 +18,11 @@ class TimeValueTransformer implements DataTransformerInterface { /** - * @param mixed|\Ibexa\Core\FieldType\Time\Value $value + * @param mixed|Value $value * * @return int|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function transform($value) { @@ -41,10 +42,10 @@ public function transform($value) /** * @param int|mixed $value * - * @return \Ibexa\Core\FieldType\Time\Value|null + * @return Value|null * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws InvalidArgumentException + * @throws TransformationFailedException */ public function reverseTransform($value) { diff --git a/src/lib/Form/DataTransformer/LanguageTransformer.php b/src/lib/Form/DataTransformer/LanguageTransformer.php index b0a4151a63..49d449e1ac 100644 --- a/src/lib/Form/DataTransformer/LanguageTransformer.php +++ b/src/lib/Form/DataTransformer/LanguageTransformer.php @@ -19,11 +19,11 @@ */ class LanguageTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ protected $languageService; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService + * @param LanguageService $languageService */ public function __construct(LanguageService $languageService) { @@ -33,11 +33,11 @@ public function __construct(LanguageService $languageService) /** * Transforms a domain specific Language object into a Language's ID. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $value + * @param Language|null $value * * @return string|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException if the given value is not a Language object + * @throws TransformationFailedException if the given value is not a Language object */ public function transform($value) { @@ -57,10 +57,10 @@ public function transform($value) * * @param string|null $value * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language|null + * @return Language|null * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Symfony\Component\Form\Exception\TransformationFailedException if the value can not be found + * @throws NotFoundException + * @throws TransformationFailedException if the value can not be found */ public function reverseTransform($value) { diff --git a/src/lib/Form/DataTransformer/LocationTransformer.php b/src/lib/Form/DataTransformer/LocationTransformer.php index 9d6e9c8818..85722a9306 100644 --- a/src/lib/Form/DataTransformer/LocationTransformer.php +++ b/src/lib/Form/DataTransformer/LocationTransformer.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LocationService; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\Location as APILocation; use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; @@ -20,11 +21,11 @@ */ class LocationTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ protected $locationService; /** - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService + * @param LocationService $locationService */ public function __construct(LocationService $locationService) { @@ -38,7 +39,7 @@ public function __construct(LocationService $locationService) * * @return int|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function transform($value): ?int { @@ -58,9 +59,9 @@ public function transform($value): ?int * * @param mixed $value * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @return Location|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function reverseTransform($value): ?APILocation { diff --git a/src/lib/Form/DataTransformer/LocationsTransformer.php b/src/lib/Form/DataTransformer/LocationsTransformer.php index dc6995ad27..8a394c4f83 100644 --- a/src/lib/Form/DataTransformer/LocationsTransformer.php +++ b/src/lib/Form/DataTransformer/LocationsTransformer.php @@ -19,11 +19,11 @@ */ class LocationsTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ protected $locationService; /** - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService + * @param LocationService $locationService */ public function __construct(LocationService $locationService) { @@ -52,9 +52,9 @@ public function transform($value): ?string * * @param mixed $value * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location[] + * @return Location[] * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function reverseTransform($value): ?array { diff --git a/src/lib/Form/DataTransformer/MultilingualSelectionTransformer.php b/src/lib/Form/DataTransformer/MultilingualSelectionTransformer.php index b3348eca6d..950362c415 100644 --- a/src/lib/Form/DataTransformer/MultilingualSelectionTransformer.php +++ b/src/lib/Form/DataTransformer/MultilingualSelectionTransformer.php @@ -16,15 +16,17 @@ class MultilingualSelectionTransformer implements DataTransformerInterface /** @var string */ protected $languageCode; - /** @var \Ibexa\AdminUi\Form\Data\FieldDefinitionData */ + /** @var FieldDefinitionData */ private $data; /** * @param string $languageCode - * @param \Ibexa\AdminUi\Form\Data\FieldDefinitionData $data + * @param FieldDefinitionData $data */ - public function __construct(string $languageCode, FieldDefinitionData $data) - { + public function __construct( + string $languageCode, + FieldDefinitionData $data + ) { $this->languageCode = $languageCode; $this->data = $data; } diff --git a/src/lib/Form/DataTransformer/ObjectStateGroupTransformer.php b/src/lib/Form/DataTransformer/ObjectStateGroupTransformer.php index d4e66b00f6..31adb7095b 100644 --- a/src/lib/Form/DataTransformer/ObjectStateGroupTransformer.php +++ b/src/lib/Form/DataTransformer/ObjectStateGroupTransformer.php @@ -19,11 +19,11 @@ */ class ObjectStateGroupTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ + /** @var ObjectStateService */ protected $objectStateService; /** - * @param \Ibexa\Contracts\Core\Repository\ObjectStateService $objectStateService + * @param ObjectStateService $objectStateService */ public function __construct(ObjectStateService $objectStateService) { diff --git a/src/lib/Form/DataTransformer/ObjectStateTransformer.php b/src/lib/Form/DataTransformer/ObjectStateTransformer.php index 533beba3c8..a09a41bd1a 100644 --- a/src/lib/Form/DataTransformer/ObjectStateTransformer.php +++ b/src/lib/Form/DataTransformer/ObjectStateTransformer.php @@ -19,11 +19,11 @@ */ class ObjectStateTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ + /** @var ObjectStateService */ protected $objectStateService; /** - * @param \Ibexa\Contracts\Core\Repository\ObjectStateService $objectStateService + * @param ObjectStateService $objectStateService */ public function __construct(ObjectStateService $objectStateService) { diff --git a/src/lib/Form/DataTransformer/PolicyTransformer.php b/src/lib/Form/DataTransformer/PolicyTransformer.php index 3f650d015b..6d92312bd3 100644 --- a/src/lib/Form/DataTransformer/PolicyTransformer.php +++ b/src/lib/Form/DataTransformer/PolicyTransformer.php @@ -23,7 +23,7 @@ class PolicyTransformer implements DataTransformerInterface * * @return string|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function transform($value): ?string { @@ -45,7 +45,7 @@ public function transform($value): ?string * * @return array|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function reverseTransform($value): ?array { diff --git a/src/lib/Form/DataTransformer/RoleAssignmentTransformer.php b/src/lib/Form/DataTransformer/RoleAssignmentTransformer.php index 8b8519dfbe..d1f267c086 100644 --- a/src/lib/Form/DataTransformer/RoleAssignmentTransformer.php +++ b/src/lib/Form/DataTransformer/RoleAssignmentTransformer.php @@ -9,7 +9,9 @@ namespace Ibexa\AdminUi\Form\DataTransformer; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\RoleService; +use Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment; use Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment as APIRoleAssignment; use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; @@ -19,11 +21,11 @@ */ class RoleAssignmentTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ protected $roleService; /** - * @param \Ibexa\Contracts\Core\Repository\RoleService $roleService + * @param RoleService $roleService */ public function __construct(RoleService $roleService) { @@ -37,7 +39,7 @@ public function __construct(RoleService $roleService) * * @return mixed|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function transform($value) { @@ -57,10 +59,10 @@ public function transform($value) * * @param mixed $value * - * @return \Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment|null + * @return RoleAssignment|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws TransformationFailedException + * @throws UnauthorizedException */ public function reverseTransform($value): ?APIRoleAssignment { diff --git a/src/lib/Form/DataTransformer/RoleTransformer.php b/src/lib/Form/DataTransformer/RoleTransformer.php index a073a613d7..ee0ff93800 100644 --- a/src/lib/Form/DataTransformer/RoleTransformer.php +++ b/src/lib/Form/DataTransformer/RoleTransformer.php @@ -9,7 +9,9 @@ namespace Ibexa\AdminUi\Form\DataTransformer; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\RoleService; +use Ibexa\Contracts\Core\Repository\Values\User\Role; use Ibexa\Contracts\Core\Repository\Values\User\Role as APIRole; use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; @@ -19,11 +21,11 @@ */ class RoleTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ protected $roleService; /** - * @param \Ibexa\Contracts\Core\Repository\RoleService $roleService + * @param RoleService $roleService */ public function __construct(RoleService $roleService) { @@ -37,7 +39,7 @@ public function __construct(RoleService $roleService) * * @return mixed|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function transform($value) { @@ -57,10 +59,10 @@ public function transform($value) * * @param mixed $value * - * @return \Ibexa\Contracts\Core\Repository\Values\User\Role|null + * @return Role|null * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws UnauthorizedException + * @throws TransformationFailedException */ public function reverseTransform($value): ?APIRole { diff --git a/src/lib/Form/DataTransformer/SectionTransformer.php b/src/lib/Form/DataTransformer/SectionTransformer.php index 46847e94ba..a5bf6fb260 100644 --- a/src/lib/Form/DataTransformer/SectionTransformer.php +++ b/src/lib/Form/DataTransformer/SectionTransformer.php @@ -19,7 +19,7 @@ */ final class SectionTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\SectionService */ + /** @var SectionService */ private $sectionService; public function __construct(SectionService $sectionService) diff --git a/src/lib/Form/DataTransformer/SectionsTransformer.php b/src/lib/Form/DataTransformer/SectionsTransformer.php index 83262fb582..5fbf5fac15 100644 --- a/src/lib/Form/DataTransformer/SectionsTransformer.php +++ b/src/lib/Form/DataTransformer/SectionsTransformer.php @@ -18,11 +18,11 @@ */ class SectionsTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\SectionService */ + /** @var SectionService */ protected $sectionService; /** - * @param \Ibexa\Contracts\Core\Repository\SectionService $sectionService + * @param SectionService $sectionService */ public function __construct(SectionService $sectionService) { @@ -53,7 +53,7 @@ public function transform($value): ?string * * @return array|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function reverseTransform($value): ?array { diff --git a/src/lib/Form/DataTransformer/TrashItemTransformer.php b/src/lib/Form/DataTransformer/TrashItemTransformer.php index 7ca971950d..9046506a1a 100644 --- a/src/lib/Form/DataTransformer/TrashItemTransformer.php +++ b/src/lib/Form/DataTransformer/TrashItemTransformer.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Form\DataTransformer; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\TrashService; use Ibexa\Contracts\Core\Repository\Values\Content\TrashItem; use Symfony\Component\Form\DataTransformerInterface; @@ -17,7 +18,7 @@ class TrashItemTransformer implements DataTransformerInterface { /** - * @var \Ibexa\Contracts\Core\Repository\TrashService + * @var TrashService */ private $trashService; @@ -33,7 +34,7 @@ public function __construct(TrashService $trashService) * * @return mixed|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function transform($value): ?int { @@ -53,10 +54,10 @@ public function transform($value): ?int * * @param mixed $value * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\TrashItem|null + * @return TrashItem|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws TransformationFailedException + * @throws UnauthorizedException */ public function reverseTransform($value): ?TrashItem { diff --git a/src/lib/Form/DataTransformer/UDWBasedValueModelTransformer.php b/src/lib/Form/DataTransformer/UDWBasedValueModelTransformer.php index d8ce33ef23..bd8ba609a9 100644 --- a/src/lib/Form/DataTransformer/UDWBasedValueModelTransformer.php +++ b/src/lib/Form/DataTransformer/UDWBasedValueModelTransformer.php @@ -23,13 +23,13 @@ */ class UDWBasedValueModelTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ + /** @var Repository */ private $repository; public function __construct( @@ -45,7 +45,7 @@ public function __construct( /** * {@inheritdoc} * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location[]|null + * @return Location[]|null */ public function transform($value): ?array { diff --git a/src/lib/Form/DataTransformer/UDWBasedValueViewTransformer.php b/src/lib/Form/DataTransformer/UDWBasedValueViewTransformer.php index 429108c351..7a5d5f8da9 100644 --- a/src/lib/Form/DataTransformer/UDWBasedValueViewTransformer.php +++ b/src/lib/Form/DataTransformer/UDWBasedValueViewTransformer.php @@ -18,11 +18,11 @@ class UDWBasedValueViewTransformer implements DataTransformerInterface { public const DELIMITER = ','; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; /** - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService + * @param LocationService $locationService */ public function __construct(LocationService $locationService) { diff --git a/src/lib/Form/DataTransformer/UserCollectionTransformer.php b/src/lib/Form/DataTransformer/UserCollectionTransformer.php index 27c9283306..10b09d4f1c 100644 --- a/src/lib/Form/DataTransformer/UserCollectionTransformer.php +++ b/src/lib/Form/DataTransformer/UserCollectionTransformer.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Form\DataTransformer; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\UserService; use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; @@ -18,11 +19,11 @@ */ class UserCollectionTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ protected $userService; /** - * @param \Ibexa\Contracts\Core\Repository\UserService $userService + * @param UserService $userService */ public function __construct(UserService $userService) { @@ -34,7 +35,7 @@ public function __construct(UserService $userService) * * @return string|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function transform($value) { @@ -50,8 +51,8 @@ public function transform($value) * * @return array * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Symfony\Component\Form\Exception\TransformationFailedException if the given value is not an integer + * @throws UnauthorizedException + * @throws TransformationFailedException if the given value is not an integer * or if the value can not be transformed */ public function reverseTransform($value): array diff --git a/src/lib/Form/DataTransformer/UserGroupCollectionTransformer.php b/src/lib/Form/DataTransformer/UserGroupCollectionTransformer.php index b69284bf81..51e29bef4f 100644 --- a/src/lib/Form/DataTransformer/UserGroupCollectionTransformer.php +++ b/src/lib/Form/DataTransformer/UserGroupCollectionTransformer.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Form\DataTransformer; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\UserService; use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; @@ -18,11 +19,11 @@ */ class UserGroupCollectionTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ protected $userService; /** - * @param \Ibexa\Contracts\Core\Repository\UserService $userService + * @param UserService $userService */ public function __construct(UserService $userService) { @@ -34,7 +35,7 @@ public function __construct(UserService $userService) * * @return string|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function transform($value) { @@ -50,8 +51,8 @@ public function transform($value) * * @return array * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Symfony\Component\Form\Exception\TransformationFailedException if the given value is not an integer + * @throws UnauthorizedException + * @throws TransformationFailedException if the given value is not an integer * or if the value can not be transformed */ public function reverseTransform($value): array diff --git a/src/lib/Form/DataTransformer/UserTransformer.php b/src/lib/Form/DataTransformer/UserTransformer.php index 85eb318973..34c4e9b3fb 100644 --- a/src/lib/Form/DataTransformer/UserTransformer.php +++ b/src/lib/Form/DataTransformer/UserTransformer.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Form\DataTransformer; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\User\User; use Symfony\Component\Form\DataTransformerInterface; @@ -19,11 +20,11 @@ */ class UserTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ protected $userService; /** - * @param \Ibexa\Contracts\Core\Repository\UserService $userService + * @param UserService $userService */ public function __construct(UserService $userService) { @@ -33,11 +34,11 @@ public function __construct(UserService $userService) /** * Transforms a domain specific User object into a Users's ID. * - * @param \Ibexa\Contracts\Core\Repository\Values\User\User|null $value + * @param User|null $value * * @return mixed|null * - * @throws \Symfony\Component\Form\Exception\TransformationFailedException + * @throws TransformationFailedException */ public function transform($value) { @@ -57,10 +58,10 @@ public function transform($value) * * @param mixed|null $value * - * @return \Ibexa\Contracts\Core\Repository\Values\User\User|null + * @return User|null * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Symfony\Component\Form\Exception\TransformationFailedException if the given value is not an integer + * @throws UnauthorizedException + * @throws TransformationFailedException if the given value is not an integer * or if the value can not be transformed */ public function reverseTransform($value): ?User diff --git a/src/lib/Form/DataTransformer/VersionInfoTransformer.php b/src/lib/Form/DataTransformer/VersionInfoTransformer.php index 2ee5f2dddc..615785bb3c 100644 --- a/src/lib/Form/DataTransformer/VersionInfoTransformer.php +++ b/src/lib/Form/DataTransformer/VersionInfoTransformer.php @@ -21,7 +21,7 @@ */ final class VersionInfoTransformer implements DataTransformerInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; public function __construct(ContentService $contentService) @@ -30,7 +30,7 @@ public function __construct(ContentService $contentService) } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo|null $value + * @param VersionInfo|null $value */ public function transform($value): ?array { diff --git a/src/lib/Form/EventListener/AddLanguageFieldBasedOnContentListener.php b/src/lib/Form/EventListener/AddLanguageFieldBasedOnContentListener.php index 7cee14ccf7..b776b23fd1 100644 --- a/src/lib/Form/EventListener/AddLanguageFieldBasedOnContentListener.php +++ b/src/lib/Form/EventListener/AddLanguageFieldBasedOnContentListener.php @@ -8,7 +8,10 @@ namespace Ibexa\AdminUi\Form\EventListener; +use Ibexa\AdminUi\Form\Data\Content\CustomUrl\CustomUrlAddData; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader; @@ -17,31 +20,33 @@ class AddLanguageFieldBasedOnContentListener { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService + * @param ContentService $contentService + * @param LanguageService $languageService */ - public function __construct(ContentService $contentService, LanguageService $languageService) - { + public function __construct( + ContentService $contentService, + LanguageService $languageService + ) { $this->contentService = $contentService; $this->languageService = $languageService; } /** - * @param \Symfony\Component\Form\FormEvent $event + * @param FormEvent $event * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ public function onPreSetData(FormEvent $event) { - /** @var \Ibexa\AdminUi\Form\Data\Content\CustomUrl\CustomUrlAddData $data */ + /** @var CustomUrlAddData $data */ $data = $event->getData(); $location = $data->getLocation(); if (null === $location) { diff --git a/src/lib/Form/EventListener/BuildPathFromRootListener.php b/src/lib/Form/EventListener/BuildPathFromRootListener.php index 3f7f50e6f7..81efab7671 100644 --- a/src/lib/Form/EventListener/BuildPathFromRootListener.php +++ b/src/lib/Form/EventListener/BuildPathFromRootListener.php @@ -8,6 +8,8 @@ namespace Ibexa\AdminUi\Form\EventListener; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\URLAliasService; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; @@ -15,13 +17,13 @@ class BuildPathFromRootListener { - /** @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; public function __construct( @@ -35,10 +37,10 @@ public function __construct( } /** - * @param \Symfony\Component\Form\FormEvent $event + * @param FormEvent $event * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ public function onPreSubmitData(FormEvent $event): void { @@ -64,8 +66,10 @@ public function onPreSubmitData(FormEvent $event): void } } - private function createPathBasedOnParentLocation(int $locationId, string $path): string - { + private function createPathBasedOnParentLocation( + int $locationId, + string $path + ): string { $parentLocation = $this->locationService->loadLocation($locationId); $urlAlias = $this->urlAliasService->reverseLookup($parentLocation); diff --git a/src/lib/Form/EventListener/DisableSiteRootCheckboxIfRootLocationListener.php b/src/lib/Form/EventListener/DisableSiteRootCheckboxIfRootLocationListener.php index d708e04651..255f4435a9 100644 --- a/src/lib/Form/EventListener/DisableSiteRootCheckboxIfRootLocationListener.php +++ b/src/lib/Form/EventListener/DisableSiteRootCheckboxIfRootLocationListener.php @@ -14,7 +14,7 @@ class DisableSiteRootCheckboxIfRootLocationListener { /** - * @param \Symfony\Component\Form\FormEvent $event + * @param FormEvent $event */ public function onPreSetData(FormEvent $event) { diff --git a/src/lib/Form/EventListener/SelectionMultilingualOptionsDataListener.php b/src/lib/Form/EventListener/SelectionMultilingualOptionsDataListener.php index eeb9c177f4..c376d8b26e 100644 --- a/src/lib/Form/EventListener/SelectionMultilingualOptionsDataListener.php +++ b/src/lib/Form/EventListener/SelectionMultilingualOptionsDataListener.php @@ -24,7 +24,7 @@ public function __construct(string $languageCode) } /** - * @param \Symfony\Component\Form\FormEvent $event + * @param FormEvent $event */ public function setLanguageOptions(FormEvent $event): void { diff --git a/src/lib/Form/Extension/HelpMultilineMessageExtension.php b/src/lib/Form/Extension/HelpMultilineMessageExtension.php index 516caacf62..77f2324d42 100644 --- a/src/lib/Form/Extension/HelpMultilineMessageExtension.php +++ b/src/lib/Form/Extension/HelpMultilineMessageExtension.php @@ -21,8 +21,11 @@ public static function getExtendedTypes(): iterable return [FormType::class]; } - public function buildView(FormView $view, FormInterface $form, array $options): void - { + public function buildView( + FormView $view, + FormInterface $form, + array $options + ): void { $view->vars['help_multiline'] = $options['help_multiline'] ?? ''; } diff --git a/src/lib/Form/Extension/RichTextTypeExtension.php b/src/lib/Form/Extension/RichTextTypeExtension.php index b5519554d8..8e64fc9f4d 100644 --- a/src/lib/Form/Extension/RichTextTypeExtension.php +++ b/src/lib/Form/Extension/RichTextTypeExtension.php @@ -31,8 +31,11 @@ public function configureOptions(OptionsResolver $resolver): void /** * {@inheritdoc} */ - public function buildView(FormView $view, FormInterface $form, array $options): void - { + public function buildView( + FormView $view, + FormInterface $form, + array $options + ): void { $view->vars += [ 'udw_context' => $options['udw_context'], ]; diff --git a/src/lib/Form/Factory/ContentTypeFormFactory.php b/src/lib/Form/Factory/ContentTypeFormFactory.php index 38068611fe..b20f4621e9 100644 --- a/src/lib/Form/Factory/ContentTypeFormFactory.php +++ b/src/lib/Form/Factory/ContentTypeFormFactory.php @@ -22,11 +22,11 @@ class ContentTypeFormFactory { - /** @var \Symfony\Component\Form\FormFactoryInterface */ + /** @var FormFactoryInterface */ private $formFactory; /** - * @param \Symfony\Component\Form\FormFactoryInterface $formFactory + * @param FormFactoryInterface $formFactory */ public function __construct( FormFactoryInterface $formFactory @@ -68,7 +68,7 @@ public function contentTypeEdit( /** * @param array $options * - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface */ public function contentTypeCopy( ContentTypeCopyData $data, diff --git a/src/lib/Form/Factory/FormFactory.php b/src/lib/Form/Factory/FormFactory.php index ca74984688..f6c6a954b7 100644 --- a/src/lib/Form/Factory/FormFactory.php +++ b/src/lib/Form/Factory/FormFactory.php @@ -126,10 +126,13 @@ use Ibexa\AdminUi\Form\Type\User\UserEditType; use Ibexa\AdminUi\Form\Type\Version\VersionRemoveType; use Ibexa\Bundle\Search\Form\Data\SearchData; + use function is_string; + use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\Util\StringUtil; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -152,7 +155,7 @@ public function __construct( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function contentEdit( ?ContentEditData $data = null, @@ -183,7 +186,7 @@ public function contentEdit( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function createContent( ?ContentCreateData $data = null, @@ -203,7 +206,7 @@ public function createContent( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function deleteContentTypes( ?ContentTypesDeleteData $data = null, @@ -266,7 +269,7 @@ public function deleteContentTypeGroup( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function deleteContentTypeGroups( ?ContentTypeGroupsDeleteData $data = null, @@ -285,7 +288,7 @@ public function deleteContentTypeGroups( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function addTranslation( ?TranslationAddData $data = null, @@ -297,7 +300,7 @@ public function addTranslation( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function deleteTranslation( ?TranslationDeleteData $data = null, @@ -309,7 +312,7 @@ public function deleteTranslation( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function removeVersion( ?VersionRemoveData $data = null, @@ -376,7 +379,7 @@ public function swapLocation( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function updateContentMainLocation( ?ContentMainLocationUpdateData $data = null, @@ -451,7 +454,7 @@ public function copyLocation( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function updateVisibilityLocation( ?LocationUpdateVisibilityData $data = null, @@ -470,7 +473,7 @@ public function updateVisibilityLocation( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function updateVisibilityContent( ?ContentVisibilityUpdateData $data = null, @@ -542,7 +545,7 @@ public function deleteSection( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function deleteSections( ?SectionsDeleteData $data = null, @@ -644,7 +647,7 @@ public function deleteLanguage( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function deleteLanguages( ?LanguagesDeleteData $data = null, @@ -697,7 +700,7 @@ public function deleteRole( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function deleteRoles( ?RolesDeleteData $data = null, @@ -818,7 +821,7 @@ public function deletePolicy( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function deletePolicies( ?PoliciesDeleteData $data = null, @@ -968,7 +971,7 @@ public function deleteObjectStateGroup( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function deleteObjectStateGroups( ?ObjectStateGroupsDeleteData $data = null, @@ -1068,7 +1071,7 @@ public function removeContentDraft( } /** - * @return \Symfony\Component\Form\FormInterface<\Ibexa\AdminUi\Form\Data\Notification\NotificationSelectionData|null> + * @return FormInterface */ public function deleteNotification( NotificationSelectionData $data = null, @@ -1091,7 +1094,7 @@ public function deleteNotification( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function createURLWildcard( ?URLWildcardData $data = null, @@ -1114,7 +1117,7 @@ public function createURLWildcard( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function createURLWildcardUpdate( ?URLWildcardUpdateData $data = null, @@ -1137,7 +1140,7 @@ public function createURLWildcardUpdate( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function deleteURLWildcard( ?URLWildcardDeleteData $data = null, diff --git a/src/lib/Form/Factory/TrashFormFactory.php b/src/lib/Form/Factory/TrashFormFactory.php index 66e8de75be..c0bdb57732 100644 --- a/src/lib/Form/Factory/TrashFormFactory.php +++ b/src/lib/Form/Factory/TrashFormFactory.php @@ -19,10 +19,11 @@ use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\Util\StringUtil; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; class TrashFormFactory { - /** @var \Symfony\Component\Form\FormFactoryInterface */ + /** @var FormFactoryInterface */ private $formFactory; public function __construct(FormFactoryInterface $formFactory) @@ -40,7 +41,7 @@ public function restoreTrashItem( } /** - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ public function deleteTrashItem( ?TrashItemDeleteData $data = null, diff --git a/src/lib/Form/Processor/Content/ContentOnTheFlyProcessor.php b/src/lib/Form/Processor/Content/ContentOnTheFlyProcessor.php index cea67a96f7..c703b5e6fe 100644 --- a/src/lib/Form/Processor/Content/ContentOnTheFlyProcessor.php +++ b/src/lib/Form/Processor/Content/ContentOnTheFlyProcessor.php @@ -11,16 +11,25 @@ use Ibexa\ContentForms\Event\FormActionEvent; use Ibexa\ContentForms\Form\Processor\ContentFormProcessor; use Ibexa\Contracts\AdminUi\Event\ContentOnTheFlyEvents; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException; +use Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Response; use Twig\Environment; +use Twig\Error\LoaderError; +use Twig\Error\RuntimeError; +use Twig\Error\SyntaxError; class ContentOnTheFlyProcessor implements EventSubscriberInterface { - /** @var \Twig\Environment */ + /** @var Environment */ private $twig; - /** @var \Ibexa\ContentForms\Form\Processor\ContentFormProcessor */ + /** @var ContentFormProcessor */ private $innerContentFormProcessor; public function __construct( @@ -45,23 +54,23 @@ public static function getSubscribedEvents() } /** - * @param \Ibexa\ContentForms\Event\FormActionEvent $event + * @param FormActionEvent $event * - * @throws \Twig\Error\LoaderError - * @throws \Twig\Error\RuntimeError - * @throws \Twig\Error\SyntaxError - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws LoaderError + * @throws RuntimeError + * @throws SyntaxError + * @throws BadStateException + * @throws ContentFieldValidationException + * @throws ContentValidationException + * @throws InvalidArgumentException + * @throws UnauthorizedException */ public function processCreatePublish(FormActionEvent $event) { // Rely on Content Form Processor from ContentForms to avoid unncessary code duplication $this->innerContentFormProcessor->processPublish($event); - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $event->getPayload('content'); $referrerLocation = $event->getOption('referrerLocation'); $locationId = $referrerLocation ? $referrerLocation->id : $content->contentInfo->mainLocationId; @@ -81,7 +90,7 @@ public function processEditPublish(FormActionEvent $event): void // Rely on Content Form Processor from ContentForms to avoid unncessary code duplication $this->innerContentFormProcessor->processPublish($event); - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $event->getPayload('content'); $referrerLocation = $event->getOption('referrerLocation'); $locationId = $referrerLocation ? $referrerLocation->id : $content->contentInfo->mainLocationId; diff --git a/src/lib/Form/Processor/Content/UrlRedirectProcessor.php b/src/lib/Form/Processor/Content/UrlRedirectProcessor.php index 8771f3ce22..52707faaf0 100644 --- a/src/lib/Form/Processor/Content/UrlRedirectProcessor.php +++ b/src/lib/Form/Processor/Content/UrlRedirectProcessor.php @@ -8,27 +8,30 @@ namespace Ibexa\AdminUi\Form\Processor\Content; +use Ibexa\AdminUi\Exception\InvalidArgumentException; use Ibexa\AdminUi\Specification\SiteAccess\IsAdmin; use Ibexa\ContentForms\Event\ContentFormEvents; use Ibexa\ContentForms\Event\FormActionEvent; use Ibexa\ContentForms\Form\Processor\SystemUrlRedirectProcessor; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Core\MVC\Symfony\SiteAccess; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class UrlRedirectProcessor implements EventSubscriberInterface { - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess */ + /** @var SiteAccess */ private $siteaccess; - /** @var \Ibexa\ContentForms\Form\Processor\SystemUrlRedirectProcessor */ + /** @var SystemUrlRedirectProcessor */ private $systemUrlRedirectProcessor; /** @var array */ private $siteaccessGroups; /** - * @param \Ibexa\Core\MVC\Symfony\SiteAccess $siteaccess - * @param \Ibexa\ContentForms\Form\Processor\SystemUrlRedirectProcessor $systemUrlRedirectProcessor + * @param SiteAccess $siteaccess + * @param SystemUrlRedirectProcessor $systemUrlRedirectProcessor * @param array $siteaccessGroups */ public function __construct( @@ -53,11 +56,11 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\ContentForms\Event\FormActionEvent $event + * @param FormActionEvent $event * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws InvalidArgumentException + * @throws NotFoundException + * @throws UnauthorizedException */ public function processRedirectAfterPublish(FormActionEvent $event): void { @@ -73,11 +76,11 @@ public function processRedirectAfterPublish(FormActionEvent $event): void } /** - * @param \Ibexa\ContentForms\Event\FormActionEvent $event + * @param FormActionEvent $event * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws InvalidArgumentException + * @throws NotFoundException + * @throws UnauthorizedException */ public function processRedirectAfterCancel(FormActionEvent $event): void { @@ -91,7 +94,7 @@ public function processRedirectAfterCancel(FormActionEvent $event): void /** * @return bool * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ protected function isAdminSiteaccess(): bool { diff --git a/src/lib/Form/Processor/ContentEditNotificationFormProcessor.php b/src/lib/Form/Processor/ContentEditNotificationFormProcessor.php index e82d167f87..1d0b882561 100644 --- a/src/lib/Form/Processor/ContentEditNotificationFormProcessor.php +++ b/src/lib/Form/Processor/ContentEditNotificationFormProcessor.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\Form\Processor; +use Ibexa\AdminUi\Exception\InvalidArgumentException; use Ibexa\AdminUi\Specification\SiteAccess\IsAdmin; use Ibexa\ContentForms\Event\ContentFormEvents; use Ibexa\ContentForms\Event\FormActionEvent; @@ -19,18 +20,18 @@ class ContentEditNotificationFormProcessor implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Symfony\Component\HttpFoundation\RequestStack */ + /** @var RequestStack */ private $requestStack; /** @var array */ private $siteAccessGroups; /** - * @param \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface $notificationHandler - * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack + * @param TranslatableNotificationHandlerInterface $notificationHandler + * @param RequestStack $requestStack * @param array $siteAccessGroups */ public function __construct( @@ -55,9 +56,9 @@ public static function getSubscribedEvents() } /** - * @param \Ibexa\ContentForms\Event\FormActionEvent $event + * @param FormActionEvent $event * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function addPublishMessage(FormActionEvent $event) { @@ -73,9 +74,9 @@ public function addPublishMessage(FormActionEvent $event) } /** - * @param \Ibexa\ContentForms\Event\FormActionEvent $event + * @param FormActionEvent $event * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function addSaveDraftMessage(FormActionEvent $event) { @@ -91,11 +92,11 @@ public function addSaveDraftMessage(FormActionEvent $event) } /** - * @param \Symfony\Component\HttpFoundation\Request $request + * @param Request $request * * @return bool * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ protected function isAdminSiteAccess(Request $request): bool { diff --git a/src/lib/Form/Processor/ContentType/ContentTypeDiscardChangesFormProcessor.php b/src/lib/Form/Processor/ContentType/ContentTypeDiscardChangesFormProcessor.php index 95ee49f99b..c973e6ee50 100644 --- a/src/lib/Form/Processor/ContentType/ContentTypeDiscardChangesFormProcessor.php +++ b/src/lib/Form/Processor/ContentType/ContentTypeDiscardChangesFormProcessor.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\Form\Processor\ContentType; +use Ibexa\AdminUi\Form\Data\ContentTypeData; use Ibexa\ContentForms\Event\FormActionEvent; use Ibexa\Contracts\AdminUi\Event\FormEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -19,11 +20,11 @@ */ class ContentTypeDiscardChangesFormProcessor implements EventSubscriberInterface { - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ + /** @var UrlGeneratorInterface */ private $urlGenerator; /** - * @param \Symfony\Component\Routing\Generator\UrlGeneratorInterface $urlGenerator + * @param UrlGeneratorInterface $urlGenerator */ public function __construct( UrlGeneratorInterface $urlGenerator @@ -43,7 +44,7 @@ public static function getSubscribedEvents(): array public function processDiscardChanges(FormActionEvent $event) { - /** @var \Ibexa\AdminUi\Form\Data\ContentTypeData $data */ + /** @var ContentTypeData $data */ $data = $event->getData(); $contentTypeDraft = $data->contentTypeDraft; diff --git a/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php b/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php index 0ffabd8ccf..e901abe718 100644 --- a/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php +++ b/src/lib/Form/Processor/ContentType/ContentTypeFormProcessor.php @@ -7,6 +7,7 @@ namespace Ibexa\AdminUi\Form\Processor\ContentType; +use Ibexa\AdminUi\Form\Data\ContentTypeData; use Ibexa\ContentForms\Event\FormActionEvent; use Ibexa\Contracts\AdminUi\Event\FormEvents; use Ibexa\Contracts\Core\Repository\ContentTypeService; @@ -16,18 +17,19 @@ use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList; use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Routing\RouterInterface; class ContentTypeFormProcessor implements EventSubscriberInterface { /** - * @var \Ibexa\Contracts\Core\Repository\ContentTypeService + * @var ContentTypeService */ private $contentTypeService; /** - * @var \Symfony\Component\Routing\RouterInterface + * @var RouterInterface */ private $router; @@ -37,7 +39,7 @@ class ContentTypeFormProcessor implements EventSubscriberInterface private $options; /** - * @var \Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList + * @var FieldsGroupsList */ private $groupsList; @@ -81,7 +83,7 @@ public function processDefaultAction(FormActionEvent $event) } // Always update FieldDefinitions and ContentTypeDraft - /** @var \Ibexa\AdminUi\Form\Data\ContentTypeData $contentTypeData */ + /** @var ContentTypeData $contentTypeData */ $contentTypeData = $event->getData(); $contentTypeDraft = $contentTypeData->contentTypeDraft; foreach ($contentTypeData->getFlatFieldDefinitionsData() as $fieldDefData) { @@ -146,12 +148,12 @@ public function processAddFieldDefinition(FormActionEvent $event) public function processRemoveFieldDefinition(FormActionEvent $event) { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft */ + /** @var ContentTypeDraft $contentTypeDraft */ $contentTypeDraft = $event->getData()->contentTypeDraft; // Accessing FieldDefinition user selection through the form and not the data, // as "selected" is not a property of FieldDefinitionData. - /** @var \Symfony\Component\Form\FormInterface $fieldDefForm */ + /** @var FormInterface $fieldDefForm */ foreach ($event->getForm()->get('fieldDefinitionsData') as $fieldDefForm) { if ($fieldDefForm->get('selected')->getData() === true) { $this->contentTypeService->removeFieldDefinition($contentTypeDraft, $fieldDefForm->getData()->fieldDefinition); @@ -173,7 +175,7 @@ public function processPublishContentType(FormActionEvent $event) public function processPublishAndEditContentType(FormActionEvent $event): void { $eventData = $event->getData(); - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft */ + /** @var ContentTypeDraft $contentTypeDraft */ $contentTypeDraft = $eventData->contentTypeDraft; $languageCode = $eventData->languageCode; @@ -197,7 +199,7 @@ public function processRemoveContentTypeDraft(FormActionEvent $event) /** * Resolves unique field definition identifier. * - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft + * @param ContentTypeDraft $contentTypeDraft * @param int $startIndex * @param string $fieldTypeIdentifier * diff --git a/src/lib/Form/Processor/PreviewFormProcessor.php b/src/lib/Form/Processor/PreviewFormProcessor.php index bf42f3bc35..7534fa6d1b 100644 --- a/src/lib/Form/Processor/PreviewFormProcessor.php +++ b/src/lib/Form/Processor/PreviewFormProcessor.php @@ -9,11 +9,18 @@ namespace Ibexa\AdminUi\Form\Processor; use Exception; +use Ibexa\AdminUi\Form\Data\NewnessChecker; use Ibexa\AdminUi\Form\Event\ContentEditEvents; +use Ibexa\ContentForms\Data\Content\ContentCreateData; +use Ibexa\ContentForms\Data\Content\ContentUpdateData; use Ibexa\ContentForms\Data\NewnessCheckable; use Ibexa\ContentForms\Event\FormActionEvent; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException; +use Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\ContentStruct; @@ -21,6 +28,9 @@ use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\Routing\Exception\InvalidParameterException; +use Symfony\Component\Routing\Exception\MissingMandatoryParametersException; +use Symfony\Component\Routing\Exception\RouteNotFoundException; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; /** @@ -28,23 +38,23 @@ */ class PreviewFormProcessor implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ + /** @var UrlGeneratorInterface */ private $urlGenerator; - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Symfony\Component\Routing\Generator\UrlGeneratorInterface $urlGenerator - * @param \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface $notificationHandler - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService + * @param ContentService $contentService + * @param UrlGeneratorInterface $urlGenerator + * @param TranslatableNotificationHandlerInterface $notificationHandler + * @param LocationService $locationService */ public function __construct( ContentService $contentService, @@ -69,13 +79,13 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\ContentForms\Event\FormActionEvent $event + * @param FormActionEvent $event * * @throws \InvalidArgumentException */ public function processPreview(FormActionEvent $event): void { - /** @var \Ibexa\ContentForms\Data\Content\ContentCreateData|\Ibexa\ContentForms\Data\Content\ContentUpdateData $data */ + /** @var ContentCreateData|ContentUpdateData $data */ $data = $event->getData(); $form = $event->getForm(); $languageCode = $form->getConfig()->getOption('languageCode'); @@ -109,19 +119,22 @@ public function processPreview(FormActionEvent $event): void * Saves content draft corresponding to $data. * Depending on the nature of $data (create or update data), the draft will either be created or simply updated. * - * @param \Ibexa\ContentForms\Data\Content\ContentCreateData|\Ibexa\Contracts\Core\Repository\Values\Content\ContentStruct|\Ibexa\ContentForms\Data\Content\ContentUpdateData $data + * @param ContentCreateData|ContentStruct|ContentUpdateData $data * @param string $languageCode * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content + * @return Content * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws BadStateException + * @throws UnauthorizedException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentValidationException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException + * @throws ContentValidationException + * @throws ContentFieldValidationException */ - private function saveDraft(ContentStruct $data, string $languageCode, ?array $fieldIdentifiersToValidate): Content - { + private function saveDraft( + ContentStruct $data, + string $languageCode, + ?array $fieldIdentifiersToValidate + ): Content { $mainLanguageCode = $this->resolveMainLanguageCode($data); foreach ($data->fieldsData as $fieldDefIdentifier => $fieldData) { if ($mainLanguageCode != $languageCode && !$fieldData->fieldDefinition->isTranslatable) { @@ -143,17 +156,19 @@ private function saveDraft(ContentStruct $data, string $languageCode, ?array $fi /** * Returns content create or edit URL depending on $data type. * - * @param \Ibexa\ContentForms\Data\Content\ContentCreateData|\Ibexa\ContentForms\Data\Content\ContentUpdateData $data + * @param ContentCreateData|ContentUpdateData $data * @param string $languageCode * * @return string * - * @throws \Symfony\Component\Routing\Exception\RouteNotFoundException - * @throws \Symfony\Component\Routing\Exception\MissingMandatoryParametersException - * @throws \Symfony\Component\Routing\Exception\InvalidParameterException + * @throws RouteNotFoundException + * @throws MissingMandatoryParametersException + * @throws InvalidParameterException */ - private function getContentEditUrl($data, string $languageCode): string - { + private function getContentEditUrl( + $data, + string $languageCode + ): string { return $data->isNew() ? $this->urlGenerator->generate('ibexa.content.create.proxy', [ 'parentLocationId' => $data->getLocationStructs()[0]->parentLocationId, @@ -168,7 +183,7 @@ private function getContentEditUrl($data, string $languageCode): string } /** - * @param \Ibexa\ContentForms\Data\Content\ContentCreateData|\Ibexa\ContentForms\Data\Content\ContentUpdateData|\Ibexa\AdminUi\Form\Data\NewnessChecker $data + * @param ContentCreateData|ContentUpdateData|NewnessChecker $data * * @return string */ @@ -180,14 +195,17 @@ private function resolveMainLanguageCode($data): string } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $referrerLocation - * @param \Ibexa\ContentForms\Data\NewnessCheckable $data + * @param Content $content + * @param Location|null $referrerLocation + * @param NewnessCheckable $data * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @return Location|null */ - private function resolveLocation(Content $content, ?Location $referrerLocation, NewnessCheckable $data): ?Location - { + private function resolveLocation( + Content $content, + ?Location $referrerLocation, + NewnessCheckable $data + ): ?Location { if ($data->isNew() || (!$content->contentInfo->published && null === $content->contentInfo->mainLocationId)) { return null; // no location exists until new content is published } diff --git a/src/lib/Form/Processor/TranslationFormProcessor.php b/src/lib/Form/Processor/TranslationFormProcessor.php index 05cc368627..74f6b7476f 100644 --- a/src/lib/Form/Processor/TranslationFormProcessor.php +++ b/src/lib/Form/Processor/TranslationFormProcessor.php @@ -20,7 +20,7 @@ */ class TranslationFormProcessor implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; public function __construct( @@ -44,11 +44,11 @@ public static function getSubscribedEvents(): array * * This step is required to achieve compatibility with other FormProcessors. * - * @param \Ibexa\ContentForms\Event\FormActionEvent $event + * @param FormActionEvent $event */ public function createContentDraft(FormActionEvent $event): void { - /** @var \Ibexa\AdminUi\Form\Data\ContentTranslationData $data */ + /** @var ContentTranslationData $data */ $data = $event->getData(); if (!$data instanceof ContentTranslationData) { diff --git a/src/lib/Form/Processor/User/UserOnTheFlyProcessor.php b/src/lib/Form/Processor/User/UserOnTheFlyProcessor.php index 8685707780..cb0c6ac08c 100644 --- a/src/lib/Form/Processor/User/UserOnTheFlyProcessor.php +++ b/src/lib/Form/Processor/User/UserOnTheFlyProcessor.php @@ -19,13 +19,13 @@ class UserOnTheFlyProcessor implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; - /** @var \Twig\Environment */ + /** @var Environment */ private $twig; - /** @var \Ibexa\ContentForms\Form\Processor\User\UserUpdateFormProcessor */ + /** @var UserUpdateFormProcessor */ private $innerUserUpdateFormProcessor; public function __construct( @@ -92,11 +92,13 @@ public function processEdit(FormActionEvent $event): void } /** - * @param \Ibexa\ContentForms\Data\User\UserCreateData $data + * @param UserCreateData $data * @param string $languageCode */ - private function setContentFields(UserCreateData $data, string $languageCode): void - { + private function setContentFields( + UserCreateData $data, + string $languageCode + ): void { foreach ($data->fieldsData as $fieldDefIdentifier => $fieldData) { $data->setField($fieldDefIdentifier, $fieldData->value, $languageCode); } diff --git a/src/lib/Form/SubmitHandler.php b/src/lib/Form/SubmitHandler.php index 79adf8e1f7..a395f566fe 100644 --- a/src/lib/Form/SubmitHandler.php +++ b/src/lib/Form/SubmitHandler.php @@ -25,19 +25,19 @@ class SubmitHandler implements UserActionsSubmitHandler { - /** @var \Ibexa\Contracts\AdminUi\Notification\NotificationHandlerInterface */ + /** @var NotificationHandlerInterface */ protected $notificationHandler; - /** @var \Symfony\Component\Routing\RouterInterface */ + /** @var RouterInterface */ protected $router; - /** @var \Ibexa\Contracts\AdminUi\UI\Action\EventDispatcherInterface */ + /** @var EventDispatcherInterface */ protected $uiActionEventDispatcher; - /** @var \Ibexa\AdminUi\UI\Action\FormUiActionMappingDispatcher */ + /** @var FormUiActionMappingDispatcher */ protected $formUiActionMappingDispatcher; - /** @var \Psr\Log\LoggerInterface */ + /** @var LoggerInterface */ private $logger; public function __construct( @@ -60,13 +60,15 @@ public function __construct( * Handles form errors (NotificationHandler:warning). * Handles business logic exceptions (NotificationHandler:error). * - * @param \Symfony\Component\Form\FormInterface $form + * @param FormInterface $form * @param callable(mixed):?Response $handler * - * @return \Symfony\Component\HttpFoundation\Response|null + * @return Response|null */ - public function handle(FormInterface $form, callable $handler): ?Response - { + public function handle( + FormInterface $form, + callable $handler + ): ?Response { $data = $form->getData(); if ($form->isValid()) { @@ -110,18 +112,20 @@ public function handle(FormInterface $form, callable $handler): ?Response * Handles form errors (JsonResponse(['errors'=> [...], Response::ERROR_STATUS_CODE])). * Handles business logic exceptions (JsonResponse(['errors'=> [...], Response::ERROR_STATUS_CODE])). * - * @param \Symfony\Component\Form\FormInterface $form + * @param FormInterface $form * @param callable(mixed):?Response $handler * - * @return \Symfony\Component\HttpFoundation\JsonResponse + * @return JsonResponse */ - public function handleAjax(FormInterface $form, callable $handler): JsonResponse - { + public function handleAjax( + FormInterface $form, + callable $handler + ): JsonResponse { $data = $form->getData(); if ($form->isValid()) { try { - /** @var \Symfony\Component\HttpFoundation\JsonResponse $result */ + /** @var JsonResponse $result */ $result = $handler($data); if ($result instanceof JsonResponse && $result->getStatusCode() === Response::HTTP_OK) { $event = $this->formUiActionMappingDispatcher->dispatch($form); diff --git a/src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php b/src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php index c070fd69ec..b221f5bc54 100644 --- a/src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php +++ b/src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php @@ -27,8 +27,10 @@ public function supports(Location $location): bool return true; } - public function addOptions(FormInterface $form, Location $location): void - { + public function addOptions( + FormInterface $form, + Location $location + ): void { $form ->add('can_have_drafts', ChoiceType::class, [ 'label' => diff --git a/src/lib/Form/TrashLocationOptionProvider/HasAssetRelation.php b/src/lib/Form/TrashLocationOptionProvider/HasAssetRelation.php index 2639b5f4fc..8aab4ca64c 100644 --- a/src/lib/Form/TrashLocationOptionProvider/HasAssetRelation.php +++ b/src/lib/Form/TrashLocationOptionProvider/HasAssetRelation.php @@ -18,10 +18,10 @@ final class HasAssetRelation implements TrashLocationOptionProvider { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -39,8 +39,10 @@ public function supports(Location $location): bool ->isSatisfiedBy($location->getContent()); } - public function addOptions(FormInterface $form, Location $location): void - { + public function addOptions( + FormInterface $form, + Location $location + ): void { $form->add('trash_assets_non_unique', ChoiceType::class, [ 'label' => /** @Desc("Asset Fields(s)") */ diff --git a/src/lib/Form/TrashLocationOptionProvider/HasChildren.php b/src/lib/Form/TrashLocationOptionProvider/HasChildren.php index fee9fe66d2..b6a5ed852d 100644 --- a/src/lib/Form/TrashLocationOptionProvider/HasChildren.php +++ b/src/lib/Form/TrashLocationOptionProvider/HasChildren.php @@ -17,14 +17,16 @@ final class HasChildren implements TrashLocationOptionProvider { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; - public function __construct(LocationService $locationService, TranslatorInterface $translator) - { + public function __construct( + LocationService $locationService, + TranslatorInterface $translator + ) { $this->locationService = $locationService; $this->translator = $translator; } @@ -34,8 +36,10 @@ public function supports(Location $location): bool return (new HasChildrenSpec($this->locationService))->isSatisfiedBy($location); } - public function addOptions(FormInterface $form, Location $location): void - { + public function addOptions( + FormInterface $form, + Location $location + ): void { $childCount = $this->locationService->getLocationChildCount($location); $translatorParameters = [ diff --git a/src/lib/Form/TrashLocationOptionProvider/HasReverseRelations.php b/src/lib/Form/TrashLocationOptionProvider/HasReverseRelations.php index bf4f4f1d0a..8a3a2c95e6 100644 --- a/src/lib/Form/TrashLocationOptionProvider/HasReverseRelations.php +++ b/src/lib/Form/TrashLocationOptionProvider/HasReverseRelations.php @@ -16,10 +16,10 @@ final class HasReverseRelations implements TrashLocationOptionProvider { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -37,8 +37,10 @@ public function supports(Location $location): bool return $reverseRelationsCount > 0; } - public function addOptions(FormInterface $form, Location $location): void - { + public function addOptions( + FormInterface $form, + Location $location + ): void { $reverseRelationsCount = $this->contentService->countReverseRelations($location->contentInfo); $translatorParameters = [ diff --git a/src/lib/Form/TrashLocationOptionProvider/HasUniqueAssetRelation.php b/src/lib/Form/TrashLocationOptionProvider/HasUniqueAssetRelation.php index c00165ed46..2f8fecfea6 100644 --- a/src/lib/Form/TrashLocationOptionProvider/HasUniqueAssetRelation.php +++ b/src/lib/Form/TrashLocationOptionProvider/HasUniqueAssetRelation.php @@ -22,10 +22,10 @@ final class HasUniqueAssetRelation implements TrashLocationOptionProvider public const RADIO_SELECT_TRASH_WITH_ASSETS = 'trash_with_assets'; public const RADIO_SELECT_DEFAULT_TRASH = 'trash_default'; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -43,8 +43,10 @@ public function supports(Location $location): bool ->isSatisfiedBy($location->getContent()); } - public function addOptions(FormInterface $form, Location $location): void - { + public function addOptions( + FormInterface $form, + Location $location + ): void { $translatorParameters = [ '%content%' => $location->getContent()->getName(), ]; diff --git a/src/lib/Form/TrashLocationOptionProvider/OptionsFactory.php b/src/lib/Form/TrashLocationOptionProvider/OptionsFactory.php index 6e34a9959d..0bf64c028d 100644 --- a/src/lib/Form/TrashLocationOptionProvider/OptionsFactory.php +++ b/src/lib/Form/TrashLocationOptionProvider/OptionsFactory.php @@ -13,7 +13,7 @@ final class OptionsFactory { - /** @var \Ibexa\AdminUi\Form\TrashLocationOptionProvider\TrashLocationOptionProvider[] */ + /** @var TrashLocationOptionProvider[] */ private $providers; public function __construct(iterable $providers) @@ -21,8 +21,10 @@ public function __construct(iterable $providers) $this->providers = $providers; } - public function addOptions(FormInterface $form, ?Location $location = null) - { + public function addOptions( + FormInterface $form, + ?Location $location = null + ) { if (!$location) { return; } diff --git a/src/lib/Form/TrashLocationOptionProvider/TrashLocationOptionProvider.php b/src/lib/Form/TrashLocationOptionProvider/TrashLocationOptionProvider.php index 559dc90b49..b9914d1008 100644 --- a/src/lib/Form/TrashLocationOptionProvider/TrashLocationOptionProvider.php +++ b/src/lib/Form/TrashLocationOptionProvider/TrashLocationOptionProvider.php @@ -15,7 +15,10 @@ interface TrashLocationOptionProvider { public function supports(Location $location): bool; - public function addOptions(FormInterface $form, Location $location): void; + public function addOptions( + FormInterface $form, + Location $location + ): void; } class_alias(TrashLocationOptionProvider::class, 'EzSystems\EzPlatformAdminUi\Form\TrashLocationOptionProvider\TrashLocationOptionProvider'); diff --git a/src/lib/Form/Type/Bookmark/BookmarkRemoveType.php b/src/lib/Form/Type/Bookmark/BookmarkRemoveType.php index 7169d31e8e..8118817aab 100644 --- a/src/lib/Form/Type/Bookmark/BookmarkRemoveType.php +++ b/src/lib/Form/Type/Bookmark/BookmarkRemoveType.php @@ -17,11 +17,13 @@ class BookmarkRemoveType extends AbstractType { /** - * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param FormBuilderInterface $builder * @param array $options */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'bookmarks', diff --git a/src/lib/Form/Type/ChoiceList/Loader/AvailableTranslationLanguageChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/AvailableTranslationLanguageChoiceLoader.php index e59f68d3bb..ed402c222c 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/AvailableTranslationLanguageChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/AvailableTranslationLanguageChoiceLoader.php @@ -13,18 +13,20 @@ class AvailableTranslationLanguageChoiceLoader extends BaseChoiceLoader { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ protected $languageService; /** @var string[] */ protected $languageCodes; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService + * @param LanguageService $languageService * @param string[] $languageCodes */ - public function __construct(LanguageService $languageService, $languageCodes) - { + public function __construct( + LanguageService $languageService, + $languageCodes + ) { $this->languageService = $languageService; $this->languageCodes = $languageCodes; } diff --git a/src/lib/Form/Type/ChoiceList/Loader/BaseChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/BaseChoiceLoader.php index 2fbcc34452..9f0dd9ca5f 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/BaseChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/BaseChoiceLoader.php @@ -33,8 +33,10 @@ public function loadChoiceList($value = null) /** * {@inheritdoc} */ - public function loadChoicesForValues(array $values, $value = null) - { + public function loadChoicesForValues( + array $values, + $value = null + ) { // Optimize $values = array_filter($values); if (empty($values)) { @@ -47,8 +49,10 @@ public function loadChoicesForValues(array $values, $value = null) /** * {@inheritdoc} */ - public function loadValuesForChoices(array $choices, $value = null) - { + public function loadValuesForChoices( + array $choices, + $value = null + ) { // Optimize $choices = array_filter($choices); if (empty($choices)) { diff --git a/src/lib/Form/Type/ChoiceList/Loader/BaseTranslationLanguageChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/BaseTranslationLanguageChoiceLoader.php index 6057310d14..3d14d070bb 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/BaseTranslationLanguageChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/BaseTranslationLanguageChoiceLoader.php @@ -13,18 +13,20 @@ class BaseTranslationLanguageChoiceLoader extends BaseChoiceLoader { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ protected $languageService; /** @var string[] */ protected $languageCodes; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService + * @param LanguageService $languageService * @param string[] $languageCodes */ - public function __construct(LanguageService $languageService, $languageCodes) - { + public function __construct( + LanguageService $languageService, + $languageCodes + ) { $this->languageService = $languageService; $this->languageCodes = $languageCodes; } diff --git a/src/lib/Form/Type/ChoiceList/Loader/ConfiguredLanguagesChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/ConfiguredLanguagesChoiceLoader.php index 14e0e6d611..7586476b89 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/ConfiguredLanguagesChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/ConfiguredLanguagesChoiceLoader.php @@ -9,24 +9,27 @@ namespace Ibexa\AdminUi\Form\Type\ChoiceList\Loader; use Ibexa\Contracts\Core\Repository\LanguageService; +use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Symfony\Component\Form\ChoiceList\ArrayChoiceList; use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; class ConfiguredLanguagesChoiceLoader implements ChoiceLoaderInterface { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService - * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver + * @param LanguageService $languageService + * @param ConfigResolverInterface $configResolver */ - public function __construct(LanguageService $languageService, ConfigResolverInterface $configResolver) - { + public function __construct( + LanguageService $languageService, + ConfigResolverInterface $configResolver + ) { $this->languageService = $languageService; $this->configResolver = $configResolver; } @@ -52,8 +55,10 @@ public function loadChoiceList($value = null) /** * {@inheritdoc} */ - public function loadChoicesForValues(array $values, $value = null) - { + public function loadChoicesForValues( + array $values, + $value = null + ) { // Optimize $values = array_filter($values); if (empty($values)) { @@ -66,8 +71,10 @@ public function loadChoicesForValues(array $values, $value = null) /** * {@inheritdoc} */ - public function loadValuesForChoices(array $choices, $value = null) - { + public function loadValuesForChoices( + array $choices, + $value = null + ) { // Optimize $choices = array_filter($choices); if (empty($choices)) { @@ -80,7 +87,7 @@ public function loadValuesForChoices(array $choices, $value = null) /** * Sort languages based on siteaccess languages order. * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language[] + * @return Language[] */ private function getPriorityOrderedLanguages(): array { diff --git a/src/lib/Form/Type/ChoiceList/Loader/ContentCreateContentTypeChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/ContentCreateContentTypeChoiceLoader.php index 754a78a54b..2790af83a6 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/ContentCreateContentTypeChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/ContentCreateContentTypeChoiceLoader.php @@ -83,8 +83,10 @@ public function loadChoiceList($value = null) /** * {@inheritdoc} */ - public function loadChoicesForValues(array $values, $value = null) - { + public function loadChoicesForValues( + array $values, + $value = null + ) { // Optimize $values = array_filter($values); if (empty($values)) { @@ -97,8 +99,10 @@ public function loadChoicesForValues(array $values, $value = null) /** * {@inheritdoc} */ - public function loadValuesForChoices(array $choices, $value = null) - { + public function loadValuesForChoices( + array $choices, + $value = null + ) { // Optimize $choices = array_filter($choices); if (empty($choices)) { diff --git a/src/lib/Form/Type/ChoiceList/Loader/ContentCreateLanguageChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/ContentCreateLanguageChoiceLoader.php index 8452cb41ec..2180ddd28f 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/ContentCreateLanguageChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/ContentCreateLanguageChoiceLoader.php @@ -14,14 +14,14 @@ class ContentCreateLanguageChoiceLoader implements ChoiceLoaderInterface { - /** @var \Ibexa\AdminUi\Form\Type\ChoiceList\Loader\LanguageChoiceLoader */ + /** @var LanguageChoiceLoader */ private $languageChoiceLoader; /** @var string[] */ private $restrictedLanguagesCodes; /** - * @param \Ibexa\AdminUi\Form\Type\ChoiceList\Loader\LanguageChoiceLoader $languageChoiceLoader + * @param LanguageChoiceLoader $languageChoiceLoader * @param array $restrictedLanguagesCodes */ public function __construct( @@ -53,8 +53,10 @@ public function loadChoiceList($value = null) /** * {@inheritdoc} */ - public function loadChoicesForValues(array $values, $value = null) - { + public function loadChoicesForValues( + array $values, + $value = null + ) { // Optimize $values = array_filter($values); if (empty($values)) { @@ -67,8 +69,10 @@ public function loadChoicesForValues(array $values, $value = null) /** * {@inheritdoc} */ - public function loadValuesForChoices(array $choices, $value = null) - { + public function loadValuesForChoices( + array $choices, + $value = null + ) { // Optimize $choices = array_filter($choices); if (empty($choices)) { diff --git a/src/lib/Form/Type/ChoiceList/Loader/ContentEditTranslationChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/ContentEditTranslationChoiceLoader.php index d746acab9d..2bbc3ac3fb 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/ContentEditTranslationChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/ContentEditTranslationChoiceLoader.php @@ -20,32 +20,32 @@ class ContentEditTranslationChoiceLoader extends BaseChoiceLoader { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; /** @var string[] */ private $languageCodes; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo */ + /** @var ContentInfo */ private $contentInfo; - /** @var \Ibexa\AdminUi\Permission\LookupLimitationsTransformer */ + /** @var LookupLimitationsTransformer */ private $lookupLimitationsTransformer; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ private $location; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo - * @param \Ibexa\AdminUi\Permission\LookupLimitationsTransformer $lookupLimitationsTransformer + * @param LanguageService $languageService + * @param PermissionResolver $permissionResolver + * @param ContentInfo $contentInfo + * @param LookupLimitationsTransformer $lookupLimitationsTransformer * @param string[] $languageCodes */ public function __construct( diff --git a/src/lib/Form/Type/ChoiceList/Loader/ContentTypeChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/ContentTypeChoiceLoader.php index 6ae5dccd09..6c403161fc 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/ContentTypeChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/ContentTypeChoiceLoader.php @@ -16,18 +16,20 @@ class ContentTypeChoiceLoader implements ChoiceLoaderInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ protected $contentTypeService; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ + /** @var UserLanguagePreferenceProviderInterface */ private $userLanguagePreferenceProvider; /** - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider + * @param ContentTypeService $contentTypeService + * @param UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider */ - public function __construct(ContentTypeService $contentTypeService, UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider) - { + public function __construct( + ContentTypeService $contentTypeService, + UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider + ) { $this->contentTypeService = $contentTypeService; $this->userLanguagePreferenceProvider = $userLanguagePreferenceProvider; } @@ -42,7 +44,10 @@ public function getChoiceList(): array $contentTypeGroups = $this->contentTypeService->loadContentTypeGroups($preferredLanguages); foreach ($contentTypeGroups as $contentTypeGroup) { $contentTypes = $this->contentTypeService->loadContentTypes($contentTypeGroup, $preferredLanguages); - usort($contentTypes, static function (ContentType $contentType1, ContentType $contentType2) { + usort($contentTypes, static function ( + ContentType $contentType1, + ContentType $contentType2 + ) { return strnatcasecmp($contentType1->getName(), $contentType2->getName()); }); @@ -65,8 +70,10 @@ public function loadChoiceList($value = null) /** * {@inheritdoc} */ - public function loadChoicesForValues(array $values, $value = null) - { + public function loadChoicesForValues( + array $values, + $value = null + ) { // Optimize $values = array_filter($values); if (empty($values)) { @@ -79,8 +86,10 @@ public function loadChoicesForValues(array $values, $value = null) /** * {@inheritdoc} */ - public function loadValuesForChoices(array $choices, $value = null) - { + public function loadValuesForChoices( + array $choices, + $value = null + ) { // Optimize $choices = array_filter($choices); if (empty($choices)) { diff --git a/src/lib/Form/Type/ChoiceList/Loader/DatePeriodChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/DatePeriodChoiceLoader.php index b380c2bee7..3c6bc27dd6 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/DatePeriodChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/DatePeriodChoiceLoader.php @@ -13,7 +13,7 @@ class DatePeriodChoiceLoader extends BaseChoiceLoader { - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct(TranslatorInterface $translator) diff --git a/src/lib/Form/Type/ChoiceList/Loader/SiteAccessChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/SiteAccessChoiceLoader.php index 1d6fb6e695..8cf9d3cd7f 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/SiteAccessChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/SiteAccessChoiceLoader.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\Form\Type\ChoiceList\Loader; +use Ibexa\AdminUi\Siteaccess\NonAdminSiteaccessResolver; use Ibexa\AdminUi\Siteaccess\SiteAccessNameGeneratorInterface; use Ibexa\AdminUi\Siteaccess\SiteaccessResolverInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Location; @@ -16,10 +17,10 @@ class SiteAccessChoiceLoader implements ChoiceLoaderInterface { - /** @var \Ibexa\AdminUi\Siteaccess\NonAdminSiteaccessResolver */ + /** @var NonAdminSiteaccessResolver */ private SiteaccessResolverInterface $nonAdminSiteaccessResolver; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ private $location; private SiteAccessNameGeneratorInterface $siteAccessNameGenerator; @@ -67,8 +68,10 @@ public function loadChoiceList($value = null) return new ArrayChoiceList($choices, $value); } - public function loadChoicesForValues(array $values, $value = null) - { + public function loadChoicesForValues( + array $values, + $value = null + ) { // Optimize $values = array_filter($values); if (empty($values)) { @@ -78,8 +81,10 @@ public function loadChoicesForValues(array $values, $value = null) return $this->loadChoiceList($value)->getChoicesForValues($values); } - public function loadValuesForChoices(array $choices, $value = null) - { + public function loadValuesForChoices( + array $choices, + $value = null + ) { // Optimize $choices = array_filter($choices); if (empty($choices)) { diff --git a/src/lib/Form/Type/Content/ContentInfoType.php b/src/lib/Form/Type/Content/ContentInfoType.php index d72eaf9dcd..d6be17013b 100644 --- a/src/lib/Form/Type/Content/ContentInfoType.php +++ b/src/lib/Form/Type/Content/ContentInfoType.php @@ -16,19 +16,21 @@ class ContentInfoType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ protected $contentService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @param ContentService $contentService */ public function __construct(ContentService $contentService) { $this->contentService = $contentService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addViewTransformer(new ContentInfoTransformer($this->contentService)); } diff --git a/src/lib/Form/Type/Content/ContentType.php b/src/lib/Form/Type/Content/ContentType.php index 5c3c622400..0c5b8999f4 100644 --- a/src/lib/Form/Type/Content/ContentType.php +++ b/src/lib/Form/Type/Content/ContentType.php @@ -16,11 +16,11 @@ class ContentType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ protected $contentService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @param ContentService $contentService */ public function __construct(ContentService $contentService) { @@ -30,8 +30,10 @@ public function __construct(ContentService $contentService) /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addViewTransformer(new ContentTransformer($this->contentService)); } diff --git a/src/lib/Form/Type/Content/ContentTypeSubmitType.php b/src/lib/Form/Type/Content/ContentTypeSubmitType.php index 8d94dd3d99..486ac2bee9 100644 --- a/src/lib/Form/Type/Content/ContentTypeSubmitType.php +++ b/src/lib/Form/Type/Content/ContentTypeSubmitType.php @@ -16,19 +16,21 @@ class ContentTypeSubmitType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ protected $contentTypeService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService + * @param ContentTypeService $contentTypeService */ public function __construct(ContentTypeService $contentTypeService) { $this->contentTypeService = $contentTypeService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addViewTransformer(new ContentTypeTransformer($this->contentTypeService)); } diff --git a/src/lib/Form/Type/Content/ContentTypeType.php b/src/lib/Form/Type/Content/ContentTypeType.php index 747875ddf8..bae46330a0 100644 --- a/src/lib/Form/Type/Content/ContentTypeType.php +++ b/src/lib/Form/Type/Content/ContentTypeType.php @@ -16,19 +16,21 @@ class ContentTypeType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ protected $contentTypeService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService + * @param ContentTypeService $contentTypeService */ public function __construct(ContentTypeService $contentTypeService) { $this->contentTypeService = $contentTypeService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addViewTransformer(new ContentTypeTransformer($this->contentTypeService)); } diff --git a/src/lib/Form/Type/Content/ContentVisibilityUpdateType.php b/src/lib/Form/Type/Content/ContentVisibilityUpdateType.php index d0e39f320c..1a0b9fb732 100644 --- a/src/lib/Form/Type/Content/ContentVisibilityUpdateType.php +++ b/src/lib/Form/Type/Content/ContentVisibilityUpdateType.php @@ -19,8 +19,10 @@ class ContentVisibilityUpdateType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'contentInfo', diff --git a/src/lib/Form/Type/Content/CustomUrl/CustomUrlAddType.php b/src/lib/Form/Type/Content/CustomUrl/CustomUrlAddType.php index 5c572e5413..ea67b31c0f 100644 --- a/src/lib/Form/Type/Content/CustomUrl/CustomUrlAddType.php +++ b/src/lib/Form/Type/Content/CustomUrl/CustomUrlAddType.php @@ -13,6 +13,7 @@ use Ibexa\AdminUi\Form\EventListener\DisableSiteRootCheckboxIfRootLocationListener; use Ibexa\AdminUi\Form\Type\ChoiceList\Loader\SiteAccessChoiceLoader; use Ibexa\AdminUi\Form\Type\Content\LocationType; +use Ibexa\AdminUi\Siteaccess\NonAdminSiteaccessResolver; use Ibexa\AdminUi\Siteaccess\SiteAccessNameGeneratorInterface; use Ibexa\AdminUi\Siteaccess\SiteaccessResolverInterface; use Ibexa\Contracts\Core\Repository\LanguageService; @@ -29,19 +30,19 @@ class CustomUrlAddType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; - /** @var \Ibexa\AdminUi\Form\EventListener\AddLanguageFieldBasedOnContentListener */ + /** @var AddLanguageFieldBasedOnContentListener */ private $addLanguageFieldBasedOnContentListener; - /** @var \Ibexa\AdminUi\Form\EventListener\BuildPathFromRootListener */ + /** @var BuildPathFromRootListener */ private $buildPathFromRootListener; - /** @var \Ibexa\AdminUi\Form\EventListener\DisableSiteRootCheckboxIfRootLocationListener */ + /** @var DisableSiteRootCheckboxIfRootLocationListener */ private $checkboxIfRootLocationListener; - /** @var \Ibexa\AdminUi\Siteaccess\NonAdminSiteaccessResolver */ + /** @var NonAdminSiteaccessResolver */ private $nonAdminSiteaccessResolver; private SiteAccessNameGeneratorInterface $siteAccessNameGenerator; @@ -63,11 +64,13 @@ public function __construct( } /** - * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param FormBuilderInterface $builder * @param array $options */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $location = $options['data']->getLocation(); $builder diff --git a/src/lib/Form/Type/Content/CustomUrl/CustomUrlRemoveType.php b/src/lib/Form/Type/Content/CustomUrl/CustomUrlRemoveType.php index eb556bb79b..9787bf4adf 100644 --- a/src/lib/Form/Type/Content/CustomUrl/CustomUrlRemoveType.php +++ b/src/lib/Form/Type/Content/CustomUrl/CustomUrlRemoveType.php @@ -18,11 +18,13 @@ class CustomUrlRemoveType extends AbstractType { /** - * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param FormBuilderInterface $builder * @param array $options */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'location', diff --git a/src/lib/Form/Type/Content/Draft/ContentCreateType.php b/src/lib/Form/Type/Content/Draft/ContentCreateType.php index e6f7a2db34..ec759dbc3b 100644 --- a/src/lib/Form/Type/Content/Draft/ContentCreateType.php +++ b/src/lib/Form/Type/Content/Draft/ContentCreateType.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\Form\Type\Content\Draft; +use Ibexa\AdminUi\Exception\InvalidArgumentException; use Ibexa\AdminUi\Form\Data\Content\Draft\ContentCreateData; use Ibexa\AdminUi\Form\Type\ChoiceList\Loader\ContentCreateContentTypeChoiceLoader; use Ibexa\AdminUi\Form\Type\ChoiceList\Loader\ContentCreateLanguageChoiceLoader; @@ -16,6 +17,8 @@ use Ibexa\AdminUi\Form\Type\Language\LanguageChoiceType; use Ibexa\AdminUi\Permission\LookupLimitationsTransformer; use Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\User\Limitation; @@ -27,25 +30,25 @@ class ContentCreateType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ protected $languageService; private ContentCreateContentTypeChoiceLoader $contentCreateContentTypeChoiceLoader; - /** @var \Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface */ + /** @var ChoiceLoaderInterface */ private $languageChoiceLoader; - /** @var \Ibexa\AdminUi\Permission\LookupLimitationsTransformer */ + /** @var LookupLimitationsTransformer */ private $lookupLimitationsTransformer; - /** @var \Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface */ + /** @var PermissionCheckerInterface */ private $permissionChecker; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService - * @param \Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface $languageChoiceLoader - * @param \Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface $permissionChecker - * @param \Ibexa\AdminUi\Permission\LookupLimitationsTransformer $lookupLimitationsTransformer + * @param LanguageService $languageService + * @param ChoiceLoaderInterface $languageChoiceLoader + * @param PermissionCheckerInterface $permissionChecker + * @param LookupLimitationsTransformer $lookupLimitationsTransformer */ public function __construct( LanguageService $languageService, @@ -62,20 +65,22 @@ public function __construct( } /** - * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param FormBuilderInterface $builder * @param array $options * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws InvalidArgumentException + * @throws BadStateException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $restrictedContentTypesIds = []; $restrictedLanguageCodes = []; - /** @var \Ibexa\AdminUi\Form\Data\Content\Draft\ContentCreateData $contentCreateData */ + /** @var ContentCreateData $contentCreateData */ $contentCreateData = $options['data']; if ($location = $contentCreateData->getParentLocation()) { $limitationsValues = $this->getLimitationValuesForLocation($location); @@ -131,14 +136,14 @@ public function configureOptions(OptionsResolver $resolver) } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * * @return array * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws InvalidArgumentException + * @throws BadStateException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ private function getLimitationValuesForLocation(Location $location): array { diff --git a/src/lib/Form/Type/Content/Draft/ContentEditType.php b/src/lib/Form/Type/Content/Draft/ContentEditType.php index 607d1503d4..f42470d61f 100644 --- a/src/lib/Form/Type/Content/Draft/ContentEditType.php +++ b/src/lib/Form/Type/Content/Draft/ContentEditType.php @@ -23,15 +23,15 @@ class ContentEditType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ protected $languageService; - /** @var \Ibexa\AdminUi\Form\Type\ChoiceList\Loader\LanguageChoiceLoader */ + /** @var LanguageChoiceLoader */ private $languageChoiceLoader; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService - * @param \Ibexa\AdminUi\Form\Type\ChoiceList\Loader\LanguageChoiceLoader $languageChoiceLoader + * @param LanguageService $languageService + * @param LanguageChoiceLoader $languageChoiceLoader */ public function __construct( LanguageService $languageService, @@ -41,8 +41,10 @@ public function __construct( $this->languageChoiceLoader = $languageChoiceLoader; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'location', diff --git a/src/lib/Form/Type/Content/Draft/ContentRemoveType.php b/src/lib/Form/Type/Content/Draft/ContentRemoveType.php index ef7cf1d05d..8c61d0606b 100644 --- a/src/lib/Form/Type/Content/Draft/ContentRemoveType.php +++ b/src/lib/Form/Type/Content/Draft/ContentRemoveType.php @@ -21,8 +21,10 @@ class ContentRemoveType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add( 'versions', CollectionType::class, diff --git a/src/lib/Form/Type/Content/Location/ContentLocationAddType.php b/src/lib/Form/Type/Content/Location/ContentLocationAddType.php index 7625ce7fb1..d35c7f9a31 100644 --- a/src/lib/Form/Type/Content/Location/ContentLocationAddType.php +++ b/src/lib/Form/Type/Content/Location/ContentLocationAddType.php @@ -18,8 +18,10 @@ class ContentLocationAddType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'content_info', diff --git a/src/lib/Form/Type/Content/Location/ContentLocationRemoveType.php b/src/lib/Form/Type/Content/Location/ContentLocationRemoveType.php index 044f92d7a5..9fa745edd2 100644 --- a/src/lib/Form/Type/Content/Location/ContentLocationRemoveType.php +++ b/src/lib/Form/Type/Content/Location/ContentLocationRemoveType.php @@ -19,8 +19,10 @@ class ContentLocationRemoveType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'content_info', diff --git a/src/lib/Form/Type/Content/Location/ContentMainLocationUpdateType.php b/src/lib/Form/Type/Content/Location/ContentMainLocationUpdateType.php index 81a4b3863f..749cb69af8 100644 --- a/src/lib/Form/Type/Content/Location/ContentMainLocationUpdateType.php +++ b/src/lib/Form/Type/Content/Location/ContentMainLocationUpdateType.php @@ -19,19 +19,21 @@ class ContentMainLocationUpdateType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ protected $locationService; /** - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService + * @param LocationService $locationService */ public function __construct(LocationService $locationService) { $this->locationService = $locationService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'content_info', diff --git a/src/lib/Form/Type/Content/LocationType.php b/src/lib/Form/Type/Content/LocationType.php index 8b7fa17b58..4654f92265 100644 --- a/src/lib/Form/Type/Content/LocationType.php +++ b/src/lib/Form/Type/Content/LocationType.php @@ -18,19 +18,21 @@ class LocationType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ protected $locationService; /** - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService + * @param LocationService $locationService */ public function __construct(LocationService $locationService) { $this->locationService = $locationService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addViewTransformer( $options['multiple'] ? new LocationsTransformer($this->locationService) diff --git a/src/lib/Form/Type/Content/SortType.php b/src/lib/Form/Type/Content/SortType.php index b328d84bf3..e492e637c5 100644 --- a/src/lib/Form/Type/Content/SortType.php +++ b/src/lib/Form/Type/Content/SortType.php @@ -19,8 +19,10 @@ class SortType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('field', ChoiceType::class, [ 'choices' => $options['sort_fields'], diff --git a/src/lib/Form/Type/Content/Translation/MainTranslationUpdateType.php b/src/lib/Form/Type/Content/Translation/MainTranslationUpdateType.php index 6ef6dc911b..08000489d5 100644 --- a/src/lib/Form/Type/Content/Translation/MainTranslationUpdateType.php +++ b/src/lib/Form/Type/Content/Translation/MainTranslationUpdateType.php @@ -19,11 +19,13 @@ class MainTranslationUpdateType extends AbstractType { /** - * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param FormBuilderInterface $builder * @param array $options */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'content', @@ -46,7 +48,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) } /** - * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * @param OptionsResolver $resolver */ public function configureOptions(OptionsResolver $resolver) { diff --git a/src/lib/Form/Type/Content/Translation/TranslationAddType.php b/src/lib/Form/Type/Content/Translation/TranslationAddType.php index e4fa58402a..e55896aefe 100644 --- a/src/lib/Form/Type/Content/Translation/TranslationAddType.php +++ b/src/lib/Form/Type/Content/Translation/TranslationAddType.php @@ -13,7 +13,10 @@ use Ibexa\AdminUi\Permission\LookupLimitationsTransformer; use Ibexa\Contracts\Core\Limitation\Target; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\PermissionResolver; @@ -23,6 +26,9 @@ use Ibexa\Contracts\Core\Repository\Values\User\Limitation; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader; +use Symfony\Component\Form\Exception\AlreadySubmittedException; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormBuilderInterface; @@ -33,27 +39,27 @@ class TranslationAddType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ protected $languageService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ protected $contentService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ protected $locationService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\AdminUi\Permission\LookupLimitationsTransformer */ + /** @var LookupLimitationsTransformer */ private $lookupLimitationsTransformer; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $langaugeService - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver - * @param \Ibexa\AdminUi\Permission\LookupLimitationsTransformer $lookupLimitationsTransformer + * @param LanguageService $langaugeService + * @param ContentService $contentService + * @param LocationService $locationService + * @param PermissionResolver $permissionResolver + * @param LookupLimitationsTransformer $lookupLimitationsTransformer */ public function __construct( LanguageService $langaugeService, @@ -69,8 +75,10 @@ public function __construct( $this->lookupLimitationsTransformer = $lookupLimitationsTransformer; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'location', @@ -99,13 +107,13 @@ public function configureOptions(OptionsResolver $resolver) /** * Adds language fields and populates options list based on default form data. * - * @param \Symfony\Component\Form\FormEvent $event + * @param FormEvent $event * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Symfony\Component\Form\Exception\AlreadySubmittedException - * @throws \Symfony\Component\Form\Exception\LogicException - * @throws \Symfony\Component\Form\Exception\UnexpectedTypeException + * @throws UnauthorizedException + * @throws NotFoundException + * @throws AlreadySubmittedException + * @throws LogicException + * @throws UnexpectedTypeException */ public function onPreSetData(FormEvent $event) { @@ -127,13 +135,13 @@ public function onPreSetData(FormEvent $event) /** * Adds language fields and populates options list based on submitted form data. * - * @param \Symfony\Component\Form\FormEvent $event + * @param FormEvent $event * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Symfony\Component\Form\Exception\AlreadySubmittedException - * @throws \Symfony\Component\Form\Exception\LogicException - * @throws \Symfony\Component\Form\Exception\UnexpectedTypeException + * @throws UnauthorizedException + * @throws NotFoundException + * @throws AlreadySubmittedException + * @throws LogicException + * @throws UnexpectedTypeException */ public function onPreSubmit(FormEvent $event) { @@ -178,13 +186,13 @@ public function loadLanguages(callable $filter): array /** * Adds language fields to the $form. Language options are composed based on content language. * - * @param \Symfony\Component\Form\FormInterface $form + * @param FormInterface $form * @param string[] $contentLanguages - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo|null $contentInfo - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param ContentInfo|null $contentInfo + * @param Location|null $location * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws BadStateException + * @throws InvalidArgumentException */ public function addLanguageFields( FormInterface $form, diff --git a/src/lib/Form/Type/Content/Translation/TranslationDeleteType.php b/src/lib/Form/Type/Content/Translation/TranslationDeleteType.php index 7850513246..c3d95eaedb 100644 --- a/src/lib/Form/Type/Content/Translation/TranslationDeleteType.php +++ b/src/lib/Form/Type/Content/Translation/TranslationDeleteType.php @@ -19,8 +19,10 @@ class TranslationDeleteType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'content_info', diff --git a/src/lib/Form/Type/Content/VersionInfoType.php b/src/lib/Form/Type/Content/VersionInfoType.php index 8556263aaf..519628a7ea 100644 --- a/src/lib/Form/Type/Content/VersionInfoType.php +++ b/src/lib/Form/Type/Content/VersionInfoType.php @@ -16,19 +16,21 @@ class VersionInfoType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ protected $contentService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @param ContentService $contentService */ public function __construct(ContentService $contentService) { $this->contentService = $contentService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'content_info', diff --git a/src/lib/Form/Type/ContentType/ContentTypeChoiceType.php b/src/lib/Form/Type/ContentType/ContentTypeChoiceType.php index 8fefe403b0..dd33a713a8 100644 --- a/src/lib/Form/Type/ContentType/ContentTypeChoiceType.php +++ b/src/lib/Form/Type/ContentType/ContentTypeChoiceType.php @@ -19,15 +19,15 @@ */ class ContentTypeChoiceType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ protected $contentTypeService; - /** @var \Ibexa\AdminUi\Form\Type\ChoiceList\Loader\ContentTypeChoiceLoader */ + /** @var ContentTypeChoiceLoader */ private $contentTypeChoiceLoader; /** - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\AdminUi\Form\Type\ChoiceList\Loader\ContentTypeChoiceLoader $contentTypeChoiceLoader + * @param ContentTypeService $contentTypeService + * @param ContentTypeChoiceLoader $contentTypeChoiceLoader */ public function __construct( ContentTypeService $contentTypeService, diff --git a/src/lib/Form/Type/ContentType/ContentTypeCopyType.php b/src/lib/Form/Type/ContentType/ContentTypeCopyType.php index 6d67acdbe2..a852b00335 100644 --- a/src/lib/Form/Type/ContentType/ContentTypeCopyType.php +++ b/src/lib/Form/Type/ContentType/ContentTypeCopyType.php @@ -17,8 +17,10 @@ class ContentTypeCopyType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder ->add( 'content_type', @@ -40,7 +42,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void } /** - * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * @param OptionsResolver $resolver */ public function configureOptions(OptionsResolver $resolver) { diff --git a/src/lib/Form/Type/ContentType/ContentTypeCreateType.php b/src/lib/Form/Type/ContentType/ContentTypeCreateType.php index 838ad9ddba..60ea10a7ee 100644 --- a/src/lib/Form/Type/ContentType/ContentTypeCreateType.php +++ b/src/lib/Form/Type/ContentType/ContentTypeCreateType.php @@ -21,7 +21,7 @@ class ContentTypeCreateType extends AbstractType { /** - * @var \Ibexa\Contracts\Core\Repository\ContentTypeService + * @var ContentTypeService */ private $contentTypeService; @@ -48,12 +48,17 @@ public function configureOptions(OptionsResolver $resolver) ]); } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('contentTypeGroupId', HiddenType::class, [ 'constraints' => new Callback( - function ($contentTypeGroupId, ExecutionContextInterface $context) { + function ( + $contentTypeGroupId, + ExecutionContextInterface $context + ) { try { $this->contentTypeService->loadContentTypeGroup($contentTypeGroupId); } catch (NotFoundException $e) { diff --git a/src/lib/Form/Type/ContentType/ContentTypeDeleteType.php b/src/lib/Form/Type/ContentType/ContentTypeDeleteType.php index 437888716d..ff481ca5bc 100644 --- a/src/lib/Form/Type/ContentType/ContentTypeDeleteType.php +++ b/src/lib/Form/Type/ContentType/ContentTypeDeleteType.php @@ -34,8 +34,10 @@ public function configureOptions(OptionsResolver $resolver) ]); } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('contentTypeId', HiddenType::class) ->add('delete', SubmitType::class, ['label' => /** @Desc("Delete") */ 'content_type.delete']); diff --git a/src/lib/Form/Type/ContentType/ContentTypeEditType.php b/src/lib/Form/Type/ContentType/ContentTypeEditType.php index 3410fdfe18..5668669de5 100644 --- a/src/lib/Form/Type/ContentType/ContentTypeEditType.php +++ b/src/lib/Form/Type/ContentType/ContentTypeEditType.php @@ -22,7 +22,7 @@ class ContentTypeEditType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ protected $languageService; public function __construct( @@ -31,9 +31,11 @@ public function __construct( $this->languageService = $languageService; } - public function buildForm(FormBuilderInterface $builder, array $options): void - { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType */ + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { + /** @var ContentType $contentType */ $contentType = $options['contentType']; $contentTypeLanguages = $contentType->languageCodes; @@ -76,7 +78,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void } /** - * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * @param OptionsResolver $resolver */ public function configureOptions(OptionsResolver $resolver) { diff --git a/src/lib/Form/Type/ContentType/ContentTypeGroupDeleteType.php b/src/lib/Form/Type/ContentType/ContentTypeGroupDeleteType.php index f5edddeecc..c00a34f4e6 100644 --- a/src/lib/Form/Type/ContentType/ContentTypeGroupDeleteType.php +++ b/src/lib/Form/Type/ContentType/ContentTypeGroupDeleteType.php @@ -26,8 +26,10 @@ public function getBlockPrefix() return 'content_type_group_delete'; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('contentTypeGroupId', HiddenType::class) ->add('delete', SubmitType::class, ['label' => /** @Desc("Delete") */ 'content_type.group.delete']); diff --git a/src/lib/Form/Type/ContentType/ContentTypeGroupType.php b/src/lib/Form/Type/ContentType/ContentTypeGroupType.php index 490ec9674b..fd636d3781 100644 --- a/src/lib/Form/Type/ContentType/ContentTypeGroupType.php +++ b/src/lib/Form/Type/ContentType/ContentTypeGroupType.php @@ -16,8 +16,10 @@ class ContentTypeGroupType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('identifier', TextType::class, ['label' => /** @Desc("Name") */ 'content_type.group.identifier']) ->add('save', SubmitType::class, ['label' => /** @Desc("Save") */ 'content_type.group.save']); diff --git a/src/lib/Form/Type/ContentType/ContentTypeUpdateType.php b/src/lib/Form/Type/ContentType/ContentTypeUpdateType.php index 894c3aa6e8..c0d81d6f39 100644 --- a/src/lib/Form/Type/ContentType/ContentTypeUpdateType.php +++ b/src/lib/Form/Type/ContentType/ContentTypeUpdateType.php @@ -45,8 +45,10 @@ public function configureOptions(OptionsResolver $resolver) ->setRequired(['languageCode']); } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $hasFieldDefinition = count($options['data']->fieldDefinitionsData) > 0; $isTranslation = $options['mainLanguageCode'] !== $options['languageCode']; diff --git a/src/lib/Form/Type/ContentType/ContentTypesDeleteType.php b/src/lib/Form/Type/ContentType/ContentTypesDeleteType.php index 02d817ce14..82cdd2a660 100644 --- a/src/lib/Form/Type/ContentType/ContentTypesDeleteType.php +++ b/src/lib/Form/Type/ContentType/ContentTypesDeleteType.php @@ -18,8 +18,10 @@ class ContentTypesDeleteType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('content_types', CollectionType::class, [ 'entry_type' => CheckboxType::class, diff --git a/src/lib/Form/Type/ContentType/FieldDefinitionsCollectionType.php b/src/lib/Form/Type/ContentType/FieldDefinitionsCollectionType.php index b0f5b501b2..acf4105c04 100644 --- a/src/lib/Form/Type/ContentType/FieldDefinitionsCollectionType.php +++ b/src/lib/Form/Type/ContentType/FieldDefinitionsCollectionType.php @@ -18,19 +18,21 @@ final class FieldDefinitionsCollectionType extends AbstractType { - /** @var \Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList */ + /** @var FieldsGroupsList */ private $fieldsGroupsList; /** - * @param \Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList $fieldsGroupsListHelper + * @param FieldsGroupsList $fieldsGroupsListHelper */ public function __construct(FieldsGroupsList $fieldsGroupsListHelper) { $this->fieldsGroupsList = $fieldsGroupsListHelper; } - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { foreach ($this->fieldsGroupsList->getGroups() as $identifier => $group) { if ($identifier === '') { $identifier = $this->fieldsGroupsList->getDefaultGroup(); diff --git a/src/lib/Form/Type/ContentType/FieldTypeChoiceType.php b/src/lib/Form/Type/ContentType/FieldTypeChoiceType.php index edd54f24e7..cbece64996 100644 --- a/src/lib/Form/Type/ContentType/FieldTypeChoiceType.php +++ b/src/lib/Form/Type/ContentType/FieldTypeChoiceType.php @@ -20,17 +20,19 @@ class FieldTypeChoiceType extends AbstractType { /** - * @var \Ibexa\Core\FieldType\FieldTypeRegistry + * @var FieldTypeRegistry */ private $fieldTypeRegistry; /** - * @var \Symfony\Contracts\Translation\TranslatorInterface + * @var TranslatorInterface */ private $translator; - public function __construct(FieldTypeRegistry $fieldTypeRegistry, TranslatorInterface $translator) - { + public function __construct( + FieldTypeRegistry $fieldTypeRegistry, + TranslatorInterface $translator + ) { $this->fieldTypeRegistry = $fieldTypeRegistry; $this->translator = $translator; } diff --git a/src/lib/Form/Type/ContentType/SortFieldChoiceType.php b/src/lib/Form/Type/ContentType/SortFieldChoiceType.php index 3f0a9edf78..846224698e 100644 --- a/src/lib/Form/Type/ContentType/SortFieldChoiceType.php +++ b/src/lib/Form/Type/ContentType/SortFieldChoiceType.php @@ -13,6 +13,7 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Translation\Exception\InvalidArgumentException; use Symfony\Contracts\Translation\TranslatorInterface; /** @@ -20,7 +21,7 @@ */ class SortFieldChoiceType extends AbstractType { - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct(TranslatorInterface $translator) @@ -46,7 +47,7 @@ public function getParent(): ?string * * @return array * - * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ private function getSortFieldChoices(): array { diff --git a/src/lib/Form/Type/ContentType/SortOrderChoiceType.php b/src/lib/Form/Type/ContentType/SortOrderChoiceType.php index d020274a76..ea9989889b 100644 --- a/src/lib/Form/Type/ContentType/SortOrderChoiceType.php +++ b/src/lib/Form/Type/ContentType/SortOrderChoiceType.php @@ -21,7 +21,7 @@ class SortOrderChoiceType extends AbstractType { /** - * @var \Symfony\Contracts\Translation\TranslatorInterface + * @var TranslatorInterface */ private $translator; diff --git a/src/lib/Form/Type/ContentType/Translation/TranslationAddType.php b/src/lib/Form/Type/ContentType/Translation/TranslationAddType.php index d9c725816c..b7a56a1744 100644 --- a/src/lib/Form/Type/ContentType/Translation/TranslationAddType.php +++ b/src/lib/Form/Type/ContentType/Translation/TranslationAddType.php @@ -15,8 +15,12 @@ use Ibexa\AdminUi\Form\Type\ContentTypeGroup\ContentTypeGroupType; use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LanguageService; use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Exception\AlreadySubmittedException; +use Symfony\Component\Form\Exception\LogicException; +use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormBuilderInterface; @@ -27,15 +31,15 @@ class TranslationAddType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ protected $languageService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService + * @param LanguageService $languageService + * @param ContentTypeService $contentTypeService */ public function __construct( LanguageService $languageService, @@ -46,11 +50,13 @@ public function __construct( } /** - * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param FormBuilderInterface $builder * @param array $options */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'contentType', @@ -78,7 +84,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) } /** - * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * @param OptionsResolver $resolver */ public function configureOptions(OptionsResolver $resolver) { @@ -91,20 +97,20 @@ public function configureOptions(OptionsResolver $resolver) /** * Adds language fields and populates options list based on default form data. * - * @param \Symfony\Component\Form\FormEvent $event + * @param FormEvent $event * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Symfony\Component\Form\Exception\AlreadySubmittedException - * @throws \Symfony\Component\Form\Exception\LogicException - * @throws \Symfony\Component\Form\Exception\UnexpectedTypeException + * @throws UnauthorizedException + * @throws NotFoundException + * @throws AlreadySubmittedException + * @throws LogicException + * @throws UnexpectedTypeException */ public function onPreSetData(FormEvent $event) { $contentLanguages = []; $form = $event->getForm(); - /** @var \Ibexa\AdminUi\Form\Data\ContentType\Translation\TranslationAddData $data */ + /** @var TranslationAddData $data */ $data = $event->getData(); $contentType = $data->getContentType(); @@ -118,13 +124,13 @@ public function onPreSetData(FormEvent $event) /** * Adds language fields and populates options list based on submitted form data. * - * @param \Symfony\Component\Form\FormEvent $event + * @param FormEvent $event * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Symfony\Component\Form\Exception\AlreadySubmittedException - * @throws \Symfony\Component\Form\Exception\LogicException - * @throws \Symfony\Component\Form\Exception\UnexpectedTypeException + * @throws UnauthorizedException + * @throws NotFoundException + * @throws AlreadySubmittedException + * @throws LogicException + * @throws UnexpectedTypeException */ public function onPreSubmit(FormEvent $event) { @@ -165,15 +171,17 @@ public function loadLanguages(callable $filter): array /** * Adds language fields to the $form. Language options are composed based on content language. * - * @param \Symfony\Component\Form\FormInterface $form + * @param FormInterface $form * @param string[] $contentLanguages * - * @throws \Symfony\Component\Form\Exception\AlreadySubmittedException - * @throws \Symfony\Component\Form\Exception\LogicException - * @throws \Symfony\Component\Form\Exception\UnexpectedTypeException + * @throws AlreadySubmittedException + * @throws LogicException + * @throws UnexpectedTypeException */ - public function addLanguageFields(FormInterface $form, array $contentLanguages): void - { + public function addLanguageFields( + FormInterface $form, + array $contentLanguages + ): void { $form ->add( 'language', diff --git a/src/lib/Form/Type/ContentType/Translation/TranslationRemoveType.php b/src/lib/Form/Type/ContentType/Translation/TranslationRemoveType.php index 26eabc49d7..ad7f387ce8 100644 --- a/src/lib/Form/Type/ContentType/Translation/TranslationRemoveType.php +++ b/src/lib/Form/Type/ContentType/Translation/TranslationRemoveType.php @@ -21,11 +21,13 @@ class TranslationRemoveType extends AbstractType { /** - * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param FormBuilderInterface $builder * @param array $options */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'content_type', @@ -63,7 +65,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) } /** - * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * @param OptionsResolver $resolver */ public function configureOptions(OptionsResolver $resolver) { diff --git a/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupCreateType.php b/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupCreateType.php index c732d24b11..0593afaa15 100644 --- a/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupCreateType.php +++ b/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupCreateType.php @@ -23,8 +23,10 @@ class ContentTypeGroupCreateType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('identifier', TextType::class, [ 'label' => /** @Desc("Name") */ 'content_type_group.create.name', diff --git a/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupDeleteType.php b/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupDeleteType.php index 46bbdd09c7..41e9bd15db 100644 --- a/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupDeleteType.php +++ b/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupDeleteType.php @@ -20,8 +20,10 @@ class ContentTypeGroupDeleteType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('content_type_group', ContentTypeGroupType::class) ->add('delete', SubmitType::class, [ diff --git a/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupType.php b/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupType.php index 708c5b89ff..ebc0d5eb5c 100644 --- a/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupType.php +++ b/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupType.php @@ -16,19 +16,21 @@ class ContentTypeGroupType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ protected $contentTypeService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService + * @param ContentTypeService $contentTypeService */ public function __construct(ContentTypeService $contentTypeService) { $this->contentTypeService = $contentTypeService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addModelTransformer(new ContentTypeGroupTransformer($this->contentTypeService)); } diff --git a/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupUpdateType.php b/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupUpdateType.php index 73856bf235..9964b6329f 100644 --- a/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupUpdateType.php +++ b/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupUpdateType.php @@ -23,8 +23,10 @@ class ContentTypeGroupUpdateType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('identifier', TextType::class, [ 'label' => /** @Desc("Name") */ 'content_type_group.update.name', diff --git a/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupsDeleteType.php b/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupsDeleteType.php index a3ea644b5e..d722409482 100644 --- a/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupsDeleteType.php +++ b/src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupsDeleteType.php @@ -18,8 +18,10 @@ class ContentTypeGroupsDeleteType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('content_type_groups', CollectionType::class, [ 'entry_type' => CheckboxType::class, diff --git a/src/lib/Form/Type/Date/DateIntervalType.php b/src/lib/Form/Type/Date/DateIntervalType.php index 2ab185260f..0130154082 100644 --- a/src/lib/Form/Type/Date/DateIntervalType.php +++ b/src/lib/Form/Type/Date/DateIntervalType.php @@ -15,8 +15,10 @@ class DateIntervalType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('date_interval', BaseDateIntervalType::class, [ 'attr' => ['hidden' => true], diff --git a/src/lib/Form/Type/DateRangeType.php b/src/lib/Form/Type/DateRangeType.php index d28fae2c65..447cff3a7a 100644 --- a/src/lib/Form/Type/DateRangeType.php +++ b/src/lib/Form/Type/DateRangeType.php @@ -15,8 +15,10 @@ final class DateRangeType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add('min', DateTimePickerType::class, [ 'required' => false, ]); diff --git a/src/lib/Form/Type/DateTimeIntervalType.php b/src/lib/Form/Type/DateTimeIntervalType.php index 102c6503ef..51f02eff84 100644 --- a/src/lib/Form/Type/DateTimeIntervalType.php +++ b/src/lib/Form/Type/DateTimeIntervalType.php @@ -36,8 +36,10 @@ public function getBlockPrefix() /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->addViewTransformer(new DateIntervalToArrayTransformer()) ->add('year', IntegerType::class) diff --git a/src/lib/Form/Type/DateTimePickerType.php b/src/lib/Form/Type/DateTimePickerType.php index 1dd538453c..9bfd5ca3c3 100644 --- a/src/lib/Form/Type/DateTimePickerType.php +++ b/src/lib/Form/Type/DateTimePickerType.php @@ -23,14 +23,19 @@ public function getParent() return IntegerType::class; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->addModelTransformer(new DateTimePickerTransformer()); } - public function buildView(FormView $view, FormInterface $form, array $options) - { + public function buildView( + FormView $view, + FormInterface $form, + array $options + ) { $view->vars['attr']['data-seconds'] = (int) $options['with_seconds']; } diff --git a/src/lib/Form/Type/Embedded/SectionType.php b/src/lib/Form/Type/Embedded/SectionType.php index ac51b7c17d..2146d5ceed 100644 --- a/src/lib/Form/Type/Embedded/SectionType.php +++ b/src/lib/Form/Type/Embedded/SectionType.php @@ -18,19 +18,21 @@ class SectionType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\SectionService */ + /** @var SectionService */ protected $sectionService; /** - * @param \Ibexa\Contracts\Core\Repository\SectionService $sectionService + * @param SectionService $sectionService */ public function __construct(SectionService $sectionService) { $this->sectionService = $sectionService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addViewTransformer( $options['multiple'] ? new SectionsTransformer($this->sectionService) diff --git a/src/lib/Form/Type/Event/ContentCreateContentTypeChoiceLoaderEvent.php b/src/lib/Form/Type/Event/ContentCreateContentTypeChoiceLoaderEvent.php index 2a81538719..5a8bdfaaa1 100644 --- a/src/lib/Form/Type/Event/ContentCreateContentTypeChoiceLoaderEvent.php +++ b/src/lib/Form/Type/Event/ContentCreateContentTypeChoiceLoaderEvent.php @@ -9,28 +9,31 @@ namespace Ibexa\AdminUi\Form\Type\Event; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Symfony\Contracts\EventDispatcher\Event; final class ContentCreateContentTypeChoiceLoaderEvent extends Event { public const RESOLVE_CONTENT_TYPES = 'admin_ui.content_create.content_type_resolve'; - /** @var array> */ + /** @var array> */ private array $contentTypeGroups; private ?Location $targetLocation; /** - * @param array> $contentTypeGroups + * @param array> $contentTypeGroups */ - public function __construct(array $contentTypeGroups, ?Location $targetLocation) - { + public function __construct( + array $contentTypeGroups, + ?Location $targetLocation + ) { $this->contentTypeGroups = $contentTypeGroups; $this->targetLocation = $targetLocation; } /** - * @return array> + * @return array> */ public function getContentTypeGroups(): array { @@ -38,7 +41,7 @@ public function getContentTypeGroups(): array } /** - * @param array> $contentTypeGroups + * @param array> $contentTypeGroups */ public function setContentTypeGroups(array $contentTypeGroups): void { @@ -46,10 +49,12 @@ public function setContentTypeGroups(array $contentTypeGroups): void } /** - * @param array<\Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType> $contentTypes + * @param array $contentTypes */ - public function addContentTypeGroup(string $name, array $contentTypes): void - { + public function addContentTypeGroup( + string $name, + array $contentTypes + ): void { $this->contentTypeGroups[$name] = $contentTypes; } diff --git a/src/lib/Form/Type/Extension/Content/ContentEditTypeExtension.php b/src/lib/Form/Type/Extension/Content/ContentEditTypeExtension.php index d41c91fca7..fe27be5456 100644 --- a/src/lib/Form/Type/Extension/Content/ContentEditTypeExtension.php +++ b/src/lib/Form/Type/Extension/Content/ContentEditTypeExtension.php @@ -22,11 +22,13 @@ class ContentEditTypeExtension extends AbstractTypeExtension { /** - * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param FormBuilderInterface $builder * @param array $options */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->add('preview', SubmitType::class, [ 'label' => /** @Desc("Preview") */ 'preview', 'attr' => [ diff --git a/src/lib/Form/Type/Extension/EventSubscriber/ModifyFieldDefinitionFieldsSubscriber.php b/src/lib/Form/Type/Extension/EventSubscriber/ModifyFieldDefinitionFieldsSubscriber.php index c79869edbe..68b370998a 100644 --- a/src/lib/Form/Type/Extension/EventSubscriber/ModifyFieldDefinitionFieldsSubscriber.php +++ b/src/lib/Form/Type/Extension/EventSubscriber/ModifyFieldDefinitionFieldsSubscriber.php @@ -57,7 +57,7 @@ public static function getSubscribedEvents(): array public function onPreSetData(FormEvent $event): void { - /** @var array|null $data */ + /** @var array|null $data */ $data = $event->getData(); $form = $event->getForm(); @@ -96,7 +96,7 @@ private function isApplicableToContentTypeDraft(?ContentTypeDraft $contentTypeDr } /** - * @param array $data + * @param array $data */ private function getContentTypeDraft(array $data): ?ContentTypeDraft { @@ -108,8 +108,10 @@ private function getContentTypeDraft(array $data): ?ContentTypeDraft return $firstField->contentTypeData->contentTypeDraft; } - private function acceptsFieldDefinition(FieldDefinitionData $field, string $identifier): bool - { + private function acceptsFieldDefinition( + FieldDefinitionData $field, + string $identifier + ): bool { $matchesType = $this->fieldTypeIdentifier === $field->getFieldTypeIdentifier(); $matchesIdentifier = in_array($identifier, $this->fieldIdentifiers, true); @@ -117,10 +119,12 @@ private function acceptsFieldDefinition(FieldDefinitionData $field, string $iden } /** - * @param \Symfony\Component\Form\FormInterface<\Ibexa\AdminUi\Form\Data\FieldDefinitionData[]> $form + * @param FormInterface $form */ - private function rebuildFieldForm(FormInterface $form, string $name): void - { + private function rebuildFieldForm( + FormInterface $form, + string $name + ): void { $baseFieldForm = $form->get($name); $baseFieldFormName = $baseFieldForm->getName(); diff --git a/src/lib/Form/Type/Extension/ModifyFieldDefinitionsCollectionTypeExtension.php b/src/lib/Form/Type/Extension/ModifyFieldDefinitionsCollectionTypeExtension.php index 524ac14709..12144fd787 100644 --- a/src/lib/Form/Type/Extension/ModifyFieldDefinitionsCollectionTypeExtension.php +++ b/src/lib/Form/Type/Extension/ModifyFieldDefinitionsCollectionTypeExtension.php @@ -47,8 +47,10 @@ public function __construct( $this->contentTypeSpecification = $contentTypeSpecification; } - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $subscriber = new ModifyFieldDefinitionFieldsSubscriber( $this->fieldTypeIdentifier, $this->modifiedOptions, diff --git a/src/lib/Form/Type/FieldDefinition/FieldDefinitionType.php b/src/lib/Form/Type/FieldDefinition/FieldDefinitionType.php index 0d80ffc246..1bffcca441 100644 --- a/src/lib/Form/Type/FieldDefinition/FieldDefinitionType.php +++ b/src/lib/Form/Type/FieldDefinition/FieldDefinitionType.php @@ -34,16 +34,16 @@ class FieldDefinitionType extends AbstractType { private ContentTypeFieldTypesResolverInterface $contentTypeFieldTypesResolver; - /** @var \Ibexa\AdminUi\FieldType\FieldTypeDefinitionFormMapperDispatcherInterface */ + /** @var FieldTypeDefinitionFormMapperDispatcherInterface */ private $fieldTypeMapperDispatcher; - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ + /** @var FieldTypeService */ private $fieldTypeService; - /** @var \Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList */ + /** @var FieldsGroupsList */ private $groupsList; - /** @var \Ibexa\Contracts\Core\Repository\Strategy\ContentThumbnail\Field\ThumbnailStrategy */ + /** @var ThumbnailStrategy */ private $thumbnailStrategy; public function __construct( @@ -80,8 +80,10 @@ public function configureOptions(OptionsResolver $resolver) ->setRequired(['languageCode']); } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $translatablePropertyTransformer = new TranslatablePropertyTransformer($options['languageCode']); $isTranslation = $options['languageCode'] !== $options['mainLanguageCode']; @@ -134,7 +136,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) // Hook on form generation for specific FieldType needs $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { - /** @var \Ibexa\AdminUi\Form\Data\FieldDefinitionData $data */ + /** @var FieldDefinitionData $data */ $data = $event->getData(); $form = $event->getForm(); $fieldTypeIdentifier = $data->getFieldTypeIdentifier(); @@ -176,8 +178,11 @@ public function buildForm(FormBuilderInterface $builder, array $options) }); } - public function buildView(FormView $view, FormInterface $form, array $options) - { + public function buildView( + FormView $view, + FormInterface $form, + array $options + ) { $view->vars['disable_remove'] = $options['disable_remove']; } diff --git a/src/lib/Form/Type/FieldDefinition/User/PasswordConstraintCheckboxType.php b/src/lib/Form/Type/FieldDefinition/User/PasswordConstraintCheckboxType.php index e4f09d83ee..eb9c5d5ebc 100644 --- a/src/lib/Form/Type/FieldDefinition/User/PasswordConstraintCheckboxType.php +++ b/src/lib/Form/Type/FieldDefinition/User/PasswordConstraintCheckboxType.php @@ -21,16 +21,21 @@ class PasswordConstraintCheckboxType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->addModelTransformer(new CallbackTransformer('boolval', 'boolval')); } /** * {@inheritdoc} */ - public function buildView(FormView $view, FormInterface $form, array $options): void - { + public function buildView( + FormView $view, + FormInterface $form, + array $options + ): void { $view->vars['label'] = 'field_definition.ezuser.' . $this->toSnakeCase($view->vars['name']); } diff --git a/src/lib/Form/Type/Language/AbstractLanguageChoiceType.php b/src/lib/Form/Type/Language/AbstractLanguageChoiceType.php index e4abc8eed7..dc0dc32795 100644 --- a/src/lib/Form/Type/Language/AbstractLanguageChoiceType.php +++ b/src/lib/Form/Type/Language/AbstractLanguageChoiceType.php @@ -15,11 +15,11 @@ abstract class AbstractLanguageChoiceType extends AbstractType { - /** @var \Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface */ + /** @var ChoiceLoaderInterface */ private $languageChoiceLoader; /** - * @param \Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface $languageChoiceLoader + * @param ChoiceLoaderInterface $languageChoiceLoader */ public function __construct(ChoiceLoaderInterface $languageChoiceLoader) { diff --git a/src/lib/Form/Type/Language/ConfiguredLanguagesChoiceType.php b/src/lib/Form/Type/Language/ConfiguredLanguagesChoiceType.php index ed62384c7b..3d82139855 100644 --- a/src/lib/Form/Type/Language/ConfiguredLanguagesChoiceType.php +++ b/src/lib/Form/Type/Language/ConfiguredLanguagesChoiceType.php @@ -16,7 +16,7 @@ class ConfiguredLanguagesChoiceType extends AbstractLanguageChoiceType { /** - * @param \Ibexa\AdminUi\Form\Type\ChoiceList\Loader\ConfiguredLanguagesChoiceLoader $languageChoiceLoader + * @param ConfiguredLanguagesChoiceLoader $languageChoiceLoader */ public function __construct(ConfiguredLanguagesChoiceLoader $languageChoiceLoader) { diff --git a/src/lib/Form/Type/Language/LanguageChoiceType.php b/src/lib/Form/Type/Language/LanguageChoiceType.php index 9667b4812f..162c959ddd 100644 --- a/src/lib/Form/Type/Language/LanguageChoiceType.php +++ b/src/lib/Form/Type/Language/LanguageChoiceType.php @@ -18,7 +18,7 @@ class LanguageChoiceType extends AbstractLanguageChoiceType { /** - * @param \Ibexa\AdminUi\Form\Type\ChoiceList\Loader\LanguageChoiceLoader $languageChoiceLoader + * @param LanguageChoiceLoader $languageChoiceLoader */ public function __construct(LanguageChoiceLoader $languageChoiceLoader) { diff --git a/src/lib/Form/Type/Language/LanguageCreateType.php b/src/lib/Form/Type/Language/LanguageCreateType.php index 5c84f8b8d7..aa6c46273b 100644 --- a/src/lib/Form/Type/Language/LanguageCreateType.php +++ b/src/lib/Form/Type/Language/LanguageCreateType.php @@ -19,8 +19,10 @@ class LanguageCreateType extends AbstractType { public const BTN_SAVE = 'save'; - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'name', diff --git a/src/lib/Form/Type/Language/LanguageDeleteType.php b/src/lib/Form/Type/Language/LanguageDeleteType.php index a82feaf4b5..d1dd6534f8 100644 --- a/src/lib/Form/Type/Language/LanguageDeleteType.php +++ b/src/lib/Form/Type/Language/LanguageDeleteType.php @@ -15,8 +15,10 @@ class LanguageDeleteType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'language', diff --git a/src/lib/Form/Type/Language/LanguageType.php b/src/lib/Form/Type/Language/LanguageType.php index 84492aa9da..e712a25521 100644 --- a/src/lib/Form/Type/Language/LanguageType.php +++ b/src/lib/Form/Type/Language/LanguageType.php @@ -16,19 +16,21 @@ class LanguageType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ protected $languageService; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService + * @param LanguageService $languageService */ public function __construct(LanguageService $languageService) { $this->languageService = $languageService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addModelTransformer(new LanguageTransformer($this->languageService)); } diff --git a/src/lib/Form/Type/Language/LanguageUpdateType.php b/src/lib/Form/Type/Language/LanguageUpdateType.php index a43a5167d2..c2e5d523f2 100644 --- a/src/lib/Form/Type/Language/LanguageUpdateType.php +++ b/src/lib/Form/Type/Language/LanguageUpdateType.php @@ -19,8 +19,10 @@ class LanguageUpdateType extends AbstractType { public const BTN_SAVE = 'save'; - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'language', diff --git a/src/lib/Form/Type/Language/LanguagesDeleteType.php b/src/lib/Form/Type/Language/LanguagesDeleteType.php index 18454ba84d..6a28dc7103 100644 --- a/src/lib/Form/Type/Language/LanguagesDeleteType.php +++ b/src/lib/Form/Type/Language/LanguagesDeleteType.php @@ -18,8 +18,10 @@ class LanguagesDeleteType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('languages', CollectionType::class, [ 'entry_type' => CheckboxType::class, diff --git a/src/lib/Form/Type/LanguageSwitchType.php b/src/lib/Form/Type/LanguageSwitchType.php index f59b669956..9eb5612314 100644 --- a/src/lib/Form/Type/LanguageSwitchType.php +++ b/src/lib/Form/Type/LanguageSwitchType.php @@ -26,8 +26,10 @@ public function __construct(LanguageService $languageService) $this->languageService = $languageService; } - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $languages = $options['languages']; $builder->add( diff --git a/src/lib/Form/Type/Location/AbstractLocationCopyType.php b/src/lib/Form/Type/Location/AbstractLocationCopyType.php index 0785276f3a..f1f34e206f 100644 --- a/src/lib/Form/Type/Location/AbstractLocationCopyType.php +++ b/src/lib/Form/Type/Location/AbstractLocationCopyType.php @@ -15,8 +15,10 @@ abstract class AbstractLocationCopyType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'location', diff --git a/src/lib/Form/Type/Location/LocationAssignSectionType.php b/src/lib/Form/Type/Location/LocationAssignSectionType.php index c562846ab1..f8dae411aa 100644 --- a/src/lib/Form/Type/Location/LocationAssignSectionType.php +++ b/src/lib/Form/Type/Location/LocationAssignSectionType.php @@ -21,8 +21,10 @@ class LocationAssignSectionType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder ->add('section', SectionChoiceType::class, [ 'label' => false, diff --git a/src/lib/Form/Type/Location/LocationMoveType.php b/src/lib/Form/Type/Location/LocationMoveType.php index fd38d396fe..f33b6cfa66 100644 --- a/src/lib/Form/Type/Location/LocationMoveType.php +++ b/src/lib/Form/Type/Location/LocationMoveType.php @@ -16,8 +16,10 @@ class LocationMoveType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'location', diff --git a/src/lib/Form/Type/Location/LocationSwapType.php b/src/lib/Form/Type/Location/LocationSwapType.php index f77904fb93..2099ed6d4b 100644 --- a/src/lib/Form/Type/Location/LocationSwapType.php +++ b/src/lib/Form/Type/Location/LocationSwapType.php @@ -17,8 +17,10 @@ class LocationSwapType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'current_location', diff --git a/src/lib/Form/Type/Location/LocationTrashType.php b/src/lib/Form/Type/Location/LocationTrashType.php index b20c2374fb..89472d3f54 100644 --- a/src/lib/Form/Type/Location/LocationTrashType.php +++ b/src/lib/Form/Type/Location/LocationTrashType.php @@ -26,10 +26,10 @@ class LocationTrashType extends AbstractType { public const CONFIRM_SEND_TO_TRASH = 'confirm_send_to_trash'; - /** @var \Ibexa\AdminUi\Form\TrashLocationOptionProvider\OptionsFactory */ + /** @var OptionsFactory */ private $trashTypeStrategy; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -40,8 +40,10 @@ public function __construct( $this->translator = $translator; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'location', diff --git a/src/lib/Form/Type/Location/LocationUpdateType.php b/src/lib/Form/Type/Location/LocationUpdateType.php index c5c1ef53c4..930625356e 100644 --- a/src/lib/Form/Type/Location/LocationUpdateType.php +++ b/src/lib/Form/Type/Location/LocationUpdateType.php @@ -20,8 +20,10 @@ class LocationUpdateType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'location', diff --git a/src/lib/Form/Type/Location/LocationUpdateVisibilityType.php b/src/lib/Form/Type/Location/LocationUpdateVisibilityType.php index 743b87f733..b0fd007275 100644 --- a/src/lib/Form/Type/Location/LocationUpdateVisibilityType.php +++ b/src/lib/Form/Type/Location/LocationUpdateVisibilityType.php @@ -18,8 +18,10 @@ class LocationUpdateVisibilityType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'location', diff --git a/src/lib/Form/Type/Notification/NotificationSelectionType.php b/src/lib/Form/Type/Notification/NotificationSelectionType.php index b0e2e8b33e..60b231b394 100644 --- a/src/lib/Form/Type/Notification/NotificationSelectionType.php +++ b/src/lib/Form/Type/Notification/NotificationSelectionType.php @@ -20,8 +20,10 @@ */ final class NotificationSelectionType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add( 'notifications', CollectionType::class, diff --git a/src/lib/Form/Type/Notification/SearchType.php b/src/lib/Form/Type/Notification/SearchType.php index f3843a69f4..1608b769e4 100644 --- a/src/lib/Form/Type/Notification/SearchType.php +++ b/src/lib/Form/Type/Notification/SearchType.php @@ -20,9 +20,12 @@ */ final class SearchType extends AbstractType { - public function buildView(FormView $view, FormInterface $form, array $options): void - { - /** @var \Ibexa\Bundle\AdminUi\Form\Data\SearchQueryData|null $data */ + public function buildView( + FormView $view, + FormInterface $form, + array $options + ): void { + /** @var SearchQueryData|null $data */ $data = $form->getData(); $view->vars['is_any_filter_set'] = false; @@ -38,8 +41,10 @@ public function buildView(FormView $view, FormInterface $form, array $options): } } - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder ->add('type', NotificationTypeChoiceType::class, [ 'required' => false, diff --git a/src/lib/Form/Type/ObjectState/ContentObjectStateUpdateType.php b/src/lib/Form/Type/ObjectState/ContentObjectStateUpdateType.php index c34ca626db..5e22575ed1 100644 --- a/src/lib/Form/Type/ObjectState/ContentObjectStateUpdateType.php +++ b/src/lib/Form/Type/ObjectState/ContentObjectStateUpdateType.php @@ -24,18 +24,20 @@ class ContentObjectStateUpdateType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ + /** @var ObjectStateService */ protected $objectStateService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; /** - * @param \Ibexa\Contracts\Core\Repository\ObjectStateService $objectStateService - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver + * @param ObjectStateService $objectStateService + * @param PermissionResolver $permissionResolver */ - public function __construct(ObjectStateService $objectStateService, PermissionResolver $permissionResolver) - { + public function __construct( + ObjectStateService $objectStateService, + PermissionResolver $permissionResolver + ) { $this->objectStateService = $objectStateService; $this->permissionResolver = $permissionResolver; } @@ -43,8 +45,10 @@ public function __construct(ObjectStateService $objectStateService, PermissionRe /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('contentInfo', ContentInfoType::class, [ 'label' => false, @@ -57,7 +61,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ]); $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { - /** @var \Ibexa\AdminUi\Form\Data\ObjectState\ContentObjectStateUpdateData $contentObjectStateUpdateData */ + /** @var ContentObjectStateUpdateData $contentObjectStateUpdateData */ $contentObjectStateUpdateData = $event->getData(); $objectStateGroup = $contentObjectStateUpdateData->getObjectStateGroup(); $contentInfo = $contentObjectStateUpdateData->getContentInfo(); diff --git a/src/lib/Form/Type/ObjectState/ObjectStateChoiceType.php b/src/lib/Form/Type/ObjectState/ObjectStateChoiceType.php index 96f9967ac5..3a2ea7a9ba 100644 --- a/src/lib/Form/Type/ObjectState/ObjectStateChoiceType.php +++ b/src/lib/Form/Type/ObjectState/ObjectStateChoiceType.php @@ -16,11 +16,11 @@ class ObjectStateChoiceType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ + /** @var ObjectStateService */ protected $objectStateService; /** - * @param \Ibexa\Contracts\Core\Repository\ObjectStateService $objectStateService + * @param ObjectStateService $objectStateService */ public function __construct(ObjectStateService $objectStateService) { diff --git a/src/lib/Form/Type/ObjectState/ObjectStateCreateType.php b/src/lib/Form/Type/ObjectState/ObjectStateCreateType.php index c5db06c784..4c928a6e05 100644 --- a/src/lib/Form/Type/ObjectState/ObjectStateCreateType.php +++ b/src/lib/Form/Type/ObjectState/ObjectStateCreateType.php @@ -23,8 +23,10 @@ class ObjectStateCreateType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('identifier', TextType::class, [ 'label' => /** @Desc("Identifier") */ 'object_state.create.identifier', diff --git a/src/lib/Form/Type/ObjectState/ObjectStateDeleteType.php b/src/lib/Form/Type/ObjectState/ObjectStateDeleteType.php index 2b5da88aa8..7ac0ab2281 100644 --- a/src/lib/Form/Type/ObjectState/ObjectStateDeleteType.php +++ b/src/lib/Form/Type/ObjectState/ObjectStateDeleteType.php @@ -20,8 +20,10 @@ class ObjectStateDeleteType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('object_state_', ObjectStateType::class) ->add('delete', SubmitType::class, [ diff --git a/src/lib/Form/Type/ObjectState/ObjectStateGroupCreateType.php b/src/lib/Form/Type/ObjectState/ObjectStateGroupCreateType.php index bc9d81baab..2dd5c12884 100644 --- a/src/lib/Form/Type/ObjectState/ObjectStateGroupCreateType.php +++ b/src/lib/Form/Type/ObjectState/ObjectStateGroupCreateType.php @@ -23,8 +23,10 @@ class ObjectStateGroupCreateType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('identifier', TextType::class, [ 'label' => /** @Desc("Identifier") */ 'object_state_group.create.identifier', diff --git a/src/lib/Form/Type/ObjectState/ObjectStateGroupDeleteType.php b/src/lib/Form/Type/ObjectState/ObjectStateGroupDeleteType.php index 8249d4a8df..2e21343b24 100644 --- a/src/lib/Form/Type/ObjectState/ObjectStateGroupDeleteType.php +++ b/src/lib/Form/Type/ObjectState/ObjectStateGroupDeleteType.php @@ -20,8 +20,10 @@ class ObjectStateGroupDeleteType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('object_state_group', ObjectStateGroupType::class) ->add('delete', SubmitType::class, [ diff --git a/src/lib/Form/Type/ObjectState/ObjectStateGroupType.php b/src/lib/Form/Type/ObjectState/ObjectStateGroupType.php index 9273c4da26..506e473f22 100644 --- a/src/lib/Form/Type/ObjectState/ObjectStateGroupType.php +++ b/src/lib/Form/Type/ObjectState/ObjectStateGroupType.php @@ -16,19 +16,21 @@ class ObjectStateGroupType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ + /** @var ObjectStateService */ protected $objectStateService; /** - * @param \Ibexa\Contracts\Core\Repository\ObjectStateService $objectStateService + * @param ObjectStateService $objectStateService */ public function __construct(ObjectStateService $objectStateService) { $this->objectStateService = $objectStateService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addModelTransformer(new ObjectStateGroupTransformer($this->objectStateService)); } diff --git a/src/lib/Form/Type/ObjectState/ObjectStateGroupUpdateType.php b/src/lib/Form/Type/ObjectState/ObjectStateGroupUpdateType.php index 2f6f59a597..cafff4f798 100644 --- a/src/lib/Form/Type/ObjectState/ObjectStateGroupUpdateType.php +++ b/src/lib/Form/Type/ObjectState/ObjectStateGroupUpdateType.php @@ -23,8 +23,10 @@ class ObjectStateGroupUpdateType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('identifier', TextType::class, [ 'label' => /** @Desc("Identifier") */ 'object_state_group.update.identifier', diff --git a/src/lib/Form/Type/ObjectState/ObjectStateGroupsDeleteType.php b/src/lib/Form/Type/ObjectState/ObjectStateGroupsDeleteType.php index 0347110320..b0506e53fd 100644 --- a/src/lib/Form/Type/ObjectState/ObjectStateGroupsDeleteType.php +++ b/src/lib/Form/Type/ObjectState/ObjectStateGroupsDeleteType.php @@ -19,8 +19,10 @@ class ObjectStateGroupsDeleteType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('objectStateGroups', CollectionType::class, [ 'entry_type' => CheckboxType::class, diff --git a/src/lib/Form/Type/ObjectState/ObjectStateType.php b/src/lib/Form/Type/ObjectState/ObjectStateType.php index 711fe13a2a..5257ce5d41 100644 --- a/src/lib/Form/Type/ObjectState/ObjectStateType.php +++ b/src/lib/Form/Type/ObjectState/ObjectStateType.php @@ -16,19 +16,21 @@ class ObjectStateType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ + /** @var ObjectStateService */ protected $objectStateService; /** - * @param \Ibexa\Contracts\Core\Repository\ObjectStateService $objectStateService + * @param ObjectStateService $objectStateService */ public function __construct(ObjectStateService $objectStateService) { $this->objectStateService = $objectStateService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addModelTransformer(new ObjectStateTransformer($this->objectStateService)); } diff --git a/src/lib/Form/Type/ObjectState/ObjectStateUpdateType.php b/src/lib/Form/Type/ObjectState/ObjectStateUpdateType.php index 5055b080de..899fa0e743 100644 --- a/src/lib/Form/Type/ObjectState/ObjectStateUpdateType.php +++ b/src/lib/Form/Type/ObjectState/ObjectStateUpdateType.php @@ -23,8 +23,10 @@ class ObjectStateUpdateType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('identifier', TextType::class, [ 'label' => /** @Desc("Identifier") */ 'object_state.update.identifier', diff --git a/src/lib/Form/Type/ObjectState/ObjectStatesDeleteType.php b/src/lib/Form/Type/ObjectState/ObjectStatesDeleteType.php index 8817868cf9..2a6ea26b78 100644 --- a/src/lib/Form/Type/ObjectState/ObjectStatesDeleteType.php +++ b/src/lib/Form/Type/ObjectState/ObjectStatesDeleteType.php @@ -19,8 +19,10 @@ class ObjectStatesDeleteType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('objectStates', CollectionType::class, [ 'entry_type' => CheckboxType::class, diff --git a/src/lib/Form/Type/Policy/PoliciesDeleteType.php b/src/lib/Form/Type/Policy/PoliciesDeleteType.php index 983b6cda0c..e59448c026 100644 --- a/src/lib/Form/Type/Policy/PoliciesDeleteType.php +++ b/src/lib/Form/Type/Policy/PoliciesDeleteType.php @@ -19,8 +19,10 @@ class PoliciesDeleteType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('role', RoleType::class) ->add('policies', CollectionType::class, [ diff --git a/src/lib/Form/Type/Policy/PolicyChoiceType.php b/src/lib/Form/Type/Policy/PolicyChoiceType.php index ed7cebee64..c6452da397 100644 --- a/src/lib/Form/Type/Policy/PolicyChoiceType.php +++ b/src/lib/Form/Type/Policy/PolicyChoiceType.php @@ -30,18 +30,22 @@ class PolicyChoiceType extends AbstractType * PolicyChoiceType constructor. * * @param array $policyMap - * @param \Symfony\Contracts\Translation\TranslatorInterface $translator + * @param TranslatorInterface $translator */ - public function __construct(TranslatorInterface $translator, array $policyMap) - { + public function __construct( + TranslatorInterface $translator, + array $policyMap + ) { $this->policyChoices = $this->buildPolicyChoicesFromMap($policyMap); } /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addModelTransformer(new class() implements DataTransformerInterface { public function transform($value) { @@ -102,7 +106,7 @@ private function buildPolicyChoicesFromMap(array $policyMap): array $policyChoices = [ self::MESSAGE_ID_PREFIX . self::ALL_MODULES => [ self::MESSAGE_ID_PREFIX . self::ALL_MODULES_ALL_FUNCTIONS => '*|*', - ], + ], ]; foreach ($policyMap as $module => $functionList) { diff --git a/src/lib/Form/Type/Policy/PolicyCreateType.php b/src/lib/Form/Type/Policy/PolicyCreateType.php index 394bb4ea6d..b6d5a8f1b8 100644 --- a/src/lib/Form/Type/Policy/PolicyCreateType.php +++ b/src/lib/Form/Type/Policy/PolicyCreateType.php @@ -16,8 +16,10 @@ class PolicyCreateType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'policy', diff --git a/src/lib/Form/Type/Policy/PolicyCreateWithLimitationType.php b/src/lib/Form/Type/Policy/PolicyCreateWithLimitationType.php index f7bb417b8d..a29881094b 100644 --- a/src/lib/Form/Type/Policy/PolicyCreateWithLimitationType.php +++ b/src/lib/Form/Type/Policy/PolicyCreateWithLimitationType.php @@ -10,7 +10,9 @@ use Ibexa\AdminUi\Form\Data\Policy\PolicyCreateData; use Ibexa\AdminUi\Form\Type\Role\LimitationType; +use Ibexa\Contracts\Core\Limitation\Type; use Ibexa\Contracts\Core\Repository\RoleService; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation; use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CollectionType; @@ -22,11 +24,11 @@ class PolicyCreateWithLimitationType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ private $roleService; /** - * @param \Ibexa\Contracts\Core\Repository\RoleService $roleService + * @param RoleService $roleService */ public function __construct(RoleService $roleService) { @@ -36,8 +38,10 @@ public function __construct(RoleService $roleService) /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'policy', @@ -92,13 +96,15 @@ public function configureOptions(OptionsResolver $resolver) * Generates the limitation list from existing limitations (already configured for current policy) and * available limitation types available for current policy (i.e. current module/function combination). * - * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation[] $existingLimitations - * @param \Ibexa\Contracts\Core\Limitation\Type[] $availableLimitationTypes + * @param Limitation[] $existingLimitations + * @param Type[] $availableLimitationTypes * - * @return array|\Ibexa\Contracts\Core\Repository\Values\User\Limitation[] + * @return array|Limitation[] */ - private function generateLimitationList(array $existingLimitations, array $availableLimitationTypes): array - { + private function generateLimitationList( + array $existingLimitations, + array $availableLimitationTypes + ): array { $limitations = []; foreach ($existingLimitations as $limitation) { $limitations[$limitation->getIdentifier()] = $limitation; diff --git a/src/lib/Form/Type/Policy/PolicyDeleteType.php b/src/lib/Form/Type/Policy/PolicyDeleteType.php index 532b95d02a..93656289ed 100644 --- a/src/lib/Form/Type/Policy/PolicyDeleteType.php +++ b/src/lib/Form/Type/Policy/PolicyDeleteType.php @@ -20,8 +20,10 @@ class PolicyDeleteType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'policy', diff --git a/src/lib/Form/Type/Policy/PolicyType.php b/src/lib/Form/Type/Policy/PolicyType.php index 09bc4040c0..a2c00174e0 100644 --- a/src/lib/Form/Type/Policy/PolicyType.php +++ b/src/lib/Form/Type/Policy/PolicyType.php @@ -15,8 +15,10 @@ class PolicyType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addViewTransformer(new PolicyTransformer()); } diff --git a/src/lib/Form/Type/Policy/PolicyUpdateType.php b/src/lib/Form/Type/Policy/PolicyUpdateType.php index 174fe25323..38959db2bc 100644 --- a/src/lib/Form/Type/Policy/PolicyUpdateType.php +++ b/src/lib/Form/Type/Policy/PolicyUpdateType.php @@ -10,7 +10,9 @@ use Ibexa\AdminUi\Form\Data\Policy\PolicyUpdateData; use Ibexa\AdminUi\Form\Type\Role\LimitationType; +use Ibexa\Contracts\Core\Limitation\Type; use Ibexa\Contracts\Core\Repository\RoleService; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation; use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CollectionType; @@ -24,13 +26,13 @@ class PolicyUpdateType extends AbstractType { public const BTN_SAVE = 'save'; - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ private $roleService; /** * PolicyLimitationsType constructor. * - * @param \Ibexa\Contracts\Core\Repository\RoleService $roleService + * @param RoleService $roleService */ public function __construct(RoleService $roleService) { @@ -40,8 +42,10 @@ public function __construct(RoleService $roleService) /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'policy', @@ -101,13 +105,15 @@ public function configureOptions(OptionsResolver $resolver) * Generates the limitation list from existing limitations (already configured for current policy) and * available limitation types available for current policy (i.e. current module/function combination). * - * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation[] $existingLimitations - * @param \Ibexa\Contracts\Core\Limitation\Type[] $availableLimitationTypes + * @param Limitation[] $existingLimitations + * @param Type[] $availableLimitationTypes * - * @return array|\Ibexa\Contracts\Core\Repository\Values\User\Limitation[] + * @return array|Limitation[] */ - private function generateLimitationList(array $existingLimitations, array $availableLimitationTypes): array - { + private function generateLimitationList( + array $existingLimitations, + array $availableLimitationTypes + ): array { $limitations = []; foreach ($existingLimitations as $limitation) { $limitations[$limitation->getIdentifier()] = $limitation; diff --git a/src/lib/Form/Type/Preview/VersionPreviewUrlChoiceType.php b/src/lib/Form/Type/Preview/VersionPreviewUrlChoiceType.php index e10ea87dbd..52035813f9 100644 --- a/src/lib/Form/Type/Preview/VersionPreviewUrlChoiceType.php +++ b/src/lib/Form/Type/Preview/VersionPreviewUrlChoiceType.php @@ -59,11 +59,11 @@ public function configureOptions(OptionsResolver $resolver): void $resolver->setDefaults([ 'choice_loader' => function (Options $options): ChoiceLoaderInterface { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo */ + /** @var VersionInfo $versionInfo */ $versionInfo = $options['version_info']; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $options['location']; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language $language */ + /** @var Language $language */ $language = $options['language']; return ChoiceList::loader( diff --git a/src/lib/Form/Type/Role/LimitationType.php b/src/lib/Form/Type/Role/LimitationType.php index 13ed7cb06b..b035e442f7 100644 --- a/src/lib/Form/Type/Role/LimitationType.php +++ b/src/lib/Form/Type/Role/LimitationType.php @@ -21,25 +21,29 @@ class LimitationType extends AbstractType { /** - * @var \Ibexa\AdminUi\Limitation\LimitationFormMapperRegistryInterface + * @var LimitationFormMapperRegistryInterface */ private $limitationFormMapperRegistry; /** - * @var \Ibexa\AdminUi\Limitation\LimitationFormMapperInterface + * @var LimitationFormMapperInterface */ private $nullMapper; - public function __construct(LimitationFormMapperRegistryInterface $limitationFormMapperRegistry, LimitationFormMapperInterface $nullMapper) - { + public function __construct( + LimitationFormMapperRegistryInterface $limitationFormMapperRegistry, + LimitationFormMapperInterface $nullMapper + ) { $this->limitationFormMapperRegistry = $limitationFormMapperRegistry; $this->nullMapper = $nullMapper; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Limitation $data */ + /** @var Limitation $data */ $data = $event->getData(); $form = $event->getForm(); @@ -49,7 +53,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) }); $builder->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Limitation $data */ + /** @var Limitation $data */ $data = $event->getData(); if ($this->limitationFormMapperRegistry->hasMapper($data->getIdentifier())) { $this->limitationFormMapperRegistry->getMapper($data->getIdentifier())->filterLimitationValues($data); @@ -57,8 +61,11 @@ public function buildForm(FormBuilderInterface $builder, array $options) }); } - public function buildView(FormView $view, FormInterface $form, array $options) - { + public function buildView( + FormView $view, + FormInterface $form, + array $options + ) { $data = $view->vars['value']; if (!$data instanceof Limitation) { return; diff --git a/src/lib/Form/Type/Role/RoleAssignmentCreateType.php b/src/lib/Form/Type/Role/RoleAssignmentCreateType.php index 5a5929f13e..301876eb23 100644 --- a/src/lib/Form/Type/Role/RoleAssignmentCreateType.php +++ b/src/lib/Form/Type/Role/RoleAssignmentCreateType.php @@ -21,8 +21,10 @@ class RoleAssignmentCreateType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'groups', diff --git a/src/lib/Form/Type/Role/RoleAssignmentDeleteType.php b/src/lib/Form/Type/Role/RoleAssignmentDeleteType.php index 3a734d87b6..7d0070abc8 100644 --- a/src/lib/Form/Type/Role/RoleAssignmentDeleteType.php +++ b/src/lib/Form/Type/Role/RoleAssignmentDeleteType.php @@ -16,8 +16,10 @@ class RoleAssignmentDeleteType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'role_assignment', diff --git a/src/lib/Form/Type/Role/RoleAssignmentType.php b/src/lib/Form/Type/Role/RoleAssignmentType.php index dff27a1277..17254a7e01 100644 --- a/src/lib/Form/Type/Role/RoleAssignmentType.php +++ b/src/lib/Form/Type/Role/RoleAssignmentType.php @@ -16,19 +16,21 @@ class RoleAssignmentType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ protected $roleService; /** - * @param \Ibexa\Contracts\Core\Repository\RoleService $roleService + * @param RoleService $roleService */ public function __construct(RoleService $roleService) { $this->roleService = $roleService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addViewTransformer(new RoleAssignmentTransformer($this->roleService)); } diff --git a/src/lib/Form/Type/Role/RoleAssignmentsDeleteType.php b/src/lib/Form/Type/Role/RoleAssignmentsDeleteType.php index 90af711d88..9701d75f1e 100644 --- a/src/lib/Form/Type/Role/RoleAssignmentsDeleteType.php +++ b/src/lib/Form/Type/Role/RoleAssignmentsDeleteType.php @@ -18,8 +18,10 @@ class RoleAssignmentsDeleteType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('role', RoleType::class) ->add('role_assignments', CollectionType::class, [ diff --git a/src/lib/Form/Type/Role/RoleCopyType.php b/src/lib/Form/Type/Role/RoleCopyType.php index e6b2dd3b2c..5f4f76499f 100644 --- a/src/lib/Form/Type/Role/RoleCopyType.php +++ b/src/lib/Form/Type/Role/RoleCopyType.php @@ -17,8 +17,10 @@ class RoleCopyType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'new_identifier', diff --git a/src/lib/Form/Type/Role/RoleCreateType.php b/src/lib/Form/Type/Role/RoleCreateType.php index f99f776da0..ea58659c0c 100644 --- a/src/lib/Form/Type/Role/RoleCreateType.php +++ b/src/lib/Form/Type/Role/RoleCreateType.php @@ -19,8 +19,10 @@ class RoleCreateType extends AbstractType { public const BTN_SAVE = 'save'; - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'identifier', diff --git a/src/lib/Form/Type/Role/RoleDeleteType.php b/src/lib/Form/Type/Role/RoleDeleteType.php index 0e95181b7d..38d0eb0b0b 100644 --- a/src/lib/Form/Type/Role/RoleDeleteType.php +++ b/src/lib/Form/Type/Role/RoleDeleteType.php @@ -16,8 +16,10 @@ class RoleDeleteType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'role', diff --git a/src/lib/Form/Type/Role/RoleType.php b/src/lib/Form/Type/Role/RoleType.php index 3e9a45a704..b165a15c3b 100644 --- a/src/lib/Form/Type/Role/RoleType.php +++ b/src/lib/Form/Type/Role/RoleType.php @@ -16,19 +16,21 @@ class RoleType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ protected $roleService; /** - * @param \Ibexa\Contracts\Core\Repository\RoleService $roleService + * @param RoleService $roleService */ public function __construct(RoleService $roleService) { $this->roleService = $roleService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addViewTransformer(new RoleTransformer($this->roleService)); } diff --git a/src/lib/Form/Type/Role/RoleUpdateType.php b/src/lib/Form/Type/Role/RoleUpdateType.php index f2d5045eda..bbfd3284e1 100644 --- a/src/lib/Form/Type/Role/RoleUpdateType.php +++ b/src/lib/Form/Type/Role/RoleUpdateType.php @@ -19,8 +19,10 @@ class RoleUpdateType extends AbstractType { public const BTN_SAVE = 'save'; - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'identifier', diff --git a/src/lib/Form/Type/Role/RolesDeleteType.php b/src/lib/Form/Type/Role/RolesDeleteType.php index 765302dcde..cac1f049a7 100644 --- a/src/lib/Form/Type/Role/RolesDeleteType.php +++ b/src/lib/Form/Type/Role/RolesDeleteType.php @@ -18,8 +18,10 @@ class RolesDeleteType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'roles', diff --git a/src/lib/Form/Type/RoleAssignment/RoleAssignmentType.php b/src/lib/Form/Type/RoleAssignment/RoleAssignmentType.php index 500d3a5a8a..9192cf03b6 100644 --- a/src/lib/Form/Type/RoleAssignment/RoleAssignmentType.php +++ b/src/lib/Form/Type/RoleAssignment/RoleAssignmentType.php @@ -21,8 +21,10 @@ class RoleAssignmentType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->add('groups', UserGroupChoiceType::class, [ 'required' => false, 'multiple' => true, diff --git a/src/lib/Form/Type/Search/DateIntervalType.php b/src/lib/Form/Type/Search/DateIntervalType.php index 8127a05929..8f8e8aac68 100644 --- a/src/lib/Form/Type/Search/DateIntervalType.php +++ b/src/lib/Form/Type/Search/DateIntervalType.php @@ -19,9 +19,7 @@ class_alias( * @deprecated since 3.1, to be removed in 3.2. * Use \Ibexa\AdminUi\Form\Type\Date\DateIntervalType instead */ - class DateIntervalType extends \Ibexa\AdminUi\Form\Type\Date\DateIntervalType - { - } + class DateIntervalType extends \Ibexa\AdminUi\Form\Type\Date\DateIntervalType {} } class_alias(DateIntervalType::class, 'EzSystems\EzPlatformAdminUi\Form\Type\Search\DateIntervalType'); diff --git a/src/lib/Form/Type/Search/GlobalSearchType.php b/src/lib/Form/Type/Search/GlobalSearchType.php index 80dc7ccf5c..559bb581fe 100644 --- a/src/lib/Form/Type/Search/GlobalSearchType.php +++ b/src/lib/Form/Type/Search/GlobalSearchType.php @@ -16,8 +16,10 @@ final class GlobalSearchType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add('query', TextType::class, [ 'required' => false, ]); diff --git a/src/lib/Form/Type/Search/SearchType.php b/src/lib/Form/Type/Search/SearchType.php index 47f0701c24..7c8a1bd080 100644 --- a/src/lib/Form/Type/Search/SearchType.php +++ b/src/lib/Form/Type/Search/SearchType.php @@ -13,7 +13,9 @@ use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Translation\Exception\InvalidArgumentException; use Symfony\Contracts\Translation\TranslatorInterface; /** @@ -21,14 +23,16 @@ */ final class SearchType extends AbstractType { - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; - /** @var \Symfony\Component\Form\AbstractType */ + /** @var AbstractType */ private $baseType; - public function __construct(AbstractType $baseType, TranslatorInterface $translator) - { + public function __construct( + AbstractType $baseType, + TranslatorInterface $translator + ) { $this->translator = $translator; $this->baseType = $baseType; } @@ -36,8 +40,10 @@ public function __construct(AbstractType $baseType, TranslatorInterface $transla /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $this->baseType->buildForm($builder, $options); $builder @@ -65,7 +71,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * {@inheritdoc} * - * @throws \Symfony\Component\OptionsResolver\Exception\AccessException + * @throws AccessException */ public function configureOptions(OptionsResolver $resolver) { @@ -83,7 +89,7 @@ public function configureOptions(OptionsResolver $resolver) /** * Generate time periods options available to choose. * - * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ private function getTimePeriodChoices(): array { @@ -98,7 +104,7 @@ private function getTimePeriodChoices(): array /** * Returns available time periods values. * - * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ private function getTimePeriodField(): array { diff --git a/src/lib/Form/Type/Search/TrashSearchType.php b/src/lib/Form/Type/Search/TrashSearchType.php index c584ad57a2..ef7e8e6c60 100644 --- a/src/lib/Form/Type/Search/TrashSearchType.php +++ b/src/lib/Form/Type/Search/TrashSearchType.php @@ -14,6 +14,7 @@ use Ibexa\AdminUi\Form\Type\Section\SectionChoiceType; use Ibexa\AdminUi\Form\Type\Trash\ChoiceList\Loader\SearchContentTypeChoiceLoader; use Ibexa\AdminUi\Form\Type\User\UserType; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\PermissionResolver; use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\Form\AbstractType; @@ -22,21 +23,22 @@ use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Contracts\Translation\TranslatorInterface; class TrashSearchType extends AbstractType { - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\AdminUi\Form\Type\ChoiceList\Loader\DatePeriodChoiceLoader */ + /** @var DatePeriodChoiceLoader */ private $datePeriodChoiceLoader; - /** @var \Ibexa\AdminUi\Form\Type\Trash\ChoiceList\Loader\SearchContentTypeChoiceLoader */ + /** @var SearchContentTypeChoiceLoader */ private $searchContentTypeChoiceLoader; public function __construct( @@ -52,10 +54,12 @@ public function __construct( } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('page', HiddenType::class) ->add('content_name', TextType::class, [ @@ -98,7 +102,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * {@inheritdoc} * - * @throws \Symfony\Component\OptionsResolver\Exception\AccessException + * @throws AccessException */ public function configureOptions(OptionsResolver $resolver) { diff --git a/src/lib/Form/Type/Section/SectionChoiceType.php b/src/lib/Form/Type/Section/SectionChoiceType.php index 492e94f3d7..5e987b0f46 100644 --- a/src/lib/Form/Type/Section/SectionChoiceType.php +++ b/src/lib/Form/Type/Section/SectionChoiceType.php @@ -15,13 +15,13 @@ class SectionChoiceType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\SectionService */ + /** @var SectionService */ private $sectionService; /** * SectionChoiceType constructor. * - * @param \Ibexa\Contracts\Core\Repository\SectionService $sectionService + * @param SectionService $sectionService */ public function __construct(SectionService $sectionService) { diff --git a/src/lib/Form/Type/Section/SectionContentAssignType.php b/src/lib/Form/Type/Section/SectionContentAssignType.php index 52d6f603e0..454313afd1 100644 --- a/src/lib/Form/Type/Section/SectionContentAssignType.php +++ b/src/lib/Form/Type/Section/SectionContentAssignType.php @@ -17,8 +17,10 @@ class SectionContentAssignType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'section', diff --git a/src/lib/Form/Type/Section/SectionCreateType.php b/src/lib/Form/Type/Section/SectionCreateType.php index 767c40d7d9..1dce5c3961 100644 --- a/src/lib/Form/Type/Section/SectionCreateType.php +++ b/src/lib/Form/Type/Section/SectionCreateType.php @@ -28,8 +28,10 @@ public function __construct(SectionType $sectionType) $this->sectionType = $sectionType; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $this->sectionType->buildForm($builder, $options); $builder diff --git a/src/lib/Form/Type/Section/SectionDeleteType.php b/src/lib/Form/Type/Section/SectionDeleteType.php index f82b1a0e22..436ebe6076 100644 --- a/src/lib/Form/Type/Section/SectionDeleteType.php +++ b/src/lib/Form/Type/Section/SectionDeleteType.php @@ -16,8 +16,10 @@ class SectionDeleteType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'section', diff --git a/src/lib/Form/Type/Section/SectionType.php b/src/lib/Form/Type/Section/SectionType.php index 2ff50b8d65..036ce41610 100644 --- a/src/lib/Form/Type/Section/SectionType.php +++ b/src/lib/Form/Type/Section/SectionType.php @@ -14,8 +14,10 @@ class SectionType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('identifier', TextType::class, [ 'label' => /** @Desc("Identifier") */ diff --git a/src/lib/Form/Type/Section/SectionUpdateType.php b/src/lib/Form/Type/Section/SectionUpdateType.php index 322de8713f..8830141b2b 100644 --- a/src/lib/Form/Type/Section/SectionUpdateType.php +++ b/src/lib/Form/Type/Section/SectionUpdateType.php @@ -28,8 +28,10 @@ public function __construct(SectionType $sectionType) $this->sectionType = $sectionType; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $this->sectionType->buildForm($builder, $options); $builder diff --git a/src/lib/Form/Type/Section/SectionsDeleteType.php b/src/lib/Form/Type/Section/SectionsDeleteType.php index 087e41fd76..c496720187 100644 --- a/src/lib/Form/Type/Section/SectionsDeleteType.php +++ b/src/lib/Form/Type/Section/SectionsDeleteType.php @@ -18,8 +18,10 @@ class SectionsDeleteType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('sections', CollectionType::class, [ 'entry_type' => CheckboxType::class, diff --git a/src/lib/Form/Type/Trash/ChoiceList/Loader/SearchContentTypeChoiceLoader.php b/src/lib/Form/Type/Trash/ChoiceList/Loader/SearchContentTypeChoiceLoader.php index f4bda31b48..cf6b71a8a3 100644 --- a/src/lib/Form/Type/Trash/ChoiceList/Loader/SearchContentTypeChoiceLoader.php +++ b/src/lib/Form/Type/Trash/ChoiceList/Loader/SearchContentTypeChoiceLoader.php @@ -19,7 +19,7 @@ class SearchContentTypeChoiceLoader extends ContentTypeChoiceLoader { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( diff --git a/src/lib/Form/Type/Trash/TrashEmptyType.php b/src/lib/Form/Type/Trash/TrashEmptyType.php index 926ad63318..39d82fa074 100644 --- a/src/lib/Form/Type/Trash/TrashEmptyType.php +++ b/src/lib/Form/Type/Trash/TrashEmptyType.php @@ -19,8 +19,10 @@ class TrashEmptyType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'empty_trash', diff --git a/src/lib/Form/Type/Trash/TrashItemCheckboxType.php b/src/lib/Form/Type/Trash/TrashItemCheckboxType.php index c5ed7c80a1..1d40f06565 100644 --- a/src/lib/Form/Type/Trash/TrashItemCheckboxType.php +++ b/src/lib/Form/Type/Trash/TrashItemCheckboxType.php @@ -29,16 +29,21 @@ public function __construct(TrashService $trashService) /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addModelTransformer(new TrashItemTransformer($this->trashService)); } /** * {@inheritdoc} */ - public function buildView(FormView $view, FormInterface $form, array $options) - { + public function buildView( + FormView $view, + FormInterface $form, + array $options + ) { $view->vars = array_replace($view->vars, [ 'value' => $form->getViewData(), 'checked' => false, diff --git a/src/lib/Form/Type/Trash/TrashItemDeleteType.php b/src/lib/Form/Type/Trash/TrashItemDeleteType.php index c61cb6471f..709d6ad662 100644 --- a/src/lib/Form/Type/Trash/TrashItemDeleteType.php +++ b/src/lib/Form/Type/Trash/TrashItemDeleteType.php @@ -20,8 +20,10 @@ class TrashItemDeleteType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->add('trash_items', CollectionType::class, [ 'entry_type' => TrashItemCheckboxType::class, 'entry_options' => [ diff --git a/src/lib/Form/Type/Trash/TrashItemRestoreType.php b/src/lib/Form/Type/Trash/TrashItemRestoreType.php index b603b27ce7..f979449aca 100644 --- a/src/lib/Form/Type/Trash/TrashItemRestoreType.php +++ b/src/lib/Form/Type/Trash/TrashItemRestoreType.php @@ -21,8 +21,10 @@ class TrashItemRestoreType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->add('trash_items', CollectionType::class, [ 'entry_type' => TrashItemCheckboxType::class, 'entry_options' => [ diff --git a/src/lib/Form/Type/URL/URLEditType.php b/src/lib/Form/Type/URL/URLEditType.php index 87623d98c4..08bd051864 100644 --- a/src/lib/Form/Type/URL/URLEditType.php +++ b/src/lib/Form/Type/URL/URLEditType.php @@ -24,8 +24,10 @@ class URLEditType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->add('url', TextType::class) ->add(self::BTN_SAVE, SubmitType::class, [ 'label' => /** @Desc("Save") */ 'url.save', diff --git a/src/lib/Form/Type/URL/URLListType.php b/src/lib/Form/Type/URL/URLListType.php index 37139801b2..d308f30836 100644 --- a/src/lib/Form/Type/URL/URLListType.php +++ b/src/lib/Form/Type/URL/URLListType.php @@ -23,14 +23,14 @@ class URLListType extends AbstractType { /** - * @var \Symfony\Contracts\Translation\TranslatorInterface + * @var TranslatorInterface */ private $translator; /** * URLListType constructor. * - * @param \Symfony\Contracts\Translation\TranslatorInterface $translator + * @param TranslatorInterface $translator */ public function __construct(TranslatorInterface $translator) { @@ -40,8 +40,10 @@ public function __construct(TranslatorInterface $translator) /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->add('status', ChoiceType::class, [ 'choices' => [ $this->translator->trans( diff --git a/src/lib/Form/Type/URLWildcard/URLWildcardDeleteType.php b/src/lib/Form/Type/URLWildcard/URLWildcardDeleteType.php index 325d7e9ed2..157e8e8403 100644 --- a/src/lib/Form/Type/URLWildcard/URLWildcardDeleteType.php +++ b/src/lib/Form/Type/URLWildcard/URLWildcardDeleteType.php @@ -21,8 +21,10 @@ final class URLWildcardDeleteType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder ->add('URLWildcardsChoices', CollectionType::class, [ 'entry_type' => CheckboxType::class, diff --git a/src/lib/Form/Type/URLWildcard/URLWildcardListType.php b/src/lib/Form/Type/URLWildcard/URLWildcardListType.php index a659374d66..6c5210e387 100644 --- a/src/lib/Form/Type/URLWildcard/URLWildcardListType.php +++ b/src/lib/Form/Type/URLWildcard/URLWildcardListType.php @@ -24,8 +24,10 @@ final class URLWildcardListType extends AbstractType implements TranslationConta private const TYPE_FORWARD = 'url_wildcard.type.forward'; private const PLACEHOLDER = 'url_wildcard.type.all'; - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add('type', ChoiceType::class, [ 'choices' => [ self::TYPE_DIRECT => true, @@ -51,7 +53,7 @@ public function configureOptions(OptionsResolver $resolver): void } /** - * @return array<\JMS\TranslationBundle\Model\Message> + * @return array */ public static function getTranslationMessages(): array { diff --git a/src/lib/Form/Type/URLWildcard/URLWildcardType.php b/src/lib/Form/Type/URLWildcard/URLWildcardType.php index 528f334e3f..b4db579bfa 100644 --- a/src/lib/Form/Type/URLWildcard/URLWildcardType.php +++ b/src/lib/Form/Type/URLWildcard/URLWildcardType.php @@ -22,8 +22,10 @@ final class URLWildcardType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder ->add('destination_url', TextType::class, [ 'label' => /** @Desc("Destination URL") */ 'url_wildcard.create.identifier', diff --git a/src/lib/Form/Type/URLWildcard/URLWildcardUpdateType.php b/src/lib/Form/Type/URLWildcard/URLWildcardUpdateType.php index 89dbfbd461..4e9fb20cab 100644 --- a/src/lib/Form/Type/URLWildcard/URLWildcardUpdateType.php +++ b/src/lib/Form/Type/URLWildcard/URLWildcardUpdateType.php @@ -24,8 +24,10 @@ final class URLWildcardUpdateType extends AbstractType /** * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder ->add('destination_url', TextType::class, [ 'label' => /** @Desc("Destination URL") */ 'url_wildcard.create.identifier', diff --git a/src/lib/Form/Type/UniversalDiscoveryWidget/UniversalDiscoveryWidgetType.php b/src/lib/Form/Type/UniversalDiscoveryWidget/UniversalDiscoveryWidgetType.php index d433523b43..37106f92e6 100644 --- a/src/lib/Form/Type/UniversalDiscoveryWidget/UniversalDiscoveryWidgetType.php +++ b/src/lib/Form/Type/UniversalDiscoveryWidget/UniversalDiscoveryWidgetType.php @@ -22,8 +22,10 @@ class UniversalDiscoveryWidgetType extends AbstractType public const TAB_BROWSE = 'browse'; public const TAB_SEARCH = 'search'; - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('location', LocationType::class, [ 'attr' => ['hidden' => true], @@ -37,8 +39,11 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->addModelTransformer($this->getDataTransformer()); } - public function finishView(FormView $view, FormInterface $form, array $options) - { + public function finishView( + FormView $view, + FormInterface $form, + array $options + ) { $selectContentButtonView = $view->offsetGet('select_content'); if (!empty($options['title'])) { @@ -89,7 +94,7 @@ public function getBlockPrefix() } /** - * @return \Symfony\Component\Form\DataTransformerInterface + * @return DataTransformerInterface */ private function getDataTransformer(): DataTransformerInterface { diff --git a/src/lib/Form/Type/User/FocusModeChangeType.php b/src/lib/Form/Type/User/FocusModeChangeType.php index 2346192cb0..a4f488386f 100644 --- a/src/lib/Form/Type/User/FocusModeChangeType.php +++ b/src/lib/Form/Type/User/FocusModeChangeType.php @@ -16,8 +16,10 @@ final class FocusModeChangeType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options): void - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ): void { $builder->add( 'enabled', CheckboxType::class, diff --git a/src/lib/Form/Type/User/UserCollectionType.php b/src/lib/Form/Type/User/UserCollectionType.php index e1928a8de9..81fa4d3e16 100644 --- a/src/lib/Form/Type/User/UserCollectionType.php +++ b/src/lib/Form/Type/User/UserCollectionType.php @@ -16,19 +16,21 @@ class UserCollectionType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ protected $userService; /** - * @param \Ibexa\Contracts\Core\Repository\UserService $userService + * @param UserService $userService */ public function __construct(UserService $userService) { $this->userService = $userService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addViewTransformer(new UserCollectionTransformer($this->userService)); } diff --git a/src/lib/Form/Type/User/UserDeleteType.php b/src/lib/Form/Type/User/UserDeleteType.php index a59fc7a147..0092df8be9 100644 --- a/src/lib/Form/Type/User/UserDeleteType.php +++ b/src/lib/Form/Type/User/UserDeleteType.php @@ -17,8 +17,10 @@ class UserDeleteType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'content_info', diff --git a/src/lib/Form/Type/User/UserEditType.php b/src/lib/Form/Type/User/UserEditType.php index a34d33ee62..74ec973782 100644 --- a/src/lib/Form/Type/User/UserEditType.php +++ b/src/lib/Form/Type/User/UserEditType.php @@ -22,19 +22,21 @@ class UserEditType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ protected $languageService; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService + * @param LanguageService $languageService */ public function __construct(LanguageService $languageService) { $this->languageService = $languageService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'content_info', diff --git a/src/lib/Form/Type/User/UserGroupCollectionType.php b/src/lib/Form/Type/User/UserGroupCollectionType.php index 8216f8d58b..f212bbfb3a 100644 --- a/src/lib/Form/Type/User/UserGroupCollectionType.php +++ b/src/lib/Form/Type/User/UserGroupCollectionType.php @@ -16,19 +16,21 @@ class UserGroupCollectionType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ protected $userService; /** - * @param \Ibexa\Contracts\Core\Repository\UserService $userService + * @param UserService $userService */ public function __construct(UserService $userService) { $this->userService = $userService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addViewTransformer(new UserGroupCollectionTransformer($this->userService)); } diff --git a/src/lib/Form/Type/User/UserInvitationType.php b/src/lib/Form/Type/User/UserInvitationType.php index 0acaf56c06..5848ac8914 100644 --- a/src/lib/Form/Type/User/UserInvitationType.php +++ b/src/lib/Form/Type/User/UserInvitationType.php @@ -17,8 +17,10 @@ final class UserInvitationType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add( 'emails', diff --git a/src/lib/Form/Type/User/UserType.php b/src/lib/Form/Type/User/UserType.php index bfd8147b56..af888ade56 100644 --- a/src/lib/Form/Type/User/UserType.php +++ b/src/lib/Form/Type/User/UserType.php @@ -16,19 +16,21 @@ class UserType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ protected $userService; /** - * @param \Ibexa\Contracts\Core\Repository\UserService $userService + * @param UserService $userService */ public function __construct(UserService $userService) { $this->userService = $userService; } - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder->addViewTransformer(new UserTransformer($this->userService)); } diff --git a/src/lib/Form/Type/UserChoiceType.php b/src/lib/Form/Type/UserChoiceType.php index 454bf9062d..77aed741dd 100644 --- a/src/lib/Form/Type/UserChoiceType.php +++ b/src/lib/Form/Type/UserChoiceType.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeIdentifier; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; +use Ibexa\Contracts\Core\Repository\Values\User\User; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\ChoiceList\Loader\CallbackChoiceLoader; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; @@ -19,13 +20,13 @@ class UserChoiceType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ + /** @var Repository */ private $repository; /** * UserGroupChoiceType constructor. * - * @param \Ibexa\Contracts\Core\Repository\Repository $repository + * @param Repository $repository */ public function __construct(Repository $repository) { @@ -57,7 +58,7 @@ public function getParent(): ?string /** * Get users list. * - * @return \Ibexa\Contracts\Core\Repository\Values\User\User[] + * @return User[] */ protected function getUsers(): array { diff --git a/src/lib/Form/Type/Version/VersionRemoveType.php b/src/lib/Form/Type/Version/VersionRemoveType.php index 81c8ab0a98..17e210efbb 100644 --- a/src/lib/Form/Type/Version/VersionRemoveType.php +++ b/src/lib/Form/Type/Version/VersionRemoveType.php @@ -19,8 +19,10 @@ class VersionRemoveType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { + public function buildForm( + FormBuilderInterface $builder, + array $options + ) { $builder ->add('content_info', ContentInfoType::class) ->add('versions', CollectionType::class, [ diff --git a/src/lib/Limitation/LimitationFormMapperInterface.php b/src/lib/Limitation/LimitationFormMapperInterface.php index b4abd8fdb3..37fa2c2109 100644 --- a/src/lib/Limitation/LimitationFormMapperInterface.php +++ b/src/lib/Limitation/LimitationFormMapperInterface.php @@ -25,10 +25,13 @@ interface LimitationFormMapperInterface * - Add a "limitationValues" form field * - OR add field(s) that map to "limitationValues" property from $data. * - * @param \Symfony\Component\Form\FormInterface $form form for current Limitation - * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $data underlying data for current Limitation form + * @param FormInterface $form form for current Limitation + * @param Limitation $data underlying data for current Limitation form */ - public function mapLimitationForm(FormInterface $form, Limitation $data); + public function mapLimitationForm( + FormInterface $form, + Limitation $data + ); /** * Returns the Twig template to use to render the limitation form. @@ -41,7 +44,7 @@ public function getFormTemplate(); * This method will be called when FormEvents::SUBMIT is called. * It gives the opportunity to filter/manipulate limitation values. * - * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation + * @param Limitation $limitation */ public function filterLimitationValues(Limitation $limitation); } diff --git a/src/lib/Limitation/LimitationFormMapperRegistry.php b/src/lib/Limitation/LimitationFormMapperRegistry.php index d520ad4f60..f5a662c880 100644 --- a/src/lib/Limitation/LimitationFormMapperRegistry.php +++ b/src/lib/Limitation/LimitationFormMapperRegistry.php @@ -27,8 +27,10 @@ public function getMappers() return $this->limitationFormMappers; } - public function addMapper(LimitationFormMapperInterface $mapper, $fieldTypeIdentifier) - { + public function addMapper( + LimitationFormMapperInterface $mapper, + $fieldTypeIdentifier + ) { $this->limitationFormMappers[$fieldTypeIdentifier] = $mapper; } @@ -37,7 +39,7 @@ public function addMapper(LimitationFormMapperInterface $mapper, $fieldTypeIdent * * @param string $limitationIdentifier * - * @throws \InvalidArgumentException if no mapper exists for $fieldTypeIdentifier + * @throws InvalidArgumentException if no mapper exists for $fieldTypeIdentifier * * @return LimitationFormMapperInterface */ diff --git a/src/lib/Limitation/LimitationFormMapperRegistryInterface.php b/src/lib/Limitation/LimitationFormMapperRegistryInterface.php index 665904c321..0a47214f41 100644 --- a/src/lib/Limitation/LimitationFormMapperRegistryInterface.php +++ b/src/lib/Limitation/LimitationFormMapperRegistryInterface.php @@ -39,7 +39,10 @@ public function hasMapper($limitationIdentifier); * @param LimitationFormMapperInterface $mapper * @param string $limitationIdentifier limitation identifier the mapper is meant for */ - public function addMapper(LimitationFormMapperInterface $mapper, $limitationIdentifier); + public function addMapper( + LimitationFormMapperInterface $mapper, + $limitationIdentifier + ); } class_alias( diff --git a/src/lib/Limitation/LimitationValueMapperInterface.php b/src/lib/Limitation/LimitationValueMapperInterface.php index 2a958c7e5c..9b10f8e1b0 100644 --- a/src/lib/Limitation/LimitationValueMapperInterface.php +++ b/src/lib/Limitation/LimitationValueMapperInterface.php @@ -17,7 +17,7 @@ interface LimitationValueMapperInterface /** * Map the limitation values, in order to pass them as context of limitation value rendering. * - * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation + * @param Limitation $limitation * * @return mixed[] */ diff --git a/src/lib/Limitation/LimitationValueMapperRegistry.php b/src/lib/Limitation/LimitationValueMapperRegistry.php index 35d74b0cba..bc98424b8a 100644 --- a/src/lib/Limitation/LimitationValueMapperRegistry.php +++ b/src/lib/Limitation/LimitationValueMapperRegistry.php @@ -48,8 +48,10 @@ public function hasMapper($limitationType) return isset($this->limitationValueMappers[$limitationType]); } - public function addMapper(LimitationValueMapperInterface $mapper, $limitationType) - { + public function addMapper( + LimitationValueMapperInterface $mapper, + $limitationType + ) { $this->limitationValueMappers[$limitationType] = $mapper; } } diff --git a/src/lib/Limitation/LimitationValueMapperRegistryInterface.php b/src/lib/Limitation/LimitationValueMapperRegistryInterface.php index 696ce3caad..1d02ed2209 100644 --- a/src/lib/Limitation/LimitationValueMapperRegistryInterface.php +++ b/src/lib/Limitation/LimitationValueMapperRegistryInterface.php @@ -7,6 +7,8 @@ namespace Ibexa\AdminUi\Limitation; +use Ibexa\AdminUi\Exception\ValueMapperNotFoundException; + /** * Interface for Limitation value mappers registry. */ @@ -22,7 +24,7 @@ public function getMappers(); /** * Returns mapper corresponding to given Limitation Type. * - * @throws \Ibexa\AdminUi\Exception\ValueMapperNotFoundException if no mapper exists for $limitationType + * @throws ValueMapperNotFoundException if no mapper exists for $limitationType * * @param string $limitationType * @@ -45,7 +47,10 @@ public function hasMapper($limitationType); * @param LimitationValueMapperInterface $mapper * @param string $limitationType limitation identifier the mapper is meant for */ - public function addMapper(LimitationValueMapperInterface $mapper, $limitationType); + public function addMapper( + LimitationValueMapperInterface $mapper, + $limitationType + ); } class_alias( diff --git a/src/lib/Limitation/Mapper/ChangeOwnerLimitationMapper.php b/src/lib/Limitation/Mapper/ChangeOwnerLimitationMapper.php index 4c11edab0d..f1d7a8de61 100644 --- a/src/lib/Limitation/Mapper/ChangeOwnerLimitationMapper.php +++ b/src/lib/Limitation/Mapper/ChangeOwnerLimitationMapper.php @@ -40,8 +40,10 @@ public function mapLimitationValue(Limitation $limitation): array return $limitation->limitationValues; } - public function mapLimitationForm(FormInterface $form, Limitation $data): void - { + public function mapLimitationForm( + FormInterface $form, + Limitation $data + ): void { $options = [ 'multiple' => true, 'expanded' => false, diff --git a/src/lib/Limitation/Mapper/ContentTypeLimitationMapper.php b/src/lib/Limitation/Mapper/ContentTypeLimitationMapper.php index c54b6dce9c..55934d593a 100644 --- a/src/lib/Limitation/Mapper/ContentTypeLimitationMapper.php +++ b/src/lib/Limitation/Mapper/ContentTypeLimitationMapper.php @@ -22,7 +22,7 @@ class ContentTypeLimitationMapper extends MultipleSelectionBasedMapper implement use LoggerAwareTrait; /** - * @var \Ibexa\Contracts\Core\Repository\ContentTypeService + * @var ContentTypeService */ private $contentTypeService; diff --git a/src/lib/Limitation/Mapper/GroupLimitationMapper.php b/src/lib/Limitation/Mapper/GroupLimitationMapper.php index 3acaa23017..d913787960 100644 --- a/src/lib/Limitation/Mapper/GroupLimitationMapper.php +++ b/src/lib/Limitation/Mapper/GroupLimitationMapper.php @@ -18,7 +18,7 @@ class GroupLimitationMapper extends MultipleSelectionBasedMapper implements LimitationValueMapperInterface, TranslationContainerInterface { /** - * @var \Symfony\Contracts\Translation\TranslatorInterface + * @var TranslatorInterface */ private $translator; diff --git a/src/lib/Limitation/Mapper/LanguageLimitationMapper.php b/src/lib/Limitation/Mapper/LanguageLimitationMapper.php index d56a3a20d4..d3cacd99a2 100644 --- a/src/lib/Limitation/Mapper/LanguageLimitationMapper.php +++ b/src/lib/Limitation/Mapper/LanguageLimitationMapper.php @@ -22,7 +22,7 @@ class LanguageLimitationMapper extends MultipleSelectionBasedMapper implements L use LoggerAwareTrait; /** - * @var \Ibexa\Contracts\Core\Repository\LanguageService + * @var LanguageService */ private $languageService; diff --git a/src/lib/Limitation/Mapper/MemberOfLimitationMapper.php b/src/lib/Limitation/Mapper/MemberOfLimitationMapper.php index 875aa8f66d..8d314e4c46 100644 --- a/src/lib/Limitation/Mapper/MemberOfLimitationMapper.php +++ b/src/lib/Limitation/Mapper/MemberOfLimitationMapper.php @@ -16,6 +16,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\ContentName; use Ibexa\Contracts\Core\Repository\Values\Filter\Filter; use Ibexa\Contracts\Core\Repository\Values\User\Limitation; +use Ibexa\Contracts\Core\Repository\Values\User\UserGroup; use Ibexa\Core\Limitation\LimitationIdentifierToLabelConverter; use Ibexa\Core\Limitation\MemberOfLimitationType; use JMS\TranslationBundle\Annotation\Desc; @@ -73,7 +74,7 @@ public function mapLimitationValue(Limitation $limitation): array } /** - * @return \Ibexa\Contracts\Core\Repository\Values\User\UserGroup[] + * @return UserGroup[] */ private function loadUserGroups(): array { diff --git a/src/lib/Limitation/Mapper/MultipleSelectionBasedMapper.php b/src/lib/Limitation/Mapper/MultipleSelectionBasedMapper.php index 7de5f389e9..489ab70c14 100644 --- a/src/lib/Limitation/Mapper/MultipleSelectionBasedMapper.php +++ b/src/lib/Limitation/Mapper/MultipleSelectionBasedMapper.php @@ -25,8 +25,10 @@ abstract class MultipleSelectionBasedMapper implements LimitationFormMapperInter */ private $template; - public function mapLimitationForm(FormInterface $form, Limitation $data) - { + public function mapLimitationForm( + FormInterface $form, + Limitation $data + ) { $options = $this->getChoiceFieldOptions() + [ 'multiple' => true, 'label' => LimitationIdentifierToLabelConverter::convert($data->getIdentifier()), @@ -65,9 +67,7 @@ public function getFormTemplate() return $this->template; } - public function filterLimitationValues(Limitation $limitation) - { - } + public function filterLimitationValues(Limitation $limitation) {} } class_alias(MultipleSelectionBasedMapper::class, 'EzSystems\EzPlatformAdminUi\Limitation\Mapper\MultipleSelectionBasedMapper'); diff --git a/src/lib/Limitation/Mapper/NullLimitationMapper.php b/src/lib/Limitation/Mapper/NullLimitationMapper.php index 8a62b2bcd1..831d0c35be 100644 --- a/src/lib/Limitation/Mapper/NullLimitationMapper.php +++ b/src/lib/Limitation/Mapper/NullLimitationMapper.php @@ -27,18 +27,17 @@ public function __construct($template) $this->template = $template; } - public function mapLimitationForm(FormInterface $form, Limitation $data) - { - } + public function mapLimitationForm( + FormInterface $form, + Limitation $data + ) {} public function getFormTemplate() { return $this->template; } - public function filterLimitationValues(Limitation $limitation) - { - } + public function filterLimitationValues(Limitation $limitation) {} public function mapLimitationValue(Limitation $limitation) { diff --git a/src/lib/Limitation/Mapper/ObjectStateLimitationMapper.php b/src/lib/Limitation/Mapper/ObjectStateLimitationMapper.php index 4a820102b2..25646775c8 100644 --- a/src/lib/Limitation/Mapper/ObjectStateLimitationMapper.php +++ b/src/lib/Limitation/Mapper/ObjectStateLimitationMapper.php @@ -23,7 +23,7 @@ class ObjectStateLimitationMapper extends MultipleSelectionBasedMapper implement use LoggerAwareTrait; /** - * @var \Ibexa\Contracts\Core\Repository\ObjectStateService + * @var ObjectStateService */ private $objectStateService; diff --git a/src/lib/Limitation/Mapper/OwnerLimitationMapper.php b/src/lib/Limitation/Mapper/OwnerLimitationMapper.php index 85faa100d4..0dbccdbe93 100644 --- a/src/lib/Limitation/Mapper/OwnerLimitationMapper.php +++ b/src/lib/Limitation/Mapper/OwnerLimitationMapper.php @@ -18,7 +18,7 @@ class OwnerLimitationMapper extends MultipleSelectionBasedMapper implements LimitationValueMapperInterface, TranslationContainerInterface { /** - * @var \Symfony\Contracts\Translation\TranslatorInterface + * @var TranslatorInterface */ private $translator; diff --git a/src/lib/Limitation/Mapper/SectionLimitationMapper.php b/src/lib/Limitation/Mapper/SectionLimitationMapper.php index 2ffcf5754a..415b74964a 100644 --- a/src/lib/Limitation/Mapper/SectionLimitationMapper.php +++ b/src/lib/Limitation/Mapper/SectionLimitationMapper.php @@ -22,7 +22,7 @@ class SectionLimitationMapper extends MultipleSelectionBasedMapper implements Li use LoggerAwareTrait; /** - * @var \Ibexa\Contracts\Core\Repository\SectionService + * @var SectionService */ private $sectionService; diff --git a/src/lib/Limitation/Mapper/SiteAccessLimitationMapper.php b/src/lib/Limitation/Mapper/SiteAccessLimitationMapper.php index ec740402b9..6985e8700c 100644 --- a/src/lib/Limitation/Mapper/SiteAccessLimitationMapper.php +++ b/src/lib/Limitation/Mapper/SiteAccessLimitationMapper.php @@ -17,10 +17,10 @@ class SiteAccessLimitationMapper extends MultipleSelectionBasedMapper implements LimitationValueMapperInterface, TranslationContainerInterface { - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessServiceInterface */ + /** @var SiteAccessServiceInterface */ private $siteAccessService; - /** @var \Ibexa\AdminUi\Siteaccess\SiteAccessKeyGeneratorInterface */ + /** @var SiteAccessKeyGeneratorInterface */ private $siteAccessKeyGenerator; public function __construct( diff --git a/src/lib/Limitation/Mapper/SubtreeLimitationMapper.php b/src/lib/Limitation/Mapper/SubtreeLimitationMapper.php index c1a71abcda..0aad00a672 100755 --- a/src/lib/Limitation/Mapper/SubtreeLimitationMapper.php +++ b/src/lib/Limitation/Mapper/SubtreeLimitationMapper.php @@ -7,7 +7,9 @@ namespace Ibexa\AdminUi\Limitation\Mapper; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\Ancestor; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause\Location\Path; @@ -33,8 +35,8 @@ public function filterLimitationValues(Limitation $limitation) } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws InvalidArgumentException + * @throws UnauthorizedException */ public function mapLimitationValue(Limitation $limitation) { diff --git a/src/lib/Limitation/Mapper/UDWBasedMapper.php b/src/lib/Limitation/Mapper/UDWBasedMapper.php index c47916da20..1c2065efc8 100755 --- a/src/lib/Limitation/Mapper/UDWBasedMapper.php +++ b/src/lib/Limitation/Mapper/UDWBasedMapper.php @@ -31,12 +31,12 @@ class UDWBasedMapper implements LimitationFormMapperInterface, LimitationValueMapperInterface, TranslationContainerInterface { /** - * @var \Ibexa\Contracts\Core\Repository\LocationService + * @var LocationService */ protected $locationService; /** - * @var \Ibexa\Contracts\Core\Repository\SearchService + * @var SearchService */ protected $searchService; @@ -47,10 +47,10 @@ class UDWBasedMapper implements LimitationFormMapperInterface, LimitationValueMa */ private $template; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ + /** @var Repository */ private $repository; public function __construct( @@ -75,8 +75,10 @@ public function getFormTemplate() return $this->template; } - public function mapLimitationForm(FormInterface $form, Limitation $data) - { + public function mapLimitationForm( + FormInterface $form, + Limitation $data + ) { $form->add( // Creating from FormBuilder as we need to add a DataTransformer. $form->getConfig()->getFormFactory() @@ -98,9 +100,7 @@ public function mapLimitationForm(FormInterface $form, Limitation $data) ); } - public function filterLimitationValues(Limitation $limitation) - { - } + public function filterLimitationValues(Limitation $limitation) {} public function mapLimitationValue(Limitation $limitation) { diff --git a/src/lib/Limitation/Mapper/UserPermissionsLimitationMapper.php b/src/lib/Limitation/Mapper/UserPermissionsLimitationMapper.php index 26e37a044e..248a06b83e 100644 --- a/src/lib/Limitation/Mapper/UserPermissionsLimitationMapper.php +++ b/src/lib/Limitation/Mapper/UserPermissionsLimitationMapper.php @@ -15,6 +15,7 @@ use Ibexa\Contracts\Core\Repository\SearchService; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\User\Limitation; +use Ibexa\Contracts\Core\Repository\Values\User\UserGroup; use Ibexa\Core\Limitation\LimitationIdentifierToLabelConverter; use Ibexa\User\Form\ChoiceList\Loader\UserGroupsChoiceLoader; use JMS\TranslationBundle\Model\Message; @@ -48,8 +49,10 @@ public function __construct( $this->searchService = $searchService; } - public function mapLimitationForm(FormInterface $form, Limitation $data) - { + public function mapLimitationForm( + FormInterface $form, + Limitation $data + ) { $sub = $form ->getConfig() ->getFormFactory() @@ -90,7 +93,7 @@ function () { ))->loadChoiceList()->getChoices(); $choices = []; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup $userGroup */ + /** @var UserGroup $userGroup */ foreach ($userGroups as $userGroup) { $choices[$userGroup->getName()] = $userGroup->id; } @@ -114,9 +117,7 @@ public function getFormTemplate(): string return $this->template; } - public function filterLimitationValues(Limitation $limitation) - { - } + public function filterLimitationValues(Limitation $limitation) {} public function mapLimitationValue(Limitation $limitation) { diff --git a/src/lib/Limitation/Templating/LimitationBlockRenderer.php b/src/lib/Limitation/Templating/LimitationBlockRenderer.php index 4b2ddec42b..02e1011cf7 100644 --- a/src/lib/Limitation/Templating/LimitationBlockRenderer.php +++ b/src/lib/Limitation/Templating/LimitationBlockRenderer.php @@ -15,19 +15,21 @@ use Ibexa\Contracts\Core\Repository\Values\User\Limitation; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Twig\Environment; +use Twig\Template; +use Twig\TemplateWrapper; class LimitationBlockRenderer implements LimitationBlockRendererInterface { public const LIMITATION_VALUE_BLOCK_NAME = 'ez_limitation_%s_value'; public const LIMITATION_VALUE_BLOCK_NAME_FALLBACK = 'ez_limitation_value_fallback'; - /** @var \Ibexa\AdminUi\Limitation\LimitationValueMapperRegistryInterface */ + /** @var LimitationValueMapperRegistryInterface */ private $valueMapperRegistry; - /** @var \Twig\Environment */ + /** @var Environment */ private $twig; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( @@ -40,8 +42,10 @@ public function __construct( $this->configResolver = $configResolver; } - public function renderLimitationValue(Limitation $limitation, array $parameters = []) - { + public function renderLimitationValue( + Limitation $limitation, + array $parameters = [] + ) { try { $blockName = $this->getValueBlockName($limitation); $parameters = $this->getValueBlockParameters($limitation, $parameters); @@ -67,7 +71,7 @@ public function renderLimitationValue(Limitation $limitation, array $parameters /** * Generates value block name based on Limitation. * - * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation + * @param Limitation $limitation * * @return string */ @@ -80,12 +84,14 @@ protected function getValueBlockName(Limitation $limitation) * Find the first template containing block definition $blockName. * * @param string $blockName - * @param string|\Twig\Template $localTemplate + * @param string|Template $localTemplate * - * @return \Twig\TemplateWrapper|null + * @return TemplateWrapper|null */ - protected function findTemplateWithBlock($blockName, $localTemplate = null) - { + protected function findTemplateWithBlock( + $blockName, + $localTemplate = null + ) { if ($localTemplate !== null) { if (is_string($localTemplate)) { $localTemplate = $this->twig->load($localTemplate); @@ -113,13 +119,15 @@ protected function findTemplateWithBlock($blockName, $localTemplate = null) /** * Get parameters passed as context of value block render. * - * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation + * @param Limitation $limitation * @param array $parameters * * @return array */ - protected function getValueBlockParameters(Limitation $limitation, array $parameters) - { + protected function getValueBlockParameters( + Limitation $limitation, + array $parameters + ) { $values = $this->valueMapperRegistry ->getMapper($limitation->getIdentifier()) ->mapLimitationValue($limitation); @@ -135,13 +143,15 @@ protected function getValueBlockParameters(Limitation $limitation, array $parame /** * Get parameters passed as context of value fallback block. * - * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation + * @param Limitation $limitation * @param array $parameters * * @return array */ - protected function getValueFallbackBlockParameters(Limitation $limitation, array $parameters) - { + protected function getValueFallbackBlockParameters( + Limitation $limitation, + array $parameters + ) { $parameters += [ 'limitation' => $limitation, 'values' => $limitation->limitationValues, @@ -154,7 +164,10 @@ private function getLimitationValueResources(): array { $resources = $this->configResolver->getParameter('limitation_value_templates'); - usort($resources, static function ($a, $b): int { + usort($resources, static function ( + $a, + $b + ): int { return $b['priority'] <=> $a['priority']; }); diff --git a/src/lib/Limitation/Templating/LimitationBlockRendererInterface.php b/src/lib/Limitation/Templating/LimitationBlockRendererInterface.php index fe1ed0860b..d30e4cb8b2 100644 --- a/src/lib/Limitation/Templating/LimitationBlockRendererInterface.php +++ b/src/lib/Limitation/Templating/LimitationBlockRendererInterface.php @@ -14,12 +14,15 @@ interface LimitationBlockRendererInterface /** * Returns limitation value in human readable format. * - * @param \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation + * @param Limitation $limitation * @param array $parameters * * @return string */ - public function renderLimitationValue(Limitation $limitation, array $parameters = []); + public function renderLimitationValue( + Limitation $limitation, + array $parameters = [] + ); } class_alias(LimitationBlockRendererInterface::class, 'EzSystems\EzPlatformAdminUi\Limitation\Templating\LimitationBlockRendererInterface'); diff --git a/src/lib/Menu/Action/VersionListActionMenuBuilder.php b/src/lib/Menu/Action/VersionListActionMenuBuilder.php index f503a3f23c..7634499dc9 100644 --- a/src/lib/Menu/Action/VersionListActionMenuBuilder.php +++ b/src/lib/Menu/Action/VersionListActionMenuBuilder.php @@ -79,7 +79,7 @@ protected function createStructure(array $options): ItemInterface } /** - * @return array<\JMS\TranslationBundle\Model\Message> + * @return array */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Admin/ContentType/AbstractContentTypeRightSidebarBuilder.php b/src/lib/Menu/Admin/ContentType/AbstractContentTypeRightSidebarBuilder.php index c18b7688bd..eaf0843ec8 100644 --- a/src/lib/Menu/Admin/ContentType/AbstractContentTypeRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ContentType/AbstractContentTypeRightSidebarBuilder.php @@ -10,15 +10,16 @@ use Ibexa\Contracts\AdminUi\Menu\AbstractBuilder; use Knp\Menu\ItemInterface; +use Symfony\Component\Form\FormView; abstract class AbstractContentTypeRightSidebarBuilder extends AbstractBuilder { public function createStructure(array $options): ItemInterface { - /** @var \Symfony\Component\Form\FormView $contentTypeFormView */ + /** @var FormView $contentTypeFormView */ $contentTypeFormView = $options['form_view']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $itemSaveIdentifier = $this->getItemSaveIdentifier(); diff --git a/src/lib/Menu/Admin/ContentType/ContentTypeCreateRightSidebarBuilder.php b/src/lib/Menu/Admin/ContentType/ContentTypeCreateRightSidebarBuilder.php index e7f046c74c..492c9563d3 100644 --- a/src/lib/Menu/Admin/ContentType/ContentTypeCreateRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ContentType/ContentTypeCreateRightSidebarBuilder.php @@ -29,7 +29,7 @@ protected function getConfigureEventName(): string } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Admin/ContentType/ContentTypeEditRightSidebarBuilder.php b/src/lib/Menu/Admin/ContentType/ContentTypeEditRightSidebarBuilder.php index 5c1ba9d9a6..a0bc2f749d 100644 --- a/src/lib/Menu/Admin/ContentType/ContentTypeEditRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ContentType/ContentTypeEditRightSidebarBuilder.php @@ -29,7 +29,7 @@ protected function getConfigureEventName(): string } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Admin/ContentType/ContentTypeGroupCreateRightSidebarBuilder.php b/src/lib/Menu/Admin/ContentType/ContentTypeGroupCreateRightSidebarBuilder.php index db3ff41c46..ebd08be9e3 100644 --- a/src/lib/Menu/Admin/ContentType/ContentTypeGroupCreateRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ContentType/ContentTypeGroupCreateRightSidebarBuilder.php @@ -29,7 +29,7 @@ class ContentTypeGroupCreateRightSidebarBuilder extends AbstractBuilder implemen public const ITEM__CREATE_AND_EDIT = 'content_type_group_create__sidebar_right__create_and_edit'; public const ITEM__CANCEL = 'content_type_group_create__sidebar_right__cancel'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -53,7 +53,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -64,7 +64,7 @@ public function createStructure(array $options): ItemInterface $saveId = $options['save_id']; $saveAncCloseId = $options['save_and_close_id']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $saveAndCloseItem = $this->createMenuItem( @@ -101,7 +101,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Admin/ContentType/ContentTypeGroupEditRightSidebarBuilder.php b/src/lib/Menu/Admin/ContentType/ContentTypeGroupEditRightSidebarBuilder.php index 2a8aee3325..e67a65255e 100644 --- a/src/lib/Menu/Admin/ContentType/ContentTypeGroupEditRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ContentType/ContentTypeGroupEditRightSidebarBuilder.php @@ -29,7 +29,7 @@ class ContentTypeGroupEditRightSidebarBuilder extends AbstractBuilder implements public const ITEM__SAVE_AND_CLOSE = 'content_type_group_edit__sidebar_right__save_and_close'; public const ITEM__CANCEL = 'content_type_group_edit__sidebar_right__cancel'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -53,7 +53,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -64,7 +64,7 @@ public function createStructure(array $options): ItemInterface $saveId = $options['save_id']; $saveAncCloseId = $options['save_and_close_id']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $saveAndCloseItem = $this->createMenuItem( @@ -101,7 +101,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Admin/Language/LanguageCreateRightSidebarBuilder.php b/src/lib/Menu/Admin/Language/LanguageCreateRightSidebarBuilder.php index 0fe3478d39..05f6731379 100644 --- a/src/lib/Menu/Admin/Language/LanguageCreateRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/Language/LanguageCreateRightSidebarBuilder.php @@ -29,7 +29,7 @@ class LanguageCreateRightSidebarBuilder extends AbstractBuilder implements Trans public const ITEM__CREATE_AND_EDIT = 'language_create__sidebar_right__create_and_edit'; public const ITEM__CANCEL = 'language_create__sidebar_right__cancel'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -53,7 +53,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -64,7 +64,7 @@ public function createStructure(array $options): ItemInterface $saveId = $options['save_id']; $saveAncCloseId = $options['save_and_close_id']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $saveAndCloseItem = $this->createMenuItem( @@ -101,7 +101,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Admin/Language/LanguageEditRightSidebarBuilder.php b/src/lib/Menu/Admin/Language/LanguageEditRightSidebarBuilder.php index 3be7538138..446a0b262c 100644 --- a/src/lib/Menu/Admin/Language/LanguageEditRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/Language/LanguageEditRightSidebarBuilder.php @@ -29,7 +29,7 @@ class LanguageEditRightSidebarBuilder extends AbstractBuilder implements Transla public const ITEM__SAVE_AND_CLOSE = 'language_edit__sidebar_right__save_and_close'; public const ITEM__CANCEL = 'language_edit__sidebar_right__cancel'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -53,7 +53,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -64,7 +64,7 @@ public function createStructure(array $options): ItemInterface $saveId = $options['save_id']; $saveAncCloseId = $options['save_and_close_id']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $saveAndCloseItem = $this->createMenuItem( @@ -101,7 +101,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Admin/ObjectState/ObjectStateCreateRightSidebarBuilder.php b/src/lib/Menu/Admin/ObjectState/ObjectStateCreateRightSidebarBuilder.php index fdabe7222f..b845ed40cc 100644 --- a/src/lib/Menu/Admin/ObjectState/ObjectStateCreateRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ObjectState/ObjectStateCreateRightSidebarBuilder.php @@ -38,7 +38,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -48,7 +48,7 @@ public function createStructure(array $options): ItemInterface { $groupId = $options['group_id']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $createItem = $this->createMenuItem( @@ -88,7 +88,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Admin/ObjectState/ObjectStateEditRightSidebarBuilder.php b/src/lib/Menu/Admin/ObjectState/ObjectStateEditRightSidebarBuilder.php index cfbb8291b9..9071a50fc9 100644 --- a/src/lib/Menu/Admin/ObjectState/ObjectStateEditRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ObjectState/ObjectStateEditRightSidebarBuilder.php @@ -38,7 +38,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -50,7 +50,7 @@ public function createStructure(array $options): ItemInterface $saveId = $options['save_id']; $saveAncCloseId = $options['save_and_close_id']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $saveAndCloseItem = $this->createMenuItem( @@ -90,7 +90,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Admin/ObjectState/ObjectStateGroupCreateRightSidebarBuilder.php b/src/lib/Menu/Admin/ObjectState/ObjectStateGroupCreateRightSidebarBuilder.php index 6b1ba9181e..cd6076ae02 100644 --- a/src/lib/Menu/Admin/ObjectState/ObjectStateGroupCreateRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ObjectState/ObjectStateGroupCreateRightSidebarBuilder.php @@ -30,7 +30,7 @@ class ObjectStateGroupCreateRightSidebarBuilder extends AbstractBuilder implemen public const ITEM__CREATE_AND_EDIT = 'object_state_group_create__sidebar_right__create_and_edit'; public const ITEM__CANCEL = 'object_state_group_create__sidebar_right__cancel'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -54,7 +54,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -62,7 +62,7 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $createItem = $this->createMenuItem( @@ -99,7 +99,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Admin/ObjectState/ObjectStateGroupEditRightSidebarBuilder.php b/src/lib/Menu/Admin/ObjectState/ObjectStateGroupEditRightSidebarBuilder.php index adead316a5..c23789cc59 100644 --- a/src/lib/Menu/Admin/ObjectState/ObjectStateGroupEditRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/ObjectState/ObjectStateGroupEditRightSidebarBuilder.php @@ -30,7 +30,7 @@ class ObjectStateGroupEditRightSidebarBuilder extends AbstractBuilder implements public const ITEM__SAVE_AND_CLOSE = 'object_state_group_edit__sidebar_right__save_and_close'; public const ITEM__CANCEL = 'object_state_group_edit__sidebar_right__cancel'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -54,7 +54,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -65,7 +65,7 @@ public function createStructure(array $options): ItemInterface $saveId = $options['save_id']; $saveAncCloseId = $options['save_and_close_id']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $saveAndCloseItem = $this->createMenuItem( @@ -102,7 +102,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Admin/ReorderMenuListener.php b/src/lib/Menu/Admin/ReorderMenuListener.php index f4383c624a..6ae73889b3 100644 --- a/src/lib/Menu/Admin/ReorderMenuListener.php +++ b/src/lib/Menu/Admin/ReorderMenuListener.php @@ -15,7 +15,7 @@ class ReorderMenuListener { /** - * @param \Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent $event + * @param ConfigureMenuEvent $event */ public function moveAdminToLast(ConfigureMenuEvent $event): void { diff --git a/src/lib/Menu/Admin/Role/PolicyCreateRightSidebarBuilder.php b/src/lib/Menu/Admin/Role/PolicyCreateRightSidebarBuilder.php index 294d4ee7b3..9686ba18e3 100644 --- a/src/lib/Menu/Admin/Role/PolicyCreateRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/Role/PolicyCreateRightSidebarBuilder.php @@ -10,6 +10,7 @@ use Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent; use Ibexa\Contracts\AdminUi\Menu\AbstractBuilder; use Ibexa\Contracts\Core\Repository\Exceptions as ApiExceptions; +use Ibexa\Contracts\Core\Repository\Values\User\Role; use JMS\TranslationBundle\Model\Message; use JMS\TranslationBundle\Translation\TranslationContainerInterface; use Knp\Menu\ItemInterface; @@ -36,7 +37,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -44,11 +45,11 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role $section */ + /** @var Role $section */ $role = $options['role']; $saveId = $options['save_id']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $menu->setChildren([ @@ -76,7 +77,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Admin/Role/PolicyEditRightSidebarBuilder.php b/src/lib/Menu/Admin/Role/PolicyEditRightSidebarBuilder.php index 13077219e5..c949b0f152 100644 --- a/src/lib/Menu/Admin/Role/PolicyEditRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/Role/PolicyEditRightSidebarBuilder.php @@ -10,6 +10,7 @@ use Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent; use Ibexa\Contracts\AdminUi\Menu\AbstractBuilder; use Ibexa\Contracts\Core\Repository\Exceptions as ApiExceptions; +use Ibexa\Contracts\Core\Repository\Values\User\Role; use JMS\TranslationBundle\Model\Message; use JMS\TranslationBundle\Translation\TranslationContainerInterface; use Knp\Menu\ItemInterface; @@ -37,7 +38,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -45,12 +46,12 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role $section */ + /** @var Role $section */ $role = $options['role']; $saveId = $options['save_id']; $saveAncCloseId = $options['save_and_close_id']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $saveAndCloseItem = $this->createMenuItem( @@ -90,7 +91,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Admin/Role/RoleAssignmentCreateRightSidebarBuilder.php b/src/lib/Menu/Admin/Role/RoleAssignmentCreateRightSidebarBuilder.php index e0f725fed5..aa78dd9027 100644 --- a/src/lib/Menu/Admin/Role/RoleAssignmentCreateRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/Role/RoleAssignmentCreateRightSidebarBuilder.php @@ -10,6 +10,7 @@ use Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent; use Ibexa\Contracts\AdminUi\Menu\AbstractBuilder; use Ibexa\Contracts\Core\Repository\Exceptions as ApiExceptions; +use Ibexa\Contracts\Core\Repository\Values\User\Role; use JMS\TranslationBundle\Model\Message; use JMS\TranslationBundle\Translation\TranslationContainerInterface; use Knp\Menu\ItemInterface; @@ -36,7 +37,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -44,10 +45,10 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role $role */ + /** @var Role $role */ $role = $options['role']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $menu->setChildren([ @@ -76,7 +77,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Admin/Role/RoleCopyRightSidebarBuilder.php b/src/lib/Menu/Admin/Role/RoleCopyRightSidebarBuilder.php index 0be86be9d3..2878502143 100644 --- a/src/lib/Menu/Admin/Role/RoleCopyRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/Role/RoleCopyRightSidebarBuilder.php @@ -28,7 +28,7 @@ class RoleCopyRightSidebarBuilder extends AbstractBuilder implements Translation public const ITEM__SAVE = 'role_copy__sidebar_right__save'; public const ITEM__CANCEL = 'role_copy__sidebar_right__cancel'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -51,7 +51,7 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $menu->setChildren([ @@ -94,7 +94,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Admin/Role/RoleCreateRightSidebarBuilder.php b/src/lib/Menu/Admin/Role/RoleCreateRightSidebarBuilder.php index d26ac08cdb..456aba835f 100644 --- a/src/lib/Menu/Admin/Role/RoleCreateRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/Role/RoleCreateRightSidebarBuilder.php @@ -29,7 +29,7 @@ class RoleCreateRightSidebarBuilder extends AbstractBuilder implements Translati public const ITEM__CREATE_AND_EDIT = 'role_create__sidebar_right__create_and_edit'; public const ITEM__CANCEL = 'role_create__sidebar_right__cancel'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -53,7 +53,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -64,7 +64,7 @@ public function createStructure(array $options): ItemInterface $saveId = $options['save_id']; $saveAncCloseId = $options['save_and_close_id']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $saveAndCloseItem = $this->createMenuItem( @@ -101,7 +101,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Admin/Role/RoleEditRightSidebarBuilder.php b/src/lib/Menu/Admin/Role/RoleEditRightSidebarBuilder.php index 405c11dc4a..cfbf1dd9c0 100644 --- a/src/lib/Menu/Admin/Role/RoleEditRightSidebarBuilder.php +++ b/src/lib/Menu/Admin/Role/RoleEditRightSidebarBuilder.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\AdminUi\Menu\AbstractBuilder; use Ibexa\Contracts\AdminUi\Menu\MenuItemFactoryInterface; use Ibexa\Contracts\Core\Repository\Exceptions as ApiExceptions; +use Ibexa\Contracts\Core\Repository\Values\User\Role; use JMS\TranslationBundle\Model\Message; use JMS\TranslationBundle\Translation\TranslationContainerInterface; use Knp\Menu\ItemInterface; @@ -29,7 +30,7 @@ class RoleEditRightSidebarBuilder extends AbstractBuilder implements Translation public const ITEM__SAVE_AND_CLOSE = 'role_edit__sidebar_right__save_and_close'; public const ITEM__CANCEL = 'role_edit__sidebar_right__cancel'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -53,7 +54,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -61,12 +62,12 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role $role */ + /** @var Role $role */ $role = $options['role']; $saveId = $options['save_id']; $saveAncCloseId = $options['save_and_close_id']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $saveAndCloseItem = $this->createMenuItem( @@ -103,7 +104,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/ContentCreateRightSidebarBuilder.php b/src/lib/Menu/ContentCreateRightSidebarBuilder.php index eee1eedc32..0b3f74ae87 100644 --- a/src/lib/Menu/ContentCreateRightSidebarBuilder.php +++ b/src/lib/Menu/ContentCreateRightSidebarBuilder.php @@ -12,6 +12,9 @@ use Ibexa\Contracts\AdminUi\Menu\MenuItemFactoryInterface; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct; @@ -41,16 +44,16 @@ class ContentCreateRightSidebarBuilder extends AbstractBuilder implements Transl public const BTN_TRIGGER_CLASS = 'ibexa-btn--trigger'; public const BTN_DISABLED_ATTR = ['disabled' => 'disabled']; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @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\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; public function __construct( @@ -82,22 +85,22 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws BadStateException + * @throws InvalidArgumentException + * @throws NotFoundException */ public function createStructure(array $options): ItemInterface { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $parentLocation */ + /** @var Location $parentLocation */ $parentLocation = $options['parent_location']; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType */ + /** @var ContentType $contentType */ $contentType = $options['content_type']; $parentContentType = $parentLocation->getContent()->getContentType(); - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language $language */ + /** @var Language $language */ $language = $options['language']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $contentCreateStruct = $this->createContentCreateStruct($parentLocation, $contentType, $language); @@ -191,7 +194,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { @@ -205,14 +208,17 @@ public static function getTranslationMessages(): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language $language + * @param Location $location + * @param ContentType $contentType + * @param Language $language * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct + * @return ContentCreateStruct */ - private function createContentCreateStruct(Location $location, ContentType $contentType, Language $language): ContentCreateStruct - { + private function createContentCreateStruct( + Location $location, + ContentType $contentType, + Language $language + ): ContentCreateStruct { $contentCreateStruct = $this->contentService->newContentCreateStruct($contentType, $language->languageCode); $contentCreateStruct->sectionId = $location->contentInfo->sectionId; diff --git a/src/lib/Menu/ContentEditAnchorMenuBuilder.php b/src/lib/Menu/ContentEditAnchorMenuBuilder.php index 82faa5974e..835eb3b54a 100644 --- a/src/lib/Menu/ContentEditAnchorMenuBuilder.php +++ b/src/lib/Menu/ContentEditAnchorMenuBuilder.php @@ -47,10 +47,10 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); - /** @var \Ibexa\Core\Repository\Values\ContentType\ContentType $contentType */ + /** @var ContentType $contentType */ $contentType = $options['content_type']; /** @var array> $groupedFields */ @@ -96,7 +96,7 @@ public function createStructure(array $options): ItemInterface /** * @param array> $groupedFields * - * @return array<\Knp\Menu\ItemInterface> + * @return array */ private function getContentFieldGroupItems(array $groupedFields): array { @@ -118,7 +118,7 @@ private function getContentFieldGroupItems(array $groupedFields): array } /** - * @return array<\Knp\Menu\ItemInterface> + * @return array */ private function getMetaFieldItems(ContentType $contentType): array { @@ -186,7 +186,7 @@ private function createSecondLevelItem( } /** - * @return array<\JMS\TranslationBundle\Model\Message> + * @return array */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/ContentEditRightSidebarBuilder.php b/src/lib/Menu/ContentEditRightSidebarBuilder.php index f6f30ecc20..fe02527742 100644 --- a/src/lib/Menu/ContentEditRightSidebarBuilder.php +++ b/src/lib/Menu/ContentEditRightSidebarBuilder.php @@ -8,11 +8,13 @@ namespace Ibexa\AdminUi\Menu; use Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent; +use Ibexa\AdminUi\Siteaccess\NonAdminSiteaccessResolver; use Ibexa\AdminUi\Siteaccess\SiteaccessResolverInterface; use Ibexa\Contracts\AdminUi\Menu\AbstractBuilder; use Ibexa\Contracts\AdminUi\Menu\MenuItemFactoryInterface; use Ibexa\Contracts\Core\Limitation\Target; use Ibexa\Contracts\Core\Repository\Exceptions as ApiExceptions; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Values\Content\Content; @@ -41,16 +43,16 @@ class ContentEditRightSidebarBuilder extends AbstractBuilder implements Translat public const BTN_TRIGGER_CLASS = 'ibexa-btn--trigger'; public const BTN_DISABLED_ATTR = ['disabled' => 'disabled']; - /** @var \Ibexa\AdminUi\Siteaccess\NonAdminSiteaccessResolver */ + /** @var NonAdminSiteaccessResolver */ private $siteaccessResolver; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -80,24 +82,24 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException - * @throws ApiExceptions\BadStateException + * @throws BadStateException * @throws \InvalidArgumentException */ public function createStructure(array $options): ItemInterface { - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $options['location']; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $options['content']; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language $language */ + /** @var Language $language */ $language = $options['language']; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $parentLocation */ + /** @var Location $parentLocation */ $parentLocation = $options['parent_location']; $target = (new Target\Builder\VersionBuilder())->translateToAnyLanguageOf([$language->languageCode])->build(); @@ -187,7 +189,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { @@ -201,15 +203,15 @@ public static function getTranslationMessages(): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language $language - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $parentLocation + * @param Location|null $location + * @param Content $content + * @param Language $language + * @param Location $parentLocation * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws BadStateException + * @throws ApiExceptions\InvalidArgumentException */ private function getContentPreviewItem( ?Location $location, diff --git a/src/lib/Menu/ContentRightSidebarBuilder.php b/src/lib/Menu/ContentRightSidebarBuilder.php index 64fe897c9e..f044f3a199 100644 --- a/src/lib/Menu/ContentRightSidebarBuilder.php +++ b/src/lib/Menu/ContentRightSidebarBuilder.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\Menu; +use Ibexa\AdminUi\Exception\InvalidArgumentException; use Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent; use Ibexa\AdminUi\Siteaccess\SiteaccessResolverInterface; use Ibexa\AdminUi\Specification\ContentType\ContentTypeIsUser; @@ -22,10 +23,13 @@ use Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface; use Ibexa\Contracts\Core\Limitation\Target; use Ibexa\Contracts\Core\Limitation\Target\Builder\VersionBuilder; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use JMS\TranslationBundle\Model\Message; use JMS\TranslationBundle\Translation\TranslationContainerInterface; @@ -54,25 +58,25 @@ class ContentRightSidebarBuilder extends AbstractBuilder implements TranslationC private const CREATE_USER_LABEL = 'sidebar_right.create_user'; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; - /** @var \Ibexa\AdminUi\UniversalDiscovery\ConfigResolver */ + /** @var ConfigResolver */ private $udwConfigResolver; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Ibexa\Bundle\AdminUi\Templating\Twig\UniversalDiscoveryExtension */ + /** @var UniversalDiscoveryExtension */ private $udwExtension; - /** @var \Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface */ + /** @var PermissionCheckerInterface */ private $permissionChecker; - private SiteaccessResolverInterface $siteaccessResolver; + private SiteaccessResolverInterface $siteaccessResolver; public function __construct( MenuItemFactoryInterface $factory, @@ -107,22 +111,22 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws InvalidArgumentException + * @throws BadStateException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ public function createStructure(array $options): ItemInterface { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $options['location']; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType */ + /** @var ContentType $contentType */ $contentType = $options['content_type']; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $options['content']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $startingLocationId = $this->udwConfigResolver->getConfig('default')['starting_location_id']; @@ -317,7 +321,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { @@ -338,12 +342,15 @@ public static function getTranslationMessages(): array } /** - * @param \Knp\Menu\ItemInterface $menu + * @param ItemInterface $menu * @param bool $contentIsUser * @param bool $canEdit */ - private function addEditMenuItem(ItemInterface $menu, bool $contentIsUser, bool $canEdit): void - { + private function addEditMenuItem( + ItemInterface $menu, + bool $contentIsUser, + bool $canEdit + ): void { $editAttributes = [ 'class' => 'ibexa-btn--extra-actions ibexa-btn--edit', 'data-actions' => 'edit', @@ -381,10 +388,12 @@ private function addEditMenuItem(ItemInterface $menu, bool $contentIsUser, bool } /** - * @param \Knp\Menu\ItemInterface $menu + * @param ItemInterface $menu */ - private function addRevealMenuItem(ItemInterface $menu, bool $canHide): void - { + private function addRevealMenuItem( + ItemInterface $menu, + bool $canHide + ): void { $attributes = [ 'class' => 'ibexa-btn--reveal', 'data-actions' => 'reveal', @@ -404,10 +413,12 @@ private function addRevealMenuItem(ItemInterface $menu, bool $canHide): void } /** - * @param \Knp\Menu\ItemInterface $menu + * @param ItemInterface $menu */ - private function addHideMenuItem(ItemInterface $menu, bool $canHide): void - { + private function addHideMenuItem( + ItemInterface $menu, + bool $canHide + ): void { $attributes = [ 'class' => 'ibexa-btn--hide', 'data-actions' => 'hide', @@ -448,8 +459,10 @@ private function canCopy(bool $hasCreatePermission): bool return $hasCreatePermission && $hasManageLocationsPermission; } - private function canCopySubtree(Location $location, bool $hasCreatePermission): bool - { + private function canCopySubtree( + Location $location, + bool $hasCreatePermission + ): bool { if (!$hasCreatePermission) { return false; } @@ -472,7 +485,7 @@ private function getCopySubtreeLimit(): int /** * @param array $options * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws BadStateException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ private function getContentPreviewItem( diff --git a/src/lib/Menu/ContentTypeEditAnchorMenuBuilder.php b/src/lib/Menu/ContentTypeEditAnchorMenuBuilder.php index 5067d48415..a5f804ad69 100644 --- a/src/lib/Menu/ContentTypeEditAnchorMenuBuilder.php +++ b/src/lib/Menu/ContentTypeEditAnchorMenuBuilder.php @@ -47,7 +47,7 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); /** @var \Ibexa\Core\Repository\Values\ContentType\ContentTypeDraft $contentTypeDraft */ @@ -85,7 +85,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return array<\Knp\Menu\ItemInterface> + * @return array */ private function getMetaFieldItems(ContentTypeDraft $contentType): array { @@ -126,7 +126,7 @@ private function createMetaMenuItem( } /** - * @return array<\JMS\TranslationBundle\Model\Message> + * @return array */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/ContentTypeRightSidebarBuilder.php b/src/lib/Menu/ContentTypeRightSidebarBuilder.php index 0c111d83fd..b8a89f7043 100644 --- a/src/lib/Menu/ContentTypeRightSidebarBuilder.php +++ b/src/lib/Menu/ContentTypeRightSidebarBuilder.php @@ -11,7 +11,10 @@ use Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent; use Ibexa\Contracts\AdminUi\Menu\AbstractBuilder; use Ibexa\Contracts\AdminUi\Menu\MenuItemFactoryInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use JMS\TranslationBundle\Model\Message; use JMS\TranslationBundle\Translation\TranslationContainerInterface; use Knp\Menu\ItemInterface; @@ -28,16 +31,16 @@ class ContentTypeRightSidebarBuilder extends AbstractBuilder implements Translat /* Menu items */ public const ITEM__EDIT = 'content_type__sidebar_right__edit'; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; /** - * @param \Ibexa\Contracts\AdminUi\Menu\MenuItemFactoryInterface $factory - * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver + * @param MenuItemFactoryInterface $factory + * @param EventDispatcherInterface $eventDispatcher + * @param PermissionResolver $permissionResolver */ public function __construct( MenuItemFactoryInterface $factory, @@ -62,17 +65,17 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws BadStateException + * @throws InvalidArgumentException */ public function createStructure(array $options): ItemInterface { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType */ + /** @var ContentType $contentType */ $contentType = $options['content_type']; - /** @var \Knp\Menu\ItemInterface $menu */ + /** @var ItemInterface $menu */ $menu = $this->factory->createItem('root'); $editAttributes = [ @@ -100,7 +103,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/Event/ConfigureMenuEvent.php b/src/lib/Menu/Event/ConfigureMenuEvent.php index ae6e3f429c..31244a7371 100644 --- a/src/lib/Menu/Event/ConfigureMenuEvent.php +++ b/src/lib/Menu/Event/ConfigureMenuEvent.php @@ -51,29 +51,32 @@ class ConfigureMenuEvent extends Event public const USER_SETTING_UPDATE_SIDEBAR_RIGHT = 'ezplatform_admin_ui.menu_configure.user_setting_update_sidebar_right'; public const CONTENT_TYPE_SIDEBAR_RIGHT = 'ezplatform_admin_ui.menu_configure.content_type_sidebar_right'; - /** @var \Knp\Menu\FactoryInterface */ + /** @var FactoryInterface */ private $factory; - /** @var \Knp\Menu\ItemInterface */ + /** @var ItemInterface */ private $menu; /** @var array|null */ private $options; /** - * @param \Knp\Menu\FactoryInterface $factory - * @param \Knp\Menu\ItemInterface $menu + * @param FactoryInterface $factory + * @param ItemInterface $menu * @param array $options */ - public function __construct(FactoryInterface $factory, ItemInterface $menu, array $options = []) - { + public function __construct( + FactoryInterface $factory, + ItemInterface $menu, + array $options = [] + ) { $this->factory = $factory; $this->menu = $menu; $this->options = $options; } /** - * @return \Knp\Menu\FactoryInterface + * @return FactoryInterface */ public function getFactory(): FactoryInterface { @@ -81,7 +84,7 @@ public function getFactory(): FactoryInterface } /** - * @return \Knp\Menu\ItemInterface + * @return ItemInterface */ public function getMenu(): ItemInterface { diff --git a/src/lib/Menu/MainMenuBuilder.php b/src/lib/Menu/MainMenuBuilder.php index 861d27a38c..f5545452ba 100644 --- a/src/lib/Menu/MainMenuBuilder.php +++ b/src/lib/Menu/MainMenuBuilder.php @@ -13,6 +13,7 @@ use Ibexa\AdminUi\UserSetting\FocusMode; use Ibexa\Contracts\AdminUi\Menu\AbstractBuilder; use Ibexa\Contracts\AdminUi\Menu\MenuItemFactoryInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\User\UserSetting\UserSettingService; @@ -136,22 +137,22 @@ class MainMenuBuilder extends AbstractBuilder implements TranslationContainerInt ], ]; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface */ + /** @var TokenStorageInterface */ private $tokenStorage; private UserSettingService $userSettingService; /** - * @param \Ibexa\Contracts\AdminUi\Menu\MenuItemFactoryInterface $factory - * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher - * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver + * @param MenuItemFactoryInterface $factory + * @param EventDispatcherInterface $eventDispatcher + * @param ConfigResolverInterface $configResolver + * @param PermissionResolver $permissionResolver */ public function __construct( MenuItemFactoryInterface $factory, @@ -177,15 +178,15 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ public function createStructure(array $options): ItemInterface { $token = $this->tokenStorage->getToken(); - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->createMenuItem('root'); $contentMenu = $menu->addChild(self::ITEM_CONTENT, [ @@ -274,9 +275,9 @@ public function createStructure(array $options): ItemInterface } /** - * @param \Knp\Menu\ItemInterface $menu + * @param ItemInterface $menu * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ private function addContentMenuItems(ItemInterface $menu): void { @@ -345,9 +346,9 @@ private function addContentMenuItems(ItemInterface $menu): void } /** - * @param \Knp\Menu\ItemInterface $menu + * @param ItemInterface $menu * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ private function addAdminMenuItems(ItemInterface $menu): void { diff --git a/src/lib/Menu/MenuItemFactory.php b/src/lib/Menu/MenuItemFactory.php index 08d989f535..314cf9fdf9 100644 --- a/src/lib/Menu/MenuItemFactory.php +++ b/src/lib/Menu/MenuItemFactory.php @@ -15,19 +15,19 @@ class MenuItemFactory implements MenuItemFactoryInterface { - /** @var \Knp\Menu\FactoryInterface */ + /** @var FactoryInterface */ protected $factory; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; /** - * @param \Knp\Menu\FactoryInterface $factory - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService + * @param FactoryInterface $factory + * @param PermissionResolver $permissionResolver + * @param LocationService $locationService */ public function __construct( FactoryInterface $factory, @@ -46,10 +46,13 @@ public function __construct( * @param int $locationId * @param array $options * - * @return \Knp\Menu\ItemInterface|null + * @return ItemInterface|null */ - public function createLocationMenuItem(string $name, int $locationId, array $options = []): ?ItemInterface - { + public function createLocationMenuItem( + string $name, + int $locationId, + array $options = [] + ): ?ItemInterface { try { $location = $this->locationService->loadLocation($locationId); $contentInfo = $location->getContentInfo(); @@ -69,8 +72,10 @@ public function createLocationMenuItem(string $name, int $locationId, array $opt return $this->createItem($name, array_merge_recursive($defaults, $options)); } - public function createItem($name, array $options = []): ItemInterface - { + public function createItem( + $name, + array $options = [] + ): ItemInterface { if (empty($options['extras']['translation_domain'])) { $options['extras']['translation_domain'] = 'ibexa_menu'; } diff --git a/src/lib/Menu/SectionCreateRightSidebarBuilder.php b/src/lib/Menu/SectionCreateRightSidebarBuilder.php index 7b64ab0130..14796d09a4 100644 --- a/src/lib/Menu/SectionCreateRightSidebarBuilder.php +++ b/src/lib/Menu/SectionCreateRightSidebarBuilder.php @@ -29,7 +29,7 @@ class SectionCreateRightSidebarBuilder extends AbstractBuilder implements Transl public const ITEM__CREATE_AND_EDIT = 'section_create__sidebar_right__create_and_edit'; public const ITEM__CANCEL = 'section_create__sidebar_right__cancel'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -53,7 +53,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -61,7 +61,7 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $createItem = $this->createMenuItem( @@ -98,7 +98,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/SectionEditRightSidebarBuilder.php b/src/lib/Menu/SectionEditRightSidebarBuilder.php index b88974f396..b320920739 100644 --- a/src/lib/Menu/SectionEditRightSidebarBuilder.php +++ b/src/lib/Menu/SectionEditRightSidebarBuilder.php @@ -30,7 +30,7 @@ class SectionEditRightSidebarBuilder extends AbstractBuilder implements Translat public const ITEM__SAVE_AND_CLOSE = 'section_edit__sidebar_right__save_and_close'; public const ITEM__CANCEL = 'section_edit__sidebar_right__cancel'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -54,7 +54,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -62,10 +62,10 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section $section */ + /** @var Section $section */ $section = $options['section']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $saveAndCloseItem = $this->createMenuItem( @@ -102,7 +102,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/TrashRightSidebarBuilder.php b/src/lib/Menu/TrashRightSidebarBuilder.php index 868878cf2f..893080e146 100644 --- a/src/lib/Menu/TrashRightSidebarBuilder.php +++ b/src/lib/Menu/TrashRightSidebarBuilder.php @@ -30,13 +30,13 @@ class TrashRightSidebarBuilder extends AbstractBuilder implements TranslationCon /* Menu items */ public const ITEM__EMPTY = 'trash__sidebar_right__empty_trash'; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\TrashService */ + /** @var TrashService */ private $trashService; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -64,7 +64,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -76,7 +76,7 @@ public function createStructure(array $options): ItemInterface $canDelete = $this->permissionResolver->hasAccess('content', 'cleantrash'); /** @var int $trashItemsCount */ $trashItemsCount = $this->trashService->findTrashItems(new Query())->count; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $trashEmptyAttributes = [ diff --git a/src/lib/Menu/URLEditRightSidebarBuilder.php b/src/lib/Menu/URLEditRightSidebarBuilder.php index 8e4d22064f..363e2d9f7d 100644 --- a/src/lib/Menu/URLEditRightSidebarBuilder.php +++ b/src/lib/Menu/URLEditRightSidebarBuilder.php @@ -10,6 +10,7 @@ use Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent; use Ibexa\Contracts\AdminUi\Menu\AbstractBuilder; use Ibexa\Contracts\AdminUi\Menu\MenuItemFactoryInterface; +use Ibexa\Contracts\Core\Repository\Values\URL\URL; use JMS\TranslationBundle\Model\Message; use JMS\TranslationBundle\Translation\TranslationContainerInterface; use Knp\Menu\ItemInterface; @@ -23,7 +24,7 @@ class URLEditRightSidebarBuilder extends AbstractBuilder implements TranslationC public const ITEM__SAVE_AND_CLOSE = 'url_edit__sidebar_right__save_and_close'; public const ITEM__CANCEL = 'url_edit__sidebar_right__cancel'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -43,10 +44,10 @@ protected function getConfigureEventName(): string protected function createStructure(array $options): ItemInterface { - /** @var \Ibexa\Contracts\Core\Repository\Values\URL\URL $url */ + /** @var URL $url */ $url = $options['url']; - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $saveAndCloseItem = $this->createMenuItem( diff --git a/src/lib/Menu/URLWildcardEditRightSidebarBuilder.php b/src/lib/Menu/URLWildcardEditRightSidebarBuilder.php index 08333198ef..821daf913a 100644 --- a/src/lib/Menu/URLWildcardEditRightSidebarBuilder.php +++ b/src/lib/Menu/URLWildcardEditRightSidebarBuilder.php @@ -24,13 +24,13 @@ final class URLWildcardEditRightSidebarBuilder extends AbstractBuilder implement public const ITEM__SAVE_AND_CLOSE = 'url_wildcard_edit__sidebar_right__save_and_close'; public const ITEM__CANCEL = 'url_wildcard_edit__sidebar_right__cancel'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; /** - * @param \Ibexa\Contracts\AdminUi\Menu\MenuItemFactoryInterface $menuItemFactory - * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher - * @param \Symfony\Contracts\Translation\TranslatorInterface $translator + * @param MenuItemFactoryInterface $menuItemFactory + * @param EventDispatcherInterface $eventDispatcher + * @param TranslatorInterface $translator */ public function __construct( MenuItemFactoryInterface $menuItemFactory, @@ -58,7 +58,7 @@ protected function getConfigureEventName(): string protected function createStructure(array $options): ItemInterface { - /** @var \Knp\Menu\ItemInterface $menu */ + /** @var ItemInterface $menu */ $menu = $this->factory->createItem('root'); $saveAndCloseItem = $this->createMenuItem( diff --git a/src/lib/Menu/UserCreateRightSidebarBuilder.php b/src/lib/Menu/UserCreateRightSidebarBuilder.php index f1ca3e4245..6d5abea2a5 100644 --- a/src/lib/Menu/UserCreateRightSidebarBuilder.php +++ b/src/lib/Menu/UserCreateRightSidebarBuilder.php @@ -36,7 +36,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -44,7 +44,7 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $menu->setChildren([ @@ -72,7 +72,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/UserEditRightSidebarBuilder.php b/src/lib/Menu/UserEditRightSidebarBuilder.php index aa5586dd95..8a70d0cb09 100644 --- a/src/lib/Menu/UserEditRightSidebarBuilder.php +++ b/src/lib/Menu/UserEditRightSidebarBuilder.php @@ -36,7 +36,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -44,7 +44,7 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $menu->setChildren([ @@ -72,7 +72,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/UserMenuBuilder.php b/src/lib/Menu/UserMenuBuilder.php index bbf69c68e3..015836171c 100644 --- a/src/lib/Menu/UserMenuBuilder.php +++ b/src/lib/Menu/UserMenuBuilder.php @@ -13,6 +13,7 @@ use Ibexa\AdminUi\UserProfile\UserProfileConfigurationInterface; use Ibexa\Contracts\AdminUi\Menu\AbstractBuilder; use Ibexa\Contracts\AdminUi\Menu\MenuItemFactoryInterface; +use Ibexa\Core\MVC\Symfony\Security\User; use JMS\TranslationBundle\Model\Message; use JMS\TranslationBundle\Translation\TranslationContainerInterface; use Knp\Menu\ItemInterface; @@ -32,7 +33,7 @@ class UserMenuBuilder extends AbstractBuilder implements TranslationContainerInt public const ITEM_BOOKMARK = 'user__bookmark'; public const ITEM_NOTIFICATION = 'menu.notification'; - /** @var \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface */ + /** @var TokenStorageInterface */ private $tokenStorage; private UserProfileConfigurationInterface $userProfileConfiguration; @@ -60,7 +61,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException */ @@ -70,7 +71,7 @@ public function createStructure(array $options): ItemInterface $token = $this->tokenStorage->getToken(); if (null !== $token && is_object($token->getUser())) { - /** @var \Ibexa\Core\MVC\Symfony\Security\User $user */ + /** @var User $user */ $user = $token->getUser(); if ((new IsProfileAvailable($this->userProfileConfiguration))->isSatisfiedBy($user->getAPIUser())) { diff --git a/src/lib/Menu/UserPasswordChangeRightSidebarBuilder.php b/src/lib/Menu/UserPasswordChangeRightSidebarBuilder.php index df2013bb17..6f228349ac 100644 --- a/src/lib/Menu/UserPasswordChangeRightSidebarBuilder.php +++ b/src/lib/Menu/UserPasswordChangeRightSidebarBuilder.php @@ -29,7 +29,7 @@ class UserPasswordChangeRightSidebarBuilder extends AbstractBuilder implements T public const ITEM__UPDATE = 'user_password_change__sidebar_right__update'; public const ITEM__CANCEL = 'user_password_change__sidebar_right__cancel'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -53,7 +53,7 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException * @throws ApiExceptions\BadStateException @@ -61,7 +61,7 @@ protected function getConfigureEventName(): string */ public function createStructure(array $options): ItemInterface { - /** @var \Knp\Menu\ItemInterface $menu */ + /** @var ItemInterface $menu */ $menu = $this->factory->createItem('root'); $menu->setChildren([ @@ -89,7 +89,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Menu/UserSetting/UserSettingUpdateRightSidebarBuilder.php b/src/lib/Menu/UserSetting/UserSettingUpdateRightSidebarBuilder.php index 283352721c..ab6afe4a14 100644 --- a/src/lib/Menu/UserSetting/UserSettingUpdateRightSidebarBuilder.php +++ b/src/lib/Menu/UserSetting/UserSettingUpdateRightSidebarBuilder.php @@ -29,7 +29,7 @@ class UserSettingUpdateRightSidebarBuilder extends AbstractBuilder implements Tr public const ITEM__SAVE_AND_EDIT = 'user_setting_update__sidebar_right__save_end_edit'; public const ITEM__CANCEL = 'user_setting_update__sidebar_right__cancel'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -53,13 +53,13 @@ protected function getConfigureEventName(): string /** * @param array $options * - * @return \Knp\Menu\ItemInterface + * @return ItemInterface * * @throws \InvalidArgumentException */ public function createStructure(array $options): ItemInterface { - /** @var \Knp\Menu\ItemInterface|\Knp\Menu\ItemInterface[] $menu */ + /** @var ItemInterface|ItemInterface[] $menu */ $menu = $this->factory->createItem('root'); $saveItem = $this->createMenuItem( @@ -99,7 +99,7 @@ public function createStructure(array $options): ItemInterface } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/Notification/FlashBagNotificationHandler.php b/src/lib/Notification/FlashBagNotificationHandler.php index 46a3dbddbb..5f80a9efcb 100644 --- a/src/lib/Notification/FlashBagNotificationHandler.php +++ b/src/lib/Notification/FlashBagNotificationHandler.php @@ -19,12 +19,12 @@ final class FlashBagNotificationHandler implements NotificationHandlerInterface private const TYPE_ERROR = 'error'; /** - * @var \Symfony\Component\HttpFoundation\Session\SessionInterface + * @var SessionInterface */ private $session; /** - * @param \Symfony\Component\HttpFoundation\Session\SessionInterface $session + * @param SessionInterface $session */ public function __construct(SessionInterface $session) { diff --git a/src/lib/Notification/TranslatableNotificationHandler.php b/src/lib/Notification/TranslatableNotificationHandler.php index 15e5cf7704..f544174b55 100644 --- a/src/lib/Notification/TranslatableNotificationHandler.php +++ b/src/lib/Notification/TranslatableNotificationHandler.php @@ -15,10 +15,10 @@ final class TranslatableNotificationHandler implements TranslatableNotificationHandlerInterface, ActionResultHandler { - /** @var \Ibexa\Contracts\AdminUi\Notification\NotificationHandlerInterface */ + /** @var NotificationHandlerInterface */ private $notificationHandler; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct( @@ -29,8 +29,12 @@ public function __construct( $this->translator = $translator; } - public function info(string $message, array $parameters = [], ?string $domain = null, ?string $locale = null): void - { + public function info( + string $message, + array $parameters = [], + ?string $domain = null, + ?string $locale = null + ): void { $translatedMessage = $this->translator->trans( /** @Ignore */ $message, @@ -43,8 +47,12 @@ public function info(string $message, array $parameters = [], ?string $domain = ); } - public function success(string $message, array $parameters = [], ?string $domain = null, ?string $locale = null): void - { + public function success( + string $message, + array $parameters = [], + ?string $domain = null, + ?string $locale = null + ): void { $translatedMessage = $this->translator->trans( /** @Ignore */ $message, @@ -57,8 +65,12 @@ public function success(string $message, array $parameters = [], ?string $domain ); } - public function warning(string $message, array $parameters = [], ?string $domain = null, ?string $locale = null): void - { + public function warning( + string $message, + array $parameters = [], + ?string $domain = null, + ?string $locale = null + ): void { $translatedMessage = $this->translator->trans( /** @Ignore */ $message, @@ -71,8 +83,12 @@ public function warning(string $message, array $parameters = [], ?string $domain ); } - public function error(string $message, array $parameters = [], ?string $domain = null, ?string $locale = null): void - { + public function error( + string $message, + array $parameters = [], + ?string $domain = null, + ?string $locale = null + ): void { $translatedMessage = $this->translator->trans( /** @Ignore */ $message, diff --git a/src/lib/Pagination/Mapper/AbstractPagerContentToDataMapper.php b/src/lib/Pagination/Mapper/AbstractPagerContentToDataMapper.php index 1319c81fd7..adbe2b29e3 100644 --- a/src/lib/Pagination/Mapper/AbstractPagerContentToDataMapper.php +++ b/src/lib/Pagination/Mapper/AbstractPagerContentToDataMapper.php @@ -16,25 +16,26 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Repository\Values\User\User; use Ibexa\Core\Helper\TranslationHelper; use Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface; abstract class AbstractPagerContentToDataMapper { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ + /** @var UserLanguagePreferenceProviderInterface */ private $userLanguagePreferenceProvider; - /** @var \Ibexa\Core\Helper\TranslationHelper */ + /** @var TranslationHelper */ protected $translationHelper; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; public function __construct( @@ -52,10 +53,10 @@ public function __construct( } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param Content $content * @param bool $filterDisabled * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language[] + * @return Language[] */ protected function getAvailableTranslations( Content $content, @@ -78,7 +79,7 @@ protected function getAvailableTranslations( } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param Content $content * * @return bool */ @@ -88,9 +89,9 @@ protected function isContentIsUser(Content $content): bool } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo + * @param VersionInfo $versionInfo * - * @return \Ibexa\Contracts\Core\Repository\Values\User\User|null + * @return User|null */ protected function getVersionContributor(VersionInfo $versionInfo): ?User { @@ -105,8 +106,10 @@ protected function getVersionContributor(VersionInfo $versionInfo): ?User * @param array $data * @param int[] $contentTypeIds */ - protected function setTranslatedContentTypesNames(array &$data, array $contentTypeIds): void - { + protected function setTranslatedContentTypesNames( + array &$data, + array $contentTypeIds + ): void { // load list of content types with proper translated names $contentTypes = $this->contentTypeService->loadContentTypeList( array_unique($contentTypeIds), @@ -116,7 +119,7 @@ protected function setTranslatedContentTypesNames(array &$data, array $contentTy foreach ($data as $idx => $item) { // get content type from bulk-loaded list or fallback to lazy loaded one if not present $contentTypeId = $item['contentTypeId']; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType */ + /** @var ContentType $contentType */ $contentType = $contentTypes[$contentTypeId] ?? $item['content']->getContentType(); $data[$idx]['type'] = $contentType->getName(); diff --git a/src/lib/Pagination/Pagerfanta/BookmarkAdapter.php b/src/lib/Pagination/Pagerfanta/BookmarkAdapter.php index dcfbb201db..cdfbdb08c9 100644 --- a/src/lib/Pagination/Pagerfanta/BookmarkAdapter.php +++ b/src/lib/Pagination/Pagerfanta/BookmarkAdapter.php @@ -10,22 +10,25 @@ use Ibexa\AdminUi\UI\Dataset\DatasetFactory; use Ibexa\Contracts\Core\Repository\BookmarkService; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Pagerfanta\Adapter\AdapterInterface; class BookmarkAdapter implements AdapterInterface { - /** @var \Ibexa\Contracts\Core\Repository\BookmarkService */ + /** @var BookmarkService */ private $bookmarkService; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ + /** @var DatasetFactory */ private $datasetFactory; /** - * @param \Ibexa\Contracts\Core\Repository\BookmarkService $bookmarkService - * @param \Ibexa\AdminUi\UI\Dataset\DatasetFactory $datasetFactory + * @param BookmarkService $bookmarkService + * @param DatasetFactory $datasetFactory */ - public function __construct(BookmarkService $bookmarkService, DatasetFactory $datasetFactory) - { + public function __construct( + BookmarkService $bookmarkService, + DatasetFactory $datasetFactory + ) { $this->bookmarkService = $bookmarkService; $this->datasetFactory = $datasetFactory; } @@ -35,7 +38,7 @@ public function __construct(BookmarkService $bookmarkService, DatasetFactory $da * * @return int the number of results * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ public function getNbResults() { @@ -50,10 +53,12 @@ public function getNbResults() * * @return array|\Traversable the slice * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ - public function getSlice($offset, $length) - { + public function getSlice( + $offset, + $length + ) { return $this->datasetFactory ->bookmarks() ->load($offset, $length) diff --git a/src/lib/Pagination/Pagerfanta/ContentDraftAdapter.php b/src/lib/Pagination/Pagerfanta/ContentDraftAdapter.php index 5614f01d19..6e754f4ba6 100644 --- a/src/lib/Pagination/Pagerfanta/ContentDraftAdapter.php +++ b/src/lib/Pagination/Pagerfanta/ContentDraftAdapter.php @@ -10,22 +10,25 @@ use Ibexa\AdminUi\UI\Dataset\DatasetFactory; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Pagerfanta\Adapter\AdapterInterface; final class ContentDraftAdapter implements AdapterInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ + /** @var DatasetFactory */ private $datasetFactory; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\AdminUi\UI\Dataset\DatasetFactory $datasetFactory + * @param ContentService $contentService + * @param DatasetFactory $datasetFactory */ - public function __construct(ContentService $contentService, DatasetFactory $datasetFactory) - { + public function __construct( + ContentService $contentService, + DatasetFactory $datasetFactory + ) { $this->contentService = $contentService; $this->datasetFactory = $datasetFactory; } @@ -35,7 +38,7 @@ public function __construct(ContentService $contentService, DatasetFactory $data * * @return int the number of results * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ public function getNbResults() { @@ -50,10 +53,12 @@ public function getNbResults() * * @return array|\Traversable the slice * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ - public function getSlice($offset, $length) - { + public function getSlice( + $offset, + $length + ) { return $this->datasetFactory ->contentDraftList() ->load(null, $offset, $length) diff --git a/src/lib/Pagination/Pagerfanta/NotificationAdapter.php b/src/lib/Pagination/Pagerfanta/NotificationAdapter.php index ed8d5b1c0f..15ff643aff 100644 --- a/src/lib/Pagination/Pagerfanta/NotificationAdapter.php +++ b/src/lib/Pagination/Pagerfanta/NotificationAdapter.php @@ -56,10 +56,12 @@ public function getNbResults(): int * @param int $offset the offset * @param int $length the length * - * @return \Ibexa\Contracts\Core\Repository\Values\Notification\NotificationList + * @return NotificationList */ - public function getSlice($offset, $length): NotificationList - { + public function getSlice( + $offset, + $length + ): NotificationList { $query = clone $this->query; $query->setOffset($offset); $query->setLimit($length); diff --git a/src/lib/Pagination/Pagerfanta/RelationAdapter.php b/src/lib/Pagination/Pagerfanta/RelationAdapter.php index 81ba2a1a3b..8ecdfe89d3 100644 --- a/src/lib/Pagination/Pagerfanta/RelationAdapter.php +++ b/src/lib/Pagination/Pagerfanta/RelationAdapter.php @@ -9,7 +9,9 @@ namespace Ibexa\AdminUi\Pagination\Pagerfanta; use Ibexa\AdminUi\UI\Dataset\DatasetFactory; +use Ibexa\AdminUi\UI\Value\Content\RelationInterface; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Pagerfanta\Adapter\AdapterInterface; @@ -37,12 +39,14 @@ public function getNbResults(): int } /** - * @return \Ibexa\AdminUi\UI\Value\Content\RelationInterface[] + * @return RelationInterface[] * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException */ - public function getSlice($offset, $length): array - { + public function getSlice( + $offset, + $length + ): array { return $this->datasetFactory ->relationList() ->load($this->content, $offset, $length) diff --git a/src/lib/Pagination/Pagerfanta/ReverseRelationAdapter.php b/src/lib/Pagination/Pagerfanta/ReverseRelationAdapter.php index ec9ff5d288..c78aa7b3ba 100644 --- a/src/lib/Pagination/Pagerfanta/ReverseRelationAdapter.php +++ b/src/lib/Pagination/Pagerfanta/ReverseRelationAdapter.php @@ -15,19 +15,19 @@ final class ReverseRelationAdapter implements AdapterInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ + /** @var DatasetFactory */ private $datasetFactory; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ + /** @var Content */ private $content; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\AdminUi\UI\Dataset\DatasetFactory $datasetFactory - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param ContentService $contentService + * @param DatasetFactory $datasetFactory + * @param Content $content */ public function __construct( ContentService $contentService, @@ -57,8 +57,10 @@ public function getNbResults() * * @return array|\Traversable the slice */ - public function getSlice($offset, $length) - { + public function getSlice( + $offset, + $length + ) { return $this->datasetFactory ->reverseRelationList() ->load($this->content, $offset, $length) diff --git a/src/lib/Pagination/Pagerfanta/RoleAssignmentsSearchAdapter.php b/src/lib/Pagination/Pagerfanta/RoleAssignmentsSearchAdapter.php index 52ba335cc7..0583fd5184 100644 --- a/src/lib/Pagination/Pagerfanta/RoleAssignmentsSearchAdapter.php +++ b/src/lib/Pagination/Pagerfanta/RoleAssignmentsSearchAdapter.php @@ -8,32 +8,38 @@ namespace Ibexa\AdminUi\Pagination\Pagerfanta; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\RoleService; use Ibexa\Contracts\Core\Repository\Values\User\Role; use Pagerfanta\Adapter\AdapterInterface; final class RoleAssignmentsSearchAdapter implements AdapterInterface { - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ private $roleService; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role */ + /** @var Role */ private $role; /** @var int|null */ private $assignmentsCount; - public function __construct(RoleService $roleService, Role $role, ?int $assignmentsCount = null) - { + public function __construct( + RoleService $roleService, + Role $role, + ?int $assignmentsCount = null + ) { $this->roleService = $roleService; $this->role = $role; $this->assignmentsCount = $assignmentsCount; } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws BadStateException + * @throws InvalidArgumentException + * @throws UnauthorizedException */ public function getNbResults(): int { @@ -41,12 +47,14 @@ public function getNbResults(): int } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws BadStateException + * @throws InvalidArgumentException + * @throws UnauthorizedException */ - public function getSlice($offset, $length): iterable - { + public function getSlice( + $offset, + $length + ): iterable { return $this->roleService->loadRoleAssignments($this->role, $offset, $length); } } diff --git a/src/lib/Pagination/Pagerfanta/TrashItemAdapter.php b/src/lib/Pagination/Pagerfanta/TrashItemAdapter.php index f1ae1e71ad..24506c07ab 100644 --- a/src/lib/Pagination/Pagerfanta/TrashItemAdapter.php +++ b/src/lib/Pagination/Pagerfanta/TrashItemAdapter.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Repository\TrashService; use Ibexa\Contracts\Core\Repository\Values\Content\Query; +use Ibexa\Contracts\Core\Repository\Values\ValueObject; use Pagerfanta\Adapter\AdapterInterface; /** @@ -18,12 +19,12 @@ class TrashItemAdapter implements AdapterInterface { /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Query + * @var Query */ private $query; /** - * @var \Ibexa\Contracts\Core\Repository\TrashService + * @var TrashService */ private $trashService; @@ -32,8 +33,10 @@ class TrashItemAdapter implements AdapterInterface */ private $nbResults; - public function __construct(Query $query, TrashService $trashService) - { + public function __construct( + Query $query, + TrashService $trashService + ) { $this->query = $query; $this->trashService = $trashService; } @@ -61,10 +64,12 @@ public function getNbResults() * @param int $offset the offset * @param int $length the length * - * @return \Ibexa\Contracts\Core\Repository\Values\ValueObject[] + * @return ValueObject[] */ - public function getSlice($offset, $length): array - { + public function getSlice( + $offset, + $length + ): array { $query = clone $this->query; $query->offset = $offset; $query->limit = $length; diff --git a/src/lib/Pagination/Pagerfanta/URLSearchAdapter.php b/src/lib/Pagination/Pagerfanta/URLSearchAdapter.php index 1bbfff08e4..e5acc4b9de 100644 --- a/src/lib/Pagination/Pagerfanta/URLSearchAdapter.php +++ b/src/lib/Pagination/Pagerfanta/URLSearchAdapter.php @@ -8,29 +8,32 @@ namespace Ibexa\AdminUi\Pagination\Pagerfanta; use Ibexa\Contracts\Core\Repository\URLService; +use Ibexa\Contracts\Core\Repository\Values\URL\URL; use Ibexa\Contracts\Core\Repository\Values\URL\URLQuery; use Pagerfanta\Adapter\AdapterInterface; class URLSearchAdapter implements AdapterInterface { /** - * @var \Ibexa\Contracts\Core\Repository\Values\URL\URLQuery + * @var URLQuery */ private $query; /** - * @var \Ibexa\Contracts\Core\Repository\URLService + * @var URLService */ private $urlService; /** * UrlSearchAdapter constructor. * - * @param \Ibexa\Contracts\Core\Repository\Values\URL\URLQuery $query - * @param \Ibexa\Contracts\Core\Repository\URLService $urlService + * @param URLQuery $query + * @param URLService $urlService */ - public function __construct(URLQuery $query, URLService $urlService) - { + public function __construct( + URLQuery $query, + URLService $urlService + ) { $this->query = $query; $this->urlService = $urlService; } @@ -50,10 +53,12 @@ public function getNbResults(): int /** * {@inheritdoc} * - * @return \Ibexa\Contracts\Core\Repository\Values\URL\URL[] + * @return URL[] */ - public function getSlice($offset, $length): array - { + public function getSlice( + $offset, + $length + ): array { $query = clone $this->query; $query->offset = $offset; $query->limit = $length; diff --git a/src/lib/Pagination/Pagerfanta/URLUsagesAdapter.php b/src/lib/Pagination/Pagerfanta/URLUsagesAdapter.php index f260882c2d..a1a612d7a0 100644 --- a/src/lib/Pagination/Pagerfanta/URLUsagesAdapter.php +++ b/src/lib/Pagination/Pagerfanta/URLUsagesAdapter.php @@ -8,27 +8,30 @@ namespace Ibexa\AdminUi\Pagination\Pagerfanta; use Ibexa\Contracts\Core\Repository\URLService; +use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\URL\URL; use Pagerfanta\Adapter\AdapterInterface; class URLUsagesAdapter implements AdapterInterface { /** - * @var \Ibexa\Contracts\Core\Repository\URLService + * @var URLService */ private $urlService; /** - * @var \Ibexa\Contracts\Core\Repository\Values\URL\URL + * @var URL */ private $url; /** - * @param \Ibexa\Contracts\Core\Repository\Values\URL\URL $url - * @param \Ibexa\Contracts\Core\Repository\URLService $urlService + * @param URL $url + * @param URLService $urlService */ - public function __construct(URL $url, URLService $urlService) - { + public function __construct( + URL $url, + URLService $urlService + ) { $this->urlService = $urlService; $this->url = $url; } @@ -44,10 +47,12 @@ public function getNbResults(): int /** * {@inheritdoc} * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo[] + * @return ContentInfo[] */ - public function getSlice($offset, $length): array - { + public function getSlice( + $offset, + $length + ): array { return $this->urlService->findUsages($this->url, $offset, $length)->items; } } diff --git a/src/lib/Pagination/Pagerfanta/URLWildcardAdapter.php b/src/lib/Pagination/Pagerfanta/URLWildcardAdapter.php index d0830b3a83..4847fcb574 100644 --- a/src/lib/Pagination/Pagerfanta/URLWildcardAdapter.php +++ b/src/lib/Pagination/Pagerfanta/URLWildcardAdapter.php @@ -7,23 +7,27 @@ namespace Ibexa\AdminUi\Pagination\Pagerfanta; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\URLWildcardService; +use Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard; use Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard\URLWildcardQuery; use Pagerfanta\Adapter\AdapterInterface; final class URLWildcardAdapter implements AdapterInterface { - /** @var \Ibexa\Contracts\Core\Repository\URLWildcardService */ + /** @var URLWildcardService */ private $urlWildcardService; /** @var int */ private $nbResults; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard\URLWildcardQuery */ + /** @var URLWildcardQuery */ private $query; - public function __construct(URLWildcardQuery $query, URLWildcardService $urlWildcardService) - { + public function __construct( + URLWildcardQuery $query, + URLWildcardService $urlWildcardService + ) { $this->query = $query; $this->urlWildcardService = $urlWildcardService; } @@ -31,7 +35,7 @@ public function __construct(URLWildcardQuery $query, URLWildcardService $urlWild /** * {@inheritdoc} * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException */ public function getNbResults(): int { @@ -45,12 +49,14 @@ public function getNbResults(): int /** * {@inheritdoc} * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard[] + * @return URLWildcard[] * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException */ - public function getSlice($offset, $length): array - { + public function getSlice( + $offset, + $length + ): array { $query = clone $this->query; $query->offset = $offset; $query->limit = $length; diff --git a/src/lib/Permission/LimitationResolver.php b/src/lib/Permission/LimitationResolver.php index 9fe601ce6e..eb06ddc7e8 100644 --- a/src/lib/Permission/LimitationResolver.php +++ b/src/lib/Permission/LimitationResolver.php @@ -126,8 +126,10 @@ public function getLanguageLimitations( /** * @param array $limitationLanguageCodes */ - private function hasAccessToLanguage(Language $language, array $limitationLanguageCodes): bool - { + private function hasAccessToLanguage( + Language $language, + array $limitationLanguageCodes + ): bool { return $language->isEnabled() && ( empty($limitationLanguageCodes) @@ -154,7 +156,7 @@ private function getContentTypeIds(): array } /** - * @param iterable<\Ibexa\Contracts\Core\Repository\Values\Content\Language>|null $languages + * @param iterable|null $languages * * @return array */ diff --git a/src/lib/Permission/LimitationResolverInterface.php b/src/lib/Permission/LimitationResolverInterface.php index 7ba4692e86..1018662825 100644 --- a/src/lib/Permission/LimitationResolverInterface.php +++ b/src/lib/Permission/LimitationResolverInterface.php @@ -8,6 +8,10 @@ namespace Ibexa\AdminUi\Permission; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\User\LookupLimitationResult; use Ibexa\Contracts\Core\Repository\Values\ValueObject; @@ -18,22 +22,22 @@ interface LimitationResolverInterface { /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws BadStateException + * @throws InvalidArgumentException + * @throws NotFoundException */ public function getContentCreateLimitations(Location $parentLocation): LookupLimitationResult; /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws BadStateException + * @throws InvalidArgumentException + * @throws NotFoundException */ public function getContentUpdateLimitations(Location $parentLocation): LookupLimitationResult; /** - * @param iterable<\Ibexa\Contracts\Core\Repository\Values\Content\Language> $languages - * @param array<\Ibexa\Contracts\Core\Repository\Values\ValueObject> $targets + * @param iterable $languages + * @param array $targets * * @return arraylimitationValues; } - /** @var \Ibexa\Contracts\Core\Repository\Values\User\LookupPolicyLimitations $lookupPolicyLimitation */ + /** @var LookupPolicyLimitations $lookupPolicyLimitation */ foreach ($lookupLimitations->lookupPolicyLimitations as $lookupPolicyLimitation) { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation */ + /** @var Limitation $limitation */ foreach ($lookupPolicyLimitation->limitations as $limitation) { $limitationsValues[] = $limitation->limitationValues; } @@ -41,12 +43,12 @@ public function getFlattenedLimitationsValues(LookupLimitationResult $lookupLimi } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\LookupLimitationResult $lookupLimitations + * @param LookupLimitationResult $lookupLimitations * @param string[] $limitationsIdentifiers * * @return array * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function getGroupedLimitationValues( LookupLimitationResult $lookupLimitations, @@ -68,7 +70,7 @@ public function getGroupedLimitationValues( } foreach ($lookupLimitations->lookupPolicyLimitations as $lookupPolicyLimitation) { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Limitation $limitation */ + /** @var Limitation $limitation */ foreach ($lookupPolicyLimitation->limitations as $limitation) { if (\in_array($limitation->getIdentifier(), $limitationsIdentifiers, true)) { $groupedLimitationsValues[$limitation->getIdentifier()][] = $limitation->limitationValues; diff --git a/src/lib/Permission/PermissionChecker.php b/src/lib/Permission/PermissionChecker.php index 6728b7d682..0461008e58 100644 --- a/src/lib/Permission/PermissionChecker.php +++ b/src/lib/Permission/PermissionChecker.php @@ -9,6 +9,8 @@ namespace Ibexa\AdminUi\Permission; use Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\Location; @@ -20,16 +22,17 @@ use Ibexa\Contracts\Core\Repository\Values\User\Limitation\SectionLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\SubtreeLimitation; use Ibexa\Contracts\Core\Repository\Values\User\LookupLimitationResult; +use Ibexa\Contracts\Core\Repository\Values\User\Policy; use Ibexa\Contracts\Core\Repository\Values\User\User; class PermissionChecker implements PermissionCheckerInterface { private const USER_GROUPS_LIMIT = 25; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; private LimitationResolverInterface $limitationResolver; @@ -50,8 +53,10 @@ public function __construct( * * @return array */ - public function getRestrictions(array $hasAccess, string $class): array - { + public function getRestrictions( + array $hasAccess, + string $class + ): array { $restrictions = []; $oneOfPoliciesHasNoLimitation = false; @@ -76,16 +81,18 @@ public function getRestrictions(array $hasAccess, string $class): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * @param array|bool $hasAccess * * @return bool * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ - public function canCreateInLocation(Location $location, $hasAccess): bool - { + public function canCreateInLocation( + Location $location, + $hasAccess + ): bool { if (\is_bool($hasAccess)) { return $hasAccess; } @@ -193,7 +200,7 @@ private function flattenArrayOfLimitationsForCurrentUser(array $hasAccess): arra $limitations = []; foreach ($hasAccess as $permissionSet) { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Policy $policy */ + /** @var Policy $policy */ foreach ($permissionSet['policies'] as $policy) { $policyLimitations = $policy->getLimitations(); if (!empty($policyLimitations)) { @@ -211,12 +218,12 @@ private function flattenArrayOfLimitationsForCurrentUser(array $hasAccess): arra } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * * @return bool * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ private function hasSameParentUserGroup(Location $location): bool { @@ -232,11 +239,11 @@ private function hasSameParentUserGroup(Location $location): bool } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\User $user + * @param User $user * * @return int[] * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException */ private function loadAllUserGroupsIdsOfUser(User $user): array { diff --git a/src/lib/QueryType/LocationPathQueryType.php b/src/lib/QueryType/LocationPathQueryType.php index 5f2450cb85..b2b58d41ee 100644 --- a/src/lib/QueryType/LocationPathQueryType.php +++ b/src/lib/QueryType/LocationPathQueryType.php @@ -34,7 +34,7 @@ protected function configureOptions(OptionsResolver $optionsResolver): void protected function doGetQuery(array $parameters): Query { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $parameters['location']; /** @var int $rootLocationId */ $rootLocationId = $parameters['rootLocationId']; diff --git a/src/lib/QueryType/LocationSubtreeQueryType.php b/src/lib/QueryType/LocationSubtreeQueryType.php index 8a93e5406f..e349a6259a 100644 --- a/src/lib/QueryType/LocationSubtreeQueryType.php +++ b/src/lib/QueryType/LocationSubtreeQueryType.php @@ -20,10 +20,10 @@ abstract class LocationSubtreeQueryType extends OptionsResolverBasedQueryType protected const OWNED_OPTION_NAME = 'owned'; protected const SUBTREE_OPTION_NAME = 'subtree'; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ protected $configResolver; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; public function __construct( diff --git a/src/lib/QueryType/SubtreeQueryType.php b/src/lib/QueryType/SubtreeQueryType.php index 9738c45aac..4e81704b2c 100644 --- a/src/lib/QueryType/SubtreeQueryType.php +++ b/src/lib/QueryType/SubtreeQueryType.php @@ -19,10 +19,10 @@ abstract class SubtreeQueryType extends OptionsResolverBasedQueryType implements protected const OWNED_OPTION_NAME = 'owned'; protected const SUBTREE_OPTION_NAME = 'subtree'; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ protected $configResolver; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; public function __construct( diff --git a/src/lib/QueryType/TrashSearchQueryType.php b/src/lib/QueryType/TrashSearchQueryType.php index 95cbfe6296..7ee1b21732 100644 --- a/src/lib/QueryType/TrashSearchQueryType.php +++ b/src/lib/QueryType/TrashSearchQueryType.php @@ -30,7 +30,7 @@ final class TrashSearchQueryType extends OptionsResolverBasedQueryType protected function doGetQuery(array $parameters): Query { - /** @var \Ibexa\AdminUi\Form\Data\Search\TrashSearchData $searchData */ + /** @var TrashSearchData $searchData */ $searchData = $parameters['search_data']; $query = new Query(); @@ -58,8 +58,10 @@ public static function getName(): string return 'IbexaAdminUi:TrashSearchQuery'; } - protected function addCriteria(TrashSearchData $searchData, Query $query): void - { + protected function addCriteria( + TrashSearchData $searchData, + Query $query + ): void { $criteria = []; if ($searchData->getSection() instanceof Section) { @@ -103,8 +105,10 @@ protected function addCriteria(TrashSearchData $searchData, Query $query): void } } - private function addSort(TrashSearchData $searchData, Query $query): void - { + private function addSort( + TrashSearchData $searchData, + Query $query + ): void { $sort = $searchData->getSort(); if (empty($sort)) { diff --git a/src/lib/QueryType/UserQueryType.php b/src/lib/QueryType/UserQueryType.php index 891e952ca8..cab6df1a47 100644 --- a/src/lib/QueryType/UserQueryType.php +++ b/src/lib/QueryType/UserQueryType.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\QueryType; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException; use Ibexa\Contracts\Core\Repository\Values\Content\Query; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Core\QueryType\BuiltIn\AbstractQueryType; @@ -49,7 +50,7 @@ protected function doGetQuery(array $parameters): Query /** * @param array $parameters * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws InvalidCriterionArgumentException */ protected function getQueryFilter(array $parameters): Criterion { diff --git a/src/lib/REST/Generator/ApplicationConfigRestGeneratorRegistry.php b/src/lib/REST/Generator/ApplicationConfigRestGeneratorRegistry.php index ab3110c6b2..f739ca7f58 100644 --- a/src/lib/REST/Generator/ApplicationConfigRestGeneratorRegistry.php +++ b/src/lib/REST/Generator/ApplicationConfigRestGeneratorRegistry.php @@ -14,11 +14,11 @@ final class ApplicationConfigRestGeneratorRegistry implements ApplicationConfigRestGeneratorRegistryInterface { - /** @var iterable<\Ibexa\Contracts\AdminUi\REST\ApplicationConfigRestGeneratorInterface> */ + /** @var iterable */ private iterable $generators; /** - * @param iterable<\Ibexa\Contracts\AdminUi\REST\ApplicationConfigRestGeneratorInterface> $generators + * @param iterable $generators */ public function __construct(iterable $generators) { @@ -52,8 +52,10 @@ public function hasGenerators(string $namespace): bool return false; } - public function getGenerator(string $namespace, string $parameter): ApplicationConfigRestGeneratorInterface - { + public function getGenerator( + string $namespace, + string $parameter + ): ApplicationConfigRestGeneratorInterface { foreach ($this->generators as $generator) { if ( $generator->supportsNamespace($namespace) @@ -73,7 +75,7 @@ public function getGenerator(string $namespace, string $parameter): ApplicationC } /** - * @return iterable<\Ibexa\Contracts\AdminUi\REST\ApplicationConfigRestGeneratorInterface> + * @return iterable */ public function getGenerators(string $namespace): iterable { diff --git a/src/lib/REST/Generator/ProfilePictureFieldConfigRestGenerator.php b/src/lib/REST/Generator/ProfilePictureFieldConfigRestGenerator.php index c969589e53..79b184e8d8 100644 --- a/src/lib/REST/Generator/ProfilePictureFieldConfigRestGenerator.php +++ b/src/lib/REST/Generator/ProfilePictureFieldConfigRestGenerator.php @@ -28,8 +28,11 @@ public function supportsParameter(string $parameterName): bool return self::PARAMETER === $parameterName; } - public function generate($parameter, Generator $generator, Visitor $visitor): void - { + public function generate( + $parameter, + Generator $generator, + Visitor $visitor + ): void { if ($parameter instanceof Field) { $generator->startHashElement(self::PARAMETER); $visitor->visitValueObject($parameter); diff --git a/src/lib/REST/Generator/UserConfigRestGenerator.php b/src/lib/REST/Generator/UserConfigRestGenerator.php index fa7012755c..ae376f12c9 100644 --- a/src/lib/REST/Generator/UserConfigRestGenerator.php +++ b/src/lib/REST/Generator/UserConfigRestGenerator.php @@ -28,8 +28,11 @@ public function supportsParameter(string $parameterName): bool return self::PARAMETER === $parameterName; } - public function generate($parameter, Generator $generator, Visitor $visitor): void - { + public function generate( + $parameter, + Generator $generator, + Visitor $visitor + ): void { if ($parameter instanceof User) { $generator->startHashElement(self::PARAMETER); $visitor->visitValueObject($parameter); diff --git a/src/lib/REST/Input/Parser/BulkOperation.php b/src/lib/REST/Input/Parser/BulkOperation.php index dc1f63f51a..c221342f5f 100644 --- a/src/lib/REST/Input/Parser/BulkOperation.php +++ b/src/lib/REST/Input/Parser/BulkOperation.php @@ -19,12 +19,14 @@ class BulkOperation extends BaseParser * Parse input structure. * * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher + * @param ParsingDispatcher $parsingDispatcher * - * @return \Ibexa\AdminUi\REST\Value\BulkOperation + * @return BulkOperationValue */ - public function parse(array $data, ParsingDispatcher $parsingDispatcher) - { + public function parse( + array $data, + ParsingDispatcher $parsingDispatcher + ) { if (!is_array($data) || 'operations' !== key($data)) { throw new Exceptions\Parser('Invalid structure for BulkOperation.'); } diff --git a/src/lib/REST/Input/Parser/ContentTree/LoadSubtreeRequest.php b/src/lib/REST/Input/Parser/ContentTree/LoadSubtreeRequest.php index d84acba39e..48a6548f39 100644 --- a/src/lib/REST/Input/Parser/ContentTree/LoadSubtreeRequest.php +++ b/src/lib/REST/Input/Parser/ContentTree/LoadSubtreeRequest.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\REST\Input\Parser\ContentTree; use Ibexa\AdminUi\REST\Value\ContentTree\LoadSubtreeRequest as LoadSubtreeRequestValue; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Rest\Exceptions; use Ibexa\Contracts\Rest\Input\ParsingDispatcher; @@ -17,10 +18,12 @@ class LoadSubtreeRequest extends CriterionParser { /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws InvalidCriterionArgumentException */ - public function parse(array $data, ParsingDispatcher $parsingDispatcher): LoadSubtreeRequestValue - { + public function parse( + array $data, + ParsingDispatcher $parsingDispatcher + ): LoadSubtreeRequestValue { if (!array_key_exists('nodes', $data) || !is_array($data['nodes'])) { throw new Exceptions\Parser( sprintf("Missing or invalid 'nodes' property for %s.", self::class) @@ -43,10 +46,12 @@ public function parse(array $data, ParsingDispatcher $parsingDispatcher): LoadSu /** * @param array $criteriaArray * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws InvalidCriterionArgumentException */ - private function processCriteriaArray(array $criteriaArray, ParsingDispatcher $parsingDispatcher): ?Criterion - { + private function processCriteriaArray( + array $criteriaArray, + ParsingDispatcher $parsingDispatcher + ): ?Criterion { if (count($criteriaArray) === 0) { return null; } diff --git a/src/lib/REST/Input/Parser/ContentTree/LoadSubtreeRequestNode.php b/src/lib/REST/Input/Parser/ContentTree/LoadSubtreeRequestNode.php index 404098b0eb..90ff85d99d 100644 --- a/src/lib/REST/Input/Parser/ContentTree/LoadSubtreeRequestNode.php +++ b/src/lib/REST/Input/Parser/ContentTree/LoadSubtreeRequestNode.php @@ -18,8 +18,10 @@ class LoadSubtreeRequestNode extends BaseParser /** * {@inheritdoc} */ - public function parse(array $data, ParsingDispatcher $parsingDispatcher): LoadSubtreeRequestNodeValue - { + public function parse( + array $data, + ParsingDispatcher $parsingDispatcher + ): LoadSubtreeRequestNodeValue { if (!array_key_exists('locationId', $data) || !is_numeric($data['locationId'])) { throw new Exceptions\Parser(sprintf("Missing or invalid 'locationId' property for %s.", self::class)); } diff --git a/src/lib/REST/Input/Parser/ContentType/FieldDefinitionCreate.php b/src/lib/REST/Input/Parser/ContentType/FieldDefinitionCreate.php index 5b26863777..cbcfbcc32d 100644 --- a/src/lib/REST/Input/Parser/ContentType/FieldDefinitionCreate.php +++ b/src/lib/REST/Input/Parser/ContentType/FieldDefinitionCreate.php @@ -15,8 +15,10 @@ final class FieldDefinitionCreate extends BaseParser { - public function parse(array $data, ParsingDispatcher $parsingDispatcher): FieldDefinitionCreateValue - { + public function parse( + array $data, + ParsingDispatcher $parsingDispatcher + ): FieldDefinitionCreateValue { if (!array_key_exists('fieldTypeIdentifier', $data)) { throw new Exceptions\Parser( sprintf("Missing or invalid 'fieldTypeIdentifier' property for %s.", FieldDefinitionCreateValue::class) diff --git a/src/lib/REST/Input/Parser/ContentType/FieldDefinitionDelete.php b/src/lib/REST/Input/Parser/ContentType/FieldDefinitionDelete.php index c51227fcc3..170e73c3c7 100644 --- a/src/lib/REST/Input/Parser/ContentType/FieldDefinitionDelete.php +++ b/src/lib/REST/Input/Parser/ContentType/FieldDefinitionDelete.php @@ -15,8 +15,10 @@ final class FieldDefinitionDelete extends BaseParser { - public function parse(array $data, ParsingDispatcher $parsingDispatcher): FieldDefinitionDeleteValue - { + public function parse( + array $data, + ParsingDispatcher $parsingDispatcher + ): FieldDefinitionDeleteValue { if (!array_key_exists('fieldDefinitionIdentifiers', $data)) { throw new Exceptions\Parser( sprintf("Missing or invalid 'fieldDefinitionIdentifiers' property for %s.", FieldDefinitionDeleteValue::class) diff --git a/src/lib/REST/Input/Parser/ContentType/FieldDefinitionReorder.php b/src/lib/REST/Input/Parser/ContentType/FieldDefinitionReorder.php index 5937be657a..0466827c84 100644 --- a/src/lib/REST/Input/Parser/ContentType/FieldDefinitionReorder.php +++ b/src/lib/REST/Input/Parser/ContentType/FieldDefinitionReorder.php @@ -15,8 +15,10 @@ final class FieldDefinitionReorder extends BaseParser { - public function parse(array $data, ParsingDispatcher $parsingDispatcher): FieldDefinitionReorderValue - { + public function parse( + array $data, + ParsingDispatcher $parsingDispatcher + ): FieldDefinitionReorderValue { if (!array_key_exists('fieldDefinitionIdentifiers', $data)) { throw new Exceptions\Parser( sprintf("Missing or invalid 'fieldDefinitionIdentifiers' property for %s.", FieldDefinitionReorderValue::class) diff --git a/src/lib/REST/Input/Parser/Operation.php b/src/lib/REST/Input/Parser/Operation.php index 1f5badacca..2dbcb13d87 100644 --- a/src/lib/REST/Input/Parser/Operation.php +++ b/src/lib/REST/Input/Parser/Operation.php @@ -19,12 +19,14 @@ class Operation extends BaseParser * Parse input structure. * * @param array $data - * @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher + * @param ParsingDispatcher $parsingDispatcher * - * @return \Ibexa\AdminUi\REST\Value\Operation + * @return OperationValue */ - public function parse(array $data, ParsingDispatcher $parsingDispatcher) - { + public function parse( + array $data, + ParsingDispatcher $parsingDispatcher + ) { if (!array_key_exists('uri', $data) || !is_string($data['uri'])) { throw new Exceptions\Parser("Missing or invalid 'uri' element for BulkOperation."); } diff --git a/src/lib/REST/Output/ValueObjectVisitor/ApplicationConfigVisitor.php b/src/lib/REST/Output/ValueObjectVisitor/ApplicationConfigVisitor.php index eb8a26b4d4..4695760ffc 100644 --- a/src/lib/REST/Output/ValueObjectVisitor/ApplicationConfigVisitor.php +++ b/src/lib/REST/Output/ValueObjectVisitor/ApplicationConfigVisitor.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\REST\Output\ValueObjectVisitor; +use Ibexa\AdminUi\REST\Value\ApplicationConfig; use Ibexa\Contracts\AdminUi\REST\ApplicationConfigRestGeneratorRegistryInterface; use Ibexa\Contracts\Rest\Output\Generator; use Ibexa\Contracts\Rest\Output\ValueObjectVisitor; @@ -26,10 +27,13 @@ public function __construct(ApplicationConfigRestGeneratorRegistryInterface $app } /** - * @param \Ibexa\AdminUi\REST\Value\ApplicationConfig $data + * @param ApplicationConfig $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void - { + public function visit( + Visitor $visitor, + Generator $generator, + $data + ): void { $generator->startObjectElement('ApplicationConfig'); $visitor->setHeader('Content-Type', $generator->getMediaType('ApplicationConfig')); diff --git a/src/lib/REST/Output/ValueObjectVisitor/BulkOperationResponse.php b/src/lib/REST/Output/ValueObjectVisitor/BulkOperationResponse.php index eaa94da817..86f1fec70d 100644 --- a/src/lib/REST/Output/ValueObjectVisitor/BulkOperationResponse.php +++ b/src/lib/REST/Output/ValueObjectVisitor/BulkOperationResponse.php @@ -21,12 +21,15 @@ class BulkOperationResponse extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator + * @param Visitor $visitor + * @param Generator $generator * @param \Ibexa\AdminUi\REST\Value\BulkOperationResponse $data */ - public function visit(Visitor $visitor, Generator $generator, $data) - { + public function visit( + Visitor $visitor, + Generator $generator, + $data + ) { $generator->startObjectElement('BulkOperationResponse'); $visitor->setHeader('Content-Type', $generator->getMediaType('BulkOperationResponse')); $visitor->setStatus(Response::HTTP_OK); diff --git a/src/lib/REST/Output/ValueObjectVisitor/ContentTree/Node.php b/src/lib/REST/Output/ValueObjectVisitor/ContentTree/Node.php index 45c5e51fae..a411297081 100644 --- a/src/lib/REST/Output/ValueObjectVisitor/ContentTree/Node.php +++ b/src/lib/REST/Output/ValueObjectVisitor/ContentTree/Node.php @@ -18,12 +18,15 @@ class Node extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator + * @param Visitor $visitor + * @param Generator $generator * @param \Ibexa\AdminUi\REST\Value\ContentTree\Node $data */ - public function visit(Visitor $visitor, Generator $generator, $data) - { + public function visit( + Visitor $visitor, + Generator $generator, + $data + ) { $generator->startObjectElement('ContentTreeNode'); $visitor->setHeader('Content-Type', $generator->getMediaType('ContentTreeNode')); $visitor->setStatus(Response::HTTP_OK); diff --git a/src/lib/REST/Output/ValueObjectVisitor/ContentTree/NodeExtendedInfoVisitor.php b/src/lib/REST/Output/ValueObjectVisitor/ContentTree/NodeExtendedInfoVisitor.php index c080b4a631..96099224bf 100644 --- a/src/lib/REST/Output/ValueObjectVisitor/ContentTree/NodeExtendedInfoVisitor.php +++ b/src/lib/REST/Output/ValueObjectVisitor/ContentTree/NodeExtendedInfoVisitor.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\REST\Output\ValueObjectVisitor\ContentTree; +use Ibexa\AdminUi\REST\Value\ContentTree\NodeExtendedInfo; use Ibexa\Contracts\Rest\Output\Generator; use Ibexa\Contracts\Rest\Output\ValueObjectVisitor; use Ibexa\Contracts\Rest\Output\Visitor; @@ -21,10 +22,13 @@ final class NodeExtendedInfoVisitor extends ValueObjectVisitor public const MAIN_ELEMENT = 'ContentTreeNodeExtendedInfo'; /** - * @param \Ibexa\AdminUi\REST\Value\ContentTree\NodeExtendedInfo $data + * @param NodeExtendedInfo $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void - { + public function visit( + Visitor $visitor, + Generator $generator, + $data + ): void { $generator->startObjectElement(self::MAIN_ELEMENT); $visitor->setHeader('Content-Type', $generator->getMediaType(self::MAIN_ELEMENT)); $visitor->setStatus(Response::HTTP_OK); diff --git a/src/lib/REST/Output/ValueObjectVisitor/ContentTree/Root.php b/src/lib/REST/Output/ValueObjectVisitor/ContentTree/Root.php index 9b977339e3..b71aeafa87 100644 --- a/src/lib/REST/Output/ValueObjectVisitor/ContentTree/Root.php +++ b/src/lib/REST/Output/ValueObjectVisitor/ContentTree/Root.php @@ -18,12 +18,15 @@ class Root extends ValueObjectVisitor /** * Visit struct returned by controllers. * - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator + * @param Visitor $visitor + * @param Generator $generator * @param \Ibexa\AdminUi\REST\Value\ContentTree\Root $data */ - public function visit(Visitor $visitor, Generator $generator, $data) - { + public function visit( + Visitor $visitor, + Generator $generator, + $data + ) { $generator->startObjectElement('ContentTreeRoot'); $visitor->setHeader('Content-Type', $generator->getMediaType('ContentTreeRoot')); $visitor->setStatus(Response::HTTP_OK); diff --git a/src/lib/REST/Output/ValueObjectVisitor/UniversalDiscovery/AccordionDataVisitor.php b/src/lib/REST/Output/ValueObjectVisitor/UniversalDiscovery/AccordionDataVisitor.php index c77c56d8f3..f969802538 100644 --- a/src/lib/REST/Output/ValueObjectVisitor/UniversalDiscovery/AccordionDataVisitor.php +++ b/src/lib/REST/Output/ValueObjectVisitor/UniversalDiscovery/AccordionDataVisitor.php @@ -8,9 +8,11 @@ namespace Ibexa\AdminUi\REST\Output\ValueObjectVisitor\UniversalDiscovery; +use Ibexa\AdminUi\REST\Value\UniversalDiscovery\AccordionData; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Rest\Output\Generator; use Ibexa\Contracts\Rest\Output\Visitor; +use Ibexa\Rest\Server\Values\RestLocation; /** * @phpstan-import-type Columns from \Ibexa\AdminUi\REST\Value\UniversalDiscovery\AccordionData @@ -20,10 +22,13 @@ final class AccordionDataVisitor extends AbstractLocationDataVisitor { /** - * @param \Ibexa\AdminUi\REST\Value\UniversalDiscovery\AccordionData $data + * @param AccordionData $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void - { + public function visit( + Visitor $visitor, + Generator $generator, + $data + ): void { $generator->startObjectElement('AccordionData'); $this->buildBreadcrumbNode($data->getBreadcrumb(), $generator, $visitor); @@ -33,7 +38,7 @@ public function visit(Visitor $visitor, Generator $generator, $data): void } /** - * @param array<\Ibexa\Contracts\Core\Repository\Values\Content\Location> $breadcrumb + * @param array $breadcrumb */ private function buildBreadcrumbNode( array $breadcrumb, @@ -118,7 +123,7 @@ private function buildSubItemsNode( } /** - * @param array<\Ibexa\Rest\Server\Values\RestLocation> $locations + * @param array $locations */ private function buildLocationListNode( array $locations, diff --git a/src/lib/REST/Output/ValueObjectVisitor/UniversalDiscovery/LocationDataVisitor.php b/src/lib/REST/Output/ValueObjectVisitor/UniversalDiscovery/LocationDataVisitor.php index 02486f3d84..5e10450e40 100644 --- a/src/lib/REST/Output/ValueObjectVisitor/UniversalDiscovery/LocationDataVisitor.php +++ b/src/lib/REST/Output/ValueObjectVisitor/UniversalDiscovery/LocationDataVisitor.php @@ -15,10 +15,13 @@ final class LocationDataVisitor extends AbstractLocationDataVisitor { /** - * @param \Ibexa\AdminUi\REST\Value\UniversalDiscovery\LocationData $data + * @param LocationData $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void - { + public function visit( + Visitor $visitor, + Generator $generator, + $data + ): void { $generator->startObjectElement('LocationData'); $this->buildLocationNode($data->getLocation(), $generator, $visitor); diff --git a/src/lib/REST/Output/ValueObjectVisitor/UniversalDiscovery/LocationListDataVisitor.php b/src/lib/REST/Output/ValueObjectVisitor/UniversalDiscovery/LocationListDataVisitor.php index 9c096b44e9..1a0d70fcce 100644 --- a/src/lib/REST/Output/ValueObjectVisitor/UniversalDiscovery/LocationListDataVisitor.php +++ b/src/lib/REST/Output/ValueObjectVisitor/UniversalDiscovery/LocationListDataVisitor.php @@ -8,16 +8,20 @@ namespace Ibexa\AdminUi\REST\Output\ValueObjectVisitor\UniversalDiscovery; +use Ibexa\AdminUi\REST\Value\UniversalDiscovery\LocationListData; use Ibexa\Contracts\Rest\Output\Generator; use Ibexa\Contracts\Rest\Output\Visitor; final class LocationListDataVisitor extends AbstractLocationDataVisitor { /** - * @param \Ibexa\AdminUi\REST\Value\UniversalDiscovery\LocationListData $data + * @param LocationListData $data */ - public function visit(Visitor $visitor, Generator $generator, $data): void - { + public function visit( + Visitor $visitor, + Generator $generator, + $data + ): void { $generator->startObjectElement('LocationList'); $generator->startList('locations'); diff --git a/src/lib/REST/Resolver/ApplicationConfigRestResolverRegistry.php b/src/lib/REST/Resolver/ApplicationConfigRestResolverRegistry.php index 47fe8cdfec..67898857c4 100644 --- a/src/lib/REST/Resolver/ApplicationConfigRestResolverRegistry.php +++ b/src/lib/REST/Resolver/ApplicationConfigRestResolverRegistry.php @@ -13,11 +13,11 @@ final class ApplicationConfigRestResolverRegistry implements ApplicationConfigRestResolverRegistryInterface { - /** @var iterable<\Ibexa\Contracts\AdminUi\REST\ApplicationConfigRestResolverInterface> */ + /** @var iterable */ private iterable $resolvers; /** - * @param iterable<\Ibexa\Contracts\AdminUi\REST\ApplicationConfigRestResolverInterface> $resolvers + * @param iterable $resolvers */ public function __construct(iterable $resolvers) { @@ -51,8 +51,10 @@ public function hasResolvers(string $namespace): bool return false; } - public function getResolver(string $namespace, string $parameter): ?ApplicationConfigRestResolverInterface - { + public function getResolver( + string $namespace, + string $parameter + ): ?ApplicationConfigRestResolverInterface { foreach ($this->resolvers as $mapper) { if ( $mapper->supportsNamespace($namespace) @@ -66,7 +68,7 @@ public function getResolver(string $namespace, string $parameter): ?ApplicationC } /** - * @return iterable<\Ibexa\Contracts\AdminUi\REST\ApplicationConfigRestResolverInterface> + * @return iterable */ public function getResolvers(string $namespace): iterable { diff --git a/src/lib/REST/Resolver/ProfilePictureFieldConfigRestResolver.php b/src/lib/REST/Resolver/ProfilePictureFieldConfigRestResolver.php index b58b5278eb..079c43ac16 100644 --- a/src/lib/REST/Resolver/ProfilePictureFieldConfigRestResolver.php +++ b/src/lib/REST/Resolver/ProfilePictureFieldConfigRestResolver.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\REST\Resolver; use Ibexa\Contracts\AdminUi\REST\ApplicationConfigRestResolverInterface; +use Ibexa\Contracts\Core\Repository\Values\User\User; use Ibexa\Rest\Server\Values\RestFieldDefinition; use Ibexa\Rest\Value; @@ -29,7 +30,7 @@ public function supportsParameter(string $parameterName): bool public function resolve(array $config): ?Value { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User|null $apiUser */ + /** @var User|null $apiUser */ $apiUser = $config['user']; if (null === $apiUser) { return null; diff --git a/src/lib/REST/Value/BulkOperation.php b/src/lib/REST/Value/BulkOperation.php index a51a84456a..7fc5836b56 100644 --- a/src/lib/REST/Value/BulkOperation.php +++ b/src/lib/REST/Value/BulkOperation.php @@ -12,11 +12,11 @@ class BulkOperation extends RestValue { - /** @var \Ibexa\AdminUi\REST\Value\Operation[] */ + /** @var Operation[] */ public $operations; /** - * @param \Ibexa\AdminUi\REST\Value\Operation[] $operations + * @param Operation[] $operations */ public function __construct(array $operations) { diff --git a/src/lib/REST/Value/BulkOperationResponse.php b/src/lib/REST/Value/BulkOperationResponse.php index 89accc571c..ed497e0380 100644 --- a/src/lib/REST/Value/BulkOperationResponse.php +++ b/src/lib/REST/Value/BulkOperationResponse.php @@ -12,11 +12,11 @@ class BulkOperationResponse extends RestValue { - /** @var \Ibexa\AdminUi\REST\Value\OperationResponse[] */ + /** @var OperationResponse[] */ public $operations; /** - * @param \Ibexa\AdminUi\REST\Value\OperationResponse[] $operations + * @param OperationResponse[] $operations */ public function __construct($operations) { diff --git a/src/lib/REST/Value/ContentTree/LoadSubtreeRequest.php b/src/lib/REST/Value/ContentTree/LoadSubtreeRequest.php index 172d513183..07aa308d5c 100644 --- a/src/lib/REST/Value/ContentTree/LoadSubtreeRequest.php +++ b/src/lib/REST/Value/ContentTree/LoadSubtreeRequest.php @@ -13,7 +13,7 @@ class LoadSubtreeRequest extends RestValue { - /** @var \Ibexa\AdminUi\REST\Value\ContentTree\LoadSubtreeRequestNode[] */ + /** @var LoadSubtreeRequestNode[] */ public array $nodes; public ?Criterion $filter; @@ -21,8 +21,10 @@ class LoadSubtreeRequest extends RestValue /** * @param array $nodes */ - public function __construct(array $nodes = [], ?Criterion $filter = null) - { + public function __construct( + array $nodes = [], + ?Criterion $filter = null + ) { $this->nodes = $nodes; $this->filter = $filter; } diff --git a/src/lib/REST/Value/ContentTree/LoadSubtreeRequestNode.php b/src/lib/REST/Value/ContentTree/LoadSubtreeRequestNode.php index dd1b912c0c..cb2d4d7396 100644 --- a/src/lib/REST/Value/ContentTree/LoadSubtreeRequestNode.php +++ b/src/lib/REST/Value/ContentTree/LoadSubtreeRequestNode.php @@ -21,14 +21,14 @@ class LoadSubtreeRequestNode extends RestValue /** @var int */ public $offset; - /** @var \Ibexa\AdminUi\REST\Value\ContentTree\LoadSubtreeRequestNode[] */ + /** @var LoadSubtreeRequestNode[] */ public $children; /** * @param int $locationId * @param int $limit * @param int $offset - * @param \Ibexa\AdminUi\REST\Value\ContentTree\LoadSubtreeRequestNode[] $children + * @param LoadSubtreeRequestNode[] $children */ public function __construct( int $locationId, diff --git a/src/lib/REST/Value/ContentTree/Node.php b/src/lib/REST/Value/ContentTree/Node.php index a00c4c9987..0eeb3b3367 100644 --- a/src/lib/REST/Value/ContentTree/Node.php +++ b/src/lib/REST/Value/ContentTree/Node.php @@ -47,7 +47,7 @@ class Node extends RestValue public bool $isBookmarked; - /** @var \Ibexa\AdminUi\REST\Value\ContentTree\Node[] */ + /** @var Node[] */ public $children; public string $pathString; @@ -55,7 +55,7 @@ class Node extends RestValue public string $mainLanguageCode; /** - * @param array<\Ibexa\AdminUi\REST\Value\ContentTree\Node> $children + * @param array $children */ public function __construct( int $depth, diff --git a/src/lib/REST/Value/ContentTree/Root.php b/src/lib/REST/Value/ContentTree/Root.php index 7043ef3b45..b645db5710 100644 --- a/src/lib/REST/Value/ContentTree/Root.php +++ b/src/lib/REST/Value/ContentTree/Root.php @@ -12,11 +12,11 @@ class Root extends RestValue { - /** @var \Ibexa\AdminUi\REST\Value\ContentTree\Node[] */ + /** @var Node[] */ public $elements; /** - * @param \Ibexa\AdminUi\REST\Value\ContentTree\Node[] $elements + * @param Node[] $elements */ public function __construct(array $elements = []) { diff --git a/src/lib/REST/Value/ContentType/FieldDefinitionCreate.php b/src/lib/REST/Value/ContentType/FieldDefinitionCreate.php index b0bd7586d3..888282b5dc 100644 --- a/src/lib/REST/Value/ContentType/FieldDefinitionCreate.php +++ b/src/lib/REST/Value/ContentType/FieldDefinitionCreate.php @@ -21,8 +21,11 @@ final class FieldDefinitionCreate extends RestValue /** @var int|null */ public $position; - public function __construct(?string $fieldTypeIdentifier, ?string $fieldGroupIdentifier, ?int $position = null) - { + public function __construct( + ?string $fieldTypeIdentifier, + ?string $fieldGroupIdentifier, + ?int $position = null + ) { $this->fieldTypeIdentifier = $fieldTypeIdentifier; $this->fieldGroupIdentifier = $fieldGroupIdentifier; $this->position = $position; diff --git a/src/lib/REST/Value/OperationResponse.php b/src/lib/REST/Value/OperationResponse.php index 4235364243..c399cbfce1 100644 --- a/src/lib/REST/Value/OperationResponse.php +++ b/src/lib/REST/Value/OperationResponse.php @@ -26,8 +26,11 @@ class OperationResponse extends RestValue * @param array $headers * @param string|null $content */ - public function __construct(int $statusCode, array $headers, ?string $content) - { + public function __construct( + int $statusCode, + array $headers, + ?string $content + ) { $this->statusCode = $statusCode; $this->headers = $headers; $this->content = $content; diff --git a/src/lib/REST/Value/UniversalDiscovery/AccordionData.php b/src/lib/REST/Value/UniversalDiscovery/AccordionData.php index 3f3e59e8a7..b2dde79da7 100644 --- a/src/lib/REST/Value/UniversalDiscovery/AccordionData.php +++ b/src/lib/REST/Value/UniversalDiscovery/AccordionData.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\REST\Value\UniversalDiscovery; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Rest\Value; /** @@ -25,25 +26,27 @@ */ final class AccordionData extends Value { - /** @var array<\Ibexa\Contracts\Core\Repository\Values\Content\Location> */ + /** @var array */ private array $breadcrumb; /** @phpstan-var Columns $columns */ private array $columns; /** - * @param array<\Ibexa\Contracts\Core\Repository\Values\Content\Location> $breadcrumb + * @param array $breadcrumb * * @phpstan-param Columns $columns */ - public function __construct(array $breadcrumb, array $columns) - { + public function __construct( + array $breadcrumb, + array $columns + ) { $this->breadcrumb = $breadcrumb; $this->columns = $columns; } /** - * @return array<\Ibexa\Contracts\Core\Repository\Values\Content\Location> + * @return array */ public function getBreadcrumb(): array { diff --git a/src/lib/Resolver/IconPathResolver.php b/src/lib/Resolver/IconPathResolver.php index a8b69942aa..7e26cb11f3 100644 --- a/src/lib/Resolver/IconPathResolver.php +++ b/src/lib/Resolver/IconPathResolver.php @@ -36,8 +36,10 @@ public function __construct( $this->iconCache = []; } - public function resolve(string $icon, ?string $set = null): string - { + public function resolve( + string $icon, + ?string $set = null + ): string { if (isset($this->iconCache[$set][$icon])) { return $this->iconCache[$set][$icon]; } diff --git a/src/lib/Service/ContentTypeService.php b/src/lib/Service/ContentTypeService.php index de464e2f9a..f9e104df38 100644 --- a/src/lib/Service/ContentTypeService.php +++ b/src/lib/Service/ContentTypeService.php @@ -20,7 +20,7 @@ class ContentTypeService /** @var Repository\ContentTypeService */ private $contentTypeService; - /** @var \Symfony\Component\Form\FormFactoryInterface */ + /** @var FormFactoryInterface */ private $formFactory; /** @var array */ @@ -30,7 +30,7 @@ class ContentTypeService * ContentTypeGroupService constructor. * * @param Repository\ContentTypeService $contentTypeService - * @param \Symfony\Component\Form\FormFactoryInterface $formFactory + * @param FormFactoryInterface $formFactory * @param array $prioritizedLanguages */ public function __construct( @@ -91,7 +91,7 @@ public function deleteContentType(ContentType $contentType) * Return the highest prioritized language that $contentType is translated to. * If there is no translation for a prioritized language, return $contentType's main language. * - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType Content type (or content type draft) + * @param ContentType $contentType Content type (or content type draft) * * @return string Language code */ diff --git a/src/lib/Service/MetaFieldType/MetaFieldDefinitionService.php b/src/lib/Service/MetaFieldType/MetaFieldDefinitionService.php index 06a10178df..94e49f3b09 100644 --- a/src/lib/Service/MetaFieldType/MetaFieldDefinitionService.php +++ b/src/lib/Service/MetaFieldType/MetaFieldDefinitionService.php @@ -60,8 +60,10 @@ public function __construct( $this->translator = $translator; } - public function addMetaFieldDefinitions(ValueObject $contentType, ?Language $language = null): void - { + public function addMetaFieldDefinitions( + ValueObject $contentType, + ?Language $language = null + ): void { $metaFieldTypes = $this->contentTypeFieldTypesResolver->getMetaFieldTypes(); if (null === $language) { diff --git a/src/lib/Service/Role/RoleService.php b/src/lib/Service/Role/RoleService.php index 43e8d042e4..4bc48a5102 100644 --- a/src/lib/Service/Role/RoleService.php +++ b/src/lib/Service/Role/RoleService.php @@ -35,8 +35,10 @@ class RoleService * @param Repository\RoleService $roleService * @param Repository\SearchService $searchService */ - public function __construct(Repository\RoleService $roleService, Repository\SearchService $searchService) - { + public function __construct( + Repository\RoleService $roleService, + Repository\SearchService $searchService + ) { $this->roleService = $roleService; $this->searchService = $searchService; } @@ -63,8 +65,10 @@ public function createRole(RoleData $data): Role return $role; } - public function updateRole(Role $role, RoleData $data): Role - { + public function updateRole( + Role $role, + RoleData $data + ): Role { $roleUpdateStruct = $this->roleService->newRoleUpdateStruct(); $roleUpdateStruct->identifier = $data->getIdentifier(); @@ -80,8 +84,10 @@ public function deleteRole(Role $role) $this->roleService->deleteRole($role); } - public function getPolicy(Role $role, int $policyId) - { + public function getPolicy( + Role $role, + int $policyId + ) { foreach ($role->getPolicies() as $policy) { if ($policy->id === $policyId) { return $policy; @@ -91,8 +97,10 @@ public function getPolicy(Role $role, int $policyId) return null; } - public function createPolicy(Role $role, PolicyData $data): Role - { + public function createPolicy( + Role $role, + PolicyData $data + ): Role { $policyCreateStruct = $this->roleService->newPolicyCreateStruct( $data->getModule(), $data->getFunction() @@ -105,8 +113,10 @@ public function createPolicy(Role $role, PolicyData $data): Role return $draft; } - public function deletePolicy(Role $role, Policy $policy) - { + public function deletePolicy( + Role $role, + Policy $policy + ) { $draft = $this->roleService->createRoleDraft($role); foreach ($draft->getPolicies() as $policyDraft) { if ($policyDraft->originalId == $policy->id) { @@ -120,8 +130,11 @@ public function deletePolicy(Role $role, Policy $policy) throw new \RuntimeException("Policy {$policy->id} not found."); } - public function updatePolicy(Role $role, Policy $policy, PolicyData $data): Role - { + public function updatePolicy( + Role $role, + Policy $policy, + PolicyData $data + ): Role { $policyUpdateStruct = $this->roleService->newPolicyUpdateStruct(); foreach ($data->getLimitations() as $limitation) { if (!empty($limitation->limitationValues)) { @@ -157,8 +170,10 @@ public function removeRoleAssignment(RoleAssignment $roleAssignment) $this->roleService->removeRoleAssignment($roleAssignment); } - public function assignRole(Role $role, RoleAssignmentData $data) - { + public function assignRole( + Role $role, + RoleAssignmentData $data + ) { $users = $data->getUsers(); $groups = $data->getGroups(); @@ -201,8 +216,12 @@ public function assignRole(Role $role, RoleAssignmentData $data) } } - private function doAssignLimitation(Role $role, ?array $users = null, ?array $groups = null, ?RoleLimitation $limitation = null) - { + private function doAssignLimitation( + Role $role, + ?array $users = null, + ?array $groups = null, + ?RoleLimitation $limitation = null + ) { if (null !== $users) { foreach ($users as $user) { $this->roleService->assignRoleToUser($role, $user, $limitation); diff --git a/src/lib/Siteaccess/AbstractSiteaccessPreviewVoter.php b/src/lib/Siteaccess/AbstractSiteaccessPreviewVoter.php index f4629eee02..514a939236 100644 --- a/src/lib/Siteaccess/AbstractSiteaccessPreviewVoter.php +++ b/src/lib/Siteaccess/AbstractSiteaccessPreviewVoter.php @@ -13,10 +13,10 @@ abstract class AbstractSiteaccessPreviewVoter implements SiteaccessPreviewVoterInterface { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ protected $configResolver; - /** @var \Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider */ + /** @var RepositoryConfigurationProvider */ protected $repositoryConfigurationProvider; public function __construct( diff --git a/src/lib/Siteaccess/NonAdminSiteaccessResolver.php b/src/lib/Siteaccess/NonAdminSiteaccessResolver.php index 02ac99d1be..e49f64040d 100644 --- a/src/lib/Siteaccess/NonAdminSiteaccessResolver.php +++ b/src/lib/Siteaccess/NonAdminSiteaccessResolver.php @@ -18,7 +18,7 @@ */ class NonAdminSiteaccessResolver implements SiteaccessResolverInterface { - /** @var \Ibexa\AdminUi\Siteaccess\SiteaccessResolver */ + /** @var SiteaccessResolver */ private $siteaccessResolver; /** @var string[] */ @@ -27,8 +27,10 @@ class NonAdminSiteaccessResolver implements SiteaccessResolverInterface /** * @param string[] $siteAccessGroups */ - public function __construct(SiteaccessResolver $siteaccessResolver, array $siteAccessGroups) - { + public function __construct( + SiteaccessResolver $siteaccessResolver, + array $siteAccessGroups + ) { $this->siteaccessResolver = $siteaccessResolver; $this->siteAccessGroups = $siteAccessGroups; } @@ -45,7 +47,7 @@ public function getSiteaccessesForLocation( } /** - * @return \Ibexa\Core\MVC\Symfony\SiteAccess[] + * @return SiteAccess[] */ public function getSiteAccessesListForLocation( Location $location, diff --git a/src/lib/Siteaccess/SiteaccessPreviewVoterContext.php b/src/lib/Siteaccess/SiteaccessPreviewVoterContext.php index 7562651d2a..0973875ab6 100644 --- a/src/lib/Siteaccess/SiteaccessPreviewVoterContext.php +++ b/src/lib/Siteaccess/SiteaccessPreviewVoterContext.php @@ -13,10 +13,10 @@ final class SiteaccessPreviewVoterContext { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ + /** @var Location */ private $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ + /** @var VersionInfo */ private $versionInfo; /** @var string */ @@ -38,7 +38,7 @@ public function __construct( } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location + * @return Location */ public function getLocation(): Location { @@ -62,7 +62,7 @@ public function getLanguageCode(): string } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo + * @return VersionInfo */ public function getVersionInfo(): VersionInfo { diff --git a/src/lib/Siteaccess/SiteaccessPreviewVoterInterface.php b/src/lib/Siteaccess/SiteaccessPreviewVoterInterface.php index b77995eeac..f36af8c6c8 100644 --- a/src/lib/Siteaccess/SiteaccessPreviewVoterInterface.php +++ b/src/lib/Siteaccess/SiteaccessPreviewVoterInterface.php @@ -13,7 +13,7 @@ interface SiteaccessPreviewVoterInterface /** * Votes whether the Content item can be previewed in given siteaccess. * - * @param \Ibexa\AdminUi\Siteaccess\SiteaccessPreviewVoterContext $context + * @param SiteaccessPreviewVoterContext $context * * @return bool */ diff --git a/src/lib/Siteaccess/SiteaccessResolver.php b/src/lib/Siteaccess/SiteaccessResolver.php index d03e9f6e1b..7d2511e5e2 100644 --- a/src/lib/Siteaccess/SiteaccessResolver.php +++ b/src/lib/Siteaccess/SiteaccessResolver.php @@ -9,26 +9,29 @@ namespace Ibexa\AdminUi\Siteaccess; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Core\MVC\Symfony\SiteAccess; use Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessService; class SiteaccessResolver implements SiteaccessResolverInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\AdminUi\Siteaccess\SiteaccessPreviewVoterInterface[] */ + /** @var SiteaccessPreviewVoterInterface[] */ private $siteAccessPreviewVoters; - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessService */ + /** @var SiteAccessService */ private $siteAccessService; private LocationService $locationService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @param ContentService $contentService * @param iterable $siteaccessPreviewVoters * @param array $siteAccesses */ @@ -47,8 +50,8 @@ public function __construct( /** * @return array * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ public function getSiteaccessesForLocation( Location $location, @@ -68,7 +71,7 @@ public function getSiteaccessesForLocation( } /** - * @return \Ibexa\Core\MVC\Symfony\SiteAccess[] + * @return SiteAccess[] */ public function getSiteAccessesListForLocation( Location $location, @@ -80,7 +83,7 @@ public function getSiteAccessesListForLocation( $languageCode = $languageCode ?? $contentInfo->getMainLanguageCode(); $eligibleSiteAccesses = []; - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess $siteAccess */ + /** @var SiteAccess $siteAccess */ foreach ($this->siteAccessService->getAll() as $siteAccess) { $context = new SiteaccessPreviewVoterContext($location, $versionInfo, $siteAccess->name, $languageCode); foreach ($this->siteAccessPreviewVoters as $siteAccessPreviewVoter) { diff --git a/src/lib/Siteaccess/SiteaccessResolverInterface.php b/src/lib/Siteaccess/SiteaccessResolverInterface.php index 137f39f410..74a2a26a80 100644 --- a/src/lib/Siteaccess/SiteaccessResolverInterface.php +++ b/src/lib/Siteaccess/SiteaccessResolverInterface.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Core\MVC\Symfony\SiteAccess; interface SiteaccessResolverInterface { @@ -19,7 +20,7 @@ interface SiteaccessResolverInterface * @return string[] * * @deprecated Deprecated since Ibexa DXP 4.5.0. - * Use { @see \Ibexa\AdminUi\Siteaccess\SiteaccessResolverInterface::getSiteAccessesList } instead. + * Use { @see SiteaccessResolverInterface::getSiteAccessesList } instead. */ public function getSiteaccessesForLocation( Location $location, @@ -28,7 +29,7 @@ public function getSiteaccessesForLocation( ): array; /** - * @return \Ibexa\Core\MVC\Symfony\SiteAccess[] + * @return SiteAccess[] */ public function getSiteAccessesListForLocation( Location $location, @@ -37,12 +38,12 @@ public function getSiteAccessesListForLocation( ): array; /** - * @return \Ibexa\Core\MVC\Symfony\SiteAccess[] + * @return SiteAccess[] */ public function getSiteAccessesListForContent(Content $content): array; /** - * @return \Ibexa\Core\MVC\Symfony\SiteAccess[] + * @return SiteAccess[] */ public function getSiteAccessesList(): array; diff --git a/src/lib/Specification/AbstractSpecification.php b/src/lib/Specification/AbstractSpecification.php index a796725a29..c0e7998003 100644 --- a/src/lib/Specification/AbstractSpecification.php +++ b/src/lib/Specification/AbstractSpecification.php @@ -13,8 +13,6 @@ /** * @deprecated 4.4.0 Use \Ibexa\Contracts\Core\Specification\AbstractSpecification */ -abstract class AbstractSpecification extends BaseAbstractSpecification -{ -} +abstract class AbstractSpecification extends BaseAbstractSpecification {} class_alias(AbstractSpecification::class, 'EzSystems\EzPlatformAdminUi\Specification\AbstractSpecification'); diff --git a/src/lib/Specification/AndSpecification.php b/src/lib/Specification/AndSpecification.php index f44661ef8b..b29c335aed 100644 --- a/src/lib/Specification/AndSpecification.php +++ b/src/lib/Specification/AndSpecification.php @@ -18,8 +18,10 @@ class AndSpecification extends AbstractSpecification { private SpecificationInterface $baseSpecification; - public function __construct(SpecificationInterface $one, SpecificationInterface $two) - { + public function __construct( + SpecificationInterface $one, + SpecificationInterface $two + ) { $this->baseSpecification = new BaseAndSpecification($one, $two); } diff --git a/src/lib/Specification/Content/ContentDraftHasConflict.php b/src/lib/Specification/Content/ContentDraftHasConflict.php index 4d42c8d737..eba7b83f5a 100644 --- a/src/lib/Specification/Content/ContentDraftHasConflict.php +++ b/src/lib/Specification/Content/ContentDraftHasConflict.php @@ -10,21 +10,25 @@ use Ibexa\AdminUi\Specification\AbstractSpecification; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; +use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; class ContentDraftHasConflict extends AbstractSpecification { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; /** @var string */ private $languageCode; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @param ContentService $contentService * @param string $languageCode */ - public function __construct(ContentService $contentService, string $languageCode) - { + public function __construct( + ContentService $contentService, + string $languageCode + ) { $this->contentService = $contentService; $this->languageCode = $languageCode; } @@ -32,11 +36,11 @@ public function __construct(ContentService $contentService, string $languageCode /** * Checks if Content has draft conflict. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo + * @param ContentInfo $contentInfo * * @return bool * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException */ public function isSatisfiedBy($contentInfo): bool { diff --git a/src/lib/Specification/Content/ContentHaveAssetRelation.php b/src/lib/Specification/Content/ContentHaveAssetRelation.php index 51402de300..c7694a20b0 100644 --- a/src/lib/Specification/Content/ContentHaveAssetRelation.php +++ b/src/lib/Specification/Content/ContentHaveAssetRelation.php @@ -11,16 +11,17 @@ use Ibexa\AdminUi\Exception\InvalidArgumentException; use Ibexa\AdminUi\Specification\AbstractSpecification; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Core\Repository\Values\Content\Relation; class ContentHaveAssetRelation extends AbstractSpecification { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @param ContentService $contentService */ public function __construct(ContentService $contentService) { @@ -32,8 +33,8 @@ public function __construct(ContentService $contentService) * * @return bool * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws InvalidArgumentException + * @throws UnauthorizedException */ public function isSatisfiedBy($item): bool { diff --git a/src/lib/Specification/Content/ContentHaveUniqueRelation.php b/src/lib/Specification/Content/ContentHaveUniqueRelation.php index c9916d3c54..cbfc189020 100644 --- a/src/lib/Specification/Content/ContentHaveUniqueRelation.php +++ b/src/lib/Specification/Content/ContentHaveUniqueRelation.php @@ -11,16 +11,17 @@ use Ibexa\AdminUi\Exception\InvalidArgumentException; use Ibexa\AdminUi\Specification\AbstractSpecification; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Core\Repository\Values\Content\Relation; class ContentHaveUniqueRelation extends AbstractSpecification { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @param ContentService $contentService */ public function __construct(ContentService $contentService) { @@ -32,8 +33,8 @@ public function __construct(ContentService $contentService) * * @return bool * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws InvalidArgumentException + * @throws UnauthorizedException */ public function isSatisfiedBy($item): bool { diff --git a/src/lib/Specification/ContentIsUser.php b/src/lib/Specification/ContentIsUser.php index e015816565..2556474555 100644 --- a/src/lib/Specification/ContentIsUser.php +++ b/src/lib/Specification/ContentIsUser.php @@ -13,11 +13,11 @@ class ContentIsUser implements ContentSpecification { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; /** - * @param \Ibexa\Contracts\Core\Repository\UserService $userService + * @param UserService $userService */ public function __construct(UserService $userService) { @@ -27,7 +27,7 @@ public function __construct(UserService $userService) /** * Checks if $contentId is an existing User content. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param Content $content * * @return bool */ diff --git a/src/lib/Specification/ContentSpecification.php b/src/lib/Specification/ContentSpecification.php index b866e90cee..115b9bc678 100644 --- a/src/lib/Specification/ContentSpecification.php +++ b/src/lib/Specification/ContentSpecification.php @@ -14,7 +14,7 @@ interface ContentSpecification /** * Check to see if the specification is satisfied. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param Content $content * * @return bool */ diff --git a/src/lib/Specification/ContentType/ContentTypeIsUser.php b/src/lib/Specification/ContentType/ContentTypeIsUser.php index 31103174d4..bf7c24a354 100644 --- a/src/lib/Specification/ContentType/ContentTypeIsUser.php +++ b/src/lib/Specification/ContentType/ContentTypeIsUser.php @@ -30,11 +30,11 @@ public function __construct(array $userContentTypeIdentifier) /** * Checks if $contentType is an existing User content. * - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param ContentType $contentType * * @return bool * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function isSatisfiedBy($contentType): bool { diff --git a/src/lib/Specification/ContentType/ContentTypeIsUserGroup.php b/src/lib/Specification/ContentType/ContentTypeIsUserGroup.php index d87129e719..23d6019b18 100644 --- a/src/lib/Specification/ContentType/ContentTypeIsUserGroup.php +++ b/src/lib/Specification/ContentType/ContentTypeIsUserGroup.php @@ -28,11 +28,11 @@ public function __construct(array $userGroupContentTypeIdentifier) /** * Checks if $contentType is an existing User content. * - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param ContentType $contentType * * @return bool * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function isSatisfiedBy($contentType): bool { diff --git a/src/lib/Specification/Location/HasChildren.php b/src/lib/Specification/Location/HasChildren.php index 227a583e3b..a37b2ca811 100644 --- a/src/lib/Specification/Location/HasChildren.php +++ b/src/lib/Specification/Location/HasChildren.php @@ -10,14 +10,15 @@ use Ibexa\AdminUi\Specification\AbstractSpecification; use Ibexa\Contracts\Core\Repository\LocationService; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; class HasChildren extends AbstractSpecification { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; /** - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService + * @param LocationService $locationService */ public function __construct(LocationService $locationService) { @@ -25,7 +26,7 @@ public function __construct(LocationService $locationService) } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $item + * @param Location $item * * @return bool */ diff --git a/src/lib/Specification/Location/IsContainer.php b/src/lib/Specification/Location/IsContainer.php index e1b591c165..af952d4f55 100644 --- a/src/lib/Specification/Location/IsContainer.php +++ b/src/lib/Specification/Location/IsContainer.php @@ -9,11 +9,12 @@ namespace Ibexa\AdminUi\Specification\Location; use Ibexa\AdminUi\Specification\AbstractSpecification; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; class IsContainer extends AbstractSpecification { /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $item + * @param Location $item * * @return bool */ diff --git a/src/lib/Specification/Location/IsContentStructureRoot.php b/src/lib/Specification/Location/IsContentStructureRoot.php index acda399d6b..0fcc24c740 100644 --- a/src/lib/Specification/Location/IsContentStructureRoot.php +++ b/src/lib/Specification/Location/IsContentStructureRoot.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\Specification\Location; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Contracts\Core\Specification\AbstractSpecification; @@ -21,7 +22,7 @@ public function __construct(ConfigResolverInterface $configResolver) } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $item + * @param Location $item */ public function isSatisfiedBy($item): bool { diff --git a/src/lib/Specification/Location/IsInContextualTreeRootIds.php b/src/lib/Specification/Location/IsInContextualTreeRootIds.php index e6c19c714b..a02701c012 100644 --- a/src/lib/Specification/Location/IsInContextualTreeRootIds.php +++ b/src/lib/Specification/Location/IsInContextualTreeRootIds.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\Specification\Location; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Contracts\Core\Specification\AbstractSpecification; @@ -21,7 +22,7 @@ public function __construct(ConfigResolverInterface $configResolver) } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $item + * @param Location $item */ public function isSatisfiedBy($item): bool { diff --git a/src/lib/Specification/Location/IsRoot.php b/src/lib/Specification/Location/IsRoot.php index 25f46882cd..cd9aff41fb 100644 --- a/src/lib/Specification/Location/IsRoot.php +++ b/src/lib/Specification/Location/IsRoot.php @@ -9,11 +9,12 @@ namespace Ibexa\AdminUi\Specification\Location; use Ibexa\AdminUi\Specification\AbstractSpecification; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; class IsRoot extends AbstractSpecification { /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $item + * @param Location $item */ public function isSatisfiedBy($item): bool { diff --git a/src/lib/Specification/Location/IsWithinCopySubtreeLimit.php b/src/lib/Specification/Location/IsWithinCopySubtreeLimit.php index 2a90c52142..8ad49ca97e 100644 --- a/src/lib/Specification/Location/IsWithinCopySubtreeLimit.php +++ b/src/lib/Specification/Location/IsWithinCopySubtreeLimit.php @@ -20,7 +20,7 @@ class IsWithinCopySubtreeLimit extends AbstractSpecification /** @var int */ private $copyLimit; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; public function __construct( @@ -32,7 +32,7 @@ public function __construct( } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $item + * @param Location $item */ public function isSatisfiedBy($item): bool { diff --git a/src/lib/Specification/OrSpecification.php b/src/lib/Specification/OrSpecification.php index 1962f89819..d8a03090da 100644 --- a/src/lib/Specification/OrSpecification.php +++ b/src/lib/Specification/OrSpecification.php @@ -18,8 +18,10 @@ class OrSpecification extends AbstractSpecification { private SpecificationInterface $baseSpecification; - public function __construct(SpecificationInterface $one, SpecificationInterface $two) - { + public function __construct( + SpecificationInterface $one, + SpecificationInterface $two + ) { $this->baseSpecification = new BaseOrSpecification($one, $two); } diff --git a/src/lib/Specification/SiteAccess/IsAdmin.php b/src/lib/Specification/SiteAccess/IsAdmin.php index 8170d44869..572064faab 100644 --- a/src/lib/Specification/SiteAccess/IsAdmin.php +++ b/src/lib/Specification/SiteAccess/IsAdmin.php @@ -31,7 +31,7 @@ public function __construct(array $siteAccessGroups) * * @return bool * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function isSatisfiedBy($item): bool { diff --git a/src/lib/Specification/SpecificationInterface.php b/src/lib/Specification/SpecificationInterface.php index 5a2a901e62..ac0580b925 100644 --- a/src/lib/Specification/SpecificationInterface.php +++ b/src/lib/Specification/SpecificationInterface.php @@ -13,8 +13,6 @@ /** * @deprecated 4.4.0 Use \Ibexa\Contracts\Core\Specification\SpecificationInterface */ -interface SpecificationInterface extends BaseSpecificationInterface -{ -} +interface SpecificationInterface extends BaseSpecificationInterface {} class_alias(SpecificationInterface::class, 'EzSystems\EzPlatformAdminUi\Specification\SpecificationInterface'); diff --git a/src/lib/Specification/UserExists.php b/src/lib/Specification/UserExists.php index 31c1c1b4dc..d6d14f7181 100644 --- a/src/lib/Specification/UserExists.php +++ b/src/lib/Specification/UserExists.php @@ -13,11 +13,11 @@ class UserExists implements UserSpecification { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; /** - * @param \Ibexa\Contracts\Core\Repository\UserService $userService + * @param UserService $userService */ public function __construct(UserService $userService) { diff --git a/src/lib/Specification/UserProfile/IsProfileAvailable.php b/src/lib/Specification/UserProfile/IsProfileAvailable.php index a103cf4bd4..d03b64fcc9 100644 --- a/src/lib/Specification/UserProfile/IsProfileAvailable.php +++ b/src/lib/Specification/UserProfile/IsProfileAvailable.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Specification\UserProfile; use Ibexa\AdminUi\UserProfile\UserProfileConfigurationInterface; +use Ibexa\Contracts\Core\Repository\Values\User\User; use Ibexa\Contracts\Core\Specification\AbstractSpecification; final class IsProfileAvailable extends AbstractSpecification @@ -21,7 +22,7 @@ public function __construct(UserProfileConfigurationInterface $userProfileConfig } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\User $item + * @param User $item */ public function isSatisfiedBy($item): bool { diff --git a/src/lib/Specification/Version/VersionHasConflict.php b/src/lib/Specification/Version/VersionHasConflict.php index bbf6dbf8ed..46787d4005 100644 --- a/src/lib/Specification/Version/VersionHasConflict.php +++ b/src/lib/Specification/Version/VersionHasConflict.php @@ -10,21 +10,25 @@ use Ibexa\AdminUi\Specification\AbstractSpecification; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; +use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; class VersionHasConflict extends AbstractSpecification { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; /** @var string */ private $languageCode; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @param ContentService $contentService * @param string $languageCode */ - public function __construct(ContentService $contentService, string $languageCode) - { + public function __construct( + ContentService $contentService, + string $languageCode + ) { $this->contentService = $contentService; $this->languageCode = $languageCode; } @@ -32,11 +36,11 @@ public function __construct(ContentService $contentService, string $languageCode /** * Checks if $content has version conflict. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo + * @param VersionInfo $versionInfo * * @return bool * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException */ public function isSatisfiedBy($versionInfo): bool { diff --git a/src/lib/Strategy/ContentTypeThumbnailStrategy.php b/src/lib/Strategy/ContentTypeThumbnailStrategy.php index 8973379174..e8ca1716aa 100644 --- a/src/lib/Strategy/ContentTypeThumbnailStrategy.php +++ b/src/lib/Strategy/ContentTypeThumbnailStrategy.php @@ -19,7 +19,7 @@ final class ContentTypeThumbnailStrategy implements ThumbnailStrategy { private const THUMBNAIL_MIME_TYPE = 'image/svg+xml'; - /** @var \Ibexa\AdminUi\UI\Service\ContentTypeIconResolver */ + /** @var ContentTypeIconResolver */ private $contentTypeIconResolver; public function __construct( diff --git a/src/lib/Strategy/NotificationTwigStrategy.php b/src/lib/Strategy/NotificationTwigStrategy.php index 3e8122651b..eb76d49848 100644 --- a/src/lib/Strategy/NotificationTwigStrategy.php +++ b/src/lib/Strategy/NotificationTwigStrategy.php @@ -15,18 +15,18 @@ class NotificationTwigStrategy { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ + /** @var Repository */ private $repository; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; /** @var string */ private $defaultTemplate; /** - * @param \Ibexa\Contracts\Core\Repository\Repository $repository - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @param Repository $repository + * @param ContentService $contentService */ public function __construct( Repository $repository, @@ -49,7 +49,7 @@ public function setDefault(string $defaultTemplate) * * @return string * - * @throws \Ibexa\AdminUi\Exception\NoValidResultException + * @throws NoValidResultException */ public function decide($contentId): string { diff --git a/src/lib/Tab/ContentType/TranslationsTab.php b/src/lib/Tab/ContentType/TranslationsTab.php index 3de39d2957..c5e7cfaa7c 100644 --- a/src/lib/Tab/ContentType/TranslationsTab.php +++ b/src/lib/Tab/ContentType/TranslationsTab.php @@ -14,6 +14,8 @@ use Ibexa\AdminUi\UI\Dataset\DatasetFactory; use Ibexa\Contracts\AdminUi\Tab\AbstractEventDispatchingTab; use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -23,18 +25,18 @@ class TranslationsTab extends AbstractEventDispatchingTab implements OrderedTabI { public const URI_FRAGMENT = 'ibexa-tab-content-type-view-translations'; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ + /** @var DatasetFactory */ protected $datasetFactory; - /** @var \Ibexa\AdminUi\Form\Factory\ContentTypeFormFactory */ + /** @var ContentTypeFormFactory */ protected $formFactory; /** - * @param \Twig\Environment $twig - * @param \Symfony\Contracts\Translation\TranslatorInterface $translator - * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher - * @param \Ibexa\AdminUi\UI\Dataset\DatasetFactory $datasetFactory - * @param \Ibexa\AdminUi\Form\Factory\ContentTypeFormFactory $formFactory + * @param Environment $twig + * @param TranslatorInterface $translator + * @param EventDispatcherInterface $eventDispatcher + * @param DatasetFactory $datasetFactory + * @param ContentTypeFormFactory $formFactory */ public function __construct( Environment $twig, @@ -87,11 +89,11 @@ public function getTemplate(): string * * @return mixed[] * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ public function getTemplateParameters(array $contextParameters = []): array { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType */ + /** @var ContentType $contentType */ $contentType = $contextParameters['content_type']; $contentTypeGroup = $contextParameters['content_type_group']; diff --git a/src/lib/Tab/Dashboard/AbstractContentTab.php b/src/lib/Tab/Dashboard/AbstractContentTab.php index 14224e9f99..0d621c0d1e 100644 --- a/src/lib/Tab/Dashboard/AbstractContentTab.php +++ b/src/lib/Tab/Dashboard/AbstractContentTab.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\Tab\Dashboard; +use Ibexa\AdminUi\QueryType\ContentLocationSubtreeQueryType; use Ibexa\Contracts\AdminUi\Tab\AbstractTab; use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; use Ibexa\Contracts\Core\Repository\SearchService; @@ -17,13 +18,13 @@ abstract class AbstractContentTab extends AbstractTab implements OrderedTabInterface { - /** @var \Ibexa\AdminUi\Tab\Dashboard\PagerLocationToDataMapper */ + /** @var PagerLocationToDataMapper */ protected $pagerLocationToDataMapper; - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ + /** @var SearchService */ protected $searchService; - /** @var \Ibexa\AdminUi\QueryType\ContentLocationSubtreeQueryType */ + /** @var ContentLocationSubtreeQueryType */ protected $contentLocationSubtreeQueryType; public function __construct( diff --git a/src/lib/Tab/Dashboard/AbstractMediaTab.php b/src/lib/Tab/Dashboard/AbstractMediaTab.php index 7c31043a06..1ba628d704 100644 --- a/src/lib/Tab/Dashboard/AbstractMediaTab.php +++ b/src/lib/Tab/Dashboard/AbstractMediaTab.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\Tab\Dashboard; +use Ibexa\AdminUi\QueryType\MediaLocationSubtreeQueryType; use Ibexa\Contracts\AdminUi\Tab\AbstractTab; use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; use Ibexa\Contracts\Core\Repository\SearchService; @@ -17,13 +18,13 @@ abstract class AbstractMediaTab extends AbstractTab implements OrderedTabInterface { - /** @var \Ibexa\AdminUi\Tab\Dashboard\PagerLocationToDataMapper */ + /** @var PagerLocationToDataMapper */ protected $pagerLocationToDataMapper; - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ + /** @var SearchService */ protected $searchService; - /** @var \Ibexa\AdminUi\QueryType\MediaLocationSubtreeQueryType */ + /** @var MediaLocationSubtreeQueryType */ protected $mediaLocationSubtreeQueryType; public function __construct( diff --git a/src/lib/Tab/Dashboard/MyContentTab.php b/src/lib/Tab/Dashboard/MyContentTab.php index 06f583a6ce..7b18b526ed 100644 --- a/src/lib/Tab/Dashboard/MyContentTab.php +++ b/src/lib/Tab/Dashboard/MyContentTab.php @@ -9,9 +9,13 @@ namespace Ibexa\AdminUi\Tab\Dashboard; use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Core\Pagination\Pagerfanta\LocationSearchAdapter; use JMS\TranslationBundle\Annotation\Desc; use Pagerfanta\Pagerfanta; +use Twig\Error\Error; class MyContentTab extends AbstractContentTab implements OrderedTabInterface { @@ -32,10 +36,10 @@ public function getOrder(): int } /** - * @throws \Twig\Error\Error - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws Error + * @throws ForbiddenException + * @throws NotFoundException + * @throws UnauthorizedException */ public function renderView(array $parameters): string { diff --git a/src/lib/Tab/Dashboard/MyDraftsTab.php b/src/lib/Tab/Dashboard/MyDraftsTab.php index 5ea1bcd134..9e52aaf3e5 100644 --- a/src/lib/Tab/Dashboard/MyDraftsTab.php +++ b/src/lib/Tab/Dashboard/MyDraftsTab.php @@ -15,6 +15,7 @@ use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use JMS\TranslationBundle\Annotation\Desc; @@ -22,27 +23,30 @@ use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Contracts\Translation\TranslatorInterface; use Twig\Environment; +use Twig\Error\LoaderError; +use Twig\Error\RuntimeError; +use Twig\Error\SyntaxError; class MyDraftsTab extends AbstractTab implements OrderedTabInterface, ConditionalTabInterface { private const PAGINATION_PARAM_NAME = 'mydrafts-page'; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ protected $contentService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ protected $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ protected $permissionResolver; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ + /** @var DatasetFactory */ protected $datasetFactory; - /** @var \Symfony\Component\HttpFoundation\RequestStack */ + /** @var RequestStack */ private $requestStack; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( @@ -97,7 +101,7 @@ public function getOrder(): int * * @return bool * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ public function evaluate(array $parameters): bool { @@ -110,9 +114,9 @@ public function evaluate(array $parameters): bool * * @return string * - * @throws \Twig\Error\LoaderError - * @throws \Twig\Error\RuntimeError - * @throws \Twig\Error\SyntaxError + * @throws LoaderError + * @throws RuntimeError + * @throws SyntaxError */ public function renderView(array $parameters): string { diff --git a/src/lib/Tab/Dashboard/MyMediaTab.php b/src/lib/Tab/Dashboard/MyMediaTab.php index 5cda00999e..455ca52ed9 100644 --- a/src/lib/Tab/Dashboard/MyMediaTab.php +++ b/src/lib/Tab/Dashboard/MyMediaTab.php @@ -9,9 +9,13 @@ namespace Ibexa\AdminUi\Tab\Dashboard; use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Core\Pagination\Pagerfanta\LocationSearchAdapter; use JMS\TranslationBundle\Annotation\Desc; use Pagerfanta\Pagerfanta; +use Twig\Error\Error; class MyMediaTab extends AbstractMediaTab implements OrderedTabInterface { @@ -32,10 +36,10 @@ public function getOrder(): int } /** - * @throws \Twig\Error\Error - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws Error + * @throws ForbiddenException + * @throws NotFoundException + * @throws UnauthorizedException */ public function renderView(array $parameters): string { diff --git a/src/lib/Tab/Dashboard/PagerContentToDataMapper.php b/src/lib/Tab/Dashboard/PagerContentToDataMapper.php index bb2dbf9a98..a319b7153d 100644 --- a/src/lib/Tab/Dashboard/PagerContentToDataMapper.php +++ b/src/lib/Tab/Dashboard/PagerContentToDataMapper.php @@ -11,8 +11,12 @@ use Ibexa\AdminUi\Pagination\Mapper\AbstractPagerContentToDataMapper; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\UserService; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Core\Helper\TranslationHelper; use Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface; use Ibexa\Core\Repository\LocationResolver\LocationResolver; @@ -20,30 +24,30 @@ /** * @deprecated in favour of PagerLocationToDataMapper - * @see \Ibexa\AdminUi\Tab\Dashboard\PagerLocationToDataMapper + * @see PagerLocationToDataMapper */ class PagerContentToDataMapper extends AbstractPagerContentToDataMapper { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ protected $contentService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ protected $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ protected $userService; - /** @var \Ibexa\Core\Repository\LocationResolver\LocationResolver */ + /** @var LocationResolver */ protected $locationResolver; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Contracts\Core\Repository\UserService $userService - * @param \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider - * @param \Ibexa\Core\Helper\TranslationHelper $translationHelper - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService - * @param \Ibexa\Core\Repository\LocationResolver\LocationResolver $locationResolver + * @param ContentService $contentService + * @param ContentTypeService $contentTypeService + * @param UserService $userService + * @param UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider + * @param TranslationHelper $translationHelper + * @param LanguageService $languageService + * @param LocationResolver $locationResolver */ public function __construct( ContentService $contentService, @@ -78,13 +82,13 @@ public function __construct( } /** - * @param \Pagerfanta\Pagerfanta $pager + * @param Pagerfanta $pager * * @return array * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws NotFoundException + * @throws ForbiddenException + * @throws BadStateException */ public function map(Pagerfanta $pager): array { @@ -92,7 +96,7 @@ public function map(Pagerfanta $pager): array $contentTypeIds = []; foreach ($pager as $content) { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $contentInfo = $content->contentInfo; $contentTypeIds[] = $contentInfo->contentTypeId; diff --git a/src/lib/Tab/Dashboard/PagerLocationToDataMapper.php b/src/lib/Tab/Dashboard/PagerLocationToDataMapper.php index 4f92d283af..5eae20ecef 100644 --- a/src/lib/Tab/Dashboard/PagerLocationToDataMapper.php +++ b/src/lib/Tab/Dashboard/PagerLocationToDataMapper.php @@ -8,10 +8,13 @@ namespace Ibexa\AdminUi\Tab\Dashboard; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\Language; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Contracts\Core\Repository\Values\User\User; use Ibexa\Core\Repository\LocationResolver\LocationResolver; @@ -19,10 +22,10 @@ final class PagerLocationToDataMapper { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; - /** @var \Ibexa\Core\Repository\LocationResolver\LocationResolver */ + /** @var LocationResolver */ private $locationResolver; private LanguageService $languageService; @@ -38,7 +41,7 @@ public function __construct( } /** - * @param \Pagerfanta\Pagerfanta<\Ibexa\Contracts\Core\Repository\Values\Content\Location> $pager + * @param Pagerfanta $pager * * @return array< * array{ @@ -55,15 +58,17 @@ public function __construct( * } * > * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws ForbiddenException + * @throws BadStateException + * @throws NotFoundException */ - public function map(Pagerfanta $pager, bool $doMapVersionInfoData = false): array - { + public function map( + Pagerfanta $pager, + bool $doMapVersionInfoData = false + ): array { $data = []; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ foreach ($pager as $location) { $contentInfo = $location->getContentInfo(); $versionInfo = $doMapVersionInfoData ? $location->getContent()->getVersionInfo() : null; @@ -96,7 +101,7 @@ private function getVersionContributor(VersionInfo $versionInfo): ?User } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language[] + * @return Language[] */ private function getAvailableTranslations( VersionInfo $versionInfo diff --git a/src/lib/Tab/Event/Subscriber/ConditionalTabSubscriber.php b/src/lib/Tab/Event/Subscriber/ConditionalTabSubscriber.php index de36cee44c..b86c1c0c3a 100644 --- a/src/lib/Tab/Event/Subscriber/ConditionalTabSubscriber.php +++ b/src/lib/Tab/Event/Subscriber/ConditionalTabSubscriber.php @@ -18,12 +18,12 @@ /** * Evaluates if tabs should be visible (Tabs implementing ConditionalTabInterface). * - * @see \Ibexa\Contracts\AdminUi\Tab\ConditionalTabInterface + * @see ConditionalTabInterface */ class ConditionalTabSubscriber implements EventSubscriberInterface { /** - * @var \Ibexa\AdminUi\UI\Service\TabService + * @var TabService */ private $tabService; @@ -43,7 +43,7 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\AdminUi\Tab\Event\TabGroupEvent $tabGroupEvent + * @param TabGroupEvent $tabGroupEvent */ public function onTabGroupInitialize(TabGroupEvent $tabGroupEvent) { diff --git a/src/lib/Tab/Event/Subscriber/OrderedTabSubscriber.php b/src/lib/Tab/Event/Subscriber/OrderedTabSubscriber.php index dc21dd3277..30c279b092 100644 --- a/src/lib/Tab/Event/Subscriber/OrderedTabSubscriber.php +++ b/src/lib/Tab/Event/Subscriber/OrderedTabSubscriber.php @@ -11,13 +11,14 @@ use Ibexa\AdminUi\Tab\Event\TabEvents; use Ibexa\AdminUi\Tab\Event\TabGroupEvent; use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; +use Ibexa\Contracts\AdminUi\Tab\TabInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Reorders tabs according to their Order value (Tabs implementing OrderedTabInterface). * Tabs without order specified are pushed to the end of the group. * - * @see \Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface + * @see OrderedTabInterface */ class OrderedTabSubscriber implements EventSubscriberInterface { @@ -32,7 +33,7 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\AdminUi\Tab\Event\TabGroupEvent $tabGroupEvent + * @param TabGroupEvent $tabGroupEvent */ public function onTabGroupPreRender(TabGroupEvent $tabGroupEvent) { @@ -46,7 +47,7 @@ public function onTabGroupPreRender(TabGroupEvent $tabGroupEvent) } /** - * @param \Ibexa\Contracts\AdminUi\Tab\TabInterface[] $tabs + * @param TabInterface[] $tabs * * @return array */ @@ -66,13 +67,15 @@ private function reorderTabs($tabs): array } /** - * @param \Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface $tab1 - * @param \Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface $tab2 + * @param OrderedTabInterface $tab1 + * @param OrderedTabInterface $tab2 * * @return int */ - private function sortTabs(OrderedTabInterface $tab1, OrderedTabInterface $tab2): int - { + private function sortTabs( + OrderedTabInterface $tab1, + OrderedTabInterface $tab2 + ): int { return $tab1->getOrder() <=> $tab2->getOrder(); } } diff --git a/src/lib/Tab/Event/TabEvent.php b/src/lib/Tab/Event/TabEvent.php index 41f9507387..29354e4a26 100644 --- a/src/lib/Tab/Event/TabEvent.php +++ b/src/lib/Tab/Event/TabEvent.php @@ -13,14 +13,14 @@ class TabEvent extends Event { - /** @var \Ibexa\Contracts\AdminUi\Tab\TabInterface */ + /** @var TabInterface */ private $data; /** @var array */ private $parameters; /** - * @return \Ibexa\Contracts\AdminUi\Tab\TabInterface + * @return TabInterface */ public function getData(): TabInterface { @@ -28,7 +28,7 @@ public function getData(): TabInterface } /** - * @param \Ibexa\Contracts\AdminUi\Tab\TabInterface $data + * @param TabInterface $data */ public function setData(TabInterface $data) { diff --git a/src/lib/Tab/Event/TabGroupEvent.php b/src/lib/Tab/Event/TabGroupEvent.php index 34386d8810..3aa7833912 100644 --- a/src/lib/Tab/Event/TabGroupEvent.php +++ b/src/lib/Tab/Event/TabGroupEvent.php @@ -13,14 +13,14 @@ class TabGroupEvent extends Event { - /** @var \Ibexa\AdminUi\Tab\TabGroup */ + /** @var TabGroup */ private $data; /** @var array */ private $parameters; /** - * @return \Ibexa\AdminUi\Tab\TabGroup + * @return TabGroup */ public function getData(): TabGroup { @@ -28,7 +28,7 @@ public function getData(): TabGroup } /** - * @param \Ibexa\AdminUi\Tab\TabGroup $data + * @param TabGroup $data */ public function setData(TabGroup $data) { diff --git a/src/lib/Tab/Event/TabViewRenderEvent.php b/src/lib/Tab/Event/TabViewRenderEvent.php index 03e1526dd7..45a996c99a 100644 --- a/src/lib/Tab/Event/TabViewRenderEvent.php +++ b/src/lib/Tab/Event/TabViewRenderEvent.php @@ -26,8 +26,11 @@ class TabViewRenderEvent extends Event * @param string $template * @param array $parameters */ - public function __construct(string $tabIdentifier, string $template, array $parameters = []) - { + public function __construct( + string $tabIdentifier, + string $template, + array $parameters = [] + ) { $this->tabIdentifier = $tabIdentifier; $this->template = $template; $this->parameters = $parameters; diff --git a/src/lib/Tab/LocationView/AuthorsTab.php b/src/lib/Tab/LocationView/AuthorsTab.php index 9e31bfd263..a2685d0d34 100644 --- a/src/lib/Tab/LocationView/AuthorsTab.php +++ b/src/lib/Tab/LocationView/AuthorsTab.php @@ -13,6 +13,7 @@ use Ibexa\Contracts\AdminUi\Tab\ConditionalTabInterface; use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; use Ibexa\Contracts\Core\Repository\UserService; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use JMS\TranslationBundle\Annotation\Desc; @@ -66,7 +67,7 @@ public function getTemplate(): string */ public function getTemplateParameters(array $contextParameters = []): array { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $contextParameters['content']; $versionInfo = $content->getVersionInfo(); @@ -91,8 +92,10 @@ public function evaluate(array $parameters): bool /** * @param array $parameters */ - private function supplyLastContributor(array &$parameters, VersionInfo $versionInfo): void - { + private function supplyLastContributor( + array &$parameters, + VersionInfo $versionInfo + ): void { $parameters['last_contributor'] = null; if ((new UserExists($this->userService))->isSatisfiedBy($versionInfo->creatorId)) { $parameters['last_contributor'] = $this->userService->loadUser($versionInfo->creatorId); @@ -102,8 +105,10 @@ private function supplyLastContributor(array &$parameters, VersionInfo $versionI /** * @param array $parameters */ - private function supplyCreator(array &$parameters, ContentInfo $contentInfo): void - { + private function supplyCreator( + array &$parameters, + ContentInfo $contentInfo + ): void { $parameters['creator'] = null; if ((new UserExists($this->userService))->isSatisfiedBy($contentInfo->ownerId)) { $parameters['creator'] = $this->userService->loadUser($contentInfo->ownerId); diff --git a/src/lib/Tab/LocationView/ContentTab.php b/src/lib/Tab/LocationView/ContentTab.php index 100fc9c9c6..f99060cae3 100644 --- a/src/lib/Tab/LocationView/ContentTab.php +++ b/src/lib/Tab/LocationView/ContentTab.php @@ -14,6 +14,7 @@ use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Language; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -22,13 +23,13 @@ class ContentTab extends AbstractEventDispatchingTab implements OrderedTabInterface { - /** @var \Ibexa\AdminUi\Util\FieldDefinitionGroupsUtil */ + /** @var FieldDefinitionGroupsUtil */ private $fieldDefinitionGroupsUtil; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( @@ -74,9 +75,9 @@ public function getTemplate(): string */ public function getTemplateParameters(array $contextParameters = []): array { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $contextParameters['content']; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType */ + /** @var ContentType $contentType */ $contentType = $contextParameters['contentType']; $fieldDefinitions = $contentType->getFieldDefinitions(); $fieldDefinitionsByGroup = $this->fieldDefinitionGroupsUtil->groupFieldDefinitions($fieldDefinitions); @@ -94,7 +95,7 @@ public function getTemplateParameters(array $contextParameters = []): array /** * Loads system languages with filtering applied. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param Content $content * * @return array */ diff --git a/src/lib/Tab/LocationView/DetailsTab.php b/src/lib/Tab/LocationView/DetailsTab.php index eeb0e138d4..b67992cbb7 100644 --- a/src/lib/Tab/LocationView/DetailsTab.php +++ b/src/lib/Tab/LocationView/DetailsTab.php @@ -21,8 +21,10 @@ use Ibexa\Contracts\AdminUi\Tab\AbstractEventDispatchingTab; use Ibexa\Contracts\AdminUi\Tab\ConditionalTabInterface; use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\SectionService; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; @@ -100,9 +102,9 @@ public function getTemplate(): string */ public function getTemplateParameters(array $contextParameters = []): array { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $contextParameters['content']; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $contextParameters['location']; $versionInfo = $content->getVersionInfo(); @@ -137,8 +139,10 @@ private function supplySortFieldClauseMap(ArrayObject $parameters): void ]; } - private function supplyObjectStateParameters(ArrayObject $parameters, ContentInfo $contentInfo): void - { + private function supplyObjectStateParameters( + ArrayObject $parameters, + ContentInfo $contentInfo + ): void { $objectStatesDataset = $this->datasetFactory->objectStates(); $objectStatesDataset->load($contentInfo); @@ -170,15 +174,18 @@ private function supplyObjectStateParameters(ArrayObject $parameters, ContentInf * * @return bool * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ private function canUserAssignObjectState(): bool { return $this->permissionResolver->hasAccess('state', 'assign') !== false; } - private function supplySectionParameters(ArrayObject $parameters, ContentInfo $contentInfo, Location $location): void - { + private function supplySectionParameters( + ArrayObject $parameters, + ContentInfo $contentInfo, + Location $location + ): void { $canSeeSection = $this->permissionResolver->canUser('section', 'view', $contentInfo); $parameters['section'] = null; @@ -204,16 +211,20 @@ private function supplySectionParameters(ArrayObject $parameters, ContentInfo $c } } - private function supplyFormLocationUpdate(ArrayObject $parameters, Location $location): void - { + private function supplyFormLocationUpdate( + ArrayObject $parameters, + Location $location + ): void { $parameters['form_location_update'] = $this->formFactory->create( LocationUpdateType::class, new LocationUpdateData($location) )->createView(); } - private function supplyTranslations(ArrayObject $parameters, VersionInfo $versionInfo): void - { + private function supplyTranslations( + ArrayObject $parameters, + VersionInfo $versionInfo + ): void { $translationsDataset = $this->datasetFactory->translations(); $translationsDataset->load($versionInfo); diff --git a/src/lib/Tab/LocationView/LocationsTab.php b/src/lib/Tab/LocationView/LocationsTab.php index 43f53aeb1e..2ead88ed1e 100644 --- a/src/lib/Tab/LocationView/LocationsTab.php +++ b/src/lib/Tab/LocationView/LocationsTab.php @@ -22,6 +22,7 @@ use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\SearchService; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query; @@ -42,40 +43,40 @@ class LocationsTab extends AbstractEventDispatchingTab implements OrderedTabInte public const URI_FRAGMENT = 'ibexa-tab-location-view-locations'; private const PAGINATION_PARAM_NAME = 'locations-tab-page'; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ protected $formFactory; - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ + /** @var UrlGeneratorInterface */ protected $urlGenerator; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ protected $permissionResolver; - /** @var \Symfony\Component\HttpFoundation\RequestStack */ + /** @var RequestStack */ private $requestStack; - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ + /** @var SearchService */ private $searchService; - /** @var \Ibexa\AdminUi\UI\Value\Content\Location\Mapper */ + /** @var Mapper */ private $locationToUILocationMapper; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; private UserSettingService $userSettingService; /** - * @param \Twig\Environment $twig - * @param \Symfony\Contracts\Translation\TranslatorInterface $translator - * @param \Ibexa\AdminUi\Form\Factory\FormFactory $formFactory - * @param \Symfony\Component\Routing\Generator\UrlGeneratorInterface $urlGenerator - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver - * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher - * @param \Ibexa\Contracts\Core\Repository\SearchService $searchService - * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack + * @param Environment $twig + * @param TranslatorInterface $translator + * @param FormFactory $formFactory + * @param UrlGeneratorInterface $urlGenerator + * @param PermissionResolver $permissionResolver + * @param EventDispatcherInterface $eventDispatcher + * @param SearchService $searchService + * @param RequestStack $requestStack * @param \Ibexa\AdminUi\UI\Value\Content\Location\Mapper$locationToUILocationMapper - * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver + * @param ConfigResolverInterface $configResolver */ public function __construct( Environment $twig, @@ -145,9 +146,9 @@ public function getTemplate(): string */ public function getTemplateParameters(array $contextParameters = []): array { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $contextParameters['content']; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $contextParameters['location']; $versionInfo = $content->getVersionInfo(); $contentInfo = $versionInfo->getContentInfo(); @@ -226,9 +227,9 @@ public function getTemplateParameters(array $contextParameters = []): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface */ private function createLocationAddForm(Location $location): FormInterface { @@ -238,13 +239,15 @@ private function createLocationAddForm(Location $location): FormInterface } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * @param \Ibexa\AdminUi\UI\Value\Content\Location[] $contentLocations * - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface */ - private function createLocationRemoveForm(Location $location, array $contentLocations): FormInterface - { + private function createLocationRemoveForm( + Location $location, + array $contentLocations + ): FormInterface { return $this->formFactory->removeLocation( new ContentLocationRemoveData($location->getContentInfo(), $this->getLocationChoices($contentLocations)) ); @@ -263,9 +266,9 @@ private function getLocationChoices(array $locations): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface */ protected function createLocationSwapForm(Location $location): FormInterface { @@ -275,9 +278,9 @@ protected function createLocationSwapForm(Location $location): FormInterface } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface */ protected function createLocationUpdateVisibilityForm(Location $location): FormInterface { @@ -288,12 +291,14 @@ protected function createLocationUpdateVisibilityForm(Location $location): FormI /** * @param $contentInfo - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface */ - protected function createLocationUpdateMainForm($contentInfo, Location $location): FormInterface - { + protected function createLocationUpdateMainForm( + $contentInfo, + Location $location + ): FormInterface { return $this->formFactory->updateContentMainLocation( new ContentMainLocationUpdateData($contentInfo, $location) ); diff --git a/src/lib/Tab/LocationView/PoliciesTab.php b/src/lib/Tab/LocationView/PoliciesTab.php index 6d9294b4ed..dbfb62cfe9 100644 --- a/src/lib/Tab/LocationView/PoliciesTab.php +++ b/src/lib/Tab/LocationView/PoliciesTab.php @@ -15,12 +15,16 @@ use Ibexa\Contracts\AdminUi\Tab\AbstractEventDispatchingTab; use Ibexa\Contracts\AdminUi\Tab\ConditionalTabInterface; use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use JMS\TranslationBundle\Annotation\Desc; use Pagerfanta\Adapter\ArrayAdapter; use Pagerfanta\Pagerfanta; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Translation\Exception\InvalidArgumentException; use Symfony\Contracts\Translation\TranslatorInterface; use Twig\Environment; @@ -28,13 +32,13 @@ class PoliciesTab extends AbstractEventDispatchingTab implements OrderedTabInter { public const URI_FRAGMENT = 'ibexa-tab-location-view-policies'; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ + /** @var DatasetFactory */ protected $datasetFactory; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ protected $permissionResolver; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ protected $configResolver; public function __construct( @@ -63,7 +67,7 @@ public function getIdentifier(): string /** * @return string * - * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function getName(): string { @@ -86,7 +90,7 @@ public function getOrder(): int * * @return bool * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws BadStateException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ public function evaluate(array $parameters): bool @@ -95,7 +99,7 @@ public function evaluate(array $parameters): bool return false; } - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType */ + /** @var ContentType $contentType */ $contentType = $parameters['contentType']; $isUser = new ContentTypeIsUser($this->configResolver->getParameter('user_content_type_identifier')); @@ -118,7 +122,7 @@ public function getTemplate(): string */ public function getTemplateParameters(array $contextParameters = []): array { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $contextParameters['location']; $policiesPaginationParams = $contextParameters['policies_pagination_params']; diff --git a/src/lib/Tab/LocationView/RelationsTab.php b/src/lib/Tab/LocationView/RelationsTab.php index 13fe2c83cb..772d3a0ae7 100644 --- a/src/lib/Tab/LocationView/RelationsTab.php +++ b/src/lib/Tab/LocationView/RelationsTab.php @@ -16,7 +16,11 @@ use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; +use Ibexa\Contracts\Core\Repository\Values\Content\Relation; use JMS\TranslationBundle\Annotation\Desc; use Pagerfanta\Pagerfanta; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -27,26 +31,26 @@ class RelationsTab extends AbstractEventDispatchingTab implements OrderedTabInte { public const URI_FRAGMENT = 'ibexa-tab-location-view-relations'; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ protected $permissionResolver; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ + /** @var DatasetFactory */ protected $datasetFactory; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ protected $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; /** - * @param \Twig\Environment $twig - * @param \Symfony\Contracts\Translation\TranslatorInterface $translator - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver - * @param \Ibexa\AdminUi\UI\Dataset\DatasetFactory $datasetFactory - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @param Environment $twig + * @param TranslatorInterface $translator + * @param PermissionResolver $permissionResolver + * @param DatasetFactory $datasetFactory + * @param ContentTypeService $contentTypeService + * @param EventDispatcherInterface $eventDispatcher + * @param ContentService $contentService */ public function __construct( Environment $twig, @@ -97,8 +101,8 @@ public function getOrder(): int * * @return bool * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws BadStateException + * @throws InvalidArgumentException */ public function evaluate(array $parameters): bool { @@ -118,7 +122,7 @@ public function getTemplate(): string */ public function getTemplateParameters(array $contextParameters = []): array { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $contextParameters['content']; $reverseRelationPaginationParams = $contextParameters['reverse_relation_pagination_params']; $reverseRelationPagination = new Pagerfanta( @@ -145,7 +149,7 @@ public function getTemplateParameters(array $contextParameters = []): array $relations = $relationPagination->getCurrentPageResults(); foreach ($relations as $relation) { if ($relation->isAccessible()) { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Relation $relation */ + /** @var Relation $relation */ $contentTypeIds[] = $relation->getDestinationContentInfo()->contentTypeId; } } @@ -157,7 +161,7 @@ public function getTemplateParameters(array $contextParameters = []): array foreach ($reverseRelations as $relation) { if ($relation->isAccessible()) { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Relation $relation */ + /** @var Relation $relation */ $contentTypeIds[] = $relation->getSourceContentInfo()->contentTypeId; } } diff --git a/src/lib/Tab/LocationView/RolesTab.php b/src/lib/Tab/LocationView/RolesTab.php index 4ab920a835..d2cc4d50a7 100644 --- a/src/lib/Tab/LocationView/RolesTab.php +++ b/src/lib/Tab/LocationView/RolesTab.php @@ -15,12 +15,16 @@ use Ibexa\Contracts\AdminUi\Tab\AbstractEventDispatchingTab; use Ibexa\Contracts\AdminUi\Tab\ConditionalTabInterface; use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use JMS\TranslationBundle\Annotation\Desc; use Pagerfanta\Adapter\ArrayAdapter; use Pagerfanta\Pagerfanta; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Translation\Exception\InvalidArgumentException; use Symfony\Contracts\Translation\TranslatorInterface; use Twig\Environment; @@ -28,13 +32,13 @@ class RolesTab extends AbstractEventDispatchingTab implements OrderedTabInterfac { public const URI_FRAGMENT = 'ibexa-tab-location-view-roles'; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ + /** @var DatasetFactory */ protected $datasetFactory; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ protected $permissionResolver; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ protected $configResolver; public function __construct( @@ -63,7 +67,7 @@ public function getIdentifier(): string /** * @return string * - * @throws \Symfony\Component\Translation\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function getName(): string { @@ -86,7 +90,7 @@ public function getOrder(): int * * @return bool * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws BadStateException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ public function evaluate(array $parameters): bool @@ -95,7 +99,7 @@ public function evaluate(array $parameters): bool return false; } - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType */ + /** @var ContentType $contentType */ $contentType = $parameters['contentType']; $isUser = new ContentTypeIsUser($this->configResolver->getParameter('user_content_type_identifier')); @@ -118,7 +122,7 @@ public function getTemplate(): string */ public function getTemplateParameters(array $contextParameters = []): array { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $contextParameters['location']; $rolesPaginationParams = $contextParameters['roles_pagination_params']; diff --git a/src/lib/Tab/LocationView/SubItemsTab.php b/src/lib/Tab/LocationView/SubItemsTab.php index c6457cf248..3785fe74df 100644 --- a/src/lib/Tab/LocationView/SubItemsTab.php +++ b/src/lib/Tab/LocationView/SubItemsTab.php @@ -10,6 +10,7 @@ use Ibexa\Contracts\AdminUi\Tab\AbstractEventDispatchingTab; use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use JMS\TranslationBundle\Annotation\Desc; class SubItemsTab extends AbstractEventDispatchingTab implements OrderedTabInterface @@ -39,7 +40,7 @@ public function getTemplate(): string public function getTemplateParameters(array $contextParameters = []): array { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $contextParameters['content']; $versionInfo = $content->getVersionInfo(); diff --git a/src/lib/Tab/LocationView/TranslationsTab.php b/src/lib/Tab/LocationView/TranslationsTab.php index 889a96f55a..60ed5e1f2e 100644 --- a/src/lib/Tab/LocationView/TranslationsTab.php +++ b/src/lib/Tab/LocationView/TranslationsTab.php @@ -26,6 +26,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Contracts\Translation\TranslatorInterface; use Twig\Environment; @@ -34,29 +35,29 @@ class TranslationsTab extends AbstractEventDispatchingTab implements OrderedTabI { public const URI_FRAGMENT = 'ibexa-tab-location-view-translations'; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ + /** @var DatasetFactory */ protected $datasetFactory; - /** @var \Symfony\Component\Form\FormFactoryInterface */ + /** @var FormFactoryInterface */ private $formFactory; - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ + /** @var UrlGeneratorInterface */ protected $urlGenerator; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; /** - * @param \Twig\Environment $twig - * @param \Symfony\Contracts\Translation\TranslatorInterface $translator - * @param \Ibexa\AdminUi\UI\Dataset\DatasetFactory $datasetFactory - * @param \Symfony\Component\Routing\Generator\UrlGeneratorInterface $urlGenerator - * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher - * @param \Symfony\Component\Form\FormFactoryInterface $formFactory - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver + * @param Environment $twig + * @param TranslatorInterface $translator + * @param DatasetFactory $datasetFactory + * @param UrlGeneratorInterface $urlGenerator + * @param EventDispatcherInterface $eventDispatcher + * @param FormFactoryInterface $formFactory + * @param PermissionResolver $permissionResolver */ public function __construct( Environment $twig, @@ -106,9 +107,9 @@ public function getTemplate(): string */ public function getTemplateParameters(array $contextParameters = []): array { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $contextParameters['location']; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $contextParameters['content']; $versionInfo = $content->getVersionInfo(); $translationsDataset = $this->datasetFactory->translations(); @@ -148,11 +149,11 @@ public function getTemplateParameters(array $contextParameters = []): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface * - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ private function createTranslationAddForm(Location $location): FormInterface { @@ -162,15 +163,17 @@ private function createTranslationAddForm(Location $location): FormInterface } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * @param array $languageCodes * - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface * - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @throws InvalidOptionsException */ - private function createTranslationDeleteForm(Location $location, array $languageCodes): FormInterface - { + private function createTranslationDeleteForm( + Location $location, + array $languageCodes + ): FormInterface { $data = new TranslationDeleteData( $location->getContentInfo(), array_combine($languageCodes, array_fill_keys($languageCodes, false)) @@ -180,13 +183,15 @@ private function createTranslationDeleteForm(Location $location, array $language } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param Content $content * @param string $languageCode * - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface */ - private function createMainLanguageUpdateForm(Content $content, string $languageCode): FormInterface - { + private function createMainLanguageUpdateForm( + Content $content, + string $languageCode + ): FormInterface { $data = new MainTranslationUpdateData($content, $languageCode); return $this->formFactory->create(MainTranslationUpdateType::class, $data); diff --git a/src/lib/Tab/LocationView/UrlsTab.php b/src/lib/Tab/LocationView/UrlsTab.php index 3b02b1e636..7093f54863 100644 --- a/src/lib/Tab/LocationView/UrlsTab.php +++ b/src/lib/Tab/LocationView/UrlsTab.php @@ -33,34 +33,34 @@ class UrlsTab extends AbstractEventDispatchingTab implements OrderedTabInterface { public const URI_FRAGMENT = 'ibexa-tab-location-view-urls'; - /** @var \Ibexa\Contracts\Core\Repository\URLAliasService */ + /** @var URLAliasService */ protected $urlAliasService; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ protected $formFactory; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ + /** @var DatasetFactory */ protected $datasetFactory; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ protected $locationService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ protected $permissionResolver; - /** @var \Ibexa\Core\Helper\TranslationHelper */ + /** @var TranslationHelper */ private $translationHelper; /** - * @param \Twig\Environment $twig - * @param \Symfony\Contracts\Translation\TranslatorInterface $translator - * @param \Ibexa\Contracts\Core\Repository\URLAliasService $urlAliasService - * @param \Ibexa\AdminUi\Form\Factory\FormFactory $formFactory - * @param \Ibexa\AdminUi\UI\Dataset\DatasetFactory $datasetFactory - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver - * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher - * @param \Ibexa\Core\Helper\TranslationHelper $translationHelper + * @param Environment $twig + * @param TranslatorInterface $translator + * @param URLAliasService $urlAliasService + * @param FormFactory $formFactory + * @param DatasetFactory $datasetFactory + * @param LocationService $locationService + * @param PermissionResolver $permissionResolver + * @param EventDispatcherInterface $eventDispatcher + * @param TranslationHelper $translationHelper */ public function __construct( Environment $twig, @@ -121,7 +121,7 @@ public function getTemplate(): string */ public function getTemplateParameters(array $contextParameters = []): array { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $contextParameters['location']; $customUrlsPaginationParams = $contextParameters['custom_urls_pagination_params']; @@ -183,9 +183,9 @@ public function getTemplateParameters(array $contextParameters = []): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface */ private function createCustomUrlAddForm(Location $location): FormInterface { @@ -195,13 +195,15 @@ private function createCustomUrlAddForm(Location $location): FormInterface } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * @param array $customUrlAliases * - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface */ - private function createCustomUrlRemoveForm(Location $location, array $customUrlAliases): FormInterface - { + private function createCustomUrlRemoveForm( + Location $location, + array $customUrlAliases + ): FormInterface { $customUrlRemoveData = new CustomUrlRemoveData($location, $this->getChoices($customUrlAliases)); return $this->formFactory->removeCustomUrl($customUrlRemoveData); diff --git a/src/lib/Tab/LocationView/VersionsTab.php b/src/lib/Tab/LocationView/VersionsTab.php index 70c94ba0ad..5eee4ef4de 100644 --- a/src/lib/Tab/LocationView/VersionsTab.php +++ b/src/lib/Tab/LocationView/VersionsTab.php @@ -14,12 +14,16 @@ use Ibexa\AdminUi\Specification\ContentIsUser; use Ibexa\AdminUi\Specification\UserMode\IsFocusModeEnabled; use Ibexa\AdminUi\UI\Dataset\DatasetFactory; +use Ibexa\AdminUi\UI\Value\Content\VersionInfo; use Ibexa\AdminUi\UserSetting\FocusMode; use Ibexa\Contracts\AdminUi\Tab\AbstractEventDispatchingTab; use Ibexa\Contracts\AdminUi\Tab\ConditionalTabInterface; use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\UserService; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\User\UserSetting\UserSettingService; use JMS\TranslationBundle\Annotation\Desc; @@ -37,32 +41,32 @@ class VersionsTab extends AbstractEventDispatchingTab implements OrderedTabInter public const FORM_REMOVE_ARCHIVED = 'version_remove_archived'; public const URI_FRAGMENT = 'ibexa-tab-location-view-versions'; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ + /** @var DatasetFactory */ protected $datasetFactory; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ protected $formFactory; - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ + /** @var UrlGeneratorInterface */ protected $urlGenerator; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ protected $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; private UserSettingService $userSettingService; /** - * @param \Twig\Environment $twig - * @param \Symfony\Contracts\Translation\TranslatorInterface $translator - * @param \Ibexa\AdminUi\UI\Dataset\DatasetFactory $datasetFactory - * @param \Ibexa\AdminUi\Form\Factory\FormFactory $formFactory - * @param \Symfony\Component\Routing\Generator\UrlGeneratorInterface $urlGenerator - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver - * @param \Ibexa\Contracts\Core\Repository\UserService $userService - * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher + * @param Environment $twig + * @param TranslatorInterface $translator + * @param DatasetFactory $datasetFactory + * @param FormFactory $formFactory + * @param UrlGeneratorInterface $urlGenerator + * @param PermissionResolver $permissionResolver + * @param UserService $userService + * @param EventDispatcherInterface $eventDispatcher */ public function __construct( Environment $twig, @@ -117,8 +121,8 @@ public function getOrder(): int * * @return bool * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws BadStateException + * @throws InvalidArgumentException */ public function evaluate(array $parameters): bool { @@ -143,9 +147,9 @@ public function getTemplate(): string */ public function getTemplateParameters(array $contextParameters = []): array { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $contextParameters['content']; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $contextParameters['location']; $draftPaginationParams = $contextParameters['draft_pagination_params']; @@ -162,7 +166,7 @@ public function getTemplateParameters(array $contextParameters = []): array $draftPagerfanta->setMaxPerPage($draftPaginationParams['limit']); $draftPagerfanta->setCurrentPage(min($draftPaginationParams['page'], $draftPagerfanta->getNbPages())); - /** @var \Ibexa\AdminUi\UI\Value\Content\VersionInfo[] $policies */ + /** @var VersionInfo[] $policies */ $draftVersions = $draftPagerfanta->getCurrentPageResults(); $archivedVersions = $versionsDataset->getArchivedVersions(); @@ -210,14 +214,17 @@ private function getVersionNumbers(array $versions): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * @param array $versions * @param bool $isDraftForm * - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface */ - private function createVersionRemoveForm(Location $location, array $versions, bool $isDraftForm): FormInterface - { + private function createVersionRemoveForm( + Location $location, + array $versions, + bool $isDraftForm + ): FormInterface { $contentInfo = $location->getContentInfo(); $data = new VersionRemoveData($contentInfo, $this->getVersionNumbers($versions)); diff --git a/src/lib/Tab/TabGroup.php b/src/lib/Tab/TabGroup.php index fb3ddb00bc..871b15a4e5 100644 --- a/src/lib/Tab/TabGroup.php +++ b/src/lib/Tab/TabGroup.php @@ -15,15 +15,17 @@ class TabGroup /** @var string */ protected $identifier; - /** @var \Ibexa\Contracts\AdminUi\Tab\TabInterface[] */ + /** @var TabInterface[] */ protected $tabs; /** * @param string $name * @param array $tabs */ - public function __construct(string $name, array $tabs = []) - { + public function __construct( + string $name, + array $tabs = [] + ) { $this->identifier = $name; $this->tabs = $tabs; } @@ -45,7 +47,7 @@ public function setIdentifier(string $identifier) } /** - * @return \Ibexa\Contracts\AdminUi\Tab\TabInterface[] + * @return TabInterface[] */ public function getTabs(): array { @@ -53,7 +55,7 @@ public function getTabs(): array } /** - * @param \Ibexa\Contracts\AdminUi\Tab\TabInterface[] $tabs + * @param TabInterface[] $tabs */ public function setTabs(array $tabs) { @@ -61,7 +63,7 @@ public function setTabs(array $tabs) } /** - * @param \Ibexa\Contracts\AdminUi\Tab\TabInterface $tab + * @param TabInterface $tab */ public function addTab(TabInterface $tab) { diff --git a/src/lib/Tab/TabRegistry.php b/src/lib/Tab/TabRegistry.php index d6a78d6f85..02e7211194 100644 --- a/src/lib/Tab/TabRegistry.php +++ b/src/lib/Tab/TabRegistry.php @@ -18,7 +18,7 @@ class TabRegistry /** * @param string $group * - * @return \Ibexa\Contracts\AdminUi\Tab\TabInterface[] + * @return TabInterface[] */ public function getTabsByGroupName(string $group): array { @@ -43,10 +43,12 @@ public function getTabGroup(string $group): TabGroup * @param string $name * @param string $group * - * @return \Ibexa\Contracts\AdminUi\Tab\TabInterface + * @return TabInterface */ - public function getTabFromGroup(string $name, string $group): TabInterface - { + public function getTabFromGroup( + string $name, + string $group + ): TabInterface { if (!isset($this->tabGroups[$group])) { throw new \InvalidArgumentException(sprintf('Could not find the requested group named "%s". Did you tag the service?', $group)); } @@ -69,11 +71,13 @@ public function addTabGroup(TabGroup $group) } /** - * @param \Ibexa\Contracts\AdminUi\Tab\TabInterface $tab + * @param TabInterface $tab * @param string $group */ - public function addTab(TabInterface $tab, string $group) - { + public function addTab( + TabInterface $tab, + string $group + ) { if (!isset($this->tabGroups[$group])) { $this->tabGroups[$group] = new TabGroup($group, []); } diff --git a/src/lib/Tab/URLManagement/LinkManagerTab.php b/src/lib/Tab/URLManagement/LinkManagerTab.php index 67822d0f1c..d8a8e03275 100644 --- a/src/lib/Tab/URLManagement/LinkManagerTab.php +++ b/src/lib/Tab/URLManagement/LinkManagerTab.php @@ -16,6 +16,7 @@ use Ibexa\Contracts\AdminUi\Tab\AbstractTab; use Ibexa\Contracts\AdminUi\Tab\ConditionalTabInterface; use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\URLService; use Ibexa\Contracts\Core\Repository\Values\URL\Query\Criterion; @@ -34,23 +35,23 @@ class LinkManagerTab extends AbstractTab implements OrderedTabInterface, Conditi public const URI_FRAGMENT = 'ibexa-tab-link-manager-link-manager'; private const DEFAULT_MAX_PER_PAGE = 10; - /** @var \Ibexa\Contracts\Core\Repository\URLService */ + /** @var URLService */ private $urlService; - /** @var \Ibexa\AdminUi\Form\Factory\FormFactory */ + /** @var FormFactory */ private $formFactory; - /** @var \Ibexa\AdminUi\Form\SubmitHandler */ + /** @var SubmitHandler */ private $submitHandler; - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Symfony\Component\HttpFoundation\RequestStack */ + /** @var RequestStack */ private $requestStack; /** - * @var \Ibexa\Contracts\Core\Repository\PermissionResolver + * @var PermissionResolver */ private $permissionResolver; @@ -95,7 +96,7 @@ public function getOrder(): int * * @return bool * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ public function evaluate(array $parameters): bool { @@ -135,9 +136,9 @@ public function renderView(array $parameters): string /** * Builds URL criteria from list data. * - * @param \Ibexa\AdminUi\Form\Data\URL\URLListData $data + * @param URLListData $data * - * @return \Ibexa\Contracts\Core\Repository\Values\URL\URLQuery + * @return URLQuery */ private function buildListQuery(URLListData $data): URLQuery { diff --git a/src/lib/Tab/URLManagement/URLWildcardsTab.php b/src/lib/Tab/URLManagement/URLWildcardsTab.php index 4a4eb7213c..c1a76df7b1 100644 --- a/src/lib/Tab/URLManagement/URLWildcardsTab.php +++ b/src/lib/Tab/URLManagement/URLWildcardsTab.php @@ -16,6 +16,7 @@ use Ibexa\AdminUi\Pagination\Pagerfanta\URLWildcardAdapter; use Ibexa\Contracts\AdminUi\Tab\AbstractTab; use Ibexa\Contracts\AdminUi\Tab\OrderedTabInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\URLWildcardService; use Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard\Query\Criterion; @@ -30,6 +31,9 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Contracts\Translation\TranslatorInterface; use Twig\Environment; +use Twig\Error\LoaderError; +use Twig\Error\RuntimeError; +use Twig\Error\SyntaxError; class URLWildcardsTab extends AbstractTab implements OrderedTabInterface { @@ -37,19 +41,19 @@ class URLWildcardsTab extends AbstractTab implements OrderedTabInterface public const URI_FRAGMENT = 'ibexa-tab-link-manager-url-wildcards'; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ protected $permissionResolver; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; - /** @var \Ibexa\Contracts\Core\Repository\URLWildcardService */ + /** @var URLWildcardService */ private $urlWildcardService; - /** @var \Symfony\Component\HttpFoundation\RequestStack */ + /** @var RequestStack */ private $requestStack; - /** @var \Symfony\Component\Form\FormFactoryInterface */ + /** @var FormFactoryInterface */ private $formFactory; public function __construct( @@ -100,10 +104,10 @@ public function getOrder(): int * * @return string * - * @throws \Twig\Error\LoaderError - * @throws \Twig\Error\RuntimeError - * @throws \Twig\Error\SyntaxError - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws LoaderError + * @throws RuntimeError + * @throws SyntaxError + * @throws InvalidArgumentException */ public function renderView(array $parameters): string { diff --git a/src/lib/Translation/Extractor/JavaScriptFileVisitor.php b/src/lib/Translation/Extractor/JavaScriptFileVisitor.php index 437f73107f..9e2acef9b0 100644 --- a/src/lib/Translation/Extractor/JavaScriptFileVisitor.php +++ b/src/lib/Translation/Extractor/JavaScriptFileVisitor.php @@ -18,6 +18,7 @@ use Peast\Peast; use Peast\Syntax\Exception; use Peast\Syntax\Node; +use Peast\Syntax\Node\Expression; use Psr\Log\LoggerAwareTrait; use Psr\Log\NullLogger; use SplFileInfo; @@ -35,7 +36,7 @@ class JavaScriptFileVisitor implements FileVisitorInterface, LoggerAwareInterfac public const TRANS_DOMAIN_ARG = 2; public const TRANS_CHOICE_DOMAIN_ARG = 3; - /** @var \Doctrine\Common\Annotations\DocParser */ + /** @var DocParser */ private $docParser; /** @var string */ @@ -58,8 +59,10 @@ public function __construct(string $defaultDomain = 'messages') ]); } - public function visitFile(SplFileInfo $file, MessageCatalogue $catalogue) - { + public function visitFile( + SplFileInfo $file, + MessageCatalogue $catalogue + ) { if (!$this->supports($file)) { return; } @@ -109,25 +112,32 @@ public function visitFile(SplFileInfo $file, MessageCatalogue $catalogue) }); } - public function visitPhpFile(SplFileInfo $file, MessageCatalogue $catalogue, array $ast) - { - } + public function visitPhpFile( + SplFileInfo $file, + MessageCatalogue $catalogue, + array $ast + ) {} - public function visitTwigFile(SplFileInfo $file, MessageCatalogue $catalogue, TwigNode $ast) - { - } + public function visitTwigFile( + SplFileInfo $file, + MessageCatalogue $catalogue, + TwigNode $ast + ) {} /** * Returns true if node is a method call. * - * @param \Peast\Syntax\Node\Node $node + * @param Node\Node $node * @param string $objectName * @param string $methodName * * @return bool */ - private function isMethodCall(Node\Node $node, string $objectName, string $methodName): bool - { + private function isMethodCall( + Node\Node $node, + string $objectName, + string $methodName + ): bool { if ($node instanceof Node\CallExpression) { $callee = $node->getCallee(); @@ -147,13 +157,15 @@ private function isMethodCall(Node\Node $node, string $objectName, string $metho /** * Extracts a message domain from the translator call. * - * @param \SplFileInfo $file - * @param \Peast\Syntax\Node\Expression[] $arguments + * @param SplFileInfo $file + * @param Expression[] $arguments * * @return string|null */ - private function extractId(SplFileInfo $file, array $arguments): ?string - { + private function extractId( + SplFileInfo $file, + array $arguments + ): ?string { if (!empty($arguments)) { $idNode = $arguments[self::ID_ARG]; @@ -178,14 +190,17 @@ private function extractId(SplFileInfo $file, array $arguments): ?string /** * Extracts a message domain from the translator call. * - * @param \SplFileInfo $file - * @param \Peast\Syntax\Node\Expression[] $arguments + * @param SplFileInfo $file + * @param Expression[] $arguments * @param string $methodName * * @return string|null */ - private function extractDomain(SplFileInfo $file, array $arguments, string $methodName): ?string - { + private function extractDomain( + SplFileInfo $file, + array $arguments, + string $methodName + ): ?string { $domainArgIndex = $methodName === self::TRANSLATOR_TRANS_METHOD ? self::TRANS_DOMAIN_ARG : self::TRANS_CHOICE_DOMAIN_ARG; @@ -214,7 +229,7 @@ private function extractDomain(SplFileInfo $file, array $arguments, string $meth /** * Extracts a message description from the translator call. * - * @param \Peast\Syntax\Node\Expression[] $arguments + * @param Expression[] $arguments * * @return string|null */ @@ -235,7 +250,7 @@ private function extractDesc(array $arguments): ?string /** * Returns true if file is supported by extractor. * - * @param \SplFileInfo $file + * @param SplFileInfo $file * * @return bool */ diff --git a/src/lib/Translation/Extractor/NotificationTranslationExtractor.php b/src/lib/Translation/Extractor/NotificationTranslationExtractor.php index 8927f0dd7d..724e397e8e 100644 --- a/src/lib/Translation/Extractor/NotificationTranslationExtractor.php +++ b/src/lib/Translation/Extractor/NotificationTranslationExtractor.php @@ -31,25 +31,25 @@ */ class NotificationTranslationExtractor implements LoggerAwareInterface, FileVisitorInterface, NodeVisitor { - /** @var \JMS\TranslationBundle\Translation\FileSourceFactory */ + /** @var FileSourceFactory */ private $fileSourceFactory; - /** @var \PhpParser\NodeTraverser */ + /** @var NodeTraverser */ private $traverser; - /** @var \JMS\TranslationBundle\Model\MessageCatalogue */ + /** @var MessageCatalogue */ private $catalogue; /** @var \SplFileInfo */ private $file; - /** @var \Doctrine\Common\Annotations\DocParser */ + /** @var DocParser */ private $docParser; - /** @var \Psr\Log\LoggerInterface */ + /** @var LoggerInterface */ private $logger; - /** @var \PhpParser\Node */ + /** @var Node */ private $previousNode; /** @@ -64,8 +64,10 @@ class NotificationTranslationExtractor implements LoggerAwareInterface, FileVisi 'error' => 2, ]; - public function __construct(DocParser $docParser, FileSourceFactory $fileSourceFactory) - { + public function __construct( + DocParser $docParser, + FileSourceFactory $fileSourceFactory + ) { $this->docParser = $docParser; $this->fileSourceFactory = $fileSourceFactory; $this->traverser = new NodeTraverser(); @@ -149,32 +151,32 @@ public function enterNode(Node $node) $this->catalogue->add($message); } - public function visitPhpFile(\SplFileInfo $file, MessageCatalogue $catalogue, array $ast) - { + public function visitPhpFile( + \SplFileInfo $file, + MessageCatalogue $catalogue, + array $ast + ) { $this->file = $file; $this->catalogue = $catalogue; $this->traverser->traverse($ast); } - public function beforeTraverse(array $nodes) - { - } + public function beforeTraverse(array $nodes) {} - public function leaveNode(Node $node) - { - } + public function leaveNode(Node $node) {} - public function afterTraverse(array $nodes) - { - } + public function afterTraverse(array $nodes) {} - public function visitFile(\SplFileInfo $file, MessageCatalogue $catalogue) - { - } + public function visitFile( + \SplFileInfo $file, + MessageCatalogue $catalogue + ) {} - public function visitTwigFile(\SplFileInfo $file, MessageCatalogue $catalogue, TwigNode $ast) - { - } + public function visitTwigFile( + \SplFileInfo $file, + MessageCatalogue $catalogue, + TwigNode $ast + ) {} private function getDocCommentForNode(Node $node): ?string { diff --git a/src/lib/Translation/Extractor/PolicyTranslationExtractor.php b/src/lib/Translation/Extractor/PolicyTranslationExtractor.php index 2f8fea5ee2..5863220a0c 100644 --- a/src/lib/Translation/Extractor/PolicyTranslationExtractor.php +++ b/src/lib/Translation/Extractor/PolicyTranslationExtractor.php @@ -38,7 +38,7 @@ public function __construct(array $policyMap) } /** - * @return \JMS\TranslationBundle\Model\MessageCatalogue + * @return MessageCatalogue * * @deprecated Since ibexa/admin-ui 4.4: The method "PolicyTranslationExtractor::extract()" method is deprecated, will be removed in 5.0. */ @@ -67,10 +67,12 @@ public function extract(): MessageCatalogue * @param string $id * @param string $desc * - * @return \JMS\TranslationBundle\Model\Message\XliffMessage|null + * @return XliffMessage|null */ - private function createMessage(string $id, string $desc): ?XliffMessage - { + private function createMessage( + string $id, + string $desc + ): ?XliffMessage { $id = self::MESSAGE_ID_PREFIX . $id; $message = new XliffMessage($id, self::MESSAGE_DOMAIN); diff --git a/src/lib/Translation/Extractor/SortingTranslationExtractor.php b/src/lib/Translation/Extractor/SortingTranslationExtractor.php index d141a645ed..3f1740ceb1 100644 --- a/src/lib/Translation/Extractor/SortingTranslationExtractor.php +++ b/src/lib/Translation/Extractor/SortingTranslationExtractor.php @@ -68,8 +68,11 @@ public function extract(): MessageCatalogue return $catalogue; } - private function createMessage(string $id, string $desc, string $source): Message - { + private function createMessage( + string $id, + string $desc, + string $source + ): Message { $message = new Message\XliffMessage($id, $this->domain); $message->addSource(new FileSource($source)); $message->setMeaning($desc); diff --git a/src/lib/UI/Action/EventDispatcher.php b/src/lib/UI/Action/EventDispatcher.php index 81f5b03d6f..4360eb9554 100644 --- a/src/lib/UI/Action/EventDispatcher.php +++ b/src/lib/UI/Action/EventDispatcher.php @@ -14,11 +14,11 @@ class EventDispatcher implements EventDispatcherInterface { - /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ + /** @var SymfonyEventDispatcher\EventDispatcherInterface */ protected $eventDispatcher; /** - * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher + * @param SymfonyEventDispatcher\EventDispatcherInterface $eventDispatcher */ public function __construct(SymfonyEventDispatcher\EventDispatcherInterface $eventDispatcher) { @@ -26,7 +26,7 @@ public function __construct(SymfonyEventDispatcher\EventDispatcherInterface $eve } /** - * @param \Ibexa\Contracts\AdminUi\UI\Action\UiActionEventInterface $event + * @param UiActionEventInterface $event */ public function dispatch(UiActionEventInterface $event): void { diff --git a/src/lib/UI/Action/FormUiActionMappingDispatcher.php b/src/lib/UI/Action/FormUiActionMappingDispatcher.php index 57441f2a16..794d878167 100644 --- a/src/lib/UI/Action/FormUiActionMappingDispatcher.php +++ b/src/lib/UI/Action/FormUiActionMappingDispatcher.php @@ -14,15 +14,15 @@ class FormUiActionMappingDispatcher { - /** @var \Ibexa\Contracts\AdminUi\UI\Action\FormUiActionMapperInterface[] */ + /** @var FormUiActionMapperInterface[] */ protected $mappers; - /** @var \Ibexa\Contracts\AdminUi\UI\Action\FormUiActionMapperInterface */ + /** @var FormUiActionMapperInterface */ protected $defaultMapper; /** - * @param \Traversable $mappers - * @param \Ibexa\Contracts\AdminUi\UI\Action\FormUiActionMapperInterface $defaultMapper + * @param Traversable $mappers + * @param FormUiActionMapperInterface $defaultMapper */ public function __construct( Traversable $mappers, @@ -33,7 +33,7 @@ public function __construct( } /** - * @return \Ibexa\Contracts\AdminUi\UI\Action\FormUiActionMapperInterface[] + * @return FormUiActionMapperInterface[] */ public function getMappers(): array { @@ -41,7 +41,7 @@ public function getMappers(): array } /** - * @param \Ibexa\Contracts\AdminUi\UI\Action\FormUiActionMapperInterface[] $mappers + * @param FormUiActionMapperInterface[] $mappers */ public function setMappers(array $mappers): void { @@ -49,7 +49,7 @@ public function setMappers(array $mappers): void } /** - * @return \Ibexa\Contracts\AdminUi\UI\Action\FormUiActionMapperInterface + * @return FormUiActionMapperInterface */ public function getDefaultMapper(): FormUiActionMapperInterface { @@ -57,7 +57,7 @@ public function getDefaultMapper(): FormUiActionMapperInterface } /** - * @param \Ibexa\Contracts\AdminUi\UI\Action\FormUiActionMapperInterface $defaultMapper + * @param FormUiActionMapperInterface $defaultMapper */ public function setDefaultMapper(FormUiActionMapperInterface $defaultMapper): void { @@ -65,13 +65,13 @@ public function setDefaultMapper(FormUiActionMapperInterface $defaultMapper): vo } /** - * @param \Symfony\Component\Form\FormInterface $form + * @param FormInterface $form * - * @return \Ibexa\AdminUi\UI\Action\UiActionEvent + * @return UiActionEvent */ public function dispatch(FormInterface $form): UiActionEvent { - /** @var \Ibexa\Contracts\AdminUi\UI\Action\FormUiActionMapperInterface[] $mappers */ + /** @var FormUiActionMapperInterface[] $mappers */ foreach ($this->mappers as $mapper) { if ($mapper === $this->defaultMapper) { continue; diff --git a/src/lib/UI/Action/UiActionEvent.php b/src/lib/UI/Action/UiActionEvent.php index 25ca7285f9..946b5a5160 100644 --- a/src/lib/UI/Action/UiActionEvent.php +++ b/src/lib/UI/Action/UiActionEvent.php @@ -21,20 +21,24 @@ class UiActionEvent extends Event implements UiActionEventInterface /** @var string */ protected $type; - /** @var \Symfony\Component\Form\FormInterface */ + /** @var FormInterface */ protected $form; - /** @var \Symfony\Component\HttpFoundation\Response|null */ + /** @var Response|null */ protected $response; /** * @param string $name * @param string $type - * @param \Symfony\Component\Form\FormInterface $form - * @param \Symfony\Component\HttpFoundation\Response|null $response + * @param FormInterface $form + * @param Response|null $response */ - public function __construct(string $name, string $type, FormInterface $form, ?Response $response) - { + public function __construct( + string $name, + string $type, + FormInterface $form, + ?Response $response + ) { $this->name = $name; $this->type = $type; $this->form = $form; diff --git a/src/lib/UI/Config/Aggregator.php b/src/lib/UI/Config/Aggregator.php index 47737bbacd..9c5bb18408 100644 --- a/src/lib/UI/Config/Aggregator.php +++ b/src/lib/UI/Config/Aggregator.php @@ -16,13 +16,13 @@ */ class Aggregator { - /** @var \Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface[] ApplicationConfigProviders, indexed by namespace string */ + /** @var ProviderInterface[] ApplicationConfigProviders, indexed by namespace string */ protected $providers; /** * Aggregator constructor. * - * @param \Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface[] $providers + * @param ProviderInterface[] $providers */ public function __construct(array $providers = []) { @@ -33,19 +33,21 @@ public function __construct(array $providers = []) * Adds an Provider to the aggregator. * * @param string $key - * @param \Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface $provider + * @param ProviderInterface $provider */ - public function addProvider(string $key, ProviderInterface $provider) - { + public function addProvider( + string $key, + ProviderInterface $provider + ) { $this->providers[$key] = $provider; } /** * @param string $key * - * @return \Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface + * @return ProviderInterface * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException */ public function removeProvider(string $key): ProviderInterface { @@ -57,7 +59,7 @@ public function removeProvider(string $key): ProviderInterface } /** - * @return \Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface[] + * @return ProviderInterface[] */ public function getProviders(): array { @@ -65,7 +67,7 @@ public function getProviders(): array } /** - * @param \Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface[] $providers + * @param ProviderInterface[] $providers */ public function setProviders(array $providers) { diff --git a/src/lib/UI/Config/ConfigWrapper.php b/src/lib/UI/Config/ConfigWrapper.php index d2ff553490..8dca8a0ad5 100644 --- a/src/lib/UI/Config/ConfigWrapper.php +++ b/src/lib/UI/Config/ConfigWrapper.php @@ -36,8 +36,10 @@ public function offsetGet($offset) } #[\ReturnTypeWillChange] - public function offsetSet($offset, $value) - { + public function offsetSet( + $offset, + $value + ) { throw new RuntimeException('Configuration is readonly'); } diff --git a/src/lib/UI/Config/Provider/BackOfficeLanguage.php b/src/lib/UI/Config/Provider/BackOfficeLanguage.php index ec56da8dfa..7fdbe5dd15 100644 --- a/src/lib/UI/Config/Provider/BackOfficeLanguage.php +++ b/src/lib/UI/Config/Provider/BackOfficeLanguage.php @@ -9,11 +9,13 @@ namespace Ibexa\AdminUi\UI\Config\Provider; use Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\User\UserSetting\UserSettingService; final class BackOfficeLanguage implements ProviderInterface { - /** @var \Ibexa\User\UserSetting\UserSettingService */ + /** @var UserSettingService */ private $userSettingService; public function __construct(UserSettingService $userSettingService) @@ -24,8 +26,8 @@ public function __construct(UserSettingService $userSettingService) /** * {@inheritdoc} * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws InvalidArgumentException + * @throws UnauthorizedException */ public function getConfig(): string { diff --git a/src/lib/UI/Config/Provider/ContentTypeMappings.php b/src/lib/UI/Config/Provider/ContentTypeMappings.php index 276cb7403b..67d2830c82 100644 --- a/src/lib/UI/Config/Provider/ContentTypeMappings.php +++ b/src/lib/UI/Config/Provider/ContentTypeMappings.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; /** * Class responsible for generating PlatformUI configuration for Multi File Upload functionality. @@ -128,7 +129,7 @@ private function buildFallbackContentTypeStructure(array $fallbackContentType): /** * @return numeric * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ private function getContentTypeConfiguredMaxFileSize( string $contentTypeIdentifier, diff --git a/src/lib/UI/Config/Provider/ContentTypes.php b/src/lib/UI/Config/Provider/ContentTypes.php index 1e39b7aab2..5cb619e85f 100644 --- a/src/lib/UI/Config/Provider/ContentTypes.php +++ b/src/lib/UI/Config/Provider/ContentTypes.php @@ -30,25 +30,25 @@ */ class ContentTypes implements ProviderInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ + /** @var UserLanguagePreferenceProviderInterface */ private $userLanguagePreferenceProvider; - /** @var \Ibexa\AdminUi\UI\Service\ContentTypeIconResolver */ + /** @var ContentTypeIconResolver */ private $contentTypeIconResolver; - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ + /** @var UrlGeneratorInterface */ private $urlGenerator; private EventDispatcherInterface $eventDispatcher; /** - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider - * @param \Ibexa\AdminUi\UI\Service\ContentTypeIconResolver $contentTypeIconResolver - * @param \Symfony\Component\Routing\Generator\UrlGeneratorInterface $urlGenerator + * @param ContentTypeService $contentTypeService + * @param UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider + * @param ContentTypeIconResolver $contentTypeIconResolver + * @param UrlGeneratorInterface $urlGenerator */ public function __construct( ContentTypeService $contentTypeService, @@ -81,7 +81,7 @@ public function getConfig() $eventContentTypeGroups[] = $contentTypeGroup; } - /** @var \Ibexa\AdminUi\Event\AddContentTypeGroupToUIConfigEvent $event */ + /** @var AddContentTypeGroupToUIConfigEvent $event */ $event = $this->eventDispatcher->dispatch(new AddContentTypeGroupToUIConfigEvent($eventContentTypeGroups)); foreach ($event->getContentTypeGroups() as $contentTypeGroup) { @@ -90,7 +90,10 @@ public function getConfig() $preferredLanguages ); - usort($contentTypes, static function (ContentType $contentType1, ContentType $contentType2) { + usort($contentTypes, static function ( + ContentType $contentType1, + ContentType $contentType2 + ) { return strnatcasecmp($contentType1->getName(), $contentType2->getName()); }); @@ -102,7 +105,7 @@ public function getConfig() } } - /** @var \Ibexa\AdminUi\Event\FilterContentTypesEvent $event */ + /** @var FilterContentTypesEvent $event */ $event = $this->eventDispatcher->dispatch(new FilterContentTypesEvent($contentTypeGroups)); return $event->getContentTypeGroups(); @@ -111,8 +114,10 @@ public function getConfig() /** * @phpstan-return TContentTypeData */ - private function getContentTypeData(ContentType $contentType, bool $isHidden): array - { + private function getContentTypeData( + ContentType $contentType, + bool $isHidden + ): array { return [ 'id' => $contentType->id, 'identifier' => $contentType->identifier, diff --git a/src/lib/UI/Config/Provider/DateFormat.php b/src/lib/UI/Config/Provider/DateFormat.php index 56da542698..d0347c61bc 100644 --- a/src/lib/UI/Config/Provider/DateFormat.php +++ b/src/lib/UI/Config/Provider/DateFormat.php @@ -14,18 +14,20 @@ class DateFormat implements ProviderInterface { - /** @var \Ibexa\User\UserSetting\UserSettingService */ + /** @var UserSettingService */ protected $userSettingService; - /** @var \Ibexa\User\UserSetting\Setting\DateTimeFormatSerializer */ + /** @var DateTimeFormatSerializer */ protected $dateTimeFormatSerializer; /** - * @param \Ibexa\User\UserSetting\UserSettingService $userSettingService - * @param \Ibexa\User\UserSetting\Setting\DateTimeFormatSerializer $dateTimeFormatSerializer + * @param UserSettingService $userSettingService + * @param DateTimeFormatSerializer $dateTimeFormatSerializer */ - public function __construct(UserSettingService $userSettingService, DateTimeFormatSerializer $dateTimeFormatSerializer) - { + public function __construct( + UserSettingService $userSettingService, + DateTimeFormatSerializer $dateTimeFormatSerializer + ) { $this->userSettingService = $userSettingService; $this->dateTimeFormatSerializer = $dateTimeFormatSerializer; } diff --git a/src/lib/UI/Config/Provider/FieldType/ImageAsset/Mapping.php b/src/lib/UI/Config/Provider/FieldType/ImageAsset/Mapping.php index e9705b4e52..761b8b89f7 100644 --- a/src/lib/UI/Config/Provider/FieldType/ImageAsset/Mapping.php +++ b/src/lib/UI/Config/Provider/FieldType/ImageAsset/Mapping.php @@ -16,11 +16,11 @@ */ class Mapping implements ProviderInterface { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; /** - * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver + * @param ConfigResolverInterface $configResolver */ public function __construct(ConfigResolverInterface $configResolver) { diff --git a/src/lib/UI/Config/Provider/IconPaths.php b/src/lib/UI/Config/Provider/IconPaths.php index 6fd48e16f7..c5c2d4ede4 100644 --- a/src/lib/UI/Config/Provider/IconPaths.php +++ b/src/lib/UI/Config/Provider/IconPaths.php @@ -16,7 +16,7 @@ */ final class IconPaths implements ProviderInterface { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct(ConfigResolverInterface $configResolver) diff --git a/src/lib/UI/Config/Provider/Languages.php b/src/lib/UI/Config/Provider/Languages.php index ab8a06ca9a..fc8eeb56d9 100644 --- a/src/lib/UI/Config/Provider/Languages.php +++ b/src/lib/UI/Config/Provider/Languages.php @@ -18,22 +18,20 @@ */ class Languages implements ProviderInterface { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; /** @var string[] */ private $siteAccesses; - /** @var \Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessServiceInterface */ + /** @var SiteAccessServiceInterface */ private $siteAccessService; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService - * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver - * @param string[] + * @param string[] $siteAccesses */ public function __construct( LanguageService $languageService, diff --git a/src/lib/UI/Config/Provider/Locations.php b/src/lib/UI/Config/Provider/Locations.php index af2f2e1457..820d1c9314 100644 --- a/src/lib/UI/Config/Provider/Locations.php +++ b/src/lib/UI/Config/Provider/Locations.php @@ -17,7 +17,7 @@ final class Locations implements ProviderInterface private const CONTENT_STRUCTURE_IDENTIFIER = 'contentStructure'; private const USERS_IDENTIFIER = 'users'; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( diff --git a/src/lib/UI/Config/Provider/Module/ContentTree.php b/src/lib/UI/Config/Provider/Module/ContentTree.php index 85b8dfdaab..50bd5300b9 100644 --- a/src/lib/UI/Config/Provider/Module/ContentTree.php +++ b/src/lib/UI/Config/Provider/Module/ContentTree.php @@ -12,11 +12,11 @@ class ContentTree implements ProviderInterface { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; /** - * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver + * @param ConfigResolverInterface $configResolver */ public function __construct( ConfigResolverInterface $configResolver diff --git a/src/lib/UI/Config/Provider/Module/DamWidget.php b/src/lib/UI/Config/Provider/Module/DamWidget.php index 40363e5712..f43299b978 100644 --- a/src/lib/UI/Config/Provider/Module/DamWidget.php +++ b/src/lib/UI/Config/Provider/Module/DamWidget.php @@ -12,6 +12,7 @@ use Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider; use Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\NameSchema\SchemaIdentifierExtractorInterface; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; @@ -81,7 +82,7 @@ public function __construct( * folder: TFolderConfig * } * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ public function getConfig(): array { @@ -94,7 +95,7 @@ public function getConfig(): array /** * @phpstan-return TImageConfig * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ private function getImageConfig(): array { @@ -127,7 +128,7 @@ private function getImageConfig(): array /** * @phpstan-return TFolderConfig * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ private function getFolderConfig(): array { @@ -142,7 +143,7 @@ private function getFolderConfig(): array } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ private function loadContentType(string $contentTypeIdentifier): ContentType { @@ -158,7 +159,7 @@ private function extractNameSchemaIdentifiers(ContentType $contentType): array } /** - * @throws \Ibexa\Bundle\Core\ApiLoader\Exception\InvalidSearchEngine + * @throws InvalidSearchEngine */ private function showImageFilters(): bool { diff --git a/src/lib/UI/Config/Provider/Module/SubItemsList.php b/src/lib/UI/Config/Provider/Module/SubItemsList.php index b0d6dd8ffe..6306af909d 100644 --- a/src/lib/UI/Config/Provider/Module/SubItemsList.php +++ b/src/lib/UI/Config/Provider/Module/SubItemsList.php @@ -9,6 +9,8 @@ namespace Ibexa\AdminUi\UI\Config\Provider\Module; use Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\User\UserSetting\UserSettingService; /** @@ -16,11 +18,11 @@ */ class SubItemsList implements ProviderInterface { - /** @var \Ibexa\User\UserSetting\UserSettingService */ + /** @var UserSettingService */ private $userSettingService; /** - * @param \Ibexa\User\UserSetting\UserSettingService $userSettingService + * @param UserSettingService $userSettingService */ public function __construct(UserSettingService $userSettingService) { @@ -30,8 +32,8 @@ public function __construct(UserSettingService $userSettingService) /** * @return array * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws InvalidArgumentException + * @throws UnauthorizedException */ public function getConfig(): array { diff --git a/src/lib/UI/Config/Provider/Module/UniversalDiscoveryWidget.php b/src/lib/UI/Config/Provider/Module/UniversalDiscoveryWidget.php index 2563ff6384..1b2ffc333f 100644 --- a/src/lib/UI/Config/Provider/Module/UniversalDiscoveryWidget.php +++ b/src/lib/UI/Config/Provider/Module/UniversalDiscoveryWidget.php @@ -15,11 +15,11 @@ */ class UniversalDiscoveryWidget implements ProviderInterface { - /** @var \Ibexa\AdminUi\UniversalDiscovery\ConfigResolver */ + /** @var ConfigResolver */ private $configResolver; /** - * @param \Ibexa\AdminUi\UniversalDiscovery\ConfigResolver $configResolver + * @param ConfigResolver $configResolver */ public function __construct( ConfigResolver $configResolver diff --git a/src/lib/UI/Config/Provider/Notifications.php b/src/lib/UI/Config/Provider/Notifications.php index fe16674bb8..2145dc08ee 100644 --- a/src/lib/UI/Config/Provider/Notifications.php +++ b/src/lib/UI/Config/Provider/Notifications.php @@ -18,11 +18,11 @@ class Notifications implements ProviderInterface { public const NOTIFICATION_TYPES = ['error', 'warning', 'info', 'success']; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; /** - * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver + * @param ConfigResolverInterface $configResolver */ public function __construct(ConfigResolverInterface $configResolver) { diff --git a/src/lib/UI/Config/Provider/ScopeParameterBasedValue.php b/src/lib/UI/Config/Provider/ScopeParameterBasedValue.php index 549d7ae75b..a0e86db61a 100644 --- a/src/lib/UI/Config/Provider/ScopeParameterBasedValue.php +++ b/src/lib/UI/Config/Provider/ScopeParameterBasedValue.php @@ -13,7 +13,7 @@ class ScopeParameterBasedValue implements ProviderInterface { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ protected $configResolver; /** @var string */ diff --git a/src/lib/UI/Config/Provider/Sections.php b/src/lib/UI/Config/Provider/Sections.php index 2a3090b8ba..4b02af3b7c 100644 --- a/src/lib/UI/Config/Provider/Sections.php +++ b/src/lib/UI/Config/Provider/Sections.php @@ -10,13 +10,14 @@ use Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface; use Ibexa\Contracts\Core\Repository\SectionService; +use Ibexa\Contracts\Core\Repository\Values\Content\Section; /** * Provides information about sections. */ class Sections implements ProviderInterface { - /** @var \Ibexa\Contracts\Core\Repository\SectionService */ + /** @var SectionService */ private $sectionService; public function __construct( @@ -30,7 +31,7 @@ public function getConfig(): array $sections = $this->sectionService->loadSections(); $config = []; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Section $section */ + /** @var Section $section */ foreach ($sections as $section) { $config[$section->identifier] = $section->name; } diff --git a/src/lib/UI/Config/Provider/SortFieldMappings.php b/src/lib/UI/Config/Provider/SortFieldMappings.php index 3cf6cf585e..5be84de10f 100644 --- a/src/lib/UI/Config/Provider/SortFieldMappings.php +++ b/src/lib/UI/Config/Provider/SortFieldMappings.php @@ -9,11 +9,12 @@ namespace Ibexa\AdminUi\UI\Config\Provider; use Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface; +use Ibexa\Contracts\Rest\Output\ValueObjectVisitor; /** * Provides information about mapping between serialized sort field and the value accepted by sort clause. * - * @see \Ibexa\Contracts\Rest\Output\ValueObjectVisitor::serializeSortField + * @see ValueObjectVisitor::serializeSortField */ class SortFieldMappings implements ProviderInterface { @@ -23,15 +24,15 @@ class SortFieldMappings implements ProviderInterface public function getConfig(): array { return [ - 'PATH' => 'LocationPath', - 'PUBLISHED' => 'DatePublished', - 'MODIFIED' => 'DateModified', - 'SECTION' => 'SectionIdentifier', - 'DEPTH' => 'LocationDepth', - 'PRIORITY' => 'LocationPriority', - 'NAME' => 'ContentName', - 'NODE_ID' => 'LocationId', - 'CONTENTOBJECT_ID' => 'ContentId', + 'PATH' => 'LocationPath', + 'PUBLISHED' => 'DatePublished', + 'MODIFIED' => 'DateModified', + 'SECTION' => 'SectionIdentifier', + 'DEPTH' => 'LocationDepth', + 'PRIORITY' => 'LocationPriority', + 'NAME' => 'ContentName', + 'NODE_ID' => 'LocationId', + 'CONTENTOBJECT_ID' => 'ContentId', ]; } } diff --git a/src/lib/UI/Config/Provider/SortOrderMappings.php b/src/lib/UI/Config/Provider/SortOrderMappings.php index 5e1a5a7764..06a02c38f1 100644 --- a/src/lib/UI/Config/Provider/SortOrderMappings.php +++ b/src/lib/UI/Config/Provider/SortOrderMappings.php @@ -10,11 +10,12 @@ use Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Query; +use Ibexa\Contracts\Rest\Output\ValueObjectVisitor; /** * Provides information about mapping between serialized sort order and the value accepted by sort clause. * - * @see \Ibexa\Contracts\Rest\Output\ValueObjectVisitor::serializeSortOrder + * @see ValueObjectVisitor::serializeSortOrder */ class SortOrderMappings implements ProviderInterface { diff --git a/src/lib/UI/Config/Provider/SuggestionSetting.php b/src/lib/UI/Config/Provider/SuggestionSetting.php index 33df81827b..5e04579be7 100644 --- a/src/lib/UI/Config/Provider/SuggestionSetting.php +++ b/src/lib/UI/Config/Provider/SuggestionSetting.php @@ -16,8 +16,10 @@ final class SuggestionSetting implements ProviderInterface private int $resultLimit; - public function __construct(int $minQueryLength, int $resultLimit) - { + public function __construct( + int $minQueryLength, + int $resultLimit + ) { $this->minQueryLength = $minQueryLength; $this->resultLimit = $resultLimit; } diff --git a/src/lib/UI/Config/Provider/Timezone.php b/src/lib/UI/Config/Provider/Timezone.php index 2cb14eca37..28478e6c0d 100644 --- a/src/lib/UI/Config/Provider/Timezone.php +++ b/src/lib/UI/Config/Provider/Timezone.php @@ -9,15 +9,17 @@ namespace Ibexa\AdminUi\UI\Config\Provider; use Ibexa\Contracts\AdminUi\UI\Config\ProviderInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\User\UserSetting\UserSettingService; class Timezone implements ProviderInterface { - /** @var \Ibexa\User\UserSetting\UserSettingService */ + /** @var UserSettingService */ protected $userSettingService; /** - * @param \Ibexa\User\UserSetting\UserSettingService $userSettingService + * @param UserSettingService $userSettingService */ public function __construct(UserSettingService $userSettingService) { @@ -29,8 +31,8 @@ public function __construct(UserSettingService $userSettingService) * * @return string * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws InvalidArgumentException + * @throws UnauthorizedException */ public function getConfig(): string { diff --git a/src/lib/UI/Config/Provider/User.php b/src/lib/UI/Config/Provider/User.php index 5caaab197f..ee9b43360e 100644 --- a/src/lib/UI/Config/Provider/User.php +++ b/src/lib/UI/Config/Provider/User.php @@ -20,15 +20,15 @@ */ class User implements ProviderInterface { - /** @var \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface */ + /** @var TokenStorageInterface */ private $tokenStorage; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; /** - * @param \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface $tokenStorage - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService + * @param TokenStorageInterface $tokenStorage + * @param ContentTypeService $contentTypeService */ public function __construct( TokenStorageInterface $tokenStorage, @@ -65,9 +65,9 @@ public function getConfig(): array /** * Returns first occurrence of an `ezimage` fieldtype. * - * @param \Ibexa\Contracts\Core\Repository\Values\User\User $user + * @param ApiUser $user * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Field|null + * @return Field|null */ private function resolveProfilePictureField(ApiUser $user): ?Field { diff --git a/src/lib/UI/Config/Provider/UserContentTypes.php b/src/lib/UI/Config/Provider/UserContentTypes.php index 2ea187b62a..7d170bbe62 100644 --- a/src/lib/UI/Config/Provider/UserContentTypes.php +++ b/src/lib/UI/Config/Provider/UserContentTypes.php @@ -13,11 +13,11 @@ class UserContentTypes implements ProviderInterface { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; /** - * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver + * @param ConfigResolverInterface $configResolver */ public function __construct(ConfigResolverInterface $configResolver) { diff --git a/src/lib/UI/Dataset/BookmarksDataset.php b/src/lib/UI/Dataset/BookmarksDataset.php index 5d84cc3f70..95aab473c2 100644 --- a/src/lib/UI/Dataset/BookmarksDataset.php +++ b/src/lib/UI/Dataset/BookmarksDataset.php @@ -7,24 +7,26 @@ namespace Ibexa\AdminUi\UI\Dataset; +use Ibexa\AdminUi\UI\Value\Location\Bookmark; use Ibexa\AdminUi\UI\Value\ValueFactory; use Ibexa\Contracts\Core\Repository\BookmarkService; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\Values\Content\Location; class BookmarksDataset { - /** @var \Ibexa\Contracts\Core\Repository\BookmarkService */ + /** @var BookmarkService */ private $bookmarkService; - /** @var \Ibexa\AdminUi\UI\Value\ValueFactory */ + /** @var ValueFactory */ private $valueFactory; - /** @var \Ibexa\AdminUi\UI\Value\Location\Bookmark[] */ + /** @var Bookmark[] */ private $data; /** - * @param \Ibexa\Contracts\Core\Repository\BookmarkService $bookmarkService - * @param \Ibexa\AdminUi\UI\Value\ValueFactory $valueFactory + * @param BookmarkService $bookmarkService + * @param ValueFactory $valueFactory */ public function __construct( BookmarkService $bookmarkService, @@ -38,12 +40,14 @@ public function __construct( * @param int $offset * @param int $limit * - * @return \Ibexa\AdminUi\UI\Dataset\BookmarksDataset + * @return BookmarksDataset * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ - public function load(int $offset = 0, int $limit = 25): self - { + public function load( + int $offset = 0, + int $limit = 25 + ): self { $this->data = array_map( function (Location $location) { return $this->valueFactory->createBookmark($location); @@ -55,7 +59,7 @@ function (Location $location) { } /** - * @return \Ibexa\AdminUi\UI\Value\Location\Bookmark[] + * @return Bookmark[] */ public function getBookmarks(): array { diff --git a/src/lib/UI/Dataset/ContentDraftListDataset.php b/src/lib/UI/Dataset/ContentDraftListDataset.php index 41b0d742c4..bb3e456e52 100644 --- a/src/lib/UI/Dataset/ContentDraftListDataset.php +++ b/src/lib/UI/Dataset/ContentDraftListDataset.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\UI\Dataset; +use Ibexa\AdminUi\UI\Value\Content\ContentDraftInterface; use Ibexa\AdminUi\UI\Value\ValueFactory; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentTypeService; @@ -16,22 +17,22 @@ class ContentDraftListDataset { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\AdminUi\UI\Value\ValueFactory */ + /** @var ValueFactory */ private $valueFactory; - /** @var \Ibexa\AdminUi\UI\Value\Content\ContentDraftInterface[] */ + /** @var ContentDraftInterface[] */ private $data = []; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\AdminUi\UI\Value\ValueFactory $valueFactory + * @param ContentService $contentService + * @param ContentTypeService $contentTypeService + * @param ValueFactory $valueFactory */ public function __construct( ContentService $contentService, @@ -43,8 +44,11 @@ public function __construct( $this->valueFactory = $valueFactory; } - public function load(?User $user = null, int $offset = 0, int $limit = 10): self - { + public function load( + ?User $user = null, + int $offset = 0, + int $limit = 10 + ): self { $contentDraftListItems = $this->contentService->loadContentDraftList($user, $offset, $limit)->items; $contentTypes = $contentTypeIds = []; @@ -76,7 +80,7 @@ function (ContentDraftListItemInterface $contentDraftListItem) use ($contentType } /** - * @return \Ibexa\AdminUi\UI\Value\Content\ContentDraftInterface[] + * @return ContentDraftInterface[] */ public function getContentDrafts(): array { diff --git a/src/lib/UI/Dataset/ContentDraftsDataset.php b/src/lib/UI/Dataset/ContentDraftsDataset.php index ef336496a4..ede55aa296 100644 --- a/src/lib/UI/Dataset/ContentDraftsDataset.php +++ b/src/lib/UI/Dataset/ContentDraftsDataset.php @@ -22,22 +22,22 @@ */ class ContentDraftsDataset { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; /** @var array */ private $data = []; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService + * @param ContentService $contentService + * @param ContentTypeService $contentTypeService + * @param LocationService $locationService */ public function __construct( ContentService $contentService, @@ -74,7 +74,10 @@ public function load(?User $user = null): self // ContentService::loadContentDrafts returns unsorted list of VersionInfo. // Sort results by modification date, descending. - usort($contentDrafts, static function (VersionInfo $a, VersionInfo $b) { + usort($contentDrafts, static function ( + VersionInfo $a, + VersionInfo $b + ) { return $b->modificationDate <=> $a->modificationDate; }); @@ -100,13 +103,15 @@ public function getContentDrafts(): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $draft - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param VersionInfo $draft + * @param ContentType $contentType * * @return array */ - private function mapContentDraft(VersionInfo $draft, ContentType $contentType): array - { + private function mapContentDraft( + VersionInfo $draft, + ContentType $contentType + ): array { $contentInfo = $draft->getContentInfo(); return [ diff --git a/src/lib/UI/Dataset/CustomUrlsDataset.php b/src/lib/UI/Dataset/CustomUrlsDataset.php index 89a7814dd6..24fc2630d2 100644 --- a/src/lib/UI/Dataset/CustomUrlsDataset.php +++ b/src/lib/UI/Dataset/CustomUrlsDataset.php @@ -17,16 +17,16 @@ class CustomUrlsDataset { - /** @var \Ibexa\Contracts\Core\Repository\URLAliasService */ + /** @var URLAliasService */ private $urlAliasService; - /** @var \Ibexa\AdminUi\UI\Value\ValueFactory */ + /** @var ValueFactory */ private $valueFactory; /** @var \Ibexa\AdminUi\UI\Value\Content\UrlAlias[] */ private $data; - /** @var \Psr\Log\LoggerInterface */ + /** @var LoggerInterface */ private $logger; public function __construct( @@ -40,9 +40,9 @@ public function __construct( } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * - * @return \Ibexa\AdminUi\UI\Dataset\CustomUrlsDataset + * @return CustomUrlsDataset */ public function load(Location $location): self { diff --git a/src/lib/UI/Dataset/DatasetFactory.php b/src/lib/UI/Dataset/DatasetFactory.php index 50ded6e184..a4d49a3247 100644 --- a/src/lib/UI/Dataset/DatasetFactory.php +++ b/src/lib/UI/Dataset/DatasetFactory.php @@ -28,37 +28,37 @@ class DatasetFactory implements LoggerAwareInterface { use LoggerAwareTrait; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ protected $contentService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ protected $languageService; - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ + /** @var ObjectStateService */ protected $objectStateService; - /** @var \Ibexa\AdminUi\UI\Value\ValueFactory */ + /** @var ValueFactory */ protected $valueFactory; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ protected $locationService; - /** @var \Ibexa\Contracts\Core\Repository\URLAliasService */ + /** @var URLAliasService */ private $urlAliasService; - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ private $roleService; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; - /** @var \Ibexa\Contracts\Core\Repository\BookmarkService */ + /** @var BookmarkService */ private $bookmarkService; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( @@ -90,7 +90,7 @@ public function __construct( } /** - * @return \Ibexa\AdminUi\UI\Dataset\VersionsDataset + * @return VersionsDataset */ public function versions(): VersionsDataset { @@ -98,7 +98,7 @@ public function versions(): VersionsDataset } /** - * @return \Ibexa\AdminUi\UI\Dataset\TranslationsDataset + * @return TranslationsDataset */ public function translations(): TranslationsDataset { @@ -108,7 +108,7 @@ public function translations(): TranslationsDataset /** * @deprecated since version 2.5, to be removed in 3.0. Please use DatasetFactory::relationList and DatasetFactory::reverseRelationList instead. * - * @return \Ibexa\AdminUi\UI\Dataset\RelationsDataset + * @return RelationsDataset */ public function relations(): RelationsDataset { @@ -116,7 +116,7 @@ public function relations(): RelationsDataset } /** - * @return \Ibexa\AdminUi\UI\Dataset\RelationListDataset + * @return RelationListDataset */ public function relationList(): RelationListDataset { @@ -127,7 +127,7 @@ public function relationList(): RelationListDataset } /** - * @return \Ibexa\AdminUi\UI\Dataset\ReverseRelationListDataset + * @return ReverseRelationListDataset */ public function reverseRelationList(): ReverseRelationListDataset { @@ -138,7 +138,7 @@ public function reverseRelationList(): ReverseRelationListDataset } /** - * @return \Ibexa\AdminUi\UI\Dataset\LocationsDataset + * @return LocationsDataset */ public function locations(): LocationsDataset { @@ -146,7 +146,7 @@ public function locations(): LocationsDataset } /** - * @return \Ibexa\AdminUi\UI\Dataset\ObjectStatesDataset + * @return ObjectStatesDataset */ public function objectStates(): ObjectStatesDataset { @@ -154,7 +154,7 @@ public function objectStates(): ObjectStatesDataset } /** - * @return \Ibexa\AdminUi\UI\Dataset\CustomUrlsDataset + * @return CustomUrlsDataset */ public function customUrls(): CustomUrlsDataset { @@ -162,7 +162,7 @@ public function customUrls(): CustomUrlsDataset } /** - * @return \Ibexa\AdminUi\UI\Dataset\RolesDataset + * @return RolesDataset */ public function roles(): RolesDataset { @@ -178,7 +178,7 @@ public function roles(): RolesDataset } /** - * @return \Ibexa\AdminUi\UI\Dataset\PoliciesDataset + * @return PoliciesDataset */ public function policies(): PoliciesDataset { @@ -194,7 +194,7 @@ public function policies(): PoliciesDataset } /** - * @return \Ibexa\AdminUi\UI\Dataset\BookmarksDataset + * @return BookmarksDataset */ public function bookmarks(): BookmarksDataset { @@ -207,7 +207,7 @@ public function bookmarks(): BookmarksDataset /** * @deprecated since version 2.5, to be removed in 3.0. Please use DatasetFactory::contentDraftList instead. * - * @return \Ibexa\AdminUi\UI\Dataset\ContentDraftsDataset + * @return ContentDraftsDataset */ public function contentDrafts(): ContentDraftsDataset { @@ -219,7 +219,7 @@ public function contentDrafts(): ContentDraftsDataset } /** - * @return \Ibexa\AdminUi\UI\Dataset\ContentDraftListDataset + * @return ContentDraftListDataset */ public function contentDraftList(): ContentDraftListDataset { diff --git a/src/lib/UI/Dataset/LocationsDataset.php b/src/lib/UI/Dataset/LocationsDataset.php index 493f25fa81..1105a72c23 100644 --- a/src/lib/UI/Dataset/LocationsDataset.php +++ b/src/lib/UI/Dataset/LocationsDataset.php @@ -11,30 +11,33 @@ use Ibexa\AdminUi\UI\Value\ValueFactory; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; class LocationsDataset { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ protected $locationService; - /** @var \Ibexa\AdminUi\UI\Value\ValueFactory */ + /** @var ValueFactory */ protected $valueFactory; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location[] */ + /** @var Location[] */ protected $data; /** - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService - * @param \Ibexa\AdminUi\UI\Value\ValueFactory $valueFactory + * @param LocationService $locationService + * @param ValueFactory $valueFactory */ - public function __construct(LocationService $locationService, ValueFactory $valueFactory) - { + public function __construct( + LocationService $locationService, + ValueFactory $valueFactory + ) { $this->locationService = $locationService; $this->valueFactory = $valueFactory; } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo + * @param ContentInfo $contentInfo * * @return LocationsDataset */ @@ -50,9 +53,9 @@ public function load(ContentInfo $contentInfo): self } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location[] $locations + * @param Location[] $locations * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location[] + * @return Location[] */ protected function prioritizeMainLocation(array $locations): array { @@ -68,7 +71,7 @@ protected function prioritizeMainLocation(array $locations): array } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location[] + * @return Location[] */ public function getLocations(): array { diff --git a/src/lib/UI/Dataset/ObjectStatesDataset.php b/src/lib/UI/Dataset/ObjectStatesDataset.php index 405c89dae5..6636d40df1 100644 --- a/src/lib/UI/Dataset/ObjectStatesDataset.php +++ b/src/lib/UI/Dataset/ObjectStatesDataset.php @@ -16,27 +16,29 @@ class ObjectStatesDataset { - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ + /** @var ObjectStateService */ protected $objectStateService; - /** @var \Ibexa\AdminUi\UI\Value\ValueFactory */ + /** @var ValueFactory */ protected $valueFactory; /** @var UIValue\ObjectState\ObjectState[] */ protected $data; /** - * @param \Ibexa\Contracts\Core\Repository\ObjectStateService $objectStateService - * @param \Ibexa\AdminUi\UI\Value\ValueFactory $valueFactory + * @param ObjectStateService $objectStateService + * @param ValueFactory $valueFactory */ - public function __construct(ObjectStateService $objectStateService, ValueFactory $valueFactory) - { + public function __construct( + ObjectStateService $objectStateService, + ValueFactory $valueFactory + ) { $this->objectStateService = $objectStateService; $this->valueFactory = $valueFactory; } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo + * @param ContentInfo $contentInfo * * @return ObjectStatesDataset */ diff --git a/src/lib/UI/Dataset/PoliciesDataset.php b/src/lib/UI/Dataset/PoliciesDataset.php index 989042156d..a9db99ec1c 100644 --- a/src/lib/UI/Dataset/PoliciesDataset.php +++ b/src/lib/UI/Dataset/PoliciesDataset.php @@ -8,11 +8,15 @@ namespace Ibexa\AdminUi\UI\Dataset; +use Ibexa\AdminUi\Exception\InvalidArgumentException; use Ibexa\AdminUi\Specification\ContentType\ContentTypeIsUser; use Ibexa\AdminUi\Specification\ContentType\ContentTypeIsUserGroup; +use Ibexa\AdminUi\UI\Value\Content\UrlAlias; use Ibexa\AdminUi\UI\Value\ValueFactory; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\RoleService; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\Location; @@ -20,19 +24,19 @@ class PoliciesDataset { - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ private $roleService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; - /** @var \Ibexa\AdminUi\UI\Value\ValueFactory */ + /** @var ValueFactory */ protected $valueFactory; /** @var array */ @@ -41,15 +45,15 @@ class PoliciesDataset /** @var array */ private $userGroupContentTypeIdentifier; - /** @var \Ibexa\AdminUi\UI\Value\Content\UrlAlias[] */ + /** @var UrlAlias[] */ private $data; /** - * @param \Ibexa\Contracts\Core\Repository\RoleService $roleService - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Contracts\Core\Repository\UserService $userService - * @param \Ibexa\AdminUi\UI\Value\ValueFactory $valueFactory + * @param RoleService $roleService + * @param ContentService $contentService + * @param ContentTypeService $contentTypeService + * @param UserService $userService + * @param ValueFactory $valueFactory * @param array $userContentTypeIdentifier * @param array $userGroupContentTypeIdentifier */ @@ -72,14 +76,14 @@ public function __construct( } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * - * @return \Ibexa\AdminUi\UI\Dataset\PoliciesDataset + * @return PoliciesDataset * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws UnauthorizedException + * @throws NotFoundException */ public function load(Location $location): self { diff --git a/src/lib/UI/Dataset/RelationListDataset.php b/src/lib/UI/Dataset/RelationListDataset.php index 014ac3d284..96f13986c5 100644 --- a/src/lib/UI/Dataset/RelationListDataset.php +++ b/src/lib/UI/Dataset/RelationListDataset.php @@ -8,39 +8,45 @@ namespace Ibexa\AdminUi\UI\Dataset; +use Ibexa\AdminUi\UI\Value\Content\RelationInterface; use Ibexa\AdminUi\UI\Value\ValueFactory; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Values\Content\Content; +use Ibexa\Contracts\Core\Repository\Values\Content\RelationList\Item\RelationListItem; +use Ibexa\Contracts\Core\Repository\Values\Content\RelationList\Item\UnauthorizedRelationListItem; use Ibexa\Contracts\Core\Repository\Values\Content\RelationList\RelationListItemInterface; final class RelationListDataset { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\AdminUi\UI\Value\ValueFactory */ + /** @var ValueFactory */ private $valueFactory; - /** @var \Ibexa\AdminUi\UI\Value\Content\RelationInterface[] */ + /** @var RelationInterface[] */ private $relations; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\AdminUi\UI\Value\ValueFactory $valueFactory + * @param ContentService $contentService + * @param ValueFactory $valueFactory */ - public function __construct(ContentService $contentService, ValueFactory $valueFactory) - { + public function __construct( + ContentService $contentService, + ValueFactory $valueFactory + ) { $this->contentService = $contentService; $this->valueFactory = $valueFactory; $this->relations = []; } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param Content $content * - * @return \Ibexa\AdminUi\UI\Dataset\RelationListDataset + * @return RelationListDataset * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException */ public function load( Content $content, @@ -53,14 +59,14 @@ public function load( $this->relations = array_map( function (RelationListItemInterface $relationListItem) use ($content) { if ($relationListItem->hasRelation()) { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\RelationList\Item\RelationListItem $relationListItem */ + /** @var RelationListItem $relationListItem */ return $this->valueFactory->createRelationItem( $relationListItem, $content ); } - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\RelationList\Item\UnauthorizedRelationListItem $relationListItem */ + /** @var UnauthorizedRelationListItem $relationListItem */ return $this->valueFactory->createUnauthorizedRelationItem( $relationListItem ); @@ -72,7 +78,7 @@ function (RelationListItemInterface $relationListItem) use ($content) { } /** - * @return \Ibexa\AdminUi\UI\Value\Content\RelationInterface[] + * @return RelationInterface[] */ public function getRelations(): array { diff --git a/src/lib/UI/Dataset/RelationsDataset.php b/src/lib/UI/Dataset/RelationsDataset.php index 350a4513cf..c97ce4bd16 100644 --- a/src/lib/UI/Dataset/RelationsDataset.php +++ b/src/lib/UI/Dataset/RelationsDataset.php @@ -11,14 +11,15 @@ use Ibexa\AdminUi\UI\Value as UIValue; use Ibexa\AdminUi\UI\Value\ValueFactory; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Values\Content\Content; class RelationsDataset { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ protected $contentService; - /** @var \Ibexa\AdminUi\UI\Value\ValueFactory */ + /** @var ValueFactory */ protected $valueFactory; /** @var UIValue\Content\Relation[] */ @@ -28,11 +29,13 @@ class RelationsDataset protected $reverseRelations; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\AdminUi\UI\Value\ValueFactory $valueFactory + * @param ContentService $contentService + * @param ValueFactory $valueFactory */ - public function __construct(ContentService $contentService, ValueFactory $valueFactory) - { + public function __construct( + ContentService $contentService, + ValueFactory $valueFactory + ) { $this->contentService = $contentService; $this->valueFactory = $valueFactory; $this->relations = []; @@ -44,7 +47,7 @@ public function __construct(ContentService $contentService, ValueFactory $valueF * * @return RelationsDataset * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException */ public function load(Content $content): self { diff --git a/src/lib/UI/Dataset/ReverseRelationListDataset.php b/src/lib/UI/Dataset/ReverseRelationListDataset.php index 6c2b00250b..f15fdb2c02 100644 --- a/src/lib/UI/Dataset/ReverseRelationListDataset.php +++ b/src/lib/UI/Dataset/ReverseRelationListDataset.php @@ -8,39 +8,44 @@ namespace Ibexa\AdminUi\UI\Dataset; +use Ibexa\AdminUi\UI\Value\Content\RelationInterface; use Ibexa\AdminUi\UI\Value\ValueFactory; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\Values\Content\Content; +use Ibexa\Contracts\Core\Repository\Values\Content\RelationList\Item\RelationListItem; +use Ibexa\Contracts\Core\Repository\Values\Content\RelationList\Item\UnauthorizedRelationListItem; use Ibexa\Contracts\Core\Repository\Values\Content\RelationList\RelationListItemInterface; final class ReverseRelationListDataset { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\AdminUi\UI\Value\ValueFactory */ + /** @var ValueFactory */ private $valueFactory; - /** @var \Ibexa\AdminUi\UI\Value\Content\RelationInterface[] */ + /** @var RelationInterface[] */ private $reverseRelations; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\AdminUi\UI\Value\ValueFactory $valueFactory + * @param ContentService $contentService + * @param ValueFactory $valueFactory */ - public function __construct(ContentService $contentService, ValueFactory $valueFactory) - { + public function __construct( + ContentService $contentService, + ValueFactory $valueFactory + ) { $this->contentService = $contentService; $this->valueFactory = $valueFactory; $this->reverseRelations = []; } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param Content $content * @param int $offset * @param int $limit * - * @return \Ibexa\AdminUi\UI\Dataset\ReverseRelationListDataset + * @return ReverseRelationListDataset */ public function load( Content $content, @@ -58,14 +63,14 @@ public function load( $this->reverseRelations = array_map( function (RelationListItemInterface $relationListItem) use ($content) { if ($relationListItem->hasRelation()) { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\RelationList\Item\RelationListItem $relationListItem */ + /** @var RelationListItem $relationListItem */ return $this->valueFactory->createRelationItem( $relationListItem, $content ); } - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\RelationList\Item\UnauthorizedRelationListItem $relationListItem */ + /** @var UnauthorizedRelationListItem $relationListItem */ return $this->valueFactory->createUnauthorizedRelationItem( $relationListItem ); @@ -77,7 +82,7 @@ function (RelationListItemInterface $relationListItem) use ($content) { } /** - * @return \Ibexa\AdminUi\UI\Value\Content\RelationInterface[] + * @return RelationInterface[] */ public function getReverseRelations(): array { diff --git a/src/lib/UI/Dataset/RolesDataset.php b/src/lib/UI/Dataset/RolesDataset.php index 6a82aa481b..e58de7bb55 100644 --- a/src/lib/UI/Dataset/RolesDataset.php +++ b/src/lib/UI/Dataset/RolesDataset.php @@ -8,30 +8,35 @@ namespace Ibexa\AdminUi\UI\Dataset; +use Ibexa\AdminUi\Exception\InvalidArgumentException; use Ibexa\AdminUi\Specification\ContentType\ContentTypeIsUser; use Ibexa\AdminUi\Specification\ContentType\ContentTypeIsUserGroup; +use Ibexa\AdminUi\UI\Value\Content\UrlAlias; +use Ibexa\AdminUi\UI\Value\User\Role; use Ibexa\AdminUi\UI\Value\ValueFactory; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\RoleService; use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\Location; class RolesDataset { - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ + /** @var RoleService */ private $roleService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ private $userService; - /** @var \Ibexa\AdminUi\UI\Value\ValueFactory */ + /** @var ValueFactory */ protected $valueFactory; /** @var array */ @@ -40,15 +45,15 @@ class RolesDataset /** @var array */ private $userGroupContentTypeIdentifier; - /** @var \Ibexa\AdminUi\UI\Value\Content\UrlAlias[] */ + /** @var UrlAlias[] */ private $data; /** - * @param \Ibexa\Contracts\Core\Repository\RoleService $roleService - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Contracts\Core\Repository\UserService $userService - * @param \Ibexa\AdminUi\UI\Value\ValueFactory $valueFactory + * @param RoleService $roleService + * @param ContentService $contentService + * @param ContentTypeService $contentTypeService + * @param UserService $userService + * @param ValueFactory $valueFactory * @param array $userContentTypeIdentifier * @param array $userGroupContentTypeIdentifier */ @@ -71,14 +76,14 @@ public function __construct( } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * - * @return \Ibexa\AdminUi\UI\Dataset\RolesDataset + * @return RolesDataset * - * @throws \Ibexa\AdminUi\Exception\InvalidArgumentException + * @throws InvalidArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws UnauthorizedException + * @throws NotFoundException */ public function load(Location $location): self { @@ -106,7 +111,7 @@ public function load(Location $location): self } /** - * @return \Ibexa\AdminUi\UI\Value\User\Role[] + * @return Role[] */ public function getRoles(): array { diff --git a/src/lib/UI/Dataset/TranslationsDataset.php b/src/lib/UI/Dataset/TranslationsDataset.php index 02e4ea3609..89fda11b83 100644 --- a/src/lib/UI/Dataset/TranslationsDataset.php +++ b/src/lib/UI/Dataset/TranslationsDataset.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\UI\Dataset; use Ibexa\AdminUi\UI\Value\ValueFactory; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; @@ -16,27 +17,29 @@ class TranslationsDataset { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ protected $languageService; - /** @var \Ibexa\AdminUi\UI\Value\ValueFactory */ + /** @var ValueFactory */ protected $valueFactory; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language[] */ + /** @var Language[] */ protected $data; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService - * @param \Ibexa\AdminUi\UI\Value\ValueFactory $valueFactory + * @param LanguageService $languageService + * @param ValueFactory $valueFactory */ - public function __construct(LanguageService $languageService, ValueFactory $valueFactory) - { + public function __construct( + LanguageService $languageService, + ValueFactory $valueFactory + ) { $this->languageService = $languageService; $this->valueFactory = $valueFactory; } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo + * @param VersionInfo $versionInfo * * @return TranslationsDataset */ @@ -58,11 +61,11 @@ function (Language $language) use ($versionInfo) { } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param ContentType $contentType * - * @return \Ibexa\AdminUi\UI\Dataset\TranslationsDataset + * @return TranslationsDataset * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ public function loadFromContentType(ContentType $contentType): self { @@ -82,7 +85,7 @@ function (Language $language) use ($contentType) { } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language[] + * @return Language[] */ public function getTranslations(): array { @@ -90,7 +93,7 @@ public function getTranslations(): array } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language[] + * @return Language[] */ public function getLanguageCodes(): array { diff --git a/src/lib/UI/Dataset/VersionsDataset.php b/src/lib/UI/Dataset/VersionsDataset.php index 4dc63c2295..7a2be99bfd 100644 --- a/src/lib/UI/Dataset/VersionsDataset.php +++ b/src/lib/UI/Dataset/VersionsDataset.php @@ -15,27 +15,29 @@ class VersionsDataset { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ protected $contentService; - /** @var \Ibexa\AdminUi\UI\Value\ValueFactory */ + /** @var ValueFactory */ protected $valueFactory; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo[] */ + /** @var VersionInfo[] */ protected $data; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\AdminUi\UI\Value\ValueFactory $valueFactory + * @param ContentService $contentService + * @param ValueFactory $valueFactory */ - public function __construct(ContentService $contentService, ValueFactory $valueFactory) - { + public function __construct( + ContentService $contentService, + ValueFactory $valueFactory + ) { $this->contentService = $contentService; $this->valueFactory = $valueFactory; } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo + * @param ContentInfo $contentInfo * * @return VersionsDataset */ @@ -50,7 +52,7 @@ public function load(ContentInfo $contentInfo): self } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo[] + * @return VersionInfo[] */ public function getVersions(): array { @@ -58,7 +60,7 @@ public function getVersions(): array } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo[] + * @return VersionInfo[] */ public function getDraftVersions(): array { @@ -76,8 +78,10 @@ static function (VersionInfo $versionInfo) { * * @return array */ - public function getConflictedDraftVersions(int $currentVersionNo, string $languageCode): array - { + public function getConflictedDraftVersions( + int $currentVersionNo, + string $languageCode + ): array { return $this->filterVersions( $this->data, static function (VersionInfo $versionInfo) use ($currentVersionNo, $languageCode) { @@ -89,7 +93,7 @@ static function (VersionInfo $versionInfo) use ($currentVersionNo, $languageCode } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo[] + * @return VersionInfo[] */ public function getPublishedVersions(): array { @@ -102,7 +106,7 @@ static function (VersionInfo $versionInfo) { } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo[] + * @return VersionInfo[] */ public function getArchivedVersions(): array { @@ -115,13 +119,15 @@ static function (VersionInfo $versionInfo) { } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo[] $versions + * @param VersionInfo[] $versions * @param callable $callable * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo[] + * @return VersionInfo[] */ - protected function filterVersions(array $versions, callable $callable): array - { + protected function filterVersions( + array $versions, + callable $callable + ): array { return array_values(array_filter($versions, $callable)); } } diff --git a/src/lib/UI/Module/ContentTree/NodeFactory.php b/src/lib/UI/Module/ContentTree/NodeFactory.php index 0efb0ff38a..31f67bf636 100644 --- a/src/lib/UI/Module/ContentTree/NodeFactory.php +++ b/src/lib/UI/Module/ContentTree/NodeFactory.php @@ -12,7 +12,10 @@ use Ibexa\AdminUi\REST\Value\ContentTree\Node; use Ibexa\Contracts\Core\Repository\BookmarkService; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Exceptions\NotImplementedException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\SearchService; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; @@ -23,6 +26,8 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; use Ibexa\Contracts\Core\Repository\Values\Content\Search\AggregationResult\TermAggregationResult; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult; +use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; +use Ibexa\Contracts\Core\Repository\Values\Filter\FilteringSortClause; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; use Ibexa\Core\Helper\TranslationHelper; @@ -36,7 +41,7 @@ final class NodeFactory private const TOP_NODE_CONTENT_ID = 0; /** - * @var array> + * @var array> */ private const SORT_CLAUSE_MAP = [ 'DatePublished' => SortClause\DatePublished::class, @@ -45,16 +50,16 @@ final class NodeFactory private BookmarkService $bookmarkService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ + /** @var SearchService */ private $searchService; - /** @var \Ibexa\Core\Helper\TranslationHelper */ + /** @var TranslationHelper */ private $translationHelper; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; private PermissionResolver $permissionResolver; @@ -86,8 +91,8 @@ public function __construct( /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ public function createNode( Location $location, @@ -162,10 +167,12 @@ private function findSubitems( } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $parentLocation + * @param Location $parentLocation */ - private function getSearchQuery(int $parentLocationId, ?Criterion $requestFilter = null): LocationQuery - { + private function getSearchQuery( + int $parentLocationId, + ?Criterion $requestFilter = null + ): LocationQuery { $searchQuery = new LocationQuery(); $searchQuery->filter = new Criterion\ParentLocationId($parentLocationId); @@ -192,8 +199,10 @@ private function getSearchQuery(int $parentLocationId, ?Criterion $requestFilter return $searchQuery; } - private function findChild(int $locationId, LoadSubtreeRequestNode $loadSubtreeRequestNode): ?LoadSubtreeRequestNode - { + private function findChild( + int $locationId, + LoadSubtreeRequestNode $loadSubtreeRequestNode + ): ?LoadSubtreeRequestNode { foreach ($loadSubtreeRequestNode->children as $child) { if ($child->locationId === $locationId) { return $child; @@ -206,8 +215,10 @@ private function findChild(int $locationId, LoadSubtreeRequestNode $loadSubtreeR /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ - private function countSubitems(int $parentLocationId, ?Criterion $requestFilter = null): int - { + private function countSubitems( + int $parentLocationId, + ?Criterion $requestFilter = null + ): int { $searchQuery = $this->getSearchQuery($parentLocationId, $requestFilter); $searchQuery->limit = 0; @@ -218,13 +229,15 @@ private function countSubitems(int $parentLocationId, ?Criterion $requestFilter } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location[] $containerLocations + * @param Location[] $containerLocations * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws InvalidCriterionArgumentException */ - private function countAggregatedSubitems(array $containerLocations, ?Criterion $requestFilter): array - { + private function countAggregatedSubitems( + array $containerLocations, + ?Criterion $requestFilter + ): array { if (empty($containerLocations)) { return []; } @@ -268,7 +281,7 @@ private function aggregationResultToArray(TermAggregationResult $aggregationResu { $resultsAsArray = []; foreach ($aggregationResult->getEntries() as $entry) { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $entry->getKey(); $resultsAsArray[$location->id] = $entry->getCount(); } @@ -284,15 +297,17 @@ private function getSetting(string $name) /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ - private function buildSortClause(string $sortClause, string $sortOrder): SortClause - { + private function buildSortClause( + string $sortClause, + string $sortOrder + ): SortClause { if (!isset(static::SORT_CLAUSE_MAP[$sortClause])) { throw new InvalidArgumentException('$sortClause', 'Invalid sort clause'); } $map = static::SORT_CLAUSE_MAP; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause $sortClauseInstance */ + /** @var SortClause $sortClauseInstance */ $sortClauseInstance = new $map[$sortClause](); $sortClauseInstance->direction = $sortOrder; @@ -300,7 +315,7 @@ private function buildSortClause(string $sortClause, string $sortOrder): SortCla } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause[] + * @return SortClause[] * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ @@ -321,12 +336,12 @@ private function getSortClauses( } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo[] $uninitializedContentInfoList + * @param ContentInfo[] $uninitializedContentInfoList * @param array $bookmarkLocations * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ private function buildNode( Location $location, @@ -366,7 +381,7 @@ private function buildNode( $searchResult = $this->findSubitems($location, $limit, $offset, $sortClause, $sortOrder, $requestFilter); $totalChildrenCount = (int) $searchResult->totalCount; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $childLocation */ + /** @var Location $childLocation */ foreach (array_column($searchResult->searchHits, 'valueObject') as $childLocation) { $childLoadSubtreeRequestNode = null !== $loadSubtreeRequestNode ? $this->findChild($childLocation->getId(), $loadSubtreeRequestNode) @@ -418,10 +433,12 @@ static function (Repository $repository) use ($contentInfo): int { } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo[] $versionInfoById + * @param VersionInfo[] $versionInfoById */ - private function supplyTranslatedContentName(Node $node, array $versionInfoById): void - { + private function supplyTranslatedContentName( + Node $node, + array $versionInfoById + ): void { if ($node->contentId !== self::TOP_NODE_CONTENT_ID) { $node->name = $this->translationHelper->getTranslatedContentNameByVersionInfo($versionInfoById[$node->contentId]); } diff --git a/src/lib/UI/Module/FieldTypeToolbar/FieldTypeToolbarFactory.php b/src/lib/UI/Module/FieldTypeToolbar/FieldTypeToolbarFactory.php index 94c0a33b64..8ae5169b1d 100644 --- a/src/lib/UI/Module/FieldTypeToolbar/FieldTypeToolbarFactory.php +++ b/src/lib/UI/Module/FieldTypeToolbar/FieldTypeToolbarFactory.php @@ -11,6 +11,7 @@ use Ibexa\AdminUi\Config\AdminUiForms\ContentTypeFieldTypesResolverInterface; use Ibexa\AdminUi\UI\Module\FieldTypeToolbar\Values\FieldTypeToolbar; use Ibexa\AdminUi\UI\Module\FieldTypeToolbar\Values\FieldTypeToolbarItem; +use Ibexa\Contracts\Core\Repository\FieldType; use Ibexa\Core\FieldType\FieldTypeRegistry; use JMS\TranslationBundle\Annotation\Ignore; use Symfony\Contracts\Translation\TranslatorInterface; @@ -47,7 +48,10 @@ public function create(): FieldTypeToolbar ); } - usort($items, static function (FieldTypeToolbarItem $a, FieldTypeToolbarItem $b): int { + usort($items, static function ( + FieldTypeToolbarItem $a, + FieldTypeToolbarItem $b + ): int { return strcmp($a->getName(), $b->getName()); }); @@ -55,7 +59,7 @@ public function create(): FieldTypeToolbar } /** - * @return \Ibexa\Contracts\Core\Repository\FieldType[] + * @return FieldType[] */ private function getAvailableFieldTypes(): iterable { diff --git a/src/lib/UI/Module/FieldTypeToolbar/Values/FieldTypeToolbar.php b/src/lib/UI/Module/FieldTypeToolbar/Values/FieldTypeToolbar.php index c74492a563..ab75e687fd 100644 --- a/src/lib/UI/Module/FieldTypeToolbar/Values/FieldTypeToolbar.php +++ b/src/lib/UI/Module/FieldTypeToolbar/Values/FieldTypeToolbar.php @@ -13,7 +13,7 @@ final class FieldTypeToolbar implements IteratorAggregate { - /** @var \Ibexa\AdminUi\UI\Module\FieldTypeToolbar\Values\FieldTypeToolbarItem[] */ + /** @var FieldTypeToolbarItem[] */ private $items; public function __construct(array $fieldTypes) @@ -22,7 +22,7 @@ public function __construct(array $fieldTypes) } /** - * @return \Ibexa\AdminUi\UI\Module\FieldTypeToolbar\Values\FieldTypeToolbarItem[] + * @return FieldTypeToolbarItem[] */ public function getItems(): iterable { @@ -30,7 +30,7 @@ public function getItems(): iterable } /** - * @return \Ibexa\AdminUi\UI\Module\FieldTypeToolbar\Values\FieldTypeToolbarItem[] + * @return FieldTypeToolbarItem[] */ public function getIterator(): Iterator { diff --git a/src/lib/UI/Module/FieldTypeToolbar/Values/FieldTypeToolbarItem.php b/src/lib/UI/Module/FieldTypeToolbar/Values/FieldTypeToolbarItem.php index ff91db3182..f90f878e72 100644 --- a/src/lib/UI/Module/FieldTypeToolbar/Values/FieldTypeToolbarItem.php +++ b/src/lib/UI/Module/FieldTypeToolbar/Values/FieldTypeToolbarItem.php @@ -19,8 +19,11 @@ final class FieldTypeToolbarItem /** @var bool */ private $isSingular; - public function __construct(string $identifier, string $name, bool $isSingular = false) - { + public function __construct( + string $identifier, + string $name, + bool $isSingular = false + ) { $this->identifier = $identifier; $this->name = $name; $this->isSingular = $isSingular; diff --git a/src/lib/UI/Module/Subitems/ContentViewParameterSupplier.php b/src/lib/UI/Module/Subitems/ContentViewParameterSupplier.php index f57b8819da..6703d9edcc 100644 --- a/src/lib/UI/Module/Subitems/ContentViewParameterSupplier.php +++ b/src/lib/UI/Module/Subitems/ContentViewParameterSupplier.php @@ -14,15 +14,21 @@ use Ibexa\AdminUi\UI\Module\Subitems\Values\SubitemsRow; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\SearchService; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Rest\Output\Visitor; use Ibexa\Core\MVC\Symfony\View\ContentView; use Ibexa\Core\Query\QueryFactoryInterface; +use Ibexa\Rest\Output\Generator\Json; use Ibexa\Rest\Output\Generator\Json as JsonOutputGenerator; use Ibexa\Rest\Server\Output\ValueObjectVisitor\ContentTypeInfoList as ContentTypeInfoListValueObjectVisitor; use Ibexa\Rest\Server\Values\ContentTypeInfoList; @@ -35,34 +41,34 @@ */ class ContentViewParameterSupplier { - /** @var \Ibexa\Contracts\Rest\Output\Visitor */ + /** @var Visitor */ private $outputVisitor; - /** @var \Ibexa\Rest\Output\Generator\Json */ + /** @var Json */ private $outputGenerator; - /** @var \Ibexa\Rest\Server\Output\ValueObjectVisitor\ContentTypeInfoList */ + /** @var ContentTypeInfoListValueObjectVisitor */ private $contentTypeInfoListValueObjectVisitor; - /** @var \Ibexa\AdminUi\UI\Module\Subitems\ValueObjectVisitor\SubitemsList */ + /** @var SubitemsListValueObjectVisitor */ private $subitemsListValueObjectVisitor; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\AdminUi\UI\Config\Provider\ContentTypeMappings */ + /** @var ContentTypeMappings */ private $contentTypeMappings; - /** @var \Ibexa\User\UserSetting\UserSettingService */ + /** @var UserSettingService */ private $userSettingService; private QueryFactoryInterface $queryFactory; @@ -106,29 +112,29 @@ public function __construct( * we are using the same data structure it would use while * fetching data from the REST. * - * @param \Ibexa\Core\MVC\Symfony\View\ContentView $view + * @param ContentView $view * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws BadStateException + * @throws InvalidArgumentException + * @throws NotFoundException + * @throws UnauthorizedException */ public function supply(ContentView $view) { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[] $contentTypes */ + /** @var ContentType[] $contentTypes */ $contentTypes = []; $subitemsRows = []; $location = $view->getLocation(); $subitemsLimit = (int)$this->userSettingService->getUserSetting('subitems_limit')->value; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery $locationChildrenQuery */ + /** @var LocationQuery $locationChildrenQuery */ $locationChildrenQuery = $this->queryFactory->create('Children', ['location' => $location]); $locationChildrenQuery->offset = 0; $locationChildrenQuery->limit = $subitemsLimit; $searchResult = $this->searchService->findLocations($locationChildrenQuery); foreach ($searchResult->searchHits as $searchHit) { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $locationChild */ + /** @var Location $locationChild */ $locationChild = $searchHit->valueObject; $contentType = $locationChild->getContent()->getContentType(); @@ -155,13 +161,13 @@ public function supply(ContentView $view) } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param Location $location + * @param ContentType $contentType * - * @return \Ibexa\Rest\Server\Values\RestContent + * @return RestContent * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ private function createRestContent( Location $location, @@ -177,9 +183,9 @@ private function createRestContent( } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * - * @return \Ibexa\Rest\Server\Values\RestLocation + * @return RestLocation */ private function createRestLocation(Location $location): RestLocation { @@ -190,13 +196,13 @@ private function createRestLocation(Location $location): RestLocation } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param Location $location + * @param ContentType $contentType * - * @return \Ibexa\AdminUi\UI\Module\Subitems\Values\SubitemsRow + * @return SubitemsRow * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ private function createSubitemsRow( Location $location, @@ -209,7 +215,7 @@ private function createSubitemsRow( } /** - * @param \Ibexa\AdminUi\UI\Module\Subitems\Values\SubitemsList $subitemsList + * @param SubitemsList $subitemsList * * @return string */ @@ -223,7 +229,7 @@ private function visitSubitemsList(SubitemsList $subitemsList): string } /** - * @param \Ibexa\Rest\Server\Values\ContentTypeInfoList $contentTypeInfoList + * @param ContentTypeInfoList $contentTypeInfoList * * @return string */ @@ -237,17 +243,19 @@ private function visitContentTypeInfoList(ContentTypeInfoList $contentTypeInfoLi } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param Location $location + * @param Content $content * * @return array * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws BadStateException + * @throws InvalidArgumentException + * @throws NotFoundException */ - private function getContentCreatePermissionsForMFU(Location $location, Content $content): array - { + private function getContentCreatePermissionsForMFU( + Location $location, + Content $content + ): array { $createPermissionsInMfu = []; $hasAccess = $this->permissionResolver->hasAccess('content', 'create'); diff --git a/src/lib/UI/Module/Subitems/ValueObjectVisitor/SubitemsList.php b/src/lib/UI/Module/Subitems/ValueObjectVisitor/SubitemsList.php index 2320be4f71..041b40bbe4 100644 --- a/src/lib/UI/Module/Subitems/ValueObjectVisitor/SubitemsList.php +++ b/src/lib/UI/Module/Subitems/ValueObjectVisitor/SubitemsList.php @@ -15,12 +15,15 @@ class SubitemsList extends ValueObjectVisitor { /** - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator + * @param Visitor $visitor + * @param Generator $generator * @param \Ibexa\AdminUi\UI\Module\Subitems\Values\SubitemsList $data */ - public function visit(Visitor $visitor, Generator $generator, $data) - { + public function visit( + Visitor $visitor, + Generator $generator, + $data + ) { $generator->startObjectElement('SubitemsList'); $visitor->setHeader('Content-Type', $generator->getMediaType('SubitemsList')); //@todo Needs refactoring, disabling certain headers should not be done this way diff --git a/src/lib/UI/Module/Subitems/ValueObjectVisitor/SubitemsRow.php b/src/lib/UI/Module/Subitems/ValueObjectVisitor/SubitemsRow.php index 2ce0d62106..65c1706ac6 100644 --- a/src/lib/UI/Module/Subitems/ValueObjectVisitor/SubitemsRow.php +++ b/src/lib/UI/Module/Subitems/ValueObjectVisitor/SubitemsRow.php @@ -15,12 +15,15 @@ class SubitemsRow extends ValueObjectVisitor { /** - * @param \Ibexa\Contracts\Rest\Output\Visitor $visitor - * @param \Ibexa\Contracts\Rest\Output\Generator $generator + * @param Visitor $visitor + * @param Generator $generator * @param \Ibexa\AdminUi\UI\Module\Subitems\Values\SubitemsRow $data */ - public function visit(Visitor $visitor, Generator $generator, $data) - { + public function visit( + Visitor $visitor, + Generator $generator, + $data + ) { $generator->startObjectElement('SubitemsRow'); $visitor->setHeader('Content-Type', $generator->getMediaType('SubitemsList')); //@todo Needs refactoring, disabling certain headers should not be done this way diff --git a/src/lib/UI/Module/Subitems/Values/ContentTypeRemoteIdList.php b/src/lib/UI/Module/Subitems/Values/ContentTypeRemoteIdList.php index f1bb99afec..fe56ca827f 100644 --- a/src/lib/UI/Module/Subitems/Values/ContentTypeRemoteIdList.php +++ b/src/lib/UI/Module/Subitems/Values/ContentTypeRemoteIdList.php @@ -8,15 +8,16 @@ namespace Ibexa\AdminUi\UI\Module\Subitems\Values; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Rest\Value as RestValue; class ContentTypeRemoteIdList extends RestValue { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[] */ + /** @var ContentType[] */ public $contentTypes; /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[] $contentTypes + * @param ContentType[] $contentTypes */ public function __construct(array $contentTypes) { diff --git a/src/lib/UI/Module/Subitems/Values/SubitemsList.php b/src/lib/UI/Module/Subitems/Values/SubitemsList.php index a22c57c842..62c3c59a48 100644 --- a/src/lib/UI/Module/Subitems/Values/SubitemsList.php +++ b/src/lib/UI/Module/Subitems/Values/SubitemsList.php @@ -22,8 +22,10 @@ class SubitemsList extends RestValue * @param SubitemsRow[] $subitemRows * @param int $childrenCount */ - public function __construct(array $subitemRows, int $childrenCount) - { + public function __construct( + array $subitemRows, + int $childrenCount + ) { $this->subitemRows = $subitemRows; $this->childrenCount = $childrenCount; } diff --git a/src/lib/UI/Module/Subitems/Values/SubitemsRow.php b/src/lib/UI/Module/Subitems/Values/SubitemsRow.php index f9808b89d5..4d24d8c82e 100644 --- a/src/lib/UI/Module/Subitems/Values/SubitemsRow.php +++ b/src/lib/UI/Module/Subitems/Values/SubitemsRow.php @@ -14,18 +14,20 @@ class SubitemsRow extends RestValue { - /** @var \Ibexa\Rest\Server\Values\RestLocation */ + /** @var RestLocation */ public $restLocation; - /** @var \Ibexa\Rest\Server\Values\RestContent */ + /** @var RestContent */ public $restContent; /** - * @param \Ibexa\Rest\Server\Values\RestLocation $restLocation - * @param \Ibexa\Rest\Server\Values\RestContent $restContent + * @param RestLocation $restLocation + * @param RestContent $restContent */ - public function __construct(RestLocation $restLocation, RestContent $restContent) - { + public function __construct( + RestLocation $restLocation, + RestContent $restContent + ) { $this->restLocation = $restLocation; $this->restContent = $restContent; } diff --git a/src/lib/UI/Service/DateTimeFormatter.php b/src/lib/UI/Service/DateTimeFormatter.php index 043ad80b2e..027ebb7f1e 100644 --- a/src/lib/UI/Service/DateTimeFormatter.php +++ b/src/lib/UI/Service/DateTimeFormatter.php @@ -17,7 +17,7 @@ final class DateTimeFormatter implements DateTimeFormatterInterface, TranslationContainerInterface { - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; public function __construct(TranslatorInterface $translator) @@ -25,8 +25,10 @@ public function __construct(TranslatorInterface $translator) $this->translator = $translator; } - public function formatDiff(DateTimeInterface $from, DateTimeInterface $to): string - { + public function formatDiff( + DateTimeInterface $from, + DateTimeInterface $to + ): string { static $units = [ 'y' => 'year', 'm' => 'month', @@ -56,8 +58,11 @@ public function formatDiff(DateTimeInterface $from, DateTimeInterface $to): stri * * @return string */ - private function getDiffMessage(int $count, bool $invert, string $unit): string - { + private function getDiffMessage( + int $count, + bool $invert, + string $unit + ): string { $id = sprintf('diff.%s.%s', $invert ? 'ago' : 'in', $unit); /** @Ignore */ @@ -75,7 +80,7 @@ private function getEmptyDiffMessage(): string } /** - * @return \JMS\TranslationBundle\Model\Message[] + * @return Message[] */ public static function getTranslationMessages(): array { diff --git a/src/lib/UI/Service/DateTimeFormatterInterface.php b/src/lib/UI/Service/DateTimeFormatterInterface.php index 758cdf377e..109083aae3 100644 --- a/src/lib/UI/Service/DateTimeFormatterInterface.php +++ b/src/lib/UI/Service/DateTimeFormatterInterface.php @@ -12,7 +12,10 @@ interface DateTimeFormatterInterface { - public function formatDiff(DateTimeInterface $from, DateTimeInterface $to): string; + public function formatDiff( + DateTimeInterface $from, + DateTimeInterface $to + ): string; } class_alias(DateTimeFormatterInterface::class, 'EzSystems\EzPlatformAdminUi\UI\Service\DateTimeFormatterInterface'); diff --git a/src/lib/UI/Service/IconResolver.php b/src/lib/UI/Service/IconResolver.php index e0e9673b45..fb6a25bca1 100644 --- a/src/lib/UI/Service/IconResolver.php +++ b/src/lib/UI/Service/IconResolver.php @@ -20,14 +20,18 @@ abstract class IconResolver protected Packages $packages; - public function __construct(ConfigResolverInterface $configResolver, Packages $packages) - { + public function __construct( + ConfigResolverInterface $configResolver, + Packages $packages + ) { $this->configResolver = $configResolver; $this->packages = $packages; } - protected function getIcon(string $format, string $identifier): string - { + protected function getIcon( + string $format, + string $identifier + ): string { $icon = $this->resolveIcon($format, $identifier); $fragment = null; if (strpos($icon, '#') !== false) { @@ -37,8 +41,10 @@ protected function getIcon(string $format, string $identifier): string return $this->packages->getUrl($icon) . ($fragment ? '#' . $fragment : ''); } - private function resolveIcon(string $format, string $identifier): string - { + private function resolveIcon( + string $format, + string $identifier + ): string { $parameterName = $this->getConfigParameterName($format, $identifier); $defaultParameterName = $this->getConfigParameterName($format, static::DEFAULT_IDENTIFIER); @@ -59,8 +65,10 @@ private function resolveIcon(string $format, string $identifier): string /** * Returns configuration parameter name for given content type identifier. */ - private function getConfigParameterName(string $format, string $identifier): string - { + private function getConfigParameterName( + string $format, + string $identifier + ): string { return sprintf($format, $identifier); } } diff --git a/src/lib/UI/Service/PathService.php b/src/lib/UI/Service/PathService.php index e033513749..2006b44ffc 100644 --- a/src/lib/UI/Service/PathService.php +++ b/src/lib/UI/Service/PathService.php @@ -21,7 +21,7 @@ */ class PathService { - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ + /** @var SearchService */ private $searchService; public function __construct(SearchService $searchService) @@ -32,9 +32,9 @@ public function __construct(SearchService $searchService) /** * Load path locations. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location[] + * @return Location[] */ public function loadPathLocations(Location $location) { diff --git a/src/lib/UI/Service/TabService.php b/src/lib/UI/Service/TabService.php index 8d486ff053..a40b664788 100644 --- a/src/lib/UI/Service/TabService.php +++ b/src/lib/UI/Service/TabService.php @@ -14,11 +14,11 @@ class TabService { - /** @var \Ibexa\AdminUi\Tab\TabRegistry */ + /** @var TabRegistry */ protected $tabRegistry; /** - * @param \Ibexa\AdminUi\Tab\TabRegistry $tabRegistry + * @param TabRegistry $tabRegistry */ public function __construct(TabRegistry $tabRegistry) { @@ -28,7 +28,7 @@ public function __construct(TabRegistry $tabRegistry) /** * @param string $groupIdentifier * - * @return \Ibexa\AdminUi\Tab\TabGroup + * @return TabGroup */ public function getTabGroup(string $groupIdentifier): TabGroup { @@ -51,10 +51,12 @@ public function getTabsFromGroup(string $groupIdentifier): array * @param string $tabIdentifier * @param string $groupIdentifier * - * @return \Ibexa\Contracts\AdminUi\Tab\TabInterface + * @return TabInterface */ - public function getTabFromGroup(string $tabIdentifier, string $groupIdentifier): TabInterface - { + public function getTabFromGroup( + string $tabIdentifier, + string $groupIdentifier + ): TabInterface { $tabs = $this->getTabsFromGroup($groupIdentifier); if (!isset($tabs[$tabIdentifier])) { diff --git a/src/lib/UI/Value/Content/ContentDraft.php b/src/lib/UI/Value/Content/ContentDraft.php index 1b7435d360..90202bb85d 100644 --- a/src/lib/UI/Value/Content/ContentDraft.php +++ b/src/lib/UI/Value/Content/ContentDraft.php @@ -13,19 +13,19 @@ class ContentDraft implements ContentDraftInterface { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo */ + /** @var VersionInfo */ private $versionInfo; - /** @var \Ibexa\AdminUi\UI\Value\Content\VersionId */ + /** @var VersionId */ private $versionId; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ + /** @var ContentType */ private $contentType; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo - * @param \Ibexa\AdminUi\UI\Value\Content\VersionId $versionId - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param VersionInfo $versionInfo + * @param VersionId $versionId + * @param ContentType $contentType */ public function __construct( VersionInfo $versionInfo, @@ -38,7 +38,7 @@ public function __construct( } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo + * @return VersionInfo */ public function getVersionInfo(): VersionInfo { @@ -46,7 +46,7 @@ public function getVersionInfo(): VersionInfo } /** - * @return \Ibexa\AdminUi\UI\Value\Content\VersionId + * @return VersionId */ public function getVersionId(): VersionId { @@ -54,7 +54,7 @@ public function getVersionId(): VersionId } /** - * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType + * @return ContentType */ public function getContentType(): ContentType { diff --git a/src/lib/UI/Value/Content/Language.php b/src/lib/UI/Value/Content/Language.php index a2331af13c..3bae382d79 100644 --- a/src/lib/UI/Value/Content/Language.php +++ b/src/lib/UI/Value/Content/Language.php @@ -36,11 +36,13 @@ class Language extends APILanguage protected $userCanEdit = false; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language $language + * @param APILanguage $language * @param array $properties */ - public function __construct(APILanguage $language, array $properties = []) - { + public function __construct( + APILanguage $language, + array $properties = [] + ) { parent::__construct(get_object_vars($language) + $properties); } diff --git a/src/lib/UI/Value/Content/Location.php b/src/lib/UI/Value/Content/Location.php index d151a2f0f8..138e9f3e7a 100644 --- a/src/lib/UI/Value/Content/Location.php +++ b/src/lib/UI/Value/Content/Location.php @@ -34,7 +34,7 @@ class Location extends CoreLocation /** * Path locations. * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location[] + * @var APILocation[] */ protected $pathLocations; @@ -60,11 +60,13 @@ class Location extends CoreLocation protected $userCanEdit; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param APILocation $location * @param array $properties */ - public function __construct(APILocation $location, array $properties = []) - { + public function __construct( + APILocation $location, + array $properties = [] + ) { parent::__construct(get_object_vars($location) + $properties); } diff --git a/src/lib/UI/Value/Content/Location/Mapper.php b/src/lib/UI/Value/Content/Location/Mapper.php index aa4dccfe1c..86877f7847 100644 --- a/src/lib/UI/Value/Content/Location/Mapper.php +++ b/src/lib/UI/Value/Content/Location/Mapper.php @@ -10,10 +10,11 @@ use Ibexa\AdminUi\UI\Value; use Ibexa\AdminUi\UI\Value\ValueFactory; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; final class Mapper { - /** @var \Ibexa\AdminUi\UI\Value\ValueFactory */ + /** @var ValueFactory */ private $valueFactory; public function __construct( @@ -23,7 +24,7 @@ public function __construct( } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location[] $locations + * @param Location[] $locations * * @return Value\Content\Location[] */ @@ -38,7 +39,7 @@ public function map(array $locations): array } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location[] $locations + * @param Location[] $locations * * @return Value\Content\Location[] */ diff --git a/src/lib/UI/Value/Content/Relation.php b/src/lib/UI/Value/Content/Relation.php index dbb7623420..966d1d2fea 100644 --- a/src/lib/UI/Value/Content/Relation.php +++ b/src/lib/UI/Value/Content/Relation.php @@ -37,7 +37,7 @@ class Relation extends CoreRelation implements RelationInterface * Main location for the relation. * This will either come from destinationContentInfo OR sourceContentInfo depending upon if reverse relation or normal relation. * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location + * @var Location */ protected $relationLocation; @@ -52,23 +52,25 @@ class Relation extends CoreRelation implements RelationInterface /** * Source location for the relation. * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location + * @var Location */ protected $resolvedSourceLocation; /** * Destination location for the relation. * - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Location + * @var Location */ protected $resolvedDestinationLocation; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Relation $relation + * @param APIRelation $relation * @param array $properties */ - public function __construct(APIRelation $relation, array $properties = []) - { + public function __construct( + APIRelation $relation, + array $properties = [] + ) { parent::__construct(get_object_vars($relation) + $properties); } diff --git a/src/lib/UI/Value/Content/UnauthorizedContentDraft.php b/src/lib/UI/Value/Content/UnauthorizedContentDraft.php index 822311b615..3570c75426 100644 --- a/src/lib/UI/Value/Content/UnauthorizedContentDraft.php +++ b/src/lib/UI/Value/Content/UnauthorizedContentDraft.php @@ -12,11 +12,11 @@ class UnauthorizedContentDraft implements ContentDraftInterface { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\DraftList\Item\UnauthorizedContentDraftListItem */ + /** @var UnauthorizedContentDraftListItem */ private $unauthorizedContentDraft; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\DraftList\Item\UnauthorizedContentDraftListItem $unauthorizedContentDraft + * @param UnauthorizedContentDraftListItem $unauthorizedContentDraft */ public function __construct(UnauthorizedContentDraftListItem $unauthorizedContentDraft) { @@ -24,7 +24,7 @@ public function __construct(UnauthorizedContentDraftListItem $unauthorizedConten } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\DraftList\Item\UnauthorizedContentDraftListItem + * @return UnauthorizedContentDraftListItem */ public function getUnauthorizedContentDraft(): UnauthorizedContentDraftListItem { diff --git a/src/lib/UI/Value/Content/UnauthorizedRelation.php b/src/lib/UI/Value/Content/UnauthorizedRelation.php index 866ae21f92..41b280232f 100644 --- a/src/lib/UI/Value/Content/UnauthorizedRelation.php +++ b/src/lib/UI/Value/Content/UnauthorizedRelation.php @@ -12,11 +12,11 @@ final class UnauthorizedRelation implements RelationInterface { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\RelationList\Item\UnauthorizedRelationListItem */ + /** @var UnauthorizedRelationListItem */ private $unauthorizedRelation; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\RelationList\Item\UnauthorizedRelationListItem $unauthorizedContentDraft + * @param UnauthorizedRelationListItem $unauthorizedContentDraft */ public function __construct(UnauthorizedRelationListItem $unauthorizedRelation) { @@ -24,7 +24,7 @@ public function __construct(UnauthorizedRelationListItem $unauthorizedRelation) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\RelationList\Item\UnauthorizedRelationListItem + * @return UnauthorizedRelationListItem */ public function getUnauthorizedRelation(): UnauthorizedRelationListItem { diff --git a/src/lib/UI/Value/Content/UrlAlias.php b/src/lib/UI/Value/Content/UrlAlias.php index dcebc82b73..207e7ebf33 100644 --- a/src/lib/UI/Value/Content/UrlAlias.php +++ b/src/lib/UI/Value/Content/UrlAlias.php @@ -13,11 +13,13 @@ class UrlAlias extends CoreURLAlias { /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\URLAlias $urlAlias + * @param CoreURLAlias $urlAlias * @param array $properties */ - public function __construct(CoreURLAlias $urlAlias, array $properties = []) - { + public function __construct( + CoreURLAlias $urlAlias, + array $properties = [] + ) { parent::__construct(get_object_vars($urlAlias) + $properties); } } diff --git a/src/lib/UI/Value/Content/VersionId.php b/src/lib/UI/Value/Content/VersionId.php index 171483a4ab..25c8e149f7 100644 --- a/src/lib/UI/Value/Content/VersionId.php +++ b/src/lib/UI/Value/Content/VersionId.php @@ -20,8 +20,10 @@ class VersionId * @param int $contentId * @param int $versionNo */ - public function __construct(int $contentId, int $versionNo) - { + public function __construct( + int $contentId, + int $versionNo + ) { $this->contentId = $contentId; $this->versionNo = $versionNo; } @@ -56,7 +58,7 @@ public function __toString(): string /** * @param string $id * - * @return \Ibexa\AdminUi\UI\Value\Content\VersionId + * @return VersionId */ public static function fromString(string $id): self { diff --git a/src/lib/UI/Value/Content/VersionInfo.php b/src/lib/UI/Value/Content/VersionInfo.php index 3e2542bb13..e84532d03d 100644 --- a/src/lib/UI/Value/Content/VersionInfo.php +++ b/src/lib/UI/Value/Content/VersionInfo.php @@ -8,7 +8,9 @@ namespace Ibexa\AdminUi\UI\Value\Content; +use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo as APIVersionInfo; +use Ibexa\Contracts\Core\Repository\Values\User\User; use Ibexa\Core\Repository\Values\Content\VersionInfo as CoreVersionInfo; /** @@ -17,11 +19,11 @@ */ class VersionInfo extends CoreVersionInfo { - /** @var \Ibexa\Contracts\Core\Repository\Values\User\User */ + /** @var User */ protected $author; /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Language[] + * @var Language[] */ protected $translations; @@ -33,11 +35,13 @@ class VersionInfo extends CoreVersionInfo protected $userCanRemove; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo + * @param APIVersionInfo $versionInfo * @param array $properties */ - public function __construct(APIVersionInfo $versionInfo, array $properties = []) - { + public function __construct( + APIVersionInfo $versionInfo, + array $properties = [] + ) { parent::__construct(get_object_vars($versionInfo) + $properties); } diff --git a/src/lib/UI/Value/Location/Bookmark.php b/src/lib/UI/Value/Location/Bookmark.php index d1d849daa1..f61cbf7a11 100644 --- a/src/lib/UI/Value/Location/Bookmark.php +++ b/src/lib/UI/Value/Location/Bookmark.php @@ -8,25 +8,28 @@ namespace Ibexa\AdminUi\UI\Value\Location; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Core\Repository\Values\Content\Location as CoreLocation; class Bookmark extends CoreLocation { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ + /** @var ContentType */ protected $contentType; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location[] */ + /** @var Location[] */ protected $pathLocations; /** @var bool */ protected $userCanEdit; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * @param array $properties */ - public function __construct(Location $location, array $properties = []) - { + public function __construct( + Location $location, + array $properties = [] + ) { parent::__construct(get_object_vars($location) + $properties); } } diff --git a/src/lib/UI/Value/ObjectState/ObjectState.php b/src/lib/UI/Value/ObjectState/ObjectState.php index 5684931fc1..6f61d2d6d0 100644 --- a/src/lib/UI/Value/ObjectState/ObjectState.php +++ b/src/lib/UI/Value/ObjectState/ObjectState.php @@ -24,11 +24,13 @@ class ObjectState extends CoreObjectState protected $userCanAssign; /** - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectState $objectState + * @param APIObjectState $objectState * @param array $properties */ - public function __construct(APIObjectState $objectState, array $properties = []) - { + public function __construct( + APIObjectState $objectState, + array $properties = [] + ) { parent::__construct(get_object_vars($objectState) + $properties); } } diff --git a/src/lib/UI/Value/User/Policy.php b/src/lib/UI/Value/User/Policy.php index 6b1ae6ace5..9e4e8631d1 100644 --- a/src/lib/UI/Value/User/Policy.php +++ b/src/lib/UI/Value/User/Policy.php @@ -8,37 +8,41 @@ namespace Ibexa\AdminUi\UI\Value\User; -use Ibexa\Contracts\Core\Repository\Values\User\Policy as APIPolicy; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation; +use Ibexa\Contracts\Core\Repository\Values\User\Policy as APIPolicy; +use Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment; class Policy extends APIPolicy { /** * Limitations assigned to this policy. * - * @var \Ibexa\Contracts\Core\Repository\Values\User\Limitation[] + * @var Limitation[] */ protected $limitations = []; /** * RoleAssignment to which policy belongs. * - * @var \Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment + * @var RoleAssignment */ protected $role_assignment; /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\Policy $policy + * @param APIPolicy $policy * @param array $properties */ - public function __construct(APIPolicy $policy, array $properties = []) - { + public function __construct( + APIPolicy $policy, + array $properties = [] + ) { parent::__construct(get_object_vars($policy) + $properties); $this->limitations = $policy->getLimitations(); } /** - * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation[] + * @return Limitation[] */ public function getLimitations(): iterable { diff --git a/src/lib/UI/Value/User/Role.php b/src/lib/UI/Value/User/Role.php index 3dc48eb69e..c901027e3a 100644 --- a/src/lib/UI/Value/User/Role.php +++ b/src/lib/UI/Value/User/Role.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\UI\Value\User; +use Ibexa\Contracts\Core\Repository\Values\User\Limitation\RoleLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\RoleLimitation as APIRoleLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Role as APIRole; use Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment; @@ -17,21 +18,21 @@ class Role extends RoleAssignment /** * the limitation of this role assignment. * - * @var \Ibexa\Contracts\Core\Repository\Values\User\Limitation\RoleLimitation|null + * @var RoleLimitation|null */ protected $limitation; /** * the role which is assigned to the user. * - * @var \Ibexa\Contracts\Core\Repository\Values\User\Role + * @var APIRole */ protected $role; /** * Returns the limitation of the user role assignment. * - * @return \Ibexa\Contracts\Core\Repository\Values\User\Limitation\RoleLimitation|null + * @return RoleLimitation|null */ public function getRoleLimitation(): ?APIRoleLimitation { @@ -41,7 +42,7 @@ public function getRoleLimitation(): ?APIRoleLimitation /** * Returns the role to which the user is assigned to. * - * @return \Ibexa\Contracts\Core\Repository\Values\User\Role + * @return APIRole */ public function getRole(): APIRole { @@ -49,11 +50,13 @@ public function getRole(): APIRole } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment $roleAssignment + * @param RoleAssignment $roleAssignment * @param array $properties */ - public function __construct(RoleAssignment $roleAssignment, array $properties = []) - { + public function __construct( + RoleAssignment $roleAssignment, + array $properties = [] + ) { parent::__construct(get_object_vars($roleAssignment) + $properties); $this->role = $roleAssignment->role; diff --git a/src/lib/UI/Value/ValueFactory.php b/src/lib/UI/Value/ValueFactory.php index 995f889b4c..dd09c9678a 100644 --- a/src/lib/UI/Value/ValueFactory.php +++ b/src/lib/UI/Value/ValueFactory.php @@ -12,9 +12,18 @@ use Ibexa\AdminUi\UI\Dataset\DatasetFactory; use Ibexa\AdminUi\UI\Service\PathService; use Ibexa\AdminUi\UI\Value as UIValue; +use Ibexa\AdminUi\UI\Value\Content\ContentDraftInterface; +use Ibexa\AdminUi\UI\Value\Content\RelationInterface; +use Ibexa\AdminUi\UI\Value\Location\Bookmark; +use Ibexa\AdminUi\UI\Value\User\Role; use Ibexa\Contracts\Core\Limitation\Target; use Ibexa\Contracts\Core\Limitation\Target\Builder\VersionBuilder; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\ObjectStateService; @@ -41,51 +50,51 @@ class ValueFactory { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ + /** @var UserService */ protected $userService; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ protected $languageService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ protected $locationService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ protected $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ + /** @var SearchService */ protected $searchService; - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService */ + /** @var ObjectStateService */ protected $objectStateService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ protected $permissionResolver; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ + /** @var DatasetFactory */ protected $datasetFactory; - /** @var \Ibexa\AdminUi\UI\Service\PathService */ + /** @var PathService */ protected $pathService; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ + /** @var UserLanguagePreferenceProviderInterface */ private $userLanguagePreferenceProvider; - /** @var \Ibexa\Core\Repository\LocationResolver\LocationResolver */ + /** @var LocationResolver */ protected $locationResolver; /** - * @param \Ibexa\Contracts\Core\Repository\UserService $userService - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Contracts\Core\Repository\SearchService $searchService - * @param \Ibexa\Contracts\Core\Repository\ObjectStateService $objectStateService - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver - * @param \Ibexa\AdminUi\UI\Service\PathService $pathService - * @param \Ibexa\AdminUi\UI\Dataset\DatasetFactory $datasetFactory - * @param \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider - * @param \Ibexa\Core\Repository\LocationResolver\LocationResolver $locationResolver + * @param UserService $userService + * @param LanguageService $languageService + * @param LocationService $locationService + * @param ContentTypeService $contentTypeService + * @param SearchService $searchService + * @param ObjectStateService $objectStateService + * @param PermissionResolver $permissionResolver + * @param PathService $pathService + * @param DatasetFactory $datasetFactory + * @param UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider + * @param LocationResolver $locationResolver */ public function __construct( UserService $userService, @@ -114,13 +123,13 @@ public function __construct( } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo + * @param VersionInfo $versionInfo * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo + * @return VersionInfo * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws BadStateException + * @throws InvalidArgumentException + * @throws NotFoundException */ public function createVersionInfo(VersionInfo $versionInfo): UIValue\Content\VersionInfo { @@ -142,16 +151,18 @@ public function createVersionInfo(VersionInfo $versionInfo): UIValue\Content\Ver } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language $language - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo + * @param Language $language + * @param VersionInfo $versionInfo * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language + * @return Language * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws BadStateException + * @throws InvalidArgumentException */ - public function createLanguage(Language $language, VersionInfo $versionInfo): UIValue\Content\Language - { + public function createLanguage( + Language $language, + VersionInfo $versionInfo + ): UIValue\Content\Language { $target = (new VersionBuilder())->translateToAnyLanguageOf([$language->languageCode])->build(); return new UIValue\Content\Language($language, [ @@ -164,18 +175,20 @@ public function createLanguage(Language $language, VersionInfo $versionInfo): UI /** * @deprecated since version 2.5, to be removed in 3.0. Please use ValueFactory::createRelationItem instead. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Relation $relation - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param Relation $relation + * @param Content $content * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Relation + * @return Relation * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws NotFoundException + * @throws UnauthorizedException + * @throws ForbiddenException + * @throws BadStateException */ - public function createRelation(Relation $relation, Content $content): UIValue\Content\Relation - { + public function createRelation( + Relation $relation, + Content $content + ): UIValue\Content\Relation { $contentType = $content->getContentType(); return new UIValue\Content\Relation($relation, [ @@ -189,18 +202,20 @@ public function createRelation(Relation $relation, Content $content): UIValue\Co } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\RelationList\Item\RelationListItem $relationListItem - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param RelationListItem $relationListItem + * @param Content $content * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Relation + * @return Relation * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws NotFoundException + * @throws UnauthorizedException + * @throws ForbiddenException + * @throws BadStateException */ - public function createRelationItem(RelationListItem $relationListItem, Content $content): UIValue\Content\Relation - { + public function createRelationItem( + RelationListItem $relationListItem, + Content $content + ): UIValue\Content\Relation { $contentType = $content->getContentType(); $relation = $relationListItem->getRelation(); @@ -215,23 +230,23 @@ public function createRelationItem(RelationListItem $relationListItem, Content $ } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\RelationList\Item\UnauthorizedRelationListItem $relationListItem + * @param UnauthorizedRelationListItem $relationListItem * - * @return \Ibexa\AdminUi\UI\Value\Content\RelationInterface + * @return RelationInterface */ public function createUnauthorizedRelationItem( UnauthorizedRelationListItem $relationListItem - ): UIValue\Content\RelationInterface { + ): RelationInterface { return new UIValue\Content\UnauthorizedRelation($relationListItem); } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location + * @return Location * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws BadStateException + * @throws InvalidArgumentException */ public function createLocation(Location $location): UIValue\Content\Location { @@ -263,29 +278,29 @@ public function createLocation(Location $location): UIValue\Content\Location } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo - * @param \Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup + * @param ContentInfo $contentInfo + * @param ObjectStateGroup $objectStateGroup * - * @return UIValue\ObjectState\ObjectState + * @return ObjectState\ObjectState * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws BadStateException + * @throws InvalidArgumentException */ public function createObjectState( ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup - ): UIValue\ObjectState\ObjectState { + ): ObjectState\ObjectState { $objectState = $this->objectStateService->getContentState($contentInfo, $objectStateGroup); - return new UIValue\ObjectState\ObjectState($objectState, [ + return new ObjectState\ObjectState($objectState, [ 'userCanAssign' => $this->permissionResolver->canUser('state', 'assign', $contentInfo, [$objectState]), ]); } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\URLAlias $urlAlias + * @param URLAlias $urlAlias * - * @return \Ibexa\AdminUi\UI\Value\Content\UrlAlias + * @return UIValue\Content\UrlAlias */ public function createUrlAlias(URLAlias $urlAlias): UIValue\Content\UrlAlias { @@ -293,39 +308,41 @@ public function createUrlAlias(URLAlias $urlAlias): UIValue\Content\UrlAlias } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment $roleAssignment + * @param RoleAssignment $roleAssignment * - * @return \Ibexa\AdminUi\UI\Value\User\Role + * @return Role */ - public function createRole(RoleAssignment $roleAssignment): UIValue\User\Role + public function createRole(RoleAssignment $roleAssignment): Role { - return new UIValue\User\Role($roleAssignment); + return new Role($roleAssignment); } /** - * @param \Ibexa\Contracts\Core\Repository\Values\User\Policy $policy - * @param \Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment $roleAssignment + * @param Policy $policy + * @param RoleAssignment $roleAssignment * - * @return \Ibexa\AdminUi\UI\Value\User\Policy + * @return User\Policy */ - public function createPolicy(Policy $policy, RoleAssignment $roleAssignment): UIValue\User\Policy - { - return new UIValue\User\Policy($policy, ['role_assignment' => $roleAssignment]); + public function createPolicy( + Policy $policy, + RoleAssignment $roleAssignment + ): User\Policy { + return new User\Policy($policy, ['role_assignment' => $roleAssignment]); } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location + * @param Location $location * - * @return \Ibexa\AdminUi\UI\Value\Location\Bookmark + * @return Bookmark * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws BadStateException + * @throws InvalidArgumentException + * @throws NotFoundException + * @throws UnauthorizedException */ - public function createBookmark(Location $location): UIValue\Location\Bookmark + public function createBookmark(Location $location): Bookmark { - return new UIValue\Location\Bookmark( + return new Bookmark( $location, [ 'contentType' => $this->contentTypeService->loadContentType( @@ -339,13 +356,13 @@ public function createBookmark(Location $location): UIValue\Location\Bookmark } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language $language - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param Language $language + * @param ContentType $contentType * - * @return \Ibexa\AdminUi\UI\Value\Content\Language + * @return UIValue\Content\Language * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws BadStateException + * @throws InvalidArgumentException */ public function createLanguageFromContentType( Language $language, @@ -358,15 +375,15 @@ public function createLanguageFromContentType( } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\DraftList\Item\ContentDraftListItem $contentDraftListItem - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param ContentDraftListItem $contentDraftListItem + * @param ContentType $contentType * - * @return \Ibexa\AdminUi\UI\Value\Content\ContentDraftInterface + * @return ContentDraftInterface */ public function createContentDraft( ContentDraftListItem $contentDraftListItem, ContentType $contentType - ): UIValue\Content\ContentDraftInterface { + ): ContentDraftInterface { $versionInfo = $contentDraftListItem->getVersionInfo(); $contentInfo = $versionInfo->contentInfo; $versionId = new UIValue\Content\VersionId( @@ -382,18 +399,20 @@ public function createContentDraft( } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\DraftList\Item\UnauthorizedContentDraftListItem $contentDraftListItem + * @param UnauthorizedContentDraftListItem $contentDraftListItem * - * @return \Ibexa\AdminUi\UI\Value\Content\ContentDraftInterface + * @return ContentDraftInterface */ public function createUnauthorizedContentDraft( UnauthorizedContentDraftListItem $contentDraftListItem - ): UIValue\Content\ContentDraftInterface { + ): ContentDraftInterface { return new UIValue\Content\UnauthorizedContentDraft($contentDraftListItem); } - private function getRelationFieldDefinitionName(?Relation $relation, ContentType $contentType): string - { + private function getRelationFieldDefinitionName( + ?Relation $relation, + ContentType $contentType + ): string { if ($relation !== null && $relation->sourceFieldDefinitionIdentifier !== null) { $fieldDefinition = $contentType->getFieldDefinition( $relation->sourceFieldDefinitionIdentifier diff --git a/src/lib/UniversalDiscovery/ConfigResolver.php b/src/lib/UniversalDiscovery/ConfigResolver.php index 1a6707203a..081d2e48d6 100644 --- a/src/lib/UniversalDiscovery/ConfigResolver.php +++ b/src/lib/UniversalDiscovery/ConfigResolver.php @@ -18,15 +18,15 @@ class ConfigResolver public const DEFAULT_CONFIGURATION_KEY = '_default'; - /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ + /** @var EventDispatcherInterface */ protected $eventDispatcher; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ protected $configResolver; /** - * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver - * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher + * @param ConfigResolverInterface $configResolver + * @param EventDispatcherInterface $eventDispatcher */ public function __construct( ConfigResolverInterface $configResolver, @@ -42,8 +42,10 @@ public function __construct( * * @return array */ - public function getConfig(string $configName, array $context = []): array - { + public function getConfig( + string $configName, + array $context = [] + ): array { $config = $this->getUDWConfiguration($configName); $defaults = $this->getUDWConfiguration(self::DEFAULT_CONFIGURATION_KEY); @@ -55,7 +57,7 @@ public function getConfig(string $configName, array $context = []): array $configResolveEvent->setContext($context); $configResolveEvent->setConfig($config); - /** @var \Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent $event */ + /** @var ConfigResolveEvent $event */ $event = $this->eventDispatcher->dispatch($configResolveEvent, ConfigResolveEvent::NAME); return $event->getConfig(); @@ -67,8 +69,10 @@ public function getConfig(string $configName, array $context = []): array * * @return array */ - protected function mergeConfiguration(array $default, $apply): array - { + protected function mergeConfiguration( + array $default, + $apply + ): array { foreach ($apply as $key => $item) { if (isset($default[$key]) && $this->isAssocArray($default[$key])) { $default[$key] = $this->mergeConfiguration($default[$key], $item); diff --git a/src/lib/UniversalDiscovery/Event/Subscriber/ContentCreate.php b/src/lib/UniversalDiscovery/Event/Subscriber/ContentCreate.php index 64e18f6543..df63fc031a 100644 --- a/src/lib/UniversalDiscovery/Event/Subscriber/ContentCreate.php +++ b/src/lib/UniversalDiscovery/Event/Subscriber/ContentCreate.php @@ -11,6 +11,7 @@ use Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent; use Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ContentTypeLimitation; @@ -25,18 +26,18 @@ class ContentCreate implements EventSubscriberInterface /** @var array */ private $restrictedLanguagesCodes; - /** @var \Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface */ + /** @var PermissionCheckerInterface */ private $permissionChecker; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; /** - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver - * @param \Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface $permissionChecker - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService + * @param PermissionResolver $permissionResolver + * @param PermissionCheckerInterface $permissionChecker + * @param ContentTypeService $contentTypeService * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ public function __construct( PermissionResolver $permissionResolver, @@ -62,7 +63,7 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent $event + * @param ConfigResolveEvent $event */ public function onUdwConfigResolve(ConfigResolveEvent $event): void { diff --git a/src/lib/UniversalDiscovery/Event/Subscriber/ImageAssetAllowedContentTypes.php b/src/lib/UniversalDiscovery/Event/Subscriber/ImageAssetAllowedContentTypes.php index 559a9dfcc9..b01b660fcd 100644 --- a/src/lib/UniversalDiscovery/Event/Subscriber/ImageAssetAllowedContentTypes.php +++ b/src/lib/UniversalDiscovery/Event/Subscriber/ImageAssetAllowedContentTypes.php @@ -14,7 +14,7 @@ final class ImageAssetAllowedContentTypes implements EventSubscriberInterface { - /** @var \Ibexa\Core\FieldType\ImageAsset\AssetMapper */ + /** @var AssetMapper */ private $assetMapper; public function __construct(AssetMapper $assetMapper) diff --git a/src/lib/UniversalDiscovery/Event/Subscriber/ImageAssetDefaultLocationId.php b/src/lib/UniversalDiscovery/Event/Subscriber/ImageAssetDefaultLocationId.php index 6adb5de008..bdab2e8254 100644 --- a/src/lib/UniversalDiscovery/Event/Subscriber/ImageAssetDefaultLocationId.php +++ b/src/lib/UniversalDiscovery/Event/Subscriber/ImageAssetDefaultLocationId.php @@ -14,11 +14,11 @@ class ImageAssetDefaultLocationId implements EventSubscriberInterface { - /** @var \Ibexa\Core\FieldType\ImageAsset\AssetMapper */ + /** @var AssetMapper */ private $assetMapper; /** - * @param \Ibexa\Core\FieldType\ImageAsset\AssetMapper $assetMapper + * @param AssetMapper $assetMapper */ public function __construct(AssetMapper $assetMapper) { @@ -36,7 +36,7 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent $event + * @param ConfigResolveEvent $event */ public function onUdwConfigResolve(ConfigResolveEvent $event): void { diff --git a/src/lib/UniversalDiscovery/Event/Subscriber/ObjectRelationAllowedContentTypes.php b/src/lib/UniversalDiscovery/Event/Subscriber/ObjectRelationAllowedContentTypes.php index 928c6f4297..4807d135d9 100644 --- a/src/lib/UniversalDiscovery/Event/Subscriber/ObjectRelationAllowedContentTypes.php +++ b/src/lib/UniversalDiscovery/Event/Subscriber/ObjectRelationAllowedContentTypes.php @@ -24,7 +24,7 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent $event + * @param ConfigResolveEvent $event */ public function onUdwConfigResolve(ConfigResolveEvent $event): void { diff --git a/src/lib/UniversalDiscovery/Event/Subscriber/ObjectRelationStartingLocationId.php b/src/lib/UniversalDiscovery/Event/Subscriber/ObjectRelationStartingLocationId.php index 1060c94a40..7b1a90dc0f 100644 --- a/src/lib/UniversalDiscovery/Event/Subscriber/ObjectRelationStartingLocationId.php +++ b/src/lib/UniversalDiscovery/Event/Subscriber/ObjectRelationStartingLocationId.php @@ -24,7 +24,7 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent $event + * @param ConfigResolveEvent $event */ public function onUdwConfigResolve(ConfigResolveEvent $event): void { diff --git a/src/lib/UniversalDiscovery/Event/Subscriber/ReadAllowedContentTypes.php b/src/lib/UniversalDiscovery/Event/Subscriber/ReadAllowedContentTypes.php index 3c3302a0e6..2842186bfb 100644 --- a/src/lib/UniversalDiscovery/Event/Subscriber/ReadAllowedContentTypes.php +++ b/src/lib/UniversalDiscovery/Event/Subscriber/ReadAllowedContentTypes.php @@ -11,19 +11,20 @@ use Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent; use Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ContentTypeLimitation; use Symfony\Component\EventDispatcher\EventSubscriberInterface; final class ReadAllowedContentTypes implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface */ + /** @var PermissionCheckerInterface */ private $permissionChecker; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; /** @var string[]|null */ @@ -40,7 +41,7 @@ public function __construct( } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ private function getAllowedContentTypesIdentifiers(array $contentTypesAllowedViaConfig): ?array { diff --git a/src/lib/UniversalDiscovery/Event/Subscriber/RichTextAllowedLanguages.php b/src/lib/UniversalDiscovery/Event/Subscriber/RichTextAllowedLanguages.php index 2e70c50fd4..8c6b994e19 100644 --- a/src/lib/UniversalDiscovery/Event/Subscriber/RichTextAllowedLanguages.php +++ b/src/lib/UniversalDiscovery/Event/Subscriber/RichTextAllowedLanguages.php @@ -24,7 +24,7 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent $event + * @param ConfigResolveEvent $event */ public function onUdwConfigResolve(ConfigResolveEvent $event): void { diff --git a/src/lib/UniversalDiscovery/Event/Subscriber/SectionAssign.php b/src/lib/UniversalDiscovery/Event/Subscriber/SectionAssign.php index 9611afb51d..8924c6dc78 100644 --- a/src/lib/UniversalDiscovery/Event/Subscriber/SectionAssign.php +++ b/src/lib/UniversalDiscovery/Event/Subscriber/SectionAssign.php @@ -11,6 +11,7 @@ use Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent; use Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ContentTypeLimitation; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -20,18 +21,18 @@ class SectionAssign implements EventSubscriberInterface /** @var array */ private $restrictedContentTypes; - /** @var \Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface */ + /** @var PermissionCheckerInterface */ private $permissionChecker; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; /** - * @param \Ibexa\Contracts\Core\Repository\PermissionResolver $permissionResolver - * @param \Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface $permissionChecker - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService + * @param PermissionResolver $permissionResolver + * @param PermissionCheckerInterface $permissionChecker + * @param ContentTypeService $contentTypeService * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ public function __construct( PermissionResolver $permissionResolver, @@ -55,7 +56,7 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent $event + * @param ConfigResolveEvent $event */ public function onUdwConfigResolve(ConfigResolveEvent $event): void { diff --git a/src/lib/UniversalDiscovery/Event/Subscriber/UserSelectionAllowedContentTypes.php b/src/lib/UniversalDiscovery/Event/Subscriber/UserSelectionAllowedContentTypes.php index e2ac04b38e..e93e99caef 100644 --- a/src/lib/UniversalDiscovery/Event/Subscriber/UserSelectionAllowedContentTypes.php +++ b/src/lib/UniversalDiscovery/Event/Subscriber/UserSelectionAllowedContentTypes.php @@ -14,7 +14,7 @@ class UserSelectionAllowedContentTypes implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ protected $configResolver; public function __construct(ConfigResolverInterface $configResolver) @@ -33,7 +33,7 @@ public static function getSubscribedEvents(): array } /** - * @param \Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent $event + * @param ConfigResolveEvent $event */ public function onUdwConfigResolve(ConfigResolveEvent $event): void { diff --git a/src/lib/UniversalDiscovery/UniversalDiscoveryProvider.php b/src/lib/UniversalDiscovery/UniversalDiscoveryProvider.php index 60f00aee56..4c528fa659 100644 --- a/src/lib/UniversalDiscovery/UniversalDiscoveryProvider.php +++ b/src/lib/UniversalDiscovery/UniversalDiscoveryProvider.php @@ -17,6 +17,7 @@ use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\SearchService; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\LocationQuery; use Ibexa\Contracts\Core\Repository\Values\Content\Query; @@ -30,31 +31,31 @@ class UniversalDiscoveryProvider implements Provider { private const COLUMNS_NUMBER = 4; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\SearchService */ + /** @var SearchService */ private $searchService; - /** @var \Ibexa\Contracts\Rest\Output\Visitor */ + /** @var Visitor */ private $visitor; - /** @var \Ibexa\Contracts\Core\Repository\BookmarkService */ + /** @var BookmarkService */ private $bookmarkService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface */ + /** @var PermissionCheckerInterface */ private $permissionChecker; - /** @var \Ibexa\AdminUi\Permission\LookupLimitationsTransformer */ + /** @var LookupLimitationsTransformer */ private $lookupLimitationsTransformer; - /** @var \Ibexa\AdminUi\QueryType\LocationPathQueryType */ + /** @var LocationPathQueryType */ private $locationPathQueryType; private $sortClauseClassMap = [ @@ -171,7 +172,7 @@ public function getLocations(array $locationIds): array return array_map( function (SearchHit $searchHit) { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $searchHit->valueObject; return [ @@ -229,7 +230,7 @@ public function getSubitemContents( return array_map( static function (SearchHit $searchHit): Version { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + /** @var Content $content */ $content = $searchHit->valueObject; return new Version($content, $content->getContentType(), []); @@ -256,7 +257,7 @@ public function getSubitemLocations( return [ 'locations' => array_map( static function (SearchHit $searchHit): RestLocation { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ + /** @var Location $location */ $location = $searchHit->valueObject; return new RestLocation( @@ -348,8 +349,10 @@ public function getRestFormat($valueObject): array ); } - public function getSortClause(string $sortClauseName, string $sortOrder): Query\SortClause - { + public function getSortClause( + string $sortClauseName, + string $sortOrder + ): Query\SortClause { $sortClauseClass = $this->sortClauseClassMap[$sortClauseName] ?? $this->sortClauseClassMap[self::SORT_CLAUSE_DATE_PUBLISHED]; $sortOrder = !in_array($sortOrder, $this->availableSortOrder) ? Query::SORT_ASC @@ -358,8 +361,10 @@ public function getSortClause(string $sortClauseName, string $sortOrder): Query\ return new $sortClauseClass($sortOrder); } - private function getRelativeLocationPath(int $locationId, array $locationPath): array - { + private function getRelativeLocationPath( + int $locationId, + array $locationPath + ): array { $locationIds = array_values($locationPath); $index = array_search($locationId, $locationIds); diff --git a/src/lib/UserSetting/Autosave.php b/src/lib/UserSetting/Autosave.php index 77500d45b8..5d86c17ae2 100644 --- a/src/lib/UserSetting/Autosave.php +++ b/src/lib/UserSetting/Autosave.php @@ -24,10 +24,10 @@ class Autosave implements ValueDefinitionInterface, FormMapperInterface public const ENABLED_OPTION = 'enabled'; public const DISABLED_OPTION = 'disabled'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( diff --git a/src/lib/UserSetting/AutosaveInterval.php b/src/lib/UserSetting/AutosaveInterval.php index 839c8d7de0..51a1ee737b 100644 --- a/src/lib/UserSetting/AutosaveInterval.php +++ b/src/lib/UserSetting/AutosaveInterval.php @@ -20,10 +20,10 @@ class AutosaveInterval implements ValueDefinitionInterface, FormMapperInterface { public const IDENTIFIER = 'autosave_interval'; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( diff --git a/src/lib/UserSetting/Group/UserModeGroup.php b/src/lib/UserSetting/Group/UserModeGroup.php index 3885023027..7a5b97fb5d 100644 --- a/src/lib/UserSetting/Group/UserModeGroup.php +++ b/src/lib/UserSetting/Group/UserModeGroup.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\UserSetting\Group; +use Ibexa\Contracts\User\UserSetting\ValueDefinitionInterface; use Ibexa\User\UserSetting\Group\AbstractGroup; use JMS\TranslationBundle\Annotation\Desc; use Symfony\Contracts\Translation\TranslatorInterface; @@ -17,7 +18,7 @@ final class UserModeGroup extends AbstractGroup private TranslatorInterface $translator; /** - * @param array $values + * @param array $values */ public function __construct( TranslatorInterface $translator, diff --git a/src/lib/Util/ContentTypeFieldsExpressionParser.php b/src/lib/Util/ContentTypeFieldsExpressionParser.php index 6d7c79b2ad..fdaa28cbf6 100644 --- a/src/lib/Util/ContentTypeFieldsExpressionParser.php +++ b/src/lib/Util/ContentTypeFieldsExpressionParser.php @@ -118,7 +118,7 @@ private function getTokenFromInsideBracket(): string } /** - * @throws \Ibexa\AdminUi\Exception\FieldTypeExpressionParserException + * @throws FieldTypeExpressionParserException */ private function expectSlash(): void { diff --git a/src/lib/Util/ContentTypeFieldsExpressionParserInterface.php b/src/lib/Util/ContentTypeFieldsExpressionParserInterface.php index 22c3aa34b8..9537ae571a 100644 --- a/src/lib/Util/ContentTypeFieldsExpressionParserInterface.php +++ b/src/lib/Util/ContentTypeFieldsExpressionParserInterface.php @@ -8,10 +8,12 @@ namespace Ibexa\AdminUi\Util; +use Ibexa\AdminUi\Exception\FieldTypeExpressionParserException; + interface ContentTypeFieldsExpressionParserInterface { /** - * @throws \Ibexa\AdminUi\Exception\FieldTypeExpressionParserException + * @throws FieldTypeExpressionParserException */ public function parseExpression(string $expression): ContentTypeFieldsParsedStructure; } diff --git a/src/lib/Util/ContentTypeFieldsExtractor.php b/src/lib/Util/ContentTypeFieldsExtractor.php index 7c8daf278a..8b9867cafe 100644 --- a/src/lib/Util/ContentTypeFieldsExtractor.php +++ b/src/lib/Util/ContentTypeFieldsExtractor.php @@ -37,15 +37,17 @@ public function extractFieldsFromExpression(string $expression): array return $this->mergeFieldIds($extractedMetadata->getFields(), $contentTypes); } - public function isFieldWithinExpression(int $fieldDefinitionId, string $expression): bool - { + public function isFieldWithinExpression( + int $fieldDefinitionId, + string $expression + ): bool { $fieldsFromExpression = $this->extractFieldsFromExpression($expression); return in_array($fieldDefinitionId, $fieldsFromExpression, true); } /** - * @return list<\Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType> + * @return list */ private function resolveContentTypes(ContentTypeFieldsParsedStructure $extractedMetadata): array { @@ -89,8 +91,10 @@ private function resolveContentTypes(ContentTypeFieldsParsedStructure $extracted * * @return array */ - private function resolveFieldIds(?array $fieldIdentifiers, ContentType $contentType): array - { + private function resolveFieldIds( + ?array $fieldIdentifiers, + ContentType $contentType + ): array { $fieldDefinitions = $contentType->getFieldDefinitions(); if ($fieldIdentifiers === null) { @@ -107,7 +111,7 @@ private function resolveFieldIds(?array $fieldIdentifiers, ContentType $contentT } /** - * @param non-empty-list<\Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType> $contentTypes + * @param non-empty-list $contentTypes * @param list $contentTypeGroupIdentifiers */ private function validateContentTypesInsideGroups( @@ -142,8 +146,10 @@ private function validateContentTypesInsideGroups( * * @return list */ - private function mergeFieldIds(?array $fieldIdentifiers, iterable $contentTypes): array - { + private function mergeFieldIds( + ?array $fieldIdentifiers, + iterable $contentTypes + ): array { $finalFieldIds = []; foreach ($contentTypes as $contentType) { $finalFieldIds = array_merge( diff --git a/src/lib/Util/ContentTypeFieldsExtractorInterface.php b/src/lib/Util/ContentTypeFieldsExtractorInterface.php index 124d79b645..1c24444d34 100644 --- a/src/lib/Util/ContentTypeFieldsExtractorInterface.php +++ b/src/lib/Util/ContentTypeFieldsExtractorInterface.php @@ -8,17 +8,22 @@ namespace Ibexa\AdminUi\Util; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; + interface ContentTypeFieldsExtractorInterface { /** * @return list * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ public function extractFieldsFromExpression(string $expression): array; /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ - public function isFieldWithinExpression(int $fieldDefinitionId, string $expression): bool; + public function isFieldWithinExpression( + int $fieldDefinitionId, + string $expression + ): bool; } diff --git a/src/lib/Util/ContentTypeUtil.php b/src/lib/Util/ContentTypeUtil.php index 4eba625688..78aca532c5 100644 --- a/src/lib/Util/ContentTypeUtil.php +++ b/src/lib/Util/ContentTypeUtil.php @@ -9,17 +9,20 @@ namespace Ibexa\AdminUi\Util; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; +use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition; class ContentTypeUtil { /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param ContentType $contentType * @param string $fieldTypeIdentifier * * @return bool */ - public function hasFieldType(ContentType $contentType, string $fieldTypeIdentifier): bool - { + public function hasFieldType( + ContentType $contentType, + string $fieldTypeIdentifier + ): bool { foreach ($contentType->getFieldDefinitions() as $fieldDefinition) { if ($fieldDefinition->fieldTypeIdentifier === $fieldTypeIdentifier) { return true; @@ -30,13 +33,15 @@ public function hasFieldType(ContentType $contentType, string $fieldTypeIdentifi } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param ContentType $contentType * @param string $fieldTypeIdentifier * - * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition[] + * @return FieldDefinition[] */ - public function findFieldDefinitions(ContentType $contentType, string $fieldTypeIdentifier): array - { + public function findFieldDefinitions( + ContentType $contentType, + string $fieldTypeIdentifier + ): array { $fieldTypes = []; foreach ($contentType->getFieldDefinitions() as $fieldDefinition) { if ($fieldDefinition->fieldTypeIdentifier === $fieldTypeIdentifier) { diff --git a/src/lib/Util/FieldDefinitionGroupsUtil.php b/src/lib/Util/FieldDefinitionGroupsUtil.php index ebbb5ef24a..d29a5dacf4 100644 --- a/src/lib/Util/FieldDefinitionGroupsUtil.php +++ b/src/lib/Util/FieldDefinitionGroupsUtil.php @@ -8,15 +8,16 @@ namespace Ibexa\AdminUi\Util; +use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition; use Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList; class FieldDefinitionGroupsUtil { - /** @var \Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList */ + /** @var FieldsGroupsList */ private $fieldsGroupsListHelper; /** - * @param \Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList $fieldsGroupsListHelper + * @param FieldsGroupsList $fieldsGroupsListHelper */ public function __construct(FieldsGroupsList $fieldsGroupsListHelper) { @@ -24,7 +25,7 @@ public function __construct(FieldsGroupsList $fieldsGroupsListHelper) } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition[] $fieldDefinitions + * @param FieldDefinition[] $fieldDefinitions * * @return array */ diff --git a/src/lib/Validator/Constraints/DateRangeConstraint.php b/src/lib/Validator/Constraints/DateRangeConstraint.php index 4a1690c317..3c3b9a4bdc 100644 --- a/src/lib/Validator/Constraints/DateRangeConstraint.php +++ b/src/lib/Validator/Constraints/DateRangeConstraint.php @@ -17,7 +17,7 @@ final class DateRangeConstraint extends Constraint implements TranslationContain public string $message = 'ibexa.date_range.invalid_range'; /** - * @return array<\JMS\TranslationBundle\Model\Message> + * @return array */ public static function getTranslationMessages(): array { diff --git a/src/lib/Validator/Constraints/DateRangeConstraintValidator.php b/src/lib/Validator/Constraints/DateRangeConstraintValidator.php index 577ce1dd5b..aeb48880fe 100644 --- a/src/lib/Validator/Constraints/DateRangeConstraintValidator.php +++ b/src/lib/Validator/Constraints/DateRangeConstraintValidator.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Validator\Constraints; use DateTimeInterface; +use Ibexa\AdminUi\Form\Data\DateRangeData; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\UnexpectedTypeException; @@ -16,10 +17,12 @@ final class DateRangeConstraintValidator extends ConstraintValidator { /** - * @param \Ibexa\AdminUi\Form\Data\DateRangeData|null $value + * @param DateRangeData|null $value */ - public function validate($value, Constraint $constraint): void - { + public function validate( + $value, + Constraint $constraint + ): void { if (!$constraint instanceof DateRangeConstraint) { throw new UnexpectedTypeException($constraint, DateRangeConstraint::class); } diff --git a/src/lib/Validator/Constraints/FieldDefinitionDefaultValueValidator.php b/src/lib/Validator/Constraints/FieldDefinitionDefaultValueValidator.php index ae8c648c1c..f0fe20d7f5 100644 --- a/src/lib/Validator/Constraints/FieldDefinitionDefaultValueValidator.php +++ b/src/lib/Validator/Constraints/FieldDefinitionDefaultValueValidator.php @@ -18,8 +18,10 @@ */ class FieldDefinitionDefaultValueValidator extends FieldTypeValidator { - public function validate($value, Constraint $constraint) - { + public function validate( + $value, + Constraint $constraint + ) { if (!$value instanceof FieldDefinitionData) { return; } @@ -60,8 +62,10 @@ protected function getFieldTypeIdentifier(FieldDefinitionData $value): string return $value->getFieldTypeIdentifier(); } - protected function generatePropertyPath($errorIndex, $errorTarget): string - { + protected function generatePropertyPath( + $errorIndex, + $errorTarget + ): string { return 'defaultValue'; } } diff --git a/src/lib/Validator/Constraints/FieldSettingsValidator.php b/src/lib/Validator/Constraints/FieldSettingsValidator.php index b1b71b3ac8..5b77ff474b 100644 --- a/src/lib/Validator/Constraints/FieldSettingsValidator.php +++ b/src/lib/Validator/Constraints/FieldSettingsValidator.php @@ -16,8 +16,10 @@ */ class FieldSettingsValidator extends FieldTypeValidator { - public function validate($value, Constraint $constraint) - { + public function validate( + $value, + Constraint $constraint + ) { if (!$value instanceof FieldDefinitionData) { return; } @@ -26,8 +28,10 @@ public function validate($value, Constraint $constraint) $this->processValidationErrors($fieldType->validateFieldSettings($value->fieldSettings)); } - protected function generatePropertyPath($errorIndex, $errorTarget) - { + protected function generatePropertyPath( + $errorIndex, + $errorTarget + ) { return 'fieldSettings' . $errorTarget; } } diff --git a/src/lib/Validator/Constraints/FieldTypeValidator.php b/src/lib/Validator/Constraints/FieldTypeValidator.php index 6774e06106..738743b191 100644 --- a/src/lib/Validator/Constraints/FieldTypeValidator.php +++ b/src/lib/Validator/Constraints/FieldTypeValidator.php @@ -28,7 +28,10 @@ private function createValidationErrorProcessor(): ValidationErrorsProcessor return new ValidationErrorsProcessor( new BaseValidationErrorsProcessor( $this->context, - function ($index, $target) { + function ( + $index, + $target + ) { return $this->generatePropertyPath($index, $target); } ) diff --git a/src/lib/Validator/Constraints/LocationHasChildrenValidator.php b/src/lib/Validator/Constraints/LocationHasChildrenValidator.php index 22867b2aae..752b9a0cd8 100644 --- a/src/lib/Validator/Constraints/LocationHasChildrenValidator.php +++ b/src/lib/Validator/Constraints/LocationHasChildrenValidator.php @@ -10,16 +10,17 @@ use Ibexa\AdminUi\Specification\Location\HasChildren; use Ibexa\Contracts\Core\Repository\LocationService; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; class LocationHasChildrenValidator extends ConstraintValidator { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; /** - * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService + * @param LocationService $locationService */ public function __construct(LocationService $locationService) { @@ -29,11 +30,13 @@ public function __construct(LocationService $locationService) /** * Checks if the passed value is valid. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location The value that should be validated - * @param \Symfony\Component\Validator\Constraint $constraint The constraint for the validation + * @param Location $location The value that should be validated + * @param Constraint $constraint The constraint for the validation */ - public function validate($location, Constraint $constraint) - { + public function validate( + $location, + Constraint $constraint + ) { if (null === $location) { $this->context->addViolation($constraint->message); diff --git a/src/lib/Validator/Constraints/LocationHaveUniqueAssetRelationValidator.php b/src/lib/Validator/Constraints/LocationHaveUniqueAssetRelationValidator.php index 52a97763db..2931c2ed00 100644 --- a/src/lib/Validator/Constraints/LocationHaveUniqueAssetRelationValidator.php +++ b/src/lib/Validator/Constraints/LocationHaveUniqueAssetRelationValidator.php @@ -12,16 +12,17 @@ use Ibexa\AdminUi\Specification\Content\ContentHaveUniqueRelation; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; class LocationHaveUniqueAssetRelationValidator extends ConstraintValidator { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService + * @param ContentService $contentService */ public function __construct(ContentService $contentService) { @@ -31,11 +32,13 @@ public function __construct(ContentService $contentService) /** * Checks if the passed value is valid. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location The value that should be validated - * @param \Symfony\Component\Validator\Constraint $constraint The constraint for the validation + * @param Location $location The value that should be validated + * @param Constraint $constraint The constraint for the validation */ - public function validate($location, Constraint $constraint) - { + public function validate( + $location, + Constraint $constraint + ) { if (null === $location) { $this->context->addViolation($constraint->message); diff --git a/src/lib/Validator/Constraints/LocationIsContainerValidator.php b/src/lib/Validator/Constraints/LocationIsContainerValidator.php index d90d3980dc..d52bd2da88 100644 --- a/src/lib/Validator/Constraints/LocationIsContainerValidator.php +++ b/src/lib/Validator/Constraints/LocationIsContainerValidator.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Validator\Constraints; use Ibexa\AdminUi\Specification\Location\IsContainer; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; @@ -17,11 +18,13 @@ class LocationIsContainerValidator extends ConstraintValidator /** * Checks if the passed value is valid. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location The value that should be validated - * @param \Symfony\Component\Validator\Constraint $constraint The constraint for the validation + * @param Location $location The value that should be validated + * @param Constraint $constraint The constraint for the validation */ - public function validate($location, Constraint $constraint) - { + public function validate( + $location, + Constraint $constraint + ) { if (null === $location) { $this->context->addViolation($constraint->message); diff --git a/src/lib/Validator/Constraints/LocationIsNotRootValidator.php b/src/lib/Validator/Constraints/LocationIsNotRootValidator.php index 87e36fa97d..b1e166931d 100644 --- a/src/lib/Validator/Constraints/LocationIsNotRootValidator.php +++ b/src/lib/Validator/Constraints/LocationIsNotRootValidator.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Validator\Constraints; use Ibexa\AdminUi\Specification\Location\IsRoot; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; @@ -17,11 +18,13 @@ class LocationIsNotRootValidator extends ConstraintValidator /** * Checks if the passed value is valid. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location The value that should be validated - * @param \Symfony\Component\Validator\Constraint $constraint The constraint for the validation + * @param Location $location The value that should be validated + * @param Constraint $constraint The constraint for the validation */ - public function validate($location, Constraint $constraint) - { + public function validate( + $location, + Constraint $constraint + ) { if (null === $location) { $this->context->addViolation($constraint->message); diff --git a/src/lib/Validator/Constraints/LocationIsNotSubLocationValidator.php b/src/lib/Validator/Constraints/LocationIsNotSubLocationValidator.php index 0be039afa4..44aec5950b 100644 --- a/src/lib/Validator/Constraints/LocationIsNotSubLocationValidator.php +++ b/src/lib/Validator/Constraints/LocationIsNotSubLocationValidator.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\Validator\Constraints; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Symfony\Component\Validator\Constraints\AbstractComparisonValidator; class LocationIsNotSubLocationValidator extends AbstractComparisonValidator @@ -15,13 +16,15 @@ class LocationIsNotSubLocationValidator extends AbstractComparisonValidator /** * Compares the two given values to find if their relationship is valid. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $targetLocation - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $sourceLocation + * @param Location $targetLocation + * @param Location $sourceLocation * * @return bool true if the relationship is valid, false otherwise */ - protected function compareValues($targetLocation, $sourceLocation) - { + protected function compareValues( + $targetLocation, + $sourceLocation + ) { return stripos($targetLocation->pathString, $sourceLocation->pathString) === false; } } diff --git a/src/lib/Validator/Constraints/LocationIsWithinCopySubtreeLimitValidator.php b/src/lib/Validator/Constraints/LocationIsWithinCopySubtreeLimitValidator.php index d05f2ee072..b25aaf2c1d 100644 --- a/src/lib/Validator/Constraints/LocationIsWithinCopySubtreeLimitValidator.php +++ b/src/lib/Validator/Constraints/LocationIsWithinCopySubtreeLimitValidator.php @@ -11,16 +11,17 @@ use Ibexa\AdminUi\Specification\Location\IsWithinCopySubtreeLimit; use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; use Ibexa\Contracts\Core\Repository\LocationService; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; class LocationIsWithinCopySubtreeLimitValidator extends ConstraintValidator { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; public function __construct( @@ -34,11 +35,13 @@ public function __construct( /** * Checks if the passed value is valid. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location The value that should be validated - * @param \Symfony\Component\Validator\Constraint $constraint The constraint for the validation + * @param Location $location The value that should be validated + * @param Constraint $constraint The constraint for the validation */ - public function validate($location, Constraint $constraint) - { + public function validate( + $location, + Constraint $constraint + ) { if (null === $location) { return; } diff --git a/src/lib/Validator/Constraints/UniqueContentTypeIdentifier.php b/src/lib/Validator/Constraints/UniqueContentTypeIdentifier.php index 704567567c..134ff4b19d 100644 --- a/src/lib/Validator/Constraints/UniqueContentTypeIdentifier.php +++ b/src/lib/Validator/Constraints/UniqueContentTypeIdentifier.php @@ -24,7 +24,7 @@ class UniqueContentTypeIdentifier extends Constraint implements TranslationConta public $message = 'ez.content_type.identifier.unique'; /** - * @return array<\JMS\TranslationBundle\Model\Message> + * @return array */ public static function getTranslationMessages(): array { diff --git a/src/lib/Validator/Constraints/UniqueContentTypeIdentifierValidator.php b/src/lib/Validator/Constraints/UniqueContentTypeIdentifierValidator.php index 3e87494efd..47df4da466 100644 --- a/src/lib/Validator/Constraints/UniqueContentTypeIdentifierValidator.php +++ b/src/lib/Validator/Constraints/UniqueContentTypeIdentifierValidator.php @@ -19,7 +19,7 @@ class UniqueContentTypeIdentifierValidator extends ConstraintValidator { /** - * @var \Ibexa\Contracts\Core\Repository\ContentTypeService + * @var ContentTypeService */ private $contentTypeService; @@ -31,13 +31,15 @@ public function __construct(ContentTypeService $contentTypeService) /** * Checks if the passed value is valid. * - * @param \Ibexa\AdminUi\Form\Data\ContentTypeData $value The value that should be validated - * @param \Symfony\Component\Validator\Constraint|UniqueFieldDefinitionIdentifier $constraint The constraint for the validation + * @param ContentTypeData $value The value that should be validated + * @param Constraint|UniqueFieldDefinitionIdentifier $constraint The constraint for the validation * * @api */ - public function validate($value, Constraint $constraint) - { + public function validate( + $value, + Constraint $constraint + ) { if (!$value instanceof ContentTypeData || $value->identifier === null) { return; } diff --git a/src/lib/Validator/Constraints/UniqueFieldDefinitionIdentifier.php b/src/lib/Validator/Constraints/UniqueFieldDefinitionIdentifier.php index f6df5e7e28..99ed55bce7 100644 --- a/src/lib/Validator/Constraints/UniqueFieldDefinitionIdentifier.php +++ b/src/lib/Validator/Constraints/UniqueFieldDefinitionIdentifier.php @@ -24,7 +24,7 @@ class UniqueFieldDefinitionIdentifier extends Constraint implements TranslationC public $message = 'ez.field_definition.identifier.unique'; /** - * @return array<\JMS\TranslationBundle\Model\Message> + * @return array */ public static function getTranslationMessages(): array { diff --git a/src/lib/Validator/Constraints/UniqueFieldDefinitionIdentifierValidator.php b/src/lib/Validator/Constraints/UniqueFieldDefinitionIdentifierValidator.php index 7a22eaf70a..2b1b552a10 100644 --- a/src/lib/Validator/Constraints/UniqueFieldDefinitionIdentifierValidator.php +++ b/src/lib/Validator/Constraints/UniqueFieldDefinitionIdentifierValidator.php @@ -19,13 +19,15 @@ class UniqueFieldDefinitionIdentifierValidator extends ConstraintValidator /** * Checks if the passed value is valid. * - * @param \Ibexa\AdminUi\Form\Data\FieldDefinitionData $value The value that should be validated - * @param \Symfony\Component\Validator\Constraint|UniqueFieldDefinitionIdentifier $constraint The constraint for the validation + * @param FieldDefinitionData $value The value that should be validated + * @param Constraint|UniqueFieldDefinitionIdentifier $constraint The constraint for the validation * * @api */ - public function validate($value, Constraint $constraint) - { + public function validate( + $value, + Constraint $constraint + ) { if (!$value instanceof FieldDefinitionData) { return; } diff --git a/src/lib/Validator/Constraints/UniqueURLValidator.php b/src/lib/Validator/Constraints/UniqueURLValidator.php index 9e31f6460a..8a3aed6869 100644 --- a/src/lib/Validator/Constraints/UniqueURLValidator.php +++ b/src/lib/Validator/Constraints/UniqueURLValidator.php @@ -15,13 +15,13 @@ class UniqueURLValidator extends ConstraintValidator { - /** @var \Ibexa\Contracts\Core\Repository\URLService */ + /** @var URLService */ private $urlService; /** * UniqueURLValidator constructor. * - * @param \Ibexa\Contracts\Core\Repository\URLService $urlService + * @param URLService $urlService */ public function __construct(URLService $urlService) { @@ -31,8 +31,10 @@ public function __construct(URLService $urlService) /** * {@inheritdoc} */ - public function validate($value, Constraint $constraint) - { + public function validate( + $value, + Constraint $constraint + ) { if (!$value instanceof URLUpdateData || $value->url === null) { return; } diff --git a/src/lib/Validator/Constraints/ValidatorConfigurationValidator.php b/src/lib/Validator/Constraints/ValidatorConfigurationValidator.php index 63d0c9f79c..83eac46f21 100644 --- a/src/lib/Validator/Constraints/ValidatorConfigurationValidator.php +++ b/src/lib/Validator/Constraints/ValidatorConfigurationValidator.php @@ -19,13 +19,15 @@ class ValidatorConfigurationValidator extends FieldTypeValidator /** * Checks if the passed value is valid. * - * @param \Ibexa\AdminUi\Form\Data\FieldDefinitionData $value The value that should be validated - * @param \Symfony\Component\Validator\Constraint $constraint The constraint for the validation + * @param FieldDefinitionData $value The value that should be validated + * @param Constraint $constraint The constraint for the validation * * @api */ - public function validate($value, Constraint $constraint) - { + public function validate( + $value, + Constraint $constraint + ) { if (!$value instanceof FieldDefinitionData) { return; } @@ -34,8 +36,10 @@ public function validate($value, Constraint $constraint) $this->processValidationErrors($fieldType->validateValidatorConfiguration($value->validatorConfiguration)); } - protected function generatePropertyPath($errorIndex, $errorTarget) - { + protected function generatePropertyPath( + $errorIndex, + $errorTarget + ) { return 'defaultValue'; } } diff --git a/src/lib/Validator/ValidationErrorsProcessor.php b/src/lib/Validator/ValidationErrorsProcessor.php index f3f2414fdc..e00b70a47e 100644 --- a/src/lib/Validator/ValidationErrorsProcessor.php +++ b/src/lib/Validator/ValidationErrorsProcessor.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Validator; use Ibexa\ContentForms\Validator\ValidationErrorsProcessor as BaseValidationErrorProcessor; +use Ibexa\Contracts\Core\FieldType\ValidationError; /** * @internal @@ -18,7 +19,7 @@ */ final class ValidationErrorsProcessor { - /** @var \Ibexa\ContentForms\Validator\ValidationErrorsProcessor */ + /** @var BaseValidationErrorProcessor */ private $validationErrorsProcessor; public function __construct(BaseValidationErrorProcessor $validationErrorsProcessor) @@ -29,7 +30,7 @@ public function __construct(BaseValidationErrorProcessor $validationErrorsProces /** * Builds constraint violations based on given SPI validation errors. * - * @param \Ibexa\Contracts\Core\FieldType\ValidationError[] $validationErrors + * @param ValidationError[] $validationErrors */ public function processValidationErrors(array $validationErrors): void { diff --git a/src/lib/View/Builder/ContentTranslateViewBuilder.php b/src/lib/View/Builder/ContentTranslateViewBuilder.php index d530795bd3..1bfa655012 100644 --- a/src/lib/View/Builder/ContentTranslateViewBuilder.php +++ b/src/lib/View/Builder/ContentTranslateViewBuilder.php @@ -11,15 +11,21 @@ use Ibexa\AdminUi\View\ContentTranslateSuccessView; use Ibexa\AdminUi\View\ContentTranslateView; use Ibexa\ContentForms\Form\ActionDispatcher\ActionDispatcherInterface; +use Ibexa\Contracts\Core\Repository\Exceptions\BadStateException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Core\Base\Exceptions\InvalidArgumentException; +use Ibexa\Core\Base\Exceptions\InvalidArgumentType; use Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface; use Ibexa\Core\MVC\Symfony\View\Builder\ViewBuilder; use Ibexa\Core\MVC\Symfony\View\Configurator; use Ibexa\Core\MVC\Symfony\View\ParametersInjector; +use Symfony\Component\Form\FormInterface; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; /** * Builds ContentEditView objects. @@ -28,19 +34,19 @@ */ class ContentTranslateViewBuilder implements ViewBuilder { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ + /** @var Repository */ private $repository; - /** @var \Ibexa\Core\MVC\Symfony\View\Configurator */ + /** @var Configurator */ private $viewConfigurator; - /** @var \Ibexa\Core\MVC\Symfony\View\ParametersInjector */ + /** @var ParametersInjector */ private $viewParametersInjector; - /** @var \Ibexa\ContentForms\Form\ActionDispatcher\ActionDispatcherInterface */ + /** @var ActionDispatcherInterface */ private $contentActionDispatcher; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ + /** @var UserLanguagePreferenceProviderInterface */ private $languagePreferenceProvider; public function __construct( @@ -68,15 +74,15 @@ public function matches($argument) /** * @param array $parameters * - * @return \Ibexa\AdminUi\View\ContentTranslateSuccessView|\Ibexa\AdminUi\View\ContentTranslateView + * @return ContentTranslateSuccessView|ContentTranslateView * - * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws InvalidArgumentException + * @throws NotFoundException + * @throws InvalidArgumentType + * @throws InvalidOptionsException + * @throws BadStateException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException */ public function buildView(array $parameters) { @@ -91,7 +97,7 @@ public function buildView(array $parameters) $content->getContentType()->id, $this->languagePreferenceProvider->getPreferredLanguages() ); - /** @var \Symfony\Component\Form\FormInterface $form */ + /** @var FormInterface $form */ $form = $parameters['form']; if (null === $location && $contentInfo->isPublished()) { @@ -133,13 +139,16 @@ public function buildView(array $parameters) * * @param array $languages * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content + * @return Content * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws UnauthorizedException + * @throws NotFoundException */ - private function loadContent(int $contentId, array $languages = [], ?int $versionNo = null): Content - { + private function loadContent( + int $contentId, + array $languages = [], + ?int $versionNo = null + ): Content { return $this->repository->getContentService()->loadContent($contentId, $languages, $versionNo); } @@ -148,20 +157,22 @@ private function loadContent(int $contentId, array $languages = [], ?int $versio * * @param array|null $languages * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location + * @return Location * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws UnauthorizedException + * @throws NotFoundException */ - private function loadLocation(int $locationId, ?array $languages = null): Location - { + private function loadLocation( + int $locationId, + ?array $languages = null + ): Location { return $this->repository->getLocationService()->loadLocation($locationId, $languages); } /** * Loads Language with code $languageCode. * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException */ private function loadLanguage(string $languageCode): Language { @@ -171,8 +182,8 @@ private function loadLanguage(string $languageCode): Language /** * @param array $parameters * - * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws InvalidArgumentException + * @throws NotFoundException */ private function resolveFromLanguage(array $parameters): ?Language { @@ -190,8 +201,8 @@ private function resolveFromLanguage(array $parameters): ?Language /** * @param array $parameters * - * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws InvalidArgumentException + * @throws NotFoundException */ private function resolveToLanguage(array $parameters): Language { @@ -212,13 +223,16 @@ private function resolveToLanguage(array $parameters): Language /** * @param array $parameters * - * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws InvalidArgumentException + * @throws UnauthorizedException + * @throws NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ - private function resolveContent(array $parameters, ?Location $location, ?Language $language): Content - { + private function resolveContent( + array $parameters, + ?Location $location, + ?Language $language + ): Content { if (isset($parameters['content'])) { return $parameters['content']; } elseif (null !== $location) { @@ -241,11 +255,13 @@ private function resolveContent(array $parameters, ?Location $location, ?Languag /** * @param array $parameters * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws UnauthorizedException + * @throws NotFoundException */ - private function resolveLocation(array $parameters, ?Language $language): ?Location - { + private function resolveLocation( + array $parameters, + ?Language $language + ): ?Location { if (isset($parameters['location'])) { return $parameters['location']; } diff --git a/src/lib/View/ContentTranslateSuccessView.php b/src/lib/View/ContentTranslateSuccessView.php index 26ad1c41e6..937f3a908d 100644 --- a/src/lib/View/ContentTranslateSuccessView.php +++ b/src/lib/View/ContentTranslateSuccessView.php @@ -8,6 +8,7 @@ namespace Ibexa\AdminUi\View; +use Ibexa\Core\Base\Exceptions\InvalidArgumentType; use Ibexa\Core\MVC\Symfony\View\BaseView; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Controller\ControllerReference; @@ -15,9 +16,9 @@ class ContentTranslateSuccessView extends BaseView { /** - * @param \Symfony\Component\HttpFoundation\Response $response + * @param Response $response * - * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType + * @throws InvalidArgumentType */ public function __construct(Response $response) { diff --git a/src/lib/View/ContentTranslateView.php b/src/lib/View/ContentTranslateView.php index 761079cb07..e848af8d92 100644 --- a/src/lib/View/ContentTranslateView.php +++ b/src/lib/View/ContentTranslateView.php @@ -22,29 +22,29 @@ */ class ContentTranslateView extends BaseView implements ContentTypeValueView { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ + /** @var Content */ private $content; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ + /** @var ContentType */ private $contentType; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ + /** @var Location|null */ private $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ + /** @var Language */ private $language; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language|null */ + /** @var Language|null */ private $baseLanguage; - /** @var \Symfony\Component\Form\FormInterface */ + /** @var FormInterface */ private $form; - /** @var \Symfony\Component\Form\FormView */ + /** @var FormView */ private $formView; /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param Content $content */ public function setContent(Content $content) { @@ -52,7 +52,7 @@ public function setContent(Content $content) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content + * @return Content */ public function getContent(): Content { @@ -60,7 +60,7 @@ public function getContent(): Content } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location + * @param Location|null $location */ public function setLocation(?Location $location) { @@ -68,7 +68,7 @@ public function setLocation(?Location $location) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null + * @return Location|null */ public function getLocation(): ?Location { @@ -76,7 +76,7 @@ public function getLocation(): ?Location } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language + * @return Language */ public function getLanguage(): Language { @@ -84,7 +84,7 @@ public function getLanguage(): Language } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language $language + * @param Language $language */ public function setLanguage(Language $language) { @@ -92,7 +92,7 @@ public function setLanguage(Language $language) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language|null + * @return Language|null */ public function getBaseLanguage(): ?Language { @@ -100,7 +100,7 @@ public function getBaseLanguage(): ?Language } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $baseLanguage + * @param Language|null $baseLanguage */ public function setBaseLanguage($baseLanguage) { @@ -108,7 +108,7 @@ public function setBaseLanguage($baseLanguage) } /** - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface */ public function getForm(): FormInterface { @@ -116,7 +116,7 @@ public function getForm(): FormInterface } /** - * @param \Symfony\Component\Form\FormInterface $form + * @param FormInterface $form */ public function setForm(FormInterface $form) { @@ -124,7 +124,7 @@ public function setForm(FormInterface $form) } /** - * @return \Symfony\Component\Form\FormView + * @return FormView */ public function getFormView(): FormView { @@ -132,7 +132,7 @@ public function getFormView(): FormView } /** - * @param \Symfony\Component\Form\FormView $formView + * @param FormView $formView */ public function setFormView(FormView $formView) { @@ -140,7 +140,7 @@ public function setFormView(FormView $formView) } /** - * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType + * @return ContentType */ public function getContentType(): ContentType { @@ -148,7 +148,7 @@ public function getContentType(): ContentType } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param ContentType $contentType */ public function setContentType(ContentType $contentType) { diff --git a/src/lib/View/ContentTypeCreateView.php b/src/lib/View/ContentTypeCreateView.php index 51dba6d3b6..5cc85d8ea8 100644 --- a/src/lib/View/ContentTypeCreateView.php +++ b/src/lib/View/ContentTypeCreateView.php @@ -15,13 +15,13 @@ final class ContentTypeCreateView extends BaseView { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup */ + /** @var ContentTypeGroup */ private $contentTypeGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ + /** @var ContentTypeDraft */ private $contentTypeDraft; - /** @var \Symfony\Component\Form\FormInterface */ + /** @var FormInterface */ private $form; /** diff --git a/src/lib/View/ContentTypeEditView.php b/src/lib/View/ContentTypeEditView.php index be747177eb..9e51996a0b 100644 --- a/src/lib/View/ContentTypeEditView.php +++ b/src/lib/View/ContentTypeEditView.php @@ -16,16 +16,16 @@ final class ContentTypeEditView extends BaseView { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup */ + /** @var ContentTypeGroup */ private $contentTypeGroup; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft */ + /** @var ContentTypeDraft */ private $contentTypeDraft; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ + /** @var Language */ private $language; - /** @var \Symfony\Component\Form\FormInterface */ + /** @var FormInterface */ private $form; /** diff --git a/src/lib/View/CreateContentOnTheFlyView.php b/src/lib/View/CreateContentOnTheFlyView.php index 0abaa97df0..70f9a33dbe 100644 --- a/src/lib/View/CreateContentOnTheFlyView.php +++ b/src/lib/View/CreateContentOnTheFlyView.php @@ -10,8 +10,6 @@ use Ibexa\Core\MVC\Symfony\View\BaseView; -class CreateContentOnTheFlyView extends BaseView -{ -} +class CreateContentOnTheFlyView extends BaseView {} class_alias(CreateContentOnTheFlyView::class, 'EzSystems\EzPlatformAdminUi\View\CreateContentOnTheFlyView'); diff --git a/src/lib/View/CreateUserOnTheFlyView.php b/src/lib/View/CreateUserOnTheFlyView.php index 87c9828674..0f172df7f3 100644 --- a/src/lib/View/CreateUserOnTheFlyView.php +++ b/src/lib/View/CreateUserOnTheFlyView.php @@ -10,8 +10,6 @@ use Ibexa\Core\MVC\Symfony\View\BaseView; -class CreateUserOnTheFlyView extends BaseView -{ -} +class CreateUserOnTheFlyView extends BaseView {} class_alias(CreateUserOnTheFlyView::class, 'EzSystems\EzPlatformAdminUi\View\CreateUserOnTheFlyView'); diff --git a/src/lib/View/EditContentOnTheFlySuccessView.php b/src/lib/View/EditContentOnTheFlySuccessView.php index 0eaa4844b4..63d22808be 100644 --- a/src/lib/View/EditContentOnTheFlySuccessView.php +++ b/src/lib/View/EditContentOnTheFlySuccessView.php @@ -10,8 +10,6 @@ use Ibexa\Core\MVC\Symfony\View\ContentView; -class EditContentOnTheFlySuccessView extends ContentView -{ -} +class EditContentOnTheFlySuccessView extends ContentView {} class_alias(EditContentOnTheFlySuccessView::class, 'EzSystems\EzPlatformAdminUi\View\EditContentOnTheFlySuccessView'); diff --git a/src/lib/View/EditContentOnTheFlyView.php b/src/lib/View/EditContentOnTheFlyView.php index 996911d4e0..945878132d 100644 --- a/src/lib/View/EditContentOnTheFlyView.php +++ b/src/lib/View/EditContentOnTheFlyView.php @@ -10,8 +10,6 @@ use Ibexa\ContentForms\Content\View\ContentEditView; -class EditContentOnTheFlyView extends ContentEditView -{ -} +class EditContentOnTheFlyView extends ContentEditView {} class_alias(EditContentOnTheFlyView::class, 'EzSystems\EzPlatformAdminUi\View\EditContentOnTheFlyView'); diff --git a/src/lib/View/EditUserOnTheFlyView.php b/src/lib/View/EditUserOnTheFlyView.php index 94ec0de238..ea7b235b33 100644 --- a/src/lib/View/EditUserOnTheFlyView.php +++ b/src/lib/View/EditUserOnTheFlyView.php @@ -10,8 +10,6 @@ use Ibexa\ContentForms\Content\View\ContentEditView; -class EditUserOnTheFlyView extends ContentEditView -{ -} +class EditUserOnTheFlyView extends ContentEditView {} class_alias(EditUserOnTheFlyView::class, 'EzSystems\EzPlatformAdminUi\View\EditUserOnTheFlyView'); diff --git a/src/lib/View/Filter/AdminSearchViewFilter.php b/src/lib/View/Filter/AdminSearchViewFilter.php index e405a36a1b..59905d10ef 100644 --- a/src/lib/View/Filter/AdminSearchViewFilter.php +++ b/src/lib/View/Filter/AdminSearchViewFilter.php @@ -13,6 +13,7 @@ use Ibexa\Bundle\Search\Form\Data\SearchData; use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\SectionService; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\MVC\Symfony\View\Event\FilterViewBuilderParametersEvent; @@ -21,29 +22,35 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\OptionsResolver\Exception\AccessException; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; +use Symfony\Component\OptionsResolver\Exception\MissingOptionsException; +use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; +use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; +use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class AdminSearchViewFilter implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; - /** @var \Symfony\Component\Form\FormFactoryInterface */ + /** @var FormFactoryInterface */ private $formFactory; - /** @var \Ibexa\Contracts\Core\Repository\SectionService */ + /** @var SectionService */ private $sectionService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; /** @var array */ private $siteAccessGroups; - /** @var \Ibexa\Search\View\SearchViewFilter */ + /** @var SearchViewFilter */ private $innerFilter; - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ + /** @var UrlGeneratorInterface */ private $urlGenerator; public function __construct( @@ -70,14 +77,14 @@ public static function getSubscribedEvents() } /** - * @throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException - * @throws \Symfony\Component\OptionsResolver\Exception\NoSuchOptionException - * @throws \Symfony\Component\OptionsResolver\Exception\MissingOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\AccessException - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws UndefinedOptionsException + * @throws OptionDefinitionException + * @throws NoSuchOptionException + * @throws MissingOptionsException + * @throws AccessException + * @throws InvalidOptionsException + * @throws UnauthorizedException + * @throws NotFoundException */ public function handleSearchForm(FilterViewBuilderParametersEvent $event): void { diff --git a/src/lib/View/Filter/ContentTranslateViewFilter.php b/src/lib/View/Filter/ContentTranslateViewFilter.php index 506c90584c..940ceba11d 100644 --- a/src/lib/View/Filter/ContentTranslateViewFilter.php +++ b/src/lib/View/Filter/ContentTranslateViewFilter.php @@ -13,6 +13,8 @@ use Ibexa\ContentForms\Form\Type\Content\ContentEditType; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\ContentTypeService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Language; @@ -23,33 +25,39 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; +use Symfony\Component\OptionsResolver\Exception\AccessException; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; +use Symfony\Component\OptionsResolver\Exception\MissingOptionsException; +use Symfony\Component\OptionsResolver\Exception\NoSuchOptionException; +use Symfony\Component\OptionsResolver\Exception\OptionDefinitionException; +use Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException; /** * Handles content translation form. */ class ContentTranslateViewFilter implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ + /** @var LanguageService */ private $languageService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ + /** @var ContentTypeService */ private $contentTypeService; - /** @var \Symfony\Component\Form\FormFactoryInterface */ + /** @var FormFactoryInterface */ private $formFactory; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ + /** @var UserLanguagePreferenceProviderInterface */ private $languagePreferenceProvider; /** - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Symfony\Component\Form\FormFactoryInterface $formFactory - * @param \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface $languagePreferenceProvider + * @param ContentService $contentService + * @param LanguageService $languageService + * @param ContentTypeService $contentTypeService + * @param FormFactoryInterface $formFactory + * @param UserLanguagePreferenceProviderInterface $languagePreferenceProvider */ public function __construct( ContentService $contentService, @@ -71,16 +79,16 @@ public static function getSubscribedEvents() } /** - * @param \Ibexa\Core\MVC\Symfony\View\Event\FilterViewBuilderParametersEvent $event + * @param FilterViewBuilderParametersEvent $event * - * @throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException - * @throws \Symfony\Component\OptionsResolver\Exception\NoSuchOptionException - * @throws \Symfony\Component\OptionsResolver\Exception\MissingOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\AccessException - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws UndefinedOptionsException + * @throws OptionDefinitionException + * @throws NoSuchOptionException + * @throws MissingOptionsException + * @throws AccessException + * @throws InvalidOptionsException + * @throws UnauthorizedException + * @throws NotFoundException */ public function handleContentTranslateForm(FilterViewBuilderParametersEvent $event): void { @@ -122,19 +130,19 @@ public function handleContentTranslateForm(FilterViewBuilderParametersEvent $eve } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language $toLanguage - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $fromLanguage - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType + * @param Content $content + * @param Language $toLanguage + * @param Language|null $fromLanguage + * @param ContentType $contentType * - * @return \Ibexa\AdminUi\Form\Data\ContentTranslationData + * @return ContentTranslationData * - * @throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException - * @throws \Symfony\Component\OptionsResolver\Exception\NoSuchOptionException - * @throws \Symfony\Component\OptionsResolver\Exception\MissingOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - * @throws \Symfony\Component\OptionsResolver\Exception\AccessException + * @throws UndefinedOptionsException + * @throws OptionDefinitionException + * @throws NoSuchOptionException + * @throws MissingOptionsException + * @throws InvalidOptionsException + * @throws AccessException */ private function resolveContentTranslationData( Content $content, @@ -155,11 +163,11 @@ private function resolveContentTranslationData( } /** - * @param \Ibexa\AdminUi\Form\Data\ContentTranslationData $contentUpdate - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language $toLanguage - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @param ContentTranslationData $contentUpdate + * @param Language $toLanguage + * @param Content $content * - * @return \Symfony\Component\Form\FormInterface + * @return FormInterface */ private function resolveContentTranslateForm( ContentTranslationData $contentUpdate, diff --git a/src/lib/View/Provider/ContentTranslateView/Configured.php b/src/lib/View/Provider/ContentTranslateView/Configured.php index 7894e61744..2f14621dd5 100644 --- a/src/lib/View/Provider/ContentTranslateView/Configured.php +++ b/src/lib/View/Provider/ContentTranslateView/Configured.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\View\Provider\ContentTranslateView; use Ibexa\AdminUi\View\ContentTranslateView; +use Ibexa\Core\Base\Exceptions\InvalidArgumentType; use Ibexa\Core\MVC\Symfony\Matcher\MatcherFactoryInterface; use Ibexa\Core\MVC\Symfony\View\View; use Ibexa\Core\MVC\Symfony\View\ViewProvider; @@ -20,12 +21,12 @@ class Configured implements ViewProvider { /** - * @var \Ibexa\Core\MVC\Symfony\Matcher\MatcherFactoryInterface + * @var MatcherFactoryInterface */ protected $matcherFactory; /** - * @param \Ibexa\Core\MVC\Symfony\Matcher\MatcherFactoryInterface $matcherFactory + * @param MatcherFactoryInterface $matcherFactory */ public function __construct(MatcherFactoryInterface $matcherFactory) { @@ -35,7 +36,7 @@ public function __construct(MatcherFactoryInterface $matcherFactory) /** * {@inheritdoc} * - * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType + * @throws InvalidArgumentType */ public function getView(View $view) { @@ -51,9 +52,9 @@ public function getView(View $view) * * @param array $viewConfig * - * @return \Ibexa\AdminUi\View\ContentTranslateView + * @return ContentTranslateView * - * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType + * @throws InvalidArgumentType */ protected function buildContentTranslateView(array $viewConfig): ContentTranslateView { diff --git a/tests/bundle/ControllerArgumentResolver/ContentTreeChildrenQueryArgumentResolverTest.php b/tests/bundle/ControllerArgumentResolver/ContentTreeChildrenQueryArgumentResolverTest.php index 0a65bdbfb8..8f6e7559ba 100644 --- a/tests/bundle/ControllerArgumentResolver/ContentTreeChildrenQueryArgumentResolverTest.php +++ b/tests/bundle/ControllerArgumentResolver/ContentTreeChildrenQueryArgumentResolverTest.php @@ -11,10 +11,14 @@ use ArrayIterator; use Generator; use Ibexa\Bundle\AdminUi\ControllerArgumentResolver\ContentTreeChildrenQueryArgumentResolver; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; +use Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\ContentTypeIdentifier; use Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\LogicalAnd; +use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Rest\Input\Parser\Query\Criterion\CriterionProcessorInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface; @@ -32,7 +36,7 @@ final class ContentTreeChildrenQueryArgumentResolverTest extends TestCase { private ArgumentValueResolverInterface $resolver; - /** @phpstan-var TCriterionProcessor&\PHPUnit\Framework\MockObject\MockObject */ + /** @phpstan-var TCriterionProcessor&MockObject */ private CriterionProcessorInterface $criterionProcessor; protected function setUp(): void @@ -101,9 +105,9 @@ public function provideDataForTestSupports(): iterable * @dataProvider provideDataForTestResolve * * @param array> $criteriaToProcess - * @param Traversable<\Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface> $expectedCriteria + * @param Traversable $expectedCriteria * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws InvalidArgumentException */ public function testResolve( Criterion $expected, @@ -139,7 +143,7 @@ public function testResolve( * 3?: array, * }> * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException + * @throws InvalidCriterionArgumentException */ public function provideDataForTestResolve(): iterable { @@ -172,7 +176,7 @@ public function provideDataForTestResolve(): iterable /** * @param array> $criteriaToProcess - * @param Traversable<\Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface> $expectedCriteria + * @param Traversable $expectedCriteria */ private function mockCriterionProcessorProcessCriteria( ?array $criteriaToProcess, diff --git a/tests/bundle/DependencyInjection/Compiler/ComponentPassTest.php b/tests/bundle/DependencyInjection/Compiler/ComponentPassTest.php index a00e12cc25..eda44f844c 100644 --- a/tests/bundle/DependencyInjection/Compiler/ComponentPassTest.php +++ b/tests/bundle/DependencyInjection/Compiler/ComponentPassTest.php @@ -25,7 +25,7 @@ protected function setUp(): void } /** - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container + * @param ContainerBuilder $container */ protected function registerCompilerPass(ContainerBuilder $container): void { diff --git a/tests/bundle/DependencyInjection/Compiler/TabPassTest.php b/tests/bundle/DependencyInjection/Compiler/TabPassTest.php index bbf5aaa5c2..7efbea00f1 100644 --- a/tests/bundle/DependencyInjection/Compiler/TabPassTest.php +++ b/tests/bundle/DependencyInjection/Compiler/TabPassTest.php @@ -24,7 +24,7 @@ protected function setUp(): void } /** - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container + * @param ContainerBuilder $container */ protected function registerCompilerPass(ContainerBuilder $container): void { diff --git a/tests/bundle/DependencyInjection/Compiler/UiConfigProviderPassTest.php b/tests/bundle/DependencyInjection/Compiler/UiConfigProviderPassTest.php index ef95891241..e2bbec6b80 100644 --- a/tests/bundle/DependencyInjection/Compiler/UiConfigProviderPassTest.php +++ b/tests/bundle/DependencyInjection/Compiler/UiConfigProviderPassTest.php @@ -24,7 +24,7 @@ protected function setUp(): void } /** - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container + * @param ContainerBuilder $container */ protected function registerCompilerPass(ContainerBuilder $container): void { diff --git a/tests/bundle/DependencyInjection/Configuration/Parser/AdminUiFormsTest.php b/tests/bundle/DependencyInjection/Configuration/Parser/AdminUiFormsTest.php index 4d81dc2bc3..b2ef1f1b28 100644 --- a/tests/bundle/DependencyInjection/Configuration/Parser/AdminUiFormsTest.php +++ b/tests/bundle/DependencyInjection/Configuration/Parser/AdminUiFormsTest.php @@ -10,6 +10,7 @@ use Ibexa\Bundle\AdminUi\DependencyInjection\Configuration\Parser\AdminUiForms; use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -18,12 +19,12 @@ class AdminUiFormsTest extends TestCase { /** - * @var \Ibexa\Bundle\AdminUi\DependencyInjection\Configuration\Parser\AdminUiForms + * @var AdminUiForms */ private $parser; /** - * @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface|\PHPUnit\Framework\MockObject\MockObject + * @var ContextualizerInterface|MockObject */ private $contextualizer; diff --git a/tests/bundle/DependencyInjection/Configuration/Parser/SubtreeOperationsTest.php b/tests/bundle/DependencyInjection/Configuration/Parser/SubtreeOperationsTest.php index 8375ac625f..a04d7393a0 100644 --- a/tests/bundle/DependencyInjection/Configuration/Parser/SubtreeOperationsTest.php +++ b/tests/bundle/DependencyInjection/Configuration/Parser/SubtreeOperationsTest.php @@ -10,6 +10,7 @@ use Ibexa\Bundle\AdminUi\DependencyInjection\Configuration\Parser\SubtreeOperations; use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -19,7 +20,7 @@ final class SubtreeOperationsTest extends TestCase { private SubtreeOperations $parser; - /** @var \PHPUnit\Framework\MockObject\MockObject&\Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface */ + /** @var MockObject&ContextualizerInterface */ private ContextualizerInterface $contextualizer; /** diff --git a/tests/bundle/ParamConverter/AbstractParamConverterTest.php b/tests/bundle/ParamConverter/AbstractParamConverterTest.php index 2df676c145..8ee3bcdb60 100644 --- a/tests/bundle/ParamConverter/AbstractParamConverterTest.php +++ b/tests/bundle/ParamConverter/AbstractParamConverterTest.php @@ -18,7 +18,7 @@ public function testSupports() { $config = $this->createConfiguration(static::SUPPORTED_CLASS); - $this->assertTrue($this->converter->supports($config)); + self::assertTrue($this->converter->supports($config)); } } diff --git a/tests/bundle/ParamConverter/ContentParamConverterTest.php b/tests/bundle/ParamConverter/ContentParamConverterTest.php index c940d2dfb4..54324d8e97 100644 --- a/tests/bundle/ParamConverter/ContentParamConverterTest.php +++ b/tests/bundle/ParamConverter/ContentParamConverterTest.php @@ -11,6 +11,7 @@ use Ibexa\Bundle\AdminUi\ParamConverter\ContentParamConverter; use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\Values\Content\Content; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\HttpFoundation\Request; /** @@ -21,10 +22,10 @@ class ContentParamConverterTest extends AbstractParamConverterTest public const SUPPORTED_CLASS = Content::class; public const PARAMETER_NAME = 'content'; - /** @var \Ibexa\Bundle\AdminUi\ParamConverter\ContentParamConverter */ + /** @var ContentParamConverter */ protected $converter; - /** @var \PHPUnit\Framework\MockObject\MockObject */ + /** @var MockObject */ protected $contentServiceMock; protected function setUp(): void @@ -42,7 +43,7 @@ public function testApply() $valueObject = $this->createMock(Content::class); $this->contentServiceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadContent') ->with($contentId, $languageCode, $versionNo) ->willReturn($valueObject); @@ -56,8 +57,8 @@ public function testApply() $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertTrue($this->converter->apply($request, $config)); - $this->assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); + self::assertTrue($this->converter->apply($request, $config)); + self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); } /** @@ -66,8 +67,10 @@ public function testApply() * @param $contentId * @param $languageCode */ - public function testApplyWithWrongAttribute($contentId, $languageCode) - { + public function testApplyWithWrongAttribute( + $contentId, + $languageCode + ) { $versionNo = 53; $requestAttributes = [ @@ -79,8 +82,8 @@ public function testApplyWithWrongAttribute($contentId, $languageCode) $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertFalse($this->converter->apply($request, $config)); - $this->assertNull($request->attributes->get(self::PARAMETER_NAME)); + self::assertFalse($this->converter->apply($request, $config)); + self::assertNull($request->attributes->get(self::PARAMETER_NAME)); } /** diff --git a/tests/bundle/ParamConverter/ContentTypeDraftParamConverterTest.php b/tests/bundle/ParamConverter/ContentTypeDraftParamConverterTest.php index c4052b43ac..ff377df2b5 100644 --- a/tests/bundle/ParamConverter/ContentTypeDraftParamConverterTest.php +++ b/tests/bundle/ParamConverter/ContentTypeDraftParamConverterTest.php @@ -10,6 +10,7 @@ use Ibexa\Bundle\AdminUi\ParamConverter\ContentTypeDraftParamConverter; use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\HttpFoundation\Request; class ContentTypeDraftParamConverterTest extends AbstractParamConverterTest @@ -17,10 +18,10 @@ class ContentTypeDraftParamConverterTest extends AbstractParamConverterTest public const SUPPORTED_CLASS = ContentTypeDraft::class; public const PARAMETER_NAME = 'contentType'; - /** @var \Ibexa\Bundle\AdminUi\ParamConverter\ContentTypeDraftParamConverter */ + /** @var ContentTypeDraftParamConverter */ protected $converter; - /** @var \PHPUnit\Framework\MockObject\MockObject */ + /** @var MockObject */ protected $contentTypeServiceMock; protected function setUp(): void @@ -36,12 +37,14 @@ protected function setUp(): void * @param mixed $contentTypeId The content type identifier fetched from the request * @param int $contentTypeIdToLoad The content type identifier used to load the content type draft */ - public function testApply($contentTypeId, int $contentTypeIdToLoad) - { + public function testApply( + $contentTypeId, + int $contentTypeIdToLoad + ) { $valueObject = $this->createMock(ContentTypeDraft::class); $this->contentTypeServiceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadContentTypeDraft') ->with($contentTypeIdToLoad) ->willReturn($valueObject); @@ -53,8 +56,8 @@ public function testApply($contentTypeId, int $contentTypeIdToLoad) $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertTrue($this->converter->apply($request, $config)); - $this->assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); + self::assertTrue($this->converter->apply($request, $config)); + self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); } public function testApplyWithWrongAttribute() @@ -66,8 +69,8 @@ public function testApplyWithWrongAttribute() $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertFalse($this->converter->apply($request, $config)); - $this->assertNull($request->attributes->get(self::PARAMETER_NAME)); + self::assertFalse($this->converter->apply($request, $config)); + self::assertNull($request->attributes->get(self::PARAMETER_NAME)); } public function dataProvider(): array diff --git a/tests/bundle/ParamConverter/ContentTypeGroupParamConverterTest.php b/tests/bundle/ParamConverter/ContentTypeGroupParamConverterTest.php index 4bdf355c7b..ea7db5f34e 100644 --- a/tests/bundle/ParamConverter/ContentTypeGroupParamConverterTest.php +++ b/tests/bundle/ParamConverter/ContentTypeGroupParamConverterTest.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -19,10 +20,10 @@ class ContentTypeGroupParamConverterTest extends AbstractParamConverterTest public const SUPPORTED_CLASS = ContentTypeGroup::class; public const PARAMETER_NAME = 'contentTypeGroup'; - /** @var \Ibexa\Bundle\AdminUi\ParamConverter\ContentTypeGroupParamConverter */ + /** @var ContentTypeGroupParamConverter */ protected $converter; - /** @var \PHPUnit\Framework\MockObject\MockObject */ + /** @var MockObject */ protected $serviceMock; protected function setUp(): void @@ -38,12 +39,14 @@ protected function setUp(): void * @param mixed $contentTypeGroupId The identifier fetched from the request * @param int $contentTypeGroupIdToLoad The identifier used to load the content type Group */ - public function testApply($contentTypeGroupId, int $contentTypeGroupIdToLoad) - { + public function testApply( + $contentTypeGroupId, + int $contentTypeGroupIdToLoad + ) { $valueObject = $this->createMock(ContentTypeGroup::class); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadContentTypeGroup') ->with($contentTypeGroupIdToLoad) ->willReturn($valueObject); @@ -55,8 +58,8 @@ public function testApply($contentTypeGroupId, int $contentTypeGroupIdToLoad) $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertTrue($this->converter->apply($request, $config)); - $this->assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); + self::assertTrue($this->converter->apply($request, $config)); + self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); } public function testApplyWithWrongAttribute() @@ -68,8 +71,8 @@ public function testApplyWithWrongAttribute() $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertFalse($this->converter->apply($request, $config)); - $this->assertNull($request->attributes->get(self::PARAMETER_NAME)); + self::assertFalse($this->converter->apply($request, $config)); + self::assertNull($request->attributes->get(self::PARAMETER_NAME)); } public function testApplyWhenNotFound() @@ -82,7 +85,7 @@ public function testApplyWhenNotFound() ); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadContentTypeGroup') ->with($contentTypeGroupId) ->willThrowException( diff --git a/tests/bundle/ParamConverter/ContentTypeParamConverterTest.php b/tests/bundle/ParamConverter/ContentTypeParamConverterTest.php index ba47cdd67e..6988f4b38b 100644 --- a/tests/bundle/ParamConverter/ContentTypeParamConverterTest.php +++ b/tests/bundle/ParamConverter/ContentTypeParamConverterTest.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -20,10 +21,10 @@ class ContentTypeParamConverterTest extends AbstractParamConverterTest public const SUPPORTED_CLASS = ContentType::class; public const PARAMETER_NAME = 'contentType'; - /** @var \Ibexa\Bundle\AdminUi\ParamConverter\ContentTypeParamConverter */ + /** @var ContentTypeParamConverter */ protected $converter; - /** @var \PHPUnit\Framework\MockObject\MockObject */ + /** @var MockObject */ protected $serviceMock; protected function setUp(): void @@ -40,12 +41,14 @@ protected function setUp(): void * @param mixed $contentTypeId The content type identifier fetched from the request * @param int $contentTypeIdToLoad The content type identifier used to load the content type draft */ - public function testApplyId($contentTypeId, int $contentTypeIdLoad) - { + public function testApplyId( + $contentTypeId, + int $contentTypeIdLoad + ) { $valueObject = $this->createMock(ContentType::class); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadContentType') ->with($contentTypeIdLoad) ->willReturn($valueObject); @@ -57,8 +60,8 @@ public function testApplyId($contentTypeId, int $contentTypeIdLoad) $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertTrue($this->converter->apply($request, $config)); - $this->assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); + self::assertTrue($this->converter->apply($request, $config)); + self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); } public function testApplyIdWithWrongValue() @@ -70,8 +73,8 @@ public function testApplyIdWithWrongValue() $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertFalse($this->converter->apply($request, $config)); - $this->assertNull($request->attributes->get(self::PARAMETER_NAME)); + self::assertFalse($this->converter->apply($request, $config)); + self::assertNull($request->attributes->get(self::PARAMETER_NAME)); } public function testApplyIdWhenNotFound() @@ -82,7 +85,7 @@ public function testApplyIdWhenNotFound() $this->expectExceptionMessage(sprintf('Content type %s not found.', $contentTypeId)); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadContentType') ->with($contentTypeId) ->willThrowException($this->createMock(NotFoundException::class)); @@ -103,7 +106,7 @@ public function testApplyIdentifier() $valueObject = $this->createMock(ContentType::class); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadContentTypeByIdentifier') ->with($contentTypeIdentifier) ->willReturn($valueObject); @@ -117,7 +120,7 @@ public function testApplyIdentifier() $this->converter->apply($request, $config); - $this->assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); + self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); } public function testApplyIdentifierWithWrongValue() @@ -129,8 +132,8 @@ public function testApplyIdentifierWithWrongValue() $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertFalse($this->converter->apply($request, $config)); - $this->assertNull($request->attributes->get(self::PARAMETER_NAME)); + self::assertFalse($this->converter->apply($request, $config)); + self::assertNull($request->attributes->get(self::PARAMETER_NAME)); } public function testApplyIdentifierWhenNotFound() @@ -141,7 +144,7 @@ public function testApplyIdentifierWhenNotFound() $this->expectExceptionMessage(sprintf('Content type %s not found.', $contentTypeIdentifier)); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadContentTypeByIdentifier') ->with($contentTypeIdentifier) ->willThrowException($this->createMock(NotFoundException::class)); diff --git a/tests/bundle/ParamConverter/LanguageParamConverterTest.php b/tests/bundle/ParamConverter/LanguageParamConverterTest.php index 64d2b88908..aed2188b44 100644 --- a/tests/bundle/ParamConverter/LanguageParamConverterTest.php +++ b/tests/bundle/ParamConverter/LanguageParamConverterTest.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\Values\Content\Language; +use PHPUnit\Framework\MockObject\MockObject; use stdClass; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -20,10 +21,10 @@ class LanguageParamConverterTest extends AbstractParamConverterTest public const SUPPORTED_CLASS = Language::class; public const PARAMETER_NAME = 'language'; - /** @var \Ibexa\Bundle\AdminUi\ParamConverter\LanguageParamConverter */ + /** @var LanguageParamConverter */ protected $converter; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var LanguageService|MockObject */ protected $serviceMock; protected function setUp(): void @@ -40,12 +41,14 @@ protected function setUp(): void * @param mixed $languageId The language identifier fetched from the request * @param int $languageIdToLoad The language identifier used to load the language */ - public function testApplyForLanguageId($languageId, int $languageIdToLoad) - { + public function testApplyForLanguageId( + $languageId, + int $languageIdToLoad + ) { $valueObject = $this->createMock(Language::class); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadLanguageById') ->with($languageIdToLoad) ->willReturn($valueObject); @@ -57,8 +60,8 @@ public function testApplyForLanguageId($languageId, int $languageIdToLoad) $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertTrue($this->converter->apply($request, $config)); - $this->assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); + self::assertTrue($this->converter->apply($request, $config)); + self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); } /** @@ -70,7 +73,7 @@ public function testApplyForLanguageCode() $valueObject = $this->createMock(Language::class); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadLanguage') ->with($languageCode) ->willReturn($valueObject); @@ -83,7 +86,7 @@ public function testApplyForLanguageCode() $this->converter->apply($request, $config); - $this->assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); + self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); } /** @@ -96,8 +99,8 @@ public function testApplyWithWrongAttribute(array $attributes) $request = new Request([], [], $attributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertFalse($this->converter->apply($request, $config)); - $this->assertNull($request->attributes->get(self::PARAMETER_NAME)); + self::assertFalse($this->converter->apply($request, $config)); + self::assertNull($request->attributes->get(self::PARAMETER_NAME)); } /** @@ -111,7 +114,7 @@ public function testApplyWithNonExistingLanguageId() $this->expectExceptionMessage(sprintf('Language %s not found.', $languageId)); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadLanguageById') ->with($languageId) ->willThrowException($this->createMock(NotFoundException::class)); @@ -137,7 +140,7 @@ public function testApplyWithNonExistingLanguageCode() $this->expectExceptionMessage(sprintf('Language %s not found.', $languageCode)); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadLanguage') ->with($languageCode) ->willThrowException($this->createMock(NotFoundException::class)); @@ -157,9 +160,11 @@ public function testApplyWithNonExistingLanguageCode() * * @dataProvider dataProviderForSupport */ - public function testSupport(string $class, bool $expected) - { - $this->assertEquals($expected, $this->converter->supports($this->createConfiguration($class))); + public function testSupport( + string $class, + bool $expected + ) { + self::assertEquals($expected, $this->converter->supports($this->createConfiguration($class))); } public function dataProviderForSupport(): array diff --git a/tests/bundle/ParamConverter/PolicyParamConverterTest.php b/tests/bundle/ParamConverter/PolicyParamConverterTest.php index 5aea2d31f7..3b9d0a01d6 100644 --- a/tests/bundle/ParamConverter/PolicyParamConverterTest.php +++ b/tests/bundle/ParamConverter/PolicyParamConverterTest.php @@ -13,6 +13,7 @@ use Ibexa\Contracts\Core\Repository\Values\User\Policy; use Ibexa\Contracts\Core\Repository\Values\User\Role; use Ibexa\Core\Repository\Values\User\Policy as UserPolicy; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -21,10 +22,10 @@ class PolicyParamConverterTest extends AbstractParamConverterTest public const SUPPORTED_CLASS = Policy::class; public const PARAMETER_NAME = 'policy'; - /** @var \Ibexa\Bundle\AdminUi\ParamConverter\PolicyParamConverter */ + /** @var PolicyParamConverter */ protected $converter; - /** @var \PHPUnit\Framework\MockObject\MockObject */ + /** @var MockObject */ protected $serviceMock; protected function setUp(): void @@ -41,8 +42,11 @@ protected function setUp(): void * @param mixed $roleId The role identifier fetched from the request * @param int $roleIdToLoad The role identifier used to load the role */ - public function testApply($policyId, $roleId, int $roleIdToLoad) - { + public function testApply( + $policyId, + $roleId, + int $roleIdToLoad + ) { $matchingPolicyId = 53; $valueObject = $this->createMock(Role::class); $valueObject->expects(self::once()) @@ -50,7 +54,7 @@ public function testApply($policyId, $roleId, int $roleIdToLoad) ->willReturn([new UserPolicy(['id' => $matchingPolicyId]), new UserPolicy(['id' => 444])]); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadRole') ->with($roleIdToLoad) ->willReturn($valueObject); @@ -63,10 +67,10 @@ public function testApply($policyId, $roleId, int $roleIdToLoad) $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertTrue($this->converter->apply($request, $config)); + self::assertTrue($this->converter->apply($request, $config)); $policy = $request->attributes->get(self::PARAMETER_NAME); - $this->assertInstanceOf(self::SUPPORTED_CLASS, $policy); - $this->assertSame($matchingPolicyId, $policy->id); + self::assertInstanceOf(self::SUPPORTED_CLASS, $policy); + self::assertSame($matchingPolicyId, $policy->id); } /** @@ -75,8 +79,10 @@ public function testApply($policyId, $roleId, int $roleIdToLoad) * @param $roleId * @param $policyId */ - public function testApplyWithWrongAttribute($roleId, $policyId) - { + public function testApplyWithWrongAttribute( + $roleId, + $policyId + ) { $requestAttributes = [ PolicyParamConverter::PARAMETER_ROLE_ID => $roleId, PolicyParamConverter::PARAMETER_POLICY_ID => $policyId, @@ -85,8 +91,8 @@ public function testApplyWithWrongAttribute($roleId, $policyId) $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertFalse($this->converter->apply($request, $config)); - $this->assertNull($request->attributes->get(self::PARAMETER_NAME)); + self::assertFalse($this->converter->apply($request, $config)); + self::assertNull($request->attributes->get(self::PARAMETER_NAME)); } public function testApplyWhenRoleNotFound() @@ -98,7 +104,7 @@ public function testApplyWhenRoleNotFound() $this->expectExceptionMessage(sprintf('Role %s not found.', $roleId)); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadRole') ->with($roleId) ->willThrowException($this->createMock(NotFoundException::class)); @@ -128,7 +134,7 @@ public function testApplyWhenPolicyNotFound() ->willReturn([new UserPolicy(['id' => 123])]); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadRole') ->with($roleId) ->willReturn($valueObject); diff --git a/tests/bundle/ParamConverter/RoleAssignmentParamConverterTest.php b/tests/bundle/ParamConverter/RoleAssignmentParamConverterTest.php index 43fd463749..8c476fea3e 100644 --- a/tests/bundle/ParamConverter/RoleAssignmentParamConverterTest.php +++ b/tests/bundle/ParamConverter/RoleAssignmentParamConverterTest.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\RoleService; use Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -19,10 +20,10 @@ class RoleAssignmentParamConverterTest extends AbstractParamConverterTest public const SUPPORTED_CLASS = RoleAssignment::class; public const PARAMETER_NAME = 'roleAssignment'; - /** @var \Ibexa\Bundle\AdminUi\ParamConverter\RoleAssignmentParamConverter */ + /** @var RoleAssignmentParamConverter */ protected $converter; - /** @var \PHPUnit\Framework\MockObject\MockObject */ + /** @var MockObject */ protected $serviceMock; protected function setUp(): void @@ -38,12 +39,14 @@ protected function setUp(): void * @param mixed $roleAssignmentId The role assignment identifier fetched from the request * @param int $roleAssignmentIdToLoad The role assignment identifier used to load the role assignment */ - public function testApply($roleAssignmentId, int $roleAssignmentIdToLoad) - { + public function testApply( + $roleAssignmentId, + int $roleAssignmentIdToLoad + ) { $valueObject = $this->createMock(RoleAssignment::class); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadRoleAssignment') ->with($roleAssignmentIdToLoad) ->willReturn($valueObject); @@ -55,8 +58,8 @@ public function testApply($roleAssignmentId, int $roleAssignmentIdToLoad) $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertTrue($this->converter->apply($request, $config)); - $this->assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); + self::assertTrue($this->converter->apply($request, $config)); + self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); } public function testApplyWithWrongAttribute() @@ -68,8 +71,8 @@ public function testApplyWithWrongAttribute() $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertFalse($this->converter->apply($request, $config)); - $this->assertNull($request->attributes->get(self::PARAMETER_NAME)); + self::assertFalse($this->converter->apply($request, $config)); + self::assertNull($request->attributes->get(self::PARAMETER_NAME)); } public function testApplyWhenNotFound() @@ -80,7 +83,7 @@ public function testApplyWhenNotFound() $this->expectExceptionMessage(sprintf('Role assignment %s not found.', $roleAssignmentId)); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadRoleAssignment') ->with($roleAssignmentId) ->willThrowException($this->createMock(NotFoundException::class)); diff --git a/tests/bundle/ParamConverter/RoleParamConverterTest.php b/tests/bundle/ParamConverter/RoleParamConverterTest.php index 4d088f9098..f2a0b6d910 100644 --- a/tests/bundle/ParamConverter/RoleParamConverterTest.php +++ b/tests/bundle/ParamConverter/RoleParamConverterTest.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\RoleService; use Ibexa\Contracts\Core\Repository\Values\User\Role; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -19,10 +20,10 @@ class RoleParamConverterTest extends AbstractParamConverterTest public const SUPPORTED_CLASS = Role::class; public const PARAMETER_NAME = 'role'; - /** @var \Ibexa\Bundle\AdminUi\ParamConverter\RoleParamConverter */ + /** @var RoleParamConverter */ protected $converter; - /** @var \PHPUnit\Framework\MockObject\MockObject */ + /** @var MockObject */ protected $serviceMock; protected function setUp(): void @@ -38,12 +39,14 @@ protected function setUp(): void * @param mixed $roleId The role identifier fetched from the request * @param int $roleIdToLoad The role identifier used to load the role */ - public function testApply($roleId, int $roleIdToLoad) - { + public function testApply( + $roleId, + int $roleIdToLoad + ) { $valueObject = $this->createMock(Role::class); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadRole') ->with($roleIdToLoad) ->willReturn($valueObject); @@ -55,8 +58,8 @@ public function testApply($roleId, int $roleIdToLoad) $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertTrue($this->converter->apply($request, $config)); - $this->assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); + self::assertTrue($this->converter->apply($request, $config)); + self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); } public function testApplyWithWrongAttribute() @@ -68,8 +71,8 @@ public function testApplyWithWrongAttribute() $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertFalse($this->converter->apply($request, $config)); - $this->assertNull($request->attributes->get(self::PARAMETER_NAME)); + self::assertFalse($this->converter->apply($request, $config)); + self::assertNull($request->attributes->get(self::PARAMETER_NAME)); } public function testApplyWhenNotFound() @@ -80,7 +83,7 @@ public function testApplyWhenNotFound() $this->expectExceptionMessage(sprintf('Role %s not found.', $roleId)); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadRole') ->with($roleId) ->willThrowException($this->createMock(NotFoundException::class)); diff --git a/tests/bundle/ParamConverter/SectionParamConverterTest.php b/tests/bundle/ParamConverter/SectionParamConverterTest.php index 4bb711b5b7..5c76cf0153 100644 --- a/tests/bundle/ParamConverter/SectionParamConverterTest.php +++ b/tests/bundle/ParamConverter/SectionParamConverterTest.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\SectionService; use Ibexa\Contracts\Core\Repository\Values\Content\Section; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -19,10 +20,10 @@ class SectionParamConverterTest extends AbstractParamConverterTest public const SUPPORTED_CLASS = Section::class; public const PARAMETER_NAME = 'section'; - /** @var \Ibexa\Bundle\AdminUi\ParamConverter\SectionParamConverter */ + /** @var SectionParamConverter */ protected $converter; - /** @var \PHPUnit\Framework\MockObject\MockObject */ + /** @var MockObject */ protected $serviceMock; protected function setUp(): void @@ -38,12 +39,14 @@ protected function setUp(): void * @param mixed $sectionId The section identifier fetched from the request * @param int $sectionIdToLoad The section identifier used to load the section */ - public function testApply($sectionId, int $sectionIdToLoad) - { + public function testApply( + $sectionId, + int $sectionIdToLoad + ) { $valueObject = $this->createMock(Section::class); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadSection') ->with($sectionIdToLoad) ->willReturn($valueObject); @@ -55,8 +58,8 @@ public function testApply($sectionId, int $sectionIdToLoad) $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertTrue($this->converter->apply($request, $config)); - $this->assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); + self::assertTrue($this->converter->apply($request, $config)); + self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); } public function testApplyWithWrongAttribute() @@ -68,8 +71,8 @@ public function testApplyWithWrongAttribute() $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertFalse($this->converter->apply($request, $config)); - $this->assertNull($request->attributes->get(self::PARAMETER_NAME)); + self::assertFalse($this->converter->apply($request, $config)); + self::assertNull($request->attributes->get(self::PARAMETER_NAME)); } public function testApplyWhenNotFound() @@ -80,7 +83,7 @@ public function testApplyWhenNotFound() $this->expectExceptionMessage(sprintf('Section %s not found.', $sectionId)); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadSection') ->with($sectionId) ->willThrowException($this->createMock(NotFoundException::class)); diff --git a/tests/bundle/ParamConverter/VersionInfoParamConverterTest.php b/tests/bundle/ParamConverter/VersionInfoParamConverterTest.php index f578262520..fe9f9899c7 100644 --- a/tests/bundle/ParamConverter/VersionInfoParamConverterTest.php +++ b/tests/bundle/ParamConverter/VersionInfoParamConverterTest.php @@ -9,8 +9,11 @@ use Ibexa\Bundle\AdminUi\ParamConverter\VersionInfoParamConverter; use Ibexa\Contracts\Core\Repository\ContentService; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\HttpFoundation\Request; class VersionInfoParamConverterTest extends AbstractParamConverterTest @@ -18,10 +21,10 @@ class VersionInfoParamConverterTest extends AbstractParamConverterTest public const SUPPORTED_CLASS = VersionInfo::class; public const PARAMETER_NAME = 'versionInfo'; - /** @var \Ibexa\Bundle\AdminUi\ParamConverter\VersionInfoParamConverter */ + /** @var VersionInfoParamConverter */ protected $converter; - /** @var \PHPUnit\Framework\MockObject\MockObject */ + /** @var MockObject */ protected $serviceMock; protected function setUp(): void @@ -39,22 +42,26 @@ protected function setUp(): void * @param mixed $contentId * @param int $contentIdToLoad * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ - public function testApply($versionNo, int $versionNoToload, $contentId, int $contentIdToLoad) - { + public function testApply( + $versionNo, + int $versionNoToload, + $contentId, + int $contentIdToLoad + ) { $valueObject = $this->createMock(ContentInfo::class); $versionInfo = $this->createMock(VersionInfo::class); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadContentInfo') ->with($contentIdToLoad) ->willReturn($valueObject); $this->serviceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadVersionInfo') ->with($valueObject, $versionNoToload) ->willReturn($versionInfo); @@ -67,8 +74,8 @@ public function testApply($versionNo, int $versionNoToload, $contentId, int $con $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertTrue($this->converter->apply($request, $config)); - $this->assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); + self::assertTrue($this->converter->apply($request, $config)); + self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); } /** @@ -77,8 +84,10 @@ public function testApply($versionNo, int $versionNoToload, $contentId, int $con * @param $contentId * @param $versionNo */ - public function testApplyWithWrongAttribute($contentId, $versionNo) - { + public function testApplyWithWrongAttribute( + $contentId, + $versionNo + ) { $requestAttributes = [ VersionInfoParamConverter::PARAMETER_CONTENT_ID => $contentId, VersionInfoParamConverter::PARAMETER_VERSION_NO => $versionNo, @@ -87,8 +96,8 @@ public function testApplyWithWrongAttribute($contentId, $versionNo) $request = new Request([], [], $requestAttributes); $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - $this->assertFalse($this->converter->apply($request, $config)); - $this->assertNull($request->attributes->get(self::PARAMETER_NAME)); + self::assertFalse($this->converter->apply($request, $config)); + self::assertNull($request->attributes->get(self::PARAMETER_NAME)); } /** diff --git a/tests/bundle/Templating/Twig/FieldEditRenderingExtensionTest.php b/tests/bundle/Templating/Twig/FieldEditRenderingExtensionTest.php index 6ec44e6ff6..2ea503ae8f 100644 --- a/tests/bundle/Templating/Twig/FieldEditRenderingExtensionTest.php +++ b/tests/bundle/Templating/Twig/FieldEditRenderingExtensionTest.php @@ -14,11 +14,12 @@ use Ibexa\Core\Repository\Values\ContentType\FieldDefinition; use Ibexa\Tests\Core\MVC\Symfony\Templating\Twig\Extension\FileSystemTwigIntegrationTestCase; use Twig\Environment; +use Twig\Extension\ExtensionInterface; class FieldEditRenderingExtensionTest extends FileSystemTwigIntegrationTestCase { /** - * @return \Twig\Extension\ExtensionInterface[] + * @return ExtensionInterface[] */ public function getExtensions(): array { @@ -52,8 +53,11 @@ public function getFixturesDir(): string return __DIR__ . '/_fixtures/field_edit_rendering_functions/'; } - public function getFieldDefinitionData($typeIdentifier, $id = null, $settings = []): FieldDefinitionData - { + public function getFieldDefinitionData( + $typeIdentifier, + $id = null, + $settings = [] + ): FieldDefinitionData { return new FieldDefinitionData([ 'fieldDefinition' => new FieldDefinition([ 'id' => $id, diff --git a/tests/bundle/Templating/Twig/LimitationMock.php b/tests/bundle/Templating/Twig/LimitationMock.php index 44f14af6d1..6f4d714bea 100644 --- a/tests/bundle/Templating/Twig/LimitationMock.php +++ b/tests/bundle/Templating/Twig/LimitationMock.php @@ -15,8 +15,10 @@ class LimitationMock extends Limitation /** @var string */ private $identifier; - public function __construct($identifier, array $limitationValues) - { + public function __construct( + $identifier, + array $limitationValues + ) { parent::__construct([ 'limitationValues' => $limitationValues, ]); diff --git a/tests/bundle/Templating/Twig/LimitationValueRenderingExtensionTest.php b/tests/bundle/Templating/Twig/LimitationValueRenderingExtensionTest.php index 1f942a11e6..528d00f59d 100644 --- a/tests/bundle/Templating/Twig/LimitationValueRenderingExtensionTest.php +++ b/tests/bundle/Templating/Twig/LimitationValueRenderingExtensionTest.php @@ -41,7 +41,7 @@ private function createLimitationValueMapperRegistryMock(): MockObject { $mapperMock = $this->createMock(LimitationValueMapperInterface::class); $mapperMock - ->expects($this->atLeastOnce()) + ->expects(self::atLeastOnce()) ->method('mapLimitationValue') ->willReturnCallback(static function (Limitation $limitation) { return $limitation->limitationValues; @@ -49,31 +49,40 @@ private function createLimitationValueMapperRegistryMock(): MockObject $registryMock = $this->createMock(LimitationValueMapperRegistryInterface::class); $registryMock - ->expects($this->atLeastOnce()) + ->expects(self::atLeastOnce()) ->method('getMapper') ->willReturn($mapperMock); return $registryMock; } - public function getLimitation($identifier, array $values): LimitationMock - { + public function getLimitation( + $identifier, + array $values + ): LimitationMock { return new LimitationMock($identifier, $values); } /** - * @see \Ibexa\Tests\Core\MVC\Symfony\Templating\Twig\Extension\FileSystemTwigIntegrationTestCase::doIntegrationTest + * @see FileSystemTwigIntegrationTestCase::doIntegrationTest */ - protected function doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs, $deprecation = ''): void - { + protected function doIntegrationTest( + $file, + $message, + $condition, + $templates, + $exception, + $outputs, + $deprecation = '' + ): void { if (!$outputs) { - $this->markTestSkipped('no legacy tests to run'); + self::markTestSkipped('no legacy tests to run'); } if ($condition) { eval('$ret = ' . $condition . ';'); if (!$ret) { - $this->markTestSkipped($condition); + self::markTestSkipped($condition); } } @@ -112,9 +121,15 @@ protected function doIntegrationTest($file, $message, $condition, $templates, $e } catch (Exception $e) { if (false !== $exception) { $message = $e->getMessage(); - $this->assertSame(trim($exception), trim(sprintf('%s: %s', \get_class($e), $message))); + self::assertSame(trim($exception), trim(sprintf('%s: %s', \get_class($e), $message))); $last = substr($message, \strlen($message) - 1); - $this->assertTrue('.' === $last || '?' === $last, $message, 'Exception message must end with a dot or a question mark.'); + self::assertTrue( + '.' === $last || '?' === $last, + sprintf( + 'Exception message must end with a dot or a question mark. Got: "%s"', + $message + ) + ); return; } @@ -126,7 +141,7 @@ protected function doIntegrationTest($file, $message, $condition, $templates, $e $output = trim($template->render(eval($match[1] . ';')), "\n "); } catch (Exception $e) { if (false !== $exception) { - $this->assertSame(trim($exception), trim(sprintf('%s: %s', \get_class($e), $e->getMessage()))); + self::assertSame(trim($exception), trim(sprintf('%s: %s', \get_class($e), $e->getMessage()))); return; } @@ -139,7 +154,7 @@ protected function doIntegrationTest($file, $message, $condition, $templates, $e if (false !== $exception) { list($class) = explode(':', $exception); $constraintClass = class_exists('PHPUnit\Framework\Constraint\Exception') ? 'PHPUnit\Framework\Constraint\Exception' : 'PHPUnit_Framework_Constraint_Exception'; - $this->assertThat(null, new $constraintClass($class)); + self::assertThat(null, new $constraintClass($class)); } $expected = trim($match[3], "\n "); @@ -152,7 +167,7 @@ protected function doIntegrationTest($file, $message, $condition, $templates, $e echo $twig->compile($twig->parse($twig->tokenize($twig->getLoader()->getSourceContext($name)))); } } - $this->assertEquals($expected, $output, $message . ' (in ' . $file . ')'); + self::assertEquals($expected, $output, $message . ' (in ' . $file . ')'); } } diff --git a/tests/bundle/Templating/Twig/LocationExtensionTest.php b/tests/bundle/Templating/Twig/LocationExtensionTest.php index c1baee526f..b50cf48210 100644 --- a/tests/bundle/Templating/Twig/LocationExtensionTest.php +++ b/tests/bundle/Templating/Twig/LocationExtensionTest.php @@ -10,6 +10,7 @@ use Ibexa\Bundle\AdminUi\Templating\Twig\LocationExtension; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use PHPUnit\Framework\MockObject\MockObject; use Twig\Test\IntegrationTestCase; final class LocationExtensionTest extends IntegrationTestCase @@ -27,7 +28,7 @@ protected function getFixturesDir(): string } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location[] + * @return Location[] */ public function getLocationWithAllPossibleSortFields(): array { @@ -38,7 +39,7 @@ public function getLocationWithAllPossibleSortFields(): array } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location&\PHPUnit\Framework\MockObject\MockObject + * @return Location&MockObject */ public function createLocationWithSortField(int $field): Location { @@ -49,7 +50,7 @@ public function createLocationWithSortField(int $field): Location } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location&\PHPUnit\Framework\MockObject\MockObject + * @return Location&MockObject */ public function createLocationWithSortOrder(int $order): Location { diff --git a/tests/integration/DependencyInjection/Configuration/IgnoredConfigParser.php b/tests/integration/DependencyInjection/Configuration/IgnoredConfigParser.php index 3dcb6fc586..55e9b43864 100644 --- a/tests/integration/DependencyInjection/Configuration/IgnoredConfigParser.php +++ b/tests/integration/DependencyInjection/Configuration/IgnoredConfigParser.php @@ -35,7 +35,9 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder): void /** * @param array $scopeSettings */ - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void - { - } + public function mapConfig( + array &$scopeSettings, + $currentScope, + ContextualizerInterface $contextualizer + ): void {} } diff --git a/tests/integration/REST/BaseAdminUiRestWebTestCase.php b/tests/integration/REST/BaseAdminUiRestWebTestCase.php index 9fe370236a..bf3a8308aa 100644 --- a/tests/integration/REST/BaseAdminUiRestWebTestCase.php +++ b/tests/integration/REST/BaseAdminUiRestWebTestCase.php @@ -8,11 +8,15 @@ namespace Ibexa\Tests\Integration\AdminUi\REST; +use Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\RoleLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Role; use Ibexa\Contracts\Core\Repository\Values\User\User; use Ibexa\Contracts\Test\Rest\BaseRestWebTestCase; use Ibexa\Core\MVC\Symfony\Security\UserWrapped; +use Ibexa\Tests\Integration\AdminUi\AdminUiIbexaTestKernel; use Symfony\Component\Security\Core\User\UserInterface; /** @@ -20,12 +24,14 @@ * * @phpstan-type TPoliciesData array * - * @see \Ibexa\Tests\Integration\AdminUi\AdminUiIbexaTestKernel + * @see AdminUiIbexaTestKernel */ abstract class BaseAdminUiRestWebTestCase extends BaseRestWebTestCase { - protected function getSchemaFileBasePath(string $resourceType, string $format): string - { + protected function getSchemaFileBasePath( + string $resourceType, + string $format + ): string { return dirname(__DIR__) . '/Resources/REST/Schemas/' . $resourceType; } @@ -37,9 +43,9 @@ protected static function getSnapshotDirectory(): ?string /** * @phpstan-param TPoliciesData $policiesData * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws ForbiddenException + * @throws NotFoundException + * @throws UnauthorizedException */ protected function createUserWithPolicies( string $login, @@ -69,12 +75,14 @@ protected function createUserWithPolicies( /** * @phpstan-param TPoliciesData $policiesData * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws ForbiddenException + * @throws NotFoundException + * @throws UnauthorizedException */ - protected function createRoleWithPolicies(string $roleName, array $policiesData): Role - { + protected function createRoleWithPolicies( + string $roleName, + array $policiesData + ): Role { $roleService = $this->getIbexaTestCore()->getRoleService(); $roleCreateStruct = $roleService->newRoleCreateStruct($roleName); diff --git a/tests/integration/REST/GetContentTreeChildrenTest.php b/tests/integration/REST/GetContentTreeChildrenTest.php index b43282a9bf..e60756c771 100644 --- a/tests/integration/REST/GetContentTreeChildrenTest.php +++ b/tests/integration/REST/GetContentTreeChildrenTest.php @@ -49,7 +49,7 @@ protected static function getEndpointsToTest(): iterable } /** - * @return iterable<\Ibexa\Contracts\Test\Rest\Request\Value\EndpointRequestDefinition> + * @return iterable */ private static function generateRequestDefinitionsWithAllFormats( EndpointRequestDefinition $endpointRequestDefinition, diff --git a/tests/integration/REST/GetContentTreeExtendedInfoTest.php b/tests/integration/REST/GetContentTreeExtendedInfoTest.php index 847e5465b4..5784a06f54 100644 --- a/tests/integration/REST/GetContentTreeExtendedInfoTest.php +++ b/tests/integration/REST/GetContentTreeExtendedInfoTest.php @@ -8,6 +8,9 @@ namespace Ibexa\Tests\Integration\AdminUi\REST; +use Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ContentTypeLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\LanguageLimitation; use Ibexa\Contracts\Test\Rest\Request\Value\EndpointRequestDefinition; @@ -18,9 +21,9 @@ final class GetContentTreeExtendedInfoTest extends BaseAdminUiRestWebTestCase { /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ForbiddenException + * @throws NotFoundException + * @throws UnauthorizedException + * @throws ForbiddenException */ protected function setUp(): void { diff --git a/tests/integration/REST/PostPostLoadSubtreeTest.php b/tests/integration/REST/PostPostLoadSubtreeTest.php index 8dffa98a28..7e43f06c13 100644 --- a/tests/integration/REST/PostPostLoadSubtreeTest.php +++ b/tests/integration/REST/PostPostLoadSubtreeTest.php @@ -9,6 +9,7 @@ namespace Ibexa\Tests\Integration\AdminUi\REST; use Ibexa\Contracts\Core\Repository\BookmarkService; +use Ibexa\Contracts\Core\Repository\Exceptions\Exception; use Ibexa\Contracts\Test\Rest\Input\PayloadLoader; use Ibexa\Contracts\Test\Rest\Request\Value\EndpointRequestDefinition; @@ -20,7 +21,7 @@ final class PostPostLoadSubtreeTest extends BaseAdminUiRestWebTestCase private const INPUT_MEDIA_TYPE = 'ContentTreeLoadSubtreeRequest'; /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\Exception + * @throws Exception */ protected function setUp(): void { diff --git a/tests/integration/bootstrap.php b/tests/integration/bootstrap.php index fa6083c9d0..efa149be57 100644 --- a/tests/integration/bootstrap.php +++ b/tests/integration/bootstrap.php @@ -9,6 +9,7 @@ use Ibexa\Contracts\Core\Test\Persistence\Fixture\FixtureImporter; use Ibexa\Tests\Core\Repository\LegacySchemaImporter; use Ibexa\Tests\Integration\AdminUi\AdminUiIbexaTestKernel; +use Psr\Container\ContainerInterface; use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\Console\Input\ArrayInput; @@ -38,7 +39,7 @@ '--quiet' => true, ])); -/** @var \Psr\Container\ContainerInterface $testContainer */ +/** @var ContainerInterface $testContainer */ $testContainer = $kernel->getContainer()->get('test.service_container'); $schemaImporter = $testContainer->get(LegacySchemaImporter::class); diff --git a/tests/lib/Autosave/AutosaveServiceTest.php b/tests/lib/Autosave/AutosaveServiceTest.php index 6c7a997901..fffaec00be 100644 --- a/tests/lib/Autosave/AutosaveServiceTest.php +++ b/tests/lib/Autosave/AutosaveServiceTest.php @@ -13,11 +13,12 @@ use Ibexa\AdminUi\UserSetting\AutosaveInterval; use Ibexa\User\UserSetting\UserSetting; use Ibexa\User\UserSetting\UserSettingService; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; final class AutosaveServiceTest extends TestCase { - /** @var \Ibexa\User\UserSetting\UserSettingService&\PHPUnit\Framework\MockObject\MockObject */ + /** @var UserSettingService&MockObject */ private UserSettingService $userSettingService; private AutosaveService $autosaveService; diff --git a/tests/lib/Config/AdminUiForms/ContentTypeFieldTypesResolverTest.php b/tests/lib/Config/AdminUiForms/ContentTypeFieldTypesResolverTest.php index 177510df80..a3c23245d0 100644 --- a/tests/lib/Config/AdminUiForms/ContentTypeFieldTypesResolverTest.php +++ b/tests/lib/Config/AdminUiForms/ContentTypeFieldTypesResolverTest.php @@ -11,6 +11,7 @@ use Ibexa\AdminUi\Config\AdminUiForms\ContentTypeFieldTypesResolver; use Ibexa\AdminUi\Config\AdminUiForms\ContentTypeFieldTypesResolverInterface; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -22,7 +23,7 @@ final class ContentTypeFieldTypesResolverTest extends TestCase private ContentTypeFieldTypesResolverInterface $contentTypeFieldTypesResolver; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ConfigResolverInterface|MockObject */ private ConfigResolverInterface $configResolver; protected function setUp(): void @@ -39,8 +40,10 @@ protected function setUp(): void * 'meta'?: bool, * }> $expectedFieldTypes */ - public function testGetFieldTypes(bool $hasParameter, array $expectedFieldTypes): void - { + public function testGetFieldTypes( + bool $hasParameter, + array $expectedFieldTypes + ): void { $this->mockConfigResolverHasParameter($hasParameter); $this->mockConfigResolverGetParameter($hasParameter, $expectedFieldTypes); @@ -222,8 +225,10 @@ private function mockConfigResolverHasParameter(bool $hasParameter): void ->willReturn($hasParameter); } - private function mockConfigResolverGetParameter(bool $hasParameter, array $configuredFieldTypes): void - { + private function mockConfigResolverGetParameter( + bool $hasParameter, + array $configuredFieldTypes + ): void { if ($hasParameter) { $this->configResolver ->expects(self::once()) diff --git a/tests/lib/EventListener/ContentDownloadRouteReferenceListenerTest.php b/tests/lib/EventListener/ContentDownloadRouteReferenceListenerTest.php index 3023e7e488..4395fe28fb 100644 --- a/tests/lib/EventListener/ContentDownloadRouteReferenceListenerTest.php +++ b/tests/lib/EventListener/ContentDownloadRouteReferenceListenerTest.php @@ -45,7 +45,7 @@ public function testOnRouteReferenceGenerationSkipNonSupportedRoutes(): void $listener = new ContentDownloadRouteReferenceListener(self::EXAMPLE_SITEACCESS_GROUPS); $listener->onRouteReferenceGeneration($event); - $this->assertEquals($expectedRouteReference, $event->getRouteReference()); + self::assertEquals($expectedRouteReference, $event->getRouteReference()); } public function testOnRouteReferenceGenerationSkipNonAdminSiteAccesses(): void @@ -67,7 +67,7 @@ public function testOnRouteReferenceGenerationSkipNonAdminSiteAccesses(): void $listener = new ContentDownloadRouteReferenceListener(self::EXAMPLE_SITEACCESS_GROUPS); $listener->onRouteReferenceGeneration($event); - $this->assertEquals($expectedRouteReference, $event->getRouteReference()); + self::assertEquals($expectedRouteReference, $event->getRouteReference()); } public function testOnRouteReferenceGenerationForcesAdminSiteAccess(): void @@ -90,7 +90,7 @@ public function testOnRouteReferenceGenerationForcesAdminSiteAccess(): void $listener = new ContentDownloadRouteReferenceListener(self::EXAMPLE_SITEACCESS_GROUPS); $listener->onRouteReferenceGeneration($event); - $this->assertEquals( + self::assertEquals( new RouteReference( ContentDownloadRouteReferenceListener::CONTENT_DOWNLOAD_ROUTE_NAME, [ diff --git a/tests/lib/EventListener/ContentProxyCreateDraftListenerTest.php b/tests/lib/EventListener/ContentProxyCreateDraftListenerTest.php index f660ef30eb..cf3fc66c34 100644 --- a/tests/lib/EventListener/ContentProxyCreateDraftListenerTest.php +++ b/tests/lib/EventListener/ContentProxyCreateDraftListenerTest.php @@ -84,7 +84,7 @@ public function testCreateContentOnTheFlyAutosaveEnabled(): void $content = $this->createMock(Content::class); $content ->method('__get') - ->will($this->returnCallback(static function ($argument) use ($contentInfo) { + ->will(self::returnCallback(static function ($argument) use ($contentInfo) { if ($argument === 'contentInfo') { return $contentInfo; } @@ -129,7 +129,7 @@ public function testCreateContentOnTheFlyAutosaveEnabled(): void $eventDispatcher->dispatch($createEvent); - $this->assertEquals(new RedirectResponse('redirect_on_the_fly_test_url'), $createEvent->getResponse()); + self::assertEquals(new RedirectResponse('redirect_on_the_fly_test_url'), $createEvent->getResponse()); self::assertInstanceOf( Content::class, $createEvent->getOptions()->get('contentDraft') @@ -206,7 +206,7 @@ public function testTranslateContentAutosaveEnabled(): void $eventDispatcher->dispatch($translateEvent, ContentProxyTranslateEvent::class); - $this->assertEquals(new RedirectResponse('redirect_test_url'), $translateEvent->getResponse()); + self::assertEquals(new RedirectResponse('redirect_test_url'), $translateEvent->getResponse()); } public function testAutosaveDisabled(): void @@ -216,17 +216,17 @@ public function testAutosaveDisabled(): void $contentService = $this->createMock(ContentService::class); $contentService - ->expects($this->never()) + ->expects(self::never()) ->method('createContent'); $createEvent = $this->createMock(ContentProxyCreateEvent::class); $createEvent - ->expects($this->never()) + ->expects(self::never()) ->method('setResponse'); $createOnTheFlyEvent = $this->createMock(ContentProxyCreateEvent::class); $createOnTheFlyEvent - ->expects($this->never()) + ->expects(self::never()) ->method('setResponse'); $createOnTheFlyEvent @@ -237,7 +237,7 @@ public function testAutosaveDisabled(): void $translateEvent = $this->createMock(ContentProxyTranslateEvent::class); $translateEvent - ->expects($this->never()) + ->expects(self::never()) ->method('setResponse'); $eventDispatcher = new EventDispatcher(); @@ -262,8 +262,10 @@ private function getContentType(array $fieldDefs = []): ContentType ]); } - private function getFieldDefinition(string $identifier = 'identifier', bool $isTranslatable = false): FieldDefinition - { + private function getFieldDefinition( + string $identifier = 'identifier', + bool $isTranslatable = false + ): FieldDefinition { return new FieldDefinition([ 'identifier' => $identifier, 'defaultValue' => $this->createMock(Value::class), diff --git a/tests/lib/EventListener/ContentTypeSuggestionsListenerTest.php b/tests/lib/EventListener/ContentTypeSuggestionsListenerTest.php index 8d7414cb73..71f1110a94 100644 --- a/tests/lib/EventListener/ContentTypeSuggestionsListenerTest.php +++ b/tests/lib/EventListener/ContentTypeSuggestionsListenerTest.php @@ -17,16 +17,17 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Search\AggregationResultCollection; use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Contracts\Translation\TranslatorInterface; final class ContentTypeSuggestionsListenerTest extends TestCase { - /** @var \Ibexa\Contracts\Core\Repository\SearchService&\PHPUnit\Framework\MockObject\MockObject */ + /** @var SearchService&MockObject */ private SearchService $searchService; - /** @var \Symfony\Contracts\Translation\TranslatorInterface&\PHPUnit\Framework\MockObject\MockObject */ + /** @var TranslatorInterface&MockObject */ private TranslatorInterface $translator; protected function setUp(): void @@ -128,7 +129,7 @@ public function testSuggestions(): void $eventDispatcher->addSubscriber($this->createDefaultListener()); $eventDispatcher->dispatch($event, ContentCreateContentTypeChoiceLoaderEvent::RESOLVE_CONTENT_TYPES); - $this->assertEquals([ + self::assertEquals([ 'content_type_suggestions' => [$article, $folder], 'content_type_group_content' => [$article, $folder], 'content_type_group_media' => [$image], @@ -177,6 +178,6 @@ private function createDefaultListener(): ContentTypeSuggestionsListener private function expectSuggestionsAreNotComputed(): void { - $this->searchService->expects($this->never())->method('findLocations'); + $this->searchService->expects(self::never())->method('findLocations'); } } diff --git a/tests/lib/EventListener/InContextTranslationListenerTest.php b/tests/lib/EventListener/InContextTranslationListenerTest.php index 44daa956c6..70f08ef73c 100644 --- a/tests/lib/EventListener/InContextTranslationListenerTest.php +++ b/tests/lib/EventListener/InContextTranslationListenerTest.php @@ -22,6 +22,7 @@ use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Translation\Translator; +use Symfony\Contracts\Translation\TranslatorInterface; final class InContextTranslationListenerTest extends TestCase { @@ -29,16 +30,16 @@ final class InContextTranslationListenerTest extends TestCase private const NON_ADMIN_SITEACCESS = 'non_admin_siteaccess'; - /** @var \Symfony\Component\HttpFoundation\Request */ + /** @var Request */ private $request; - /** @var \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\HttpKernel\HttpKernelInterface */ + /** @var MockObject|HttpKernelInterface */ private $httpKernel; - /** @var \Ibexa\User\UserSetting\UserSettingService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var UserSettingService|MockObject */ private $userSettingService; - /** @var \Symfony\Contracts\Translation\TranslatorInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var TranslatorInterface|MockObject */ private $translator; protected function setUp(): void @@ -104,12 +105,12 @@ public function testLocaleIsNotSetOnSubRequest(): void public function testLocaleIsSet(): void { $this->request - ->expects($this->once()) + ->expects(self::once()) ->method('setLocale') ->with('ach-UG'); $this->translator - ->expects($this->once()) + ->expects(self::once()) ->method('setLocale') ->with('ach-UG'); @@ -138,7 +139,7 @@ public function testLocaleIsSet(): void public function testLocaleIsNotSet(): void { $this->request - ->expects($this->never()) + ->expects(self::never()) ->method('setLocale'); $event = new RequestEvent( @@ -171,7 +172,7 @@ public function testSubscribedEvents(): void $this->translator ); - $this->assertSame( + self::assertSame( [KernelEvents::REQUEST => [['setInContextTranslation', 5]]], $listener::getSubscribedEvents() ); @@ -200,7 +201,7 @@ public function testNonSiteaccessInRequest(): void } /** - * @return \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\HttpFoundation\Request + * @return MockObject|Request */ private function requestWithSetLocaleExpectsNever(): MockObject { @@ -209,7 +210,7 @@ private function requestWithSetLocaleExpectsNever(): MockObject ->setMethods(['setLocale']) ->getMock(); $request - ->expects($this->never()) + ->expects(self::never()) ->method('setLocale'); return $request; diff --git a/tests/lib/EventListener/RequestListenerTest.php b/tests/lib/EventListener/RequestListenerTest.php index 55242eaea5..d7c0c25bc3 100644 --- a/tests/lib/EventListener/RequestListenerTest.php +++ b/tests/lib/EventListener/RequestListenerTest.php @@ -9,6 +9,7 @@ use Ibexa\AdminUi\EventListener\RequestListener; use Ibexa\Core\MVC\Symfony\SiteAccess; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Event\RequestEvent; @@ -18,16 +19,16 @@ class RequestListenerTest extends TestCase { - /** @var \Ibexa\AdminUi\EventListener\RequestListener */ + /** @var RequestListener */ private $requestListener; - /** @var \Symfony\Component\HttpFoundation\Request */ + /** @var Request */ private $request; - /** @var \Symfony\Component\HttpKernel\Event\RequestEvent */ + /** @var RequestEvent */ private $event; - /** @var \Symfony\Component\HttpKernel\HttpKernelInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var HttpKernelInterface|MockObject */ private $httpKernel; protected function setUp(): void @@ -69,21 +70,21 @@ public function testOnKernelRequestAllowAccessWithSubRequest() HttpKernelInterface::SUB_REQUEST ); - $this->assertNull($this->requestListener->onKernelRequest($this->event)); + self::assertNull($this->requestListener->onKernelRequest($this->event)); } public function testOnKernelRequestAllowAccessWithoutSiteAccess() { $this->request->attributes->set('siteaccess', 'not_siteaccess_object'); - $this->assertNull($this->requestListener->onKernelRequest($this->event)); + self::assertNull($this->requestListener->onKernelRequest($this->event)); } public function testOnKernelRequestAllowAccessWithoutGroupWhitelist() { $this->request->attributes->set('siteaccess_group_whitelist', null); - $this->assertNull($this->requestListener->onKernelRequest($this->event)); + self::assertNull($this->requestListener->onKernelRequest($this->event)); } public function testOnKernelRequestAllowAccessWhenGroupMatch() @@ -91,12 +92,12 @@ public function testOnKernelRequestAllowAccessWhenGroupMatch() $this->request->attributes->set('siteaccess', new SiteAccess('some_name')); $this->request->attributes->set('siteaccess_group_whitelist', ['group_1', 'group_2']); - $this->assertNull($this->requestListener->onKernelRequest($this->event)); + self::assertNull($this->requestListener->onKernelRequest($this->event)); } public function testSubscribedEvents() { - $this->assertSame([KernelEvents::REQUEST => ['onKernelRequest', 13]], $this->requestListener::getSubscribedEvents()); + self::assertSame([KernelEvents::REQUEST => ['onKernelRequest', 13]], $this->requestListener::getSubscribedEvents()); } } diff --git a/tests/lib/EventListener/RequestLocaleListenerTest.php b/tests/lib/EventListener/RequestLocaleListenerTest.php index da870b3f19..6e17ae19ba 100644 --- a/tests/lib/EventListener/RequestLocaleListenerTest.php +++ b/tests/lib/EventListener/RequestLocaleListenerTest.php @@ -21,6 +21,7 @@ use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Translation\Translator; +use Symfony\Contracts\Translation\TranslatorInterface; class RequestLocaleListenerTest extends TestCase { @@ -28,19 +29,19 @@ class RequestLocaleListenerTest extends TestCase private const NON_ADMIN_SITEACCESS = 'non_admin_siteaccess'; - /** @var \Symfony\Component\HttpFoundation\Request */ + /** @var Request */ private $request; - /** @var \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\HttpKernel\HttpKernelInterface */ + /** @var MockObject|HttpKernelInterface */ private $httpKernel; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ + /** @var TranslatorInterface */ private $translator; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ + /** @var UserLanguagePreferenceProviderInterface */ private $userLanguagePreferenceProvider; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ConfigResolverInterface|MockObject */ private $configResolver; protected function setUp(): void @@ -121,12 +122,12 @@ public function testLocaleIsNotSetOnSubRequest(): void public function testLocaleIsSet(): void { $this->translator - ->expects($this->once()) + ->expects(self::once()) ->method('setLocale') ->with('en_US'); $this->request - ->expects($this->once()) + ->expects(self::once()) ->method('setLocale') ->with('en_US'); @@ -154,12 +155,12 @@ public function testLocaleIsSet(): void public function testLocaleIsSetWithoutAvailableTranslation(): void { $this->translator - ->expects($this->once()) + ->expects(self::once()) ->method('setLocale') ->with('en_US'); $this->request - ->expects($this->once()) + ->expects(self::once()) ->method('setLocale') ->with('en_US'); @@ -194,7 +195,7 @@ public function testSubscribedEvents(): void $this->configResolver ); - $this->assertSame([KernelEvents::REQUEST => ['onKernelRequest', 6]], $requestLocaleListener::getSubscribedEvents()); + self::assertSame([KernelEvents::REQUEST => ['onKernelRequest', 6]], $requestLocaleListener::getSubscribedEvents()); } public function testNonSiteaccessInRequest(): void @@ -222,7 +223,7 @@ public function testNonSiteaccessInRequest(): void } /** - * @return \PHPUnit\Framework\MockObject\MockObject|\Symfony\Contracts\Translation\TranslatorInterface + * @return MockObject|TranslatorInterface * * @throws \ReflectionException */ @@ -230,14 +231,14 @@ private function translatorWithSetLocaleExpectsNever(): MockObject { $translator = $this->createMock(Translator::class); $translator - ->expects($this->never()) + ->expects(self::never()) ->method('setLocale'); return $translator; } /** - * @return \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\HttpFoundation\Request + * @return MockObject|Request */ private function requestWithSetLocaleExpectsNever(): MockObject { @@ -246,7 +247,7 @@ private function requestWithSetLocaleExpectsNever(): MockObject ->setMethods(['getSession', 'hasSession', 'setLocale']) ->getMock(); $request - ->expects($this->never()) + ->expects(self::never()) ->method('setLocale'); return $request; diff --git a/tests/lib/EventListener/SetViewParametersListenerTest.php b/tests/lib/EventListener/SetViewParametersListenerTest.php index be26d52c27..95504e72f0 100644 --- a/tests/lib/EventListener/SetViewParametersListenerTest.php +++ b/tests/lib/EventListener/SetViewParametersListenerTest.php @@ -13,11 +13,16 @@ use Ibexa\ContentForms\User\View\UserUpdateView; use Ibexa\Contracts\ContentForms\Content\Form\Provider\GroupedContentFormFieldsProviderInterface; use Ibexa\Contracts\ContentForms\Data\Content\FieldData; +use Ibexa\Contracts\Core\Repository\Exceptions\Exception; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\UserService; -use Ibexa\Contracts\Core\Repository\Values\Content as API; +use Ibexa\Contracts\Core\Repository\Values\Content\Content; +use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Field; +use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; +use Ibexa\Contracts\Core\Repository\Values\User\User; use Ibexa\Contracts\Core\Repository\Values\User\User as APIUser; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\MVC\Symfony\Event\PreContentViewEvent; @@ -36,25 +41,25 @@ final class SetViewParametersListenerTest extends TestCase private const EXAMPLE_LOCATION_B_ID = 2; private const EXAMPLE_OWNER_ID = 14; - /** @var \Ibexa\Core\MVC\Symfony\Event\PreContentViewEvent */ + /** @var PreContentViewEvent */ private $event; - /** @var \Ibexa\AdminUi\EventListener\SetViewParametersListener */ + /** @var SetViewParametersListener */ private $viewParametersListener; - /** @var \Ibexa\Contracts\Core\Repository\LocationService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var LocationService|MockObject */ private $locationService; - /** @var \Ibexa\Contracts\Core\Repository\UserService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var UserService|MockObject */ private $userService; - /** @var \Ibexa\Contracts\Core\Repository\Repository|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Repository|MockObject */ private $repository; - /** @var \PHPUnit\Framework\MockObject\MockObject */ + /** @var MockObject */ private ConfigResolverInterface $configResolver; - /** @var \Ibexa\Contracts\ContentForms\Content\Form\Provider\GroupedContentFormFieldsProviderInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var GroupedContentFormFieldsProviderInterface|MockObject */ private $groupedContentFormFieldsProvider; public function setUp(): void @@ -128,15 +133,15 @@ public function testSetViewTemplateParameters(): void $this->viewParametersListener->setContentEditViewTemplateParameters(new PreContentViewEvent($contentView)); - $this->assertSame($locations, $contentView->getParameter('parent_locations')); + self::assertSame($locations, $contentView->getParameter('parent_locations')); } /** * @param int|null $parentLocationId * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location + * @return Location */ - private function generateLocation(?int $parentLocationId = null): API\Location + private function generateLocation(?int $parentLocationId = null): Location { return new Core\Location(['id' => 3, 'parentLocationId' => $parentLocationId]); } @@ -175,10 +180,13 @@ public function testSetViewTemplateParametersWithMainLocationId(): void $this->viewParametersListener->setContentEditViewTemplateParameters(new PreContentViewEvent($contentView)); - $this->assertSame([], $contentView->getParameter('parent_locations')); - $this->assertSame(reset($parentLocations), $contentView->getParameter('parent_location')); + self::assertSame([], $contentView->getParameter('parent_locations')); + self::assertSame(reset($parentLocations), $contentView->getParameter('parent_location')); } + /** + * @throws Exception + */ public function testSetViewTemplateParametersWithoutContentEditViewInstance(): void { $contentView = $this->createMock(View::class); @@ -186,11 +194,7 @@ public function testSetViewTemplateParametersWithoutContentEditViewInstance(): v $this->locationService->expects(self::never()) ->method('loadParentLocationsForDraftContent'); - $this->assertNull( - $this->viewParametersListener->setContentEditViewTemplateParameters( - new PreContentViewEvent($contentView) - ) - ); + $this->viewParametersListener->setContentEditViewTemplateParameters(new PreContentViewEvent($contentView)); } public function testSetUserUpdateViewTemplateParametersWithoutUserUpdateViewInstance(): void @@ -200,10 +204,8 @@ public function testSetUserUpdateViewTemplateParametersWithoutUserUpdateViewInst $this->locationService->expects(self::never()) ->method('loadParentLocationsForDraftContent'); - $this->assertNull( - $this->viewParametersListener->setUserUpdateViewTemplateParameters( - new PreContentViewEvent($view) - ) + $this->viewParametersListener->setUserUpdateViewTemplateParameters( + new PreContentViewEvent($view) ); } @@ -225,7 +227,7 @@ public function testSetUserUpdateViewTemplateParameters(): void $this->viewParametersListener->setUserUpdateViewTemplateParameters(new PreContentViewEvent($userUpdateView)); - $this->assertSame($user, $userUpdateView->getParameter('creator')); + self::assertSame($user, $userUpdateView->getParameter('creator')); } public function testSetContentFieldsParameters(): void @@ -288,8 +290,8 @@ public function testSetContentFieldsParameters(): void $this->viewParametersListener->setContentFieldsParameters(new PreContentViewEvent($contentEditView)); - $this->assertSame($ignoredContentFields, $contentEditView->getParameter('ignored_content_fields')); - $this->assertSame($groupedFields, $contentEditView->getParameter('grouped_fields')); + self::assertSame($ignoredContentFields, $contentEditView->getParameter('ignored_content_fields')); + self::assertSame($groupedFields, $contentEditView->getParameter('grouped_fields')); } public function testSubscribedEvents(): void @@ -310,10 +312,10 @@ public function testSubscribedEvents(): void $actualSubscribedEvents = $this->viewParametersListener::getSubscribedEvents(); - $this->assertCount(count($actualSubscribedEvents), $expectedSubscribedEvents); + self::assertCount(count($actualSubscribedEvents), $expectedSubscribedEvents); foreach ($expectedSubscribedEvents as $key => $value) { - $this->assertArrayHasKey($key, $actualSubscribedEvents); - $this->assertSame($value, $actualSubscribedEvents[$key]); + self::assertArrayHasKey($key, $actualSubscribedEvents); + self::assertSame($value, $actualSubscribedEvents[$key]); } } @@ -321,11 +323,13 @@ public function testSubscribedEvents(): void * @param int $mainLocationId * @param bool $published * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo + * @return ContentInfo */ - private function generateContentInfo(?int $mainLocationId = null, bool $published = false): API\ContentInfo - { - return new API\ContentInfo([ + private function generateContentInfo( + ?int $mainLocationId = null, + bool $published = false + ): ContentInfo { + return new ContentInfo([ 'mainLocationId' => $mainLocationId, 'ownerId' => self::EXAMPLE_OWNER_ID, 'published' => $published, @@ -333,21 +337,21 @@ private function generateContentInfo(?int $mainLocationId = null, bool $publishe } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo $contentInfo + * @param ContentInfo $contentInfo * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo + * @return VersionInfo */ - private function generateVersionInfo(API\ContentInfo $contentInfo): API\VersionInfo + private function generateVersionInfo(ContentInfo $contentInfo): VersionInfo { return new Core\VersionInfo(['contentInfo' => $contentInfo]); } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $versionInfo + * @param VersionInfo $versionInfo * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content + * @return Content */ - private function generateContent(API\VersionInfo $versionInfo): API\Content + private function generateContent(VersionInfo $versionInfo): Content { return new Core\Content(['versionInfo' => $versionInfo]); } @@ -355,11 +359,11 @@ private function generateContent(API\VersionInfo $versionInfo): API\Content /** * @param int $ownerId * - * @return \Ibexa\Contracts\Core\Repository\Values\User\User + * @return User */ private function generateUser(int $ownerId): APIUser { - $contentInfo = new API\ContentInfo(['ownerId' => $ownerId]); + $contentInfo = new ContentInfo(['ownerId' => $ownerId]); $versionInfo = new Core\VersionInfo(['contentInfo' => $contentInfo]); @@ -369,10 +373,13 @@ private function generateUser(int $ownerId): APIUser } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Field|\PHPUnit\Framework\MockObject\MockObject + * @return Field|MockObject */ - private function createFieldMock(string $identifier, string $type, string $fieldGroup = 'content'): MockObject - { + private function createFieldMock( + string $identifier, + string $type, + string $fieldGroup = 'content' + ): MockObject { $data = new FieldData([ 'field' => new Field([ 'fieldDefIdentifier' => $identifier, diff --git a/tests/lib/FieldType/FieldTypeFormMapperDispatcherTest.php b/tests/lib/FieldType/FieldTypeFormMapperDispatcherTest.php index 9915ce276f..04e692b436 100644 --- a/tests/lib/FieldType/FieldTypeFormMapperDispatcherTest.php +++ b/tests/lib/FieldType/FieldTypeFormMapperDispatcherTest.php @@ -9,23 +9,25 @@ use Ibexa\AdminUi\FieldType\FieldDefinitionFormMapperInterface; use Ibexa\AdminUi\FieldType\FieldTypeDefinitionFormMapperDispatcher; +use Ibexa\AdminUi\FieldType\FieldTypeDefinitionFormMapperDispatcherInterface; use Ibexa\AdminUi\Form\Data\ContentTypeData; use Ibexa\AdminUi\Form\Data\FieldDefinitionData; use Ibexa\Core\Repository\Values\ContentType\ContentType; use Ibexa\Core\Repository\Values\ContentType\ContentTypeDraft; use Ibexa\Core\Repository\Values\ContentType\FieldDefinition; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\FormInterface; class FieldTypeFormMapperDispatcherTest extends TestCase { /** - * @var \Ibexa\AdminUi\FieldType\FieldTypeDefinitionFormMapperDispatcherInterface + * @var FieldTypeDefinitionFormMapperDispatcherInterface */ private $dispatcher; /** - * @var \Ibexa\AdminUi\FieldType\FieldDefinitionFormMapperInterface|\PHPUnit\Framework\MockObject\MockObject + * @var FieldDefinitionFormMapperInterface|MockObject */ private $fieldDefinitionMapperMock; @@ -53,7 +55,7 @@ public function testMapFieldDefinition(): void $formMock = $this->createMock(FormInterface::class); $this->fieldDefinitionMapperMock - ->expects($this->once()) + ->expects(self::once()) ->method('mapFieldDefinitionForm') ->with($formMock, $data); diff --git a/tests/lib/Form/Data/Content/CustomUrl/CustomUrlAddDataTest.php b/tests/lib/Form/Data/Content/CustomUrl/CustomUrlAddDataTest.php index 80bb44fd9a..e348ca870a 100644 --- a/tests/lib/Form/Data/Content/CustomUrl/CustomUrlAddDataTest.php +++ b/tests/lib/Form/Data/Content/CustomUrl/CustomUrlAddDataTest.php @@ -24,10 +24,10 @@ public function testConstruct(): void $data = new CustomUrlAddData($location, $path, $language, false, true, $siteAccess); - $this->assertSame($location, $data->getLocation()); - $this->assertSame($language, $data->getLanguage()); - $this->assertSame($path, $data->getPath()); - $this->assertSame($siteAccess, $data->getSiteAccess()); + self::assertSame($location, $data->getLocation()); + self::assertSame($language, $data->getLanguage()); + self::assertSame($path, $data->getPath()); + self::assertSame($siteAccess, $data->getSiteAccess()); } } diff --git a/tests/lib/Form/Data/ContentTranslationDataTest.php b/tests/lib/Form/Data/ContentTranslationDataTest.php index 1f335bb4f6..4f01f24df5 100644 --- a/tests/lib/Form/Data/ContentTranslationDataTest.php +++ b/tests/lib/Form/Data/ContentTranslationDataTest.php @@ -14,7 +14,7 @@ class ContentTranslationDataTest extends TestCase { - /** @var \Ibexa\AdminUi\Form\Data\ContentTranslationData */ + /** @var ContentTranslationData */ private $contentTranslationData; protected function setUp(): void @@ -24,31 +24,31 @@ protected function setUp(): void public function testAddFieldData() { - $this->assertNull($this->contentTranslationData->fieldsData); + self::assertNull($this->contentTranslationData->fieldsData); $this->contentTranslationData->addFieldData(new FieldData([ 'fieldDefinition' => $this->getFieldDefinition(), ])); - $this->assertCount(1, $this->contentTranslationData->fieldsData); + self::assertCount(1, $this->contentTranslationData->fieldsData); // Add another field with same identifier $this->contentTranslationData->addFieldData(new FieldData([ 'fieldDefinition' => $this->getFieldDefinition(), ])); - $this->assertCount(1, $this->contentTranslationData->fieldsData); + self::assertCount(1, $this->contentTranslationData->fieldsData); // Add field with another identifier $this->contentTranslationData->addFieldData(new FieldData([ 'fieldDefinition' => $this->getFieldDefinition('another_identifier'), ])); - $this->assertCount(2, $this->contentTranslationData->fieldsData); + self::assertCount(2, $this->contentTranslationData->fieldsData); } /** * @param string $identifier * - * @return \Ibexa\Core\Repository\Values\ContentType\FieldDefinition + * @return FieldDefinition */ private function getFieldDefinition(string $identifier = 'identifier'): FieldDefinition { diff --git a/tests/lib/Form/Data/FormMapper/ContentTranslationMapperTest.php b/tests/lib/Form/Data/FormMapper/ContentTranslationMapperTest.php index 6f03c3884d..08c48fb0cc 100644 --- a/tests/lib/Form/Data/FormMapper/ContentTranslationMapperTest.php +++ b/tests/lib/Form/Data/FormMapper/ContentTranslationMapperTest.php @@ -29,7 +29,7 @@ final class ContentTranslationMapperTest extends TestCase { public const LANGUAGE_CODE = 'cyb-CY'; - /** @var \Ibexa\AdminUi\Form\Data\FormMapper\ContentTranslationMapper */ + /** @var ContentTranslationMapper */ private $mapper; protected function setUp(): void @@ -40,11 +40,14 @@ protected function setUp(): void /** * @dataProvider paramsProvider */ - public function testMapToFormData(Content $content, array $params, ContentTranslationData $expectedData) - { + public function testMapToFormData( + Content $content, + array $params, + ContentTranslationData $expectedData + ) { $actualData = $this->mapper->mapToFormData($content, $params); - $this->assertEquals($expectedData, $actualData); + self::assertEquals($expectedData, $actualData); } public function paramsProvider(): array @@ -147,8 +150,11 @@ public function paramsProvider(): array /** * @dataProvider wrongParamsProvider */ - public function testMapToFormDataWithoutRequiredParameter($content, array $params, array $exception) - { + public function testMapToFormDataWithoutRequiredParameter( + $content, + array $params, + array $exception + ) { $this->expectException($exception['class']); $this->expectExceptionMessage($exception['message']); @@ -229,8 +235,11 @@ private function getCompleteContent(array $fields = []): Content ]); } - private function getField($fieldDefIdentifier = 'identifier', $languageCode = self::LANGUAGE_CODE, $value = 'string_value'): Field - { + private function getField( + $fieldDefIdentifier = 'identifier', + $languageCode = self::LANGUAGE_CODE, + $value = 'string_value' + ): Field { return new Field([ 'fieldDefIdentifier' => $fieldDefIdentifier, 'languageCode' => $languageCode, @@ -245,8 +254,10 @@ private function getContentType(array $fieldDefs = []): ContentType ]); } - private function getFieldDefinition(string $identifier = 'identifier', bool $isTranslatable = false): FieldDefinition - { + private function getFieldDefinition( + string $identifier = 'identifier', + bool $isTranslatable = false + ): FieldDefinition { return new FieldDefinition([ 'identifier' => $identifier, 'defaultValue' => $this->createMock(Value::class), diff --git a/tests/lib/Form/Data/FormMapper/ContentTypeDraftMapperTest.php b/tests/lib/Form/Data/FormMapper/ContentTypeDraftMapperTest.php index 100e7c0ff8..f27fbaf8f8 100644 --- a/tests/lib/Form/Data/FormMapper/ContentTypeDraftMapperTest.php +++ b/tests/lib/Form/Data/FormMapper/ContentTypeDraftMapperTest.php @@ -24,6 +24,7 @@ use Ibexa\Core\Repository\Values\ContentType\ContentTypeDraft; use Ibexa\Core\Repository\Values\ContentType\FieldDefinition; use Ibexa\Core\Repository\Values\ContentType\FieldDefinitionCollection; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\EventDispatcher\Event; @@ -37,16 +38,16 @@ final class ContentTypeDraftMapperTest extends TestCase private FormDataMapperInterface $contentTypeDraftMapper; - /** @var \Ibexa\AdminUi\Config\AdminUiForms\ContentTypeFieldTypesResolverInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ContentTypeFieldTypesResolverInterface|MockObject */ private ContentTypeFieldTypesResolverInterface $contentTypeFieldTypesResolver; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ContentTypeService|MockObject */ private ContentTypeService $contentTypeService; - /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var EventDispatcherInterface|MockObject */ private EventDispatcherInterface $eventDispatcher; - /** @var \Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList|\PHPUnit\Framework\MockObject\MockObject */ + /** @var FieldsGroupsList|MockObject */ private FieldsGroupsList $fieldsGroupsList; protected function setUp(): void @@ -277,8 +278,10 @@ private function mockContentTypeFieldTypesResolverGetMetaFieldTypeIdentifiers(): ); } - private function mockContentTypeServiceLoadContentType(int $contentTypeId, ContentType $contentType): void - { + private function mockContentTypeServiceLoadContentType( + int $contentTypeId, + ContentType $contentType + ): void { $this->contentTypeService ->expects(self::once()) ->method('loadContentType') @@ -290,9 +293,12 @@ private function mockEventDispatcherDispatch(): void { $this->eventDispatcher ->method('dispatch') - ->with($this->isInstanceOf(FieldDefinitionMappingEvent::class), FieldDefinitionMappingEvent::NAME) + ->with(self::isInstanceOf(FieldDefinitionMappingEvent::class), FieldDefinitionMappingEvent::NAME) ->willReturnCallback( - static function (FieldDefinitionMappingEvent $event, string $eventName): Event { + static function ( + FieldDefinitionMappingEvent $event, + string $eventName + ): Event { $fieldDefinitionData = $event->getFieldDefinitionData(); $fieldDefinition = $event->getFieldDefinition(); diff --git a/tests/lib/Form/DataMapper/ContentMainLocationUpdateMapperTest.php b/tests/lib/Form/DataMapper/ContentMainLocationUpdateMapperTest.php index b474288c64..dcd168523e 100644 --- a/tests/lib/Form/DataMapper/ContentMainLocationUpdateMapperTest.php +++ b/tests/lib/Form/DataMapper/ContentMainLocationUpdateMapperTest.php @@ -10,10 +10,13 @@ use Ibexa\AdminUi\Exception\InvalidArgumentException; use Ibexa\AdminUi\Form\DataMapper\ContentMainLocationUpdateMapper; +use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Values\Content\ContentMetadataUpdateStruct; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\ValueObject; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -21,7 +24,7 @@ */ final class ContentMainLocationUpdateMapperTest extends TestCase { - /** @var \Ibexa\Contracts\Core\Repository\LocationService&\PHPUnit\Framework\MockObject\MockObject */ + /** @var LocationService&MockObject */ private LocationService $locationService; private ContentMainLocationUpdateMapper $mapper; @@ -34,8 +37,8 @@ protected function setUp(): void /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ public function testMapWithMainLocationId(): void { @@ -56,9 +59,9 @@ public function testMapWithMainLocationId(): void } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws UnauthorizedException */ public function testMapWithNullMainLocationId(): void { @@ -75,8 +78,8 @@ public function testMapWithNullMainLocationId(): void /** * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws NotFoundException + * @throws UnauthorizedException */ public function testMapThrowsOnInvalidValueObject(): void { diff --git a/tests/lib/Form/DataMapper/LanguageCreateMapperTest.php b/tests/lib/Form/DataMapper/LanguageCreateMapperTest.php index ad3e72ea58..e1ebfc4b16 100644 --- a/tests/lib/Form/DataMapper/LanguageCreateMapperTest.php +++ b/tests/lib/Form/DataMapper/LanguageCreateMapperTest.php @@ -17,7 +17,7 @@ class LanguageCreateMapperTest extends TestCase { - /** @var \Ibexa\AdminUi\Form\DataMapper\LanguageCreateMapper */ + /** @var LanguageCreateMapper */ private $mapper; protected function setUp(): void @@ -39,7 +39,7 @@ public function testMap(array $properties) { $data = $this->mapper->map($this->createStruct($properties)); - $this->assertEquals($this->createData($properties), $data); + self::assertEquals($this->createData($properties), $data); } /** @@ -51,7 +51,7 @@ public function testReverseMap(array $properties) { $struct = $this->mapper->reverseMap($this->createData($properties)); - $this->assertEquals($this->createStruct($properties), $struct); + self::assertEquals($this->createStruct($properties), $struct); } public function testMapWithWrongInstance() @@ -81,7 +81,7 @@ public function dataProvider() /** * @param array $properties * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\LanguageCreateStruct + * @return LanguageCreateStruct */ private function createStruct(array $properties): LanguageCreateStruct { @@ -91,7 +91,7 @@ private function createStruct(array $properties): LanguageCreateStruct /** * @param array $properties * - * @return \Ibexa\AdminUi\Form\Data\Language\LanguageCreateData + * @return LanguageCreateData */ private function createData(array $properties): LanguageCreateData { diff --git a/tests/lib/Form/DataMapper/PolicyCreateMapperTest.php b/tests/lib/Form/DataMapper/PolicyCreateMapperTest.php index 562c05ca81..7ab050c459 100644 --- a/tests/lib/Form/DataMapper/PolicyCreateMapperTest.php +++ b/tests/lib/Form/DataMapper/PolicyCreateMapperTest.php @@ -17,7 +17,7 @@ class PolicyCreateMapperTest extends TestCase { - /** @var \Ibexa\AdminUi\Form\DataMapper\PolicyCreateMapper */ + /** @var PolicyCreateMapper */ private $mapper; protected function setUp(): void @@ -39,7 +39,7 @@ public function testMap(array $properties) { $data = $this->mapper->map($this->createStruct($properties)); - $this->assertEquals($this->createData($properties), $data); + self::assertEquals($this->createData($properties), $data); } /** @@ -51,7 +51,7 @@ public function testReverseMap(array $properties) { $struct = $this->mapper->reverseMap($this->createData($properties)); - $this->assertEquals($this->createStruct($properties), $struct); + self::assertEquals($this->createStruct($properties), $struct); } public function testMapWithWrongInstance() @@ -80,7 +80,7 @@ public function dataProvider(): array /** * @param array $properties * - * @return \Ibexa\Core\Repository\Values\User\PolicyCreateStruct + * @return PolicyCreateStruct */ private function createStruct(array $properties): PolicyCreateStruct { @@ -90,7 +90,7 @@ private function createStruct(array $properties): PolicyCreateStruct /** * @param array $properties * - * @return \Ibexa\AdminUi\Form\Data\Policy\PolicyCreateData + * @return PolicyCreateData */ private function createData(array $properties): PolicyCreateData { diff --git a/tests/lib/Form/DataMapper/PolicyUpdateMapperTest.php b/tests/lib/Form/DataMapper/PolicyUpdateMapperTest.php index 7745627a7b..61d2015676 100644 --- a/tests/lib/Form/DataMapper/PolicyUpdateMapperTest.php +++ b/tests/lib/Form/DataMapper/PolicyUpdateMapperTest.php @@ -17,13 +17,13 @@ class PolicyUpdateMapperTest extends TestCase { - /** @var \Ibexa\AdminUi\Form\DataMapper\PolicyUpdateMapper */ + /** @var PolicyUpdateMapper */ private $mapper; protected function setUp(): void { /* TODO - test skipped, because tested class need to be improved */ - $this->markTestSkipped(); + self::markTestSkipped(); $this->mapper = new PolicyUpdateMapper(); } @@ -41,7 +41,7 @@ public function testMap(array $properties) { $data = $this->mapper->map($this->createStruct($properties)); - $this->assertEquals($this->createData($properties), $data); + self::assertEquals($this->createData($properties), $data); } /** @@ -53,7 +53,7 @@ public function testReverseMap(array $properties) { $struct = $this->mapper->reverseMap($this->createData($properties)); - $this->assertEquals($this->createStruct($properties), $struct); + self::assertEquals($this->createStruct($properties), $struct); } public function testMapWithWrongInstance() @@ -74,7 +74,7 @@ public function dataProvider(): array /** * @param array $properties * - * @return \Ibexa\Core\Repository\Values\User\PolicyUpdateStruct + * @return PolicyUpdateStruct */ private function createStruct(array $properties): PolicyUpdateStruct { @@ -87,7 +87,7 @@ private function createStruct(array $properties): PolicyUpdateStruct /** * @param array $properties * - * @return \Ibexa\AdminUi\Form\Data\Policy\PolicyUpdateData + * @return PolicyUpdateData */ private function createData(array $properties): PolicyUpdateData { diff --git a/tests/lib/Form/DataMapper/RoleCreateMapperTest.php b/tests/lib/Form/DataMapper/RoleCreateMapperTest.php index 6ff95c3a7b..f5603b8783 100644 --- a/tests/lib/Form/DataMapper/RoleCreateMapperTest.php +++ b/tests/lib/Form/DataMapper/RoleCreateMapperTest.php @@ -17,7 +17,7 @@ class RoleCreateMapperTest extends TestCase { - /** @var \Ibexa\AdminUi\Form\DataMapper\RoleCreateMapper */ + /** @var RoleCreateMapper */ private $mapper; protected function setUp(): void @@ -39,7 +39,7 @@ public function testMap(array $properties) { $data = $this->mapper->map($this->createStruct($properties)); - $this->assertEquals($this->createData($properties), $data); + self::assertEquals($this->createData($properties), $data); } /** @@ -51,7 +51,7 @@ public function testReverseMap(array $properties) { $struct = $this->mapper->reverseMap($this->createData($properties)); - $this->assertEquals($this->createStruct($properties), $struct); + self::assertEquals($this->createStruct($properties), $struct); } public function testMapWithWrongInstance() @@ -80,7 +80,7 @@ public function dataProvider(): array /** * @param array $properties * - * @return \Ibexa\Core\Repository\Values\User\RoleCreateStruct + * @return RoleCreateStruct */ private function createStruct(array $properties): RoleCreateStruct { @@ -90,7 +90,7 @@ private function createStruct(array $properties): RoleCreateStruct /** * @param array $properties * - * @return \Ibexa\AdminUi\Form\Data\Role\RoleCreateData + * @return RoleCreateData */ private function createData(array $properties): RoleCreateData { diff --git a/tests/lib/Form/DataMapper/RoleUpdateMapperTest.php b/tests/lib/Form/DataMapper/RoleUpdateMapperTest.php index 0dcad5442b..f4b56a2dd6 100644 --- a/tests/lib/Form/DataMapper/RoleUpdateMapperTest.php +++ b/tests/lib/Form/DataMapper/RoleUpdateMapperTest.php @@ -17,7 +17,7 @@ class RoleUpdateMapperTest extends TestCase { - /** @var \Ibexa\AdminUi\Form\DataMapper\RoleUpdateMapper */ + /** @var RoleUpdateMapper */ private $mapper; protected function setUp(): void @@ -39,7 +39,7 @@ public function testMap(array $properties) { $data = $this->mapper->map($this->createStruct($properties)); - $this->assertEquals($this->createData($properties), $data); + self::assertEquals($this->createData($properties), $data); } /** @@ -51,7 +51,7 @@ public function testReverseMap(array $properties) { $struct = $this->mapper->reverseMap($this->createData($properties)); - $this->assertEquals($this->createStruct($properties), $struct); + self::assertEquals($this->createStruct($properties), $struct); } public function testMapWithWrongInstance() @@ -80,7 +80,7 @@ public function dataProvider(): array /** * @param array $properties * - * @return \Ibexa\Contracts\Core\Repository\Values\User\RoleUpdateStruct + * @return RoleUpdateStruct */ private function createStruct(array $properties): RoleUpdateStruct { @@ -90,7 +90,7 @@ private function createStruct(array $properties): RoleUpdateStruct /** * @param array $properties * - * @return \Ibexa\AdminUi\Form\Data\Role\RoleUpdateData + * @return RoleUpdateData */ private function createData(array $properties): RoleUpdateData { diff --git a/tests/lib/Form/DataMapper/SelectionCreateMapperTest.php b/tests/lib/Form/DataMapper/SelectionCreateMapperTest.php index 289fd74044..e20ebbbcc8 100644 --- a/tests/lib/Form/DataMapper/SelectionCreateMapperTest.php +++ b/tests/lib/Form/DataMapper/SelectionCreateMapperTest.php @@ -17,7 +17,7 @@ class SelectionCreateMapperTest extends TestCase { - /** @var \Ibexa\AdminUi\Form\DataMapper\SectionCreateMapper */ + /** @var SectionCreateMapper */ private $mapper; protected function setUp(): void @@ -39,7 +39,7 @@ public function testMap(array $properties) { $data = $this->mapper->map($this->createStruct($properties)); - $this->assertEquals($this->createData($properties), $data); + self::assertEquals($this->createData($properties), $data); } /** @@ -51,7 +51,7 @@ public function testReverseMap(array $properties) { $struct = $this->mapper->reverseMap($this->createData($properties)); - $this->assertEquals($this->createStruct($properties), $struct); + self::assertEquals($this->createStruct($properties), $struct); } public function testMapWithWrongInstance() @@ -83,7 +83,7 @@ public function dataProvider(): array /** * @param array $properties * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\SectionCreateStruct + * @return SectionCreateStruct */ private function createStruct(array $properties): SectionCreateStruct { @@ -93,7 +93,7 @@ private function createStruct(array $properties): SectionCreateStruct /** * @param array $properties * - * @return \Ibexa\AdminUi\Form\Data\Section\SectionCreateData + * @return SectionCreateData */ private function createData(array $properties): SectionCreateData { diff --git a/tests/lib/Form/DataMapper/SelectionUpdateMapperTest.php b/tests/lib/Form/DataMapper/SelectionUpdateMapperTest.php index 25e6e739f8..80d4c777b7 100644 --- a/tests/lib/Form/DataMapper/SelectionUpdateMapperTest.php +++ b/tests/lib/Form/DataMapper/SelectionUpdateMapperTest.php @@ -18,7 +18,7 @@ class SelectionUpdateMapperTest extends TestCase { - /** @var \Ibexa\AdminUi\Form\DataMapper\SectionUpdateMapper */ + /** @var SectionUpdateMapper */ private $mapper; protected function setUp(): void @@ -40,7 +40,7 @@ public function testMap(array $properties) { $data = $this->mapper->map($this->createStruct($properties)); - $this->assertEquals($this->createData($properties), $data); + self::assertEquals($this->createData($properties), $data); } /** @@ -52,7 +52,7 @@ public function testReverseMap(array $properties) { $struct = $this->mapper->reverseMap($this->createData($properties)); - $this->assertEquals($this->createStruct($properties), $struct); + self::assertEquals($this->createStruct($properties), $struct); } public function testMapWithWrongInstance() @@ -84,7 +84,7 @@ public function dataProvider(): array /** * @param array $properties * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\SectionUpdateStruct + * @return SectionUpdateStruct */ private function createStruct(array $properties): SectionUpdateStruct { @@ -94,7 +94,7 @@ private function createStruct(array $properties): SectionUpdateStruct /** * @param array $properties * - * @return \Ibexa\AdminUi\Form\Data\Section\SectionUpdateData + * @return SectionUpdateData */ private function createData(array $properties): SectionUpdateData { diff --git a/tests/lib/Form/DataTransformer/ContentInfoTransformerTest.php b/tests/lib/Form/DataTransformer/ContentInfoTransformerTest.php index f30a3e59f4..b31286466c 100644 --- a/tests/lib/Form/DataTransformer/ContentInfoTransformerTest.php +++ b/tests/lib/Form/DataTransformer/ContentInfoTransformerTest.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Exception\TransformationFailedException; @@ -19,18 +20,18 @@ final class ContentInfoTransformerTest extends TestCase { private const EXAMPLE_CONTENT_ID = 123456; - /** @var \Ibexa\AdminUi\Form\DataTransformer\ContentInfoTransformer */ + /** @var ContentInfoTransformer */ private $contentInfoTransformer; protected function setUp(): void { - /** @var \Ibexa\Contracts\Core\Repository\ContentService|\PHPUnit\Framework\MockObject\MockObject $contentService */ + /** @var ContentService|MockObject $contentService */ $contentService = $this->createMock(ContentService::class); $contentService ->method('loadContentInfo') - ->with($this->logicalAnd( - $this->equalTo(self::EXAMPLE_CONTENT_ID), - $this->isType('int') + ->with(self::logicalAnd( + self::equalTo(self::EXAMPLE_CONTENT_ID), + self::isType('int') )) ->willReturn(new ContentInfo([ 'id' => self::EXAMPLE_CONTENT_ID, @@ -55,21 +56,25 @@ public function testTransformWithInvalidInput($value): void /** * @dataProvider transformDataProvider */ - public function testTransform(?ContentInfo $value, ?int $expected): void - { + public function testTransform( + ?ContentInfo $value, + ?int $expected + ): void { $result = $this->contentInfoTransformer->transform($value); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } /** * @dataProvider reverseTransformDataProvider */ - public function testReverseTransform($value, ?ContentInfo $expected): void - { + public function testReverseTransform( + $value, + ?ContentInfo $expected + ): void { $result = $this->contentInfoTransformer->reverseTransform($value); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } /** @@ -90,11 +95,10 @@ public function testReverseTransformWithNotFoundException(): void $this->expectException(TransformationFailedException::class); $this->expectExceptionMessage('ContentInfo not found'); - /** @var \Ibexa\Contracts\Core\Repository\ContentService|\PHPUnit\Framework\MockObject\MockObject $service */ + /** @var ContentService|MockObject $service */ $service = $this->createMock(ContentService::class); $service->method('loadContentInfo') - ->will($this->throwException(new class('ContentInfo not found') extends NotFoundException { - })); + ->will(self::throwException(new class('ContentInfo not found') extends NotFoundException {})); $transformer = new ContentInfoTransformer($service); diff --git a/tests/lib/Form/DataTransformer/ContentTypeGroupTransformerTest.php b/tests/lib/Form/DataTransformer/ContentTypeGroupTransformerTest.php index 1690b2cdd8..97c0f39dea 100644 --- a/tests/lib/Form/DataTransformer/ContentTypeGroupTransformerTest.php +++ b/tests/lib/Form/DataTransformer/ContentTypeGroupTransformerTest.php @@ -13,6 +13,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup as APIContentTypeGroup; use Ibexa\Core\Repository\Values\ContentType\ContentTypeGroup; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use stdClass; use Symfony\Component\Form\Exception\TransformationFailedException; @@ -21,10 +22,10 @@ final class ContentTypeGroupTransformerTest extends TestCase { private const EXAMPLE_CONTENT_TYPE_GROUP_ID = 1; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ContentTypeService|MockObject */ private $contentService; - /** @var \Ibexa\AdminUi\Form\DataTransformer\ContentTypeGroupTransformer */ + /** @var ContentTypeGroupTransformer */ private $transformer; protected function setUp(): void @@ -36,9 +37,11 @@ protected function setUp(): void /** * @dataProvider dataProviderForTransformWithValidInput */ - public function testTransformWithValidInput(?APIContentTypeGroup $value, ?int $expected): void - { - $this->assertEquals($expected, $this->transformer->transform($value)); + public function testTransformWithValidInput( + ?APIContentTypeGroup $value, + ?int $expected + ): void { + self::assertEquals($expected, $this->transformer->transform($value)); } public function dataProviderForTransformWithValidInput(): array @@ -72,15 +75,17 @@ public function dataProviderForTransformWithInvalidInput(): array 'bool' => [true], 'float' => [12.34], 'array' => [[]], - 'object' => [new \stdClass()], + 'object' => [new stdClass()], ]; } /** * @dataProvider dataProviderForReverseTransformWithValidInput */ - public function testReverseTransformWithValidInput($value, ?APIContentTypeGroup $expected): void - { + public function testReverseTransformWithValidInput( + $value, + ?APIContentTypeGroup $expected + ): void { if ($expected !== null) { $this->contentService ->method('loadContentTypeGroup') @@ -88,7 +93,7 @@ public function testReverseTransformWithValidInput($value, ?APIContentTypeGroup ->willReturn($expected); } - $this->assertEquals( + self::assertEquals( $expected, $this->transformer->reverseTransform($value) ); @@ -141,8 +146,7 @@ public function testReverseTransformWithNotFoundException(): void $this->expectException(TransformationFailedException::class); $this->expectExceptionMessage($expectedExceptionMessage); - $exception = new class($expectedExceptionMessage) extends NotFoundException { - }; + $exception = new class($expectedExceptionMessage) extends NotFoundException {}; $this->contentService ->method('loadContentTypeGroup') diff --git a/tests/lib/Form/DataTransformer/DateTimePickerTransformerTest.php b/tests/lib/Form/DataTransformer/DateTimePickerTransformerTest.php index 5bfce9f805..21da6f3610 100644 --- a/tests/lib/Form/DataTransformer/DateTimePickerTransformerTest.php +++ b/tests/lib/Form/DataTransformer/DateTimePickerTransformerTest.php @@ -23,7 +23,7 @@ public function testTransform(): void { $transformer = new DateTimePickerTransformer(); $dateTime = new DateTime('2021-01-01 00:00:00'); - $this->assertSame($dateTime->getTimestamp(), $transformer->transform($dateTime)); + self::assertSame($dateTime->getTimestamp(), $transformer->transform($dateTime)); } /** @@ -52,7 +52,7 @@ public function testReverseTransform(): void { $transformer = new DateTimePickerTransformer(); $dateTime = new DateTime('2021-01-01 00:00:00'); - $this->assertEquals($dateTime, $transformer->reverseTransform($dateTime->getTimestamp())); + self::assertEquals($dateTime, $transformer->reverseTransform($dateTime->getTimestamp())); } /** diff --git a/tests/lib/Form/DataTransformer/FieldValueTransformerTest.php b/tests/lib/Form/DataTransformer/FieldValueTransformerTest.php index 92e6a01c3f..9592a375e3 100644 --- a/tests/lib/Form/DataTransformer/FieldValueTransformerTest.php +++ b/tests/lib/Form/DataTransformer/FieldValueTransformerTest.php @@ -21,12 +21,12 @@ public function testTransformNull() $fieldType = $this->createMock(FieldType::class); $fieldType - ->expects($this->never()) + ->expects(self::never()) ->method('toHash'); $result = (new FieldValueTransformer($fieldType))->transform($value); - $this->assertNull($result); + self::assertNull($result); } public function testTransform() @@ -36,14 +36,14 @@ public function testTransform() $fieldType = $this->createMock(FieldType::class); $fieldType - ->expects($this->once()) + ->expects(self::once()) ->method('toHash') ->with($value) ->willReturn($valueHash); $result = (new FieldValueTransformer($fieldType))->transform($value); - $this->assertEquals($result, $valueHash); + self::assertEquals($result, $valueHash); } public function testReverseTransformNull() @@ -52,16 +52,16 @@ public function testReverseTransformNull() $fieldType = $this->createMock(FieldType::class); $fieldType - ->expects($this->once()) + ->expects(self::once()) ->method('getEmptyValue') ->willReturn($emptyValue); $fieldType - ->expects($this->never()) + ->expects(self::never()) ->method('fromHash'); $result = (new FieldValueTransformer($fieldType))->reverseTransform(null); - $this->assertSame($emptyValue, $result); + self::assertSame($emptyValue, $result); } public function testReverseTransform() @@ -71,16 +71,16 @@ public function testReverseTransform() $fieldType = $this->createMock(FieldType::class); $fieldType - ->expects($this->never()) + ->expects(self::never()) ->method('getEmptyValue'); $fieldType - ->expects($this->once()) + ->expects(self::once()) ->method('fromHash') ->willReturn($expected); $result = (new FieldValueTransformer($fieldType))->reverseTransform($value); - $this->assertSame($expected, $result); + self::assertSame($expected, $result); } } diff --git a/tests/lib/Form/DataTransformer/LanguageTransformerTest.php b/tests/lib/Form/DataTransformer/LanguageTransformerTest.php index ac179e124a..b57f16cd2f 100644 --- a/tests/lib/Form/DataTransformer/LanguageTransformerTest.php +++ b/tests/lib/Form/DataTransformer/LanguageTransformerTest.php @@ -12,12 +12,13 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\Values\Content\Language; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Exception\TransformationFailedException; class LanguageTransformerTest extends TestCase { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService&\PHPUnit\Framework\MockObject\MockObject */ + /** @var LanguageService&MockObject */ private LanguageService $languageService; protected function setUp(): void @@ -28,16 +29,18 @@ protected function setUp(): void /** * @dataProvider transformDataProvider * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language|null $value + * @param Language|null $value * @param string|null $expected */ - public function testTransform($value, $expected): void - { + public function testTransform( + $value, + $expected + ): void { $transformer = new LanguageTransformer($this->languageService); $result = $transformer->transform($value); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } /** @@ -68,7 +71,7 @@ public function testReverseTransformWithLanguageCode(): void $result = $transformer->reverseTransform('eng-GB'); - $this->assertEquals(new Language(['languageCode' => 'eng-GB']), $result); + self::assertEquals(new Language(['languageCode' => 'eng-GB']), $result); } public function testReverseTransformWithNull(): void @@ -81,15 +84,14 @@ public function testReverseTransformWithNull(): void $result = $transformer->reverseTransform(null); - $this->assertNull($result); + self::assertNull($result); } public function testReverseTransformWithNotFoundException(): void { $this->languageService ->method('loadLanguage') - ->will($this->throwException(new class('Language not found') extends NotFoundException { - })); + ->will(self::throwException(new class('Language not found') extends NotFoundException {})); $transformer = new LanguageTransformer($this->languageService); diff --git a/tests/lib/Form/DataTransformer/LocationTransformerTest.php b/tests/lib/Form/DataTransformer/LocationTransformerTest.php index 91b60fca36..af9a4fc9b2 100644 --- a/tests/lib/Form/DataTransformer/LocationTransformerTest.php +++ b/tests/lib/Form/DataTransformer/LocationTransformerTest.php @@ -24,14 +24,16 @@ class LocationTransformerTest extends TestCase * @param $value * @param $expected */ - public function testTransform($value, $expected) - { + public function testTransform( + $value, + $expected + ) { $service = $this->createMock(LocationService::class); $transformer = new LocationTransformer($service); $result = $transformer->transform($value); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } /** @@ -62,7 +64,7 @@ public function testReverseTransformWithId() $result = $transformer->reverseTransform(123456); - $this->assertEquals(new Location(['id' => 123456]), $result); + self::assertEquals(new Location(['id' => 123456]), $result); } public function testReverseTransformWithNull() @@ -75,7 +77,7 @@ public function testReverseTransformWithNull() $result = $transformer->reverseTransform(null); - $this->assertNull($result); + self::assertNull($result); } public function testReverseTransformWithNotFoundException() @@ -85,8 +87,7 @@ public function testReverseTransformWithNotFoundException() $service = $this->createMock(LocationService::class); $service->method('loadLocation') - ->will($this->throwException(new class('Location not found') extends NotFoundException { - })); + ->will(self::throwException(new class('Location not found') extends NotFoundException {})); $transformer = new LocationTransformer($service); diff --git a/tests/lib/Form/DataTransformer/LocationsTransformerTest.php b/tests/lib/Form/DataTransformer/LocationsTransformerTest.php index 02741226e4..db63463633 100644 --- a/tests/lib/Form/DataTransformer/LocationsTransformerTest.php +++ b/tests/lib/Form/DataTransformer/LocationsTransformerTest.php @@ -22,14 +22,16 @@ class LocationsTransformerTest extends TestCase * @param $value * @param $expected */ - public function testTransform($value, $expected) - { + public function testTransform( + $value, + $expected + ) { $service = $this->createMock(LocationService::class); $transformer = new LocationsTransformer($service); $result = $transformer->transform($value); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } public function testReverseTransformWithIds() @@ -45,7 +47,7 @@ public function testReverseTransformWithIds() $transformer = new LocationsTransformer($service); $result = $transformer->reverseTransform('123456,456789'); - $this->assertEquals([new Location(['id' => 123456]), new Location(['id' => 456789])], $result); + self::assertEquals([new Location(['id' => 123456]), new Location(['id' => 456789])], $result); } /** @@ -62,7 +64,7 @@ public function testReverseTransformWithEmpty($value) $transformer = new LocationsTransformer($service); $result = $transformer->reverseTransform($value); - $this->assertEmpty($result); + self::assertEmpty($result); } /** diff --git a/tests/lib/Form/DataTransformer/PolicyTransformerTest.php b/tests/lib/Form/DataTransformer/PolicyTransformerTest.php index 519083f6da..eb1f00d955 100644 --- a/tests/lib/Form/DataTransformer/PolicyTransformerTest.php +++ b/tests/lib/Form/DataTransformer/PolicyTransformerTest.php @@ -20,13 +20,15 @@ class PolicyTransformerTest extends TestCase * @param $value * @param $expected */ - public function testTransform($value, $expected) - { + public function testTransform( + $value, + $expected + ) { $transformer = new PolicyTransformer(); $result = $transformer->transform($value); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } /** @@ -50,12 +52,14 @@ public function testTransformWithInvalidInput($value) * @param $value * @param $expected */ - public function testReverseTransform($value, $expected) - { + public function testReverseTransform( + $value, + $expected + ) { $transformer = new PolicyTransformer(); $result = $transformer->reverseTransform($value); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } /** @@ -64,8 +68,10 @@ public function testReverseTransform($value, $expected) * @param $value * @param $expectedMessage */ - public function testReverseTransformWithInvalidInput($value, $expectedMessage) - { + public function testReverseTransformWithInvalidInput( + $value, + $expectedMessage + ) { $this->expectException(TransformationFailedException::class); $this->expectExceptionMessage($expectedMessage); diff --git a/tests/lib/Form/DataTransformer/RoleAssignmentTransformerTest.php b/tests/lib/Form/DataTransformer/RoleAssignmentTransformerTest.php index ad4fe8e5f4..9481ff92f4 100644 --- a/tests/lib/Form/DataTransformer/RoleAssignmentTransformerTest.php +++ b/tests/lib/Form/DataTransformer/RoleAssignmentTransformerTest.php @@ -24,14 +24,16 @@ class RoleAssignmentTransformerTest extends TestCase * @param $value * @param $expected */ - public function testTransform($value, $expected) - { + public function testTransform( + $value, + $expected + ) { $service = $this->createMock(RoleService::class); $transformer = new RoleAssignmentTransformer($service); $result = $transformer->transform($value); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } /** @@ -62,7 +64,7 @@ public function testReverseTransformWithId() $result = $transformer->reverseTransform(123456); - $this->assertEquals(new RoleAssignment(['id' => 123456]), $result); + self::assertEquals(new RoleAssignment(['id' => 123456]), $result); } public function testReverseTransformWithNull() @@ -75,7 +77,7 @@ public function testReverseTransformWithNull() $result = $transformer->reverseTransform(null); - $this->assertNull($result); + self::assertNull($result); } /** @@ -97,8 +99,7 @@ public function testReverseTransformWithNotFoundException() { $service = $this->createMock(RoleService::class); $service->method('loadRoleAssignment') - ->will($this->throwException(new class('Location not found') extends NotFoundException { - })); + ->will(self::throwException(new class('Location not found') extends NotFoundException {})); $transformer = new RoleAssignmentTransformer($service); diff --git a/tests/lib/Form/DataTransformer/RoleTransformerTest.php b/tests/lib/Form/DataTransformer/RoleTransformerTest.php index 61e77bb7a4..8faa8d85e3 100644 --- a/tests/lib/Form/DataTransformer/RoleTransformerTest.php +++ b/tests/lib/Form/DataTransformer/RoleTransformerTest.php @@ -24,14 +24,16 @@ class RoleTransformerTest extends TestCase * @param $value * @param $expected */ - public function testTransform($value, $expected) - { + public function testTransform( + $value, + $expected + ) { $service = $this->createMock(RoleService::class); $transformer = new RoleTransformer($service); $result = $transformer->transform($value); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } /** @@ -62,7 +64,7 @@ public function testReverseTransformWithId() $result = $transformer->reverseTransform(123456); - $this->assertEquals(new Role(['id' => 123456]), $result); + self::assertEquals(new Role(['id' => 123456]), $result); } public function testReverseTransformWithNull() @@ -75,7 +77,7 @@ public function testReverseTransformWithNull() $result = $transformer->reverseTransform(null); - $this->assertNull($result); + self::assertNull($result); } /** @@ -99,8 +101,7 @@ public function testReverseTransformWithNotFoundException() $service = $this->createMock(RoleService::class); $service->method('loadRole') - ->will($this->throwException(new class('Location not found') extends NotFoundException { - })); + ->will(self::throwException(new class('Location not found') extends NotFoundException {})); $transformer = new RoleTransformer($service); diff --git a/tests/lib/Form/DataTransformer/SectionTransformerTest.php b/tests/lib/Form/DataTransformer/SectionTransformerTest.php index 3a56514369..23f9bd4c14 100644 --- a/tests/lib/Form/DataTransformer/SectionTransformerTest.php +++ b/tests/lib/Form/DataTransformer/SectionTransformerTest.php @@ -23,14 +23,16 @@ class SectionTransformerTest extends TestCase * @param $value * @param $expected */ - public function testTransform($value, $expected) - { + public function testTransform( + $value, + $expected + ) { $service = $this->createMock(SectionService::class); $transformer = new SectionTransformer($service); $result = $transformer->transform($value); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } /** @@ -61,7 +63,7 @@ public function testReverseTransformWithId() $result = $transformer->reverseTransform(123456); - $this->assertEquals(new APISection(['id' => 123456]), $result); + self::assertEquals(new APISection(['id' => 123456]), $result); } public function testReverseTransformWithNull() @@ -74,7 +76,7 @@ public function testReverseTransformWithNull() $result = $transformer->reverseTransform(null); - $this->assertNull($result); + self::assertNull($result); } public function testReverseTransformWithNotFoundException() @@ -84,8 +86,7 @@ public function testReverseTransformWithNotFoundException() $service = $this->createMock(SectionService::class); $service->method('loadSection') - ->will($this->throwException(new class('Section not found') extends NotFoundException { - })); + ->will(self::throwException(new class('Section not found') extends NotFoundException {})); $transformer = new SectionTransformer($service); diff --git a/tests/lib/Form/DataTransformer/SectionsTransformerTest.php b/tests/lib/Form/DataTransformer/SectionsTransformerTest.php index 5dee15fc36..b0fcf2ab3a 100644 --- a/tests/lib/Form/DataTransformer/SectionsTransformerTest.php +++ b/tests/lib/Form/DataTransformer/SectionsTransformerTest.php @@ -22,14 +22,16 @@ class SectionsTransformerTest extends TestCase * @param $value * @param $expected */ - public function testTransform($value, $expected) - { + public function testTransform( + $value, + $expected + ) { $service = $this->createMock(SectionService::class); $transformer = new SectionsTransformer($service); $result = $transformer->transform($value); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } public function testReverseTransformWithIds() @@ -45,7 +47,7 @@ public function testReverseTransformWithIds() $transformer = new SectionsTransformer($service); $result = $transformer->reverseTransform('123456,456789'); - $this->assertEquals([new APISection(['id' => 123456]), new APISection(['id' => 456789])], $result); + self::assertEquals([new APISection(['id' => 123456]), new APISection(['id' => 456789])], $result); } /** @@ -62,7 +64,7 @@ public function testReverseTransformWithEmpty($value) $transformer = new SectionsTransformer($service); $result = $transformer->reverseTransform($value); - $this->assertNull($result); + self::assertNull($result); } /** diff --git a/tests/lib/Form/DataTransformer/TranslatablePropertyTransformerTest.php b/tests/lib/Form/DataTransformer/TranslatablePropertyTransformerTest.php index 23c92cf596..b464bdb77c 100644 --- a/tests/lib/Form/DataTransformer/TranslatablePropertyTransformerTest.php +++ b/tests/lib/Form/DataTransformer/TranslatablePropertyTransformerTest.php @@ -34,8 +34,11 @@ public function transformInvalidValueProvider() /** * @dataProvider transformValueProvider */ - public function testTransform(array $inputValue, $languageCode, $expected) - { + public function testTransform( + array $inputValue, + $languageCode, + $expected + ) { $transformer = new TranslatablePropertyTransformer($languageCode); self::assertSame($expected, $transformer->transform($inputValue)); } @@ -52,8 +55,11 @@ public function transformValueProvider() /** * @dataProvider reverseTransformProvider */ - public function testReverseTransform($inputValue, $languageCode, $expected) - { + public function testReverseTransform( + $inputValue, + $languageCode, + $expected + ) { $transformer = new TranslatablePropertyTransformer($languageCode); self::assertSame($expected, $transformer->reverseTransform($inputValue)); } diff --git a/tests/lib/Form/DataTransformer/UDWBasedValueViewTransformerTest.php b/tests/lib/Form/DataTransformer/UDWBasedValueViewTransformerTest.php index bbba147458..f0516146de 100644 --- a/tests/lib/Form/DataTransformer/UDWBasedValueViewTransformerTest.php +++ b/tests/lib/Form/DataTransformer/UDWBasedValueViewTransformerTest.php @@ -13,15 +13,16 @@ use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Exception\TransformationFailedException; class UDWBasedValueViewTransformerTest extends TestCase { - /** @var \Ibexa\Contracts\Core\Repository\LocationService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var LocationService|MockObject */ private $locationService; - /** @var \Ibexa\AdminUi\Form\DataTransformer\UDWBasedValueViewTransformer */ + /** @var UDWBasedValueViewTransformer */ private $transformer; protected function setUp(): void @@ -35,9 +36,11 @@ protected function setUp(): void /** * @dataProvider dataProviderForTransform */ - public function testTransform(?array $given, ?string $expected) - { - $this->assertEquals($expected, $this->transformer->transform($given)); + public function testTransform( + ?array $given, + ?string $expected + ) { + self::assertEquals($expected, $this->transformer->transform($given)); } public function dataProviderForTransform(): array @@ -58,15 +61,17 @@ public function dataProviderForTransform(): array /** * @dataProvider dataProviderForReverseTransform */ - public function testReverseTransform(?string $given, ?array $expected) - { + public function testReverseTransform( + ?string $given, + ?array $expected + ) { $this->locationService ->method('loadLocation') ->willReturnCallback(function ($id) { return $this->createLocation($id); }); - $this->assertEquals($expected, $this->transformer->reverseTransform($given)); + self::assertEquals($expected, $this->transformer->reverseTransform($given)); } public function dataProviderForReverseTransform(): array diff --git a/tests/lib/Form/DataTransformer/UserTransformerTest.php b/tests/lib/Form/DataTransformer/UserTransformerTest.php index 594fac65c1..b3e8b5be20 100644 --- a/tests/lib/Form/DataTransformer/UserTransformerTest.php +++ b/tests/lib/Form/DataTransformer/UserTransformerTest.php @@ -15,17 +15,18 @@ use Ibexa\Contracts\Core\Repository\Values\User\User; use Ibexa\Core\Repository\Values\Content as Core; use Ibexa\Core\Repository\Values\User\User as CoreUser; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Exception\TransformationFailedException; class UserTransformerTest extends TestCase { - /** @var \Ibexa\AdminUi\Form\DataTransformer\UserTransformer */ + /** @var UserTransformer */ private $userTransformer; protected function setUp(): void { - /** @var \Ibexa\Contracts\Core\Repository\UserService|\PHPUnit\Framework\MockObject\MockObject $userService */ + /** @var UserService|MockObject $userService */ $userService = $this->createMock(UserService::class); $userService->expects(self::any()) ->method('loadUser') @@ -41,11 +42,13 @@ protected function setUp(): void * @param $value * @param $expected */ - public function testTransform($value, $expected) - { + public function testTransform( + $value, + $expected + ) { $result = $this->userTransformer->transform($value); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } /** @@ -67,11 +70,13 @@ public function testTransformWithInvalidInput($value) * @param $value * @param $expected */ - public function testReverseTransform($value, $expected) - { + public function testReverseTransform( + $value, + $expected + ) { $result = $this->userTransformer->reverseTransform($value); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } /** @@ -92,11 +97,10 @@ public function testReverseTransformWithNotFoundException() $this->expectException(TransformationFailedException::class); $this->expectExceptionMessage('User not found'); - /** @var \Ibexa\Contracts\Core\Repository\UserService|\PHPUnit\Framework\MockObject\MockObject $service */ + /** @var UserService|MockObject $service */ $service = $this->createMock(UserService::class); $service->method('loadUser') - ->will($this->throwException(new class('User not found') extends NotFoundException { - })); + ->will(self::throwException(new class('User not found') extends NotFoundException {})); $transformer = new UserTransformer($service); diff --git a/tests/lib/Form/DataTransformer/VersionInfoTransformerTest.php b/tests/lib/Form/DataTransformer/VersionInfoTransformerTest.php index ac9118d038..35132fc5c8 100644 --- a/tests/lib/Form/DataTransformer/VersionInfoTransformerTest.php +++ b/tests/lib/Form/DataTransformer/VersionInfoTransformerTest.php @@ -14,6 +14,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Exception\TransformationFailedException; @@ -22,10 +23,10 @@ final class VersionInfoTransformerTest extends TestCase private const EXAMPLE_CONTENT_ID = 123456; private const EXAMPLE_VERSION_NO = 7; - /** @var \Ibexa\Contracts\Core\Repository\ContentService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ContentService|MockObject */ private $contentService; - /** @var \Ibexa\AdminUi\Form\DataTransformer\VersionInfoTransformer */ + /** @var VersionInfoTransformer */ private $transformer; protected function setUp(): void @@ -37,9 +38,11 @@ protected function setUp(): void /** * @dataProvider dataProviderForTransformWithValidInput */ - public function testTransformWithValidInput(?VersionInfo $value, ?array $expected): void - { - $this->assertEquals( + public function testTransformWithValidInput( + ?VersionInfo $value, + ?array $expected + ): void { + self::assertEquals( $expected, $this->transformer->transform($value) ); @@ -78,8 +81,7 @@ public function testTransformWithInvalidInput($value): void public function dataProviderForTransformWithInvalidInput(): array { - $object = new class() { - }; + $object = new class() {}; return [ 'string' => ['string'], @@ -94,24 +96,26 @@ public function dataProviderForTransformWithInvalidInput(): array /** * @dataProvider dataProviderForReverseTransformWithValidInput */ - public function testReverseTransformWithValidInput(?array $value, ?VersionInfo $expected): void - { + public function testReverseTransformWithValidInput( + ?array $value, + ?VersionInfo $expected + ): void { if ($expected !== null) { $this->contentService - ->expects($this->once()) + ->expects(self::once()) ->method('loadVersionInfo') ->with( - $this->equalTo($value['content_info']), - $this->logicalAnd( - $this->equalTo($value['version_no']), + self::equalTo($value['content_info']), + self::logicalAnd( + self::equalTo($value['version_no']), // Make sure value is casted to int - $this->isType('int') + self::isType('int') ) ) ->willReturn($expected); } - $this->assertEquals( + self::assertEquals( $expected, $this->transformer->reverseTransform($value) ); @@ -185,8 +189,7 @@ public function testReverseTransformForNonExistingVersionInfo(): void 'version_no' => self::EXAMPLE_VERSION_NO, ]; - $exception = new class('VersionInfo not found') extends NotFoundException { - }; + $exception = new class('VersionInfo not found') extends NotFoundException {}; $this->contentService ->method('loadVersionInfo') @@ -210,8 +213,7 @@ public function testReverseTransformForUnauthorizedVersionInfo(): void 'version_no' => self::EXAMPLE_VERSION_NO, ]; - $exception = new class('Unauthorized VersionInfo') extends UnauthorizedException { - }; + $exception = new class('Unauthorized VersionInfo') extends UnauthorizedException {}; $this->contentService ->method('loadVersionInfo') @@ -221,8 +223,10 @@ public function testReverseTransformForUnauthorizedVersionInfo(): void $this->transformer->reverseTransform($value); } - private function createVersionInfoMock(ContentInfo $contentInfo, int $versionNo): VersionInfo - { + private function createVersionInfoMock( + ContentInfo $contentInfo, + int $versionNo + ): VersionInfo { $versionInfo = $this->createMock(VersionInfo::class); $versionInfo ->method('__get') diff --git a/tests/lib/Form/Processor/ContentTypeFormProcessorTest.php b/tests/lib/Form/Processor/ContentTypeFormProcessorTest.php index ed5aa1e398..a6de533856 100644 --- a/tests/lib/Form/Processor/ContentTypeFormProcessorTest.php +++ b/tests/lib/Form/Processor/ContentTypeFormProcessorTest.php @@ -19,6 +19,7 @@ use Ibexa\Core\Repository\Values\ContentType\ContentTypeDraft; use Ibexa\Core\Repository\Values\ContentType\FieldDefinition; use Ibexa\Core\Repository\Values\ContentType\FieldDefinitionCollection; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\FormConfigInterface; use Symfony\Component\Form\FormInterface; @@ -33,22 +34,22 @@ final class ContentTypeFormProcessorTest extends TestCase private const EXAMPLE_CONTENT_TYPE_ID = 1; /** - * @var \Ibexa\Contracts\Core\Repository\ContentTypeService|\PHPUnit\Framework\MockObject\MockObject + * @var ContentTypeService|MockObject */ private $contentTypeService; /** - * @var \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\Routing\RouterInterface + * @var MockObject|RouterInterface */ private $router; /** - * @var \Ibexa\AdminUi\Form\Processor\ContentType\ContentTypeFormProcessor + * @var ContentTypeFormProcessor */ private $formProcessor; /** - * @var \Ibexa\Core\Helper\FieldsGroups\FieldsGroupsList|\PHPUnit\Framework\MockObject\MockObject + * @var FieldsGroupsList|MockObject */ private $groupsList; @@ -142,12 +143,12 @@ public function testAddFieldDefinition(): void $fieldTypeSelectionForm = $this->createMock(FormInterface::class); $fieldTypeSelectionForm - ->expects($this->once()) + ->expects(self::once()) ->method('getData') ->willReturn($fieldTypeIdentifier); $mainForm = $this->createMock(FormInterface::class); $mainForm - ->expects($this->once()) + ->expects(self::once()) ->method('get') ->with('fieldTypeSelection') ->willReturn($fieldTypeSelectionForm); @@ -159,7 +160,7 @@ public function testAddFieldDefinition(): void ->willReturn($languageCode); $mainForm - ->expects($this->once()) + ->expects(self::once()) ->method('getConfig') ->willReturn($formConfig); @@ -171,18 +172,18 @@ public function testAddFieldDefinition(): void 'fieldGroup' => 'content', ]); $this->contentTypeService - ->expects($this->once()) + ->expects(self::once()) ->method('loadContentTypeDraft') ->with($contentTypeDraft->id) ->willReturn($contentTypeDraft); $this->contentTypeService - ->expects($this->once()) + ->expects(self::once()) ->method('addFieldDefinition') - ->with($contentTypeDraft, $this->equalTo($expectedFieldDefCreateStruct)); + ->with($contentTypeDraft, self::equalTo($expectedFieldDefCreateStruct)); $this->groupsList - ->expects($this->once()) + ->expects(self::once()) ->method('getDefaultGroup') - ->will($this->returnValue('content')); + ->will(self::returnValue('content')); $event = new FormActionEvent( $mainForm, @@ -204,7 +205,7 @@ public function testPublishContentType(): void ['languageCode' => 'eng-GB'] ); $this->contentTypeService - ->expects($this->once()) + ->expects(self::once()) ->method('publishContentTypeDraft') ->with($contentTypeDraft); @@ -223,12 +224,12 @@ public function testPublishContentTypeWithRedirection(): void ['languageCode' => 'eng-GB'] ); $this->contentTypeService - ->expects($this->once()) + ->expects(self::once()) ->method('publishContentTypeDraft') ->with($contentTypeDraft); $this->router - ->expects($this->once()) + ->expects(self::once()) ->method('generate') ->with($redirectRoute) ->willReturn($redirectUrl); @@ -259,53 +260,53 @@ public function testRemoveFieldDefinition(): void $fieldDefForm1 = $this->createMock(FormInterface::class); $fieldDefSelected1 = $this->createMock(FormInterface::class); $fieldDefForm1 - ->expects($this->once()) + ->expects(self::once()) ->method('get') ->with('selected') ->willReturn($fieldDefSelected1); $fieldDefSelected1 - ->expects($this->once()) + ->expects(self::once()) ->method('getData') ->willReturn(false); $fieldDefForm1 - ->expects($this->never()) + ->expects(self::never()) ->method('getData'); $fieldDefForm2 = $this->createMock(FormInterface::class); $fieldDefSelected2 = $this->createMock(FormInterface::class); $fieldDefForm2 - ->expects($this->once()) + ->expects(self::once()) ->method('get') ->with('selected') ->willReturn($fieldDefSelected2); $fieldDefSelected2 - ->expects($this->once()) + ->expects(self::once()) ->method('getData') ->willReturn(true); $fieldDefForm2 - ->expects($this->once()) + ->expects(self::once()) ->method('getData') ->willReturn(new FieldDefinitionData(['fieldDefinition' => $fieldDefinition1])); $fieldDefForm3 = $this->createMock(FormInterface::class); $fieldDefSelected3 = $this->createMock(FormInterface::class); $fieldDefForm3 - ->expects($this->once()) + ->expects(self::once()) ->method('get') ->with('selected') ->willReturn($fieldDefSelected3); $fieldDefSelected3 - ->expects($this->once()) + ->expects(self::once()) ->method('getData') ->willReturn(true); $fieldDefForm3 - ->expects($this->once()) + ->expects(self::once()) ->method('getData') ->willReturn(new FieldDefinitionData(['fieldDefinition' => $fieldDefinition1])); $mainForm = $this->createMock(FormInterface::class); $mainForm - ->expects($this->once()) + ->expects(self::once()) ->method('get') ->with('fieldDefinitionsData') ->willReturn([$fieldDefForm1, $fieldDefForm2, $fieldDefForm3]); @@ -329,7 +330,7 @@ public function testRemoveContentTypeDraft(): void ['languageCode' => 'eng-GB'] ); $this->contentTypeService - ->expects($this->once()) + ->expects(self::once()) ->method('deleteContentType') ->with($contentTypeDraft); @@ -348,12 +349,12 @@ public function testRemoveContentTypeDraftWithRedirection(): void ['languageCode' => 'eng-GB'] ); $this->contentTypeService - ->expects($this->once()) + ->expects(self::once()) ->method('deleteContentType') ->with($contentTypeDraft); $this->router - ->expects($this->once()) + ->expects(self::once()) ->method('generate') ->with($redirectRoute) ->willReturn($redirectUrl); diff --git a/tests/lib/Form/Processor/PreviewFormProcessorTest.php b/tests/lib/Form/Processor/PreviewFormProcessorTest.php index c7f17cbf00..f9e407ef87 100644 --- a/tests/lib/Form/Processor/PreviewFormProcessorTest.php +++ b/tests/lib/Form/Processor/PreviewFormProcessorTest.php @@ -32,16 +32,16 @@ class PreviewFormProcessorTest extends TestCase { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ + /** @var ContentService */ private $contentService; - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ + /** @var UrlGeneratorInterface */ private $urlGenerator; - /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ + /** @var TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ + /** @var LocationService */ private $locationService; protected function setUp(): void @@ -53,12 +53,12 @@ protected function setUp(): void } /** - * @param \Ibexa\Contracts\Core\Repository\ContentService|null $contentService - * @param \Symfony\Component\Routing\Generator\UrlGeneratorInterface|null $urlGenerator - * @param \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface|null $notificationHandler - * @param \Ibexa\Contracts\Core\Repository\LocationService|null $locationService + * @param ContentService|null $contentService + * @param UrlGeneratorInterface|null $urlGenerator + * @param TranslatableNotificationHandlerInterface|null $notificationHandler + * @param LocationService|null $locationService * - * @return \Ibexa\AdminUi\Form\Processor\PreviewFormProcessor + * @return PreviewFormProcessor */ private function createPreviewFormProcessor( ?ContentService $contentService = null, @@ -102,7 +102,7 @@ public function testProcessPreview() $previewFormProcessor = $this->createPreviewFormProcessor($contentService, $urlGenerator, $this->notificationHandler); $previewFormProcessor->processPreview($event); - $this->assertEquals(new RedirectResponse($url), $event->getResponse()); + self::assertEquals(new RedirectResponse($url), $event->getResponse()); } public function testProcessPreviewHandleExceptionWithNew() @@ -127,8 +127,7 @@ public function testProcessPreviewHandleExceptionWithNew() $contentService ->expects(self::once()) ->method('createContent') - ->will($this->throwException(new class('Location not found') extends \Exception { - })); + ->will(self::throwException(new class('Location not found') extends \Exception {})); $urlGenerator = $this->generateUrlGeneratorForContentEditUrlMock($contentDraft, $languageCode, $url); @@ -136,14 +135,14 @@ public function testProcessPreviewHandleExceptionWithNew() $previewFormProcessor->processPreview($event); - $this->assertEquals(new RedirectResponse($url), $event->getResponse()); + self::assertEquals(new RedirectResponse($url), $event->getResponse()); } public function testSubscribedEvents() { $previewFormProcessor = $this->createPreviewFormProcessor(); - $this->assertSame([ContentEditEvents::CONTENT_PREVIEW => ['processPreview', 10]], $previewFormProcessor::getSubscribedEvents()); + self::assertSame([ContentEditEvents::CONTENT_PREVIEW => ['processPreview', 10]], $previewFormProcessor::getSubscribedEvents()); } /** @@ -151,10 +150,13 @@ public function testSubscribedEvents() * @param string $fieldDefinitionIdentifier * @param string $fieldDataValue * - * @return \Ibexa\ContentForms\Data\Content\ContentCreateData + * @return ContentCreateData */ - private function generateContentStruct(string $mainLanguageCode, string $fieldDefinitionIdentifier, string $fieldDataValue): ContentCreateData - { + private function generateContentStruct( + string $mainLanguageCode, + string $fieldDefinitionIdentifier, + string $fieldDataValue + ): ContentCreateData { $contentStruct = new ContentCreateData([ 'mainLanguageCode' => $mainLanguageCode, 'contentType' => new ContentType(['identifier' => 123]), @@ -171,13 +173,15 @@ private function generateContentStruct(string $mainLanguageCode, string $fieldDe } /** - * @param \Ibexa\ContentForms\Data\Content\ContentCreateData $contentStruct - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $contentDraft + * @param ContentCreateData $contentStruct + * @param APIContent $contentDraft * - * @return \PHPUnit\Framework\MockObject\MockObject + * @return MockObject */ - private function generateContentServiceMock(ContentCreateData $contentStruct, APIContent $contentDraft): MockObject - { + private function generateContentServiceMock( + ContentCreateData $contentStruct, + APIContent $contentDraft + ): MockObject { $contentService = $this->createMock(ContentService::class); $contentService ->expects(self::once()) @@ -189,7 +193,7 @@ private function generateContentServiceMock(ContentCreateData $contentStruct, AP } /** - * @return \PHPUnit\Framework\MockObject\MockObject + * @return MockObject */ private function generateConfigMock($languageCode): MockObject { @@ -206,7 +210,7 @@ private function generateConfigMock($languageCode): MockObject /** * @param $config * - * @return \Symfony\Component\Form\FormInterface|\PHPUnit\Framework\MockObject\MockObject + * @return FormInterface|MockObject */ private function generateFormMock($config): MockObject { @@ -220,12 +224,12 @@ private function generateFormMock($config): MockObject } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $contentDraft + * @param APIContent $contentDraft * @param string $languageCode * @param string $url * @param int|null $locationId * - * @return \PHPUnit\Framework\MockObject\MockObject + * @return MockObject */ private function generateUrlGeneratorMock( APIContent $contentDraft, @@ -248,14 +252,17 @@ private function generateUrlGeneratorMock( } /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $contentDraft + * @param APIContent $contentDraft * @param string $languageCode * @param string $url * - * @return \PHPUnit\Framework\MockObject\MockObject + * @return MockObject */ - private function generateUrlGeneratorForContentEditUrlMock(APIContent $contentDraft, string $languageCode, string $url): MockObject - { + private function generateUrlGeneratorForContentEditUrlMock( + APIContent $contentDraft, + string $languageCode, + string $url + ): MockObject { $urlGenerator = $this->createMock(UrlGeneratorInterface::class); $urlGenerator ->expects(self::once()) @@ -274,10 +281,13 @@ private function generateUrlGeneratorForContentEditUrlMock(APIContent $contentDr * @param $contentDraftId * @param $languageCode * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Content + * @return APIContent */ - private function generateContentDraft($contentDraftId, $languageCode, $mainLocationId): APIContent - { + private function generateContentDraft( + $contentDraftId, + $languageCode, + $mainLocationId + ): APIContent { $contentDraft = new Content([ 'versionInfo' => new VersionInfo( [ diff --git a/tests/lib/Form/Type/Extension/EventSubscriber/ModifyFieldDefinitionFieldsSubscriberTest.php b/tests/lib/Form/Type/Extension/EventSubscriber/ModifyFieldDefinitionFieldsSubscriberTest.php index 31992c9aba..c94ee10e9c 100644 --- a/tests/lib/Form/Type/Extension/EventSubscriber/ModifyFieldDefinitionFieldsSubscriberTest.php +++ b/tests/lib/Form/Type/Extension/EventSubscriber/ModifyFieldDefinitionFieldsSubscriberTest.php @@ -14,6 +14,7 @@ use Ibexa\AdminUi\Form\Type\FieldDefinition\FieldDefinitionType; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeDraft; use Ibexa\Core\Repository\Values\ContentType\FieldDefinition; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvent; @@ -34,7 +35,7 @@ final class ModifyFieldDefinitionFieldsSubscriberTest extends TestCase private ModifyFieldDefinitionFieldsSubscriber $modifyFieldDefinitionFieldsSubscriber; - /** @var \Symfony\Component\Form\FormInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var FormInterface|MockObject */ private FormInterface $form; private FormBuilderInterface $formBuilder; @@ -157,8 +158,10 @@ private function mockFormRemove(string $identifier): void /** * @param array $options */ - private function mockFormAdd(string $identifier, array $options): void - { + private function mockFormAdd( + string $identifier, + array $options + ): void { $this->form ->expects(self::once()) ->method('add') diff --git a/tests/lib/Limitation/LimitationValueMapperRegistryTest.php b/tests/lib/Limitation/LimitationValueMapperRegistryTest.php index 8194dfc66f..561e82e3cd 100644 --- a/tests/lib/Limitation/LimitationValueMapperRegistryTest.php +++ b/tests/lib/Limitation/LimitationValueMapperRegistryTest.php @@ -26,9 +26,9 @@ public function testGetMappers() $result = $registry->getMappers(); - $this->assertCount(2, $result); - $this->assertContains($foo, $result); - $this->assertContains($bar, $result); + self::assertCount(2, $result); + self::assertContains($foo, $result); + self::assertContains($bar, $result); } public function testGetMapper() @@ -39,7 +39,7 @@ public function testGetMapper() 'foo' => $foo, ]); - $this->assertEquals($foo, $registry->getMapper('foo')); + self::assertEquals($foo, $registry->getMapper('foo')); } public function testGetNonExistingMapper() @@ -60,7 +60,7 @@ public function testAddMapper() $registry = new LimitationValueMapperRegistry(); $registry->addMapper($foo, 'foo'); - $this->assertTrue($registry->hasMapper('foo')); + self::assertTrue($registry->hasMapper('foo')); } public function testHasMapper() @@ -69,8 +69,8 @@ public function testHasMapper() 'foo' => $this->createMock(LimitationValueMapperInterface::class), ]); - $this->assertTrue($registry->hasMapper('foo')); - $this->assertFalse($registry->hasMapper('bar')); + self::assertTrue($registry->hasMapper('foo')); + self::assertFalse($registry->hasMapper('bar')); } } diff --git a/tests/lib/Limitation/Mapper/ContentTypeLimitationMapperTest.php b/tests/lib/Limitation/Mapper/ContentTypeLimitationMapperTest.php index 195975f301..61c742aaa1 100644 --- a/tests/lib/Limitation/Mapper/ContentTypeLimitationMapperTest.php +++ b/tests/lib/Limitation/Mapper/ContentTypeLimitationMapperTest.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ContentTypeLimitation; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -21,13 +22,13 @@ class ContentTypeLimitationMapperTest extends TestCase private const EXAMPLE_CONTENT_TYPE_ID_B = 2; private const EXAMPLE_CONTENT_TYPE_ID_C = 3; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ContentTypeService|MockObject */ private $contentTypeService; - /** @var \Psr\Log\LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var LoggerInterface|MockObject */ private $logger; - /** @var \Ibexa\AdminUi\Limitation\Mapper\ContentTypeLimitationMapper */ + /** @var ContentTypeLimitationMapper */ private $mapper; protected function setUp(): void @@ -55,7 +56,7 @@ public function testMapLimitationValue() foreach ($values as $i => $value) { $this->contentTypeService - ->expects($this->at($i)) + ->expects(self::at($i)) ->method('loadContentType') ->with($value) ->willReturn($expected[$i]); @@ -65,20 +66,20 @@ public function testMapLimitationValue() 'limitationValues' => $values, ])); - $this->assertEquals($expected, $result); - $this->assertCount(3, $result); + self::assertEquals($expected, $result); + self::assertCount(3, $result); } public function testMapLimitationValueWithNotExistingContentType() { $this->contentTypeService - ->expects($this->once()) + ->expects(self::once()) ->method('loadContentType') ->with(self::EXAMPLE_CONTENT_TYPE_ID_A) ->willThrowException($this->createMock(NotFoundException::class)); $this->logger - ->expects($this->once()) + ->expects(self::once()) ->method('error') ->with('Could not map the Limitation value: could not find a content type with ID ' . self::EXAMPLE_CONTENT_TYPE_ID_A); @@ -86,7 +87,7 @@ public function testMapLimitationValueWithNotExistingContentType() 'limitationValues' => [self::EXAMPLE_CONTENT_TYPE_ID_A], ])); - $this->assertEmpty($actual); + self::assertEmpty($actual); } } diff --git a/tests/lib/Limitation/Mapper/GroupLimitationMapperTest.php b/tests/lib/Limitation/Mapper/GroupLimitationMapperTest.php index ca85bd9fd1..87f1355e3f 100644 --- a/tests/lib/Limitation/Mapper/GroupLimitationMapperTest.php +++ b/tests/lib/Limitation/Mapper/GroupLimitationMapperTest.php @@ -20,7 +20,7 @@ public function testMapLimitationValue() $translatorMock = $this->createMock(TranslatorInterface::class); $translatorMock - ->expects($this->once()) + ->expects(self::once()) ->method('trans') ->willReturnArgument(0); @@ -29,7 +29,7 @@ public function testMapLimitationValue() 'limitationValues' => [1], ])); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } } diff --git a/tests/lib/Limitation/Mapper/LanguageTypeLimitationMapperTest.php b/tests/lib/Limitation/Mapper/LanguageTypeLimitationMapperTest.php index b38036af7e..9f65103608 100644 --- a/tests/lib/Limitation/Mapper/LanguageTypeLimitationMapperTest.php +++ b/tests/lib/Limitation/Mapper/LanguageTypeLimitationMapperTest.php @@ -12,18 +12,19 @@ use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\LanguageLimitation; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; class LanguageTypeLimitationMapperTest extends TestCase { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var LanguageService|MockObject */ private $languageService; - /** @var \Psr\Log\LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var LoggerInterface|MockObject */ private $logger; - /** @var \Ibexa\AdminUi\Limitation\Mapper\LanguageLimitationMapper */ + /** @var LanguageLimitationMapper */ private $mapper; protected function setUp(): void @@ -47,7 +48,7 @@ public function testMapLimitationValue() foreach ($values as $i => $value) { $this->languageService - ->expects($this->at($i)) + ->expects(self::at($i)) ->method('loadLanguage') ->with($value) ->willReturn($expected[$i]); @@ -57,7 +58,7 @@ public function testMapLimitationValue() 'limitationValues' => $values, ])); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } public function testMapLimitationValueWithNotExistingContentType() @@ -65,13 +66,13 @@ public function testMapLimitationValueWithNotExistingContentType() $values = ['foo']; $this->languageService - ->expects($this->once()) + ->expects(self::once()) ->method('loadLanguage') ->with($values[0]) ->willThrowException($this->createMock(NotFoundException::class)); $this->logger - ->expects($this->once()) + ->expects(self::once()) ->method('error') ->with('Could not map the Limitation value: could not find a language with code foo'); @@ -79,7 +80,7 @@ public function testMapLimitationValueWithNotExistingContentType() 'limitationValues' => $values, ])); - $this->assertEmpty($actual); + self::assertEmpty($actual); } } diff --git a/tests/lib/Limitation/Mapper/NullLimitationMapperTest.php b/tests/lib/Limitation/Mapper/NullLimitationMapperTest.php index 78c77fec83..3bb05cd27a 100644 --- a/tests/lib/Limitation/Mapper/NullLimitationMapperTest.php +++ b/tests/lib/Limitation/Mapper/NullLimitationMapperTest.php @@ -25,7 +25,7 @@ public function testMapLimitationValue() $mapper = new NullLimitationMapper(null); $result = $mapper->mapLimitationValue($limitation); - $this->assertEquals($values, $result); + self::assertEquals($values, $result); } } diff --git a/tests/lib/Limitation/Mapper/ObjectStateLimitationMapperTest.php b/tests/lib/Limitation/Mapper/ObjectStateLimitationMapperTest.php index b4eacf5f91..6f6b0ec3bb 100644 --- a/tests/lib/Limitation/Mapper/ObjectStateLimitationMapperTest.php +++ b/tests/lib/Limitation/Mapper/ObjectStateLimitationMapperTest.php @@ -13,6 +13,7 @@ use Ibexa\Contracts\Core\Repository\Values\ObjectState\ObjectStateGroup; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ObjectStateLimitation; use Ibexa\Core\Repository\Values\ObjectState\ObjectState; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -22,13 +23,13 @@ class ObjectStateLimitationMapperTest extends TestCase private const EXAMPLE_OBJECT_STATE_ID_B = 2; private const EXAMPLE_OBJECT_STATE_ID_C = 3; - /** @var \Ibexa\Contracts\Core\Repository\ObjectStateService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ObjectStateService|MockObject */ private $objectStateService; - /** @var \Psr\Log\LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var LoggerInterface|MockObject */ private $logger; - /** @var \Ibexa\AdminUi\Limitation\Mapper\ObjectStateLimitationMapper */ + /** @var ObjectStateLimitationMapper */ private $mapper; protected function setUp(): void @@ -56,7 +57,7 @@ public function testMapLimitationValue() foreach ($values as $i => $value) { $this->objectStateService - ->expects($this->at($i)) + ->expects(self::at($i)) ->method('loadObjectState') ->with($value) ->willReturn($expected[$i]); @@ -66,7 +67,7 @@ public function testMapLimitationValue() 'limitationValues' => $values, ])); - $this->assertEquals([ + self::assertEquals([ 'foo:foo', 'bar:bar', 'baz:baz', ], $result); } @@ -74,13 +75,13 @@ public function testMapLimitationValue() public function testMapLimitationValueWithNotExistingObjectState() { $this->objectStateService - ->expects($this->once()) + ->expects(self::once()) ->method('loadObjectState') ->with(self::EXAMPLE_OBJECT_STATE_ID_A) ->willThrowException($this->createMock(NotFoundException::class)); $this->logger - ->expects($this->once()) + ->expects(self::once()) ->method('error') ->with('Could not map the Limitation value: could not find an Object state with ID ' . self::EXAMPLE_OBJECT_STATE_ID_A); @@ -88,25 +89,25 @@ public function testMapLimitationValueWithNotExistingObjectState() 'limitationValues' => [self::EXAMPLE_OBJECT_STATE_ID_A], ])); - $this->assertEmpty($actual); + self::assertEmpty($actual); } private function createStateMock($value) { $stateGroupMock = $this->createMock(ObjectStateGroup::class); $stateGroupMock - ->expects($this->once()) + ->expects(self::once()) ->method('getName') ->willReturn($value); $stateMock = $this->createMock(ObjectState::class); $stateMock - ->expects($this->any()) + ->expects(self::any()) ->method('getObjectStateGroup') ->willReturn($stateGroupMock); $stateMock - ->expects($this->any()) + ->expects(self::any()) ->method('getName') ->willReturn($value); diff --git a/tests/lib/Limitation/Mapper/OwnerLimitationMapperTest.php b/tests/lib/Limitation/Mapper/OwnerLimitationMapperTest.php index 8b61c29077..c0259fe283 100644 --- a/tests/lib/Limitation/Mapper/OwnerLimitationMapperTest.php +++ b/tests/lib/Limitation/Mapper/OwnerLimitationMapperTest.php @@ -20,7 +20,7 @@ public function testMapLimitationValue() $translatorMock = $this->createMock(TranslatorInterface::class); $translatorMock - ->expects($this->once()) + ->expects(self::once()) ->method('trans') ->willReturnArgument(0); @@ -29,7 +29,7 @@ public function testMapLimitationValue() 'limitationValues' => [1], ])); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } } diff --git a/tests/lib/Limitation/Mapper/ParentDepthLimitationMapperTest.php b/tests/lib/Limitation/Mapper/ParentDepthLimitationMapperTest.php index 21796c5c6e..69a1d8147c 100644 --- a/tests/lib/Limitation/Mapper/ParentDepthLimitationMapperTest.php +++ b/tests/lib/Limitation/Mapper/ParentDepthLimitationMapperTest.php @@ -20,7 +20,7 @@ public function testMapLimitationValue() 'limitationValues' => [256], ])); - $this->assertEquals([256], $result); + self::assertEquals([256], $result); } } diff --git a/tests/lib/Limitation/Mapper/SectionLimitationMapperTest.php b/tests/lib/Limitation/Mapper/SectionLimitationMapperTest.php index 7efc77799a..ef13dabc15 100644 --- a/tests/lib/Limitation/Mapper/SectionLimitationMapperTest.php +++ b/tests/lib/Limitation/Mapper/SectionLimitationMapperTest.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Repository\SectionService; use Ibexa\Contracts\Core\Repository\Values\Content\Section; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\SectionLimitation; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -19,13 +20,13 @@ class SectionLimitationMapperTest extends TestCase { private const EXAMPLE_SECTION_ID = 0xFF; - /** @var \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\Repository\SectionService */ + /** @var MockObject|SectionService */ private $sectionServiceMock; - /** @var \Psr\Log\LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var LoggerInterface|MockObject */ private $logger; - /** @var \Ibexa\AdminUi\Limitation\Mapper\SectionLimitationMapper */ + /** @var SectionLimitationMapper */ private $mapper; protected function setUp(): void @@ -48,7 +49,7 @@ public function testMapLimitationValue() ]); $this->sectionServiceMock - ->expects($this->at($i)) + ->expects(self::at($i)) ->method('loadSection') ->with($value) ->willReturn($expected[$i]); @@ -58,7 +59,7 @@ public function testMapLimitationValue() 'limitationValues' => $values, ])); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } public function testMapLimitationValueWithNotExistingContentType() @@ -66,13 +67,13 @@ public function testMapLimitationValueWithNotExistingContentType() $values = [self::EXAMPLE_SECTION_ID]; $this->sectionServiceMock - ->expects($this->once()) + ->expects(self::once()) ->method('loadSection') ->with($values[0]) ->willThrowException($this->createMock(NotFoundException::class)); $this->logger - ->expects($this->once()) + ->expects(self::once()) ->method('error') ->with('Could not map the Limitation value: could not find a Section with ID ' . $values[0]); @@ -80,7 +81,7 @@ public function testMapLimitationValueWithNotExistingContentType() 'limitationValues' => $values, ])); - $this->assertEmpty($actual); + self::assertEmpty($actual); } } diff --git a/tests/lib/Limitation/Mapper/SubtreeLimitationMapperTest.php b/tests/lib/Limitation/Mapper/SubtreeLimitationMapperTest.php index 22872f266c..bb673169f2 100644 --- a/tests/lib/Limitation/Mapper/SubtreeLimitationMapperTest.php +++ b/tests/lib/Limitation/Mapper/SubtreeLimitationMapperTest.php @@ -57,7 +57,7 @@ public function testMapLimitationValue() ]); $searchServiceMock - ->expects($this->at($i)) + ->expects(self::at($i)) ->method('findLocations') ->with($query) ->willReturn($this->createSearchResultsMock($expected[$i])); @@ -73,7 +73,7 @@ public function testMapLimitationValue() 'limitationValues' => $values, ])); - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } private function createSearchResultsMock($expected) @@ -82,7 +82,7 @@ private function createSearchResultsMock($expected) foreach ($expected as $contentInfo) { $locationMock = $this->createMock(Location::class); $locationMock - ->expects($this->atLeastOnce()) + ->expects(self::atLeastOnce()) ->method('getContentInfo') ->willReturn($contentInfo); diff --git a/tests/lib/Limitation/Mapper/UDWBasedMapperTest.php b/tests/lib/Limitation/Mapper/UDWBasedMapperTest.php index 806de76c74..d7c60deec0 100644 --- a/tests/lib/Limitation/Mapper/UDWBasedMapperTest.php +++ b/tests/lib/Limitation/Mapper/UDWBasedMapperTest.php @@ -56,7 +56,7 @@ public function testMapLimitationValue(): void ]); $locationServiceMock - ->expects($this->at($i)) + ->expects(self::at($i)) ->method('loadLocation') ->with($id) ->willReturn($location); diff --git a/tests/lib/Menu/Action/BaseActionMenuBuilderTest.php b/tests/lib/Menu/Action/BaseActionMenuBuilderTest.php index 1aa55ce042..7e2676736f 100644 --- a/tests/lib/Menu/Action/BaseActionMenuBuilderTest.php +++ b/tests/lib/Menu/Action/BaseActionMenuBuilderTest.php @@ -22,6 +22,7 @@ use Ibexa\Core\Repository\Values\User\User; use Knp\Menu\ItemInterface; use Knp\Menu\MenuFactory; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; @@ -47,19 +48,19 @@ abstract class BaseActionMenuBuilderTest extends TestCase protected MenuItemFactoryInterface $menuItemFactory; - /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface&\PHPUnit\Framework\MockObject\MockObject */ + /** @var EventDispatcherInterface&MockObject */ protected EventDispatcherInterface $eventDispatcher; - /** @var \Ibexa\Contracts\Core\Repository\ContentService&\PHPUnit\Framework\MockObject\MockObject */ + /** @var ContentService&MockObject */ protected ContentService $contentService; - /** @var \Symfony\Contracts\Translation\TranslatorInterface&\PHPUnit\Framework\MockObject\MockObject */ + /** @var TranslatorInterface&MockObject */ protected TranslatorInterface $translator; - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface&\PHPUnit\Framework\MockObject\MockObject */ + /** @var UrlGeneratorInterface&MockObject */ protected UrlGeneratorInterface $urlGenerator; - /** @var \Ibexa\Contracts\Core\Repository\UserService&\PHPUnit\Framework\MockObject\MockObject */ + /** @var UserService&MockObject */ protected UserService $userService; protected function setUp(): void @@ -119,7 +120,10 @@ protected function mockUrlGeneratorGenerate(): void $this->urlGenerator ->method('generate') ->willReturnCallback( - function (string $routeName, array $parameters): ?string { + function ( + string $routeName, + array $parameters + ): ?string { if ($routeName === self::ROUTE_VERSION_HAS_NO_CONFLICT) { return $this->getUrl('/version/has-no-conflict/%d/%d/%s', $parameters); } diff --git a/tests/lib/Menu/MainMenuBuilerTest.php b/tests/lib/Menu/MainMenuBuilerTest.php index 11ce990448..6b8941a573 100644 --- a/tests/lib/Menu/MainMenuBuilerTest.php +++ b/tests/lib/Menu/MainMenuBuilerTest.php @@ -18,6 +18,7 @@ use Ibexa\User\UserSetting\UserSettingService; use Knp\Menu\FactoryInterface; use Knp\Menu\MenuItem; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\TestBrowserToken; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -25,22 +26,22 @@ class MainMenuBuilerTest extends TestCase { - /** @var \Ibexa\Contracts\AdminUi\Menu\MenuItemFactoryInterface */ + /** @var MenuItemFactoryInterface */ private $factory; - /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ + /** @var EventDispatcherInterface */ private $eventDispatcher; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ + /** @var PermissionResolver */ private $permissionResolver; - /** @var \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface */ + /** @var TokenStorageInterface */ private $tokenStorage; - /** @var \Ibexa\User\UserSetting\UserSettingService&\PHPUnit\Framework\MockObject\MockObject */ + /** @var UserSettingService&MockObject */ private UserSettingService $userSettingService; protected function setUp(): void @@ -217,10 +218,10 @@ public function testCreateMenuForUserWithoutAdministratePolicy() private function assertMenuHasAllItems(array $menu): void { - $this->assertArrayHasKey(MainMenuBuilder::ITEM_CONTENT, $menu); - $this->assertArrayHasKey(MainMenuBuilder::ITEM_ADMIN, $menu); - $this->assertArrayHasKey(MainMenuBuilder::ITEM_BOOKMARKS, $menu); - $this->assertArrayHasKey(MainMenuBuilder::ITEM_TRASH, $menu); + self::assertArrayHasKey(MainMenuBuilder::ITEM_CONTENT, $menu); + self::assertArrayHasKey(MainMenuBuilder::ITEM_ADMIN, $menu); + self::assertArrayHasKey(MainMenuBuilder::ITEM_BOOKMARKS, $menu); + self::assertArrayHasKey(MainMenuBuilder::ITEM_TRASH, $menu); } } diff --git a/tests/lib/Menu/ReorderByOrderNumberListenerTest.php b/tests/lib/Menu/ReorderByOrderNumberListenerTest.php index 0923854729..e3db420a28 100644 --- a/tests/lib/Menu/ReorderByOrderNumberListenerTest.php +++ b/tests/lib/Menu/ReorderByOrderNumberListenerTest.php @@ -45,7 +45,7 @@ public function testUnorderedMenuListUntouched(): void 'fifth', ]; - $this->assertEquals($expected, $this->getChildrenNames($menu)); + self::assertEquals($expected, $this->getChildrenNames($menu)); } public function testOrderedMenuList(): void @@ -76,7 +76,7 @@ public function testOrderedMenuList(): void 'first', ]; - $this->assertEquals($expected, $this->getChildrenNames($menu)); + self::assertEquals($expected, $this->getChildrenNames($menu)); } public function testSameOrderMenuListUntouched(): void @@ -107,7 +107,7 @@ public function testSameOrderMenuListUntouched(): void 'fifth', ]; - $this->assertEquals($expected, $this->getChildrenNames($menu)); + self::assertEquals($expected, $this->getChildrenNames($menu)); } public function testAppendUnorderedMenuListAtTheEnd(): void @@ -142,7 +142,7 @@ public function testAppendUnorderedMenuListAtTheEnd(): void 'another', ]; - $this->assertEquals($expected, $this->getChildrenNames($menu)); + self::assertEquals($expected, $this->getChildrenNames($menu)); } public function testNestedOrderedMenuList(): void @@ -189,15 +189,15 @@ public function testNestedOrderedMenuList(): void 'unordered_child', ]; - $this->assertEquals($expected, $this->getChildrenNames($menu)); - $this->assertEquals($expectedNested, $this->getChildrenNames($menu->getChild('another'))); + self::assertEquals($expected, $this->getChildrenNames($menu)); + self::assertEquals($expectedNested, $this->getChildrenNames($menu->getChild('another'))); } private function getConfigureMenuEventMock(ItemInterface $menu): ConfigureMenuEvent { $mock = $this->createMock(ConfigureMenuEvent::class); $mock - ->expects($this->any()) + ->expects(self::any()) ->method('getMenu') ->willReturn($menu); diff --git a/tests/lib/Pagination/Pagerfanta/TrashItemAdapterTest.php b/tests/lib/Pagination/Pagerfanta/TrashItemAdapterTest.php index 211a22e2df..546216ca9f 100644 --- a/tests/lib/Pagination/Pagerfanta/TrashItemAdapterTest.php +++ b/tests/lib/Pagination/Pagerfanta/TrashItemAdapterTest.php @@ -14,12 +14,13 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Query\SortClause; use Ibexa\Contracts\Core\Repository\Values\Content\Trash\SearchResult; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class TrashItemAdapterTest extends TestCase { /** - * @var \Ibexa\Contracts\Core\Repository\TrashService|\PHPUnit\Framework\MockObject\MockObject + * @var TrashService|MockObject */ protected $trashService; @@ -32,13 +33,15 @@ protected function setUp(): void /** * Returns the adapter to test. * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Query $query - * @param \Ibexa\Contracts\Core\Repository\TrashService $trashService + * @param Query $query + * @param TrashService $trashService * - * @return \Ibexa\AdminUi\Pagination\Pagerfanta\TrashItemAdapter + * @return TrashItemAdapter */ - protected function getAdapter(Query $query, TrashService $trashService): TrashItemAdapter - { + protected function getAdapter( + Query $query, + TrashService $trashService + ): TrashItemAdapter { return new TrashItemAdapter($query, $trashService); } @@ -57,16 +60,16 @@ public function testGetNbResults() $searchResult = new SearchResult(['count' => $nbResults]); $this->trashService - ->expects($this->once()) + ->expects(self::once()) ->method('findTrashItems') - ->with($this->equalTo($countQuery)) + ->with(self::equalTo($countQuery)) ->willReturn($searchResult); $adapter = $this->getAdapter($query, $this->trashService); - $this->assertSame($nbResults, $adapter->getNbResults()); + self::assertSame($nbResults, $adapter->getNbResults()); // Running a 2nd time to ensure SearchService::findContent() is called only once. - $this->assertSame($nbResults, $adapter->getNbResults()); + self::assertSame($nbResults, $adapter->getNbResults()); } public function testGetSlice() @@ -97,17 +100,17 @@ public function testGetSlice() $searchResult = new SearchResult(['items' => $items, 'count' => $nbResults]); $this->trashService - ->expects($this->once()) + ->expects(self::once()) ->method('findTrashItems') - ->with($this->equalTo($searchQuery)) + ->with(self::equalTo($searchQuery)) ->willReturn($searchResult); $adapter = $this->getAdapter($query, $this->trashService); - $this->assertSame($items, $adapter->getSlice($offset, $limit)); - $this->assertSame($nbResults, $adapter->getNbResults()); + self::assertSame($items, $adapter->getSlice($offset, $limit)); + self::assertSame($nbResults, $adapter->getNbResults()); // Running a 2nd time to ensure SearchService::findContent() is called only once. - $this->assertSame($nbResults, $adapter->getNbResults()); + self::assertSame($nbResults, $adapter->getNbResults()); } } diff --git a/tests/lib/Pagination/Pagerfanta/URLSearchAdapterTest.php b/tests/lib/Pagination/Pagerfanta/URLSearchAdapterTest.php index f607eb31f2..cd68af3302 100644 --- a/tests/lib/Pagination/Pagerfanta/URLSearchAdapterTest.php +++ b/tests/lib/Pagination/Pagerfanta/URLSearchAdapterTest.php @@ -14,11 +14,12 @@ use Ibexa\Contracts\Core\Repository\Values\URL\SearchResult; use Ibexa\Contracts\Core\Repository\Values\URL\URL; use Ibexa\Contracts\Core\Repository\Values\URL\URLQuery; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class URLSearchAdapterTest extends TestCase { - /** @var \Ibexa\Contracts\Core\Repository\URLService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var URLService|MockObject */ private $urlService; protected function setUp(): void @@ -36,7 +37,7 @@ public function testGetNbResults() ]); $this->urlService - ->expects($this->once()) + ->expects(self::once()) ->method('findUrls') ->willReturnCallback(function (URLQuery $q) use ($query, $searchResults) { $this->assertEquals($query->filter, $q->filter); @@ -49,7 +50,7 @@ public function testGetNbResults() $adapter = new URLSearchAdapter($query, $this->urlService); - $this->assertEquals($searchResults->totalCount, $adapter->getNbResults()); + self::assertEquals($searchResults->totalCount, $adapter->getNbResults()); } public function testGetSlice() @@ -68,7 +69,7 @@ public function testGetSlice() ]); $this->urlService - ->expects($this->once()) + ->expects(self::once()) ->method('findUrls') ->willReturnCallback(function (URLQuery $q) use ($query, $limit, $offset, $searchResults) { $this->assertEquals($query->filter, $q->filter); @@ -81,7 +82,7 @@ public function testGetSlice() $adapter = new URLSearchAdapter($query, $this->urlService); - $this->assertEquals($searchResults->items, $adapter->getSlice($offset, $limit)); + self::assertEquals($searchResults->items, $adapter->getSlice($offset, $limit)); } private function createURLQuery() diff --git a/tests/lib/Pagination/Pagerfanta/URLUsagesAdapterTest.php b/tests/lib/Pagination/Pagerfanta/URLUsagesAdapterTest.php index ce3ac2c5de..8936842926 100644 --- a/tests/lib/Pagination/Pagerfanta/URLUsagesAdapterTest.php +++ b/tests/lib/Pagination/Pagerfanta/URLUsagesAdapterTest.php @@ -12,11 +12,12 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit; use Ibexa\Contracts\Core\Repository\Values\URL\URL; use Ibexa\Contracts\Core\Repository\Values\URL\UsageSearchResult; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class URLUsagesAdapterTest extends TestCase { - /** @var \Ibexa\Contracts\Core\Repository\URLService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var URLService|MockObject */ private $urlService; protected function setUp(): void @@ -34,14 +35,14 @@ public function testGetNbResults() ]); $this->urlService - ->expects($this->once()) + ->expects(self::once()) ->method('findUsages') ->with($url, 0, 0) ->willReturn($searchResults); $adapter = new URLUsagesAdapter($url, $this->urlService); - $this->assertEquals( + self::assertEquals( $searchResults->totalCount, $adapter->getNbResults() ); @@ -63,14 +64,14 @@ public function testGetSlice() ]); $this->urlService - ->expects($this->once()) + ->expects(self::once()) ->method('findUsages') ->with($url, $offset, $limit) ->willReturn($searchResults); $adapter = new URLUsagesAdapter($url, $this->urlService); - $this->assertEquals( + self::assertEquals( $searchResults->items, $adapter->getSlice($offset, $limit) ); diff --git a/tests/lib/Pagination/Pagerfanta/URLWildcardAdapterTest.php b/tests/lib/Pagination/Pagerfanta/URLWildcardAdapterTest.php index 880e37f4c6..3e000037d6 100644 --- a/tests/lib/Pagination/Pagerfanta/URLWildcardAdapterTest.php +++ b/tests/lib/Pagination/Pagerfanta/URLWildcardAdapterTest.php @@ -14,11 +14,12 @@ use Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard\Query\SortClause; use Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard\SearchResult; use Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard\URLWildcardQuery; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; final class URLWildcardAdapterTest extends TestCase { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard|\PHPUnit\Framework\MockObject\MockObject */ + /** @var URLWildcard|MockObject */ private $urlWildcardService; protected function setUp(): void @@ -36,7 +37,7 @@ public function testGetNbResults(): void ]); $this->urlWildcardService - ->expects($this->once()) + ->expects(self::once()) ->method('findUrlWildcards') ->willReturnCallback(function (URLWildcardQuery $q) use ($query, $searchResults) { $this->assertEquals($query->filter, $q->filter); @@ -49,7 +50,7 @@ public function testGetNbResults(): void $adapter = new URLWildcardAdapter($query, $this->urlWildcardService); - $this->assertEquals($searchResults->totalCount, $adapter->getNbResults()); + self::assertEquals($searchResults->totalCount, $adapter->getNbResults()); } public function testGetSlice(): void @@ -64,7 +65,7 @@ public function testGetSlice(): void ]); $this->urlWildcardService - ->expects($this->once()) + ->expects(self::once()) ->method('findUrlWildcards') ->willReturnCallback(function (URLWildcardQuery $q) use ($query, $limit, $offset, $searchResults) { $this->assertEquals($query->filter, $q->filter); @@ -77,11 +78,11 @@ public function testGetSlice(): void $adapter = new URLWildcardAdapter($query, $this->urlWildcardService); - $this->assertEquals($searchResults->items, $adapter->getSlice($offset, $limit)); + self::assertEquals($searchResults->items, $adapter->getSlice($offset, $limit)); } /** - * @return \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard[] + * @return URLWildcard[] */ public function urlWildcards(): array { diff --git a/tests/lib/Permission/LimitationResolverTest.php b/tests/lib/Permission/LimitationResolverTest.php index 084046f6d1..f9919bc1ae 100644 --- a/tests/lib/Permission/LimitationResolverTest.php +++ b/tests/lib/Permission/LimitationResolverTest.php @@ -24,6 +24,7 @@ use Ibexa\Contracts\Core\Repository\Values\User\LookupLimitationResult; use Ibexa\Contracts\Core\Repository\Values\User\LookupPolicyLimitations; use Ibexa\Contracts\Core\Repository\Values\User\Policy; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -31,7 +32,7 @@ */ final class LimitationResolverTest extends TestCase { - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver&\PHPUnit\Framework\MockObject\MockObject */ + /** @var PermissionResolver&MockObject */ private PermissionResolver $permissionResolver; private LimitationResolverInterface $limitationResolver; @@ -58,7 +59,7 @@ protected function setUp(): void * name: string, * hasAccess: bool, * }> $expected - * @param iterable<\Ibexa\Contracts\Core\Repository\Values\Content\Language> $languages + * @param iterable $languages */ public function testGetLanguageLimitations( array $expected, diff --git a/tests/lib/Permission/LookupLimitationsTransformerTest.php b/tests/lib/Permission/LookupLimitationsTransformerTest.php index 4c515785cc..b40e37324f 100644 --- a/tests/lib/Permission/LookupLimitationsTransformerTest.php +++ b/tests/lib/Permission/LookupLimitationsTransformerTest.php @@ -35,7 +35,7 @@ public function testGetFlattenedLimitationsValues(): void $flattenedLimitationsValues = (new LookupLimitationsTransformer())->getFlattenedLimitationsValues($lookupLimitations); - $this->assertEqualsCanonicalizing([1, 2, 3], $flattenedLimitationsValues, ''); + self::assertEqualsCanonicalizing([1, 2, 3], $flattenedLimitationsValues, ''); } public function testGetGroupedLimitationValues(): void @@ -67,7 +67,7 @@ public function testGetGroupedLimitationValues(): void Limitation::CONTENTTYPE => [4], ]; - $this->assertEquals($expected, $flattenedLimitationsValues); + self::assertEquals($expected, $flattenedLimitationsValues); } public function testGetGroupedLimitationValuesThrowException(): void diff --git a/tests/lib/Permission/PermissionCheckerTest.php b/tests/lib/Permission/PermissionCheckerTest.php index 57e6328be2..2626829d1f 100644 --- a/tests/lib/Permission/PermissionCheckerTest.php +++ b/tests/lib/Permission/PermissionCheckerTest.php @@ -18,22 +18,23 @@ use Ibexa\Core\Repository\Values\Content as CoreContent; use Ibexa\Core\Repository\Values\User\Policy; use Ibexa\Core\Repository\Values\User\User as CoreUser; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class PermissionCheckerTest extends TestCase { private const USER_ID = 14; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver&\PHPUnit\Framework\MockObject\MockObject */ + /** @var PermissionResolver&MockObject */ private $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\UserService&\PHPUnit\Framework\MockObject\MockObject */ + /** @var UserService&MockObject */ private $userService; - /** @var \Ibexa\AdminUi\Permission\LimitationResolverInterface&\PHPUnit\Framework\MockObject\MockObject */ + /** @var LimitationResolverInterface&MockObject */ private LimitationResolverInterface $permissionLimitationResolver; - /** @var \Ibexa\AdminUi\Permission\PermissionChecker */ + /** @var PermissionChecker */ private $permissionChecker; public function setUp(): void @@ -56,11 +57,14 @@ public function setUp(): void /** * @dataProvider restrictionsProvider */ - public function testGetRestrictions(array $hasAccess, string $class, array $expectedRestrictions): void - { + public function testGetRestrictions( + array $hasAccess, + string $class, + array $expectedRestrictions + ): void { $actual = $this->permissionChecker->getRestrictions($hasAccess, $class); - $this->assertEquals($expectedRestrictions, $actual); + self::assertEquals($expectedRestrictions, $actual); } public function restrictionsProvider(): array @@ -168,12 +172,12 @@ public function testGetRestrictionsIsNotCached(): void ], ]; - $this->assertEquals( + self::assertEquals( [44], $this->permissionChecker->getRestrictions($hasAccessA, Limitation\SectionLimitation::class) ); - $this->assertEquals( + self::assertEquals( [2, 3], $this->permissionChecker->getRestrictions($hasAccessB, Limitation\ContentTypeLimitation::class) ); @@ -182,7 +186,7 @@ public function testGetRestrictionsIsNotCached(): void /** * @param int $id * - * @return \Ibexa\Contracts\Core\Repository\Values\User\User + * @return User */ private function generateUser(int $id): User { diff --git a/tests/lib/PreviewUrlResolver/VersionPreviewUrlResolverTest.php b/tests/lib/PreviewUrlResolver/VersionPreviewUrlResolverTest.php index de71c7c220..d3c1932b14 100644 --- a/tests/lib/PreviewUrlResolver/VersionPreviewUrlResolverTest.php +++ b/tests/lib/PreviewUrlResolver/VersionPreviewUrlResolverTest.php @@ -55,7 +55,7 @@ public function testResolvesPreviewUrlSuccessfully(): void $resolver = new VersionPreviewUrlResolver($eventDispatcher); $result = $resolver->resolveUrl($versionInfo, $location, $language, $siteAccess); - $this->assertSame(self::EXAMPLE_PREVIEW_URL, $result); + self::assertSame(self::EXAMPLE_PREVIEW_URL, $result); } public function testThrowsExceptionWhenPreviewUrlIsNotResolved(): void diff --git a/tests/lib/REST/Input/ContentType/FieldDefinitionCreateTest.php b/tests/lib/REST/Input/ContentType/FieldDefinitionCreateTest.php index 0846b59ea5..06cd99da3b 100644 --- a/tests/lib/REST/Input/ContentType/FieldDefinitionCreateTest.php +++ b/tests/lib/REST/Input/ContentType/FieldDefinitionCreateTest.php @@ -16,7 +16,7 @@ final class FieldDefinitionCreateTest extends TestCase { - /** @var \Ibexa\AdminUi\REST\Input\Parser\ContentType\FieldDefinitionCreate */ + /** @var FieldDefinitionCreate */ private $parser; protected function setUp(): void diff --git a/tests/lib/REST/Input/ContentType/FieldDefinitionDeleteTest.php b/tests/lib/REST/Input/ContentType/FieldDefinitionDeleteTest.php index 502893ab38..475d2b12e0 100644 --- a/tests/lib/REST/Input/ContentType/FieldDefinitionDeleteTest.php +++ b/tests/lib/REST/Input/ContentType/FieldDefinitionDeleteTest.php @@ -16,7 +16,7 @@ final class FieldDefinitionDeleteTest extends TestCase { - /** @var \Ibexa\AdminUi\REST\Input\Parser\ContentType\FieldDefinitionDelete */ + /** @var FieldDefinitionDelete */ private $parser; protected function setUp(): void diff --git a/tests/lib/REST/Input/ContentType/FieldDefinitionReorderTest.php b/tests/lib/REST/Input/ContentType/FieldDefinitionReorderTest.php index 1b4fb2a193..2dd4061ac7 100644 --- a/tests/lib/REST/Input/ContentType/FieldDefinitionReorderTest.php +++ b/tests/lib/REST/Input/ContentType/FieldDefinitionReorderTest.php @@ -16,7 +16,7 @@ final class FieldDefinitionReorderTest extends TestCase { - /** @var \Ibexa\AdminUi\REST\Input\Parser\ContentType\FieldDefinitionReorder */ + /** @var FieldDefinitionReorder */ private $parser; protected function setUp(): void diff --git a/tests/lib/Resolver/IconPathResolverTest.php b/tests/lib/Resolver/IconPathResolverTest.php index ddd799326e..d278402cff 100644 --- a/tests/lib/Resolver/IconPathResolverTest.php +++ b/tests/lib/Resolver/IconPathResolverTest.php @@ -10,15 +10,16 @@ use Ibexa\AdminUi\Resolver\IconPathResolver; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Asset\Packages; final class IconPathResolverTest extends TestCase { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ConfigResolverInterface|MockObject */ private $configResolver; - /** @var \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\Asset\Packages */ + /** @var MockObject|Packages */ private $packages; public function setUp(): void @@ -32,8 +33,11 @@ public function setUp(): void /** * @dataProvider resolveDataProvider */ - public function testResolve(string $icon, ?string $set, string $expectedPath): void - { + public function testResolve( + string $icon, + ?string $set, + string $expectedPath + ): void { $iconPathResolver = new IconPathResolver($this->configResolver, $this->packages); self::assertEquals($expectedPath, $iconPathResolver->resolve($icon, $set)); diff --git a/tests/lib/Siteaccess/AdminSiteaccessPreviewVoterTest.php b/tests/lib/Siteaccess/AdminSiteaccessPreviewVoterTest.php index bb13260321..bb12a9250d 100644 --- a/tests/lib/Siteaccess/AdminSiteaccessPreviewVoterTest.php +++ b/tests/lib/Siteaccess/AdminSiteaccessPreviewVoterTest.php @@ -21,13 +21,13 @@ class AdminSiteaccessPreviewVoterTest extends TestCase { private const LANGUAGE_CODE = 'eng-GB'; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ + /** @var ConfigResolverInterface */ private $configResolver; - /** @var \Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider */ + /** @var RepositoryConfigurationProvider */ private $repositoryConfigurationProvider; - /** @var \Ibexa\AdminUi\Siteaccess\AdminSiteaccessPreviewVoter */ + /** @var AdminSiteaccessPreviewVoter */ private $adminSiteaccessPreviewVoter; public function setUp(): void @@ -54,7 +54,7 @@ public function testVoteWithInvalidPath(): void $this->mockConfigMethods($context); - $this->assertFalse($this->adminSiteaccessPreviewVoter->vote($context)); + self::assertFalse($this->adminSiteaccessPreviewVoter->vote($context)); } /** @@ -65,28 +65,28 @@ public function testVoteWithInvalidLanguageMatch(SiteaccessPreviewVoterContext $ $this->mockConfigMethods($context); $this->repositoryConfigurationProvider - ->expects($this->at(0)) + ->expects(self::at(0)) ->method('getDefaultRepositoryAlias') ->willReturn('default'); $this->repositoryConfigurationProvider - ->expects($this->at(1)) + ->expects(self::at(1)) ->method('getCurrentRepositoryAlias') ->willReturn('default'); $this->configResolver - ->expects($this->at(3)) + ->expects(self::at(3)) ->method('getParameter') ->with('repository', null, $context->getSiteaccess()) ->willReturn(null); $this->configResolver - ->expects($this->at(4)) + ->expects(self::at(4)) ->method('getParameter') ->with('languages', null, $context->getSiteaccess()) ->willReturn(['ger-DE']); - $this->assertFalse($this->adminSiteaccessPreviewVoter->vote($context)); + self::assertFalse($this->adminSiteaccessPreviewVoter->vote($context)); } /** @@ -97,22 +97,22 @@ public function testVoteWithInvalidRepositoryMatch(SiteaccessPreviewVoterContext $this->mockConfigMethods($context); $this->configResolver - ->expects($this->at(3)) + ->expects(self::at(3)) ->method('getParameter') ->with('repository', null, $context->getSiteaccess()) ->willReturn(null); $this->repositoryConfigurationProvider - ->expects($this->at(0)) + ->expects(self::at(0)) ->method('getDefaultRepositoryAlias') ->willReturn('default'); $this->repositoryConfigurationProvider - ->expects($this->at(1)) + ->expects(self::at(1)) ->method('getCurrentRepositoryAlias') ->willReturn('main'); - $this->assertFalse($this->adminSiteaccessPreviewVoter->vote($context)); + self::assertFalse($this->adminSiteaccessPreviewVoter->vote($context)); } /** @@ -123,46 +123,46 @@ public function testVoteWithValidRepositoryAndLanguageMatch(SiteaccessPreviewVot $this->mockConfigMethods($context); $this->configResolver - ->expects($this->at(3)) + ->expects(self::at(3)) ->method('getParameter') ->with('repository', null, $context->getSiteaccess()) ->willReturn(null); $this->repositoryConfigurationProvider - ->expects($this->at(0)) + ->expects(self::at(0)) ->method('getDefaultRepositoryAlias') ->willReturn('default'); $this->repositoryConfigurationProvider - ->expects($this->at(1)) + ->expects(self::at(1)) ->method('getCurrentRepositoryAlias') ->willReturn('default'); $this->configResolver - ->expects($this->at(4)) + ->expects(self::at(4)) ->method('getParameter') ->with('languages', null, $context->getSiteaccess()) ->willReturn(['eng-GB', 'fre-FR']); - $this->assertTrue($this->adminSiteaccessPreviewVoter->vote($context)); + self::assertTrue($this->adminSiteaccessPreviewVoter->vote($context)); } private function mockConfigMethods(SiteaccessPreviewVoterContext $context): void { $this->configResolver - ->expects($this->at(0)) + ->expects(self::at(0)) ->method('getParameter') ->with('content.tree_root.location_id', null, $context->getSiteaccess()) ->willReturn(2); $this->configResolver - ->expects($this->at(1)) + ->expects(self::at(1)) ->method('getParameter') ->with('location_ids.media', null, $context->getSiteaccess()) ->willReturn(43); $this->configResolver - ->expects($this->at(2)) + ->expects(self::at(2)) ->method('getParameter') ->with('location_ids.users', null, $context->getSiteaccess()) ->willReturn(5); diff --git a/tests/lib/Specification/ContentType/ContentTypeIsUserTest.php b/tests/lib/Specification/ContentType/ContentTypeIsUserTest.php index 44fbb8487f..7bef7ef3c9 100644 --- a/tests/lib/Specification/ContentType/ContentTypeIsUserTest.php +++ b/tests/lib/Specification/ContentType/ContentTypeIsUserTest.php @@ -39,7 +39,7 @@ public function testIsSatisfiedByCustomUserContentType() $customUserContentType, ]); - $this->assertTrue($specification->isSatisfiedBy($this->createContentType($customUserContentType))); + self::assertTrue($specification->isSatisfiedBy($this->createContentType($customUserContentType))); } /** @@ -54,7 +54,7 @@ public function testIsSatisfiedByContentTypeWithEzUserField() ['ezstring', 'ezuser'] ); - $this->assertTrue($specification->isSatisfiedBy($contentTypeWithEzUserField)); + self::assertTrue($specification->isSatisfiedBy($contentTypeWithEzUserField)); } /** @@ -68,7 +68,7 @@ public function testIsSatisfiedByReturnFalse() $articleContentType = $this->createContentType('article', ['ezstring', 'ezrichtext']); - $this->assertFalse($specification->isSatisfiedBy($articleContentType)); + self::assertFalse($specification->isSatisfiedBy($articleContentType)); } /** @@ -77,10 +77,12 @@ public function testIsSatisfiedByReturnFalse() * @param string $identifier * @param array $fieldsType * - * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType + * @return APIContentType */ - private function createContentType(string $identifier, array $fieldsType = []): APIContentType - { + private function createContentType( + string $identifier, + array $fieldsType = [] + ): APIContentType { $contentType = $this->createMock(ContentType::class); $contentType ->method('__get') diff --git a/tests/lib/Specification/UserMode/IsFocusModeEnabledTest.php b/tests/lib/Specification/UserMode/IsFocusModeEnabledTest.php index c03a30dac1..7e7ab673dc 100644 --- a/tests/lib/Specification/UserMode/IsFocusModeEnabledTest.php +++ b/tests/lib/Specification/UserMode/IsFocusModeEnabledTest.php @@ -19,8 +19,11 @@ final class IsFocusModeEnabledTest extends TestCase /** * @dataProvider dataProviderForIsSatisfiedBy */ - public function testIsSatisfiedBy(string $userMode, string $value, bool $expectedResult): void - { + public function testIsSatisfiedBy( + string $userMode, + string $value, + bool $expectedResult + ): void { self::assertEquals( $expectedResult, (new IsFocusModeEnabled($userMode))->isSatisfiedBy($value) @@ -30,8 +33,11 @@ public function testIsSatisfiedBy(string $userMode, string $value, bool $expecte /** * @dataProvider dataProviderForIsSatisfiedBy */ - public function testFromUserSetting(string $userMode, string $value, bool $expectedResult): void - { + public function testFromUserSetting( + string $userMode, + string $value, + bool $expectedResult + ): void { $userSetting = $this->createMock(UserSetting::class); $userSetting->method('__get')->with('value')->willReturn($userMode); diff --git a/tests/lib/Specification/UserProfile/IsProfileAvailableTest.php b/tests/lib/Specification/UserProfile/IsProfileAvailableTest.php index 53d32442c3..8e95cf5b8d 100644 --- a/tests/lib/Specification/UserProfile/IsProfileAvailableTest.php +++ b/tests/lib/Specification/UserProfile/IsProfileAvailableTest.php @@ -31,7 +31,7 @@ public function testIsSatisfiedBy( } /** - * @return iterable + * @return iterable */ public function dataProviderForIsSatisfiedBy(): iterable { @@ -57,8 +57,10 @@ public function dataProviderForIsSatisfiedBy(): iterable /** * @param string[] $contentTypes */ - private function createConfiguration(bool $enabled, array $contentTypes): UserProfileConfigurationInterface - { + private function createConfiguration( + bool $enabled, + array $contentTypes + ): UserProfileConfigurationInterface { $configuration = $this->createMock(UserProfileConfigurationInterface::class); $configuration->method('isEnabled')->willReturn($enabled); $configuration->method('getContentTypes')->willReturn($contentTypes); diff --git a/tests/lib/Specification/VersionHasConflictTest.php b/tests/lib/Specification/VersionHasConflictTest.php index 7da11b3e2f..e7ec00969c 100644 --- a/tests/lib/Specification/VersionHasConflictTest.php +++ b/tests/lib/Specification/VersionHasConflictTest.php @@ -12,13 +12,14 @@ use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class VersionHasConflictTest extends TestCase { public function testVersionWithStatusDraft() { - /** @var \Ibexa\Contracts\Core\Repository\ContentService|\PHPUnit\Framework\MockObject\MockObject $contentServiceMock */ + /** @var ContentService|MockObject $contentServiceMock */ $contentServiceMock = $this->createMock(ContentService::class); $contentServiceMock ->method('loadVersions') @@ -36,7 +37,7 @@ public function testVersionWithStatusDraft() public function testVersionWithStatusDraftAndVersionConflict() { - /** @var \Ibexa\Contracts\Core\Repository\ContentService|\PHPUnit\Framework\MockObject\MockObject $contentServiceMock */ + /** @var ContentService|MockObject $contentServiceMock */ $contentServiceMock = $this->createMock(ContentService::class); $contentServiceMock ->method('loadVersions') @@ -74,10 +75,13 @@ public function testVersionWithStatusDraftAndVersionConflictWithAnotherLanguageC * @param int $versionNo * @param string $languageCode * - * @return \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo + * @return MockObject|VersionInfo */ - private function createVersionInfo(bool $isPublished = false, int $versionNo = 1, string $languageCode = 'eng-GB'): VersionInfo - { + private function createVersionInfo( + bool $isPublished = false, + int $versionNo = 1, + string $languageCode = 'eng-GB' + ): VersionInfo { $contentInfo = $this->createMock(ContentInfo::class); $versionInfo = $this->getMockForAbstractClass( diff --git a/tests/lib/Strategy/FocusMode/ContentStructureRedirectStrategyTest.php b/tests/lib/Strategy/FocusMode/ContentStructureRedirectStrategyTest.php index 454cc254ba..a7906bbb0e 100644 --- a/tests/lib/Strategy/FocusMode/ContentStructureRedirectStrategyTest.php +++ b/tests/lib/Strategy/FocusMode/ContentStructureRedirectStrategyTest.php @@ -14,6 +14,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\Repository\Values\Content\Location; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Routing\RouterInterface; @@ -35,8 +36,10 @@ protected function setUp(): void * * @param array $pathData */ - public function testSupports(array $pathData, bool $doesSupport): void - { + public function testSupports( + array $pathData, + bool $doesSupport + ): void { self::assertSame($doesSupport, $this->strategy->supports($pathData)); } @@ -61,8 +64,10 @@ public function dataProviderForTestSupports(): iterable /** * @dataProvider dataProviderForTestGenerateRedirectPath */ - public function testGenerateRedirectPath(string $path, string $expectedPath): void - { + public function testGenerateRedirectPath( + string $path, + string $expectedPath + ): void { self::assertSame( $expectedPath, $this->strategy->generateRedirectPath($path) @@ -80,7 +85,7 @@ public function dataProviderForTestGenerateRedirectPath(): iterable } /** - * @return \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface&\PHPUnit\Framework\MockObject\MockObject + * @return ConfigResolverInterface&MockObject */ private function createConfigResolverMock(): ConfigResolverInterface { @@ -94,7 +99,7 @@ private function createConfigResolverMock(): ConfigResolverInterface } /** - * @return \Ibexa\Contracts\Core\Repository\LocationService&\PHPUnit\Framework\MockObject\MockObject + * @return LocationService&MockObject */ private function createLocationServiceMock(): LocationService { @@ -107,7 +112,7 @@ private function createLocationServiceMock(): LocationService } /** - * @return \Symfony\Component\Routing\RouterInterface&\PHPUnit\Framework\MockObject\MockObject + * @return RouterInterface&MockObject */ private function createRouterMock(): RouterInterface { diff --git a/tests/lib/Strategy/FocusMode/OriginalPathRedirectStrategyTest.php b/tests/lib/Strategy/FocusMode/OriginalPathRedirectStrategyTest.php index 2b6e20e4c8..cf876b6e42 100644 --- a/tests/lib/Strategy/FocusMode/OriginalPathRedirectStrategyTest.php +++ b/tests/lib/Strategy/FocusMode/OriginalPathRedirectStrategyTest.php @@ -25,8 +25,10 @@ protected function setUp(): void * * @param array $pathData */ - public function testSupports(array $pathData, bool $doesSupport): void - { + public function testSupports( + array $pathData, + bool $doesSupport + ): void { self::assertSame($doesSupport, $this->strategy->supports($pathData)); } @@ -45,8 +47,10 @@ public function dataProviderForTestSupports(): iterable /** * @dataProvider dataProviderForTestGenerateRedirectPath */ - public function testGenerateRedirectPath(string $path, string $expectedPath): void - { + public function testGenerateRedirectPath( + string $path, + string $expectedPath + ): void { self::assertSame( $expectedPath, $this->strategy->generateRedirectPath($path) diff --git a/tests/lib/Tab/LocationView/AbstractTabVisibilityTestCase.php b/tests/lib/Tab/LocationView/AbstractTabVisibilityTestCase.php index 90a6f81bdb..702536a672 100644 --- a/tests/lib/Tab/LocationView/AbstractTabVisibilityTestCase.php +++ b/tests/lib/Tab/LocationView/AbstractTabVisibilityTestCase.php @@ -9,6 +9,7 @@ namespace Ibexa\Tests\AdminUi\Tab\LocationView; use Ibexa\AdminUi\UserSetting\FocusMode; +use Ibexa\Contracts\AdminUi\Tab\ConditionalTabInterface; use Ibexa\Contracts\AdminUi\Tab\TabInterface; use Ibexa\User\UserSetting\UserSetting; use Ibexa\User\UserSetting\UserSettingService; @@ -21,8 +22,11 @@ abstract class AbstractTabVisibilityTestCase extends TestCase * * @param array $parameters */ - final public function testTabVisibilityInGivenUserMode(string $userMode, array $parameters, bool $expectedResult): void - { + final public function testTabVisibilityInGivenUserMode( + string $userMode, + array $parameters, + bool $expectedResult + ): void { $userSetting = $this->createMock(UserSetting::class); $userSetting->method('__get')->with('value')->willReturn($userMode); @@ -40,7 +44,7 @@ final public function testTabVisibilityInGivenUserMode(string $userMode, array $ abstract public function dataProviderForTestTabVisibilityInGivenUserMode(): iterable; /** - * @return \Ibexa\Contracts\AdminUi\Tab\TabInterface&\Ibexa\Contracts\AdminUi\Tab\ConditionalTabInterface + * @return TabInterface&ConditionalTabInterface */ abstract protected function createTabForVisibilityInGivenUserModeTest( UserSettingService $userSettingService diff --git a/tests/lib/Tab/LocationView/VersionsTabVisibilityTest.php b/tests/lib/Tab/LocationView/VersionsTabVisibilityTest.php index bd73c2577f..be4f36ef1f 100644 --- a/tests/lib/Tab/LocationView/VersionsTabVisibilityTest.php +++ b/tests/lib/Tab/LocationView/VersionsTabVisibilityTest.php @@ -17,6 +17,7 @@ use Ibexa\Contracts\Core\Repository\UserService; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\User\UserSetting\UserSettingService; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -24,7 +25,7 @@ final class VersionsTabVisibilityTest extends AbstractTabVisibilityTestCase { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content&\PHPUnit\Framework\MockObject\MockObject */ + /** @var Content&MockObject */ private Content $exampleContent; private function getExampleContent(): Content diff --git a/tests/lib/Tab/TabGroupTest.php b/tests/lib/Tab/TabGroupTest.php index 9170fe8562..8fde49fb5c 100644 --- a/tests/lib/Tab/TabGroupTest.php +++ b/tests/lib/Tab/TabGroupTest.php @@ -25,11 +25,11 @@ public function testAddTab() $tabGroup = new TabGroup('group_name'); - $this->assertCount(0, $tabGroup->getTabs()); + self::assertCount(0, $tabGroup->getTabs()); $tabGroup->addTab($tab); - $this->assertCount(1, $tabGroup->getTabs()); + self::assertCount(1, $tabGroup->getTabs()); } public function testAddTabWithSameIdentifier() @@ -49,9 +49,9 @@ public function testAddTabWithSameIdentifier() $tabGroup = new TabGroup('group_name'); $tabGroup->addTab($tab); - $this->assertCount(1, $tabGroup->getTabs()); + self::assertCount(1, $tabGroup->getTabs()); $tabGroup->addTab($tabWithSameIdentifier); - $this->assertCount(1, $tabGroup->getTabs()); + self::assertCount(1, $tabGroup->getTabs()); } public function testRemoveTab() @@ -66,9 +66,9 @@ public function testRemoveTab() $tabGroup = new TabGroup('group_name'); $tabGroup->addTab($tab); - $this->assertCount(1, $tabGroup->getTabs()); + self::assertCount(1, $tabGroup->getTabs()); $tabGroup->removeTab($tabIdentifier); - $this->assertCount(0, $tabGroup->getTabs()); + self::assertCount(0, $tabGroup->getTabs()); } public function testRemoveTabWhenNotExist() @@ -83,7 +83,7 @@ public function testRemoveTabWhenNotExist() $tabGroup = new TabGroup('group_name'); - $this->assertCount(0, $tabGroup->getTabs()); + self::assertCount(0, $tabGroup->getTabs()); $tabGroup->removeTab($tabIdentifier); } } diff --git a/tests/lib/Tab/TabRegistryTest.php b/tests/lib/Tab/TabRegistryTest.php index 1248cf6c16..637352ba20 100644 --- a/tests/lib/Tab/TabRegistryTest.php +++ b/tests/lib/Tab/TabRegistryTest.php @@ -4,6 +4,7 @@ * @copyright Copyright (C) Ibexa AS. All rights reserved. * @license For full copyright and license information view LICENSE file distributed with this source code. */ +declare(strict_types=1); namespace Ibexa\Tests\AdminUi\Tab; @@ -11,13 +12,14 @@ use Ibexa\AdminUi\Tab\TabRegistry; use Ibexa\Contracts\AdminUi\Tab\AbstractTab; use Ibexa\Contracts\AdminUi\Tab\TabInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Contracts\Translation\TranslatorInterface; use Twig\Environment; -class TabRegistryTest extends TestCase +final class TabRegistryTest extends TestCase { - private $groupName; + private string $groupName; protected function setUp(): void { @@ -25,7 +27,7 @@ protected function setUp(): void $this->groupName = 'group_name'; } - public function testGetTabsByGroupNameWhenGroupDoesNotExist() + public function testGetTabsByGroupNameWhenGroupDoesNotExist(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage(sprintf('Could not find the requested group named "%s". Did you tag the service?', $this->groupName)); @@ -34,17 +36,19 @@ public function testGetTabsByGroupNameWhenGroupDoesNotExist() $tabRegistry->getTabsByGroupName($this->groupName); } - public function testGetTabsByGroupName() + public function testGetTabsByGroupName(): void { - $tabs = ['tab1', 'tab2']; + $twig = $this->createMock(Environment::class); + $translator = $this->createMock(TranslatorInterface::class); + $tabs = [$this->createTab('tab1', $twig, $translator), $this->createTab('tab1', $twig, $translator)]; $tabGroup = $this->createTabGroup($this->groupName, $tabs); $tabRegistry = new TabRegistry(); $tabRegistry->addTabGroup($tabGroup); - $this->assertSame($tabs, $tabRegistry->getTabsByGroupName($this->groupName)); + self::assertSame($tabs, $tabRegistry->getTabsByGroupName($this->groupName)); } - public function testGetTabFromGroup() + public function testGetTabFromGroup(): void { $twig = $this->createMock(Environment::class); $translator = $this->createMock(TranslatorInterface::class); @@ -55,10 +59,10 @@ public function testGetTabFromGroup() $tabGroup = $this->createTabGroup($this->groupName, $tabs); $tabRegistry->addTabGroup($tabGroup); - $this->assertSame($tab1, $tabRegistry->getTabFromGroup('tab1', $this->groupName)); + self::assertSame($tab1, $tabRegistry->getTabFromGroup('tab1', $this->groupName)); } - public function testGetTabFromGroupWhenGroupDoesNotExist() + public function testGetTabFromGroupWhenGroupDoesNotExist(): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage(sprintf('Could not find the requested group named "%s". Did you tag the service?', $this->groupName)); @@ -67,7 +71,7 @@ public function testGetTabFromGroupWhenGroupDoesNotExist() $tabRegistry->getTabFromGroup('tab1', $this->groupName); } - public function testGetTabFromGroupWhenTabDoesNotExist() + public function testGetTabFromGroupWhenTabDoesNotExist(): void { $tabName = 'tab1'; @@ -81,7 +85,7 @@ public function testGetTabFromGroupWhenTabDoesNotExist() $tabRegistry->getTabFromGroup($tabName, $this->groupName); } - public function testAddTabGroup() + public function testAddTabGroup(): void { $tabRegistry = new TabRegistry(); $tabGroup = $this->createTabGroup(); @@ -90,7 +94,7 @@ public function testAddTabGroup() self::assertSame($tabGroup, $tabRegistry->getTabGroup('lorem')); } - public function testAddTabGroupWithSameIdentifier() + public function testAddTabGroupWithSameIdentifier(): void { $tabGroup = $this->createTabGroup($this->groupName); $tabGroupWithSameIdentifier = $this->createTabGroup($this->groupName); @@ -103,7 +107,7 @@ public function testAddTabGroupWithSameIdentifier() self::assertSame($tabGroupWithSameIdentifier, $tabRegistry->getTabGroup($this->groupName)); } - public function testAddTabToExistingGroup() + public function testAddTabToExistingGroup(): void { $twig = $this->createMock(Environment::class); $translator = $this->createMock(TranslatorInterface::class); @@ -119,7 +123,7 @@ public function testAddTabToExistingGroup() self::assertCount(2, $tabRegistry->getTabsByGroupName($this->groupName)); } - public function testAddTabToNonExistentGroup() + public function testAddTabToNonExistentGroup(): void { $twig = $this->createMock(Environment::class); $translator = $this->createMock(TranslatorInterface::class); @@ -132,80 +136,49 @@ public function testAddTabToNonExistentGroup() } /** - * Returns Tab Group. - * - * @param string $name - * @param array $tabs - * - * @return \Ibexa\AdminUi\Tab\TabGroup + * @param TabInterface[] $tabs */ - private function createTabGroup(string $name = 'lorem', array $tabs = []): TabGroup - { + private function createTabGroup( + string $name = 'lorem', + array $tabs = [] + ): TabGroup { return new TabGroup($name, $tabs); } /** - * Returns Tab. - * - * @param string $name - * @param \Twig\Environment|\PHPUnit\Framework\MockObject\MockObject $twig - * @param \PHPUnit\Framework\MockObject\MockObject|\Symfony\Contracts\Translation\TranslatorInterface $translator - * - * @return \Ibexa\Contracts\AdminUi\Tab\TabInterface + * @param Environment&MockObject $twig + * @param TranslatorInterface&MockObject $translator */ - private function createTab(string $name, Environment $twig, TranslatorInterface $translator): TabInterface - { + private function createTab( + string $name, + Environment $twig, + TranslatorInterface $translator + ): TabInterface { return new class($name, $twig, $translator) extends AbstractTab { - /** @var string */ - protected $name; + protected string $name; - /** @var \Twig\Environment */ - protected $twig; - - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ - protected $translator; - - /** - * @param string $name - * @param \Twig\Environment $twig - * @param \Symfony\Contracts\Translation\TranslatorInterface $translator - */ - public function __construct(string $name = 'tab', Environment $twig, TranslatorInterface $translator) - { + public function __construct( + string $name, + Environment $twig, + TranslatorInterface $translator + ) { parent::__construct($twig, $translator); $this->name = $name; } - /** - * Returns identifier of the tab. - * - * @return string - */ public function getIdentifier(): string { return 'identifier'; } - /** - * Returns name of the tab which is displayed as a tab's title in the UI. - * - * @return string - */ public function getName(): string { return $this->name; } - /** - * Returns HTML body of the tab. - * - * @param array $parameters - * - * @return string - */ public function renderView(array $parameters): string { - return null; + return ''; } }; } diff --git a/tests/lib/Translation/Extractor/LimitationTranslationExtractorTest.php b/tests/lib/Translation/Extractor/LimitationTranslationExtractorTest.php index aae8f6b83c..8e30338464 100644 --- a/tests/lib/Translation/Extractor/LimitationTranslationExtractorTest.php +++ b/tests/lib/Translation/Extractor/LimitationTranslationExtractorTest.php @@ -36,7 +36,7 @@ public function testExtract() /** * Get expected MessageCatalogue object created by the extractor. * - * @return \JMS\TranslationBundle\Model\MessageCatalogue + * @return MessageCatalogue */ private function getExpectedMessageCatalogue(): MessageCatalogue { diff --git a/tests/lib/UI/Config/Provider/Module/DamWidgetTest.php b/tests/lib/UI/Config/Provider/Module/DamWidgetTest.php index 758261ebe9..df2291fa4a 100644 --- a/tests/lib/UI/Config/Provider/Module/DamWidgetTest.php +++ b/tests/lib/UI/Config/Provider/Module/DamWidgetTest.php @@ -15,6 +15,7 @@ use Ibexa\Contracts\Core\Repository\ContentTypeService; use Ibexa\Contracts\Core\Repository\NameSchema\SchemaIdentifierExtractorInterface; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** @@ -59,11 +60,11 @@ final class DamWidgetTest extends TestCase private const IMAGE_MAPPINGS = [ self::IMAGE_FOO_CONTENT_TYPE_IDENTIFIER => [ 'imageFieldIdentifier' => 'field_foo', - 'nameSchemaIdentifiers' => self:: IMAGE_FOO_NAME_SCHEMA_IDENTIFIERS, + 'nameSchemaIdentifiers' => self::IMAGE_FOO_NAME_SCHEMA_IDENTIFIERS, ], self::IMAGE_BAR_CONTENT_TYPE_IDENTIFIER => [ 'imageFieldIdentifier' => 'field_bar', - 'nameSchemaIdentifiers' => self:: IMAGE_BAR_NAME_SCHEMA_IDENTIFIERS, + 'nameSchemaIdentifiers' => self::IMAGE_BAR_NAME_SCHEMA_IDENTIFIERS, ], ]; private const IMAGE_FIELD_DEFINITION_IDENTIFIERS = ['field_foo', 'field_bar']; @@ -81,13 +82,13 @@ final class DamWidgetTest extends TestCase private ProviderInterface $provider; - /** @var \Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider&\PHPUnit\Framework\MockObject\MockObject */ + /** @var RepositoryConfigurationProvider&MockObject */ private RepositoryConfigurationProvider $repositoryConfigurationProvider; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService&\PHPUnit\Framework\MockObject\MockObject */ + /** @var ContentTypeService&MockObject */ private ContentTypeService $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\NameSchema\SchemaIdentifierExtractorInterface&\PHPUnit\Framework\MockObject\MockObject */ + /** @var SchemaIdentifierExtractorInterface&MockObject */ private SchemaIdentifierExtractorInterface $schemaIdentifierExtractor; protected function setUp(): void diff --git a/tests/lib/UI/Config/Service/ContentTypeIconResolverTest.php b/tests/lib/UI/Config/Service/ContentTypeIconResolverTest.php index 60839cbba4..a1fed14b46 100644 --- a/tests/lib/UI/Config/Service/ContentTypeIconResolverTest.php +++ b/tests/lib/UI/Config/Service/ContentTypeIconResolverTest.php @@ -10,18 +10,19 @@ use Ibexa\AdminUi\UI\Service\ContentTypeIconResolver; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Asset\Packages; class ContentTypeIconResolverTest extends TestCase { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ConfigResolverInterface|MockObject */ private $configResolver; - /** @var \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\Asset\Packages */ + /** @var MockObject|Packages */ private $packages; - /** @var \Ibexa\AdminUi\UI\Service\ContentTypeIconResolver */ + /** @var ContentTypeIconResolver */ private $contentTypeIconResolver; protected function setUp(): void @@ -38,10 +39,13 @@ protected function setUp(): void /** * @dataProvider dataProviderForGetContentTypeIcon */ - public function testGetContentTypeIcon(array $config, string $identifier, string $expected) - { + public function testGetContentTypeIcon( + array $config, + string $identifier, + string $expected + ) { $this->configResolver - ->expects($this->any()) + ->expects(self::any()) ->method('hasParameter') ->willReturnCallback(static function (string $key) use ($config) { $key = explode('.', $key); @@ -50,7 +54,7 @@ public function testGetContentTypeIcon(array $config, string $identifier, string }); $this->configResolver - ->expects($this->any()) + ->expects(self::any()) ->method('getParameter') ->willReturnCallback(static function (string $key) use ($config) { $key = explode('.', $key); @@ -59,13 +63,13 @@ public function testGetContentTypeIcon(array $config, string $identifier, string }); $this->packages - ->expects($this->any()) + ->expects(self::any()) ->method('getUrl') ->willReturnCallback(static function (string $uri) { return "https://cdn.example.com/$uri"; }); - $this->assertEquals($expected, $this->contentTypeIconResolver->getContentTypeIcon($identifier)); + self::assertEquals($expected, $this->contentTypeIconResolver->getContentTypeIcon($identifier)); } public function dataProviderForGetContentTypeIcon(): array diff --git a/tests/lib/UniversalDiscovery/Event/Subscriber/ContentCreateTest.php b/tests/lib/UniversalDiscovery/Event/Subscriber/ContentCreateTest.php index 0e03f25ed4..d4ec803765 100644 --- a/tests/lib/UniversalDiscovery/Event/Subscriber/ContentCreateTest.php +++ b/tests/lib/UniversalDiscovery/Event/Subscriber/ContentCreateTest.php @@ -24,13 +24,13 @@ class ContentCreateTest extends TestCase private const ALLOWED_LANGUAGE_CODE = 'eng-GB'; private const ALLOWED_CONTENT_TYPE_ID = 1; - /** @var \Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface|PHPUnit\Framework\MockObject\MockObject */ + /** @var PermissionCheckerInterface|PHPUnit\Framework\MockObject\MockObject */ private $permissionChecker; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService|PHPUnit\Framework\MockObject\MockObject */ + /** @var ContentTypeService|PHPUnit\Framework\MockObject\MockObject */ private $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver|PHPUnit\Framework\MockObject\MockObject */ + /** @var PermissionResolver|PHPUnit\Framework\MockObject\MockObject */ private $permissionResolver; public function setUp(): void @@ -60,7 +60,7 @@ public function testUdwConfigResolveWithCreateTab(array $config): void $expectedConfig = $config + $addedConfig; - $this->assertEquals($expectedConfig, $event->getConfig()); + self::assertEquals($expectedConfig, $event->getConfig()); } /** @@ -75,7 +75,7 @@ public function testUdwConfigResolveWithoutCreateTab($config): void $subscriber = $this->getSubscriberWithRestrictions(); $subscriber->onUdwConfigResolve($event); - $this->assertEquals($config, $event->getConfig()); + self::assertEquals($config, $event->getConfig()); } public function createTab(): array diff --git a/tests/lib/UniversalDiscovery/Event/Subscriber/ReadAllowedContentTypesTest.php b/tests/lib/UniversalDiscovery/Event/Subscriber/ReadAllowedContentTypesTest.php index 88bd6d4113..bdb368cf8c 100644 --- a/tests/lib/UniversalDiscovery/Event/Subscriber/ReadAllowedContentTypesTest.php +++ b/tests/lib/UniversalDiscovery/Event/Subscriber/ReadAllowedContentTypesTest.php @@ -15,6 +15,7 @@ use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\ContentTypeLimitation; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; final class ReadAllowedContentTypesTest extends TestCase @@ -26,16 +27,16 @@ final class ReadAllowedContentTypesTest extends TestCase private const ALLOWED_CONTENT_TYPES_IDS = [2, 4]; private const ALLOWED_CONTENT_TYPES = ['article', 'folder']; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver|\PHPUnit\Framework\MockObject\MockObject */ + /** @var PermissionResolver|MockObject */ private $permissionResolver; - /** @var \Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var PermissionCheckerInterface|MockObject */ private $permissionChecker; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ContentTypeService|MockObject */ private $contentTypeService; - /** @var \Ibexa\AdminUi\UniversalDiscovery\Event\Subscriber\ReadAllowedContentTypes */ + /** @var ReadAllowedContentTypes */ private $subscriber; protected function setUp(): void @@ -54,8 +55,8 @@ protected function setUp(): void public function testUdwConfigResolveOnUnsupportedConfigName(): void { $this->permissionResolver->method('hasAccess')->with('content', 'read')->willReturn(true); - $this->permissionChecker->expects($this->never())->method('getRestrictions'); - $this->contentTypeService->expects($this->never())->method('loadContentTypeList'); + $this->permissionChecker->expects(self::never())->method('getRestrictions'); + $this->contentTypeService->expects(self::never())->method('loadContentTypeList'); $event = $this->createConfigResolveEvent('unsupported_config_name'); @@ -65,14 +66,14 @@ public function testUdwConfigResolveOnUnsupportedConfigName(): void 'allowed_content_types' => null, ]; - $this->assertEquals($expectedConfig, $event->getConfig()); + self::assertEquals($expectedConfig, $event->getConfig()); } public function testUdwConfigResolveWhenThereIsNoContentReadLimitations(): void { $this->permissionResolver->method('hasAccess')->with('content', 'read')->willReturn(true); - $this->permissionChecker->expects($this->never())->method('getRestrictions'); - $this->contentTypeService->expects($this->never())->method('loadContentTypeList'); + $this->permissionChecker->expects(self::never())->method('getRestrictions'); + $this->contentTypeService->expects(self::never())->method('loadContentTypeList'); $this->assertConfigurationResolvingResult([ 'allowed_content_types' => null, @@ -82,8 +83,8 @@ public function testUdwConfigResolveWhenThereIsNoContentReadLimitations(): void public function testUdwConfigResolveWhenThereIsNoContentReadLimitationsAndNoAccess(): void { $this->permissionResolver->method('hasAccess')->with('content', 'read')->willReturn(false); - $this->permissionChecker->expects($this->never())->method('getRestrictions'); - $this->contentTypeService->expects($this->never())->method('loadContentTypeList'); + $this->permissionChecker->expects(self::never())->method('getRestrictions'); + $this->contentTypeService->expects(self::never())->method('loadContentTypeList'); $this->assertConfigurationResolvingResult([ 'allowed_content_types' => [null], @@ -119,7 +120,7 @@ private function assertConfigurationResolvingResult(?array $expectedConfiguratio $this->subscriber->onUdwConfigResolve($event); - $this->assertEquals( + self::assertEquals( $expectedConfiguration, $event->getConfig() ); diff --git a/tests/lib/Util/ContentTypeFieldsExpressionParserTest.php b/tests/lib/Util/ContentTypeFieldsExpressionParserTest.php index 4afc12e279..ebaad48767 100644 --- a/tests/lib/Util/ContentTypeFieldsExpressionParserTest.php +++ b/tests/lib/Util/ContentTypeFieldsExpressionParserTest.php @@ -27,8 +27,10 @@ protected function setUp(): void /** * @dataProvider dataProviderForTestParse */ - public function testParse(string $expression, ContentTypeFieldsParsedStructure $expectedResult): void - { + public function testParse( + string $expression, + ContentTypeFieldsParsedStructure $expectedResult + ): void { $result = $this->contentTypeFieldsExpressionExtractor->parseExpression($expression); self::assertSame($expectedResult->getGroups(), $result->getGroups()); @@ -47,7 +49,7 @@ public function testParseInvalidExpression(string $expression): void } /** - * @return iterable + * @return iterable */ public function dataProviderForTestParse(): iterable { diff --git a/tests/lib/Util/FieldDefinitionGroupsUtilTest.php b/tests/lib/Util/FieldDefinitionGroupsUtilTest.php index dff6eb4ec6..26d6c30a48 100644 --- a/tests/lib/Util/FieldDefinitionGroupsUtilTest.php +++ b/tests/lib/Util/FieldDefinitionGroupsUtilTest.php @@ -50,8 +50,8 @@ public function testGroupFieldDefinitions() $util = new FieldDefinitionGroupsUtil($fieldsGroupsListHelper); - $this->assertSame($groupedFieldDefinitions, $util->groupFieldDefinitions($fieldDefinitions)); - $this->assertEquals($groupedFieldDefinitions, $util->groupFieldDefinitions($fieldDefinitions)); + self::assertSame($groupedFieldDefinitions, $util->groupFieldDefinitions($fieldDefinitions)); + self::assertEquals($groupedFieldDefinitions, $util->groupFieldDefinitions($fieldDefinitions)); } } diff --git a/tests/lib/Validator/Constraint/FieldSettingsValidatorTest.php b/tests/lib/Validator/Constraint/FieldSettingsValidatorTest.php index ea53731a76..ebd4951b69 100644 --- a/tests/lib/Validator/Constraint/FieldSettingsValidatorTest.php +++ b/tests/lib/Validator/Constraint/FieldSettingsValidatorTest.php @@ -14,6 +14,7 @@ use Ibexa\Contracts\Core\Repository\FieldTypeService; use Ibexa\Core\FieldType\ValidationError; use Ibexa\Core\Repository\Values\ContentType\FieldDefinition; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; @@ -21,17 +22,17 @@ class FieldSettingsValidatorTest extends TestCase { /** - * @var \PHPUnit\Framework\MockObject\MockObject + * @var MockObject */ private $executionContext; /** - * @var \PHPUnit\Framework\MockObject\MockObject + * @var MockObject */ private $fieldTypeService; /** - * @var \Ibexa\AdminUi\Validator\Constraints\FieldSettingsValidator + * @var FieldSettingsValidator */ private $validator; @@ -47,7 +48,7 @@ protected function setUp(): void public function testNotFieldDefinitionData() { $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('buildViolation'); $this->validator->validate('foo', new FieldSettings()); @@ -56,7 +57,7 @@ public function testNotFieldDefinitionData() public function testValid() { $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('buildViolation'); $fieldTypeIdentifier = 'ezstring'; @@ -65,12 +66,12 @@ public function testValid() $fieldDefData = new FieldDefinitionData(['identifier' => 'foo', 'fieldDefinition' => $fieldDefinition, 'fieldSettings' => $fieldSettings]); $fieldType = $this->createMock(FieldType::class); $this->fieldTypeService - ->expects($this->once()) + ->expects(self::once()) ->method('getFieldType') ->with($fieldTypeIdentifier) ->willReturn($fieldType); $fieldType - ->expects($this->once()) + ->expects(self::once()) ->method('validateFieldSettings') ->with($fieldSettings) ->willReturn([]); @@ -86,7 +87,7 @@ public function testInvalid() $fieldDefData = new FieldDefinitionData(['identifier' => 'foo', 'fieldDefinition' => $fieldDefinition, 'fieldSettings' => $fieldSettings]); $fieldType = $this->createMock(FieldType::class); $this->fieldTypeService - ->expects($this->once()) + ->expects(self::once()) ->method('getFieldType') ->with($fieldTypeIdentifier) ->willReturn($fieldType); @@ -94,28 +95,28 @@ public function testInvalid() $errorParameter = 'bar'; $errorMessage = 'error'; $fieldType - ->expects($this->once()) + ->expects(self::once()) ->method('validateFieldSettings') ->with($fieldSettings) ->willReturn([new ValidationError($errorMessage, null, ['%foo%' => $errorParameter])]); $constraintViolationBuilder = $this->createMock(ConstraintViolationBuilderInterface::class); $this->executionContext - ->expects($this->once()) + ->expects(self::once()) ->method('buildViolation') ->willReturn($constraintViolationBuilder); $this->executionContext - ->expects($this->once()) + ->expects(self::once()) ->method('buildViolation') ->with($errorMessage) ->willReturn($constraintViolationBuilder); $constraintViolationBuilder - ->expects($this->once()) + ->expects(self::once()) ->method('setParameters') ->with(['%foo%' => $errorParameter]) ->willReturn($constraintViolationBuilder); $constraintViolationBuilder - ->expects($this->once()) + ->expects(self::once()) ->method('addViolation'); $this->validator->validate($fieldDefData, new FieldSettings()); diff --git a/tests/lib/Validator/Constraint/LocationIsContainerValidatorTest.php b/tests/lib/Validator/Constraint/LocationIsContainerValidatorTest.php index 5761deb912..afbef3f8f4 100644 --- a/tests/lib/Validator/Constraint/LocationIsContainerValidatorTest.php +++ b/tests/lib/Validator/Constraint/LocationIsContainerValidatorTest.php @@ -13,21 +13,22 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Context\ExecutionContextInterface; class LocationIsContainerValidatorTest extends TestCase { - /** @var \Symfony\Component\Validator\Context\ExecutionContextInterface */ + /** @var ExecutionContextInterface */ private $executionContext; - /** @var \Ibexa\AdminUi\Validator\Constraints\LocationIsContainerValidator */ + /** @var LocationIsContainerValidator */ private $validator; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Location|MockObject */ private $location; - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ContentType|MockObject */ private $contentType; protected function setUp(): void @@ -58,7 +59,7 @@ public function testValid() ->willReturn(true); $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('addViolation'); $this->validator->validate($this->location, new LocationIsContainer()); @@ -72,7 +73,7 @@ public function testInvalid() ->willReturn(false); $this->executionContext - ->expects($this->once()) + ->expects(self::once()) ->method('addViolation'); $this->validator->validate($this->location, new LocationIsContainer()); diff --git a/tests/lib/Validator/Constraint/LocationIsNotRootValidatorTest.php b/tests/lib/Validator/Constraint/LocationIsNotRootValidatorTest.php index b5df19d147..cf784c4155 100644 --- a/tests/lib/Validator/Constraint/LocationIsNotRootValidatorTest.php +++ b/tests/lib/Validator/Constraint/LocationIsNotRootValidatorTest.php @@ -8,6 +8,7 @@ namespace Ibexa\Tests\AdminUi\Validator\Constraint; +use Ibexa\AdminUi\Validator\Constraints\LocationIsContainerValidator; use Ibexa\AdminUi\Validator\Constraints\LocationIsNotRoot; use Ibexa\AdminUi\Validator\Constraints\LocationIsNotRootValidator; use Ibexa\Contracts\Core\Repository\Values\Content\Location; @@ -16,10 +17,10 @@ class LocationIsNotRootValidatorTest extends TestCase { - /** @var \Symfony\Component\Validator\Context\ExecutionContextInterface */ + /** @var ExecutionContextInterface */ private $executionContext; - /** @var \Ibexa\AdminUi\Validator\Constraints\LocationIsContainerValidator */ + /** @var LocationIsContainerValidator */ private $validator; protected function setUp(): void @@ -35,7 +36,7 @@ public function testValid() $location->method('getDepth')->willReturn(5); $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('addViolation'); $this->validator->validate($location, new LocationIsNotRoot()); @@ -47,7 +48,7 @@ public function testInvalid() $location->method('getDepth')->willReturn(1); $this->executionContext - ->expects($this->once()) + ->expects(self::once()) ->method('addViolation'); $this->validator->validate($location, new LocationIsNotRoot()); diff --git a/tests/lib/Validator/Constraint/LocationIsNotSubLocationValidatorTest.php b/tests/lib/Validator/Constraint/LocationIsNotSubLocationValidatorTest.php index 4bfae46829..408c4f7a62 100644 --- a/tests/lib/Validator/Constraint/LocationIsNotSubLocationValidatorTest.php +++ b/tests/lib/Validator/Constraint/LocationIsNotSubLocationValidatorTest.php @@ -17,10 +17,10 @@ class LocationIsNotSubLocationValidatorTest extends TestCase { - /** @var \Symfony\Component\Validator\Context\ExecutionContextInterface */ + /** @var ExecutionContextInterface */ private $executionContext; - /** @var \Ibexa\AdminUi\Validator\Constraints\LocationIsNotSubLocationValidator */ + /** @var LocationIsNotSubLocationValidator */ private $validator; protected function setUp(): void @@ -45,7 +45,7 @@ public function testValid() ->getMock(); $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('addViolation'); $constraint = new LocationIsNotSubLocation(['value' => $comparedLocation]); @@ -86,7 +86,7 @@ public function testInvalid() ->willReturn($constraintViolationBuilder); $this->executionContext - ->expects($this->once()) + ->expects(self::once()) ->method('buildViolation'); $this->validator->validate($location, $constraint); diff --git a/tests/lib/Validator/Constraint/LocationIsWithinCopySubtreeLimitValidatorTest.php b/tests/lib/Validator/Constraint/LocationIsWithinCopySubtreeLimitValidatorTest.php index 409071da3e..ac4f0e08f4 100644 --- a/tests/lib/Validator/Constraint/LocationIsWithinCopySubtreeLimitValidatorTest.php +++ b/tests/lib/Validator/Constraint/LocationIsWithinCopySubtreeLimitValidatorTest.php @@ -8,6 +8,7 @@ namespace Ibexa\Tests\AdminUi\Validator\Constraint; +use Ibexa\AdminUi\Validator\Constraints\LocationIsContainerValidator; use Ibexa\AdminUi\Validator\Constraints\LocationIsWithinCopySubtreeLimit; use Ibexa\AdminUi\Validator\Constraints\LocationIsWithinCopySubtreeLimitValidator; use Ibexa\Contracts\Core\Repository\LocationService; @@ -24,16 +25,16 @@ class LocationIsWithinCopySubtreeLimitValidatorTest extends TestCase { private const COPY_LIMIT = 10; - /** @var \Ibexa\Contracts\Core\Repository\LocationService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var LocationService|MockObject */ private $locationService; - /** @var \Symfony\Component\Validator\Context\ExecutionContextInterface */ + /** @var ExecutionContextInterface */ private $executionContext; - /** @var \Ibexa\AdminUi\Validator\Constraints\LocationIsContainerValidator */ + /** @var LocationIsContainerValidator */ private $validator; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Location|MockObject */ private $location; protected function setUp(): void @@ -62,7 +63,7 @@ public function testValid(): void $this->locationService->method('count')->willReturn(5); $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('addViolation'); $this->mockLocationContentContentTypeIsContainer($this->location); @@ -87,7 +88,7 @@ public function testInvalid(): void ->willReturn($constraintViolationBuilder); $this->executionContext - ->expects($this->once()) + ->expects(self::once()) ->method('buildViolation'); $this->validator->validate($this->location, new LocationIsWithinCopySubtreeLimit()); diff --git a/tests/lib/Validator/Constraint/UniqueContentTypeIdentifierValidatorTest.php b/tests/lib/Validator/Constraint/UniqueContentTypeIdentifierValidatorTest.php index ea29f169ab..49ad02d888 100644 --- a/tests/lib/Validator/Constraint/UniqueContentTypeIdentifierValidatorTest.php +++ b/tests/lib/Validator/Constraint/UniqueContentTypeIdentifierValidatorTest.php @@ -16,6 +16,7 @@ use Ibexa\Core\Base\Exceptions\NotFoundException; use Ibexa\Core\Repository\Values\ContentType\ContentType as APIContentType; use Ibexa\Core\Repository\Values\ContentType\ContentTypeDraft as APIContentTypeDraft; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use stdClass; use Symfony\Component\Validator\Context\ExecutionContextInterface; @@ -24,17 +25,17 @@ final class UniqueContentTypeIdentifierValidatorTest extends TestCase { /** - * @var \PHPUnit\Framework\MockObject\MockObject + * @var MockObject */ private $contentTypeService; /** - * @var \PHPUnit\Framework\MockObject\MockObject + * @var MockObject */ private $executionContext; /** - * @var \Ibexa\AdminUi\Validator\Constraints\UniqueContentTypeIdentifierValidator + * @var UniqueContentTypeIdentifierValidator */ private $validator; @@ -51,10 +52,10 @@ public function testNotContentTypeData(): void { $value = new stdClass(); $this->contentTypeService - ->expects($this->never()) + ->expects(self::never()) ->method('loadContentTypeByIdentifier'); $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('buildViolation'); $this->validator->validate($value, new UniqueContentTypeIdentifier()); @@ -68,10 +69,10 @@ public function testNullContentTypeIdentifier(): void ]); $this->contentTypeService - ->expects($this->never()) + ->expects(self::never()) ->method('loadContentTypeByIdentifier'); $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('buildViolation'); $this->validator->validate($value, new UniqueContentTypeIdentifier()); @@ -86,12 +87,12 @@ public function testValid(): void ]); $this->contentTypeService - ->expects($this->once()) + ->expects(self::once()) ->method('loadContentTypeByIdentifier') ->with($identifier) ->willThrowException(new NotFoundException('foo', 'bar')); $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('buildViolation'); $this->validator->validate($value, new UniqueContentTypeIdentifier()); @@ -113,12 +114,12 @@ public function testEditingContentTypeDraftFromExistingContentTypeIsValid(): voi ->setConstructorArgs([['id' => $contentTypeId]]) ->getMockForAbstractClass(); $this->contentTypeService - ->expects($this->once()) + ->expects(self::once()) ->method('loadContentTypeByIdentifier') ->with($identifier) ->willReturn($returnedContentType); $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('buildViolation'); $this->validator->validate($value, new UniqueContentTypeIdentifier()); @@ -141,27 +142,27 @@ public function testInvalid(): void ->setConstructorArgs([['id' => 123]]) ->getMockForAbstractClass(); $this->contentTypeService - ->expects($this->once()) + ->expects(self::once()) ->method('loadContentTypeByIdentifier') ->with($identifier) ->willReturn($returnedContentType); $this->executionContext - ->expects($this->once()) + ->expects(self::once()) ->method('buildViolation') ->with($constraint->message) ->willReturn($constraintViolationBuilder); $constraintViolationBuilder - ->expects($this->once()) + ->expects(self::once()) ->method('atPath') ->with('identifier') ->willReturn($constraintViolationBuilder); $constraintViolationBuilder - ->expects($this->once()) + ->expects(self::once()) ->method('setParameter') ->with('%identifier%', $identifier) ->willReturn($constraintViolationBuilder); $constraintViolationBuilder - ->expects($this->once()) + ->expects(self::once()) ->method('addViolation'); $this->validator->validate($value, $constraint); diff --git a/tests/lib/Validator/Constraint/UniqueFieldDefinitionIdentifierValidatorTest.php b/tests/lib/Validator/Constraint/UniqueFieldDefinitionIdentifierValidatorTest.php index 505dd4596d..c104c10b30 100644 --- a/tests/lib/Validator/Constraint/UniqueFieldDefinitionIdentifierValidatorTest.php +++ b/tests/lib/Validator/Constraint/UniqueFieldDefinitionIdentifierValidatorTest.php @@ -13,6 +13,7 @@ use Ibexa\AdminUi\Validator\Constraints\UniqueFieldDefinitionIdentifierValidator; use Ibexa\Core\Repository\Values\ContentType\ContentType; use Ibexa\Core\Repository\Values\ContentType\ContentTypeDraft; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; @@ -20,12 +21,12 @@ class UniqueFieldDefinitionIdentifierValidatorTest extends TestCase { /** - * @var \PHPUnit\Framework\MockObject\MockObject + * @var MockObject */ private $executionContext; /** - * @var \Ibexa\AdminUi\Validator\Constraints\UniqueFieldDefinitionIdentifierValidator + * @var UniqueFieldDefinitionIdentifierValidator */ private $validator; @@ -40,7 +41,7 @@ protected function setUp(): void public function testNotFieldDefinitionData(): void { $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('buildViolation'); $this->validator->validate('foo', new UniqueFieldDefinitionIdentifier()); @@ -49,7 +50,7 @@ public function testNotFieldDefinitionData(): void public function testValid(): void { $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('buildViolation'); $contentTypeData = new ContentTypeData([ @@ -76,22 +77,22 @@ public function testInvalid(): void $constraint = new UniqueFieldDefinitionIdentifier(); $constraintViolationBuilder = $this->createMock(ConstraintViolationBuilderInterface::class); $this->executionContext - ->expects($this->once()) + ->expects(self::once()) ->method('buildViolation') ->with($constraint->message) ->willReturn($constraintViolationBuilder); $constraintViolationBuilder - ->expects($this->once()) + ->expects(self::once()) ->method('atPath') ->with('identifier') ->willReturn($constraintViolationBuilder); $constraintViolationBuilder - ->expects($this->once()) + ->expects(self::once()) ->method('setParameter') ->with('%identifier%', $identifier) ->willReturn($constraintViolationBuilder); $constraintViolationBuilder - ->expects($this->once()) + ->expects(self::once()) ->method('addViolation'); $contentTypeData = new ContentTypeData([ diff --git a/tests/lib/Validator/Constraint/UniqueURLTest.php b/tests/lib/Validator/Constraint/UniqueURLTest.php index 23144f097f..7020cef4a8 100644 --- a/tests/lib/Validator/Constraint/UniqueURLTest.php +++ b/tests/lib/Validator/Constraint/UniqueURLTest.php @@ -12,7 +12,7 @@ class UniqueURLTest extends TestCase { - /** @var \Ibexa\AdminUi\Validator\Constraints\UniqueURL */ + /** @var UniqueURL */ private $constraint; protected function setUp(): void @@ -22,17 +22,17 @@ protected function setUp(): void public function testConstruct() { - $this->assertSame('ez.url.unique', $this->constraint->message); + self::assertSame('ez.url.unique', $this->constraint->message); } public function testValidatedBy() { - $this->assertSame('ezplatform.content_forms.validator.unique_url', $this->constraint->validatedBy()); + self::assertSame('ezplatform.content_forms.validator.unique_url', $this->constraint->validatedBy()); } public function testGetTargets() { - $this->assertSame(UniqueURL::CLASS_CONSTRAINT, $this->constraint->getTargets()); + self::assertSame(UniqueURL::CLASS_CONSTRAINT, $this->constraint->getTargets()); } } diff --git a/tests/lib/Validator/Constraint/UniqueURLValidatorTest.php b/tests/lib/Validator/Constraint/UniqueURLValidatorTest.php index d43c8787a8..4e72709748 100644 --- a/tests/lib/Validator/Constraint/UniqueURLValidatorTest.php +++ b/tests/lib/Validator/Constraint/UniqueURLValidatorTest.php @@ -13,6 +13,7 @@ use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; use Ibexa\Contracts\Core\Repository\URLService; use Ibexa\Contracts\Core\Repository\Values\URL\URL; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use stdClass; use Symfony\Component\Validator\Context\ExecutionContextInterface; @@ -20,13 +21,13 @@ class UniqueURLValidatorTest extends TestCase { - /** @var \Ibexa\Contracts\Core\Repository\URLService|\PHPUnit\Framework\MockObject\MockObject */ + /** @var URLService|MockObject */ private $urlService; - /** @var \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\Validator\Context\ExecutionContextInterface */ + /** @var MockObject|ExecutionContextInterface */ private $executionContext; - /** @var \Ibexa\AdminUi\Validator\Constraints\UniqueURLValidator */ + /** @var UniqueURLValidator */ private $validator; protected function setUp(): void @@ -43,11 +44,11 @@ public function testUnsupportedValueType() $value = new stdClass(); $this->urlService - ->expects($this->never()) + ->expects(self::never()) ->method('loadByUrl'); $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('buildViolation'); $this->validator->validate($value, new UniqueURL()); @@ -58,13 +59,13 @@ public function testValid() $url = 'http://ibexa.co'; $this->urlService - ->expects($this->once()) + ->expects(self::once()) ->method('loadByUrl') ->with($url) ->willThrowException($this->createMock(NotFoundException::class)); $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('buildViolation'); $this->validator->validate(new URLUpdateData([ @@ -79,7 +80,7 @@ public function testInvalid() $url = 'http://ibexa.co'; $this->urlService - ->expects($this->once()) + ->expects(self::once()) ->method('loadByUrl') ->with($url) ->willReturn(new URL([ @@ -90,25 +91,25 @@ public function testInvalid() $constraintViolationBuilder = $this->createMock(ConstraintViolationBuilderInterface::class); $this->executionContext - ->expects($this->once()) + ->expects(self::once()) ->method('buildViolation') ->with($constraint->message) ->willReturn($constraintViolationBuilder); $constraintViolationBuilder - ->expects($this->once()) + ->expects(self::once()) ->method('atPath') ->with('url') ->willReturn($constraintViolationBuilder); $constraintViolationBuilder - ->expects($this->once()) + ->expects(self::once()) ->method('setParameter') ->with('%url%', $url) ->willReturn($constraintViolationBuilder); $constraintViolationBuilder - ->expects($this->once()) + ->expects(self::once()) ->method('addViolation'); $this->validator->validate(new URLUpdateData([ @@ -123,7 +124,7 @@ public function testEditingIsValid() $url = 'http://ibexa.co'; $this->urlService - ->expects($this->once()) + ->expects(self::once()) ->method('loadByUrl') ->with($url) ->willReturn(new URL([ @@ -132,7 +133,7 @@ public function testEditingIsValid() ])); $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('buildViolation'); $this->validator->validate(new URLUpdateData([ diff --git a/tests/lib/Validator/Constraint/ValidatorConfigurationValidatorTest.php b/tests/lib/Validator/Constraint/ValidatorConfigurationValidatorTest.php index 55e63fc78c..e3ded81e96 100644 --- a/tests/lib/Validator/Constraint/ValidatorConfigurationValidatorTest.php +++ b/tests/lib/Validator/Constraint/ValidatorConfigurationValidatorTest.php @@ -14,6 +14,7 @@ use Ibexa\Contracts\Core\Repository\FieldTypeService; use Ibexa\Core\FieldType\ValidationError; use Ibexa\Core\Repository\Values\ContentType\FieldDefinition; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; @@ -21,17 +22,17 @@ class ValidatorConfigurationValidatorTest extends TestCase { /** - * @var \PHPUnit\Framework\MockObject\MockObject + * @var MockObject */ private $executionContext; /** - * @var \PHPUnit\Framework\MockObject\MockObject + * @var MockObject */ private $fieldTypeService; /** - * @var \Ibexa\AdminUi\Validator\Constraints\ValidatorConfigurationValidator + * @var ValidatorConfigurationValidator */ private $validator; @@ -47,7 +48,7 @@ protected function setUp(): void public function testNotFieldDefinitionData() { $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('buildViolation'); $this->validator->validate('foo', new ValidatorConfiguration()); @@ -56,7 +57,7 @@ public function testNotFieldDefinitionData() public function testValid() { $this->executionContext - ->expects($this->never()) + ->expects(self::never()) ->method('buildViolation'); $fieldTypeIdentifier = 'ezstring'; @@ -65,12 +66,12 @@ public function testValid() $fieldDefData = new FieldDefinitionData(['identifier' => 'foo', 'fieldDefinition' => $fieldDefinition, 'validatorConfiguration' => $validatorConfiguration]); $fieldType = $this->createMock(FieldType::class); $this->fieldTypeService - ->expects($this->once()) + ->expects(self::once()) ->method('getFieldType') ->with($fieldTypeIdentifier) ->willReturn($fieldType); $fieldType - ->expects($this->once()) + ->expects(self::once()) ->method('validateValidatorConfiguration') ->with($validatorConfiguration) ->willReturn([]); @@ -86,7 +87,7 @@ public function testInvalid() $fieldDefData = new FieldDefinitionData(['identifier' => 'foo', 'fieldDefinition' => $fieldDefinition, 'validatorConfiguration' => $validatorConfiguration]); $fieldType = $this->createMock(FieldType::class); $this->fieldTypeService - ->expects($this->once()) + ->expects(self::once()) ->method('getFieldType') ->with($fieldTypeIdentifier) ->willReturn($fieldType); @@ -94,28 +95,28 @@ public function testInvalid() $errorParameter = 'bar'; $errorMessage = 'error'; $fieldType - ->expects($this->once()) + ->expects(self::once()) ->method('validateValidatorConfiguration') ->with($validatorConfiguration) ->willReturn([new ValidationError($errorMessage, null, ['%foo%' => $errorParameter])]); $constraintViolationBuilder = $this->createMock(ConstraintViolationBuilderInterface::class); $this->executionContext - ->expects($this->once()) + ->expects(self::once()) ->method('buildViolation') ->willReturn($constraintViolationBuilder); $this->executionContext - ->expects($this->once()) + ->expects(self::once()) ->method('buildViolation') ->with($errorMessage) ->willReturn($constraintViolationBuilder); $constraintViolationBuilder - ->expects($this->once()) + ->expects(self::once()) ->method('setParameters') ->with(['%foo%' => $errorParameter]) ->willReturn($constraintViolationBuilder); $constraintViolationBuilder - ->expects($this->once()) + ->expects(self::once()) ->method('addViolation'); $this->validator->validate($fieldDefData, new ValidatorConfiguration());