* 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\CastNotation; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @internal * * @covers \PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer> */ final class ShortScalarCastFixerTest extends AbstractFixerTestCase { /** * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } /** * @return iterable */ public static function provideFixCases(): iterable { foreach (['boolean' => 'bool', 'integer' => 'int', 'double' => 'float', 'binary' => 'string'] as $from => $to) { yield from self::createCasesFor($from, $to); } $types = ['string', 'array', 'object']; foreach ($types as $cast) { yield [\sprintf('doTest($expected, $input); } /** * @return iterable */ public static function provideFixPre80Cases(): iterable { yield ['expectDeprecation('The (real) cast is deprecated, use (float) instead'); $this->doTest($expected, $input); } /** * @return iterable */ public static function provideFix74DeprecatedCases(): iterable { yield from self::createCasesFor('real', 'float'); } /** * @return iterable */ private static function createCasesFor(string $from, string $to): iterable { yield [ \sprintf('