fixed short array CS in comments

This commit is contained in:
Fabien Potencier 2019-01-16 14:03:22 +01:00
parent 25240831e2
commit 1429267f9c
73 changed files with 264 additions and 264 deletions

View File

@ -50,7 +50,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
/** /**
* List of potential container parameters that hold the object manager name * List of potential container parameters that hold the object manager name
* to register the mappings with the correct metadata driver, for example * 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[] * @var string[]
*/ */

View File

@ -25,7 +25,7 @@ class Test
{ {
public static function getGroups() public static function getGroups()
{ {
return array(); return [];
} }
} }
EOPHP EOPHP

View File

@ -7,7 +7,7 @@ class Test
{ {
public static function getGroups() public static function getGroups()
{ {
return array(); return [];
} }
} }
EOPHP EOPHP

View File

@ -25,7 +25,7 @@ class Test
{ {
public static function getGroups() public static function getGroups()
{ {
return array(); return [];
} }
} }
EOPHP EOPHP

View File

@ -25,7 +25,7 @@ class Test
{ {
public static function getGroups() public static function getGroups()
{ {
return array(); return [];
} }
} }
EOPHP EOPHP

View File

@ -83,7 +83,7 @@ if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__
$prevRoot = getenv('COMPOSER_ROOT_VERSION'); $prevRoot = getenv('COMPOSER_ROOT_VERSION');
putenv("COMPOSER_ROOT_VERSION=$PHPUNIT_VERSION.99"); 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 // --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 : '')); putenv('COMPOSER_ROOT_VERSION'.(false !== $prevRoot ? '='.$prevRoot : ''));
if ($exit) { if ($exit) {
exit($exit); exit($exit);
@ -116,9 +116,9 @@ EOPHP
} }
global $argv, $argc; global $argv, $argc;
$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array(); $argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : [];
$argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0; $argc = isset($_SERVER['argc']) ? $_SERVER['argc'] : 0;
$components = array(); $components = [];
$cmd = array_map('escapeshellarg', $argv); $cmd = array_map('escapeshellarg', $argv);
$exit = 0; $exit = 0;
@ -153,7 +153,7 @@ if ('\\' === DIRECTORY_SEPARATOR) {
if ($components) { if ($components) {
$skippedTests = isset($_SERVER['SYMFONY_PHPUNIT_SKIPPED_TESTS']) ? $_SERVER['SYMFONY_PHPUNIT_SKIPPED_TESTS'] : false; $skippedTests = isset($_SERVER['SYMFONY_PHPUNIT_SKIPPED_TESTS']) ? $_SERVER['SYMFONY_PHPUNIT_SKIPPED_TESTS'] : false;
$runningProcs = array(); $runningProcs = [];
foreach ($components as $component) { foreach ($components as $component) {
// Run phpunit tests in parallel // Run phpunit tests in parallel
@ -164,7 +164,7 @@ if ($components) {
$c = escapeshellarg($component); $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; $runningProcs[$component] = $proc;
} else { } else {
$exit = 1; $exit = 1;
@ -174,7 +174,7 @@ if ($components) {
while ($runningProcs) { while ($runningProcs) {
usleep(300000); usleep(300000);
$terminatedProcs = array(); $terminatedProcs = [];
foreach ($runningProcs as $component => $proc) { foreach ($runningProcs as $component => $proc) {
$procStatus = proc_get_status($proc); $procStatus = proc_get_status($proc);
if (!$procStatus['running']) { if (!$procStatus['running']) {
@ -185,7 +185,7 @@ if ($components) {
} }
foreach ($terminatedProcs as $component => $procStatus) { foreach ($terminatedProcs as $component => $procStatus) {
foreach (array('out', 'err') as $file) { foreach (['out', 'err'] as $file) {
$file = "$component/phpunit.std$file"; $file = "$component/phpunit.std$file";
readfile($file); readfile($file);
unlink($file); unlink($file);
@ -195,7 +195,7 @@ if ($components) {
// STATUS_STACK_BUFFER_OVERRUN (-1073740791/0xC0000409) // STATUS_STACK_BUFFER_OVERRUN (-1073740791/0xC0000409)
// STATUS_ACCESS_VIOLATION (-1073741819/0xC0000005) // STATUS_ACCESS_VIOLATION (-1073741819/0xC0000005)
// STATUS_HEAP_CORRUPTION (-1073740940/0xC0000374) // 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; $exit = $procStatus;
echo "\033[41mKO\033[0m $component\n\n"; echo "\033[41mKO\033[0m $component\n\n";
} else { } else {
@ -207,7 +207,7 @@ if ($components) {
if (!class_exists('SymfonyBlacklistSimplePhpunit', false)) { if (!class_exists('SymfonyBlacklistSimplePhpunit', false)) {
class SymfonyBlacklistSimplePhpunit {} class SymfonyBlacklistSimplePhpunit {}
} }
array_splice($argv, 1, 0, array('--colors=always')); array_splice($argv, 1, 0, ['--colors=always']);
$_SERVER['argv'] = $argv; $_SERVER['argv'] = $argv;
$_SERVER['argc'] = ++$argc; $_SERVER['argc'] = ++$argc;
include "$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit"; include "$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit";

View File

@ -150,7 +150,7 @@ class AppVariable
* Returns some or all the existing flash messages: * Returns some or all the existing flash messages:
* * getFlashes() returns all the flash messages * * getFlashes() returns all the flash messages
* * getFlashes('notice') returns a simple array with flash messages of that type * * 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 * @return array
*/ */

View File

@ -33,7 +33,7 @@ CHANGELOG
use Symfony\Bridge\Twig\Form\TwigRendererEngine; 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); $rendererEngine->setEnvironment($twig);
$twig->addExtension(new FormExtension(new TwigRenderer($rendererEngine, $csrfTokenManager))); $twig->addExtension(new FormExtension(new TwigRenderer($rendererEngine, $csrfTokenManager)));
``` ```
@ -42,13 +42,13 @@ CHANGELOG
```php ```php
// ... // ...
$rendererEngine = new TwigRendererEngine(array('form_div_layout.html.twig'), $twig); $rendererEngine = new TwigRendererEngine(['form_div_layout.html.twig'], $twig);
// require Twig 1.30+ // require Twig 1.30+
$twig->addRuntimeLoader(new \Twig\RuntimeLoader\FactoryRuntimeLoader(array( $twig->addRuntimeLoader(new \Twig\RuntimeLoader\FactoryRuntimeLoader([
TwigRenderer::class => function () use ($rendererEngine, $csrfTokenManager) { TwigRenderer::class => function () use ($rendererEngine, $csrfTokenManager) {
return new TwigRenderer($rendererEngine, $csrfTokenManager); return new TwigRenderer($rendererEngine, $csrfTokenManager);
}, },
))); ]));
$twig->addExtension(new FormExtension()); $twig->addExtension(new FormExtension());
``` ```
* Deprecated the `TwigRendererEngineInterface` interface. * Deprecated the `TwigRendererEngineInterface` interface.

View File

@ -51,7 +51,7 @@ class WebLinkExtension extends AbstractExtension
* *
* @param string $uri The relation URI * @param string $uri The relation URI
* @param string $rel The relation type (e.g. "preload", "prefetch", "prerender" or "dns-prefetch") * @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 * @return string The relation URI
*/ */
@ -76,7 +76,7 @@ class WebLinkExtension extends AbstractExtension
* Preloads a resource. * Preloads a resource.
* *
* @param string $uri A public path * @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 * @return string The path of the asset
*/ */
@ -89,7 +89,7 @@ class WebLinkExtension extends AbstractExtension
* Resolves a resource origin as early as possible. * Resolves a resource origin as early as possible.
* *
* @param string $uri A public path * @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 * @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). * Initiates a early connection to a resource (DNS resolution, TCP handshake, TLS negotiation).
* *
* @param string $uri A public path * @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 * @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. * Indicates to the client that it should prefetch this resource.
* *
* @param string $uri A public path * @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 * @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 . * Indicates to the client that it should prerender this resource .
* *
* @param string $uri A public path * @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 * @return string The path of the asset
*/ */

View File

@ -338,7 +338,7 @@ namespace $namespace
// filter container's resources, removing reference to temp kernel file // filter container's resources, removing reference to temp kernel file
\$resources = \$container->getResources(); \$resources = \$container->getResources();
\$filteredResources = array(); \$filteredResources = [];
foreach (\$resources as \$resource) { foreach (\$resources as \$resource) {
if ((string) \$resource !== __FILE__) { if ((string) \$resource !== __FILE__) {
\$filteredResources[] = \$resource; \$filteredResources[] = \$resource;

View File

@ -39,9 +39,9 @@ trait MicroKernelTrait
* *
* You can register extensions: * You can register extensions:
* *
* $c->loadFromExtension('framework', array( * $c->loadFromExtension('framework', [
* 'secret' => '%secret%' * 'secret' => '%secret%'
* )); * ]);
* *
* Or services: * Or services:
* *

View File

@ -61,9 +61,9 @@ class FormHelper extends Helper
* *
* You can pass options during the call: * You can pass options during the call:
* *
* <?php echo view['form']->form($form, array('attr' => array('class' => 'foo'))) ?> * <?php echo view['form']->form($form, ['attr' => ['class' => 'foo']]) ?>
* *
* <?php echo view['form']->form($form, array('separator' => '+++++')) ?> * <?php echo view['form']->form($form, ['separator' => '+++++']) ?>
* *
* This method is mainly intended for prototyping purposes. If you want to * 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 * 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: * You can pass options during the call:
* *
* <?php echo $view['form']->widget($form, array('attr' => array('class' => 'foo'))) ?> * <?php echo $view['form']->widget($form, ['attr' => ['class' => 'foo']]) ?>
* *
* <?php echo $view['form']->widget($form, array('separator' => '+++++')) ?> * <?php echo $view['form']->widget($form, ['separator' => '+++++']) ?>
* *
* @param FormView $view The view for which to render the widget * @param FormView $view The view for which to render the widget
* @param array $variables Additional variables passed to the template * @param array $variables Additional variables passed to the template

View File

@ -29,21 +29,21 @@ EOF
<?php echo $view['translator']->transChoice( <?php echo $view['translator']->transChoice(
'{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples', '{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples',
10, 10,
array('%count%' => 10) ['%count%' => 10]
) ?> ) ?>
<?php echo $view['translator']->trans('other-domain-test-no-params-short-array', array(), 'not_messages'); ?> <?php echo $view['translator']->trans('other-domain-test-no-params-short-array', [], 'not_messages'); ?>
<?php echo $view['translator']->trans('other-domain-test-no-params-long-array', array(), 'not_messages'); ?> <?php echo $view['translator']->trans('other-domain-test-no-params-long-array', [], 'not_messages'); ?>
<?php echo $view['translator']->trans('other-domain-test-params-short-array', array('foo' => 'bar'), 'not_messages'); ?> <?php echo $view['translator']->trans('other-domain-test-params-short-array', ['foo' => 'bar'], 'not_messages'); ?>
<?php echo $view['translator']->trans('other-domain-test-params-long-array', array('foo' => 'bar'), 'not_messages'); ?> <?php echo $view['translator']->trans('other-domain-test-params-long-array', ['foo' => 'bar'], 'not_messages'); ?>
<?php echo $view['translator']->transChoice('other-domain-test-trans-choice-short-array-%count%', 10, array('%count%' => 10), 'not_messages'); ?> <?php echo $view['translator']->transChoice('other-domain-test-trans-choice-short-array-%count%', 10, ['%count%' => 10], 'not_messages'); ?>
<?php echo $view['translator']->transChoice('other-domain-test-trans-choice-long-array-%count%', 10, array('%count%' => 10), 'not_messages'); ?> <?php echo $view['translator']->transChoice('other-domain-test-trans-choice-long-array-%count%', 10, ['%count%' => 10], 'not_messages'); ?>
<?php echo $view['translator']->trans('typecast', array('a' => (int) '123'), 'not_messages'); ?> <?php echo $view['translator']->trans('typecast', ['a' => (int) '123'], 'not_messages'); ?>
<?php echo $view['translator']->transChoice('msg1', 10 + 1, array(), 'not_messages'); ?> <?php echo $view['translator']->transChoice('msg1', 10 + 1, [], 'not_messages'); ?>
<?php echo $view['translator']->transChoice('msg2', ceil(4.5), array(), 'not_messages'); ?> <?php echo $view['translator']->transChoice('msg2', ceil(4.5), [], 'not_messages'); ?>

View File

@ -1,2 +1,2 @@
<?php if (!$label) { $label = $view['form']->humanize($name); } ?> <?php if (!$label) { $label = $view['form']->humanize($name); } ?>
<label>Custom name label: <?php echo $view->escape($view['translator']->trans($label, array(), $translation_domain)) ?></label> <label>Custom name label: <?php echo $view->escape($view['translator']->trans($label, [], $translation_domain)) ?></label>

View File

@ -1,4 +1,4 @@
<?php if (!$label) { <?php if (!$label) {
$label = $view['form']->humanize($name); $label = $view['form']->humanize($name);
} ?> } ?>
<label>Custom label: <?php echo $view->escape($view['translator']->trans($label, array(), $translation_domain)) ?></label> <label>Custom label: <?php echo $view->escape($view['translator']->trans($label, [], $translation_domain)) ?></label>

View File

@ -35,7 +35,7 @@ class PdoAdapter extends AbstractAdapter implements PruneableInterface
* * db_time_col: The column where to store the timestamp [default: item_time] * * db_time_col: The column where to store the timestamp [default: item_time]
* * db_username: The username when lazy-connect [default: ''] * * db_username: The username when lazy-connect [default: '']
* * db_password: The password 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 \PDO|Connection|string $connOrDsn A \PDO or Connection instance or DSN string or null
* @param string $namespace * @param string $namespace

View File

@ -33,7 +33,7 @@ class PdoCache extends AbstractCache implements PruneableInterface
* * db_time_col: The column where to store the timestamp [default: item_time] * * db_time_col: The column where to store the timestamp [default: item_time]
* * db_username: The username when lazy-connect [default: ''] * * db_username: The username when lazy-connect [default: '']
* * db_password: The password 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 \PDO|Connection|string $connOrDsn A \PDO or Connection instance or DSN string or null
* @param string $namespace * @param string $namespace

View File

@ -64,7 +64,7 @@ trait MemcachedTrait
* *
* Examples for servers: * Examples for servers:
* - 'memcached://user:pass@localhost?weight=33' * - '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[]|string|string[] $servers An array of servers, a DSN, or an array of DSNs
* @param array $options An array of options * @param array $options An array of options

View File

@ -60,7 +60,7 @@ trait PhpArrayTrait
// This file has been auto-generated by the Symfony Cache Component. // This file has been auto-generated by the Symfony Cache Component.
return array( return [
EOF; EOF;
@ -97,7 +97,7 @@ EOF;
$dump .= var_export($key, true).' => '.var_export($value, true).",\n"; $dump .= var_export($key, true).' => '.var_export($value, true).",\n";
} }
$dump .= "\n);\n"; $dump .= "\n];\n";
$dump = str_replace("' . \"\\0\" . '", "\0", $dump); $dump = str_replace("' . \"\\0\" . '", "\0", $dump);
$tmpFile = uniqid($this->file, true); $tmpFile = uniqid($this->file, true);

View File

@ -34,7 +34,7 @@ The edge case of defining just one value for nodes of type Enum is now allowed:
$rootNode $rootNode
->children() ->children()
->enumNode('variable') ->enumNode('variable')
->values(array('value')) ->values(['value'])
->end() ->end()
->end() ->end()
; ;

View File

@ -82,7 +82,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
/** /**
* Sets the xml remappings that should be performed. * 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) public function setXmlRemappings(array $remappings)
{ {
@ -92,7 +92,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
/** /**
* Gets the xml remappings that should be performed. * 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() public function getXmlRemappings()
{ {

View File

@ -214,15 +214,15 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
* to be the key of the particular item. For example, if "id" is the * to be the key of the particular item. For example, if "id" is the
* "key", then: * "key", then:
* *
* array( * [
* array('id' => 'my_name', 'foo' => 'bar'), * ['id' => 'my_name', 'foo' => 'bar'],
* ); * ];
* *
* becomes * 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 * 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. * array, then you can set the second argument of this method to false.

View File

@ -53,15 +53,15 @@ class PrototypedArrayNode extends ArrayNode
* to be the key of the particular item. For example, if "id" is the * to be the key of the particular item. For example, if "id" is the
* "key", then: * "key", then:
* *
* array( * [
* array('id' => 'my_name', 'foo' => 'bar'), * ['id' => 'my_name', 'foo' => 'bar'],
* ); * ];
* *
* becomes * 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 * 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. * 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: * For example, assume $this->keyAttribute is 'name' and the value array is as follows:
* *
* array( * [
* array( * [
* 'name' => 'name001', * 'name' => 'name001',
* 'value' => 'value001' * 'value' => 'value001'
* ) * ]
* ) * ]
* *
* Now, the key is 0 and the child node is: * Now, the key is 0 and the child node is:
* *
* array( * [
* 'name' => 'name001', * 'name' => 'name001',
* 'value' => 'value001' * 'value' => 'value001'
* ) * ]
* *
* When normalizing the value array, the 'name' element will removed from the child node * 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: * 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: * 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 * 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. * the prototype of child node 'name001' should be a ScalarNode instead of an ArrayNode instance.

View File

@ -227,7 +227,7 @@ class ExprBuilderTest extends TestCase
* *
* @param TreeBuilder $testBuilder The tree builder to finalize * @param TreeBuilder $testBuilder The tree builder to finalize
* @param array $config The config you want to use for the finalization, if nothing provided * @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 * @return array The finalized config values
*/ */

View File

@ -66,12 +66,12 @@ class PrototypedArrayNodeTest extends TestCase
* The above should finally be mapped to an array that looks like this * The above should finally be mapped to an array that looks like this
* (because "id" is the key attribute). * (because "id" is the key attribute).
* *
* array( * [
* 'things' => array( * 'things' => [
* 'option1' => 'foo', * 'option1' => 'foo',
* 'option2' => 'bar', * 'option2' => 'bar',
* ) * ]
* ) * ]
*/ */
public function testMappedAttributeKeyIsRemoved() public function testMappedAttributeKeyIsRemoved()
{ {
@ -191,11 +191,11 @@ class PrototypedArrayNodeTest extends TestCase
* The above should finally be mapped to an array that looks like this * The above should finally be mapped to an array that looks like this
* (because "id" is the key attribute). * (because "id" is the key attribute).
* *
* array( * [
* 'things' => array( * 'things' => [
* 'option1' => 'value1' * 'option1' => 'value1'
* ) * ]
* ) * ]
* *
* It's also possible to mix 'value-only' and 'non-value-only' elements in the array. * 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 * The above should finally be mapped to an array as follows
* *
* array( * [
* 'things' => array( * 'things' => [
* 'option1' => 'value1', * 'option1' => 'value1',
* 'option2' => array( * 'option2' => [
* 'value' => 'value2', * 'value' => 'value2',
* 'foo' => 'foo2' * 'foo' => 'foo2'
* ) * ]
* ) * ]
* ) * ]
* *
* The 'value' element can also be ArrayNode: * 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 * The above should be finally be mapped to an array as follows
* *
* array( * [
* 'things' => array( * 'things' => [
* 'option1' => array( * 'option1' => [
* 'foo' => 'foo1', * 'foo' => 'foo1',
* 'bar' => 'bar1' * 'bar' => 'bar1'
* ) * ]
* ) * ]
* ) * ]
* *
* If using VariableNode for value node, it's also possible to mix different types of value nodes: * 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 * The above should be finally mapped to an array as follows
* *
* array( * [
* 'things' => array( * 'things' => [
* 'option1' => array( * 'option1' => [
* 'foo' => 'foo1', * 'foo' => 'foo1',
* 'bar' => 'bar1' * 'bar' => 'bar1'
* ), * ],
* 'option2' => 'value2' * 'option2' => 'value2'
* ) * ]
* ) * ]
* *
* *
* @dataProvider getDataForKeyRemovedLeftValueOnly * @dataProvider getDataForKeyRemovedLeftValueOnly

View File

@ -71,7 +71,7 @@ class ReflectionClassResourceTest extends TestCase
/* 2*/ { /* 2*/ {
/* 3*/ const FOO = 123; /* 3*/ const FOO = 123;
/* 4*/ /* 4*/
/* 5*/ public $pub = array(); /* 5*/ public $pub = [];
/* 6*/ /* 6*/
/* 7*/ protected $prot; /* 7*/ protected $prot;
/* 8*/ /* 8*/
@ -79,7 +79,7 @@ class ReflectionClassResourceTest extends TestCase
/*10*/ /*10*/
/*11*/ public function pub($arg = null) {} /*11*/ public function pub($arg = null) {}
/*12*/ /*12*/
/*13*/ protected function prot($a = array()) {} /*13*/ protected function prot($a = []) {}
/*14*/ /*14*/
/*15*/ private function priv() {} /*15*/ private function priv() {}
/*16*/ } /*16*/ }
@ -119,8 +119,8 @@ EOPHP;
yield [1, 3, 'const FOO = 456;']; yield [1, 3, 'const FOO = 456;'];
yield [1, 3, 'const BAR = 123;']; yield [1, 3, 'const BAR = 123;'];
yield [1, 4, '/** pub docblock */']; yield [1, 4, '/** pub docblock */'];
yield [1, 5, 'protected $pub = array();']; yield [1, 5, 'protected $pub = [];'];
yield [1, 5, 'public $pub = array(123);']; yield [1, 5, 'public $pub = [123];'];
yield [1, 6, '/** prot docblock */']; yield [1, 6, '/** prot docblock */'];
yield [1, 7, 'private $prot;']; yield [1, 7, 'private $prot;'];
yield [0, 8, '/** priv docblock */']; yield [0, 8, '/** priv docblock */'];
@ -134,7 +134,7 @@ EOPHP;
} }
yield [0, 11, "public function pub(\$arg = null) {\nreturn 123;\n}"]; yield [0, 11, "public function pub(\$arg = null) {\nreturn 123;\n}"];
yield [1, 12, '/** prot docblock */']; 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, 14, '/** priv docblock */'];
yield [0, 15, '']; yield [0, 15, ''];
} }

View File

@ -19,7 +19,7 @@ use Symfony\Component\Console\Exception\InvalidOptionException;
* *
* Usage: * Usage:
* *
* $input = new ArrayInput(array('name' => 'foo', '--bar' => 'foobar')); * $input = new ArrayInput(['name' => 'foo', '--bar' => 'foobar']);
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*/ */

View File

@ -19,10 +19,10 @@ use Symfony\Component\Console\Exception\LogicException;
* *
* Usage: * Usage:
* *
* $definition = new InputDefinition(array( * $definition = new InputDefinition([
* new InputArgument('name', InputArgument::REQUIRED), * new InputArgument('name', InputArgument::REQUIRED),
* new InputOption('foo', 'f', InputOption::VALUE_REQUIRED), * new InputOption('foo', 'f', InputOption::VALUE_REQUIRED),
* )); * ]);
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*/ */

View File

@ -186,7 +186,7 @@ class InputDefinitionTest extends TestCase
new InputArgument('foo1', InputArgument::OPTIONAL), new InputArgument('foo1', InputArgument::OPTIONAL),
new InputArgument('foo2', InputArgument::OPTIONAL, '', 'default'), new InputArgument('foo2', InputArgument::OPTIONAL, '', 'default'),
new InputArgument('foo3', InputArgument::OPTIONAL | InputArgument::IS_ARRAY), 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'); $this->assertEquals(['foo1' => null, 'foo2' => 'default', 'foo3' => []], $definition->getArgumentDefaults(), '->getArgumentDefaults() return the default values for each argument');

View File

@ -25,41 +25,41 @@ function symfony_zval_info($key, $array, $options = 0)
return null; return null;
} }
$info = array( $info = [
'type' => gettype($array[$key]), 'type' => gettype($array[$key]),
'zval_hash' => /* hashed memory address of $array[$key] */, 'zval_hash' => /* hashed memory address of $array[$key] */,
'zval_refcount' => /* internal zval refcount of $array[$key] */, 'zval_refcount' => /* internal zval refcount of $array[$key] */,
'zval_isref' => /* is_ref status of $array[$key] */, 'zval_isref' => /* is_ref status of $array[$key] */,
); ];
switch ($info['type']) { switch ($info['type']) {
case 'object': case 'object':
$info += array( $info += [
'object_class' => get_class($array[$key]), 'object_class' => get_class($array[$key]),
'object_refcount' => /* internal object refcount of $array[$key] */, 'object_refcount' => /* internal object refcount of $array[$key] */,
'object_hash' => spl_object_hash($array[$key]), 'object_hash' => spl_object_hash($array[$key]),
'object_handle' => /* internal object handle $array[$key] */, 'object_handle' => /* internal object handle $array[$key] */,
); ];
break; break;
case 'resource': case 'resource':
$info += array( $info += [
'resource_handle' => (int) $array[$key], 'resource_handle' => (int) $array[$key],
'resource_type' => get_resource_type($array[$key]), 'resource_type' => get_resource_type($array[$key]),
'resource_refcount' => /* internal resource refcount of $array[$key] */, 'resource_refcount' => /* internal resource refcount of $array[$key] */,
); ];
break; break;
case 'array': case 'array':
$info += array( $info += [
'array_count' => count($array[$key]), 'array_count' => count($array[$key]),
); ];
break; break;
case 'string': case 'string':
$info += array( $info += [
'strlen' => strlen($array[$key]), 'strlen' => strlen($array[$key]),
); ];
break; break;
} }

View File

@ -28,14 +28,14 @@ class DebugClassLoaderTest extends TestCase
{ {
$this->errorReporting = error_reporting(E_ALL); $this->errorReporting = error_reporting(E_ALL);
$this->loader = new ClassLoader(); $this->loader = new ClassLoader();
spl_autoload_register(array($this->loader, 'loadClass'), true, true); spl_autoload_register([$this->loader, 'loadClass'], true, true);
DebugClassLoader::enable(); DebugClassLoader::enable();
} }
protected function tearDown() protected function tearDown()
{ {
DebugClassLoader::disable(); DebugClassLoader::disable();
spl_autoload_unregister(array($this->loader, 'loadClass')); spl_autoload_unregister([$this->loader, 'loadClass']);
error_reporting($this->errorReporting); error_reporting($this->errorReporting);
} }
@ -45,7 +45,7 @@ class DebugClassLoaderTest extends TestCase
$functions = spl_autoload_functions(); $functions = spl_autoload_functions();
foreach ($functions as $function) { 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]); $reflClass = new \ReflectionClass($function[0]);
$reflProp = $reflClass->getProperty('classLoader'); $reflProp = $reflClass->getProperty('classLoader');
$reflProp->setAccessible(true); $reflProp->setAccessible(true);
@ -81,7 +81,7 @@ class DebugClassLoaderTest extends TestCase
if (\PHP_VERSION_ID >= 70000) { if (\PHP_VERSION_ID >= 70000) {
$this->markTestSkipped('PHP7 throws exceptions, unsilencing is not required anymore.'); $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.'); $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)) { if (class_exists('Symfony\Component\Debug\Exception\ContextErrorException', false)) {
$this->markTestSkipped('The ContextErrorException class is already loaded.'); $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.'); $this->markTestSkipped('HHVM is not handled in this test case.');
} }
@ -192,7 +192,7 @@ class DebugClassLoaderTest extends TestCase
{ {
set_error_handler(function () { return false; }); set_error_handler(function () { return false; });
$e = error_reporting(0); $e = error_reporting(0);
trigger_error('', E_USER_DEPRECATED); @trigger_error('', E_USER_DEPRECATED);
class_exists('Test\\'.__NAMESPACE__.'\\'.$class, true); class_exists('Test\\'.__NAMESPACE__.'\\'.$class, true);
@ -202,20 +202,20 @@ class DebugClassLoaderTest extends TestCase
$lastError = error_get_last(); $lastError = error_get_last();
unset($lastError['file'], $lastError['line']); unset($lastError['file'], $lastError['line']);
$xError = array( $xError = [
'type' => E_USER_DEPRECATED, '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.', '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); $this->assertSame($xError, $lastError);
} }
public function provideDeprecatedSuper() public function provideDeprecatedSuper()
{ {
return array( return [
array('DeprecatedInterfaceClass', 'DeprecatedInterface', 'implements'), ['DeprecatedInterfaceClass', 'DeprecatedInterface', 'implements'],
array('DeprecatedParentClass', 'DeprecatedClass', 'extends'), ['DeprecatedParentClass', 'DeprecatedClass', 'extends'],
); ];
} }
public function testInterfaceExtendsDeprecatedInterface() public function testInterfaceExtendsDeprecatedInterface()
@ -232,10 +232,10 @@ class DebugClassLoaderTest extends TestCase
$lastError = error_get_last(); $lastError = error_get_last();
unset($lastError['file'], $lastError['line']); unset($lastError['file'], $lastError['line']);
$xError = array( $xError = [
'type' => E_USER_NOTICE, 'type' => E_USER_NOTICE,
'message' => '', 'message' => '',
); ];
$this->assertSame($xError, $lastError); $this->assertSame($xError, $lastError);
} }
@ -254,10 +254,10 @@ class DebugClassLoaderTest extends TestCase
$lastError = error_get_last(); $lastError = error_get_last();
unset($lastError['file'], $lastError['line']); unset($lastError['file'], $lastError['line']);
$xError = array( $xError = [
'type' => E_USER_NOTICE, 'type' => E_USER_NOTICE,
'message' => '', 'message' => '',
); ];
$this->assertSame($xError, $lastError); $this->assertSame($xError, $lastError);
} }
@ -280,10 +280,10 @@ class DebugClassLoaderTest extends TestCase
$lastError = error_get_last(); $lastError = error_get_last();
unset($lastError['file'], $lastError['line']); unset($lastError['file'], $lastError['line']);
$xError = array( $xError = [
'type' => E_USER_DEPRECATED, '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', '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); $this->assertSame($xError, $lastError);
} }
@ -302,17 +302,17 @@ class DebugClassLoaderTest extends TestCase
$lastError = error_get_last(); $lastError = error_get_last();
unset($lastError['file'], $lastError['line']); unset($lastError['file'], $lastError['line']);
$xError = array( $xError = [
'type' => E_USER_DEPRECATED, '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".', '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); $this->assertSame($xError, $lastError);
} }
public function testExtendedFinalMethod() public function testExtendedFinalMethod()
{ {
$deprecations = array(); $deprecations = [];
set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; }); set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; });
$e = error_reporting(E_USER_DEPRECATED); $e = error_reporting(E_USER_DEPRECATED);
@ -321,10 +321,10 @@ class DebugClassLoaderTest extends TestCase
error_reporting($e); error_reporting($e);
restore_error_handler(); 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::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".', '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); $this->assertSame($xError, $deprecations);
} }
@ -343,12 +343,12 @@ class DebugClassLoaderTest extends TestCase
$lastError = error_get_last(); $lastError = error_get_last();
unset($lastError['file'], $lastError['line']); 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() public function testInternalsUse()
{ {
$deprecations = array(); $deprecations = [];
set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; }); set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; });
$e = error_reporting(E_USER_DEPRECATED); $e = error_reporting(E_USER_DEPRECATED);
@ -357,17 +357,17 @@ class DebugClassLoaderTest extends TestCase
error_reporting($e); error_reporting($e);
restore_error_handler(); 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\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\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\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".', '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() public function testUseTraitWithInternalMethod()
{ {
$deprecations = array(); $deprecations = [];
set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; }); set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; });
$e = error_reporting(E_USER_DEPRECATED); $e = error_reporting(E_USER_DEPRECATED);
@ -376,7 +376,7 @@ class DebugClassLoaderTest extends TestCase
error_reporting($e); error_reporting($e);
restore_error_handler(); restore_error_handler();
$this->assertSame(array(), $deprecations); $this->assertSame([], $deprecations);
} }
} }
@ -388,12 +388,12 @@ class ClassLoader
public function getClassMap() public function getClassMap()
{ {
return array(__NAMESPACE__.'\Fixtures\NotPSR0bis' => __DIR__.'/Fixtures/notPsr0Bis.php'); return [__NAMESPACE__.'\Fixtures\NotPSR0bis' => __DIR__.'/Fixtures/notPsr0Bis.php'];
} }
public function findFile($class) public function findFile($class)
{ {
$fixtureDir = __DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR; $fixtureDir = __DIR__.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR;
if (__NAMESPACE__.'\TestingUnsilencing' === $class) { if (__NAMESPACE__.'\TestingUnsilencing' === $class) {
eval('-- parse error --'); eval('-- parse error --');
@ -402,7 +402,7 @@ class ClassLoader
} elseif (__NAMESPACE__.'\TestingCaseMismatch' === $class) { } elseif (__NAMESPACE__.'\TestingCaseMismatch' === $class) {
eval('namespace '.__NAMESPACE__.'; class TestingCaseMisMatch {}'); eval('namespace '.__NAMESPACE__.'; class TestingCaseMisMatch {}');
} elseif (__NAMESPACE__.'\Fixtures\Psr4CaseMismatch' === $class) { } elseif (__NAMESPACE__.'\Fixtures\Psr4CaseMismatch' === $class) {
return $fixtureDir.'psr4'.DIRECTORY_SEPARATOR.'Psr4CaseMismatch.php'; return $fixtureDir.'psr4'.\DIRECTORY_SEPARATOR.'Psr4CaseMismatch.php';
} elseif (__NAMESPACE__.'\Fixtures\NotPSR0' === $class) { } elseif (__NAMESPACE__.'\Fixtures\NotPSR0' === $class) {
return $fixtureDir.'reallyNotPsr0.php'; return $fixtureDir.'reallyNotPsr0.php';
} elseif (__NAMESPACE__.'\Fixtures\NotPSR0bis' === $class) { } elseif (__NAMESPACE__.'\Fixtures\NotPSR0bis' === $class) {

View File

@ -647,7 +647,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
* the parameters passed to the container constructor to have precedence * the parameters passed to the container constructor to have precedence
* over the loaded ones. * over the loaded ones.
* *
* $container = new ContainerBuilder(new ParameterBag(array('foo' => 'bar'))); * $container = new ContainerBuilder(new ParameterBag(['foo' => 'bar']));
* $loader = new LoaderXXX($container); * $loader = new LoaderXXX($container);
* $loader->load('resource_name'); * $loader->load('resource_name');
* $container->register('foo', 'stdClass'); * $container->register('foo', 'stdClass');
@ -1288,7 +1288,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
* *
* Example: * Example:
* *
* $container->register('foo')->addTag('my.tag', array('hello' => 'world')); * $container->register('foo')->addTag('my.tag', ['hello' => 'world']);
* *
* $serviceIds = $container->findTaggedServiceIds('my.tag'); * $serviceIds = $container->findTaggedServiceIds('my.tag');
* foreach ($serviceIds as $serviceId => $tags) { * foreach ($serviceIds as $serviceId => $tags) {

View File

@ -33,16 +33,16 @@ interface ServiceSubscriberInterface
* *
* For mandatory dependencies: * 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. * internally to fetch a service which must implement Psr\Log\LoggerInterface.
* * array('Psr\Log\LoggerInterface') is a shortcut for * * ['Psr\Log\LoggerInterface'] is a shortcut for
* * array('Psr\Log\LoggerInterface' => 'Psr\Log\LoggerInterface') * * ['Psr\Log\LoggerInterface' => 'Psr\Log\LoggerInterface']
* *
* otherwise: * otherwise:
* *
* * array('logger' => '?Psr\Log\LoggerInterface') denotes an optional dependency * * ['logger' => '?Psr\Log\LoggerInterface'] denotes an optional dependency
* * array('?Psr\Log\LoggerInterface') is a shortcut for * * ['?Psr\Log\LoggerInterface'] is a shortcut for
* * array('Psr\Log\LoggerInterface' => '?Psr\Log\LoggerInterface') * * ['Psr\Log\LoggerInterface' => '?Psr\Log\LoggerInterface']
* *
* @return array The required service types, optionally keyed by service names * @return array The required service types, optionally keyed by service names
*/ */

View File

@ -626,7 +626,7 @@ class Crawler implements \Countable, \IteratorAggregate
* *
* Example: * Example:
* *
* $crawler->filter('h1 a')->extract(array('_text', 'href')); * $crawler->filter('h1 a')->extract(['_text', 'href']);
* *
* @param array $attributes An array of attributes * @param array $attributes An array of attributes
* *

View File

@ -133,7 +133,7 @@ class FormFieldRegistry
/** /**
* Returns the list of field with their value. * 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() public function all()
{ {
@ -167,7 +167,7 @@ class FormFieldRegistry
* @param string $base The name of the base field * @param string $base The name of the base field
* @param array $output The initial values * @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 = []) 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. * 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 * @param string $name The name of the field
* *

View File

@ -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); @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)) { 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]; $this->listenerIds[$eventName][] = [$callback[0], $callback[1], $priority];

View File

@ -36,9 +36,9 @@ interface EventSubscriberInterface
* *
* For instance: * For instance:
* *
* * array('eventName' => 'methodName') * * ['eventName' => 'methodName']
* * array('eventName' => array('methodName', $priority)) * * ['eventName' => ['methodName', $priority]]
* * array('eventName' => array(array('methodName1', $priority), array('methodName2'))) * * ['eventName' => [['methodName1', $priority], ['methodName2']]]
* *
* @return array The event names to listen to * @return array The event names to listen to
*/ */

View File

@ -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 * @param string $filename The filename to be parsed
* *

View File

@ -18,7 +18,7 @@ namespace Symfony\Component\Finder;
* *
* // prints foo.bar and foo.baz * // prints foo.bar and foo.baz
* $regex = glob_to_regex("foo.*"); * $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"; * if (/$regex/) echo "matched: $car\n";
* } * }

View File

@ -48,19 +48,19 @@ interface ChoiceListInterface
* keys of the choices. If the original array contained nested arrays, these * keys of the choices. If the original array contained nested arrays, these
* nested arrays are represented here as well: * nested arrays are represented here as well:
* *
* $form->add('field', 'choice', array( * $form->add('field', 'choice', [
* 'choices' => array( * 'choices' => [
* 'Decided' => array('Yes' => true, 'No' => false), * 'Decided' => ['Yes' => true, 'No' => false],
* 'Undecided' => array('Maybe' => null), * 'Undecided' => ['Maybe' => null],
* ), * ],
* )); * ]);
* *
* In this example, the result of this method is: * In this example, the result of this method is:
* *
* array( * [
* 'Decided' => array('Yes' => '0', 'No' => '1'), * 'Decided' => ['Yes' => '0', 'No' => '1'],
* 'Undecided' => array('Maybe' => '2'), * 'Undecided' => ['Maybe' => '2'],
* ) * ]
* *
* @return string[] The choice values * @return string[] The choice values
*/ */
@ -73,12 +73,12 @@ interface ChoiceListInterface
* "choice" option of the choice type. Note that this array may contain * "choice" option of the choice type. Note that this array may contain
* duplicates if the "choice" option contained choice groups: * duplicates if the "choice" option contained choice groups:
* *
* $form->add('field', 'choice', array( * $form->add('field', 'choice', [
* 'choices' => array( * 'choices' => [
* 'Decided' => array(true, false), * 'Decided' => [true, false],
* 'Undecided' => array(null), * 'Undecided' => [null],
* ), * ],
* )); * ]);
* *
* In this example, the original key 0 appears twice, once for `true` and * In this example, the original key 0 appears twice, once for `true` and
* once for `null`. * once for `null`.

View File

@ -26,9 +26,9 @@ use Symfony\Component\Form\Extension\Core\CoreExtension;
* ->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType') * ->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
* ->add('lastName', '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('age', 'Symfony\Component\Form\Extension\Core\Type\IntegerType')
* ->add('color', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array( * ->add('color', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', [
* 'choices' => array('Red' => 'r', 'Blue' => 'b'), * 'choices' => ['Red' => 'r', 'Blue' => 'b'],
* )) * ])
* ->getForm(); * ->getForm();
* *
* You can also add custom extensions to the form factory: * 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; * use Symfony\Component\Form\Extension\Templating\TemplatingExtension;
* *
* $formFactory = Forms::createFormFactoryBuilder() * $formFactory = Forms::createFormFactoryBuilder()
* ->addExtension(new TemplatingExtension($engine, null, array( * ->addExtension(new TemplatingExtension($engine, null, [
* 'FrameworkBundle:Form', * 'FrameworkBundle:Form',
* ))) * ]))
* ->getFormFactory(); * ->getFormFactory();
* *
* The next example shows how to include the "<table>" layout: * The next example shows how to include the "<table>" layout:
@ -78,10 +78,10 @@ use Symfony\Component\Form\Extension\Core\CoreExtension;
* use Symfony\Component\Form\Extension\Templating\TemplatingExtension; * use Symfony\Component\Form\Extension\Templating\TemplatingExtension;
* *
* $formFactory = Forms::createFormFactoryBuilder() * $formFactory = Forms::createFormFactoryBuilder()
* ->addExtension(new TemplatingExtension($engine, null, array( * ->addExtension(new TemplatingExtension($engine, null, [
* 'FrameworkBundle:Form', * 'FrameworkBundle:Form',
* 'FrameworkBundle:FormTable', * 'FrameworkBundle:FormTable',
* ))) * ]))
* ->getFormFactory(); * ->getFormFactory();
* *
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>

View File

@ -41,8 +41,8 @@ class DateTimeToStringTransformerTest extends TestCase
// this will not work as PHP will use actual date to replace missing info // this will not work as PHP will use actual date to replace missing info
// and after change of date will lookup for closest Wednesday // 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 // 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'), //['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-l', '2010-02-Wednesday', '2010-02-03 00:00:00 UTC'],
// different month representations // different month representations
['Y-n-d', '2010-2-03', '2010-02-03 00:00:00 UTC'], ['Y-n-d', '2010-2-03', '2010-02-03 00:00:00 UTC'],

View File

@ -47,7 +47,7 @@ class StringUtilTest extends TestCase
['0020'], ['0020'],
['00A0'], ['00A0'],
['1680'], ['1680'],
// array('180E'), // ['180E'],
['2000'], ['2000'],
['2001'], ['2001'],
['2002'], ['2002'],
@ -72,7 +72,7 @@ class StringUtilTest extends TestCase
['000D'], ['000D'],
['0085'], ['0085'],
// zero width space // zero width space
// array('200B'), // ['200B'],
]; ];
} }

View File

@ -36,7 +36,7 @@ class FormUtil
*/ */
public static function isEmpty($data) 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 // This method is used in occurrences where arrays are
// not considered to be empty, ever. // not considered to be empty, ever.
return null === $data || '' === $data; return null === $data || '' === $data;

View File

@ -161,7 +161,7 @@ class PdoSessionHandler extends AbstractSessionHandler
* * db_time_col: The column where to store the timestamp [default: sess_time] * * db_time_col: The column where to store the timestamp [default: sess_time]
* * db_username: The username when lazy-connect [default: ''] * * db_username: The username when lazy-connect [default: '']
* * db_password: The password 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] * * 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 * @param \PDO|string|null $pdoOrDsn A \PDO instance or DSN string or URL string or null

View File

@ -331,7 +331,7 @@ class NativeSessionStorage implements SessionStorageInterface
* For convenience we omit 'session.' from the beginning of the keys. * For convenience we omit 'session.' from the beginning of the keys.
* Explicitly ignores other ini 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 * @see http://php.net/session.configuration
*/ */

View File

@ -576,7 +576,7 @@ class ResponseTest extends ResponseTestCase
public function testSetCache() public function testSetCache()
{ {
$response = new Response(); $response = new Response();
//array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public') // ['etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public']
try { try {
$response->setCache(['wrong option' => 'value']); $response->setCache(['wrong option' => 'value']);
$this->fail('->setCache() throws an InvalidArgumentException if an option is not supported'); $this->fail('->setCache() throws an InvalidArgumentException if an option is not supported');

View File

@ -216,7 +216,7 @@ class ControllerResolver implements ArgumentResolverInterface, ControllerResolve
} }
if (2 !== \count($callable)) { 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; list($controller, $method) = $callable;

View File

@ -149,9 +149,9 @@ class InflectorTest extends TestCase
['SubTrees', ['SubTre', 'SubTree']], ['SubTrees', ['SubTre', 'SubTree']],
// Known issues // Known issues
//array('insignia', 'insigne'), //['insignia', 'insigne'],
//array('insignias', 'insigne'), //['insignias', 'insigne'],
//array('rattles', 'rattle'), //['rattles', 'rattle'],
]; ];
} }

View File

@ -35,7 +35,7 @@ interface BundleEntryReaderInterface extends BundleReaderInterface
* *
* Then the value can be read by calling: * 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 $path The path to the resource bundle
* @param string $locale The locale to read * @param string $locale The locale to read

View File

@ -439,7 +439,7 @@ abstract class AbstractNumberFormatterTest extends TestCase
return [ return [
[1.121, '1.12'], [1.121, '1.12'],
[1.123, '1.12'], [1.123, '1.12'],
// array(1.125, '1.13'), // [1.125, '1.13'],
[1.127, '1.13'], [1.127, '1.13'],
[1.129, '1.13'], [1.129, '1.13'],
[1020 / 100, '10.20'], [1020 / 100, '10.20'],

View File

@ -64,7 +64,7 @@ class PhpProcess extends Process
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function start(callable $callback = null/*, array $env = array()*/) public function start(callable $callback = null/*, array $env = []*/)
{ {
if (null === $this->getCommandLine()) { if (null === $this->getCommandLine()) {
throw new RuntimeException('Unable to find the PHP executable.'); throw new RuntimeException('Unable to find the PHP executable.');

View File

@ -204,7 +204,7 @@ class Process implements \IteratorAggregate
* *
* @final since version 3.3 * @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; $env = 1 < \func_num_args() ? func_get_arg(1) : null;
$this->start($callback, $env); $this->start($callback, $env);
@ -228,7 +228,7 @@ class Process implements \IteratorAggregate
* *
* @final since version 3.3 * @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()) { if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.'); 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 RuntimeException When process is already running
* @throws LogicException In case a callback is provided and output has been disabled * @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()) { if ($this->isRunning()) {
throw new RuntimeException('Process is already running'); throw new RuntimeException('Process is already running');
@ -378,7 +378,7 @@ class Process implements \IteratorAggregate
* *
* @final since version 3.3 * @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()) { if ($this->isRunning()) {
throw new RuntimeException('Process is already running'); throw new RuntimeException('Process is already running');

View File

@ -1164,8 +1164,8 @@ class ProcessTest extends TestCase
{ {
return [ return [
//expected output / getter / code to execute //expected output / getter / code to execute
//array(1,'getExitCode','exit(1);'), //[1,'getExitCode','exit(1);'],
//array(true,'isSuccessful','exit();'), //[true,'isSuccessful','exit();'],
['output', 'getOutput', 'echo \'output\';'], ['output', 'getOutput', 'echo \'output\';'],
]; ];
} }

View File

@ -41,7 +41,7 @@ CHANGELOG
Before: Before:
```php ```php
$router->generate('blog_show', array('slug' => 'my-blog-post'), true); $router->generate('blog_show', ['slug' => 'my-blog-post'], true);
``` ```
After: After:
@ -49,7 +49,7 @@ CHANGELOG
```php ```php
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; 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 2.5.0
@ -114,7 +114,7 @@ CHANGELOG
```php ```php
$route = new Route(); $route = new Route();
$route->setPath('/article/{id}'); $route->setPath('/article/{id}');
$route->setMethods(array('POST', 'PUT')); $route->setMethods(['POST', 'PUT']);
$route->setSchemes('https'); $route->setSchemes('https');
``` ```
@ -169,10 +169,10 @@ CHANGELOG
used with a single parameter. The other params `$prefix`, `$default`, `$requirements` and `$options` 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 will still work, but have been deprecated. The `addPrefix` method should be used for this
use-case instead. use-case instead.
Before: `$parentCollection->addCollection($collection, '/prefix', array(...), array(...))` Before: `$parentCollection->addCollection($collection, '/prefix', [...], [...])`
After: After:
```php ```php
$collection->addPrefix('/prefix', array(...), array(...)); $collection->addPrefix('/prefix', [...], [...]);
$parentCollection->addCollection($collection); $parentCollection->addCollection($collection);
``` ```
* added support for the method default argument values when defining a @Route * 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). (only relevant if you implemented your own RouteCompiler).
* Added possibility to generate relative paths and network paths in the UrlGenerator, e.g. * 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 "../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 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 claritiy. The old method calls with a Boolean parameter will continue to work because they
equal the signature using the constants. equal the signature using the constants.

View File

@ -76,7 +76,7 @@ EOF;
*/ */
private function generateDeclaredRoutes() private function generateDeclaredRoutes()
{ {
$routes = "array(\n"; $routes = "[\n";
foreach ($this->getRoutes()->all() as $name => $route) { foreach ($this->getRoutes()->all() as $name => $route) {
$compiledRoute = $route->compile(); $compiledRoute = $route->compile();
@ -90,7 +90,7 @@ EOF;
$routes .= sprintf(" '%s' => %s,\n", $name, str_replace("\n", '', var_export($properties, true))); $routes .= sprintf(" '%s' => %s,\n", $name, str_replace("\n", '', var_export($properties, true)));
} }
$routes .= ' )'; $routes .= ' ]';
return $routes; return $routes;
} }
@ -103,7 +103,7 @@ EOF;
private function generateGenerateMethod() private function generateGenerateMethod()
{ {
return <<<'EOF' 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])) { 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)); throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));

View File

@ -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 '/' // 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 // 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 // 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. // 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 // 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'. // part of {_format} when generating the URL, e.g. _format = 'mobile.html'.

View File

@ -153,7 +153,7 @@ class RouteTest extends TestCase
public function testScheme() public function testScheme()
{ {
$route = new Route('/'); $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')); $this->assertFalse($route->hasScheme('http'));
$route->setSchemes('hTTp'); $route->setSchemes('hTTp');
$this->assertEquals(['http'], $route->getSchemes(), '->setSchemes() accepts a single scheme string and lowercases it'); $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() public function testMethod()
{ {
$route = new Route('/'); $route = new Route('/');
$this->assertEquals([], $route->getMethods(), 'methods is initialized with array()'); $this->assertEquals([], $route->getMethods(), 'methods is initialized with []');
$route->setMethods('gEt'); $route->setMethods('gEt');
$this->assertEquals(['GET'], $route->getMethods(), '->setMethods() accepts a single method string and uppercases it'); $this->assertEquals(['GET'], $route->getMethods(), '->setMethods() accepts a single method string and uppercases it');
$route->setMethods(['gEt', 'PosT']); $route->setMethods(['gEt', 'PosT']);

View File

@ -38,7 +38,7 @@ interface UserInterface
* *
* public function getRoles() * public function getRoles()
* { * {
* return array('ROLE_USER'); * return ['ROLE_USER'];
* } * }
* *
* Alternatively, the roles might be stored on a ``roles`` property, * Alternatively, the roles might be stored on a ``roles`` property,

View File

@ -44,14 +44,14 @@ interface AuthenticatorInterface extends GuardAuthenticatorInterface
* *
* For example, for a form login, you might: * For example, for a form login, you might:
* *
* return array( * return [
* 'username' => $request->request->get('_username'), * 'username' => $request->request->get('_username'),
* 'password' => $request->request->get('_password'), * 'password' => $request->request->get('_password'),
* ); * ];
* *
* Or for an API token that's on a header, you might use: * 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 * @param Request $request
* *

View File

@ -43,17 +43,17 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface
* For example, for a form login, you might: * For example, for a form login, you might:
* *
* if ($request->request->has('_username')) { * if ($request->request->has('_username')) {
* return array( * return [
* 'username' => $request->request->get('_username'), * 'username' => $request->request->get('_username'),
* 'password' => $request->request->get('_password'), * 'password' => $request->request->get('_password'),
* ); * ];
* } else { * } else {
* return; * return;
* } * }
* *
* Or for an API token that's on a header, you might use: * 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 * @param Request $request
* *

View File

@ -30,7 +30,7 @@ interface FirewallMapInterface
* If there is no exception listener, the second element of the outer array * If there is no exception listener, the second element of the outer array
* must be null. * must be null.
* *
* @return array of the format array(array(AuthenticationListener), ExceptionListener) * @return array of the format [[AuthenticationListener], ExceptionListener]
*/ */
public function getListeners(Request $request); public function getListeners(Request $request);
} }

View File

@ -43,7 +43,7 @@ class ChainDecoder implements DecoderInterface /*, ContextAwareDecoderInterface*
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function supportsDecoding($format/*, array $context = array()*/) public function supportsDecoding($format/*, array $context = []*/)
{ {
$context = \func_num_args() > 1 ? func_get_arg(1) : []; $context = \func_num_args() > 1 ? func_get_arg(1) : [];

View File

@ -43,7 +43,7 @@ class ChainEncoder implements EncoderInterface /*, ContextAwareEncoderInterface*
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function supportsEncoding($format/*, array $context = array()*/) public function supportsEncoding($format/*, array $context = []*/)
{ {
$context = \func_num_args() > 1 ? func_get_arg(1) : []; $context = \func_num_args() > 1 ? func_get_arg(1) : [];
@ -64,7 +64,7 @@ class ChainEncoder implements EncoderInterface /*, ContextAwareEncoderInterface*
* *
* @return bool * @return bool
*/ */
public function needsNormalization($format/*, array $context = array()*/) public function needsNormalization($format/*, array $context = []*/)
{ {
$context = \func_num_args() > 1 ? func_get_arg(1) : []; $context = \func_num_args() > 1 ? func_get_arg(1) : [];
$encoder = $this->getEncoder($format, $context); $encoder = $this->getEncoder($format, $context);

View File

@ -396,7 +396,7 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
/* /*
* Create nodes to append to $parentNode based on the $key of this array * Create nodes to append to $parentNode based on the $key of this array
* Produces <xml><item>0</item><item>1</item></xml> * Produces <xml><item>0</item><item>1</item></xml>
* From array("item" => array(0,1));. * From ["item" => [0,1]];.
*/ */
foreach ($data as $subData) { foreach ($data as $subData) {
$append = $this->appendNode($parentNode, $subData, $key); $append = $this->appendNode($parentNode, $subData, $key);

View File

@ -66,7 +66,7 @@ class ArrayDenormalizer implements DenormalizerInterface, SerializerAwareInterfa
/** /**
* {@inheritdoc} * {@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) : []; $context = \func_num_args() > 3 ? func_get_arg(3) : [];

View File

@ -188,7 +188,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function supportsNormalization($data, $format = null/*, array $context = array()*/) public function supportsNormalization($data, $format = null/*, array $context = []*/)
{ {
if (\func_num_args() > 2) { if (\func_num_args() > 2) {
$context = \func_get_arg(2); $context = \func_get_arg(2);
@ -196,7 +196,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
if (__CLASS__ !== \get_class($this)) { if (__CLASS__ !== \get_class($this)) {
$r = new \ReflectionMethod($this, __FUNCTION__); $r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) { 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} * {@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) { if (\func_num_args() > 3) {
$context = \func_get_arg(3); $context = \func_get_arg(3);
@ -217,7 +217,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
if (__CLASS__ !== \get_class($this)) { if (__CLASS__ !== \get_class($this)) {
$r = new \ReflectionMethod($this, __FUNCTION__); $r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) { 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} * {@inheritdoc}
*/ */
public function supportsEncoding($format/*, array $context = array()*/) public function supportsEncoding($format/*, array $context = []*/)
{ {
if (\func_num_args() > 1) { if (\func_num_args() > 1) {
$context = \func_get_arg(1); $context = \func_get_arg(1);
@ -291,7 +291,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
if (__CLASS__ !== \get_class($this)) { if (__CLASS__ !== \get_class($this)) {
$r = new \ReflectionMethod($this, __FUNCTION__); $r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) { 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} * {@inheritdoc}
*/ */
public function supportsDecoding($format/*, array $context = array()*/) public function supportsDecoding($format/*, array $context = []*/)
{ {
if (\func_num_args() > 1) { if (\func_num_args() > 1) {
$context = \func_get_arg(1); $context = \func_get_arg(1);
@ -312,7 +312,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz
if (__CLASS__ !== \get_class($this)) { if (__CLASS__ !== \get_class($this)) {
$r = new \ReflectionMethod($this, __FUNCTION__); $r = new \ReflectionMethod($this, __FUNCTION__);
if (__CLASS__ !== $r->getDeclaringClass()->getName()) { 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);
} }
} }

View File

@ -40,19 +40,19 @@ abstract class AbstractOperation implements OperationInterface
* *
* The data structure of this array is as follows: * The data structure of this array is as follows:
* *
* array( * [
* 'domain 1' => array( * 'domain 1' => [
* 'all' => array(...), * 'all' => [...],
* 'new' => array(...), * 'new' => [...],
* 'obsolete' => array(...) * 'obsolete' => [...]
* ), * ],
* 'domain 2' => array( * 'domain 2' => [
* 'all' => array(...), * 'all' => [...],
* 'new' => array(...), * 'new' => [...],
* 'obsolete' => array(...) * 'obsolete' => [...]
* ), * ],
* ... * ...
* ) * ]
* *
* @var array The array that stores 'all', 'new' and 'obsolete' messages * @var array The array that stores 'all', 'new' and 'obsolete' messages
*/ */

View File

@ -36,7 +36,7 @@ class ArrayLoader implements LoaderInterface
* Flattens an nested array of translations. * Flattens an nested array of translations.
* *
* The scheme used is: * The scheme used is:
* 'key' => array('key2' => array('key3' => 'value')) * 'key' => ['key2' => ['key3' => 'value']]
* Becomes: * Becomes:
* 'key.key2.key3' => 'value' * 'key.key2.key3' => 'value'
* *

View File

@ -27,7 +27,7 @@ class ArrayConverter
{ {
/** /**
* Converts linear messages array to tree-like array. * 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 * @param array $messages Linear messages array
* *

View File

@ -17,7 +17,7 @@ namespace Symfony\Component\Validator\Constraints;
* When validating a group sequence, each group will only be validated if all * When validating a group sequence, each group will only be validated if all
* of the previous groups in the sequence succeeded. For example: * 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 * 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 * validated. If none of the constraints fail, the validator will then validate

View File

@ -97,7 +97,7 @@ interface ExecutionContextInterface
* { * {
* $validator = $this->context->getValidator(); * $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) { * if (count($violations) > 0) {
* // ... * // ...

View File

@ -372,7 +372,7 @@ EOTXT
$cloner->addCasters([ $cloner->addCasters([
':stream' => eval('return function () use ($twig) { ':stream' => eval('return function () use ($twig) {
try { try {
$twig->render(array()); $twig->render([]);
} catch (\Twig\Error\RuntimeError $e) { } catch (\Twig\Error\RuntimeError $e) {
throw $e->getPrevious(); throw $e->getPrevious();
} }