Skip to content

Commit

Permalink
Run PHP-CS-Fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicLuidold committed Apr 1, 2024
1 parent 47d967e commit ab6ab11
Show file tree
Hide file tree
Showing 73 changed files with 553 additions and 274 deletions.
1 change: 0 additions & 1 deletion src/Annotation/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#[\Attribute(\Attribute::TARGET_METHOD)]
final class Model extends Attachable
{
/** {@inheritdoc} */
public static $_types = [
'type' => 'string',
'groups' => '[string]',
Expand Down
1 change: 0 additions & 1 deletion src/Annotation/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class Security extends AbstractAnnotation
{
/** {@inheritdoc} */
public static $_types = [
'name' => 'string',
'scopes' => '[string]',
Expand Down
2 changes: 1 addition & 1 deletion src/ApiDocGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ final class ApiDocGenerator
/**
* @var ?string
*/
private $openApiVersion = null;
private $openApiVersion;

/** @var Generator */
private $generator;
Expand Down
3 changes: 1 addition & 2 deletions src/Controller/YamlDocumentationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Nelmio\ApiDocBundle\Controller;

use InvalidArgumentException;
use Nelmio\ApiDocBundle\Render\RenderOpenApi;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -39,7 +38,7 @@ public function __invoke(Request $request, $area = 'default')
);

return $response->setCharset('UTF-8');
} catch (InvalidArgumentException $e) {
} catch (\InvalidArgumentException $e) {
throw new BadRequestHttpException(sprintf('Area "%s" is not supported as it isn\'t defined in config.', $area));
}
}
Expand Down
6 changes: 0 additions & 6 deletions src/DependencyInjection/NelmioApiDocExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@

final class NelmioApiDocExtension extends Extension implements PrependExtensionInterface
{
/**
* {@inheritdoc}
*/
public function prepend(ContainerBuilder $container): void
{
$container->prependExtensionConfig('framework', ['property_info' => ['enabled' => true]]);
Expand All @@ -62,9 +59,6 @@ public function prepend(ContainerBuilder $container): void
}
}

/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container): void
{
$config = $this->processConfiguration(new Configuration(), $configs);
Expand Down
8 changes: 4 additions & 4 deletions src/Describer/OpenApiPhpDescriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ public function describe(OA\OpenApi $api)
}

if (
!$annotation instanceof OA\Response &&
!$annotation instanceof OA\RequestBody &&
!$annotation instanceof OA\Parameter &&
!$annotation instanceof OA\ExternalDocumentation
!$annotation instanceof OA\Response
&& !$annotation instanceof OA\RequestBody
&& !$annotation instanceof OA\Parameter
&& !$annotation instanceof OA\ExternalDocumentation
) {
throw new \LogicException(sprintf('Using the annotation "%s" as a root annotation in "%s::%s()" is not allowed.', get_class($annotation), $method->getDeclaringClass()->name, $method->name));
}
Expand Down
2 changes: 0 additions & 2 deletions src/ModelDescriber/Annotations/OpenApiAnnotationsReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ public function updateProperty($reflection, OA\Property $property, array $serial

/**
* @param \ReflectionClass|\ReflectionProperty|\ReflectionMethod $reflection
*
* @return mixed
*/
private function getAnnotation(Context $parentContext, $reflection, string $className)
{
Expand Down
6 changes: 0 additions & 6 deletions src/ModelDescriber/BazingaHateoasModelDescriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ public function setModelRegistry(ModelRegistry $modelRegistry)
$this->JMSModelDescriber->setModelRegistry($modelRegistry);
}

/**
* {@inheritdoc}
*/
public function describe(Model $model, OA\Schema $schema): void
{
$this->JMSModelDescriber->describe($model, $schema);
Expand Down Expand Up @@ -106,9 +103,6 @@ private function getHateoasMetadata(Model $model)
return null;
}

/**
* {@inheritdoc}
*/
public function supports(Model $model): bool
{
return $this->JMSModelDescriber->supports($model) || null !== $this->getHateoasMetadata($model);
Expand Down
9 changes: 9 additions & 0 deletions src/ModelDescriber/EnumModelDescriber.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\ModelDescriber;

use Nelmio\ApiDocBundle\Model\Model;
Expand Down
6 changes: 0 additions & 6 deletions src/ModelDescriber/JMSModelDescriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ public function __construct(
$this->contextFactory = $contextFactory;
}

/**
* {@inheritdoc}
*/
public function describe(Model $model, OA\Schema $schema)
{
$className = $model->getType()->getClassName();
Expand Down Expand Up @@ -246,9 +243,6 @@ private function computeGroups(Context $context, array $type = null)
return $groups;
}

/**
* {@inheritdoc}
*/
public function supports(Model $model): bool
{
$className = $model->getType()->getClassName();
Expand Down
3 changes: 0 additions & 3 deletions src/NelmioApiDocBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@

final class NelmioApiDocBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function build(ContainerBuilder $container): void
{
$container->addCompilerPass(new ConfigurationPass());
Expand Down
2 changes: 0 additions & 2 deletions src/OpenApiPhp/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ public static function getCollectionItem(OA\AbstractAnnotation $parent, $class,
* @see OA\AbstractAnnotation::$_nested
*
* @param string $class
* @param mixed $value
*/
public static function getIndexedCollectionItem(OA\AbstractAnnotation $parent, $class, $value): OA\AbstractAnnotation
{
Expand Down Expand Up @@ -259,7 +258,6 @@ public static function searchCollectionItem(array $collection, array $properties
* Search for an Annotation within the $collection that has its member $index set to $value.
*
* @param string $member
* @param mixed $value
*
* @return false|int|string
*/
Expand Down
9 changes: 9 additions & 0 deletions src/Processor/MapQueryStringProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\Processor;

use Nelmio\ApiDocBundle\OpenApiPhp\Util;
Expand Down
9 changes: 9 additions & 0 deletions src/Processor/MapRequestPayloadProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\Processor;

use Nelmio\ApiDocBundle\OpenApiPhp\Util;
Expand Down
9 changes: 9 additions & 0 deletions src/Processor/NullablePropertyProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\Processor;

use OpenApi\Analysis;
Expand Down
1 change: 0 additions & 1 deletion src/PropertyDescriber/DictionaryPropertyDescriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public function describe(array $types, OA\Schema $property, array $groups = null
$this->propertyDescriber->describe($types[0]->getCollectionValueTypes(), $additionalProperties, $groups, $schema, $context);
}

/** {@inheritDoc} */
public function supports(array $types): bool
{
return 1 === count($types)
Expand Down
9 changes: 9 additions & 0 deletions src/PropertyDescriber/PropertyDescriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\PropertyDescriber;

use Nelmio\ApiDocBundle\Describer\ModelRegistryAwareInterface;
Expand Down
3 changes: 1 addition & 2 deletions src/Render/Html/HtmlOpenApiRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Nelmio\ApiDocBundle\Render\Html;

use InvalidArgumentException;
use Nelmio\ApiDocBundle\Render\OpenApiRenderer;
use Nelmio\ApiDocBundle\Render\RenderOpenApi;
use OpenApi\Annotations\OpenApi;
Expand All @@ -28,7 +27,7 @@ class HtmlOpenApiRenderer implements OpenApiRenderer
public function __construct($twig)
{
if (!$twig instanceof \Twig_Environment && !$twig instanceof Environment) {
throw new InvalidArgumentException(sprintf('Providing an instance of "%s" as twig is not supported.', get_class($twig)));
throw new \InvalidArgumentException(sprintf('Providing an instance of "%s" as twig is not supported.', get_class($twig)));
}
$this->twig = $twig;
}
Expand Down
9 changes: 9 additions & 0 deletions src/Render/Html/Renderer.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
<?php

/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\Render\Html;

class Renderer
Expand Down
12 changes: 10 additions & 2 deletions src/RouteDescriber/RouteArgumentDescriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@

declare(strict_types=1);

/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\RouteDescriber;

use Nelmio\ApiDocBundle\Describer\ModelRegistryAwareInterface;
use Nelmio\ApiDocBundle\Describer\ModelRegistryAwareTrait;
use Nelmio\ApiDocBundle\RouteDescriber\RouteArgumentDescriber\RouteArgumentDescriberInterface;
use OpenApi\Annotations as OA;
use ReflectionMethod;
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactoryInterface;
use Symfony\Component\Routing\Route;

Expand All @@ -26,7 +34,7 @@ public function __construct(
) {
}

public function describe(OA\OpenApi $api, Route $route, ReflectionMethod $reflectionMethod): void
public function describe(OA\OpenApi $api, Route $route, \ReflectionMethod $reflectionMethod): void
{
$controller = $route->getDefault('_controller');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\RouteDescriber\RouteArgumentDescriber;

use OpenApi\Annotations as OA;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\RouteDescriber\RouteArgumentDescriber;

use Nelmio\ApiDocBundle\OpenApiPhp\Util;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\RouteDescriber\RouteArgumentDescriber;

use Nelmio\ApiDocBundle\Describer\ModelRegistryAwareInterface;
Expand All @@ -15,12 +24,12 @@

final class SymfonyMapQueryStringDescriber implements RouteArgumentDescriberInterface, ModelRegistryAwareInterface
{
use ModelRegistryAwareTrait;

public const CONTEXT_KEY = 'nelmio_api_doc_bundle.map_query_string.'.self::class;
public const CONTEXT_ARGUMENT_METADATA = 'nelmio_api_doc_bundle.argument_metadata.'.self::class;
public const CONTEXT_MODEL_REF = 'nelmio_api_doc_bundle.model_ref.'.self::class;

use ModelRegistryAwareTrait;

public function describe(ArgumentMetadata $argumentMetadata, OA\Operation $operation): void
{
/** @var MapQueryString $attribute */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

declare(strict_types=1);

/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Nelmio\ApiDocBundle\RouteDescriber\RouteArgumentDescriber;

use Nelmio\ApiDocBundle\Describer\ModelRegistryAwareInterface;
Expand All @@ -15,11 +24,11 @@

final class SymfonyMapRequestPayloadDescriber implements RouteArgumentDescriberInterface, ModelRegistryAwareInterface
{
use ModelRegistryAwareTrait;

public const CONTEXT_ARGUMENT_METADATA = 'nelmio_api_doc_bundle.argument_metadata.'.self::class;
public const CONTEXT_MODEL_REF = 'nelmio_api_doc_bundle.model_ref.'.self::class;

use ModelRegistryAwareTrait;

public function describe(ArgumentMetadata $argumentMetadata, OA\Operation $operation): void
{
/** @var MapRequestPayload $attribute */
Expand Down
Loading

0 comments on commit ab6ab11

Please sign in to comment.