You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Override construct function with optional argument should not produce fatal error #23630
PHP Fatal error: Declaration of MyInterface1::__construct(?string $name = null) must be compatible with MyInterface2::__construct(?string $name = null, ?int $id = null) in php shell code on line 1
But I expected no error and the following code works as expected:
It is a bug. When an interface doesn't declare a method itself, the engine copies the declaration from the first parent listed and only checks that copy against the later ones, so it only links if the interface you list first already has the most specific signature. Same root cause as bug #76361.
Activity
lazerg commentedon Sep 9, 2026
It is a bug. When an interface doesn't declare a method itself, the engine copies the declaration from the first parent listed and only checks that copy against the later ones, so it only links if the interface you list first already has the most specific signature. Same root cause as bug #76361.
PR is up: #23638.