* 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\Phpdoc; use PhpCsFixer\Test\AbstractFixerTestCase; /** * @author Ceeram * * @internal * * @covers \PhpCsFixer\Fixer\Phpdoc\PhpdocToCommentFixer */ final class PhpdocToCommentFixerTest extends AbstractFixerTestCase { /** * @param string $expected * @param null|string $input * * @dataProvider provideDocblocks */ public function testFix($expected, $input = null) { $this->doTest($expected, $input); } /** * @param string $expected * @param null|string $input * * @requires PHP 5.4 * @dataProvider provideTraits */ public function testFixTraits($expected, $input = null) { $this->doTest($expected, $input); } public function provideDocblocks() { $cases = array(); $cases[] = array( 'open($path); }', ); $cases[] = array( ' $sqlite) { $sqlite->open($path); }', ); $cases[] = array( ' $sqlite) { $sqlite->open($path); }', ); $cases[] = array( ' $sqlite) { $sqlite->open($path); }', ' $sqlite) { $sqlite->open($path); }', ); $cases[] = array( 'open($path); ', 'open($path); ', ); $cases[] = array( 'getPairs($c->bar(), $bar) as $index => list($a, $b)) { // Do something with $index, $a and $b } /** @var \Closure $value */ if (!$value = $this->getValue()) { return false; } /** @var string $name */ switch ($name = $this->getName()) { case "John": return false; case "Jane": return true; } /** @var string $content */ while ($content = $this->getContent()) { $name .= $content; } /** @var int $size */ for($i = 0, $size = count($people); $i < $size; ++$i) { $people[$i][\'salt\'] = mt_rand(000000, 999999); }', ); $cases[] = array( 'getPairs($c->bar(), $bar) as $index => list($a, $b)) { // Do something with $index, $a and $b } /* @var \Closure $notValue */ if (!$value = $this->getValue()) { return false; } /* @var string $notName */ switch ($name = $this->getName()) { case "John": return false; case "Jane": return true; } /* @var string $notContent */ while ($content = $this->getContent()) { $name .= $content; } /* @var int $notSize */ for($i = 0, $size = count($people); $i < $size; ++$i) { $people[$i][\'salt\'] = mt_rand(000000, 999999); }', 'getPairs($c->bar(), $bar) as $index => list($a, $b)) { // Do something with $index, $a and $b } /** @var \Closure $notValue */ if (!$value = $this->getValue()) { return false; } /** @var string $notName */ switch ($name = $this->getName()) { case "John": return false; case "Jane": return true; } /** @var string $notContent */ while ($content = $this->getContent()) { $name .= $content; } /** @var int $notSize */ for($i = 0, $size = count($people); $i < $size; ++$i) { $people[$i][\'salt\'] = mt_rand(000000, 999999); }', ); $cases[] = array( 'doTest($expected, $input); } public function provideCases71() { return array( array( '