Skip to content

Tag reference

@suppress

The @suppress tag silences one or more named diagnostics that a static analyzer would otherwise report for the described element, without disabling analysis of the element altogether.

Grammar

"@psalm-suppress" <IssueName> [ "," <IssueName> ... ] [ <Description> ]
"@suppress" <IssueName> [ "," <IssueName> ... ] [ <Description> ]

Examples

Silencing a single diagnostic.
/**
* @suppress UndefinedMethod
*/
Silencing several diagnostics at once, with a description explaining why.
/**
* @suppress UndefinedMethod, PossiblyUnusedMethod Called only from
* tests.
*/

Names by platform

psalm
@psalm-suppress
standard
@suppress

Parsing a @suppress tag produces a SuppressTag instance exposing $issues: the list of every comma-separated identifier, in the order they were written (always at least one).

abstract class IssueListTag extends Tag
{
public function __construct(
string $name,
/**
* @var non-empty-list<non-empty-string>
*/
public readonly array $issues,
?DescriptionInterface $description = null,
) {
parent::__construct($name, $description);
}
}
final class SuppressTag extends IssueListTag {}

The plain, vendor-neutral spelling parsed here is Psalm’s @psalm-suppress in its bare form. PHPStan and Phan only recognize their own prefixed spellings, not this bare one.