mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-05 02:40:50 +00:00
53742c371b
70fa502a59
[CodeQuality] Skip private static call from static:: on LocallyCalledStaticMethodToNonStaticRector (#5620)
31 lines
1.1 KiB
PHP
31 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer;
|
|
|
|
use PhpParser\Node\Stmt\Property;
|
|
use Rector\Doctrine\CodeQuality\Contract\PropertyAttributeTransformerInterface;
|
|
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
|
|
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
|
use Rector\Doctrine\Enum\MappingClass;
|
|
final class IdColumnAttributeTransformer implements PropertyAttributeTransformerInterface
|
|
{
|
|
public function transform(EntityMapping $entityMapping, Property $property) : void
|
|
{
|
|
$idMapping = $entityMapping->matchIdPropertyMapping($property);
|
|
if (!\is_array($idMapping)) {
|
|
return;
|
|
}
|
|
$args = [];
|
|
$type = $idMapping['type'] ?? null;
|
|
if ($type) {
|
|
$args[] = AttributeFactory::createNamedArg($type, 'type');
|
|
}
|
|
$property->attrGroups[] = AttributeFactory::createGroup($this->getClassName(), $args);
|
|
}
|
|
public function getClassName() : string
|
|
{
|
|
return MappingClass::COLUMN;
|
|
}
|
|
}
|