Skip to content

Commit 4e80425

Browse files
committed
AC-7098: Performance issue in TableNameSniff with big array
- updated rector/rector because its dependency phpstan/phpstan released 1.9 and caused build to fail
1 parent 097bda3 commit 4e80425

File tree

9 files changed

+51
-50
lines changed

9 files changed

+51
-50
lines changed

Magento2/Rector/Tests/AddArrayAccessInterfaceReturnTypes/AddArrayAccessInterfaceReturnTypesTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class AddArrayAccessInterfaceReturnTypesTest extends AbstractRectorTestCase
1616
/**
1717
* @dataProvider provideData()
1818
*/
19-
public function test(SmartFileInfo $fileInfo): void
19+
public function test(string $fileInfo): void
2020
{
21-
$this->doTestFileInfo($fileInfo);
21+
$this->doTestFile($fileInfo);
2222
}
2323

2424
/**

Magento2/Rector/Tests/ReplaceMbStrposNullLimit/ReplaceMbStrposNullLimitTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class ReplaceMbStrposNullLimitTest extends AbstractRectorTestCase
1616
/**
1717
* @dataProvider provideData()
1818
*/
19-
public function test(SmartFileInfo $fileInfo): void
19+
public function test(string $fileInfo): void
2020
{
21-
$this->doTestFileInfo($fileInfo);
21+
$this->doTestFile($fileInfo);
2222
}
2323

2424
/**

Magento2/Rector/Tests/ReplaceNewDateTimeNull/ReplaceNewDateTimeNullTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class ReplaceNewDateTimeNullTest extends AbstractRectorTestCase
1616
/**
1717
* @dataProvider provideData()
1818
*/
19-
public function test(SmartFileInfo $fileInfo): void
19+
public function test(string $fileInfo): void
2020
{
21-
$this->doTestFileInfo($fileInfo);
21+
$this->doTestFile($fileInfo);
2222
}
2323

2424
/**

Magento2/Rector/Tests/ReplacePregSplitNullLimit/ReplacePregSplitNullLimitTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class ReplacePregSplitNullLimitTest extends AbstractRectorTestCase
1616
/**
1717
* @dataProvider provideData()
1818
*/
19-
public function test(SmartFileInfo $fileInfo): void
19+
public function test(string $fileInfo): void
2020
{
21-
$this->doTestFileInfo($fileInfo);
21+
$this->doTestFile($fileInfo);
2222
}
2323

2424
/**

Magento2/Sniffs/Legacy/TableNameSniff.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,10 @@ private function checkOccurrencesInProperty(File $phpcsFile, int $stackPtr, arra
189189
private function checkOccurrencesInArray(File $phpcsFile, int $stackPtr, array $tokens): void
190190
{
191191
$aliasPos = $phpcsFile->findPrevious(
192-
T_CONSTANT_ENCAPSED_STRING,
193-
$stackPtr -1
192+
T_WHITESPACE,
193+
$stackPtr - 1,
194+
null,
195+
true,
194196
);
195197

196198
$alias = trim($tokens[$aliasPos]['content'], '\'"');

Magento2/Tests/Legacy/TableNameUnitTest.inc

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ $select = $connection->select()->from(
2828
['main_table' => 'magento_sample_table']
2929
);
3030

31+
$fooBar=array(0=>array(125,0,875,750),'33' =>array(85,0,194,716), 10 => 100);
32+
3133
class Collection extends \Magento\Sales\Model\ResourceModel\Report\Order\Collection
3234
{
3335
/**

Magento2/Tests/Legacy/TableNameUnitTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function getErrorList($testFile = '')
1919
7 => 1,
2020
16 => 1,
2121
20 => 1,
22-
38 => 1,
22+
40 => 1,
2323
];
2424
}
2525

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"ext-dom": "*",
1515
"phpcompatibility/php-compatibility": "^9.3",
1616
"squizlabs/php_codesniffer": "^3.6.1",
17-
"rector/rector": "^0.13.0"
17+
"rector/rector": "^0.14.8"
1818
},
1919
"require-dev": {
2020
"phpunit/phpunit": "^9.5.8"

composer.lock

+35-38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)