Skip to content

Commit 7e37483

Browse files
committed
fixed CS
1 parent 3609dc8 commit 7e37483

12 files changed

+192
-192
lines changed

Command/DebugCommand.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ public function __construct(Environment $twig, string $projectDir = null)
4343
protected function configure()
4444
{
4545
$this
46-
->setDefinition(array(
46+
->setDefinition([
4747
new InputArgument('filter', InputArgument::OPTIONAL, 'Show details for all entries matching this filter'),
4848
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (text or json)', 'text'),
49-
))
49+
])
5050
->setDescription('Shows a list of twig functions, filters, globals and tests')
5151
->setHelp(<<<'EOF'
5252
The <info>%command.name%</info> command outputs a list of twig functions,
@@ -71,10 +71,10 @@ protected function configure()
7171
protected function execute(InputInterface $input, OutputInterface $output)
7272
{
7373
$io = new SymfonyStyle($input, $output);
74-
$types = array('functions', 'filters', 'tests', 'globals');
74+
$types = ['functions', 'filters', 'tests', 'globals'];
7575

7676
if ('json' === $input->getOption('format')) {
77-
$data = array();
77+
$data = [];
7878
foreach ($types as $type) {
7979
foreach ($this->twig->{'get'.ucfirst($type)}() as $name => $entity) {
8080
$data[$type][$name] = $this->getMetadata($type, $entity);
@@ -90,7 +90,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9090
$filter = $input->getArgument('filter');
9191

9292
foreach ($types as $index => $type) {
93-
$items = array();
93+
$items = [];
9494
foreach ($this->twig->{'get'.ucfirst($type)}() as $name => $entity) {
9595
if (!$filter || false !== strpos($name, $filter)) {
9696
$items[$name] = $name.$this->getPrettyMetadata($type, $entity);
@@ -107,20 +107,20 @@ protected function execute(InputInterface $input, OutputInterface $output)
107107
$io->listing($items);
108108
}
109109

110-
$rows = array();
110+
$rows = [];
111111
$firstNamespace = true;
112112
$prevHasSeparator = false;
113113
foreach ($this->getLoaderPaths() as $namespace => $paths) {
114114
if (!$firstNamespace && !$prevHasSeparator && \count($paths) > 1) {
115-
$rows[] = array('', '');
115+
$rows[] = ['', ''];
116116
}
117117
$firstNamespace = false;
118118
foreach ($paths as $path) {
119-
$rows[] = array($namespace, $path.\DIRECTORY_SEPARATOR);
119+
$rows[] = [$namespace, $path.\DIRECTORY_SEPARATOR];
120120
$namespace = '';
121121
}
122122
if (\count($paths) > 1) {
123-
$rows[] = array('', '');
123+
$rows[] = ['', ''];
124124
$prevHasSeparator = true;
125125
} else {
126126
$prevHasSeparator = false;
@@ -130,18 +130,18 @@ protected function execute(InputInterface $input, OutputInterface $output)
130130
array_pop($rows);
131131
}
132132
$io->section('Loader Paths');
133-
$io->table(array('Namespace', 'Paths'), $rows);
133+
$io->table(['Namespace', 'Paths'], $rows);
134134

135135
return 0;
136136
}
137137

138138
private function getLoaderPaths()
139139
{
140140
if (!($loader = $this->twig->getLoader()) instanceof FilesystemLoader) {
141-
return array();
141+
return [];
142142
}
143143

144-
$loaderPaths = array();
144+
$loaderPaths = [];
145145
foreach ($loader->getNamespaces() as $namespace) {
146146
$paths = array_map(function ($path) {
147147
if (null !== $this->projectDir && 0 === strpos($path, $this->projectDir)) {

DataCollector/TwigDataCollector.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function reset()
5151
{
5252
$this->profile->reset();
5353
$this->computed = null;
54-
$this->data = array();
54+
$this->data = [];
5555
}
5656

5757
/**
@@ -60,7 +60,7 @@ public function reset()
6060
public function lateCollect()
6161
{
6262
$this->data['profile'] = serialize($this->profile);
63-
$this->data['template_paths'] = array();
63+
$this->data['template_paths'] = [];
6464

6565
if (null === $this->twig) {
6666
return;
@@ -122,23 +122,23 @@ public function getHtmlCallGraph()
122122
$dump = $dumper->dump($this->getProfile());
123123

124124
// needed to remove the hardcoded CSS styles
125-
$dump = str_replace(array(
125+
$dump = str_replace([
126126
'<span style="background-color: #ffd">',
127127
'<span style="color: #d44">',
128128
'<span style="background-color: #dfd">',
129-
), array(
129+
], [
130130
'<span class="status-warning">',
131131
'<span class="status-error">',
132132
'<span class="status-success">',
133-
), $dump);
133+
], $dump);
134134

135135
return new Markup($dump, 'UTF-8');
136136
}
137137

138138
public function getProfile()
139139
{
140140
if (null === $this->profile) {
141-
$this->profile = unserialize($this->data['profile'], array('allowed_classes' => array('Twig_Profiler_Profile', 'Twig\Profiler\Profile')));
141+
$this->profile = unserialize($this->data['profile'], ['allowed_classes' => ['Twig_Profiler_Profile', 'Twig\Profiler\Profile']]);
142142
}
143143

144144
return $this->profile;
@@ -155,13 +155,13 @@ private function getComputedData($index)
155155

156156
private function computeData(Profile $profile)
157157
{
158-
$data = array(
158+
$data = [
159159
'template_count' => 0,
160160
'block_count' => 0,
161161
'macro_count' => 0,
162-
);
162+
];
163163

164-
$templates = array();
164+
$templates = [];
165165
foreach ($profile as $p) {
166166
$d = $this->computeData($p);
167167

Extension/CsrfExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class CsrfExtension extends AbstractExtension
2525
*/
2626
public function getFunctions(): array
2727
{
28-
return array(
29-
new TwigFunction('csrf_token', array(CsrfRuntime::class, 'getCsrfToken')),
30-
);
28+
return [
29+
new TwigFunction('csrf_token', [CsrfRuntime::class, 'getCsrfToken']),
30+
];
3131
}
3232
}

Extension/FormExtension.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,51 +32,51 @@ class FormExtension extends AbstractExtension
3232
*/
3333
public function getTokenParsers()
3434
{
35-
return array(
35+
return [
3636
// {% form_theme form "SomeBundle::widgets.twig" %}
3737
new FormThemeTokenParser(),
38-
);
38+
];
3939
}
4040

4141
/**
4242
* {@inheritdoc}
4343
*/
4444
public function getFunctions()
4545
{
46-
return array(
47-
new TwigFunction('form_widget', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))),
48-
new TwigFunction('form_errors', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))),
49-
new TwigFunction('form_label', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))),
50-
new TwigFunction('form_help', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))),
51-
new TwigFunction('form_row', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))),
52-
new TwigFunction('form_rest', null, array('node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => array('html'))),
53-
new TwigFunction('form', null, array('node_class' => 'Symfony\Bridge\Twig\Node\RenderBlockNode', 'is_safe' => array('html'))),
54-
new TwigFunction('form_start', null, array('node_class' => 'Symfony\Bridge\Twig\Node\RenderBlockNode', 'is_safe' => array('html'))),
55-
new TwigFunction('form_end', null, array('node_class' => 'Symfony\Bridge\Twig\Node\RenderBlockNode', 'is_safe' => array('html'))),
56-
new TwigFunction('csrf_token', array('Symfony\Component\Form\FormRenderer', 'renderCsrfToken')),
57-
);
46+
return [
47+
new TwigFunction('form_widget', null, ['node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => ['html']]),
48+
new TwigFunction('form_errors', null, ['node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => ['html']]),
49+
new TwigFunction('form_label', null, ['node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => ['html']]),
50+
new TwigFunction('form_help', null, ['node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => ['html']]),
51+
new TwigFunction('form_row', null, ['node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => ['html']]),
52+
new TwigFunction('form_rest', null, ['node_class' => 'Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode', 'is_safe' => ['html']]),
53+
new TwigFunction('form', null, ['node_class' => 'Symfony\Bridge\Twig\Node\RenderBlockNode', 'is_safe' => ['html']]),
54+
new TwigFunction('form_start', null, ['node_class' => 'Symfony\Bridge\Twig\Node\RenderBlockNode', 'is_safe' => ['html']]),
55+
new TwigFunction('form_end', null, ['node_class' => 'Symfony\Bridge\Twig\Node\RenderBlockNode', 'is_safe' => ['html']]),
56+
new TwigFunction('csrf_token', ['Symfony\Component\Form\FormRenderer', 'renderCsrfToken']),
57+
];
5858
}
5959

6060
/**
6161
* {@inheritdoc}
6262
*/
6363
public function getFilters()
6464
{
65-
return array(
66-
new TwigFilter('humanize', array('Symfony\Component\Form\FormRenderer', 'humanize')),
67-
new TwigFilter('form_encode_currency', array('Symfony\Component\Form\FormRenderer', 'encodeCurrency'), array('is_safe' => array('html'), 'needs_environment' => true)),
68-
);
65+
return [
66+
new TwigFilter('humanize', ['Symfony\Component\Form\FormRenderer', 'humanize']),
67+
new TwigFilter('form_encode_currency', ['Symfony\Component\Form\FormRenderer', 'encodeCurrency'], ['is_safe' => ['html'], 'needs_environment' => true]),
68+
];
6969
}
7070

7171
/**
7272
* {@inheritdoc}
7373
*/
7474
public function getTests()
7575
{
76-
return array(
76+
return [
7777
new TwigTest('selectedchoice', 'Symfony\Bridge\Twig\Extension\twig_is_selected_choice'),
7878
new TwigTest('rootform', 'Symfony\Bridge\Twig\Extension\twig_is_root_form'),
79-
);
79+
];
8080
}
8181

8282
/**

Extension/WorkflowExtension.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ public function __construct(Registry $workflowRegistry)
3232

3333
public function getFunctions()
3434
{
35-
return array(
36-
new TwigFunction('workflow_can', array($this, 'canTransition')),
37-
new TwigFunction('workflow_transitions', array($this, 'getEnabledTransitions')),
38-
new TwigFunction('workflow_has_marked_place', array($this, 'hasMarkedPlace')),
39-
new TwigFunction('workflow_marked_places', array($this, 'getMarkedPlaces')),
40-
new TwigFunction('workflow_metadata', array($this, 'getMetadata')),
41-
);
35+
return [
36+
new TwigFunction('workflow_can', [$this, 'canTransition']),
37+
new TwigFunction('workflow_transitions', [$this, 'getEnabledTransitions']),
38+
new TwigFunction('workflow_has_marked_place', [$this, 'hasMarkedPlace']),
39+
new TwigFunction('workflow_marked_places', [$this, 'getMarkedPlaces']),
40+
new TwigFunction('workflow_metadata', [$this, 'getMetadata']),
41+
];
4242
}
4343

4444
/**

Form/TwigRendererEngine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(array $defaultThemes, Environment $environment)
4040
/**
4141
* {@inheritdoc}
4242
*/
43-
public function renderBlock(FormView $view, $resource, $blockName, array $variables = array())
43+
public function renderBlock(FormView $view, $resource, $blockName, array $variables = [])
4444
{
4545
$cacheKey = $view->vars[self::CACHE_KEY_VAR];
4646

@@ -169,7 +169,7 @@ protected function loadResourcesFromTheme($cacheKey, &$theme)
169169
// theme is a reference and we don't want to change it.
170170
$currentTheme = $theme;
171171

172-
$context = $this->environment->mergeGlobals(array());
172+
$context = $this->environment->mergeGlobals([]);
173173

174174
// The do loop takes care of template inheritance.
175175
// Add blocks from all templates in the inheritance tree, but avoid

Node/FormThemeNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class FormThemeNode extends Node
2222
{
2323
public function __construct(Node $form, Node $resources, int $lineno, string $tag = null, bool $only = false)
2424
{
25-
parent::__construct(array('form' => $form, 'resources' => $resources), array('only' => $only), $lineno, $tag);
25+
parent::__construct(['form' => $form, 'resources' => $resources], ['only' => $only], $lineno, $tag);
2626
}
2727

2828
public function compile(Compiler $compiler)

Tests/Command/LintCommandTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function testLintCorrectFile()
2828
$tester = $this->createCommandTester();
2929
$filename = $this->createFile('{{ foo }}');
3030

31-
$ret = $tester->execute(array('filename' => array($filename)), array('verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false));
31+
$ret = $tester->execute(['filename' => [$filename]], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE, 'decorated' => false]);
3232

3333
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
3434
$this->assertContains('OK in', trim($tester->getDisplay()));
@@ -39,7 +39,7 @@ public function testLintIncorrectFile()
3939
$tester = $this->createCommandTester();
4040
$filename = $this->createFile('{{ foo');
4141

42-
$ret = $tester->execute(array('filename' => array($filename)), array('decorated' => false));
42+
$ret = $tester->execute(['filename' => [$filename]], ['decorated' => false]);
4343

4444
$this->assertEquals(1, $ret, 'Returns 1 in case of error');
4545
$this->assertRegExp('/ERROR in \S+ \(line /', trim($tester->getDisplay()));
@@ -54,15 +54,15 @@ public function testLintFileNotReadable()
5454
$filename = $this->createFile('');
5555
unlink($filename);
5656

57-
$ret = $tester->execute(array('filename' => array($filename)), array('decorated' => false));
57+
$ret = $tester->execute(['filename' => [$filename]], ['decorated' => false]);
5858
}
5959

6060
public function testLintFileCompileTimeException()
6161
{
6262
$tester = $this->createCommandTester();
6363
$filename = $this->createFile("{{ 2|number_format(2, decimal_point='.', ',') }}");
6464

65-
$ret = $tester->execute(array('filename' => array($filename)), array('decorated' => false));
65+
$ret = $tester->execute(['filename' => [$filename]], ['decorated' => false]);
6666

6767
$this->assertEquals(1, $ret, 'Returns 1 in case of error');
6868
$this->assertRegExp('/ERROR in \S+ \(line /', trim($tester->getDisplay()));
@@ -97,7 +97,7 @@ private function createFile($content)
9797

9898
protected function setUp()
9999
{
100-
$this->files = array();
100+
$this->files = [];
101101
}
102102

103103
protected function tearDown()

Tests/Extension/AbstractBootstrap3LayoutTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ public function testLabelWithCustomTextAsOptionAndCustomAttributesPassedDirectly
105105

106106
public function testHelp()
107107
{
108-
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
108+
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, [
109109
'help' => 'Help text test!',
110-
));
110+
]);
111111
$view = $form->createView();
112112
$html = $this->renderHelp($view);
113113

Tests/Extension/AbstractBootstrap4HorizontalLayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public function testCheckboxRowWithHelp()
219219
{
220220
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType');
221221
$view = $form->createView();
222-
$html = $this->renderRow($view, array('label' => 'foo', 'help' => 'really helpful text'));
222+
$html = $this->renderRow($view, ['label' => 'foo', 'help' => 'really helpful text']);
223223

224224
$this->assertMatchesXpath($html,
225225
'/div

0 commit comments

Comments
 (0)