1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fix #3027 - inherited properties should be templated properly

This commit is contained in:
Brown 2020-03-27 18:31:48 -04:00
parent b57563c8cf
commit 056f4aaac6
2 changed files with 29 additions and 1 deletions

View File

@ -1053,7 +1053,8 @@ class ClassAnalyzer extends ClassLikeAnalyzer
$codebase,
null,
null,
null
null,
$class_context->self
);
}

View File

@ -3480,6 +3480,33 @@ class ClassTemplateExtendsTest extends TestCase
}
}',
],
'extendsWithTemplatedProperty' => [
'<?php
/**
* @template I as object
*/
class Foo {
/** @var I */
protected $collection;
/** @param I $collection */
public function __construct($collection) {
$this->collection = $collection;
}
}
/**
* @template I2 as object
*
* @extends Foo<I2>
*/
class FooChild extends Foo {
/** @return I2 */
public function getCollection() {
return $this->collection;
}
}'
],
];
}