123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- /*
- * This file is part of PHP CS Fixer.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- * Dariusz Rumiński <dariusz.ruminski@gmail.com>
- *
- * This source file is subject to the MIT license that is bundled
- * with this source code in the file LICENSE.
- */
- namespace PhpCsFixer\Tests\Fixer\Alias;
- use PhpCsFixer\Test\AbstractFixerTestCase;
- /**
- * @author Filippo Tessarotto <zoeslam@gmail.com>
- *
- * @internal
- *
- * @covers \PhpCsFixer\AbstractFunctionReferenceFixer
- * @covers \PhpCsFixer\Fixer\Alias\MbStrFunctionsFixer
- */
- final class MbStrFunctionsFixerTest extends AbstractFixerTestCase
- {
- /**
- * @param string $expected
- * @param null|string $input
- *
- * @dataProvider provideExamples
- */
- public function testFix($expected, $input = null)
- {
- $this->doTest($expected, $input);
- }
- public function provideExamples()
- {
- return [
- ['<?php $x = "strlen";'],
- ['<?php $x = Foo::strlen("bar");'],
- ['<?php $x = new strlen("bar");'],
- ['<?php $x = new \strlen("bar");'],
- ['<?php $x = new Foo\strlen("bar");'],
- ['<?php $x = Foo\strlen("bar");'],
- ['<?php $x = strlen::call("bar");'],
- ['<?php $x = $foo->strlen("bar");'],
- ['<?php $x = strlen();'], // number of arguments mismatch
- ['<?php $x = strlen($a, $b);'], // number of arguments mismatch
- ['<?php $x = mb_strlen("bar");', '<?php $x = strlen("bar");'],
- ['<?php $x = \mb_strlen("bar");', '<?php $x = \strlen("bar");'],
- ['<?php $x = mb_strtolower(mb_strstr("bar", "a"));', '<?php $x = strtolower(strstr("bar", "a"));'],
- ['<?php $x = mb_strtolower( \mb_strstr ("bar", "a"));', '<?php $x = strtolower( \strstr ("bar", "a"));'],
- ['<?php $x = mb_substr("bar", 2, 1);', '<?php $x = substr("bar", 2, 1);'],
- [
- '<?php
- interface Test
- {
- public function &strlen($a);
- public function strtolower($a);
- }',
- ],
- ];
- }
- }
|