Use short array declaration

This commit is contained in:
Romain Neutron
2013-11-18 11:58:12 +01:00
parent 2898b317c4
commit 56b373ee6e
723 changed files with 8350 additions and 8352 deletions

View File

@@ -82,7 +82,7 @@ class appbox extends base
if (!is_null($pathfile)) {
if (!in_array(mb_strtolower($pathfile->getMimeType()), array('image/gif', 'image/png', 'image/jpeg', 'image/jpg', 'image/pjpeg'))) {
if (!in_array(mb_strtolower($pathfile->getMimeType()), ['image/gif', 'image/png', 'image/jpeg', 'image/jpg', 'image/pjpeg'])) {
throw new \InvalidArgumentException('Invalid file format');
}
@@ -146,7 +146,7 @@ class appbox extends base
$file = $this->app['root.path'] . '/config/' . $pic_type . '/' . $collection->get_base_id();
$custom_path = $this->app['root.path'] . '/www/custom/' . $pic_type . '/' . $collection->get_base_id();
foreach (array($file, $custom_path) as $target) {
foreach ([$file, $custom_path] as $target) {
if (is_file($target)) {
@@ -171,12 +171,12 @@ class appbox extends base
if (!is_null($pathfile)) {
if (!in_array(mb_strtolower($pathfile->getMimeType()), array('image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png', 'image/gif'))) {
if (!in_array(mb_strtolower($pathfile->getMimeType()), ['image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png', 'image/gif'])) {
throw new \InvalidArgumentException('Invalid file format');
}
}
if (!in_array($pic_type, array(databox::PIC_PDF))) {
if (!in_array($pic_type, [databox::PIC_PDF])) {
throw new \InvalidArgumentException('unknown pic_type');
}
@@ -201,7 +201,7 @@ class appbox extends base
$file = $this->app['root.path'] . '/config/minilogos/' . $pic_type . '_' . $databox->get_sbas_id() . '.jpg';
$custom_path = $this->app['root.path'] . '/www/custom/minilogos/' . $pic_type . '_' . $databox->get_sbas_id() . '.jpg';
foreach (array($file, $custom_path) as $target) {
foreach ([$file, $custom_path] as $target) {
if (is_file($target)) {
$filesystem->remove($target);
@@ -231,7 +231,7 @@ class appbox extends base
{
$sqlupd = "UPDATE bas SET ord = :ordre WHERE base_id = :base_id";
$stmt = $this->get_connection()->prepare($sqlupd);
$stmt->execute(array(':ordre' => $ordre, ':base_id' => $collection->get_base_id()));
$stmt->execute([':ordre' => $ordre, ':base_id' => $collection->get_base_id()]);
$stmt->closeCursor();
$collection->get_databox()->delete_data_from_cache(\databox::CACHE_COLLECTIONS);
@@ -251,10 +251,10 @@ class appbox extends base
$sql = 'UPDATE sbas SET indexable = :indexable WHERE sbas_id = :sbas_id';
$stmt = $this->get_connection()->prepare($sql);
$stmt->execute(array(
$stmt->execute([
':indexable' => ($boolean ? '1' : '0'),
':sbas_id' => $databox->get_sbas_id()
));
]);
$stmt->closeCursor();
return $this;
@@ -270,7 +270,7 @@ class appbox extends base
$sql = 'SELECT indexable FROM sbas WHERE sbas_id = :sbas_id';
$stmt = $this->get_connection()->prepare($sql);
$stmt->execute(array(':sbas_id' => $databox->get_sbas_id()));
$stmt->execute([':sbas_id' => $databox->get_sbas_id()]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -322,13 +322,13 @@ class appbox extends base
$upgrader->set_current_message(_('Purging directories'));
$finder = new Finder();
$finder->in(array(
$finder->in([
$this->app['root.path'] . '/tmp/cache_minify/',
$this->app['root.path'] . '/tmp/cache_twig/',
$this->app['root.path'] . '/tmp/cache/profiler/',
$this->app['root.path'] . '/tmp/doctrine/',
$this->app['root.path'] . '/tmp/serializer/',
))
])
->depth(0)
->ignoreVCS(true)
->ignoreDotFiles(true);
@@ -344,19 +344,19 @@ class appbox extends base
*/
$upgrader->set_current_message(_('Copying files'));
foreach (array(
foreach ([
'config/custom_files/' => 'www/custom/',
'config/minilogos/' => 'www/custom/minilogos/',
'config/stamp/' => 'www/custom/stamp/',
'config/status/' => 'www/custom/status/',
'config/wm/' => 'www/custom/wm/',
) as $source => $target) {
] as $source => $target) {
$app['filesystem']->mirror($this->app['root.path'] . '/' . $source, $this->app['root.path'] . '/' . $target);
}
$upgrader->add_steps_complete(1);
$advices = array();
$advices = [];
/**
* Step 6
@@ -430,7 +430,7 @@ class appbox extends base
return $this->databoxes;
}
$ret = array();
$ret = [];
foreach ($this->retrieve_sbas_ids() as $sbas_id) {
try {
$ret[$sbas_id] = new \databox($this->app, $sbas_id);
@@ -453,7 +453,7 @@ class appbox extends base
}
$sql = 'SELECT sbas_id FROM sbas';
$ret = array();
$ret = [];
$stmt = $this->get_connection()->prepare($sql);
$stmt->execute();