-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Milestone
Description
Bug report
<?php declare(strict_types = 1);
/** @var DateTime|DateInterval $command */
$command = new DateTime();
switch ($command::class) {
case DateTime::class:
// Call to an undefined method DateInterval\|DateTime::getTimestamp().
var_dump($command->getTimestamp());
break;
case DateInterval::class:
echo " Hello Date Interval " . $command->format('d');
break;
}
switch (get_class($command)) {
case DateTime::class:
// Works
var_dump($command->getTimestamp());
break;
case DateInterval::class:
echo " Hello Date Interval " . $command->format('d');
break;
}Code snippet that reproduces the problem
https://phpstan.org/r/7edb1da5-a99e-4788-8e1e-08dbf783ea13
Expected output
No error
Reactions are currently unavailable