doctrine / doctrine/annotations

ignores extra closing brackets

Open
#420 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
6.7k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

If the balance of parentheses is violated in the annotation and additional closing parentheses are present, then the parser does not generate an error.
In some annotations, this can lead to nesting errors, due to the forgotten closing parenthesis deep in the nested annotations

For example - `ObjectResponseDto"))` - last bracket move response=400 outsode post, but it's hard to see

```
* @OA\Post(path="/cart/api/item/{id}", summary="Update item quantity", tags={"Cart API"},
* @OA\Parameter(
* name="id",
* in="path",
* description="itemId",
* @OA\Schema(type="string")
* ),
* @OA\RequestBody(required=true, @OA\JsonContent(type="object",
* @OA\Property(property="quantity", description="Quantity", type="number"),
* )),
* @OA\Response(response=200, description="Item updated successfully",
* @OA\JsonContent(type="object", ref="#/components/schemas/ObjectResponseDto"))
* ),
* @OA\Response(response=400, description="Invalid params"),
* @OA\Response(response=404, description="Method not found"),
* )
```

I think parser need check brackets balanse and generate error

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.