The following fatal exception is thrown when exporting a model which has at least one property declared with a PHP 8 union type:
Invalid variable character[|], different than $
Project Info:
- Doctrine 2
- No ORM
- Export Data Format: Doctrine2 Annotations
Minimum reproduction example:
<?php
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
class SampleEntity
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $test;
private string|null $example = null;
public function getTest(): ?string
{
return $this->test;
}
public function getExample(): ?string
{
return $this->example;
}
}