Description
The following code:
https://3v4l.org/AVYra#v8.5.9
<?php
// Why is this allowed ?
// This pattern is used by Carbon - https://github.com/briannesbitt/Carbon
class MyDateTimeImmutable extends DateTimeImmutable implements DateTimeInterface
{
public function format(string $format): string
{
return 'Why is this allowed?';
}
}
// And why is this disallowed ?
// Fatal error: DateTimeInterface can't be implemented by user classes
class MyTime implements DateTimeInterface
{
}
Resulted in this output:
Fatal error: DateTimeInterface can't be implemented by user classes in /in/AVYra on line 14
But I expected this output instead:
Fatal error: Class MyTime contains ... abstract methods and must therefore be declared abstract or implement the remaining methods
PHP Version
Operating System
https://3v4l.org/
Description
The following code:
https://3v4l.org/AVYra#v8.5.9
Resulted in this output:
But I expected this output instead:
PHP Version
Operating System
https://3v4l.org/