Skip to content

Commit

Permalink
Fixed missing option
Browse files Browse the repository at this point in the history
  • Loading branch information
Sammyjo20 committed Dec 2, 2023
1 parent 2d8ca33 commit 0e1f3f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, bcmath, intl, exif, iconv, fileinfo
coverage: none

- name: Setup problem matchers
Expand Down
6 changes: 3 additions & 3 deletions src/Console/Commands/MakeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class MakeRequest extends MakeCommand
protected function getOptions(): array
{
return [
['method', null, InputOption::VALUE_REQUIRED, 'the method of the request'],
['method', 'm', InputOption::VALUE_REQUIRED, 'the method of the request'],
];
}

Expand Down Expand Up @@ -83,15 +83,15 @@ protected function afterPromptingForMissingArguments(InputInterface $input, Outp
protected function buildClass($name): MakeRequest|string
{
$stub = $this->files->get($this->getStub());
$stub = $this->replaceMethod($stub, $this->option('method'));
$stub = $this->replaceMethod($stub, $this->option('method') ?? 'GET');

return $this->replaceNamespace($stub, $name)->replaceClass($stub, $name);
}

/**
* Replace the method for the stub
*/
protected function replaceMethod($stub, $name): string
protected function replaceMethod(string $stub, string $name): string
{
return str_replace('{{ method }}', $name, $stub);
}
Expand Down

0 comments on commit 0e1f3f4

Please sign in to comment.