Skip to content

implementsInterface() isSubclassOf() method inconsistancies in ReflectionClass #72

Open
@loren-osborn

Description

@loren-osborn

I'm finding differences in how Go\ParserReflection\ReflectionClass and native ReflectionClass behave for methods implementsInterface() and isSubclassOf(). I'm using some fakery to simulate external file loading, so I would be unsurprised if the issue involves how I'm populating these files, but I don't currently see anything I missing in that regard.

This is a couple pages of code, so it's hard to call it a "minimal reproducible test case", but I wrote it to be self-contained, and to demonstrate the issue I'm seeing in my code. I hope my comments are adequate, but I opted for clarity of the output over clarity of the code. This is why I chose to use ANSI color codes to make the issue easier to see.

As far as the issue I'm seeing in my actual codebase, I'm seeing the following behavior:

  • implementsInterface() is working as expected.
  • isSubclassOf() is always returning FALSE.

Here is a gist of the example code I'm using: https://gist.github.com/loren-osborn/b3a80c075ebb3ac6d3e2d8749a23bbe7 :

  • Lines in green are working as expected.
  • Lines in red (marked with !!) are returning FALSE when they should return TRUE.
  • Lines with a yellow (marked with ..) background are not throwing an exception that the native ReflectionClass method throws. This may or may not be the expected behavior. (I suggest that Go\ParserReflection\ReflectionClass should throw an exception as well, but that's my personal opinion.)

This is what my output looks like::
goaop_parserreflection_issubclassofissue

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions