From cedc9f738548a77bc61583234a41536df1168413 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Wed, 10 Jan 2018 14:30:29 +0100 Subject: [PATCH] Recommend using private constants --- README.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d0c3001..6a08e0a 100644 --- a/README.md +++ b/README.md @@ -33,11 +33,12 @@ use MyCLabs\Enum\Enum; */ class Action extends Enum { - const VIEW = 'view'; - const EDIT = 'edit'; + private const VIEW = 'view'; + private const EDIT = 'edit'; } ``` +Note the `private` keyword requires PHP > 7.1, you can omit it on PHP 7.0. ## Usage @@ -80,8 +81,8 @@ Static methods: ```php class Action extends Enum { - const VIEW = 'view'; - const EDIT = 'edit'; + private const VIEW = 'view'; + private const EDIT = 'edit'; } // Static method: @@ -96,7 +97,7 @@ If you care about IDE autocompletion, you can either implement the static method ```php class Action extends Enum { - const VIEW = 'view'; + private const VIEW = 'view'; /** * @return Action @@ -116,8 +117,8 @@ or you can use phpdoc (this is supported in PhpStorm for example): */ class Action extends Enum { - const VIEW = 'view'; - const EDIT = 'edit'; + private const VIEW = 'view'; + private const EDIT = 'edit'; } ```