From e65402b681606d1b9a22b0f20f6d9450a14570a7 Mon Sep 17 00:00:00 2001 From: "bocharsky.bw" Date: Thu, 3 Dec 2015 10:54:14 +0200 Subject: [PATCH] Replace old array() syntax with new [] We could use new array syntax based on the fact that Symfony 3 require PHP >=5.5.9 --- app/AppKernel.php | 6 +++--- app/autoload.php | 2 +- bin/console | 4 ++-- src/AppBundle/Controller/DefaultController.php | 4 ++-- web/app_dev.php | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/AppKernel.php b/app/AppKernel.php index ff6d5d2020..3789b326e0 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -7,7 +7,7 @@ class AppKernel extends Kernel { public function registerBundles() { - $bundles = array( + $bundles = [ new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), new Symfony\Bundle\SecurityBundle\SecurityBundle(), new Symfony\Bundle\TwigBundle\TwigBundle(), @@ -16,9 +16,9 @@ public function registerBundles() new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new AppBundle\AppBundle(), - ); + ]; - if (in_array($this->getEnvironment(), array('dev', 'test'), true)) { + if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); diff --git a/app/autoload.php b/app/autoload.php index b32da0f3a3..c81b9e27f3 100644 --- a/app/autoload.php +++ b/app/autoload.php @@ -10,6 +10,6 @@ */ $loader = require __DIR__.'/../vendor/autoload.php'; -AnnotationRegistry::registerLoader(array($loader, 'loadClass')); +AnnotationRegistry::registerLoader([$loader, 'loadClass']); return $loader; diff --git a/bin/console b/bin/console index ca74e93611..49247c94dc 100755 --- a/bin/console +++ b/bin/console @@ -17,8 +17,8 @@ set_time_limit(0); $loader = require __DIR__.'/../app/autoload.php'; $input = new ArgvInput(); -$env = $input->getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev'); -$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod'; +$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev'); +$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod'; if ($debug) { Debug::enable(); diff --git a/src/AppBundle/Controller/DefaultController.php b/src/AppBundle/Controller/DefaultController.php index 3bd767561a..7b7bbc1f18 100644 --- a/src/AppBundle/Controller/DefaultController.php +++ b/src/AppBundle/Controller/DefaultController.php @@ -14,8 +14,8 @@ class DefaultController extends Controller public function indexAction(Request $request) { // replace this example code with whatever you need - return $this->render('default/index.html.twig', array( + return $this->render('default/index.html.twig', [ 'base_dir' => realpath($this->container->getParameter('kernel.root_dir').'/..'), - )); + ]); } } diff --git a/web/app_dev.php b/web/app_dev.php index 635bf7ac7b..8456754d56 100644 --- a/web/app_dev.php +++ b/web/app_dev.php @@ -12,7 +12,7 @@ // Feel free to remove this, extend it, or make something more sophisticated. if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) - || !(in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) || php_sapi_name() === 'cli-server') + || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server') ) { header('HTTP/1.0 403 Forbidden'); exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');