Skip to content

Commit 8631d12

Browse files
authored
IBX-9727: Aligned codebase with content-forms changes (#1566)
* IBX-9727: Added missing return types to ContentTypeDispatcher * IBX-9727: Fixed strict types in ValidatorConfigurationValidator * [PHPStan] Removed resolved issues from the baseline
1 parent 3eb6d1b commit 8631d12

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3462,12 +3462,6 @@ parameters:
34623462
count: 1
34633463
path: src/lib/FieldType/Mapper/UserAccountFormMapper.php
34643464

3465-
-
3466-
message: '#^Method Ibexa\\AdminUi\\Form\\ActionDispatcher\\ContentTypeDispatcher\:\:configureOptions\(\) has no return type specified\.$#'
3467-
identifier: missingType.return
3468-
count: 1
3469-
path: src/lib/Form/ActionDispatcher/ContentTypeDispatcher.php
3470-
34713465
-
34723466
message: '#^Method Ibexa\\AdminUi\\Form\\Data\\Content\\CustomUrl\\CustomUrlRemoveData\:\:__construct\(\) has parameter \$urlAliases with no value type specified in iterable type array\.$#'
34733467
identifier: missingType.iterableValue
@@ -9348,12 +9342,6 @@ parameters:
93489342
count: 1
93499343
path: src/lib/Validator/Constraints/ValidatorConfigurationValidator.php
93509344

9351-
-
9352-
message: '#^Parameter \#1 \$validationErrors of method Ibexa\\ContentForms\\Validator\\Constraints\\FieldTypeValidator\:\:processValidationErrors\(\) expects array\<Ibexa\\Contracts\\Core\\FieldType\\ValidationError\>, iterable\<Ibexa\\Contracts\\Core\\FieldType\\ValidationError\> given\.$#'
9353-
identifier: argument.type
9354-
count: 1
9355-
path: src/lib/Validator/Constraints/ValidatorConfigurationValidator.php
9356-
93579345
-
93589346
message: '#^Call to an undefined method Symfony\\Component\\Form\\FormInterface\:\:getClickedButton\(\)\.$#'
93599347
identifier: method.notFound
@@ -9660,12 +9648,6 @@ parameters:
96609648
count: 1
96619649
path: tests/lib/Config/AdminUiForms/ContentTypeFieldTypesResolverTest.php
96629650

9663-
-
9664-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertNull\(\) with Symfony\\Component\\HttpFoundation\\Response will always evaluate to false\.$#'
9665-
identifier: staticMethod.impossibleType
9666-
count: 2
9667-
path: tests/lib/Event/FormActionEventTest.php
9668-
96699651
-
96709652
message: '#^Method Ibexa\\Tests\\AdminUi\\EventListener\\ContentProxyCreateDraftListenerTest\:\:getContentType\(\) has parameter \$fieldDefs with no value type specified in iterable type array\.$#'
96719653
identifier: missingType.iterableValue

src/lib/Form/ActionDispatcher/ContentTypeDispatcher.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313

1414
class ContentTypeDispatcher extends AbstractActionDispatcher
1515
{
16-
protected function configureOptions(OptionsResolver $resolver)
16+
protected function configureOptions(OptionsResolver $resolver): void
1717
{
1818
$resolver->setRequired('languageCode');
1919
}
2020

21-
protected function getActionEventBaseName()
21+
protected function getActionEventBaseName(): string
2222
{
2323
return FormEvents::CONTENT_TYPE_UPDATE;
2424
}

src/lib/Validator/Constraints/ValidatorConfigurationValidator.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,23 @@ class ValidatorConfigurationValidator extends FieldTypeValidator
2222
* @param \Ibexa\AdminUi\Form\Data\FieldDefinitionData $value The value that should be validated
2323
* @param \Symfony\Component\Validator\Constraint $constraint The constraint for the validation
2424
*
25+
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException
26+
*
2527
* @api
2628
*/
27-
public function validate($value, Constraint $constraint): void
29+
public function validate(mixed $value, Constraint $constraint): void
2830
{
2931
if (!$value instanceof FieldDefinitionData) {
3032
return;
3133
}
3234

3335
$fieldType = $this->fieldTypeService->getFieldType($value->getFieldTypeIdentifier());
34-
$this->processValidationErrors($fieldType->validateValidatorConfiguration($value->validatorConfiguration));
36+
$this->processValidationErrors(
37+
iterator_to_array($fieldType->validateValidatorConfiguration($value->validatorConfiguration))
38+
);
3539
}
3640

37-
protected function generatePropertyPath($errorIndex, $errorTarget)
41+
protected function generatePropertyPath($errorIndex, $errorTarget): string
3842
{
3943
return 'defaultValue';
4044
}

0 commit comments

Comments
 (0)