* 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\ClassNotation; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; use PhpCsFixer\WhitespacesFixerConfig; /** * @internal * * @covers \PhpCsFixer\Fixer\ClassNotation\MethodSeparationFixer */ final class MethodSeparationFixerTest extends AbstractFixerTestCase { /** * @param string $expected * @param null|string $input * * @dataProvider provideFixClassesCases */ public function testFixClasses($expected, $input = null) { $this->doTest($expected, $input); } public function provideFixClassesCases() { $cases = []; $cases[] = ['filter( function (\SplFileInfo $file) use ($files) { return !in_array($file->getRelativePathname(), $files, true); } ); } } private $a; public static function method145() { } abstract protected function method245(); // comment final private function method345() { } } function test1(){ echo 1;} function test2(){ echo 2;}', 'filter( function (\SplFileInfo $file) use ($files) { return !in_array($file->getRelativePathname(), $files, true); } ); } } private $a; public static function method145() { } abstract protected function method245(); // comment final private function method345() { } } function test1(){ echo 1;} function test2(){ echo 2;}', ]; $cases[] = [ ' * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\Linter; /** * Dummy linter. No linting is performed. No error is raised. * * @author Dariusz Rumiński * * @internal */ final class NullLinter implements LinterInterface { /** * {@inheritdoc} */ public function lintFile($path) { unset($path); } /** * {@inheritdoc} */ public function lintSource($source) { unset($source); } } ', ]; // do not touch anonymous functions (since PHP doesn't allow // for class attributes being functions :(, we only have to test // those used within methods) $cases[] = [ 'doTest($expected, $input); } public function provideFixTraitsCases() { $cases = []; // do not touch well formatted traits $cases[] = [ 'doTest($expected, $input); } public function provideFixInterfaceCases() { $cases = []; $cases[] = [ 'fixer->setWhitespacesConfig(new WhitespacesFixerConfig("\t", "\r\n")); $this->doTest($expected, $input); } public function provideMessyWhitespacesCases() { return [ [ "