File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -33,11 +33,12 @@ use MyCLabs\Enum\Enum;
3333 */
3434class Action extends Enum
3535{
36- const VIEW = 'view';
37- const EDIT = 'edit';
36+ private const VIEW = 'view';
37+ private const EDIT = 'edit';
3838}
3939```
4040
41+ Note the ` private ` keyword requires PHP > 7.1, you can omit it on PHP 7.0.
4142
4243## Usage
4344
@@ -80,8 +81,8 @@ Static methods:
8081``` php
8182class Action extends Enum
8283{
83- const VIEW = 'view';
84- const EDIT = 'edit';
84+ private const VIEW = 'view';
85+ private const EDIT = 'edit';
8586}
8687
8788// Static method:
@@ -96,7 +97,7 @@ If you care about IDE autocompletion, you can either implement the static method
9697``` php
9798class Action extends Enum
9899{
99- const VIEW = 'view';
100+ private const VIEW = 'view';
100101
101102 /**
102103 * @return Action
@@ -116,8 +117,8 @@ or you can use phpdoc (this is supported in PhpStorm for example):
116117 */
117118class Action extends Enum
118119{
119- const VIEW = 'view';
120- const EDIT = 'edit';
120+ private const VIEW = 'view';
121+ private const EDIT = 'edit';
121122}
122123```
123124
You can’t perform that action at this time.
0 commit comments