[ 'code' => ' [ 'code' => ' */ class AChild extends A { /** @var string */ public $foo = "foo"; }', ], 'allowTemplatedInvarianceWithListTemplate' => [ 'code' => ' */ protected $items = []; } /** @extends ItemCollection */ class FooCollection extends ItemCollection { /** @var list */ protected $items = []; }', ], 'allowTemplatedInvarianceWithClassTemplate' => [ 'code' => '|null */ protected $items; } /** @extends ItemCollection */ class FooCollection extends ItemCollection { /** @var Collection|null */ protected $items; }', ], 'allowTemplatedInvarianceWithClassStringTemplate' => [ 'code' => '|null */ protected $type; } /** @extends ItemType */ class FooTypes extends ItemType { /** @var class-string|null */ protected $type; }', ], 'templatedInvarianceGrandchild' => [ 'code' => ' */ protected $items = []; } /** * @template T of Foo * @extends ItemCollection */ class FooCollection extends ItemCollection { /** @var list */ protected $items = []; } /** @extends FooCollection */ class BarCollection extends FooCollection { /** @var list */ protected $items = []; }', ], 'allowTemplateCovariant' => [ 'code' => ' */ class FooPair extends Pair { /** @var Bar|null */ public $a; /** @var Baz|null */ public $b; }', ], 'allowTemplateCovariantManyTemplates' => [ 'code' => ' */ class Bar extends Foo {} /** * @template Ta * @template Tb * @template-covariant Tc * @template Td * @extends Bar */ class Baz extends Bar { /** @var A|null */ public $a; /** @var B|null */ public $b; /** @var C|null */ public $c; /** @var C|null */ public $d; }', ], 'allowReadonly' => [ 'code' => ' [ 'code' => ' 'NonInvariantDocblockPropertyType', ], 'variantProperties' => [ 'code' => ' 'NonInvariantPropertyType', ], 'variantTemplatedProperties' => [ 'code' => ' */ class AChild extends A { /** @var int */ public $foo = 0; }', 'error_message' => 'NonInvariantDocblockPropertyType', ], 'variantTemplatedGrandchild' => [ 'code' => ' */ protected $items = []; } /** * @template T of Foo * @extends ItemCollection */ class FooCollection extends ItemCollection { /** @var list */ protected $items = []; } /** @extends FooCollection */ class BarCollection extends FooCollection { /** @var list */ // Should be list protected $items = []; }', 'error_message' => 'NonInvariantDocblockPropertyType', ], 'variantPropertiesWithTemplateNotSpecified' => [ 'code' => ' 'NonInvariantDocblockPropertyType', ], ]; } }