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

View File

@@ -74,7 +74,7 @@ class ConnectedUsers implements ControllerProviderInterface
$info = '';
}
} 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[] = [

View File

@@ -77,7 +77,7 @@ class Permalink extends AbstractDelivery
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)

View File

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

View File

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

View File

@@ -106,7 +106,7 @@ class RemovePluginTest extends PluginCommandTestCase
private function addPluginData()
{
$data = array('key' => 'value');
$data = ['key' => 'value'];
$conf = self::$DI['cli']['phraseanet.configuration']->getConfig();
$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']->flush();
$this->XMLHTTPRequest('POST', '/prod/records/', array(
$this->XMLHTTPRequest('POST', '/prod/records/', [
'env' => 'BASK',
'pos' => 0,
'query' => '',
'cont' => $basket->getId(),
));
]);
$response = self::$DI['client']->getResponse();
$this->assertEquals(200, $response->getStatusCode());