Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Child's private method is shown with overwrites A annotation in reflection #9409

Closed
KapitanOczywisty opened this issue Aug 23, 2022 · 2 comments

Comments

@KapitanOczywisty
Copy link

KapitanOczywisty commented Aug 23, 2022

Description

Child's private method is shown with overwrites A annotation, which is misleading https://3v4l.org/dm3Y9

<?php
class A
{
    private function privateMethod() {}
}
class C extends A {
    private function privateMethod() {}
    private function otherMethod() {}
}

$class = new ReflectionClass('C');
echo (string)$class->getMethod('privateMethod');
echo (string)$class->getMethod('otherMethod');

Resulted in this output:

Method [ <user, overwrites A> private method privateMethod ] {
  @@ /in/dm3Y9 7 - 7
}
Method [ <user> private method otherMethod ] {
  @@ /in/dm3Y9 8 - 8
}

But I expected this output instead:

Method [ <user> private method privateMethod ] {
  @@ /in/dm3Y9 7 - 7
}
Method [ <user> private method otherMethod ] {
  @@ /in/dm3Y9 8 - 8
}

/cc @damianwadley

PHP Version

8.0 - 8.2

Operating System

No response

@damianwadley
Copy link
Member

Like with 64592, this is probably something that can't be fixed (if that decision is made) until PHP 9.

@iluuu1994
Copy link
Member

Fix for the latter part: #9469

I'll create a new issue for the former part so we have separate GitHub issue IDs that can be referenced.

@iluuu1994 iluuu1994 changed the title Inconsistency with ReflectionMethod Child's private method is shown with overwrites A annotation in reflection Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@iluuu1994 @damianwadley @KapitanOczywisty and others