Skip to content

Commit

Permalink
optimize the from named constructor to have only one array full scan …
Browse files Browse the repository at this point in the history
…without calling the constructor again
  • Loading branch information
drealecs committed Feb 15, 2021
1 parent b072dc2 commit be02f8d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ public function __wakeup()
*/
public static function from($value): self
{
static::assertValidValue($value);
$key = static::assertValidValueReturningKey($value);

return new static($value);
return self::__callStatic($key, []);
}

/**
Expand Down

0 comments on commit be02f8d

Please sign in to comment.