Skip to content

Commit a73bafe

Browse files
committed
Respect basepath configuration option in output
1 parent c688fd3 commit a73bafe

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

Magento2/Sniffs/Legacy/InstallUpgradeSniff.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use PHP_CodeSniffer\Files\File;
1313
use PHP_CodeSniffer\Sniffs\Sniff;
14+
use PHP_CodeSniffer\Util\Common;
1415
use SplFileInfo;
1516

1617
class InstallUpgradeSniff implements Sniff
@@ -108,7 +109,7 @@ public function process(File $phpcsFile, $stackPtr)
108109
self::INVALID_DIRECTORIES_ERROR_CODES[$folderName],
109110
[
110111
$fileInfo->getFilename(),
111-
$fileInfo->getPath(),
112+
Common::stripBasepath($fileInfo->getPath(), $phpcsFile->config->basepath),
112113
]
113114
);
114115
}

Magento2/Sniffs/Legacy/ParseXMLTrait.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use DOMDocument;
1111
use PHP_CodeSniffer\Files\File;
12+
use PHP_CodeSniffer\Util\Common;
1213

1314
trait ParseXMLTrait
1415
{
@@ -32,7 +33,7 @@ private function getFormattedXML(File $phpcsFile)
3233
0,
3334
'WrongXML',
3435
[
35-
$phpcsFile->getFilename(),
36+
Common::stripBasepath($phpcsFile->getFilename(), $phpcsFile->config->basepath),
3637
]
3738
);
3839
return false;

Magento2/Sniffs/Legacy/RestrictedCodeSniff.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use PHP_CodeSniffer\Files\File;
1313
use PHP_CodeSniffer\Sniffs\Sniff;
14+
use PHP_CodeSniffer\Util\Common;
1415

1516
/**
1617
* Tests to find usage of restricted code
@@ -76,7 +77,7 @@ public function process(File $phpcsFile, $stackPtr)
7677
$this->classes[$token]['warning_code'],
7778
[
7879
$token,
79-
$phpcsFile->getFilename(),
80+
Common::stripBasepath($phpcsFile->getFilename(), $phpcsFile->config->basepath),
8081
$this->classes[$token]['replacement'],
8182
]
8283
);

0 commit comments

Comments
 (0)