Menu

← Back to property.*

Error Identifier: property.unresolvableNativeType

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

class Ipsum
{
}

class Test
{
	private Lorem&Ipsum $prop; // ERROR: Property Test::$prop has unresolvable native type.
}

Why is it reported? #

The property has a native intersection type that cannot be resolved. An intersection type like Lorem&Ipsum requires that a value is an instance of both Lorem and Ipsum simultaneously. When these two classes are unrelated and neither extends the other, no value can satisfy this type, making it unresolvable.

This typically occurs with intersection types (available since PHP 8.1) where the combined type constraints are impossible to satisfy.

How to fix it #

Use interfaces in intersection types instead of unrelated classes, since a single object can implement multiple interfaces:

 <?php declare(strict_types = 1);
 
-class Lorem
+interface Loremable
 {
 }

-class Ipsum
+interface Ipsumable
 {
 }

 class Test
 {
-	private Lorem&Ipsum $prop;
+	private Loremable&Ipsumable $prop;
 }

Alternatively, if only one of the types is needed, simplify the type:

 <?php declare(strict_types = 1);
 
 class Test
 {
-	private Lorem&Ipsum $prop;
+	private Lorem $prop;
 }

How to ignore this error #

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

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

Rules that report this error #

  • PHPStan\Rules\Properties\ExistingClassesInPropertiesRule [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.