From 277adf944b671a8ba95970b278a2fb8f68521efe Mon Sep 17 00:00:00 2001 From: Artem Henvald Date: Wed, 22 Jun 2022 17:33:36 +0300 Subject: [PATCH] Update --- Command/GenerateDocsCommand.php | 7 +++---- Generator/Generator.php | 6 +++--- Tests/Generator/GeneratorTest.php | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Command/GenerateDocsCommand.php b/Command/GenerateDocsCommand.php index 83b0f6a..7e2e53e 100644 --- a/Command/GenerateDocsCommand.php +++ b/Command/GenerateDocsCommand.php @@ -13,6 +13,7 @@ namespace StfalconStudio\SwaggerBundle\Command; use StfalconStudio\SwaggerBundle\Generator\Generator; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -20,11 +21,10 @@ /** * GenerateDocsCommand. */ +#[AsCommand(name: 'swagger:generate-docs', description: 'Generates swagger docs')] class GenerateDocsCommand extends Command { - protected static $defaultName = 'swagger:generate-docs'; - - private Generator $generator; + private readonly Generator $generator; /** * @param Generator $generator @@ -42,7 +42,6 @@ public function __construct(Generator $generator) protected function configure(): void { $this - ->setDescription('Generate swagger docs') ->setHelp('This command generate swagger docs.') ; } diff --git a/Generator/Generator.php b/Generator/Generator.php index a78bbc1..f364524 100644 --- a/Generator/Generator.php +++ b/Generator/Generator.php @@ -21,11 +21,11 @@ */ class Generator { - private Environment $twig; + private readonly Environment $twig; - private ConfigParser $configParser; + private readonly ConfigParser $configParser; - private string$docsFolder; + private readonly string $docsFolder; /** * @param Environment $twig diff --git a/Tests/Generator/GeneratorTest.php b/Tests/Generator/GeneratorTest.php index 927d03c..6a7a8b6 100644 --- a/Tests/Generator/GeneratorTest.php +++ b/Tests/Generator/GeneratorTest.php @@ -26,10 +26,10 @@ final class GeneratorTest extends TestCase private string $docsFile = __DIR__.'/Fixtures/index.html'; /** @var Environment|MockObject */ - private $twig; + private Environment|MockObject $twig; /** @var ConfigParser|MockObject */ - private $parser; + private ConfigParser|MockObject $parser; private Filesystem $filesystem;