Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive UnusedIssueHandlerSuppression when using <errorLevel type="info"> #11262

Open
gharlan opened this issue Feb 7, 2025 · 1 comment

Comments

@gharlan
Copy link
Contributor

gharlan commented Feb 7, 2025

psalm.xml:

<?xml version="1.0"?>
<psalm
    errorLevel="1"
    findUnusedPsalmSuppress="true"
    ....
>
    ...
    <issueHandlers>
        <DeprecatedMethod>
            <errorLevel type="info">
                <referencedMethod name="Foo::bar"/>
            </errorLevel>
        </DeprecatedMethod>
    </issueHandlers>
</psalm>

Code:

<?php

class Foo
{
    /** @deprecated */
    public static function bar(): void {}
}

Foo::bar();

Running psalm results in:

ERROR: UnusedIssueHandlerSuppression - [...]/psalm.xml:0:0 - Suppressed issue type "DeprecatedMethod" for was not thrown. (see https://psalm.dev/326)

(side note: remark the missing part between for was.)

The error disappears when running psalm --show-info=true.
It also disappears when using <DeprecatedMethod errorLevel="info"/>.

Copy link

Hey @gharlan, can you reproduce the issue on https://psalm.dev? These will be used as phpunit tests when implementing the feature or fixing this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant