psalm
psalm copied to clipboard
False UndefinedPropertyFetch with BackedEnum
https://psalm.dev/r/c2491c56ec
I found these snippets:
https://psalm.dev/r/c2491c56ec
<?php
function toString(BackedEnum|DateTime $x): string {
if ($x instanceof BackedEnum) {
return (string)$x->value;
}
return $x->format(DateTime::ATOM);
}
Psalm output (using commit ef3b018):
ERROR: UndefinedPropertyFetch - 5:24 - Instance property DateTime::$value is not defined