-
-
Notifications
You must be signed in to change notification settings - Fork 147
Open
Description
Version: v4.1.8
Bug Description
Creating a class with the name "Enum" does not work because its in the keyword list.
Steps To Reproduce
$file = new PhpFile();
$namespace = $file->addNamespace('Test');
$class = $namespace->addClass('Enum');
This will throw an exception:
In ClassLike.php line 89:
Value 'Enum' is not valid class name.
Expected Behavior
Enum is a valid class name when its under a namespace:
<?php
namespace Test;
class Enum
{
}
Possible Solution
I suggest to remove the keyword from the list or to create a real list of unsupported PHP class names:
https://www.php.net/manual/en/reserved.keywords.php +
- self
- static
- parent
Metadata
Metadata
Assignees
Labels
No labels