Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 252371e

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into auto-fix/remove-useless-comments
2 parents 5936239 + bc6b0f6 commit 252371e

15 files changed

+186
-26
lines changed

‎Magento2/Sniffs/Commenting/ClassAndInterfacePHPDocFormattingSniff.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class ClassAndInterfacePHPDocFormattingSniff implements Sniff
2424
* @var string[] List of tags that can not be used in comments
2525
*/
2626
public $forbiddenTags = [
27+
'@author',
2728
'@category',
2829
'@package',
2930
'@subpackage'

‎Magento2/Sniffs/Less/ClassNamingSniff.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ public function process(File $phpcsFile, $stackPtr)
6666
[implode("", $matches[0])]
6767
);
6868
}
69-
if (strpos($className, self::STRING_HELPER_CLASSES_PREFIX, 2) !== false) {
69+
70+
if (strlen($className) > 1 && strpos($className, self::STRING_HELPER_CLASSES_PREFIX, 2) !== false
71+
&& !str_starts_with($className, 'admin__')
72+
) {
7073
$phpcsFile->addError(
7174
'CSS class names should be separated with "-" (dash) instead of "_" (underscore)',
7275
$stackPtr,

‎Magento2/Sniffs/PHP/ShortEchoSyntaxSniff.php‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,30 @@ public function process(File $phpcsFile, $stackPtr)
3737

3838
$nextToken = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true);
3939
if ($tokens[$nextToken]['code'] == T_ECHO) {
40-
$phpcsFile->addWarning(
40+
$fix = $phpcsFile->addFixableWarning(
4141
'Short echo tag syntax must be used; expected "<?=" but found "<?php echo"',
4242
$stackPtr,
4343
'ShortEchoTag'
4444
);
45+
46+
if ($fix) {
47+
$phpcsFile->fixer->beginChangeset();
48+
49+
if (($nextToken - $stackPtr) === 1) {
50+
$phpcsFile->fixer->replaceToken($stackPtr, '<?=');
51+
} else {
52+
$phpcsFile->fixer->replaceToken($stackPtr, '<?= ');
53+
}
54+
55+
for ($i = $stackPtr + 1; $i < $nextToken; $i++) {
56+
if ($tokens[$i]['code'] === T_WHITESPACE) {
57+
$phpcsFile->fixer->replaceToken($i, '');
58+
}
59+
}
60+
61+
$phpcsFile->fixer->replaceToken($nextToken, '');
62+
$phpcsFile->fixer->endChangeset();
63+
}
4564
}
4665
}
4766
}

‎Magento2/Sniffs/Security/XssTemplateSniff.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ public function process(File $phpcsFile, $stackPtr)
135135
$statement = array_shift($this->statements);
136136
$this->detectUnescapedString($statement);
137137
}
138+
$this->hasDisallowedAnnotation = false;
138139
}
139140

140141
/**

‎Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.1.inc‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ class EmptyHandler
6060
* @api is ok here
6161
* @deprecated can be used in this context
6262
* @see is ok here
63-
* @author is actually ok
63+
* @author should not be used
6464
* @category is irrelevant
65-
* @package is not ment to be used
65+
* @package should not be used
6666
* @subpackage does not belong here
6767
*/
6868
class ExampleHandler

‎Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.1.inc.fixed‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class EmptyHandler
4444
* @api is ok here
4545
* @deprecated can be used in this context
4646
* @see is ok here
47-
* @author is actually ok
4847
*/
4948
class ExampleHandler
5049
{

‎Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.2.inc‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ interface EmptyHandler
6060
* @api is ok here
6161
* @deprecated can be used in this context
6262
* @see is ok here
63-
* @author is actually ok
63+
* @author should not be used
6464
* @category is irrelevant
65-
* @package is not ment to be used
65+
* @package should not be used
6666
* @subpackage does not belong here
6767
*/
6868
interface ExampleHandler

‎Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.2.inc.fixed‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ interface EmptyHandler
4444
* @api is ok here
4545
* @deprecated can be used in this context
4646
* @see is ok here
47-
* @author is actually ok
4847
*/
4948
interface ExampleHandler
5049
{

‎Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public function getWarningList($testFile = '')
2929
35 => 1,
3030
44 => 1,
3131
52 => 1,
32+
63 => 1,
3233
64 => 1,
3334
65 => 1,
3435
66 => 1,

‎Magento2/Tests/Less/ClassNamingUnitTest.less‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,13 @@
3030
.category-title {
3131
background: green;
3232
}
33+
34+
// @see https://github.com/magento/magento-coding-standard/issues/425
35+
.a {
36+
text-decoration: none;
37+
}
38+
39+
// @see https://github.com/magento/magento-coding-standard/issues/409
40+
.admin__allowed {
41+
background: green;
42+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /