Skip to content

Commit

Permalink
minor #31063 CS Fixes: Not double split with one array argument (rube…
Browse files Browse the repository at this point in the history
…nrua)

This PR was merged into the 4.3-dev branch.

Discussion
----------

CS Fixes: Not double split with one array argument

| Q             | A
| ------------- | ---
| Branch?       | master
| 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
-------

027bd12 CS Fixes: Not double split with one array argument
  • Loading branch information
fabpot committed Apr 11, 2019
2 parents 713aab7 + 027bd12 commit 936355e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ protected function setUp()
$this->obj2 = (object) ['label' => 'B', 'index' => 'x', 'value' => 'b', 'preferred' => true, 'group' => 'Group 1', 'attr' => ['attr1' => 'value1']];
$this->obj3 = (object) ['label' => 'C', 'index' => 'y', 'value' => 1, 'preferred' => true, 'group' => 'Group 2', 'attr' => ['attr2' => 'value2']];
$this->obj4 = (object) ['label' => 'D', 'index' => 'z', 'value' => 2, 'preferred' => false, 'group' => 'Group 2', 'attr' => []];
$this->list = new ArrayChoiceList(
['A' => $this->obj1, 'B' => $this->obj2, 'C' => $this->obj3, 'D' => $this->obj4]
);
$this->list = new ArrayChoiceList(['A' => $this->obj1, 'B' => $this->obj2, 'C' => $this->obj3, 'D' => $this->obj4]);
$this->factory = new DefaultChoiceListFactory();
}

Expand All @@ -111,9 +109,7 @@ public function testCreateFromChoicesEmpty()

public function testCreateFromChoicesFlat()
{
$list = $this->factory->createListFromChoices(
['A' => $this->obj1, 'B' => $this->obj2, 'C' => $this->obj3, 'D' => $this->obj4]
);
$list = $this->factory->createListFromChoices(['A' => $this->obj1, 'B' => $this->obj2, 'C' => $this->obj3, 'D' => $this->obj4]);

$this->assertObjectListWithGeneratedValues($list);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1841,12 +1841,11 @@ public function testCustomChoiceTypeDoesNotInheritChoiceLabels()
{
$builder = $this->factory->createBuilder();
$builder->add('choice', static::TESTED_TYPE, [
'choices' => [
'1' => '1',
'2' => '2',
],
]
);
'choices' => [
'1' => '1',
'2' => '2',
],
]);
$builder->add('subChoice', 'Symfony\Component\Form\Tests\Fixtures\ChoiceSubType');
$form = $builder->getForm();

Expand Down

0 comments on commit 936355e

Please sign in to comment.