In version 2.0.0, the @param annotation for isAOf() was changed from object|string to ExpectedType|class-string<ExpectedType>, breaking the ability to validate uncertain strings.
Example use case:
public function doSomething(string $type) : object
{
Assert::isAOf($type, SomeClass::class); // PHPStan error in v2.x
}
The problem:
When you receive a plain string from an external source, you need to validate that it's both a valid class name AND implements/extends the expected class. PHPStan now rejects this because string
doesn't match class-string<ExpectedType>.
Suggested fix:
Revert @param to object|string
/**
* @param object|string $value
*/