website/errors/sealed.nonObject.md
<?php declare(strict_types = 1);
/**
* @phpstan-sealed int
*/
class Foo
{
}
The @phpstan-sealed PHPDoc tag contains a non-object type such as int, string, or array. This tag is used to declare that a class or interface can only be extended or implemented by the listed types. Only class and interface names are valid in @phpstan-sealed because only objects can extend or implement other types.
Replace the non-object type with a valid class or interface name:
/**
- * @phpstan-sealed int
+ * @phpstan-sealed ChildClass
*/
class Foo
{
}
The @phpstan-sealed tag accepts one or more class/interface names, separated by |:
<?php declare(strict_types = 1);
/**
* @phpstan-sealed ChildA|ChildB
*/
class Foo
{
}