Skip to content

Exceptions declared on interfaces unused in implementations reported as unused #124

Closed
@Majkl578

Description

@Majkl578

There seem to be false positives with exceptions declared on interface methods that are not being used in the method implementation. This seems to be due to merging phpDoc since PHPStan 0.12.24 (phpstan/phpstan-src#196). Happens both in 0.10.1 and 0.11.0.

interface Foo {
    /**
     * @throws SomeException
     */
    function bar(): void;
}

class SomeFoo implements Foo {
    public function bar(): void
    {
        // no throw here -> causes Unused @throws
    }
}
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions