1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Fix #2106 - add defining class to converted template

This commit is contained in:
Matthew Brown 2019-09-07 13:44:47 -04:00
parent 8be43398f0
commit e7a69f715d
2 changed files with 15 additions and 1 deletions

View File

@ -1167,7 +1167,8 @@ class Union
? new Union([$input_atomic_type->as_type])
: ($input_atomic_type->as === 'object'
? Type::getObject()
: Type::getMixed())
: Type::getMixed()),
$input_atomic_type->defining_class
);
} elseif ($input_atomic_type instanceof Type\Atomic\TClassString) {
if ($input_atomic_type->as_type) {

View File

@ -1690,6 +1690,19 @@ class ClassTemplateTest extends TestCase
}
}'
],
'reflectTemplatedClass' => [
'<?php
/** @template T1 of object */
class Foo {
/**
* @param class-string<T1> $a
* @psalm-return ReflectionClass<T1>
*/
public function reflection(string $a) {
return new ReflectionClass($a);
}
}',
],
];
}