Drop some obviously useless static function variables

these are better suited as constant literals.
This commit is contained in:
Dylan K. Taylor
2020-09-05 18:39:47 +01:00
parent 6b6f77f8af
commit b96565faa4
3 changed files with 9 additions and 14 deletions

View File

@ -82,8 +82,7 @@ trait EnumTrait{
* @throws \InvalidArgumentException
*/
private function __construct(string $enumName){
static $pattern = '/^\D[A-Za-z\d_]+$/u';
if(preg_match($pattern, $enumName, $matches) === 0){
if(preg_match('/^\D[A-Za-z\d_]+$/u', $enumName, $matches) === 0){
throw new \InvalidArgumentException("Invalid enum member name \"$enumName\", should only contain letters, numbers and underscores, and must not start with a number");
}
$this->enumName = $enumName;