0

I am using DarkaOnLine/L5-Swagger package for project. Here is example annotation

/**
 * @OA\Post(
 * //annotations etc..
 *     )
 */
public function login(LoginRequest $request): JsonResponse
{
    //login method
}

But using annotations in controllers complicates the code. Is there another way to do it in separate file?

1 Answer 1

2

Not sure it complicates things - with separate files you always have to update two different places.

Your annotations can be whereever you like as long as they are associated with structural elements (class, method, etc) so reflection can find them (means you need to create dummy classes, etc if the annotations are separate from the "real" code).

Also, those files need to be found by the bundle but I would expect you can configure multiple path to scan.

The downside for me is that you need to replicate all details, in particular type-hints and keep them in sync.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.