rector/vendor/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/EmbeddableClassAttributeTransformer.php
Tomas Votruba 53742c371b Updated Rector to commit 70fa502a59dfb8f81011a46a456e1ccb4051be76
70fa502a59 [CodeQuality] Skip private static call from static:: on LocallyCalledStaticMethodToNonStaticRector (#5620)
2024-02-15 09:08:32 +00:00

27 lines
937 B
PHP

<?php
declare (strict_types=1);
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\ClassAttributeTransformer;
use PhpParser\Node\Stmt\Class_;
use Rector\Doctrine\CodeQuality\Contract\ClassAttributeTransformerInterface;
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
use Rector\Doctrine\Enum\MappingClass;
final class EmbeddableClassAttributeTransformer implements ClassAttributeTransformerInterface
{
public function transform(EntityMapping $entityMapping, Class_ $class) : void
{
$classMapping = $entityMapping->getClassMapping();
$type = $classMapping['type'] ?? null;
if ($type !== 'embeddable') {
return;
}
$class->attrGroups[] = AttributeFactory::createGroup($this->getClassName());
}
public function getClassName() : string
{
return MappingClass::EMBEDDABLE;
}
}