Skip to content

InvalidNamedArgument "timestamp" for DateTimeImmutable::setTimestamp due to stubs #11408

@savinmikhail

Description

@savinmikhail

Summary

Psalm incorrectly reports an InvalidNamedArgument error when using named arguments for DateTimeImmutable::setTimestamp(timestamp: ...).

Code sample

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

<?php
(new DateTimeImmutable())->setTimestamp(timestamp: 1);

Psalm output:

ERROR: InvalidNamedArgument - 3:41 - Parameter $timestamp does not exist on function DateTimeImmutable::setTimestamp

Additional context


Expected Behavior

Psalm should allow using timestamp as a valid named argument for DateTimeImmutable::setTimestamp.


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