* 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\LanguageConstruct; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @author Vladimir Reznichenko * * @internal * * @covers \PhpCsFixer\Fixer\LanguageConstruct\IsNullFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\LanguageConstruct\IsNullFixer> */ final class IsNullFixerTest extends AbstractFixerTestCase { /** * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } /** * @return iterable */ public static function provideFixCases(): iterable { $multiLinePatternToFix = <<<'FIX' is_null(json_decode($x));']; yield ['', "", ]; yield [ '', ]; // edge cases: is_null wrapped into a binary operations yield [ '', '', ]; yield [ '', '', ]; yield [ '', '', ]; yield [ '', '', ]; yield [ '', '', ]; yield [ '', '', ]; yield [ '', '', ]; yield [ '', '', ]; yield [ ' (null === $a)); ?>', ' is_null($a)); ?>', ]; yield [ ' false); ?>', ' false); ?>', ]; yield [ '', '', ]; // check with logical operator yield [ '', '', ]; yield [ '', '', ]; yield [ '', '', ]; yield [ '', '', ]; yield [ '', '', ]; yield [ '', '', ]; // edge cases: $isContainingDangerousConstructs, $wrapIntoParentheses yield [ '', '', ]; // edge cases: $isContainingDangerousConstructs, $wrapIntoParentheses yield [ 'doTest($expected, $input); } /** * @return iterable */ public static function provideFix81Cases(): iterable { yield 'first-class callable' => [ ' [ '