mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-20 23:41:57 +02:00
[st] fixes
This commit is contained in:
parent
7e5a9a1002
commit
eb127ae461
@ -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
|
||||
)
|
||||
),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user