Skip to content

Commit 12ca9b4

Browse files
committed
IBX-8753: Refactor fieldIdentifiers parameter to enforce array type in ModifyFieldDefinitionFieldsSubscriber and ModifyFieldDefinitionsCollectionTypeExtension constructors
1 parent b6f359f commit 12ca9b4

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/lib/Form/Type/Extension/EventSubscriber/ModifyFieldDefinitionFieldsSubscriber.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
final class ModifyFieldDefinitionFieldsSubscriber implements EventSubscriberInterface
2424
{
25-
private string $fieldTypeIdentifier;
25+
private ?string $fieldTypeIdentifier;
2626

2727
/** @var string[] */
2828
private array $fieldIdentifiers;
@@ -33,18 +33,18 @@ final class ModifyFieldDefinitionFieldsSubscriber implements EventSubscriberInte
3333
private ?SpecificationInterface $contentTypeSpecification;
3434

3535
/**
36-
* @param string[]|string $fieldIdentifiers
3736
* @param array<string, mixed> $modifiedOptions
37+
* @param array<string> $fieldIdentifiers
3838
*/
3939
public function __construct(
40-
string $fieldTypeIdentifier,
40+
?string $fieldTypeIdentifier,
4141
array $modifiedOptions,
42-
$fieldIdentifiers = [],
42+
array $fieldIdentifiers = [],
4343
?SpecificationInterface $contentTypeSpecification = null
4444
) {
4545
$this->fieldTypeIdentifier = $fieldTypeIdentifier;
4646
$this->modifiedOptions = $modifiedOptions;
47-
$this->fieldIdentifiers = is_array($fieldIdentifiers) ? $fieldIdentifiers : [$fieldIdentifiers];
47+
$this->fieldIdentifiers = $fieldIdentifiers;
4848
$this->contentTypeSpecification = $contentTypeSpecification;
4949
}
5050

src/lib/Form/Type/Extension/ModifyFieldDefinitionsCollectionTypeExtension.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
final class ModifyFieldDefinitionsCollectionTypeExtension extends AbstractTypeExtension
2323
{
24-
private string $fieldTypeIdentifier;
24+
private ?string $fieldTypeIdentifier;
2525

2626
/** @var string[] */
2727
private array $fieldIdentifiers;
@@ -32,17 +32,17 @@ final class ModifyFieldDefinitionsCollectionTypeExtension extends AbstractTypeEx
3232
private ?SpecificationInterface $contentTypeSpecification;
3333

3434
/**
35-
* @param string|string[] $fieldIdentifiers
3635
* @param array<string, mixed> $modifiedOptions
36+
* @param array<string> $fieldIdentifiers
3737
*/
3838
public function __construct(
39-
string $fieldTypeIdentifier,
39+
?string $fieldTypeIdentifier,
4040
array $modifiedOptions,
41-
$fieldIdentifiers = [],
41+
array $fieldIdentifiers = [],
4242
?SpecificationInterface $contentTypeSpecification = null
4343
) {
4444
$this->fieldTypeIdentifier = $fieldTypeIdentifier;
45-
$this->fieldIdentifiers = is_array($fieldIdentifiers) ? $fieldIdentifiers : [$fieldIdentifiers];
45+
$this->fieldIdentifiers = $fieldIdentifiers;
4646
$this->modifiedOptions = $modifiedOptions;
4747
$this->contentTypeSpecification = $contentTypeSpecification;
4848
}

0 commit comments

Comments
 (0)