10000 CS Fixes: Not double split with one array argument by rubenrua · Pull Request #31064 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

CS Fixes: Not double split with one array argument #31064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,12 @@ public function testEncodePasswordOutput()

public function testEncodePasswordEmptySaltOutput()
{
$this->passwordEncoderCommandTester->execute(
[
'command' => 'security:encode-password',
'password' => 'p@ssw0rd',
'user-class' => 'Symfony\Component\Security\Core\User\User',
'--empty-salt' => true,
]
);
$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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,38 +205,36 @@ public function configureOptions(OptionsResolver $resolver)
}));
};

$resolver->setDefaults(
[
'with_years' => true,
'with_months' => true,
'with_days' => true,
'with_weeks' => false,
'with_hours' => false,
'with_minutes' => false,
'with_seconds' => false,
'with_invert' => false,
'years' => range(0, 100),
'months' => range(0, 12),
'weeks' => range(0, 52),
'days' => range(0, 31),
'hours' => range(0, 24),
'minutes' => range(0, 60),
'seconds' => range(0, 60),
'widget' => 'choice',
'input' => 'dateinterval',
'placeholder' => $placeholderDefault,
'by_reference' => true,
'error_bubbling' => false,
// If initialized with a \DateInterval object, FormType initializes
// this option to "\DateInterval". Since the internal, normalized
// representation is not \DateInterval, but an array, we need to unset
// this option.
'data_class' => null,
'compound' => $compound,
'empty_data' => $emptyData,
'labels' => [],
]
);
$resolver->setDefaults([
'with_years' => true,
'with_months' => true,
'with_days' => true,
'with_weeks' => false,
'with_hours' => false,
'with_minutes' => false,
'with_seconds' => false,
'with_invert' => false,
'years' => range(0, 100),
'months' => range(0, 12),
'weeks' => range(0, 52),
'days' => range(0, 31),
'hours' => range(0, 24),
'minutes' => range(0, 60),
'seconds' => range(0, 60),
'widget' => 'choice',
'input' => 'dateinterval',
'placeholder' => $placeholderDefault,
'by_reference' => true,
'error_bubbling' => false,
// If initialized with a \DateInterval object, FormType initializes
// this option to "\DateInterval". Since the internal, normalized
// representation is not \DateInterval, but an array, we need to unset
// this option.
'data_class' => null,
'compound' => $compound,
'empty_data' => $emptyData,
'labels' => [],
]);
$resolver->setNormalizer('placeholder', $placeholderNormalizer);
$resolver->setNormalizer('labels', $labelsNormalizer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,10 @@ function ($object) { return $object->value; }

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

$this->assertObjectListWithGeneratedValues($list);
}
Expand Down
38 changes: 16 additions & 22 deletions src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,13 +531,11 @@ public function testResolveFailsWithCorrectLevelsButWrongScalar()
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'int[][]');

$this->resolver->resolve(
[
'foo' => [
[1.2],
],
]
);
$this->resolver->resolve([
'foo' => [
[1.2],
],
]);
}

/**
Expand Down Expand Up @@ -1598,13 +1596,11 @@ public function testNestedArrays()
1, 2,
],
],
], $this->resolver->resolve(
[
'foo' => [
[1, 2],
],
]
));
], $this->resolver->resolve([
'foo' => [
[1, 2],
],
]));
}

public function testNested2Arrays()
Expand Down Expand Up @@ -1644,17 +1640,15 @@ public function testNestedArraysException()
$this->resolver->setDefined('foo');
$this->resolver->setAllowedTypes('foo', 'float[][][][]');

$this->resolver->resolve(
[
'foo' => [
$this->resolver->resolve([
'foo' => [
[
[
[
[1, 2],
],
[1, 2],
],
],
]
);
],
]);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ class YamlFileDumperTest extends TestCase
public function testTreeFormatCatalogue()
{
$catalogue = new MessageCatalogue('en');
$catalogue->add(
[
'foo.bar1' => 'value1',
'foo.bar2' => 'value2',
]);
$catalogue->add([
'foo.bar1' => 'value1',
'foo.bar2' => 'value2',
]);

$dumper = new YamlFileDumper();

Expand All @@ -34,11 +33,10 @@ public function testTreeFormatCatalogue()
public function testLinearFormatCatalogue()
{
$catalogue = new MessageCatalogue('en');
$catalogue->add(
[
'foo.bar1' => 'value1',
'foo.bar2' => 'value2',
]);
$catalogue->add([
'foo.bar1' => 'value1',
'foo.bar2' => 'value2',
]);

$dumper = new YamlFileDumper();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ public function testNullIsValid()
{
$this->validator->validate(
null,
new Choice(
[
'choices' => ['foo', 'bar'],
'strict' => true,
]
)
new Choice([
'choices' => ['foo', 'bar'],
'strict' => true,
])
);

$this->assertNoViolation();
Expand Down Expand Up @@ -102,14 +100,12 @@ public function testValidChoiceCallbackFunction()

public function testValidChoiceCallbackClosure()
{
$constraint = new Choice(
[
'strict' => true,
'callback' => function () {
return ['foo', 'bar'];
},
]
);
$constraint = new Choice([
'strict' => true,
'callback' => function () {
return ['foo', 'bar'];
},
]);

$this->validator->validate('bar', $constraint);

Expand Down
0