From d3ccffe21ce2153414291f2fa5fea2fb8ce5b132 Mon Sep 17 00:00:00 2001 From: Danack Date: Mon, 15 Jun 2020 10:26:05 +0100 Subject: [PATCH 1/2] fix legacy use of words. --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6065f49..024c4df 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ First, and mainly, `SplEnum` is not integrated to PHP, you have to install the e Using an enum instead of class constants provides the following advantages: -- You can type-hint: `function setAction(Action $action) {` +- You can use an enum as a parameter type: `function setAction(Action $action) {` +- You can use an enum as a return type: `function getAction() : Action {` - You can enrich the enum with methods (e.g. `format`, `parse`, …) - You can extend the enum to add new values (make your enum `final` to prevent it) - You can get a list of all the possible values (see below) @@ -54,7 +55,7 @@ $action = new Action($value); As you can see, static methods are automatically implemented to provide quick access to an enum value. -One advantage over using class constants is to be able to type-hint enum values: +One advantage over using class constants is to be able to use enum as a paramter type: ```php function setAction(Action $action) { From 7c4836a6ec7476e4aad0f6044ee2581357c8237a Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Mon, 15 Jun 2020 18:00:00 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 024c4df..7d09e87 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ $action = new Action($value); As you can see, static methods are automatically implemented to provide quick access to an enum value. -One advantage over using class constants is to be able to use enum as a paramter type: +One advantage over using class constants is to be able to use an enum as a parameter type: ```php function setAction(Action $action) {