From cd7a209e3935d8ed6bc2908de571e2a676278e35 Mon Sep 17 00:00:00 2001 From: konradoboza Date: Fri, 11 Jul 2025 15:07:36 +0200 Subject: [PATCH 1/2] IBX-9727: Added type-hints and adapted codebase to PHP8+ --- phpstan-baseline.neon | 138 ++---------------- .../Command/MigrateLegacyMatrixCommand.php | 68 ++++----- .../IbexaFieldTypeMatrixExtension.php | 4 +- src/bundle/IbexaFieldTypeMatrixBundle.php | 2 +- .../FieldType/Converter/MatrixConverter.php | 29 +--- src/lib/FieldType/Indexable.php | 6 +- .../Mapper/FieldTypeToContentTypeStrategy.php | 7 +- src/lib/FieldType/Mapper/MatrixFormMapper.php | 14 +- src/lib/FieldType/Type.php | 61 ++------ src/lib/FieldType/Value.php | 4 +- src/lib/FieldType/Value/Row.php | 18 ++- src/lib/FieldType/Value/RowsCollection.php | 24 +-- .../Transformer/FieldTypeModelTransformer.php | 10 +- src/lib/Form/Type/ColumnType.php | 6 +- .../Type/FieldType/MatrixCollectionType.php | 5 +- .../Form/Type/FieldType/MatrixEntryType.php | 2 +- .../Form/Type/FieldType/MatrixFieldType.php | 2 +- src/lib/GraphQL/FieldValueResolver.php | 9 +- src/lib/GraphQL/InputHandler.php | 7 +- ...MatrixFieldDefinitionInputSchemaWorker.php | 21 ++- .../Schema/MatrixFieldDefinitionMapper.php | 19 +-- .../MatrixFieldDefinitionSchemaWorker.php | 21 ++- src/lib/GraphQL/Schema/NameHelper.php | 2 +- src/lib/GraphQL/SilentRow.php | 7 +- tests/lib/CoreSetupFactoryTrait.php | 2 - tests/lib/LegacySetupFactory.php | 4 +- tests/lib/Repository/SearchServiceTest.php | 29 ++-- 27 files changed, 175 insertions(+), 346 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 0270708..104d23c 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,38 +1,20 @@ parameters: ignoreErrors: - - message: '#^Cannot access offset ''entries'' on array\|bool\|float\|int\|string\|null\.$#' - identifier: offsetAccess.nonOffsetAccessible - count: 1 - path: src/bundle/Command/MigrateLegacyMatrixCommand.php - - - - message: '#^Method Ibexa\\Bundle\\FieldTypeMatrix\\Command\\MigrateLegacyMatrixCommand\:\:convertCellsToRows\(\) has parameter \$cells with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/bundle/Command/MigrateLegacyMatrixCommand.php - - - - message: '#^Method Ibexa\\Bundle\\FieldTypeMatrix\\Command\\MigrateLegacyMatrixCommand\:\:convertCellsToRows\(\) has parameter \$columns with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/bundle/Command/MigrateLegacyMatrixCommand.php - - - - message: '#^Method Ibexa\\Bundle\\FieldTypeMatrix\\Command\\MigrateLegacyMatrixCommand\:\:convertCellsToRows\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue + message: '#^Binary operation "%%" between int\|string and int\<0, max\> results in an error\.$#' + identifier: binaryOp.invalid count: 1 path: src/bundle/Command/MigrateLegacyMatrixCommand.php - - message: '#^Method Ibexa\\Bundle\\FieldTypeMatrix\\Command\\MigrateLegacyMatrixCommand\:\:getContentClassAttributes\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue + message: '#^Cannot access offset ''entries'' on array\|bool\|float\|int\|string\|null\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 1 path: src/bundle/Command/MigrateLegacyMatrixCommand.php - - message: '#^Method Ibexa\\Bundle\\FieldTypeMatrix\\Command\\MigrateLegacyMatrixCommand\:\:getContentObjectAttributes\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue + message: '#^Cannot access property \$identifier on array\\.$#' + identifier: property.nonObject count: 1 path: src/bundle/Command/MigrateLegacyMatrixCommand.php @@ -43,115 +25,19 @@ parameters: path: src/bundle/Command/MigrateLegacyMatrixCommand.php - - message: '#^Parameter \#1 \$input of static method Symfony\\Component\\Yaml\\Yaml\:\:parse\(\) expects string, string\|false given\.$#' - identifier: argument.type - count: 1 - path: src/bundle/DependencyInjection/IbexaFieldTypeMatrixExtension.php - - - - message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\StorageFieldDefinition\:\:\$dataText5 \(string\) on left side of \?\? is not nullable\.$#' - identifier: nullCoalesce.property - count: 1 - path: src/lib/FieldType/Converter/MatrixConverter.php - - - - message: '#^Method Ibexa\\FieldTypeMatrix\\FieldType\\Value\\Row\:\:__construct\(\) has parameter \$cells with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/FieldType/Value/Row.php - - - - message: '#^Method Ibexa\\FieldTypeMatrix\\FieldType\\Value\\Row\:\:__get\(\) has no return type specified\.$#' - identifier: missingType.return + message: '#^Method Ibexa\\FieldTypeMatrix\\FieldType\\Mapper\\MatrixFormMapper\:\:mapFieldDefinitionForm\(\) has parameter \$fieldDefinitionForm with generic interface Symfony\\Component\\Form\\FormInterface but does not specify its types\: TData$#' + identifier: missingType.generics count: 1 - path: src/lib/FieldType/Value/Row.php + path: src/lib/FieldType/Mapper/MatrixFormMapper.php - - message: '#^Method Ibexa\\FieldTypeMatrix\\FieldType\\Value\\Row\:\:__get\(\) has parameter \$name with no type specified\.$#' - identifier: missingType.parameter + message: '#^Method Ibexa\\FieldTypeMatrix\\FieldType\\Mapper\\MatrixFormMapper\:\:mapFieldValueForm\(\) has parameter \$fieldForm with generic interface Symfony\\Component\\Form\\FormInterface but does not specify its types\: TData$#' + identifier: missingType.generics count: 1 - path: src/lib/FieldType/Value/Row.php - - - - message: '#^Method Ibexa\\FieldTypeMatrix\\FieldType\\Value\\Row\:\:__isset\(\) has parameter \$name with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/FieldType/Value/Row.php - - - - message: '#^Method Ibexa\\FieldTypeMatrix\\FieldType\\Value\\Row\:\:getCells\(\) return type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/FieldType/Value/Row.php + path: src/lib/FieldType/Mapper/MatrixFormMapper.php - message: '#^Parameter \#2 \$callback of function array_filter expects \(callable\(string\)\: bool\)\|null, ''strlen'' given\.$#' identifier: argument.type count: 1 path: src/lib/FieldType/Value/Row.php - - - - message: '#^Property Ibexa\\FieldTypeMatrix\\FieldType\\Value\\Row\:\:\$cells type has no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/FieldType/Value/Row.php - - - - message: '#^Method Ibexa\\FieldTypeMatrix\\GraphQL\\InputHandler\:\:toFieldValue\(\) has parameter \$input with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/GraphQL/InputHandler.php - - - - message: '#^Method Ibexa\\FieldTypeMatrix\\GraphQL\\InputHandler\:\:toFieldValue\(\) has parameter \$inputFormat with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/GraphQL/InputHandler.php - - - - message: '#^Method Ibexa\\FieldTypeMatrix\\GraphQL\\Schema\\MatrixFieldDefinitionInputSchemaWorker\:\:canWork\(\) has parameter \$args with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/GraphQL/Schema/MatrixFieldDefinitionInputSchemaWorker.php - - - - message: '#^Method Ibexa\\FieldTypeMatrix\\GraphQL\\Schema\\MatrixFieldDefinitionInputSchemaWorker\:\:typeName\(\) has parameter \$args with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/GraphQL/Schema/MatrixFieldDefinitionInputSchemaWorker.php - - - - message: '#^Method Ibexa\\FieldTypeMatrix\\GraphQL\\Schema\\MatrixFieldDefinitionInputSchemaWorker\:\:work\(\) has parameter \$args with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/GraphQL/Schema/MatrixFieldDefinitionInputSchemaWorker.php - - - - message: '#^Method Ibexa\\FieldTypeMatrix\\GraphQL\\Schema\\MatrixFieldDefinitionSchemaWorker\:\:canWork\(\) has parameter \$args with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/GraphQL/Schema/MatrixFieldDefinitionSchemaWorker.php - - - - message: '#^Method Ibexa\\FieldTypeMatrix\\GraphQL\\Schema\\MatrixFieldDefinitionSchemaWorker\:\:typeName\(\) has parameter \$args with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/GraphQL/Schema/MatrixFieldDefinitionSchemaWorker.php - - - - message: '#^Method Ibexa\\FieldTypeMatrix\\GraphQL\\Schema\\MatrixFieldDefinitionSchemaWorker\:\:work\(\) has parameter \$args with no value type specified in iterable type array\.$#' - identifier: missingType.iterableValue - count: 1 - path: src/lib/GraphQL/Schema/MatrixFieldDefinitionSchemaWorker.php - - - - message: '#^Method Ibexa\\FieldTypeMatrix\\GraphQL\\SilentRow\:\:__get\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: src/lib/GraphQL/SilentRow.php - - - - message: '#^Method Ibexa\\FieldTypeMatrix\\GraphQL\\SilentRow\:\:__get\(\) has parameter \$name with no type specified\.$#' - identifier: missingType.parameter - count: 1 - path: src/lib/GraphQL/SilentRow.php diff --git a/src/bundle/Command/MigrateLegacyMatrixCommand.php b/src/bundle/Command/MigrateLegacyMatrixCommand.php index 9df7794..c54af02 100644 --- a/src/bundle/Command/MigrateLegacyMatrixCommand.php +++ b/src/bundle/Command/MigrateLegacyMatrixCommand.php @@ -27,28 +27,18 @@ use Symfony\Component\Console\Style\SymfonyStyle; #[AsCommand(name: 'ibexa:migrate:legacy_matrix')] -class MigrateLegacyMatrixCommand extends Command +final class MigrateLegacyMatrixCommand extends Command { - private const DEFAULT_ITERATION_COUNT = 1000; - private const EZMATRIX_IDENTIFIER = 'ezmatrix'; - private const CONFIRMATION_ANSWER = 'yes'; + private const int DEFAULT_ITERATION_COUNT = 1000; + private const string IBEXA_MATRIX_IDENTIFIER = 'ibexa_matrix'; + private const string CONFIRMATION_ANSWER = 'yes'; - private Connection $connection; - - /** - * @param \Doctrine\DBAL\Connection $connection - */ public function __construct( - Connection $connection + private readonly Connection $connection ) { - $this->connection = $connection; - parent::__construct(); } - /** - * {@inheritdoc} - */ protected function configure(): void { $this @@ -66,9 +56,6 @@ protected function configure(): void ); } - /** - * {@inheritdoc} - */ public function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); @@ -84,7 +71,7 @@ public function execute(InputInterface $input, OutputInterface $output): int } } - $io->comment('Migrating legacy ezmatrix fieldtype'); + $io->comment('Migrating legacy ibexa_matrix fieldtype'); $iterationCount = (int)$input->getOption('iteration-count'); $converter = new MatrixConverter(); @@ -94,13 +81,19 @@ public function execute(InputInterface $input, OutputInterface $output): int libxml_use_internal_errors(true); foreach ($contentClassAttributes as $contentClassAttribute) { - $io->comment(sprintf('Migrate %s:%s attribute.', $contentClassAttribute['contenttype_identifier'], $contentClassAttribute['identifier'])); + $io->comment( + sprintf( + 'Migrate %s:%s attribute.', + $contentClassAttribute['contenttype_identifier'], + $contentClassAttribute['identifier'] + ) + ); try { $xml = new SimpleXMLElement((string)$contentClassAttribute['columns']); $isValidXml = true; - } catch (Exception $e) { + } catch (Exception) { $isValidXml = false; } @@ -128,8 +121,8 @@ public function execute(InputInterface $input, OutputInterface $output): int $this->updateContentClassAttribute( (int)$contentClassAttribute['id'], - (int)$storageFieldDefinition->dataInt1, - (string)$storageFieldDefinition->dataText5 + $storageFieldDefinition->dataInt1, + $storageFieldDefinition->dataText5 ); $columnsJson = $storageFieldDefinition->dataText5; @@ -141,8 +134,15 @@ public function execute(InputInterface $input, OutputInterface $output): int (int)$contentClassAttribute['id'] ); - if ($contentAttributesCount === 0) { - $io->comment(sprintf('Zero instances of %s:%s attribute to migrate.', $contentClassAttribute['contenttype_identifier'], $contentClassAttribute['identifier'])); + if ($contentAttributesCount == 0) { + $io->comment( + sprintf( + 'Zero instances of %s:%s attribute to migrate.', + $contentClassAttribute['contenttype_identifier'], + $contentClassAttribute['identifier'] + ) + ); + continue; } @@ -165,7 +165,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $xml = new SimpleXMLElement( (string)$contentObjectAttribute['data_text'] ); - } catch (Exception $e) { + } catch (Exception) { $progressBar->advance(); continue; @@ -186,7 +186,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $this->updateContentObjectAttribute( (int)$contentObjectAttribute['id'], - (string)$storageFieldValue->dataText + $storageFieldValue->dataText ); $progressBar->advance(); @@ -206,10 +206,10 @@ public function execute(InputInterface $input, OutputInterface $output): int } /** - * @param array $cells - * @param array $columns + * @param array $cells + * @param list> $columns * - * @return array + * @return list> */ private function convertCellsToRows(array $cells, array $columns): array { @@ -223,7 +223,7 @@ private function convertCellsToRows(array $cells, array $columns): array $row[$columnIdentifier] = (string)$cell; - if ($columnIndex === $columnsCount - 1) { + if ($columnIndex == $columnsCount - 1) { $rows[] = $row; $row = []; } @@ -233,7 +233,7 @@ private function convertCellsToRows(array $cells, array $columns): array } /** - * @return array + * @return list> */ private function getContentClassAttributes(): array { @@ -249,7 +249,7 @@ private function getContentClassAttributes(): array ->from(ContentTypeGateway::FIELD_DEFINITION_TABLE, 'attr') ->join('attr', ContentTypeGateway::CONTENT_TYPE_TABLE, 'class', 'class.id = attr.content_type_id') ->where('attr.data_type_string = :identifier') - ->setParameter('identifier', self::EZMATRIX_IDENTIFIER); + ->setParameter('identifier', self::IBEXA_MATRIX_IDENTIFIER); return $query->executeQuery()->fetchAllAssociative(); } @@ -282,7 +282,7 @@ private function getContentObjectAttributesCount(int $id): int } /** - * @return array + * @return list> */ private function getContentObjectAttributes(int $id, int $offset, int $iterationCount): array { diff --git a/src/bundle/DependencyInjection/IbexaFieldTypeMatrixExtension.php b/src/bundle/DependencyInjection/IbexaFieldTypeMatrixExtension.php index 0f80933..5c06392 100644 --- a/src/bundle/DependencyInjection/IbexaFieldTypeMatrixExtension.php +++ b/src/bundle/DependencyInjection/IbexaFieldTypeMatrixExtension.php @@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\Yaml\Yaml; -class IbexaFieldTypeMatrixExtension extends Extension implements PrependExtensionInterface +final class IbexaFieldTypeMatrixExtension extends Extension implements PrependExtensionInterface { public function load(array $configs, ContainerBuilder $container): void { @@ -39,7 +39,7 @@ public function prepend(ContainerBuilder $container): void public function prependKernelSettings(ContainerBuilder $container): void { $configFile = __DIR__ . '/../Resources/config/kernel.yaml'; - $config = Yaml::parse(file_get_contents($configFile)); + $config = Yaml::parseFile($configFile); $container->prependExtensionConfig('ibexa', $config); $container->addResource(new FileResource($configFile)); } diff --git a/src/bundle/IbexaFieldTypeMatrixBundle.php b/src/bundle/IbexaFieldTypeMatrixBundle.php index fc81c57..39018f3 100644 --- a/src/bundle/IbexaFieldTypeMatrixBundle.php +++ b/src/bundle/IbexaFieldTypeMatrixBundle.php @@ -10,6 +10,6 @@ use Symfony\Component\HttpKernel\Bundle\Bundle; -class IbexaFieldTypeMatrixBundle extends Bundle +final class IbexaFieldTypeMatrixBundle extends Bundle { } diff --git a/src/lib/FieldType/Converter/MatrixConverter.php b/src/lib/FieldType/Converter/MatrixConverter.php index 50413ce..90e421c 100644 --- a/src/lib/FieldType/Converter/MatrixConverter.php +++ b/src/lib/FieldType/Converter/MatrixConverter.php @@ -15,16 +15,13 @@ use Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition; use Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue; -class MatrixConverter implements Converter +final readonly class MatrixConverter implements Converter { /** * Converts data from $value to $storageFieldValue. * Note: You should not throw on validation here, as it is implicitly used by ContentService->createContentDraft(). * Rather allow invalid value or omit it to let validation layer in FieldType handle issues when user tried * to publish the given draft. - * - * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $value - * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue */ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue): void { @@ -33,12 +30,6 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel $storageFieldValue->dataText = json_encode(array_values($entries)) ?: ''; } - /** - * Converts data from $value to $fieldValue. - * - * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue $value - * @param \Ibexa\Contracts\Core\Persistence\Content\FieldValue $fieldValue - */ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): void { $fieldValue->data = [ @@ -46,12 +37,6 @@ public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue): ]; } - /** - * Converts field definition data in $fieldDef into $storageFieldDef. - * - * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef - * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef - */ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef): void { $fieldSettings = $fieldDef->fieldTypeConstraints->fieldSettings; @@ -70,18 +55,12 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField $storageDef->dataText5 = json_encode($columns) ?: ''; } - /** - * Converts field definition data in $storageDef into $fieldDef. - * - * @param \Ibexa\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef - * @param \Ibexa\Contracts\Core\Persistence\Content\Type\FieldDefinition $fieldDef - */ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void { $fieldDef->fieldTypeConstraints->fieldSettings = new FieldSettings( [ 'minimum_rows' => (int)$storageDef->dataInt1, - 'columns' => json_decode($storageDef->dataText5 ?? '[]', true), + 'columns' => json_decode($storageDef->dataText5, true), ] ); @@ -94,10 +73,8 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin * "sort_key_int" or "sort_key_string". This column is then used for * filtering and sorting for this type. * If the indexing is not supported, this method must return false. - * - * @return string|false */ - public function getIndexColumn() + public function getIndexColumn(): false { return false; } diff --git a/src/lib/FieldType/Indexable.php b/src/lib/FieldType/Indexable.php index 3a3d22b..c53e9d9 100644 --- a/src/lib/FieldType/Indexable.php +++ b/src/lib/FieldType/Indexable.php @@ -21,7 +21,7 @@ public function getIndexData(Field $field, FieldDefinition $fieldDefinition): ar $cells = []; foreach ($entries as $entry) { - foreach ($entry as $column => $value) { + foreach ($entry as $value) { $cells[] = $value; } } @@ -40,12 +40,12 @@ public function getIndexDefinition(): array return []; } - public function getDefaultMatchField(): ?string + public function getDefaultMatchField(): null { return null; } - public function getDefaultSortField(): ?string + public function getDefaultSortField(): null { return null; } diff --git a/src/lib/FieldType/Mapper/FieldTypeToContentTypeStrategy.php b/src/lib/FieldType/Mapper/FieldTypeToContentTypeStrategy.php index 9592d06..388588e 100644 --- a/src/lib/FieldType/Mapper/FieldTypeToContentTypeStrategy.php +++ b/src/lib/FieldType/Mapper/FieldTypeToContentTypeStrategy.php @@ -12,13 +12,10 @@ use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition; -final class FieldTypeToContentTypeStrategy implements FieldTypeToContentTypeStrategyInterface +final readonly class FieldTypeToContentTypeStrategy implements FieldTypeToContentTypeStrategyInterface { - private ContentTypeService $contentTypeService; - - public function __construct(ContentTypeService $contentTypeService) + public function __construct(private ContentTypeService $contentTypeService) { - $this->contentTypeService = $contentTypeService; } public function findContentTypeOf(FieldDefinition $fieldDefinition): ?ContentType diff --git a/src/lib/FieldType/Mapper/MatrixFormMapper.php b/src/lib/FieldType/Mapper/MatrixFormMapper.php index 3333f9b..e38ab9c 100644 --- a/src/lib/FieldType/Mapper/MatrixFormMapper.php +++ b/src/lib/FieldType/Mapper/MatrixFormMapper.php @@ -14,11 +14,12 @@ use Ibexa\Contracts\ContentForms\FieldType\FieldValueFormMapperInterface; use Ibexa\FieldTypeMatrix\Form\Type\ColumnType; use Ibexa\FieldTypeMatrix\Form\Type\FieldType\MatrixFieldType; +use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\Form\Extension\Core\Type\IntegerType; use Symfony\Component\Form\FormInterface; -class MatrixFormMapper implements FieldDefinitionFormMapperInterface, FieldValueFormMapperInterface +final readonly class MatrixFormMapper implements FieldDefinitionFormMapperInterface, FieldValueFormMapperInterface { /** * "Maps" FieldDefinition form to current FieldType. @@ -26,9 +27,6 @@ class MatrixFormMapper implements FieldDefinitionFormMapperInterface, FieldValue * - validator configuration, * - field settings * - default value. - * - * @param \Symfony\Component\Form\FormInterface<\Ibexa\AdminUi\Form\Data\FieldDefinitionData> $fieldDefinitionForm form for current FieldDefinition - * @param \Ibexa\AdminUi\Form\Data\FieldDefinitionData $data underlying data for current FieldDefinition form */ public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void { @@ -60,13 +58,11 @@ public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, Field /** * Maps Field form to current FieldType. * Allows to add form fields for content edition. - * - * @param \Symfony\Component\Form\FormInterface<\Ibexa\Contracts\ContentForms\Data\Content\FieldData> $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): void { $fieldDefinition = $data->fieldDefinition; + $fieldSettings = $fieldDefinition->getFieldSettings(); $formConfig = $fieldForm->getConfig(); $fieldForm @@ -78,8 +74,8 @@ public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): vo [ 'label' => $fieldDefinition->getName(), 'required' => $fieldDefinition->isRequired, - 'columns' => $fieldDefinition->fieldSettings['columns'], - 'minimum_rows' => $fieldDefinition->fieldSettings['minimum_rows'], + 'columns' => $fieldSettings['columns'], + 'minimum_rows' => $fieldSettings['minimum_rows'], ] ) ->setAutoInitialize(false) diff --git a/src/lib/FieldType/Type.php b/src/lib/FieldType/Type.php index 464b4a2..9bde934 100644 --- a/src/lib/FieldType/Type.php +++ b/src/lib/FieldType/Type.php @@ -15,11 +15,9 @@ use Ibexa\Core\FieldType\Value as FieldTypeValue; use Ibexa\FieldTypeMatrix\FieldType\Value\Row; -class Type extends FieldType +final class Type extends FieldType { - /** - * {@inheritdoc} - */ + /** @var array>> */ protected $settingsSchema = [ 'minimum_rows' => [ 'type' => 'integer', @@ -31,28 +29,16 @@ class Type extends FieldType ], ]; - private string $fieldTypeIdentifier; - - /** - * @param string $fieldTypeIdentifier - */ - public function __construct(string $fieldTypeIdentifier) + public function __construct(private readonly string $fieldTypeIdentifier) { - $this->fieldTypeIdentifier = $fieldTypeIdentifier; } - /** - * {@inheritdoc} - */ - protected function getSortInfo(FieldTypeValue $value) + protected function getSortInfo(FieldTypeValue $value): string { return ''; } - /** - * {@inheritdoc} - */ - public function validateFieldSettings($fieldSettings): array + public function validateFieldSettings(mixed $fieldSettings): array { $minimumRows = $fieldSettings['minimum_rows']; $columns = array_values($fieldSettings['columns'] ?? []); @@ -91,10 +77,7 @@ public function validateFieldSettings($fieldSettings): array return $errors ?? []; } - /** - * {@inheritdoc} - */ - protected function createValueFromInput($inputValue) + protected function createValueFromInput(mixed $inputValue): mixed { if (is_array($inputValue)) { $inputValue = new Value($inputValue); @@ -103,33 +86,21 @@ protected function createValueFromInput($inputValue) return $inputValue; } - /** - * {@inheritdoc} - */ public function getFieldTypeIdentifier(): string { return $this->fieldTypeIdentifier; } - /** - * {@inheritdoc} - */ public function getName(SPIValue $value, FieldDefinition $fieldDefinition, string $languageCode): string { return ''; } - /** - * {@inheritdoc} - */ public function getEmptyValue(): SPIValue { return new Value([]); } - /** - * {@inheritdoc} - */ public function fromHash($hash): SPIValue { $entries = $hash['entries'] ?? []; @@ -141,18 +112,11 @@ public function fromHash($hash): SPIValue return new Value($rows ?? []); } - /** - * {@inheritdoc} - */ protected function checkValueStructure(FieldTypeValue $value): void { // Value is self-contained and strong typed - return; } - /** - * {@inheritdoc} - */ public function isEmptyValue(SPIValue $value): bool { /** @var \Ibexa\FieldTypeMatrix\FieldType\Value $value */ @@ -160,11 +124,11 @@ public function isEmptyValue(SPIValue $value): bool } /** - * {@inheritdoc} - * * @param \Ibexa\FieldTypeMatrix\FieldType\Value $value + * + * @return \Ibexa\Core\FieldType\ValidationError[] */ - public function validate(FieldDefinition $fieldDefinition, SPIValue $value) + public function validate(FieldDefinition $fieldDefinition, SPIValue $value): array { if ($this->isEmptyValue($value)) { return []; @@ -193,13 +157,12 @@ public function validate(FieldDefinition $fieldDefinition, SPIValue $value) } /** - * {@inheritdoc} + * @return array */ - public function toHash(SPIValue $value) + public function toHash(SPIValue $value): array { /** @var \Ibexa\FieldTypeMatrix\FieldType\Value $value */ $rows = $value->getRows(); - $hash['entries'] = []; foreach ($rows as $row) { @@ -209,7 +172,7 @@ public function toHash(SPIValue $value) return $hash; } - public function isSearchable(): bool + public function isSearchable(): true { return true; } diff --git a/src/lib/FieldType/Value.php b/src/lib/FieldType/Value.php index cb7679d..a7a0ad6 100644 --- a/src/lib/FieldType/Value.php +++ b/src/lib/FieldType/Value.php @@ -11,7 +11,7 @@ use Ibexa\Core\FieldType\Value as BaseValue; use Ibexa\FieldTypeMatrix\FieldType\Value\RowsCollection; -class Value extends BaseValue +final class Value extends BaseValue { protected RowsCollection $rows; @@ -20,6 +20,8 @@ class Value extends BaseValue */ public function __construct(array $rows = []) { + parent::__construct(); + $this->rows = new RowsCollection($rows); } diff --git a/src/lib/FieldType/Value/Row.php b/src/lib/FieldType/Value/Row.php index 44d2649..453b144 100644 --- a/src/lib/FieldType/Value/Row.php +++ b/src/lib/FieldType/Value/Row.php @@ -10,13 +10,16 @@ class Row { - protected array $cells; - - public function __construct(array $cells = []) + /** + * @param array $cells + */ + public function __construct(protected array $cells = []) { - $this->cells = $cells; } + /** + * @return array + */ public function getCells(): array { return $this->cells; @@ -30,12 +33,15 @@ public function isEmpty(): bool return count($filtered) === 0; } - public function __get($name) + /** + * @return array|string + */ + public function __get(string $name): array|string { return $this->cells[$name]; } - public function __isset($name): bool + public function __isset(string $name): bool { return isset($this->cells[$name]); } diff --git a/src/lib/FieldType/Value/RowsCollection.php b/src/lib/FieldType/Value/RowsCollection.php index ad126d2..b307e7d 100644 --- a/src/lib/FieldType/Value/RowsCollection.php +++ b/src/lib/FieldType/Value/RowsCollection.php @@ -9,17 +9,14 @@ namespace Ibexa\FieldTypeMatrix\FieldType\Value; use ArrayObject; -use Ibexa\Core\Base\Exceptions\InvalidArgumentType; /** * @extends ArrayObject */ -class RowsCollection extends ArrayObject +final class RowsCollection extends ArrayObject { /** * @param \Ibexa\FieldTypeMatrix\FieldType\Value\Row[] $elements - * - * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType */ public function __construct(array $elements = []) { @@ -29,23 +26,4 @@ public function __construct(array $elements = []) $this->offsetSet($index, $element); } } - - /** - * @param mixed $offset - * @param mixed $value - * - * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType - */ - public function offsetSet($offset, $value): void - { - if (!$value instanceof Row) { - throw new InvalidArgumentType( - '$value', - Row::class, - $value - ); - } - - parent::offsetSet($offset, $value); - } } diff --git a/src/lib/Form/Transformer/FieldTypeModelTransformer.php b/src/lib/Form/Transformer/FieldTypeModelTransformer.php index c3444f1..69c2e62 100644 --- a/src/lib/Form/Transformer/FieldTypeModelTransformer.php +++ b/src/lib/Form/Transformer/FieldTypeModelTransformer.php @@ -15,12 +15,14 @@ /** * @implements DataTransformerInterface<\Ibexa\FieldTypeMatrix\FieldType\Value, array> */ -class FieldTypeModelTransformer implements DataTransformerInterface +final readonly class FieldTypeModelTransformer implements DataTransformerInterface { - public function transform(mixed $value): mixed + /** + * @return array + */ + public function transform(mixed $value): array { $hash['entries'] = []; - if ($value === null) { return $hash; } @@ -32,7 +34,7 @@ public function transform(mixed $value): mixed return $hash; } - public function reverseTransform(mixed $value): mixed + public function reverseTransform(mixed $value): Value { $entries = $value['entries'] ?? []; diff --git a/src/lib/Form/Type/ColumnType.php b/src/lib/Form/Type/ColumnType.php index 49abf49..141e7df 100644 --- a/src/lib/Form/Type/ColumnType.php +++ b/src/lib/Form/Type/ColumnType.php @@ -8,6 +8,7 @@ namespace Ibexa\FieldTypeMatrix\Form\Type; +use JMS\TranslationBundle\Annotation\Desc; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; @@ -16,8 +17,11 @@ /** * @phpstan-extends \Symfony\Component\Form\AbstractType */ -class ColumnType extends AbstractType +final class ColumnType extends AbstractType { + /** + * @param array $options + */ public function buildForm(FormBuilderInterface $builder, array $options): void { $builder diff --git a/src/lib/Form/Type/FieldType/MatrixCollectionType.php b/src/lib/Form/Type/FieldType/MatrixCollectionType.php index 46783be..78fc216 100644 --- a/src/lib/Form/Type/FieldType/MatrixCollectionType.php +++ b/src/lib/Form/Type/FieldType/MatrixCollectionType.php @@ -17,7 +17,7 @@ /** * @phpstan-extends \Symfony\Component\Form\AbstractType>> */ -class MatrixCollectionType extends AbstractType +final class MatrixCollectionType extends AbstractType { public function getName(): string { @@ -47,6 +47,9 @@ public function configureOptions(OptionsResolver $resolver): void parent::configureOptions($resolver); } + /** + * @param array $options + */ public function buildView(FormView $view, FormInterface $form, array $options): void { $view->vars['columns'] = $options['columns']; diff --git a/src/lib/Form/Type/FieldType/MatrixEntryType.php b/src/lib/Form/Type/FieldType/MatrixEntryType.php index 3adb749..251f6c0 100644 --- a/src/lib/Form/Type/FieldType/MatrixEntryType.php +++ b/src/lib/Form/Type/FieldType/MatrixEntryType.php @@ -18,7 +18,7 @@ /** * @phpstan-extends \Symfony\Component\Form\AbstractType> */ -class MatrixEntryType extends AbstractType +final class MatrixEntryType extends AbstractType { public function getName(): string { diff --git a/src/lib/Form/Type/FieldType/MatrixFieldType.php b/src/lib/Form/Type/FieldType/MatrixFieldType.php index efac933..984a99c 100644 --- a/src/lib/Form/Type/FieldType/MatrixFieldType.php +++ b/src/lib/Form/Type/FieldType/MatrixFieldType.php @@ -22,7 +22,7 @@ /** * @phpstan-extends \Symfony\Component\Form\AbstractType>}> */ -class MatrixFieldType extends AbstractType +final class MatrixFieldType extends AbstractType { public function getName(): string { diff --git a/src/lib/GraphQL/FieldValueResolver.php b/src/lib/GraphQL/FieldValueResolver.php index 8d2bcfe..a84cfa9 100644 --- a/src/lib/GraphQL/FieldValueResolver.php +++ b/src/lib/GraphQL/FieldValueResolver.php @@ -12,21 +12,16 @@ use Ibexa\FieldTypeMatrix\FieldType\Value\RowsCollection; use Overblog\GraphQLBundle\Definition\Resolver\QueryInterface; -class FieldValueResolver implements QueryInterface +final readonly class FieldValueResolver implements QueryInterface { - /** @var iterable<\Ibexa\FieldTypeMatrix\GraphQL\Strategy\ContentResolvingStrategyInterface> */ - private iterable $strategies; - /** * @param iterable<\Ibexa\FieldTypeMatrix\GraphQL\Strategy\ContentResolvingStrategyInterface> $strategies */ - public function __construct(iterable $strategies) + public function __construct(private iterable $strategies) { - $this->strategies = $strategies; } /** - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException */ public function resolveMatrixFieldValue(object $item, string $fieldDefIdentifier): RowsCollection diff --git a/src/lib/GraphQL/InputHandler.php b/src/lib/GraphQL/InputHandler.php index c8cea86..e9765ae 100644 --- a/src/lib/GraphQL/InputHandler.php +++ b/src/lib/GraphQL/InputHandler.php @@ -13,9 +13,12 @@ use Ibexa\FieldTypeMatrix\FieldType\Value as MatrixValue; use Ibexa\FieldTypeMatrix\FieldType\Value\Row; -class InputHandler implements FieldTypeInputHandler +final readonly class InputHandler implements FieldTypeInputHandler { - public function toFieldValue($input, $inputFormat = null): Value + /** + * @param array $input + */ + public function toFieldValue($input, mixed $inputFormat = null): Value { return new MatrixValue( array_map( diff --git a/src/lib/GraphQL/Schema/MatrixFieldDefinitionInputSchemaWorker.php b/src/lib/GraphQL/Schema/MatrixFieldDefinitionInputSchemaWorker.php index ea28067..c8d26bc 100644 --- a/src/lib/GraphQL/Schema/MatrixFieldDefinitionInputSchemaWorker.php +++ b/src/lib/GraphQL/Schema/MatrixFieldDefinitionInputSchemaWorker.php @@ -13,15 +13,15 @@ use Ibexa\GraphQL\Schema\Builder; use Ibexa\GraphQL\Schema\Worker; -class MatrixFieldDefinitionInputSchemaWorker implements Worker +final readonly class MatrixFieldDefinitionInputSchemaWorker implements Worker { - private NameHelper $nameHelper; - - public function __construct(NameHelper $nameHelper) + public function __construct(private NameHelper $nameHelper) { - $this->nameHelper = $nameHelper; } + /** + * @param array $args + */ public function work(Builder $schema, array $args): void { $typeName = $this->typeName($args); @@ -41,6 +41,9 @@ public function work(Builder $schema, array $args): void } } + /** + * @param array $args + */ public function canWork(Builder $schema, array $args): bool { return @@ -52,8 +55,14 @@ public function canWork(Builder $schema, array $args): bool && !$schema->hasType($this->typeName($args)); } + /** + * @param array $args + */ private function typeName(array $args): string { - return $this->nameHelper->matrixFieldDefinitionInputType($args['ContentType'], $args['FieldDefinition']); + return $this->nameHelper->matrixFieldDefinitionInputType( + $args['ContentType'], + $args['FieldDefinition'] + ); } } diff --git a/src/lib/GraphQL/Schema/MatrixFieldDefinitionMapper.php b/src/lib/GraphQL/Schema/MatrixFieldDefinitionMapper.php index 70dcc77..5b4273a 100644 --- a/src/lib/GraphQL/Schema/MatrixFieldDefinitionMapper.php +++ b/src/lib/GraphQL/Schema/MatrixFieldDefinitionMapper.php @@ -14,28 +14,20 @@ use Ibexa\Core\Base\Exceptions\NotFoundException; use Ibexa\GraphQL\Schema\Domain\Content\Mapper\FieldDefinition\DecoratingFieldDefinitionMapper; -class MatrixFieldDefinitionMapper extends DecoratingFieldDefinitionMapper implements FieldDefinitionMapper +final class MatrixFieldDefinitionMapper extends DecoratingFieldDefinitionMapper implements FieldDefinitionMapper { - private NameHelper $nameHelper; - - /** @var iterable<\Ibexa\FieldTypeMatrix\FieldType\Mapper\FieldTypeToContentTypeStrategyInterface> */ - private iterable $strategies; - /** * @param iterable<\Ibexa\FieldTypeMatrix\FieldType\Mapper\FieldTypeToContentTypeStrategyInterface> $strategies */ public function __construct( FieldDefinitionMapper $innerMapper, - NameHelper $nameHelper, - iterable $strategies + private readonly NameHelper $nameHelper, + private readonly iterable $strategies ) { parent::__construct($innerMapper); - - $this->nameHelper = $nameHelper; - $this->strategies = $strategies; } - public function mapToFieldDefinitionType(FieldDefinition $fieldDefinition): ?string + public function mapToFieldDefinitionType(FieldDefinition $fieldDefinition): string { return 'MatrixFieldDefinition'; } @@ -45,6 +37,9 @@ protected function getFieldTypeIdentifier(): string return 'ibexa_matrix'; } + /** + * @throws \Ibexa\Core\Base\Exceptions\NotFoundException + */ public function mapToFieldValueType(FieldDefinition $fieldDefinition): ?string { if (!$this->canMap($fieldDefinition)) { diff --git a/src/lib/GraphQL/Schema/MatrixFieldDefinitionSchemaWorker.php b/src/lib/GraphQL/Schema/MatrixFieldDefinitionSchemaWorker.php index f510a58..22214d2 100644 --- a/src/lib/GraphQL/Schema/MatrixFieldDefinitionSchemaWorker.php +++ b/src/lib/GraphQL/Schema/MatrixFieldDefinitionSchemaWorker.php @@ -13,15 +13,15 @@ use Ibexa\GraphQL\Schema\Builder; use Ibexa\GraphQL\Schema\Worker; -class MatrixFieldDefinitionSchemaWorker implements Worker +final readonly class MatrixFieldDefinitionSchemaWorker implements Worker { - private NameHelper $nameHelper; - - public function __construct(NameHelper $nameHelper) + public function __construct(private NameHelper $nameHelper) { - $this->nameHelper = $nameHelper; } + /** + * @param array $args + */ public function work(Builder $schema, array $args): void { $typeName = $this->typeName($args); @@ -41,6 +41,9 @@ public function work(Builder $schema, array $args): void } } + /** + * @param array $args + */ public function canWork(Builder $schema, array $args): bool { return @@ -52,8 +55,14 @@ public function canWork(Builder $schema, array $args): bool && !$schema->hasType($this->typeName($args)); } + /** + * @param array $args + */ private function typeName(array $args): string { - return $this->nameHelper->matrixFieldDefinitionType($args['ContentType'], $args['FieldDefinition']); + return $this->nameHelper->matrixFieldDefinitionType( + $args['ContentType'], + $args['FieldDefinition'] + ); } } diff --git a/src/lib/GraphQL/Schema/NameHelper.php b/src/lib/GraphQL/Schema/NameHelper.php index e916102..8683aaf 100644 --- a/src/lib/GraphQL/Schema/NameHelper.php +++ b/src/lib/GraphQL/Schema/NameHelper.php @@ -12,7 +12,7 @@ use Ibexa\Contracts\Core\Repository\Values\ContentType\FieldDefinition; use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter; -class NameHelper +final readonly class NameHelper { public function matrixFieldDefinitionType(ContentType $contentType, FieldDefinition $fieldDefinition): string { diff --git a/src/lib/GraphQL/SilentRow.php b/src/lib/GraphQL/SilentRow.php index d169474..8de0051 100644 --- a/src/lib/GraphQL/SilentRow.php +++ b/src/lib/GraphQL/SilentRow.php @@ -10,9 +10,12 @@ use Ibexa\FieldTypeMatrix\FieldType\Value\Row; -class SilentRow extends Row +final class SilentRow extends Row { - public function __get($name) + /** + * @return array|string + */ + public function __get(string $name): array|string { return $this->cells[$name] ?? ''; } diff --git a/tests/lib/CoreSetupFactoryTrait.php b/tests/lib/CoreSetupFactoryTrait.php index 427c2f1..eb8bd27 100644 --- a/tests/lib/CoreSetupFactoryTrait.php +++ b/tests/lib/CoreSetupFactoryTrait.php @@ -23,8 +23,6 @@ trait CoreSetupFactoryTrait * * @todo refactor ibexa/core SetupFactory to include that setup w/o relying on config.php * - * @param \Symfony\Component\DependencyInjection\ContainerBuilder $containerBuilder - * * @throws \Exception */ protected function loadCoreSettings(ContainerBuilder $containerBuilder): void diff --git a/tests/lib/LegacySetupFactory.php b/tests/lib/LegacySetupFactory.php index 7559fe0..f11caf5 100644 --- a/tests/lib/LegacySetupFactory.php +++ b/tests/lib/LegacySetupFactory.php @@ -22,7 +22,6 @@ final class LegacySetupFactory extends CoreLegacySetupFactory public function getServiceContainer(): ServiceContainer { if (!isset(self::$serviceContainer)) { - /** @var \Symfony\Component\DependencyInjection\ContainerBuilder $containerBuilder */ $containerBuilder = new ContainerBuilder(); $this->externalBuildContainer($containerBuilder); self::$serviceContainer = new ServiceContainer( @@ -37,6 +36,9 @@ public function getServiceContainer(): ServiceContainer return self::$serviceContainer; } + /** + * @throws \Exception + */ protected function externalBuildContainer(ContainerBuilder $containerBuilder): void { $this->loadCoreSettings($containerBuilder); diff --git a/tests/lib/Repository/SearchServiceTest.php b/tests/lib/Repository/SearchServiceTest.php index 5340e78..199ca63 100644 --- a/tests/lib/Repository/SearchServiceTest.php +++ b/tests/lib/Repository/SearchServiceTest.php @@ -17,19 +17,12 @@ final class SearchServiceTest extends BaseTestCase { + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + */ public function testFindContentWithMatrixFieldType(): void { - $content = $this->createAndPublishContentWithMatrixFieldType( - 'Content with table', - new Value([ - new Row([ - 'foo' => 'Foo', - 'bar' => 'Bar', - 'baz' => 'Baz', - ]), - ]) - ); - + $content = $this->createAndPublishContentWithMatrixFieldType(); $searchService = $this->getRepository()->getSearchService(); $searchResults = $searchService->findContent( @@ -42,9 +35,9 @@ public function testFindContentWithMatrixFieldType(): void self::assertEquals($content->id, $searchResults->searchHits[0]->valueObject->id); } - private function createAndPublishContentWithMatrixFieldType(string $title, Value $table): Content + private function createAndPublishContentWithMatrixFieldType(): Content { - $contentType = $this->createContentTypeWithMatrixFieldType('content_with_table'); + $contentType = $this->createContentTypeWithMatrixFieldType(); $contentService = $this->getRepository()->getContentService(); $locationService = $this->getRepository()->getLocationService(); @@ -72,8 +65,16 @@ private function createAndPublishContentWithMatrixFieldType(string $title, Value return $contentService->publishVersion($content->getVersionInfo()); } - private function createContentTypeWithMatrixFieldType(string $identifier): ContentType + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentTypeFieldDefinitionValidationException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException + */ + private function createContentTypeWithMatrixFieldType(): ContentType { + $identifier = 'content_with_table'; $repository = $this->getRepository(); $contentTypeService = $repository->getContentTypeService(); From fd47c667e39455058c4322cbbf5e40f8dfb4e787 Mon Sep 17 00:00:00 2001 From: konradoboza Date: Mon, 14 Jul 2025 08:58:36 +0200 Subject: [PATCH 2/2] cr remarks --- src/bundle/Command/MigrateLegacyMatrixCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bundle/Command/MigrateLegacyMatrixCommand.php b/src/bundle/Command/MigrateLegacyMatrixCommand.php index c54af02..42bb00b 100644 --- a/src/bundle/Command/MigrateLegacyMatrixCommand.php +++ b/src/bundle/Command/MigrateLegacyMatrixCommand.php @@ -134,7 +134,7 @@ public function execute(InputInterface $input, OutputInterface $output): int (int)$contentClassAttribute['id'] ); - if ($contentAttributesCount == 0) { + if ($contentAttributesCount === 0) { $io->comment( sprintf( 'Zero instances of %s:%s attribute to migrate.',