mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-01 00:40:52 +00:00
faf7fee8e4
c4dd05e2e3
[CodeQuality] Add StaticToSelfStaticMethodCallOnFinalClassRector (#5621)
30 lines
1010 B
PHP
30 lines
1010 B
PHP
<?php
|
|
|
|
declare (strict_types=1);
|
|
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer;
|
|
|
|
use PhpParser\Node\Param;
|
|
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 IdAttributeTransformer implements PropertyAttributeTransformerInterface
|
|
{
|
|
/**
|
|
* @param \PhpParser\Node\Stmt\Property|\PhpParser\Node\Param $property
|
|
*/
|
|
public function transform(EntityMapping $entityMapping, $property) : void
|
|
{
|
|
$idMapping = $entityMapping->matchIdPropertyMapping($property);
|
|
if (!\is_array($idMapping)) {
|
|
return;
|
|
}
|
|
$property->attrGroups[] = AttributeFactory::createGroup($this->getClassName());
|
|
}
|
|
public function getClassName() : string
|
|
{
|
|
return MappingClass::ID;
|
|
}
|
|
}
|