* 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\Semicolon; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @author John Kelly * @author Graham Campbell * @author Dariusz Rumiński * * @internal * * @covers \PhpCsFixer\Fixer\Semicolon\NoSinglelineWhitespaceBeforeSemicolonsFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Semicolon\NoSinglelineWhitespaceBeforeSemicolonsFixer> */ final class NoSinglelineWhitespaceBeforeSemicolonsFixerTest extends AbstractFixerTestCase { /** * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } /** * @return iterable */ public static function provideFixCases(): iterable { yield [ 'setName(\'readme1\') ->setDescription(\'Generates the README content, based on the fix command help\') ;', ]; yield [ 'setName(\'readme2\') ->setDescription(\'Generates the README content, based on the fix command help\') ;', ]; yield [ 'foo(\'with param containing ;\') ;";', 'foo(\'with param containing ;\') ;" ;', ]; yield [ 'foo();', 'foo() ;', ]; yield [ 'foo(\'with param containing ;\');', 'foo(\'with param containing ;\') ;', ]; yield [ 'foo(\'with param containing ) ; \');', 'foo(\'with param containing ) ; \') ;', ]; yield [ 'foo("with param containing ) ; ");', 'foo("with param containing ) ; ") ;', ]; yield [ 'bar(1) ->baz(2) ;', ]; yield [ 'bar(1) //->baz(2) ;', ]; yield [ 'foo("with semicolon in string) ; ");', ]; } }