1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 12:55:26 +01:00

Merge pull request #6580 from orklah/psalter-generic-object-tophpstring

fix wrong type description added in signature
This commit is contained in:
orklah 2021-10-04 20:23:42 +02:00 committed by GitHub
commit d22105de72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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,
]
];
}
}