* 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\Tokenizer\Analyzer; use PhpCsFixer\Tests\TestCase; use PhpCsFixer\Tokenizer\Analyzer\WhitespacesAnalyzer; use PhpCsFixer\Tokenizer\Tokens; /** * @internal * * @covers \PhpCsFixer\Tokenizer\Analyzer\WhitespacesAnalyzer */ final class WhitespacesAnalyzerTest extends TestCase { /** * @dataProvider provideIndentCases */ public function testIndent(string $code, string $indent, int $index): void { $tokens = Tokens::fromCode($code); self::assertSame($indent, WhitespacesAnalyzer::detectIndent($tokens, $index)); } /** * @return iterable */ public static function provideIndentCases(): iterable { yield ['count() - 2) as $index) { yield [$code, ' ', $index]; } } }