minor #31064 CS Fixes: Not double split with one array argument (rubenrua)
This PR was merged into the 3.4 branch.
Discussion
----------
CS Fixes: Not double split with one array argument
| Q | A
| ------------- | ---
| Branch? | 3.4 (master from #31063)
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | None
| License | MIT
| Doc PR | None
Keep to use the same CS in all the Symfony code base.
Use:
```php
$resolver->setDefaults([
'compound' => false
]);
```
Instead of:
```php
$resolver->setDefaults(
[
'compound' => false,
]
);
```
Keep the double split when the method has two or more arguments.
I miss a PSR with this rule.
Commits
-------
a56bf552ad
CS Fixes: Not double split with one array argument
This commit is contained in:
commit
32c448f639
@ -126,14 +126,12 @@ class UserPasswordEncoderCommandTest extends WebTestCase
|
|||||||
|
|
||||||
public function testEncodePasswordEmptySaltOutput()
|
public function testEncodePasswordEmptySaltOutput()
|
||||||
{
|
{
|
||||||
$this->passwordEncoderCommandTester->execute(
|
$this->passwordEncoderCommandTester->execute([
|
||||||
[
|
'command' => 'security:encode-password',
|
||||||
'command' => 'security:encode-password',
|
'password' => 'p@ssw0rd',
|
||||||
'password' => 'p@ssw0rd',
|
'user-class' => 'Symfony\Component\Security\Core\User\User',
|
||||||
'user-class' => 'Symfony\Component\Security\Core\User\User',
|
'--empty-salt' => true,
|
||||||
'--empty-salt' => true,
|
]);
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->assertContains('Password encoding succeeded', $this->passwordEncoderCommandTester->getDisplay());
|
$this->assertContains('Password encoding succeeded', $this->passwordEncoderCommandTester->getDisplay());
|
||||||
$this->assertContains(' Encoded password p@ssw0rd', $this->passwordEncoderCommandTester->getDisplay());
|
$this->assertContains(' Encoded password p@ssw0rd', $this->passwordEncoderCommandTester->getDisplay());
|
||||||
|
@ -205,38 +205,36 @@ class DateIntervalType extends AbstractType
|
|||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
$resolver->setDefaults(
|
$resolver->setDefaults([
|
||||||
[
|
'with_years' => true,
|
||||||
'with_years' => true,
|
'with_months' => true,
|
||||||
'with_months' => true,
|
'with_days' => true,
|
||||||
'with_days' => true,
|
'with_weeks' => false,
|
||||||
'with_weeks' => false,
|
'with_hours' => false,
|
||||||
'with_hours' => false,
|
'with_minutes' => false,
|
||||||
'with_minutes' => false,
|
'with_seconds' => false,
|
||||||
'with_seconds' => false,
|
'with_invert' => false,
|
||||||
'with_invert' => false,
|
'years' => range(0, 100),
|
||||||
'years' => range(0, 100),
|
'months' => range(0, 12),
|
||||||
'months' => range(0, 12),
|
'weeks' => range(0, 52),
|
||||||
'weeks' => range(0, 52),
|
'days' => range(0, 31),
|
||||||
'days' => range(0, 31),
|
'hours' => range(0, 24),
|
||||||
'hours' => range(0, 24),
|
'minutes' => range(0, 60),
|
||||||
'minutes' => range(0, 60),
|
'seconds' => range(0, 60),
|
||||||
'seconds' => range(0, 60),
|
'widget' => 'choice',
|
||||||
'widget' => 'choice',
|
'input' => 'dateinterval',
|
||||||
'input' => 'dateinterval',
|
'placeholder' => $placeholderDefault,
|
||||||
'placeholder' => $placeholderDefault,
|
'by_reference' => true,
|
||||||
'by_reference' => true,
|
'error_bubbling' => false,
|
||||||
'error_bubbling' => false,
|
// If initialized with a \DateInterval object, FormType initializes
|
||||||
// If initialized with a \DateInterval object, FormType initializes
|
// this option to "\DateInterval". Since the internal, normalized
|
||||||
// this option to "\DateInterval". Since the internal, normalized
|
// representation is not \DateInterval, but an array, we need to unset
|
||||||
// representation is not \DateInterval, but an array, we need to unset
|
// this option.
|
||||||
// this option.
|
'data_class' => null,
|
||||||
'data_class' => null,
|
'compound' => $compound,
|
||||||
'compound' => $compound,
|
'empty_data' => $emptyData,
|
||||||
'empty_data' => $emptyData,
|
'labels' => [],
|
||||||
'labels' => [],
|
]);
|
||||||
]
|
|
||||||
);
|
|
||||||
$resolver->setNormalizer('placeholder', $placeholderNormalizer);
|
$resolver->setNormalizer('placeholder', $placeholderNormalizer);
|
||||||
$resolver->setNormalizer('labels', $labelsNormalizer);
|
$resolver->setNormalizer('labels', $labelsNormalizer);
|
||||||
|
|
||||||
|
@ -144,12 +144,10 @@ class DefaultChoiceListFactoryTest extends TestCase
|
|||||||
|
|
||||||
public function testCreateFromChoicesGrouped()
|
public function testCreateFromChoicesGrouped()
|
||||||
{
|
{
|
||||||
$list = $this->factory->createListFromChoices(
|
$list = $this->factory->createListFromChoices([
|
||||||
[
|
'Group 1' => ['A' => $this->obj1, 'B' => $this->obj2],
|
||||||
'Group 1' => ['A' => $this->obj1, 'B' => $this->obj2],
|
'Group 2' => ['C' => $this->obj3, 'D' => $this->obj4],
|
||||||
'Group 2' => ['C' => $this->obj3, 'D' => $this->obj4],
|
]);
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->assertObjectListWithGeneratedValues($list);
|
$this->assertObjectListWithGeneratedValues($list);
|
||||||
}
|
}
|
||||||
|
@ -531,13 +531,11 @@ class OptionsResolverTest extends TestCase
|
|||||||
$this->resolver->setDefined('foo');
|
$this->resolver->setDefined('foo');
|
||||||
$this->resolver->setAllowedTypes('foo', 'int[][]');
|
$this->resolver->setAllowedTypes('foo', 'int[][]');
|
||||||
|
|
||||||
$this->resolver->resolve(
|
$this->resolver->resolve([
|
||||||
[
|
'foo' => [
|
||||||
'foo' => [
|
[1.2],
|
||||||
[1.2],
|
],
|
||||||
],
|
]);
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1598,13 +1596,11 @@ class OptionsResolverTest extends TestCase
|
|||||||
1, 2,
|
1, 2,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
], $this->resolver->resolve(
|
], $this->resolver->resolve([
|
||||||
[
|
'foo' => [
|
||||||
'foo' => [
|
[1, 2],
|
||||||
[1, 2],
|
],
|
||||||
],
|
]));
|
||||||
]
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNested2Arrays()
|
public function testNested2Arrays()
|
||||||
@ -1644,17 +1640,15 @@ class OptionsResolverTest extends TestCase
|
|||||||
$this->resolver->setDefined('foo');
|
$this->resolver->setDefined('foo');
|
||||||
$this->resolver->setAllowedTypes('foo', 'float[][][][]');
|
$this->resolver->setAllowedTypes('foo', 'float[][][][]');
|
||||||
|
|
||||||
$this->resolver->resolve(
|
$this->resolver->resolve([
|
||||||
[
|
'foo' => [
|
||||||
'foo' => [
|
[
|
||||||
[
|
[
|
||||||
[
|
[1, 2],
|
||||||
[1, 2],
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
]
|
],
|
||||||
);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,11 +20,10 @@ class YamlFileDumperTest extends TestCase
|
|||||||
public function testTreeFormatCatalogue()
|
public function testTreeFormatCatalogue()
|
||||||
{
|
{
|
||||||
$catalogue = new MessageCatalogue('en');
|
$catalogue = new MessageCatalogue('en');
|
||||||
$catalogue->add(
|
$catalogue->add([
|
||||||
[
|
'foo.bar1' => 'value1',
|
||||||
'foo.bar1' => 'value1',
|
'foo.bar2' => 'value2',
|
||||||
'foo.bar2' => 'value2',
|
]);
|
||||||
]);
|
|
||||||
|
|
||||||
$dumper = new YamlFileDumper();
|
$dumper = new YamlFileDumper();
|
||||||
|
|
||||||
@ -34,11 +33,10 @@ class YamlFileDumperTest extends TestCase
|
|||||||
public function testLinearFormatCatalogue()
|
public function testLinearFormatCatalogue()
|
||||||
{
|
{
|
||||||
$catalogue = new MessageCatalogue('en');
|
$catalogue = new MessageCatalogue('en');
|
||||||
$catalogue->add(
|
$catalogue->add([
|
||||||
[
|
'foo.bar1' => 'value1',
|
||||||
'foo.bar1' => 'value1',
|
'foo.bar2' => 'value2',
|
||||||
'foo.bar2' => 'value2',
|
]);
|
||||||
]);
|
|
||||||
|
|
||||||
$dumper = new YamlFileDumper();
|
$dumper = new YamlFileDumper();
|
||||||
|
|
||||||
|
@ -55,12 +55,10 @@ class ChoiceValidatorTest extends ConstraintValidatorTestCase
|
|||||||
{
|
{
|
||||||
$this->validator->validate(
|
$this->validator->validate(
|
||||||
null,
|
null,
|
||||||
new Choice(
|
new Choice([
|
||||||
[
|
'choices' => ['foo', 'bar'],
|
||||||
'choices' => ['foo', 'bar'],
|
'strict' => true,
|
||||||
'strict' => true,
|
])
|
||||||
]
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertNoViolation();
|
$this->assertNoViolation();
|
||||||
@ -102,14 +100,12 @@ class ChoiceValidatorTest extends ConstraintValidatorTestCase
|
|||||||
|
|
||||||
public function testValidChoiceCallbackClosure()
|
public function testValidChoiceCallbackClosure()
|
||||||
{
|
{
|
||||||
$constraint = new Choice(
|
$constraint = new Choice([
|
||||||
[
|
'strict' => true,
|
||||||
'strict' => true,
|
'callback' => function () {
|
||||||
'callback' => function () {
|
return ['foo', 'bar'];
|
||||||
return ['foo', 'bar'];
|
},
|
||||||
},
|
]);
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->validator->validate('bar', $constraint);
|
$this->validator->validate('bar', $constraint);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user