mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Fix #2443 - templates are not valid PHPDoc
This commit is contained in:
parent
423288d2fe
commit
9d22f56560
@ -108,6 +108,15 @@ class TTemplateParam extends \Psalm\Type\Atomic
|
||||
?string $this_class,
|
||||
bool $use_phpdoc_format
|
||||
) {
|
||||
if ($use_phpdoc_format) {
|
||||
return $this->as->toNamespacedString(
|
||||
$namespace,
|
||||
$aliased_classes,
|
||||
$this_class,
|
||||
$use_phpdoc_format
|
||||
);
|
||||
}
|
||||
|
||||
$intersection_types = $this->getNamespacedIntersectionTypes(
|
||||
$namespace,
|
||||
$aliased_classes,
|
||||
|
@ -735,6 +735,37 @@ class ReturnTypeManipulationTest extends FileManipulationTest
|
||||
['MissingReturnType'],
|
||||
true,
|
||||
],
|
||||
'addMissingTemplateReturnType' => [
|
||||
'<?php
|
||||
/**
|
||||
* @template T as object
|
||||
*
|
||||
* @param object $t Flabble
|
||||
*
|
||||
* @psalm-param T $t
|
||||
*/
|
||||
function foo($t) {
|
||||
return $t;
|
||||
}',
|
||||
'<?php
|
||||
/**
|
||||
* @template T as object
|
||||
*
|
||||
* @param object $t Flabble
|
||||
*
|
||||
* @psalm-param T $t
|
||||
*
|
||||
* @return object
|
||||
*
|
||||
* @psalm-return T
|
||||
*/
|
||||
function foo($t) {
|
||||
return $t;
|
||||
}',
|
||||
'7.4',
|
||||
['MissingReturnType'],
|
||||
true
|
||||
],
|
||||
'fixInvalidIntReturnType56' => [
|
||||
'<?php
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user