Merge pull request #2081 from gnutix/StringifyStrNeedlesRector/adding-testcase

Add failing test: StringifyStrNeedlesRector adds (string) to a method call that returns a string anyway
This commit is contained in:
Tomáš Votruba 2019-10-04 13:59:06 +02:00 committed by GitHub
commit affe5aef5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,16 @@
<?php
namespace Rector\Php73\Tests\Rector\FuncCall\StringifyStrNeedlesRector\Fixture;
final class SkipAlreadyString
{
public function getNeedle(): string
{
return 'needle';
}
public function __invoke()
{
return strpos('needle', (new SkipAlreadyString)->getNeedle());
}
}

View File

@ -21,6 +21,7 @@ final class StringifyStrNeedlesRectorTest extends AbstractRectorTestCase
yield [__DIR__ . '/Fixture/fixture.php.inc'];
yield [__DIR__ . '/Fixture/trait.php.inc'];
yield [__DIR__ . '/Fixture/skip_twice.php.inc'];
yield [__DIR__ . '/Fixture/skip_already_string.php.inc'];
}
protected function getRectorClass(): string