rector
rector copied to clipboard
Incorrect behavior of MakeEntitySetterNullabilityInSyncWithPropertyRector, RemoveRedundantDefaultClassAnnotationValuesRector, RemoveRedundantDefaultPropertyAnnotationValuesRector, ServiceGetterToConstructorInjectionRector
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.org/demo/b67b9bc6-6695-4b3f-af1c-1421de94f675
<?php
namespace App\BankBundle\Entity;
use Stringable;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="post_package")
*/
class Package implements Stringable
{
/**
* @var integer
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private int $id;
/**
* @ORM\JoinColumn(name="platform_id")
* @ORM\ManyToOne(targetEntity=Platform::class)
*/
private ?Platform $platform = null;
/**
* @ORM\JoinColumn(name="status")
* @ORM\ManyToOne(targetEntity=Status::class)
*/
private ?Status $status = null;
/**
* @ORM\Column(type="guid", options={"comment":"Unique package id"})
*/
private string $guid;
/**
* Package constructor.
*/
public function __construct()
{
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
public function getPlatform(): ?Platform
{
return $this->platform;
}
public function setPlatform(?Platform $platform): void
{
$this->platform = $platform;
}
public function getStatus(): ?Status
{
return $this->status;
}
public function setStatus(?Status $status): void
{
$this->status = $status;
}
public function getGuid(): string
{
return $this->guid;
}
public function setGuid(string $guid): void
{
$this->guid = $guid;
}
public function __toString(): string
{
return (string) $this->getId();
}
}
Responsible rules
-
MakeEntitySetterNullabilityInSyncWithPropertyRector -
RemoveRedundantDefaultClassAnnotationValuesRector -
RemoveRedundantDefaultPropertyAnnotationValuesRector -
ServiceGetterToConstructorInjectionRector
Expected Behavior
Arguments from setStatus and setPlatform must stay intact.