Use short array declarations

This commit is contained in:
Romain Neutron
2014-02-11 18:44:31 +01:00
parent 76048709ee
commit 372fc86601
7 changed files with 19 additions and 19 deletions

View File

@@ -38,11 +38,11 @@ class ListPlugin extends AbstractPluginCommand
}, $this->container['plugins.manager']->listPlugins()); }, $this->container['plugins.manager']->listPlugins());
if ($input->getOption('json')) { if ($input->getOption('json')) {
$output->writeln(json_encode(array('plugins' => array_values($plugins)))); $output->writeln(json_encode(['plugins' => array_values($plugins)]));
} else { } else {
$table = $this->getHelperSet()->get('table'); $table = $this->getHelperSet()->get('table');
$table $table
->setHeaders(array('Name', 'Version', 'Description')) ->setHeaders(['Name', 'Version', 'Description'])
->setRows($plugins) ->setRows($plugins)
; ;
@@ -55,36 +55,36 @@ class ListPlugin extends AbstractPluginCommand
private function formatPlugin(InputInterface $input, Plugin $plugin) private function formatPlugin(InputInterface $input, Plugin $plugin)
{ {
if ($input->getOption('json')) { if ($input->getOption('json')) {
return array( return [
'name' => $plugin->getName(), 'name' => $plugin->getName(),
'version' => $plugin->getManifest()->getVersion(), 'version' => $plugin->getManifest()->getVersion(),
'description' => $plugin->getManifest()->getDescription(), 'description' => $plugin->getManifest()->getDescription(),
'error' => false, 'error' => false,
); ];
} }
return array( return [
$plugin->getName(), $plugin->getName(),
$plugin->getManifest()->getVersion(), $plugin->getManifest()->getVersion(),
$plugin->getManifest()->getDescription(), $plugin->getManifest()->getDescription(),
); ];
} }
private function formatErroneousPlugin(InputInterface $input, Plugin $plugin) private function formatErroneousPlugin(InputInterface $input, Plugin $plugin)
{ {
if ($input->getOption('json')) { if ($input->getOption('json')) {
return array( return [
'name' => $plugin->getName(), 'name' => $plugin->getName(),
'error' => true, 'error' => true,
'description' => 'Error : '.$plugin->getError()->getMessage(), 'description' => 'Error : '.$plugin->getError()->getMessage(),
'version' => null, 'version' => null,
); ];
} }
return array( return [
'<error>' . $plugin->getName() . '</error>', '<error>' . $plugin->getName() . '</error>',
'<error>Error : ' . $plugin->getError()->getMessage() . '</error>', '<error>Error : ' . $plugin->getError()->getMessage() . '</error>',
'', '',
); ];
} }
} }

View File

@@ -74,7 +74,7 @@ class ConnectedUsers implements ControllerProviderInterface
$info = ''; $info = '';
} }
} catch (GeonamesExceptionInterface $e) { } catch (GeonamesExceptionInterface $e) {
$app['monolog']->error(sprintf("Unable to get IP information for %s", $session->getIpAddress()), array('exception' => $e)); $app['monolog']->error(sprintf("Unable to get IP information for %s", $session->getIpAddress()), ['exception' => $e]);
} }
$result[] = [ $result[] = [

View File

@@ -77,7 +77,7 @@ class Permalink extends AbstractDelivery
throw new NotFoundHttpException("Record not found"); throw new NotFoundHttpException("Record not found");
} }
return new Response('', 200, array('Allow' => 'GET, HEAD, OPTIONS')); return new Response('', 200, ['Allow' => 'GET, HEAD, OPTIONS']);
} }
public function deliverCaption(PhraseaApplication $app, Request $request, $sbas_id, $record_id) public function deliverCaption(PhraseaApplication $app, Request $request, $sbas_id, $record_id)

View File

@@ -37,7 +37,7 @@ class PluginManager
->in($this->pluginDir) ->in($this->pluginDir)
->directories(); ->directories();
$plugins = array(); $plugins = [];
foreach ($finder as $pluginDir) { foreach ($finder as $pluginDir) {
$manifest = $error = null; $manifest = $error = null;

View File

@@ -17,7 +17,7 @@ class patch_383alpha5a implements patchInterface
private $release = '3.8.3-alpha.5'; private $release = '3.8.3-alpha.5';
/** @var array */ /** @var array */
private $concern = array(base::APPLICATION_BOX); private $concern = [base::APPLICATION_BOX];
/** /**
* {@inheritdoc} * {@inheritdoc}
@@ -58,11 +58,11 @@ class patch_383alpha5a implements patchInterface
{ {
$config = $app['phraseanet.configuration']->getConfig(); $config = $app['phraseanet.configuration']->getConfig();
$config['main']['task-manager']['logger'] = array( $config['main']['task-manager']['logger'] = [
'enabled' => true, 'enabled' => true,
'max-files' => 10, 'max-files' => 10,
'level' => 'INFO', 'level' => 'INFO',
); ];
$app['phraseanet.configuration']->setConfig($config); $app['phraseanet.configuration']->setConfig($config);

View File

@@ -106,7 +106,7 @@ class RemovePluginTest extends PluginCommandTestCase
private function addPluginData() private function addPluginData()
{ {
$data = array('key' => 'value'); $data = ['key' => 'value'];
$conf = self::$DI['cli']['phraseanet.configuration']->getConfig(); $conf = self::$DI['cli']['phraseanet.configuration']->getConfig();
$conf['plugins']['test-plugin'] = $data; $conf['plugins']['test-plugin'] = $data;

View File

@@ -96,12 +96,12 @@ class RecordsTest extends \PhraseanetAuthenticatedWebTestCase
self::$DI['app']['EM']->persist($element); self::$DI['app']['EM']->persist($element);
self::$DI['app']['EM']->flush(); self::$DI['app']['EM']->flush();
$this->XMLHTTPRequest('POST', '/prod/records/', array( $this->XMLHTTPRequest('POST', '/prod/records/', [
'env' => 'BASK', 'env' => 'BASK',
'pos' => 0, 'pos' => 0,
'query' => '', 'query' => '',
'cont' => $basket->getId(), 'cont' => $basket->getId(),
)); ]);
$response = self::$DI['client']->getResponse(); $response = self::$DI['client']->getResponse();
$this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(200, $response->getStatusCode());