Skip to content

[Bug]: Variable could not be converted to string (Scope) #1027

@romalytvynenko

Description

@romalytvynenko

What happened?

"Error when analyzing route 'GET api/v1/payments' (App\Http\Controllers\PaymentController@index): Object of class PhpParser\Node\Expr\Variable could not be converted to string – /home/uriel/rocketforms-ai-backend/vendor/dedoc/scramble/src/Infer/Scope/Scope.php on line 328 ◀" // vendor/dedoc/scramble/src/Generator.php:74
{"success":false,"message":"Object of class PhpParser\Node\Expr\Variable could not be converted to string","errors":{"status_code":500,"message":"Object of class PhpParser\Node\Expr\Variable could not be converted to string","file":"/home/uriel/rocketforms-ai-backend/vendor/dedoc/scramble/src/Infer/Scope/Scope.php","line":328,"client":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"},"code":"SERVER_ERROR","status":500}

Here is my controller

public function index(PaymentIndexRequest $request): JsonResponse
{
    $validatedData = $request->validated();
    $data = collect($validatedData)->except('per_page', 'page')->toArray();
    $payments = $this->paymentService->index($data, $request->per_page ?? null);

    return JsonResponseTrait::success(
        data: $payments
    );
}

How to reproduce the bug

Here is the repo https://github.com/boko-marc/scramble-bug-error

Package Version

see repo

PHP Version

see repo

Laravel Version

see repo

Which operating systems does with happen with?

No response

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions