move to SilentKeyNodeInterface fully

This commit is contained in:
TomasVotruba 2020-04-30 10:00:39 +02:00
parent b161d55ae2
commit 3c1761bcc3
3 changed files with 13 additions and 5 deletions

View File

@ -187,15 +187,17 @@ abstract class AbstractTagValueNode implements AttributeAwareNodeInterface, PhpD
);
}
protected function resolveOriginalContentSpacingAndOrder(?string $originalContent, ?string $silentKey = null): void
protected function resolveOriginalContentSpacingAndOrder(?string $originalContent): void
{
$this->keysByQuotedStatus = [];
if ($originalContent === null) {
return;
}
if ($silentKey === null && $this instanceof SilentKeyNodeInterface) {
if ($this instanceof SilentKeyNodeInterface) {
$silentKey = $this->getSilentKey();
} else {
$silentKey = null;
}
$this->originalContent = $originalContent;

View File

@ -89,7 +89,7 @@ final class TableTagValueNode extends AbstractDoctrineTagValueNode implements Si
$this->uniqueConstraints = $uniqueConstraints;
$this->options = $options;
$this->resolveOriginalContentSpacingAndOrder($originalContent, 'name');
$this->resolveOriginalContentSpacingAndOrder($originalContent);
$this->haveIndexesFinalComma = $haveIndexesFinalComma;
$this->haveUniqueConstraintsFinalComma = $haveUniqueConstraintsFinalComma;

View File

@ -6,9 +6,10 @@ namespace Rector\BetterPhpDocParser\PhpDocNode\JMS;
use JMS\DiExtraBundle\Annotation\Inject;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\ShortNameAwareTagInterface;
use Rector\BetterPhpDocParser\Contract\PhpDocNode\SilentKeyNodeInterface;
use Rector\BetterPhpDocParser\PhpDocNode\AbstractTagValueNode;
final class JMSInjectTagValueNode extends AbstractTagValueNode implements ShortNameAwareTagInterface
final class JMSInjectTagValueNode extends AbstractTagValueNode implements ShortNameAwareTagInterface, SilentKeyNodeInterface
{
/**
* @var string|null
@ -20,7 +21,7 @@ final class JMSInjectTagValueNode extends AbstractTagValueNode implements ShortN
$this->items = get_object_vars($inject);
$this->serviceName = $serviceName;
$this->resolveOriginalContentSpacingAndOrder($annotationContent, 'value');
$this->resolveOriginalContentSpacingAndOrder($annotationContent);
}
public function getServiceName(): ?string
@ -32,4 +33,9 @@ final class JMSInjectTagValueNode extends AbstractTagValueNode implements ShortN
{
return '@DI\Inject';
}
public function getSilentKey(): string
{
return 'value';
}
}