Skip to content

ReflectionMethod->class and getDeclaringClass() of an inherited method name the subclass instead of the declaring class #195

Closed

Description

@blacktrs

Summary

ReflectionMethod->class and getDeclaringClass() of an inherited method name the subclass instead of the declaring class.

Repro

<?php
abstract class Animal { public function eat(): string { return 'eat'; } }
class Dog extends Animal {}
$m = new ReflectionMethod('Dog', 'eat');
echo $m->class, ' ', $m->getDeclaringClass()->getName(), "\n";

Expected (php)

Animal Animal

Actual (manticore 320b47ff, Darwin arm64)

Dog Dog

Tracking

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

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