* Dariusz RumiƄski * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\Tests\Fixer\StringNotation; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @author Filippo Tessarotto * @author Michael Vorisek * * @internal * * @covers \PhpCsFixer\Fixer\StringNotation\StringImplicitBackslashesFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\StringNotation\StringImplicitBackslashesFixer> * * @phpstan-import-type _AutogeneratedInputConfiguration from \PhpCsFixer\Fixer\StringNotation\StringImplicitBackslashesFixer */ final class StringImplicitBackslashesFixerTest extends AbstractFixerTestCase { /** * @param _AutogeneratedInputConfiguration $configuration * * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null, array $configuration = []): void { $this->fixer->configure($configuration); $this->doTest($expected, $input); } /** * @return iterable}> */ public static function provideFixCases(): iterable { yield [ <<<'EOD' 'escape'], ]; yield [ <<<'EOD' 'unescape'], ]; yield [ <<<'EOD' 'unescape'], ]; yield [ <<<'EOD' 'escape'], ]; yield [ <<<'EOD' 'unescape'], ]; yield [ <<<'EOD' 'unescape'], ]; yield [ <<<'EOD' 'escape'], ]; yield [ <<<'EOD' 'unescape'], ]; yield [ <<<'EOD' 'unescape'], ]; yield [ <<<'EOD' 'escape'], ]; yield [ <<<'EOD' [ <<<'EOD' [ <<<'EOD' [ <<<'EOD' [ <<<'EOD' 'unescape'], ]; yield 'unescaped backslashes in double quoted string - reserved chars' => [ <<<'EOD' 'unescape'], ]; yield 'unescaped backslashes in heredoc - backslash' => [ <<<'EOD_' 'unescape'], ]; yield 'unescaped backslashes in heredoc - reserved single quote' => [ <<<'EOD_' 'unescape'], ]; yield 'unescaped backslashes in heredoc - reserved double quote' => [ <<<'EOD_' 'unescape'], ]; yield 'unescaped backslashes in heredoc - reserved chars' => [ <<<'EOD_' 'unescape'], ]; yield 'ignored mixed implicit backslashes in single quoted string' => [ <<<'EOD' 'ignore'], ]; yield 'ignored mixed implicit backslashes in double quoted string' => [ <<<'EOD' 'ignore'], ]; yield 'ignored mixed implicit backslashes in heredoc' => [ <<<'EOD' 'ignore'], ]; } }