Skip to content

Commit a74a579

Browse files
committed
Utils/I18nTextDomainFixer: start using the PHPCSUtils FilePath utility
The `FilePath::getName()` method will strip quotes from the file name, as well as normalize the slashes to forward (*nix) slashes. This allows for a minor simplication in the code and improves code readability.
1 parent f09cf09 commit a74a579

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

WordPress/Sniffs/Utils/I18nTextDomainFixerSniff.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use PHP_CodeSniffer\Util\Tokens;
1313
use PHPCSUtils\BackCompat\Helper;
14+
use PHPCSUtils\Utils\FilePath;
1415
use PHPCSUtils\Utils\GetTokensAsString;
1516
use PHPCSUtils\Utils\PassedParameters;
1617
use PHPCSUtils\Utils\TextStrings;
@@ -675,7 +676,7 @@ public function process_comments( $stackPtr ) {
675676
$headers = $this->plugin_headers;
676677
$type = 'plugin';
677678

678-
$file = TextStrings::stripQuotes( $this->phpcsFile->getFileName() );
679+
$file = FilePath::getName( $this->phpcsFile );
679680
if ( 'STDIN' === $file ) {
680681
return;
681682
}

0 commit comments

Comments
 (0)