From a8c60745c8de6a3e91be80fedf15b586e3b08ea4 Mon Sep 17 00:00:00 2001 From: Julien PRIGENT Date: Thu, 19 Dec 2024 10:15:45 +0100 Subject: [PATCH 1/3] fix(maker-bundle): Correct bug related to namespace detection --- src/Generator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.php b/src/Generator.php index fbadc1bca..84934d9a9 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -188,7 +188,7 @@ public function createClassNameDetails(string $name, string $namespacePrefix, st $className = Str::asClassName($name, $suffix); try { - Validator::classDoesNotExist($className); + Validator::classDoesNotExist(\sprintf('%s/%s', $namespacePrefix, $className)); $className = rtrim($fullNamespacePrefix, '\\').'\\'.$className; } catch (RuntimeCommandException) { } From 52f63b25bd94cae2ec79389be0f9dc5d7df12ccb Mon Sep 17 00:00:00 2001 From: Julien PRIGENT Date: Thu, 19 Dec 2024 11:00:25 +0100 Subject: [PATCH 2/3] check namespace only if it was passed ;) --- src/Generator.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Generator.php b/src/Generator.php index 84934d9a9..dfc56d0bd 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -188,7 +188,12 @@ public function createClassNameDetails(string $name, string $namespacePrefix, st $className = Str::asClassName($name, $suffix); try { - Validator::classDoesNotExist(\sprintf('%s/%s', $namespacePrefix, $className)); + $check = $className; + if (!empty($namespacePrefix) && empty($suffix)) { + $check = \sprintf('%s\%s', $namespacePrefix, $check); + } + Validator::classDoesNotExist($check); + $className = rtrim($fullNamespacePrefix, '\\').'\\'.$className; } catch (RuntimeCommandException) { } From d3f0aa47361a870cda604c6f88645e9ea85e34bc Mon Sep 17 00:00:00 2001 From: Julien PRIGENT Date: Thu, 19 Dec 2024 11:11:10 +0100 Subject: [PATCH 3/3] fix coding standard --- src/Generator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.php b/src/Generator.php index dfc56d0bd..98f7d83f7 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -192,7 +192,7 @@ public function createClassNameDetails(string $name, string $namespacePrefix, st if (!empty($namespacePrefix) && empty($suffix)) { $check = \sprintf('%s\%s', $namespacePrefix, $check); } - Validator::classDoesNotExist($check); + Validator::classDoesNotExist($check); $className = rtrim($fullNamespacePrefix, '\\').'\\'.$className; } catch (RuntimeCommandException) {