Menu

Error Identifier: argument.unresolvableType

← Back to argument.*

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
{
	/**
	 * @template T
	 * @param T $p
	 * @param value-of<T> $v
	 */
	public function doBar($p, $v): void
	{
	}
}

function doFoo(Foo $foo): void
{
	$foo->doBar(0, 0);
}

Why is it reported? #

PHPStan reports this error when calling a generic function or method and a parameter’s type becomes unresolvable after template type substitution. This happens when the template type resolves to a value that makes a dependent type meaningless.

In the example above, doBar declares value-of<T> for the second parameter $v. When T resolves to int (because 0 is passed as the first argument), value-of<int> is not a valid type construct since int is not an array or enum. The resolved parameter type becomes unresolvable.

How to fix it #

Pass an argument whose type makes the dependent type parameter resolvable. For value-of<T>, T should be an array or an enum type:

 function doFoo(Foo $foo): void
 {
-	$foo->doBar(0, 0);
+	/** @var array{a: 1, b: 2} $arr */
+	$arr = ['a' => 1, 'b' => 2];
+	$foo->doBar($arr, 1);
 }

How to ignore this error #

You can use the identifier argument.unresolvableType to ignore this error using a comment:

// @phpstan-ignore argument.unresolvableType
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: argument.unresolvableType

Rules that report this error #

  • PHPStan\Rules\Classes\ClassAttributesRule [1]
  • PHPStan\Rules\Classes\ClassConstantAttributesRule [1]
  • PHPStan\Rules\Classes\InstantiationRule [1]
  • PHPStan\Rules\Constants\ConstantAttributesRule [1]
  • PHPStan\Rules\EnumCases\EnumCaseAttributesRule [1]
  • PHPStan\Rules\Functions\ArrowFunctionAttributesRule [1]
  • PHPStan\Rules\Functions\CallCallablesRule [1]
  • PHPStan\Rules\Functions\CallToFunctionParametersRule [1]
  • PHPStan\Rules\Functions\CallUserFuncRule [1]
  • PHPStan\Rules\Functions\ClosureAttributesRule [1]
  • PHPStan\Rules\Functions\FunctionAttributesRule [1]
  • PHPStan\Rules\Functions\ParamAttributesRule [1]
  • PHPStan\Rules\Methods\CallMethodsRule [1]
  • PHPStan\Rules\Methods\CallStaticMethodsRule [1]
  • PHPStan\Rules\Methods\MethodAttributesRule [1]
  • PHPStan\Rules\Properties\PropertyAttributesRule [1]
  • PHPStan\Rules\Properties\PropertyHookAttributesRule [1]
  • PHPStan\Rules\Traits\TraitAttributesRule [1]
Theme
A
© 2026 PHPStan s.r.o.