Skip to content

Psalm in combination with v1.8.0 #53

Description

@gdejong

Hi,

Since the recent v1.8.0 release I am having some problems with Psalm.

There is an example listed in the README of this project:

Or if you're using react/promise v2.2.0 or up:

React\Promise\Timer\timeout($promise, 10.0)
    ->then(function ($value) {
        // the operation finished within 10.0 seconds
    })
    ->otherwise(function (React\Promise\Timer\TimeoutException $error) {
        // the operation has failed due to a timeout
    })
    ->otherwise(function ($error) {
        // the input operation has failed due to some other error
    })
;

However when running Psalm with errorLevel 5 or lower I get:

ERROR: UndefinedInterfaceMethod - Method React\Promise\PromiseInterface::otherwise does not exist (see https://psalm.dev/181)
            ->otherwise(function (\React\Promise\Timer\TimeoutException $error) {

I guess this is caused by the return type hint of PromiseInterface that was added to \React\Promise\Timer\timeout.

This timeout() function is returning a new Promise(), would it be an idea to change the docblock to @return Promise or @return ExtendedPromiseInterface?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions