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

PHPDocBlock for getKey incorrect #2

Open
burnhamrobertp opened this issue Jun 1, 2017 · 0 comments
Open

PHPDocBlock for getKey incorrect #2

burnhamrobertp opened this issue Jun 1, 2017 · 0 comments

Comments

@burnhamrobertp
Copy link

burnhamrobertp commented Jun 1, 2017

/**
     * Gets the key of the provided value.
     *
     * @param string $value The value.
     *
     * **@return boolean The key if found, false otherwise.**
     */
    public static function getKey($value)
    {
        return array_search($value, static::getAll(), true);
    }

array_search will return the element, if found, which would be a string

...

class UserRoles extends AbstractEnum
{
    const ADMIN = 1;
    const MODERATOR = 2;
    const CLIENT = 3;
    const WRITER = 4;
}

UserRoles::getKey(3) will return 'client'

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

No branches or pull requests

1 participant