Closed
Description
Description
The following code:
<?php
class CoreTransliterator
{
public static function create(string $id, int $direction = self::FORWARD): ?CoreTransliterator
{
}
}
trait EmojiTransliteratorTrait
{
public static function create(string $id, int $direction = self::FORWARD): self
{
}
}
class EmojiTransliterator extends CoreTransliterator
{
use EmojiTransliteratorTrait;
}
Resulted in this output:
Fatal error: Declaration of EmojiTransliteratorTrait::create(string $id, int $direction = self::FORWARD): EmojiTransliteratorTrait must be compatible with CoreTransliterator::create(string $id, int $direction = self::FORWARD): ?CoreTransliterator
But I expected this output instead:
The code should continue to work. self
in a trait should probably not be resolved at compile time.
PHP Version
8.5
Operating System
No response
Additional information
- behaviour on PHP 8.4: https://3v4l.org/6J3Q9#v8.4.5
- behaviour on PHP 8.5: https://3v4l.org/6J3Q9/rfc#vgit.master