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

Enums with interface do not resolve correctly #2220

Closed
haringsrob opened this issue Apr 20, 2023 · 2 comments · Fixed by #2222
Closed

Enums with interface do not resolve correctly #2220

haringsrob opened this issue Apr 20, 2023 · 2 comments · Fixed by #2222

Comments

@haringsrob
Copy link
Contributor

Hey,

I continue to have this issue (#2218), made sure I am on latest master (disabled my wip as well).

I think it is because of the interface as I tried this little test case:

This has issues:

<?php

interface test
{
    public function foo(): string;
}

enum Test: string implements test
{
    public function foo()
    {
        $this->cases(); <--- Undefined error
    }
}

Test::from('bar')->foo(); <--- Method "foo" does not exist

All fine with:

enum Test: string
{
    public function foo()
    {
        $this->cases();
    }
}

Test::from('bar')->foo();
@dantleech
Copy link
Collaborator

dantleech commented Apr 20, 2023

this looks like a parser bug - it incorrectly parses the "base clause" as the "members" node:

image

also note that it parses the "method" as a "function" instead of a "MethodDecalaration":

compare to a class:

image

will need to fix in our fork then push an upstream fix

@dantleech
Copy link
Collaborator

Well, it's mostly fixed in 2220 although it ignores the interface type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants