Skip to content
This repository was archived by the owner on Dec 9, 2023. It is now read-only.

Commit e01830c

Browse files
committed
switched array() to []
1 parent 1f0ec2b commit e01830c

File tree

8 files changed

+19
-19
lines changed

8 files changed

+19
-19
lines changed

Command/ServerLogCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*/
2828
class ServerLogCommand extends Command
2929
{
30-
private static $bgColor = array('black', 'blue', 'cyan', 'green', 'magenta', 'red', 'white', 'yellow');
30+
private static $bgColor = ['black', 'blue', 'cyan', 'green', 'magenta', 'red', 'white', 'yellow'];
3131

3232
private $el;
3333
private $handler;
@@ -87,12 +87,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
8787

8888
$this->handler = new ConsoleHandler($output);
8989

90-
$this->handler->setFormatter(new ConsoleFormatter(array(
90+
$this->handler->setFormatter(new ConsoleFormatter([
9191
'format' => str_replace('\n', "\n", $input->getOption('format')),
9292
'date_format' => $input->getOption('date-format'),
9393
'colors' => $output->isDecorated(),
9494
'multiline' => OutputInterface::VERBOSITY_DEBUG <= $output->getVerbosity(),
95-
)));
95+
]));
9696

9797
if (false === strpos($host = $input->getOption('host'), '://')) {
9898
$host = 'tcp://'.$host;
@@ -120,8 +120,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
120120

121121
private function getLogs($socket)
122122
{
123-
$sockets = array((int) $socket => $socket);
124-
$write = array();
123+
$sockets = [(int) $socket => $socket];
124+
$write = [];
125125

126126
while (true) {
127127
$read = $sockets;

Command/ServerRunCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ public function __construct($documentRoot = null, $environment = null)
4747
protected function configure()
4848
{
4949
$this
50-
->setDefinition(array(
50+
->setDefinition([
5151
new InputArgument('addressport', InputArgument::OPTIONAL, 'The address to listen to (can be address:port, address, or port)'),
5252
new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root, usually where your front controllers are stored'),
5353
new InputOption('router', 'r', InputOption::VALUE_REQUIRED, 'Path to custom router script'),
54-
))
54+
])
5555
->setDescription('Runs a local web server')
5656
->setHelp(<<<'EOF'
5757
<info>%command.name%</info> runs a local web server: By default, the server

Command/ServerStartCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ public function __construct($documentRoot = null, $environment = null)
4747
protected function configure()
4848
{
4949
$this
50-
->setDefinition(array(
50+
->setDefinition([
5151
new InputArgument('addressport', InputArgument::OPTIONAL, 'The address to listen to (can be address:port, address, or port)'),
5252
new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root'),
5353
new InputOption('router', 'r', InputOption::VALUE_REQUIRED, 'Path to custom router script'),
5454
new InputOption('pidfile', null, InputOption::VALUE_REQUIRED, 'PID file'),
55-
))
55+
])
5656
->setDescription('Starts a local web server in the background')
5757
->setHelp(<<<'EOF'
5858
<info>%command.name%</info> runs a local web server: By default, the server
@@ -90,10 +90,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
9090
$io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output);
9191

9292
if (!\extension_loaded('pcntl')) {
93-
$io->error(array(
93+
$io->error([
9494
'This command needs the pcntl extension to run.',
9595
'You can either install it or use the "server:run" command instead.',
96-
));
96+
]);
9797

9898
if ($io->confirm('Do you want to execute <info>server:run</info> immediately?', false)) {
9999
return $this->getApplication()->find('server:run')->run($input, $output);

Command/ServerStatusCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ class ServerStatusCommand extends ServerCommand
3535
protected function configure()
3636
{
3737
$this
38-
->setDefinition(array(
38+
->setDefinition([
3939
new InputOption('pidfile', null, InputOption::VALUE_REQUIRED, 'PID file'),
4040
new InputOption('filter', null, InputOption::VALUE_REQUIRED, 'The value to display (one of port, host, or address)'),
41-
))
41+
])
4242
->setDescription('Outputs the status of the local web server')
4343
->setHelp(<<<'EOF'
4444
<info>%command.name%</info> shows the details of the given local web

Command/ServerStopCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class ServerStopCommand extends ServerCommand
3333
protected function configure()
3434
{
3535
$this
36-
->setDefinition(array(
36+
->setDefinition([
3737
new InputOption('pidfile', null, InputOption::VALUE_REQUIRED, 'PID file'),
38-
))
38+
])
3939
->setDescription('Stops the local web server that was started with the server:start command')
4040
->setHelp(<<<'EOF'
4141
<info>%command.name%</info> stops the local web server:

Tests/DependencyInjection/WebServerExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function testLoad()
2222
{
2323
$container = new ContainerBuilder();
2424
$container->setParameter('kernel.project_dir', __DIR__);
25-
(new WebServerExtension())->load(array(), $container);
25+
(new WebServerExtension())->load([], $container);
2626

2727
$this->assertSame(
2828
__DIR__.'/test',

WebServer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,12 @@ private function createServerProcess(WebServerConfig $config)
150150
throw new \RuntimeException('Unable to find the PHP binary.');
151151
}
152152

153-
$process = new Process(array_merge(array($binary), $finder->findArguments(), array('-dvariables_order=EGPCS', '-S', $config->getAddress(), $config->getRouter())));
153+
$process = new Process(array_merge([$binary], $finder->findArguments(), ['-dvariables_order=EGPCS', '-S', $config->getAddress(), $config->getRouter()]));
154154
$process->setWorkingDirectory($config->getDocumentRoot());
155155
$process->setTimeout(null);
156156

157157
if (\in_array('APP_ENV', explode(',', getenv('SYMFONY_DOTENV_VARS')))) {
158-
$process->setEnv(array('APP_ENV' => false));
158+
$process->setEnv(['APP_ENV' => false]);
159159
$process->inheritEnvironmentVariables();
160160
}
161161

WebServerConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private function findFrontController($documentRoot, $env)
114114

115115
private function getFrontControllerFileNames($env)
116116
{
117-
return array('app_'.$env.'.php', 'app.php', 'index_'.$env.'.php', 'index.php');
117+
return ['app_'.$env.'.php', 'app.php', 'index_'.$env.'.php', 'index.php'];
118118
}
119119

120120
private function findBestPort()

0 commit comments

Comments
 (0)