Skip to content

Use of unassigned variable message error #821

Description

@ntm-dev

I have the following code:

class A
{
    public static function foo(string $param)
    {
        return static::bar(
            param2: true,
            param1: static fn() => $param,
        );
    }

    public static function bar(callable $param1, bool $param2 = false) {
        // do something
    }
}

Then I got the error message:

Use of unassigned variable '$param'

The error only occurs when I reverse the order of param1 and param2 in the foo function

My php version: 8.3.12
Extension version: 1.57.16971
Vscode version: 1.97.2

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions