Skip to content

Commit

Permalink
Respect basepath configuration option in output
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden committed Jul 3, 2023
1 parent ffd3fb4 commit 9c2ac84
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Magento2/Sniffs/Legacy/InstallUpgradeSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Common;
use SplFileInfo;

class InstallUpgradeSniff implements Sniff
Expand Down Expand Up @@ -108,7 +109,7 @@ public function process(File $phpcsFile, $stackPtr)
self::INVALID_DIRECTORIES_ERROR_CODES[$folderName],
[
$fileInfo->getFilename(),
$fileInfo->getPath(),
Common::stripBasepath($fileInfo->getPath(), $phpcsFile->config->basepath),
]
);
}
Expand Down
3 changes: 2 additions & 1 deletion Magento2/Sniffs/Legacy/ParseXMLTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use DOMDocument;
use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Util\Common;

trait ParseXMLTrait
{
Expand All @@ -34,7 +35,7 @@ private function getFormattedXML(File $phpcsFile)
0,
self::ERROR_CODE_XML,
[
$phpcsFile->getFilename(),
Common::stripBasepath($phpcsFile->getFilename(), $phpcsFile->config->basepath),
]
);
return false;
Expand Down
3 changes: 2 additions & 1 deletion Magento2/Sniffs/Legacy/RestrictedCodeSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Util\Common;

/**
* Tests to find usage of restricted code
Expand Down Expand Up @@ -76,7 +77,7 @@ public function process(File $phpcsFile, $stackPtr)
$this->classes[$token]['warning_code'],
[
$token,
$phpcsFile->getFilename(),
Common::stripBasepath($phpcsFile->getFilename(), $phpcsFile->config->basepath),
$this->classes[$token]['replacement'],
]
);
Expand Down

0 comments on commit 9c2ac84

Please sign in to comment.