Skip to content

Commit 67926bd

Browse files
authored
Merge pull request #80 from magento-commerce/imported-magento-magento-coding-standard-292
[Imported] Version 12 master update
2 parents 17f55d9 + b2cea3a commit 67926bd

File tree

7 files changed

+18
-4
lines changed

7 files changed

+18
-4
lines changed

Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,17 @@ public function processMemberVar(File $phpcsFile, $stackPtr)
5757
$tokens = $phpcsFile->getTokens();
5858

5959
$commentEnd = $phpcsFile->findPrevious($this->ignoreTokens, ($stackPtr - 1), null, true);
60-
if ($commentEnd === false
60+
61+
if ($commentEnd !== false && $tokens[$commentEnd]['code'] === T_STRING) {
62+
$commentEnd = $phpcsFile->findPrevious($this->ignoreTokens, ($commentEnd - 1), null, true);
63+
} elseif ($commentEnd === false
6164
|| ($tokens[$commentEnd]['code'] !== T_DOC_COMMENT_CLOSE_TAG
6265
&& $tokens[$commentEnd]['code'] !== T_COMMENT)
6366
) {
6467
$phpcsFile->addWarning('Missing PHP DocBlock for class property.', $stackPtr, 'Missing');
6568
return;
6669
}
70+
6771
$commentStart = $tokens[$commentEnd]['comment_opener'];
6872
$foundVar = null;
6973
foreach ($tokens[$commentStart]['comment_tags'] as $tag) {

Magento2/Sniffs/Legacy/InstallUpgradeSniff.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ public function process(File $phpcsFile, $stackPtr)
6464
}
6565
}
6666

67-
if (preg_match('/(sql|data)/', $fileInfo->getPath()) === 1) {
67+
$folders = array_filter(explode('/', $fileInfo->getPath()));
68+
$folderName = array_pop($folders);
69+
70+
if ($folderName === 'data' || $folderName === 'sql') {
6871
$phpcsFile->addError(
6972
$fileInfo->getFilename()." is in an invalid directory ".$fileInfo->getPath().":\n"
7073
. "- Create a data patch within module's Setup/Patch/Data folder for data upgrades.\n"

Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc

+5
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,9 @@ class correctlyFormattedClassMemberDocBlock
120120
* @var test
121121
*/
122122
protected $test;
123+
124+
/**
125+
* @var string
126+
*/
127+
protected string $test;
123128
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"AFL-3.0"
77
],
88
"type": "phpcodesniffer-standard",
9-
"version": "11",
9+
"version": "12",
1010
"require": {
1111
"php": ">=7.3",
1212
"squizlabs/php_codesniffer": "^3.6",

composer.lock

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

0 commit comments

Comments
 (0)