Skip to content

Commit 6aa3333

Browse files
committed
Use short array deconstruction syntax.
1 parent 4d3a95d commit 6aa3333

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

Constraints/FileValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function validate($value, Constraint $constraint)
6363
$binaryFormat = null === $constraint->binaryFormat ? true : $constraint->binaryFormat;
6464
}
6565

66-
list(, $limitAsString, $suffix) = $this->factorizeSizes(0, $limitInBytes, $binaryFormat);
66+
[, $limitAsString, $suffix] = $this->factorizeSizes(0, $limitInBytes, $binaryFormat);
6767
$this->context->buildViolation($constraint->uploadIniSizeErrorMessage)
6868
->setParameter('{{ limit }}', $limitAsString)
6969
->setParameter('{{ suffix }}', $suffix)
@@ -157,7 +157,7 @@ public function validate($value, Constraint $constraint)
157157
$limitInBytes = $constraint->maxSize;
158158

159159
if ($sizeInBytes > $limitInBytes) {
160-
list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes($sizeInBytes, $limitInBytes, $constraint->binaryFormat);
160+
[$sizeAsString, $limitAsString, $suffix] = $this->factorizeSizes($sizeInBytes, $limitInBytes, $constraint->binaryFormat);
161161
$this->context->buildViolation($constraint->maxSizeMessage)
162162
->setParameter('{{ file }}', $this->formatValue($path))
163163
->setParameter('{{ size }}', $sizeAsString)

Constraints/NotCompromisedPasswordValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function validate($value, Constraint $constraint)
9191
}
9292

9393
foreach (explode("\r\n", $result) as $line) {
94-
list($hashSuffix, $count) = explode(':', $line);
94+
[$hashSuffix, $count] = explode(':', $line);
9595

9696
if ($hashPrefix.$hashSuffix === $hash && $constraint->threshold <= (int) $count) {
9797
$this->context->buildViolation($constraint->message)

DependencyInjection/AddValidatorInitializersPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function process(ContainerBuilder $container)
5151
$builder = $container->getDefinition($this->builderService);
5252
$calls = [];
5353

54-
foreach ($builder->getMethodCalls() as list($method, $arguments)) {
54+
foreach ($builder->getMethodCalls() as [$method, $arguments]) {
5555
if ('setTranslator' === $method) {
5656
if (!$arguments[0] instanceof Reference) {
5757
$translator = $arguments[0];

Mapping/Loader/AbstractLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ protected function newConstraint($name, $options = null)
7272
if (false !== strpos($name, '\\') && class_exists($name)) {
7373
$className = (string) $name;
7474
} elseif (false !== strpos($name, ':')) {
75-
list($prefix, $className) = explode(':', $name, 2);
75+
[$prefix, $className] = explode(':', $name, 2);
7676

7777
if (!isset($this->namespaces[$prefix])) {
7878
throw new MappingException(sprintf('Undefined namespace prefix "%s".', $prefix));

Test/ConstraintValidatorTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ public function doValidate($value, $constraints = null, $groups = null)
413413
{
414414
Assert::assertFalse($this->expectNoValidate, 'No validation calls have been expected.');
415415

416-
list($expectedValue, $expectedGroup, $expectedConstraints) = $this->expectedValidate[++$this->validateCalls];
416+
[$expectedValue, $expectedGroup, $expectedConstraints] = $this->expectedValidate[++$this->validateCalls];
417417

418418
Assert::assertSame($expectedValue, $value);
419419
$expectedConstraints($constraints);

Tests/Constraints/AbstractComparisonValidatorTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public function testInvalidComparisonToValue($dirtyValue, $dirtyValueAsString, $
202202

203203
public function testInvalidComparisonToPropertyPathAddsPathAsParameter()
204204
{
205-
list($dirtyValue, $dirtyValueAsString, $comparedValue, $comparedValueString, $comparedValueType) = current($this->provideAllInvalidComparisons());
205+
[$dirtyValue, $dirtyValueAsString, $comparedValue, $comparedValueString, $comparedValueType] = current($this->provideAllInvalidComparisons());
206206

207207
$constraint = $this->createConstraint(['propertyPath' => 'value']);
208208
$constraint->message = 'Constraint Message';

Tests/Constraints/FileValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ public function uploadedFileErrorProvider()
456456
$reflection = new \ReflectionClass(\get_class(new FileValidator()));
457457
$method = $reflection->getMethod('factorizeSizes');
458458
$method->setAccessible(true);
459-
list(, $limit, $suffix) = $method->invokeArgs(new FileValidator(), [0, UploadedFile::getMaxFilesize(), false]);
459+
[, $limit, $suffix] = $method->invokeArgs(new FileValidator(), [0, UploadedFile::getMaxFilesize(), false]);
460460

461461
// it correctly parses the maxSize option and not only uses simple string comparison
462462
// 1000M should be bigger than the ini value

0 commit comments

Comments
 (0)