Skip to content

http client response is not typed correctly #58555

@kjjd84

Description

@kjjd84

Laravel Version

12

PHP Version

8

Database Driver & Version

No response

Description

not sure which update caused this (as it used to be fine), but vscode complains unless i explicitly tell it what type $response is.

for example, this causes a type error:

use Illuminate\Support\Facades\Http;

$response = Http::asForm()
    ->post('https://login.procore.com/oauth/token', [
        'client_id' => config('services.procore.client_id'),
        'client_secret' => config('services.procore.client_secret'),
        'grant_type' => 'client_credentials',
    ]);

and if i try and call $response->json() it tells me the method is undefined.

but if i tell it what type it actually is, it works fine:

use Illuminate\Support\Facades\Http;

/** @var \Illuminate\Http\Client\Response $response */
$response = Http::asForm()
    ->post('https://login.procore.com/oauth/token', [
        'client_id' => config('services.procore.client_id'),
        'client_secret' => config('services.procore.client_secret'),
        'grant_type' => 'client_credentials',
    ]);

im using intelephense and the laravel extension in vscode. like i said it used to be fine.

Steps To Reproduce

see description

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions