diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php
index 8b95cb02b8..860a6c7c20 100644
--- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php
+++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php
@@ -50,7 +50,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
/**
* List of potential container parameters that hold the object manager name
* to register the mappings with the correct metadata driver, for example
- * array('acme.manager', 'doctrine.default_entity_manager').
+ * ['acme.manager', 'doctrine.default_entity_manager'].
*
* @var string[]
*/
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt
index 1070b19a43..9bc155a7cd 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt
+++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt
@@ -25,7 +25,7 @@ class Test
{
public static function getGroups()
{
- return array();
+ return [];
}
}
EOPHP
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php
index 16a58246d2..5229a7a7cc 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php
+++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/fake_vendor/acme/lib/deprecation_riddled.php
@@ -7,7 +7,7 @@ class Test
{
public static function getGroups()
{
- return array();
+ return [];
}
}
EOPHP
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/shutdown_deprecations.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/shutdown_deprecations.phpt
index a0bf3e2ba7..703db6fd19 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/shutdown_deprecations.phpt
+++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/shutdown_deprecations.phpt
@@ -25,7 +25,7 @@ class Test
{
public static function getGroups()
{
- return array();
+ return [];
}
}
EOPHP
diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt
index e20c7adf6b..b37b623cf2 100644
--- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt
+++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak_vendors_on_non_vendor.phpt
@@ -25,7 +25,7 @@ class Test
{
public static function getGroups()
{
- return array();
+ return [];
}
}
EOPHP
diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit
index af60eb0f8c..a8528d7375 100755
--- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit
+++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit
@@ -83,7 +83,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
$prevRoot = getenv('COMPOSER_ROOT_VERSION');
putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99");
// --no-suggest is not in the list to keep compat with composer 1.0, which is shipped with Ubuntu 16.04LTS
- $exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", array(), $p, getcwd(), null, array('bypass_shell' => true)));
+ $exit = proc_close(proc_open("$COMPOSER install --no-dev --prefer-dist --no-progress --ansi", [], $p, getcwd(), null, ['bypass_shell' => true]));
putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : ''));
if ($exit) {
exit($exit);
@@ -116,9 +116,9 @@ EOPHP
}
global $argv, $argc;
-$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array();
+$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : [];
$argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0;
-$components = array();
+$components = [];
$cmd = array_map('escapeshellarg', $argv);
$exit = 0;
@@ -153,7 +153,7 @@ if ('\\' === DIRECTORY_SEPARATOR) {
if ($components) {
$skippedTests = isset($_SERVER['SYMFONY_PHPUNIT_SKIPPED_TESTS']) ? $_SERVER['SYMFONY_PHPUNIT_SKIPPED_TESTS'] : false;
- $runningProcs = array();
+ $runningProcs = [];
foreach ($components as $component) {
// Run phpunit tests in parallel
@@ -164,7 +164,7 @@ if ($components) {
$c = escapeshellarg($component);
- if ($proc = proc_open(sprintf($cmd, $c, " > $c/phpunit.stdout 2> $c/phpunit.stderr"), array(), $pipes)) {
+ if ($proc = proc_open(sprintf($cmd, $c, " > $c/phpunit.stdout 2> $c/phpunit.stderr"), [], $pipes)) {
$runningProcs[$component] = $proc;
} else {
$exit = 1;
@@ -174,7 +174,7 @@ if ($components) {
while ($runningProcs) {
usleep(300000);
- $terminatedProcs = array();
+ $terminatedProcs = [];
foreach ($runningProcs as $component => $proc) {
$procStatus = proc_get_status($proc);
if (!$procStatus['running']) {
@@ -185,7 +185,7 @@ if ($components) {
}
foreach ($terminatedProcs as $component => $procStatus) {
- foreach (array('out', 'err') as $file) {
+ foreach (['out', 'err'] as $file) {
$file = "$component/phpunit.std$file";
readfile($file);
unlink($file);
@@ -195,7 +195,7 @@ if ($components) {
// STATUS_STACK_BUFFER_OVERRUN (-1073740791/0xC0000409)
// STATUS_ACCESS_VIOLATION (-1073741819/0xC0000005)
// STATUS_HEAP_CORRUPTION (-1073740940/0xC0000374)
- if ($procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded('apcu') || !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) || !in_array($procStatus, array(-1073740791, -1073741819, -1073740940)))) {
+ if ($procStatus && ('\\' !== DIRECTORY_SEPARATOR || !extension_loaded('apcu') || !filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) || !in_array($procStatus, [-1073740791, -1073741819, -1073740940]))) {
$exit = $procStatus;
echo "\033[41mKO\033[0m $component\n\n";
} else {
@@ -207,7 +207,7 @@ if ($components) {
if (!class_exists('SymfonyBlacklistSimplePhpunit', false)) {
class SymfonyBlacklistSimplePhpunit {}
}
- array_splice($argv, 1, 0, array('--colors=always'));
+ array_splice($argv, 1, 0, ['--colors=always']);
$_SERVER['argv'] = $argv;
$_SERVER['argc'] = ++$argc;
include "$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit";
diff --git a/src/Symfony/Bridge/Twig/AppVariable.php b/src/Symfony/Bridge/Twig/AppVariable.php
index d3fb5a55b3..21020270a0 100644
--- a/src/Symfony/Bridge/Twig/AppVariable.php
+++ b/src/Symfony/Bridge/Twig/AppVariable.php
@@ -150,7 +150,7 @@ class AppVariable
* Returns some or all the existing flash messages:
* * getFlashes() returns all the flash messages
* * getFlashes('notice') returns a simple array with flash messages of that type
- * * getFlashes(array('notice', 'error')) returns a nested array of type => messages.
+ * * getFlashes(['notice', 'error']) returns a nested array of type => messages.
*
* @return array
*/
diff --git a/src/Symfony/Bridge/Twig/CHANGELOG.md b/src/Symfony/Bridge/Twig/CHANGELOG.md
index 8d5d6f56b6..4ccde38947 100644
--- a/src/Symfony/Bridge/Twig/CHANGELOG.md
+++ b/src/Symfony/Bridge/Twig/CHANGELOG.md
@@ -33,7 +33,7 @@ CHANGELOG
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
// ...
- $rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'));
+ $rendererEngine = new TwigRendererEngine(['form_div_layout.html.twig']);
$rendererEngine->setEnvironment($twig);
$twig->addExtension(new FormExtension(new TwigRenderer($rendererEngine, $csrfTokenManager)));
```
@@ -42,13 +42,13 @@ CHANGELOG
```php
// ...
- $rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'), $twig);
+ $rendererEngine = new TwigRendererEngine(['form_div_layout.html.twig'], $twig);
// require Twig 1.30+
- $twig->addRuntimeLoader(new \Twig\RuntimeLoader\FactoryRuntimeLoader(array(
+ $twig->addRuntimeLoader(new \Twig\RuntimeLoader\FactoryRuntimeLoader([
TwigRenderer::class => function () use ($rendererEngine, $csrfTokenManager) {
return new TwigRenderer($rendererEngine, $csrfTokenManager);
},
- )));
+ ]));
$twig->addExtension(new FormExtension());
```
* Deprecated the `TwigRendererEngineInterface` interface.
diff --git a/src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php b/src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php
index cf00b4c53a..0ca519ee72 100644
--- a/src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php
@@ -51,7 +51,7 @@ class WebLinkExtension extends AbstractExtension
*
* @param string $uri The relation URI
* @param string $rel The relation type (e.g. "preload", "prefetch", "prerender" or "dns-prefetch")
- * @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('pr' => 0.5)")
+ * @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
*
* @return string The relation URI
*/
@@ -76,7 +76,7 @@ class WebLinkExtension extends AbstractExtension
* Preloads a resource.
*
* @param string $uri A public path
- * @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('crossorigin' => 'use-credentials')")
+ * @param array $attributes The attributes of this link (e.g. "['as' => true]", "['crossorigin' => 'use-credentials']")
*
* @return string The path of the asset
*/
@@ -89,7 +89,7 @@ class WebLinkExtension extends AbstractExtension
* Resolves a resource origin as early as possible.
*
* @param string $uri A public path
- * @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('pr' => 0.5)")
+ * @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
*
* @return string The path of the asset
*/
@@ -102,7 +102,7 @@ class WebLinkExtension extends AbstractExtension
* Initiates a early connection to a resource (DNS resolution, TCP handshake, TLS negotiation).
*
* @param string $uri A public path
- * @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('pr' => 0.5)")
+ * @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
*
* @return string The path of the asset
*/
@@ -115,7 +115,7 @@ class WebLinkExtension extends AbstractExtension
* Indicates to the client that it should prefetch this resource.
*
* @param string $uri A public path
- * @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('pr' => 0.5)")
+ * @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
*
* @return string The path of the asset
*/
@@ -128,7 +128,7 @@ class WebLinkExtension extends AbstractExtension
* Indicates to the client that it should prerender this resource .
*
* @param string $uri A public path
- * @param array $attributes The attributes of this link (e.g. "array('as' => true)", "array('pr' => 0.5)")
+ * @param array $attributes The attributes of this link (e.g. "['as' => true]", "['pr' => 0.5]")
*
* @return string The path of the asset
*/
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
index 9f3c471977..14f0dc28cf 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
@@ -338,7 +338,7 @@ namespace $namespace
// filter container's resources, removing reference to temp kernel file
\$resources = \$container->getResources();
- \$filteredResources = array();
+ \$filteredResources = [];
foreach (\$resources as \$resource) {
if ((string) \$resource !== __FILE__) {
\$filteredResources[] = \$resource;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php b/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php
index 3d4e7b9afe..a8f3ce9540 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php
@@ -39,9 +39,9 @@ trait MicroKernelTrait
*
* You can register extensions:
*
- * $c->loadFromExtension('framework', array(
+ * $c->loadFromExtension('framework', [
* 'secret' => '%secret%'
- * ));
+ * ]);
*
* Or services:
*
diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php
index 9e602b2aeb..686777f745 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php
@@ -61,9 +61,9 @@ class FormHelper extends Helper
*
* You can pass options during the call:
*
- * form($form, array('attr' => array('class' => 'foo'))) ?>
+ * form($form, ['attr' => ['class' => 'foo']]) ?>
*
- * form($form, array('separator' => '+++++')) ?>
+ * form($form, ['separator' => '+++++']) ?>
*
* This method is mainly intended for prototyping purposes. If you want to
* control the layout of a form in a more fine-grained manner, you are
@@ -124,9 +124,9 @@ class FormHelper extends Helper
*
* You can pass options during the call:
*
- * widget($form, array('attr' => array('class' => 'foo'))) ?>
+ * widget($form, ['attr' => ['class' => 'foo']]) ?>
*
- * widget($form, array('separator' => '+++++')) ?>
+ * widget($form, ['separator' => '+++++']) ?>
*
* @param FormView $view The view for which to render the widget
* @param array $variables Additional variables passed to the template
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php
index 1dcc5536c1..b8a20d246a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php
@@ -29,21 +29,21 @@ EOF
transChoice(
'{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples',
10,
- array('%count%' => 10)
+ ['%count%' => 10]
) ?>
-trans('other-domain-test-no-params-short-array', array(), 'not_messages'); ?>
+trans('other-domain-test-no-params-short-array', [], 'not_messages'); ?>
-trans('other-domain-test-no-params-long-array', array(), 'not_messages'); ?>
+trans('other-domain-test-no-params-long-array', [], 'not_messages'); ?>
-trans('other-domain-test-params-short-array', array('foo' => 'bar'), 'not_messages'); ?>
+trans('other-domain-test-params-short-array', ['foo' => 'bar'], 'not_messages'); ?>
-trans('other-domain-test-params-long-array', array('foo' => 'bar'), 'not_messages'); ?>
+trans('other-domain-test-params-long-array', ['foo' => 'bar'], 'not_messages'); ?>
-transChoice('other-domain-test-trans-choice-short-array-%count%', 10, array('%count%' => 10), 'not_messages'); ?>
+transChoice('other-domain-test-trans-choice-short-array-%count%', 10, ['%count%' => 10], 'not_messages'); ?>
-transChoice('other-domain-test-trans-choice-long-array-%count%', 10, array('%count%' => 10), 'not_messages'); ?>
+transChoice('other-domain-test-trans-choice-long-array-%count%', 10, ['%count%' => 10], 'not_messages'); ?>
-trans('typecast', array('a' => (int) '123'), 'not_messages'); ?>
-transChoice('msg1', 10 + 1, array(), 'not_messages'); ?>
-transChoice('msg2', ceil(4.5), array(), 'not_messages'); ?>
+trans('typecast', ['a' => (int) '123'], 'not_messages'); ?>
+transChoice('msg1', 10 + 1, [], 'not_messages'); ?>
+transChoice('msg2', ceil(4.5), [], 'not_messages'); ?>
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php
index 05240035c0..4ad7e75ddc 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php
@@ -1,2 +1,2 @@
humanize($name); } ?>
-
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_names_entry_label.html.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_names_entry_label.html.php
index e165a429a5..71de9d4631 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_names_entry_label.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_names_entry_label.html.php
@@ -1,4 +1,4 @@
humanize($name);
} ?>
-
+
diff --git a/src/Symfony/Component/Cache/Adapter/PdoAdapter.php b/src/Symfony/Component/Cache/Adapter/PdoAdapter.php
index 62c4d175b1..5903867942 100644
--- a/src/Symfony/Component/Cache/Adapter/PdoAdapter.php
+++ b/src/Symfony/Component/Cache/Adapter/PdoAdapter.php
@@ -35,7 +35,7 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
* * db_time_col: The column where to store the timestamp [default: item_time]
* * db_username: The username when lazy-connect [default: '']
* * db_password: The password when lazy-connect [default: '']
- * * db_connection_options: An array of driver-specific connection options [default: array()]
+ * * db_connection_options: An array of driver-specific connection options [default: []]
*
* @param \PDO|Connection|string $connOrDsn A \PDO or Connection instance or DSN string or null
* @param string $namespace
diff --git a/src/Symfony/Component/Cache/Simple/PdoCache.php b/src/Symfony/Component/Cache/Simple/PdoCache.php
index 4faf10edf5..c92e049a1b 100644
--- a/src/Symfony/Component/Cache/Simple/PdoCache.php
+++ b/src/Symfony/Component/Cache/Simple/PdoCache.php
@@ -33,7 +33,7 @@ class PdoCache extends AbstractCache implements PruneableInterface
* * db_time_col: The column where to store the timestamp [default: item_time]
* * db_username: The username when lazy-connect [default: '']
* * db_password: The password when lazy-connect [default: '']
- * * db_connection_options: An array of driver-specific connection options [default: array()]
+ * * db_connection_options: An array of driver-specific connection options [default: []]
*
* @param \PDO|Connection|string $connOrDsn A \PDO or Connection instance or DSN string or null
* @param string $namespace
diff --git a/src/Symfony/Component/Cache/Traits/MemcachedTrait.php b/src/Symfony/Component/Cache/Traits/MemcachedTrait.php
index 3a073e772c..6c2190ab75 100644
--- a/src/Symfony/Component/Cache/Traits/MemcachedTrait.php
+++ b/src/Symfony/Component/Cache/Traits/MemcachedTrait.php
@@ -64,7 +64,7 @@ trait MemcachedTrait
*
* Examples for servers:
* - 'memcached://user:pass@localhost?weight=33'
- * - array(array('localhost', 11211, 33))
+ * - [['localhost', 11211, 33]]
*
* @param array[]|string|string[] $servers An array of servers, a DSN, or an array of DSNs
* @param array $options An array of options
diff --git a/src/Symfony/Component/Cache/Traits/PhpArrayTrait.php b/src/Symfony/Component/Cache/Traits/PhpArrayTrait.php
index 9845701ab4..e96462abf7 100644
--- a/src/Symfony/Component/Cache/Traits/PhpArrayTrait.php
+++ b/src/Symfony/Component/Cache/Traits/PhpArrayTrait.php
@@ -60,7 +60,7 @@ trait PhpArrayTrait
// This file has been auto-generated by the Symfony Cache Component.
-return array(
+return [
EOF;
@@ -97,7 +97,7 @@ EOF;
$dump .= var_export($key, true).' => '.var_export($value, true).",\n";
}
- $dump .= "\n);\n";
+ $dump .= "\n];\n";
$dump = str_replace("' . \"\\0\" . '", "\0", $dump);
$tmpFile = uniqid($this->file, true);
diff --git a/src/Symfony/Component/Config/CHANGELOG.md b/src/Symfony/Component/Config/CHANGELOG.md
index 7813ac53ed..6cb610c478 100644
--- a/src/Symfony/Component/Config/CHANGELOG.md
+++ b/src/Symfony/Component/Config/CHANGELOG.md
@@ -34,7 +34,7 @@ The edge case of defining just one value for nodes of type Enum is now allowed:
$rootNode
->children()
->enumNode('variable')
- ->values(array('value'))
+ ->values(['value'])
->end()
->end()
;
diff --git a/src/Symfony/Component/Config/Definition/ArrayNode.php b/src/Symfony/Component/Config/Definition/ArrayNode.php
index 4e39ea7699..70baa5a0ab 100644
--- a/src/Symfony/Component/Config/Definition/ArrayNode.php
+++ b/src/Symfony/Component/Config/Definition/ArrayNode.php
@@ -82,7 +82,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
/**
* Sets the xml remappings that should be performed.
*
- * @param array $remappings An array of the form array(array(string, string))
+ * @param array $remappings An array of the form [[string, string]]
*/
public function setXmlRemappings(array $remappings)
{
@@ -92,7 +92,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
/**
* Gets the xml remappings that should be performed.
*
- * @return array an array of the form array(array(string, string))
+ * @return array an array of the form [[string, string]]
*/
public function getXmlRemappings()
{
diff --git a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php
index 55d695c7cb..9837e5d883 100644
--- a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php
+++ b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php
@@ -214,15 +214,15 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
* to be the key of the particular item. For example, if "id" is the
* "key", then:
*
- * array(
- * array('id' => 'my_name', 'foo' => 'bar'),
- * );
+ * [
+ * ['id' => 'my_name', 'foo' => 'bar'],
+ * ];
*
* becomes
*
- * array(
- * 'my_name' => array('foo' => 'bar'),
- * );
+ * [
+ * 'my_name' => ['foo' => 'bar'],
+ * ];
*
* If you'd like "'id' => 'my_name'" to still be present in the resulting
* array, then you can set the second argument of this method to false.
diff --git a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php
index 15769a34f1..f00cfcaa83 100644
--- a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php
+++ b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php
@@ -53,15 +53,15 @@ class PrototypedArrayNode extends ArrayNode
* to be the key of the particular item. For example, if "id" is the
* "key", then:
*
- * array(
- * array('id' => 'my_name', 'foo' => 'bar'),
- * );
+ * [
+ * ['id' => 'my_name', 'foo' => 'bar'],
+ * ];
*
* becomes
*
- * array(
- * 'my_name' => array('foo' => 'bar'),
- * );
+ * [
+ * 'my_name' => ['foo' => 'bar'],
+ * ];
*
* If you'd like "'id' => 'my_name'" to still be present in the resulting
* array, then you can set the second argument of this method to false.
@@ -335,30 +335,30 @@ class PrototypedArrayNode extends ArrayNode
*
* For example, assume $this->keyAttribute is 'name' and the value array is as follows:
*
- * array(
- * array(
+ * [
+ * [
* 'name' => 'name001',
* 'value' => 'value001'
- * )
- * )
+ * ]
+ * ]
*
* Now, the key is 0 and the child node is:
*
- * array(
+ * [
* 'name' => 'name001',
* 'value' => 'value001'
- * )
+ * ]
*
* When normalizing the value array, the 'name' element will removed from the child node
* and its value becomes the new key of the child node:
*
- * array(
- * 'name001' => array('value' => 'value001')
- * )
+ * [
+ * 'name001' => ['value' => 'value001']
+ * ]
*
* Now only 'value' element is left in the child node which can be further simplified into a string:
*
- * array('name001' => 'value001')
+ * ['name001' => 'value001']
*
* Now, the key becomes 'name001' and the child node becomes 'value001' and
* the prototype of child node 'name001' should be a ScalarNode instead of an ArrayNode instance.
diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php
index d58d42e0a3..191bf1c0b5 100644
--- a/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php
@@ -227,7 +227,7 @@ class ExprBuilderTest extends TestCase
*
* @param TreeBuilder $testBuilder The tree builder to finalize
* @param array $config The config you want to use for the finalization, if nothing provided
- * a simple array('key'=>'value') will be used
+ * a simple ['key'=>'value'] will be used
*
* @return array The finalized config values
*/
diff --git a/src/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php
index 485b1321c8..6478bd12db 100644
--- a/src/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/PrototypedArrayNodeTest.php
@@ -66,12 +66,12 @@ class PrototypedArrayNodeTest extends TestCase
* The above should finally be mapped to an array that looks like this
* (because "id" is the key attribute).
*
- * array(
- * 'things' => array(
+ * [
+ * 'things' => [
* 'option1' => 'foo',
* 'option2' => 'bar',
- * )
- * )
+ * ]
+ * ]
*/
public function testMappedAttributeKeyIsRemoved()
{
@@ -191,11 +191,11 @@ class PrototypedArrayNodeTest extends TestCase
* The above should finally be mapped to an array that looks like this
* (because "id" is the key attribute).
*
- * array(
- * 'things' => array(
+ * [
+ * 'things' => [
* 'option1' => 'value1'
- * )
- * )
+ * ]
+ * ]
*
* It's also possible to mix 'value-only' and 'non-value-only' elements in the array.
*
@@ -206,15 +206,15 @@ class PrototypedArrayNodeTest extends TestCase
*
* The above should finally be mapped to an array as follows
*
- * array(
- * 'things' => array(
+ * [
+ * 'things' => [
* 'option1' => 'value1',
- * 'option2' => array(
+ * 'option2' => [
* 'value' => 'value2',
* 'foo' => 'foo2'
- * )
- * )
- * )
+ * ]
+ * ]
+ * ]
*
* The 'value' element can also be ArrayNode:
*
@@ -229,14 +229,14 @@ class PrototypedArrayNodeTest extends TestCase
*
* The above should be finally be mapped to an array as follows
*
- * array(
- * 'things' => array(
- * 'option1' => array(
+ * [
+ * 'things' => [
+ * 'option1' => [
* 'foo' => 'foo1',
* 'bar' => 'bar1'
- * )
- * )
- * )
+ * ]
+ * ]
+ * ]
*
* If using VariableNode for value node, it's also possible to mix different types of value nodes:
*
@@ -252,15 +252,15 @@ class PrototypedArrayNodeTest extends TestCase
*
* The above should be finally mapped to an array as follows
*
- * array(
- * 'things' => array(
- * 'option1' => array(
+ * [
+ * 'things' => [
+ * 'option1' => [
* 'foo' => 'foo1',
* 'bar' => 'bar1'
- * ),
+ * ],
* 'option2' => 'value2'
- * )
- * )
+ * ]
+ * ]
*
*
* @dataProvider getDataForKeyRemovedLeftValueOnly
diff --git a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
index e4f8bed87c..23f2cc567c 100644
--- a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
@@ -71,7 +71,7 @@ class ReflectionClassResourceTest extends TestCase
/* 2*/ {
/* 3*/ const FOO = 123;
/* 4*/
-/* 5*/ public $pub = array();
+/* 5*/ public $pub = [];
/* 6*/
/* 7*/ protected $prot;
/* 8*/
@@ -79,7 +79,7 @@ class ReflectionClassResourceTest extends TestCase
/*10*/
/*11*/ public function pub($arg = null) {}
/*12*/
-/*13*/ protected function prot($a = array()) {}
+/*13*/ protected function prot($a = []) {}
/*14*/
/*15*/ private function priv() {}
/*16*/ }
@@ -119,8 +119,8 @@ EOPHP;
yield [1, 3, 'const FOO = 456;'];
yield [1, 3, 'const BAR = 123;'];
yield [1, 4, '/** pub docblock */'];
- yield [1, 5, 'protected $pub = array();'];
- yield [1, 5, 'public $pub = array(123);'];
+ yield [1, 5, 'protected $pub = [];'];
+ yield [1, 5, 'public $pub = [123];'];
yield [1, 6, '/** prot docblock */'];
yield [1, 7, 'private $prot;'];
yield [0, 8, '/** priv docblock */'];
@@ -134,7 +134,7 @@ EOPHP;
}
yield [0, 11, "public function pub(\$arg = null) {\nreturn 123;\n}"];
yield [1, 12, '/** prot docblock */'];
- yield [1, 13, 'protected function prot($a = array(123)) {}'];
+ yield [1, 13, 'protected function prot($a = [123]) {}'];
yield [0, 14, '/** priv docblock */'];
yield [0, 15, ''];
}
diff --git a/src/Symfony/Component/Console/Input/ArrayInput.php b/src/Symfony/Component/Console/Input/ArrayInput.php
index 72706ddbbf..cf09ff45ec 100644
--- a/src/Symfony/Component/Console/Input/ArrayInput.php
+++ b/src/Symfony/Component/Console/Input/ArrayInput.php
@@ -19,7 +19,7 @@ use Symfony\Component\Console\Exception\InvalidOptionException;
*
* Usage:
*
- * $input = new ArrayInput(array('name' => 'foo', '--bar' => 'foobar'));
+ * $input = new ArrayInput(['name' => 'foo', '--bar' => 'foobar']);
*
* @author Fabien Potencier
*/
diff --git a/src/Symfony/Component/Console/Input/InputDefinition.php b/src/Symfony/Component/Console/Input/InputDefinition.php
index 65860e460d..9dc1c09b94 100644
--- a/src/Symfony/Component/Console/Input/InputDefinition.php
+++ b/src/Symfony/Component/Console/Input/InputDefinition.php
@@ -19,10 +19,10 @@ use Symfony\Component\Console\Exception\LogicException;
*
* Usage:
*
- * $definition = new InputDefinition(array(
+ * $definition = new InputDefinition([
* new InputArgument('name', InputArgument::REQUIRED),
* new InputOption('foo', 'f', InputOption::VALUE_REQUIRED),
- * ));
+ * ]);
*
* @author Fabien Potencier
*/
diff --git a/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php b/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php
index 197869767d..5fdcb981c6 100644
--- a/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php
+++ b/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php
@@ -186,7 +186,7 @@ class InputDefinitionTest extends TestCase
new InputArgument('foo1', InputArgument::OPTIONAL),
new InputArgument('foo2', InputArgument::OPTIONAL, '', 'default'),
new InputArgument('foo3', InputArgument::OPTIONAL | InputArgument::IS_ARRAY),
- // new InputArgument('foo4', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, '', array(1, 2)),
+ // new InputArgument('foo4', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, '', [1, 2]),
]);
$this->assertEquals(['foo1' => null, 'foo2' => 'default', 'foo3' => []], $definition->getArgumentDefaults(), '->getArgumentDefaults() return the default values for each argument');
diff --git a/src/Symfony/Component/Debug/Resources/ext/README.md b/src/Symfony/Component/Debug/Resources/ext/README.md
index 25dccf0766..2df00ecd29 100644
--- a/src/Symfony/Component/Debug/Resources/ext/README.md
+++ b/src/Symfony/Component/Debug/Resources/ext/README.md
@@ -25,41 +25,41 @@ function symfony_zval_info($key, $array, $options = 0)
return null;
}
- $info = array(
+ $info = [
'type' => gettype($array[$key]),
'zval_hash' => /* hashed memory address of $array[$key] */,
'zval_refcount' => /* internal zval refcount of $array[$key] */,
'zval_isref' => /* is_ref status of $array[$key] */,
- );
+ ];
switch ($info['type']) {
case 'object':
- $info += array(
+ $info += [
'object_class' => get_class($array[$key]),
'object_refcount' => /* internal object refcount of $array[$key] */,
'object_hash' => spl_object_hash($array[$key]),
'object_handle' => /* internal object handle $array[$key] */,
- );
+ ];
break;
case 'resource':
- $info += array(
+ $info += [
'resource_handle' => (int) $array[$key],
'resource_type' => get_resource_type($array[$key]),
'resource_refcount' => /* internal resource refcount of $array[$key] */,
- );
+ ];
break;
case 'array':
- $info += array(
+ $info += [
'array_count' => count($array[$key]),
- );
+ ];
break;
case 'string':
- $info += array(
+ $info += [
'strlen' => strlen($array[$key]),
- );
+ ];
break;
}
diff --git a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
index e9ce535ee7..b1c3c2b581 100644
--- a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
+++ b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
@@ -28,14 +28,14 @@ class DebugClassLoaderTest extends TestCase
{
$this->errorReporting = error_reporting(E_ALL);
$this->loader = new ClassLoader();
- spl_autoload_register(array($this->loader, 'loadClass'), true, true);
+ spl_autoload_register([$this->loader, 'loadClass'], true, true);
DebugClassLoader::enable();
}
protected function tearDown()
{
DebugClassLoader::disable();
- spl_autoload_unregister(array($this->loader, 'loadClass'));
+ spl_autoload_unregister([$this->loader, 'loadClass']);
error_reporting($this->errorReporting);
}
@@ -45,7 +45,7 @@ class DebugClassLoaderTest extends TestCase
$functions = spl_autoload_functions();
foreach ($functions as $function) {
- if (is_array($function) && $function[0] instanceof DebugClassLoader) {
+ if (\is_array($function) && $function[0] instanceof DebugClassLoader) {
$reflClass = new \ReflectionClass($function[0]);
$reflProp = $reflClass->getProperty('classLoader');
$reflProp->setAccessible(true);
@@ -81,7 +81,7 @@ class DebugClassLoaderTest extends TestCase
if (\PHP_VERSION_ID >= 70000) {
$this->markTestSkipped('PHP7 throws exceptions, unsilencing is not required anymore.');
}
- if (defined('HHVM_VERSION')) {
+ if (\defined('HHVM_VERSION')) {
$this->markTestSkipped('HHVM is not handled in this test case.');
}
@@ -106,7 +106,7 @@ class DebugClassLoaderTest extends TestCase
if (class_exists('Symfony\Component\Debug\Exception\ContextErrorException', false)) {
$this->markTestSkipped('The ContextErrorException class is already loaded.');
}
- if (defined('HHVM_VERSION')) {
+ if (\defined('HHVM_VERSION')) {
$this->markTestSkipped('HHVM is not handled in this test case.');
}
@@ -192,7 +192,7 @@ class DebugClassLoaderTest extends TestCase
{
set_error_handler(function () { return false; });
$e = error_reporting(0);
- trigger_error('', E_USER_DEPRECATED);
+ @trigger_error('', E_USER_DEPRECATED);
class_exists('Test\\'.__NAMESPACE__.'\\'.$class, true);
@@ -202,20 +202,20 @@ class DebugClassLoaderTest extends TestCase
$lastError = error_get_last();
unset($lastError['file'], $lastError['line']);
- $xError = array(
+ $xError = [
'type' => E_USER_DEPRECATED,
'message' => 'The "Test\Symfony\Component\Debug\Tests\\'.$class.'" class '.$type.' "Symfony\Component\Debug\Tests\Fixtures\\'.$super.'" that is deprecated but this is a test deprecation notice.',
- );
+ ];
$this->assertSame($xError, $lastError);
}
public function provideDeprecatedSuper()
{
- return array(
- array('DeprecatedInterfaceClass', 'DeprecatedInterface', 'implements'),
- array('DeprecatedParentClass', 'DeprecatedClass', 'extends'),
- );
+ return [
+ ['DeprecatedInterfaceClass', 'DeprecatedInterface', 'implements'],
+ ['DeprecatedParentClass', 'DeprecatedClass', 'extends'],
+ ];
}
public function testInterfaceExtendsDeprecatedInterface()
@@ -232,10 +232,10 @@ class DebugClassLoaderTest extends TestCase
$lastError = error_get_last();
unset($lastError['file'], $lastError['line']);
- $xError = array(
+ $xError = [
'type' => E_USER_NOTICE,
'message' => '',
- );
+ ];
$this->assertSame($xError, $lastError);
}
@@ -254,10 +254,10 @@ class DebugClassLoaderTest extends TestCase
$lastError = error_get_last();
unset($lastError['file'], $lastError['line']);
- $xError = array(
+ $xError = [
'type' => E_USER_NOTICE,
'message' => '',
- );
+ ];
$this->assertSame($xError, $lastError);
}
@@ -280,10 +280,10 @@ class DebugClassLoaderTest extends TestCase
$lastError = error_get_last();
unset($lastError['file'], $lastError['line']);
- $xError = array(
+ $xError = [
'type' => E_USER_DEPRECATED,
'message' => 'The "Test\Symfony\Component\Debug\Tests\Float" class uses the reserved name "Float", it will break on PHP 7 and higher',
- );
+ ];
$this->assertSame($xError, $lastError);
}
@@ -302,17 +302,17 @@ class DebugClassLoaderTest extends TestCase
$lastError = error_get_last();
unset($lastError['file'], $lastError['line']);
- $xError = array(
+ $xError = [
'type' => E_USER_DEPRECATED,
'message' => 'The "Symfony\Component\Debug\Tests\Fixtures\FinalClass" class is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsFinalClass".',
- );
+ ];
$this->assertSame($xError, $lastError);
}
public function testExtendedFinalMethod()
{
- $deprecations = array();
+ $deprecations = [];
set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; });
$e = error_reporting(E_USER_DEPRECATED);
@@ -321,10 +321,10 @@ class DebugClassLoaderTest extends TestCase
error_reporting($e);
restore_error_handler();
- $xError = array(
+ $xError = [
'The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod()" method is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".',
'The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod2()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".',
- );
+ ];
$this->assertSame($xError, $deprecations);
}
@@ -343,12 +343,12 @@ class DebugClassLoaderTest extends TestCase
$lastError = error_get_last();
unset($lastError['file'], $lastError['line']);
- $this->assertSame(array('type' => E_USER_NOTICE, 'message' => ''), $lastError);
+ $this->assertSame(['type' => E_USER_NOTICE, 'message' => ''], $lastError);
}
public function testInternalsUse()
{
- $deprecations = array();
+ $deprecations = [];
set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; });
$e = error_reporting(E_USER_DEPRECATED);
@@ -357,17 +357,17 @@ class DebugClassLoaderTest extends TestCase
error_reporting($e);
restore_error_handler();
- $this->assertSame($deprecations, array(
+ $this->assertSame($deprecations, [
'The "Symfony\Component\Debug\Tests\Fixtures\InternalInterface" interface is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".',
'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass" class is considered internal since version 3.4. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".',
'The "Symfony\Component\Debug\Tests\Fixtures\InternalTrait" trait is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".',
'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass::internalMethod()" method is considered internal since version 3.4. It may change without further notice. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".',
- ));
+ ]);
}
public function testUseTraitWithInternalMethod()
{
- $deprecations = array();
+ $deprecations = [];
set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; });
$e = error_reporting(E_USER_DEPRECATED);
@@ -376,7 +376,7 @@ class DebugClassLoaderTest extends TestCase
error_reporting($e);
restore_error_handler();
- $this->assertSame(array(), $deprecations);
+ $this->assertSame([], $deprecations);
}
}
@@ -388,12 +388,12 @@ class ClassLoader
public function getClassMap()
{
- return array(__NAMESPACE__.'\Fixtures\NotPSR0bis' => __DIR__.'/Fixtures/notPsr0Bis.php');
+ return [__NAMESPACE__.'\Fixtures\NotPSR0bis' => __DIR__.'/Fixtures/notPsr0Bis.php'];
}
public function findFile($class)
{
- $fixtureDir = __DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR;
+ $fixtureDir = __DIR__.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR;
if (__NAMESPACE__.'\TestingUnsilencing' === $class) {
eval('-- parse error --');
@@ -402,7 +402,7 @@ class ClassLoader
} elseif (__NAMESPACE__.'\TestingCaseMismatch' === $class) {
eval('namespace '.__NAMESPACE__.'; class TestingCaseMisMatch {}');
} elseif (__NAMESPACE__.'\Fixtures\Psr4CaseMismatch' === $class) {
- return $fixtureDir.'psr4'.DIRECTORY_SEPARATOR.'Psr4CaseMismatch.php';
+ return $fixtureDir.'psr4'.\DIRECTORY_SEPARATOR.'Psr4CaseMismatch.php';
} elseif (__NAMESPACE__.'\Fixtures\NotPSR0' === $class) {
return $fixtureDir.'reallyNotPsr0.php';
} elseif (__NAMESPACE__.'\Fixtures\NotPSR0bis' === $class) {
diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
index 436f45b854..0c1966a42e 100644
--- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
+++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
@@ -647,7 +647,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
* the parameters passed to the container constructor to have precedence
* over the loaded ones.
*
- * $container = new ContainerBuilder(new ParameterBag(array('foo' => 'bar')));
+ * $container = new ContainerBuilder(new ParameterBag(['foo' => 'bar']));
* $loader = new LoaderXXX($container);
* $loader->load('resource_name');
* $container->register('foo', 'stdClass');
@@ -1288,7 +1288,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
*
* Example:
*
- * $container->register('foo')->addTag('my.tag', array('hello' => 'world'));
+ * $container->register('foo')->addTag('my.tag', ['hello' => 'world']);
*
* $serviceIds = $container->findTaggedServiceIds('my.tag');
* foreach ($serviceIds as $serviceId => $tags) {
diff --git a/src/Symfony/Component/DependencyInjection/ServiceSubscriberInterface.php b/src/Symfony/Component/DependencyInjection/ServiceSubscriberInterface.php
index 7024484bd8..10c2387544 100644
--- a/src/Symfony/Component/DependencyInjection/ServiceSubscriberInterface.php
+++ b/src/Symfony/Component/DependencyInjection/ServiceSubscriberInterface.php
@@ -33,16 +33,16 @@ interface ServiceSubscriberInterface
*
* For mandatory dependencies:
*
- * * array('logger' => 'Psr\Log\LoggerInterface') means the objects use the "logger" name
+ * * ['logger' => 'Psr\Log\LoggerInterface'] means the objects use the "logger" name
* internally to fetch a service which must implement Psr\Log\LoggerInterface.
- * * array('Psr\Log\LoggerInterface') is a shortcut for
- * * array('Psr\Log\LoggerInterface' => 'Psr\Log\LoggerInterface')
+ * * ['Psr\Log\LoggerInterface'] is a shortcut for
+ * * ['Psr\Log\LoggerInterface' => 'Psr\Log\LoggerInterface']
*
* otherwise:
*
- * * array('logger' => '?Psr\Log\LoggerInterface') denotes an optional dependency
- * * array('?Psr\Log\LoggerInterface') is a shortcut for
- * * array('Psr\Log\LoggerInterface' => '?Psr\Log\LoggerInterface')
+ * * ['logger' => '?Psr\Log\LoggerInterface'] denotes an optional dependency
+ * * ['?Psr\Log\LoggerInterface'] is a shortcut for
+ * * ['Psr\Log\LoggerInterface' => '?Psr\Log\LoggerInterface']
*
* @return array The required service types, optionally keyed by service names
*/
diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php
index 8e1014dcef..b2355dedf9 100644
--- a/src/Symfony/Component/DomCrawler/Crawler.php
+++ b/src/Symfony/Component/DomCrawler/Crawler.php
@@ -626,7 +626,7 @@ class Crawler implements \Countable, \IteratorAggregate
*
* Example:
*
- * $crawler->filter('h1 a')->extract(array('_text', 'href'));
+ * $crawler->filter('h1 a')->extract(['_text', 'href']);
*
* @param array $attributes An array of attributes
*
diff --git a/src/Symfony/Component/DomCrawler/FormFieldRegistry.php b/src/Symfony/Component/DomCrawler/FormFieldRegistry.php
index b4ec51290c..10c7e8cb36 100644
--- a/src/Symfony/Component/DomCrawler/FormFieldRegistry.php
+++ b/src/Symfony/Component/DomCrawler/FormFieldRegistry.php
@@ -133,7 +133,7 @@ class FormFieldRegistry
/**
* Returns the list of field with their value.
*
- * @return FormField[] The list of fields as array((string) Fully qualified name => (mixed) value)
+ * @return FormField[] The list of fields as [string] Fully qualified name => (mixed) value)
*/
public function all()
{
@@ -167,7 +167,7 @@ class FormFieldRegistry
* @param string $base The name of the base field
* @param array $output The initial values
*
- * @return array The list of fields as array((string) Fully qualified name => (mixed) value)
+ * @return array The list of fields as [string] Fully qualified name => (mixed) value)
*/
private function walk(array $array, $base = '', array &$output = [])
{
@@ -186,7 +186,7 @@ class FormFieldRegistry
/**
* Splits a field name into segments as a web browser would do.
*
- * getSegments('base[foo][3][]') = array('base', 'foo, '3', '');
+ * getSegments('base[foo][3][]') = ['base', 'foo, '3', ''];
*
* @param string $name The name of the field
*
diff --git a/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php b/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php
index 14f17277e6..aeafd9ec29 100644
--- a/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php
+++ b/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php
@@ -67,7 +67,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher
@trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED);
if (!\is_array($callback) || 2 !== \count($callback)) {
- throw new \InvalidArgumentException('Expected an array("service", "method") argument');
+ throw new \InvalidArgumentException('Expected an ["service", "method"] argument');
}
$this->listenerIds[$eventName][] = [$callback[0], $callback[1], $priority];
diff --git a/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php b/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php
index 6e1976b86a..824f21599c 100644
--- a/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php
+++ b/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php
@@ -36,9 +36,9 @@ interface EventSubscriberInterface
*
* For instance:
*
- * * array('eventName' => 'methodName')
- * * array('eventName' => array('methodName', $priority))
- * * array('eventName' => array(array('methodName1', $priority), array('methodName2')))
+ * * ['eventName' => 'methodName']
+ * * ['eventName' => ['methodName', $priority]]
+ * * ['eventName' => [['methodName1', $priority], ['methodName2']]]
*
* @return array The event names to listen to
*/
diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php
index 01872d9262..aa9afb349d 100644
--- a/src/Symfony/Component/Filesystem/Filesystem.php
+++ b/src/Symfony/Component/Filesystem/Filesystem.php
@@ -730,7 +730,7 @@ class Filesystem
}
/**
- * Gets a 2-tuple of scheme (may be null) and hierarchical part of a filename (e.g. file:///tmp -> array(file, tmp)).
+ * Gets a 2-tuple of scheme (may be null) and hierarchical part of a filename (e.g. file:///tmp -> [file, tmp]).
*
* @param string $filename The filename to be parsed
*
diff --git a/src/Symfony/Component/Finder/Glob.php b/src/Symfony/Component/Finder/Glob.php
index 27d9ce3d11..ea76d51ae0 100644
--- a/src/Symfony/Component/Finder/Glob.php
+++ b/src/Symfony/Component/Finder/Glob.php
@@ -18,7 +18,7 @@ namespace Symfony\Component\Finder;
*
* // prints foo.bar and foo.baz
* $regex = glob_to_regex("foo.*");
- * for (array('foo.bar', 'foo.baz', 'foo', 'bar') as $t)
+ * for (['foo.bar', 'foo.baz', 'foo', 'bar'] as $t)
* {
* if (/$regex/) echo "matched: $car\n";
* }
diff --git a/src/Symfony/Component/Form/ChoiceList/ChoiceListInterface.php b/src/Symfony/Component/Form/ChoiceList/ChoiceListInterface.php
index b59e77bf79..c1d643ee73 100644
--- a/src/Symfony/Component/Form/ChoiceList/ChoiceListInterface.php
+++ b/src/Symfony/Component/Form/ChoiceList/ChoiceListInterface.php
@@ -48,19 +48,19 @@ interface ChoiceListInterface
* keys of the choices. If the original array contained nested arrays, these
* nested arrays are represented here as well:
*
- * $form->add('field', 'choice', array(
- * 'choices' => array(
- * 'Decided' => array('Yes' => true, 'No' => false),
- * 'Undecided' => array('Maybe' => null),
- * ),
- * ));
+ * $form->add('field', 'choice', [
+ * 'choices' => [
+ * 'Decided' => ['Yes' => true, 'No' => false],
+ * 'Undecided' => ['Maybe' => null],
+ * ],
+ * ]);
*
* In this example, the result of this method is:
*
- * array(
- * 'Decided' => array('Yes' => '0', 'No' => '1'),
- * 'Undecided' => array('Maybe' => '2'),
- * )
+ * [
+ * 'Decided' => ['Yes' => '0', 'No' => '1'],
+ * 'Undecided' => ['Maybe' => '2'],
+ * ]
*
* @return string[] The choice values
*/
@@ -73,12 +73,12 @@ interface ChoiceListInterface
* "choice" option of the choice type. Note that this array may contain
* duplicates if the "choice" option contained choice groups:
*
- * $form->add('field', 'choice', array(
- * 'choices' => array(
- * 'Decided' => array(true, false),
- * 'Undecided' => array(null),
- * ),
- * ));
+ * $form->add('field', 'choice', [
+ * 'choices' => [
+ * 'Decided' => [true, false],
+ * 'Undecided' => [null],
+ * ],
+ * ]);
*
* In this example, the original key 0 appears twice, once for `true` and
* once for `null`.
diff --git a/src/Symfony/Component/Form/Forms.php b/src/Symfony/Component/Form/Forms.php
index 9b352aa5dd..7c61d640e2 100644
--- a/src/Symfony/Component/Form/Forms.php
+++ b/src/Symfony/Component/Form/Forms.php
@@ -26,9 +26,9 @@ use Symfony\Component\Form\Extension\Core\CoreExtension;
* ->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
* ->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
* ->add('age', 'Symfony\Component\Form\Extension\Core\Type\IntegerType')
- * ->add('color', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array(
- * 'choices' => array('Red' => 'r', 'Blue' => 'b'),
- * ))
+ * ->add('color', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', [
+ * 'choices' => ['Red' => 'r', 'Blue' => 'b'],
+ * ])
* ->getForm();
*
* You can also add custom extensions to the form factory:
@@ -68,9 +68,9 @@ use Symfony\Component\Form\Extension\Core\CoreExtension;
* use Symfony\Component\Form\Extension\Templating\TemplatingExtension;
*
* $formFactory = Forms::createFormFactoryBuilder()
- * ->addExtension(new TemplatingExtension($engine, null, array(
+ * ->addExtension(new TemplatingExtension($engine, null, [
* 'FrameworkBundle:Form',
- * )))
+ * ]))
* ->getFormFactory();
*
* The next example shows how to include the "
" layout:
@@ -78,10 +78,10 @@ use Symfony\Component\Form\Extension\Core\CoreExtension;
* use Symfony\Component\Form\Extension\Templating\TemplatingExtension;
*
* $formFactory = Forms::createFormFactoryBuilder()
- * ->addExtension(new TemplatingExtension($engine, null, array(
+ * ->addExtension(new TemplatingExtension($engine, null, [
* 'FrameworkBundle:Form',
* 'FrameworkBundle:FormTable',
- * )))
+ * ]))
* ->getFormFactory();
*
* @author Bernhard Schussek
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
index 7619fcc473..87587bda3a 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
@@ -41,8 +41,8 @@ class DateTimeToStringTransformerTest extends TestCase
// this will not work as PHP will use actual date to replace missing info
// and after change of date will lookup for closest Wednesday
// i.e. value: 2010-02, PHP value: 2010-02-(today i.e. 20), parsed date: 2010-02-24
- //array('Y-m-D', '2010-02-Wed', '2010-02-03 00:00:00 UTC'),
- //array('Y-m-l', '2010-02-Wednesday', '2010-02-03 00:00:00 UTC'),
+ //['Y-m-D', '2010-02-Wed', '2010-02-03 00:00:00 UTC'],
+ //['Y-m-l', '2010-02-Wednesday', '2010-02-03 00:00:00 UTC'],
// different month representations
['Y-n-d', '2010-2-03', '2010-02-03 00:00:00 UTC'],
diff --git a/src/Symfony/Component/Form/Tests/Util/StringUtilTest.php b/src/Symfony/Component/Form/Tests/Util/StringUtilTest.php
index 1c723d16a0..755b842e61 100644
--- a/src/Symfony/Component/Form/Tests/Util/StringUtilTest.php
+++ b/src/Symfony/Component/Form/Tests/Util/StringUtilTest.php
@@ -47,7 +47,7 @@ class StringUtilTest extends TestCase
['0020'],
['00A0'],
['1680'],
-// array('180E'),
+// ['180E'],
['2000'],
['2001'],
['2002'],
@@ -72,7 +72,7 @@ class StringUtilTest extends TestCase
['000D'],
['0085'],
// zero width space
-// array('200B'),
+// ['200B'],
];
}
diff --git a/src/Symfony/Component/Form/Util/FormUtil.php b/src/Symfony/Component/Form/Util/FormUtil.php
index 53053f9d5b..fed96de4fa 100644
--- a/src/Symfony/Component/Form/Util/FormUtil.php
+++ b/src/Symfony/Component/Form/Util/FormUtil.php
@@ -36,7 +36,7 @@ class FormUtil
*/
public static function isEmpty($data)
{
- // Should not do a check for array() === $data!!!
+ // Should not do a check for [] === $data!!!
// This method is used in occurrences where arrays are
// not considered to be empty, ever.
return null === $data || '' === $data;
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
index c027a9e6e5..bc088e7740 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
@@ -161,7 +161,7 @@ class PdoSessionHandler extends AbstractSessionHandler
* * db_time_col: The column where to store the timestamp [default: sess_time]
* * db_username: The username when lazy-connect [default: '']
* * db_password: The password when lazy-connect [default: '']
- * * db_connection_options: An array of driver-specific connection options [default: array()]
+ * * db_connection_options: An array of driver-specific connection options [default: []]
* * lock_mode: The strategy for locking, see constants [default: LOCK_TRANSACTIONAL]
*
* @param \PDO|string|null $pdoOrDsn A \PDO instance or DSN string or URL string or null
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
index a2f64a3afb..c4dbe75868 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
@@ -331,7 +331,7 @@ class NativeSessionStorage implements SessionStorageInterface
* For convenience we omit 'session.' from the beginning of the keys.
* Explicitly ignores other ini keys.
*
- * @param array $options Session ini directives array(key => value)
+ * @param array $options Session ini directives [key => value]
*
* @see http://php.net/session.configuration
*/
diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
index f6fb1309ea..68634f6d4b 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php
@@ -576,7 +576,7 @@ class ResponseTest extends ResponseTestCase
public function testSetCache()
{
$response = new Response();
- //array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public')
+ // ['etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public']
try {
$response->setCache(['wrong option' => 'value']);
$this->fail('->setCache() throws an InvalidArgumentException if an option is not supported');
diff --git a/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php b/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php
index 50413ce4ed..758e9043da 100644
--- a/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php
+++ b/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php
@@ -216,7 +216,7 @@ class ControllerResolver implements ArgumentResolverInterface, ControllerResolve
}
if (2 !== \count($callable)) {
- return 'Invalid format for controller, expected array(controller, method) or controller::method.';
+ return 'Invalid format for controller, expected [controller, method] or controller::method.';
}
list($controller, $method) = $callable;
diff --git a/src/Symfony/Component/Inflector/Tests/InflectorTest.php b/src/Symfony/Component/Inflector/Tests/InflectorTest.php
index 87a959fa0a..9f1e1c6baf 100644
--- a/src/Symfony/Component/Inflector/Tests/InflectorTest.php
+++ b/src/Symfony/Component/Inflector/Tests/InflectorTest.php
@@ -149,9 +149,9 @@ class InflectorTest extends TestCase
['SubTrees', ['SubTre', 'SubTree']],
// Known issues
- //array('insignia', 'insigne'),
- //array('insignias', 'insigne'),
- //array('rattles', 'rattle'),
+ //['insignia', 'insigne'],
+ //['insignias', 'insigne'],
+ //['rattles', 'rattle'],
];
}
diff --git a/src/Symfony/Component/Intl/Data/Bundle/Reader/BundleEntryReaderInterface.php b/src/Symfony/Component/Intl/Data/Bundle/Reader/BundleEntryReaderInterface.php
index 13cf85bb48..8dac0aad24 100644
--- a/src/Symfony/Component/Intl/Data/Bundle/Reader/BundleEntryReaderInterface.php
+++ b/src/Symfony/Component/Intl/Data/Bundle/Reader/BundleEntryReaderInterface.php
@@ -35,7 +35,7 @@ interface BundleEntryReaderInterface extends BundleReaderInterface
*
* Then the value can be read by calling:
*
- * $reader->readEntry('...', 'en', array('TopLevel', 'NestedLevel', 'Entry'));
+ * $reader->readEntry('...', 'en', ['TopLevel', 'NestedLevel', 'Entry']);
*
* @param string $path The path to the resource bundle
* @param string $locale The locale to read
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
index ff1c2653e0..a81d30c865 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
@@ -439,7 +439,7 @@ abstract class AbstractNumberFormatterTest extends TestCase
return [
[1.121, '1.12'],
[1.123, '1.12'],
- // array(1.125, '1.13'),
+ // [1.125, '1.13'],
[1.127, '1.13'],
[1.129, '1.13'],
[1020 / 100, '10.20'],
diff --git a/src/Symfony/Component/Process/PhpProcess.php b/src/Symfony/Component/Process/PhpProcess.php
index e1d749633e..f0c47b285a 100644
--- a/src/Symfony/Component/Process/PhpProcess.php
+++ b/src/Symfony/Component/Process/PhpProcess.php
@@ -64,7 +64,7 @@ class PhpProcess extends Process
/**
* {@inheritdoc}
*/
- public function start(callable $callback = null/*, array $env = array()*/)
+ public function start(callable $callback = null/*, array $env = []*/)
{
if (null === $this->getCommandLine()) {
throw new RuntimeException('Unable to find the PHP executable.');
diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php
index cfd5adb736..75395b66c5 100644
--- a/src/Symfony/Component/Process/Process.php
+++ b/src/Symfony/Component/Process/Process.php
@@ -204,7 +204,7 @@ class Process implements \IteratorAggregate
*
* @final since version 3.3
*/
- public function run($callback = null/*, array $env = array()*/)
+ public function run($callback = null/*, array $env = []*/)
{
$env = 1 < \func_num_args() ? func_get_arg(1) : null;
$this->start($callback, $env);
@@ -228,7 +228,7 @@ class Process implements \IteratorAggregate
*
* @final since version 3.3
*/
- public function mustRun(callable $callback = null/*, array $env = array()*/)
+ public function mustRun(callable $callback = null/*, array $env = []*/)
{
if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
@@ -262,7 +262,7 @@ class Process implements \IteratorAggregate
* @throws RuntimeException When process is already running
* @throws LogicException In case a callback is provided and output has been disabled
*/
- public function start(callable $callback = null/*, array $env = array()*/)
+ public function start(callable $callback = null/*, array $env = [*/)
{
if ($this->isRunning()) {
throw new RuntimeException('Process is already running');
@@ -378,7 +378,7 @@ class Process implements \IteratorAggregate
*
* @final since version 3.3
*/
- public function restart(callable $callback = null/*, array $env = array()*/)
+ public function restart(callable $callback = null/*, array $env = []*/)
{
if ($this->isRunning()) {
throw new RuntimeException('Process is already running');
diff --git a/src/Symfony/Component/Process/Tests/ProcessTest.php b/src/Symfony/Component/Process/Tests/ProcessTest.php
index 99f27d4cd6..a9ecbe8043 100644
--- a/src/Symfony/Component/Process/Tests/ProcessTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessTest.php
@@ -1164,8 +1164,8 @@ class ProcessTest extends TestCase
{
return [
//expected output / getter / code to execute
- //array(1,'getExitCode','exit(1);'),
- //array(true,'isSuccessful','exit();'),
+ //[1,'getExitCode','exit(1);'],
+ //[true,'isSuccessful','exit();'],
['output', 'getOutput', 'echo \'output\';'],
];
}
diff --git a/src/Symfony/Component/Routing/CHANGELOG.md b/src/Symfony/Component/Routing/CHANGELOG.md
index e278f8b1e5..3d34c1d167 100644
--- a/src/Symfony/Component/Routing/CHANGELOG.md
+++ b/src/Symfony/Component/Routing/CHANGELOG.md
@@ -41,7 +41,7 @@ CHANGELOG
Before:
```php
- $router->generate('blog_show', array('slug' => 'my-blog-post'), true);
+ $router->generate('blog_show', ['slug' => 'my-blog-post'], true);
```
After:
@@ -49,7 +49,7 @@ CHANGELOG
```php
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
- $router->generate('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL);
+ $router->generate('blog_show', ['slug' => 'my-blog-post'], UrlGeneratorInterface::ABSOLUTE_URL);
```
2.5.0
@@ -114,7 +114,7 @@ CHANGELOG
```php
$route = new Route();
$route->setPath('/article/{id}');
- $route->setMethods(array('POST', 'PUT'));
+ $route->setMethods(['POST', 'PUT']);
$route->setSchemes('https');
```
@@ -169,10 +169,10 @@ CHANGELOG
used with a single parameter. The other params `$prefix`, `$default`, `$requirements` and `$options`
will still work, but have been deprecated. The `addPrefix` method should be used for this
use-case instead.
- Before: `$parentCollection->addCollection($collection, '/prefix', array(...), array(...))`
+ Before: `$parentCollection->addCollection($collection, '/prefix', [...], [...])`
After:
```php
- $collection->addPrefix('/prefix', array(...), array(...));
+ $collection->addPrefix('/prefix', [...], [...]);
$parentCollection->addCollection($collection);
```
* added support for the method default argument values when defining a @Route
@@ -197,7 +197,7 @@ CHANGELOG
(only relevant if you implemented your own RouteCompiler).
* Added possibility to generate relative paths and network paths in the UrlGenerator, e.g.
"../parent-file" and "//example.com/dir/file". The third parameter in
- `UrlGeneratorInterface::generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)`
+ `UrlGeneratorInterface::generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH)`
now accepts more values and you should use the constants defined in `UrlGeneratorInterface` for
claritiy. The old method calls with a Boolean parameter will continue to work because they
equal the signature using the constants.
diff --git a/src/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php b/src/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php
index 9fc45c58f6..2e99c81d9c 100644
--- a/src/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php
+++ b/src/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php
@@ -76,7 +76,7 @@ EOF;
*/
private function generateDeclaredRoutes()
{
- $routes = "array(\n";
+ $routes = "[\n";
foreach ($this->getRoutes()->all() as $name => $route) {
$compiledRoute = $route->compile();
@@ -90,7 +90,7 @@ EOF;
$routes .= sprintf(" '%s' => %s,\n", $name, str_replace("\n", '', var_export($properties, true)));
}
- $routes .= ' )';
+ $routes .= ' ]';
return $routes;
}
@@ -103,7 +103,7 @@ EOF;
private function generateGenerateMethod()
{
return <<<'EOF'
- public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
+ public function generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH)
{
if (!isset(self::$declaredRoutes[$name])) {
throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));
diff --git a/src/Symfony/Component/Routing/RouteCompiler.php b/src/Symfony/Component/Routing/RouteCompiler.php
index 0eb2b6b323..391fa82903 100644
--- a/src/Symfony/Component/Routing/RouteCompiler.php
+++ b/src/Symfony/Component/Routing/RouteCompiler.php
@@ -154,7 +154,7 @@ class RouteCompiler implements RouteCompilerInterface
// Find the next static character after the variable that functions as a separator. By default, this separator and '/'
// are disallowed for the variable. This default requirement makes sure that optional variables can be matched at all
// and that the generating-matching-combination of URLs unambiguous, i.e. the params used for generating the URL are
- // the same that will be matched. Example: new Route('/{page}.{_format}', array('_format' => 'html'))
+ // the same that will be matched. Example: new Route('/{page}.{_format}', ['_format' => 'html'])
// If {page} would also match the separating dot, {_format} would never match as {page} will eagerly consume everything.
// Also even if {_format} was not optional the requirement prevents that {page} matches something that was originally
// part of {_format} when generating the URL, e.g. _format = 'mobile.html'.
diff --git a/src/Symfony/Component/Routing/Tests/RouteTest.php b/src/Symfony/Component/Routing/Tests/RouteTest.php
index 1c9f3e1867..179f4880d0 100644
--- a/src/Symfony/Component/Routing/Tests/RouteTest.php
+++ b/src/Symfony/Component/Routing/Tests/RouteTest.php
@@ -153,7 +153,7 @@ class RouteTest extends TestCase
public function testScheme()
{
$route = new Route('/');
- $this->assertEquals([], $route->getSchemes(), 'schemes is initialized with array()');
+ $this->assertEquals([], $route->getSchemes(), 'schemes is initialized with []');
$this->assertFalse($route->hasScheme('http'));
$route->setSchemes('hTTp');
$this->assertEquals(['http'], $route->getSchemes(), '->setSchemes() accepts a single scheme string and lowercases it');
@@ -168,7 +168,7 @@ class RouteTest extends TestCase
public function testMethod()
{
$route = new Route('/');
- $this->assertEquals([], $route->getMethods(), 'methods is initialized with array()');
+ $this->assertEquals([], $route->getMethods(), 'methods is initialized with []');
$route->setMethods('gEt');
$this->assertEquals(['GET'], $route->getMethods(), '->setMethods() accepts a single method string and uppercases it');
$route->setMethods(['gEt', 'PosT']);
diff --git a/src/Symfony/Component/Security/Core/User/UserInterface.php b/src/Symfony/Component/Security/Core/User/UserInterface.php
index 613db8ecc0..264e0c1aeb 100644
--- a/src/Symfony/Component/Security/Core/User/UserInterface.php
+++ b/src/Symfony/Component/Security/Core/User/UserInterface.php
@@ -38,7 +38,7 @@ interface UserInterface
*
* public function getRoles()
* {
- * return array('ROLE_USER');
+ * return ['ROLE_USER'];
* }
*
* Alternatively, the roles might be stored on a ``roles`` property,
diff --git a/src/Symfony/Component/Security/Guard/AuthenticatorInterface.php b/src/Symfony/Component/Security/Guard/AuthenticatorInterface.php
index f68b8d6f43..90df7610ad 100644
--- a/src/Symfony/Component/Security/Guard/AuthenticatorInterface.php
+++ b/src/Symfony/Component/Security/Guard/AuthenticatorInterface.php
@@ -44,14 +44,14 @@ interface AuthenticatorInterface extends GuardAuthenticatorInterface
*
* For example, for a form login, you might:
*
- * return array(
+ * return [
* 'username' => $request->request->get('_username'),
* 'password' => $request->request->get('_password'),
- * );
+ * ];
*
* Or for an API token that's on a header, you might use:
*
- * return array('api_key' => $request->headers->get('X-API-TOKEN'));
+ * return ['api_key' => $request->headers->get('X-API-TOKEN')];
*
* @param Request $request
*
diff --git a/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php b/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php
index 5f6b6bd3c8..3a9828dfd6 100644
--- a/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php
+++ b/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php
@@ -43,17 +43,17 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface
* For example, for a form login, you might:
*
* if ($request->request->has('_username')) {
- * return array(
+ * return [
* 'username' => $request->request->get('_username'),
* 'password' => $request->request->get('_password'),
- * );
+ * ];
* } else {
* return;
* }
*
* Or for an API token that's on a header, you might use:
*
- * return array('api_key' => $request->headers->get('X-API-TOKEN'));
+ * return ['api_key' => $request->headers->get('X-API-TOKEN')];
*
* @param Request $request
*
diff --git a/src/Symfony/Component/Security/Http/FirewallMapInterface.php b/src/Symfony/Component/Security/Http/FirewallMapInterface.php
index ebdd498123..5517e1d1a3 100644
--- a/src/Symfony/Component/Security/Http/FirewallMapInterface.php
+++ b/src/Symfony/Component/Security/Http/FirewallMapInterface.php
@@ -30,7 +30,7 @@ interface FirewallMapInterface
* If there is no exception listener, the second element of the outer array
* must be null.
*
- * @return array of the format array(array(AuthenticationListener), ExceptionListener)
+ * @return array of the format [[AuthenticationListener], ExceptionListener]
*/
public function getListeners(Request $request);
}
diff --git a/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php b/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php
index 24daf7c5c4..1c76fe4bba 100644
--- a/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php
+++ b/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php
@@ -43,7 +43,7 @@ class ChainDecoder implements DecoderInterface /*, ContextAwareDecoderInterface*
/**
* {@inheritdoc}
*/
- public function supportsDecoding($format/*, array $context = array()*/)
+ public function supportsDecoding($format/*, array $context = []*/)
{
$context = \func_num_args() > 1 ? func_get_arg(1) : [];
diff --git a/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php b/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php
index f1e7491394..a0a718356c 100644
--- a/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php
+++ b/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php
@@ -43,7 +43,7 @@ class ChainEncoder implements EncoderInterface /*, ContextAwareEncoderInterface*
/**
* {@inheritdoc}
*/
- public function supportsEncoding($format/*, array $context = array()*/)
+ public function supportsEncoding($format/*, array $context = []*/)
{
$context = \func_num_args() > 1 ? func_get_arg(1) : [];
@@ -64,7 +64,7 @@ class ChainEncoder implements EncoderInterface /*, ContextAwareEncoderInterface*
*
* @return bool
*/
- public function needsNormalization($format/*, array $context = array()*/)
+ public function needsNormalization($format/*, array $context = []*/)
{
$context = \func_num_args() > 1 ? func_get_arg(1) : [];
$encoder = $this->getEncoder($format, $context);
diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
index 522637a007..f0a4afb191 100644
--- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
+++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
@@ -396,7 +396,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
/*
* Create nodes to append to $parentNode based on the $key of this array
* Produces 01
- * From array("item" => array(0,1));.
+ * From ["item" => [0,1]];.
*/
foreach ($data as $subData) {
$append = $this->appendNode($parentNode, $subData, $key);
diff --git a/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php b/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php
index cf65094c66..af80d00ba0 100644
--- a/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php
+++ b/src/Symfony/Component/Serializer/Normalizer/ArrayDenormalizer.php
@@ -66,7 +66,7 @@ class ArrayDenormalizer implements DenormalizerInterface, SerializerAwareInterfa
/**
* {@inheritdoc}
*/
- public function supportsDenormalization($data, $type, $format = null/*, array $context = array()*/)
+ public function supportsDenormalization($data, $type, $format = null/*, array $context = []*/)
{
$context = \func_num_args() > 3 ? func_get_arg(3) : [];
diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php
index 27014fb72d..4528e385a7 100644
--- a/src/Symfony/Component/Serializer/Serializer.php
+++ b/src/Symfony/Component/Serializer/Serializer.php
@@ -188,7 +188,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
/**
* {@inheritdoc}
*/
- public function supportsNormalization($data, $format = null/*, array $context = array()*/)
+ public function supportsNormalization($data, $format = null/*, array $context = []*/)
{
if (\func_num_args() > 2) {
$context = \func_get_arg(2);
@@ -196,7 +196,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
if (__CLASS__ !== \get_class($this)) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
- @trigger_error(sprintf('The "%s()" method will have a third `$context = array()` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED);
+ @trigger_error(sprintf('The "%s()" method will have a third `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED);
}
}
@@ -209,7 +209,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
/**
* {@inheritdoc}
*/
- public function supportsDenormalization($data, $type, $format = null/*, array $context = array()*/)
+ public function supportsDenormalization($data, $type, $format = null/*, array $context = []*/)
{
if (\func_num_args() > 3) {
$context = \func_get_arg(3);
@@ -217,7 +217,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
if (__CLASS__ !== \get_class($this)) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
- @trigger_error(sprintf('The "%s()" method will have a fourth `$context = array()` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED);
+ @trigger_error(sprintf('The "%s()" method will have a fourth `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED);
}
}
@@ -283,7 +283,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
/**
* {@inheritdoc}
*/
- public function supportsEncoding($format/*, array $context = array()*/)
+ public function supportsEncoding($format/*, array $context = []*/)
{
if (\func_num_args() > 1) {
$context = \func_get_arg(1);
@@ -291,7 +291,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
if (__CLASS__ !== \get_class($this)) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
- @trigger_error(sprintf('The "%s()" method will have a second `$context = array()` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED);
+ @trigger_error(sprintf('The "%s()" method will have a second `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED);
}
}
@@ -304,7 +304,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
/**
* {@inheritdoc}
*/
- public function supportsDecoding($format/*, array $context = array()*/)
+ public function supportsDecoding($format/*, array $context = []*/)
{
if (\func_num_args() > 1) {
$context = \func_get_arg(1);
@@ -312,7 +312,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
if (__CLASS__ !== \get_class($this)) {
$r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) {
- @trigger_error(sprintf('The "%s()" method will have a second `$context = array()` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED);
+ @trigger_error(sprintf('The "%s()" method will have a second `$context = []` argument in version 4.0. Not defining it is deprecated since Symfony 3.3.', __METHOD__), E_USER_DEPRECATED);
}
}
diff --git a/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php b/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php
index b8fdc92683..919bab8fff 100644
--- a/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php
+++ b/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php
@@ -40,19 +40,19 @@ abstract class AbstractOperation implements OperationInterface
*
* The data structure of this array is as follows:
*
- * array(
- * 'domain 1' => array(
- * 'all' => array(...),
- * 'new' => array(...),
- * 'obsolete' => array(...)
- * ),
- * 'domain 2' => array(
- * 'all' => array(...),
- * 'new' => array(...),
- * 'obsolete' => array(...)
- * ),
+ * [
+ * 'domain 1' => [
+ * 'all' => [...],
+ * 'new' => [...],
+ * 'obsolete' => [...]
+ * ],
+ * 'domain 2' => [
+ * 'all' => [...],
+ * 'new' => [...],
+ * 'obsolete' => [...]
+ * ],
* ...
- * )
+ * ]
*
* @var array The array that stores 'all', 'new' and 'obsolete' messages
*/
diff --git a/src/Symfony/Component/Translation/Loader/ArrayLoader.php b/src/Symfony/Component/Translation/Loader/ArrayLoader.php
index 7bbfca68a4..0a6f9f089d 100644
--- a/src/Symfony/Component/Translation/Loader/ArrayLoader.php
+++ b/src/Symfony/Component/Translation/Loader/ArrayLoader.php
@@ -36,7 +36,7 @@ class ArrayLoader implements LoaderInterface
* Flattens an nested array of translations.
*
* The scheme used is:
- * 'key' => array('key2' => array('key3' => 'value'))
+ * 'key' => ['key2' => ['key3' => 'value']]
* Becomes:
* 'key.key2.key3' => 'value'
*
diff --git a/src/Symfony/Component/Translation/Util/ArrayConverter.php b/src/Symfony/Component/Translation/Util/ArrayConverter.php
index a45ae2dbba..0276294f62 100644
--- a/src/Symfony/Component/Translation/Util/ArrayConverter.php
+++ b/src/Symfony/Component/Translation/Util/ArrayConverter.php
@@ -27,7 +27,7 @@ class ArrayConverter
{
/**
* Converts linear messages array to tree-like array.
- * For example this rray('foo.bar' => 'value') will be converted to array('foo' => array('bar' => 'value')).
+ * For example this rray('foo.bar' => 'value') will be converted to ['foo' => ['bar' => 'value']].
*
* @param array $messages Linear messages array
*
diff --git a/src/Symfony/Component/Validator/Constraints/GroupSequence.php b/src/Symfony/Component/Validator/Constraints/GroupSequence.php
index 1f6f512811..a39d712bf4 100644
--- a/src/Symfony/Component/Validator/Constraints/GroupSequence.php
+++ b/src/Symfony/Component/Validator/Constraints/GroupSequence.php
@@ -17,7 +17,7 @@ namespace Symfony\Component\Validator\Constraints;
* When validating a group sequence, each group will only be validated if all
* of the previous groups in the sequence succeeded. For example:
*
- * $validator->validate($address, null, new GroupSequence(array('Basic', 'Strict')));
+ * $validator->validate($address, null, new GroupSequence(['Basic', 'Strict']));
*
* In the first step, all constraints that belong to the group "Basic" will be
* validated. If none of the constraints fail, the validator will then validate
diff --git a/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php b/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php
index cac98495bc..2ab625b156 100644
--- a/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php
+++ b/src/Symfony/Component/Validator/Context/ExecutionContextInterface.php
@@ -97,7 +97,7 @@ interface ExecutionContextInterface
* {
* $validator = $this->context->getValidator();
*
- * $violations = $validator->validate($value, new Length(array('min' => 3)));
+ * $violations = $validator->validate($value, new Length(['min' => 3]));
*
* if (count($violations) > 0) {
* // ...
diff --git a/src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php b/src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php
index 16c1968f25..9520b4fe10 100644
--- a/src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php
+++ b/src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php
@@ -372,7 +372,7 @@ EOTXT
$cloner->addCasters([
':stream' => eval('return function () use ($twig) {
try {
- $twig->render(array());
+ $twig->render([]);
} catch (\Twig\Error\RuntimeError $e) {
throw $e->getPrevious();
}