From 372fc86601ca8f6a5f584d9782d153b426fe8479 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 11 Feb 2014 18:44:31 +0100 Subject: [PATCH] Use short array declarations --- .../Phrasea/Command/Plugin/ListPlugin.php | 20 +++++++++---------- .../Controller/Admin/ConnectedUsers.php | 2 +- lib/Alchemy/Phrasea/Controller/Permalink.php | 2 +- lib/Alchemy/Phrasea/Plugin/PluginManager.php | 2 +- lib/classes/patch/383alpha5a.php | 6 +++--- .../Command/Plugin/RemovePluginTest.php | 2 +- .../Phrasea/Controller/Prod/RecordsTest.php | 4 ++-- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/Alchemy/Phrasea/Command/Plugin/ListPlugin.php b/lib/Alchemy/Phrasea/Command/Plugin/ListPlugin.php index 0b6eee9070..3da4c15332 100644 --- a/lib/Alchemy/Phrasea/Command/Plugin/ListPlugin.php +++ b/lib/Alchemy/Phrasea/Command/Plugin/ListPlugin.php @@ -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 [ '' . $plugin->getName() . '', 'Error : ' . $plugin->getError()->getMessage() . '', '', - ); + ]; } } diff --git a/lib/Alchemy/Phrasea/Controller/Admin/ConnectedUsers.php b/lib/Alchemy/Phrasea/Controller/Admin/ConnectedUsers.php index 28c63f000f..6f8f81e799 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/ConnectedUsers.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/ConnectedUsers.php @@ -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[] = [ diff --git a/lib/Alchemy/Phrasea/Controller/Permalink.php b/lib/Alchemy/Phrasea/Controller/Permalink.php index 12271e0b1c..69a3e40cb4 100644 --- a/lib/Alchemy/Phrasea/Controller/Permalink.php +++ b/lib/Alchemy/Phrasea/Controller/Permalink.php @@ -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) diff --git a/lib/Alchemy/Phrasea/Plugin/PluginManager.php b/lib/Alchemy/Phrasea/Plugin/PluginManager.php index 491743bb64..f3c014a0f4 100644 --- a/lib/Alchemy/Phrasea/Plugin/PluginManager.php +++ b/lib/Alchemy/Phrasea/Plugin/PluginManager.php @@ -37,7 +37,7 @@ class PluginManager ->in($this->pluginDir) ->directories(); - $plugins = array(); + $plugins = []; foreach ($finder as $pluginDir) { $manifest = $error = null; diff --git a/lib/classes/patch/383alpha5a.php b/lib/classes/patch/383alpha5a.php index 18e49958d2..971a018909 100644 --- a/lib/classes/patch/383alpha5a.php +++ b/lib/classes/patch/383alpha5a.php @@ -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); diff --git a/tests/Alchemy/Tests/Phrasea/Command/Plugin/RemovePluginTest.php b/tests/Alchemy/Tests/Phrasea/Command/Plugin/RemovePluginTest.php index e9ad2541dd..35c1a84a16 100644 --- a/tests/Alchemy/Tests/Phrasea/Command/Plugin/RemovePluginTest.php +++ b/tests/Alchemy/Tests/Phrasea/Command/Plugin/RemovePluginTest.php @@ -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; diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Prod/RecordsTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Prod/RecordsTest.php index 100e955359..7b21d1ae16 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Prod/RecordsTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Prod/RecordsTest.php @@ -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());