Skip to content

Commit

Permalink
[11.x] Simplify .php extension chopping in getNameInput (#51843)
Browse files Browse the repository at this point in the history
* Simplify `.php` extension chopping in `getNameInput`

* Update GeneratorCommand.php

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
osbre and taylorotwell authored Jun 19, 2024
1 parent 9619f56 commit 9b9e862
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/Illuminate/Console/GeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,13 +417,7 @@ protected function sortImports($stub)
*/
protected function getNameInput()
{
$name = trim($this->argument('name'));

if (Str::endsWith($name, '.php')) {
return Str::substr($name, 0, -4);
}

return $name;
return (string) Str::of($this->argument('name'))->trim()->beforeLast('.php');
}

/**
Expand Down

0 comments on commit 9b9e862

Please sign in to comment.