Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb4e394

Browse files
committed
Merge branch '4.4' into 5.0
* 4.4: Fix CS Fix CS
2 parents 85f793b + 03181ee commit bb4e394

File tree

71 files changed

+207
-192
lines changed

Some content is hidden

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

71 files changed

+207
-192
lines changed

src/Symfony/Bridge/PhpUnit/Tests/DnsMockTest.php

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ class DnsMockTest extends TestCase
1818
{
1919
protected function tearDown(): void
2020
{
21-
DnsMock::withMockedHosts(array());
21+
DnsMock::withMockedHosts([]);
2222
}
2323

2424
public function testCheckdnsrr()
2525
{
26-
DnsMock::withMockedHosts(array('example.com' => array(array('type' => 'MX'))));
26+
DnsMock::withMockedHosts(['example.com' => [['type' => 'MX']]]);
2727
$this->assertTrue(DnsMock::checkdnsrr('example.com'));
2828

29-
DnsMock::withMockedHosts(array('example.com' => array(array('type' => 'A'))));
29+
DnsMock::withMockedHosts(['example.com' => [['type' => 'A']]]);
3030
$this->assertFalse(DnsMock::checkdnsrr('example.com'));
3131
$this->assertTrue(DnsMock::checkdnsrr('example.com', 'a'));
3232
$this->assertTrue(DnsMock::checkdnsrr('example.com', 'any'));
@@ -35,34 +35,34 @@ public function testCheckdnsrr()
3535

3636
public function testGetmxrr()
3737
{
38-
DnsMock::withMockedHosts(array(
39-
'example.com' => array(array(
38+
DnsMock::withMockedHosts([
39+
'example.com' => [[
4040
'type' => 'MX',
4141
'host' => 'mx.example.com',
4242
'pri' => 10,
43-
)),
44-
));
43+
]],
44+
]);
4545

4646
$this->assertFalse(DnsMock::getmxrr('foobar.com', $mxhosts, $weight));
4747
$this->assertTrue(DnsMock::getmxrr('example.com', $mxhosts, $weight));
48-
$this->assertSame(array('mx.example.com'), $mxhosts);
49-
$this->assertSame(array(10), $weight);
48+
$this->assertSame(['mx.example.com'], $mxhosts);
49+
$this->assertSame([10], $weight);
5050
}
5151

5252
public function testGethostbyaddr()
5353
{
54-
DnsMock::withMockedHosts(array(
55-
'example.com' => array(
56-
array(
54+
DnsMock::withMockedHosts([
55+
'example.com' => [
56+
[
5757
'type' => 'A',
5858
'ip' => '1.2.3.4',
59-
),
60-
array(
59+
],
60+
[
6161
'type' => 'AAAA',
6262
'ipv6' => '::12',
63-
),
64-
),
65-
));
63+
],
64+
],
65+
]);
6666

6767
$this->assertSame('::21', DnsMock::gethostbyaddr('::21'));
6868
$this->assertSame('example.com', DnsMock::gethostbyaddr('::12'));
@@ -71,78 +71,78 @@ public function testGethostbyaddr()
7171

7272
public function testGethostbyname()
7373
{
74-
DnsMock::withMockedHosts(array(
75-
'example.com' => array(
76-
array(
74+
DnsMock::withMockedHosts([
75+
'example.com' => [
76+
[
7777
'type' => 'AAAA',
7878
'ipv6' => '::12',
79-
),
80-
array(
79+
],
80+
[
8181
'type' => 'A',
8282
'ip' => '1.2.3.4',
83-
),
84-
),
85-
));
83+
],
84+
],
85+
]);
8686

8787
$this->assertSame('foobar.com', DnsMock::gethostbyname('foobar.com'));
8888
$this->assertSame('1.2.3.4', DnsMock::gethostbyname('example.com'));
8989
}
9090

9191
public function testGethostbynamel()
9292
{
93-
DnsMock::withMockedHosts(array(
94-
'example.com' => array(
95-
array(
93+
DnsMock::withMockedHosts([
94+
'example.com' => [
95+
[
9696
'type' => 'A',
9797
'ip' => '1.2.3.4',
98-
),
99-
array(
98+
],
99+
[
100100
'type' => 'A',
101101
'ip' => '2.3.4.5',
102-
),
103-
),
104-
));
102+
],
103+
],
104+
]);
105105

106106
$this->assertFalse(DnsMock::gethostbynamel('foobar.com'));
107-
$this->assertSame(array('1.2.3.4', '2.3.4.5'), DnsMock::gethostbynamel('example.com'));
107+
$this->assertSame(['1.2.3.4', '2.3.4.5'], DnsMock::gethostbynamel('example.com'));
108108
}
109109

110110
public function testDnsGetRecord()
111111
{
112-
DnsMock::withMockedHosts(array(
113-
'example.com' => array(
114-
array(
112+
DnsMock::withMockedHosts([
113+
'example.com' => [
114+
[
115115
'type' => 'A',
116116
'ip' => '1.2.3.4',
117-
),
118-
array(
117+
],
118+
[
119119
'type' => 'PTR',
120120
'ip' => '2.3.4.5',
121-
),
122-
),
123-
));
121+
],
122+
],
123+
]);
124124

125-
$records = array(
126-
array(
125+
$records = [
126+
[
127127
'host' => 'example.com',
128128
'class' => 'IN',
129129
'ttl' => 1,
130130
'type' => 'A',
131131
'ip' => '1.2.3.4',
132-
),
133-
$ptr = array(
132+
],
133+
$ptr = [
134134
'host' => 'example.com',
135135
'class' => 'IN',
136136
'ttl' => 1,
137137
'type' => 'PTR',
138138
'ip' => '2.3.4.5',
139-
),
140-
);
139+
],
140+
];
141141

142142
$this->assertFalse(DnsMock::dns_get_record('foobar.com'));
143143
$this->assertSame($records, DnsMock::dns_get_record('example.com'));
144144
$this->assertSame($records, DnsMock::dns_get_record('example.com', DNS_ALL));
145145
$this->assertSame($records, DnsMock::dns_get_record('example.com', DNS_A | DNS_PTR));
146-
$this->assertSame(array($ptr), DnsMock::dns_get_record('example.com', DNS_PTR));
146+
$this->assertSame([$ptr], DnsMock::dns_get_record('example.com', DNS_PTR));
147147
}
148148
}

src/Symfony/Bridge/PhpUnit/bin/simple-phpunit.php

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
error_reporting(-1);
1616

1717
global $argv, $argc;
18-
$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array();
18+
$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : [];
1919
$argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0;
2020
$getEnvVar = function ($name, $default = false) use ($argv) {
2121
if (false !== $value = getenv($name)) {
@@ -130,11 +130,11 @@
130130
$PHP .= ' -qrr';
131131
}
132132

133-
$defaultEnvs = array(
133+
$defaultEnvs = [
134134
'COMPOSER' => 'composer.json',
135135
'COMPOSER_VENDOR_DIR' => 'vendor',
136136
'COMPOSER_BIN_DIR' => 'bin',
137-
);
137+
];
138138

139139
foreach ($defaultEnvs as $envName => $envValue) {
140140
if ($envValue !== getenv($envName)) {
@@ -147,21 +147,21 @@
147147
|| ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar 2> /dev/null`))
148148
|| ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer`) : `which composer 2> /dev/null`))
149149
|| file_exists($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? `git rev-parse --show-toplevel 2> NUL` : `git rev-parse --show-toplevel 2> /dev/null`).DIRECTORY_SEPARATOR.'composer.phar')
150-
? (file_get_contents($COMPOSER, false, null, 0, 18) === '#!/usr/bin/env php' ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
150+
? ('#!/usr/bin/env php' === file_get_contents($COMPOSER, false, null, 0, 18) ? $PHP : '').' '.escapeshellarg($COMPOSER) // detect shell wrappers by looking at the shebang
151151
: 'composer';
152152

153-
$SYMFONY_PHPUNIT_REMOVE = $getEnvVar('SYMFONY_PHPUNIT_REMOVE', 'phpspec/prophecy'.($PHPUNIT_VERSION < 6.0 ? ' symfony/yaml': ''));
154-
$configurationHash = md5(implode(PHP_EOL, array(md5_file(__FILE__), $SYMFONY_PHPUNIT_REMOVE, (int) $PHPUNIT_REMOVE_RETURN_TYPEHINT)));
155-
$PHPUNIT_VERSION_DIR=sprintf('phpunit-%s-%d', $PHPUNIT_VERSION, $PHPUNIT_REMOVE_RETURN_TYPEHINT);
153+
$SYMFONY_PHPUNIT_REMOVE = $getEnvVar('SYMFONY_PHPUNIT_REMOVE', 'phpspec/prophecy'.($PHPUNIT_VERSION < 6.0 ? ' symfony/yaml' : ''));
154+
$configurationHash = md5(implode(PHP_EOL, [md5_file(__FILE__), $SYMFONY_PHPUNIT_REMOVE, (int) $PHPUNIT_REMOVE_RETURN_TYPEHINT]));
155+
$PHPUNIT_VERSION_DIR = sprintf('phpunit-%s-%d', $PHPUNIT_VERSION, $PHPUNIT_REMOVE_RETURN_TYPEHINT);
156156
if (!file_exists("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit") || $configurationHash !== @file_get_contents("$PHPUNIT_DIR/.$PHPUNIT_VERSION_DIR.md5")) {
157157
// Build a standalone phpunit without symfony/yaml nor prophecy by default
158158

159159
@mkdir($PHPUNIT_DIR, 0777, true);
160160
chdir($PHPUNIT_DIR);
161161
if (file_exists("$PHPUNIT_VERSION_DIR")) {
162-
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s > NUL': 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old"));
162+
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s > NUL' : 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old"));
163163
rename("$PHPUNIT_VERSION_DIR", "$PHPUNIT_VERSION_DIR.old");
164-
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s': 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old"));
164+
passthru(sprintf('\\' === DIRECTORY_SEPARATOR ? 'rmdir /S /Q %s' : 'rm -rf %s', "$PHPUNIT_VERSION_DIR.old"));
165165
}
166166
$passthruOrFail("$COMPOSER create-project --no-install --prefer-dist --no-scripts --no-plugins --no-progress --ansi phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\"");
167167
@copy("$PHPUNIT_VERSION_DIR/phpunit.xsd", 'phpunit.xsd');
@@ -187,7 +187,7 @@
187187
putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");
188188
$q = '\\' === DIRECTORY_SEPARATOR ? '"' : '';
189189
// --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS
190-
$exit = proc_close(proc_open("$q$COMPOSER install --no-dev --prefer-dist --no-progress --ansi$q", array(), $p, getcwd()));
190+
$exit = proc_close(proc_open("$q$COMPOSER install --no-dev --prefer-dist --no-progress --ansi$q", [], $p, getcwd()));
191191
putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : ''));
192192
if ($exit) {
193193
exit($exit);
@@ -233,13 +233,20 @@ class SymfonyBlacklistPhpunit {}
233233
}
234234

235235
if ($PHPUNIT_VERSION < 8.0) {
236-
$argv = array_filter($argv, function ($v) use (&$argc) { if ('--do-not-cache-result' !== $v) return true; --$argc; return false; });
236+
$argv = array_filter($argv, function ($v) use (&$argc) {
237+
if ('--do-not-cache-result' !== $v) {
238+
return true;
239+
}
240+
--$argc;
241+
242+
return false;
243+
});
237244
} elseif (filter_var(getenv('SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE'), FILTER_VALIDATE_BOOLEAN)) {
238245
$argv[] = '--do-not-cache-result';
239246
++$argc;
240247
}
241248

242-
$components = array();
249+
$components = [];
243250
$cmd = array_map('escapeshellarg', $argv);
244251
$exit = 0;
245252

@@ -274,7 +281,7 @@ class SymfonyBlacklistPhpunit {}
274281

275282
if ($components) {
276283
$skippedTests = isset($_SERVER['SYMFONY_PHPUNIT_SKIPPED_TESTS']) ? $_SERVER['SYMFONY_PHPUNIT_SKIPPED_TESTS'] : false;
277-
$runningProcs = array();
284+
$runningProcs = [];
278285

279286
foreach ($components as $component) {
280287
// Run phpunit tests in parallel
@@ -285,7 +292,7 @@ class SymfonyBlacklistPhpunit {}
285292

286293
$c = escapeshellarg($component);
287294

288-
if ($proc = proc_open(sprintf($cmd, $c, " > $c/phpunit.stdout 2> $c/phpunit.stderr"), array(), $pipes)) {
295+
if ($proc = proc_open(sprintf($cmd, $c, " > $c/phpunit.stdout 2> $c/phpunit.stderr"), [], $pipes)) {
289296
$runningProcs[$component] = $proc;
290297
} else {
291298
$exit = 1;
@@ -295,7 +302,7 @@ class SymfonyBlacklistPhpunit {}
295302

296303
while ($runningProcs) {
297304
usleep(300000);
298-
$terminatedProcs = array();
305+
$terminatedProcs = [];
299306
foreach ($runningProcs as $component => $proc) {
300307
$procStatus = proc_get_status($proc);
301308
if (!$procStatus['running']) {
@@ -306,7 +313,7 @@ class SymfonyBlacklistPhpunit {}
306313
}
307314

308315
foreach ($terminatedProcs as $component => $procStatus) {
309-
foreach (array('out', 'err') as $file) {
316+
foreach (['out', 'err'] as $file) {
310317
$file = "$component/phpunit.std$file";
311318
readfile($file);
312319
unlink($file);
@@ -316,7 +323,7 @@ class SymfonyBlacklistPhpunit {}
316323
// STATUS_STACK_BUFFER_OVERRUN (-1073740791/0xC0000409)
317324
// STATUS_ACCESS_VIOLATION (-1073741819/0xC0000005)
318325
// STATUS_HEAP_CORRUPTION (-1073740940/0xC0000374)
319-
if ($procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded('apcu') || !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) || !in_array($procStatus, array(-1073740791, -1073741819, -1073740940)))) {
326+
if ($procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded('apcu') || !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) || !in_array($procStatus, [-1073740791, -1073741819, -1073740940]))) {
320327
$exit = $procStatus;
321328
echo "\033[41mKO\033[0m $component\n\n";
322329
} else {
@@ -326,9 +333,11 @@ class SymfonyBlacklistPhpunit {}
326333
}
327334
} elseif (!isset($argv[1]) || 'install' !== $argv[1] || file_exists('install')) {
328335
if (!class_exists('SymfonyBlacklistSimplePhpunit', false)) {
329-
class SymfonyBlacklistSimplePhpunit {}
336+
class SymfonyBlacklistSimplePhpunit
337+
{
338+
}
330339
}
331-
array_splice($argv, 1, 0, array('--colors=always'));
340+
array_splice($argv, 1, 0, ['--colors=always']);
332341
$_SERVER['argv'] = $argv;
333342
$_SERVER['argc'] = ++$argc;
334343
include "$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit";

src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function setContainer(ContainerInterface $container): ?ContainerInterface
7979
protected function getParameter(string $name)
8080
{
8181
if (!$this->container->has('parameter_bag')) {
82-
throw new ServiceNotFoundException('parameter_bag', null, null, [], sprintf('The "%s::getParameter()" method is missing a parameter bag to work properly. Did you forget to register your controller as a service subscriber? This can be fixed either by using autoconfiguration or by manually wiring a "parameter_bag" in the service locator passed to the controller.', \get_class($this)));
82+
throw new ServiceNotFoundException('parameter_bag', null, null, [], sprintf('The "%s::getParameter()" method is missing a parameter bag to work properly. Did you forget to register your controller as a service subscriber? This can be fixed either by using autoconfiguration or by manually wiring a "parameter_bag" in the service locator passed to the controller.', static::class));
8383
}
8484

8585
return $this->container->get('parameter_bag')->get($name);

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ protected function createContainer(array $data = [])
14181418

14191419
protected function createContainerFromFile($file, $data = [], $resetCompilerPasses = true, $compile = true)
14201420
{
1421-
$cacheKey = md5(\get_class($this).$file.serialize($data));
1421+
$cacheKey = md5(static::class.$file.serialize($data));
14221422
if ($compile && isset(self::$containerCache[$cacheKey])) {
14231423
return self::$containerCache[$cacheKey];
14241424
}

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AbstractWebTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ protected static function createKernel(array $options = []): KernelInterface
6969

7070
protected static function getVarDir()
7171
{
72-
return 'FB'.substr(strrchr(\get_called_class(), '\\'), 1);
72+
return 'FB'.substr(strrchr(static::class, '\\'), 1);
7373
}
7474
}

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ public function testEncodersWithArgon2i()
424424
],
425425
'JMS\FooBundle\Entity\User7' => [
426426
'class' => $sodium ? SodiumPasswordEncoder::class : NativePasswordEncoder::class,
427-
'arguments' => $sodium ? [256, 1] : [1, 262144, null, \PASSWORD_ARGON2I],
427+
'arguments' => $sodium ? [256, 1] : [1, 262144, null, PASSWORD_ARGON2I],
428428
],
429429
]], $container->getDefinition('security.encoder_factory.generic')->getArguments());
430430
}
@@ -534,7 +534,7 @@ public function testEncodersWithBCrypt()
534534
],
535535
'JMS\FooBundle\Entity\User7' => [
536536
'class' => NativePasswordEncoder::class,
537-
'arguments' => [null, null, 15, \PASSWORD_BCRYPT],
537+
'arguments' => [null, null, 15, PASSWORD_BCRYPT],
538538
],
539539
]], $container->getDefinition('security.encoder_factory.generic')->getArguments());
540540
}

src/Symfony/Bundle/SecurityBundle/Tests/Functional/AbstractWebTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ protected static function createKernel(array $options = []): KernelInterface
6969

7070
protected static function getVarDir()
7171
{
72-
return 'SB'.substr(strrchr(\get_called_class(), '\\'), 1);
72+
return 'SB'.substr(strrchr(static::class, '\\'), 1);
7373
}
7474
}

src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function __construct($redisClient, string $namespace = '', int $defaultLi
8080

8181
foreach (\is_array($compression) ? $compression : [$compression] as $c) {
8282
if (\Redis::COMPRESSION_NONE !== $c) {
83-
throw new InvalidArgumentException(sprintf('phpredis compression must be disabled when using "%s", use "%s" instead.', \get_class($this), DeflateMarshaller::class));
83+
throw new InvalidArgumentException(sprintf('phpredis compression must be disabled when using "%s", use "%s" instead.', static::class, DeflateMarshaller::class));
8484
}
8585
}
8686
}

src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function testUnserializable()
5555

5656
public function testVersion()
5757
{
58-
$namespace = str_replace('\\', '.', \get_class($this));
58+
$namespace = str_replace('\\', '.', static::class);
5959

6060
$pool1 = new ApcuAdapter($namespace, 0, 'p1');
6161

@@ -80,7 +80,7 @@ public function testVersion()
8080

8181
public function testNamespace()
8282
{
83-
$namespace = str_replace('\\', '.', \get_class($this));
83+
$namespace = str_replace('\\', '.', static::class);
8484

8585
$pool1 = new ApcuAdapter($namespace.'_1', 0, 'p1');
8686

0 commit comments

Comments
 (0)