Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ public static function classExists(string $className, string $errorMessage = '')
{
self::notBlank($className);

// normalize class name
$className = str_replace('\\\\', '\\', $className);

if (!class_exists($className)) {
$errorMessage = $errorMessage ?: \sprintf('Class "%s" doesn\'t exist; please enter an existing full class name.', $className);

Expand Down Expand Up @@ -247,7 +250,7 @@ public static function classIsUserInterface($userClassName): string

public static function classIsBackedEnum($backedEnum): string
{
self::classExists($backedEnum);
$backedEnum = self::classExists($backedEnum);

if (!isset(class_implements($backedEnum)[\BackedEnum::class])) {
throw new RuntimeCommandException(\sprintf('The class "%s" is not a valid BackedEnum.', $backedEnum));
Expand Down
22 changes: 22 additions & 0 deletions tests/Maker/MakeEntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,28 @@ public function getTestDetails(): \Generator
$this->runEntityTest($runner);
}),
];

yield 'it_does_not_throw_error_with_double_slashes' => [$this->createMakeEntityTest()
->run(function (MakerTestRunner $runner) {
$this->copyEntity($runner, 'Enum/Role-basic.php');

$runner->runMaker([
// entity class name
'User',
// add additional field
'role',
'enum',
'App\\\\Entity\\\\Enum\\\\Role',
'',
// nullable
'y',
// finish adding fields
'',
]);

$this->runEntityTest($runner);
}),
];
}

/** @param array<string, mixed> $data */
Expand Down
Loading