Skip to content

Commit 7a6f29f

Browse files
committed
AC-666: Create phpcs static check for CopyrightTest
1 parent f4b0117 commit 7a6f29f

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

Magento2/Sniffs/Legacy/CopyrightSniff.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ public function process(File $phpcsFile, $stackPtr)
3737
$contentFile = $phpcsFile->getTokens()[$positionComment]['content'];
3838
$adobeCopyrightFound = preg_match(self::COPYRIGHT_ADOBE, $contentFile);
3939

40-
if (strpos($contentFile, self::COPYRIGHT_MAGENTO_TEXT) === false || $adobeCopyrightFound === false) {
40+
if (strpos($contentFile, self::COPYRIGHT_MAGENTO_TEXT) !== false || $adobeCopyrightFound) {
41+
return;
42+
} else {
4143
$phpcsFile->addWarningOnLine(
4244
'Copyright is missing or has wrong format',
4345
$phpcsFile->getTokens()[$positionComment]['line'],
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
/**
3+
* Copyright 2020 Adobe
4+
* See COPYING.txt for license details.
5+
*/
6+
7+

Magento2/Tests/Legacy/CopyrightUnitTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function getErrorList(): array
2222
*/
2323
public function getWarningList($testFile = ''): array
2424
{
25-
if ($testFile === 'CopyrightUnitTest.4.inc') {
25+
if ($testFile === 'CopyrightUnitTest.4.inc' || $testFile === 'CopyrightUnitTest.5.inc') {
2626
return [];
2727
}
2828

@@ -31,7 +31,7 @@ public function getWarningList($testFile = ''): array
3131
1 => 1,
3232
];
3333
}
34-
if ($testFile === 'CopyrightUnitTest.2.inc' || 'CopyrightUnitTest.3.inc') {
34+
if ($testFile === 'CopyrightUnitTest.2.inc' || $testFile === 'CopyrightUnitTest.3.inc') {
3535
return [
3636
3 => 1,
3737
];

0 commit comments

Comments
 (0)