Skip to content

Commit

Permalink
Files/TestDoubles: use PHPCSUtils in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed Nov 19, 2023
1 parent f5b49d8 commit f07d449
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Yoast/Sniffs/Files/TestDoublesSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Sniffs\Sniff;
use PHPCSUtils\Utils\ObjectDeclarations;
use PHPCSUtils\Utils\TextStrings;

/**
* Check that all mock/doubles classes are in a `doubles` directory.
Expand Down Expand Up @@ -72,7 +73,7 @@ public function register() {
*/
public function process( File $phpcsFile, $stackPtr ) {
// Stripping potential quotes to ensure `stdin_path` passed by IDEs does not include quotes.
$file = \preg_replace( '`^([\'"])(.*)\1$`Ds', '$2', $phpcsFile->getFileName() );
$file = TextStrings::stripQuotes( $phpcsFile->getFileName() );

if ( $file === 'STDIN' ) {
return; // @codeCoverageIgnore
Expand Down

0 comments on commit f07d449

Please sign in to comment.