Skip to content

The return value of the ReflectionMethod::getAttributes() method was not resolved to an array. #157

@lly0414

Description

@lly0414

PHPantom version

0.8.0

Installation method

Pre-built binary from GitHub Releases

Operating system

Windows x86_64

Editor

Zed

Bug description

ReflectionMethod::getAttributes() 方法应该返回一个数组,但 LSP 告诉我它返回的是 ReflectionAttribute<Attribute>

Steps to reproduce

$reflection = new ReflectionMethod($class, $method);

$attributes = $reflection->getAttributes(Attribute::class);

// The LSP function throws an error when calling count(): Argument 1 ($value) expects Countable|array, got ReflectionAttribute<Attribute>
if (count($attributes) === 0) {
    return null;
}

Error output or panic trace


.phpantom.toml

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions