Skip to content

Commit e9d2835

Browse files
committed
Merge branch '4.2' into short-array-master
* 4.2: fixed CS fixed CS fixed tests fixed CS fixed CS fixed CS fixed short array CS in comments fixed CS in ExpressionLanguage fixtures fixed CS in generated files fixed CS on generated container files fixed CS on Form PHP templates fixed CS on YAML fixtures fixed fixtures switched array() to []
2 parents 4f2bcb5 + f376d51 commit e9d2835

32 files changed

+416
-415
lines changed

Comparator/Comparator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function setOperator($operator)
6464
$operator = '==';
6565
}
6666

67-
if (!\in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
67+
if (!\in_array($operator, ['>', '<', '>=', '<=', '==', '!='])) {
6868
throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
6969
}
7070

Finder.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,26 @@ class Finder implements \IteratorAggregate, \Countable
4141
const IGNORE_DOT_FILES = 2;
4242

4343
private $mode = 0;
44-
private $names = array();
45-
private $notNames = array();
46-
private $exclude = array();
47-
private $filters = array();
48-
private $depths = array();
49-
private $sizes = array();
44+
private $names = [];
45+
private $notNames = [];
46+
private $exclude = [];
47+
private $filters = [];
48+
private $depths = [];
49+
private $sizes = [];
5050
private $followLinks = false;
5151
private $reverseSorting = false;
5252
private $sort = false;
5353
private $ignore = 0;
54-
private $dirs = array();
55-
private $dates = array();
56-
private $iterators = array();
57-
private $contains = array();
58-
private $notContains = array();
59-
private $paths = array();
60-
private $notPaths = array();
54+
private $dirs = [];
55+
private $dates = [];
56+
private $iterators = [];
57+
private $contains = [];
58+
private $notContains = [];
59+
private $paths = [];
60+
private $notPaths = [];
6161
private $ignoreUnreadableDirs = false;
6262

63-
private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
63+
private static $vcsPatterns = ['.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg'];
6464

6565
public function __construct()
6666
{
@@ -570,13 +570,13 @@ public function ignoreUnreadableDirs($ignore = true)
570570
*/
571571
public function in($dirs)
572572
{
573-
$resolvedDirs = array();
573+
$resolvedDirs = [];
574574

575575
foreach ((array) $dirs as $dir) {
576576
if (is_dir($dir)) {
577577
$resolvedDirs[] = $this->normalizeDir($dir);
578578
} elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
579-
$resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
579+
$resolvedDirs = array_merge($resolvedDirs, array_map([$this, 'normalizeDir'], $glob));
580580
} else {
581581
throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
582582
}

Glob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* // prints foo.bar and foo.baz
2020
* $regex = glob_to_regex("foo.*");
21-
* for (array('foo.bar', 'foo.baz', 'foo', 'bar') as $t)
21+
* for (['foo.bar', 'foo.baz', 'foo', 'bar'] as $t)
2222
* {
2323
* if (/$regex/) echo "matched: $car\n";
2424
* }

Iterator/CustomFilterIterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
class CustomFilterIterator extends \FilterIterator
2323
{
24-
private $filters = array();
24+
private $filters = [];
2525

2626
/**
2727
* @param \Iterator $iterator The Iterator to filter

Iterator/DateRangeFilterIterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
class DateRangeFilterIterator extends \FilterIterator
2222
{
23-
private $comparators = array();
23+
private $comparators = [];
2424

2525
/**
2626
* @param \Iterator $iterator The Iterator to filter

Iterator/ExcludeDirectoryFilterIterator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ExcludeDirectoryFilterIterator extends \FilterIterator implements \Recursi
2020
{
2121
private $iterator;
2222
private $isRecursive;
23-
private $excludedDirs = array();
23+
private $excludedDirs = [];
2424
private $excludedPattern;
2525

2626
/**
@@ -31,7 +31,7 @@ public function __construct(\Iterator $iterator, array $directories)
3131
{
3232
$this->iterator = $iterator;
3333
$this->isRecursive = $iterator instanceof \RecursiveIterator;
34-
$patterns = array();
34+
$patterns = [];
3535
foreach ($directories as $directory) {
3636
$directory = rtrim($directory, '/');
3737
if (!$this->isRecursive || false !== strpos($directory, '/')) {
@@ -75,7 +75,7 @@ public function hasChildren()
7575

7676
public function getChildren()
7777
{
78-
$children = new self($this->iterator->getChildren(), array());
78+
$children = new self($this->iterator->getChildren(), []);
7979
$children->excludedDirs = $this->excludedDirs;
8080
$children->excludedPattern = $this->excludedPattern;
8181

Iterator/MultiplePcreFilterIterator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
*/
1919
abstract class MultiplePcreFilterIterator extends \FilterIterator
2020
{
21-
protected $matchRegexps = array();
22-
protected $noMatchRegexps = array();
21+
protected $matchRegexps = [];
22+
protected $noMatchRegexps = [];
2323

2424
/**
2525
* @param \Iterator $iterator The Iterator to filter
@@ -91,7 +91,7 @@ protected function isRegex($str)
9191
return !preg_match('/[*?[:alnum:] \\\\]/', $start);
9292
}
9393

94-
foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
94+
foreach ([['{', '}'], ['(', ')'], ['[', ']'], ['<', '>']] as $delimiters) {
9595
if ($start === $delimiters[0] && $end === $delimiters[1]) {
9696
return true;
9797
}

Iterator/RecursiveDirectoryIterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function getChildren()
9696
} catch (\UnexpectedValueException $e) {
9797
if ($this->ignoreUnreadableDirs) {
9898
// If directory is unreadable and finder is set to ignore it, a fake empty content is returned.
99-
return new \RecursiveArrayIterator(array());
99+
return new \RecursiveArrayIterator([]);
100100
} else {
101101
throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
102102
}

Iterator/SizeRangeFilterIterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
class SizeRangeFilterIterator extends \FilterIterator
2222
{
23-
private $comparators = array();
23+
private $comparators = [];
2424

2525
/**
2626
* @param \Iterator $iterator The Iterator to filter

Iterator/SortableIterator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ public function __construct(\Traversable $iterator, $sort, bool $reverseOrder =
7373
} elseif (self::SORT_BY_NONE === $sort) {
7474
$this->sort = $order;
7575
} elseif (\is_callable($sort)) {
76-
$this->sort = $reverseOrder ? function ($a, $b) use ($sort) { return -$sort($a, $b); } : $sort;
76+
$this->sort = $reverseOrder ? function ($a, $b) use ($sort) { return -$sort($a, $b); }
77+
: $sort;
7778
} else {
7879
throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
7980
}

Tests/Comparator/ComparatorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public function testTest($operator, $target, $match, $noMatch)
5858

5959
public function getTestData()
6060
{
61-
return array(
62-
array('<', '1000', array('500', '999'), array('1000', '1500')),
63-
);
61+
return [
62+
['<', '1000', ['500', '999'], ['1000', '1500']],
63+
];
6464
}
6565
}

Tests/Comparator/DateComparatorTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ public function testTest($test, $match, $noMatch)
5151

5252
public function getTestData()
5353
{
54-
return array(
55-
array('< 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))),
56-
array('until 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))),
57-
array('before 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))),
58-
array('> 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))),
59-
array('after 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))),
60-
array('since 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))),
61-
array('!= 2005-10-10', array(strtotime('2005-10-11')), array(strtotime('2005-10-10'))),
62-
);
54+
return [
55+
['< 2005-10-10', [strtotime('2005-10-09')], [strtotime('2005-10-15')]],
56+
['until 2005-10-10', [strtotime('2005-10-09')], [strtotime('2005-10-15')]],
57+
['before 2005-10-10', [strtotime('2005-10-09')], [strtotime('2005-10-15')]],
58+
['> 2005-10-10', [strtotime('2005-10-15')], [strtotime('2005-10-09')]],
59+
['after 2005-10-10', [strtotime('2005-10-15')], [strtotime('2005-10-09')]],
60+
['since 2005-10-10', [strtotime('2005-10-15')], [strtotime('2005-10-09')]],
61+
['!= 2005-10-10', [strtotime('2005-10-11')], [strtotime('2005-10-10')]],
62+
];
6363
}
6464
}

Tests/Comparator/NumberComparatorTest.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -53,39 +53,39 @@ public function testTest($test, $match, $noMatch)
5353

5454
public function getTestData()
5555
{
56-
return array(
57-
array('< 1000', array('500', '999'), array('1000', '1500')),
56+
return [
57+
['< 1000', ['500', '999'], ['1000', '1500']],
5858

59-
array('< 1K', array('500', '999'), array('1000', '1500')),
60-
array('<1k', array('500', '999'), array('1000', '1500')),
61-
array(' < 1 K ', array('500', '999'), array('1000', '1500')),
62-
array('<= 1K', array('1000'), array('1001')),
63-
array('> 1K', array('1001'), array('1000')),
64-
array('>= 1K', array('1000'), array('999')),
59+
['< 1K', ['500', '999'], ['1000', '1500']],
60+
['<1k', ['500', '999'], ['1000', '1500']],
61+
[' < 1 K ', ['500', '999'], ['1000', '1500']],
62+
['<= 1K', ['1000'], ['1001']],
63+
['> 1K', ['1001'], ['1000']],
64+
['>= 1K', ['1000'], ['999']],
6565

66-
array('< 1KI', array('500', '1023'), array('1024', '1500')),
67-
array('<= 1KI', array('1024'), array('1025')),
68-
array('> 1KI', array('1025'), array('1024')),
69-
array('>= 1KI', array('1024'), array('1023')),
66+
['< 1KI', ['500', '1023'], ['1024', '1500']],
67+
['<= 1KI', ['1024'], ['1025']],
68+
['> 1KI', ['1025'], ['1024']],
69+
['>= 1KI', ['1024'], ['1023']],
7070

71-
array('1KI', array('1024'), array('1023', '1025')),
72-
array('==1KI', array('1024'), array('1023', '1025')),
71+
['1KI', ['1024'], ['1023', '1025']],
72+
['==1KI', ['1024'], ['1023', '1025']],
7373

74-
array('==1m', array('1000000'), array('999999', '1000001')),
75-
array('==1mi', array(1024 * 1024), array(1024 * 1024 - 1, 1024 * 1024 + 1)),
74+
['==1m', ['1000000'], ['999999', '1000001']],
75+
['==1mi', [1024 * 1024], [1024 * 1024 - 1, 1024 * 1024 + 1]],
7676

77-
array('==1g', array('1000000000'), array('999999999', '1000000001')),
78-
array('==1gi', array(1024 * 1024 * 1024), array(1024 * 1024 * 1024 - 1, 1024 * 1024 * 1024 + 1)),
77+
['==1g', ['1000000000'], ['999999999', '1000000001']],
78+
['==1gi', [1024 * 1024 * 1024], [1024 * 1024 * 1024 - 1, 1024 * 1024 * 1024 + 1]],
7979

80-
array('!= 1000', array('500', '999'), array('1000')),
81-
);
80+
['!= 1000', ['500', '999'], ['1000']],
81+
];
8282
}
8383

8484
public function getConstructorTestData()
8585
{
86-
return array(
87-
array(
88-
array(
86+
return [
87+
[
88+
[
8989
'1', '0',
9090
'3.5', '33.55', '123.456', '123456.78',
9191
'.1', '.123',
@@ -94,15 +94,15 @@ public function getConstructorTestData()
9494
'==1', '!=1', '<1', '>1', '<=1', '>=1',
9595
'==1k', '==1ki', '==1m', '==1mi', '==1g', '==1gi',
9696
'1k', '1ki', '1m', '1mi', '1g', '1gi',
97-
),
98-
array(
97+
],
98+
[
9999
false, null, '',
100100
' ', 'foobar',
101101
'=1', '===1',
102102
'0 . 1', '123 .45', '234. 567',
103103
'..', '.0.', '0.1.2',
104-
),
105-
),
106-
);
104+
],
105+
],
106+
];
107107
}
108108
}

0 commit comments

Comments
 (0)