With this example:
class Datetime extends \DateTime
{
public static function createFromInterface(\DatetimeInterface $datetime): \Datetime
{
if (\PHP_VERSION_ID >= 80000) {
return parent::createFromInterface($datetime);
}
//…
}
}
psalm returns to me:
ERROR: UndefinedMethod - src/Datetime.php - Method DateTime::createfrominterface does not exist
return parent::createFromInterface($datetime);
Is it a bug? Or I must ignore it because psalm can't detect this kind ot things.
Here it is a link: https://psalm.dev/r/c6f2bbb578
I found these snippets:
https://psalm.dev/r/c6f2bbb578
<?php
declare(strict_types=1);
namespace FooBar;
class Datetime extends \DateTime
{
public static function createFromInterface(\DatetimeInterface $datetime)
{
if (\PHP_VERSION_ID >= 80000) {
return parent::createFromInterface($datetime);
}
}
}
Psalm output (using commit ae0b1a6):
ERROR: UndefinedMethod - 12:20 - Method DateTime::createfrominterface does not exist
INFO: MissingReturnType - 9:28 - Method FooBar\Datetime::createFromInterface does not have a return type
somebody (maybe you?) will have to add declarations for methods added to php 8 in a file similar to CallMap_74_delta.php, but named CallMap_80_delta.php
Most helpful comment
somebody (maybe you?) will have to add declarations for methods added to php 8 in a file similar to CallMap_74_delta.php, but named
CallMap_80_delta.php