Skip to content

Commit

Permalink
cs-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
faizanakram99 committed Dec 11, 2023
1 parent ba71ca1 commit 3b35a25
Show file tree
Hide file tree
Showing 42 changed files with 250 additions and 79 deletions.
2 changes: 1 addition & 1 deletion Tests/Functional/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Symfony\Component\Routing\Annotation\Route;

if (Kernel::MAJOR_VERSION >= 7) {
#[Route("/api", name: 'api_', host: 'api.example.com')]
#[Route('/api', name: 'api_', host: 'api.example.com')]
class ApiController extends ApiController81
{
}
Expand Down
58 changes: 58 additions & 0 deletions Tests/Functional/Controller/ApiController80.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,19 @@ class ApiController80
{
/**
* @OA\Get(
*
* @OA\Response(
* response="200",
* description="Success",
*
* @Model(type=Article::class, groups={"light"}))
* )
* )
*
* @OA\Parameter(ref="#/components/parameters/test")
*
* @Route("/article/{id}", methods={"GET"})
*
* @OA\Parameter(name="Accept-Version", in="header", @OA\Schema(type="string"))
* @OA\Parameter(name="Application-Name", in="header", @OA\Schema(type="string"))
*/
Expand All @@ -56,14 +61,19 @@ public function fetchArticleAction()

/**
* @OA\Get(
*
* @OA\Response(
* response="200",
* description="Success",
*
* @Model(type=ArticleInterface::class, groups={"light"}))
* )
* )
*
* @OA\Parameter(ref="#/components/parameters/test")
*
* @Route("/article-interface/{id}", methods={"GET"})
*
* @OA\Parameter(name="Accept-Version", in="header", @OA\Schema(type="string"))
* @OA\Parameter(name="Application-Name", in="header", @OA\Schema(type="string"))
*/
Expand All @@ -76,15 +86,21 @@ public function fetchArticleInterfaceAction()
*
* @Route("/swagger", methods={"GET", "LINK"})
* @Route("/swagger2", methods={"GET"})
*
* @Operation(
*
* @OA\Response(response="201", description="An example resource")
* )
*
* @OA\Get(
* path="/api/swagger2",
*
* @OA\Parameter(name="Accept-Version", in="header", @OA\Schema(type="string"))
* )
*
* @OA\Post(
* path="/api/swagger2",
*
* @OA\Response(response="203", description="but 203 is not actually allowed (wrong method)")
* )
*/
Expand All @@ -94,18 +110,24 @@ public function swaggerAction()

/**
* @Route("/swagger/implicit", methods={"GET", "POST"})
*
* @OA\Response(
* response="201",
* description="Operation automatically detected",
*
* @Model(type=User::class)
* ),
*
* @OA\RequestBody(
* description="This is a request body",
*
* @OA\JsonContent(
* type="array",
*
* @OA\Items(ref=@Model(type=User::class))
* )
* )
*
* @OA\Tag(name="implicit")
*/
public function implicitSwaggerAction()
Expand All @@ -114,13 +136,17 @@ public function implicitSwaggerAction()

/**
* @Route("/test/users/{user}", methods={"POST"}, schemes={"https"}, requirements={"user"="/foo/"})
*
* @OA\Response(
* response="201",
* description="Operation automatically detected",
*
* @Model(type=User::class)
* ),
*
* @OA\RequestBody(
* description="This is a request body",
*
* @Model(type=UserType::class, options={"bar": "baz"}))
* )
*/
Expand All @@ -130,6 +156,7 @@ public function submitUserTypeAction()

/**
* @Route("/test/{user}", methods={"GET"}, schemes={"https"}, requirements={"user"="/foo/"})
*
* @OA\Response(response=200, description="sucessful")
*/
public function userAction()
Expand Down Expand Up @@ -161,6 +188,7 @@ public function adminAction()
/**
* @OA\Get(
* path="/filtered",
*
* @OA\Response(response="201", description="")
* )
*/
Expand All @@ -170,10 +198,13 @@ public function filteredAction()

/**
* @Route("/form", methods={"POST"})
*
* @OA\RequestBody(
* description="Request content",
*
* @Model(type=DummyType::class))
* )
*
* @OA\Response(response="201", description="")
*/
public function formAction()
Expand All @@ -182,10 +213,13 @@ public function formAction()

/**
* @Route("/form-model", methods={"POST"})
*
* @OA\RequestBody(
* description="Request content",
*
* @Model(type=FormWithModel::class))
* )
*
* @OA\Response(response="201", description="")
*/
public function formWithModelAction()
Expand All @@ -194,7 +228,9 @@ public function formWithModelAction()

/**
* @Route("/security")
*
* @OA\Response(response="201", description="")
*
* @Security(name="api_key")
* @Security(name="basic")
* @Security(name="oauth2", scopes={"scope_1"})
Expand All @@ -205,7 +241,9 @@ public function securityAction()

/**
* @Route("/securityOverride")
*
* @OA\Response(response="201", description="")
*
* @Security(name="api_key")
* @Security(name=null)
*/
Expand All @@ -215,9 +253,11 @@ public function securityActionOverride()

/**
* @Route("/swagger/symfonyConstraints", methods={"GET"})
*
* @OA\Response(
* response="201",
* description="Used for symfony constraints test",
*
* @Model(type=SymfonyConstraints::class)
* )
*/
Expand All @@ -235,6 +275,7 @@ public function symfonyConstraintsAction()
* response="201",
* ref="#/components/responses/201"
* )
*
* @Route("/configReference", methods={"GET"})
*/
public function configReferenceAction()
Expand All @@ -243,7 +284,9 @@ public function configReferenceAction()

/**
* @Route("/multi-annotations", methods={"GET", "POST"})
*
* @OA\Get(description="This is the get operation")
*
* @OA\Post(description="This is post")
*
* @OA\Response(response=200, description="Worked well!", @Model(type=DummyType::class))
Expand Down Expand Up @@ -301,7 +344,9 @@ public function namedRouteOperationIdAction()
* @Route("/custom-operation-id", methods={"GET", "POST"})
*
* @OA\Get(operationId="get-custom-operation-id")
*
* @OA\Post(operationId="post-custom-operation-id")
*
* @OA\Response(response=200, description="success")
*/
public function customOperationIdAction()
Expand All @@ -310,9 +355,11 @@ public function customOperationIdAction()

/**
* @Route("/swagger/symfonyConstraintsWithValidationGroups", methods={"GET"})
*
* @OA\Response(
* response="201",
* description="Used for symfony constraints with validation groups test",
*
* @Model(type=SymfonyConstraintsWithValidationGroups::class, groups={"test"})
* )
*/
Expand All @@ -324,6 +371,7 @@ public function symfonyConstraintsWithGroupsAction()
* @Route("/alternate-entity-type", methods={"GET", "POST"})
*
* @OA\Get(operationId="alternate-entity-type")
*
* @OA\Response(response=200, description="success", @OA\JsonContent(
* ref=@Model(type=EntityWithAlternateType::class),
* ))
Expand All @@ -336,6 +384,7 @@ public function alternateEntityType()
* @Route("/entity-with-ref", methods={"GET", "POST"})
*
* @OA\Get(operationId="entity-with-ref")
*
* @OA\Response(response=200, description="success", @OA\JsonContent(
* ref=@Model(type=EntityWithRef::class),
* ))
Expand All @@ -348,6 +397,7 @@ public function entityWithRef()
* @Route("/entity-with-object-type", methods={"GET", "POST"})
*
* @OA\Get(operationId="entity-with-object-type")
*
* @OA\Response(response=200, description="success", @OA\JsonContent(
* ref=@Model(type=EntityWithObjectType::class),
* ))
Expand All @@ -358,11 +408,14 @@ public function entityWithObjectType()

/**
* @Route("/form-with-alternate-type", methods={"POST"})
*
* @OA\Response(
* response="204",
* description="Operation automatically detected",
* ),
*
* @OA\RequestBody(
*
* @Model(type=FormWithAlternateSchemaType::class))
* )
*/
Expand All @@ -372,11 +425,14 @@ public function formWithAlternateSchemaType()

/**
* @Route("/form-with-ref-type", methods={"POST"})
*
* @OA\Response(
* response="204",
* description="Operation automatically detected",
* ),
*
* @OA\RequestBody(
*
* @Model(type=FormWithRefType::class))
* )
*/
Expand All @@ -386,9 +442,11 @@ public function formWithRefSchemaType()

/**
* @Route("/entity-with-nullable-property-set", methods={"GET"})
*
* @OA\Response(
* response="201",
* description="Operation automatically detected",
*
* @Model(type=EntityWithNullableSchemaSet::class)
* )
*/
Expand Down
2 changes: 2 additions & 0 deletions Tests/Functional/Controller/ArrayItemsErrorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ class ArrayItemsErrorController
{
/**
* @Route("/api/error", methods={"GET"})
*
* @OA\Response(
* response=200,
* description="Success",
*
* @Model(type=Foo::class)
* )
*/
Expand Down
4 changes: 4 additions & 0 deletions Tests/Functional/Controller/BazingaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ class BazingaController
{
/**
* @Route("/api/bazinga", methods={"GET"})
*
* @OA\Response(
* response=200,
* description="Success",
*
* @Model(type=BazingaUser::class)
* )
*/
Expand All @@ -35,9 +37,11 @@ public function userAction()

/**
* @Route("/api/bazinga_foo", methods={"GET"})
*
* @OA\Response(
* response=200,
* description="Success",
*
* @Model(type=BazingaUser::class, groups={"foo"})
* )
*/
Expand Down
2 changes: 2 additions & 0 deletions Tests/Functional/Controller/BazingaTypedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ class BazingaTypedController
{
/**
* @Route("/api/bazinga_typed", methods={"GET"})
*
* @OA\Response(
* response=200,
* description="Success",
*
* @Model(type=BazingaUserTyped::class)
* )
*/
Expand Down
8 changes: 5 additions & 3 deletions Tests/Functional/Controller/ClassApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
if (Kernel::MAJOR_VERSION < 7) {
/**
* @Route("/api", host="api.example.com")
*
* @Security(name="basic")
*/
class ClassApiController
{
/**
* @Route("/security/class")
*
* @OA\Response(response="201", description="")
*/
public function securityAction()
Expand All @@ -34,13 +36,13 @@ public function securityAction()
}
} else {
#[Security(name: 'basic')]
#[Route("/api", host: "api.example.com")]
#[Route('/api', host: 'api.example.com')]
class ClassApiController
{
#[Response(response: 201, description: '')]
#[Route("/security/class")]
#[Route('/security/class')]
public function securityAction()
{
}
}
}
}
2 changes: 2 additions & 0 deletions Tests/Functional/Controller/FOSRestController80.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ class FOSRestController80
{
/**
* @Route("/fosrest.{_format}", methods={"POST"})
*
* @QueryParam(name="foo", requirements=@Regex("/^\d+$/"))
* @QueryParam(name="mapped", map=true)
*
* @RequestParam(name="Barraa", key="bar", requirements="\d+")
* @RequestParam(name="baz", requirements=@IsTrue)
* @RequestParam(name="datetime", requirements=@DateTime("Y-m-d\TH:i:sP"))
Expand Down
Loading

0 comments on commit 3b35a25

Please sign in to comment.