psalm
psalm copied to clipboard
issue with psalm-assert and unions
https://psalm.dev/r/0531bb69bd
Don't know if it's one or two issues:
- When calling Psalm complains that "$o - object does not contain class-string<DateTime>" but since the assert is for
class-string<DateTime>|DateTimeand$ois an object it should be fine - Post call, the infered type for
$oisclass-string<DateTime>|DateTime(taken from the assert) but it should be(class-string<DateTime>|DateTime)&object(the assert type&the initial type) and should resolve toDateTime
I found these snippets:
https://psalm.dev/r/0531bb69bd
<?php
function doSomeMath(int $number): int
{
return $number ** 2;
}
$squared = doSomeMath(3);
assert($squared === 9);
Psalm output (using commit 16b24bd):
No issues!