diff --git a/src/bundle/Controller/ContentEditController.php b/src/bundle/Controller/ContentEditController.php index dc1888b8..322c1b7a 100644 --- a/src/bundle/Controller/ContentEditController.php +++ b/src/bundle/Controller/ContentEditController.php @@ -23,14 +23,11 @@ class ContentEditController extends Controller { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - private $contentTypeService; + private ContentTypeService $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\ContentForms\Form\ActionDispatcher\ActionDispatcherInterface */ - private $contentActionDispatcher; + private ActionDispatcherInterface $contentActionDispatcher; public function __construct( ContentTypeService $contentTypeService, diff --git a/src/bundle/Controller/UserController.php b/src/bundle/Controller/UserController.php index 33c219a0..231e35fa 100644 --- a/src/bundle/Controller/UserController.php +++ b/src/bundle/Controller/UserController.php @@ -30,29 +30,21 @@ class UserController extends Controller { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - private $contentTypeService; + private ContentTypeService $contentTypeService; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ - private $userService; + private UserService $userService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - private $locationService; + private LocationService $locationService; - /** @var \Ibexa\Contracts\Core\Repository\LanguageService */ - private $languageService; + private LanguageService $languageService; - /** @var \Ibexa\ContentForms\Form\ActionDispatcher\ActionDispatcherInterface */ - private $userActionDispatcher; + private ActionDispatcherInterface $userActionDispatcher; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ - private $userLanguagePreferenceProvider; + private UserLanguagePreferenceProviderInterface $userLanguagePreferenceProvider; - /** @var \Ibexa\Contracts\ContentForms\Content\Form\Provider\GroupedContentFormFieldsProviderInterface */ - private $groupedContentFormFieldsProvider; + private GroupedContentFormFieldsProviderInterface $groupedContentFormFieldsProvider; private ContentService $contentService; diff --git a/src/bundle/DependencyInjection/Configuration/Parser/ContentEdit.php b/src/bundle/DependencyInjection/Configuration/Parser/ContentEdit.php index 54bd7106..993b6dfb 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/ContentEdit.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/ContentEdit.php @@ -19,7 +19,7 @@ class ContentEdit extends AbstractParser * * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system. */ - public function addSemanticConfig(NodeBuilder $nodeBuilder) + public function addSemanticConfig(NodeBuilder $nodeBuilder): void { $nodeBuilder ->arrayNode('content_edit') @@ -48,7 +48,7 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) ->end(); } - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) + public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void { if (empty($scopeSettings['content_edit'])) { return; diff --git a/src/bundle/DependencyInjection/Configuration/Parser/UserEdit.php b/src/bundle/DependencyInjection/Configuration/Parser/UserEdit.php index 9c97654b..b28afcf4 100644 --- a/src/bundle/DependencyInjection/Configuration/Parser/UserEdit.php +++ b/src/bundle/DependencyInjection/Configuration/Parser/UserEdit.php @@ -19,7 +19,7 @@ class UserEdit extends AbstractParser * * @param \Symfony\Component\Config\Definition\Builder\NodeBuilder $nodeBuilder Node just under ezpublish.system. */ - public function addSemanticConfig(NodeBuilder $nodeBuilder) + public function addSemanticConfig(NodeBuilder $nodeBuilder): void { $nodeBuilder ->arrayNode('user_edit') @@ -40,7 +40,7 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) ->end(); } - public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) + public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void { if (empty($scopeSettings['user_edit'])) { return; diff --git a/src/lib/Behat/Context/ContentEditContext.php b/src/lib/Behat/Context/ContentEditContext.php index b663edea..5df99dd7 100644 --- a/src/lib/Behat/Context/ContentEditContext.php +++ b/src/lib/Behat/Context/ContentEditContext.php @@ -18,10 +18,8 @@ final class ContentEditContext extends MinkContext implements Context, SnippetAc { /** * Name of the content that was created using the edit form. Used to validate that the content was created. - * - * @var string */ - private $createdContentName; + private ?string $createdContentName = null; /** * @var \Ibexa\ContentForms\Behat\Context\ContentTypeContext @@ -30,13 +28,11 @@ final class ContentEditContext extends MinkContext implements Context, SnippetAc /** * Identifier of the FieldDefinition used to cover validation. - * - * @var string */ - private static $constrainedFieldIdentifier = 'constrained_field'; + private static string $constrainedFieldIdentifier = 'constrained_field'; /** @BeforeScenario */ - public function gatherContexts(BeforeScenarioScope $scope) + public function gatherContexts(BeforeScenarioScope $scope): void { $environment = $scope->getEnvironment(); @@ -47,7 +43,7 @@ public function gatherContexts(BeforeScenarioScope $scope) * @Then /^I should see a folder content edit form$/ * @Then /^I should see a content edit form$/ */ - public function iShouldSeeAContentEditForm() + public function iShouldSeeAContentEditForm(): void { $this->assertSession()->elementExists('css', 'form[name=ezplatform_content_forms_content_edit]'); } @@ -55,7 +51,7 @@ public function iShouldSeeAContentEditForm() /** * @Then /^I am on the View of the Content that was published$/ */ - public function iAmOnTheViewOfTheContentThatWasPublished() + public function iAmOnTheViewOfTheContentThatWasPublished(): void { if (!isset($this->createdContentName)) { throw new \Exception('No created content name set'); @@ -68,7 +64,7 @@ public function iAmOnTheViewOfTheContentThatWasPublished() /** * @When /^I fill in the folder edit form$/ */ - public function iFillInTheFolderEditForm() + public function iFillInTheFolderEditForm(): void { // will only work for single value fields $this->createdContentName = 'Behat content edit @' . microtime(true); @@ -78,7 +74,7 @@ public function iFillInTheFolderEditForm() /** * @Given /^that I have permission to create folders$/ */ - public function thatIHavePermissionToCreateFolders() + public function thatIHavePermissionToCreateFolders(): void { $this->visit('/login'); $this->fillField('_username', 'admin'); @@ -89,7 +85,7 @@ public function thatIHavePermissionToCreateFolders() /** * @Given /^that I have permission to create content of this type$/ */ - public function thatIHavePermissionToCreateContentOfThisType() + public function thatIHavePermissionToCreateContentOfThisType(): void { $this->thatIHavePermissionToCreateFolders(); } @@ -97,7 +93,7 @@ public function thatIHavePermissionToCreateContentOfThisType() /** * @When /^I go to the content creation page for this type$/ */ - public function iGoToTheContentCreationPageForThisType() + public function iGoToTheContentCreationPageForThisType(): void { $uri = sprintf( '/content/create/nodraft/%s/eng-GB/2', @@ -110,7 +106,7 @@ public function iGoToTheContentCreationPageForThisType() /** * @Given /^I fill in the constrained field with an invalid value$/ */ - public function iFillInTheConstrainedFieldWithAnInvalidValue() + public function iFillInTheConstrainedFieldWithAnInvalidValue(): void { $this->fillField( sprintf( @@ -132,7 +128,7 @@ public function iFillInTheConstrainedFieldWithAnInvalidValue() /** * @Then /^I am shown the content creation form$/ */ - public function iAmShownTheContentCreationForm() + public function iAmShownTheContentCreationForm(): void { $uri = sprintf( '/content/create/nodraft/%s/eng-GB/2', @@ -151,7 +147,7 @@ public function iAmShownTheContentCreationForm() /** * @Given /^there is a relevant error message linked to the invalid field$/ */ - public function thereIsARelevantErrorMessageLinkedToTheInvalidField() + public function thereIsARelevantErrorMessageLinkedToTheInvalidField(): void { $selector = sprintf( '#ezplatform_content_forms_content_edit_fieldsData_%s div ul li', @@ -165,7 +161,7 @@ public function thereIsARelevantErrorMessageLinkedToTheInvalidField() /** * @Given /^that there is a content type with any kind of constraints on a Field Definition$/ */ - public function thereIsAContentTypeWithAnyKindOfConstraintsOnAFieldDefinition() + public function thereIsAContentTypeWithAnyKindOfConstraintsOnAFieldDefinition(): void { $contentTypeCreateStruct = $this->contentTypeContext->newContentTypeCreateStruct(); @@ -188,7 +184,7 @@ public function thereIsAContentTypeWithAnyKindOfConstraintsOnAFieldDefinition() /** * @When /^a content creation form is displayed$/ */ - public function aContentCreationFormIsDisplayed() + public function aContentCreationFormIsDisplayed(): void { $this->visit('/content/create/nodraft/folder/eng-GB/2'); } diff --git a/src/lib/Behat/Context/ContentTypeContext.php b/src/lib/Behat/Context/ContentTypeContext.php index 95a46b98..488a1483 100644 --- a/src/lib/Behat/Context/ContentTypeContext.php +++ b/src/lib/Behat/Context/ContentTypeContext.php @@ -22,8 +22,7 @@ final class ContentTypeContext extends RawMinkContext implements Context, SnippetAcceptingContext { - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - private $contentTypeService; + private ContentTypeService $contentTypeService; /** * Current content type within this context. @@ -32,13 +31,12 @@ final class ContentTypeContext extends RawMinkContext implements Context, Snippe */ private $currentContentType; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; /** * Default Administrator user id. */ - private $adminUserId = 14; + private int $adminUserId = 14; public function __construct(PermissionResolver $permissionResolver, ContentTypeService $contentTypeService) { @@ -50,7 +48,7 @@ public function __construct(PermissionResolver $permissionResolver, ContentTypeS /** * @Given /^there is a content type "([^"]*)" with the id "([^"]*)"$/ */ - public function thereIsAContentTypeWithId($contentTypeIdentifier, $id) + public function thereIsAContentTypeWithId(string $contentTypeIdentifier, $id): void { try { $contentType = $this->contentTypeService->loadContentTypeByIdentifier($contentTypeIdentifier); @@ -63,7 +61,7 @@ public function thereIsAContentTypeWithId($contentTypeIdentifier, $id) /** * @Given I remove :fieldIdentifier field from :contentTypeIdentifier content type */ - public function iRemoveFieldFromContentType($fieldIdentifier, $contentTypeIdentifier) + public function iRemoveFieldFromContentType($fieldIdentifier, string $contentTypeIdentifier): void { $contentType = $this->contentTypeService->loadContentTypeByIdentifier($contentTypeIdentifier); $contentTypeDraft = $this->contentTypeService->createContentTypeDraft($contentType); @@ -74,7 +72,7 @@ public function iRemoveFieldFromContentType($fieldIdentifier, $contentTypeIdenti $this->contentTypeService->publishContentTypeDraft($contentTypeDraft); } - public function addFieldsTo($contentTypeIdentifier, array $fieldDefinitions) + public function addFieldsTo(string $contentTypeIdentifier, array $fieldDefinitions): void { $contentType = $this->contentTypeService->loadContentTypeByIdentifier($contentTypeIdentifier); $contentTypeDraft = $this->contentTypeService->createContentTypeDraft($contentType); @@ -100,7 +98,7 @@ public function getCurrentContentType() return $this->currentContentType; } - public function createContentType(ContentTypeCreateStruct $struct) + public function createContentType(ContentTypeCreateStruct $struct): void { if (!isset($struct->mainLanguageCode)) { $struct->mainLanguageCode = 'eng-GB'; @@ -125,14 +123,14 @@ public function createContentType(ContentTypeCreateStruct $struct) * * @return \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentTypeCreateStruct */ - public function newContentTypeCreateStruct($identifier = null) + public function newContentTypeCreateStruct($identifier = null): ContentTypeCreateStruct { return $this->contentTypeService->newContentTypeCreateStruct( $identifier ?: $identifier = str_replace('.', '', uniqid('content_type_', true)) ); } - public function updateFieldDefinition($identifier, FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct) + public function updateFieldDefinition($identifier, FieldDefinitionUpdateStruct $fieldDefinitionUpdateStruct): void { $contentTypeDraft = $this->contentTypeService->createContentTypeDraft($this->currentContentType); diff --git a/src/lib/Behat/Context/FieldTypeFormContext.php b/src/lib/Behat/Context/FieldTypeFormContext.php index 4efc63f4..23a977e2 100644 --- a/src/lib/Behat/Context/FieldTypeFormContext.php +++ b/src/lib/Behat/Context/FieldTypeFormContext.php @@ -18,9 +18,9 @@ final class FieldTypeFormContext extends RawMinkContext implements SnippetAcceptingContext { - private static $fieldIdentifier = 'field'; + private static string $fieldIdentifier = 'field'; - private static $fieldTypeIdentifierMap = [ + private static array $fieldTypeIdentifierMap = [ 'user' => 'ezuser', 'textline' => 'ezstring', 'selection' => 'ezselection', @@ -30,7 +30,7 @@ final class FieldTypeFormContext extends RawMinkContext implements SnippetAccept private $contentTypeContext; /** @BeforeScenario */ - public function gatherContexts(BeforeScenarioScope $scope) + public function gatherContexts(BeforeScenarioScope $scope): void { $environment = $scope->getEnvironment(); $this->contentTypeContext = $environment->getContext(ContentTypeContext::class); @@ -40,7 +40,7 @@ public function gatherContexts(BeforeScenarioScope $scope) * @Given a content type with a(n) :fieldTypeIdentifier field definition * @Given a content type :contentTypeName with a(n) :fieldTypeIdentifier field definition */ - public function aContentTypeWithAGivenFieldDefinition($fieldTypeIdentifier, $contentTypeName = null) + public function aContentTypeWithAGivenFieldDefinition($fieldTypeIdentifier, $contentTypeName = null): void { if (isset(self::$fieldTypeIdentifierMap[$fieldTypeIdentifier])) { $fieldTypeIdentifier = self::$fieldTypeIdentifierMap[$fieldTypeIdentifier]; @@ -80,7 +80,7 @@ public function aContentTypeWithAGivenFieldDefinition($fieldTypeIdentifier, $con /** * @When /^I view the edit form for this field$/ */ - public function iEditOrCreateContentOfThisType() + public function iEditOrCreateContentOfThisType(): void { $this->visitPath( sprintf( @@ -93,7 +93,7 @@ public function iEditOrCreateContentOfThisType() /** * @When /^I view the edit user form for this field$/ */ - public function iEditOrCreateContentOfUserType() + public function iEditOrCreateContentOfUserType(): void { $this->visitPath( sprintf( @@ -106,7 +106,7 @@ public function iEditOrCreateContentOfUserType() /** * @Then the edit form should contain an identifiable widget for :fieldTypeIdentifier field definition */ - public function theEditFormShouldContainAFieldsetNamedAfterTheFieldDefinition($fieldTypeIdentifier) + public function theEditFormShouldContainAFieldsetNamedAfterTheFieldDefinition(string $fieldTypeIdentifier): void { $this->assertSession()->elementTextContains( 'css', @@ -118,7 +118,7 @@ public function theEditFormShouldContainAFieldsetNamedAfterTheFieldDefinition($f /** * @Given it should contain a :type input field */ - public function itShouldContainAGivenTypeInputField($inputType) + public function itShouldContainAGivenTypeInputField($inputType): void { $this->assertSession()->elementExists( 'css', @@ -134,7 +134,7 @@ public function itShouldContainAGivenTypeInputField($inputType) /** * @Given /^it should contain the following set of labels, and input fields of the following types:$/ */ - public function itShouldContainTheFollowingSetOfLabelsAndInputFieldsTypes(TableNode $table) + public function itShouldContainTheFollowingSetOfLabelsAndInputFieldsTypes(TableNode $table): void { $inputNodeElements = $this->getSession()->getPage()->findAll( 'css', @@ -162,7 +162,7 @@ public function itShouldContainTheFollowingSetOfLabelsAndInputFieldsTypes(TableN * @Given /^the field definition is required$/ * @Given /^the field definition is marked as required$/ */ - public function theFieldDefinitionIsMarkedAsRequired() + public function theFieldDefinitionIsMarkedAsRequired(): void { $this->contentTypeContext->updateFieldDefinition( self::$fieldIdentifier, @@ -173,7 +173,7 @@ public function theFieldDefinitionIsMarkedAsRequired() /** * @Then the value input fields for :fieldIdentifier field should be flagged as required */ - public function theInputFieldsShouldBeFlaggedAsRequired(string $fieldTypeIdentifier) + public function theInputFieldsShouldBeFlaggedAsRequired(string $fieldTypeIdentifier): void { $inputNodeElements = $this->getSession()->getPage()->findAll( 'css', @@ -212,7 +212,7 @@ public function theInputFieldsShouldBeFlaggedAsRequired(string $fieldTypeIdentif * @param $option string The field definition option * @param $value mixed The option value */ - public function setFieldDefinitionOption($option, $value) + public function setFieldDefinitionOption($option, $value): void { $this->contentTypeContext->updateFieldDefinition( self::$fieldIdentifier, diff --git a/src/lib/Behat/Context/PagelayoutContext.php b/src/lib/Behat/Context/PagelayoutContext.php index 755a2ae6..7c40084b 100644 --- a/src/lib/Behat/Context/PagelayoutContext.php +++ b/src/lib/Behat/Context/PagelayoutContext.php @@ -19,10 +19,7 @@ class PagelayoutContext extends RawMinkContext implements Context, SnippetAccept /** @var string Regex matching the way the Twig template name is inserted in debug mode */ public const TWIG_DEBUG_STOP_REGEX = ''; - /** - * @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface - */ - private $configResolver; + private ConfigResolverInterface $configResolver; public function __construct(ConfigResolverInterface $configResolver) { @@ -32,7 +29,7 @@ public function __construct(ConfigResolverInterface $configResolver) /** * @Given /^a pagelayout is configured$/ */ - public function aPagelayoutIsConfigured() + public function aPagelayoutIsConfigured(): void { Assertion::assertTrue($this->configResolver->hasParameter('page_layout')); } @@ -40,7 +37,7 @@ public function aPagelayoutIsConfigured() /** * @Then /^it is rendered using the configured pagelayout$/ */ - public function itIsRenderedUsingTheConfiguredPagelayout() + public function itIsRenderedUsingTheConfiguredPagelayout(): void { $pageLayout = $this->getPageLayout(); diff --git a/src/lib/Behat/Context/SelectionFieldTypeFormContext.php b/src/lib/Behat/Context/SelectionFieldTypeFormContext.php index 41493c7b..d525bef2 100644 --- a/src/lib/Behat/Context/SelectionFieldTypeFormContext.php +++ b/src/lib/Behat/Context/SelectionFieldTypeFormContext.php @@ -15,7 +15,7 @@ final class SelectionFieldTypeFormContext extends RawMinkContext implements SnippetAcceptingContext { - private static $fieldIdentifier = 'field'; + private static string $fieldIdentifier = 'field'; /** * @var \Ibexa\ContentForms\Behat\Context\FieldTypeFormContext @@ -23,7 +23,7 @@ final class SelectionFieldTypeFormContext extends RawMinkContext implements Snip private $fieldTypeFormContext; /** @BeforeScenario */ - public function gatherContexts(BeforeScenarioScope $scope) + public function gatherContexts(BeforeScenarioScope $scope): void { $this->fieldTypeFormContext = $scope->getEnvironment()->getContext(FieldTypeFormContext::class); } @@ -31,7 +31,7 @@ public function gatherContexts(BeforeScenarioScope $scope) /** * @Given /^the field definition is set to single choice$/ */ - public function setFieldDefinitionToSingleChoice() + public function setFieldDefinitionToSingleChoice(): void { $this->fieldTypeFormContext->setFieldDefinitionOption('isMultiple', false); } @@ -39,7 +39,7 @@ public function setFieldDefinitionToSingleChoice() /** * @Given /^the field definition is set to multiple choice$/ */ - public function setFieldDefinitionToMultipleChoice() + public function setFieldDefinitionToMultipleChoice(): void { $this->fieldTypeFormContext->setFieldDefinitionOption('isMultiple', true); } @@ -47,7 +47,7 @@ public function setFieldDefinitionToMultipleChoice() /** * @Then it should contain a select field */ - public function itShouldContainASelectField() + public function itShouldContainASelectField(): void { $this->assertSession()->elementExists( 'css', @@ -62,7 +62,7 @@ public function itShouldContainASelectField() /** * @Then the select field should be flagged as required */ - public function theSelectFieldShouldBeFlaggedAsRequired() + public function theSelectFieldShouldBeFlaggedAsRequired(): void { $nodeElements = $this->getSession()->getPage()->findAll( 'css', @@ -87,7 +87,7 @@ public function theSelectFieldShouldBeFlaggedAsRequired() /** * @Then the input is a single selection dropdown */ - public function theInputIsASingleSelectionDropdown() + public function theInputIsASingleSelectionDropdown(): void { $selector = sprintf( 'select[name="ezplatform_content_forms_content_edit[fieldsData][%s][value]"]', @@ -101,7 +101,7 @@ public function theInputIsASingleSelectionDropdown() /** * @Then the input is a multiple selection dropdown */ - public function theInputIsAMultipleSelectionDropdown() + public function theInputIsAMultipleSelectionDropdown(): void { $selector = sprintf( 'select[name="ezplatform_content_forms_content_edit[fieldsData][%s][value][]"][multiple=multiple]', diff --git a/src/lib/Behat/Context/UserRegistrationContext.php b/src/lib/Behat/Context/UserRegistrationContext.php index 6b4463f3..2bcc8a6d 100644 --- a/src/lib/Behat/Context/UserRegistrationContext.php +++ b/src/lib/Behat/Context/UserRegistrationContext.php @@ -35,13 +35,13 @@ class UserRegistrationContext extends RawMinkContext implements Context, Snippet */ public const TWIG_DEBUG_STOP_REGEX = ''; - private static $password = 'PassWord42'; + private static string $password = 'PassWord42'; - private static $language = 'eng-GB'; + private static string $language = 'eng-GB'; - private static $groupId = 4; + private static int $groupId = 4; - private $registrationUsername; + private ?string $registrationUsername = null; /** * Used to cover registration group customization. @@ -58,19 +58,15 @@ class UserRegistrationContext extends RawMinkContext implements Context, Snippet /** * Default Administrator user id. */ - private $adminUserId = 14; + private int $adminUserId = 14; - /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver */ - private $permissionResolver; + private PermissionResolver $permissionResolver; - /** @var \Ibexa\Contracts\Core\Repository\RoleService */ - private $roleService; + private RoleService $roleService; - /** @var \Ibexa\Contracts\Core\Repository\UserService */ - private $userService; + private UserService $userService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - private $contentTypeService; + private ContentTypeService $contentTypeService; public function __construct( PermissionResolver $permissionResolver, @@ -86,7 +82,7 @@ public function __construct( } /** @BeforeScenario */ - public function gatherContexts(BeforeScenarioScope $scope) + public function gatherContexts(BeforeScenarioScope $scope): void { $this->yamlConfigurationContext = $scope->getEnvironment()->getContext(YamlConfigurationContext::class); } @@ -94,7 +90,7 @@ public function gatherContexts(BeforeScenarioScope $scope) /** * @Given /^I do not have the user\/register policy$/ */ - public function loginAsUserWithoutRegisterPolicy() + public function loginAsUserWithoutRegisterPolicy(): void { $role = $this->createRegistrationRole(false); $user = $this->createUserWithRole($role); @@ -104,7 +100,7 @@ public function loginAsUserWithoutRegisterPolicy() /** * @Given /^I do have the user\/register policy$/ */ - public function loginAsUserWithUserRegisterPolicy() + public function loginAsUserWithUserRegisterPolicy(): void { $role = $this->createRegistrationRole(true); $user = $this->createUserWithRole($role); @@ -145,7 +141,7 @@ private function createUserWithRole(Role $role) * * @return \Ibexa\Contracts\Core\Repository\Values\User\Role */ - private function createRegistrationRole($withUserRegisterPolicy = true) + private function createRegistrationRole(bool $withUserRegisterPolicy = true): Role { $roleIdentifier = uniqid( 'anonymous_role_' . ($withUserRegisterPolicy ? 'with' : 'without') . '_register', @@ -174,7 +170,7 @@ private function createRegistrationRole($withUserRegisterPolicy = true) /** * @Then /^I see an error message saying that I can not register$/ */ - public function iSeeAnErrorMessageSayingThatICanNotRegister() + public function iSeeAnErrorMessageSayingThatICanNotRegister(): void { $this->assertSession()->pageTextContains('You are not allowed to register a new account'); } @@ -184,7 +180,7 @@ public function iSeeAnErrorMessageSayingThatICanNotRegister() * * @throws \Behat\Mink\Exception\ElementNotFoundException */ - private function loginAs(User $user) + private function loginAs(User $user): void { $this->visitPath('/login'); $page = $this->getSession()->getPage(); @@ -197,7 +193,7 @@ private function loginAs(User $user) /** * @Then /^I can see the registration form$/ */ - public function iCanSeeTheRegistrationForm() + public function iCanSeeTheRegistrationForm(): void { $this->assertSession()->pageTextNotContains('You are not allowed to register a new account'); $this->assertSession()->elementExists('css', 'form[name=ezplatform_content_forms_user_register]'); @@ -206,7 +202,7 @@ public function iCanSeeTheRegistrationForm() /** * @Given /^it matches the structure of the configured registration user content type$/ */ - public function itMatchesTheStructureOfTheConfiguredRegistrationUserContentType() + public function itMatchesTheStructureOfTheConfiguredRegistrationUserContentType(): void { $userContentType = $this->contentTypeService->loadContentTypeByIdentifier('user'); foreach ($userContentType->getFieldDefinitions() as $fieldDefinition) { @@ -224,7 +220,7 @@ public function itMatchesTheStructureOfTheConfiguredRegistrationUserContentType( /** * @Given /^it has a register button$/ */ - public function itHasARegisterButton() + public function itHasARegisterButton(): void { $this->assertSession()->elementExists( 'css', @@ -235,7 +231,7 @@ public function itHasARegisterButton() /** * @When /^I fill in the form with valid values$/ */ - public function iFillInTheFormWithValidValues() + public function iFillInTheFormWithValidValues(): void { $page = $this->getSession()->getPage(); @@ -252,7 +248,7 @@ public function iFillInTheFormWithValidValues() /** * @When /^I click on the register button$/ */ - public function iClickOnTheRegisterButton() + public function iClickOnTheRegisterButton(): void { $this->getSession()->getPage()->pressButton('ezplatform_content_forms_user_register[register]'); $this->assertSession()->statusCodeEquals(200); @@ -261,7 +257,7 @@ public function iClickOnTheRegisterButton() /** * @Then /^I am on the registration confirmation page$/ */ - public function iAmOnTheRegistrationConfirmationPage() + public function iAmOnTheRegistrationConfirmationPage(): void { $this->assertSession()->addressEquals('/register-confirm'); } @@ -269,7 +265,7 @@ public function iAmOnTheRegistrationConfirmationPage() /** * @Given /^I see a registration confirmation message$/ */ - public function iSeeARegistrationConfirmationMessage() + public function iSeeARegistrationConfirmationMessage(): void { $this->assertSession()->pageTextContains('Your account has been created'); } @@ -277,7 +273,7 @@ public function iSeeARegistrationConfirmationMessage() /** * @Given /^the user account has been created$/ */ - public function theUserAccountHasBeenCreated() + public function theUserAccountHasBeenCreated(): void { $this->userService->loadUserByLogin($this->registrationUsername); } @@ -285,7 +281,7 @@ public function theUserAccountHasBeenCreated() /** * @Given a User Group :userGroupName */ - public function createUserGroup(string $userGroupName) + public function createUserGroup(string $userGroupName): void { $groupCreateStruct = $this->userService->newUserGroupCreateStruct(self::$language); $groupCreateStruct->setField('name', $userGroupName); @@ -298,7 +294,7 @@ public function createUserGroup(string $userGroupName) /** * @Given /^the following user registration group configuration:$/ */ - public function addUserRegistrationConfiguration(PyStringNode $extraConfigurationString) + public function addUserRegistrationConfiguration(PyStringNode $extraConfigurationString): void { $extraConfigurationString = str_replace( '', @@ -312,7 +308,7 @@ public function addUserRegistrationConfiguration(PyStringNode $extraConfiguratio /** * @When /^I register a user account$/ */ - public function iRegisterAUserAccount() + public function iRegisterAUserAccount(): void { $this->loginAsUserWithUserRegisterPolicy(); $this->visitPath('/register'); @@ -326,7 +322,7 @@ public function iRegisterAUserAccount() /** * @Then /^the user is created in :userGroupName user group$/ */ - public function theUserIsCreatedInThisUserGroup(string $userGroupName) + public function theUserIsCreatedInThisUserGroup(string $userGroupName): void { $user = $this->userService->loadUserByLogin($this->registrationUsername); $userGroups = $this->userService->loadUserGroupsOfUser($user); @@ -340,7 +336,7 @@ public function theUserIsCreatedInThisUserGroup(string $userGroupName) /** * @Given /^the following user registration templates configuration:$/ */ - public function addRegistrationTemplatesConfiguration(PyStringNode $pyStringNode) + public function addRegistrationTemplatesConfiguration(PyStringNode $pyStringNode): void { $this->yamlConfigurationContext->addConfiguration(Yaml::parse((string) $pyStringNode)); } @@ -348,7 +344,7 @@ public function addRegistrationTemplatesConfiguration(PyStringNode $pyStringNode /** * @Given /^the following template in "([^"]*)":$/ */ - public function createTemplateAt($path, PyStringNode $contents) + public function createTemplateAt(string $path, PyStringNode $contents): void { $fs = new Filesystem(); $fs->mkdir(dirname($path)); @@ -364,7 +360,7 @@ public function createTemplateAt($path, PyStringNode $contents) * If relative to app/Resources/views (example: user/register.html.twig), * the path is checked with the :path:file.html.twig syntax as well. */ - public function thePageIsRenderedUsingTheTemplateConfiguredIn($template) + public function thePageIsRenderedUsingTheTemplateConfiguredIn($template): void { $html = $this->getSession()->getPage()->getOuterHtml(); $searchedPattern = sprintf(self::TWIG_DEBUG_STOP_REGEX, preg_quote($template, null)); diff --git a/src/lib/Content/View/Builder/AbstractContentViewBuilder.php b/src/lib/Content/View/Builder/AbstractContentViewBuilder.php index a438272a..775d990f 100644 --- a/src/lib/Content/View/Builder/AbstractContentViewBuilder.php +++ b/src/lib/Content/View/Builder/AbstractContentViewBuilder.php @@ -25,29 +25,21 @@ */ abstract class AbstractContentViewBuilder { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - protected $repository; + protected Repository $repository; - /** @var \Ibexa\Core\MVC\Symfony\View\Configurator */ - protected $viewConfigurator; + protected Configurator $viewConfigurator; - /** @var \Ibexa\Core\MVC\Symfony\View\ParametersInjector */ - protected $viewParametersInjector; + protected ParametersInjector $viewParametersInjector; - /** @var \Ibexa\ContentForms\Form\ActionDispatcher\ActionDispatcherInterface */ - protected $contentActionDispatcher; + protected ActionDispatcherInterface $contentActionDispatcher; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ - protected $languagePreferenceProvider; + protected UserLanguagePreferenceProviderInterface $languagePreferenceProvider; - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - protected $configResolver; + protected ConfigResolverInterface $configResolver; - /** @var \Ibexa\Contracts\ContentForms\Content\Form\Provider\GroupedContentFormFieldsProviderInterface */ - protected $groupedContentFormFieldsProvider; + protected GroupedContentFormFieldsProviderInterface $groupedContentFormFieldsProvider; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - protected $contentService; + protected ContentService $contentService; public function __construct( Repository $repository, diff --git a/src/lib/Content/View/ContentCreateSuccessView.php b/src/lib/Content/View/ContentCreateSuccessView.php index 14f88044..24ef3966 100644 --- a/src/lib/Content/View/ContentCreateSuccessView.php +++ b/src/lib/Content/View/ContentCreateSuccessView.php @@ -17,7 +17,7 @@ class ContentCreateSuccessView extends BaseView implements LocationValueView { /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ - private $location; + private ?Location $location = null; /** * @param \Symfony\Component\HttpFoundation\Response $response diff --git a/src/lib/Content/View/ContentCreateView.php b/src/lib/Content/View/ContentCreateView.php index 4d4ba1cb..fdcb9527 100644 --- a/src/lib/Content/View/ContentCreateView.php +++ b/src/lib/Content/View/ContentCreateView.php @@ -18,21 +18,21 @@ class ContentCreateView extends BaseView implements LocationValueView, ContentTypeValueView { /** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType */ - private $contentType; + private ContentType $contentType; /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location */ - private $location; + private Location $location; /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ - private $language; + private Language $language; /** @var \Symfony\Component\Form\FormInterface */ - private $form; + private FormInterface $form; /** * @param \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType $contentType */ - public function setContentType(ContentType $contentType) + public function setContentType(ContentType $contentType): void { $this->contentType = $contentType; } @@ -48,7 +48,7 @@ public function getContentType(): ContentType /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location */ - public function setLocation(Location $location) + public function setLocation(Location $location): void { $this->location = $location; } @@ -72,7 +72,7 @@ public function getLanguage(): Language /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language $language */ - public function setLanguage(Language $language) + public function setLanguage(Language $language): void { $this->language = $language; } @@ -88,7 +88,7 @@ public function getForm(): FormInterface /** * @param \Symfony\Component\Form\FormInterface $form */ - public function setForm(FormInterface $form) + public function setForm(FormInterface $form): void { $this->form = $form; } diff --git a/src/lib/Content/View/ContentEditSuccessView.php b/src/lib/Content/View/ContentEditSuccessView.php index 580e6144..ebec29ee 100644 --- a/src/lib/Content/View/ContentEditSuccessView.php +++ b/src/lib/Content/View/ContentEditSuccessView.php @@ -17,7 +17,7 @@ class ContentEditSuccessView extends BaseView implements LocationValueView { /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ - private $location; + private ?Location $location = null; /** * @param \Symfony\Component\HttpFoundation\Response $response diff --git a/src/lib/Content/View/ContentEditView.php b/src/lib/Content/View/ContentEditView.php index 8dbcd7c7..240da933 100644 --- a/src/lib/Content/View/ContentEditView.php +++ b/src/lib/Content/View/ContentEditView.php @@ -19,21 +19,21 @@ class ContentEditView extends BaseView implements ContentValueView, LocationValueView { /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - private $content; + private Content $content; /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Location|null */ - private $location; + private ?Location $location = null; /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Language */ - private $language; + private Language $language; /** @var \Symfony\Component\Form\FormInterface */ - private $form; + private FormInterface $form; /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content */ - public function setContent(Content $content) + public function setContent(Content $content): void { $this->content = $content; } @@ -51,7 +51,7 @@ public function getContent(): Content /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location|null $location */ - public function setLocation(?Location $location) + public function setLocation(?Location $location): void { $this->location = $location; } @@ -75,7 +75,7 @@ public function getLanguage(): Language /** * @param \Ibexa\Contracts\Core\Repository\Values\Content\Language $language */ - public function setLanguage(Language $language) + public function setLanguage(Language $language): void { $this->language = $language; } @@ -91,7 +91,7 @@ public function getForm(): FormInterface /** * @param \Symfony\Component\Form\FormInterface $form */ - public function setForm(FormInterface $form) + public function setForm(FormInterface $form): void { $this->form = $form; } diff --git a/src/lib/Content/View/Filter/ContentCreateViewFilter.php b/src/lib/Content/View/Filter/ContentCreateViewFilter.php index 4e9a1d7f..b3940906 100644 --- a/src/lib/Content/View/Filter/ContentCreateViewFilter.php +++ b/src/lib/Content/View/Filter/ContentCreateViewFilter.php @@ -24,17 +24,13 @@ class ContentCreateViewFilter implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - private $locationService; + private LocationService $locationService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - private $contentTypeService; + private ContentTypeService $contentTypeService; - /** @var \Symfony\Component\Form\FormFactoryInterface */ - private $formFactory; + private FormFactoryInterface $formFactory; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ - private $languagePreferenceProvider; + private UserLanguagePreferenceProviderInterface $languagePreferenceProvider; /** * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService @@ -66,7 +62,7 @@ public static function getSubscribedEvents(): array * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function handleContentCreateForm(FilterViewBuilderParametersEvent $event) + public function handleContentCreateForm(FilterViewBuilderParametersEvent $event): void { if ('ibexa_content_edit::createWithoutDraftAction' !== $event->getParameters()->get('_controller')) { return; diff --git a/src/lib/Content/View/Filter/ContentEditViewFilter.php b/src/lib/Content/View/Filter/ContentEditViewFilter.php index 15b96226..29ff70ba 100644 --- a/src/lib/Content/View/Filter/ContentEditViewFilter.php +++ b/src/lib/Content/View/Filter/ContentEditViewFilter.php @@ -27,17 +27,13 @@ class ContentEditViewFilter implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - private $contentTypeService; + private ContentTypeService $contentTypeService; - /** @var \Symfony\Component\Form\FormFactoryInterface */ - private $formFactory; + private FormFactoryInterface $formFactory; - /** @var \Ibexa\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface */ - private $languagePreferenceProvider; + private UserLanguagePreferenceProviderInterface $languagePreferenceProvider; private LocationService $locationService; @@ -73,7 +69,7 @@ public static function getSubscribedEvents(): array * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function handleContentEditForm(FilterViewBuilderParametersEvent $event) + public function handleContentEditForm(FilterViewBuilderParametersEvent $event): void { if ('ibexa_content_edit::editVersionDraftAction' !== $event->getParameters()->get('_controller')) { return; diff --git a/src/lib/Content/View/Provider/ContentCreateView/Configured.php b/src/lib/Content/View/Provider/ContentCreateView/Configured.php index 59842a89..0042e7f1 100644 --- a/src/lib/Content/View/Provider/ContentCreateView/Configured.php +++ b/src/lib/Content/View/Provider/ContentCreateView/Configured.php @@ -19,10 +19,7 @@ */ class Configured implements ViewProvider { - /** - * @var \Ibexa\Core\MVC\Symfony\Matcher\MatcherFactoryInterface - */ - protected $matcherFactory; + protected MatcherFactoryInterface $matcherFactory; /** * @param \Ibexa\Core\MVC\Symfony\Matcher\MatcherFactoryInterface $matcherFactory diff --git a/src/lib/Content/View/Provider/ContentEditView/Configured.php b/src/lib/Content/View/Provider/ContentEditView/Configured.php index 3ed09718..c3f6343f 100644 --- a/src/lib/Content/View/Provider/ContentEditView/Configured.php +++ b/src/lib/Content/View/Provider/ContentEditView/Configured.php @@ -19,10 +19,7 @@ */ class Configured implements ViewProvider { - /** - * @var \Ibexa\Core\MVC\Symfony\Matcher\MatcherFactoryInterface - */ - protected $matcherFactory; + protected MatcherFactoryInterface $matcherFactory; /** * @param \Ibexa\Core\MVC\Symfony\Matcher\MatcherFactoryInterface $matcherFactory diff --git a/src/lib/Data/Content/ContentCreateData.php b/src/lib/Data/Content/ContentCreateData.php index bdb7bcc0..0f110567 100644 --- a/src/lib/Data/Content/ContentCreateData.php +++ b/src/lib/Data/Content/ContentCreateData.php @@ -22,9 +22,9 @@ class ContentCreateData extends ContentCreateStruct implements NewnessCheckable /** * @var \Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct[] */ - private $locationStructs; + private ?array $locationStructs = null; - public function isNew() + public function isNew(): bool { return true; } @@ -43,7 +43,7 @@ public function getLocationStructs() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct $locationStruct */ - public function addLocationStruct(LocationCreateStruct $locationStruct) + public function addLocationStruct(LocationCreateStruct $locationStruct): void { $this->locationStructs[] = $locationStruct; } diff --git a/src/lib/Data/Content/ContentData.php b/src/lib/Data/Content/ContentData.php index 923f265c..3af02ddd 100644 --- a/src/lib/Data/Content/ContentData.php +++ b/src/lib/Data/Content/ContentData.php @@ -17,7 +17,7 @@ trait ContentData */ protected $fieldsData; - public function addFieldData(FieldData $fieldData) + public function addFieldData(FieldData $fieldData): void { $this->fieldsData[$fieldData->fieldDefinition->identifier] = $fieldData; } diff --git a/src/lib/Data/Content/ContentUpdateData.php b/src/lib/Data/Content/ContentUpdateData.php index e7084af8..00fafb63 100644 --- a/src/lib/Data/Content/ContentUpdateData.php +++ b/src/lib/Data/Content/ContentUpdateData.php @@ -21,7 +21,7 @@ class ContentUpdateData extends ContentUpdateStruct implements NewnessCheckable protected $contentDraft; - public function isNew() + public function isNew(): bool { return false; } diff --git a/src/lib/Data/Mapper/ContentCreateMapper.php b/src/lib/Data/Mapper/ContentCreateMapper.php index cae8ef2d..27615813 100644 --- a/src/lib/Data/Mapper/ContentCreateMapper.php +++ b/src/lib/Data/Mapper/ContentCreateMapper.php @@ -27,7 +27,7 @@ class ContentCreateMapper implements FormDataMapperInterface * * @return \Ibexa\ContentForms\Data\Content\ContentCreateData */ - public function mapToFormData(ValueObject $contentType, array $params = []) + public function mapToFormData(ValueObject $contentType, array $params = []): ContentCreateData { $resolver = new OptionsResolver(); $this->configureOptions($resolver); @@ -49,7 +49,7 @@ public function mapToFormData(ValueObject $contentType, array $params = []) return $data; } - private function configureOptions(OptionsResolver $optionsResolver) + private function configureOptions(OptionsResolver $optionsResolver): void { $optionsResolver ->setRequired(['mainLanguageCode', 'parentLocation']) diff --git a/src/lib/Data/Mapper/ContentUpdateMapper.php b/src/lib/Data/Mapper/ContentUpdateMapper.php index bdb6e0e1..65edf630 100644 --- a/src/lib/Data/Mapper/ContentUpdateMapper.php +++ b/src/lib/Data/Mapper/ContentUpdateMapper.php @@ -24,7 +24,7 @@ class ContentUpdateMapper implements FormDataMapperInterface * * @return \Ibexa\ContentForms\Data\Content\ContentUpdateData */ - public function mapToFormData(ValueObject $contentDraft, array $params = []) + public function mapToFormData(ValueObject $contentDraft, array $params = []): ContentUpdateData { $optionsResolver = new OptionsResolver(); $this->configureOptions($optionsResolver); @@ -58,7 +58,7 @@ public function mapToFormData(ValueObject $contentDraft, array $params = []) return $data; } - private function configureOptions(OptionsResolver $optionsResolver) + private function configureOptions(OptionsResolver $optionsResolver): void { $optionsResolver ->setRequired(['languageCode', 'contentType', 'currentFields']) diff --git a/src/lib/Data/Mapper/UserUpdateMapper.php b/src/lib/Data/Mapper/UserUpdateMapper.php index 2afc24db..88f387e4 100644 --- a/src/lib/Data/Mapper/UserUpdateMapper.php +++ b/src/lib/Data/Mapper/UserUpdateMapper.php @@ -67,7 +67,7 @@ public function mapToFormData(User $user, ContentType $contentType, array $param return $data; } - private function configureOptions(OptionsResolver $optionsResolver) + private function configureOptions(OptionsResolver $optionsResolver): void { $optionsResolver->define('filter')->allowedTypes('callable', 'null')->default(null); $optionsResolver->setRequired(['languageCode']); diff --git a/src/lib/Data/NewnessChecker.php b/src/lib/Data/NewnessChecker.php index 33241e7d..1c05a22c 100644 --- a/src/lib/Data/NewnessChecker.php +++ b/src/lib/Data/NewnessChecker.php @@ -19,7 +19,7 @@ trait NewnessChecker * * @return bool */ - public function isNew() + public function isNew(): bool { return strpos($this->getIdentifierValue(), '__new__') === 0; } diff --git a/src/lib/Data/User/UserCreateData.php b/src/lib/Data/User/UserCreateData.php index 04fdb28e..9724164f 100644 --- a/src/lib/Data/User/UserCreateData.php +++ b/src/lib/Data/User/UserCreateData.php @@ -25,13 +25,13 @@ class UserCreateData extends UserCreateStruct implements NewnessCheckable /** * @var \Ibexa\Contracts\Core\Repository\Values\User\UserGroup[] */ - private $parentGroups; + private ?array $parentGroups = null; private ?Role $role = null; private ?RoleLimitation $roleLimitation = null; - public function isNew() + public function isNew(): bool { return true; } @@ -49,7 +49,7 @@ public function getParentGroups() * * @param \Ibexa\Contracts\Core\Repository\Values\User\UserGroup $parentGroup */ - public function addParentGroup(UserGroup $parentGroup) + public function addParentGroup(UserGroup $parentGroup): void { $this->parentGroups[] = $parentGroup; } @@ -57,7 +57,7 @@ public function addParentGroup(UserGroup $parentGroup) /** * @param \Ibexa\Contracts\Core\Repository\Values\User\UserGroup[] $parentGroups */ - public function setParentGroups(array $parentGroups) + public function setParentGroups(array $parentGroups): void { $this->parentGroups = $parentGroups; } diff --git a/src/lib/Data/User/UserUpdateData.php b/src/lib/Data/User/UserUpdateData.php index a7bcf96d..48fe4951 100644 --- a/src/lib/Data/User/UserUpdateData.php +++ b/src/lib/Data/User/UserUpdateData.php @@ -30,7 +30,7 @@ class UserUpdateData extends UserUpdateStruct implements NewnessCheckable */ public $contentType; - public function isNew() + public function isNew(): bool { return false; } diff --git a/src/lib/Event/ContentCreateFieldOptionsEvent.php b/src/lib/Event/ContentCreateFieldOptionsEvent.php index f1c495b2..2375d406 100644 --- a/src/lib/Event/ContentCreateFieldOptionsEvent.php +++ b/src/lib/Event/ContentCreateFieldOptionsEvent.php @@ -14,8 +14,7 @@ final class ContentCreateFieldOptionsEvent extends StructFieldOptionsEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct */ - private $contentCreateStruct; + private ContentCreateStruct $contentCreateStruct; public function __construct( ContentCreateStruct $contentCreateStruct, diff --git a/src/lib/Event/ContentUpdateFieldOptionsEvent.php b/src/lib/Event/ContentUpdateFieldOptionsEvent.php index d2194d0a..4c8499ae 100644 --- a/src/lib/Event/ContentUpdateFieldOptionsEvent.php +++ b/src/lib/Event/ContentUpdateFieldOptionsEvent.php @@ -15,11 +15,9 @@ final class ContentUpdateFieldOptionsEvent extends StructFieldOptionsEvent { - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Content */ - private $content; + private Content $content; - /** @var \Ibexa\Contracts\Core\Repository\Values\Content\ContentUpdateStruct */ - private $contentUpdateStruct; + private ContentUpdateStruct $contentUpdateStruct; public function __construct( Content $content, diff --git a/src/lib/Event/FormActionEvent.php b/src/lib/Event/FormActionEvent.php index e28f1d07..4c966710 100644 --- a/src/lib/Event/FormActionEvent.php +++ b/src/lib/Event/FormActionEvent.php @@ -23,24 +23,18 @@ class FormActionEvent extends FormEvent /** * Hash of options. - * - * @var array */ - private $options; + private array $options; /** * Response to return after form post-processing. Typically a RedirectResponse. - * - * @var \Symfony\Component\HttpFoundation\Response */ - private $response; + private ?Response $response = null; /** * Additional payload populated for event listeners next in priority. - * - * @var array */ - private $payloads; + private array $payloads; /** * @param \Symfony\Component\Form\FormInterface $form @@ -49,7 +43,7 @@ class FormActionEvent extends FormEvent * @param array $options * @param array $payloads */ - public function __construct(FormInterface $form, $data, $clickedButton, array $options = [], array $payloads = []) + public function __construct(FormInterface $form, mixed $data, $clickedButton, array $options = [], array $payloads = []) { parent::__construct($form, $data); $this->clickedButton = $clickedButton; @@ -93,7 +87,7 @@ public function getOption($optionName, $defaultValue = null) * * @return bool */ - public function hasOption($optionName) + public function hasOption($optionName): bool { return isset($this->options[$optionName]); } @@ -109,12 +103,12 @@ public function getResponse() /** * @param \Symfony\Component\HttpFoundation\Response $response */ - public function setResponse(Response $response) + public function setResponse(Response $response): void { $this->response = $response; } - public function hasResponse() + public function hasResponse(): bool { return $this->response !== null; } diff --git a/src/lib/EventListener/ViewTemplatesListener.php b/src/lib/EventListener/ViewTemplatesListener.php index f73b6d65..8f12b612 100644 --- a/src/lib/EventListener/ViewTemplatesListener.php +++ b/src/lib/EventListener/ViewTemplatesListener.php @@ -22,8 +22,7 @@ */ class ViewTemplatesListener implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface */ - private $configResolver; + private ConfigResolverInterface $configResolver; public function __construct(ConfigResolverInterface $configResolver) { diff --git a/src/lib/FieldType/DataTransformer/AbstractBinaryBaseTransformer.php b/src/lib/FieldType/DataTransformer/AbstractBinaryBaseTransformer.php index 6cfe316d..bea14f10 100644 --- a/src/lib/FieldType/DataTransformer/AbstractBinaryBaseTransformer.php +++ b/src/lib/FieldType/DataTransformer/AbstractBinaryBaseTransformer.php @@ -19,11 +19,9 @@ */ abstract class AbstractBinaryBaseTransformer { - /** @var \Ibexa\Contracts\Core\Repository\FieldType */ - protected $fieldType; + protected FieldType $fieldType; - /** @var \Ibexa\Core\FieldType\Value */ - protected $initialValue; + protected Value $initialValue; /** @var string */ protected $valueClass; diff --git a/src/lib/FieldType/DataTransformer/FieldValueTransformer.php b/src/lib/FieldType/DataTransformer/FieldValueTransformer.php index a77cb759..96b1ba1c 100644 --- a/src/lib/FieldType/DataTransformer/FieldValueTransformer.php +++ b/src/lib/FieldType/DataTransformer/FieldValueTransformer.php @@ -18,10 +18,7 @@ */ class FieldValueTransformer implements DataTransformerInterface { - /** - * @var \Ibexa\Contracts\Core\Repository\FieldType - */ - private $fieldType; + private FieldType $fieldType; public function __construct(FieldType $fieldType) { diff --git a/src/lib/FieldType/DataTransformer/MultipleCountryValueTransformer.php b/src/lib/FieldType/DataTransformer/MultipleCountryValueTransformer.php index 9bca16e5..816d7924 100644 --- a/src/lib/FieldType/DataTransformer/MultipleCountryValueTransformer.php +++ b/src/lib/FieldType/DataTransformer/MultipleCountryValueTransformer.php @@ -20,7 +20,7 @@ class MultipleCountryValueTransformer implements DataTransformerInterface /** * @var array Array of countries from "ibexa.field_type.country.data" */ - protected $countriesInfo; + protected array $countriesInfo; /** * @param array $countriesInfo diff --git a/src/lib/FieldType/DataTransformer/SingleCountryValueTransformer.php b/src/lib/FieldType/DataTransformer/SingleCountryValueTransformer.php index f793aaff..f146c3d8 100644 --- a/src/lib/FieldType/DataTransformer/SingleCountryValueTransformer.php +++ b/src/lib/FieldType/DataTransformer/SingleCountryValueTransformer.php @@ -21,7 +21,7 @@ class SingleCountryValueTransformer implements DataTransformerInterface /** * @var array Array of countries from "ibexa.field_type.country.data" */ - protected $countriesInfo; + protected array $countriesInfo; /** * @param array $countriesInfo diff --git a/src/lib/FieldType/FieldTypeFormMapperDispatcher.php b/src/lib/FieldType/FieldTypeFormMapperDispatcher.php index 5781d5ac..ef6eccc4 100644 --- a/src/lib/FieldType/FieldTypeFormMapperDispatcher.php +++ b/src/lib/FieldType/FieldTypeFormMapperDispatcher.php @@ -24,7 +24,7 @@ class FieldTypeFormMapperDispatcher implements FieldTypeFormMapperDispatcherInte * * @var \Ibexa\Contracts\ContentForms\FieldType\FieldValueFormMapperInterface[] */ - private $mappers; + private array $mappers; /** * FieldTypeFormMapperDispatcher constructor. diff --git a/src/lib/FieldType/Mapper/AbstractRelationFormMapper.php b/src/lib/FieldType/Mapper/AbstractRelationFormMapper.php index a23a0dff..e1e6a10e 100644 --- a/src/lib/FieldType/Mapper/AbstractRelationFormMapper.php +++ b/src/lib/FieldType/Mapper/AbstractRelationFormMapper.php @@ -22,12 +22,12 @@ abstract class AbstractRelationFormMapper implements FieldValueFormMapperInterfa /** * @var \Ibexa\Contracts\Core\Repository\ContentTypeService Used to fetch list of available content types */ - protected $contentTypeService; + protected ContentTypeService $contentTypeService; /** * @var \Ibexa\Contracts\Core\Repository\LocationService Used to fetch selection root */ - protected $locationService; + protected LocationService $locationService; /** * @param \Ibexa\Contracts\Core\Repository\ContentTypeService $contentTypeService diff --git a/src/lib/FieldType/Mapper/AuthorFormMapper.php b/src/lib/FieldType/Mapper/AuthorFormMapper.php index f34a2f9f..69a1f6ea 100644 --- a/src/lib/FieldType/Mapper/AuthorFormMapper.php +++ b/src/lib/FieldType/Mapper/AuthorFormMapper.php @@ -22,7 +22,7 @@ class AuthorFormMapper implements FieldValueFormMapperInterface * @param \Symfony\Component\Form\FormInterface $fieldForm * @param \Ibexa\Contracts\ContentForms\Data\Content\FieldData $data */ - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $fieldSettings = $fieldDefinition->getFieldSettings(); diff --git a/src/lib/FieldType/Mapper/BinaryFileFormMapper.php b/src/lib/FieldType/Mapper/BinaryFileFormMapper.php index c3e86d96..06d2c249 100644 --- a/src/lib/FieldType/Mapper/BinaryFileFormMapper.php +++ b/src/lib/FieldType/Mapper/BinaryFileFormMapper.php @@ -18,15 +18,14 @@ class BinaryFileFormMapper implements FieldValueFormMapperInterface { - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ - private $fieldTypeService; + private FieldTypeService $fieldTypeService; public function __construct(FieldTypeService $fieldTypeService) { $this->fieldTypeService = $fieldTypeService; } - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/CheckboxFormMapper.php b/src/lib/FieldType/Mapper/CheckboxFormMapper.php index 775428c0..7bda50f2 100644 --- a/src/lib/FieldType/Mapper/CheckboxFormMapper.php +++ b/src/lib/FieldType/Mapper/CheckboxFormMapper.php @@ -18,7 +18,7 @@ */ class CheckboxFormMapper implements FieldValueFormMapperInterface { - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/CountryFormMapper.php b/src/lib/FieldType/Mapper/CountryFormMapper.php index 0e1c91e8..92dbb389 100644 --- a/src/lib/FieldType/Mapper/CountryFormMapper.php +++ b/src/lib/FieldType/Mapper/CountryFormMapper.php @@ -15,7 +15,7 @@ class CountryFormMapper implements FieldValueFormMapperInterface { - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $fieldSettings = $fieldDefinition->getFieldSettings(); diff --git a/src/lib/FieldType/Mapper/DateFormMapper.php b/src/lib/FieldType/Mapper/DateFormMapper.php index 464dbbea..76034de4 100644 --- a/src/lib/FieldType/Mapper/DateFormMapper.php +++ b/src/lib/FieldType/Mapper/DateFormMapper.php @@ -18,7 +18,7 @@ */ class DateFormMapper implements FieldValueFormMapperInterface { - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/DateTimeFormMapper.php b/src/lib/FieldType/Mapper/DateTimeFormMapper.php index fc9533d5..fc5ba2ee 100644 --- a/src/lib/FieldType/Mapper/DateTimeFormMapper.php +++ b/src/lib/FieldType/Mapper/DateTimeFormMapper.php @@ -18,7 +18,7 @@ */ class DateTimeFormMapper implements FieldValueFormMapperInterface { - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $fieldSettings = $fieldDefinition->getFieldSettings(); diff --git a/src/lib/FieldType/Mapper/FloatFormMapper.php b/src/lib/FieldType/Mapper/FloatFormMapper.php index a4d7c22f..6c0203c8 100644 --- a/src/lib/FieldType/Mapper/FloatFormMapper.php +++ b/src/lib/FieldType/Mapper/FloatFormMapper.php @@ -18,7 +18,7 @@ */ class FloatFormMapper implements FieldValueFormMapperInterface { - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/FormTypeBasedFieldValueFormMapper.php b/src/lib/FieldType/Mapper/FormTypeBasedFieldValueFormMapper.php index 6217a37a..ae4106e0 100644 --- a/src/lib/FieldType/Mapper/FormTypeBasedFieldValueFormMapper.php +++ b/src/lib/FieldType/Mapper/FormTypeBasedFieldValueFormMapper.php @@ -39,17 +39,14 @@ final class FormTypeBasedFieldValueFormMapper implements FieldValueFormMapperInt */ private $formType; - /** - * @var \Ibexa\Contracts\Core\Repository\FieldTypeService - */ - private $fieldTypeService; + private FieldTypeService $fieldTypeService; public function __construct(FieldTypeService $fieldTypeService) { $this->fieldTypeService = $fieldTypeService; } - public function setFormType($formType) + public function setFormType($formType): void { $this->formType = $formType; } @@ -60,7 +57,7 @@ public function setFormType($formType) * @param \Symfony\Component\Form\FormInterface $fieldForm form for the current Field * @param \Ibexa\Contracts\ContentForms\Data\Content\FieldData $data underlying data for current Field form */ - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/ISBNFormMapper.php b/src/lib/FieldType/Mapper/ISBNFormMapper.php index 53a1fd54..71a286f4 100644 --- a/src/lib/FieldType/Mapper/ISBNFormMapper.php +++ b/src/lib/FieldType/Mapper/ISBNFormMapper.php @@ -15,7 +15,7 @@ class ISBNFormMapper implements FieldValueFormMapperInterface { - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/ImageAssetFormMapper.php b/src/lib/FieldType/Mapper/ImageAssetFormMapper.php index 71ad8efa..396ffb47 100644 --- a/src/lib/FieldType/Mapper/ImageAssetFormMapper.php +++ b/src/lib/FieldType/Mapper/ImageAssetFormMapper.php @@ -18,8 +18,7 @@ class ImageAssetFormMapper implements FieldValueFormMapperInterface { - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ - private $fieldTypeService; + private FieldTypeService $fieldTypeService; /** * @param \Ibexa\Contracts\Core\Repository\FieldTypeService $fieldTypeService diff --git a/src/lib/FieldType/Mapper/ImageFormMapper.php b/src/lib/FieldType/Mapper/ImageFormMapper.php index c26474b3..f034c0b6 100644 --- a/src/lib/FieldType/Mapper/ImageFormMapper.php +++ b/src/lib/FieldType/Mapper/ImageFormMapper.php @@ -18,15 +18,14 @@ class ImageFormMapper implements FieldValueFormMapperInterface { - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ - private $fieldTypeService; + private FieldTypeService $fieldTypeService; public function __construct(FieldTypeService $fieldTypeService) { $this->fieldTypeService = $fieldTypeService; } - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/IntegerFormMapper.php b/src/lib/FieldType/Mapper/IntegerFormMapper.php index 4d73559b..c50e5fbf 100644 --- a/src/lib/FieldType/Mapper/IntegerFormMapper.php +++ b/src/lib/FieldType/Mapper/IntegerFormMapper.php @@ -18,7 +18,7 @@ */ class IntegerFormMapper implements FieldValueFormMapperInterface { - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/KeywordFormMapper.php b/src/lib/FieldType/Mapper/KeywordFormMapper.php index f9bc2847..7525bb51 100644 --- a/src/lib/FieldType/Mapper/KeywordFormMapper.php +++ b/src/lib/FieldType/Mapper/KeywordFormMapper.php @@ -18,7 +18,7 @@ */ class KeywordFormMapper implements FieldValueFormMapperInterface { - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/MapLocationFormMapper.php b/src/lib/FieldType/Mapper/MapLocationFormMapper.php index 1ed2a3cc..e8f920b7 100644 --- a/src/lib/FieldType/Mapper/MapLocationFormMapper.php +++ b/src/lib/FieldType/Mapper/MapLocationFormMapper.php @@ -18,7 +18,7 @@ */ class MapLocationFormMapper implements FieldValueFormMapperInterface { - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/MediaFormMapper.php b/src/lib/FieldType/Mapper/MediaFormMapper.php index 8f3e046d..bb028b23 100644 --- a/src/lib/FieldType/Mapper/MediaFormMapper.php +++ b/src/lib/FieldType/Mapper/MediaFormMapper.php @@ -19,8 +19,7 @@ class MediaFormMapper implements FieldValueFormMapperInterface { - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ - private $fieldTypeService; + private FieldTypeService $fieldTypeService; protected const ACCEPT_VIDEO = 'video/*'; protected const ACCEPT_AUDIO = 'audio/*'; @@ -30,7 +29,7 @@ public function __construct(FieldTypeService $fieldTypeService) $this->fieldTypeService = $fieldTypeService; } - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/RelationFormMapper.php b/src/lib/FieldType/Mapper/RelationFormMapper.php index 3fd84cfd..8ea8e266 100644 --- a/src/lib/FieldType/Mapper/RelationFormMapper.php +++ b/src/lib/FieldType/Mapper/RelationFormMapper.php @@ -14,7 +14,7 @@ class RelationFormMapper extends AbstractRelationFormMapper { - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/RelationListFormMapper.php b/src/lib/FieldType/Mapper/RelationListFormMapper.php index 26b5a0bb..f9442097 100644 --- a/src/lib/FieldType/Mapper/RelationListFormMapper.php +++ b/src/lib/FieldType/Mapper/RelationListFormMapper.php @@ -14,7 +14,7 @@ class RelationListFormMapper extends AbstractRelationFormMapper { - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/SelectionFormMapper.php b/src/lib/FieldType/Mapper/SelectionFormMapper.php index 1a7eec01..f656fddd 100644 --- a/src/lib/FieldType/Mapper/SelectionFormMapper.php +++ b/src/lib/FieldType/Mapper/SelectionFormMapper.php @@ -15,7 +15,7 @@ class SelectionFormMapper implements FieldValueFormMapperInterface { - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/TextBlockFormMapper.php b/src/lib/FieldType/Mapper/TextBlockFormMapper.php index 55aee1ec..0066b88e 100644 --- a/src/lib/FieldType/Mapper/TextBlockFormMapper.php +++ b/src/lib/FieldType/Mapper/TextBlockFormMapper.php @@ -18,7 +18,7 @@ */ class TextBlockFormMapper implements FieldValueFormMapperInterface { - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/TextLineFormMapper.php b/src/lib/FieldType/Mapper/TextLineFormMapper.php index a68a9997..7259bdbd 100644 --- a/src/lib/FieldType/Mapper/TextLineFormMapper.php +++ b/src/lib/FieldType/Mapper/TextLineFormMapper.php @@ -18,7 +18,7 @@ */ class TextLineFormMapper implements FieldValueFormMapperInterface { - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/TimeFormMapper.php b/src/lib/FieldType/Mapper/TimeFormMapper.php index 6ff91ae4..0e9bba7e 100644 --- a/src/lib/FieldType/Mapper/TimeFormMapper.php +++ b/src/lib/FieldType/Mapper/TimeFormMapper.php @@ -18,7 +18,7 @@ */ class TimeFormMapper implements FieldValueFormMapperInterface { - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $fieldSettings = $fieldDefinition->getFieldSettings(); diff --git a/src/lib/FieldType/Mapper/UrlFormMapper.php b/src/lib/FieldType/Mapper/UrlFormMapper.php index 15a81037..42b2e95d 100644 --- a/src/lib/FieldType/Mapper/UrlFormMapper.php +++ b/src/lib/FieldType/Mapper/UrlFormMapper.php @@ -22,7 +22,7 @@ class UrlFormMapper implements FieldValueFormMapperInterface * @param \Symfony\Component\Form\FormInterface $fieldForm * @param \Ibexa\Contracts\ContentForms\Data\Content\FieldData $data */ - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); diff --git a/src/lib/FieldType/Mapper/UserAccountFieldValueFormMapper.php b/src/lib/FieldType/Mapper/UserAccountFieldValueFormMapper.php index 0269cab3..2cf982a6 100644 --- a/src/lib/FieldType/Mapper/UserAccountFieldValueFormMapper.php +++ b/src/lib/FieldType/Mapper/UserAccountFieldValueFormMapper.php @@ -35,7 +35,7 @@ final class UserAccountFieldValueFormMapper implements FieldValueFormMapperInter * @throws \Symfony\Component\Form\Exception\UnexpectedTypeException * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException */ - public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) + public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void { $fieldDefinition = $data->fieldDefinition; $formConfig = $fieldForm->getConfig(); @@ -67,7 +67,7 @@ public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) * * @throws \Symfony\Component\OptionsResolver\Exception\AccessException */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver): void { $resolver ->setDefaults([ @@ -83,7 +83,7 @@ public function configureOptions(OptionsResolver $resolver) public function getModelTransformerForTranslation(FieldDefinition $fieldDefinition): CallbackTransformer { return new CallbackTransformer( - static function (ApiUserValue $data) { + static function (ApiUserValue $data): UserAccountFieldData { return new UserAccountFieldData($data->login, null, $data->email, $data->enabled); }, static function (UserAccountFieldData $submittedData) use ($fieldDefinition) { @@ -103,10 +103,10 @@ static function (UserAccountFieldData $submittedData) use ($fieldDefinition) { public function getModelTransformer(): CallbackTransformer { return new CallbackTransformer( - static function (ApiUserValue $data) { + static function (ApiUserValue $data): UserAccountFieldData { return new UserAccountFieldData($data->login, null, $data->email, $data->enabled); }, - static function (UserAccountFieldData $submittedData) { + static function (UserAccountFieldData $submittedData): UserAccountFieldData { return $submittedData; } ); diff --git a/src/lib/Form/ActionDispatcher/AbstractActionDispatcher.php b/src/lib/Form/ActionDispatcher/AbstractActionDispatcher.php index 895c80f4..730b2405 100644 --- a/src/lib/Form/ActionDispatcher/AbstractActionDispatcher.php +++ b/src/lib/Form/ActionDispatcher/AbstractActionDispatcher.php @@ -19,22 +19,19 @@ */ abstract class AbstractActionDispatcher implements ActionDispatcherInterface { - /** - * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface - */ - private $eventDispatcher; + private ?EventDispatcherInterface $eventDispatcher = null; /** * @var \Symfony\Component\HttpFoundation\Response */ protected $response; - public function setEventDispatcher(EventDispatcherInterface $eventDispatcher) + public function setEventDispatcher(EventDispatcherInterface $eventDispatcher): void { $this->eventDispatcher = $eventDispatcher; } - public function dispatchFormAction(FormInterface $form, ValueObject $data, $actionName = null, array $options = []) + public function dispatchFormAction(FormInterface $form, ValueObject $data, $actionName = null, array $options = []): void { $resolver = new OptionsResolver(); $this->configureOptions($resolver); @@ -74,7 +71,7 @@ abstract protected function getActionEventBaseName(); * @param $defaultActionEventName * @param $event */ - protected function dispatchDefaultAction($defaultActionEventName, FormActionEvent $event) + protected function dispatchDefaultAction(?string $defaultActionEventName, FormActionEvent $event) { $this->eventDispatcher->dispatch($event, $defaultActionEventName); } @@ -83,7 +80,7 @@ protected function dispatchDefaultAction($defaultActionEventName, FormActionEven * @param $actionEventName * @param $event */ - protected function dispatchAction($actionEventName, FormActionEvent $event) + protected function dispatchAction(?string $actionEventName, FormActionEvent $event) { $this->eventDispatcher->dispatch($event, $actionEventName); } diff --git a/src/lib/Form/ActionDispatcher/ContentDispatcher.php b/src/lib/Form/ActionDispatcher/ContentDispatcher.php index e0f1ea16..9b722169 100644 --- a/src/lib/Form/ActionDispatcher/ContentDispatcher.php +++ b/src/lib/Form/ActionDispatcher/ContentDispatcher.php @@ -21,7 +21,7 @@ protected function configureOptions(OptionsResolver $resolver) $resolver->setAllowedTypes('referrerLocation', [Location::class, 'null']); } - protected function getActionEventBaseName() + protected function getActionEventBaseName(): string { return ContentFormEvents::CONTENT_EDIT; } diff --git a/src/lib/Form/ActionDispatcher/UserDispatcher.php b/src/lib/Form/ActionDispatcher/UserDispatcher.php index 29e624ea..e9d8c52f 100644 --- a/src/lib/Form/ActionDispatcher/UserDispatcher.php +++ b/src/lib/Form/ActionDispatcher/UserDispatcher.php @@ -12,7 +12,7 @@ class UserDispatcher extends AbstractActionDispatcher { - protected function getActionEventBaseName() + protected function getActionEventBaseName(): string { return ContentFormEvents::USER_EDIT; } diff --git a/src/lib/Form/EventSubscriber/SuppressValidationSubscriber.php b/src/lib/Form/EventSubscriber/SuppressValidationSubscriber.php index e7b65a6f..80cdd504 100644 --- a/src/lib/Form/EventSubscriber/SuppressValidationSubscriber.php +++ b/src/lib/Form/EventSubscriber/SuppressValidationSubscriber.php @@ -29,7 +29,7 @@ public static function getSubscribedEvents(): array ]; } - public function suppressValidationOnCancel(FormEvent $event) + public function suppressValidationOnCancel(FormEvent $event): void { $form = $event->getForm(); @@ -38,7 +38,7 @@ public function suppressValidationOnCancel(FormEvent $event) } } - public function suppressValidationOnSaveDraft(PostSubmitEvent $event) + public function suppressValidationOnSaveDraft(PostSubmitEvent $event): void { $form = $event->getForm(); @@ -50,7 +50,7 @@ public function suppressValidationOnSaveDraft(PostSubmitEvent $event) } } - public function suppressValidationOnAutosaveDraft(PostSubmitEvent $event) + public function suppressValidationOnAutosaveDraft(PostSubmitEvent $event): void { $form = $event->getForm(); diff --git a/src/lib/Form/EventSubscriber/UserFieldsSubscriber.php b/src/lib/Form/EventSubscriber/UserFieldsSubscriber.php index 1337c537..db0fe830 100644 --- a/src/lib/Form/EventSubscriber/UserFieldsSubscriber.php +++ b/src/lib/Form/EventSubscriber/UserFieldsSubscriber.php @@ -35,7 +35,7 @@ public static function getSubscribedEvents(): array * * @param \Symfony\Component\Form\FormEvent $event */ - public function handleUserAccountField(FormEvent $event) + public function handleUserAccountField(FormEvent $event): void { /** @var \Ibexa\ContentForms\Data\User\UserCreateData|\Ibexa\ContentForms\Data\User\UserUpdateData $data */ $data = $event->getData(); @@ -52,7 +52,7 @@ public function handleUserAccountField(FormEvent $event) /** * @param \Ibexa\ContentForms\Data\User\UserCreateData $data */ - private function handleUserCreateData(UserCreateData $data) + private function handleUserCreateData(UserCreateData $data): void { foreach ($data->fieldsData as $fieldData) { if ('ezuser' !== $fieldData->getFieldTypeIdentifier()) { @@ -84,7 +84,7 @@ private function handleUserCreateData(UserCreateData $data) * @param \Ibexa\ContentForms\Data\User\UserUpdateData $data * @param $languageCode */ - private function handleUserUpdateData(UserUpdateData $data, $languageCode) + private function handleUserUpdateData(UserUpdateData $data, ?string $languageCode): void { foreach ($data->fieldsData as $fieldData) { if ('ezuser' !== $fieldData->getFieldTypeIdentifier()) { diff --git a/src/lib/Form/Processor/ContentFormProcessor.php b/src/lib/Form/Processor/ContentFormProcessor.php index dae39171..b055478c 100644 --- a/src/lib/Form/Processor/ContentFormProcessor.php +++ b/src/lib/Form/Processor/ContentFormProcessor.php @@ -30,14 +30,11 @@ */ class ContentFormProcessor implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - private $locationService; + private LocationService $locationService; - /** @var \Symfony\Component\Routing\RouterInterface */ - private $router; + private RouterInterface $router; /** * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService @@ -81,7 +78,7 @@ public static function getSubscribedEvents(): array * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException */ - public function processSaveDraft(FormActionEvent $event) + public function processSaveDraft(FormActionEvent $event): void { /** @var \Ibexa\ContentForms\Data\Content\ContentCreateData|\Ibexa\ContentForms\Data\Content\ContentUpdateData $data */ $data = $event->getData(); @@ -169,7 +166,7 @@ public function processSaveDraftAndClose(FormActionEvent $event): void * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException */ - public function processPublish(FormActionEvent $event) + public function processPublish(FormActionEvent $event): void { /** @var \Ibexa\ContentForms\Data\Content\ContentCreateData|\Ibexa\ContentForms\Data\Content\ContentUpdateData $data */ $data = $event->getData(); @@ -208,7 +205,7 @@ public function processPublish(FormActionEvent $event) * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException */ - public function processPublishAndEdit(FormActionEvent $event) + public function processPublishAndEdit(FormActionEvent $event): void { /** @var \Ibexa\ContentForms\Data\Content\ContentCreateData|\Ibexa\ContentForms\Data\Content\ContentUpdateData $data */ $data = $event->getData(); @@ -244,7 +241,7 @@ public function processPublishAndEdit(FormActionEvent $event) * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function processCancel(FormActionEvent $event) + public function processCancel(FormActionEvent $event): void { /** @var \Ibexa\ContentForms\Data\Content\ContentCreateData|\Ibexa\ContentForms\Data\Content\ContentUpdateData $data */ $data = $event->getData(); @@ -299,7 +296,7 @@ public function processCancel(FormActionEvent $event) * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException */ - public function processCreateDraft(FormActionEvent $event) + public function processCreateDraft(FormActionEvent $event): void { /** @var $createContentDraft \Ibexa\ContentForms\Data\Content\CreateContentDraftData */ $createContentDraft = $event->getData(); @@ -364,7 +361,7 @@ private function saveDraft(ContentStruct $data, string $languageCode, ?array $fi * * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException */ - private function resolveMainLanguageCode($data): string + private function resolveMainLanguageCode(ContentStruct $data): string { if (!$data instanceof ContentUpdateData && !$data instanceof ContentCreateData) { throw new InvalidArgumentException( diff --git a/src/lib/Form/Processor/SystemUrlRedirectProcessor.php b/src/lib/Form/Processor/SystemUrlRedirectProcessor.php index a75a2921..edb520d3 100644 --- a/src/lib/Form/Processor/SystemUrlRedirectProcessor.php +++ b/src/lib/Form/Processor/SystemUrlRedirectProcessor.php @@ -18,14 +18,11 @@ class SystemUrlRedirectProcessor implements EventSubscriberInterface { - /** @var \Symfony\Component\Routing\RouterInterface */ - private $router; + private RouterInterface $router; - /** @var \Ibexa\Contracts\Core\Repository\URLAliasService */ - private $urlAliasService; + private URLAliasService $urlAliasService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - private $locationService; + private LocationService $locationService; /** * @param \Symfony\Component\Routing\RouterInterface $router diff --git a/src/lib/Form/Processor/User/UserCancelFormProcessor.php b/src/lib/Form/Processor/User/UserCancelFormProcessor.php index 03f5ffba..f33ba194 100644 --- a/src/lib/Form/Processor/User/UserCancelFormProcessor.php +++ b/src/lib/Form/Processor/User/UserCancelFormProcessor.php @@ -19,8 +19,7 @@ */ class UserCancelFormProcessor implements EventSubscriberInterface { - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ - private $urlGenerator; + private UrlGeneratorInterface $urlGenerator; /** * @param \Symfony\Component\Routing\Generator\UrlGeneratorInterface $urlGenerator @@ -38,7 +37,7 @@ public static function getSubscribedEvents(): array ]; } - public function processCancel(FormActionEvent $event) + public function processCancel(FormActionEvent $event): void { /** @var \Ibexa\ContentForms\Data\User\UserUpdateData|\Ibexa\ContentForms\Data\User\UserCreateData $data */ $data = $event->getData(); diff --git a/src/lib/Form/Processor/User/UserCreateFormProcessor.php b/src/lib/Form/Processor/User/UserCreateFormProcessor.php index ee45b30e..adf6415e 100644 --- a/src/lib/Form/Processor/User/UserCreateFormProcessor.php +++ b/src/lib/Form/Processor/User/UserCreateFormProcessor.php @@ -21,11 +21,9 @@ */ class UserCreateFormProcessor implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ - private $userService; + private UserService $userService; - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ - private $urlGenerator; + private UrlGeneratorInterface $urlGenerator; /** * @param \Ibexa\Contracts\Core\Repository\UserService $userService @@ -46,7 +44,7 @@ public static function getSubscribedEvents(): array ]; } - public function processCreate(FormActionEvent $event) + public function processCreate(FormActionEvent $event): void { $data = $data = $event->getData(); diff --git a/src/lib/Form/Processor/User/UserUpdateFormProcessor.php b/src/lib/Form/Processor/User/UserUpdateFormProcessor.php index 3fc1536d..9436df3d 100644 --- a/src/lib/Form/Processor/User/UserUpdateFormProcessor.php +++ b/src/lib/Form/Processor/User/UserUpdateFormProcessor.php @@ -22,14 +22,11 @@ */ class UserUpdateFormProcessor implements EventSubscriberInterface { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ - private $userService; + private UserService $userService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface */ - private $urlGenerator; + private UrlGeneratorInterface $urlGenerator; public function __construct( UserService $userService, @@ -48,7 +45,7 @@ public static function getSubscribedEvents(): array ]; } - public function processUpdate(FormActionEvent $event) + public function processUpdate(FormActionEvent $event): void { $data = $event->getData(); diff --git a/src/lib/Form/Type/Content/BaseContentType.php b/src/lib/Form/Type/Content/BaseContentType.php index eb3d1c8c..a6b15e5e 100644 --- a/src/lib/Form/Type/Content/BaseContentType.php +++ b/src/lib/Form/Type/Content/BaseContentType.php @@ -25,7 +25,7 @@ */ class BaseContentType extends AbstractType { - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } @@ -58,7 +58,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ]); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $view->vars['languageCode'] = $options['languageCode']; $view->vars['mainLanguageCode'] = $options['mainLanguageCode']; diff --git a/src/lib/Form/Type/Content/ContentDraftCreateType.php b/src/lib/Form/Type/Content/ContentDraftCreateType.php index 3e87a1fe..3eb19edc 100644 --- a/src/lib/Form/Type/Content/ContentDraftCreateType.php +++ b/src/lib/Form/Type/Content/ContentDraftCreateType.php @@ -16,7 +16,7 @@ class ContentDraftCreateType extends AbstractType { - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } diff --git a/src/lib/Form/Type/Content/ContentEditType.php b/src/lib/Form/Type/Content/ContentEditType.php index ec8bfd78..b119f9e1 100644 --- a/src/lib/Form/Type/Content/ContentEditType.php +++ b/src/lib/Form/Type/Content/ContentEditType.php @@ -23,7 +23,7 @@ */ class ContentEditType extends AbstractType { - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } diff --git a/src/lib/Form/Type/Content/ContentFieldType.php b/src/lib/Form/Type/Content/ContentFieldType.php index 7c406472..f1047a91 100644 --- a/src/lib/Form/Type/Content/ContentFieldType.php +++ b/src/lib/Form/Type/Content/ContentFieldType.php @@ -26,17 +26,14 @@ class ContentFieldType extends AbstractType { - /** - * @var \Ibexa\ContentForms\FieldType\FieldTypeFormMapperDispatcherInterface - */ - private $fieldTypeFormMapper; + private FieldTypeFormMapperDispatcherInterface $fieldTypeFormMapper; public function __construct(FieldTypeFormMapperDispatcherInterface $fieldTypeFormMapper) { $this->fieldTypeFormMapper = $fieldTypeFormMapper; } - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } @@ -99,7 +96,7 @@ public function configureOptions(OptionsResolver $resolver): void ); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $view->vars['location'] = $options['location']; $view->vars['languageCode'] = $options['languageCode']; @@ -108,7 +105,7 @@ public function buildView(FormView $view, FormInterface $form, array $options) public function buildForm(FormBuilderInterface $builder, array $options): void { - $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) { + $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event): void { $this->fieldTypeFormMapper->map($event->getForm(), $event->getData()); }); } diff --git a/src/lib/Form/Type/Content/FieldCollectionType.php b/src/lib/Form/Type/Content/FieldCollectionType.php index 22dc7f18..724b7161 100644 --- a/src/lib/Form/Type/Content/FieldCollectionType.php +++ b/src/lib/Form/Type/Content/FieldCollectionType.php @@ -28,8 +28,7 @@ class FieldCollectionType extends CollectionType { - /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface */ - private $eventDispatcher; + private EventDispatcherInterface $eventDispatcher; public function __construct( EventDispatcherInterface $eventDispatcher @@ -43,7 +42,7 @@ public function buildForm( ): void { parent::buildForm($builder, $options); - $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($options) { + $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($options): void { $form = $event->getForm(); $data = $event->getData(); diff --git a/src/lib/Form/Type/FieldType/Author/AuthorCollectionType.php b/src/lib/Form/Type/FieldType/Author/AuthorCollectionType.php index 6c1c24ff..280f4bf6 100644 --- a/src/lib/Form/Type/FieldType/Author/AuthorCollectionType.php +++ b/src/lib/Form/Type/FieldType/Author/AuthorCollectionType.php @@ -17,7 +17,7 @@ */ class AuthorCollectionType extends AbstractType { - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } diff --git a/src/lib/Form/Type/FieldType/Author/AuthorEntryType.php b/src/lib/Form/Type/FieldType/Author/AuthorEntryType.php index c88a2c48..a350a109 100644 --- a/src/lib/Form/Type/FieldType/Author/AuthorEntryType.php +++ b/src/lib/Form/Type/FieldType/Author/AuthorEntryType.php @@ -25,7 +25,7 @@ class AuthorEntryType extends AbstractType /** * @return string */ - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } diff --git a/src/lib/Form/Type/FieldType/AuthorFieldType.php b/src/lib/Form/Type/FieldType/AuthorFieldType.php index 4d9edb03..6a955c94 100644 --- a/src/lib/Form/Type/FieldType/AuthorFieldType.php +++ b/src/lib/Form/Type/FieldType/AuthorFieldType.php @@ -29,8 +29,7 @@ */ class AuthorFieldType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\Repository */ - private $repository; + private Repository $repository; /** @var int */ private $defaultAuthor; @@ -46,7 +45,7 @@ public function __construct(Repository $repository) /** * @return string */ - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } @@ -78,7 +77,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void * @param \Symfony\Component\Form\FormInterface $form * @param array $options */ - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $view->vars['attr']['default-author'] = $options['default_author']; } @@ -101,7 +100,7 @@ public function configureOptions(OptionsResolver $resolver): void */ public function getViewTransformer(): DataTransformerInterface { - return new CallbackTransformer(function (Value $value) { + return new CallbackTransformer(function (Value $value): Value { if (0 === $value->authors->count()) { if ($this->defaultAuthor === AuthorType::DEFAULT_CURRENT_USER) { $value->authors->append($this->fetchLoggedAuthor()); @@ -111,7 +110,7 @@ public function getViewTransformer(): DataTransformerInterface } return $value; - }, static function (Value $value) { + }, static function (Value $value): Value { return $value; }); } @@ -119,14 +118,14 @@ public function getViewTransformer(): DataTransformerInterface /** * @param \Symfony\Component\Form\FormEvent $event */ - public function filterOutEmptyAuthors(FormEvent $event) + public function filterOutEmptyAuthors(FormEvent $event): void { $value = $event->getData(); $value->authors->exchangeArray( array_filter( $value->authors->getArrayCopy(), - static function (Author $author) { + static function (Author $author): bool { return !empty($author->email) || !empty($author->name); } ) diff --git a/src/lib/Form/Type/FieldType/BinaryBaseFieldType.php b/src/lib/Form/Type/FieldType/BinaryBaseFieldType.php index 08ad3439..5181d3bc 100644 --- a/src/lib/Form/Type/FieldType/BinaryBaseFieldType.php +++ b/src/lib/Form/Type/FieldType/BinaryBaseFieldType.php @@ -24,8 +24,7 @@ */ class BinaryBaseFieldType extends AbstractType { - /** @var \Ibexa\ContentForms\ConfigResolver\MaxUploadSize */ - private $maxUploadSize; + private MaxUploadSize $maxUploadSize; public function __construct(MaxUploadSize $maxUploadSize) { @@ -57,7 +56,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $view->vars['max_upload_size'] = $this->maxUploadSize->get(); } diff --git a/src/lib/Form/Type/FieldType/BinaryFileFieldType.php b/src/lib/Form/Type/FieldType/BinaryFileFieldType.php index 3c8af5a3..0f80d691 100644 --- a/src/lib/Form/Type/FieldType/BinaryFileFieldType.php +++ b/src/lib/Form/Type/FieldType/BinaryFileFieldType.php @@ -16,7 +16,7 @@ */ class BinaryFileFieldType extends AbstractType { - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } diff --git a/src/lib/Form/Type/FieldType/CheckboxFieldType.php b/src/lib/Form/Type/FieldType/CheckboxFieldType.php index 00806d5b..e814355c 100644 --- a/src/lib/Form/Type/FieldType/CheckboxFieldType.php +++ b/src/lib/Form/Type/FieldType/CheckboxFieldType.php @@ -19,15 +19,14 @@ */ class CheckboxFieldType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ - protected $fieldTypeService; + protected FieldTypeService $fieldTypeService; public function __construct(FieldTypeService $fieldTypeService) { $this->fieldTypeService = $fieldTypeService; } - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } diff --git a/src/lib/Form/Type/FieldType/CountryFieldType.php b/src/lib/Form/Type/FieldType/CountryFieldType.php index 475bcacf..9bedf4fb 100644 --- a/src/lib/Form/Type/FieldType/CountryFieldType.php +++ b/src/lib/Form/Type/FieldType/CountryFieldType.php @@ -20,8 +20,7 @@ */ class CountryFieldType extends AbstractType { - /** @var array */ - protected $countriesInfo; + protected array $countriesInfo; /** * @param array $countriesInfo @@ -31,7 +30,7 @@ public function __construct(array $countriesInfo) $this->countriesInfo = $countriesInfo; } - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } @@ -63,7 +62,10 @@ public function configureOptions(OptionsResolver $resolver): void ]); } - private function getCountryChoices(array $countriesInfo) + /** + * @return mixed[] + */ + private function getCountryChoices(array $countriesInfo): array { $choices = []; foreach ($countriesInfo as $country) { diff --git a/src/lib/Form/Type/FieldType/DateFieldType.php b/src/lib/Form/Type/FieldType/DateFieldType.php index 486ec46a..db9b270f 100644 --- a/src/lib/Form/Type/FieldType/DateFieldType.php +++ b/src/lib/Form/Type/FieldType/DateFieldType.php @@ -23,15 +23,14 @@ class DateFieldType extends AbstractType { private const EDIT_VIEWS = ['ibexa.content.draft.edit', 'ibexa.content.translate', 'ibexa.content.translate_with_location', 'ibexa.user.update']; - /** @var \Symfony\Component\HttpFoundation\RequestStack */ - private $requestStack; + private RequestStack $requestStack; public function __construct(RequestStack $requestStack) { $this->requestStack = $requestStack; } - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } @@ -52,7 +51,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ->addModelTransformer(new DateValueTransformer()); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $request = $this->requestStack->getCurrentRequest(); $view->vars['isEditView'] = \in_array($request->attributes->get('_route'), self::EDIT_VIEWS); diff --git a/src/lib/Form/Type/FieldType/DateTimeFieldType.php b/src/lib/Form/Type/FieldType/DateTimeFieldType.php index 43b6e63f..395db4d9 100644 --- a/src/lib/Form/Type/FieldType/DateTimeFieldType.php +++ b/src/lib/Form/Type/FieldType/DateTimeFieldType.php @@ -21,7 +21,7 @@ */ class DateTimeFieldType extends AbstractType { - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } @@ -42,7 +42,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ->addModelTransformer(new DateTimeValueTransformer()); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $view->vars['attr']['data-seconds'] = (int) $options['with_seconds']; } diff --git a/src/lib/Form/Type/FieldType/FloatFieldType.php b/src/lib/Form/Type/FieldType/FloatFieldType.php index 1172bf54..2050e98a 100644 --- a/src/lib/Form/Type/FieldType/FloatFieldType.php +++ b/src/lib/Form/Type/FieldType/FloatFieldType.php @@ -22,15 +22,14 @@ */ class FloatFieldType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ - protected $fieldTypeService; + protected FieldTypeService $fieldTypeService; public function __construct(FieldTypeService $fieldTypeService) { $this->fieldTypeService = $fieldTypeService; } - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } @@ -52,7 +51,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $builder->resetViewTransformers(); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $attributes = ['step' => 'any']; diff --git a/src/lib/Form/Type/FieldType/ISBNFieldType.php b/src/lib/Form/Type/FieldType/ISBNFieldType.php index 3640e613..6aa05c7b 100644 --- a/src/lib/Form/Type/FieldType/ISBNFieldType.php +++ b/src/lib/Form/Type/FieldType/ISBNFieldType.php @@ -19,15 +19,14 @@ */ class ISBNFieldType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ - protected $fieldTypeService; + protected FieldTypeService $fieldTypeService; public function __construct(FieldTypeService $fieldTypeService) { $this->fieldTypeService = $fieldTypeService; } - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } diff --git a/src/lib/Form/Type/FieldType/ImageAssetFieldType.php b/src/lib/Form/Type/FieldType/ImageAssetFieldType.php index c6525b5f..46fcc928 100644 --- a/src/lib/Form/Type/FieldType/ImageAssetFieldType.php +++ b/src/lib/Form/Type/FieldType/ImageAssetFieldType.php @@ -27,14 +27,11 @@ class ImageAssetFieldType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\Core\FieldType\ImageAsset\AssetMapper */ - private $assetMapper; + private AssetMapper $assetMapper; - /** @var \Ibexa\ContentForms\ConfigResolver\MaxUploadSize */ - private $maxUploadSize; + private MaxUploadSize $maxUploadSize; private MimeTypesInterface $mimeTypes; @@ -50,7 +47,7 @@ public function __construct( $this->mimeTypes = $mimeTypes; } - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } @@ -91,7 +88,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $view->vars['destination_content'] = null; diff --git a/src/lib/Form/Type/FieldType/ImageFieldType.php b/src/lib/Form/Type/FieldType/ImageFieldType.php index 6b91710b..09a7aa50 100644 --- a/src/lib/Form/Type/FieldType/ImageFieldType.php +++ b/src/lib/Form/Type/FieldType/ImageFieldType.php @@ -30,7 +30,7 @@ public function __construct(MimeTypesInterface $mimeTypes) $this->mimeTypes = $mimeTypes; } - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } @@ -63,7 +63,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $view->vars += [ 'is_alternative_text_required' => $options['is_alternative_text_required'], diff --git a/src/lib/Form/Type/FieldType/IntegerFieldType.php b/src/lib/Form/Type/FieldType/IntegerFieldType.php index 2d6f1238..661103f4 100644 --- a/src/lib/Form/Type/FieldType/IntegerFieldType.php +++ b/src/lib/Form/Type/FieldType/IntegerFieldType.php @@ -22,15 +22,14 @@ */ class IntegerFieldType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ - private $fieldTypeService; + private FieldTypeService $fieldTypeService; public function __construct(FieldTypeService $fieldTypeService) { $this->fieldTypeService = $fieldTypeService; } - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } @@ -60,7 +59,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $builder->addModelTransformer(new FieldValueTransformer($this->fieldTypeService->getFieldType('ezinteger'))); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $attributes = ['step' => 1]; diff --git a/src/lib/Form/Type/FieldType/KeywordFieldType.php b/src/lib/Form/Type/FieldType/KeywordFieldType.php index 58bbb85b..ed5430ee 100644 --- a/src/lib/Form/Type/FieldType/KeywordFieldType.php +++ b/src/lib/Form/Type/FieldType/KeywordFieldType.php @@ -18,7 +18,7 @@ */ class KeywordFieldType extends AbstractType { - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } diff --git a/src/lib/Form/Type/FieldType/MapLocationFieldType.php b/src/lib/Form/Type/FieldType/MapLocationFieldType.php index 693510bb..98c04965 100644 --- a/src/lib/Form/Type/FieldType/MapLocationFieldType.php +++ b/src/lib/Form/Type/FieldType/MapLocationFieldType.php @@ -24,15 +24,14 @@ */ class MapLocationFieldType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ - protected $fieldTypeService; + protected FieldTypeService $fieldTypeService; public function __construct(FieldTypeService $fieldTypeService) { $this->fieldTypeService = $fieldTypeService; } - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } @@ -87,7 +86,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ); } - public function finishView(FormView $view, FormInterface $form, array $options) + public function finishView(FormView $view, FormInterface $form, array $options): void { $view->children['latitude']->vars['type'] = 'number'; $view->children['longitude']->vars['type'] = 'number'; diff --git a/src/lib/Form/Type/FieldType/MediaFieldType.php b/src/lib/Form/Type/FieldType/MediaFieldType.php index 70bd0c4d..3015641f 100644 --- a/src/lib/Form/Type/FieldType/MediaFieldType.php +++ b/src/lib/Form/Type/FieldType/MediaFieldType.php @@ -20,7 +20,7 @@ */ class MediaFieldType extends AbstractType { - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } diff --git a/src/lib/Form/Type/FieldType/RelationFieldType.php b/src/lib/Form/Type/FieldType/RelationFieldType.php index c95f7adf..cbd7bae3 100644 --- a/src/lib/Form/Type/FieldType/RelationFieldType.php +++ b/src/lib/Form/Type/FieldType/RelationFieldType.php @@ -26,11 +26,9 @@ */ class RelationFieldType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - private $contentTypeService; + private ContentTypeService $contentTypeService; /** * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService @@ -42,7 +40,7 @@ public function __construct(ContentService $contentService, ContentTypeService $ $this->contentTypeService = $contentTypeService; } - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } @@ -62,7 +60,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $builder->addModelTransformer(new RelationValueTransformer()); } - public function finishView(FormView $view, FormInterface $form, array $options) + public function finishView(FormView $view, FormInterface $form, array $options): void { $view->vars['relations'] = []; $view->vars['default_location'] = $options['default_location']; diff --git a/src/lib/Form/Type/FieldType/RelationListFieldType.php b/src/lib/Form/Type/FieldType/RelationListFieldType.php index f1890864..84b8672c 100644 --- a/src/lib/Form/Type/FieldType/RelationListFieldType.php +++ b/src/lib/Form/Type/FieldType/RelationListFieldType.php @@ -26,11 +26,9 @@ */ class RelationListFieldType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; + private ContentService $contentService; - /** @var \Ibexa\Contracts\Core\Repository\ContentTypeService */ - private $contentTypeService; + private ContentTypeService $contentTypeService; /** * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService @@ -42,7 +40,7 @@ public function __construct(ContentService $contentService, ContentTypeService $ $this->contentTypeService = $contentTypeService; } - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } @@ -62,7 +60,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $builder->addModelTransformer(new RelationListValueTransformer()); } - public function finishView(FormView $view, FormInterface $form, array $options) + public function finishView(FormView $view, FormInterface $form, array $options): void { $view->vars['relations'] = []; $view->vars['default_location'] = $options['default_location']; diff --git a/src/lib/Form/Type/FieldType/SelectionFieldType.php b/src/lib/Form/Type/FieldType/SelectionFieldType.php index c6b42890..f77ef7a6 100644 --- a/src/lib/Form/Type/FieldType/SelectionFieldType.php +++ b/src/lib/Form/Type/FieldType/SelectionFieldType.php @@ -20,7 +20,7 @@ */ class SelectionFieldType extends AbstractType { - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } diff --git a/src/lib/Form/Type/FieldType/TextBlockFieldType.php b/src/lib/Form/Type/FieldType/TextBlockFieldType.php index c137cc91..5eaf6a02 100644 --- a/src/lib/Form/Type/FieldType/TextBlockFieldType.php +++ b/src/lib/Form/Type/FieldType/TextBlockFieldType.php @@ -22,15 +22,14 @@ */ class TextBlockFieldType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ - protected $fieldTypeService; + protected FieldTypeService $fieldTypeService; public function __construct(FieldTypeService $fieldTypeService) { $this->fieldTypeService = $fieldTypeService; } - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } @@ -45,7 +44,7 @@ public function getParent(): ?string return TextareaType::class; } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { if (null !== $options['rows']) { $view->vars['attr'] = array_merge($view->vars['attr'], ['rows' => $options['rows']]); diff --git a/src/lib/Form/Type/FieldType/TextLineFieldType.php b/src/lib/Form/Type/FieldType/TextLineFieldType.php index 6bca7754..0b441f8b 100644 --- a/src/lib/Form/Type/FieldType/TextLineFieldType.php +++ b/src/lib/Form/Type/FieldType/TextLineFieldType.php @@ -22,15 +22,14 @@ */ class TextLineFieldType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ - private $fieldTypeService; + private FieldTypeService $fieldTypeService; public function __construct(FieldTypeService $fieldTypeService) { $this->fieldTypeService = $fieldTypeService; } - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } @@ -50,7 +49,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $builder->addModelTransformer(new FieldValueTransformer($this->fieldTypeService->getFieldType('ezstring'))); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $attributes = []; diff --git a/src/lib/Form/Type/FieldType/TimeFieldType.php b/src/lib/Form/Type/FieldType/TimeFieldType.php index 2d8e5ee7..921e7944 100644 --- a/src/lib/Form/Type/FieldType/TimeFieldType.php +++ b/src/lib/Form/Type/FieldType/TimeFieldType.php @@ -21,7 +21,7 @@ */ class TimeFieldType extends AbstractType { - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } @@ -42,7 +42,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void ->addModelTransformer(new TimeValueTransformer()); } - public function buildView(FormView $view, FormInterface $form, array $options) + public function buildView(FormView $view, FormInterface $form, array $options): void { $view->vars['attr']['data-seconds'] = (int) $options['with_seconds']; } diff --git a/src/lib/Form/Type/FieldType/UrlFieldType.php b/src/lib/Form/Type/FieldType/UrlFieldType.php index 02943e7c..2368b9cc 100644 --- a/src/lib/Form/Type/FieldType/UrlFieldType.php +++ b/src/lib/Form/Type/FieldType/UrlFieldType.php @@ -22,15 +22,14 @@ */ class UrlFieldType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\FieldTypeService */ - protected $fieldTypeService; + protected FieldTypeService $fieldTypeService; public function __construct(FieldTypeService $fieldTypeService) { $this->fieldTypeService = $fieldTypeService; } - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } diff --git a/src/lib/Form/Type/FieldType/UserAccountFieldType.php b/src/lib/Form/Type/FieldType/UserAccountFieldType.php index eff15077..522b1512 100644 --- a/src/lib/Form/Type/FieldType/UserAccountFieldType.php +++ b/src/lib/Form/Type/FieldType/UserAccountFieldType.php @@ -21,7 +21,7 @@ class UserAccountFieldType extends AbstractType { - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } diff --git a/src/lib/Form/Type/LocationType.php b/src/lib/Form/Type/LocationType.php index 35844214..e8805f96 100644 --- a/src/lib/Form/Type/LocationType.php +++ b/src/lib/Form/Type/LocationType.php @@ -18,8 +18,7 @@ class LocationType extends AbstractType { - /** @var \Ibexa\Contracts\Core\Repository\LocationService */ - private $locationService; + private LocationService $locationService; /** * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService diff --git a/src/lib/Form/Type/RelationType.php b/src/lib/Form/Type/RelationType.php index b6b85ed7..128b9c85 100644 --- a/src/lib/Form/Type/RelationType.php +++ b/src/lib/Form/Type/RelationType.php @@ -69,7 +69,7 @@ public function buildView( FormView $view, FormInterface $form, array $options - ) { + ): void { $view->vars['destination_location'] = null; $value = $form->getData(); diff --git a/src/lib/Form/Type/SwitcherType.php b/src/lib/Form/Type/SwitcherType.php index 33fbc0b5..a75f2dd7 100644 --- a/src/lib/Form/Type/SwitcherType.php +++ b/src/lib/Form/Type/SwitcherType.php @@ -19,7 +19,7 @@ public function getParent(): ?string return CheckboxType::class; } - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } diff --git a/src/lib/Form/Type/User/BaseUserType.php b/src/lib/Form/Type/User/BaseUserType.php index 47433bcf..0a8efa9f 100644 --- a/src/lib/Form/Type/User/BaseUserType.php +++ b/src/lib/Form/Type/User/BaseUserType.php @@ -24,7 +24,7 @@ */ class BaseUserType extends AbstractType { - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } diff --git a/src/lib/Form/Type/User/UserCreateType.php b/src/lib/Form/Type/User/UserCreateType.php index 43f0bdfe..368e8737 100644 --- a/src/lib/Form/Type/User/UserCreateType.php +++ b/src/lib/Form/Type/User/UserCreateType.php @@ -23,7 +23,7 @@ */ class UserCreateType extends AbstractType { - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } diff --git a/src/lib/Form/Type/User/UserUpdateType.php b/src/lib/Form/Type/User/UserUpdateType.php index e6eb752a..b8bb1b41 100644 --- a/src/lib/Form/Type/User/UserUpdateType.php +++ b/src/lib/Form/Type/User/UserUpdateType.php @@ -23,7 +23,7 @@ */ class UserUpdateType extends AbstractType { - public function getName() + public function getName(): string { return $this->getBlockPrefix(); } diff --git a/src/lib/Validator/Constraints/FieldTypeValidator.php b/src/lib/Validator/Constraints/FieldTypeValidator.php index ea0b49ec..fe3e53f0 100644 --- a/src/lib/Validator/Constraints/FieldTypeValidator.php +++ b/src/lib/Validator/Constraints/FieldTypeValidator.php @@ -14,10 +14,7 @@ abstract class FieldTypeValidator extends ConstraintValidator { - /** - * @var \Ibexa\Contracts\Core\Repository\FieldTypeService - */ - protected $fieldTypeService; + protected FieldTypeService $fieldTypeService; public function __construct(FieldTypeService $fieldTypeService) { diff --git a/src/lib/Validator/Constraints/PasswordValidator.php b/src/lib/Validator/Constraints/PasswordValidator.php index d43aa519..c52044bf 100644 --- a/src/lib/Validator/Constraints/PasswordValidator.php +++ b/src/lib/Validator/Constraints/PasswordValidator.php @@ -16,8 +16,7 @@ class PasswordValidator extends ConstraintValidator { - /** @var \Ibexa\Contracts\Core\Repository\UserService */ - private $userService; + private UserService $userService; /** * @param \Ibexa\Contracts\Core\Repository\UserService $userService diff --git a/src/lib/Validator/Constraints/UserAccountPasswordValidator.php b/src/lib/Validator/Constraints/UserAccountPasswordValidator.php index abe903af..fb4f537b 100644 --- a/src/lib/Validator/Constraints/UserAccountPasswordValidator.php +++ b/src/lib/Validator/Constraints/UserAccountPasswordValidator.php @@ -31,7 +31,7 @@ public function validate($value, Constraint $constraint): void */ protected function createValidationErrorsProcessor(): ValidationErrorsProcessor { - return new ValidationErrorsProcessor($this->context, static function () { + return new ValidationErrorsProcessor($this->context, static function (): string { return 'password'; }); } diff --git a/src/lib/Validator/ValidationErrorsProcessor.php b/src/lib/Validator/ValidationErrorsProcessor.php index cd97dc14..f03a1928 100644 --- a/src/lib/Validator/ValidationErrorsProcessor.php +++ b/src/lib/Validator/ValidationErrorsProcessor.php @@ -16,8 +16,7 @@ */ final class ValidationErrorsProcessor { - /** @var \Symfony\Component\Validator\Context\ExecutionContextInterface */ - private $context; + private ExecutionContextInterface $context; /** @var callable|null */ private $propertyPathGenerator; diff --git a/tests/bundle/DependencyInjection/Compiler/FieldTypeFormMapperDispatcherPassTest.php b/tests/bundle/DependencyInjection/Compiler/FieldTypeFormMapperDispatcherPassTest.php index 0b93ac6e..16965fde 100644 --- a/tests/bundle/DependencyInjection/Compiler/FieldTypeFormMapperDispatcherPassTest.php +++ b/tests/bundle/DependencyInjection/Compiler/FieldTypeFormMapperDispatcherPassTest.php @@ -31,7 +31,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void /** * @dataProvider tagsProvider */ - public function testRegisterMappers(string $tag) + public function testRegisterMappers(string $tag): void { $fieldTypeIdentifier = 'field_type_identifier'; $serviceId = 'service_id'; diff --git a/tests/lib/Content/Form/Provider/AbstractGroupedContentFormFieldsProviderTest.php b/tests/lib/Content/Form/Provider/AbstractGroupedContentFormFieldsProviderTest.php index 6523f352..3b7c1ed7 100644 --- a/tests/lib/Content/Form/Provider/AbstractGroupedContentFormFieldsProviderTest.php +++ b/tests/lib/Content/Form/Provider/AbstractGroupedContentFormFieldsProviderTest.php @@ -27,7 +27,7 @@ final protected function getFieldsGroupsListMock(): FieldsGroupsList $mock ->expects($matcher) ->method('getFieldGroup') - ->willReturnCallback(static function () use ($matcher, $expectedGroups) { + ->willReturnCallback(static function () use ($matcher, $expectedGroups): string { return $expectedGroups[$matcher->getInvocationCount()]; }); diff --git a/tests/lib/Content/Form/Provider/GroupedContentFormFieldsProviderTest.php b/tests/lib/Content/Form/Provider/GroupedContentFormFieldsProviderTest.php index 3ef8cc80..443a4cc4 100644 --- a/tests/lib/Content/Form/Provider/GroupedContentFormFieldsProviderTest.php +++ b/tests/lib/Content/Form/Provider/GroupedContentFormFieldsProviderTest.php @@ -36,6 +36,6 @@ public function testGetGroupedFields(): void ], ]; - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } } diff --git a/tests/lib/Content/Form/Provider/IdentifiedGroupedContentFormFieldsProviderTest.php b/tests/lib/Content/Form/Provider/IdentifiedGroupedContentFormFieldsProviderTest.php index 0fe37629..22693459 100644 --- a/tests/lib/Content/Form/Provider/IdentifiedGroupedContentFormFieldsProviderTest.php +++ b/tests/lib/Content/Form/Provider/IdentifiedGroupedContentFormFieldsProviderTest.php @@ -29,6 +29,6 @@ public function testGetGroupedFields(): void ], ]; - $this->assertEquals($expected, $result); + self::assertEquals($expected, $result); } } diff --git a/tests/lib/Event/FormActionEventTest.php b/tests/lib/Event/FormActionEventTest.php index 26bac432..14ceaede 100644 --- a/tests/lib/Event/FormActionEventTest.php +++ b/tests/lib/Event/FormActionEventTest.php @@ -16,7 +16,7 @@ class FormActionEventTest extends TestCase { - public function testConstruct() + public function testConstruct(): void { $form = $this->createMock(FormInterface::class); $data = new stdClass(); @@ -30,7 +30,7 @@ public function testConstruct() self::assertSame($options, $event->getOptions()); } - public function testEventDoesntHaveResponse() + public function testEventDoesntHaveResponse(): void { $event = new FormActionEvent( $this->createMock(FormInterface::class), @@ -41,7 +41,7 @@ public function testEventDoesntHaveResponse() self::assertNull($event->getResponse()); } - public function testEventSetResponse() + public function testEventSetResponse(): void { $event = new FormActionEvent( $this->createMock(FormInterface::class), @@ -57,7 +57,7 @@ public function testEventSetResponse() self::assertSame($response, $event->getResponse()); } - public function testGetOption() + public function testGetOption(): void { $objectOption = new stdClass(); $options = ['languageCode' => 'eng-GB', 'foo' => 'bar', 'obj' => $objectOption]; diff --git a/tests/lib/FieldType/DataTransformer/FieldValueTransformerTest.php b/tests/lib/FieldType/DataTransformer/FieldValueTransformerTest.php index 2558a239..239ffb07 100644 --- a/tests/lib/FieldType/DataTransformer/FieldValueTransformerTest.php +++ b/tests/lib/FieldType/DataTransformer/FieldValueTransformerTest.php @@ -16,7 +16,7 @@ class FieldValueTransformerTest extends TestCase { - public function testTransformNull() + public function testTransformNull(): void { $value = new stdClass(); @@ -30,7 +30,7 @@ public function testTransformNull() self::assertNull($result); } - public function testTransform() + public function testTransform(): void { $value = $this->createMock(Value::class); $valueHash = ['lorem' => 'Lorem ipsum dolor...']; @@ -47,7 +47,7 @@ public function testTransform() self::assertEquals($result, $valueHash); } - public function testReverseTransformNull() + public function testReverseTransformNull(): void { $emptyValue = $this->createMock(Value::class); @@ -65,7 +65,7 @@ public function testReverseTransformNull() self::assertSame($emptyValue, $result); } - public function testReverseTransform() + public function testReverseTransform(): void { $value = 'Lorem ipsum dolor...'; $expected = $this->createMock(Value::class); diff --git a/tests/lib/FieldType/DataTransformer/MultiSelectionValueTransformerTest.php b/tests/lib/FieldType/DataTransformer/MultiSelectionValueTransformerTest.php index 10730683..6790f343 100644 --- a/tests/lib/FieldType/DataTransformer/MultiSelectionValueTransformerTest.php +++ b/tests/lib/FieldType/DataTransformer/MultiSelectionValueTransformerTest.php @@ -14,7 +14,7 @@ class MultiSelectionValueTransformerTest extends TestCase { - public function transformProvider() + public function transformProvider(): array { return [ [[0]], @@ -28,7 +28,7 @@ public function transformProvider() /** * @dataProvider transformProvider */ - public function testTransform($valueAsArray) + public function testTransform(array $valueAsArray): void { $transformer = new MultiSelectionValueTransformer(); $value = new Value($valueAsArray); @@ -38,14 +38,14 @@ public function testTransform($valueAsArray) /** * @dataProvider transformProvider */ - public function testReverseTransform($valueAsArray) + public function testReverseTransform(array $valueAsArray): void { $transformer = new MultiSelectionValueTransformer(); $expectedValue = new Value($valueAsArray); self::assertEquals($expectedValue, $transformer->reverseTransform($valueAsArray)); } - public function transformNullProvider() + public function transformNullProvider(): array { return [ [new Value()], @@ -59,13 +59,13 @@ public function transformNullProvider() /** * @dataProvider transformNullProvider */ - public function testTransformNull($value) + public function testTransformNull(mixed $value): void { $transformer = new MultiSelectionValueTransformer(); self::assertNull($transformer->transform($value)); } - public function testReverseTransformNull() + public function testReverseTransformNull(): void { $transformer = new MultiSelectionValueTransformer(); self::assertNull($transformer->reverseTransform(null)); diff --git a/tests/lib/FieldType/DataTransformer/MultipleCountryValueTransformerTest.php b/tests/lib/FieldType/DataTransformer/MultipleCountryValueTransformerTest.php index 071aa2e1..8421602c 100644 --- a/tests/lib/FieldType/DataTransformer/MultipleCountryValueTransformerTest.php +++ b/tests/lib/FieldType/DataTransformer/MultipleCountryValueTransformerTest.php @@ -44,7 +44,7 @@ class MultipleCountryValueTransformerTest extends TestCase 'ZW' => ['Name' => 'Zimbabwe', 'Alpha2' => 'ZW', 'Alpha3' => 'ZWE', 'IDC' => '263'], ]; - public function transformProvider() + public function transformProvider(): array { return [ [[ @@ -61,7 +61,7 @@ public function transformProvider() /** * @dataProvider transformProvider */ - public function testTransform($valueAsArray) + public function testTransform(array $valueAsArray): void { $transformer = new MultipleCountryValueTransformer($this->countriesInfo); $value = new Value($valueAsArray); @@ -71,14 +71,14 @@ public function testTransform($valueAsArray) /** * @dataProvider transformProvider */ - public function testReverseTransform($valueAsArray) + public function testReverseTransform(array $valueAsArray): void { $transformer = new MultipleCountryValueTransformer($this->countriesInfo); $expectedValue = new Value($valueAsArray); self::assertEquals($expectedValue, $transformer->reverseTransform(array_keys($valueAsArray))); } - public function transformNullProvider() + public function transformNullProvider(): array { return [ [42], @@ -91,26 +91,26 @@ public function transformNullProvider() /** * @dataProvider transformNullProvider */ - public function testTransformNull($value) + public function testTransformNull(int|string|array|null $value): void { $transformer = new MultipleCountryValueTransformer($this->countriesInfo); self::assertNull($transformer->transform($value)); } - public function reverseTransformNullProvider() + public function reverseTransformNullProvider(): array { return [ [42], ['snafu'], [null], - [new \Ibexa\Core\FieldType\Country\Value()], + [new Value()], ]; } /** * @dataProvider reverseTransformNullProvider */ - public function testReverseTransformNull($value) + public function testReverseTransformNull(mixed $value): void { $transformer = new MultipleCountryValueTransformer($this->countriesInfo); self::assertNull($transformer->reverseTransform($value)); diff --git a/tests/lib/FieldType/DataTransformer/RelationListValueTransformerTest.php b/tests/lib/FieldType/DataTransformer/RelationListValueTransformerTest.php index e01d402d..dc99899a 100644 --- a/tests/lib/FieldType/DataTransformer/RelationListValueTransformerTest.php +++ b/tests/lib/FieldType/DataTransformer/RelationListValueTransformerTest.php @@ -17,7 +17,7 @@ final class RelationListValueTransformerTest extends TestCase /** * @dataProvider dataProviderForTestReverseTransform */ - public function testReverseTransform($value, ?Value $expectedValue): void + public function testReverseTransform(?string $value, ?Value $expectedValue): void { $transformer = new RelationListValueTransformer(); diff --git a/tests/lib/FieldType/DataTransformer/SingleSelectionValueTransformerTest.php b/tests/lib/FieldType/DataTransformer/SingleSelectionValueTransformerTest.php index c9de2906..bd2c9cc9 100644 --- a/tests/lib/FieldType/DataTransformer/SingleSelectionValueTransformerTest.php +++ b/tests/lib/FieldType/DataTransformer/SingleSelectionValueTransformerTest.php @@ -14,7 +14,7 @@ class SingleSelectionValueTransformerTest extends TestCase { - public function transformProvider() + public function transformProvider(): array { return [ [0], @@ -26,7 +26,7 @@ public function transformProvider() /** * @dataProvider transformProvider */ - public function testTransform($value) + public function testTransform(int $value): void { $transformer = new SingleSelectionValueTransformer(); self::assertSame($value, $transformer->transform(new Value([$value]))); @@ -35,14 +35,14 @@ public function testTransform($value) /** * @dataProvider transformProvider */ - public function testReverseTransform($value) + public function testReverseTransform(int $value): void { $transformer = new SingleSelectionValueTransformer(); $expectedValue = new Value([$value]); self::assertEquals($expectedValue, $transformer->reverseTransform($value)); } - public function transformNullProvider() + public function transformNullProvider(): array { return [ [new Value()], @@ -55,13 +55,13 @@ public function transformNullProvider() /** * @dataProvider transformNullProvider */ - public function testTransformNull($value) + public function testTransformNull(mixed $value): void { $transformer = new SingleSelectionValueTransformer(); self::assertNull($transformer->transform($value)); } - public function testReverseTransformNull() + public function testReverseTransformNull(): void { $transformer = new SingleSelectionValueTransformer(); self::assertNull($transformer->reverseTransform(null)); diff --git a/tests/lib/FieldType/DataTransformer/TimeValueTransformerTest.php b/tests/lib/FieldType/DataTransformer/TimeValueTransformerTest.php index f5cdbf35..699b6145 100644 --- a/tests/lib/FieldType/DataTransformer/TimeValueTransformerTest.php +++ b/tests/lib/FieldType/DataTransformer/TimeValueTransformerTest.php @@ -16,7 +16,7 @@ class TimeValueTransformerTest extends TestCase { - public function testTransform() + public function testTransform(): void { $date = new DateTime(); $value = Value::fromDateTime($date); @@ -26,7 +26,7 @@ public function testTransform() self::assertSame($time, $transformer->transform($value)); } - public function testTransformZero() + public function testTransformZero(): void { $value = new Value(0); $transformer = new TimeValueTransformer(); @@ -34,7 +34,7 @@ public function testTransformZero() self::assertSame(0, $transformer->transform($value)); } - public function testTransformNull() + public function testTransformNull(): void { $value = new Value(null); $transformer = new TimeValueTransformer(); @@ -42,7 +42,7 @@ public function testTransformNull() self::assertNull($transformer->transform($value)); } - public function testTransformInvalidValue() + public function testTransformInvalidValue(): void { $transformer = new TimeValueTransformer(); diff --git a/tests/lib/FieldType/FieldTypeFormMapperDispatcherTest.php b/tests/lib/FieldType/FieldTypeFormMapperDispatcherTest.php index 1496b57d..f0925254 100644 --- a/tests/lib/FieldType/FieldTypeFormMapperDispatcherTest.php +++ b/tests/lib/FieldType/FieldTypeFormMapperDispatcherTest.php @@ -13,16 +13,15 @@ use Ibexa\Contracts\ContentForms\FieldType\FieldValueFormMapperInterface; use Ibexa\Contracts\Core\Repository\Values\Content\Field; use Ibexa\Core\Repository\Values\ContentType\FieldDefinition; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\FormInterface; class FieldTypeFormMapperDispatcherTest extends TestCase { - /** @var \Ibexa\ContentForms\FieldType\FieldTypeFormMapperDispatcherInterface */ - private $dispatcher; + private FieldTypeFormMapperDispatcher $dispatcher; - /** @var \Ibexa\Contracts\ContentForms\FieldType\FieldValueFormMapperInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $fieldValueMapperMock; + private FieldValueFormMapperInterface & MockObject $fieldValueMapperMock; protected function setUp(): void { @@ -32,7 +31,7 @@ protected function setUp(): void $this->dispatcher->addMapper($this->fieldValueMapperMock, 'first_type'); } - public function testMapFieldValue() + public function testMapFieldValue(): void { $data = new FieldData([ 'field' => new Field(['fieldDefIdentifier' => 'first_type']), diff --git a/tests/lib/FieldType/Mapper/UserAccountFieldValueFormMapperTest.php b/tests/lib/FieldType/Mapper/UserAccountFieldValueFormMapperTest.php index 07f53803..b88ea090 100644 --- a/tests/lib/FieldType/Mapper/UserAccountFieldValueFormMapperTest.php +++ b/tests/lib/FieldType/Mapper/UserAccountFieldValueFormMapperTest.php @@ -44,7 +44,7 @@ protected function setUp(): void ->willReturn($userEditForm); } - public function testMapFieldValueFormNoLanguageCode() + public function testMapFieldValueFormNoLanguageCode(): void { $mapper = new UserAccountFieldValueFormMapper(); @@ -65,7 +65,7 @@ public function testMapFieldValueFormNoLanguageCode() $mapper->mapFieldValueForm($this->fieldForm, $this->data); } - public function testMapFieldValueFormWithLanguageCode() + public function testMapFieldValueFormWithLanguageCode(): void { $mapper = new UserAccountFieldValueFormMapper(); diff --git a/tests/lib/Validator/Constraints/FieldValueTest.php b/tests/lib/Validator/Constraints/FieldValueTest.php index 3e0de144..9862dc7b 100644 --- a/tests/lib/Validator/Constraints/FieldValueTest.php +++ b/tests/lib/Validator/Constraints/FieldValueTest.php @@ -15,19 +15,19 @@ class FieldValueTest extends TestCase { - public function testConstruct() + public function testConstruct(): void { $constraint = new FieldValue(); self::assertSame('ez.field.value', $constraint->message); } - public function testValidatedBy() + public function testValidatedBy(): void { $constraint = new FieldValue(); self::assertSame(FieldValueValidator::class, $constraint->validatedBy()); } - public function testGetTargets() + public function testGetTargets(): void { $constraint = new FieldValue(); self::assertSame(Constraint::CLASS_CONSTRAINT, $constraint->getTargets()); diff --git a/tests/lib/Validator/Constraints/PasswordTest.php b/tests/lib/Validator/Constraints/PasswordTest.php index c32f6888..27a58c80 100644 --- a/tests/lib/Validator/Constraints/PasswordTest.php +++ b/tests/lib/Validator/Constraints/PasswordTest.php @@ -15,24 +15,24 @@ class PasswordTest extends TestCase { /** @var \Ibexa\ContentForms\Validator\Constraints\Password */ - private $constraint; + private Password $constraint; protected function setUp(): void { $this->constraint = new Password(); } - public function testConstruct() + public function testConstruct(): void { self::assertSame('ez.user.password.invalid', $this->constraint->message); } - public function testValidatedBy() + public function testValidatedBy(): void { self::assertSame(PasswordValidator::class, $this->constraint->validatedBy()); } - public function testGetTargets() + public function testGetTargets(): void { self::assertSame([Password::CLASS_CONSTRAINT, Password::PROPERTY_CONSTRAINT], $this->constraint->getTargets()); } diff --git a/tests/lib/Validator/Constraints/PasswordValidatorTest.php b/tests/lib/Validator/Constraints/PasswordValidatorTest.php index e3d79cd5..55ca6a51 100644 --- a/tests/lib/Validator/Constraints/PasswordValidatorTest.php +++ b/tests/lib/Validator/Constraints/PasswordValidatorTest.php @@ -14,20 +14,18 @@ use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Repository\Values\User\PasswordValidationContext; use Ibexa\Core\FieldType\ValidationError; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; class PasswordValidatorTest extends TestCase { - /** @var \Ibexa\Contracts\Core\Repository\UserService|\PHPUnit\Framework\MockObject\MockObject */ - private $userService; + private UserService & MockObject $userService; - /** @var \Symfony\Component\Validator\Context\ExecutionContextInterface|\PHPUnit\Framework\MockObject\MockObject */ - private $executionContext; + private ExecutionContextInterface & MockObject $executionContext; - /** @var \Ibexa\ContentForms\Validator\Constraints\PasswordValidator */ - private $validator; + private PasswordValidator $validator; protected function setUp(): void { @@ -40,7 +38,7 @@ protected function setUp(): void /** * @dataProvider dataProviderForValidateNotSupportedValueType */ - public function testValidateShouldBeSkipped($value) + public function testValidateShouldBeSkipped(mixed $value): void { $this->userService ->expects(self::never()) @@ -53,7 +51,7 @@ public function testValidateShouldBeSkipped($value) $this->validator->validate($value, new Password()); } - public function testValid() + public function testValid(): void { $password = 'pass'; $contentType = $this->createMock(ContentType::class); @@ -61,7 +59,7 @@ public function testValid() $this->userService ->expects(self::once()) ->method('validatePassword') - ->willReturnCallback(function ($actualPassword, $actualContext) use ($password, $contentType) { + ->willReturnCallback(function ($actualPassword, $actualContext) use ($password, $contentType): array { $this->assertEquals($password, $actualPassword); $this->assertInstanceOf(PasswordValidationContext::class, $actualContext); $this->assertSame($contentType, $actualContext->contentType); @@ -78,7 +76,7 @@ public function testValid() ])); } - public function testInvalid() + public function testInvalid(): void { $contentType = $this->createMock(ContentType::class); $password = 'pass'; @@ -88,7 +86,7 @@ public function testInvalid() $this->userService ->expects(self::once()) ->method('validatePassword') - ->willReturnCallback(function ($actualPassword, $actualContext) use ($password, $contentType, $errorMessage, $errorParameter) { + ->willReturnCallback(function ($actualPassword, $actualContext) use ($password, $contentType, $errorMessage, $errorParameter): array { $this->assertEquals($password, $actualPassword); $this->assertInstanceOf(PasswordValidationContext::class, $actualContext); $this->assertSame($contentType, $actualContext->contentType); diff --git a/tests/lib/Validator/Constraints/UserAccountPasswordTest.php b/tests/lib/Validator/Constraints/UserAccountPasswordTest.php index 1687d9fb..a08bfa44 100644 --- a/tests/lib/Validator/Constraints/UserAccountPasswordTest.php +++ b/tests/lib/Validator/Constraints/UserAccountPasswordTest.php @@ -15,24 +15,24 @@ class UserAccountPasswordTest extends TestCase { /** @var \Ibexa\ContentForms\Validator\Constraints\Password */ - private $constraint; + private UserAccountPassword $constraint; protected function setUp(): void { $this->constraint = new UserAccountPassword(); } - public function testConstruct() + public function testConstruct(): void { self::assertSame('ez.user.password.invalid', $this->constraint->message); } - public function testValidatedBy() + public function testValidatedBy(): void { self::assertSame(UserAccountPasswordValidator::class, $this->constraint->validatedBy()); } - public function testGetTargets() + public function testGetTargets(): void { self::assertSame([UserAccountPassword::CLASS_CONSTRAINT, UserAccountPassword::PROPERTY_CONSTRAINT], $this->constraint->getTargets()); } diff --git a/tests/lib/Validator/Constraints/UserAccountPasswordValidatorTest.php b/tests/lib/Validator/Constraints/UserAccountPasswordValidatorTest.php index c0859d69..4caf9af7 100644 --- a/tests/lib/Validator/Constraints/UserAccountPasswordValidatorTest.php +++ b/tests/lib/Validator/Constraints/UserAccountPasswordValidatorTest.php @@ -15,25 +15,23 @@ use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Repository\Values\User\PasswordValidationContext; use Ibexa\Core\FieldType\ValidationError; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; class UserAccountPasswordValidatorTest extends TestCase { - /** @var \Ibexa\Contracts\Core\Repository\UserService|\PHPUnit\Framework\MockObject\MockObject */ - private $userService; + private UserService & MockObject $userService; - /** @var \PHPUnit\Framework\MockObject\MockObject|\Symfony\Component\Validator\Context\ExecutionContextInterface */ - private $executionContext; + private ExecutionContextInterface & MockObject $executionContext; - /** @var \Ibexa\ContentForms\Validator\Constraints\UserAccountPasswordValidator */ - private $validator; + private UserAccountPasswordValidator $validator; /** * @dataProvider dataProviderForValidateNotSupportedValueType */ - public function testValidateShouldBeSkipped($value) + public function testValidateShouldBeSkipped(mixed $value): void { $this->userService ->expects(self::never()) @@ -63,7 +61,7 @@ public function dataProviderForValidateNotSupportedValueType(): array ]; } - public function testValid() + public function testValid(): void { $userAccount = new UserAccountFieldData('user', 'pass', 'user@ibexa.co'); $contentType = $this->createMock(ContentType::class); @@ -71,7 +69,7 @@ public function testValid() $this->userService ->expects(self::once()) ->method('validatePassword') - ->willReturnCallback(function ($actualPassword, $actualContext) use ($userAccount, $contentType) { + ->willReturnCallback(function ($actualPassword, $actualContext) use ($userAccount, $contentType): array { $this->assertEquals($userAccount->password, $actualPassword); $this->assertInstanceOf(PasswordValidationContext::class, $actualContext); $this->assertSame($contentType, $actualContext->contentType); @@ -88,7 +86,7 @@ public function testValid() ])); } - public function testInvalid() + public function testInvalid(): void { $contentType = $this->createMock(ContentType::class); $userAccount = new UserAccountFieldData('user', 'pass', 'user@ibexa.co'); @@ -98,7 +96,7 @@ public function testInvalid() $this->userService ->expects(self::once()) ->method('validatePassword') - ->willReturnCallback(function ($actualPassword, $actualContext) use ($userAccount, $contentType, $errorMessage, $errorParameter) { + ->willReturnCallback(function ($actualPassword, $actualContext) use ($userAccount, $contentType, $errorMessage, $errorParameter): array { $this->assertEquals($userAccount->password, $actualPassword); $this->assertInstanceOf(PasswordValidationContext::class, $actualContext); $this->assertSame($contentType, $actualContext->contentType);