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:
Fabien Potencier 2019-04-10 18:18:38 +02:00
commit 32c448f639
6 changed files with 74 additions and 92 deletions

View File

@ -126,14 +126,12 @@ class UserPasswordEncoderCommandTest extends WebTestCase
public function testEncodePasswordEmptySaltOutput()
{
$this->passwordEncoderCommandTester->execute(
[
$this->passwordEncoderCommandTester->execute([
'command' => 'security:encode-password',
'password' => 'p@ssw0rd',
'user-class' => 'Symfony\Component\Security\Core\User\User',
'--empty-salt' => true,
]
);
]);
$this->assertContains('Password encoding succeeded', $this->passwordEncoderCommandTester->getDisplay());
$this->assertContains(' Encoded password p@ssw0rd', $this->passwordEncoderCommandTester->getDisplay());

View File

@ -205,8 +205,7 @@ class DateIntervalType extends AbstractType
}));
};
$resolver->setDefaults(
[
$resolver->setDefaults([
'with_years' => true,
'with_months' => true,
'with_days' => true,
@ -235,8 +234,7 @@ class DateIntervalType extends AbstractType
'compound' => $compound,
'empty_data' => $emptyData,
'labels' => [],
]
);
]);
$resolver->setNormalizer('placeholder', $placeholderNormalizer);
$resolver->setNormalizer('labels', $labelsNormalizer);

View File

@ -144,12 +144,10 @@ class DefaultChoiceListFactoryTest extends TestCase
public function testCreateFromChoicesGrouped()
{
$list = $this->factory->createListFromChoices(
[
$list = $this->factory->createListFromChoices([
'Group 1' => ['A' => $this->obj1, 'B' => $this->obj2],
'Group 2' => ['C' => $this->obj3, 'D' => $this->obj4],
]
);
]);
$this->assertObjectListWithGeneratedValues($list);
}

View File

@ -531,13 +531,11 @@ class OptionsResolverTest extends TestCase
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'int[][]');
$this->resolver->resolve(
[
$this->resolver->resolve([
'foo' => [
[1.2],
],
]
);
]);
}
/**
@ -1598,13 +1596,11 @@ class OptionsResolverTest extends TestCase
1, 2,
],
],
], $this->resolver->resolve(
[
], $this->resolver->resolve([
'foo' => [
[1, 2],
],
]
));
]));
}
public function testNested2Arrays()
@ -1644,8 +1640,7 @@ class OptionsResolverTest extends TestCase
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'float[][][][]');
$this->resolver->resolve(
[
$this->resolver->resolve([
'foo' => [
[
[
@ -1653,8 +1648,7 @@ class OptionsResolverTest extends TestCase
],
],
],
]
);
]);
}
/**

View File

@ -20,8 +20,7 @@ class YamlFileDumperTest extends TestCase
public function testTreeFormatCatalogue()
{
$catalogue = new MessageCatalogue('en');
$catalogue->add(
[
$catalogue->add([
'foo.bar1' => 'value1',
'foo.bar2' => 'value2',
]);
@ -34,8 +33,7 @@ class YamlFileDumperTest extends TestCase
public function testLinearFormatCatalogue()
{
$catalogue = new MessageCatalogue('en');
$catalogue->add(
[
$catalogue->add([
'foo.bar1' => 'value1',
'foo.bar2' => 'value2',
]);

View File

@ -55,12 +55,10 @@ class ChoiceValidatorTest extends ConstraintValidatorTestCase
{
$this->validator->validate(
null,
new Choice(
[
new Choice([
'choices' => ['foo', 'bar'],
'strict' => true,
]
)
])
);
$this->assertNoViolation();
@ -102,14 +100,12 @@ class ChoiceValidatorTest extends ConstraintValidatorTestCase
public function testValidChoiceCallbackClosure()
{
$constraint = new Choice(
[
$constraint = new Choice([
'strict' => true,
'callback' => function () {
return ['foo', 'bar'];
},
]
);
]);
$this->validator->validate('bar', $constraint);