Skip to content

Tag reference

@seal-methods

The @seal-methods tag closes off a class’s __call()/__callStatic() surface to exactly the magic methods already declared with @method, nothing more. A class documenting several magic methods normally leaves the door open for an analyzer to assume __call() might answer to other, undocumented method names too; writing @seal-methods on the class tells the analyzer that assumption is wrong, so a call to any magic method not already listed can be reported as an error instead of silently allowed through.

Grammar

"@psalm-seal-methods" [ <Description> ]
"@seal-methods" [ <Description> ]

Examples

Closing the magic method surface of a fluent builder.
/**
* @method static setName(string $name)
* @method static setAge(int $age)
* @seal-methods
*/
class Builder {}
With a description explaining the intent.
/**
* @method string getName()
* @seal-methods No further magic methods will ever be added here.
*/
class ReadOnlyModel {}

Names by platform

psalm
@psalm-seal-methods
standard
@seal-methods

Parsing a @seal-methods tag produces a FlagTag instance. Being a pure marker, it adds nothing beyond the $name and optional $description every tag already carries.

final class SealMethodsTag extends FlagTag {}

The equivalent tag for magic properties declared through @property is @seal-properties.

This is a Psalm-only convention: Psalm’s own vocabulary is @psalm-seal-methods/@psalm-no-seal-methods, but its docs explicitly list the bare @seal-methods/@no-seal-methods spellings as equivalent. See Psalm’s reference. PHPStan has no equivalent concept.