Menu

← Back to property.*

Error Identifier: property.phpDocType

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 Foo
{
	/** @var string */
	public int $value;
}

Why is it reported? #

The PHPDoc type for a property is incompatible with its native type declaration. In the example above, the @var tag says the property is string, but the native type is int. These types are incompatible.

How to fix it #

Align the PHPDoc type with the native type:

 <?php declare(strict_types = 1);
 
 class Foo
 {
-	/** @var string */
+	/** @var int */
 	public int $value;
 }

Or update the native type to match the intended PHPDoc type.

How to ignore this error #

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

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

Rules that report this error #

  • PHPStan\Rules\PhpDoc\IncompatiblePropertyPhpDocTypeRule [1] [2]
  • PHPStan\Rules\Properties\OverridingPropertyRule [1] [2] [3] [4]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.