[st] fixes

This commit is contained in:
Tomas Votruba 2018-04-08 16:11:07 +02:00
parent 7e5a9a1002
commit eb127ae461
3 changed files with 8 additions and 6 deletions

View File

@ -58,7 +58,8 @@ final class ReplaceParentRepositoryCallsByRepositoryPropertyRector extends Abstr
{
return new RectorDefinition(
'Handles method calls in child of Doctrine EntityRepository and moves them to "$this->repository" property.',
new CodeSample(
[
new CodeSample(
<<<'SAMPLE'
<?php
@ -72,7 +73,7 @@ class SomeRepository extends EntityRepository
}
}
SAMPLE
,
,
<<<'SAMPLE_TWO'
<?php
@ -86,7 +87,8 @@ class SomeRepository extends EntityRepository
}
}
SAMPLE_TWO
)
),
]
);
}

View File

@ -15,6 +15,7 @@ final class RectorDefinition
private $codeSamples = [];
/**
* @todo require at least 1 item?
* @param CodeSample[] $codeSamples
*/
public function __construct(string $description, array $codeSamples)

View File

@ -2,10 +2,9 @@
namespace Rector\Tests\NodeValueResolver;
use PhpParser\BuilderFactory;
use PhpParser\ConstExprEvaluator;
use PhpParser\Node\Expr\ClassConstFetch;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Class_;
use PHPUnit\Framework\TestCase;
use Rector\Node\Attribute;
use Rector\NodeValueResolver\ConstExprEvaluatorFactory;
@ -24,7 +23,7 @@ final class ConstExprEvaluatorFactoryTest extends TestCase
public function test(): void
{
$classConstFetchNode = new ClassConstFetch(new Class_('SomeClass'), 'SOME_CONSTANT');
$classConstFetchNode = (new BuilderFactory())->classConstFetch('SomeClass', 'SOME_CONSTANT');
$classConstFetchNode->class->setAttribute(Attribute::RESOLVED_NAME, new Name('SomeClassResolveName'));
$this->assertSame(