Skip to content

Commit c3ee22d

Browse files
committed
[TASK] Switch to short array syntax
1 parent c7e181c commit c3ee22d

15 files changed

Lines changed: 142 additions & 142 deletions

.php_cs.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ return PhpCsFixer\Config::create()
44
->setRules([
55
'@PSR2' => true,
66
'array_syntax' => [
7-
'syntax' => 'long',
7+
'syntax' => 'short',
88
],
99
'binary_operator_spaces' => true,
1010
'concat_space' => [

.styleci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ enabled:
77
- function_typehint_space
88
- hash_to_slash_comment
99
- linebreak_after_opening_tag
10-
- long_array_syntax
1110
- lowercase_cast
1211
- method_separation
1312
- native_function_casing
@@ -43,6 +42,7 @@ enabled:
4342
- phpdoc_scalar
4443
- phpdoc_types
4544
- self_accessor
45+
- short_array_syntax
4646
- short_scalar_cast
4747
- single_quote
4848
- standardize_not_equals

Classes/Configuration/RecordRenderingConfigurationBuilder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ public function configurationFor($extensionName, $pluginName, $contextRecord = '
4545
list($tableName, $uid) = $this->resolveTableNameAndUidFromContextString($contextRecord);
4646
$pluginSignature = $this->buildPluginSignature($extensionName, $pluginName);
4747
$renderingPath = $this->resolveRenderingPath($pluginSignature);
48-
return array(
48+
return [
4949
'record' => $tableName . '_' . $uid,
5050
'path' => $renderingPath,
51-
);
51+
];
5252
}
5353

5454
/**
@@ -68,11 +68,11 @@ protected function resolveTableNameAndUidFromContextString($contextRecord)
6868
}
6969

7070
if ($contextRecord === 'currentPage') {
71-
$tableNameAndUid = array('pages', $this->renderingContext->getFrontendController()->id);
71+
$tableNameAndUid = ['pages', $this->renderingContext->getFrontendController()->id];
7272
} else {
7373
$tableNameAndUid = explode(':', $contextRecord);
7474
if (count($tableNameAndUid) !== 2 || empty($tableNameAndUid[0]) || empty($tableNameAndUid[1]) || !MathUtility::canBeInterpretedAsInteger($tableNameAndUid[1])) {
75-
$tableNameAndUid = array('pages', $this->renderingContext->getFrontendController()->id);
75+
$tableNameAndUid = ['pages', $this->renderingContext->getFrontendController()->id];
7676
}
7777
}
7878
// TODO: maybe check if the record is available

Classes/Mvc/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Request
1818
/**
1919
* @var array
2020
*/
21-
protected $arguments = array();
21+
protected $arguments = [];
2222

2323
/**
2424
* @param array $arguments

Classes/Renderer/RecordRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function canRender(Request $request)
5757
*/
5858
protected function resolveRenderingConfiguration(Request $request, RenderingContext $renderingContext)
5959
{
60-
$configuration = array();
60+
$configuration = [];
6161

6262
if ($request->hasArgument('path')) {
6363
$renderingPath = $request->getArgument('path');

Classes/RenderingDispatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class RenderingDispatcher
4040
/**
4141
* @var string[]
4242
*/
43-
protected $renderer = array();
43+
protected $renderer = [];
4444

4545
/**
4646
* @param RequestBuilder $requestBuilder

Classes/ViewHelpers/Uri/AjaxActionViewHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class AjaxActionViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractView
5858
* @return string Rendered link
5959
*
6060
*/
61-
public function render($action = null, array $arguments = array(), $controller = null, $extensionName = null, $pluginName = null, $pageUid = null, $section = '', $format = '', $linkAccessRestrictedPages = false, array $additionalParams = array(), $absolute = false, $addQueryString = false, array $argumentsToBeExcludedFromQueryString = array(), $addQueryStringMethod = null, $contextRecord = 'current')
61+
public function render($action = null, array $arguments = [], $controller = null, $extensionName = null, $pluginName = null, $pageUid = null, $section = '', $format = '', $linkAccessRestrictedPages = false, array $additionalParams = [], $absolute = false, $addQueryString = false, array $argumentsToBeExcludedFromQueryString = [], $addQueryStringMethod = null, $contextRecord = 'current')
6262
{
6363
if ($pluginName === null) {
6464
$pluginName = $this->controllerContext->getRequest()->getPluginName();

Classes/ViewHelpers/Widget/LinkViewHelper.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function initializeArguments()
6262
* @return string The rendered link
6363
*
6464
*/
65-
public function render($pluginName, $extensionName, $action = null, array $arguments = array(), $section = '', $format = '', $ajax = true, $contextRecord = 'current')
65+
public function render($pluginName, $extensionName, $action = null, array $arguments = [], $section = '', $format = '', $ajax = true, $contextRecord = 'current')
6666
{
6767
if ($ajax === true) {
6868
$uri = $this->getAjaxUri();
@@ -86,7 +86,7 @@ protected function getAjaxUri()
8686
$pluginName = $this->arguments['pluginName'];
8787
$extensionName = $this->arguments['extensionName'];
8888
$contextRecord = $this->arguments['contextRecord'];
89-
$arguments = $this->hasArgument('arguments') ? $this->arguments['arguments'] : array();
89+
$arguments = $this->hasArgument('arguments') ? $this->arguments['arguments'] : [];
9090
if ($contextRecord === 'current') {
9191
if (
9292
$pluginName !== $this->controllerContext->getRequest()->getPluginName()
@@ -104,10 +104,10 @@ protected function getAjaxUri()
104104
$argumentPrefix = $this->controllerContext->getRequest()->getArgumentPrefix();
105105

106106
$uriBuilder->reset()
107-
->setArguments(array_merge(array($argumentPrefix => $arguments), $additionalParams))
107+
->setArguments(array_merge([$argumentPrefix => $arguments], $additionalParams))
108108
->setSection($this->arguments['section'])
109109
->setAddQueryString(true)
110-
->setArgumentsToBeExcludedFromQueryString(array($argumentPrefix, 'cHash'))
110+
->setArgumentsToBeExcludedFromQueryString([$argumentPrefix, 'cHash'])
111111
->setFormat($this->arguments['format'])
112112
->setUseCacheHash(true);
113113

@@ -128,7 +128,7 @@ protected function getWidgetUri()
128128
{
129129
$uriBuilder = $this->controllerContext->getUriBuilder();
130130
$argumentPrefix = $this->controllerContext->getRequest()->getArgumentPrefix();
131-
$arguments = $this->hasArgument('arguments') ? $this->arguments['arguments'] : array();
131+
$arguments = $this->hasArgument('arguments') ? $this->arguments['arguments'] : [];
132132
if ($this->hasArgument('action')) {
133133
$arguments['action'] = $this->arguments['action'];
134134
}
@@ -139,10 +139,10 @@ protected function getWidgetUri()
139139
$arguments['addQueryStringMethod'] = $this->arguments['addQueryStringMethod'];
140140
}
141141
$uriBuilder->reset()
142-
->setArguments(array($argumentPrefix => $arguments))
142+
->setArguments([$argumentPrefix => $arguments])
143143
->setSection($this->arguments['section'])
144144
->setAddQueryString(true)
145-
->setArgumentsToBeExcludedFromQueryString(array($argumentPrefix, 'cHash'))
145+
->setArgumentsToBeExcludedFromQueryString([$argumentPrefix, 'cHash'])
146146
->setFormat($this->arguments['format']);
147147

148148
// TYPO3 6.0 compatibility check:

Classes/ViewHelpers/Widget/UriViewHelper.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function initializeArguments()
5252
* @return string The rendered link
5353
*
5454
*/
55-
public function render($pluginName, $extensionName, $action = null, array $arguments = array(), $section = '', $format = '', $ajax = true, $contextRecord = 'current')
55+
public function render($pluginName, $extensionName, $action = null, array $arguments = [], $section = '', $format = '', $ajax = true, $contextRecord = 'current')
5656
{
5757
if ($ajax === true) {
5858
return $this->getAjaxUri();
@@ -72,7 +72,7 @@ protected function getAjaxUri()
7272
$pluginName = $this->arguments['pluginName'];
7373
$extensionName = $this->arguments['extensionName'];
7474
$contextRecord = $this->arguments['contextRecord'];
75-
$arguments = $this->hasArgument('arguments') ? $this->arguments['arguments'] : array();
75+
$arguments = $this->hasArgument('arguments') ? $this->arguments['arguments'] : [];
7676
if ($contextRecord === 'current') {
7777
if (
7878
$pluginName !== $this->controllerContext->getRequest()->getPluginName()
@@ -90,10 +90,10 @@ protected function getAjaxUri()
9090
$argumentPrefix = $this->controllerContext->getRequest()->getArgumentPrefix();
9191

9292
$uriBuilder->reset()
93-
->setArguments(array_merge(array($argumentPrefix => $arguments), $additionalParams))
93+
->setArguments(array_merge([$argumentPrefix => $arguments], $additionalParams))
9494
->setSection($this->arguments['section'])
9595
->setAddQueryString(true)
96-
->setArgumentsToBeExcludedFromQueryString(array($argumentPrefix, 'cHash'))
96+
->setArgumentsToBeExcludedFromQueryString([$argumentPrefix, 'cHash'])
9797
->setFormat($this->arguments['format'])
9898
->setUseCacheHash(true);
9999

@@ -114,7 +114,7 @@ protected function getWidgetUri()
114114
{
115115
$uriBuilder = $this->controllerContext->getUriBuilder();
116116
$argumentPrefix = $this->controllerContext->getRequest()->getArgumentPrefix();
117-
$arguments = $this->hasArgument('arguments') ? $this->arguments['arguments'] : array();
117+
$arguments = $this->hasArgument('arguments') ? $this->arguments['arguments'] : [];
118118
if ($this->hasArgument('action')) {
119119
$arguments['action'] = $this->arguments['action'];
120120
}
@@ -125,10 +125,10 @@ protected function getWidgetUri()
125125
$arguments['addQueryStringMethod'] = $this->arguments['addQueryStringMethod'];
126126
}
127127
$uriBuilder->reset()
128-
->setArguments(array($argumentPrefix => $arguments))
128+
->setArguments([$argumentPrefix => $arguments])
129129
->setSection($this->arguments['section'])
130130
->setAddQueryString(true)
131-
->setArgumentsToBeExcludedFromQueryString(array($argumentPrefix, 'cHash'))
131+
->setArgumentsToBeExcludedFromQueryString([$argumentPrefix, 'cHash'])
132132
->setFormat($this->arguments['format']);
133133

134134
// TYPO3 6.0 compatibility check:

Tests/Functional/AbstractRenderingTestCase.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ abstract class AbstractRenderingTestCase extends FunctionalTestCase
2626
/**
2727
* @var string[]
2828
*/
29-
protected $testExtensionsToLoad = array('typo3conf/ext/typoscript_rendering');
29+
protected $testExtensionsToLoad = ['typo3conf/ext/typoscript_rendering'];
3030

3131
/**
3232
* @var string[]
3333
*/
34-
protected $coreExtensionsToLoad = array('fluid');
34+
protected $coreExtensionsToLoad = ['fluid'];
3535

3636
public function setUp()
3737
{
3838
parent::setUp();
3939
$this->importDataSet(__DIR__ . '/Fixtures/Database/pages.xml');
40-
$this->setUpFrontendRootPage(1, array('EXT:typoscript_rendering/Tests/Functional/Fixtures/Frontend/Basic.ts'));
40+
$this->setUpFrontendRootPage(1, ['EXT:typoscript_rendering/Tests/Functional/Fixtures/Frontend/Basic.ts']);
4141
}
4242

4343
/* ***********************************************
@@ -53,7 +53,7 @@ public function setUp()
5353
*/
5454
protected function getRenderUrl($pageId, $languageId, $path)
5555
{
56-
$requestArguments = array('id' => $pageId, 'L' => $languageId, 'path' => $path);
56+
$requestArguments = ['id' => $pageId, 'L' => $languageId, 'path' => $path];
5757
return $this->fetchFrontendResponse($requestArguments)->getContent();
5858
}
5959

@@ -71,18 +71,18 @@ protected function fetchFrontendResponse(array $requestArguments, $failOnFailure
7171
$requestUrl = '/?' . GeneralUtility::implodeArrayForUrl('', $requestArguments);
7272
}
7373

74-
$arguments = array(
74+
$arguments = [
7575
'documentRoot' => $this->getInstancePath(),
7676
'requestUrl' => 'http://localhost' . $requestUrl,
77-
);
77+
];
7878

7979
$template = new \Text_Template('ntf://Frontend/Request.tpl');
8080
$template->setVar(
81-
array(
81+
[
8282
'arguments' => var_export($arguments, true),
8383
'originalRoot' => ORIGINAL_ROOT,
8484
'ntfRoot' => __DIR__ . '/../../.Build/vendor/nimut/testing-framework/',
85-
)
85+
]
8686
);
8787

8888
if (class_exists('PHPUnit_Util_PHP')) {

0 commit comments

Comments
 (0)