From 7c55765fd8e85861be0babf84be37548d4eb2b42 Mon Sep 17 00:00:00 2001 From: Jason McCreary Date: Wed, 26 Jun 2024 19:45:27 -0400 Subject: [PATCH] Revert "[11.x] Simplify `.php` extension chopping in `getNameInput` (#51843)" This reverts commit 9b9e8620ab5805392ec6935ff29d3899fc96e053. --- src/Illuminate/Console/GeneratorCommand.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Console/GeneratorCommand.php b/src/Illuminate/Console/GeneratorCommand.php index 798a9dc5e137..07913bd67eac 100644 --- a/src/Illuminate/Console/GeneratorCommand.php +++ b/src/Illuminate/Console/GeneratorCommand.php @@ -417,7 +417,13 @@ protected function sortImports($stub) */ protected function getNameInput() { - return (string) Str::of($this->argument('name'))->trim()->beforeLast('.php'); + $name = trim($this->argument('name')); + + if (Str::endsWith($name, '.php')) { + return Str::substr($name, 0, -4); + } + + return $name; } /**