Closed
Description
Expected:
PHPStand understands that such a definition is valid and that $id is set to int
by Doctrine.
Actual:
Property HelloWorld::$id (int|null) is never assigned int so it can be removed from the property type.
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private ?int $id = null;
public function __clone()
{
if ($this->id !== null) {
$this->id = null;
}
// ...
}
}
Only happens when I have that clone method in place, which says that id is not null π
Playground: https://phpstan.org/r/ed1ce389-72ab-4deb-a1bc-6d570db17f87
But in that case it makes sense, as there is no Doctrine annotation/bridge available.
Metadata
Metadata
Assignees
Labels
No labels