Skip to content

Commit 5a852b3

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into less-class-naming-strpos
2 parents 1798cf4 + 5f4cb84 commit 5a852b3

File tree

13 files changed

+207
-77
lines changed

13 files changed

+207
-77
lines changed

.github/workflows/php.yml

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
php-version:
16-
- "7.3"
1716
- "7.4"
1817
- "8.0"
1918
- "8.1"

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/Commenting/ClassPropertyPHPDocFormattingSniff.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ class ClassPropertyPHPDocFormattingSniff extends AbstractVariableSniff
2929
T_NS_SEPARATOR,
3030
T_STRING,
3131
T_COMMENT,
32-
T_NULLABLE
32+
T_NULLABLE,
33+
T_BITWISE_AND,
34+
T_TYPE_UNION,
3335
];
3436

3537
/**

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/Sniffs/Less/ClassNamingSniff.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ public function process(File $phpcsFile, $stackPtr)
6767
);
6868
}
6969

70-
if (strlen($className) > 1 && strpos($className, self::STRING_HELPER_CLASSES_PREFIX, 2) !== false) {
70+
if (strlen($className) > 1 && strpos($className, self::STRING_HELPER_CLASSES_PREFIX, 2) !== false
71+
&& !str_starts_with($className, 'admin__')
72+
) {
7173
$phpcsFile->addError(
7274
'CSS class names should be separated with "-" (dash) instead of "_" (underscore)',
7375
$stackPtr,

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

Magento2/Tests/Less/ClassNamingUnitTest.less

+5
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,8 @@
3535
.a {
3636
text-decoration: none;
3737
}
38+
39+
// @see https://github.com/magento/magento-coding-standard/issues/409
40+
.admin__allowed {
41+
background: green;
42+
}

composer.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66
"AFL-3.0"
77
],
88
"type": "phpcodesniffer-standard",
9-
"version": "26",
9+
"version": "31",
1010
"require": {
11-
"php": ">=7.3",
12-
"webonyx/graphql-php": "^14.9",
11+
"php": ">=7.4",
12+
"webonyx/graphql-php": "^15.0",
1313
"ext-simplexml": "*",
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.15.10",
18+
"symfony/polyfill": "^1.16"
1819
},
1920
"require-dev": {
2021
"phpunit/phpunit": "^9.5.8"

0 commit comments

Comments
 (0)