Skip to content

#[\Override] on a method implementing an abstract trait method is rejected: "no matching parent method exists". #617

Closed

Description

@blacktrs

Summary

#[\Override] on a method implementing an abstract trait method is rejected: "no matching parent method exists".

Repro

<?php
// reported in #614 (open-telemetry/api NoopLogger + Psr\Log\LoggerTrait)
trait LogsT { abstract public function log(string $m): void; public function info(string $m): void { $this->log($m); } }
interface Emitter { public function emit(): void; }
class NoopLogger implements Emitter {
    use LogsT;
    #[\Override] public function emit(): void {}
    #[\Override] public function log(string $m): void { echo "log: $m\n"; }
}
(new NoopLogger)->info("ok");

Expected (php)

log: ok

Actual (manticore c421455f, Darwin arm64)

compile failed (rc=65):
compile failed: NoopLogger::log() has #[\Override] attribute, but no matching parent method exists at line 9
compile: front-end (parse/typeck/IR) returned null (rc=65)

Tracking

Known-bug repro: tests/aot/repro/wrong/override_abstract_trait_method.php — bash tests/aot/xfail.sh -k override_abstract_trait_method reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    wrong-answer
    on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions