Skip to content

Commit 9ad4dda

Browse files
authored
Merge pull request #106 from marc-mabe/array-value
implemented #96: support type `array` in enumerator values
2 parents 3a5af48 + 6ed4718 commit 9ad4dda

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

src/Enum.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ abstract class Enum
1818
/**
1919
* The selected enumerator value
2020
*
21-
* @var null|bool|int|float|string
21+
* @var null|bool|int|float|string|array
2222
*/
2323
private $value;
2424

@@ -53,8 +53,8 @@ abstract class Enum
5353
/**
5454
* Constructor
5555
*
56-
* @param null|bool|int|float|string $value The value of the enumerator
57-
* @param int|null $ordinal The ordinal number of the enumerator
56+
* @param null|bool|int|float|string|array $value The value of the enumerator
57+
* @param int|null $ordinal The ordinal number of the enumerator
5858
*/
5959
final private function __construct($value, $ordinal = null)
6060
{
@@ -103,7 +103,7 @@ final public function __wakeup()
103103
/**
104104
* Get the value of the enumerator
105105
*
106-
* @return null|bool|int|float|string
106+
* @return null|bool|int|float|string|array
107107
*/
108108
final public function getValue()
109109
{
@@ -164,7 +164,7 @@ final public function is($enumerator)
164164
/**
165165
* Get an enumerator instance of the given enumerator value or instance
166166
*
167-
* @param static|null|bool|int|float|string $enumerator
167+
* @param static|null|bool|int|float|string|array $enumerator
168168
* @return static
169169
* @throws InvalidArgumentException On an unknwon or invalid value
170170
* @throws LogicException On ambiguous constant values
@@ -325,7 +325,7 @@ final public static function getConstants()
325325
/**
326326
* Test if the given enumerator is part of this enumeration
327327
*
328-
* @param static|null|bool|int|float|string $value
328+
* @param static|null|bool|int|float|string|array $value
329329
* @return bool
330330
*/
331331
final public static function has($enumerator)

src/EnumMap.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function getValues()
8787

8888
/**
8989
* Search for the given value
90-
* @param mixed $value
90+
* @param null|bool|int|float|string|array $value
9191
* @param bool $strict Use strict type comparison
9292
* @return Enum|null The found key or NULL
9393
*/
@@ -104,8 +104,8 @@ public function search($value, $strict = false)
104104

105105
/**
106106
* Test if the given enumerator exists
107-
* @param Enum|null|boolean|int|float|string $enumerator
108-
* @return boolean
107+
* @param Enum|null|bool|int|float|string|array $enumerator
108+
* @return bool
109109
* @see offsetExists
110110
*/
111111
public function contains($enumerator)
@@ -122,8 +122,8 @@ public function contains($enumerator)
122122

123123
/**
124124
* Test if the given enumerator key exists and is not NULL
125-
* @param Enum|null|boolean|int|float|string $enumerator
126-
* @return boolean
125+
* @param Enum|null|bool|int|float|string|array $enumerator
126+
* @return bool
127127
* @see contains
128128
*/
129129
public function offsetExists($enumerator)
@@ -140,7 +140,7 @@ public function offsetExists($enumerator)
140140

141141
/**
142142
* Get mapped data for the given enumerator
143-
* @param Enum|null|boolean|int|float|string $enumerator
143+
* @param Enum|null|bool|int|float|string|array $enumerator
144144
* @return mixed
145145
* @throws InvalidArgumentException On an invalid given enumerator
146146
*/
@@ -160,8 +160,8 @@ public function offsetGet($enumerator)
160160

161161
/**
162162
* Attach a new enumerator or overwrite an existing one
163-
* @param Enum|null|boolean|int|float|string $enumerator
164-
* @param mixed $value
163+
* @param Enum|null|bool|int|float|string|array $enumerator
164+
* @param mixed $value
165165
* @return void
166166
* @throws InvalidArgumentException On an invalid given enumerator
167167
* @see attach()
@@ -179,7 +179,7 @@ public function offsetSet($enumerator, $value = null)
179179

180180
/**
181181
* Detach an existing enumerator
182-
* @param Enum|null|boolean|int|float|string $enumerator
182+
* @param Enum|null|bool|int|float|string|array $enumerator
183183
* @return void
184184
* @throws InvalidArgumentException On an invalid given enumerator
185185
* @see detach()
@@ -256,7 +256,7 @@ public function next()
256256

257257
/**
258258
* Test if the iterator is in a valid state
259-
* @return boolean
259+
* @return bool
260260
*/
261261
public function valid()
262262
{

src/EnumSet.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function getEnumeration()
106106

107107
/**
108108
* Attach a new enumerator or overwrite an existing one
109-
* @param Enum|null|boolean|int|float|string $enumerator
109+
* @param Enum|null|bool|int|float|string|array $enumerator
110110
* @return void
111111
* @throws InvalidArgumentException On an invalid given enumerator
112112
*/
@@ -118,7 +118,7 @@ public function attach($enumerator)
118118

119119
/**
120120
* Detach the given enumerator
121-
* @param Enum|null|boolean|int|float|string $enumerator
121+
* @param Enum|null|bool|int|float|string|array $enumerator
122122
* @return void
123123
* @throws InvalidArgumentException On an invalid given enumerator
124124
*/
@@ -130,8 +130,8 @@ public function detach($enumerator)
130130

131131
/**
132132
* Test if the given enumerator was attached
133-
* @param Enum|null|boolean|int|float|string $enumerator
134-
* @return boolean
133+
* @param Enum|null|bool|int|float|string|array $enumerator
134+
* @return bool
135135
*/
136136
public function contains($enumerator)
137137
{
@@ -233,7 +233,7 @@ private function doRewindInt()
233233

234234
/**
235235
* Test if the iterator is in a valid state
236-
* @return boolean
236+
* @return bool
237237
*/
238238
public function valid()
239239
{
@@ -710,7 +710,7 @@ public function setBinaryBitsetBe($bitset)
710710
* Get a bit at the given ordinal number
711711
*
712712
* @param int $ordinal Ordinal number of bit to get
713-
* @return boolean
713+
* @return bool
714714
*/
715715
public function getBit($ordinal)
716716
{
@@ -727,7 +727,7 @@ public function getBit($ordinal)
727727
* This is the binary bitset implementation.
728728
*
729729
* @param int $ordinal Ordinal number of bit to get
730-
* @return boolean
730+
* @return bool
731731
* @see getBit
732732
* @see doGetBitInt
733733
*/
@@ -742,7 +742,7 @@ private function doGetBitBin($ordinal)
742742
* This is the integer bitset implementation.
743743
*
744744
* @param int $ordinal Ordinal number of bit to get
745-
* @return boolean
745+
* @return bool
746746
* @see getBit
747747
* @see doGetBitBin
748748
*/

0 commit comments

Comments
 (0)