Skip to content

InvalidNamedArgument "objectOrClass" for ReflectionClass constructor due to incorrect stub #11406

@savinmikhail

Description

@savinmikhail

Summary

Psalm incorrectly reports an InvalidNamedArgument error when using named arguments for new ReflectionClass(objectOrClass: $foo).

Code sample

Reproducible snippet:
https://psalm.dev/r/d3654927ce

Psalm output:

ERROR: InvalidNamedArgument - 3:35 - Parameter $objectOrClass does not exist on function ReflectionClass::__construct

Additional context


Expected Behavior

Psalm should allow using objectOrClass as a valid named argument for ReflectionClass::__construct.


Environment

  • Psalm version: 6.x
  • PHP version: 8.2
  • Platform: tested on online playground and local.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions