Skip to content

Commit 4065d9e

Browse files
committed
Fix PHPStan issues
1 parent 95f31bc commit 4065d9e

File tree

7 files changed

+19
-25
lines changed

7 files changed

+19
-25
lines changed

bundle/Core/FieldType/Tags/FormMapper.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,9 @@ public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, Field
6868
'property_path' => 'validatorConfiguration[TagsValueValidator][maxTags]',
6969
'label' => 'field_definition.tags.validator.max_tags',
7070
'constraints' => [
71-
new Constraints\Type(['type' => 'int']),
71+
new Constraints\Type(type: 'int'),
7272
new Constraints\NotBlank(),
73-
new Constraints\GreaterThanOrEqual(
74-
[
75-
'value' => 0,
76-
],
77-
),
73+
new Constraints\PositiveOrZero(),
7874
],
7975
'empty_data' => 0,
8076
'attr' => [
@@ -90,7 +86,7 @@ public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, Field
9086
'property_path' => 'fieldSettings[hideRootTag]',
9187
'label' => 'field_definition.tags.settings.hide_root_tag',
9288
'constraints' => [
93-
new Constraints\Type(['type' => 'bool']),
89+
new Constraints\Type(type: 'bool'),
9490
new Constraints\NotNull(),
9591
],
9692
],
@@ -104,13 +100,10 @@ public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, Field
104100
'property_path' => 'fieldSettings[editView]',
105101
'label' => 'field_definition.tags.settings.edit_view',
106102
'constraints' => [
107-
new Constraints\Type(['type' => 'string']),
103+
new Constraints\Type(type: 'string'),
108104
new Constraints\NotBlank(),
109105
new Constraints\Choice(
110-
[
111-
'choices' => array_values($editViewChoices),
112-
'strict' => true,
113-
],
106+
choices: array_values($editViewChoices),
114107
),
115108
],
116109
],

bundle/DependencyInjection/Configuration.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99

1010
final class Configuration extends SiteAccessConfiguration
1111
{
12+
/**
13+
* @return \Symfony\Component\Config\Definition\Builder\TreeBuilder<'array'>
14+
*/
1215
public function getConfigTreeBuilder(): TreeBuilder
1316
{
1417
$treeBuilder = new TreeBuilder('netgen_tags');
15-
16-
/** @var \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition $rootNode */
1718
$rootNode = $treeBuilder->getRootNode();
1819

1920
$this->generateScopeBaseNode($rootNode)

bundle/Form/Type/TagTreeType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function configureOptions(OptionsResolver $resolver): void
3737
'allowRootTag' => true,
3838
'disableSubtree' => [],
3939
'constraints' => static fn (Options $options): array => [
40-
new Constraints\Type(['type' => 'int']),
40+
new Constraints\Type(type: 'int'),
4141
new Constraints\NotBlank(),
4242
new TagConstraint(['allowRootTag' => $options['allowRootTag']]),
4343
],

bundle/Validator/Structs/CreateStructValidator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,31 @@ public function validate(mixed $value, Constraint $constraint): void
1919
$validator->atPath('alwaysAvailable')->validate(
2020
$value->alwaysAvailable,
2121
[
22-
new Constraints\Type(['type' => 'bool']),
22+
new Constraints\Type(type: 'bool'),
2323
new Constraints\NotNull(),
2424
],
2525
);
2626

2727
$validator->atPath('keyword')->validate(
2828
$value->getKeyword(),
2929
[
30-
new Constraints\Type(['type' => 'string']),
30+
new Constraints\Type(type: 'string'),
3131
new Constraints\NotBlank(),
3232
],
3333
);
3434

3535
$validator->atPath('remoteId')->validate(
3636
$value->remoteId,
3737
[
38-
new Constraints\Type(['type' => 'string']),
38+
new Constraints\Type(type: 'string'),
3939
new RemoteId(),
4040
],
4141
);
4242

4343
$validator->atPath('mainLanguageCode')->validate(
4444
$value->mainLanguageCode,
4545
[
46-
new Constraints\Type(['type' => 'string']),
46+
new Constraints\Type(type: 'string'),
4747
new Constraints\NotBlank(),
4848
new Language(),
4949
],

bundle/Validator/Structs/SynonymCreateStructValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function validate(mixed $value, Constraint $constraint): void
3636
$validator->atPath('mainTagId')->validate(
3737
$value->mainTagId,
3838
[
39-
new Constraints\Type(['type' => 'int']),
39+
new Constraints\Type(type: 'int'),
4040
new Constraints\NotBlank(),
4141
new Tag(['allowRootTag' => false]),
4242
],

bundle/Validator/Structs/TagCreateStructValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function validate(mixed $value, Constraint $constraint): void
3636
$validator->atPath('parentTagId')->validate(
3737
$value->parentTagId,
3838
[
39-
new Constraints\Type(['type' => 'int']),
39+
new Constraints\Type(type: 'int'),
4040
new Constraints\NotBlank(),
4141
new Tag(),
4242
],

bundle/Validator/Structs/TagUpdateStructValidator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,23 @@ public function validate(mixed $value, Constraint $constraint): void
3636
$validator->atPath('alwaysAvailable')->validate(
3737
$value->alwaysAvailable,
3838
[
39-
new Constraints\Type(['type' => 'bool']),
39+
new Constraints\Type(type: 'bool'),
4040
new Constraints\NotNull(),
4141
],
4242
);
4343

4444
$validator->atPath('keyword')->validate(
4545
$value->getKeyword($constraint->languageCode),
4646
[
47-
new Constraints\Type(['type' => 'string']),
47+
new Constraints\Type(type: 'string'),
4848
new Constraints\NotBlank(),
4949
],
5050
);
5151

5252
$validator->atPath('remoteId')->validate(
5353
$value->remoteId,
5454
[
55-
new Constraints\Type(['type' => 'string']),
55+
new Constraints\Type(type: 'string'),
5656
new Constraints\NotBlank(),
5757
new RemoteId(
5858
[
@@ -66,7 +66,7 @@ public function validate(mixed $value, Constraint $constraint): void
6666
$validator->atPath('mainLanguageCode')->validate(
6767
$value->mainLanguageCode,
6868
[
69-
new Constraints\Type(['type' => 'string']),
69+
new Constraints\Type(type: 'string'),
7070
new Constraints\NotBlank(),
7171
new Language(),
7272
],

0 commit comments

Comments
 (0)