Skip to content

Public const inside Enum class #157

Description

@enotocode

Hi,
there is an example in the readme.md of Enum class with private constant. Why it uses private const instead of public const?

Public modifier makes it possible to use class constant in array property:

final class Action extends Enum
{
    public const VIEW = 'view';
    public const EDIT = 'edit';
}

class ActionValidation 
{
    private array types = [Action::VIEW, Action::EDIT];
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions