Skip to content

Call to method Foo::foo() on a separate line has no effect. #4232

@VincentLanglet

Description

@VincentLanglet

Support question

When a function foo has #[Pure], the following code

try {
     $foo->foo();
} catch (ReflectionException $exception) {
     return false;
}

returns

Call to method Foo::foo() on a separate line has no effect.

When foo() is sometimes throwing exceptions, it can be useful to write this.

In my case, I'm calling

ReflectionMethod::getPrototype

because there is no hasPrototype method.

What is the best way to avoid the phpstan error ? Does a PR should be made for Pure methods throwing exceptions ?

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