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:
commit
d22105de72
@ -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
|
||||
|
@ -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,
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user