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

fix wrong type description added in signature

This commit is contained in:
orklah 2021-10-04 12:26:05 +02:00
parent 2e7e343ef8
commit 66206bf061
2 changed files with 54 additions and 1 deletions

View File

@ -69,7 +69,7 @@ class TGenericObject extends TNamedObject
int $php_major_version,
int $php_minor_version
): ?string {
return $this->toNamespacedString($namespace, $aliased_classes, $this_class, false);
return $this->toNamespacedString($namespace, $aliased_classes, $this_class, true);
}
public function equals(Atomic $other_type, bool $ensure_source_equality): bool

View File

@ -683,6 +683,59 @@ class ReturnTypeManipulationTest extends FileManipulationTestCase
false,
true,
],
'GenericObjectInSignature' => [
'<?php
/**
* @template T
*/
class container {
/**
* @var T
*/
private $c;
/**
* @param T $c
*/
public function __construct($c) { $this->c = $c; }
}
class a {
public function test()
{
$a = new container(1);
return $a;
}
}',
'<?php
/**
* @template T
*/
class container {
/**
* @var T
*/
private $c;
/**
* @param T $c
*/
public function __construct($c) { $this->c = $c; }
}
class a {
/**
* @return container
*
* @psalm-return container<1>
*/
public function test(): container
{
$a = new container(1);
return $a;
}
}',
'7.3',
['MissingReturnType'],
false,
true,
]
];
}
}