This indicates an error in my code, but the crash is unexpected. I'm providing the bug report and stack trace as the PHPStan output requests, but through some quick trial-and-error I was able to determine that #[Mapping\Column] on a class property that's unsupported would trigger it.
Not sure if this would happen if Doctrine had a custom type mapper set which allows this to work (seeing the stack trace, it looks like probably), but I think PHPStan, or more specifically the Doctrine extension, should catch the assertion error and translate it into an analysis warning of some kind.
Simple reproduce code:
<?php
declare(strict_types=1);
namespace App\Entities;
use Doctrine\ORM\Mapping;
#[Mapping\Entity]
class Bug
{
#[Mapping\Column]
#[Mapping\Id]
public string $id;
#[Mapping\Column]
public Status $status;
public function causeError(): void
{
$this->a = 1; // This should error, instead PHPStan crashes
}
}
enum Status
{
case Working;
case Broken;
}
Bug report
This indicates an error in my code, but the crash is unexpected. I'm providing the bug report and stack trace as the PHPStan output requests, but through some quick trial-and-error I was able to determine that
#[Mapping\Column]
on a class property that's unsupported would trigger it.Not sure if this would happen if Doctrine had a custom type mapper set which allows this to work (seeing the stack trace, it looks like probably), but I think PHPStan, or more specifically the Doctrine extension, should catch the assertion error and translate it into an analysis warning of some kind.
Simple reproduce code:
Code snippet that reproduces the problem
No response
Expected output
No crash, possibly an indication of an invalid column mapping.
Did PHPStan help you today? Did it make you happy in any way?
No response