[Solved] PHP 8 Union Types Unsupported

0 votes
asked May 20, 2021 in Solved by matthewa (150 points)
recategorized May 25, 2021 by ludek.vodicka

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;
    }
}
commented May 20, 2021 by ludek.vodicka Skipper developer (140,450 points)

Hello Mathewa,

thank you for the report. Can you please send me ([email protected]) the Skipper project which exports this PHP file?

Together with the expected output.

Thanks
Ludek

commented May 21, 2021 by matthewa (150 points)

Hello,

I have sent you a minimal reproduction example project with steps to reproduce the issue.

Regards

commented May 21, 2021 by ludek.vodicka Skipper developer (140,450 points)

Hello, unfortunately, your email doesn't contain any attachment. Can you please send it again?

1 Answer

0 votes
answered May 24, 2021 by ludek.vodicka Skipper developer (140,450 points)
selected May 25, 2021 by ludek.vodicka
 
Best answer

Hello,

we just released a new beta which contains PHP parser fix for this issue.

https://www.skipper18.com/support/402/downloads-skipper-beta

Please try it and let me know if everything works as expected.

Thanks

commented May 25, 2021 by matthewa (150 points)

I have verified that this is functional. Thank you!

...