File tree 1 file changed +8
-7
lines changed
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;
33
33
*/
34
34
class Action extends Enum
35
35
{
36
- const VIEW = 'view';
37
- const EDIT = 'edit';
36
+ private const VIEW = 'view';
37
+ private const EDIT = 'edit';
38
38
}
39
39
```
40
40
41
+ Note the ` private ` keyword requires PHP > 7.1, you can omit it on PHP 7.0.
41
42
42
43
## Usage
43
44
@@ -80,8 +81,8 @@ Static methods:
80
81
``` php
81
82
class Action extends Enum
82
83
{
83
- const VIEW = 'view';
84
- const EDIT = 'edit';
84
+ private const VIEW = 'view';
85
+ private const EDIT = 'edit';
85
86
}
86
87
87
88
// Static method:
@@ -96,7 +97,7 @@ If you care about IDE autocompletion, you can either implement the static method
96
97
``` php
97
98
class Action extends Enum
98
99
{
99
- const VIEW = 'view';
100
+ private const VIEW = 'view';
100
101
101
102
/**
102
103
* @return Action
@@ -116,8 +117,8 @@ or you can use phpdoc (this is supported in PhpStorm for example):
116
117
*/
117
118
class Action extends Enum
118
119
{
119
- const VIEW = 'view';
120
- const EDIT = 'edit';
120
+ private const VIEW = 'view';
121
+ private const EDIT = 'edit';
121
122
}
122
123
```
123
124
You can’t perform that action at this time.
0 commit comments