Skip to content

Commit

Permalink
conflicting test
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed May 8, 2021
1 parent 5fa7ec5 commit b7e0b28
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/Issues/CallableFixture/class_with_nullable_callable.php.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace Rector\Tests\Issues\CallableFixture;

final class StyleWithCallable implements InterfaceWithCallable
{
public function ask($id = null)
{
}
}

interface InterfaceWithCallable
{
public function ask(callable $id = null);
}

?>
-----
<?php

namespace Rector\Tests\Issues\CallableFixture;

final class StyleWithCallable implements InterfaceWithCallable
{
public function ask($id = null)
{
}
}

interface InterfaceWithCallable
{
/**
* @param callable|null $id
*/
public function ask($id = null);
}

?>
33 changes: 33 additions & 0 deletions tests/Issues/CallableInterfaceDowngradeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace Rector\Core\Tests\Issues;

use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;

final class CallableInterfaceDowngradeTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(SmartFileInfo $fileInfo): void
{
$this->doTestFileInfo($fileInfo);
}

/**
* @return Iterator<SmartFileInfo>
*/
public function provideData(): Iterator
{
return $this->yieldFilesFromDirectory(__DIR__ . '/CallableFixture');
}

public function provideConfigFilePath(): string
{
return __DIR__ . '/config/callable_interface_downgrade.php';
}
}
13 changes: 13 additions & 0 deletions tests/Issues/config/callable_interface_downgrade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

use Rector\DowngradePhp70\Rector\FunctionLike\DowngradeScalarTypeDeclarationRector;
use Rector\DowngradePhp71\Rector\FunctionLike\DowngradeNullableTypeDeclarationRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(DowngradeNullableTypeDeclarationRector::class);
$services->set(DowngradeScalarTypeDeclarationRector::class);
};

0 comments on commit b7e0b28

Please sign in to comment.