Skip to content

Commit 57177db

Browse files
author
Leandro Ferraz Luvisotto
committed
Array short syntax
1 parent cc4b174 commit 57177db

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

app/code/Magento/Catalog/Test/Unit/Model/ProductTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,11 +631,11 @@ public function testReindex($productChanged, $isScheduled, $productFlatCount, $c
631631
*/
632632
public function getProductReindexProvider()
633633
{
634-
return array(
634+
return [
635635
'set 1' => [true, false, 1, 1],
636636
'set 2' => [true, true, 1, 0],
637637
'set 3' => [false, false, 1, 0]
638-
);
638+
];
639639
}
640640

641641
public function testPriceReindexCallback()

app/code/Magento/GroupedProduct/Test/Unit/Model/ProductTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ public function testGetProductLinks()
324324
$reflectionOfExtension = new \ReflectionClass(\Magento\Catalog\Api\Data\ProductLinkExtension::class);
325325
$method = $reflectionOfExtension->getMethod('setData');
326326
$method->setAccessible(true);
327-
$method->invokeArgs($groupExtension, array('qty', 1));
327+
$method->invokeArgs($groupExtension, ['qty', 1]);
328328

329329
$outputGroupLink = $this->objectManagerHelper->getObject(\Magento\Catalog\Model\ProductLink\Link::class);
330330
$outputGroupLink->setProductSku("Simple Product 1");

setup/src/Magento/Setup/Module/Di/Code/Reader/FileScanner.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected function scan()
9292
$MACRO_DOC_COMMENT_VALIDATE = function () use (&$docCommentIndex) {
9393
static $validTrailingTokens = null;
9494
if ($validTrailingTokens === null) {
95-
$validTrailingTokens = array(T_WHITESPACE, T_FINAL, T_ABSTRACT, T_INTERFACE, T_CLASS, T_FUNCTION);
95+
$validTrailingTokens = [T_WHITESPACE, T_FINAL, T_ABSTRACT, T_INTERFACE, T_CLASS, T_FUNCTION];
9696
}
9797
if ($docCommentIndex !== false && !in_array($this->tokenType, $validTrailingTokens)) {
9898
$docCommentIndex = false;
@@ -134,14 +134,14 @@ protected function scan()
134134

135135
case T_NAMESPACE:
136136

137-
$infos[$infoIndex] = array(
137+
$infos[$infoIndex] = [
138138
'type' => 'namespace',
139139
'tokenStart' => $MACRO_TOKEN_LOGICAL_START_INDEX(),
140140
'tokenEnd' => null,
141141
'lineStart' => $token[2],
142142
'lineEnd' => null,
143143
'namespace' => null,
144-
);
144+
];
145145

146146
// start processing with next token
147147
if ($MACRO_TOKEN_ADVANCE() === false) {
@@ -179,16 +179,15 @@ protected function scan()
179179

180180
case T_USE:
181181

182-
$infos[$infoIndex] = array(
182+
$infos[$infoIndex] = [
183183
'type' => 'use',
184184
'tokenStart' => $MACRO_TOKEN_LOGICAL_START_INDEX(),
185185
'tokenEnd' => null,
186186
'lineStart' => $tokens[$tokenIndex][2],
187187
'lineEnd' => null,
188188
'namespace' => $namespace,
189-
'statements' => array(0 => array('use' => null,
190-
'as' => null)),
191-
);
189+
'statements' => [0 => ['use' => null, 'as' => null]],
190+
];
192191

193192
$useStatementIndex = 0;
194193
$useAsContext = false;
@@ -206,8 +205,7 @@ protected function scan()
206205
} elseif ($tokenContent === ',') {
207206
$useAsContext = false;
208207
$useStatementIndex++;
209-
$infos[$infoIndex]['statements'][$useStatementIndex] = array('use' => null,
210-
'as' => null);
208+
$infos[$infoIndex]['statements'][$useStatementIndex] = ['use' => null, 'as' => null];
211209
}
212210
}
213211

@@ -246,22 +244,22 @@ protected function scan()
246244
case T_REQUIRE_ONCE:
247245

248246
// Static for performance
249-
static $includeTypes = array(
247+
static $includeTypes = [
250248
T_INCLUDE => 'include',
251249
T_INCLUDE_ONCE => 'include_once',
252250
T_REQUIRE => 'require',
253251
T_REQUIRE_ONCE => 'require_once'
254-
);
252+
];
255253

256-
$infos[$infoIndex] = array(
254+
$infos[$infoIndex] = [
257255
'type' => 'include',
258256
'tokenStart' => $MACRO_TOKEN_LOGICAL_START_INDEX(),
259257
'tokenEnd' => null,
260258
'lineStart' => $tokens[$tokenIndex][2],
261259
'lineEnd' => null,
262260
'includeType' => $includeTypes[$tokens[$tokenIndex][0]],
263261
'path' => '',
264-
);
262+
];
265263

266264
// start processing with next token
267265
if ($MACRO_TOKEN_ADVANCE() === false) {
@@ -296,7 +294,7 @@ protected function scan()
296294
case T_INTERFACE:
297295
case T_TRAIT:
298296

299-
$infos[$infoIndex] = array(
297+
$infos[$infoIndex] = [
300298
'type' => ($this->tokenType === T_FUNCTION) ? 'function' : 'class',
301299
'tokenStart' => $MACRO_TOKEN_LOGICAL_START_INDEX(),
302300
'tokenEnd' => null,
@@ -306,7 +304,7 @@ protected function scan()
306304
'uses' => $this->getUsesNoScan($namespace),
307305
'name' => null,
308306
'shortName' => null,
309-
);
307+
];
310308

311309
$classBraceCount = 0;
312310

0 commit comments

Comments
 (0)