Skip to content

Commit 60a9b25

Browse files
committed
switched array() to []
1 parent 7deab3c commit 60a9b25

31 files changed

+354
-354
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,25 +41,25 @@ 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 $sort = false;
5252
private $ignore = 0;
53-
private $dirs = array();
54-
private $dates = array();
55-
private $iterators = array();
56-
private $contains = array();
57-
private $notContains = array();
58-
private $paths = array();
59-
private $notPaths = array();
53+
private $dirs = [];
54+
private $dates = [];
55+
private $iterators = [];
56+
private $contains = [];
57+
private $notContains = [];
58+
private $paths = [];
59+
private $notPaths = [];
6060
private $ignoreUnreadableDirs = false;
6161

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

6464
public function __construct()
6565
{
@@ -536,13 +536,13 @@ public function ignoreUnreadableDirs($ignore = true)
536536
*/
537537
public function in($dirs)
538538
{
539-
$resolvedDirs = array();
539+
$resolvedDirs = [];
540540

541541
foreach ((array) $dirs as $dir) {
542542
if (is_dir($dir)) {
543543
$resolvedDirs[] = $this->normalizeDir($dir);
544544
} elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
545-
$resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
545+
$resolvedDirs = array_merge($resolvedDirs, array_map([$this, 'normalizeDir'], $glob));
546546
} else {
547547
throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
548548
}

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 \Recursiv
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
@@ -100,7 +100,7 @@ public function getChildren()
100100
} catch (\UnexpectedValueException $e) {
101101
if ($this->ignoreUnreadableDirs) {
102102
// If directory is unreadable and finder is set to ignore it, a fake empty content is returned.
103-
return new \RecursiveArrayIterator(array());
103+
return new \RecursiveArrayIterator([]);
104104
} else {
105105
throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
106106
}

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
}

0 commit comments

Comments
 (0)