Skip to content
Permalink
Browse files

Fix #2443 - templates are not valid PHPDoc

  • Loading branch information
muglug committed Dec 10, 2019
1 parent 423288d commit 9d22f565604cdc5bf2145fbfd37f5ebde5323c72
Showing with 40 additions and 0 deletions.
  1. +9 −0 src/Psalm/Type/Atomic/TTemplateParam.php
  2. +31 −0 tests/FileManipulation/ReturnTypeManipulationTest.php
@@ -108,6 +108,15 @@ public function toNamespacedString(
?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 @@ public function foo() {
['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
/**

0 comments on commit 9d22f56

Please sign in to comment.
You can’t perform that action at this time.