Menu

← Back to sealed.*

Error Identifier: sealed.nonObject

Every error reported by PHPStan has an error identifier. Here’s a list of all error identifiers. In PHPStan Pro you can see the error identifier next to each error and filter errors by their identifiers.

Code example #

<?php declare(strict_types = 1);

/**
 * @phpstan-sealed int
 */
class Foo
{
}

Why is it reported? #

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.

How to fix it #

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
{
}

How to ignore this error #

You can use the identifier sealed.nonObject to ignore this error using a comment:

// @phpstan-ignore sealed.nonObject
codeThatProducesTheError();

You can also use only the identifier key to ignore all errors of the same type in your configuration file in the ignoreErrors parameter:

parameters:
	ignoreErrors:
		-
			identifier: sealed.nonObject

Rules that report this error #

  • PHPStan\Rules\PhpDoc\SealedDefinitionClassRule [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.