Skip to content

Commit 862181e

Browse files
committed
Merge branch '4.1' into 4.2
* 4.1: 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 95fd571 + be77a07 commit 862181e

24 files changed

+168
-168
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

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
}

Tests/GlobTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testGlobToRegexDoubleStarStrictDots()
3939
}
4040
sort($match);
4141

42-
$this->assertSame(array('one/b/c.neon', 'one/b/d.neon'), $match);
42+
$this->assertSame(['one/b/c.neon', 'one/b/d.neon'], $match);
4343
}
4444

4545
public function testGlobToRegexDoubleStarNonStrictDots()
@@ -56,7 +56,7 @@ public function testGlobToRegexDoubleStarNonStrictDots()
5656
}
5757
sort($match);
5858

59-
$this->assertSame(array('.dot/b/c.neon', '.dot/b/d.neon', 'one/b/c.neon', 'one/b/d.neon'), $match);
59+
$this->assertSame(['.dot/b/c.neon', '.dot/b/d.neon', 'one/b/c.neon', 'one/b/d.neon'], $match);
6060
}
6161

6262
public function testGlobToRegexDoubleStarWithoutLeadingSlash()
@@ -73,7 +73,7 @@ public function testGlobToRegexDoubleStarWithoutLeadingSlash()
7373
}
7474
sort($match);
7575

76-
$this->assertSame(array('one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'), $match);
76+
$this->assertSame(['one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'], $match);
7777
}
7878

7979
public function testGlobToRegexDoubleStarWithoutLeadingSlashNotStrictLeadingDot()
@@ -90,6 +90,6 @@ public function testGlobToRegexDoubleStarWithoutLeadingSlashNotStrictLeadingDot(
9090
}
9191
sort($match);
9292

93-
$this->assertSame(array('one/.dot', 'one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'), $match);
93+
$this->assertSame(['one/.dot', 'one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'], $match);
9494
}
9595
}

Tests/Iterator/CustomFilterIteratorTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ class CustomFilterIteratorTest extends IteratorTestCase
2020
*/
2121
public function testWithInvalidFilter()
2222
{
23-
new CustomFilterIterator(new Iterator(), array('foo'));
23+
new CustomFilterIterator(new Iterator(), ['foo']);
2424
}
2525

2626
/**
2727
* @dataProvider getAcceptData
2828
*/
2929
public function testAccept($filters, $expected)
3030
{
31-
$inner = new Iterator(array('test.php', 'test.py', 'foo.php'));
31+
$inner = new Iterator(['test.php', 'test.py', 'foo.php']);
3232

3333
$iterator = new CustomFilterIterator($inner, $filters);
3434

@@ -37,10 +37,10 @@ public function testAccept($filters, $expected)
3737

3838
public function getAcceptData()
3939
{
40-
return array(
41-
array(array(function (\SplFileInfo $fileinfo) { return false; }), array()),
42-
array(array(function (\SplFileInfo $fileinfo) { return 0 === strpos($fileinfo, 'test'); }), array('test.php', 'test.py')),
43-
array(array('is_dir'), array()),
44-
);
40+
return [
41+
[[function (\SplFileInfo $fileinfo) { return false; }], []],
42+
[[function (\SplFileInfo $fileinfo) { return 0 === strpos($fileinfo, 'test'); }], ['test.php', 'test.py']],
43+
[['is_dir'], []],
44+
];
4545
}
4646
}

0 commit comments

Comments
 (0)