Class PHPStan\Type\AcceptsResult

final

Result of a Type::accepts() check — whether one type accepts another. Wraps a TrinaryLogic result together with human-readable reasons explaining why the acceptance failed. These reasons are surfaced in PHPStan error messages to help developers understand type mismatches. For example, when checking if int accepts string, the result would be No with a reason like "string is not a subtype of int". The accepts() method is used to check assignability — whether a value of one type can be assigned to a variable/parameter of another type. This is stricter than isSuperTypeOf() because it accounts for PHPStan's rule level and generics variance.

Methods