Skip to content

Commit f4c0224

Browse files
committed
Build-in func call + removed not needed get_class() + more strict arg type for Enum::get()
1 parent d71dc32 commit f4c0224

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Enum.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ final public static function get($enumerator)
181181
/**
182182
* Get an enumerator instance by the given value
183183
*
184-
* @param mixed $value
184+
* @param null|bool|int|float|string|array $value
185185
* @return static
186186
* @throws InvalidArgumentException On an unknwon or invalid value
187187
* @throws LogicException On ambiguous constant values

src/EnumSerializableTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function unserialize($serialized)
5555
throw new RuntimeException($message);
5656
}
5757

58-
$class = \get_class($this);
58+
$class = static::class;
5959
$enumerator = $this;
6060
$closure = function () use ($class, $name, $value, $enumerator) {
6161
if ($value !== null && $this->value !== null) {

src/EnumSet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function __construct($enumeration)
7474
}
7575

7676
$this->enumeration = $enumeration;
77-
$this->ordinalMax = count($enumeration::getConstants());
77+
$this->ordinalMax = \count($enumeration::getConstants());
7878

7979
// By default the bitset is initialized as integer bitset
8080
// in case the enumeraton has more enumerators then integer bits

0 commit comments

Comments
 (0)