Skip to content

Commit 266273e

Browse files
committed
switched array() to []
1 parent 13d551f commit 266273e

File tree

165 files changed

+2807
-2807
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+2807
-2807
lines changed

Constraint.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ abstract class Constraint
4949
/**
5050
* Maps error codes to the names of their constants.
5151
*/
52-
protected static $errorNames = array();
52+
protected static $errorNames = [];
5353

5454
/**
5555
* Domain-specific data attached to a constraint.
@@ -105,7 +105,7 @@ public static function getErrorName($errorCode)
105105
*/
106106
public function __construct($options = null)
107107
{
108-
$invalidOptions = array();
108+
$invalidOptions = [];
109109
$missingOptions = array_flip((array) $this->getRequiredOptions());
110110
$knownOptions = get_object_vars($this);
111111

@@ -173,7 +173,7 @@ public function __set($option, $value)
173173
return;
174174
}
175175

176-
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, \get_class($this)), array($option));
176+
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, \get_class($this)), [$option]);
177177
}
178178

179179
/**
@@ -194,12 +194,12 @@ public function __set($option, $value)
194194
public function __get($option)
195195
{
196196
if ('groups' === $option) {
197-
$this->groups = array(self::DEFAULT_GROUP);
197+
$this->groups = [self::DEFAULT_GROUP];
198198

199199
return $this->groups;
200200
}
201201

202-
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, \get_class($this)), array($option));
202+
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, \get_class($this)), [$option]);
203203
}
204204

205205
/**
@@ -248,7 +248,7 @@ public function getDefaultOption()
248248
*/
249249
public function getRequiredOptions()
250250
{
251-
return array();
251+
return [];
252252
}
253253

254254
/**

ConstraintValidatorFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
class ConstraintValidatorFactory implements ConstraintValidatorFactoryInterface
2626
{
27-
protected $validators = array();
27+
protected $validators = [];
2828

2929
public function __construct()
3030
{

ConstraintViolationList.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ class ConstraintViolationList implements \IteratorAggregate, ConstraintViolation
2121
/**
2222
* @var ConstraintViolationInterface[]
2323
*/
24-
private $violations = array();
24+
private $violations = [];
2525

2626
/**
2727
* Creates a new constraint violation list.
2828
*
2929
* @param ConstraintViolationInterface[] $violations The constraint violations to add to the list
3030
*/
31-
public function __construct(array $violations = array())
31+
public function __construct(array $violations = [])
3232
{
3333
foreach ($violations as $violation) {
3434
$this->add($violation);
@@ -169,7 +169,7 @@ public function offsetUnset($offset)
169169
public function findByCodes($codes)
170170
{
171171
$codes = (array) $codes;
172-
$violations = array();
172+
$violations = [];
173173
foreach ($this as $violation) {
174174
if (\in_array($violation->getCode(), $codes, true)) {
175175
$violations[] = $violation;

ConstraintViolationListInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function add(ConstraintViolationInterface $violation);
2626
/**
2727
* Merges an existing violation list into this list.
2828
*/
29-
public function addAll(ConstraintViolationListInterface $otherList);
29+
public function addAll(self $otherList);
3030

3131
/**
3232
* Returns the violation at a given offset.

Constraints/AbstractComparison.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ abstract class AbstractComparison extends Constraint
3333
public function __construct($options = null)
3434
{
3535
if (null === $options) {
36-
$options = array();
36+
$options = [];
3737
}
3838

3939
if (\is_array($options)) {

Constraints/All.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
class All extends Composite
2121
{
22-
public $constraints = array();
22+
public $constraints = [];
2323

2424
public function getDefaultOption()
2525
{
@@ -28,7 +28,7 @@ public function getDefaultOption()
2828

2929
public function getRequiredOptions()
3030
{
31-
return array('constraints');
31+
return ['constraints'];
3232
}
3333

3434
protected function getCompositeOption()

Constraints/Bic.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ class Bic extends Constraint
2727
const INVALID_COUNTRY_CODE_ERROR = '1ce76f8d-3c1f-451c-9e62-fe9c3ed486ae';
2828
const INVALID_CASE_ERROR = '11884038-3312-4ae5-9d04-699f782130c7';
2929

30-
protected static $errorNames = array(
30+
protected static $errorNames = [
3131
self::INVALID_LENGTH_ERROR => 'INVALID_LENGTH_ERROR',
3232
self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR',
3333
self::INVALID_BANK_CODE_ERROR => 'INVALID_BANK_CODE_ERROR',
3434
self::INVALID_COUNTRY_CODE_ERROR => 'INVALID_COUNTRY_CODE_ERROR',
3535
self::INVALID_CASE_ERROR => 'INVALID_CASE_ERROR',
36-
);
36+
];
3737

3838
public $message = 'This is not a valid Business Identifier Code (BIC).';
3939
}

Constraints/BicValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function validate($value, Constraint $constraint)
3838
$canonicalize = str_replace(' ', '', $value);
3939

4040
// the bic must be either 8 or 11 characters long
41-
if (!\in_array(\strlen($canonicalize), array(8, 11))) {
41+
if (!\in_array(\strlen($canonicalize), [8, 11])) {
4242
$this->context->buildViolation($constraint->message)
4343
->setParameter('{{ value }}', $this->formatValue($value))
4444
->setCode(Bic::INVALID_LENGTH_ERROR)

Constraints/Blank.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class Blank extends Constraint
2323
{
2424
const NOT_BLANK_ERROR = '183ad2de-533d-4796-a439-6d3c3852b549';
2525

26-
protected static $errorNames = array(
26+
protected static $errorNames = [
2727
self::NOT_BLANK_ERROR => 'NOT_BLANK_ERROR',
28-
);
28+
];
2929

3030
public $message = 'This value should be blank.';
3131
}

Constraints/Callback.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct($options = null)
3737
}
3838

3939
if (\is_array($options) && !isset($options['callback']) && !isset($options['groups']) && !isset($options['payload'])) {
40-
$options = array('callback' => $options);
40+
$options = ['callback' => $options];
4141
}
4242

4343
parent::__construct($options);
@@ -56,6 +56,6 @@ public function getDefaultOption()
5656
*/
5757
public function getTargets()
5858
{
59-
return array(self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT);
59+
return [self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT];
6060
}
6161
}

0 commit comments

Comments
 (0)