diff --git a/composer.json b/composer.json index 5ea3f908ec..3d6799d8a9 100644 --- a/composer.json +++ b/composer.json @@ -23,52 +23,50 @@ "require": { "php": " >=8.3", "ext-json": "*", - "babdev/pagerfanta-bundle": "^2.1", - "ibexa/content-forms": "~5.0.x-dev", - "ibexa/core": "~5.0.x-dev", - "ibexa/design-engine": "~5.0.x-dev", - "ibexa/fieldtype-richtext": "~5.0.x-dev", + "babdev/pagerfanta-bundle": "^3.8", + "ibexa/content-forms": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/core": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/design-engine": "dev-ibx-8470-symfony-6 as 5.0.x-dev", "ibexa/polyfill-php82": "^1.0", - "ibexa/rest": "~5.0.x-dev", - "ibexa/search": "~5.0.x-dev", - "ibexa/user": "~5.0.x-dev", - "jms/translation-bundle": "^1.5", + "ibexa/rest": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/search": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/user": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "jms/translation-bundle": "^2.4", "knplabs/knp-menu-bundle": "^3.0", "mck89/peast": "^1.9", - "symfony/asset": "^5.0", - "symfony/config": "^5.0", - "symfony/console": "^5.0", - "symfony/dependency-injection": "^5.0", + "symfony/asset": "^6.4", + "symfony/config": "^6.4", + "symfony/console": "^6.4", + "symfony/dependency-injection": "^6.4", "symfony/deprecation-contracts": "^2.5", - "symfony/event-dispatcher": "^5.0", - "symfony/filesystem": "^5.0", - "symfony/form": "^5.0", - "symfony/http-foundation": "^5.0", - "symfony/http-kernel": "^5.0", - "symfony/options-resolver": "^5.0", - "symfony/routing": "^5.0", - "symfony/security-core": "^5.0", - "symfony/security-http": "^5.0", - "symfony/translation": "^5.0", - "symfony/validator": "^5.0", - "symfony/webpack-encore-bundle": "^v1.17", - "symfony/yaml": "^5.0", + "symfony/event-dispatcher": "^6.4", + "symfony/filesystem": "^6.4", + "symfony/form": "^6.4", + "symfony/http-foundation": "^6.4", + "symfony/http-kernel": "^6.4", + "symfony/options-resolver": "^6.4", + "symfony/routing": "^6.4", + "symfony/security-core": "^6.4", + "symfony/security-http": "^6.4", + "symfony/translation": "^6.4", + "symfony/validator": "^6.4", + "symfony/webpack-encore-bundle": "^1.17", + "symfony/yaml": "^6.4", "twig/intl-extra": "^3.0", "twig/string-extra": "^3.0", "twig/twig": "^3.0", - "willdurand/js-translation-bundle": "^4.0" + "willdurand/js-translation-bundle": "^6.1" }, "require-dev": { "ext-zip": "*", "dama/doctrine-test-bundle": "^v6.7", - "ibexa/behat": "~5.0.x-dev", - "ibexa/ci-scripts": "^0.2@dev", + "ibexa/behat": "dev-ibx-8470-symfony-6 as 5.0.x-dev", "ibexa/code-style": "~2.0.0", - "ibexa/doctrine-schema": "~5.0.x-dev", - "ibexa/http-cache": "~5.0.x-dev", - "ibexa/notifications": "~5.0.x-dev", - "ibexa/test-core": "~5.0.x-dev", - "ibexa/test-rest": "~5.0.x-dev", + "ibexa/doctrine-schema": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/http-cache": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/notifications": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/test-core": "dev-ibx-8470-symfony-6 as 5.0.x-dev", + "ibexa/test-rest": "dev-ibx-8470-symfony-6 as 5.0.x-dev", "matthiasnoback/symfony-dependency-injection-test": "^4.0", "phpstan/phpstan": "^1.10", "phpstan/phpstan-phpunit": "^1.3", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a306908806..0455ba01d1 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -45,31 +45,6 @@ parameters: count: 1 path: src/bundle/Controller/AssetController.php - - - message: "#^Method Ibexa\\\\Bundle\\\\AdminUi\\\\Controller\\\\BookmarkController\\:\\:getChoices\\(\\) has parameter \\$bookmarks with no value type specified in iterable type array\\.$#" - count: 1 - path: src/bundle/Controller/BookmarkController.php - - - - message: "#^Method Ibexa\\\\Bundle\\\\AdminUi\\\\Controller\\\\BookmarkController\\:\\:getChoices\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/bundle/Controller/BookmarkController.php - - - - message: "#^Parameter \\#1 \\$bookmarks of method Ibexa\\\\Bundle\\\\AdminUi\\\\Controller\\\\BookmarkController\\:\\:getChoices\\(\\) expects array, iterable\\<\\(int\\|string\\), mixed\\> given\\.$#" - count: 1 - path: src/bundle/Controller/BookmarkController.php - - - - message: "#^Parameter \\#1 \\$currentPage of method Pagerfanta\\\\Pagerfanta\\\\:\\:setCurrentPage\\(\\) expects int, int\\|string given\\.$#" - count: 1 - path: src/bundle/Controller/BookmarkController.php - - - - message: "#^Parameter \\#2 \\$default of method Symfony\\\\Component\\\\HttpFoundation\\\\InputBag\\\\:\\:get\\(\\) expects string\\|null, int given\\.$#" - count: 1 - path: src/bundle/Controller/BookmarkController.php - - message: "#^Parameter \\#3 \\$content of class Ibexa\\\\AdminUi\\\\REST\\\\Value\\\\OperationResponse constructor expects string\\|null, string\\|false given\\.$#" count: 1 @@ -215,11 +190,6 @@ parameters: count: 1 path: src/bundle/Controller/ContentTypeController.php - - - message: "#^Argument of an invalid type array\\|null supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: src/bundle/Controller/ContentTypeController.php - - message: "#^Call to an undefined method Symfony\\\\Component\\\\Form\\\\FormInterface\\:\\:getClickedButton\\(\\)\\.$#" count: 2 @@ -260,21 +230,6 @@ parameters: count: 1 path: src/bundle/Controller/ContentTypeController.php - - - message: "#^Method Ibexa\\\\Bundle\\\\AdminUi\\\\Controller\\\\ContentTypeController\\:\\:getContentTypesNumbers\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/bundle/Controller/ContentTypeController.php - - - - message: "#^Parameter \\#1 \\$array of class Pagerfanta\\\\Adapter\\\\ArrayAdapter constructor expects array, iterable\\ given\\.$#" - count: 1 - path: src/bundle/Controller/ContentTypeController.php - - - - message: "#^Parameter \\#1 \\$array of function usort expects TArray of array\\, iterable\\ given\\.$#" - count: 1 - path: src/bundle/Controller/ContentTypeController.php - - message: "#^Parameter \\#1 \\$contentType of method Ibexa\\\\Bundle\\\\AdminUi\\\\Controller\\\\ContentTypeController\\:\\:tryToCreateContentTypeDraft\\(\\) expects Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ContentType\\\\ContentType, Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ContentType\\\\ContentType\\|null given\\.$#" count: 2 @@ -285,16 +240,6 @@ parameters: count: 1 path: src/bundle/Controller/ContentTypeController.php - - - message: "#^Parameter \\#1 \\$contentTypes of method Ibexa\\\\Bundle\\\\AdminUi\\\\Controller\\\\ContentTypeController\\:\\:getContentTypesNumbers\\(\\) expects array\\, iterable\\<\\(int\\|string\\), mixed\\> given\\.$#" - count: 1 - path: src/bundle/Controller/ContentTypeController.php - - - - message: "#^Parameter \\#1 \\$string1 of function strnatcasecmp expects string, string\\|null given\\.$#" - count: 1 - path: src/bundle/Controller/ContentTypeController.php - - message: "#^Parameter \\#2 \\$handler of method Ibexa\\\\AdminUi\\\\Form\\\\SubmitHandler\\:\\:handle\\(\\) expects callable\\(mixed\\)\\: \\(Symfony\\\\Component\\\\HttpFoundation\\\\Response\\|null\\), Closure\\(\\)\\: void given\\.$#" count: 1 @@ -305,11 +250,6 @@ parameters: count: 1 path: src/bundle/Controller/ContentTypeController.php - - - message: "#^Parameter \\#2 \\$string2 of function strnatcasecmp expects string, string\\|null given\\.$#" - count: 1 - path: src/bundle/Controller/ContentTypeController.php - - message: "#^Variable \\$contentTypeGroupList in PHPDoc tag @var does not match assigned variable \\$types\\.$#" count: 1 @@ -330,16 +270,6 @@ parameters: count: 1 path: src/bundle/Controller/ContentTypeGroupController.php - - - message: "#^Parameter \\#1 \\$array of class Pagerfanta\\\\Adapter\\\\ArrayAdapter constructor expects array, iterable\\ given\\.$#" - count: 1 - path: src/bundle/Controller/ContentTypeGroupController.php - - - - message: "#^Parameter \\#1 \\$currentPage of method Pagerfanta\\\\Pagerfanta\\\\:\\:setCurrentPage\\(\\) expects int, int\\|string given\\.$#" - count: 1 - path: src/bundle/Controller/ContentTypeGroupController.php - - message: "#^Parameter \\#1 \\$identifier of method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\ContentTypeService\\:\\:newContentTypeGroupCreateStruct\\(\\) expects string, string\\|null given\\.$#" count: 1 @@ -455,16 +385,6 @@ parameters: count: 1 path: src/bundle/Controller/LanguageController.php - - - message: "#^Parameter \\#1 \\$array of class Pagerfanta\\\\Adapter\\\\ArrayAdapter constructor expects array, iterable\\ given\\.$#" - count: 1 - path: src/bundle/Controller/LanguageController.php - - - - message: "#^Parameter \\#1 \\$currentPage of method Pagerfanta\\\\Pagerfanta\\\\:\\:setCurrentPage\\(\\) expects int, int\\|string given\\.$#" - count: 1 - path: src/bundle/Controller/LanguageController.php - - message: "#^Parameter \\#1 \\$language of method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\LanguageService\\:\\:deleteLanguage\\(\\) expects Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Language, Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Language\\|null given\\.$#" count: 1 @@ -715,11 +635,6 @@ parameters: count: 1 path: src/bundle/Controller/PolicyController.php - - - message: "#^Parameter \\#1 \\$array of class Pagerfanta\\\\Adapter\\\\ArrayAdapter constructor expects array, iterable\\ given\\.$#" - count: 1 - path: src/bundle/Controller/PolicyController.php - - message: "#^Parameter \\#2 \\$policy of method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\RoleService\\:\\:updatePolicyByRoleDraft\\(\\) expects Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\PolicyDraft, Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\Policy given\\.$#" count: 1 @@ -765,21 +680,6 @@ parameters: count: 1 path: src/bundle/Controller/RoleController.php - - - message: "#^Parameter \\#1 \\$array of class Pagerfanta\\\\Adapter\\\\ArrayAdapter constructor expects array, iterable\\ given\\.$#" - count: 1 - path: src/bundle/Controller/RoleController.php - - - - message: "#^Parameter \\#1 \\$array of function array_column expects array, iterable\\<\\(int\\|string\\), mixed\\> given\\.$#" - count: 1 - path: src/bundle/Controller/RoleController.php - - - - message: "#^Parameter \\#1 \\$currentPage of method Pagerfanta\\\\Pagerfanta\\\\:\\:setCurrentPage\\(\\) expects int, int\\|string given\\.$#" - count: 1 - path: src/bundle/Controller/RoleController.php - - message: "#^Parameter \\#1 \\$role of method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\RoleService\\:\\:copyRole\\(\\) expects Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\Role, Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\Role\\|null given\\.$#" count: 1 @@ -790,11 +690,6 @@ parameters: count: 1 path: src/bundle/Controller/RoleController.php - - - message: "#^Variable \\$sectionList in PHPDoc tag @var does not match assigned variable \\$roles\\.$#" - count: 1 - path: src/bundle/Controller/RoleController.php - - message: "#^Argument of an invalid type array\\|null supplied for foreach, only iterables are supported\\.$#" count: 1 @@ -815,16 +710,6 @@ parameters: count: 1 path: src/bundle/Controller/SectionController.php - - - message: "#^Parameter \\#1 \\$array of class Pagerfanta\\\\Adapter\\\\ArrayAdapter constructor expects array, iterable\\ given\\.$#" - count: 1 - path: src/bundle/Controller/SectionController.php - - - - message: "#^Parameter \\#1 \\$currentPage of method Pagerfanta\\\\Pagerfanta\\\\:\\:setCurrentPage\\(\\) expects int, int\\|string given\\.$#" - count: 1 - path: src/bundle/Controller/SectionController.php - - message: "#^Parameter \\#1 \\$section of method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\SectionService\\:\\:deleteSection\\(\\) expects Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Section, Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Section\\|null given\\.$#" count: 1 @@ -885,16 +770,6 @@ parameters: count: 1 path: src/bundle/Controller/TrashController.php - - - message: "#^Parameter \\#1 \\$trashItems of class Ibexa\\\\AdminUi\\\\Form\\\\Data\\\\Trash\\\\TrashItemDeleteData constructor expects array\\, iterable\\<\\(int\\|string\\), mixed\\> given\\.$#" - count: 1 - path: src/bundle/Controller/TrashController.php - - - - message: "#^Parameter \\#1 \\$trashItems of class Ibexa\\\\AdminUi\\\\Form\\\\Data\\\\Trash\\\\TrashItemRestoreData constructor expects array\\, iterable\\<\\(int\\|string\\), mixed\\> given\\.$#" - count: 1 - path: src/bundle/Controller/TrashController.php - - message: "#^Variable \\$requestedPage in empty\\(\\) always exists and is always falsy\\.$#" count: 1 @@ -1045,21 +920,6 @@ parameters: count: 1 path: src/bundle/Controller/VersionController.php - - - message: "#^Method Ibexa\\\\Bundle\\\\AdminUi\\\\DependencyInjection\\\\Compiler\\\\FieldTypeFormMapperDispatcherPass\\:\\:process\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/DependencyInjection/Compiler/FieldTypeFormMapperDispatcherPass.php - - - - message: "#^Method Ibexa\\\\Bundle\\\\AdminUi\\\\DependencyInjection\\\\Compiler\\\\LimitationFormMapperPass\\:\\:process\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/DependencyInjection/Compiler/LimitationFormMapperPass.php - - - - message: "#^Method Ibexa\\\\Bundle\\\\AdminUi\\\\DependencyInjection\\\\Compiler\\\\LimitationValueMapperPass\\:\\:process\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/DependencyInjection/Compiler/LimitationValueMapperPass.php - - message: "#^Method Ibexa\\\\Bundle\\\\AdminUi\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\AdminUiForms\\:\\:addSemanticConfig\\(\\) has no return type specified\\.$#" count: 1 @@ -1215,11 +1075,6 @@ parameters: count: 1 path: src/bundle/DependencyInjection/IbexaAdminUiExtension.php - - - message: "#^Method Ibexa\\\\Bundle\\\\AdminUi\\\\DependencyInjection\\\\IbexaAdminUiExtension\\:\\:prepend\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/DependencyInjection/IbexaAdminUiExtension.php - - message: "#^Method Ibexa\\\\Bundle\\\\AdminUi\\\\DependencyInjection\\\\IbexaAdminUiExtension\\:\\:prependAdminUiFormsConfiguration\\(\\) has no return type specified\\.$#" count: 1 @@ -1255,51 +1110,6 @@ parameters: count: 1 path: src/bundle/IbexaAdminUiBundle.php - - - message: "#^Method Ibexa\\\\Bundle\\\\AdminUi\\\\IbexaAdminUiBundle\\:\\:build\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/IbexaAdminUiBundle.php - - - - message: "#^Negated boolean expression is always false\\.$#" - count: 1 - path: src/bundle/ParamConverter/ContentInfoParamConverter.php - - - - message: "#^Variable \\$contentType might not be defined\\.$#" - count: 1 - path: src/bundle/ParamConverter/ContentTypeParamConverter.php - - - - message: "#^Variable \\$identifier might not be defined\\.$#" - count: 1 - path: src/bundle/ParamConverter/ContentTypeParamConverter.php - - - - message: "#^Variable \\$language might not be defined\\.$#" - count: 1 - path: src/bundle/ParamConverter/LanguageParamConverter.php - - - - message: "#^Negated boolean expression is always false\\.$#" - count: 1 - path: src/bundle/ParamConverter/ObjectStateGroupParamConverter.php - - - - message: "#^Negated boolean expression is always false\\.$#" - count: 1 - path: src/bundle/ParamConverter/ObjectStateParamConverter.php - - - - message: "#^Access to an undefined property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\Policy\\:\\:\\$originalId\\.$#" - count: 1 - path: src/bundle/ParamConverter/PolicyDraftParamConverter.php - - - - message: "#^Negated boolean expression is always false\\.$#" - count: 1 - path: src/bundle/ParamConverter/PolicyDraftParamConverter.php - - message: "#^Method Ibexa\\\\Bundle\\\\AdminUi\\\\Templating\\\\Twig\\\\ComponentExtension\\:\\:renderComponent\\(\\) has no return type specified\\.$#" count: 1 @@ -1405,16 +1215,6 @@ parameters: count: 1 path: src/bundle/Templating/Twig/UserPreferencesGlobalExtension.php - - - message: "#^Property Ibexa\\\\Bundle\\\\AdminUi\\\\View\\\\EzPagerfantaView\\:\\:\\$translator is never written, only read\\.$#" - count: 1 - path: src/bundle/View/EzPagerfantaView.php - - - - message: "#^Constructor of class Ibexa\\\\Bundle\\\\AdminUi\\\\View\\\\Template\\\\EzPagerfantaTemplate has an unused parameter \\$translator\\.$#" - count: 1 - path: src/bundle/View/Template/EzPagerfantaTemplate.php - - message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Component\\\\Renderable\\:\\:render\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#" count: 1 @@ -1440,56 +1240,6 @@ parameters: count: 1 path: src/contracts/Component/Renderer/RendererInterface.php - - - message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Controller\\\\Controller\\:\\:performAccessCheck\\(\\) has no return type specified\\.$#" - count: 1 - path: src/contracts/Controller/Controller.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Event\\\\FormActionEvent\\:\\:__construct\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/Event/FormActionEvent.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Event\\\\FormActionEvent\\:\\:__construct\\(\\) has parameter \\$payloads with no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/Event/FormActionEvent.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Event\\\\FormActionEvent\\:\\:getOptions\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/Event/FormActionEvent.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Event\\\\FormActionEvent\\:\\:getPayload\\(\\) has no return type specified\\.$#" - count: 1 - path: src/contracts/Event/FormActionEvent.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Event\\\\FormActionEvent\\:\\:getPayloads\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/Event/FormActionEvent.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Event\\\\FormActionEvent\\:\\:setPayload\\(\\) has parameter \\$payload with no type specified\\.$#" - count: 1 - path: src/contracts/Event/FormActionEvent.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Event\\\\FormActionEvent\\:\\:setPayloads\\(\\) has parameter \\$payloads with no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/Event/FormActionEvent.php - - - - message: "#^Property Ibexa\\\\Contracts\\\\AdminUi\\\\Event\\\\FormActionEvent\\:\\:\\$options type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/Event/FormActionEvent.php - - - - message: "#^Property Ibexa\\\\Contracts\\\\AdminUi\\\\Event\\\\FormActionEvent\\:\\:\\$payloads type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/Event/FormActionEvent.php - - message: "#^Method Ibexa\\\\Contracts\\\\AdminUi\\\\Form\\\\ActionDispatcher\\\\ActionDispatcherInterface\\:\\:dispatchFormAction\\(\\) has no return type specified\\.$#" count: 1 @@ -3930,26 +3680,6 @@ parameters: count: 2 path: src/lib/Form/Data/Asset/ImageAssetUploadData.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Data\\\\Bookmark\\\\BookmarkRemoveData\\:\\:__construct\\(\\) has parameter \\$bookmarks with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Form/Data/Bookmark/BookmarkRemoveData.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Data\\\\Bookmark\\\\BookmarkRemoveData\\:\\:getBookmarks\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Form/Data/Bookmark/BookmarkRemoveData.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Data\\\\Bookmark\\\\BookmarkRemoveData\\:\\:setBookmarks\\(\\) has parameter \\$bookmarks with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Form/Data/Bookmark/BookmarkRemoveData.php - - - - message: "#^Property Ibexa\\\\AdminUi\\\\Form\\\\Data\\\\Bookmark\\\\BookmarkRemoveData\\:\\:\\$bookmarks type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Form/Data/Bookmark/BookmarkRemoveData.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Data\\\\Content\\\\CustomUrl\\\\CustomUrlRemoveData\\:\\:__construct\\(\\) has parameter \\$urlAliases with no value type specified in iterable type array\\.$#" count: 1 @@ -4115,26 +3845,6 @@ parameters: count: 2 path: src/lib/Form/Data/ContentType/ContentTypeCopyData.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Data\\\\ContentType\\\\ContentTypesDeleteData\\:\\:__construct\\(\\) has parameter \\$contentTypes with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Form/Data/ContentType/ContentTypesDeleteData.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Data\\\\ContentType\\\\ContentTypesDeleteData\\:\\:getContentTypes\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Form/Data/ContentType/ContentTypesDeleteData.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Data\\\\ContentType\\\\ContentTypesDeleteData\\:\\:setContentTypes\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Data/ContentType/ContentTypesDeleteData.php - - - - message: "#^PHPDoc tag @param for parameter \\$contentTypes with type array\\\\|null is not subtype of native type array\\.$#" - count: 1 - path: src/lib/Form/Data/ContentType/ContentTypesDeleteData.php - - message: "#^PHPDoc tag @param for parameter \\$baseLanguage with type Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Language\\|null is not subtype of native type Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Language\\.$#" count: 1 @@ -6190,51 +5900,6 @@ parameters: count: 1 path: src/lib/Form/Type/Bookmark/BookmarkRemoveType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ChoiceList\\\\Loader\\\\AvailableTranslationLanguageChoiceLoader\\:\\:getChoiceList\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/AvailableTranslationLanguageChoiceLoader.php - - - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\ given\\.$#" - count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/AvailableTranslationLanguageChoiceLoader.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ChoiceList\\\\Loader\\\\BaseChoiceLoader\\:\\:getChoiceList\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/BaseChoiceLoader.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ChoiceList\\\\Loader\\\\BaseTranslationLanguageChoiceLoader\\:\\:getChoiceList\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/BaseTranslationLanguageChoiceLoader.php - - - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\ given\\.$#" - count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/BaseTranslationLanguageChoiceLoader.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ChoiceList\\\\Loader\\\\ConfiguredLanguagesChoiceLoader\\:\\:getChoiceList\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/ConfiguredLanguagesChoiceLoader.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ChoiceList\\\\Loader\\\\ContentCreateContentTypeChoiceLoader\\:\\:setRestrictedContentTypeIds\\(\\) has parameter \\$restrictedContentTypeIds with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/ContentCreateContentTypeChoiceLoader.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ChoiceList\\\\Loader\\\\ContentCreateLanguageChoiceLoader\\:\\:__construct\\(\\) has parameter \\$restrictedLanguagesCodes with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/ContentCreateLanguageChoiceLoader.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ChoiceList\\\\Loader\\\\ContentEditTranslationChoiceLoader\\:\\:getChoiceList\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/ContentEditTranslationChoiceLoader.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ChoiceList\\\\Loader\\\\ContentEditTranslationChoiceLoader\\:\\:getChoiceList\\(\\) should return array but returns iterable\\\\.$#" count: 1 @@ -6261,97 +5926,52 @@ parameters: path: src/lib/Form/Type/ChoiceList/Loader/ContentEditTranslationChoiceLoader.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ChoiceList\\\\Loader\\\\ContentTypeChoiceLoader\\:\\:getChoiceList\\(\\) return type has no value type specified in iterable type array\\.$#" + message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\ContentInfoType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/ContentTypeChoiceLoader.php + path: src/lib/Form/Type/Content/ContentInfoType.php - - message: "#^Parameter \\#1 \\$array of function usort expects TArray of array\\, iterable\\ given\\.$#" + message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\ContentType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/ContentTypeChoiceLoader.php + path: src/lib/Form/Type/Content/ContentType.php - - message: "#^Parameter \\#1 \\$string1 of function strnatcasecmp expects string, string\\|null given\\.$#" + message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\ContentTypeSubmitType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/ContentTypeChoiceLoader.php + path: src/lib/Form/Type/Content/ContentTypeSubmitType.php - - message: "#^Parameter \\#2 \\$string2 of function strnatcasecmp expects string, string\\|null given\\.$#" + message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\ContentTypeType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/ContentTypeChoiceLoader.php + path: src/lib/Form/Type/Content/ContentTypeType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ChoiceList\\\\Loader\\\\DatePeriodChoiceLoader\\:\\:getChoiceList\\(\\) return type has no value type specified in iterable type array\\.$#" + message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\ContentVisibilityUpdateType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/DatePeriodChoiceLoader.php + path: src/lib/Form/Type/Content/ContentVisibilityUpdateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ChoiceList\\\\Loader\\\\DatePeriodChoiceLoader\\:\\:getDatePeriods\\(\\) return type has no value type specified in iterable type array\\.$#" + message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\CustomUrl\\\\CustomUrlAddType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/DatePeriodChoiceLoader.php + path: src/lib/Form/Type/Content/CustomUrl/CustomUrlAddType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ChoiceList\\\\Loader\\\\LanguageChoiceLoader\\:\\:getChoiceList\\(\\) return type has no value type specified in iterable type array\\.$#" + message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\CustomUrl\\\\CustomUrlAddType\\:\\:buildForm\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/LanguageChoiceLoader.php + path: src/lib/Form/Type/Content/CustomUrl/CustomUrlAddType.php - - message: "#^Property Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ChoiceList\\\\Loader\\\\SiteAccessChoiceLoader\\:\\:\\$nonAdminSiteaccessResolver \\(Ibexa\\\\AdminUi\\\\Siteaccess\\\\NonAdminSiteaccessResolver\\) does not accept Ibexa\\\\AdminUi\\\\Siteaccess\\\\SiteaccessResolverInterface\\.$#" + message: "#^Property Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\CustomUrl\\\\CustomUrlAddType\\:\\:\\$nonAdminSiteaccessResolver \\(Ibexa\\\\AdminUi\\\\Siteaccess\\\\NonAdminSiteaccessResolver\\) does not accept Ibexa\\\\AdminUi\\\\Siteaccess\\\\SiteaccessResolverInterface\\.$#" count: 1 - path: src/lib/Form/Type/ChoiceList/Loader/SiteAccessChoiceLoader.php + path: src/lib/Form/Type/Content/CustomUrl/CustomUrlAddType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\ContentInfoType\\:\\:buildForm\\(\\) has no return type specified\\.$#" + message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\CustomUrl\\\\CustomUrlRemoveType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 - path: src/lib/Form/Type/Content/ContentInfoType.php + path: src/lib/Form/Type/Content/CustomUrl/CustomUrlRemoveType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\ContentType\\:\\:buildForm\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Content/ContentType.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\ContentTypeSubmitType\\:\\:buildForm\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Content/ContentTypeSubmitType.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\ContentTypeType\\:\\:buildForm\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Content/ContentTypeType.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\ContentVisibilityUpdateType\\:\\:buildForm\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Content/ContentVisibilityUpdateType.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\ContentVisibilityUpdateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Content/ContentVisibilityUpdateType.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\CustomUrl\\\\CustomUrlAddType\\:\\:buildForm\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Content/CustomUrl/CustomUrlAddType.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\CustomUrl\\\\CustomUrlAddType\\:\\:buildForm\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Form/Type/Content/CustomUrl/CustomUrlAddType.php - - - - message: "#^Property Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\CustomUrl\\\\CustomUrlAddType\\:\\:\\$nonAdminSiteaccessResolver \\(Ibexa\\\\AdminUi\\\\Siteaccess\\\\NonAdminSiteaccessResolver\\) does not accept Ibexa\\\\AdminUi\\\\Siteaccess\\\\SiteaccessResolverInterface\\.$#" - count: 1 - path: src/lib/Form/Type/Content/CustomUrl/CustomUrlAddType.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\CustomUrl\\\\CustomUrlRemoveType\\:\\:buildForm\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Content/CustomUrl/CustomUrlRemoveType.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\CustomUrl\\\\CustomUrlRemoveType\\:\\:buildForm\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" + message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\CustomUrl\\\\CustomUrlRemoveType\\:\\:buildForm\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 path: src/lib/Form/Type/Content/CustomUrl/CustomUrlRemoveType.php @@ -6365,11 +5985,6 @@ parameters: count: 1 path: src/lib/Form/Type/Content/Draft/ContentCreateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\Draft\\\\ContentCreateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Content/Draft/ContentCreateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\Draft\\\\ContentCreateType\\:\\:getLimitationValuesForLocation\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -6385,11 +6000,6 @@ parameters: count: 1 path: src/lib/Form/Type/Content/Draft/ContentEditType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\Draft\\\\ContentEditType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Content/Draft/ContentEditType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\Draft\\\\ContentEditType\\:\\:getLanguageOptions\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 @@ -6405,41 +6015,21 @@ parameters: count: 1 path: src/lib/Form/Type/Content/Location/ContentLocationAddType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\Location\\\\ContentLocationAddType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Content/Location/ContentLocationAddType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\Location\\\\ContentLocationRemoveType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Content/Location/ContentLocationRemoveType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\Location\\\\ContentLocationRemoveType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Content/Location/ContentLocationRemoveType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\Location\\\\ContentMainLocationUpdateType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Content/Location/ContentMainLocationUpdateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\Location\\\\ContentMainLocationUpdateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Content/Location/ContentMainLocationUpdateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\LocationType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Content/LocationType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\LocationType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Content/LocationType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\SortType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 @@ -6455,21 +6045,11 @@ parameters: count: 1 path: src/lib/Form/Type/Content/Translation/MainTranslationUpdateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\Translation\\\\MainTranslationUpdateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Content/Translation/MainTranslationUpdateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\Translation\\\\TranslationAddType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Content/Translation/TranslationAddType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\Translation\\\\TranslationAddType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Content/Translation/TranslationAddType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\Translation\\\\TranslationAddType\\:\\:loadLanguages\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -6505,36 +6085,16 @@ parameters: count: 1 path: src/lib/Form/Type/Content/Translation/TranslationDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\Translation\\\\TranslationDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Content/Translation/TranslationDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Content\\\\VersionInfoType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Content/VersionInfoType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\ContentTypeChoiceType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentType/ContentTypeChoiceType.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\ContentTypeCopyType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentType/ContentTypeCopyType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\ContentTypeCreateType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/ContentType/ContentTypeCreateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\ContentTypeCreateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentType/ContentTypeCreateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\ContentTypeCreateType\\:\\:getName\\(\\) has no return type specified\\.$#" count: 1 @@ -6545,31 +6105,16 @@ parameters: count: 1 path: src/lib/Form/Type/ContentType/ContentTypeDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\ContentTypeDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentType/ContentTypeDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\ContentTypeDeleteType\\:\\:getName\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/ContentType/ContentTypeDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\ContentTypeEditType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentType/ContentTypeEditType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\ContentTypeGroupDeleteType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/ContentType/ContentTypeGroupDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\ContentTypeGroupDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentType/ContentTypeGroupDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\ContentTypeGroupDeleteType\\:\\:getName\\(\\) has no return type specified\\.$#" count: 1 @@ -6580,11 +6125,6 @@ parameters: count: 1 path: src/lib/Form/Type/ContentType/ContentTypeGroupType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\ContentTypeGroupType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentType/ContentTypeGroupType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\ContentTypeGroupType\\:\\:getName\\(\\) has no return type specified\\.$#" count: 1 @@ -6595,11 +6135,6 @@ parameters: count: 1 path: src/lib/Form/Type/ContentType/ContentTypeUpdateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\ContentTypeUpdateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentType/ContentTypeUpdateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\ContentTypeUpdateType\\:\\:getName\\(\\) has no return type specified\\.$#" count: 1 @@ -6610,21 +6145,11 @@ parameters: count: 1 path: src/lib/Form/Type/ContentType/ContentTypesDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\ContentTypesDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentType/ContentTypesDeleteType.php - - message: "#^Parameter \\#1 \\$child of method Symfony\\\\Component\\\\Form\\\\FormBuilderInterface\\\\:\\:add\\(\\) expects string\\|Symfony\\\\Component\\\\Form\\\\FormBuilderInterface, int\\|string given\\.$#" count: 1 path: src/lib/Form/Type/ContentType/FieldDefinitionsCollectionType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\FieldTypeChoiceType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentType/FieldTypeChoiceType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\FieldTypeChoiceType\\:\\:getFieldTypeChoices\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -6635,11 +6160,6 @@ parameters: count: 1 path: src/lib/Form/Type/ContentType/FieldTypeChoiceType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\SortFieldChoiceType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentType/SortFieldChoiceType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\SortFieldChoiceType\\:\\:getSortField\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -6650,11 +6170,6 @@ parameters: count: 1 path: src/lib/Form/Type/ContentType/SortFieldChoiceType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\SortOrderChoiceType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentType/SortOrderChoiceType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\SortOrderChoiceType\\:\\:getSortOrder\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -6675,11 +6190,6 @@ parameters: count: 1 path: src/lib/Form/Type/ContentType/Translation/TranslationAddType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\Translation\\\\TranslationAddType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentType/Translation/TranslationAddType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\Translation\\\\TranslationAddType\\:\\:loadLanguages\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -6710,31 +6220,16 @@ parameters: count: 1 path: src/lib/Form/Type/ContentType/Translation/TranslationRemoveType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentType\\\\Translation\\\\TranslationRemoveType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentType/Translation/TranslationRemoveType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentTypeGroup\\\\ContentTypeGroupCreateType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupCreateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentTypeGroup\\\\ContentTypeGroupCreateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupCreateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentTypeGroup\\\\ContentTypeGroupDeleteType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentTypeGroup\\\\ContentTypeGroupDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentTypeGroup\\\\ContentTypeGroupType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 @@ -6745,21 +6240,11 @@ parameters: count: 1 path: src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupUpdateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentTypeGroup\\\\ContentTypeGroupUpdateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupUpdateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentTypeGroup\\\\ContentTypeGroupsDeleteType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupsDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ContentTypeGroup\\\\ContentTypeGroupsDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ContentTypeGroup/ContentTypeGroupsDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Date\\\\DateIntervalType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 @@ -6785,31 +6270,16 @@ parameters: count: 1 path: src/lib/Form/Type/DateTimePickerType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\DateTimePickerType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/DateTimePickerType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Embedded\\\\SectionType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Embedded/SectionType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Embedded\\\\SectionType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Embedded/SectionType.php - - message: "#^Call to an undefined method Symfony\\\\Component\\\\Form\\\\FormInterface\\:\\:isClicked\\(\\)\\.$#" count: 1 path: src/lib/Form/Type/Extension/Content/ContentEditTypeExtension.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Extension\\\\Content\\\\ContentEditTypeExtension\\:\\:buildForm\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Extension/Content/ContentEditTypeExtension.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Extension\\\\Content\\\\ContentEditTypeExtension\\:\\:buildForm\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 @@ -6830,11 +6300,6 @@ parameters: count: 1 path: src/lib/Form/Type/FieldDefinition/FieldDefinitionType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\FieldDefinition\\\\FieldDefinitionType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/FieldDefinition/FieldDefinitionType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\FieldDefinition\\\\FieldDefinitionType\\:\\:getName\\(\\) has no return type specified\\.$#" count: 1 @@ -6860,21 +6325,11 @@ parameters: count: 1 path: src/lib/Form/Type/Language/LanguageCreateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Language\\\\LanguageCreateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Language/LanguageCreateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Language\\\\LanguageDeleteType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Language/LanguageDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Language\\\\LanguageDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Language/LanguageDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Language\\\\LanguageType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 @@ -6885,61 +6340,26 @@ parameters: count: 1 path: src/lib/Form/Type/Language/LanguageUpdateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Language\\\\LanguageUpdateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Language/LanguageUpdateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Language\\\\LanguagesDeleteType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Language/LanguagesDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Language\\\\LanguagesDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Language/LanguagesDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Location\\\\AbstractLocationCopyType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Location/AbstractLocationCopyType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Location\\\\AbstractLocationCopyType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Location/AbstractLocationCopyType.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Location\\\\LocationCopySubtreeType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Location/LocationCopySubtreeType.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Location\\\\LocationCopyType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Location/LocationCopyType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Location\\\\LocationMoveType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Location/LocationMoveType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Location\\\\LocationMoveType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Location/LocationMoveType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Location\\\\LocationSwapType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Location/LocationSwapType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Location\\\\LocationSwapType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Location/LocationSwapType.php - - message: "#^Cannot call method get\\(\\) on Symfony\\\\Component\\\\Form\\\\FormInterface\\|null\\.$#" count: 3 @@ -6955,11 +6375,6 @@ parameters: count: 1 path: src/lib/Form/Type/Location/LocationTrashType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Location\\\\LocationTrashType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Location/LocationTrashType.php - - message: "#^Parameter \\#1 \\$form of method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Location\\\\LocationTrashType\\:\\:addConfirmCheckbox\\(\\) expects Symfony\\\\Component\\\\Form\\\\FormInterface, Symfony\\\\Component\\\\Form\\\\FormInterface\\|null given\\.$#" count: 2 @@ -6970,21 +6385,11 @@ parameters: count: 1 path: src/lib/Form/Type/Location/LocationUpdateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Location\\\\LocationUpdateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Location/LocationUpdateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Location\\\\LocationUpdateVisibilityType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Location/LocationUpdateVisibilityType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Location\\\\LocationUpdateVisibilityType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Location/LocationUpdateVisibilityType.php - - message: "#^Anonymous function has an unused use \\$contentState\\.$#" count: 1 @@ -6995,61 +6400,31 @@ parameters: count: 1 path: src/lib/Form/Type/ObjectState/ContentObjectStateUpdateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ContentObjectStateUpdateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ObjectState/ContentObjectStateUpdateType.php - - message: "#^Parameter \\#1 \\$array of function array_filter expects array, iterable\\ given\\.$#" count: 1 path: src/lib/Form/Type/ObjectState/ContentObjectStateUpdateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStateChoiceType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ObjectState/ObjectStateChoiceType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStateCreateType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/ObjectState/ObjectStateCreateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStateCreateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ObjectState/ObjectStateCreateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStateDeleteType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/ObjectState/ObjectStateDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStateDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ObjectState/ObjectStateDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStateGroupCreateType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/ObjectState/ObjectStateGroupCreateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStateGroupCreateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ObjectState/ObjectStateGroupCreateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStateGroupDeleteType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/ObjectState/ObjectStateGroupDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStateGroupDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ObjectState/ObjectStateGroupDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStateGroupType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 @@ -7060,21 +6435,11 @@ parameters: count: 1 path: src/lib/Form/Type/ObjectState/ObjectStateGroupUpdateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStateGroupUpdateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ObjectState/ObjectStateGroupUpdateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStateGroupsDeleteType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/ObjectState/ObjectStateGroupsDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStateGroupsDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ObjectState/ObjectStateGroupsDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStateType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 @@ -7085,31 +6450,16 @@ parameters: count: 1 path: src/lib/Form/Type/ObjectState/ObjectStateUpdateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStateUpdateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ObjectState/ObjectStateUpdateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStatesDeleteType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/ObjectState/ObjectStatesDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\ObjectState\\\\ObjectStatesDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/ObjectState/ObjectStatesDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Policy\\\\PoliciesDeleteType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Policy/PoliciesDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Policy\\\\PoliciesDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Policy/PoliciesDeleteType.php - - message: "#^Constructor of class Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Policy\\\\PolicyChoiceType has an unused parameter \\$translator\\.$#" count: 1 @@ -7135,11 +6485,6 @@ parameters: count: 1 path: src/lib/Form/Type/Policy/PolicyChoiceType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Policy\\\\PolicyChoiceType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Policy/PolicyChoiceType.php - - message: "#^Property Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Policy\\\\PolicyChoiceType\\:\\:\\$policyChoices type has no value type specified in iterable type array\\.$#" count: 1 @@ -7150,11 +6495,6 @@ parameters: count: 1 path: src/lib/Form/Type/Policy/PolicyCreateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Policy\\\\PolicyCreateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Policy/PolicyCreateType.php - - message: "#^Anonymous function has an unused use \\$options\\.$#" count: 1 @@ -7165,11 +6505,6 @@ parameters: count: 1 path: src/lib/Form/Type/Policy/PolicyCreateWithLimitationType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Policy\\\\PolicyCreateWithLimitationType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Policy/PolicyCreateWithLimitationType.php - - message: "#^Parameter \\#1 \\$existingLimitations of method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Policy\\\\PolicyCreateWithLimitationType\\:\\:generateLimitationList\\(\\) expects array\\, array\\|null given\\.$#" count: 1 @@ -7195,11 +6530,6 @@ parameters: count: 1 path: src/lib/Form/Type/Policy/PolicyDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Policy\\\\PolicyDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Policy/PolicyDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Policy\\\\PolicyType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 @@ -7215,11 +6545,6 @@ parameters: count: 1 path: src/lib/Form/Type/Policy/PolicyUpdateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Policy\\\\PolicyUpdateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Policy/PolicyUpdateType.php - - message: "#^Parameter \\#1 \\$existingLimitations of method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Policy\\\\PolicyUpdateType\\:\\:generateLimitationList\\(\\) expects array\\, array\\|null given\\.$#" count: 1 @@ -7250,11 +6575,6 @@ parameters: count: 1 path: src/lib/Form/Type/Role/LimitationType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\LimitationType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Role/LimitationType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\LimitationType\\:\\:getName\\(\\) has no return type specified\\.$#" count: 1 @@ -7265,21 +6585,11 @@ parameters: count: 1 path: src/lib/Form/Type/Role/RoleAssignmentCreateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\RoleAssignmentCreateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Role/RoleAssignmentCreateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\RoleAssignmentDeleteType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Role/RoleAssignmentDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\RoleAssignmentDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Role/RoleAssignmentDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\RoleAssignmentType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 @@ -7290,41 +6600,21 @@ parameters: count: 1 path: src/lib/Form/Type/Role/RoleAssignmentsDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\RoleAssignmentsDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Role/RoleAssignmentsDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\RoleCopyType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Role/RoleCopyType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\RoleCopyType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Role/RoleCopyType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\RoleCreateType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Role/RoleCreateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\RoleCreateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Role/RoleCreateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\RoleDeleteType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Role/RoleDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\RoleDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Role/RoleDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\RoleType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 @@ -7335,41 +6625,21 @@ parameters: count: 1 path: src/lib/Form/Type/Role/RoleUpdateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\RoleUpdateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Role/RoleUpdateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\RolesDeleteType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Role/RolesDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Role\\\\RolesDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Role/RolesDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\RoleAssignment\\\\RoleAssignmentType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/RoleAssignment/RoleAssignmentType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\RoleAssignment\\\\RoleAssignmentType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/RoleAssignment/RoleAssignmentType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Search\\\\SearchType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Search/SearchType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Search\\\\SearchType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Search/SearchType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Search\\\\SearchType\\:\\:getTimePeriodChoices\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -7385,86 +6655,41 @@ parameters: count: 1 path: src/lib/Form/Type/Search/TrashSearchType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Search\\\\TrashSearchType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Search/TrashSearchType.php - - message: "#^Property Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Search\\\\TrashSearchType\\:\\:\\$translator is never read, only written\\.$#" count: 1 path: src/lib/Form/Type/Search/TrashSearchType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Section\\\\SectionChoiceType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Section/SectionChoiceType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Section\\\\SectionContentAssignType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Section/SectionContentAssignType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Section\\\\SectionContentAssignType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Section/SectionContentAssignType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Section\\\\SectionCreateType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Section/SectionCreateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Section\\\\SectionCreateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Section/SectionCreateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Section\\\\SectionDeleteType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Section/SectionDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Section\\\\SectionDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Section/SectionDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Section\\\\SectionType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Section/SectionType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Section\\\\SectionType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Section/SectionType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Section\\\\SectionUpdateType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Section/SectionUpdateType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Section\\\\SectionUpdateType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Section/SectionUpdateType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Section\\\\SectionsDeleteType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Section/SectionsDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Section\\\\SectionsDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Section/SectionsDeleteType.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\SwitcherType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/SwitcherType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\SwitcherType\\:\\:getName\\(\\) has no return type specified\\.$#" count: 1 @@ -7475,11 +6700,6 @@ parameters: count: 1 path: src/lib/Form/Type/Trash/TrashEmptyType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Trash\\\\TrashEmptyType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Trash/TrashEmptyType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Trash\\\\TrashItemCheckboxType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 @@ -7490,11 +6710,6 @@ parameters: count: 1 path: src/lib/Form/Type/Trash/TrashItemCheckboxType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Trash\\\\TrashItemCheckboxType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Trash/TrashItemCheckboxType.php - - message: "#^Property Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Trash\\\\TrashItemCheckboxType\\:\\:\\$trashService has no type specified\\.$#" count: 1 @@ -7505,31 +6720,16 @@ parameters: count: 1 path: src/lib/Form/Type/Trash/TrashItemDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Trash\\\\TrashItemDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Trash/TrashItemDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Trash\\\\TrashItemRestoreType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Trash/TrashItemRestoreType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Trash\\\\TrashItemRestoreType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Trash/TrashItemRestoreType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\URL\\\\URLEditType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/URL/URLEditType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\URL\\\\URLEditType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/URL/URLEditType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\URL\\\\URLEditType\\:\\:getName\\(\\) has no return type specified\\.$#" count: 1 @@ -7540,31 +6740,16 @@ parameters: count: 1 path: src/lib/Form/Type/URL/URLListType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\URL\\\\URLListType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/URL/URLListType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\URL\\\\URLListType\\:\\:getName\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/URL/URLListType.php - - - message: "#^Cannot access property \\$vars on Symfony\\\\Component\\\\Form\\\\FormView\\|null\\.$#" - count: 7 - path: src/lib/Form/Type/UniversalDiscoveryWidget/UniversalDiscoveryWidgetType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\UniversalDiscoveryWidget\\\\UniversalDiscoveryWidgetType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/UniversalDiscoveryWidget/UniversalDiscoveryWidgetType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\UniversalDiscoveryWidget\\\\UniversalDiscoveryWidgetType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/UniversalDiscoveryWidget/UniversalDiscoveryWidgetType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\UniversalDiscoveryWidget\\\\UniversalDiscoveryWidgetType\\:\\:finishView\\(\\) has no return type specified\\.$#" count: 1 @@ -7585,21 +6770,11 @@ parameters: count: 1 path: src/lib/Form/Type/User/UserDeleteType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\User\\\\UserDeleteType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/User/UserDeleteType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\User\\\\UserEditType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/User/UserEditType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\User\\\\UserEditType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/User/UserEditType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\User\\\\UserEditType\\:\\:getLanguageOptions\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 @@ -7620,41 +6795,16 @@ parameters: count: 1 path: src/lib/Form/Type/User/UserInvitationType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\User\\\\UserInvitationType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/User/UserInvitationType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\User\\\\UserType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/User/UserType.php - - - message: "#^Access to an undefined property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ValueObject\\:\\:\\$id\\.$#" - count: 1 - path: src/lib/Form/Type/UserChoiceType.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\UserChoiceType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/UserChoiceType.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\UserGroupChoiceType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/UserGroupChoiceType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Version\\\\VersionRemoveType\\:\\:buildForm\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Form/Type/Version/VersionRemoveType.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Form\\\\Type\\\\Version\\\\VersionRemoveType\\:\\:configureOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Form/Type/Version/VersionRemoveType.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Limitation\\\\LimitationFormMapperInterface\\:\\:filterLimitationValues\\(\\) has no return type specified\\.$#" count: 1 @@ -7820,21 +6970,11 @@ parameters: count: 1 path: src/lib/Limitation/Mapper/SiteAccessLimitationMapper.php - - - message: "#^Call to an undefined method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ValueObject\\:\\:getContentInfo\\(\\)\\.$#" - count: 1 - path: src/lib/Limitation/Mapper/SubtreeLimitationMapper.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Limitation\\\\Mapper\\\\SubtreeLimitationMapper\\:\\:filterLimitationValues\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/Limitation/Mapper/SubtreeLimitationMapper.php - - - message: "#^Call to an undefined method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\ValueObject\\:\\:getContentInfo\\(\\)\\.$#" - count: 1 - path: src/lib/Limitation/Mapper/UDWBasedMapper.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Limitation\\\\Mapper\\\\UDWBasedMapper\\:\\:filterLimitationValues\\(\\) has no return type specified\\.$#" count: 1 @@ -7905,11 +7045,6 @@ parameters: count: 1 path: src/lib/Limitation/Templating/LimitationBlockRendererInterface.php - - - message: "#^Cannot access property \\$vars on Symfony\\\\Component\\\\Form\\\\FormView\\|null\\.$#" - count: 3 - path: src/lib/Menu/Admin/ContentType/AbstractContentTypeRightSidebarBuilder.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Menu\\\\Admin\\\\ContentType\\\\AbstractContentTypeRightSidebarBuilder\\:\\:createStructure\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#" count: 1 @@ -8242,7 +7377,7 @@ parameters: - message: "#^Call to an undefined method Symfony\\\\Component\\\\HttpFoundation\\\\Session\\\\SessionInterface\\:\\:getFlashBag\\(\\)\\.$#" - count: 4 + count: 1 path: src/lib/Notification/FlashBagNotificationHandler.php - @@ -8280,76 +7415,6 @@ parameters: count: 1 path: src/lib/Pagination/Mapper/AbstractPagerContentToDataMapper.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Pagination\\\\Pagerfanta\\\\BookmarkAdapter\\:\\:getSlice\\(\\) return type has no value type specified in iterable type Traversable\\.$#" - count: 1 - path: src/lib/Pagination/Pagerfanta/BookmarkAdapter.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Pagination\\\\Pagerfanta\\\\BookmarkAdapter\\:\\:getSlice\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Pagination/Pagerfanta/BookmarkAdapter.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Pagination\\\\Pagerfanta\\\\BookmarkAdapter\\:\\:getSlice\\(\\) return type has no value type specified in iterable type array\\|Traversable\\.$#" - count: 1 - path: src/lib/Pagination/Pagerfanta/BookmarkAdapter.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Pagination\\\\Pagerfanta\\\\ContentDraftAdapter\\:\\:getSlice\\(\\) return type has no value type specified in iterable type Traversable\\.$#" - count: 1 - path: src/lib/Pagination/Pagerfanta/ContentDraftAdapter.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Pagination\\\\Pagerfanta\\\\ContentDraftAdapter\\:\\:getSlice\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Pagination/Pagerfanta/ContentDraftAdapter.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Pagination\\\\Pagerfanta\\\\ContentDraftAdapter\\:\\:getSlice\\(\\) return type has no value type specified in iterable type array\\|Traversable\\.$#" - count: 1 - path: src/lib/Pagination/Pagerfanta/ContentDraftAdapter.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Pagination\\\\Pagerfanta\\\\ReverseRelationAdapter\\:\\:getSlice\\(\\) return type has no value type specified in iterable type Traversable\\.$#" - count: 1 - path: src/lib/Pagination/Pagerfanta/ReverseRelationAdapter.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Pagination\\\\Pagerfanta\\\\ReverseRelationAdapter\\:\\:getSlice\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Pagination/Pagerfanta/ReverseRelationAdapter.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Pagination\\\\Pagerfanta\\\\ReverseRelationAdapter\\:\\:getSlice\\(\\) return type has no value type specified in iterable type array\\|Traversable\\.$#" - count: 1 - path: src/lib/Pagination/Pagerfanta/ReverseRelationAdapter.php - - - - message: "#^Property Ibexa\\\\AdminUi\\\\Pagination\\\\Pagerfanta\\\\TrashItemAdapter\\:\\:\\$nbResults \\(int\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: src/lib/Pagination/Pagerfanta/TrashItemAdapter.php - - - - message: "#^Unreachable statement \\- code above always terminates\\.$#" - count: 1 - path: src/lib/Pagination/Pagerfanta/TrashItemAdapter.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Pagination\\\\Pagerfanta\\\\URLSearchAdapter\\:\\:getNbResults\\(\\) should return int but returns int\\|null\\.$#" - count: 1 - path: src/lib/Pagination/Pagerfanta/URLSearchAdapter.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Pagination\\\\Pagerfanta\\\\URLWildcardAdapter\\:\\:getNbResults\\(\\) should return int but returns int\\|null\\.$#" - count: 1 - path: src/lib/Pagination/Pagerfanta/URLWildcardAdapter.php - - - - message: "#^Property Ibexa\\\\AdminUi\\\\Pagination\\\\Pagerfanta\\\\URLWildcardAdapter\\:\\:\\$nbResults is unused\\.$#" - count: 1 - path: src/lib/Pagination/Pagerfanta/URLWildcardAdapter.php - - message: "#^Access to protected property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\User\\\\LookupLimitationResult\\:\\:\\$hasAccess\\.$#" count: 1 @@ -8948,30 +8013,20 @@ parameters: - message: "#^Parameter \\#1 \\$array of function array_column expects array, iterable\\ given\\.$#" count: 1 - path: src/lib/Tab/LocationView/TranslationsTab.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Tab\\\\LocationView\\\\UrlsTab\\:\\:createCustomUrlRemoveForm\\(\\) has parameter \\$customUrlAliases with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Tab/LocationView/UrlsTab.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Tab\\\\LocationView\\\\UrlsTab\\:\\:getChoices\\(\\) has parameter \\$customUrlAliases with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/Tab/LocationView/UrlsTab.php + path: src/lib/Tab/LocationView/TranslationsTab.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Tab\\\\LocationView\\\\UrlsTab\\:\\:getChoices\\(\\) return type has no value type specified in iterable type array\\.$#" + message: "#^Method Ibexa\\\\AdminUi\\\\Tab\\\\LocationView\\\\UrlsTab\\:\\:createCustomUrlRemoveForm\\(\\) has parameter \\$customUrlAliases with no value type specified in iterable type array\\.$#" count: 1 path: src/lib/Tab/LocationView/UrlsTab.php - - message: "#^Parameter \\#1 \\$array of class Pagerfanta\\\\Adapter\\\\ArrayAdapter constructor expects array, iterable\\ given\\.$#" + message: "#^Method Ibexa\\\\AdminUi\\\\Tab\\\\LocationView\\\\UrlsTab\\:\\:getChoices\\(\\) has parameter \\$customUrlAliases with no value type specified in iterable type array\\.$#" count: 1 path: src/lib/Tab/LocationView/UrlsTab.php - - message: "#^Parameter \\#2 \\$customUrlAliases of method Ibexa\\\\AdminUi\\\\Tab\\\\LocationView\\\\UrlsTab\\:\\:createCustomUrlRemoveForm\\(\\) expects array, iterable\\<\\(int\\|string\\), mixed\\> given\\.$#" + message: "#^Method Ibexa\\\\AdminUi\\\\Tab\\\\LocationView\\\\UrlsTab\\:\\:getChoices\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: src/lib/Tab/LocationView/UrlsTab.php @@ -8990,11 +8045,6 @@ parameters: count: 1 path: src/lib/Tab/LocationView/VersionsTab.php - - - message: "#^Parameter \\#2 \\$versions of method Ibexa\\\\AdminUi\\\\Tab\\\\LocationView\\\\VersionsTab\\:\\:createVersionRemoveForm\\(\\) expects array, iterable\\<\\(int\\|string\\), mixed\\> given\\.$#" - count: 1 - path: src/lib/Tab/LocationView/VersionsTab.php - - message: "#^Variable \\$policies in PHPDoc tag @var does not match assigned variable \\$draftVersions\\.$#" count: 1 @@ -9145,16 +8195,6 @@ parameters: count: 1 path: src/lib/Translation/Extractor/NotificationTranslationExtractor.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Translation\\\\Extractor\\\\NotificationTranslationExtractor\\:\\:enterNode\\(\\) should return int\\|PhpParser\\\\Node\\|null but empty return statement found\\.$#" - count: 4 - path: src/lib/Translation/Extractor/NotificationTranslationExtractor.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Translation\\\\Extractor\\\\NotificationTranslationExtractor\\:\\:enterNode\\(\\) should return int\\|PhpParser\\\\Node\\|null but return statement is missing\\.$#" - count: 1 - path: src/lib/Translation/Extractor/NotificationTranslationExtractor.php - - message: "#^Method Ibexa\\\\AdminUi\\\\Translation\\\\Extractor\\\\NotificationTranslationExtractor\\:\\:leaveNode\\(\\) should return array\\\\|int\\|PhpParser\\\\Node\\|null but return statement is missing\\.$#" count: 1 @@ -9570,11 +8610,6 @@ parameters: count: 1 path: src/lib/UI/Module/ContentTree/NodeFactory.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\UI\\\\Module\\\\ContentTree\\\\NodeFactory\\:\\:countSubitems\\(\\) should return int but returns int\\|null\\.$#" - count: 1 - path: src/lib/UI/Module/ContentTree/NodeFactory.php - - message: "#^Method Ibexa\\\\AdminUi\\\\UI\\\\Module\\\\ContentTree\\\\NodeFactory\\:\\:getSetting\\(\\) has no return type specified\\.$#" count: 1 @@ -9655,11 +8690,6 @@ parameters: count: 1 path: src/lib/UI/Module/Subitems/ValueObjectVisitor/SubitemsRow.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\UI\\\\Service\\\\PathService\\:\\:loadPathLocations\\(\\) should return array\\ but returns array\\\\.$#" - count: 1 - path: src/lib/UI/Service/PathService.php - - message: "#^Method Ibexa\\\\AdminUi\\\\UI\\\\Service\\\\TabService\\:\\:getTabsFromGroup\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -10015,31 +9045,11 @@ parameters: count: 1 path: src/lib/Validator/Constraints/FieldDefinitionDefaultValue.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Validator\\\\Constraints\\\\FieldDefinitionDefaultValueValidator\\:\\:validate\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Validator/Constraints/FieldDefinitionDefaultValueValidator.php - - - - message: "#^Parameter \\#1 \\$validationErrors of method Ibexa\\\\ContentForms\\\\Validator\\\\Constraints\\\\FieldTypeValidator\\:\\:processValidationErrors\\(\\) expects array\\, iterable\\ given\\.$#" - count: 1 - path: src/lib/Validator/Constraints/FieldDefinitionDefaultValueValidator.php - - message: "#^Property Ibexa\\\\AdminUi\\\\Validator\\\\Constraints\\\\FieldSettings\\:\\:\\$message has no type specified\\.$#" count: 1 path: src/lib/Validator/Constraints/FieldSettings.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Validator\\\\Constraints\\\\FieldSettingsValidator\\:\\:validate\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Validator/Constraints/FieldSettingsValidator.php - - - - message: "#^Parameter \\#1 \\$validationErrors of method Ibexa\\\\ContentForms\\\\Validator\\\\Constraints\\\\FieldTypeValidator\\:\\:processValidationErrors\\(\\) expects array\\, iterable\\ given\\.$#" - count: 1 - path: src/lib/Validator/Constraints/FieldSettingsValidator.php - - message: "#^Property Ibexa\\\\AdminUi\\\\Validator\\\\Constraints\\\\LocationHasChildren\\:\\:\\$message has no type specified\\.$#" count: 1 @@ -10050,11 +9060,6 @@ parameters: count: 2 path: src/lib/Validator/Constraints/LocationHasChildrenValidator.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Validator\\\\Constraints\\\\LocationHasChildrenValidator\\:\\:validate\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Validator/Constraints/LocationHasChildrenValidator.php - - message: "#^Strict comparison using \\=\\=\\= between null and Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Location will always evaluate to false\\.$#" count: 1 @@ -10070,11 +9075,6 @@ parameters: count: 2 path: src/lib/Validator/Constraints/LocationHaveUniqueAssetRelationValidator.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Validator\\\\Constraints\\\\LocationHaveUniqueAssetRelationValidator\\:\\:validate\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Validator/Constraints/LocationHaveUniqueAssetRelationValidator.php - - message: "#^Strict comparison using \\=\\=\\= between null and Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Location will always evaluate to false\\.$#" count: 1 @@ -10090,11 +9090,6 @@ parameters: count: 2 path: src/lib/Validator/Constraints/LocationIsContainerValidator.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Validator\\\\Constraints\\\\LocationIsContainerValidator\\:\\:validate\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Validator/Constraints/LocationIsContainerValidator.php - - message: "#^Strict comparison using \\=\\=\\= between null and Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Location will always evaluate to false\\.$#" count: 1 @@ -10110,11 +9105,6 @@ parameters: count: 2 path: src/lib/Validator/Constraints/LocationIsNotRootValidator.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Validator\\\\Constraints\\\\LocationIsNotRootValidator\\:\\:validate\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Validator/Constraints/LocationIsNotRootValidator.php - - message: "#^Strict comparison using \\=\\=\\= between null and Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Location will always evaluate to false\\.$#" count: 1 @@ -10135,11 +9125,6 @@ parameters: count: 1 path: src/lib/Validator/Constraints/LocationIsWithinCopySubtreeLimitValidator.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Validator\\\\Constraints\\\\LocationIsWithinCopySubtreeLimitValidator\\:\\:validate\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Validator/Constraints/LocationIsWithinCopySubtreeLimitValidator.php - - message: "#^Strict comparison using \\=\\=\\= between null and Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Location will always evaluate to false\\.$#" count: 1 @@ -10150,46 +9135,21 @@ parameters: count: 1 path: src/lib/Validator/Constraints/UniqueContentTypeIdentifierValidator.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Validator\\\\Constraints\\\\UniqueContentTypeIdentifierValidator\\:\\:validate\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Validator/Constraints/UniqueContentTypeIdentifierValidator.php - - message: "#^Access to an undefined property Symfony\\\\Component\\\\Validator\\\\Constraint\\:\\:\\$message\\.$#" count: 1 path: src/lib/Validator/Constraints/UniqueFieldDefinitionIdentifierValidator.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Validator\\\\Constraints\\\\UniqueFieldDefinitionIdentifierValidator\\:\\:validate\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Validator/Constraints/UniqueFieldDefinitionIdentifierValidator.php - - message: "#^Access to an undefined property Symfony\\\\Component\\\\Validator\\\\Constraint\\:\\:\\$message\\.$#" count: 1 path: src/lib/Validator/Constraints/UniqueURLValidator.php - - - message: "#^Access to protected property Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\URL\\\\URL\\:\\:\\$id\\.$#" - count: 1 - path: src/lib/Validator/Constraints/UniqueURLValidator.php - - - - message: "#^Method Ibexa\\\\AdminUi\\\\Validator\\\\Constraints\\\\UniqueURLValidator\\:\\:validate\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Validator/Constraints/UniqueURLValidator.php - - message: "#^Property Ibexa\\\\AdminUi\\\\Validator\\\\Constraints\\\\ValidatorConfiguration\\:\\:\\$message has no type specified\\.$#" count: 1 path: src/lib/Validator/Constraints/ValidatorConfiguration.php - - - message: "#^Method Ibexa\\\\AdminUi\\\\Validator\\\\Constraints\\\\ValidatorConfigurationValidator\\:\\:validate\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/Validator/Constraints/ValidatorConfigurationValidator.php - - message: "#^Parameter \\#1 \\$validationErrors of method Ibexa\\\\ContentForms\\\\Validator\\\\Constraints\\\\FieldTypeValidator\\:\\:processValidationErrors\\(\\) expects array\\, iterable\\ given\\.$#" count: 1 @@ -10355,296 +9315,6 @@ parameters: count: 1 path: tests/bundle/DependencyInjection/Configuration/Parser/AdminUiFormsTest.php - - - message: "#^Access to an undefined property Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\AbstractParamConverterTest\\:\\:\\$converter\\.$#" - count: 1 - path: tests/bundle/ParamConverter/AbstractParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\AbstractParamConverterTest\\:\\:testSupports\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/AbstractParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentParamConverterTest\\:\\:attributeProvider\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentParamConverterTest\\:\\:testApply\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentParamConverterTest\\:\\:testApplyWithWrongAttribute\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentParamConverterTest\\:\\:testApplyWithWrongAttribute\\(\\) has parameter \\$contentId with no type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentParamConverterTest\\:\\:testApplyWithWrongAttribute\\(\\) has parameter \\$languageCode with no type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentTypeDraftParamConverterTest\\:\\:dataProvider\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentTypeDraftParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentTypeDraftParamConverterTest\\:\\:testApply\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentTypeDraftParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentTypeDraftParamConverterTest\\:\\:testApplyWithWrongAttribute\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentTypeDraftParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentTypeGroupParamConverterTest\\:\\:dataProvider\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentTypeGroupParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentTypeGroupParamConverterTest\\:\\:testApply\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentTypeGroupParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentTypeGroupParamConverterTest\\:\\:testApplyWhenNotFound\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentTypeGroupParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentTypeGroupParamConverterTest\\:\\:testApplyWithWrongAttribute\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentTypeGroupParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentTypeParamConverterTest\\:\\:dataProvider\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentTypeParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentTypeParamConverterTest\\:\\:testApplyId\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentTypeParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentTypeParamConverterTest\\:\\:testApplyIdWhenNotFound\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentTypeParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentTypeParamConverterTest\\:\\:testApplyIdWithWrongValue\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentTypeParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentTypeParamConverterTest\\:\\:testApplyIdentifier\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentTypeParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentTypeParamConverterTest\\:\\:testApplyIdentifierWhenNotFound\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentTypeParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\ContentTypeParamConverterTest\\:\\:testApplyIdentifierWithWrongValue\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/ContentTypeParamConverterTest.php - - - - message: "#^PHPDoc tag @param references unknown parameter\\: \\$contentTypeIdToLoad$#" - count: 1 - path: tests/bundle/ParamConverter/ContentTypeParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\LanguageParamConverterTest\\:\\:dataProvider\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/bundle/ParamConverter/LanguageParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\LanguageParamConverterTest\\:\\:dataProviderForApplyWithWrongAttribute\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/bundle/ParamConverter/LanguageParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\LanguageParamConverterTest\\:\\:dataProviderForSupport\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/bundle/ParamConverter/LanguageParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\LanguageParamConverterTest\\:\\:testApplyForLanguageCode\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/LanguageParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\LanguageParamConverterTest\\:\\:testApplyForLanguageId\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/LanguageParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\LanguageParamConverterTest\\:\\:testApplyWithNonExistingLanguageCode\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/LanguageParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\LanguageParamConverterTest\\:\\:testApplyWithNonExistingLanguageId\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/LanguageParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\LanguageParamConverterTest\\:\\:testApplyWithWrongAttribute\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/LanguageParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\LanguageParamConverterTest\\:\\:testApplyWithWrongAttribute\\(\\) has parameter \\$attributes with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/bundle/ParamConverter/LanguageParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\LanguageParamConverterTest\\:\\:testSupport\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/LanguageParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\PolicyParamConverterTest\\:\\:attributeProvider\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/bundle/ParamConverter/PolicyParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\PolicyParamConverterTest\\:\\:dataProvider\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/bundle/ParamConverter/PolicyParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\PolicyParamConverterTest\\:\\:testApply\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/PolicyParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\PolicyParamConverterTest\\:\\:testApplyWhenPolicyNotFound\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/PolicyParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\PolicyParamConverterTest\\:\\:testApplyWhenRoleNotFound\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/PolicyParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\PolicyParamConverterTest\\:\\:testApplyWithWrongAttribute\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/PolicyParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\PolicyParamConverterTest\\:\\:testApplyWithWrongAttribute\\(\\) has parameter \\$policyId with no type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/PolicyParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\PolicyParamConverterTest\\:\\:testApplyWithWrongAttribute\\(\\) has parameter \\$roleId with no type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/PolicyParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\RoleAssignmentParamConverterTest\\:\\:dataProvider\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/bundle/ParamConverter/RoleAssignmentParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\RoleAssignmentParamConverterTest\\:\\:testApply\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/RoleAssignmentParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\RoleAssignmentParamConverterTest\\:\\:testApplyWhenNotFound\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/RoleAssignmentParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\RoleAssignmentParamConverterTest\\:\\:testApplyWithWrongAttribute\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/RoleAssignmentParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\RoleParamConverterTest\\:\\:dataProvider\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/bundle/ParamConverter/RoleParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\RoleParamConverterTest\\:\\:testApply\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/RoleParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\RoleParamConverterTest\\:\\:testApplyWhenNotFound\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/RoleParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\RoleParamConverterTest\\:\\:testApplyWithWrongAttribute\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/RoleParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\SectionParamConverterTest\\:\\:dataProvider\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/bundle/ParamConverter/SectionParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\SectionParamConverterTest\\:\\:testApply\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/SectionParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\SectionParamConverterTest\\:\\:testApplyWhenNotFound\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/SectionParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\SectionParamConverterTest\\:\\:testApplyWithWrongAttribute\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/SectionParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\VersionInfoParamConverterTest\\:\\:attributeProvider\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/bundle/ParamConverter/VersionInfoParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\VersionInfoParamConverterTest\\:\\:dataProvider\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/bundle/ParamConverter/VersionInfoParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\VersionInfoParamConverterTest\\:\\:testApply\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/VersionInfoParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\VersionInfoParamConverterTest\\:\\:testApplyWithWrongAttribute\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/VersionInfoParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\VersionInfoParamConverterTest\\:\\:testApplyWithWrongAttribute\\(\\) has parameter \\$contentId with no type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/VersionInfoParamConverterTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\ParamConverter\\\\VersionInfoParamConverterTest\\:\\:testApplyWithWrongAttribute\\(\\) has parameter \\$versionNo with no type specified\\.$#" - count: 1 - path: tests/bundle/ParamConverter/VersionInfoParamConverterTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\AdminUi\\\\Templating\\\\Twig\\\\FieldEditRenderingExtensionTest\\:\\:getFieldDefinitionData\\(\\) has parameter \\$id with no type specified\\.$#" count: 1 @@ -12356,11 +11026,6 @@ parameters: count: 1 path: tests/lib/Limitation/Mapper/SubtreeLimitationMapperTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\AdminUi\\\\Limitation\\\\Mapper\\\\UDWBasedMapperTest\\:\\:createSearchResultsMock\\(\\) has parameter \\$expected with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/lib/Limitation/Mapper/UDWBasedMapperTest.php - - message: "#^Call to an undefined method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\PermissionResolver\\:\\:method\\(\\)\\.$#" count: 2 diff --git a/src/bundle/Controller/BookmarkController.php b/src/bundle/Controller/BookmarkController.php index 005860716b..b1eccec89c 100644 --- a/src/bundle/Controller/BookmarkController.php +++ b/src/bundle/Controller/BookmarkController.php @@ -65,7 +65,8 @@ public function __construct( */ public function listAction(Request $request): Response { - $page = $request->query->get('page', 1); + /** @phpstan-var int<0, max> $page */ + $page = $request->query->getInt('page', 1); $pagerfanta = new Pagerfanta( new BookmarkAdapter($this->bookmarkService, $this->datasetFactory) @@ -79,12 +80,12 @@ public function listAction(Request $request): Response ); $removeBookmarkForm = $this->formFactory->removeBookmark( - new BookmarkRemoveData($this->getChoices($pagerfanta->getCurrentPageResults())) + new BookmarkRemoveData($this->getChoices(iterator_to_array($pagerfanta->getCurrentPageResults()))) ); return $this->render( '@ibexadesign/account/bookmarks/list.html.twig', - $viewParameters = [ + [ 'pager' => $pagerfanta, 'form_edit' => $editForm->createView(), 'form_remove' => $removeBookmarkForm->createView(), @@ -124,9 +125,9 @@ public function removeAction(Request $request): Response } /** - * @param array $bookmarks + * @param array<\Ibexa\AdminUi\UI\Value\Location\Bookmark> $bookmarks * - * @return array + * @return array */ private function getChoices(array $bookmarks): array { diff --git a/src/bundle/Controller/ContentTypeController.php b/src/bundle/Controller/ContentTypeController.php index ff16ccff2e..cbbbea8cae 100644 --- a/src/bundle/Controller/ContentTypeController.php +++ b/src/bundle/Controller/ContentTypeController.php @@ -130,18 +130,18 @@ 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 */ public function listAction(ContentTypeGroup $group, string $routeName, int $page): Response { $deletableTypes = []; - $contentTypes = $this->contentTypeService->loadContentTypes($group, $this->configResolver->getParameter('languages')); + $contentTypes = iterator_to_array( + $this->contentTypeService->loadContentTypes($group, $this->configResolver->getParameter('languages')) + ); usort($contentTypes, static function (ContentType $contentType1, ContentType $contentType2) { - return strnatcasecmp($contentType1->getName(), $contentType2->getName()); + return strnatcasecmp($contentType1->getName() ?? '', $contentType2->getName() ?? ''); }); $pagerfanta = new Pagerfanta( @@ -152,7 +152,7 @@ public function listAction(ContentTypeGroup $group, string $routeName, int $page $pagerfanta->setCurrentPage(min($page, $pagerfanta->getNbPages())); /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeGroup[] $contentTypeGroupList */ - $types = $pagerfanta->getCurrentPageResults(); + $types = iterator_to_array($pagerfanta->getCurrentPageResults()); $deleteContentTypesForm = $this->formFactory->deleteContentTypes( new ContentTypesDeleteData($this->getContentTypesNumbers($types)) @@ -795,7 +795,7 @@ protected function createDeleteForm(ContentTypeGroup $group, ContentType $conten /** * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[] $contentTypes * - * @return array + * @return array */ private function getContentTypesNumbers(array $contentTypes): array { diff --git a/src/bundle/Controller/ContentTypeGroupController.php b/src/bundle/Controller/ContentTypeGroupController.php index feb0cd07d3..364c4e8d94 100644 --- a/src/bundle/Controller/ContentTypeGroupController.php +++ b/src/bundle/Controller/ContentTypeGroupController.php @@ -70,10 +70,10 @@ public function listAction(Request $request): Response $deletableContentTypeGroup = []; $count = []; - $page = $request->query->get('page') ?? 1; + $page = $request->query->getInt('page', 1); $pagerfanta = new Pagerfanta( - new ArrayAdapter($this->contentTypeService->loadContentTypeGroups()) + new ArrayAdapter(iterator_to_array($this->contentTypeService->loadContentTypeGroups())) ); $pagerfanta->setMaxPerPage($this->configResolver->getParameter('pagination.content_type_group_limit')); diff --git a/src/bundle/Controller/DownloadImageController.php b/src/bundle/Controller/DownloadImageController.php index 4193b8a0a0..0557ae943a 100644 --- a/src/bundle/Controller/DownloadImageController.php +++ b/src/bundle/Controller/DownloadImageController.php @@ -92,6 +92,8 @@ private function assertDownloadLimitNotExceeded(array $contentIdList): void } /** + * @phpstan-param \Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult<\Ibexa\Contracts\Core\Repository\Values\Content\Content> $result + * * @throws \Exception */ private function processDownloading(SearchResult $result): Response @@ -110,9 +112,7 @@ private function processDownloading(SearchResult $result): Response $contentList = []; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchHit $image */ foreach ($result as $image) { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ $content = $image->valueObject; $contentList[] = $content; } @@ -239,6 +239,8 @@ private function getImageFileName(Value $value): string /** * @param array $contentIdList * + * @phpstan-return \Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult<\Ibexa\Contracts\Core\Repository\Values\Content\Content> + * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException; * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidCriterionArgumentException; */ diff --git a/src/bundle/Controller/LanguageController.php b/src/bundle/Controller/LanguageController.php index be90e10cd6..f264e199c0 100644 --- a/src/bundle/Controller/LanguageController.php +++ b/src/bundle/Controller/LanguageController.php @@ -75,10 +75,10 @@ public function __construct( */ public function listAction(Request $request): Response { - $page = $request->query->get('page') ?? 1; + $page = $request->query->getInt('page', 1); $pagerfanta = new Pagerfanta( - new ArrayAdapter($this->languageService->loadLanguages()) + new ArrayAdapter(iterator_to_array($this->languageService->loadLanguages())) ); $pagerfanta->setMaxPerPage($this->configResolver->getParameter('pagination.language_limit')); diff --git a/src/bundle/Controller/NotificationController.php b/src/bundle/Controller/NotificationController.php index 248b16b9b8..efd777384d 100644 --- a/src/bundle/Controller/NotificationController.php +++ b/src/bundle/Controller/NotificationController.php @@ -9,8 +9,8 @@ namespace Ibexa\Bundle\AdminUi\Controller; use Ibexa\AdminUi\Pagination\Pagerfanta\NotificationAdapter; -use Ibexa\Bundle\AdminUi\View\EzPagerfantaView; -use Ibexa\Bundle\AdminUi\View\Template\EzPagerfantaTemplate; +use Ibexa\Bundle\AdminUi\View\IbexaPagerfantaView; +use Ibexa\Bundle\AdminUi\View\Template\IbexaPagerfantaTemplate; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\Core\Repository\NotificationService; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; @@ -94,7 +94,7 @@ public function renderNotificationsPageAction(int $page): Response ]); }; - $pagination = (new EzPagerfantaView(new EzPagerfantaTemplate($this->translator)))->render($pagerfanta, $routeGenerator); + $pagination = (new IbexaPagerfantaView(new IbexaPagerfantaTemplate()))->render($pagerfanta, $routeGenerator); return new Response($this->render('@ibexadesign/account/notifications/list.html.twig', [ 'page' => $page, diff --git a/src/bundle/Controller/PolicyController.php b/src/bundle/Controller/PolicyController.php index 736f636ba5..732aad8384 100644 --- a/src/bundle/Controller/PolicyController.php +++ b/src/bundle/Controller/PolicyController.php @@ -84,15 +84,13 @@ public function __construct( * @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 */ public function listAction(Role $role, string $routeName, int $policyPage = 1): Response { $pagerfanta = new Pagerfanta( - new ArrayAdapter($role->getPolicies()) + new ArrayAdapter(iterator_to_array($role->getPolicies())) ); $pagerfanta->setMaxPerPage($this->configResolver->getParameter('pagination.policy_limit')); diff --git a/src/bundle/Controller/RoleController.php b/src/bundle/Controller/RoleController.php index b19c0ab04e..0cbe44d092 100644 --- a/src/bundle/Controller/RoleController.php +++ b/src/bundle/Controller/RoleController.php @@ -83,16 +83,16 @@ public function __construct( public function listAction(Request $request): Response { - $page = $request->query->get('page') ?? 1; + $page = $request->query->getInt('page', 1); $pagerfanta = new Pagerfanta( - new ArrayAdapter($this->roleService->loadRoles()) + new ArrayAdapter(iterator_to_array($this->roleService->loadRoles())) ); $pagerfanta->setMaxPerPage($this->configResolver->getParameter('pagination.role_limit')); $pagerfanta->setCurrentPage(min($page, $pagerfanta->getNbPages())); - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role[] $sectionList */ + /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role[] $roles */ $roles = $pagerfanta->getCurrentPageResults(); $rolesNumbers = array_column($roles, 'id'); diff --git a/src/bundle/Controller/SectionController.php b/src/bundle/Controller/SectionController.php index 8310403973..6cff56914f 100644 --- a/src/bundle/Controller/SectionController.php +++ b/src/bundle/Controller/SectionController.php @@ -21,8 +21,8 @@ use Ibexa\AdminUi\Form\Type\Section\SectionCreateType; use Ibexa\AdminUi\Form\Type\Section\SectionUpdateType; use Ibexa\AdminUi\UI\Service\PathService; -use Ibexa\Bundle\AdminUi\View\EzPagerfantaView; -use Ibexa\Bundle\AdminUi\View\Template\EzPagerfantaTemplate; +use Ibexa\Bundle\AdminUi\View\IbexaPagerfantaView; +use Ibexa\Bundle\AdminUi\View\Template\IbexaPagerfantaTemplate; use Ibexa\Contracts\AdminUi\Controller\Controller; use Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface; use Ibexa\Contracts\AdminUi\Permission\PermissionCheckerInterface; @@ -44,16 +44,12 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Contracts\Translation\TranslatorInterface; class SectionController extends Controller { /** @var \Ibexa\Contracts\AdminUi\Notification\TranslatableNotificationHandlerInterface */ private $notificationHandler; - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ - private $translator; - /** @var \Ibexa\Contracts\Core\Repository\SectionService */ private $sectionService; @@ -89,7 +85,6 @@ class SectionController extends Controller public function __construct( TranslatableNotificationHandlerInterface $notificationHandler, - TranslatorInterface $translator, SectionService $sectionService, SearchService $searchService, FormFactory $formFactory, @@ -103,7 +98,6 @@ public function __construct( ConfigResolverInterface $configResolver ) { $this->notificationHandler = $notificationHandler; - $this->translator = $translator; $this->sectionService = $sectionService; $this->searchService = $searchService; $this->formFactory = $formFactory; @@ -129,14 +123,13 @@ public function performAccessCheck(): void * @return \Symfony\Component\HttpFoundation\Response * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ public function listAction(Request $request): Response { - $page = $request->query->get('page') ?? 1; + $page = $request->query->getInt('page', 1); $pagerfanta = new Pagerfanta( - new ArrayAdapter($this->sectionService->loadSections()) + new ArrayAdapter(iterator_to_array($this->sectionService->loadSections())) ); $pagerfanta->setMaxPerPage($this->configResolver->getParameter('pagination.section_limit')); @@ -233,13 +226,15 @@ public function viewSectionContentAction(Section $section, int $page = 1, int $l $assignedContent = []; foreach ($pagerfanta as $content) { + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ + $mainLocationId = $content->getContentInfo()->getMainLocationId(); $assignedContent[] = [ - 'id' => $content->id, + 'id' => $content->getId(), 'name' => $content->getName(), 'type' => $content->getContentType()->getName(), - 'path' => $this->pathService->loadPathLocations( - $this->locationService->loadLocation($content->contentInfo->mainLocationId) - ), + 'path' => $mainLocationId !== null ? $this->pathService->loadPathLocations( + $this->locationService->loadLocation($mainLocationId) + ) : [], ]; } @@ -250,7 +245,7 @@ public function viewSectionContentAction(Section $section, int $page = 1, int $l ]); }; - $pagination = (new EzPagerfantaView(new EzPagerfantaTemplate($this->translator)))->render($pagerfanta, $routeGenerator); + $pagination = (new IbexaPagerfantaView(new IbexaPagerfantaTemplate()))->render($pagerfanta, $routeGenerator); return $this->render('@ibexadesign/section/assigned_content.html.twig', [ 'section' => $section, diff --git a/src/bundle/Controller/TrashController.php b/src/bundle/Controller/TrashController.php index 1a53d6700a..b14fec905c 100644 --- a/src/bundle/Controller/TrashController.php +++ b/src/bundle/Controller/TrashController.php @@ -107,9 +107,7 @@ public function performAccessCheck(): void * @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 */ @@ -149,11 +147,11 @@ public function listAction(Request $request): Response } $trashItemRestoreForm = $this->formFactory->restoreTrashItem( - new TrashItemRestoreData($pagerfanta->getCurrentPageResults(), null) + new TrashItemRestoreData(iterator_to_array($pagerfanta->getCurrentPageResults()), null) ); $trashItemDeleteForm = $this->formFactory->deleteTrashItem( - new TrashItemDeleteData($pagerfanta->getCurrentPageResults()) + new TrashItemDeleteData(iterator_to_array($pagerfanta->getCurrentPageResults())) ); $trashEmptyForm = $this->formFactory->emptyTrash( diff --git a/src/bundle/EventSubscriber/PerformAccessCheckSubscriber.php b/src/bundle/EventSubscriber/PerformAccessCheckSubscriber.php new file mode 100644 index 0000000000..c3c75593fb --- /dev/null +++ b/src/bundle/EventSubscriber/PerformAccessCheckSubscriber.php @@ -0,0 +1,34 @@ +getController(); + if (is_array($controller) && $controller[0] instanceof Controller) { + $controller[0]->performAccessCheck(); + } + } + + public static function getSubscribedEvents(): array + { + return [ + ControllerArgumentsEvent::class => 'onControllerArgumentsEvent', + ]; + } +} diff --git a/src/bundle/ParamConverter/ContentInfoParamConverter.php b/src/bundle/ParamConverter/ContentInfoParamConverter.php deleted file mode 100644 index 1f5abcc105..0000000000 --- a/src/bundle/ParamConverter/ContentInfoParamConverter.php +++ /dev/null @@ -1,57 +0,0 @@ -contentService = $contentTypeService; - } - - /** - * {@inheritdoc} - */ - public function apply(Request $request, ParamConverter $configuration) - { - $id = (int)$request->get(self::PARAMETER_CONTENT_INFO_ID); - $contentInfo = $this->contentService->loadContentInfo($id); - - if (!$contentInfo) { - throw new NotFoundHttpException("Content Info $id not found."); - } - - $request->attributes->set($configuration->getName(), $contentInfo); - - return true; - } - - /** - * {@inheritdoc} - */ - public function supports(ParamConverter $configuration) - { - return ContentInfo::class === $configuration->getClass(); - } -} diff --git a/src/bundle/ParamConverter/ContentParamConverter.php b/src/bundle/ParamConverter/ContentParamConverter.php deleted file mode 100644 index 5cf9dd513a..0000000000 --- a/src/bundle/ParamConverter/ContentParamConverter.php +++ /dev/null @@ -1,69 +0,0 @@ -contentService = $contentService; - } - - /** - * {@inheritdoc} - * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - */ - 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); - - if (null === $contentId || !\is_array($languageCode)) { - return false; - } - - $content = $this->contentService->loadContent($contentId, $languageCode, $versionNo); - - $request->attributes->set($configuration->getName(), $content); - - return true; - } - - /** - * {@inheritdoc} - */ - public function supports(ParamConverter $configuration): bool - { - return Content::class === $configuration->getClass(); - } -} diff --git a/src/bundle/ParamConverter/ContentTypeDraftParamConverter.php b/src/bundle/ParamConverter/ContentTypeDraftParamConverter.php deleted file mode 100644 index 93a2a0d932..0000000000 --- a/src/bundle/ParamConverter/ContentTypeDraftParamConverter.php +++ /dev/null @@ -1,53 +0,0 @@ -contentTypeService = $contentTypeGroupService; - } - - /** - * {@inheritdoc} - */ - public function apply(Request $request, ParamConverter $configuration) - { - if (!$request->get(self::PARAMETER_CONTENT_TYPE_ID)) { - return false; - } - - $id = (int)$request->get(self::PARAMETER_CONTENT_TYPE_ID); - - $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($id); - - $request->attributes->set($configuration->getName(), $contentTypeDraft); - - return true; - } - - /** - * {@inheritdoc} - */ - public function supports(ParamConverter $configuration) - { - return ContentTypeDraft::class === $configuration->getClass(); - } -} diff --git a/src/bundle/ParamConverter/ContentTypeGroupParamConverter.php b/src/bundle/ParamConverter/ContentTypeGroupParamConverter.php deleted file mode 100644 index f51b982ceb..0000000000 --- a/src/bundle/ParamConverter/ContentTypeGroupParamConverter.php +++ /dev/null @@ -1,65 +0,0 @@ -contentTypeService = $contentTypeService; - } - - /** - * {@inheritdoc} - */ - public function apply(Request $request, ParamConverter $configuration) - { - if (!$request->get(self::PARAMETER_CONTENT_TYPE_GROUP_ID)) { - return false; - } - - $id = (int)$request->get(self::PARAMETER_CONTENT_TYPE_GROUP_ID); - - try { - $group = $this->contentTypeService->loadContentTypeGroup($id); - } catch (NotFoundException $e) { - throw new NotFoundHttpException("Content type group $id not found."); - } - - $request->attributes->set($configuration->getName(), $group); - - return true; - } - - /** - * {@inheritdoc} - */ - public function supports(ParamConverter $configuration) - { - return ContentTypeGroup::class === $configuration->getClass(); - } -} diff --git a/src/bundle/ParamConverter/ContentTypeParamConverter.php b/src/bundle/ParamConverter/ContentTypeParamConverter.php deleted file mode 100644 index 4decf2136e..0000000000 --- a/src/bundle/ParamConverter/ContentTypeParamConverter.php +++ /dev/null @@ -1,78 +0,0 @@ -contentTypeService = $contentTypeGroupService; - $this->languagePreferenceProvider = $languagePreferenceProvider; - } - - /** - * {@inheritdoc} - */ - public function apply(Request $request, ParamConverter $configuration) - { - if (!$request->get(self::PARAMETER_CONTENT_TYPE_ID) && !$request->get(self::PARAMETER_CONTENT_TYPE_IDENTIFIER)) { - return false; - } - - $prioritizedLanguages = $this->languagePreferenceProvider->getPreferredLanguages(); - - try { - if ($request->get(self::PARAMETER_CONTENT_TYPE_ID)) { - $id = (int)$request->get(self::PARAMETER_CONTENT_TYPE_ID); - $contentType = $this->contentTypeService->loadContentType($id, $prioritizedLanguages); - } elseif ($request->get(self::PARAMETER_CONTENT_TYPE_IDENTIFIER)) { - $identifier = $request->get(self::PARAMETER_CONTENT_TYPE_IDENTIFIER); - $contentType = $this->contentTypeService->loadContentTypeByIdentifier($identifier, $prioritizedLanguages); - } - } catch (NotFoundException $e) { - throw new NotFoundHttpException('Content type ' . ($id ?? $identifier) . ' not found.'); - } - - $request->attributes->set($configuration->getName(), $contentType); - - return true; - } - - /** - * {@inheritdoc} - */ - public function supports(ParamConverter $configuration) - { - return ContentType::class === $configuration->getClass(); - } -} diff --git a/src/bundle/ParamConverter/LanguageParamConverter.php b/src/bundle/ParamConverter/LanguageParamConverter.php deleted file mode 100644 index 4aa93a3ac2..0000000000 --- a/src/bundle/ParamConverter/LanguageParamConverter.php +++ /dev/null @@ -1,74 +0,0 @@ -languageService = $languageService; - } - - /** - * {@inheritdoc} - */ - public function apply(Request $request, ParamConverter $configuration) - { - if (!$request->get(self::PARAMETER_LANGUAGE_ID) && !$request->get(self::PARAMETER_LANGUAGE_CODE)) { - return false; - } - - if ($request->get(self::PARAMETER_LANGUAGE_ID)) { - $id = (int)$request->get(self::PARAMETER_LANGUAGE_ID); - - try { - $language = $this->languageService->loadLanguageById($id); - } catch (NotFoundException $e) { - throw new NotFoundHttpException("Language $id not found."); - } - } elseif ($request->get(self::PARAMETER_LANGUAGE_CODE)) { - $languageCode = $request->get(self::PARAMETER_LANGUAGE_CODE); - - try { - $language = $this->languageService->loadLanguage($languageCode); - } catch (NotFoundException $e) { - throw new NotFoundHttpException("Language $languageCode not found."); - } - } - - $request->attributes->set($configuration->getName(), $language); - - return true; - } - - /** - * {@inheritdoc} - */ - public function supports(ParamConverter $configuration) - { - return Language::class === $configuration->getClass(); - } -} diff --git a/src/bundle/ParamConverter/ObjectStateGroupParamConverter.php b/src/bundle/ParamConverter/ObjectStateGroupParamConverter.php deleted file mode 100644 index 3c561c063f..0000000000 --- a/src/bundle/ParamConverter/ObjectStateGroupParamConverter.php +++ /dev/null @@ -1,64 +0,0 @@ -objectStateService = $objectStateService; - } - - /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter $configuration - * - * @return bool - * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - */ - public function apply(Request $request, ParamConverter $configuration) - { - $id = (int)$request->get(self::PARAMETER_OBJECT_STATE_GROUP_ID); - $objectStateGroup = $this->objectStateService->loadObjectStateGroup($id); - - if (!$objectStateGroup) { - throw new NotFoundHttpException("Object state group $id not found."); - } - - $request->attributes->set($configuration->getName(), $objectStateGroup); - - return true; - } - - /** - * @param \Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter $configuration - * - * @return bool - */ - public function supports(ParamConverter $configuration) - { - return ObjectStateGroup::class === $configuration->getClass(); - } -} diff --git a/src/bundle/ParamConverter/ObjectStateParamConverter.php b/src/bundle/ParamConverter/ObjectStateParamConverter.php deleted file mode 100644 index db9322ed00..0000000000 --- a/src/bundle/ParamConverter/ObjectStateParamConverter.php +++ /dev/null @@ -1,64 +0,0 @@ -objectStateService = $objectStateService; - } - - /** - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter $configuration - * - * @return bool - * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - */ - public function apply(Request $request, ParamConverter $configuration) - { - $id = (int)$request->get(self::PARAMETER_OBJECT_STATE_ID); - $objectState = $this->objectStateService->loadObjectState($id); - - if (!$objectState) { - throw new NotFoundHttpException("Object state $id not found."); - } - - $request->attributes->set($configuration->getName(), $objectState); - - return true; - } - - /** - * @param \Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter $configuration - * - * @return bool - */ - public function supports(ParamConverter $configuration) - { - return ObjectState::class === $configuration->getClass(); - } -} diff --git a/src/bundle/ParamConverter/PolicyDraftParamConverter.php b/src/bundle/ParamConverter/PolicyDraftParamConverter.php deleted file mode 100644 index 3145642648..0000000000 --- a/src/bundle/ParamConverter/PolicyDraftParamConverter.php +++ /dev/null @@ -1,79 +0,0 @@ -roleService = $roleService; - } - - /** - * {@inheritdoc} - */ - public function apply(Request $request, ParamConverter $configuration) - { - if (!$request->get(self::PARAMETER_ROLE_ID) || !$request->get(self::PARAMETER_POLICY_ID)) { - return false; - } - - $roleId = (int)$request->get(self::PARAMETER_ROLE_ID); - - $roleDraft = $this->roleService->loadRoleDraftByRoleId($roleId); - - if (!$roleDraft) { - throw new NotFoundHttpException("Role $roleId not found."); - } - - $policyId = (int)$request->get(self::PARAMETER_POLICY_ID); - - $policyDraft = null; - foreach ($roleDraft->getPolicies() as $item) { - if ($item->originalId === $policyId) { - $policyDraft = $item; - break; - } - } - - if (!$policyDraft) { - throw new NotFoundHttpException("Policy draft $policyId not found."); - } - - $request->attributes->set($configuration->getName(), $policyDraft); - - return true; - } - - /** - * {@inheritdoc} - */ - public function supports(ParamConverter $configuration) - { - return PolicyDraft::class === $configuration->getClass(); - } -} diff --git a/src/bundle/ParamConverter/PolicyParamConverter.php b/src/bundle/ParamConverter/PolicyParamConverter.php deleted file mode 100644 index a3bbc96958..0000000000 --- a/src/bundle/ParamConverter/PolicyParamConverter.php +++ /dev/null @@ -1,74 +0,0 @@ -roleService = $roleService; - } - - /** - * {@inheritdoc} - */ - public function apply(Request $request, ParamConverter $configuration) - { - if (!$request->get(self::PARAMETER_ROLE_ID) || !$request->get(self::PARAMETER_POLICY_ID)) { - return false; - } - - $roleId = (int)$request->get(self::PARAMETER_ROLE_ID); - - try { - $role = $this->roleService->loadRole($roleId); - } catch (NotFoundException $e) { - throw new NotFoundHttpException("Role $roleId not found."); - } - - $policyId = (int)$request->get(self::PARAMETER_POLICY_ID); - - foreach ($role->getPolicies() as $item) { - if ($item->id === $policyId) { - $request->attributes->set($configuration->getName(), $item); - - return true; - } - } - - throw new NotFoundHttpException("Policy $policyId not found."); - } - - /** - * {@inheritdoc} - */ - public function supports(ParamConverter $configuration) - { - return Policy::class === $configuration->getClass(); - } -} diff --git a/src/bundle/ParamConverter/RoleAssignmentParamConverter.php b/src/bundle/ParamConverter/RoleAssignmentParamConverter.php deleted file mode 100644 index d0673b1669..0000000000 --- a/src/bundle/ParamConverter/RoleAssignmentParamConverter.php +++ /dev/null @@ -1,64 +0,0 @@ -roleService = $roleService; - } - - /** - * {@inheritdoc} - */ - public function apply(Request $request, ParamConverter $configuration) - { - if (!$request->get(self::PRAMETER_ROLE_ASSIGNMENT_ID)) { - return false; - } - - $roleAssigmentId = (int)$request->get(self::PRAMETER_ROLE_ASSIGNMENT_ID); - - try { - $roleAssigment = $this->roleService->loadRoleAssignment($roleAssigmentId); - } catch (NotFoundException $e) { - throw new NotFoundHttpException("Role assignment $roleAssigmentId not found."); - } - - $request->attributes->set($configuration->getName(), $roleAssigment); - - return true; - } - - /** - * {@inheritdoc} - */ - public function supports(ParamConverter $configuration) - { - return RoleAssignment::class === $configuration->getClass(); - } -} diff --git a/src/bundle/ParamConverter/RoleParamConverter.php b/src/bundle/ParamConverter/RoleParamConverter.php deleted file mode 100644 index e5ec8f9f53..0000000000 --- a/src/bundle/ParamConverter/RoleParamConverter.php +++ /dev/null @@ -1,65 +0,0 @@ -roleService = $roleService; - } - - /** - * {@inheritdoc} - */ - public function apply(Request $request, ParamConverter $configuration) - { - if (!$request->get(self::PARAMETER_ROLE_ID)) { - return false; - } - - $id = (int)$request->get(self::PARAMETER_ROLE_ID); - - try { - $role = $this->roleService->loadRole($id); - } catch (NotFoundException $e) { - throw new NotFoundHttpException("Role $id not found."); - } - - $request->attributes->set($configuration->getName(), $role); - - return true; - } - - /** - * {@inheritdoc} - */ - public function supports(ParamConverter $configuration) - { - return Role::class === $configuration->getClass(); - } -} diff --git a/src/bundle/ParamConverter/SectionParamConverter.php b/src/bundle/ParamConverter/SectionParamConverter.php deleted file mode 100644 index 45db845c3c..0000000000 --- a/src/bundle/ParamConverter/SectionParamConverter.php +++ /dev/null @@ -1,67 +0,0 @@ -sectionService = $sectionService; - } - - /** - * {@inheritdoc} - */ - public function apply(Request $request, ParamConverter $configuration) - { - if (!$request->get(self::PARAMETER_SECTION_ID)) { - return false; - } - - $id = (int)$request->get(self::PARAMETER_SECTION_ID); - - try { - $section = $this->sectionService->loadSection($id); - } catch (NotFoundException $e) { - throw new NotFoundHttpException("Section $id not found."); - } - - $request->attributes->set($configuration->getName(), $section); - - return true; - } - - /** - * {@inheritdoc} - */ - public function supports(ParamConverter $configuration) - { - return Section::class === $configuration->getClass(); - } -} diff --git a/src/bundle/ParamConverter/TranslationLanguageParamConverter.php b/src/bundle/ParamConverter/TranslationLanguageParamConverter.php deleted file mode 100644 index b4f5b407b3..0000000000 --- a/src/bundle/ParamConverter/TranslationLanguageParamConverter.php +++ /dev/null @@ -1,76 +0,0 @@ -languageService = $languageService; - } - - /** - * {@inheritdoc} - */ - 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()) { - $languageCode = $request->get(self::PARAMETER_LANGUAGE_CODE_FROM); - } else { - return false; - } - - $request->attributes->set($configuration->getName(), $this->getLanguage($languageCode)); - - return true; - } - - /** - * {@inheritdoc} - */ - public function supports(ParamConverter $configuration) - { - return Language::class === $configuration->getClass(); - } - - /** - * @param string $languageCode - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language - */ - private function getLanguage(string $languageCode): Language - { - try { - $language = $this->languageService->loadLanguage($languageCode); - } catch (NotFoundException $e) { - throw new NotFoundHttpException("Language $languageCode not found."); - } - - return $language; - } -} diff --git a/src/bundle/ParamConverter/URLWildcardParamConverter.php b/src/bundle/ParamConverter/URLWildcardParamConverter.php deleted file mode 100644 index 6bc48f13cc..0000000000 --- a/src/bundle/ParamConverter/URLWildcardParamConverter.php +++ /dev/null @@ -1,63 +0,0 @@ -urlWildcardService = $urlWildcardService; - } - - /** - * {@inheritdoc} - */ - public function apply(Request $request, ParamConverter $configuration): bool - { - if (empty($request->get(self::PARAMETER_URL_WILDCARD_ID))) { - return false; - } - - $id = (int) $request->get(self::PARAMETER_URL_WILDCARD_ID); - - try { - $urlWildcard = $this->urlWildcardService->load($id); - } catch (NotFoundException $e) { - throw new NotFoundHttpException("URLWildcard {$id} not found."); - } - - $request->attributes->set($configuration->getName(), $urlWildcard); - - return true; - } - - /** - * {@inheritdoc} - */ - public function supports(ParamConverter $configuration): bool - { - return URLWildcard::class === $configuration->getClass(); - } -} diff --git a/src/bundle/ParamConverter/VersionInfoParamConverter.php b/src/bundle/ParamConverter/VersionInfoParamConverter.php deleted file mode 100644 index a1415fb272..0000000000 --- a/src/bundle/ParamConverter/VersionInfoParamConverter.php +++ /dev/null @@ -1,65 +0,0 @@ -contentService = $contentService; - } - - /** - * {@inheritdoc} - * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - */ - public function apply(Request $request, ParamConverter $configuration): bool - { - if (!$request->get(self::PARAMETER_VERSION_NO) || !$request->get(self::PARAMETER_CONTENT_ID)) { - return false; - } - - $versionNo = (int)$request->get(self::PARAMETER_VERSION_NO); - $contentId = (int)$request->get(self::PARAMETER_CONTENT_ID); - - $contentInfo = $this->contentService->loadContentInfo($contentId); - $versionInfo = $this->contentService->loadVersionInfo($contentInfo, $versionNo); - - $request->attributes->set($configuration->getName(), $versionInfo); - - return true; - } - - /** - * {@inheritdoc} - */ - public function supports(ParamConverter $configuration): bool - { - return VersionInfo::class === $configuration->getClass(); - } -} diff --git a/src/bundle/Resources/config/services.yaml b/src/bundle/Resources/config/services.yaml index f4d9534827..3b4e07f8c2 100644 --- a/src/bundle/Resources/config/services.yaml +++ b/src/bundle/Resources/config/services.yaml @@ -47,21 +47,14 @@ services: public: false Ibexa\Contracts\AdminUi\Controller\Controller: - tags: ['controller.service_arguments'] - calls: - - [setContainer, ["@service_container"]] - - [performAccessCheck, []] - - Ibexa\Bundle\AdminUi\ParamConverter\: - resource: "../../ParamConverter/*" - public: true tags: - - { name: 'request.param_converter' } + - name: controller.service_arguments - Ibexa\Bundle\AdminUi\ParamConverter\ContentTypeParamConverter: - public: true + Ibexa\Bundle\AdminUi\ValueResolver\: + resource: "../../ValueResolver/*" tags: - - { name: 'request.param_converter' } + - name: controller.argument_value_resolver + priority: 150 Ibexa\AdminUi\UI\Dataset\DatasetFactory: lazy: true diff --git a/src/bundle/Resources/config/services/controllers.yaml b/src/bundle/Resources/config/services/controllers.yaml index 9181f83624..ef79dc4ca5 100644 --- a/src/bundle/Resources/config/services/controllers.yaml +++ b/src/bundle/Resources/config/services/controllers.yaml @@ -1,6 +1,7 @@ services: _defaults: autowire: true + autoconfigure: true tags: - controller.service_arguments diff --git a/src/bundle/Resources/config/services/events.yaml b/src/bundle/Resources/config/services/events.yaml index 28316fa85b..a9787b4e3a 100644 --- a/src/bundle/Resources/config/services/events.yaml +++ b/src/bundle/Resources/config/services/events.yaml @@ -10,6 +10,10 @@ services: tags: - { name: kernel.event_subscriber } + Ibexa\Bundle\AdminUi\EventSubscriber\PerformAccessCheckSubscriber: + tags: + - { name: kernel.event_subscriber } + Ibexa\AdminUi\EventListener\RequestListener: arguments: - '%ibexa.site_access.groups_by_site_access%' diff --git a/src/bundle/Resources/config/services/forms.yaml b/src/bundle/Resources/config/services/forms.yaml index f5ad33e4ce..1206c53b3c 100644 --- a/src/bundle/Resources/config/services/forms.yaml +++ b/src/bundle/Resources/config/services/forms.yaml @@ -386,11 +386,6 @@ services: Ibexa\AdminUi\Form\TrashLocationOptionProvider\OptionsFactory: arguments: [!tagged ibexa.admin_ui.form.trash_location_option] - Ibexa\AdminUi\Form\Extension\RichTextTypeExtension: - public: true - tags: - - { name: form.type_extension } - Ibexa\AdminUi\Form\Extension\HelpMultilineMessageExtension: tags: - { name: form.type_extension, extended_type: Symfony\Component\Form\Extension\Core\Type\FormType } diff --git a/src/bundle/Resources/config/services/pagination.yaml b/src/bundle/Resources/config/services/pagination.yaml index 96a112242e..5b344853a0 100644 --- a/src/bundle/Resources/config/services/pagination.yaml +++ b/src/bundle/Resources/config/services/pagination.yaml @@ -1,13 +1,10 @@ services: - Ibexa\Bundle\AdminUi\View\Template\EzPagerfantaTemplate: - class: Ibexa\Bundle\AdminUi\View\Template\EzPagerfantaTemplate - arguments: - - '@translator' + Ibexa\Bundle\AdminUi\View\Template\IbexaPagerfantaTemplate: ~ - Ibexa\Bundle\AdminUi\View\EzPagerfantaView: + Ibexa\Bundle\AdminUi\View\IbexaPagerfantaView: public: false arguments: - - '@Ibexa\Bundle\AdminUi\View\Template\EzPagerfantaTemplate' + $template: '@Ibexa\Bundle\AdminUi\View\Template\IbexaPagerfantaTemplate' tags: - { name: 'pagerfanta.view', alias: 'ibexa' } diff --git a/src/bundle/Resources/views/themes/admin/content_type/content_type_group/index.html.twig b/src/bundle/Resources/views/themes/admin/content_type/content_type_group/index.html.twig index 79a079e831..4c37867951 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/content_type_group/index.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/content_type_group/index.html.twig @@ -44,7 +44,7 @@ {% block content %} {{ render(controller('Ibexa\\Bundle\\AdminUi\\Controller\\ContentTypeController::listAction', { - contentTypeGroupId: content_type_group.id, + group: content_type_group, page: page, routeName: route_name })) }} diff --git a/src/bundle/Resources/views/themes/admin/object_state/object_state_group/view.html.twig b/src/bundle/Resources/views/themes/admin/object_state/object_state_group/view.html.twig index 3ac93fc78a..c30400a405 100644 --- a/src/bundle/Resources/views/themes/admin/object_state/object_state_group/view.html.twig +++ b/src/bundle/Resources/views/themes/admin/object_state/object_state_group/view.html.twig @@ -63,8 +63,8 @@ items: details_items, } only %} - {{ render( controller('Ibexa\\Bundle\\AdminUi\\Controller\\ObjectStateController::listAction', { - objectStateGroupId: object_state_group.id, + {{ render(controller('Ibexa\\Bundle\\AdminUi\\Controller\\ObjectStateController::listAction', { + objectStateGroup: object_state_group, })) }} {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/ui/field_type/preview/content_fields.html.twig b/src/bundle/Resources/views/themes/admin/ui/field_type/preview/content_fields.html.twig index 2170d93898..4c51282280 100644 --- a/src/bundle/Resources/views/themes/admin/ui/field_type/preview/content_fields.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/field_type/preview/content_fields.html.twig @@ -474,7 +474,7 @@ {% if not ibexa_field_is_empty( content, field ) and parameters.available %} {% set attr = attr|merge({'class': (attr.class|default('') ~ ' ibexa-field-preview ibexa-field-preview--ezimageasset')|trim}) %}
- {{ render(controller('ibexa_content:viewAction', { + {{ render(controller('ibexa_content::viewAction', { contentId: field.value.destinationContentId, viewType: 'preview_ezimageasset', no_layout: true, diff --git a/src/bundle/Resources/views/themes/admin/user/role/index.html.twig b/src/bundle/Resources/views/themes/admin/user/role/index.html.twig index 7a2f9eba8a..45cccac4b9 100644 --- a/src/bundle/Resources/views/themes/admin/user/role/index.html.twig +++ b/src/bundle/Resources/views/themes/admin/user/role/index.html.twig @@ -32,7 +32,7 @@ {% embed '@ibexadesign/ui/component/tab/tab_pane.html.twig' with { id: 'policies', active: true } %} {% block content %} {{ render(controller('Ibexa\\Bundle\\AdminUi\\Controller\\PolicyController::listAction', { - roleId: role.id, + role: role, policyPage: policy_page, routeName: route_name })) }} @@ -41,7 +41,7 @@ {% embed '@ibexadesign/ui/component/tab/tab_pane.html.twig' with { id: 'users-and-groups', active: false } %} {% block content %} {{ render(controller('Ibexa\\Bundle\\AdminUi\\Controller\\RoleAssignmentController::listAction', { - roleId: role.id, + role: role, assignmentPage: assignment_page, routeName: route_name })) }} diff --git a/src/bundle/ValueResolver/AbstractValueResolver.php b/src/bundle/ValueResolver/AbstractValueResolver.php new file mode 100644 index 0000000000..1445fde20f --- /dev/null +++ b/src/bundle/ValueResolver/AbstractValueResolver.php @@ -0,0 +1,107 @@ + + */ + final public function resolve(Request $request, ArgumentMetadata $argument): iterable + { + if (!$this->supports($argument)) { + return []; + } + + $key = $this->getKey($request); + if (!$this->validateKey($key)) { + return []; + } + + yield $this->load($key); + } + + protected function supports(ArgumentMetadata $argument): bool + { + $argumentType = $argument->getType(); + if ($argumentType === null) { + return false; + } + + return is_a($argumentType, $this->getClass(), true); + } + + /** + * @phpstan-return array + */ + protected function getKey(Request $request): array + { + $key = []; + foreach ($this->getRequestAttributes() as $name) { + if (!$request->attributes->has($name)) { + continue; + } + + $key[$name] = $request->attributes->get($name); + } + + return $key; + } + + /** + * @phpstan-param array $key + */ + protected function validateKey(array $key): bool + { + foreach ($this->getRequestAttributes() as $name) { + if (!isset($key[$name])) { + return false; + } + + if (!is_string($key[$name])) { + return false; + } + + if (!$this->validateValue($key[$name])) { + return false; + } + } + + return true; + } + + protected function validateValue(string $value): bool + { + return true; + } + + /** + * @phpstan-return string[] + */ + abstract protected function getRequestAttributes(): array; + + /** + * @phpstan-return class-string + */ + abstract protected function getClass(): string; + + /** + * @phpstan-param array $key + * + * @phpstan-return TValue + */ + abstract protected function load(array $key): object; +} diff --git a/src/bundle/ValueResolver/ContentInfoValueResolver.php b/src/bundle/ValueResolver/ContentInfoValueResolver.php new file mode 100644 index 0000000000..e1f1d34197 --- /dev/null +++ b/src/bundle/ValueResolver/ContentInfoValueResolver.php @@ -0,0 +1,47 @@ + + */ +final class ContentInfoValueResolver extends AbstractValueResolver +{ + public const string ATTRIBUTE_CONTENT_INFO_ID = 'contentInfoId'; + + public function __construct( + private readonly ContentService $contentService + ) { + } + + protected function getRequestAttributes(): array + { + return [self::ATTRIBUTE_CONTENT_INFO_ID]; + } + + protected function getClass(): string + { + return ContentInfo::class; + } + + protected function validateValue(string $value): bool + { + return is_numeric($value); + } + + protected function load(array $key): object + { + return $this->contentService->loadContentInfo( + (int)$key[self::ATTRIBUTE_CONTENT_INFO_ID] + ); + } +} diff --git a/src/bundle/ValueResolver/ContentTypeDraftValueResolver.php b/src/bundle/ValueResolver/ContentTypeDraftValueResolver.php new file mode 100644 index 0000000000..84f82cac08 --- /dev/null +++ b/src/bundle/ValueResolver/ContentTypeDraftValueResolver.php @@ -0,0 +1,47 @@ + + */ +final class ContentTypeDraftValueResolver extends AbstractValueResolver +{ + private const string ATTRIBUTE_CONTENT_TYPE_ID = 'contentTypeId'; + + public function __construct( + private readonly ContentTypeService $contentTypeService + ) { + } + + protected function getRequestAttributes(): array + { + return [self::ATTRIBUTE_CONTENT_TYPE_ID]; + } + + protected function getClass(): string + { + return ContentTypeDraft::class; + } + + protected function validateValue(string $value): bool + { + return is_numeric($value); + } + + protected function load(array $key): object + { + return $this->contentTypeService->loadContentTypeDraft( + (int)$key[self::ATTRIBUTE_CONTENT_TYPE_ID] + ); + } +} diff --git a/src/bundle/ValueResolver/ContentTypeFromIdValueResolver.php b/src/bundle/ValueResolver/ContentTypeFromIdValueResolver.php new file mode 100644 index 0000000000..7c9553c99d --- /dev/null +++ b/src/bundle/ValueResolver/ContentTypeFromIdValueResolver.php @@ -0,0 +1,47 @@ + + */ +final class ContentTypeFromIdValueResolver extends AbstractValueResolver +{ + private const string ATTRIBUTE_CONTENT_TYPE_ID = 'contentTypeId'; + + public function __construct( + private readonly ContentTypeService $contentTypeService + ) { + } + + protected function getRequestAttributes(): array + { + return [self::ATTRIBUTE_CONTENT_TYPE_ID]; + } + + protected function getClass(): string + { + return ContentType::class; + } + + protected function validateValue(string $value): bool + { + return is_numeric($value); + } + + protected function load(array $key): object + { + return $this->contentTypeService->loadContentType( + (int)$key[self::ATTRIBUTE_CONTENT_TYPE_ID] + ); + } +} diff --git a/src/bundle/ValueResolver/ContentTypeFromIdentifierValueResolver.php b/src/bundle/ValueResolver/ContentTypeFromIdentifierValueResolver.php new file mode 100644 index 0000000000..1d0fb9ccfd --- /dev/null +++ b/src/bundle/ValueResolver/ContentTypeFromIdentifierValueResolver.php @@ -0,0 +1,47 @@ + + */ +final class ContentTypeFromIdentifierValueResolver extends AbstractValueResolver +{ + private const string ATTRIBUTE_CONTENT_TYPE_IDENTIFIER = 'contentTypeIdentifier'; + + public function __construct( + private readonly ContentTypeService $contentTypeService + ) { + } + + protected function getRequestAttributes(): array + { + return [self::ATTRIBUTE_CONTENT_TYPE_IDENTIFIER]; + } + + protected function getClass(): string + { + return ContentType::class; + } + + protected function validateValue(string $value): bool + { + return $value !== ''; + } + + protected function load(array $key): object + { + return $this->contentTypeService->loadContentTypeByIdentifier( + $key[self::ATTRIBUTE_CONTENT_TYPE_IDENTIFIER] + ); + } +} diff --git a/src/bundle/ValueResolver/ContentTypeGroupValueResolver.php b/src/bundle/ValueResolver/ContentTypeGroupValueResolver.php new file mode 100644 index 0000000000..bd08ac5f44 --- /dev/null +++ b/src/bundle/ValueResolver/ContentTypeGroupValueResolver.php @@ -0,0 +1,47 @@ + + */ +final class ContentTypeGroupValueResolver extends AbstractValueResolver +{ + private const string ATTRIBUTE_CONTENT_TYPE_GROUP_ID = 'contentTypeGroupId'; + + public function __construct( + private readonly ContentTypeService $contentTypeService + ) { + } + + protected function getRequestAttributes(): array + { + return [self::ATTRIBUTE_CONTENT_TYPE_GROUP_ID]; + } + + protected function getClass(): string + { + return ContentTypeGroup::class; + } + + protected function validateValue(string $value): bool + { + return is_numeric($value); + } + + protected function load(array $key): object + { + return $this->contentTypeService->loadContentTypeGroup( + (int) $key[self::ATTRIBUTE_CONTENT_TYPE_GROUP_ID] + ); + } +} diff --git a/src/bundle/ValueResolver/ContentValueResolver.php b/src/bundle/ValueResolver/ContentValueResolver.php new file mode 100644 index 0000000000..0c05b26ed9 --- /dev/null +++ b/src/bundle/ValueResolver/ContentValueResolver.php @@ -0,0 +1,74 @@ + + */ +final class ContentValueResolver extends AbstractValueResolver +{ + private const string ATTRIBUTE_CONTENT_ID = 'contentId'; + private const string ATTRIBUTE_VERSION_NO = 'versionNo'; + private const string ATTRIBUTE_LANGUAGE_CODE = 'languageCode'; + + public function __construct( + private readonly ContentService $contentService + ) { + } + + protected function getRequestAttributes(): array + { + return [ + self::ATTRIBUTE_CONTENT_ID, + self::ATTRIBUTE_VERSION_NO, + self::ATTRIBUTE_LANGUAGE_CODE, + ]; + } + + protected function getClass(): string + { + return Content::class; + } + + protected function validateKey(array $key): bool + { + if (!array_key_exists(self::ATTRIBUTE_CONTENT_ID, $key)) { + return false; + } + $contentId = $key[self::ATTRIBUTE_CONTENT_ID]; + if (!is_numeric($contentId)) { + return false; + } + + if (array_key_exists(self::ATTRIBUTE_VERSION_NO, $key) && !is_numeric($key[self::ATTRIBUTE_VERSION_NO])) { + return false; + } + + if (!is_array($key[self::ATTRIBUTE_LANGUAGE_CODE])) { + return false; + } + + return true; + } + + protected function load(array $key): object + { + $contentId = (int)$key[self::ATTRIBUTE_CONTENT_ID]; + $languages = $key[self::ATTRIBUTE_LANGUAGE_CODE]; + $versionNo = $key[self::ATTRIBUTE_VERSION_NO] ?? null; + if ($versionNo !== null) { + $versionNo = (int)$versionNo; + } + + return $this->contentService->loadContent($contentId, $languages, $versionNo); + } +} diff --git a/src/bundle/ValueResolver/LanguageFromCodeValueResolver.php b/src/bundle/ValueResolver/LanguageFromCodeValueResolver.php new file mode 100644 index 0000000000..041ccac63b --- /dev/null +++ b/src/bundle/ValueResolver/LanguageFromCodeValueResolver.php @@ -0,0 +1,47 @@ + + */ +final class LanguageFromCodeValueResolver extends AbstractValueResolver +{ + private const string ATTRIBUTE_LANGUAGE_CORE = 'languageCode'; + + public function __construct( + private readonly LanguageService $languageService + ) { + } + + protected function getRequestAttributes(): array + { + return [self::ATTRIBUTE_LANGUAGE_CORE]; + } + + protected function getClass(): string + { + return Language::class; + } + + protected function validateValue(string $value): bool + { + return $value !== ''; + } + + protected function load(array $key): object + { + return $this->languageService->loadLanguage( + $key[self::ATTRIBUTE_LANGUAGE_CORE] + ); + } +} diff --git a/src/bundle/ValueResolver/LanguageFromIdValueResolver.php b/src/bundle/ValueResolver/LanguageFromIdValueResolver.php new file mode 100644 index 0000000000..627142f326 --- /dev/null +++ b/src/bundle/ValueResolver/LanguageFromIdValueResolver.php @@ -0,0 +1,47 @@ + + */ +final class LanguageFromIdValueResolver extends AbstractValueResolver +{ + private const string ATTRIBUTE_LANGUAGE_ID = 'languageId'; + + public function __construct( + private readonly LanguageService $languageService + ) { + } + + protected function getRequestAttributes(): array + { + return [self::ATTRIBUTE_LANGUAGE_ID]; + } + + protected function getClass(): string + { + return Language::class; + } + + protected function validateValue(string $value): bool + { + return is_numeric($value); + } + + protected function load(array $key): object + { + return $this->languageService->loadLanguageById( + (int) $key[self::ATTRIBUTE_LANGUAGE_ID] + ); + } +} diff --git a/src/bundle/ValueResolver/ObjectStateGroupValueResolver.php b/src/bundle/ValueResolver/ObjectStateGroupValueResolver.php new file mode 100644 index 0000000000..81ed2cdc42 --- /dev/null +++ b/src/bundle/ValueResolver/ObjectStateGroupValueResolver.php @@ -0,0 +1,47 @@ + + */ +final class ObjectStateGroupValueResolver extends AbstractValueResolver +{ + private const string ATTRIBUTE_OBJECT_STATE_GROUP_ID = 'objectStateGroupId'; + + public function __construct( + private readonly ObjectStateService $objectStateService + ) { + } + + protected function getRequestAttributes(): array + { + return [self::ATTRIBUTE_OBJECT_STATE_GROUP_ID]; + } + + protected function getClass(): string + { + return ObjectStateGroup::class; + } + + protected function validateValue(string $value): bool + { + return is_numeric($value); + } + + protected function load(array $key): object + { + return $this->objectStateService->loadObjectStateGroup( + (int)$key[self::ATTRIBUTE_OBJECT_STATE_GROUP_ID] + ); + } +} diff --git a/src/bundle/ValueResolver/ObjectStateValueResolver.php b/src/bundle/ValueResolver/ObjectStateValueResolver.php new file mode 100644 index 0000000000..56d921dfe4 --- /dev/null +++ b/src/bundle/ValueResolver/ObjectStateValueResolver.php @@ -0,0 +1,47 @@ + + */ +final class ObjectStateValueResolver extends AbstractValueResolver +{ + private const string ATTRIBUTE_OBJECT_STATE_ID = 'objectStateId'; + + public function __construct( + private readonly ObjectStateService $objectStateService + ) { + } + + protected function getRequestAttributes(): array + { + return [self::ATTRIBUTE_OBJECT_STATE_ID]; + } + + protected function getClass(): string + { + return ObjectState::class; + } + + protected function validateValue(string $value): bool + { + return is_numeric($value); + } + + protected function load(array $key): object + { + return $this->objectStateService->loadObjectState( + (int)$key[self::ATTRIBUTE_OBJECT_STATE_ID] + ); + } +} diff --git a/src/bundle/ValueResolver/PolicyDraftValueResolver.php b/src/bundle/ValueResolver/PolicyDraftValueResolver.php new file mode 100644 index 0000000000..036bb267a5 --- /dev/null +++ b/src/bundle/ValueResolver/PolicyDraftValueResolver.php @@ -0,0 +1,61 @@ + + */ +final class PolicyDraftValueResolver extends AbstractValueResolver +{ + private const string ATTRIBUTE_ROLE_ID = 'roleId'; + private const string ATTRIBUTE_POLICY_ID = 'policyId'; + + public function __construct( + private readonly RoleService $roleService + ) { + } + + protected function getRequestAttributes(): array + { + return [ + self::ATTRIBUTE_ROLE_ID, + self::ATTRIBUTE_POLICY_ID, + ]; + } + + protected function getClass(): string + { + return PolicyDraft::class; + } + + protected function validateValue(string $value): bool + { + return is_numeric($value); + } + + protected function load(array $key): object + { + $roleId = (int)$key[self::ATTRIBUTE_ROLE_ID]; + $policyId = (int)$key[self::ATTRIBUTE_POLICY_ID]; + + $roleDraft = $this->roleService->loadRoleDraftByRoleId($roleId); + foreach ($roleDraft->getPolicies() as $policy) { + /** @var \Ibexa\Contracts\Core\Repository\Values\User\PolicyDraft $policy */ + if ($policy->originalId === $policyId) { + return $policy; + } + } + + throw new NotFoundHttpException("Policy draft $policyId not found."); + } +} diff --git a/src/bundle/ValueResolver/PolicyValueResolver.php b/src/bundle/ValueResolver/PolicyValueResolver.php new file mode 100644 index 0000000000..c4901add21 --- /dev/null +++ b/src/bundle/ValueResolver/PolicyValueResolver.php @@ -0,0 +1,61 @@ + + */ +final class PolicyValueResolver extends AbstractValueResolver +{ + private const string ATTRIBUTE_ROLE_ID = 'roleId'; + private const string ATTRIBUTE_POLICY_ID = 'policyId'; + + public function __construct( + private readonly RoleService $roleService + ) { + } + + protected function getRequestAttributes(): array + { + return [ + self::ATTRIBUTE_ROLE_ID, + self::ATTRIBUTE_POLICY_ID, + ]; + } + + protected function getClass(): string + { + return Policy::class; + } + + protected function validateValue(string $value): bool + { + return is_numeric($value); + } + + protected function load(array $key): object + { + $roleId = (int)$key[self::ATTRIBUTE_ROLE_ID]; + $policyId = (int)$key[self::ATTRIBUTE_POLICY_ID]; + + $roleDraft = $this->roleService->loadRole($roleId); + foreach ($roleDraft->getPolicies() as $policy) { + /** @var \Ibexa\Contracts\Core\Repository\Values\User\PolicyDraft $policy */ + if ($policy->originalId === $policyId) { + return $policy; + } + } + + throw new NotFoundHttpException("Policy draft $policyId not found."); + } +} diff --git a/src/bundle/ValueResolver/RoleAssignmentValueResolver.php b/src/bundle/ValueResolver/RoleAssignmentValueResolver.php new file mode 100644 index 0000000000..a9efb2ad12 --- /dev/null +++ b/src/bundle/ValueResolver/RoleAssignmentValueResolver.php @@ -0,0 +1,49 @@ + + */ +final class RoleAssignmentValueResolver extends AbstractValueResolver +{ + private const string ATTRIBUTE_ROLE_ASSIGNMENT_ID = 'roleAssignmentId'; + + public function __construct( + private readonly RoleService $roleService + ) { + } + + protected function getRequestAttributes(): array + { + return [ + self::ATTRIBUTE_ROLE_ASSIGNMENT_ID, + ]; + } + + protected function getClass(): string + { + return RoleAssignment::class; + } + + protected function validateValue(string $value): bool + { + return is_numeric($value); + } + + protected function load(array $key): object + { + return $this->roleService->loadRoleAssignment( + (int)$key[self::ATTRIBUTE_ROLE_ASSIGNMENT_ID] + ); + } +} diff --git a/src/bundle/ValueResolver/RoleValueResolver.php b/src/bundle/ValueResolver/RoleValueResolver.php new file mode 100644 index 0000000000..090e0baa32 --- /dev/null +++ b/src/bundle/ValueResolver/RoleValueResolver.php @@ -0,0 +1,47 @@ + + */ +final class RoleValueResolver extends AbstractValueResolver +{ + private const string ATTRIBUTE_ROLE_ID = 'roleId'; + + public function __construct( + private readonly RoleService $roleService + ) { + } + + protected function getRequestAttributes(): array + { + return [self::ATTRIBUTE_ROLE_ID]; + } + + protected function getClass(): string + { + return Role::class; + } + + protected function validateValue(string $value): bool + { + return is_numeric($value); + } + + protected function load(array $key): object + { + return $this->roleService->loadRole( + (int)$key[self::ATTRIBUTE_ROLE_ID] + ); + } +} diff --git a/src/bundle/ValueResolver/SectionValueResolver.php b/src/bundle/ValueResolver/SectionValueResolver.php new file mode 100644 index 0000000000..fed3607e6d --- /dev/null +++ b/src/bundle/ValueResolver/SectionValueResolver.php @@ -0,0 +1,47 @@ + + */ +final class SectionValueResolver extends AbstractValueResolver +{ + private const string ATTRIBUTE_SECTION_ID = 'sectionId'; + + public function __construct( + private readonly SectionService $sectionService + ) { + } + + protected function getRequestAttributes(): array + { + return [self::ATTRIBUTE_SECTION_ID]; + } + + protected function getClass(): string + { + return Section::class; + } + + protected function validateValue(string $value): bool + { + return is_numeric($value); + } + + protected function load(array $key): object + { + return $this->sectionService->loadSection( + (int)$key[self::ATTRIBUTE_SECTION_ID] + ); + } +} diff --git a/src/bundle/ValueResolver/SourceLanguageValueResolver.php b/src/bundle/ValueResolver/SourceLanguageValueResolver.php new file mode 100644 index 0000000000..692d769a9f --- /dev/null +++ b/src/bundle/ValueResolver/SourceLanguageValueResolver.php @@ -0,0 +1,56 @@ + + */ +final class SourceLanguageValueResolver extends AbstractValueResolver +{ + private const string ARGUMENT_NAME = 'language'; + private const string ATTRIBUTE_LANGUAGE_CODE_FROM = 'fromLanguageCode'; + + public function __construct( + private readonly LanguageService $languageService + ) { + } + + protected function supports(ArgumentMetadata $argument): bool + { + if ($argument->getName() !== self::ARGUMENT_NAME) { + return false; + } + + return parent::supports($argument); + } + + protected function getRequestAttributes(): array + { + return [self::ATTRIBUTE_LANGUAGE_CODE_FROM]; + } + + protected function getClass(): string + { + return Language::class; + } + + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ + protected function load(array $key): object + { + return $this->languageService->loadLanguage( + $key[self::ATTRIBUTE_LANGUAGE_CODE_FROM] + ); + } +} diff --git a/src/bundle/ValueResolver/TargetLanguageValueResolver.php b/src/bundle/ValueResolver/TargetLanguageValueResolver.php new file mode 100644 index 0000000000..60911c8481 --- /dev/null +++ b/src/bundle/ValueResolver/TargetLanguageValueResolver.php @@ -0,0 +1,53 @@ + + */ +final class TargetLanguageValueResolver extends AbstractValueResolver +{ + private const string ARGUMENT_NAME = 'language'; + private const string ATTRIBUTE_LANGUAGE_CODE_TO = 'toLanguageCode'; + + public function __construct( + private readonly LanguageService $languageService + ) { + } + + protected function supports(ArgumentMetadata $argument): bool + { + if ($argument->getName() !== self::ARGUMENT_NAME) { + return false; + } + + return parent::supports($argument); + } + + protected function getRequestAttributes(): array + { + return [self::ATTRIBUTE_LANGUAGE_CODE_TO]; + } + + protected function getClass(): string + { + return Language::class; + } + + protected function load(array $key): object + { + return $this->languageService->loadLanguage( + $key[self::ATTRIBUTE_LANGUAGE_CODE_TO] + ); + } +} diff --git a/src/bundle/ValueResolver/URLWildcardValueResolver.php b/src/bundle/ValueResolver/URLWildcardValueResolver.php new file mode 100644 index 0000000000..0899b9b14b --- /dev/null +++ b/src/bundle/ValueResolver/URLWildcardValueResolver.php @@ -0,0 +1,47 @@ + + */ +final class URLWildcardValueResolver extends AbstractValueResolver +{ + private const string ATTRIBUTE_URL_WILDCARD_ID = 'urlWildcardId'; + + public function __construct( + private readonly URLWildcardService $urlWildcardService + ) { + } + + protected function getRequestAttributes(): array + { + return [self::ATTRIBUTE_URL_WILDCARD_ID]; + } + + protected function getClass(): string + { + return URLWildcard::class; + } + + protected function validateValue(string $value): bool + { + return is_numeric($value); + } + + protected function load(array $key): object + { + return $this->urlWildcardService->load( + (int)$key[self::ATTRIBUTE_URL_WILDCARD_ID] + ); + } +} diff --git a/src/bundle/ValueResolver/VersionInfoValueResolver.php b/src/bundle/ValueResolver/VersionInfoValueResolver.php new file mode 100644 index 0000000000..1d5799b027 --- /dev/null +++ b/src/bundle/ValueResolver/VersionInfoValueResolver.php @@ -0,0 +1,51 @@ + + */ +final class VersionInfoValueResolver extends AbstractValueResolver +{ + private const string ATTRIBUTE_VERSION_NO = 'versionNo'; + private const string ATTRIBUTE_CONTENT_ID = 'contentId'; + + public function __construct( + private readonly ContentService $contentService + ) { + } + + protected function getRequestAttributes(): array + { + return [self::ATTRIBUTE_VERSION_NO, self::ATTRIBUTE_CONTENT_ID]; + } + + protected function getClass(): string + { + return VersionInfo::class; + } + + protected function validateValue(string $value): bool + { + return is_numeric($value); + } + + protected function load(array $key): object + { + $contentId = (int)$key[self::ATTRIBUTE_CONTENT_ID]; + $versionNo = (int)$key[self::ATTRIBUTE_VERSION_NO]; + + $contentInfo = $this->contentService->loadContentInfo($contentId); + + return $this->contentService->loadVersionInfo($contentInfo, $versionNo); + } +} diff --git a/src/bundle/View/EzPagerfantaView.php b/src/bundle/View/EzPagerfantaView.php deleted file mode 100644 index 1e3fdb59fc..0000000000 --- a/src/bundle/View/EzPagerfantaView.php +++ /dev/null @@ -1,38 +0,0 @@ -translator); - } - - protected function getDefaultProximity() - { - return 3; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'ibexa'; - } -} diff --git a/src/bundle/View/IbexaPagerfantaView.php b/src/bundle/View/IbexaPagerfantaView.php new file mode 100644 index 0000000000..318a2bbc0e --- /dev/null +++ b/src/bundle/View/IbexaPagerfantaView.php @@ -0,0 +1,34 @@ +denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED'); } - /** - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location - * @param string $uriFragment - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse - */ public function redirectToLocation(Location $location, string $uriFragment = ''): RedirectResponse { return $this->redirectToRoute('ibexa.content.view', [ diff --git a/src/contracts/Event/FormActionEvent.php b/src/contracts/Event/FormActionEvent.php index 07aa518acb..c7ef0a295e 100644 --- a/src/contracts/Event/FormActionEvent.php +++ b/src/contracts/Event/FormActionEvent.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\Contracts\AdminUi\Event; @@ -15,35 +16,35 @@ class FormActionEvent extends FormEvent { /** * Name of the button used to submit the form. - * - * @var string|null */ - private $clickedButton; + private ?string $clickedButton; /** * Hash of options. * - * @var array + * @var array */ - private $options; + private array $options; /** - * Response to return after form post-processing. Typically a RedirectResponse. - * - * @var \Symfony\Component\HttpFoundation\Response|null + * Response to return after form post-processing. Typically, a RedirectResponse. */ - private $response; + private ?Response $response; /** * Additional payload populated for event listeners next in priority. * - * @var array + * @var array */ - private $payloads; + private array $payloads; + /** + * @param array $options + * @param array $payloads + */ public function __construct( FormInterface $form, - $data, + mixed $data, ?string $clickedButton, array $options = [], array $payloads = [] @@ -59,6 +60,9 @@ public function getClickedButton(): ?string return $this->clickedButton; } + /** + * @return array + */ public function getOptions(): array { return $this->options; @@ -67,16 +71,10 @@ public function getOptions(): array /** * @param string $optionName The option name * @param mixed $defaultValue default value to return if option is not set - * - * @return mixed */ - public function getOption($optionName, $defaultValue = null) + public function getOption(string $optionName, mixed $defaultValue = null): mixed { - if (!isset($this->options[$optionName])) { - return $defaultValue; - } - - return $this->options[$optionName]; + return $this->options[$optionName] ?? $defaultValue; } public function hasOption(string $optionName): bool @@ -99,11 +97,17 @@ public function hasResponse(): bool return $this->response !== null; } + /** + * @return array + */ public function getPayloads(): array { return $this->payloads; } + /** + * @param array $payloads + */ public function setPayloads(array $payloads): void { $this->payloads = $payloads; @@ -114,12 +118,12 @@ public function hasPayload(string $name): bool return isset($this->payloads[$name]); } - public function getPayload(string $name) + public function getPayload(string $name): mixed { return $this->payloads[$name]; } - public function setPayload(string $name, $payload): void + public function setPayload(string $name, mixed $payload): void { $this->payloads[$name] = $payload; } diff --git a/src/lib/Form/Data/Bookmark/BookmarkRemoveData.php b/src/lib/Form/Data/Bookmark/BookmarkRemoveData.php index f5497b57de..65118653ae 100644 --- a/src/lib/Form/Data/Bookmark/BookmarkRemoveData.php +++ b/src/lib/Form/Data/Bookmark/BookmarkRemoveData.php @@ -13,13 +13,13 @@ class BookmarkRemoveData { /** - * @var array + * @var array */ #[Assert\NotBlank] - public $bookmarks; + public array $bookmarks; /** - * @param array $bookmarks + * @param array $bookmarks */ public function __construct(array $bookmarks = []) { @@ -27,7 +27,7 @@ public function __construct(array $bookmarks = []) } /** - * @return array + * @return array */ public function getBookmarks(): array { @@ -35,7 +35,7 @@ public function getBookmarks(): array } /** - * @param array $bookmarks + * @param array $bookmarks */ public function setBookmarks(array $bookmarks): void { diff --git a/src/lib/Form/Data/ContentType/ContentTypesDeleteData.php b/src/lib/Form/Data/ContentType/ContentTypesDeleteData.php index 49bbc97c25..69ca4a789b 100644 --- a/src/lib/Form/Data/ContentType/ContentTypesDeleteData.php +++ b/src/lib/Form/Data/ContentType/ContentTypesDeleteData.php @@ -13,11 +13,15 @@ */ class ContentTypesDeleteData { - /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[]|null */ - protected $contentTypes; + /** + * A map of content type id to false value. + * + * @var array + */ + protected array $contentTypes; /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[]|null $contentTypes + * @param array $contentTypes */ public function __construct(array $contentTypes = []) { @@ -25,17 +29,17 @@ public function __construct(array $contentTypes = []) } /** - * @return array|null + * @return array */ - public function getContentTypes(): ?array + public function getContentTypes(): array { return $this->contentTypes; } /** - * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[]|null $contentTypes + * @param array $contentTypes */ - public function setContentTypes(?array $contentTypes) + public function setContentTypes(array $contentTypes): void { $this->contentTypes = $contentTypes; } diff --git a/src/lib/Form/Extension/RichTextTypeExtension.php b/src/lib/Form/Extension/RichTextTypeExtension.php deleted file mode 100644 index bf82f1bde7..0000000000 --- a/src/lib/Form/Extension/RichTextTypeExtension.php +++ /dev/null @@ -1,45 +0,0 @@ -setDefaults([ - 'udw_context' => [ - 'language' => null, - ], - ]); - } - - /** - * {@inheritdoc} - */ - public function buildView(FormView $view, FormInterface $form, array $options): void - { - $view->vars += [ - 'udw_context' => $options['udw_context'], - ]; - } - - public static function getExtendedTypes(): iterable - { - return [RichTextType::class]; - } -} diff --git a/src/lib/Form/Type/ChoiceList/Loader/AvailableTranslationLanguageChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/AvailableTranslationLanguageChoiceLoader.php index 47dee62c75..9de4a24bc6 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/AvailableTranslationLanguageChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/AvailableTranslationLanguageChoiceLoader.php @@ -13,29 +13,27 @@ class AvailableTranslationLanguageChoiceLoader extends BaseChoiceLoader { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ - protected $languageService; + protected LanguageService $languageService; /** @var string[] */ - protected $languageCodes; + protected array $languageCodes; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService * @param string[] $languageCodes */ - public function __construct(LanguageService $languageService, $languageCodes) + public function __construct(LanguageService $languageService, array $languageCodes) { $this->languageService = $languageService; $this->languageCodes = $languageCodes; } /** - * {@inheritdoc} + * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language[] */ public function getChoiceList(): array { return array_filter( - $this->languageService->loadLanguages(), + iterator_to_array($this->languageService->loadLanguages()), function (Language $language) { return $language->enabled && !in_array($language->languageCode, $this->languageCodes, true); } diff --git a/src/lib/Form/Type/ChoiceList/Loader/BaseChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/BaseChoiceLoader.php index c5f9c88339..e9d63e6433 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/BaseChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/BaseChoiceLoader.php @@ -9,6 +9,7 @@ namespace Ibexa\AdminUi\Form\Type\ChoiceList\Loader; use Symfony\Component\Form\ChoiceList\ArrayChoiceList; +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; abstract class BaseChoiceLoader implements ChoiceLoaderInterface @@ -18,22 +19,16 @@ abstract class BaseChoiceLoader implements ChoiceLoaderInterface * * Introduced for simplify decoration. * - * @return array + * @return array */ abstract public function getChoiceList(): array; - /** - * {@inheritdoc} - */ - public function loadChoiceList($value = null) + public function loadChoiceList(?callable $value = null): ChoiceListInterface { return new ArrayChoiceList($this->getChoiceList(), $value); } - /** - * {@inheritdoc} - */ - public function loadChoicesForValues(array $values, $value = null) + public function loadChoicesForValues(array $values, ?callable $value = null): array { // Optimize $values = array_filter($values); @@ -44,10 +39,7 @@ public function loadChoicesForValues(array $values, $value = null) return $this->loadChoiceList($value)->getChoicesForValues($values); } - /** - * {@inheritdoc} - */ - public function loadValuesForChoices(array $choices, $value = null) + public function loadValuesForChoices(array $choices, ?callable $value = null): array { // Optimize $choices = array_filter($choices); diff --git a/src/lib/Form/Type/ChoiceList/Loader/BaseTranslationLanguageChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/BaseTranslationLanguageChoiceLoader.php index 4d3abc32da..c8ec98b2f2 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/BaseTranslationLanguageChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/BaseTranslationLanguageChoiceLoader.php @@ -13,29 +13,27 @@ class BaseTranslationLanguageChoiceLoader extends BaseChoiceLoader { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ - protected $languageService; + protected LanguageService $languageService; /** @var string[] */ - protected $languageCodes; + protected array $languageCodes; /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService * @param string[] $languageCodes */ - public function __construct(LanguageService $languageService, $languageCodes) + public function __construct(LanguageService $languageService, array $languageCodes) { $this->languageService = $languageService; $this->languageCodes = $languageCodes; } /** - * {@inheritdoc} + * \Ibexa\Contracts\Core\Repository\Values\Content\Language[]. */ public function getChoiceList(): array { return array_filter( - $this->languageService->loadLanguages(), + iterator_to_array($this->languageService->loadLanguages()), function (Language $language) { return $language->enabled && in_array($language->languageCode, $this->languageCodes, true); } diff --git a/src/lib/Form/Type/ChoiceList/Loader/ConfiguredLanguagesChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/ConfiguredLanguagesChoiceLoader.php index fa75b533e9..93b0cd20c6 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/ConfiguredLanguagesChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/ConfiguredLanguagesChoiceLoader.php @@ -11,20 +11,15 @@ use Ibexa\Contracts\Core\Repository\LanguageService; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Symfony\Component\Form\ChoiceList\ArrayChoiceList; +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; class ConfiguredLanguagesChoiceLoader implements ChoiceLoaderInterface { - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ - private $languageService; + private LanguageService $languageService; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; - /** - * @param \Ibexa\Contracts\Core\Repository\LanguageService $languageService - * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver - */ public function __construct(LanguageService $languageService, ConfigResolverInterface $configResolver) { $this->languageService = $languageService; @@ -32,17 +27,14 @@ public function __construct(LanguageService $languageService, ConfigResolverInte } /** - * {@inheritdoc} + * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language[] */ public function getChoiceList(): array { return $this->getPriorityOrderedLanguages(); } - /** - * {@inheritdoc} - */ - public function loadChoiceList($value = null) + public function loadChoiceList(?callable $value = null): ChoiceListInterface { $choices = $this->getChoiceList(); @@ -50,9 +42,9 @@ public function loadChoiceList($value = null) } /** - * {@inheritdoc} + * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language[] */ - public function loadChoicesForValues(array $values, $value = null) + public function loadChoicesForValues(array $values, ?callable $value = null): array { // Optimize $values = array_filter($values); @@ -64,9 +56,9 @@ public function loadChoicesForValues(array $values, $value = null) } /** - * {@inheritdoc} + * @return string[] */ - public function loadValuesForChoices(array $choices, $value = null) + public function loadValuesForChoices(array $choices, ?callable $value = null): array { // Optimize $choices = array_filter($choices); @@ -78,7 +70,7 @@ public function loadValuesForChoices(array $choices, $value = null) } /** - * Sort languages based on siteaccess languages order. + * Sort languages based on SiteAccess languages order. * * @return \Ibexa\Contracts\Core\Repository\Values\Content\Language[] */ diff --git a/src/lib/Form/Type/ChoiceList/Loader/ContentCreateContentTypeChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/ContentCreateContentTypeChoiceLoader.php index 62c2109a25..29e96ed8ef 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/ContentCreateContentTypeChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/ContentCreateContentTypeChoiceLoader.php @@ -12,6 +12,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Symfony\Component\Form\ChoiceList\ArrayChoiceList; +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; @@ -34,6 +35,9 @@ public function __construct( $this->eventDispatcher = $eventDispatcher; } + /** + * @param array $restrictedContentTypeIds + */ public function setRestrictedContentTypeIds(array $restrictedContentTypeIds): self { $this->restrictedContentTypesIds = $restrictedContentTypeIds; @@ -53,10 +57,7 @@ public function setTargetLocation(?Location $targetLocation): self return $this; } - /** - * {@inheritdoc} - */ - public function loadChoiceList($value = null) + public function loadChoiceList(?callable $value = null): ChoiceListInterface { $contentTypesGroups = $this->contentTypeChoiceLoader->getChoiceList(); @@ -73,7 +74,7 @@ public function loadChoiceList($value = null) foreach ($contentTypesGroups as $group => $contentTypes) { $contentTypesGroups[$group] = array_filter($contentTypes, function (ContentType $contentType) { - return \in_array($contentType->id, $this->restrictedContentTypesIds); + return \in_array($contentType->id, $this->restrictedContentTypesIds, true); }); } @@ -81,9 +82,9 @@ public function loadChoiceList($value = null) } /** - * {@inheritdoc} + * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[][] */ - public function loadChoicesForValues(array $values, $value = null) + public function loadChoicesForValues(array $values, ?callable $value = null): array { // Optimize $values = array_filter($values); @@ -95,9 +96,9 @@ public function loadChoicesForValues(array $values, $value = null) } /** - * {@inheritdoc} + * @return array */ - public function loadValuesForChoices(array $choices, $value = null) + public function loadValuesForChoices(array $choices, ?callable $value = null): array { // Optimize $choices = array_filter($choices); diff --git a/src/lib/Form/Type/ChoiceList/Loader/ContentCreateLanguageChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/ContentCreateLanguageChoiceLoader.php index 9258a84e96..72140d6fab 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/ContentCreateLanguageChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/ContentCreateLanguageChoiceLoader.php @@ -9,20 +9,20 @@ namespace Ibexa\AdminUi\Form\Type\ChoiceList\Loader; use Ibexa\Contracts\Core\Repository\Values\Content\Language; +use function in_array; use Symfony\Component\Form\ChoiceList\ArrayChoiceList; +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; class ContentCreateLanguageChoiceLoader implements ChoiceLoaderInterface { - /** @var \Ibexa\AdminUi\Form\Type\ChoiceList\Loader\LanguageChoiceLoader */ - private $languageChoiceLoader; + private LanguageChoiceLoader $languageChoiceLoader; /** @var string[] */ - private $restrictedLanguagesCodes; + private array $restrictedLanguagesCodes; /** - * @param \Ibexa\AdminUi\Form\Type\ChoiceList\Loader\LanguageChoiceLoader $languageChoiceLoader - * @param array $restrictedLanguagesCodes + * @param array $restrictedLanguagesCodes */ public function __construct( LanguageChoiceLoader $languageChoiceLoader, @@ -32,10 +32,7 @@ public function __construct( $this->restrictedLanguagesCodes = $restrictedLanguagesCodes; } - /** - * {@inheritdoc} - */ - public function loadChoiceList($value = null) + public function loadChoiceList(?callable $value = null): ChoiceListInterface { $languages = $this->languageChoiceLoader->getChoiceList(); @@ -44,16 +41,16 @@ public function loadChoiceList($value = null) } $languages = array_filter($languages, function (Language $language) { - return \in_array($language->languageCode, $this->restrictedLanguagesCodes, true); + return in_array($language->languageCode, $this->restrictedLanguagesCodes, true); }); return new ArrayChoiceList($languages, $value); } /** - * {@inheritdoc} + * @return string[] */ - public function loadChoicesForValues(array $values, $value = null) + public function loadChoicesForValues(array $values, ?callable $value = null): array { // Optimize $values = array_filter($values); @@ -65,9 +62,9 @@ public function loadChoicesForValues(array $values, $value = null) } /** - * {@inheritdoc} + * @return string[] */ - public function loadValuesForChoices(array $choices, $value = null) + public function loadValuesForChoices(array $choices, ?callable $value = null): array { // Optimize $choices = array_filter($choices); diff --git a/src/lib/Form/Type/ChoiceList/Loader/ContentTypeChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/ContentTypeChoiceLoader.php index 139bb3390c..9657937d5e 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/ContentTypeChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/ContentTypeChoiceLoader.php @@ -12,28 +12,25 @@ use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface; use Symfony\Component\Form\ChoiceList\ArrayChoiceList; +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; class ContentTypeChoiceLoader implements ChoiceLoaderInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - protected $contentTypeService; + protected ContentTypeService $contentTypeService; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ - private $userLanguagePreferenceProvider; + private UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider; - /** - * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService - * @param \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider - */ - public function __construct(ContentTypeService $contentTypeService, UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider) - { + public function __construct( + ContentTypeService $contentTypeService, + UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider + ) { $this->contentTypeService = $contentTypeService; $this->userLanguagePreferenceProvider = $userLanguagePreferenceProvider; } /** - * {@inheritdoc} + * @return array */ public function getChoiceList(): array { @@ -41,9 +38,11 @@ public function getChoiceList(): array $preferredLanguages = $this->userLanguagePreferenceProvider->getPreferredLanguages(); $contentTypeGroups = $this->contentTypeService->loadContentTypeGroups($preferredLanguages); foreach ($contentTypeGroups as $contentTypeGroup) { - $contentTypes = $this->contentTypeService->loadContentTypes($contentTypeGroup, $preferredLanguages); + $contentTypes = iterator_to_array( + $this->contentTypeService->loadContentTypes($contentTypeGroup, $preferredLanguages) + ); usort($contentTypes, static function (ContentType $contentType1, ContentType $contentType2) { - return strnatcasecmp($contentType1->getName(), $contentType2->getName()); + return strnatcasecmp($contentType1->getName() ?? '', $contentType2->getName() ?? ''); }); $contentTypesList[$contentTypeGroup->identifier] = $contentTypes; @@ -52,10 +51,7 @@ public function getChoiceList(): array return $contentTypesList; } - /** - * {@inheritdoc} - */ - public function loadChoiceList($value = null) + public function loadChoiceList(?callable $value = null): ChoiceListInterface { $choices = $this->getChoiceList(); @@ -63,9 +59,9 @@ public function loadChoiceList($value = null) } /** - * {@inheritdoc} + * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType[] */ - public function loadChoicesForValues(array $values, $value = null) + public function loadChoicesForValues(array $values, ?callable $value = null): array { // Optimize $values = array_filter($values); @@ -77,9 +73,9 @@ public function loadChoicesForValues(array $values, $value = null) } /** - * {@inheritdoc} + * @return string[] */ - public function loadValuesForChoices(array $choices, $value = null) + public function loadValuesForChoices(array $choices, ?callable $value = null): array { // Optimize $choices = array_filter($choices); diff --git a/src/lib/Form/Type/ChoiceList/Loader/DatePeriodChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/DatePeriodChoiceLoader.php index 28aae53cc6..6456a04cd7 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/DatePeriodChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/DatePeriodChoiceLoader.php @@ -13,8 +13,7 @@ class DatePeriodChoiceLoader extends BaseChoiceLoader { - /** @var \Symfony\Contracts\Translation\TranslatorInterface */ - private $translator; + private TranslatorInterface $translator; public function __construct(TranslatorInterface $translator) { @@ -22,18 +21,16 @@ public function __construct(TranslatorInterface $translator) } /** - * {@inheritdoc} + * @return array */ public function getChoiceList(): array { - $choices = []; - foreach ($this->getDatePeriods() as $label => $value) { - $choices[$label] = $value; - } - - return $choices; + return array_map(static fn ($value): string => $value, $this->getDatePeriods()); } + /** + * @return array + */ private function getDatePeriods(): array { return [ diff --git a/src/lib/Form/Type/ChoiceList/Loader/LanguageChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/LanguageChoiceLoader.php index 2226bab009..ef23a3b3f9 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/LanguageChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/LanguageChoiceLoader.php @@ -10,9 +10,6 @@ class LanguageChoiceLoader extends ConfiguredLanguagesChoiceLoader { - /** - * {@inheritdoc} - */ public function getChoiceList(): array { $languages = parent::getChoiceList(); diff --git a/src/lib/Form/Type/ChoiceList/Loader/SiteAccessChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/SiteAccessChoiceLoader.php index 69e32e5742..37f94f20f0 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/SiteAccessChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/SiteAccessChoiceLoader.php @@ -12,24 +12,23 @@ use Ibexa\AdminUi\Siteaccess\SiteaccessResolverInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Symfony\Component\Form\ChoiceList\ArrayChoiceList; +use Symfony\Component\Form\ChoiceList\ChoiceListInterface; use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface; class SiteAccessChoiceLoader implements ChoiceLoaderInterface { - /** @var \Ibexa\AdminUi\Siteaccess\NonAdminSiteaccessResolver */ - private SiteaccessResolverInterface $nonAdminSiteaccessResolver; + private SiteaccessResolverInterface $nonAdminSiteAccessResolver; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ - private $location; + private ?Location $location; private SiteAccessNameGeneratorInterface $siteAccessNameGenerator; public function __construct( - SiteaccessResolverInterface $nonAdminSiteaccessResolver, + SiteaccessResolverInterface $nonAdminSiteAccessResolver, SiteAccessNameGeneratorInterface $siteAccessNameGenerator, ?Location $location = null ) { - $this->nonAdminSiteaccessResolver = $nonAdminSiteaccessResolver; + $this->nonAdminSiteAccessResolver = $nonAdminSiteAccessResolver; $this->location = $location; $this->siteAccessNameGenerator = $siteAccessNameGenerator; } @@ -40,8 +39,8 @@ public function __construct( public function getChoiceList(): array { $siteAccesses = $this->location === null - ? $this->nonAdminSiteaccessResolver->getSiteAccessesList() - : $this->nonAdminSiteaccessResolver->getSiteAccessesListForLocation(($this->location)); + ? $this->nonAdminSiteAccessResolver->getSiteAccessesList() + : $this->nonAdminSiteAccessResolver->getSiteAccessesListForLocation(($this->location)); $data = []; foreach ($siteAccesses as $siteAccess) { @@ -52,14 +51,17 @@ public function getChoiceList(): array return $data; } - public function loadChoiceList($value = null) + public function loadChoiceList(?callable $value = null): ChoiceListInterface { $choices = $this->getChoiceList(); return new ArrayChoiceList($choices, $value); } - public function loadChoicesForValues(array $values, $value = null) + /** + * @return string[] + */ + public function loadChoicesForValues(array $values, ?callable $value = null): array { // Optimize $values = array_filter($values); @@ -70,7 +72,10 @@ public function loadChoicesForValues(array $values, $value = null) return $this->loadChoiceList($value)->getChoicesForValues($values); } - public function loadValuesForChoices(array $choices, $value = null) + /** + * @return string[] + */ + public function loadValuesForChoices(array $choices, ?callable $value = null): array { // Optimize $choices = array_filter($choices); diff --git a/src/lib/Form/Type/ChoiceList/Loader/SiteAccessPreviewChoiceLoader.php b/src/lib/Form/Type/ChoiceList/Loader/SiteAccessPreviewChoiceLoader.php index 524be412df..3d8782c06d 100644 --- a/src/lib/Form/Type/ChoiceList/Loader/SiteAccessPreviewChoiceLoader.php +++ b/src/lib/Form/Type/ChoiceList/Loader/SiteAccessPreviewChoiceLoader.php @@ -43,19 +43,14 @@ public function getChoiceList(): array { $baseChoiceList = $this->siteAccessChoiceLoader->getChoiceList(); - $choiceList = []; - foreach ($baseChoiceList as $siteAccessName => $siteAccessKey) { - $choiceList[$siteAccessName] = $this->urlGenerator->generate( - 'ibexa.version.preview', - [ - 'contentId' => $this->contentId, - 'versionNo' => $this->versionNo, - 'language' => $this->languageCode, - 'siteAccessName' => $siteAccessKey, - ] - ); - } - - return $choiceList; + return array_map(fn (string $siteAccessKey): string => $this->urlGenerator->generate( + 'ibexa.version.preview', + [ + 'contentId' => $this->contentId, + 'versionNo' => $this->versionNo, + 'language' => $this->languageCode, + 'siteAccessName' => $siteAccessKey, + ] + ), $baseChoiceList); } } diff --git a/src/lib/Form/Type/Trash/ChoiceList/Loader/SearchContentTypeChoiceLoader.php b/src/lib/Form/Type/Trash/ChoiceList/Loader/SearchContentTypeChoiceLoader.php index 9a5b217a30..4a1bf4178d 100644 --- a/src/lib/Form/Type/Trash/ChoiceList/Loader/SearchContentTypeChoiceLoader.php +++ b/src/lib/Form/Type/Trash/ChoiceList/Loader/SearchContentTypeChoiceLoader.php @@ -19,8 +19,7 @@ class SearchContentTypeChoiceLoader extends ContentTypeChoiceLoader { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; public function __construct( ContentTypeService $contentTypeService, @@ -32,10 +31,7 @@ public function __construct( $this->configResolver = $configResolver; } - /** - * {@inheritdoc} - */ - public function loadChoiceList($value = null): ChoiceListInterface + public function loadChoiceList(?callable $value = null): ChoiceListInterface { $contentTypesGroups = $this->getChoiceList(); $userContentTypeIdentifier = $this->configResolver->getParameter('user_content_type_identifier'); diff --git a/src/lib/Limitation/Mapper/UDWBasedMapper.php b/src/lib/Limitation/Mapper/UDWBasedMapper.php index 4a746fd90a..237003d7ee 100755 --- a/src/lib/Limitation/Mapper/UDWBasedMapper.php +++ b/src/lib/Limitation/Mapper/UDWBasedMapper.php @@ -110,7 +110,7 @@ public function mapLimitationValue(Limitation $limitation) $location = $this->locationService->loadLocation($id); $query = new LocationQuery([ - 'filter' => new Ancestor($location->pathString), + 'filter' => new Ancestor($location->getPathString()), 'sortClauses' => [new Path()], ]); diff --git a/src/lib/Notification/FlashBagNotificationHandler.php b/src/lib/Notification/FlashBagNotificationHandler.php index edff774d26..448b9e54e4 100644 --- a/src/lib/Notification/FlashBagNotificationHandler.php +++ b/src/lib/Notification/FlashBagNotificationHandler.php @@ -9,7 +9,8 @@ namespace Ibexa\AdminUi\Notification; use Ibexa\Contracts\AdminUi\Notification\NotificationHandlerInterface; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; final class FlashBagNotificationHandler implements NotificationHandlerInterface { @@ -18,48 +19,32 @@ final class FlashBagNotificationHandler implements NotificationHandlerInterface private const TYPE_WARNING = 'warning'; private const TYPE_ERROR = 'error'; - /** - * @var \Symfony\Component\HttpFoundation\Session\SessionInterface - */ - private $session; - - /** - * @param \Symfony\Component\HttpFoundation\Session\SessionInterface $session - */ - public function __construct(SessionInterface $session) + public function __construct(private readonly RequestStack $requestStack) { - $this->session = $session; } - /** - * @param string $message - */ public function info(string $message): void { - $this->session->getFlashBag()->add(self::TYPE_INFO, $message); + $this->getFlashBag()->add(self::TYPE_INFO, $message); } - /** - * @param string $message - */ public function success(string $message): void { - $this->session->getFlashBag()->add(self::TYPE_SUCCESS, $message); + $this->getFlashBag()->add(self::TYPE_SUCCESS, $message); } - /** - * @param string $message - */ public function warning(string $message): void { - $this->session->getFlashBag()->add(self::TYPE_WARNING, $message); + $this->getFlashBag()->add(self::TYPE_WARNING, $message); } - /** - * @param string $message - */ public function error(string $message): void { - $this->session->getFlashBag()->add(self::TYPE_ERROR, $message); + $this->getFlashBag()->add(self::TYPE_ERROR, $message); + } + + private function getFlashBag(): FlashBagInterface + { + return $this->requestStack->getSession()->getFlashBag(); } } diff --git a/src/lib/Pagination/Pagerfanta/BookmarkAdapter.php b/src/lib/Pagination/Pagerfanta/BookmarkAdapter.php index 2a2945266b..f0f38e13ac 100644 --- a/src/lib/Pagination/Pagerfanta/BookmarkAdapter.php +++ b/src/lib/Pagination/Pagerfanta/BookmarkAdapter.php @@ -12,13 +12,14 @@ use Ibexa\Contracts\Core\Repository\BookmarkService; use Pagerfanta\Adapter\AdapterInterface; +/** + * @implements \Pagerfanta\Adapter\AdapterInterface<\Ibexa\AdminUi\UI\Value\Location\Bookmark> + */ class BookmarkAdapter implements AdapterInterface { - /** @var \Ibexa\Contracts\Core\Repository\BookmarkService */ - private $bookmarkService; + private BookmarkService $bookmarkService; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ - private $datasetFactory; + private DatasetFactory $datasetFactory; /** * @param \Ibexa\Contracts\Core\Repository\BookmarkService $bookmarkService @@ -31,28 +32,18 @@ public function __construct(BookmarkService $bookmarkService, DatasetFactory $da } /** - * Returns the number of results. - * - * @return int the number of results - * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ - public function getNbResults() + public function getNbResults(): int { + /** @var int<0, max> */ return $this->bookmarkService->loadBookmarks()->totalCount; } /** - * Returns an slice of the results. - * - * @param int $offset the offset - * @param int $length the length - * - * @return array|\Traversable the slice - * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ - public function getSlice($offset, $length) + public function getSlice(int $offset, int $length): iterable { return $this->datasetFactory ->bookmarks() diff --git a/src/lib/Pagination/Pagerfanta/ContentDraftAdapter.php b/src/lib/Pagination/Pagerfanta/ContentDraftAdapter.php index c629c19a90..3bbf90b75b 100644 --- a/src/lib/Pagination/Pagerfanta/ContentDraftAdapter.php +++ b/src/lib/Pagination/Pagerfanta/ContentDraftAdapter.php @@ -12,13 +12,14 @@ use Ibexa\Contracts\Core\Repository\ContentService; use Pagerfanta\Adapter\AdapterInterface; +/** + * @implements \Pagerfanta\Adapter\AdapterInterface<\Ibexa\AdminUi\UI\Value\Content\ContentDraftInterface> + */ final class ContentDraftAdapter implements AdapterInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ - private $datasetFactory; + private DatasetFactory $datasetFactory; /** * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService @@ -31,28 +32,15 @@ public function __construct(ContentService $contentService, DatasetFactory $data } /** - * Returns the number of results. - * - * @return int the number of results - * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ - public function getNbResults() + public function getNbResults(): int { + /** @var int<0, max> */ return $this->contentService->countContentDrafts(); } - /** - * Returns an slice of the results. - * - * @param int $offset the offset - * @param int $length the length - * - * @return array|\Traversable the slice - * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - */ - public function getSlice($offset, $length) + public function getSlice(int $offset, int $length): iterable { return $this->datasetFactory ->contentDraftList() diff --git a/src/lib/Pagination/Pagerfanta/NotificationAdapter.php b/src/lib/Pagination/Pagerfanta/NotificationAdapter.php index 31ee81710f..8264904c2d 100644 --- a/src/lib/Pagination/Pagerfanta/NotificationAdapter.php +++ b/src/lib/Pagination/Pagerfanta/NotificationAdapter.php @@ -12,16 +12,14 @@ use Pagerfanta\Adapter\AdapterInterface; /** - * Pagerfanta adapter for Ibexa content search. - * Will return results as notification list. + * @implements \Pagerfanta\Adapter\AdapterInterface<\Ibexa\Contracts\Core\Repository\Values\Notification\Notification> */ class NotificationAdapter implements AdapterInterface { - /** @var \Ibexa\Contracts\Core\Repository\NotificationService */ - private $notificationService; + private NotificationService $notificationService; - /** @var int */ - private $nbResults; + /** @phpstan-var int<0, max> */ + private int $nbResults; /** * @param \Ibexa\Contracts\Core\Repository\NotificationService $notificationService @@ -32,33 +30,16 @@ public function __construct( $this->notificationService = $notificationService; } - /** - * Returns the number of results. - * - * @return int the number of results - */ public function getNbResults(): int { - if ($this->nbResults !== null) { - return $this->nbResults; - } - - return $this->nbResults = $this->notificationService->getNotificationCount(); + return $this->nbResults ?? ($this->nbResults = $this->notificationService->getNotificationCount()); } - /** - * Returns a slice of the results. - * - * @param int $offset the offset - * @param int $length the length - * - * @return \Ibexa\Contracts\Core\Repository\Values\Notification\NotificationList - */ - public function getSlice($offset, $length): NotificationList + public function getSlice(int $offset, int $length): NotificationList { $notifications = $this->notificationService->loadNotifications($offset, $length); - if (null === $this->nbResults) { + if (!isset($this->nbResults)) { $this->nbResults = $notifications->totalCount; } diff --git a/src/lib/Pagination/Pagerfanta/RelationAdapter.php b/src/lib/Pagination/Pagerfanta/RelationAdapter.php index 81ba2a1a3b..55d543fc8f 100644 --- a/src/lib/Pagination/Pagerfanta/RelationAdapter.php +++ b/src/lib/Pagination/Pagerfanta/RelationAdapter.php @@ -13,6 +13,9 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Pagerfanta\Adapter\AdapterInterface; +/** + * @implements \Pagerfanta\Adapter\AdapterInterface<\Ibexa\AdminUi\UI\Value\Content\RelationInterface> + */ final class RelationAdapter implements AdapterInterface { private ContentService $contentService; @@ -31,8 +34,13 @@ public function __construct( $this->content = $content; } + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + */ public function getNbResults(): int { + /** @phpstan-var int<0, max> */ return $this->contentService->countRelations($this->content->getVersionInfo()); } @@ -41,7 +49,7 @@ public function getNbResults(): int * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function getSlice($offset, $length): array + public function getSlice(int $offset, int $length): array { return $this->datasetFactory ->relationList() diff --git a/src/lib/Pagination/Pagerfanta/ReverseRelationAdapter.php b/src/lib/Pagination/Pagerfanta/ReverseRelationAdapter.php index c0745886f2..8001793ab2 100644 --- a/src/lib/Pagination/Pagerfanta/ReverseRelationAdapter.php +++ b/src/lib/Pagination/Pagerfanta/ReverseRelationAdapter.php @@ -13,16 +13,16 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Pagerfanta\Adapter\AdapterInterface; +/** + * @implements \Pagerfanta\Adapter\AdapterInterface<\Ibexa\AdminUi\UI\Value\Content\RelationInterface> + */ final class ReverseRelationAdapter implements AdapterInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\AdminUi\UI\Dataset\DatasetFactory */ - private $datasetFactory; + private DatasetFactory $datasetFactory; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - private $content; + private Content $content; /** * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService @@ -39,25 +39,13 @@ public function __construct( $this->content = $content; } - /** - * Returns the number of results. - * - * @return int the number of results - */ - public function getNbResults() + public function getNbResults(): int { + /** @phpstan-var int<0, max> */ return $this->contentService->countReverseRelations($this->content->contentInfo); } - /** - * Returns an slice of the results. - * - * @param int $offset the offset - * @param int $length the length - * - * @return array|\Traversable the slice - */ - public function getSlice($offset, $length) + public function getSlice(int $offset, int $length): iterable { return $this->datasetFactory ->reverseRelationList() diff --git a/src/lib/Pagination/Pagerfanta/RoleAssignmentsSearchAdapter.php b/src/lib/Pagination/Pagerfanta/RoleAssignmentsSearchAdapter.php index 52ba335cc7..9b2e6ef051 100644 --- a/src/lib/Pagination/Pagerfanta/RoleAssignmentsSearchAdapter.php +++ b/src/lib/Pagination/Pagerfanta/RoleAssignmentsSearchAdapter.php @@ -12,16 +12,16 @@ use Ibexa\Contracts\Core\Repository\Values\User\Role; use Pagerfanta\Adapter\AdapterInterface; +/** + * @implements \Pagerfanta\Adapter\AdapterInterface<\Ibexa\Contracts\Core\Repository\Values\User\RoleAssignment> + */ final class RoleAssignmentsSearchAdapter implements AdapterInterface { - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ - private $roleService; + private RoleService $roleService; - /** @var \Ibexa\Contracts\Core\Repository\Values\User\Role */ - private $role; + private Role $role; - /** @var int|null */ - private $assignmentsCount; + private ?int $assignmentsCount; public function __construct(RoleService $roleService, Role $role, ?int $assignmentsCount = null) { @@ -37,6 +37,7 @@ public function __construct(RoleService $roleService, Role $role, ?int $assignme */ public function getNbResults(): int { + /** @phpstan-var int<0, max> */ return $this->assignmentsCount ?: $this->roleService->countRoleAssignments($this->role); } diff --git a/src/lib/Pagination/Pagerfanta/TrashItemAdapter.php b/src/lib/Pagination/Pagerfanta/TrashItemAdapter.php index 07bfe18562..635f83bbac 100644 --- a/src/lib/Pagination/Pagerfanta/TrashItemAdapter.php +++ b/src/lib/Pagination/Pagerfanta/TrashItemAdapter.php @@ -12,25 +12,16 @@ use Pagerfanta\Adapter\AdapterInterface; /** - * Pagerfanta adapter for Ibexa content search. - * Will return results as SearchHit objects. + * @implements \Pagerfanta\Adapter\AdapterInterface<\Ibexa\Contracts\Core\Repository\Values\Content\TrashItem> */ class TrashItemAdapter implements AdapterInterface { - /** - * @var \Ibexa\Contracts\Core\Repository\Values\Content\Query - */ - private $query; + private Query $query; - /** - * @var \Ibexa\Contracts\Core\Repository\TrashService - */ - private $trashService; + private TrashService $trashService; - /** - * @var int - */ - private $nbResults; + /** @phpstan-var int<0, max> */ + private int $nbResults; public function __construct(Query $query, TrashService $trashService) { @@ -38,12 +29,7 @@ public function __construct(Query $query, TrashService $trashService) $this->trashService = $trashService; } - /** - * Returns the number of results. - * - * @return int the number of results - */ - public function getNbResults() + public function getNbResults(): int { if (isset($this->nbResults)) { return $this->nbResults; @@ -52,18 +38,13 @@ public function getNbResults() $countQuery = clone $this->query; $countQuery->limit = 0; - return $this->nbResults = $this->trashService->findTrashItems($countQuery)->count; + return $this->nbResults = $this->trashService->findTrashItems($countQuery)->totalCount; } /** - * Returns a slice of the results. - * - * @param int $offset the offset - * @param int $length the length - * * @return \Ibexa\Contracts\Core\Repository\Values\ValueObject[] */ - public function getSlice($offset, $length): array + public function getSlice(int $offset, int $length): array { $query = clone $this->query; $query->offset = $offset; @@ -72,8 +53,8 @@ public function getSlice($offset, $length): array $trashItems = $this->trashService->findTrashItems($query); - if (null === $this->nbResults && null !== $trashItems->count) { - $this->nbResults = $trashItems->count; + if (!isset($this->nbResults)) { + $this->nbResults = $trashItems->totalCount; } return $trashItems->items; diff --git a/src/lib/Pagination/Pagerfanta/URLSearchAdapter.php b/src/lib/Pagination/Pagerfanta/URLSearchAdapter.php index 3fb40d749a..7070f1c329 100644 --- a/src/lib/Pagination/Pagerfanta/URLSearchAdapter.php +++ b/src/lib/Pagination/Pagerfanta/URLSearchAdapter.php @@ -11,17 +11,14 @@ use Ibexa\Contracts\Core\Repository\Values\URL\URLQuery; use Pagerfanta\Adapter\AdapterInterface; +/** + * @implements \Pagerfanta\Adapter\AdapterInterface<\Ibexa\Contracts\Core\Repository\Values\URL\URL> + */ class URLSearchAdapter implements AdapterInterface { - /** - * @var \Ibexa\Contracts\Core\Repository\Values\URL\URLQuery - */ - private $query; + private URLQuery $query; - /** - * @var \Ibexa\Contracts\Core\Repository\URLService - */ - private $urlService; + private URLService $urlService; /** * UrlSearchAdapter constructor. @@ -36,7 +33,7 @@ public function __construct(URLQuery $query, URLService $urlService) } /** - * {@inheritdoc} + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ public function getNbResults(): int { @@ -44,15 +41,16 @@ public function getNbResults(): int $query->offset = 0; $query->limit = 0; + /** @phpstan-var int<0, max> */ return $this->urlService->findUrls($query)->totalCount; } /** - * {@inheritdoc} - * * @return \Ibexa\Contracts\Core\Repository\Values\URL\URL[] + * + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function getSlice($offset, $length): array + public function getSlice(int $offset, int $length): array { $query = clone $this->query; $query->offset = $offset; diff --git a/src/lib/Pagination/Pagerfanta/URLUsagesAdapter.php b/src/lib/Pagination/Pagerfanta/URLUsagesAdapter.php index 687b4ff9d4..60a3e4bcf7 100644 --- a/src/lib/Pagination/Pagerfanta/URLUsagesAdapter.php +++ b/src/lib/Pagination/Pagerfanta/URLUsagesAdapter.php @@ -11,39 +11,34 @@ use Ibexa\Contracts\Core\Repository\Values\URL\URL; use Pagerfanta\Adapter\AdapterInterface; +/** + * @implements \Pagerfanta\Adapter\AdapterInterface<\Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo> + */ class URLUsagesAdapter implements AdapterInterface { /** * @var \Ibexa\Contracts\Core\Repository\URLService */ - private $urlService; + private URLService $urlService; /** * @var \Ibexa\Contracts\Core\Repository\Values\URL\URL */ - private $url; + private URL $url; - /** - * @param \Ibexa\Contracts\Core\Repository\Values\URL\URL $url - * @param \Ibexa\Contracts\Core\Repository\URLService $urlService - */ public function __construct(URL $url, URLService $urlService) { $this->urlService = $urlService; $this->url = $url; } - /** - * {@inheritdoc} - */ public function getNbResults(): int { + /** @phpstan-var int<0, max> */ return $this->urlService->findUsages($this->url, 0, 0)->totalCount; } /** - * {@inheritdoc} - * * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo[] */ public function getSlice($offset, $length): array diff --git a/src/lib/Pagination/Pagerfanta/URLWildcardAdapter.php b/src/lib/Pagination/Pagerfanta/URLWildcardAdapter.php index d0830b3a83..31c63b457f 100644 --- a/src/lib/Pagination/Pagerfanta/URLWildcardAdapter.php +++ b/src/lib/Pagination/Pagerfanta/URLWildcardAdapter.php @@ -11,16 +11,14 @@ use Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard\URLWildcardQuery; use Pagerfanta\Adapter\AdapterInterface; +/** + * @implements \Pagerfanta\Adapter\AdapterInterface<\Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard> + */ final class URLWildcardAdapter implements AdapterInterface { - /** @var \Ibexa\Contracts\Core\Repository\URLWildcardService */ - private $urlWildcardService; - - /** @var int */ - private $nbResults; + private URLWildcardService $urlWildcardService; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard\URLWildcardQuery */ - private $query; + private URLWildcardQuery $query; public function __construct(URLWildcardQuery $query, URLWildcardService $urlWildcardService) { @@ -29,9 +27,8 @@ public function __construct(URLWildcardQuery $query, URLWildcardService $urlWild } /** - * {@inheritdoc} - * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException */ public function getNbResults(): int { @@ -39,17 +36,17 @@ public function getNbResults(): int $query->offset = 0; $query->limit = 0; + /** @phpstan-var int<0, max> */ return $this->urlWildcardService->findUrlWildcards($query)->totalCount; } /** - * {@inheritdoc} - * * @return \Ibexa\Contracts\Core\Repository\Values\Content\URLWildcard[] * + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function getSlice($offset, $length): array + public function getSlice(int $offset, int $length): array { $query = clone $this->query; $query->offset = $offset; diff --git a/src/lib/Tab/LocationView/UrlsTab.php b/src/lib/Tab/LocationView/UrlsTab.php index 862a37be53..fb91f9d382 100644 --- a/src/lib/Tab/LocationView/UrlsTab.php +++ b/src/lib/Tab/LocationView/UrlsTab.php @@ -141,7 +141,9 @@ public function getTemplateParameters(array $contextParameters = []): array )); $systemUrlPagerfanta = new Pagerfanta( - new ArrayAdapter($this->urlAliasService->listLocationAliases($location, false, null, true)) + new ArrayAdapter( + iterator_to_array($this->urlAliasService->listLocationAliases($location, false, null, true)) + ) ); $systemUrlPagerfanta->setMaxPerPage($systemUrlsPaginationParams['limit']); @@ -153,7 +155,7 @@ public function getTemplateParameters(array $contextParameters = []): array $customUrlAddForm = $this->createCustomUrlAddForm($location); $customUrlRemoveForm = $this->createCustomUrlRemoveForm( $location, - $customUrlPagerfanta->getCurrentPageResults() + iterator_to_array($customUrlPagerfanta->getCurrentPageResults()) ); $canEditCustomUrl = $this->permissionResolver->hasAccess('content', 'urltranslator'); diff --git a/src/lib/Tab/LocationView/VersionsTab.php b/src/lib/Tab/LocationView/VersionsTab.php index 83e5d57e2c..337d6eb46b 100644 --- a/src/lib/Tab/LocationView/VersionsTab.php +++ b/src/lib/Tab/LocationView/VersionsTab.php @@ -163,7 +163,7 @@ public function getTemplateParameters(array $contextParameters = []): array $draftPagerfanta->setCurrentPage(min($draftPaginationParams['page'], $draftPagerfanta->getNbPages())); /** @var \Ibexa\AdminUi\UI\Value\Content\VersionInfo[] $policies */ - $draftVersions = $draftPagerfanta->getCurrentPageResults(); + $draftVersions = iterator_to_array($draftPagerfanta->getCurrentPageResults()); $archivedVersions = $versionsDataset->getArchivedVersions(); diff --git a/src/lib/Translation/Extractor/NotificationTranslationExtractor.php b/src/lib/Translation/Extractor/NotificationTranslationExtractor.php index 5e6a8860f6..693914d510 100644 --- a/src/lib/Translation/Extractor/NotificationTranslationExtractor.php +++ b/src/lib/Translation/Extractor/NotificationTranslationExtractor.php @@ -89,7 +89,7 @@ public function enterNode(Node $node) || !in_array(strtolower($methodCallNodeName), array_map('strtolower', array_keys($this->methodsToExtractFrom)))) { $this->previousNode = $node; - return; + return null; } $ignore = false; @@ -110,12 +110,12 @@ public function enterNode(Node $node) } } } else { - return; + return null; } if (!$node->args[0]->value instanceof String_) { if ($ignore) { - return; + return null; } $message = sprintf('Can only extract the translation id from a scalar string, not from "%s". Refactor your code to make it extractable, or add the doc comment /** @Ignore */ to this code element (in %s on line %d).', get_class($node->args[0]->value), $this->file, $node->args[0]->value->getLine()); @@ -129,7 +129,7 @@ public function enterNode(Node $node) if (isset($node->args[$index])) { if (!$node->args[$index]->value instanceof String_) { if ($ignore) { - return; + return null; } $message = sprintf('Can only extract the translation domain from a scalar string, not from "%s". Refactor your code to make it extractable, or add the doc comment /** @Ignore */ to this code element (in %s on line %d).', get_class($node->args[$index]->value), $this->file, $node->args[$index]->value->getLine()); @@ -147,6 +147,8 @@ public function enterNode(Node $node) $message->setMeaning($meaning); $message->addSource($this->fileSourceFactory->create($this->file, $node->getLine())); $this->catalogue->add($message); + + return null; } public function visitPhpFile(\SplFileInfo $file, MessageCatalogue $catalogue, array $ast) diff --git a/src/lib/UI/Module/ContentTree/NodeFactory.php b/src/lib/UI/Module/ContentTree/NodeFactory.php index 314cb1da64..d0df4250d8 100644 --- a/src/lib/UI/Module/ContentTree/NodeFactory.php +++ b/src/lib/UI/Module/ContentTree/NodeFactory.php @@ -145,6 +145,11 @@ private function resolveLoadLimit(?LoadSubtreeRequestNode $loadSubtreeRequestNod return $limit; } + /** + * @phpstan-return \Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult<\Ibexa\Contracts\Core\Repository\Values\Content\Location> + * + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + */ private function findSubitems( Location $parentLocation, int $limit = 10, @@ -215,7 +220,7 @@ private function countSubitems(int $parentLocationId, ?CriterionInterface $reque $searchQuery->offset = 0; $searchQuery->performCount = true; - return $this->searchService->findLocations($searchQuery)->totalCount; + return $this->searchService->findLocations($searchQuery)->totalCount ?? 0; } /** diff --git a/src/lib/Validator/Constraints/FieldDefinitionDefaultValueValidator.php b/src/lib/Validator/Constraints/FieldDefinitionDefaultValueValidator.php index 2a9ac996cc..e5d736ede6 100644 --- a/src/lib/Validator/Constraints/FieldDefinitionDefaultValueValidator.php +++ b/src/lib/Validator/Constraints/FieldDefinitionDefaultValueValidator.php @@ -18,7 +18,7 @@ */ class FieldDefinitionDefaultValueValidator extends FieldTypeValidator { - public function validate($value, Constraint $constraint) + public function validate(mixed $value, Constraint $constraint): void { if (!$value instanceof FieldDefinitionData) { return; @@ -35,7 +35,7 @@ public function validate($value, Constraint $constraint) $validationErrors = $fieldType->validateValue($fieldDefinition, $fieldValue); - $this->processValidationErrors($validationErrors); + $this->processValidationErrors(iterator_to_array($validationErrors)); } protected function getFieldValue(FieldDefinitionData $value): ?Value diff --git a/src/lib/Validator/Constraints/FieldSettingsValidator.php b/src/lib/Validator/Constraints/FieldSettingsValidator.php index 99fbc295c5..a8d0ea5e7e 100644 --- a/src/lib/Validator/Constraints/FieldSettingsValidator.php +++ b/src/lib/Validator/Constraints/FieldSettingsValidator.php @@ -16,17 +16,20 @@ */ class FieldSettingsValidator extends FieldTypeValidator { - public function validate($value, Constraint $constraint) + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + */ + public function validate(mixed $value, Constraint $constraint): void { if (!$value instanceof FieldDefinitionData) { return; } $fieldType = $this->fieldTypeService->getFieldType($value->getFieldTypeIdentifier()); - $this->processValidationErrors($fieldType->validateFieldSettings($value->fieldSettings)); + $this->processValidationErrors(iterator_to_array($fieldType->validateFieldSettings($value->fieldSettings))); } - protected function generatePropertyPath($errorIndex, $errorTarget) + protected function generatePropertyPath($errorIndex, $errorTarget): string { return 'fieldSettings' . $errorTarget; } diff --git a/src/lib/Validator/Constraints/LocationIsNotSubLocationValidator.php b/src/lib/Validator/Constraints/LocationIsNotSubLocationValidator.php index 1d580b1b32..884c81edc1 100644 --- a/src/lib/Validator/Constraints/LocationIsNotSubLocationValidator.php +++ b/src/lib/Validator/Constraints/LocationIsNotSubLocationValidator.php @@ -20,7 +20,7 @@ class LocationIsNotSubLocationValidator extends AbstractComparisonValidator * * @return bool true if the relationship is valid, false otherwise */ - protected function compareValues($targetLocation, $sourceLocation) + protected function compareValues(mixed $targetLocation, mixed $sourceLocation): bool { return stripos($targetLocation->pathString, $sourceLocation->pathString) === false; } diff --git a/src/lib/Validator/Constraints/UniqueURLValidator.php b/src/lib/Validator/Constraints/UniqueURLValidator.php index 911f8cc5b0..84dfc501e1 100644 --- a/src/lib/Validator/Constraints/UniqueURLValidator.php +++ b/src/lib/Validator/Constraints/UniqueURLValidator.php @@ -28,10 +28,7 @@ public function __construct(URLService $urlService) $this->urlService = $urlService; } - /** - * {@inheritdoc} - */ - public function validate($value, Constraint $constraint) + public function validate(mixed $value, Constraint $constraint): void { if (!$value instanceof URLUpdateData || $value->url === null) { return; @@ -40,7 +37,7 @@ public function validate($value, Constraint $constraint) try { $url = $this->urlService->loadByUrl($value->url); - if ($url->id === $value->id) { + if ($url->getId() === $value->id) { return; } diff --git a/tests/bundle/ParamConverter/AbstractParamConverterTest.php b/tests/bundle/ParamConverter/AbstractParamConverterTest.php deleted file mode 100644 index ad41daa19f..0000000000 --- a/tests/bundle/ParamConverter/AbstractParamConverterTest.php +++ /dev/null @@ -1,23 +0,0 @@ -createConfiguration(static::SUPPORTED_CLASS); - - self::assertTrue($this->converter->supports($config)); - } -} diff --git a/tests/bundle/ParamConverter/ContentParamConverterTest.php b/tests/bundle/ParamConverter/ContentParamConverterTest.php deleted file mode 100644 index e76a07a383..0000000000 --- a/tests/bundle/ParamConverter/ContentParamConverterTest.php +++ /dev/null @@ -1,96 +0,0 @@ -contentServiceMock = $this->createMock(ContentService::class); - - $this->converter = new ContentParamConverter($this->contentServiceMock); - } - - public function testApply() - { - $contentId = 42; - $languageCode = ['language_code']; - $versionNo = 53; - $valueObject = $this->createMock(Content::class); - - $this->contentServiceMock - ->expects(self::once()) - ->method('loadContent') - ->with($contentId, $languageCode, $versionNo) - ->willReturn($valueObject); - - $requestAttributes = [ - ContentParamConverter::PARAMETER_CONTENT_ID => $contentId, - ContentParamConverter::PARAMETER_LANGUAGE_CODE => $languageCode, - ContentParamConverter::PARAMETER_VERSION_NO => $versionNo, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertTrue($this->converter->apply($request, $config)); - self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); - } - - /** - * @dataProvider attributeProvider - * - * @param $contentId - * @param $languageCode - */ - public function testApplyWithWrongAttribute($contentId, $languageCode) - { - $versionNo = 53; - - $requestAttributes = [ - ContentParamConverter::PARAMETER_CONTENT_ID => $contentId, - ContentParamConverter::PARAMETER_LANGUAGE_CODE => $languageCode, - ContentParamConverter::PARAMETER_VERSION_NO => $versionNo, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertFalse($this->converter->apply($request, $config)); - self::assertNull($request->attributes->get(self::PARAMETER_NAME)); - } - - /** - * @return array - */ - public function attributeProvider(): array - { - return [ - 'empty_content_id' => [null, ['language_code']], - 'language_code_as_string' => [42, 'string'], - ]; - } -} diff --git a/tests/bundle/ParamConverter/ContentTypeDraftParamConverterTest.php b/tests/bundle/ParamConverter/ContentTypeDraftParamConverterTest.php deleted file mode 100644 index 4f1b389ccd..0000000000 --- a/tests/bundle/ParamConverter/ContentTypeDraftParamConverterTest.php +++ /dev/null @@ -1,81 +0,0 @@ -contentTypeServiceMock = $this->createMock(ContentTypeService::class); - - $this->converter = new ContentTypeDraftParamConverter($this->contentTypeServiceMock); - } - - /** - * @dataProvider dataProvider - * - * @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) - { - $valueObject = $this->createMock(ContentTypeDraft::class); - - $this->contentTypeServiceMock - ->expects(self::once()) - ->method('loadContentTypeDraft') - ->with($contentTypeIdToLoad) - ->willReturn($valueObject); - - $requestAttributes = [ - ContentTypeDraftParamConverter::PARAMETER_CONTENT_TYPE_ID => $contentTypeId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertTrue($this->converter->apply($request, $config)); - self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); - } - - public function testApplyWithWrongAttribute() - { - $requestAttributes = [ - ContentTypeDraftParamConverter::PARAMETER_CONTENT_TYPE_ID => null, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertFalse($this->converter->apply($request, $config)); - self::assertNull($request->attributes->get(self::PARAMETER_NAME)); - } - - public function dataProvider(): array - { - return [ - 'integer' => [42, 42], - 'number_as_string' => ['42', 42], - 'string' => ['42k', 42], - ]; - } -} diff --git a/tests/bundle/ParamConverter/ContentTypeGroupParamConverterTest.php b/tests/bundle/ParamConverter/ContentTypeGroupParamConverterTest.php deleted file mode 100644 index a6c4e21c0e..0000000000 --- a/tests/bundle/ParamConverter/ContentTypeGroupParamConverterTest.php +++ /dev/null @@ -1,110 +0,0 @@ -serviceMock = $this->createMock(ContentTypeService::class); - - $this->converter = new ContentTypeGroupParamConverter($this->serviceMock); - } - - /** - * @dataProvider dataProvider - * - * @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) - { - $valueObject = $this->createMock(ContentTypeGroup::class); - - $this->serviceMock - ->expects(self::once()) - ->method('loadContentTypeGroup') - ->with($contentTypeGroupIdToLoad) - ->willReturn($valueObject); - - $requestAttributes = [ - ContentTypeGroupParamConverter::PARAMETER_CONTENT_TYPE_GROUP_ID => $contentTypeGroupId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertTrue($this->converter->apply($request, $config)); - self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); - } - - public function testApplyWithWrongAttribute() - { - $requestAttributes = [ - ContentTypeGroupParamConverter::PARAMETER_CONTENT_TYPE_GROUP_ID => null, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertFalse($this->converter->apply($request, $config)); - self::assertNull($request->attributes->get(self::PARAMETER_NAME)); - } - - public function testApplyWhenNotFound() - { - $contentTypeGroupId = 42; - - $this->expectException(NotFoundHttpException::class); - $this->expectExceptionMessage( - sprintf('Content type group %s not found.', $contentTypeGroupId) - ); - - $this->serviceMock - ->expects(self::once()) - ->method('loadContentTypeGroup') - ->with($contentTypeGroupId) - ->willThrowException( - $this->createMock(NotFoundException::class) - ); - - $requestAttributes = [ - ContentTypeGroupParamConverter::PARAMETER_CONTENT_TYPE_GROUP_ID => $contentTypeGroupId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - $this->converter->apply($request, $config); - } - - public function dataProvider(): array - { - return [ - 'integer' => [42, 42], - 'number_as_string' => ['42', 42], - 'string' => ['42k', 42], - ]; - } -} diff --git a/tests/bundle/ParamConverter/ContentTypeParamConverterTest.php b/tests/bundle/ParamConverter/ContentTypeParamConverterTest.php deleted file mode 100644 index 1aff74f548..0000000000 --- a/tests/bundle/ParamConverter/ContentTypeParamConverterTest.php +++ /dev/null @@ -1,167 +0,0 @@ -serviceMock = $this->createMock(ContentTypeService::class); - - $userLanguagePreferenceProvider = $this->createMock(UserLanguagePreferenceProviderInterface::class); - $this->converter = new ContentTypeParamConverter($this->serviceMock, $userLanguagePreferenceProvider); - } - - /** - * @dataProvider dataProvider - * - * @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) - { - $valueObject = $this->createMock(ContentType::class); - - $this->serviceMock - ->expects(self::once()) - ->method('loadContentType') - ->with($contentTypeIdLoad) - ->willReturn($valueObject); - - $requestAttributes = [ - ContentTypeParamConverter::PARAMETER_CONTENT_TYPE_ID => $contentTypeId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertTrue($this->converter->apply($request, $config)); - self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); - } - - public function testApplyIdWithWrongValue() - { - $requestAttributes = [ - ContentTypeParamConverter::PARAMETER_CONTENT_TYPE_ID => null, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertFalse($this->converter->apply($request, $config)); - self::assertNull($request->attributes->get(self::PARAMETER_NAME)); - } - - public function testApplyIdWhenNotFound() - { - $contentTypeId = 42; - - $this->expectException(NotFoundHttpException::class); - $this->expectExceptionMessage(sprintf('Content type %s not found.', $contentTypeId)); - - $this->serviceMock - ->expects(self::once()) - ->method('loadContentType') - ->with($contentTypeId) - ->willThrowException($this->createMock(NotFoundException::class)); - - $requestAttributes = [ - ContentTypeParamConverter::PARAMETER_CONTENT_TYPE_ID => $contentTypeId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - $this->converter->apply($request, $config); - } - - public function testApplyIdentifier() - { - $contentTypeIdentifier = 'test_identifier'; - $valueObject = $this->createMock(ContentType::class); - - $this->serviceMock - ->expects(self::once()) - ->method('loadContentTypeByIdentifier') - ->with($contentTypeIdentifier) - ->willReturn($valueObject); - - $requestAttributes = [ - ContentTypeParamConverter::PARAMETER_CONTENT_TYPE_IDENTIFIER => $contentTypeIdentifier, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - $this->converter->apply($request, $config); - - self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); - } - - public function testApplyIdentifierWithWrongValue() - { - $requestAttributes = [ - ContentTypeParamConverter::PARAMETER_CONTENT_TYPE_IDENTIFIER => null, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertFalse($this->converter->apply($request, $config)); - self::assertNull($request->attributes->get(self::PARAMETER_NAME)); - } - - public function testApplyIdentifierWhenNotFound() - { - $contentTypeIdentifier = 'test_identifier'; - - $this->expectException(NotFoundHttpException::class); - $this->expectExceptionMessage(sprintf('Content type %s not found.', $contentTypeIdentifier)); - - $this->serviceMock - ->expects(self::once()) - ->method('loadContentTypeByIdentifier') - ->with($contentTypeIdentifier) - ->willThrowException($this->createMock(NotFoundException::class)); - - $requestAttributes = [ - ContentTypeParamConverter::PARAMETER_CONTENT_TYPE_IDENTIFIER => $contentTypeIdentifier, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - $this->converter->apply($request, $config); - } - - public function dataProvider(): array - { - return [ - 'integer' => [42, 42], - 'number_as_string' => ['42', 42], - 'string' => ['42k', 42], - ]; - } -} diff --git a/tests/bundle/ParamConverter/LanguageParamConverterTest.php b/tests/bundle/ParamConverter/LanguageParamConverterTest.php deleted file mode 100644 index 8cffccc87e..0000000000 --- a/tests/bundle/ParamConverter/LanguageParamConverterTest.php +++ /dev/null @@ -1,196 +0,0 @@ -serviceMock = $this->createMock(LanguageService::class); - $this->converter = new LanguageParamConverter($this->serviceMock); - } - - /** - * @covers \Ibexa\Bundle\AdminUi\ParamConverter\LanguageParamConverter::apply - * - * @dataProvider dataProvider - * - * @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) - { - $valueObject = $this->createMock(Language::class); - - $this->serviceMock - ->expects(self::once()) - ->method('loadLanguageById') - ->with($languageIdToLoad) - ->willReturn($valueObject); - - $requestAttributes = [ - LanguageParamConverter::PARAMETER_LANGUAGE_ID => $languageId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertTrue($this->converter->apply($request, $config)); - self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); - } - - /** - * @covers \Ibexa\Bundle\AdminUi\ParamConverter\LanguageParamConverter::apply - */ - public function testApplyForLanguageCode() - { - $languageCode = 'eng-GB'; - $valueObject = $this->createMock(Language::class); - - $this->serviceMock - ->expects(self::once()) - ->method('loadLanguage') - ->with($languageCode) - ->willReturn($valueObject); - - $request = new Request([], [], [ - LanguageParamConverter::PARAMETER_LANGUAGE_CODE => $languageCode, - ]); - - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - $this->converter->apply($request, $config); - - self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); - } - - /** - * @covers \Ibexa\Bundle\AdminUi\ParamConverter\LanguageParamConverter::apply - * - * @dataProvider dataProviderForApplyWithWrongAttribute - */ - public function testApplyWithWrongAttribute(array $attributes) - { - $request = new Request([], [], $attributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertFalse($this->converter->apply($request, $config)); - self::assertNull($request->attributes->get(self::PARAMETER_NAME)); - } - - /** - * @covers \Ibexa\Bundle\AdminUi\ParamConverter\LanguageParamConverter::apply - */ - public function testApplyWithNonExistingLanguageId() - { - $languageId = 42; - - $this->expectException(NotFoundHttpException::class); - $this->expectExceptionMessage(sprintf('Language %s not found.', $languageId)); - - $this->serviceMock - ->expects(self::once()) - ->method('loadLanguageById') - ->with($languageId) - ->willThrowException($this->createMock(NotFoundException::class)); - - $requestAttributes = [ - LanguageParamConverter::PARAMETER_LANGUAGE_ID => $languageId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - $this->converter->apply($request, $config); - } - - /** - * @covers \Ibexa\Bundle\AdminUi\ParamConverter\LanguageParamConverter::apply - */ - public function testApplyWithNonExistingLanguageCode() - { - $languageCode = 'eng-Gb'; - - $this->expectException(NotFoundHttpException::class); - $this->expectExceptionMessage(sprintf('Language %s not found.', $languageCode)); - - $this->serviceMock - ->expects(self::once()) - ->method('loadLanguage') - ->with($languageCode) - ->willThrowException($this->createMock(NotFoundException::class)); - - $requestAttributes = [ - LanguageParamConverter::PARAMETER_LANGUAGE_CODE => $languageCode, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - $this->converter->apply($request, $config); - } - - /** - * @covers \Ibexa\Bundle\AdminUi\ParamConverter\LanguageParamConverter::supports - * - * @dataProvider dataProviderForSupport - */ - public function testSupport(string $class, bool $expected) - { - self::assertEquals($expected, $this->converter->supports($this->createConfiguration($class))); - } - - public function dataProviderForSupport(): array - { - return [ - [self::SUPPORTED_CLASS, true], - [stdClass::class, false], - ]; - } - - public function dataProviderForApplyWithWrongAttribute(): array - { - return [ - [ - [LanguageParamConverter::PARAMETER_LANGUAGE_ID => null], - ], - [ - [LanguageParamConverter::PARAMETER_LANGUAGE_CODE => null], - ], - [ - [], - ], - ]; - } - - public function dataProvider(): array - { - return [ - 'integer' => [42, 42], - 'number_as_string' => ['42', 42], - 'string' => ['42k', 42], - ]; - } -} diff --git a/tests/bundle/ParamConverter/PolicyParamConverterTest.php b/tests/bundle/ParamConverter/PolicyParamConverterTest.php deleted file mode 100644 index 9a48eae247..0000000000 --- a/tests/bundle/ParamConverter/PolicyParamConverterTest.php +++ /dev/null @@ -1,166 +0,0 @@ -serviceMock = $this->createMock(RoleService::class); - - $this->converter = new PolicyParamConverter($this->serviceMock); - } - - /** - * @dataProvider dataProvider - * - * @param mixed $policyId The policy identifier fetched from the request - * @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) - { - $matchingPolicyId = 53; - $valueObject = $this->createMock(Role::class); - $valueObject->expects(self::once()) - ->method('getPolicies') - ->willReturn([new UserPolicy(['id' => $matchingPolicyId]), new UserPolicy(['id' => 444])]); - - $this->serviceMock - ->expects(self::once()) - ->method('loadRole') - ->with($roleIdToLoad) - ->willReturn($valueObject); - - $requestAttributes = [ - PolicyParamConverter::PARAMETER_ROLE_ID => $roleId, - PolicyParamConverter::PARAMETER_POLICY_ID => $policyId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertTrue($this->converter->apply($request, $config)); - $policy = $request->attributes->get(self::PARAMETER_NAME); - self::assertInstanceOf(self::SUPPORTED_CLASS, $policy); - self::assertSame($matchingPolicyId, $policy->id); - } - - /** - * @dataProvider attributeProvider - * - * @param $roleId - * @param $policyId - */ - public function testApplyWithWrongAttribute($roleId, $policyId) - { - $requestAttributes = [ - PolicyParamConverter::PARAMETER_ROLE_ID => $roleId, - PolicyParamConverter::PARAMETER_POLICY_ID => $policyId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertFalse($this->converter->apply($request, $config)); - self::assertNull($request->attributes->get(self::PARAMETER_NAME)); - } - - public function testApplyWhenRoleNotFound() - { - $roleId = 42; - $policyId = 53; - - $this->expectException(NotFoundHttpException::class); - $this->expectExceptionMessage(sprintf('Role %s not found.', $roleId)); - - $this->serviceMock - ->expects(self::once()) - ->method('loadRole') - ->with($roleId) - ->willThrowException($this->createMock(NotFoundException::class)); - - $requestAttributes = [ - PolicyParamConverter::PARAMETER_ROLE_ID => $roleId, - PolicyParamConverter::PARAMETER_POLICY_ID => $policyId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - $this->converter->apply($request, $config); - } - - public function testApplyWhenPolicyNotFound() - { - $roleId = 42; - $policyId = 53; - - $this->expectException(NotFoundHttpException::class); - $this->expectExceptionMessage(sprintf('Policy %s not found.', $policyId)); - - $valueObject = $this->createMock(Role::class); - $valueObject->expects(self::once()) - ->method('getPolicies') - ->willReturn([new UserPolicy(['id' => 123])]); - - $this->serviceMock - ->expects(self::once()) - ->method('loadRole') - ->with($roleId) - ->willReturn($valueObject); - - $requestAttributes = [ - PolicyParamConverter::PARAMETER_ROLE_ID => $roleId, - PolicyParamConverter::PARAMETER_POLICY_ID => $policyId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - $this->converter->apply($request, $config); - } - - /** - * @return array - */ - public function attributeProvider(): array - { - return [ - 'empty_role_id' => [null, 53], - 'empty_policy_id' => [42, null], - ]; - } - - public function dataProvider(): array - { - return [ - 'integer' => [53, 42, 42], - 'number_as_string' => ['53', '42', 42], - 'string' => ['53k', '42k', 42], - ]; - } -} diff --git a/tests/bundle/ParamConverter/RoleAssignmentParamConverterTest.php b/tests/bundle/ParamConverter/RoleAssignmentParamConverterTest.php deleted file mode 100644 index 89e7ad7f7e..0000000000 --- a/tests/bundle/ParamConverter/RoleAssignmentParamConverterTest.php +++ /dev/null @@ -1,106 +0,0 @@ -serviceMock = $this->createMock(RoleService::class); - - $this->converter = new RoleAssignmentParamConverter($this->serviceMock); - } - - /** - * @dataProvider dataProvider - * - * @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) - { - $valueObject = $this->createMock(RoleAssignment::class); - - $this->serviceMock - ->expects(self::once()) - ->method('loadRoleAssignment') - ->with($roleAssignmentIdToLoad) - ->willReturn($valueObject); - - $requestAttributes = [ - RoleAssignmentParamConverter::PRAMETER_ROLE_ASSIGNMENT_ID => $roleAssignmentId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertTrue($this->converter->apply($request, $config)); - self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); - } - - public function testApplyWithWrongAttribute() - { - $requestAttributes = [ - RoleAssignmentParamConverter::PRAMETER_ROLE_ASSIGNMENT_ID => null, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertFalse($this->converter->apply($request, $config)); - self::assertNull($request->attributes->get(self::PARAMETER_NAME)); - } - - public function testApplyWhenNotFound() - { - $roleAssignmentId = 42; - - $this->expectException(NotFoundHttpException::class); - $this->expectExceptionMessage(sprintf('Role assignment %s not found.', $roleAssignmentId)); - - $this->serviceMock - ->expects(self::once()) - ->method('loadRoleAssignment') - ->with($roleAssignmentId) - ->willThrowException($this->createMock(NotFoundException::class)); - - $requestAttributes = [ - RoleAssignmentParamConverter::PRAMETER_ROLE_ASSIGNMENT_ID => $roleAssignmentId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - $this->converter->apply($request, $config); - } - - public function dataProvider(): array - { - return [ - 'integer' => [42, 42], - 'number_as_string' => ['42', 42], - 'string' => ['42k', 42], - ]; - } -} diff --git a/tests/bundle/ParamConverter/RoleParamConverterTest.php b/tests/bundle/ParamConverter/RoleParamConverterTest.php deleted file mode 100644 index 9bd2258681..0000000000 --- a/tests/bundle/ParamConverter/RoleParamConverterTest.php +++ /dev/null @@ -1,106 +0,0 @@ -serviceMock = $this->createMock(RoleService::class); - - $this->converter = new RoleParamConverter($this->serviceMock); - } - - /** - * @dataProvider dataProvider - * - * @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) - { - $valueObject = $this->createMock(Role::class); - - $this->serviceMock - ->expects(self::once()) - ->method('loadRole') - ->with($roleIdToLoad) - ->willReturn($valueObject); - - $requestAttributes = [ - RoleParamConverter::PARAMETER_ROLE_ID => $roleId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertTrue($this->converter->apply($request, $config)); - self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); - } - - public function testApplyWithWrongAttribute() - { - $requestAttributes = [ - RoleParamConverter::PARAMETER_ROLE_ID => null, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertFalse($this->converter->apply($request, $config)); - self::assertNull($request->attributes->get(self::PARAMETER_NAME)); - } - - public function testApplyWhenNotFound() - { - $roleId = 42; - - $this->expectException(NotFoundHttpException::class); - $this->expectExceptionMessage(sprintf('Role %s not found.', $roleId)); - - $this->serviceMock - ->expects(self::once()) - ->method('loadRole') - ->with($roleId) - ->willThrowException($this->createMock(NotFoundException::class)); - - $requestAttributes = [ - RoleParamConverter::PARAMETER_ROLE_ID => $roleId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - $this->converter->apply($request, $config); - } - - public function dataProvider(): array - { - return [ - 'integer' => [42, 42], - 'number_as_string' => ['42', 42], - 'string' => ['42k', 42], - ]; - } -} diff --git a/tests/bundle/ParamConverter/SectionParamConverterTest.php b/tests/bundle/ParamConverter/SectionParamConverterTest.php deleted file mode 100644 index c004c396fa..0000000000 --- a/tests/bundle/ParamConverter/SectionParamConverterTest.php +++ /dev/null @@ -1,106 +0,0 @@ -serviceMock = $this->createMock(SectionService::class); - - $this->converter = new SectionParamConverter($this->serviceMock); - } - - /** - * @dataProvider dataProvider - * - * @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) - { - $valueObject = $this->createMock(Section::class); - - $this->serviceMock - ->expects(self::once()) - ->method('loadSection') - ->with($sectionIdToLoad) - ->willReturn($valueObject); - - $requestAttributes = [ - SectionParamConverter::PARAMETER_SECTION_ID => $sectionId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertTrue($this->converter->apply($request, $config)); - self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); - } - - public function testApplyWithWrongAttribute() - { - $requestAttributes = [ - SectionParamConverter::PARAMETER_SECTION_ID => null, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertFalse($this->converter->apply($request, $config)); - self::assertNull($request->attributes->get(self::PARAMETER_NAME)); - } - - public function testApplyWhenNotFound() - { - $sectionId = 42; - - $this->expectException(NotFoundHttpException::class); - $this->expectExceptionMessage(sprintf('Section %s not found.', $sectionId)); - - $this->serviceMock - ->expects(self::once()) - ->method('loadSection') - ->with($sectionId) - ->willThrowException($this->createMock(NotFoundException::class)); - - $requestAttributes = [ - SectionParamConverter::PARAMETER_SECTION_ID => $sectionId, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - $this->converter->apply($request, $config); - } - - public function dataProvider(): array - { - return [ - 'integer' => [42, 42], - 'number_as_string' => ['42', 42], - 'string' => ['42k', 42], - ]; - } -} diff --git a/tests/bundle/ParamConverter/VersionInfoParamConverterTest.php b/tests/bundle/ParamConverter/VersionInfoParamConverterTest.php deleted file mode 100644 index 5512d4ddf3..0000000000 --- a/tests/bundle/ParamConverter/VersionInfoParamConverterTest.php +++ /dev/null @@ -1,113 +0,0 @@ -serviceMock = $this->createMock(ContentService::class); - - $this->converter = new VersionInfoParamConverter($this->serviceMock); - } - - /** - * @dataProvider dataProvider - * - * @param mixed $versionNo - * @param int $versionNoToload - * @param mixed $contentId - * @param int $contentIdToLoad - * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - */ - public function testApply($versionNo, int $versionNoToload, $contentId, int $contentIdToLoad) - { - $valueObject = $this->createMock(ContentInfo::class); - $versionInfo = $this->createMock(VersionInfo::class); - - $this->serviceMock - ->expects(self::once()) - ->method('loadContentInfo') - ->with($contentIdToLoad) - ->willReturn($valueObject); - - $this->serviceMock - ->expects(self::once()) - ->method('loadVersionInfo') - ->with($valueObject, $versionNoToload) - ->willReturn($versionInfo); - - $requestAttributes = [ - VersionInfoParamConverter::PARAMETER_CONTENT_ID => $contentId, - VersionInfoParamConverter::PARAMETER_VERSION_NO => $versionNo, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertTrue($this->converter->apply($request, $config)); - self::assertInstanceOf(self::SUPPORTED_CLASS, $request->attributes->get(self::PARAMETER_NAME)); - } - - /** - * @dataProvider attributeProvider - * - * @param $contentId - * @param $versionNo - */ - public function testApplyWithWrongAttribute($contentId, $versionNo) - { - $requestAttributes = [ - VersionInfoParamConverter::PARAMETER_CONTENT_ID => $contentId, - VersionInfoParamConverter::PARAMETER_VERSION_NO => $versionNo, - ]; - - $request = new Request([], [], $requestAttributes); - $config = $this->createConfiguration(self::SUPPORTED_CLASS, self::PARAMETER_NAME); - - self::assertFalse($this->converter->apply($request, $config)); - self::assertNull($request->attributes->get(self::PARAMETER_NAME)); - } - - /** - * @return array - */ - public function attributeProvider(): array - { - return [ - 'empty_content_id' => [null, 53], - 'empty_version_no' => [42, null], - ]; - } - - public function dataProvider(): array - { - return [ - 'integer' => [53, 53, 42, 42], - 'number_as_string' => ['53', 53, '42', 42], - 'string' => ['53k', 53, '42k', 42], - ]; - } -} diff --git a/tests/bundle/ValueResolver/ContentInfoValueResolverTest.php b/tests/bundle/ValueResolver/ContentInfoValueResolverTest.php new file mode 100644 index 0000000000..96eb61312e --- /dev/null +++ b/tests/bundle/ValueResolver/ContentInfoValueResolverTest.php @@ -0,0 +1,94 @@ +contentServiceMock = $this->createMock(ContentService::class); + $this->resolver = new ContentInfoValueResolver($this->contentServiceMock); + } + + public function testResolve(): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(ContentInfo::class); + + $request = new Request([], [], [ + ContentInfoValueResolver::ATTRIBUTE_CONTENT_INFO_ID => '1', + ]); + + $mockContentInfo = $this->createMock(ContentInfo::class); + + $this->contentServiceMock + ->expects(self::once()) + ->method('loadContentInfo') + ->with(1) + ->willReturn($mockContentInfo); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([$mockContentInfo], $result); + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(ContentInfo::class); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @phpstan-return array, expectedMessage: string}> + */ + public function invalidAttributesProvider(): array + { + return [ + 'missing contentInfoId' => [ + 'attributes' => [], + 'expectedMessage' => 'Should return empty because contentInfoId is missing', + ], + 'invalid contentInfoId type' => [ + 'attributes' => ['contentInfoId' => 'invalid'], + 'expectedMessage' => 'Should return empty because contentInfoId is invalid', + ], + 'empty contentInfoId' => [ + 'attributes' => ['contentInfoId' => ''], + 'expectedMessage' => 'Should return empty because contentInfoId is empty', + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/ContentTypeDraftValueResolverTest.php b/tests/bundle/ValueResolver/ContentTypeDraftValueResolverTest.php new file mode 100644 index 0000000000..30b74c13cf --- /dev/null +++ b/tests/bundle/ValueResolver/ContentTypeDraftValueResolverTest.php @@ -0,0 +1,94 @@ +contentTypeServiceMock = $this->createMock(ContentTypeService::class); + $this->resolver = new ContentTypeDraftValueResolver($this->contentTypeServiceMock); + } + + public function testResolve(): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(ContentTypeDraft::class); + + $request = new Request([], [], [ + 'contentTypeId' => '1', + ]); + + $mockContentTypeDraft = $this->createMock(ContentTypeDraft::class); + + $this->contentTypeServiceMock + ->expects(self::once()) + ->method('loadContentTypeDraft') + ->with(1) + ->willReturn($mockContentTypeDraft); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([$mockContentTypeDraft], $result); + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(ContentTypeDraft::class); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @phpstan-return array, expectedMessage: string}> + */ + public function invalidAttributesProvider(): array + { + return [ + 'missing contentTypeId' => [ + 'attributes' => [], + 'expectedMessage' => 'Should return empty because contentTypeId is missing', + ], + 'invalid contentTypeId type' => [ + 'attributes' => ['contentTypeId' => 'invalid'], + 'expectedMessage' => 'Should return empty because contentTypeId is invalid', + ], + 'empty contentTypeId' => [ + 'attributes' => ['contentTypeId' => ''], + 'expectedMessage' => 'Should return empty because contentTypeId is empty', + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/ContentTypeFromIdValueResolverTest.php b/tests/bundle/ValueResolver/ContentTypeFromIdValueResolverTest.php new file mode 100644 index 0000000000..dae23d46e4 --- /dev/null +++ b/tests/bundle/ValueResolver/ContentTypeFromIdValueResolverTest.php @@ -0,0 +1,94 @@ +contentTypeServiceMock = $this->createMock(ContentTypeService::class); + $this->resolver = new ContentTypeFromIdValueResolver($this->contentTypeServiceMock); + } + + public function testResolve(): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(ContentType::class); + + $request = new Request([], [], [ + 'contentTypeId' => '123', + ]); + + $mockContentType = $this->createMock(ContentType::class); + + $this->contentTypeServiceMock + ->expects(self::once()) + ->method('loadContentType') + ->with(123) + ->willReturn($mockContentType); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([$mockContentType], $result); + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(ContentType::class); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @phpstan-return array, expectedMessage: string}> + */ + public function invalidAttributesProvider(): array + { + return [ + 'missing contentTypeId' => [ + 'attributes' => [], + 'expectedMessage' => 'Should return empty because contentTypeId is missing', + ], + 'invalid contentTypeId type' => [ + 'attributes' => ['contentTypeId' => 'invalid'], + 'expectedMessage' => 'Should return empty because contentTypeId is invalid', + ], + 'empty contentTypeId' => [ + 'attributes' => ['contentTypeId' => ''], + 'expectedMessage' => 'Should return empty because contentTypeId is empty', + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/ContentTypeFromIdentifierValueResolverTest.php b/tests/bundle/ValueResolver/ContentTypeFromIdentifierValueResolverTest.php new file mode 100644 index 0000000000..5608683813 --- /dev/null +++ b/tests/bundle/ValueResolver/ContentTypeFromIdentifierValueResolverTest.php @@ -0,0 +1,94 @@ +contentTypeServiceMock = $this->createMock(ContentTypeService::class); + $this->resolver = new ContentTypeFromIdentifierValueResolver($this->contentTypeServiceMock); + } + + public function testResolve(): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(ContentType::class); + + $request = new Request([], [], [ + 'contentTypeIdentifier' => 'article', + ]); + + $mockContentType = $this->createMock(ContentType::class); + + $this->contentTypeServiceMock + ->expects(self::once()) + ->method('loadContentTypeByIdentifier') + ->with('article') + ->willReturn($mockContentType); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([$mockContentType], $result); + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(ContentType::class); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @phpstan-return array, expectedMessage: string}> + */ + public function invalidAttributesProvider(): array + { + return [ + 'missing contentTypeIdentifier' => [ + 'attributes' => [], + 'expectedMessage' => 'Should return empty because contentTypeIdentifier is missing', + ], + 'invalid contentTypeIdentifier type' => [ + 'attributes' => ['contentTypeIdentifier' => 123], // Adjusted invalid type + 'expectedMessage' => 'Should return empty because contentTypeIdentifier is invalid', + ], + 'empty contentTypeIdentifier' => [ + 'attributes' => ['contentTypeIdentifier' => ''], // Adjusted empty value + 'expectedMessage' => 'Should return empty because contentTypeIdentifier is empty', + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/ContentTypeGroupValueResolverTest.php b/tests/bundle/ValueResolver/ContentTypeGroupValueResolverTest.php new file mode 100644 index 0000000000..2e128b79a5 --- /dev/null +++ b/tests/bundle/ValueResolver/ContentTypeGroupValueResolverTest.php @@ -0,0 +1,94 @@ +contentTypeServiceMock = $this->createMock(ContentTypeService::class); + $this->resolver = new ContentTypeGroupValueResolver($this->contentTypeServiceMock); + } + + public function testResolve(): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(ContentTypeGroup::class); + + $request = new Request([], [], [ + 'contentTypeGroupId' => '123', + ]); + + $mockContentTypeGroup = $this->createMock(ContentTypeGroup::class); + + $this->contentTypeServiceMock + ->expects(self::once()) + ->method('loadContentTypeGroup') + ->with(123) + ->willReturn($mockContentTypeGroup); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([$mockContentTypeGroup], $result); + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(ContentTypeGroup::class); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @phpstan-return array, expectedMessage: string}> + */ + public function invalidAttributesProvider(): array + { + return [ + 'missing contentTypeGroupId' => [ + 'attributes' => [], + 'expectedMessage' => 'Should return empty because contentTypeGroupId is missing', + ], + 'invalid contentTypeGroupId type' => [ + 'attributes' => ['contentTypeGroupId' => 'invalid'], + 'expectedMessage' => 'Should return empty because contentTypeGroupId is invalid', + ], + 'empty contentTypeGroupId' => [ + 'attributes' => ['contentTypeGroupId' => ''], + 'expectedMessage' => 'Should return empty because contentTypeGroupId is empty', + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/ContentValueResolverTest.php b/tests/bundle/ValueResolver/ContentValueResolverTest.php new file mode 100644 index 0000000000..fecb5bbf15 --- /dev/null +++ b/tests/bundle/ValueResolver/ContentValueResolverTest.php @@ -0,0 +1,122 @@ +contentServiceMock = $this->createMock(ContentService::class); + $this->resolver = new ContentValueResolver($this->contentServiceMock); + } + + /** + * @dataProvider validAttributesProvider + * + * @param array $attributes + */ + public function testResolve(array $attributes): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(Content::class); + + $request = new Request([], [], $attributes); + $mockContent = $this->createMock(Content::class); + + $this->contentServiceMock + ->expects(self::once()) + ->method('loadContent') + ->with(1, ['eng-GB'], $attributes['versionNo'] ?? null) + ->willReturn($mockContent); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([$mockContent], $result); + } + + /** + * @phpstan-return array}> + */ + public function validAttributesProvider(): array + { + return [ + 'full valid attributes' => [ + 'attributes' => [ + 'contentId' => '1', + 'versionNo' => '2', + 'languageCode' => ['eng-GB'], + ], + ], + 'missing versionNo' => [ + 'attributes' => [ + 'contentId' => '1', + 'languageCode' => ['eng-GB'], + ], + ], + ]; + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(Content::class); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @phpstan-return array, expectedMessage: string}> + */ + public function invalidAttributesProvider(): array + { + return [ + 'missing contentId' => [ + 'attributes' => [], + 'expectedMessage' => 'Should return empty because contentId is missing', + ], + 'invalid contentId type' => [ + 'attributes' => ['contentId' => 'invalid', 'versionNo' => '1', 'languageCode' => ['en']], + 'expectedMessage' => 'Should return empty because contentId is invalid', + ], + 'invalid versionNo type' => [ + 'attributes' => ['contentId' => '1', 'versionNo' => 'invalid', 'languageCode' => ['en']], + 'expectedMessage' => 'Should return empty because versionNo is invalid', + ], + 'invalid languageCode type' => [ + 'attributes' => ['contentId' => '1', 'versionNo' => '1', 'languageCode' => 'eng-GB'], + 'expectedMessage' => 'Should return empty because languageCode is invalid', + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/LanguageFromCodeValueResolverTest.php b/tests/bundle/ValueResolver/LanguageFromCodeValueResolverTest.php new file mode 100644 index 0000000000..0a72ffbcd4 --- /dev/null +++ b/tests/bundle/ValueResolver/LanguageFromCodeValueResolverTest.php @@ -0,0 +1,90 @@ +languageServiceMock = $this->createMock(LanguageService::class); + $this->resolver = new LanguageFromCodeValueResolver($this->languageServiceMock); + } + + public function testResolve(): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(Language::class); + + $request = new Request([], [], [ + 'languageCode' => 'pol-pl', + ]); + + $mockLanguage = $this->createMock(Language::class); + + $this->languageServiceMock + ->expects(self::once()) + ->method('loadLanguage') + ->with('pol-pl') + ->willReturn($mockLanguage); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([$mockLanguage], $result); + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(Language::class); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @phpstan-return array, expectedMessage: string}> + */ + public function invalidAttributesProvider(): array + { + return [ + 'missing languageCode' => [ + 'attributes' => [], + 'expectedMessage' => 'Should return empty because languageCode is missing', + ], + 'empty languageCode' => [ + 'attributes' => ['languageCode' => ''], + 'expectedMessage' => 'Should return empty because languageCode is empty', + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/LanguageFromIdValueResolverTest.php b/tests/bundle/ValueResolver/LanguageFromIdValueResolverTest.php new file mode 100644 index 0000000000..47321d4246 --- /dev/null +++ b/tests/bundle/ValueResolver/LanguageFromIdValueResolverTest.php @@ -0,0 +1,94 @@ +languageServiceMock = $this->createMock(LanguageService::class); + $this->resolver = new LanguageFromIdValueResolver($this->languageServiceMock); + } + + public function testResolve(): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(Language::class); + + $request = new Request([], [], [ + 'languageId' => '1', + ]); + + $mockLanguage = $this->createMock(Language::class); + + $this->languageServiceMock + ->expects(self::once()) + ->method('loadLanguageById') + ->with(1) + ->willReturn($mockLanguage); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([$mockLanguage], $result); + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(Language::class); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @phpstan-return array, expectedMessage: string}> + */ + public function invalidAttributesProvider(): array + { + return [ + 'missing languageId' => [ + 'attributes' => [], + 'expectedMessage' => 'Should return empty because languageId is missing', + ], + 'invalid languageId type' => [ + 'attributes' => ['languageId' => 'invalid'], + 'expectedMessage' => 'Should return empty because languageId is invalid', + ], + 'empty languageId' => [ + 'attributes' => ['languageId' => ''], + 'expectedMessage' => 'Should return empty because languageId is empty', + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/ObjectStateGroupValueResolverTest.php b/tests/bundle/ValueResolver/ObjectStateGroupValueResolverTest.php new file mode 100644 index 0000000000..c9faa690fb --- /dev/null +++ b/tests/bundle/ValueResolver/ObjectStateGroupValueResolverTest.php @@ -0,0 +1,95 @@ +objectStateServiceMock = $this->createMock(ObjectStateService::class); + $this->resolver = new ObjectStateGroupValueResolver($this->objectStateServiceMock); + } + + public function testResolve(): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(ObjectStateGroup::class); + + $request = new Request([], [], [ + 'objectStateGroupId' => '123', + ]); + + $mockObjectStateGroup = $this->createMock(ObjectStateGroup::class); + + $this->objectStateServiceMock + ->expects(self::once()) + ->method('loadObjectStateGroup') + ->with(123) + ->willReturn($mockObjectStateGroup); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([$mockObjectStateGroup], $result); + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + * @param string $expectedMessage + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(ObjectStateGroup::class); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @phpstan-return array, expectedMessage: string}> + */ + public function invalidAttributesProvider(): array + { + return [ + 'missing objectStateGroupId' => [ + 'attributes' => [], + 'expectedMessage' => 'Should return empty because objectStateGroupId is missing', + ], + 'invalid objectStateGroupId type' => [ + 'attributes' => ['objectStateGroupId' => 'invalid'], + 'expectedMessage' => 'Should return empty because objectStateGroupId is invalid', + ], + 'empty objectStateGroupId' => [ + 'attributes' => ['objectStateGroupId' => ''], + 'expectedMessage' => 'Should return empty because objectStateGroupId is empty', + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/ObjectStateValueResolverTest.php b/tests/bundle/ValueResolver/ObjectStateValueResolverTest.php new file mode 100644 index 0000000000..aa9d0f848d --- /dev/null +++ b/tests/bundle/ValueResolver/ObjectStateValueResolverTest.php @@ -0,0 +1,84 @@ +objectStateService = $this->createMock(ObjectStateService::class); + $this->resolver = new ObjectStateValueResolver($this->objectStateService); + } + + public function testResolve(): void + { + $request = new Request([], [], [ + 'objectStateId' => '123', + ]); + + $objectState = $this->createMock(ObjectState::class); + + $this->objectStateService + ->method('loadObjectState') + ->with(123) + ->willReturn($objectState); + + $argument = $this->createMock(ArgumentMetadata::class); + $argument->method('getType')->willReturn(ObjectState::class); + + $result = iterator_to_array($this->resolver->resolve($request, $argument)); + + self::assertCount(1, $result); + self::assertSame($objectState, $result[0]); + } + + /** + * @dataProvider invalidRequestProvider + * + * @param array $attributes + */ + public function testResolveInvalidRequest(array $attributes): void + { + $request = new Request([], [], $attributes); + + $argument = $this->createMock(ArgumentMetadata::class); + $argument->method('getType')->willReturn(ObjectState::class); + + $result = iterator_to_array($this->resolver->resolve($request, $argument)); + + self::assertCount(0, $result); + } + + /** + * @phpstan-return array>> + */ + public function invalidRequestProvider(): array + { + return [ + 'missing objectStateId' => [ + [], + ], + 'invalid objectStateId type' => [ + ['objectStateId' => 'invalid'], + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/PolicyDraftValueResolverTest.php b/tests/bundle/ValueResolver/PolicyDraftValueResolverTest.php new file mode 100644 index 0000000000..46e3eb8c2b --- /dev/null +++ b/tests/bundle/ValueResolver/PolicyDraftValueResolverTest.php @@ -0,0 +1,86 @@ +roleService = $this->createMock(RoleService::class); + $this->resolver = new PolicyDraftValueResolver($this->roleService); + } + + public function testResolve(): void + { + $request = new Request([], [], [ + 'roleId' => '1', + 'policyId' => '123', + ]); + + $policyDraft = $this->createMock(PolicyDraft::class); + $policyDraft->method('__get')->with('originalId')->willReturn(123); + + $roleDraft = $this->createMock(RoleDraft::class); + $roleDraft->method('getPolicies')->willReturn([$policyDraft]); + + $this->roleService + ->method('loadRoleDraftByRoleId') + ->with(1) + ->willReturn($roleDraft); + + $argument = $this->createMock(ArgumentMetadata::class); + $argument->method('getType')->willReturn(PolicyDraft::class); + + $result = iterator_to_array($this->resolver->resolve($request, $argument)); + + self::assertCount(1, $result); + self::assertSame($policyDraft, $result[0]); + } + + public function testResolveNotFound(): void + { + $this->expectException(NotFoundHttpException::class); + $this->expectExceptionMessage('Policy draft 456 not found.'); + + $request = new Request([], [], [ + 'roleId' => '1', + 'policyId' => '456', + ]); + + $policyDraft = $this->createMock(PolicyDraft::class); + $policyDraft->method('__get')->with('originalId')->willReturn(123); + + $roleDraft = $this->createMock(RoleDraft::class); + $roleDraft->method('getPolicies')->willReturn([$policyDraft]); + + $this->roleService + ->method('loadRoleDraftByRoleId') + ->with(1) + ->willReturn($roleDraft); + + $argument = $this->createMock(ArgumentMetadata::class); + $argument->method('getType')->willReturn(PolicyDraft::class); + + iterator_to_array($this->resolver->resolve($request, $argument)); + } +} diff --git a/tests/bundle/ValueResolver/PolicyValueResolverTest.php b/tests/bundle/ValueResolver/PolicyValueResolverTest.php new file mode 100644 index 0000000000..193bc594a4 --- /dev/null +++ b/tests/bundle/ValueResolver/PolicyValueResolverTest.php @@ -0,0 +1,137 @@ +roleService = $this->createMock(RoleService::class); + $this->resolver = new PolicyValueResolver($this->roleService); + } + + public function testResolve(): void + { + $policyDraft = $this->createMock(PolicyDraft::class); + $policyDraft + ->method('__get') + ->with('originalId') + ->willReturn(123); + + $roleDraft = $this->createMock(RoleDraft::class); + $roleDraft + ->method('getPolicies') + ->willReturn([$policyDraft]); + + $attributes = [ + 'roleId' => '456', + 'policyId' => '123', + ]; + + $this->roleService->expects(self::once()) + ->method('loadRole') + ->with(456) + ->willReturn($roleDraft); + + $argumentMetadata = $this->createMock(ArgumentMetadata::class); + $argumentMetadata->method('getType')->willReturn(PolicyDraft::class); + $argumentMetadata->method('getName')->willReturn('policy'); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $argumentMetadata)); + + self::assertCount(1, $result); + self::assertSame($policyDraft, $result[0]); + } + + public function testResolvePolicyNotFound(): void + { + $roleDraft = $this->createMock(RoleDraft::class); + $roleDraft->method('getPolicies')->willReturn([]); + + $attributes = [ + 'roleId' => '456', + 'policyId' => '999', + ]; + + $this->roleService->expects(self::once()) + ->method('loadRole') + ->with(456) + ->willReturn($roleDraft); + + $argumentMetadata = $this->createMock(ArgumentMetadata::class); + $argumentMetadata->method('getType')->willReturn(PolicyDraft::class); + $argumentMetadata->method('getName')->willReturn('policy'); + + $request = new Request([], [], $attributes); + + $this->expectException(NotFoundHttpException::class); + $this->expectExceptionMessage('Policy draft 999 not found.'); + + iterator_to_array($this->resolver->resolve($request, $argumentMetadata)); + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $argumentMetadata = $this->createMock(ArgumentMetadata::class); + $argumentMetadata->method('getType')->willReturn(PolicyDraft::class); + $argumentMetadata->method('getName')->willReturn('policy'); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $argumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @return array, expectedMessage: string}> + */ + public static function invalidAttributesProvider(): array + { + return [ + 'missing roleId' => [ + 'attributes' => ['policyId' => '123'], + 'expectedMessage' => 'Should return empty because roleId is missing', + ], + 'missing policyId' => [ + 'attributes' => ['roleId' => '456'], + 'expectedMessage' => 'Should return empty because policyId is missing', + ], + 'invalid roleId type' => [ + 'attributes' => ['roleId' => 'invalid', 'policyId' => '123'], + 'expectedMessage' => 'Should return empty because roleId is not numeric', + ], + 'invalid policyId type' => [ + 'attributes' => ['roleId' => '456', 'policyId' => 'invalid'], + 'expectedMessage' => 'Should return empty because policyId is not numeric', + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/RoleAssignmentValueResolverTest.php b/tests/bundle/ValueResolver/RoleAssignmentValueResolverTest.php new file mode 100644 index 0000000000..fa73f0b7d8 --- /dev/null +++ b/tests/bundle/ValueResolver/RoleAssignmentValueResolverTest.php @@ -0,0 +1,91 @@ +roleService = $this->createMock(RoleService::class); + $this->resolver = new RoleAssignmentValueResolver($this->roleService); + } + + public function testResolve(): void + { + $roleAssignment = $this->createMock(RoleAssignment::class); + $attributes = ['roleAssignmentId' => '789']; + + $this->roleService->expects(self::once()) + ->method('loadRoleAssignment') + ->with(789) + ->willReturn($roleAssignment); + + $argumentMetadata = $this->createMock(ArgumentMetadata::class); + $argumentMetadata->method('getType') + ->willReturn(RoleAssignment::class); + $argumentMetadata->method('getName') + ->willReturn('roleAssignment'); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $argumentMetadata)); + + self::assertCount(1, $result); + self::assertSame($roleAssignment, $result[0]); + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $argumentMetadata = $this->createMock(ArgumentMetadata::class); + $argumentMetadata->method('getType') + ->willReturn(RoleAssignment::class); + $argumentMetadata->method('getName') + ->willReturn('roleAssignment'); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $argumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @return array, expectedMessage: string}> + */ + public static function invalidAttributesProvider(): array + { + return [ + 'missing roleAssignmentId' => [ + 'attributes' => [], + 'expectedMessage' => 'Should return empty because roleAssignmentId is missing', + ], + 'invalid roleAssignmentId type' => [ + 'attributes' => ['roleAssignmentId' => 'invalid'], + 'expectedMessage' => 'Should return empty because roleAssignmentId is not numeric', + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/RoleValueResolverTest.php b/tests/bundle/ValueResolver/RoleValueResolverTest.php new file mode 100644 index 0000000000..c532650e04 --- /dev/null +++ b/tests/bundle/ValueResolver/RoleValueResolverTest.php @@ -0,0 +1,91 @@ +roleService = $this->createMock(RoleService::class); + $this->resolver = new RoleValueResolver($this->roleService); + } + + public function testResolve(): void + { + $role = $this->createMock(Role::class); + $attributes = ['roleId' => '456']; + + $this->roleService->expects(self::once()) + ->method('loadRole') + ->with(456) + ->willReturn($role); + + $argumentMetadata = $this->createMock(ArgumentMetadata::class); + $argumentMetadata->method('getType') + ->willReturn(Role::class); + $argumentMetadata->method('getName') + ->willReturn('role'); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $argumentMetadata)); + + self::assertCount(1, $result); + self::assertSame($role, $result[0]); + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $argumentMetadata = $this->createMock(ArgumentMetadata::class); + $argumentMetadata->method('getType') + ->willReturn(Role::class); + $argumentMetadata->method('getName') + ->willReturn('role'); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $argumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @return array, expectedMessage: string}> + */ + public static function invalidAttributesProvider(): array + { + return [ + 'missing roleId' => [ + 'attributes' => [], + 'expectedMessage' => 'Should return empty because roleId is missing', + ], + 'invalid roleId type' => [ + 'attributes' => ['roleId' => 'invalid'], + 'expectedMessage' => 'Should return empty because roleId is not numeric', + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/SectionValueResolverTest.php b/tests/bundle/ValueResolver/SectionValueResolverTest.php new file mode 100644 index 0000000000..a4d10206f1 --- /dev/null +++ b/tests/bundle/ValueResolver/SectionValueResolverTest.php @@ -0,0 +1,91 @@ +sectionService = $this->createMock(SectionService::class); + $this->resolver = new SectionValueResolver($this->sectionService); + } + + public function testResolve(): void + { + $section = $this->createMock(Section::class); + $attributes = ['sectionId' => '123']; + + $this->sectionService->expects(self::once()) + ->method('loadSection') + ->with(123) + ->willReturn($section); + + $argumentMetadata = $this->createMock(ArgumentMetadata::class); + $argumentMetadata->method('getType') + ->willReturn(Section::class); + $argumentMetadata->method('getName') + ->willReturn('section'); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $argumentMetadata)); + + self::assertCount(1, $result); + self::assertSame($section, $result[0]); + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $argumentMetadata = $this->createMock(ArgumentMetadata::class); + $argumentMetadata->method('getType') + ->willReturn(Section::class); + $argumentMetadata->method('getName') + ->willReturn('section'); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $argumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @return array, expectedMessage: string}> + */ + public static function invalidAttributesProvider(): array + { + return [ + 'missing sectionId' => [ + 'attributes' => [], + 'expectedMessage' => 'Should return empty because sectionId is missing', + ], + 'invalid sectionId type' => [ + 'attributes' => ['sectionId' => 'invalid'], + 'expectedMessage' => 'Should return empty because sectionId is not numeric', + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/SourceLanguageValueResolverTest.php b/tests/bundle/ValueResolver/SourceLanguageValueResolverTest.php new file mode 100644 index 0000000000..e68bed0124 --- /dev/null +++ b/tests/bundle/ValueResolver/SourceLanguageValueResolverTest.php @@ -0,0 +1,91 @@ +languageService = $this->createMock(LanguageService::class); + $this->resolver = new SourceLanguageValueResolver($this->languageService); + } + + public function testResolve(): void + { + $language = $this->createMock(Language::class); + $attributes = ['fromLanguageCode' => 'fra-FR']; + + $this->languageService->expects(self::once()) + ->method('loadLanguage') + ->with('fra-FR') + ->willReturn($language); + + $argumentMetadata = $this->createMock(ArgumentMetadata::class); + $argumentMetadata->method('getType') + ->willReturn(Language::class); + $argumentMetadata->method('getName') + ->willReturn('language'); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $argumentMetadata)); + + self::assertCount(1, $result); + self::assertSame($language, $result[0]); + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $argumentMetadata = $this->createMock(ArgumentMetadata::class); + $argumentMetadata->method('getType') + ->willReturn(Language::class); + $argumentMetadata->method('getName') + ->willReturn('language'); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $argumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @return array, expectedMessage: string}> + */ + public static function invalidAttributesProvider(): array + { + return [ + 'missing fromLanguageCode' => [ + 'attributes' => [], + 'expectedMessage' => 'Should return empty because fromLanguageCode is missing', + ], + 'invalid fromLanguageCode type' => [ + 'attributes' => ['fromLanguageCode' => 789], + 'expectedMessage' => 'Should return empty because fromLanguageCode is not a string', + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/TargetLanguageValueResolverTest.php b/tests/bundle/ValueResolver/TargetLanguageValueResolverTest.php new file mode 100644 index 0000000000..eab0c48504 --- /dev/null +++ b/tests/bundle/ValueResolver/TargetLanguageValueResolverTest.php @@ -0,0 +1,91 @@ +languageService = $this->createMock(LanguageService::class); + $this->resolver = new TargetLanguageValueResolver($this->languageService); + } + + public function testResolve(): void + { + $language = $this->createMock(Language::class); + $attributes = ['toLanguageCode' => 'eng-GB']; + + $this->languageService->expects(self::once()) + ->method('loadLanguage') + ->with('eng-GB') + ->willReturn($language); + + $argumentMetadata = $this->createMock(ArgumentMetadata::class); + $argumentMetadata->method('getType') + ->willReturn(Language::class); + $argumentMetadata->method('getName') + ->willReturn('language'); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $argumentMetadata)); + + self::assertCount(1, $result); + self::assertSame($language, $result[0]); + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $argumentMetadata = $this->createMock(ArgumentMetadata::class); + $argumentMetadata->method('getType') + ->willReturn(Language::class); + $argumentMetadata->method('getName') + ->willReturn('language'); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $argumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @return array, expectedMessage: string}> + */ + public static function invalidAttributesProvider(): array + { + return [ + 'missing toLanguageCode' => [ + 'attributes' => [], + 'expectedMessage' => 'Should return empty because toLanguageCode is missing', + ], + 'invalid toLanguageCode type' => [ + 'attributes' => ['toLanguageCode' => 123], + 'expectedMessage' => 'Should return empty because toLanguageCode is not a string', + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/URLWildcardValueResolverTest.php b/tests/bundle/ValueResolver/URLWildcardValueResolverTest.php new file mode 100644 index 0000000000..72555b1356 --- /dev/null +++ b/tests/bundle/ValueResolver/URLWildcardValueResolverTest.php @@ -0,0 +1,94 @@ +urlWildcardServiceMock = $this->createMock(URLWildcardService::class); + $this->resolver = new URLWildcardValueResolver($this->urlWildcardServiceMock); + } + + public function testResolve(): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(URLWildcard::class); + + $request = new Request([], [], [ + 'urlWildcardId' => '123', + ]); + + $mockURLWildcard = $this->createMock(URLWildcard::class); + + $this->urlWildcardServiceMock + ->expects(self::once()) + ->method('load') + ->with(123) + ->willReturn($mockURLWildcard); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([$mockURLWildcard], $result); + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(URLWildcard::class); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @phpstan-return array, expectedMessage: string}> + */ + public function invalidAttributesProvider(): array + { + return [ + 'missing urlWildcardId' => [ + 'attributes' => [], + 'expectedMessage' => 'Should return empty because urlWildcardId is missing', + ], + 'invalid urlWildcardId type' => [ + 'attributes' => ['urlWildcardId' => 'invalid'], + 'expectedMessage' => 'Should return empty because urlWildcardId is invalid', + ], + 'empty urlWildcardId' => [ + 'attributes' => ['urlWildcardId' => ''], + 'expectedMessage' => 'Should return empty because urlWildcardId is empty', + ], + ]; + } +} diff --git a/tests/bundle/ValueResolver/VersionInfoValueResolverTest.php b/tests/bundle/ValueResolver/VersionInfoValueResolverTest.php new file mode 100644 index 0000000000..27de65aba5 --- /dev/null +++ b/tests/bundle/ValueResolver/VersionInfoValueResolverTest.php @@ -0,0 +1,115 @@ +contentServiceMock = $this->createMock(ContentService::class); + $this->resolver = new VersionInfoValueResolver($this->contentServiceMock); + } + + public function testResolve(): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(VersionInfo::class); + + $request = new Request([], [], [ + 'versionNo' => '1', + 'contentId' => '123', + ]); + + $mockContentInfo = $this->createMock(ContentInfo::class); + $mockVersionInfo = $this->createMock(VersionInfo::class); + + $this->contentServiceMock + ->expects(self::once()) + ->method('loadContentInfo') + ->with(123) + ->willReturn($mockContentInfo); + + $this->contentServiceMock + ->expects(self::once()) + ->method('loadVersionInfo') + ->with($mockContentInfo, 1) + ->willReturn($mockVersionInfo); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([$mockVersionInfo], $result); + } + + /** + * @dataProvider invalidAttributesProvider + * + * @param array $attributes + */ + public function testResolveInvalidAttributes(array $attributes, string $expectedMessage): void + { + $mockArgumentMetadata = $this->createMock(ArgumentMetadata::class); + $mockArgumentMetadata->expects(self::once()) + ->method('getType') + ->willReturn(VersionInfo::class); + + $request = new Request([], [], $attributes); + + $result = iterator_to_array($this->resolver->resolve($request, $mockArgumentMetadata)); + + self::assertSame([], $result, $expectedMessage); + } + + /** + * @phpstan-return array, expectedMessage: string}> + */ + public function invalidAttributesProvider(): array + { + return [ + 'missing versionNo' => [ + 'attributes' => ['contentId' => '123'], + 'expectedMessage' => 'Should return empty because versionNo is missing', + ], + 'missing contentId' => [ + 'attributes' => ['versionNo' => '1'], + 'expectedMessage' => 'Should return empty because contentId is missing', + ], + 'missing both attributes' => [ + 'attributes' => [], + 'expectedMessage' => 'Should return empty because both versionNo and contentId are missing', + ], + 'invalid contentId type' => [ + 'attributes' => ['versionNo' => '1', 'contentId' => 'invalid'], + 'expectedMessage' => 'Should return empty because contentId is invalid', + ], + 'invalid versionNo type' => [ + 'attributes' => ['versionNo' => 'invalid', 'contentId' => '123'], + 'expectedMessage' => 'Should return empty because versionNo is invalid', + ], + 'invalid attributes type' => [ + 'attributes' => ['versionNo' => 1, 'contentId' => 123], + 'expectedMessage' => 'Should return empty because attributes are integers instead of strings', + ], + ]; + } +} diff --git a/tests/integration/REST/BaseAdminUiRestWebTestCase.php b/tests/integration/REST/BaseAdminUiRestWebTestCase.php index 9fe370236a..c6b85e9c47 100644 --- a/tests/integration/REST/BaseAdminUiRestWebTestCase.php +++ b/tests/integration/REST/BaseAdminUiRestWebTestCase.php @@ -103,7 +103,7 @@ private function mockSymfonyUser(User $ibexaUser): UserInterface { $symfonyUser = $this->createMock(UserInterface::class); $symfonyUser->method('getRoles')->willReturn(['ROLE_USER']); - $symfonyUser->method('getUsername')->willReturn($ibexaUser->login); + $symfonyUser->method('getUserIdentifier')->willReturn($ibexaUser->login); return new UserWrapped($symfonyUser, $ibexaUser); } diff --git a/tests/lib/Form/Data/AbstractFormDataValidationTestCase.php b/tests/lib/Form/Data/AbstractFormDataValidationTestCase.php index 7c5be56de8..8c14f3d63f 100644 --- a/tests/lib/Form/Data/AbstractFormDataValidationTestCase.php +++ b/tests/lib/Form/Data/AbstractFormDataValidationTestCase.php @@ -80,7 +80,7 @@ static function (FormError $error): FormErrorDataTestWrapper { protected function getExtensions(): array { $validator = Validation::createValidatorBuilder() - ->enableAnnotationMapping(true) + ->enableAttributeMapping() ->getValidator() ; diff --git a/tests/lib/Form/Data/Role/RoleAssignmentCreateDataValidationTest.php b/tests/lib/Form/Data/Role/RoleAssignmentCreateDataValidationTest.php index 4d8bfa06de..6c9986c4cc 100644 --- a/tests/lib/Form/Data/Role/RoleAssignmentCreateDataValidationTest.php +++ b/tests/lib/Form/Data/Role/RoleAssignmentCreateDataValidationTest.php @@ -49,7 +49,7 @@ public static function getDataForTestFormSubmitValidation(): iterable ], [ new FormErrorDataTestWrapper( - 'This value is not valid.', + 'The selected choice is invalid.', ['{{ value }}' => 'foo'], 'children[limitation_type]' ), diff --git a/tests/lib/Form/Data/Section/AbstractSectionMutationDataValidationTestCase.php b/tests/lib/Form/Data/Section/AbstractSectionMutationDataValidationTestCase.php index bbda16e3ba..8344e3c030 100644 --- a/tests/lib/Form/Data/Section/AbstractSectionMutationDataValidationTestCase.php +++ b/tests/lib/Form/Data/Section/AbstractSectionMutationDataValidationTestCase.php @@ -26,7 +26,10 @@ public static function getDataForTestFormSubmitValidation(): iterable [ new FormErrorDataTestWrapper( 'ez.section.identifier.format', - ['{{ value }}' => '"Foo With Space"'], + [ + '{{ value }}' => '"Foo With Space"', + '{{ pattern }}' => '/^[[:alnum:]_]+$/', + ], 'data.identifier' ), ], diff --git a/tests/lib/Form/Processor/ContentTypeFormProcessorTest.php b/tests/lib/Form/Processor/ContentTypeFormProcessorTest.php index cd77860515..b9c2a05c06 100644 --- a/tests/lib/Form/Processor/ContentTypeFormProcessorTest.php +++ b/tests/lib/Form/Processor/ContentTypeFormProcessorTest.php @@ -19,7 +19,10 @@ 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\DataMapperInterface; +use Symfony\Component\Form\Form; use Symfony\Component\Form\FormConfigInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -245,9 +248,9 @@ public function testPublishContentTypeWithRedirection(): void public function testRemoveFieldDefinition(): void { - $fieldDefinition1 = new FieldDefinition(); - $fieldDefinition2 = new FieldDefinition(); - $fieldDefinition3 = new FieldDefinition(); + $fieldDefinition1 = new FieldDefinition(['identifier' => 'field_1']); + $fieldDefinition2 = new FieldDefinition(['identifier' => 'field_2']); + $fieldDefinition3 = new FieldDefinition(['identifier' => 'field_3']); $existingFieldDefinitions = [$fieldDefinition1, $fieldDefinition2, $fieldDefinition3]; $contentTypeDraft = new ContentTypeDraft([ 'innerContentType' => new ContentType([ @@ -256,59 +259,40 @@ public function testRemoveFieldDefinition(): void ]), ]); - $fieldDefForm1 = $this->createMock(FormInterface::class); - $fieldDefSelected1 = $this->createMock(FormInterface::class); - $fieldDefForm1 - ->expects(self::once()) - ->method('get') - ->with('selected') - ->willReturn($fieldDefSelected1); - $fieldDefSelected1 - ->expects(self::once()) - ->method('getData') - ->willReturn(false); - $fieldDefForm1 - ->expects(self::never()) - ->method('getData'); - - $fieldDefForm2 = $this->createMock(FormInterface::class); - $fieldDefSelected2 = $this->createMock(FormInterface::class); - $fieldDefForm2 - ->expects(self::once()) - ->method('get') - ->with('selected') - ->willReturn($fieldDefSelected2); - $fieldDefSelected2 - ->expects(self::once()) - ->method('getData') - ->willReturn(true); - $fieldDefForm2 - ->expects(self::once()) - ->method('getData') - ->willReturn(new FieldDefinitionData(['fieldDefinition' => $fieldDefinition1])); - - $fieldDefForm3 = $this->createMock(FormInterface::class); - $fieldDefSelected3 = $this->createMock(FormInterface::class); - $fieldDefForm3 - ->expects(self::once()) - ->method('get') - ->with('selected') - ->willReturn($fieldDefSelected3); - $fieldDefSelected3 - ->expects(self::once()) - ->method('getData') - ->willReturn(true); - $fieldDefForm3 - ->expects(self::once()) - ->method('getData') - ->willReturn(new FieldDefinitionData(['fieldDefinition' => $fieldDefinition1])); + $compoundFormConfig = $this->createMock(FormConfigInterface::class); + $compoundFormConfig->method('getCompound')->willReturn(true); + $compoundFormConfig->method('getDataMapper')->willReturn($this->createMock(DataMapperInterface::class)); + $fieldDefinitionsDataForm = new Form($compoundFormConfig); + $fieldDefinitionsDataForm->add($this->mockFieldDefinitionForm($fieldDefinition1, false)); + $fieldDefinitionsDataForm->add($this->mockFieldDefinitionForm($fieldDefinition2, true)); + $fieldDefinitionsDataForm->add($this->mockFieldDefinitionForm($fieldDefinition3, true)); $mainForm = $this->createMock(FormInterface::class); $mainForm ->expects(self::once()) ->method('get') ->with('fieldDefinitionsData') - ->willReturn([$fieldDefForm1, $fieldDefForm2, $fieldDefForm3]); + ->willReturn($fieldDefinitionsDataForm); + + // only 2 fields are selected for removal: field 2 and 3 + $matcher = self::exactly(2); + $this->contentTypeService->expects($matcher) + ->method('removeFieldDefinition') + // replacement for deprecated withConsecutive method + ->willReturnCallback( + static function ( + ContentTypeDraft $actualContentTypeDraft, + FieldDefinition $actualFieldDefinition + ) use ($matcher, $contentTypeDraft, $fieldDefinition2, $fieldDefinition3) { + self::assertSame($contentTypeDraft, $actualContentTypeDraft); + match ($matcher->getInvocationCount()) { + 1 => self::assertSame($fieldDefinition2, $actualFieldDefinition), + 2 => self::assertSame($fieldDefinition3, $actualFieldDefinition), + default => self::fail('Unexpected invocation count matched'), + }; + } + ) + ; $event = new FormActionEvent( $mainForm, @@ -316,6 +300,7 @@ public function testRemoveFieldDefinition(): void 'removeFieldDefinition', ['languageCode' => 'eng-GB'] ); + $this->formProcessor->processRemoveFieldDefinition($event); } @@ -376,4 +361,29 @@ private function getContentTypeDraft(): ContentTypeDraft ]), ]); } + + private function mockFieldDefinitionForm(FieldDefinition $fieldDefinition, bool $isSelected): FormInterface & MockObject + { + $fieldDefinitionForm = $this->createMock(FormInterface::class); + $fieldDefinitionForm->method('getName')->willReturn(uniqid('child', true)); + $fieldDefinitionSelectedForm = $this->createMock(FormInterface::class); + $fieldDefinitionForm + ->expects(self::once()) + ->method('get') + ->with('selected') + ->willReturn($fieldDefinitionSelectedForm) + ; + $fieldDefinitionSelectedForm + ->expects(self::once()) + ->method('getData') + ->willReturn($isSelected) + ; + $fieldDefinitionForm + ->expects($isSelected ? self::once() : self::never()) + ->method('getData') + ->willReturn(new FieldDefinitionData(['fieldDefinition' => $fieldDefinition])) + ; + + return $fieldDefinitionForm; + } } diff --git a/tests/lib/Limitation/Mapper/UDWBasedMapperTest.php b/tests/lib/Limitation/Mapper/UDWBasedMapperTest.php index cc11a73f0d..3feaa6a38a 100644 --- a/tests/lib/Limitation/Mapper/UDWBasedMapperTest.php +++ b/tests/lib/Limitation/Mapper/UDWBasedMapperTest.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\Limitation\Mapper; @@ -22,6 +23,9 @@ use Ibexa\Core\Repository\Values\Content\Location; use PHPUnit\Framework\TestCase; +/** + * @covers \Ibexa\AdminUi\Limitation\Mapper\UDWBasedMapper + */ class UDWBasedMapperTest extends TestCase { public function testMapLimitationValue(): void @@ -86,6 +90,11 @@ public function testMapLimitationValue(): void self::assertEquals($expected, $result); } + /** + * @param \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo[] $expected + * + * @phpstan-return \Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult<\Ibexa\Core\Repository\Values\Content\Location> + */ private function createSearchResultsMock(array $expected): SearchResult { $hits = []; @@ -99,6 +108,7 @@ private function createSearchResultsMock(array $expected): SearchResult $hits[] = new SearchHit(['valueObject' => $locationMock]); } + /** @phpstan-var \Ibexa\Contracts\Core\Repository\Values\Content\Search\SearchResult<\Ibexa\Core\Repository\Values\Content\Location> */ return new SearchResult(['searchHits' => $hits]); } } diff --git a/tests/lib/Pagination/Pagerfanta/TrashItemAdapterTest.php b/tests/lib/Pagination/Pagerfanta/TrashItemAdapterTest.php index 8bddf35a9c..93552fd399 100644 --- a/tests/lib/Pagination/Pagerfanta/TrashItemAdapterTest.php +++ b/tests/lib/Pagination/Pagerfanta/TrashItemAdapterTest.php @@ -55,7 +55,7 @@ public function testGetNbResults() $countQuery = clone $query; $countQuery->limit = 0; - $searchResult = new SearchResult(['count' => $nbResults]); + $searchResult = new SearchResult(['totalCount' => $nbResults]); $this->trashService ->expects(self::once()) ->method('findTrashItems') @@ -94,7 +94,7 @@ public function testGetSlice() $items[] = $content; } - $searchResult = new SearchResult(['items' => $items, 'count' => $nbResults]); + $searchResult = new SearchResult(['items' => $items, 'totalCount' => $nbResults]); $this->trashService ->expects(self::once())