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:
parent
b57563c8cf
commit
056f4aaac6
@ -1053,7 +1053,8 @@ class ClassAnalyzer extends ClassLikeAnalyzer
|
||||
$codebase,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
null,
|
||||
$class_context->self
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user