Skip to content

Commit 1d98514

Browse files
committed
Merge branch '3.4' into 4.1
* 3.4: 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 078f948 + d61ec43 commit 1d98514

17 files changed

+130
-130
lines changed

ClockMock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public static function register($class)
7373
{
7474
$self = \get_called_class();
7575

76-
$mockedNs = array(substr($class, 0, strrpos($class, '\\')));
76+
$mockedNs = [substr($class, 0, strrpos($class, '\\'))];
7777
if (0 < strpos($class, '\\Tests\\')) {
7878
$ns = str_replace('\\Tests\\', '\\', $class);
7979
$mockedNs[] = substr($ns, 0, strrpos($ns, '\\'));

DeprecationErrorHandler.php

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ public static function register($mode = 0)
5454
if (false === $mode) {
5555
$mode = getenv('SYMFONY_DEPRECATIONS_HELPER');
5656
}
57-
if (DeprecationErrorHandler::MODE_DISABLED !== $mode
58-
&& DeprecationErrorHandler::MODE_WEAK !== $mode
59-
&& DeprecationErrorHandler::MODE_WEAK_VENDORS !== $mode
57+
if (self::MODE_DISABLED !== $mode
58+
&& self::MODE_WEAK !== $mode
59+
&& self::MODE_WEAK_VENDORS !== $mode
6060
&& (!isset($mode[0]) || '/' !== $mode[0])
6161
) {
6262
$mode = preg_match('/^[1-9][0-9]*$/', $mode) ? (int) $mode : 0;
@@ -92,29 +92,29 @@ public static function register($mode = 0)
9292
return false;
9393
};
9494

95-
$deprecations = array(
95+
$deprecations = [
9696
'unsilencedCount' => 0,
9797
'remainingCount' => 0,
9898
'legacyCount' => 0,
9999
'otherCount' => 0,
100100
'remaining vendorCount' => 0,
101-
'unsilenced' => array(),
102-
'remaining' => array(),
103-
'legacy' => array(),
104-
'other' => array(),
105-
'remaining vendor' => array(),
106-
);
107-
$deprecationHandler = function ($type, $msg, $file, $line, $context = array()) use (&$deprecations, $getMode, $UtilPrefix, $inVendors) {
101+
'unsilenced' => [],
102+
'remaining' => [],
103+
'legacy' => [],
104+
'other' => [],
105+
'remaining vendor' => [],
106+
];
107+
$deprecationHandler = function ($type, $msg, $file, $line, $context = []) use (&$deprecations, $getMode, $UtilPrefix, $inVendors) {
108108
$mode = $getMode();
109-
if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) || DeprecationErrorHandler::MODE_DISABLED === $mode) {
109+
if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) || self::MODE_DISABLED === $mode) {
110110
$ErrorHandler = $UtilPrefix.'ErrorHandler';
111111

112112
return $ErrorHandler::handleError($type, $msg, $file, $line, $context);
113113
}
114114

115115
$trace = debug_backtrace();
116116
$group = 'other';
117-
$isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && $inVendors($file);
117+
$isVendor = self::MODE_WEAK_VENDORS === $mode && $inVendors($file);
118118

119119
$i = \count($trace);
120120
while (1 < $i && (!isset($trace[--$i]['class']) || ('ReflectionMethod' === $trace[$i]['class'] || 0 === strpos($trace[$i]['class'], 'PHPUnit_') || 0 === strpos($trace[$i]['class'], 'PHPUnit\\')))) {
@@ -131,7 +131,7 @@ public static function register($mode = 0)
131131
// \Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait::endTest()
132132
// then we need to use the serialized information to determine
133133
// if the error has been triggered from vendor code.
134-
$isVendor = DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode && isset($parsedMsg['triggering_file']) && $inVendors($parsedMsg['triggering_file']);
134+
$isVendor = self::MODE_WEAK_VENDORS === $mode && isset($parsedMsg['triggering_file']) && $inVendors($parsedMsg['triggering_file']);
135135
} else {
136136
$class = isset($trace[$i]['object']) ? \get_class($trace[$i]['object']) : $trace[$i]['class'];
137137
$method = $trace[$i]['function'];
@@ -168,13 +168,13 @@ public static function register($mode = 0)
168168

169169
exit(1);
170170
}
171-
if ('legacy' !== $group && DeprecationErrorHandler::MODE_WEAK !== $mode) {
171+
if ('legacy' !== $group && self::MODE_WEAK !== $mode) {
172172
$ref = &$deprecations[$group][$msg]['count'];
173173
++$ref;
174174
$ref = &$deprecations[$group][$msg][$class.'::'.$method];
175175
++$ref;
176176
}
177-
} elseif (DeprecationErrorHandler::MODE_WEAK !== $mode) {
177+
} elseif (self::MODE_WEAK !== $mode) {
178178
$ref = &$deprecations[$group][$msg]['count'];
179179
++$ref;
180180
}
@@ -184,7 +184,7 @@ public static function register($mode = 0)
184184

185185
if (null !== $oldErrorHandler) {
186186
restore_error_handler();
187-
if (array($UtilPrefix.'ErrorHandler', 'handleError') === $oldErrorHandler) {
187+
if ([$UtilPrefix.'ErrorHandler', 'handleError'] === $oldErrorHandler) {
188188
restore_error_handler();
189189
self::register($mode);
190190
}
@@ -207,7 +207,7 @@ public static function register($mode = 0)
207207
$currErrorHandler = set_error_handler('var_dump');
208208
restore_error_handler();
209209

210-
if (DeprecationErrorHandler::MODE_WEAK === $mode) {
210+
if (self::MODE_WEAK === $mode) {
211211
$colorize = function ($str) { return $str; };
212212
}
213213
if ($currErrorHandler !== $deprecationHandler) {
@@ -218,8 +218,8 @@ public static function register($mode = 0)
218218
return $b['count'] - $a['count'];
219219
};
220220

221-
$groups = array('unsilenced', 'remaining');
222-
if (DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode) {
221+
$groups = ['unsilenced', 'remaining'];
222+
if (self::MODE_WEAK_VENDORS === $mode) {
223223
$groups[] = 'remaining vendor';
224224
}
225225
array_push($groups, 'legacy', 'other');
@@ -255,11 +255,11 @@ public static function register($mode = 0)
255255
$displayDeprecations($deprecations);
256256

257257
// store failing status
258-
$isFailing = DeprecationErrorHandler::MODE_WEAK !== $mode && $mode < $deprecations['unsilencedCount'] + $deprecations['remainingCount'] + $deprecations['otherCount'];
258+
$isFailing = self::MODE_WEAK !== $mode && $mode < $deprecations['unsilencedCount'] + $deprecations['remainingCount'] + $deprecations['otherCount'];
259259

260260
// reset deprecations array
261261
foreach ($deprecations as $group => $arrayOrInt) {
262-
$deprecations[$group] = \is_int($arrayOrInt) ? 0 : array();
262+
$deprecations[$group] = \is_int($arrayOrInt) ? 0 : [];
263263
}
264264

265265
register_shutdown_function(function () use (&$deprecations, $isFailing, $displayDeprecations, $mode) {
@@ -270,7 +270,7 @@ public static function register($mode = 0)
270270
}
271271
}
272272
$displayDeprecations($deprecations);
273-
if ($isFailing || DeprecationErrorHandler::MODE_WEAK !== $mode && $mode < $deprecations['unsilencedCount'] + $deprecations['remainingCount'] + $deprecations['otherCount']) {
273+
if ($isFailing || self::MODE_WEAK !== $mode && $mode < $deprecations['unsilencedCount'] + $deprecations['remainingCount'] + $deprecations['otherCount']) {
274274
exit(1);
275275
}
276276
});
@@ -280,8 +280,8 @@ public static function register($mode = 0)
280280

281281
public static function collectDeprecations($outputFile)
282282
{
283-
$deprecations = array();
284-
$previousErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) use (&$deprecations, &$previousErrorHandler) {
283+
$deprecations = [];
284+
$previousErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) use (&$deprecations, &$previousErrorHandler) {
285285
if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) {
286286
if ($previousErrorHandler) {
287287
return $previousErrorHandler($type, $msg, $file, $line, $context);
@@ -293,7 +293,7 @@ public static function collectDeprecations($outputFile)
293293

294294
return $ErrorHandler::handleError($type, $msg, $file, $line, $context);
295295
}
296-
$deprecations[] = array(error_reporting(), $msg, $file);
296+
$deprecations[] = [error_reporting(), $msg, $file];
297297
});
298298

299299
register_shutdown_function(function () use ($outputFile, &$deprecations) {

DnsMock.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
*/
1717
class DnsMock
1818
{
19-
private static $hosts = array();
20-
private static $dnsTypes = array(
19+
private static $hosts = [];
20+
private static $dnsTypes = [
2121
'A' => DNS_A,
2222
'MX' => DNS_MX,
2323
'NS' => DNS_NS,
@@ -30,7 +30,7 @@ class DnsMock
3030
'NAPTR' => DNS_NAPTR,
3131
'TXT' => DNS_TXT,
3232
'HINFO' => DNS_HINFO,
33-
);
33+
];
3434

3535
/**
3636
* Configures the mock values for DNS queries.
@@ -68,7 +68,7 @@ public static function getmxrr($hostname, &$mxhosts, &$weight = null)
6868
if (!self::$hosts) {
6969
return \getmxrr($hostname, $mxhosts, $weight);
7070
}
71-
$mxhosts = $weight = array();
71+
$mxhosts = $weight = [];
7272

7373
if (isset(self::$hosts[$hostname])) {
7474
foreach (self::$hosts[$hostname] as $record) {
@@ -125,7 +125,7 @@ public static function gethostbynamel($hostname)
125125
$ips = false;
126126

127127
if (isset(self::$hosts[$hostname])) {
128-
$ips = array();
128+
$ips = [];
129129

130130
foreach (self::$hosts[$hostname] as $record) {
131131
if ('A' === $record['type']) {
@@ -149,11 +149,11 @@ public static function dns_get_record($hostname, $type = DNS_ANY, &$authns = nul
149149
if (DNS_ANY === $type) {
150150
$type = DNS_ALL;
151151
}
152-
$records = array();
152+
$records = [];
153153

154154
foreach (self::$hosts[$hostname] as $record) {
155155
if (isset(self::$dnsTypes[$record['type']]) && (self::$dnsTypes[$record['type']] & $type)) {
156-
$records[] = array_merge(array('host' => $hostname, 'class' => 'IN', 'ttl' => 1, 'type' => $record['type']), $record);
156+
$records[] = array_merge(['host' => $hostname, 'class' => 'IN', 'ttl' => 1, 'type' => $record['type']], $record);
157157
}
158158
}
159159
}
@@ -165,7 +165,7 @@ public static function register($class)
165165
{
166166
$self = \get_called_class();
167167

168-
$mockedNs = array(substr($class, 0, strrpos($class, '\\')));
168+
$mockedNs = [substr($class, 0, strrpos($class, '\\'))];
169169
if (0 < strpos($class, '\\Tests\\')) {
170170
$ns = str_replace('\\Tests\\', '\\', $class);
171171
$mockedNs[] = substr($ns, 0, strrpos($ns, '\\'));

Legacy/CoverageListenerTrait.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(callable $sutFqcnResolver = null, $warningOnSutNotFo
3131
{
3232
$this->sutFqcnResolver = $sutFqcnResolver;
3333
$this->warningOnSutNotFound = $warningOnSutNotFound;
34-
$this->warnings = array();
34+
$this->warnings = [];
3535
}
3636

3737
public function startTest($test)
@@ -42,7 +42,7 @@ public function startTest($test)
4242

4343
$annotations = $test->getAnnotations();
4444

45-
$ignoredAnnotations = array('covers', 'coversDefaultClass', 'coversNothing');
45+
$ignoredAnnotations = ['covers', 'coversDefaultClass', 'coversNothing'];
4646

4747
foreach ($ignoredAnnotations as $annotation) {
4848
if (isset($annotations['class'][$annotation]) || isset($annotations['method'][$annotation])) {
@@ -74,11 +74,11 @@ public function startTest($test)
7474
$r->setAccessible(true);
7575

7676
$cache = $r->getValue();
77-
$cache = array_replace_recursive($cache, array(
78-
\get_class($test) => array(
79-
'covers' => array($sutFqcn),
80-
),
81-
));
77+
$cache = array_replace_recursive($cache, [
78+
\get_class($test) => [
79+
'covers' => [$sutFqcn],
80+
],
81+
]);
8282
$r->setValue($testClass, $cache);
8383
}
8484

Legacy/SymfonyTestsListenerForV5.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class SymfonyTestsListenerForV5 extends \PHPUnit_Framework_BaseTestListener
2222
{
2323
private $trait;
2424

25-
public function __construct(array $mockedNamespaces = array())
25+
public function __construct(array $mockedNamespaces = [])
2626
{
2727
$this->trait = new SymfonyTestsListenerTrait($mockedNamespaces);
2828
}

Legacy/SymfonyTestsListenerForV6.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class SymfonyTestsListenerForV6 extends BaseTestListener
2727
{
2828
private $trait;
2929

30-
public function __construct(array $mockedNamespaces = array())
30+
public function __construct(array $mockedNamespaces = [])
3131
{
3232
$this->trait = new SymfonyTestsListenerTrait($mockedNamespaces);
3333
}

Legacy/SymfonyTestsListenerForV7.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class SymfonyTestsListenerForV7 implements TestListener
3030

3131
private $trait;
3232

33-
public function __construct(array $mockedNamespaces = array())
33+
public function __construct(array $mockedNamespaces = [])
3434
{
3535
$this->trait = new SymfonyTestsListenerTrait($mockedNamespaces);
3636
}

0 commit comments

Comments
 (0)