Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
"ibexa/search": "~5.0.x-dev",
"ibexa/test-core": "~5.0.x-dev",
"ibexa/user": "~5.0.x-dev",
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^1.12",
"phpstan/phpstan-phpunit": "^1.4",
"phpstan/phpstan-symfony": "^1.4"
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-symfony": "^2.0",
"phpunit/phpunit": "^9.5"
},
"scripts": {
"fix-cs": "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots",
Expand Down
6 changes: 3 additions & 3 deletions src/bundle/Command/MigrateLegacyMatrixCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@
use Ibexa\Core\Persistence\Legacy\Content\StorageFieldValue;
use Ibexa\FieldTypeMatrix\FieldType\Converter\MatrixConverter;
use SimpleXMLElement;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

#[\Symfony\Component\Console\Attribute\AsCommand(name: 'ibexa:migrate:legacy_matrix')]
#[AsCommand(name: 'ibexa:migrate:legacy_matrix')]
class MigrateLegacyMatrixCommand extends Command
{
private const DEFAULT_ITERATION_COUNT = 1000;
private const EZMATRIX_IDENTIFIER = 'ezmatrix';
private const CONFIRMATION_ANSWER = 'yes';

/** @var \Doctrine\DBAL\Connection */
private $connection;
private Connection $connection;

/**
* @param \Doctrine\DBAL\Connection $connection
Expand Down
2 changes: 1 addition & 1 deletion src/lib/FieldType/Converter/MatrixConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField
$columns = array_values($fieldSettings['columns']);
$minimumRows = (int)$fieldSettings['minimum_rows'];

array_walk($columns, static function ($column) {
array_walk($columns, static function ($column): array {
return [
'identifier' => trim($column['identifier'] ?? ''),
'name' => trim($column['name'] ?? ''),
Expand Down
3 changes: 1 addition & 2 deletions src/lib/FieldType/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class Type extends FieldType
],
];

/** @var string */
private $fieldTypeIdentifier;
private string $fieldTypeIdentifier;

/**
* @param string $fieldTypeIdentifier
Expand Down
3 changes: 3 additions & 0 deletions src/lib/Form/Type/ColumnType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* @phpstan-extends \Symfony\Component\Form\AbstractType<array{name: string, identifier: string}>
*/
class ColumnType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
Expand Down
3 changes: 3 additions & 0 deletions src/lib/Form/Type/FieldType/MatrixCollectionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* @phpstan-extends \Symfony\Component\Form\AbstractType<array<int, array<string, mixed>>>
*/
class MatrixCollectionType extends AbstractType
{
public function getName(): string
Expand Down
3 changes: 3 additions & 0 deletions src/lib/Form/Type/FieldType/MatrixEntryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* @phpstan-extends \Symfony\Component\Form\AbstractType<array<string, mixed>>
*/
class MatrixEntryType extends AbstractType
{
public function getName(): string
Expand Down
14 changes: 4 additions & 10 deletions src/lib/Form/Type/FieldType/MatrixFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,21 @@
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* @phpstan-extends \Symfony\Component\Form\AbstractType<array{entries: array<int, array<string, mixed>>}>
*/
class MatrixFieldType extends AbstractType
{
/**
* @return string
*/
public function getName(): string
{
return $this->getBlockPrefix();
}

/**
* @return string
*/
public function getBlockPrefix(): string
{
return 'ezplatform_fieldtype_ezmatrix';
}

/**
* @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefined(['columns', 'minimum_rows']);
Expand Down Expand Up @@ -68,7 +62,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
$columnsByIdentifier = array_flip(array_column($options['columns'], 'identifier'));

// Filter out unnecessary/obsolete columns data
$builder->addEventListener(FormEvents::PRE_SET_DATA, static function (FormEvent $event) use ($columnsByIdentifier) {
$builder->addEventListener(FormEvents::PRE_SET_DATA, static function (FormEvent $event) use ($columnsByIdentifier): void {
$value = $event->getData();

/** @var \Ibexa\FieldTypeMatrix\FieldType\Value\Row $originalRow */
Expand Down
5 changes: 3 additions & 2 deletions src/lib/GraphQL/InputHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
use Ibexa\Contracts\Core\FieldType\Value;
use Ibexa\Contracts\GraphQL\Mutation\InputHandler\FieldTypeInputHandler;
use Ibexa\FieldTypeMatrix\FieldType\Value as MatrixValue;
use Ibexa\FieldTypeMatrix\FieldType\Value\Row;

class InputHandler implements FieldTypeInputHandler
{
public function toFieldValue($input, $inputFormat = null): Value
{
return new MatrixValue(
array_map(
static function (array $row) {
return new MatrixValue\Row($row);
static function (array $row): Row {
return new Row($row);
},
$input
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

class MatrixFieldDefinitionInputSchemaWorker implements Worker
{
/** @var \Ibexa\FieldTypeMatrix\GraphQL\Schema\NameHelper */
private $nameHelper;
private NameHelper $nameHelper;

public function __construct(NameHelper $nameHelper)
{
Expand Down
3 changes: 1 addition & 2 deletions src/lib/GraphQL/Schema/MatrixFieldDefinitionMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

class MatrixFieldDefinitionMapper extends DecoratingFieldDefinitionMapper implements FieldDefinitionMapper
{
/** @var \Ibexa\FieldTypeMatrix\GraphQL\Schema\NameHelper */
private $nameHelper;
private NameHelper $nameHelper;

/** @var iterable<\Ibexa\FieldTypeMatrix\FieldType\Mapper\FieldTypeToContentTypeStrategyInterface> */
private iterable $strategies;
Expand Down
3 changes: 1 addition & 2 deletions src/lib/GraphQL/Schema/MatrixFieldDefinitionSchemaWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

class MatrixFieldDefinitionSchemaWorker implements Worker
{
/** @var \Ibexa\FieldTypeMatrix\GraphQL\Schema\NameHelper */
private $nameHelper;
private NameHelper $nameHelper;

public function __construct(NameHelper $nameHelper)
{
Expand Down
Loading