PHPStan has supported what is called declaration-site variance for a long time. An example you might be familiar with is the infamous @template-covariant. And although not as often useful, it also has a contravariant counterpart.
‹ Enhancements in Handling Parameters Passed by Reference in PHPStan 1.10.60 Using RuleErrorBuilder to enrich reported errors in custom rules ›