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

Creating enum using method call from within enum throws UnknownEnumMethod #82

Closed
hxnk opened this issue Dec 9, 2020 · 6 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@hxnk
Copy link

hxnk commented Dec 9, 2020

After upgrading to v3, I ran into the following issue (this used to work in v2):

Given this enum:

/**
 * @method static self open()
 * @method static self cancelled()
 * @method static self closed()
 */
class SomeStatus extends Enum
{
    public function isFinal()
    {
        return $this->equals(SomeStatus::cancelled(), SomeStatus::closed());
    }
}

When calling:

SomeStatus::open()->isFinal();

An exception is thrown: Spatie\Enum\Exceptions\UnknownEnumMethod
with Method cancelled not found on class SomeStatus.

@milesizzo
Copy link
Contributor

+1, this issue just bit me too.

@brendt
Copy link
Collaborator

brendt commented Dec 14, 2020

I'll look into it this week.

@brendt brendt self-assigned this Dec 14, 2020
@brendt brendt added the bug Something isn't working label Dec 14, 2020
@brendt
Copy link
Collaborator

brendt commented Dec 17, 2020

I've released a fix in 3.6.1: https://github.com/spatie/enum/releases/tag/3.6.1

@brendt brendt closed this as completed Dec 17, 2020
@Gummibeer
Copy link
Collaborator

Gummibeer commented Dec 17, 2020

@brendt is it me or did you forgot to push your code? The last commit is my v3.6.0 one 21days ago.

image

@brendt
Copy link
Collaborator

brendt commented Dec 17, 2020

😅 oh noes! Hang on!

@brendt
Copy link
Collaborator

brendt commented Dec 17, 2020

https://github.com/spatie/enum/releases/tag/3.6.2

There we are, sorry for the inconvenience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants