Tag reference
@seal-properties
The @seal-properties tag closes off a class’s magic property surface to
exactly the properties already declared with
@property, @property-read, or
@property-write, nothing more. Without it, an
analyzer that sees __get()/__set() implemented has to assume any
property name might resolve at runtime, even one never mentioned in the
docblock; @seal-properties removes that uncertainty, so access to an
undocumented magic property can be flagged as an error instead of passing
silently.
Grammar
"@psalm-seal-properties" [ <Description> ]"@seal-properties" [ <Description> ]Examples
/** * @property-read int $id * @property string $name * @seal-properties */class Record {}/** * @property-read DateTimeImmutable $createdAt * @seal-properties Every magic property this class exposes is * listed above. */class Entry {}Names by platform
- psalm
@psalm-seal-properties- standard
@seal-properties
Parsing a @seal-properties tag produces a FlagTag instance. Being a
pure marker, it adds nothing beyond the $name and optional
$description every tag already carries.
final class SealPropertiesTag extends FlagTag {}The equivalent tag for magic methods declared through @method is @seal-methods.
This is a Psalm-only convention, following the same pattern as
@seal-methods: Psalm’s own vocabulary is
@psalm-seal-properties/@psalm-no-seal-properties, with the bare
@seal-properties/@no-seal-properties spellings documented as
equivalent.
See Psalm’s reference.
PHPStan has no equivalent concept.