add defined test case

This commit is contained in:
Tomas Votruba 2019-05-26 21:27:18 +02:00
parent b16ebe6be2
commit 3389d71219
3 changed files with 18 additions and 1 deletions

View File

@ -9,7 +9,11 @@ final class CompleteDynamicPropertiesRectorTest extends AbstractRectorTestCase
{
public function test(): void
{
$this->doTestFiles([__DIR__ . '/Fixture/fixture.php.inc', __DIR__ . '/Fixture/multiple_types.php.inc']);
$this->doTestFiles([
__DIR__ . '/Fixture/fixture.php.inc',
__DIR__ . '/Fixture/multiple_types.php.inc',
__DIR__ . '/Fixture/skip_defined.php.inc',
]);
}
protected function getRectorClass(): string

View File

@ -0,0 +1,12 @@
<?php
namespace Rector\CodeQuality\Tests\Rector\Class_\CompleteDynamicPropertiesRector\Fixture;
class SkipDefined
{
private $value;
public function set()
{
$this->value = 5;
}
}

View File

@ -96,6 +96,7 @@ CODE_SAMPLE
return null;
}
// type is already set → skip
if ($node->type !== null) {
return null;
}