Menu

← Back to missingType.*

Error Identifier: missingType.property

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);

class MyClass
{
	private $value;
}

Why is it reported? #

The property has no type specified – neither a native PHP type declaration nor a @var PHPDoc tag. Without a type, PHPStan cannot verify that the property is used correctly throughout the codebase. The property is implicitly typed as mixed, which disables many checks.

How to fix it #

Add a native type declaration (PHP 7.4+):

 class MyClass
 {
-	private $value;
+	private string $value;
 }

For older PHP versions, add a @var PHPDoc tag:

 class MyClass
 {
+	/** @var string */
 	private $value;
 }

How to ignore this error #

You can use the identifier missingType.property to ignore this error using a comment:

// @phpstan-ignore missingType.property
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: missingType.property

Rules that report this error #

  • PHPStan\Rules\Properties\MissingPropertyTypehintRule [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.