diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d618c581..e328ee76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,8 +17,8 @@ jobs: - "ubuntu-latest" - "windows-latest" php-version: - - "8.0" - "8.1" + - "8.2" dependencies: - "lowest" - "highest" @@ -53,7 +53,7 @@ jobs: operating-system: - "ubuntu-latest" php-version: - - "8.1" + - "8.2" steps: - name: "Checkout" uses: "actions/checkout@v2" @@ -81,7 +81,7 @@ jobs: operating-system: - "ubuntu-latest" php-version: - - "8.1" + - "8.2" steps: - name: "Checkout" uses: "actions/checkout@v2" @@ -109,7 +109,7 @@ jobs: operating-system: - "ubuntu-latest" php-version: - - "8.1" + - "8.2" steps: - name: "Checkout" uses: "actions/checkout@v2" @@ -137,7 +137,7 @@ jobs: operating-system: - "ubuntu-latest" php-version: - - "8.1" + - "8.2" steps: - name: "Checkout" uses: "actions/checkout@v2" @@ -170,7 +170,7 @@ jobs: operating-system: - "ubuntu-latest" php-version: - - "8.1" + - "8.2" steps: - name: "Checkout" uses: "actions/checkout@v2" @@ -201,7 +201,7 @@ jobs: operating-system: - "ubuntu-latest" php-version: - - "8.1" + - "8.2" steps: - name: "Checkout" uses: "actions/checkout@v2" diff --git a/composer.json b/composer.json index 4a7caf07..0bdaa8fd 100644 --- a/composer.json +++ b/composer.json @@ -22,42 +22,42 @@ } ], "require": { - "php": "^8.0", + "php": "^8.1", "ext-json": "*", "cebe/php-openapi": "^1.7", - "league/openapi-psr7-validator": "^0.18.0", - "lukasoppermann/http-status": "^3.2", - "nikic/php-parser": "^4.13", + "league/openapi-psr7-validator": "^0.22.0", + "lukasoppermann/http-status": "^4.0", + "nikic/php-parser": "^4.19", "nyholm/psr7": "^1.5", "phpdocumentor/reflection-docblock": "^5.3", "sspat/reserved-words": "^3.0", - "symfony/cache": "^6.0", - "symfony/cache-contracts": "^3", - "symfony/config": "^6.0", - "symfony/console": "^6.0", - "symfony/dependency-injection": "^6.0", - "symfony/event-dispatcher": "^6.0", - "symfony/http-kernel": "^6.0", - "symfony/psr-http-message-bridge": "^2.1", - "symfony/routing": "^6.0", - "symfony/yaml": "^6.0", + "symfony/cache": "^6.4|^7.0", + "symfony/cache-contracts": "^3.5", + "symfony/config": "^6.4|^7.0", + "symfony/console": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/psr-http-message-bridge": "^6.4|^7.0", + "symfony/routing": "^6.4|^7.0", + "symfony/yaml": "^6.4|^7.0", "thecodingmachine/safe": "^1.3|^2" }, "require-dev": { - "doctrine/coding-standard": "^9.0", - "matthiasnoback/symfony-config-test": "^4.3", - "matthiasnoback/symfony-dependency-injection-test": "^4.3", - "phpstan/phpstan": "^1.5", - "phpstan/phpstan-phpunit": "^1.1", - "phpstan/phpstan-strict-rules": "^1.1", - "phpunit/phpunit": "^9.5", - "roave/infection-static-analysis-plugin": "^1.18", - "squizlabs/php_codesniffer": "^3.6", - "symfony/browser-kit": "^6.0", - "symfony/dom-crawler": "^6.0", - "symfony/framework-bundle": "^6.0", + "doctrine/coding-standard": "^12.0", + "matthiasnoback/symfony-config-test": "^5.1", + "matthiasnoback/symfony-dependency-injection-test": "^5.1", + "phpstan/phpstan": "^1.11", + "phpstan/phpstan-phpunit": "^1.4", + "phpstan/phpstan-strict-rules": "^1.6", + "phpunit/phpunit": "^10.5", + "roave/infection-static-analysis-plugin": "^1.35", + "squizlabs/php_codesniffer": "^3.10", + "symfony/browser-kit": "^6.4|^7.0", + "symfony/dom-crawler": "^6.4|^7.0", + "symfony/framework-bundle": "^6.4|^7.0", "thecodingmachine/phpstan-safe-rule": "^1.2", - "vimeo/psalm": "^4.22" + "vimeo/psalm": "^5.24" }, "minimum-stability": "dev", "prefer-stable": true, @@ -90,7 +90,7 @@ "psalm": "psalm", "stan": "phpstan analyse --memory-limit=-1 --xdebug", "tests": "phpunit --fail-on-warning", - "mutation": "vendor/bin/roave-infection-static-analysis-plugin --only-covered --test-framework-options=\"--testsuite=unit\"", + "mutation": "php -d memory_limit=-1 vendor/bin/roave-infection-static-analysis-plugin --only-covered --test-framework-options=\"--testsuite=unit\"", "all": "composer psalm && composer stan && composer tests && composer mutation && composer cs && composer security", "get-security": "rm -f local-php-security-checker && curl -s https://api.github.com/repos/fabpot/local-php-security-checker/releases/latest | grep -E \"browser_download_url(.+)linux_amd64\" | cut -d : -f 2,3 | tr -d \\\" | xargs -I % curl % -L -o local-php-security-checker && chmod +x local-php-security-checker", "security": "./local-php-security-checker" diff --git a/phpstan.neon b/phpstan.neon index fd730ca9..0045c6ba 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,7 +3,6 @@ parameters: paths: - src # - test - checkMissingIterableValueType: false treatPhpDocTypesAsCertain: false excludePaths: - 'src/DependencyInjection/Configuration.php' @@ -27,6 +26,10 @@ parameters: message: '#OnMoon\\OpenApiServerBundle\\Router\\RouteLoader::__construct\(\) does not call parent constructor from Symfony\\Component\\Config\\Loader\\Loader\.#' paths: - %currentWorkingDirectory%/src/Router/RouteLoader.php + - + message: '#Method OnMoon\\OpenApiServerBundle\\Specification\\SpecificationParser::getResponseDtoDefinitions\(\) has parameter \$responses with no value type specified in iterable type array\.#' + paths: + - %currentWorkingDirectory%/src/Specification/SpecificationParser.php includes: - vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon - vendor/phpstan/phpstan-phpunit/extension.neon diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ea5e7383..7b61c738 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,29 +1,24 @@ - - - - ./test/unit - - - ./test/functional - - - ./test/generation - - - - - ./src - - - - - - - + + + + ./test/unit + + + ./test/functional + + + ./test/generation + + + + + + + + + + ./src + + diff --git a/psalm.xml b/psalm.xml index 42c3e930..970e1147 100644 --- a/psalm.xml +++ b/psalm.xml @@ -6,6 +6,8 @@ strictBinaryOperands="true" findUnusedVariablesAndParams="true" ensureArrayStringOffsetsExist="true" + findUnusedBaselineEntry="true" + findUnusedCode="false" phpVersion="8.1" > diff --git a/src/CodeGenerator/Definitions/DtoDefinition.php b/src/CodeGenerator/Definitions/DtoDefinition.php index a65c02f1..0c36486a 100644 --- a/src/CodeGenerator/Definitions/DtoDefinition.php +++ b/src/CodeGenerator/Definitions/DtoDefinition.php @@ -14,9 +14,7 @@ class DtoDefinition extends GeneratedClassDefinition implements DtoReference private array $properties; private ?ClassReference $implements; - /** - * @param PropertyDefinition[] $properties - */ + /** @param PropertyDefinition[] $properties */ public function __construct(array $properties) { $this->implements = ClassDefinition::fromFQCN(Dto::class); @@ -28,9 +26,7 @@ final public function isEmpty(): bool return count($this->properties) === 0; } - /** - * @return PropertyDefinition[] - */ + /** @return PropertyDefinition[] */ final public function getProperties(): array { return $this->properties; diff --git a/src/CodeGenerator/Definitions/GeneratedInterfaceDefinition.php b/src/CodeGenerator/Definitions/GeneratedInterfaceDefinition.php index 28867bce..75ea031c 100644 --- a/src/CodeGenerator/Definitions/GeneratedInterfaceDefinition.php +++ b/src/CodeGenerator/Definitions/GeneratedInterfaceDefinition.php @@ -13,9 +13,7 @@ final public function getExtends(): ?ClassReference return $this->extends; } - /** - * @return GeneratedInterfaceDefinition - */ + /** @return GeneratedInterfaceDefinition */ final public function setExtends(?ClassReference $extends): self { $this->extends = $extends; diff --git a/src/CodeGenerator/Definitions/GraphDefinition.php b/src/CodeGenerator/Definitions/GraphDefinition.php index 5e3ed607..1859a898 100644 --- a/src/CodeGenerator/Definitions/GraphDefinition.php +++ b/src/CodeGenerator/Definitions/GraphDefinition.php @@ -10,18 +10,14 @@ final class GraphDefinition private array $specifications; private ServiceSubscriberDefinition $serviceSubscriber; - /** - * @param SpecificationDefinition[] $specifications - */ + /** @param SpecificationDefinition[] $specifications */ public function __construct(array $specifications, ServiceSubscriberDefinition $serviceSubscriber) { $this->specifications = $specifications; $this->serviceSubscriber = $serviceSubscriber; } - /** - * @return SpecificationDefinition[] - */ + /** @return SpecificationDefinition[] */ public function getSpecifications(): array { return $this->specifications; diff --git a/src/CodeGenerator/Definitions/OperationDefinition.php b/src/CodeGenerator/Definitions/OperationDefinition.php index 72a3711e..034a45de 100644 --- a/src/CodeGenerator/Definitions/OperationDefinition.php +++ b/src/CodeGenerator/Definitions/OperationDefinition.php @@ -6,9 +6,7 @@ final class OperationDefinition { - /** - * @param ResponseDefinition[] $responses - */ + /** @param ResponseDefinition[] $responses */ public function __construct( private string $url, private string $method, @@ -52,9 +50,7 @@ public function getRequest(): ?DtoReference return $this->request; } - /** - * @return ResponseDefinition[] - */ + /** @return ResponseDefinition[] */ public function getResponses(): array { return $this->responses; diff --git a/src/CodeGenerator/Definitions/ServiceSubscriberDefinition.php b/src/CodeGenerator/Definitions/ServiceSubscriberDefinition.php index fbf9e455..6ee7ac59 100644 --- a/src/CodeGenerator/Definitions/ServiceSubscriberDefinition.php +++ b/src/CodeGenerator/Definitions/ServiceSubscriberDefinition.php @@ -16,17 +16,13 @@ public function __construct() $this->implements = [ClassDefinition::fromFQCN(ApiLoader::class)]; } - /** - * @return ClassReference[] - */ + /** @return ClassReference[] */ public function getImplements(): array { return $this->implements; } - /** - * @param ClassReference[] $implements - */ + /** @param ClassReference[] $implements */ public function setImplements(array $implements): self { $this->implements = $implements; diff --git a/src/CodeGenerator/Definitions/SpecificationDefinition.php b/src/CodeGenerator/Definitions/SpecificationDefinition.php index e7e2d406..9efb12c6 100644 --- a/src/CodeGenerator/Definitions/SpecificationDefinition.php +++ b/src/CodeGenerator/Definitions/SpecificationDefinition.php @@ -16,9 +16,7 @@ public function __construct(private SpecificationConfig $specification, private { } - /** - * @return OperationDefinition[] - */ + /** @return OperationDefinition[] */ public function getOperations(): array { return $this->operations; @@ -29,9 +27,7 @@ public function getSpecification(): SpecificationConfig return $this->specification; } - /** - * @return ComponentDefinition[] - */ + /** @return ComponentDefinition[] */ public function getComponents(): array { return $this->components; diff --git a/src/CodeGenerator/FileGenerator.php b/src/CodeGenerator/FileGenerator.php index aaad4be1..7f3e966d 100644 --- a/src/CodeGenerator/FileGenerator.php +++ b/src/CodeGenerator/FileGenerator.php @@ -30,9 +30,7 @@ public function __construct( $this->serviceSubscriberGenerator = $serviceSubscriberGenerator; } - /** - * @return GeneratedFileDefinition[] - */ + /** @return GeneratedFileDefinition[] */ public function generateAllFiles(GraphDefinition $graph): array { /** @var GeneratedFileDefinition[] $result */ @@ -58,9 +56,7 @@ public function generateAllFiles(GraphDefinition $graph): array return $result; } - /** - * @return GeneratedFileDefinition[] - */ + /** @return GeneratedFileDefinition[] */ public function generateDtoTree(?DtoReference $root): array { if (! $root instanceof DtoDefinition) { diff --git a/src/CodeGenerator/Naming/NamingStrategy.php b/src/CodeGenerator/Naming/NamingStrategy.php index 2b3cfb35..40488cc8 100644 --- a/src/CodeGenerator/Naming/NamingStrategy.php +++ b/src/CodeGenerator/Naming/NamingStrategy.php @@ -9,9 +9,7 @@ interface NamingStrategy { - /** - * @psalm-return class-string - */ + /** @psalm-return class-string */ public function getInterfaceFQCN(string $apiNameSpace, string $operationId): string; public function stringToNamespace(string $text): string; diff --git a/src/CodeGenerator/PhpParserGenerators/DtoCodeGenerator.php b/src/CodeGenerator/PhpParserGenerators/DtoCodeGenerator.php index ccaaeb8e..04b4b3ef 100644 --- a/src/CodeGenerator/PhpParserGenerators/DtoCodeGenerator.php +++ b/src/CodeGenerator/PhpParserGenerators/DtoCodeGenerator.php @@ -68,9 +68,7 @@ public function generate(DtoDefinition $definition): GeneratedFileDefinition ); } - /** - * @return Builder[] - */ + /** @return Builder[] */ private function generateProperties(FileBuilder $builder, DtoDefinition $definition): array { $properties = []; @@ -81,9 +79,7 @@ private function generateProperties(FileBuilder $builder, DtoDefinition $definit return $properties; } - /** - * @return Builder[] - */ + /** @return Builder[] */ private function generateGetters(FileBuilder $builder, DtoDefinition $definition): array { $properties = []; @@ -98,9 +94,7 @@ private function generateGetters(FileBuilder $builder, DtoDefinition $definition return $properties; } - /** - * @return Builder[] - */ + /** @return Builder[] */ private function generateSetters(FileBuilder $builder, DtoDefinition $definition): array { $properties = []; @@ -115,9 +109,7 @@ private function generateSetters(FileBuilder $builder, DtoDefinition $definition return $properties; } - /** - * @return Builder[] - */ + /** @return Builder[] */ private function generateConstructor(FileBuilder $builder, DtoDefinition $definition): array { $constructorBuilder = $this->factory->method('__construct')->makePublic(); diff --git a/src/Command/DeleteGeneratedCodeCommand.php b/src/Command/DeleteGeneratedCodeCommand.php index c0785cde..6001b1b5 100644 --- a/src/Command/DeleteGeneratedCodeCommand.php +++ b/src/Command/DeleteGeneratedCodeCommand.php @@ -37,6 +37,7 @@ public function __construct(string $rootPath, ?string $name = null) /** * phpcs:disable SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint + * * @var string|null */ protected static $defaultName = self::COMMAND; diff --git a/src/Command/GenerateApiCodeCommand.php b/src/Command/GenerateApiCodeCommand.php index 8ebce175..97e3e2b6 100644 --- a/src/Command/GenerateApiCodeCommand.php +++ b/src/Command/GenerateApiCodeCommand.php @@ -60,6 +60,7 @@ protected function configure(): void /** * phpcs:disable SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint + * * @var string|null */ protected static $defaultName = self::COMMAND; @@ -117,7 +118,10 @@ private function removeEmptyDirectories(string $root): void RecursiveIteratorIterator::CHILD_FIRST ); - /** @var SplFileInfo $dir */ + /** + * @var SplFileInfo $dir + * @psalm-suppress PossiblyNullArgument + */ foreach ($directories as $dir) { if (! $dir->isDir() || iterator_count($directories->callGetChildren()) !== 0) { continue; diff --git a/src/Controller/ApiController.php b/src/Controller/ApiController.php index e19d61ab..8e5fc6c3 100644 --- a/src/Controller/ApiController.php +++ b/src/Controller/ApiController.php @@ -114,9 +114,7 @@ private function getSpecification(Route $route): Specification return $this->specificationLoader->load($this->getSpecificationName($route)); } - /** - * @psalm-param class-string $inputDtoClass - */ + /** @psalm-param class-string $inputDtoClass */ private function createRequestDto( Request $request, Operation $operation, @@ -142,9 +140,7 @@ private function executeRequestHandler( return $responseDto; } - /** - * @return array{0: class-string, 1: RequestHandler} - */ + /** @return array{0: class-string, 1: RequestHandler} */ private function getRequestHandler(Request $request, Operation $operation): array { $handlerName = $operation->getRequestHandlerName(); diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index c1062060..148487eb 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -13,7 +13,9 @@ public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('open_api_server'); - $treeBuilder->getRootNode() + /** @psalm-suppress UndefinedMethod */ + $treeBuilder + ->getRootNode() ->children() ->scalarNode('root_path')->end() ->scalarNode('root_name_space')->defaultValue('App\Generated')->cannotBeEmpty()->end() diff --git a/src/DependencyInjection/OpenApiServerExtension.php b/src/DependencyInjection/OpenApiServerExtension.php index 6a8d03ba..416633db 100644 --- a/src/DependencyInjection/OpenApiServerExtension.php +++ b/src/DependencyInjection/OpenApiServerExtension.php @@ -18,9 +18,7 @@ final class OpenApiServerExtension extends Extension implements ExtensionInterface { - /** - * @param mixed[] $configs - */ + /** @param mixed[] $configs */ public function load(array $configs, ContainerBuilder $container): void { $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); diff --git a/src/Event/CodeGenerator/FilesReadyEvent.php b/src/Event/CodeGenerator/FilesReadyEvent.php index 68ddb9eb..7e79d5b7 100644 --- a/src/Event/CodeGenerator/FilesReadyEvent.php +++ b/src/Event/CodeGenerator/FilesReadyEvent.php @@ -19,17 +19,13 @@ final class FilesReadyEvent extends Event /** @var GeneratedFileDefinition[] */ private array $files; - /** - * @param GeneratedFileDefinition[] $files - */ + /** @param GeneratedFileDefinition[] $files */ public function __construct(array $files) { $this->files = $files; } - /** - * @return GeneratedFileDefinition[] - */ + /** @return GeneratedFileDefinition[] */ public function files(): array { return $this->files; diff --git a/src/Router/RouteLoader.php b/src/Router/RouteLoader.php index c482c3a2..2eb6df24 100644 --- a/src/Router/RouteLoader.php +++ b/src/Router/RouteLoader.php @@ -60,9 +60,7 @@ public function load(mixed $resource, ?string $type = null): RouteCollection return $routes; } - /** - * @inheritDoc - */ + /** @inheritDoc */ public function supports($resource, ?string $type = null): bool { return $type === self::OPENAPI_TYPE; diff --git a/src/Serializer/ArrayDtoSerializer.php b/src/Serializer/ArrayDtoSerializer.php index 3d4fe9c2..474dcb7e 100644 --- a/src/Serializer/ArrayDtoSerializer.php +++ b/src/Serializer/ArrayDtoSerializer.php @@ -60,9 +60,7 @@ public function createRequestDto( $input['body'] = $this->convert(true, $rawBody, $bodyType->getSchema()); } - /** - * @var Dto $inputDto - */ + /** @var Dto $inputDto */ $inputDto = $inputDtoFQCN::{'fromArray'}($input); return $inputDto; diff --git a/src/Serializer/DtoSerializer.php b/src/Serializer/DtoSerializer.php index d5ef15ec..d3adda87 100644 --- a/src/Serializer/DtoSerializer.php +++ b/src/Serializer/DtoSerializer.php @@ -11,9 +11,7 @@ interface DtoSerializer { - /** - * @psalm-param class-string $inputDtoFQCN - */ + /** @psalm-param class-string $inputDtoFQCN */ public function createRequestDto( Request $request, Operation $operation, diff --git a/src/Specification/Definitions/ObjectSchema.php b/src/Specification/Definitions/ObjectSchema.php index da4dbe25..e642b4f6 100644 --- a/src/Specification/Definitions/ObjectSchema.php +++ b/src/Specification/Definitions/ObjectSchema.php @@ -9,17 +9,13 @@ final class ObjectSchema implements GetSchema /** @var Property[] $properties; */ private array $properties; - /** - * @param Property[] $properties - */ + /** @param Property[] $properties */ public function __construct(array $properties) { $this->properties = $properties; } - /** - * @return Property[] - */ + /** @return Property[] */ public function getProperties(): array { return $this->properties; diff --git a/src/Specification/Definitions/Operation.php b/src/Specification/Definitions/Operation.php index ab33b554..06b3687a 100644 --- a/src/Specification/Definitions/Operation.php +++ b/src/Specification/Definitions/Operation.php @@ -46,17 +46,13 @@ public function getRequestBody(): ObjectSchema|ObjectReference|null return $this->requestBody; } - /** - * @return array - */ + /** @return array */ public function getRequestParameters(): array { return $this->requestParameters; } - /** - * @return array - */ + /** @return array */ public function getResponses(): array { return $this->responses; diff --git a/src/Specification/Definitions/Property.php b/src/Specification/Definitions/Property.php index 3063da0b..db538592 100644 --- a/src/Specification/Definitions/Property.php +++ b/src/Specification/Definitions/Property.php @@ -34,9 +34,7 @@ public function isArray(): bool return $this->array; } - /** - * @return Property - */ + /** @return Property */ public function setArray(bool $array): self { $this->array = $array; @@ -44,17 +42,13 @@ public function setArray(bool $array): self return $this; } - /** - * @return bool|float|int|string|null - */ + /** @return bool|float|int|string|null */ public function getDefaultValue() { return $this->defaultValue; } - /** - * @param bool|float|int|string|null $defaultValue - */ + /** @param bool|float|int|string|null $defaultValue */ public function setDefaultValue($defaultValue): Property { $this->defaultValue = $defaultValue; @@ -67,9 +61,7 @@ public function isRequired(): bool return $this->required; } - /** - * @return Property - */ + /** @return Property */ public function setRequired(bool $required): self { $this->required = $required; @@ -82,9 +74,7 @@ public function getScalarTypeId(): ?int return $this->scalarTypeId; } - /** - * @return Property - */ + /** @return Property */ public function setScalarTypeId(?int $scalarTypeId): self { $this->scalarTypeId = $scalarTypeId; @@ -97,9 +87,7 @@ public function getObjectTypeDefinition(): ObjectSchema|ObjectReference|null return $this->objectTypeDefinition; } - /** - * @return Property - */ + /** @return Property */ public function setObjectTypeDefinition(ObjectSchema|ObjectReference|null $objectTypeDefinition): self { $this->objectTypeDefinition = $objectTypeDefinition; @@ -112,9 +100,7 @@ public function getDescription(): ?string return $this->description; } - /** - * @return Property - */ + /** @return Property */ public function setDescription(?string $description): self { $this->description = $description; @@ -127,9 +113,7 @@ public function getPattern(): ?string return $this->pattern; } - /** - * @return Property - */ + /** @return Property */ public function setPattern(?string $pattern): self { $this->pattern = $pattern; diff --git a/src/Specification/Definitions/Specification.php b/src/Specification/Definitions/Specification.php index e13dcff7..707925a8 100644 --- a/src/Specification/Definitions/Specification.php +++ b/src/Specification/Definitions/Specification.php @@ -33,9 +33,7 @@ public function getOperation(string $id): Operation return $this->operations[$id]; } - /** - * @return array - */ + /** @return array */ public function getComponentSchemas(): array { return $this->componentSchemas; diff --git a/src/Specification/SpecificationLoader.php b/src/Specification/SpecificationLoader.php index 74471f5e..5fcc3458 100644 --- a/src/Specification/SpecificationLoader.php +++ b/src/Specification/SpecificationLoader.php @@ -43,9 +43,7 @@ public function __construct(SpecificationParser $parser, FileLocatorInterface $l $this->cache = $cache; } - /** - * @param array{path:string,type:string|null,name_space:string,media_type:string,date_time_class:string|null} $spec - */ + /** @param array{path:string,type:string|null,name_space:string,media_type:string,date_time_class:string|null} $spec */ public function registerSpec(string $name, array $spec): void { $this->specs[$name] = new SpecificationConfig( diff --git a/src/Specification/SpecificationParser.php b/src/Specification/SpecificationParser.php index 65ba4797..fea367a6 100644 --- a/src/Specification/SpecificationParser.php +++ b/src/Specification/SpecificationParser.php @@ -64,13 +64,9 @@ public function parseOpenApi(string $specificationName, SpecificationConfig $spe $this->dateTimeClass = $specificationConfig->getDateTimeClass(); - /** - * @var string $url - */ + /** @var string $url */ foreach ($parsedSpecification->paths as $url => $pathItem) { - /** - * @var string $method - */ + /** @var string $method */ foreach ($pathItem->getOperations() as $method => $operation) { $operationId = $operation->operationId; $summary = $operation->summary; @@ -227,9 +223,7 @@ private function filterParameters(array $parameters): array return array_filter($parameters, static fn ($parameter): bool => $parameter instanceof Parameter); } - /** - * @return Parameter[] - */ + /** @return Parameter[] */ private function mergeParameters(PathItem $pathItem, Operation $operation): array { $operationParameters = $this->filterParameters($operation->parameters); @@ -303,9 +297,7 @@ private function getComponentSchemaName(string $path): ?string return null; } - /** - * @param array{location:string,method:string,url:string,path:string} $exceptionContext - */ + /** @param array{location:string,method:string,url:string,path:string} $exceptionContext */ private function getObjectSchema(Schema $schema, ?bool $isRequest, ComponentArray $componentSchemas, array $exceptionContext): ObjectSchema|ObjectReference { if ($schema->type !== Type::OBJECT) { @@ -322,9 +314,7 @@ private function getObjectSchema(Schema $schema, ?bool $isRequest, ComponentArra } $propertyDefinitions = []; - /** - * @var string $propertyName - */ + /** @var string $propertyName */ foreach ($schema->properties as $propertyName => $property) { if (! ($property instanceof Schema)) { throw CannotParseOpenApi::becausePropertyIsNotScheme(); @@ -335,9 +325,7 @@ private function getObjectSchema(Schema $schema, ?bool $isRequest, ComponentArra continue; } - /** - * @psalm-suppress RedundantConditionGivenDocblockType - */ + /** @psalm-suppress RedundantConditionGivenDocblockType */ $required = is_array($schema->required) && in_array($propertyName, $schema->required, true); $propertyDefinitions[] = $this->getProperty($propertyName, $property, $isRequest, $componentSchemas, $exceptionContext)->setRequired($required); } @@ -353,9 +341,7 @@ private function getObjectSchema(Schema $schema, ?bool $isRequest, ComponentArra return $objectSchema; } - /** - * @param array{location:string,method:string,url:string,path:string} $exceptionContext - */ + /** @param array{location:string,method:string,url:string,path:string} $exceptionContext */ private function getProperty( string $propertyName, Schema|Reference|null $property, diff --git a/test/functional/CodeGenerator/Filesystem/FilePutContentsFileWriterTest.php b/test/functional/CodeGenerator/Filesystem/FilePutContentsFileWriterTest.php index bf703e28..7a253490 100644 --- a/test/functional/CodeGenerator/Filesystem/FilePutContentsFileWriterTest.php +++ b/test/functional/CodeGenerator/Filesystem/FilePutContentsFileWriterTest.php @@ -14,9 +14,7 @@ use const DIRECTORY_SEPARATOR; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Filesystem\FilePutContentsFileWriter - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Filesystem\FilePutContentsFileWriter */ final class FilePutContentsFileWriterTest extends TestCase { public function testWriteCreatesFile(): void diff --git a/test/functional/Command/CommandTestCase.php b/test/functional/Command/CommandTestCase.php index 6a5344f4..25ed24b3 100644 --- a/test/functional/Command/CommandTestCase.php +++ b/test/functional/Command/CommandTestCase.php @@ -30,6 +30,7 @@ public function tearDown(): void $filesystem = new Filesystem(); $filesystem->remove([TestKernel::$bundleRootPath]); unset($this->commandTester, $this->application); + parent::tearDown(); } diff --git a/test/functional/Command/DeleteGeneratedCodeCommandTest.php b/test/functional/Command/DeleteGeneratedCodeCommandTest.php index f2839537..3f30b673 100644 --- a/test/functional/Command/DeleteGeneratedCodeCommandTest.php +++ b/test/functional/Command/DeleteGeneratedCodeCommandTest.php @@ -14,9 +14,7 @@ use function Safe\mkdir; use function Safe\sprintf; -/** - * @covers \OnMoon\OpenApiServerBundle\Command\DeleteGeneratedCodeCommand - */ +/** @covers \OnMoon\OpenApiServerBundle\Command\DeleteGeneratedCodeCommand */ class DeleteGeneratedCodeCommandTest extends CommandTestCase { public function setUp(): void diff --git a/test/functional/Command/GenerateApiCodeCommandTest.php b/test/functional/Command/GenerateApiCodeCommandTest.php index f7102ef9..081ab9d8 100644 --- a/test/functional/Command/GenerateApiCodeCommandTest.php +++ b/test/functional/Command/GenerateApiCodeCommandTest.php @@ -15,14 +15,13 @@ use const DIRECTORY_SEPARATOR; -/** - * @covers \OnMoon\OpenApiServerBundle\Command\GenerateApiCodeCommand - */ +/** @covers \OnMoon\OpenApiServerBundle\Command\GenerateApiCodeCommand */ class GenerateApiCodeCommandTest extends CommandTestCase { public function setUp(): void { parent::setUp(); + $command = $this->application->find(GenerateApiCodeCommand::COMMAND); $this->commandTester = new CommandTester($command); } @@ -34,6 +33,7 @@ public function testGeneration(): void ]); $output = $this->commandTester->getDisplay(); + Assert::assertEquals(sprintf('API server code generated in: %s', TestKernel::$bundleRootPath), rtrim($output)); Assert::assertSame(0, $this->commandTester->getStatusCode()); Assert::assertDirectoryExists(TestKernel::$bundleRootPath); diff --git a/test/functional/Controller/ApiControllerTest.php b/test/functional/Controller/ApiControllerTest.php index 5f4938a7..4d035bfd 100644 --- a/test/functional/Controller/ApiControllerTest.php +++ b/test/functional/Controller/ApiControllerTest.php @@ -25,9 +25,7 @@ use const DIRECTORY_SEPARATOR; -/** - * @covers \OnMoon\OpenApiServerBundle\Controller\ApiController - */ +/** @covers \OnMoon\OpenApiServerBundle\Controller\ApiController */ class ApiControllerTest extends WebTestCase { private AbstractBrowser $client; @@ -60,6 +58,7 @@ public function tearDown(): void $filesystem = new Filesystem(); $filesystem->remove([TestKernel::$bundleRootPath]); unset($this->client); + parent::tearDown(); } @@ -100,7 +99,7 @@ protected function configureRoutes(RoutingConfigurator $routes): void private function createGetGoodImpl(): string { - $content = <<>>|string>> */ - public function parametersIsRequiredDataProvider(): array + public static function parametersIsRequiredDataProvider(): array { return [ [['specs' => [[]]], 'path'], @@ -62,7 +60,7 @@ public function testParametersIsRequired(array $configuration, string $parameter * @return mixed[] * @psalm-return list>|string>|string>> */ - public function parametersCannotBeEmptyDataProvider(): array + public static function parametersCannotBeEmptyDataProvider(): array { return [ [['root_name_space' => ''], 'root_name_space'], @@ -89,7 +87,7 @@ public function testParametersCannotBeEmpty(array $configuration, string $parame * @return mixed[] * @psalm-return list>>|string>> */ - public function parametersEnumDataProvider(): array + public static function parametersEnumDataProvider(): array { return [ [['specs' => [['path' => 'test', 'type' => 'someRandomString']]], 'specs.0.type', 'someRandomString', '"yaml", "json"'], diff --git a/test/functional/DependencyInjection/OpenApiServerExtensionTest.php b/test/functional/DependencyInjection/OpenApiServerExtensionTest.php index 40aac38d..bb24a4fd 100644 --- a/test/functional/DependencyInjection/OpenApiServerExtensionTest.php +++ b/test/functional/DependencyInjection/OpenApiServerExtensionTest.php @@ -10,14 +10,10 @@ use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; use Throwable; -/** - * @covers \OnMoon\OpenApiServerBundle\DependencyInjection\OpenApiServerExtension - */ +/** @covers \OnMoon\OpenApiServerBundle\DependencyInjection\OpenApiServerExtension */ class OpenApiServerExtensionTest extends AbstractExtensionTestCase { - /** - * @return array - */ + /** @return array */ protected function getContainerExtensions(): array { return [ @@ -29,7 +25,7 @@ protected function getContainerExtensions(): array * @return mixed[] * @psalm-return list> */ - public function parameterLoadedDataProvider(): array + public static function parameterLoadedDataProvider(): array { return [ ['openapi.generated.code.root.path','someRootPath'], diff --git a/test/functional/Specification/SpecificationLoaderTest.php b/test/functional/Specification/SpecificationLoaderTest.php index c8bcfba0..e6289e96 100644 --- a/test/functional/Specification/SpecificationLoaderTest.php +++ b/test/functional/Specification/SpecificationLoaderTest.php @@ -24,9 +24,7 @@ use function array_pop; use function Safe\sprintf; -/** - * @covers \OnMoon\OpenApiServerBundle\Specification\SpecificationLoader - */ +/** @covers \OnMoon\OpenApiServerBundle\Specification\SpecificationLoader */ class SpecificationLoaderTest extends TestCase { /** @var SpecificationParser|MockObject $specificationParser */ @@ -101,9 +99,7 @@ public function expiresAt(?DateTimeInterface $expiration): static return $item; } - /** - * @return array|Specification[] - */ + /** @return array|Specification[] */ public function getCachedItems(): array { return $this->items; @@ -173,9 +169,7 @@ public function testGetThrowsException(): void $specificationArray = $this->getSpecificationArray($specificationFileName); $specificationLoader->registerSpec(self::SPECIFICATION_NAME, $specificationArray); - /** - * phpcs:disable SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly - */ + /** phpcs:disable SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly */ $this->expectException(Exception::class); $this->expectExceptionMessage(sprintf('OpenApi spec "%s" is not registered in bundle config, ' . 'Registered specs are: %s.', $specificationName, self::SPECIFICATION_NAME)); @@ -245,10 +239,8 @@ public function testLoadMissedSpecificationFileThrowsException(): void $specificationLoader->load(self::SPECIFICATION_NAME); } - /** - * @return string[][] - */ - public function specificationProvider(): array + /** @return string[][] */ + public static function specificationProvider(): array { return [ ['specificationFileName' => 'specification.yaml'], @@ -256,9 +248,7 @@ public function specificationProvider(): array ]; } - /** - * @dataProvider specificationProvider - */ + /** @dataProvider specificationProvider */ public function testLoadSavesSpecificationInCache(string $specificationFileName): void { $this->specificationParser @@ -322,9 +312,7 @@ public function testLoadForbiddenSpecificationTypeThrowsException(): void $specificationLoader->load(self::SPECIFICATION_NAME); } - /** - * @return array{path:string,type:string|null,name_space:string,media_type:string} $spec - */ + /** @return array{path:string,type:string|null,name_space:string,media_type:string} $spec */ private function getSpecificationArray(string $specificationFileName): array { return [ diff --git a/test/functional/TestKernel.php b/test/functional/TestKernel.php index fb8bc3a9..16cbfb7c 100644 --- a/test/functional/TestKernel.php +++ b/test/functional/TestKernel.php @@ -56,7 +56,7 @@ public function getLogDir(): string } /** - * {@inheritdoc} + * {@inheritDoc} */ public function registerBundles(): iterable { diff --git a/test/generation/GenerationTestCase.php b/test/generation/GenerationTestCase.php index 0b0ad9f5..3b5c79df 100644 --- a/test/generation/GenerationTestCase.php +++ b/test/generation/GenerationTestCase.php @@ -44,9 +44,7 @@ protected function generateCodeFromSpec( return $fileWriter; } - /** - * @return Stmt[] - */ + /** @return Stmt[] */ protected function getStatements(string $phpCode): array { $statements = $this->phpParser->parse($phpCode); diff --git a/test/generation/TestApiServerCodeGeneratorFactory.php b/test/generation/TestApiServerCodeGeneratorFactory.php index 5bc0f0ad..806f482d 100644 --- a/test/generation/TestApiServerCodeGeneratorFactory.php +++ b/test/generation/TestApiServerCodeGeneratorFactory.php @@ -29,9 +29,7 @@ final class TestApiServerCodeGeneratorFactory { - /** - * @param mixed[] $specifications - */ + /** @param mixed[] $specifications */ public static function getCodeGenerator( array $specifications, FileWriter $fileWriter, diff --git a/test/unit/CodeGenerator/ApiServerCodeGeneratorTest.php b/test/unit/CodeGenerator/ApiServerCodeGeneratorTest.php index d3662e0e..a74bbc14 100644 --- a/test/unit/CodeGenerator/ApiServerCodeGeneratorTest.php +++ b/test/unit/CodeGenerator/ApiServerCodeGeneratorTest.php @@ -20,13 +20,12 @@ use OnMoon\OpenApiServerBundle\Specification\Definitions\SpecificationConfig; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Contracts\EventDispatcher\Event; use Webmozart\Assert\Assert; use const DIRECTORY_SEPARATOR; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\ApiServerCodeGenerator - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\ApiServerCodeGenerator */ final class ApiServerCodeGeneratorTest extends TestCase { public function testGenerate(): void @@ -78,13 +77,18 @@ public function testGenerate(): void $generatedFileDefinitionTwo = new GeneratedFileDefinition($generatedClassDefinitionTwo, 'test_two'); $eventDispatcher = $this->createMock(EventDispatcherInterface::class); + $matcher = self::exactly(2); $eventDispatcher - ->expects(self::exactly(2)) + ->expects($matcher) ->method('dispatch') - ->withConsecutive( - [new ClassGraphReadyEvent($graphDefinition)], - [new FilesReadyEvent([$generatedFileDefinition, $generatedFileDefinitionTwo])] - ); + ->willReturnCallback(function (Event $event) use ($matcher, $graphDefinition, $generatedFileDefinition, $generatedFileDefinitionTwo): object { + match ($matcher->numberOfInvocations()) { + 1 => $this->assertEquals($event, new ClassGraphReadyEvent($graphDefinition)), + 2 => $this->assertEquals($event, new FilesReadyEvent([$generatedFileDefinition, $generatedFileDefinitionTwo])), + }; + + return $event; + }); $fileGenerator = $this->createMock(FileGenerator::class); $fileGenerator @@ -94,13 +98,16 @@ public function testGenerate(): void ->willReturn([$generatedFileDefinition, $generatedFileDefinitionTwo]); $fileWriter = $this->createMock(FileWriter::class); + $matcher = self::exactly(2); $fileWriter - ->expects(self::exactly(2)) + ->expects($matcher) ->method('write') - ->withConsecutive( - [$generatedClassDefinition->getFilePath(), $generatedClassDefinition->getFileName(), $generatedFileDefinition->getFileContents()], - [$generatedClassDefinitionTwo->getFilePath(), $generatedClassDefinitionTwo->getFileName(), $generatedFileDefinitionTwo->getFileContents()] - ); + ->willReturnCallback(function (string $path, string $filename, string $contents) use ($matcher, $generatedClassDefinition, $generatedFileDefinition, $generatedClassDefinitionTwo, $generatedFileDefinitionTwo): void { + match ($matcher->numberOfInvocations()) { + 1 => $this->assertEquals([$path, $filename, $contents], [$generatedClassDefinition->getFilePath(), $generatedClassDefinition->getFileName(), $generatedFileDefinition->getFileContents()]), + 2 => $this->assertEquals([$path, $filename, $contents], [$generatedClassDefinitionTwo->getFilePath(), $generatedClassDefinitionTwo->getFileName(), $generatedFileDefinitionTwo->getFileContents()]), + }; + }); $apiServerCodeGenerator = new ApiServerCodeGenerator( $graphGenerator, diff --git a/test/unit/CodeGenerator/AttributeGeneratorTest.php b/test/unit/CodeGenerator/AttributeGeneratorTest.php index 7e9dfbaf..67bd377c 100644 --- a/test/unit/CodeGenerator/AttributeGeneratorTest.php +++ b/test/unit/CodeGenerator/AttributeGeneratorTest.php @@ -21,9 +21,7 @@ use function array_map; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\AttributeGenerator - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\AttributeGenerator */ class AttributeGeneratorTest extends TestCase { private Property $property; diff --git a/test/unit/CodeGenerator/Definitions/ClassDefinitionTest.php b/test/unit/CodeGenerator/Definitions/ClassDefinitionTest.php index 60899473..c2c7bbae 100644 --- a/test/unit/CodeGenerator/Definitions/ClassDefinitionTest.php +++ b/test/unit/CodeGenerator/Definitions/ClassDefinitionTest.php @@ -8,9 +8,7 @@ use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\ClassDefinition - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\ClassDefinition */ final class ClassDefinitionTest extends TestCase { public function testCorrectDefinitionCreatedFromFQCN(): void diff --git a/test/unit/CodeGenerator/Definitions/DtoDefinitionTest.php b/test/unit/CodeGenerator/Definitions/DtoDefinitionTest.php index 0ac005cf..691f5924 100644 --- a/test/unit/CodeGenerator/Definitions/DtoDefinitionTest.php +++ b/test/unit/CodeGenerator/Definitions/DtoDefinitionTest.php @@ -11,15 +11,11 @@ use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\DtoDefinition - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\DtoDefinition */ final class DtoDefinitionTest extends TestCase { - /** - * @return mixed[] - */ - public function dtoDefinitionProvider(): array + /** @return mixed[] */ + public static function dtoDefinitionProvider(): array { return [ [ diff --git a/test/unit/CodeGenerator/Definitions/GeneratedClassDefinitionTest.php b/test/unit/CodeGenerator/Definitions/GeneratedClassDefinitionTest.php index ec6d3d29..3c3e9269 100644 --- a/test/unit/CodeGenerator/Definitions/GeneratedClassDefinitionTest.php +++ b/test/unit/CodeGenerator/Definitions/GeneratedClassDefinitionTest.php @@ -8,9 +8,7 @@ use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\GeneratedClassDefinition - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\GeneratedClassDefinition */ final class GeneratedClassDefinitionTest extends TestCase { public function testGeneratedClassDefinition(): void diff --git a/test/unit/CodeGenerator/Definitions/GeneratedFileDefinitionTest.php b/test/unit/CodeGenerator/Definitions/GeneratedFileDefinitionTest.php index a6ee53da..f346dff3 100644 --- a/test/unit/CodeGenerator/Definitions/GeneratedFileDefinitionTest.php +++ b/test/unit/CodeGenerator/Definitions/GeneratedFileDefinitionTest.php @@ -9,9 +9,7 @@ use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\GeneratedFileDefinition - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\GeneratedFileDefinition */ final class GeneratedFileDefinitionTest extends TestCase { public function testGeneratedFileDefinition(): void diff --git a/test/unit/CodeGenerator/Definitions/GeneratedInterfaceDefinitionTest.php b/test/unit/CodeGenerator/Definitions/GeneratedInterfaceDefinitionTest.php index e96020ac..014d2b36 100644 --- a/test/unit/CodeGenerator/Definitions/GeneratedInterfaceDefinitionTest.php +++ b/test/unit/CodeGenerator/Definitions/GeneratedInterfaceDefinitionTest.php @@ -9,15 +9,11 @@ use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\GeneratedInterfaceDefinition - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\GeneratedInterfaceDefinition */ final class GeneratedInterfaceDefinitionTest extends TestCase { - /** - * @return mixed[] - */ - public function generatedInterfaceDefinitionProvider(): array + /** @return mixed[] */ + public static function generatedInterfaceDefinitionProvider(): array { return [ [ diff --git a/test/unit/CodeGenerator/Definitions/GraphDefinitionTest.php b/test/unit/CodeGenerator/Definitions/GraphDefinitionTest.php index e413634b..e9e3ddbb 100644 --- a/test/unit/CodeGenerator/Definitions/GraphDefinitionTest.php +++ b/test/unit/CodeGenerator/Definitions/GraphDefinitionTest.php @@ -15,15 +15,11 @@ use const DIRECTORY_SEPARATOR; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\GraphDefinition - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\GraphDefinition */ final class GraphDefinitionTest extends TestCase { - /** - * @return mixed[] - */ - public function graphDefinitionProvider(): array + /** @return mixed[] */ + public static function graphDefinitionProvider(): array { return [ [ diff --git a/test/unit/CodeGenerator/Definitions/OperationDefinitionTest.php b/test/unit/CodeGenerator/Definitions/OperationDefinitionTest.php index f7b98d6e..4f8e3a61 100644 --- a/test/unit/CodeGenerator/Definitions/OperationDefinitionTest.php +++ b/test/unit/CodeGenerator/Definitions/OperationDefinitionTest.php @@ -11,15 +11,11 @@ use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\OperationDefinition - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\OperationDefinition */ final class OperationDefinitionTest extends TestCase { - /** - * @return mixed[] - */ - public function operationDefinitionProvider(): array + /** @return mixed[] */ + public static function operationDefinitionProvider(): array { return [ [ diff --git a/test/unit/CodeGenerator/Definitions/PropertyDefinitionTest.php b/test/unit/CodeGenerator/Definitions/PropertyDefinitionTest.php index 8ea0a2b4..83309e57 100644 --- a/test/unit/CodeGenerator/Definitions/PropertyDefinitionTest.php +++ b/test/unit/CodeGenerator/Definitions/PropertyDefinitionTest.php @@ -10,15 +10,11 @@ use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\PropertyDefinition - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\PropertyDefinition */ final class PropertyDefinitionTest extends TestCase { - /** - * @return mixed[] - */ - public function propertyDefinitionProvider(): array + /** @return mixed[] */ + public static function propertyDefinitionProvider(): array { return [ [ diff --git a/test/unit/CodeGenerator/Definitions/RequestDtoDefinitionTest.php b/test/unit/CodeGenerator/Definitions/RequestDtoDefinitionTest.php index 52cefe98..e4ce65cb 100644 --- a/test/unit/CodeGenerator/Definitions/RequestDtoDefinitionTest.php +++ b/test/unit/CodeGenerator/Definitions/RequestDtoDefinitionTest.php @@ -14,10 +14,8 @@ final class RequestDtoDefinitionTest extends TestCase { - /** - * @return mixed[] - */ - public function requestDtoDefinitionProvider(): array + /** @return mixed[] */ + public static function requestDtoDefinitionProvider(): array { return [ [ diff --git a/test/unit/CodeGenerator/Definitions/RequestHandlerInterfaceDefinitionTest.php b/test/unit/CodeGenerator/Definitions/RequestHandlerInterfaceDefinitionTest.php index dcdd3b80..218bce9b 100644 --- a/test/unit/CodeGenerator/Definitions/RequestHandlerInterfaceDefinitionTest.php +++ b/test/unit/CodeGenerator/Definitions/RequestHandlerInterfaceDefinitionTest.php @@ -10,15 +10,11 @@ use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\RequestHandlerInterfaceDefinition - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\RequestHandlerInterfaceDefinition */ final class RequestHandlerInterfaceDefinitionTest extends TestCase { - /** - * @return mixed[] - */ - public function requestHandlerInterfaceDefinitionProvider(): array + /** @return mixed[] */ + public static function requestHandlerInterfaceDefinitionProvider(): array { return [ [ diff --git a/test/unit/CodeGenerator/Definitions/ResponseDtoDefinitionTest.php b/test/unit/CodeGenerator/Definitions/ResponseDtoDefinitionTest.php index d8b12730..e9574a24 100644 --- a/test/unit/CodeGenerator/Definitions/ResponseDtoDefinitionTest.php +++ b/test/unit/CodeGenerator/Definitions/ResponseDtoDefinitionTest.php @@ -11,15 +11,11 @@ use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\ResponseDefinition - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\ResponseDefinition */ final class ResponseDtoDefinitionTest extends TestCase { - /** - * @return mixed[] - */ - public function responseDtoDefinitionProvider(): array + /** @return mixed[] */ + public static function responseDtoDefinitionProvider(): array { return [ [ diff --git a/test/unit/CodeGenerator/Definitions/ServiceSubscriberDefinitionTest.php b/test/unit/CodeGenerator/Definitions/ServiceSubscriberDefinitionTest.php index cf32ff02..c722593f 100644 --- a/test/unit/CodeGenerator/Definitions/ServiceSubscriberDefinitionTest.php +++ b/test/unit/CodeGenerator/Definitions/ServiceSubscriberDefinitionTest.php @@ -10,15 +10,11 @@ use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\ServiceSubscriberDefinition - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\ServiceSubscriberDefinition */ final class ServiceSubscriberDefinitionTest extends TestCase { - /** - * @return mixed[] - */ - public function serviceSubscriberDefinitionProvider(): array + /** @return mixed[] */ + public static function serviceSubscriberDefinitionProvider(): array { return [ [ diff --git a/test/unit/CodeGenerator/Definitions/SpecificationDefinitionTest.php b/test/unit/CodeGenerator/Definitions/SpecificationDefinitionTest.php index 5c3f9fc8..5a95f52a 100644 --- a/test/unit/CodeGenerator/Definitions/SpecificationDefinitionTest.php +++ b/test/unit/CodeGenerator/Definitions/SpecificationDefinitionTest.php @@ -16,15 +16,11 @@ use const DIRECTORY_SEPARATOR; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\SpecificationDefinition - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Definitions\SpecificationDefinition */ final class SpecificationDefinitionTest extends TestCase { - /** - * @return mixed[] - */ - public function specificationDefinitionProvider(): array + /** @return mixed[] */ + public static function specificationDefinitionProvider(): array { return [ [ diff --git a/test/unit/CodeGenerator/GraphGeneratorTest.php b/test/unit/CodeGenerator/GraphGeneratorTest.php index 3e2c0402..20f5537a 100644 --- a/test/unit/CodeGenerator/GraphGeneratorTest.php +++ b/test/unit/CodeGenerator/GraphGeneratorTest.php @@ -85,6 +85,7 @@ public function setUp(): void public function tearDown(): void { unset($this->specificationLoader); + parent::tearDown(); } diff --git a/test/unit/CodeGenerator/NameGeneratorTest.php b/test/unit/CodeGenerator/NameGeneratorTest.php index aaa68e25..0cde6787 100644 --- a/test/unit/CodeGenerator/NameGeneratorTest.php +++ b/test/unit/CodeGenerator/NameGeneratorTest.php @@ -28,15 +28,11 @@ use const DIRECTORY_SEPARATOR; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\NameGenerator - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\NameGenerator */ final class NameGeneratorTest extends TestCase { - /** - * @return mixed[] - */ - private function getCommonPayload(): array + /** @return mixed[] */ + private static function getCommonPayload(): array { return [ 'rootNamespace' => 'Some\\Custom\\Namespace', @@ -51,15 +47,13 @@ private function getCommonPayload(): array ]; } - /** - * @return mixed[] - */ - public function setAllNamesAndPathsProvider(): array + /** @return mixed[] */ + public static function setAllNamesAndPathsProvider(): array { return [ [ 'payload' => array_merge( - $this->getCommonPayload(), + self::getCommonPayload(), [ 'graph' => [ 'specifications' => [], @@ -69,7 +63,7 @@ public function setAllNamesAndPathsProvider(): array ], [ 'payload' => array_merge( - $this->getCommonPayload(), + self::getCommonPayload(), [ 'graph' => [ 'specifications' => [ @@ -89,7 +83,7 @@ public function setAllNamesAndPathsProvider(): array ], [ 'payload' => array_merge( - $this->getCommonPayload(), + self::getCommonPayload(), [ 'graph' => [ 'specifications' => [ @@ -477,10 +471,8 @@ public function testSetRequestNames(): void Assert::assertSame('Custom\Namespace\Dto\Request', $root->getNamespace()); } - /** - * @return mixed[] - */ - public function setResponseNamesProvider(): array + /** @return mixed[] */ + public static function setResponseNamesProvider(): array { return [ [ diff --git a/test/unit/CodeGenerator/Naming/CannotCreateNamespaceTest.php b/test/unit/CodeGenerator/Naming/CannotCreateNamespaceTest.php index 14c5324f..3993cf10 100644 --- a/test/unit/CodeGenerator/Naming/CannotCreateNamespaceTest.php +++ b/test/unit/CodeGenerator/Naming/CannotCreateNamespaceTest.php @@ -9,9 +9,7 @@ use function Safe\sprintf; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Naming\CannotCreateNamespace - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Naming\CannotCreateNamespace */ final class CannotCreateNamespaceTest extends TestCase { public function testBecauseTestContainsNoValidSymbolsShowCorrectError(): void diff --git a/test/unit/CodeGenerator/Naming/CannotCreatePropertyNameTest.php b/test/unit/CodeGenerator/Naming/CannotCreatePropertyNameTest.php index 15d0c6bd..45b0ee58 100644 --- a/test/unit/CodeGenerator/Naming/CannotCreatePropertyNameTest.php +++ b/test/unit/CodeGenerator/Naming/CannotCreatePropertyNameTest.php @@ -9,9 +9,7 @@ use function Safe\sprintf; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Naming\CannotCreatePropertyName - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Naming\CannotCreatePropertyName */ final class CannotCreatePropertyNameTest extends TestCase { public function testBecauseTextContainsNoValidSymbolsShowsCorrectError(): void diff --git a/test/unit/CodeGenerator/Naming/DefaultNamingStrategyTest.php b/test/unit/CodeGenerator/Naming/DefaultNamingStrategyTest.php index d8e5a4bd..467faa56 100644 --- a/test/unit/CodeGenerator/Naming/DefaultNamingStrategyTest.php +++ b/test/unit/CodeGenerator/Naming/DefaultNamingStrategyTest.php @@ -12,9 +12,7 @@ use const DIRECTORY_SEPARATOR; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Naming\DefaultNamingStrategy - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\Naming\DefaultNamingStrategy */ final class DefaultNamingStrategyTest extends TestCase { private DefaultNamingStrategy $defaultNamingStrategy; @@ -26,10 +24,8 @@ public function setUp(): void $this->defaultNamingStrategy = new DefaultNamingStrategy($reservedWords, 'NameSpace', '8.0'); } - /** - * @return array> - */ - public function isAllowedPhpPropertyNameDataProvider(): array + /** @return array> */ + public static function isAllowedPhpPropertyNameDataProvider(): array { return [ ['test', true], @@ -42,9 +38,7 @@ public function isAllowedPhpPropertyNameDataProvider(): array ]; } - /** - * @dataProvider isAllowedPhpPropertyNameDataProvider - */ + /** @dataProvider isAllowedPhpPropertyNameDataProvider */ public function testIsAllowedPhpPropertyName(string $name, bool $expectedResult): void { $actualResult = $this->defaultNamingStrategy->isAllowedPhpPropertyName($name); @@ -52,10 +46,8 @@ public function testIsAllowedPhpPropertyName(string $name, bool $expectedResult) TestCase::assertEquals($expectedResult, $actualResult); } - /** - * @return array> - */ - public function stringToMethodNameDataProvider(): array + /** @return array> */ + public static function stringToMethodNameDataProvider(): array { return [ ['test', 'test'], @@ -66,9 +58,7 @@ public function stringToMethodNameDataProvider(): array ]; } - /** - * @dataProvider stringToMethodNameDataProvider - */ + /** @dataProvider stringToMethodNameDataProvider */ public function testStringToMethodNameData(string $string, string $expectedOutput): void { $actualOutput = $this->defaultNamingStrategy->stringToMethodName($string); @@ -84,10 +74,8 @@ public function testGetInterfaceFQCN(): void TestCase::assertEquals($expectedOutput, $actualOutput); } - /** - * @return array> - */ - public function stringToNamespaceDataProvider(): array + /** @return array> */ + public static function stringToNamespaceDataProvider(): array { return [ ['1some random string', '_1someRandomString'], @@ -96,9 +84,7 @@ public function stringToNamespaceDataProvider(): array ]; } - /** - * @dataProvider stringToNamespaceDataProvider - */ + /** @dataProvider stringToNamespaceDataProvider */ public function testStringToNamespace(string $string, string $expectedOutput): void { $actualOutput = $this->defaultNamingStrategy->stringToNamespace($string); diff --git a/test/unit/CodeGenerator/PhpParserGenerators/CodeGeneratorTest.php b/test/unit/CodeGenerator/PhpParserGenerators/CodeGeneratorTest.php index bc1add5b..b3b73e08 100644 --- a/test/unit/CodeGenerator/PhpParserGenerators/CodeGeneratorTest.php +++ b/test/unit/CodeGenerator/PhpParserGenerators/CodeGeneratorTest.php @@ -18,9 +18,7 @@ use const PHP_EOL; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\PhpParserGenerators\CodeGenerator - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\PhpParserGenerators\CodeGenerator */ class CodeGeneratorTest extends TestCase { private CodeGenerator $codeGenerator; @@ -34,6 +32,7 @@ public function setUp(): void public function tearDown(): void { unset($this->codeGenerator); + parent::tearDown(); } diff --git a/test/unit/CodeGenerator/PhpParserGenerators/FileBuilderTest.php b/test/unit/CodeGenerator/PhpParserGenerators/FileBuilderTest.php index 82e6831d..dd674991 100644 --- a/test/unit/CodeGenerator/PhpParserGenerators/FileBuilderTest.php +++ b/test/unit/CodeGenerator/PhpParserGenerators/FileBuilderTest.php @@ -14,9 +14,7 @@ use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\PhpParserGenerators\FileBuilder - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\PhpParserGenerators\FileBuilder */ class FileBuilderTest extends TestCase { private FileBuilder $fileBuilder; diff --git a/test/unit/CodeGenerator/PhpParserGenerators/InterfaceCodeGeneratorTest.php b/test/unit/CodeGenerator/PhpParserGenerators/InterfaceCodeGeneratorTest.php index 7166409f..6523fdd3 100644 --- a/test/unit/CodeGenerator/PhpParserGenerators/InterfaceCodeGeneratorTest.php +++ b/test/unit/CodeGenerator/PhpParserGenerators/InterfaceCodeGeneratorTest.php @@ -14,9 +14,7 @@ use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; -/** - * @covers \OnMoon\OpenApiServerBundle\CodeGenerator\PhpParserGenerators\InterfaceCodeGenerator - */ +/** @covers \OnMoon\OpenApiServerBundle\CodeGenerator\PhpParserGenerators\InterfaceCodeGenerator */ class InterfaceCodeGeneratorTest extends TestCase { private InterfaceCodeGenerator $interfaceCodeGenerator; @@ -38,6 +36,7 @@ protected function setUp(): void protected function tearDown(): void { unset($this->interfaceCodeGenerator); + parent::tearDown(); } @@ -50,7 +49,7 @@ public function testGenerateWithRequestHandlerInterfaceDefinition(): void $generatedInterfaceDefinition->setNamespace('Test\Test2'); $generatedCode = - <<setNamespace('Test\Test2'); $generatedCode = - <<setResponseTypes([ClassDefinition::fromFQCN('TestClass')]); $generatedCode = - <<setMethodDescription('method description'); $generatedCode = - <<firstParam = $data['firstParam']; @@ -359,7 +355,7 @@ public function toArray(): array } /** @inheritDoc */ - public static function fromArray(array $data): self + public static function fromArray(array $data): Dto { $dto = new self(); $dto->firstParam = $data['firstParam']; @@ -402,7 +398,7 @@ public function toArray(): array } /** @inheritDoc */ - public static function fromArray(array $data): self + public static function fromArray(array $data): Dto { $thirdParamDto = new class () implements Dto { @@ -422,7 +418,7 @@ public function toArray(): array } /** @inheritDoc */ - public static function fromArray(array $data): self + public static function fromArray(array $data): Dto { $dto = new self(); $dto->firstParam = $data['firstParam']; @@ -452,10 +448,8 @@ public static function fromArray(array $data): self }; } - /** - * @return mixed[] - */ - public function createResponseFromDtoPropertyIsNullProvider(): array + /** @return mixed[] */ + public static function createResponseFromDtoPropertyIsNullProvider(): array { return [ [ @@ -465,7 +459,7 @@ public function createResponseFromDtoPropertyIsNullProvider(): array 'isNullable' => false, ], 'sendNotRequiredNullableNulls' => false, - 'result' => [], + 'expectedResult' => [], ], [ 'propertyConditions' => [ @@ -474,7 +468,7 @@ public function createResponseFromDtoPropertyIsNullProvider(): array 'isNullable' => false, ], 'sendNotRequiredNullableNulls' => false, - 'result' => [self::OK_RESPONSE_DTO_FIRST_PROP => 'SomeFirstDefaultNotNullValue'], + 'expectedResult' => [self::OK_RESPONSE_DTO_FIRST_PROP => 'SomeFirstDefaultNotNullValue'], ], [ 'propertyConditions' => [ @@ -483,7 +477,7 @@ public function createResponseFromDtoPropertyIsNullProvider(): array 'isNullable' => false, ], 'sendNotRequiredNullableNulls' => false, - 'result' => [self::OK_RESPONSE_DTO_FIRST_PROP => null], + 'expectedResult' => [self::OK_RESPONSE_DTO_FIRST_PROP => null], ], [ 'propertyConditions' => [ @@ -492,7 +486,7 @@ public function createResponseFromDtoPropertyIsNullProvider(): array 'isNullable' => true, ], 'sendNotRequiredNullableNulls' => false, - 'result' => [], + 'expectedResult' => [], ], [ 'propertyConditions' => [ @@ -501,7 +495,7 @@ public function createResponseFromDtoPropertyIsNullProvider(): array 'isNullable' => true, ], 'sendNotRequiredNullableNulls' => true, - 'result' => [self::OK_RESPONSE_DTO_FIRST_PROP => null], + 'expectedResult' => [self::OK_RESPONSE_DTO_FIRST_PROP => null], ], [ 'propertyConditions' => [ @@ -510,7 +504,7 @@ public function createResponseFromDtoPropertyIsNullProvider(): array 'isNullable' => false, ], 'sendNotRequiredNullableNulls' => true, - 'result' => [], + 'expectedResult' => [], ], ]; } @@ -550,10 +544,8 @@ public function testCreateResponseFromDtoPropertyIsNull( Assert::assertSame($expectedResult, $result); } - /** - * @return mixed[] - */ - public function createResponseFromDtoMultiplePropertiesProvider(): array + /** @return mixed[] */ + public static function createResponseFromDtoMultiplePropertiesProvider(): array { return [ [ @@ -712,7 +704,7 @@ public function toArray(): array } /** @inheritDoc */ - public static function fromArray(array $data): self + public static function fromArray(array $data): Dto { $thirdParamDto = new class () implements Dto { @@ -732,7 +724,7 @@ public function toArray(): array } /** @inheritDoc */ - public static function fromArray(array $data): self + public static function fromArray(array $data): Dto { $dto = new self(); $dto->firstParam = $data['firstParam']; diff --git a/test/unit/Specification/Definitions/ObjectSchemaTest.php b/test/unit/Specification/Definitions/ObjectSchemaTest.php index 14b1428c..34609aea 100644 --- a/test/unit/Specification/Definitions/ObjectSchemaTest.php +++ b/test/unit/Specification/Definitions/ObjectSchemaTest.php @@ -9,9 +9,7 @@ use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; -/** - * @covers \OnMoon\OpenApiServerBundle\Specification\Definitions\ObjectSchema - */ +/** @covers \OnMoon\OpenApiServerBundle\Specification\Definitions\ObjectSchema */ final class ObjectSchemaTest extends TestCase { public function testGetProperties(): void diff --git a/test/unit/Specification/Definitions/OperationTest.php b/test/unit/Specification/Definitions/OperationTest.php index ba95b527..6dae1d35 100644 --- a/test/unit/Specification/Definitions/OperationTest.php +++ b/test/unit/Specification/Definitions/OperationTest.php @@ -11,15 +11,11 @@ use function count; -/** - * @covers \OnMoon\OpenApiServerBundle\Specification\Definitions\Operation - */ +/** @covers \OnMoon\OpenApiServerBundle\Specification\Definitions\Operation */ final class OperationTest extends TestCase { - /** - * @return mixed[] - */ - public function operationsProvider(): array + /** @return mixed[] */ + public static function operationsProvider(): array { return [ [ diff --git a/test/unit/Specification/Definitions/PropertyTest.php b/test/unit/Specification/Definitions/PropertyTest.php index b91a07c7..997bb9ee 100644 --- a/test/unit/Specification/Definitions/PropertyTest.php +++ b/test/unit/Specification/Definitions/PropertyTest.php @@ -11,15 +11,11 @@ use function array_key_exists; -/** - * @covers \OnMoon\OpenApiServerBundle\Specification\Definitions\Property - */ +/** @covers \OnMoon\OpenApiServerBundle\Specification\Definitions\Property */ final class PropertyTest extends TestCase { - /** - * @return mixed[] - */ - public function propertiesProvider(): array + /** @return mixed[] */ + public static function propertiesProvider(): array { return [ [ diff --git a/test/unit/Specification/Definitions/SpecificationConfigTest.php b/test/unit/Specification/Definitions/SpecificationConfigTest.php index 2b3f9326..b4b2c006 100644 --- a/test/unit/Specification/Definitions/SpecificationConfigTest.php +++ b/test/unit/Specification/Definitions/SpecificationConfigTest.php @@ -8,15 +8,11 @@ use PHPUnit\Framework\Assert; use PHPUnit\Framework\TestCase; -/** - * @covers \OnMoon\OpenApiServerBundle\Specification\Definitions\SpecificationConfig - */ +/** @covers \OnMoon\OpenApiServerBundle\Specification\Definitions\SpecificationConfig */ final class SpecificationConfigTest extends TestCase { - /** - * @return mixed[] - */ - public function specificationConfigsProvider(): array + /** @return mixed[] */ + public static function specificationConfigsProvider(): array { return [ [ diff --git a/test/unit/Specification/Definitions/SpecificationTest.php b/test/unit/Specification/Definitions/SpecificationTest.php index 48962166..34c5d1eb 100644 --- a/test/unit/Specification/Definitions/SpecificationTest.php +++ b/test/unit/Specification/Definitions/SpecificationTest.php @@ -13,15 +13,11 @@ use function count; -/** - * @covers \OnMoon\OpenApiServerBundle\Specification\Definitions\Specification - */ +/** @covers \OnMoon\OpenApiServerBundle\Specification\Definitions\Specification */ final class SpecificationTest extends TestCase { - /** - * @return mixed[] - */ - public function specificationsProvider(): array + /** @return mixed[] */ + public static function specificationsProvider(): array { $operationData = [ 'url' => '/some/custom/path', diff --git a/test/unit/Specification/SpecificationParserTest.php b/test/unit/Specification/SpecificationParserTest.php index c43b9dc1..dbd65e09 100644 --- a/test/unit/Specification/SpecificationParserTest.php +++ b/test/unit/Specification/SpecificationParserTest.php @@ -26,9 +26,7 @@ use function array_map; use function sprintf; -/** - * @covers \OnMoon\OpenApiServerBundle\Specification\SpecificationParser - */ +/** @covers \OnMoon\OpenApiServerBundle\Specification\SpecificationParser */ final class SpecificationParserTest extends TestCase { public function testParseOpenApiSuccess(): void @@ -484,10 +482,8 @@ public function testParseOpenApiSuccessRequestBadAndGoodMediaType(): void ); } - /** - * @return mixed[] - */ - public function parseOpenApiSuccessDefaultValueProvider(): array + /** @return mixed[] */ + public static function parseOpenApiSuccessDefaultValueProvider(): array { return [ [ @@ -623,10 +619,8 @@ static function (array $data): Schema { } } - /** - * @return mixed[] - */ - public function parseOpenApiThrowCannotParseOpenApiProvider(): array + /** @return mixed[] */ + public static function parseOpenApiThrowCannotParseOpenApiProvider(): array { return [ [ diff --git a/test/unit/Types/ArgumentResolverTest.php b/test/unit/Types/ArgumentResolverTest.php index 4e02a38e..ba075cab 100644 --- a/test/unit/Types/ArgumentResolverTest.php +++ b/test/unit/Types/ArgumentResolverTest.php @@ -12,9 +12,7 @@ use PHPUnit\Framework\TestCase; use Throwable; -/** - * @covers \OnMoon\OpenApiServerBundle\Types\ArgumentResolver - */ +/** @covers \OnMoon\OpenApiServerBundle\Types\ArgumentResolver */ final class ArgumentResolverTest extends TestCase { private ScalarTypesResolver $typeResolver; diff --git a/test/unit/Types/ScalarTypesResolverTest.php b/test/unit/Types/ScalarTypesResolverTest.php index 0ce7b692..3dd61134 100644 --- a/test/unit/Types/ScalarTypesResolverTest.php +++ b/test/unit/Types/ScalarTypesResolverTest.php @@ -11,9 +11,7 @@ use Safe\DateTime; use Safe\Exceptions\DatetimeException; -/** - * @covers \OnMoon\OpenApiServerBundle\Types\ScalarTypesResolver - */ +/** @covers \OnMoon\OpenApiServerBundle\Types\ScalarTypesResolver */ final class ScalarTypesResolverTest extends TestCase { private ScalarTypesResolver $scalarTypeResolver; @@ -26,6 +24,7 @@ protected function setUp(): void public function tearDown(): void { unset($this->scalarTypeResolver); + parent::tearDown(); } @@ -34,7 +33,7 @@ public function tearDown(): void * * @throws DatetimeException */ - public function convertDeserializeDataProvider(): array + public static function convertDeserializeDataProvider(): array { return [ 'deserialize_null' => [ @@ -154,7 +153,7 @@ public function testConvertDeserializesValue(bool $deserialize, int $id, $value, * * @throws DatetimeException */ - public function convertSerializeDataProvider(): array + public static function convertSerializeDataProvider(): array { return [ 'serialize_null' => [ diff --git a/test/unit/Types/TypeSerializerTest.php b/test/unit/Types/TypeSerializerTest.php index 33458bdb..b3c86bb2 100644 --- a/test/unit/Types/TypeSerializerTest.php +++ b/test/unit/Types/TypeSerializerTest.php @@ -14,9 +14,7 @@ use function sprintf; -/** - * @covers \OnMoon\OpenApiServerBundle\Types\TypeSerializer - */ +/** @covers \OnMoon\OpenApiServerBundle\Types\TypeSerializer */ final class TypeSerializerTest extends TestCase { public function testDeserializeDateReturnsDateTime(): void diff --git a/test/unit/Validator/LeaguePSR7RequestSchemaValidatorTest.php b/test/unit/Validator/LeaguePSR7RequestSchemaValidatorTest.php index 49123d61..2d1eb755 100644 --- a/test/unit/Validator/LeaguePSR7RequestSchemaValidatorTest.php +++ b/test/unit/Validator/LeaguePSR7RequestSchemaValidatorTest.php @@ -16,9 +16,7 @@ use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory; use Symfony\Component\HttpFoundation\Request; -/** - * @covers \OnMoon\OpenApiServerBundle\Validator\LeaguePSR7RequestSchemaValidator - */ +/** @covers \OnMoon\OpenApiServerBundle\Validator\LeaguePSR7RequestSchemaValidator */ final class LeaguePSR7RequestSchemaValidatorTest extends TestCase { public function testValidate(): void