1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Fix self parsing for psalm-if-this-is and psalm-self-out

This commit is contained in:
andrew 2022-01-16 16:11:40 +03:00
parent de824d6724
commit 10012c9e09
2 changed files with 26 additions and 2 deletions

View File

@ -303,7 +303,8 @@ class FunctionLikeDocblockScanner
$docblock_info->self_out['type'], $docblock_info->self_out['type'],
$aliases, $aliases,
$function_template_types + $class_template_types, $function_template_types + $class_template_types,
$type_aliases $type_aliases,
$classlike_storage ? $classlike_storage->name : null
), ),
null, null,
$function_template_types + $class_template_types, $function_template_types + $class_template_types,
@ -319,7 +320,8 @@ class FunctionLikeDocblockScanner
$docblock_info->if_this_is['type'], $docblock_info->if_this_is['type'],
$aliases, $aliases,
$function_template_types + $class_template_types, $function_template_types + $class_template_types,
$type_aliases $type_aliases,
$classlike_storage ? $classlike_storage->name : null
), ),
null, null,
$function_template_types + $class_template_types, $function_template_types + $class_template_types,

View File

@ -112,6 +112,28 @@ class IfThisIsTest extends TestCase
$f->test(); $f->test();
' '
], ],
'ifThisIsWithSelfAlias' => [
'<?php
/**
* @template T of string
*/
final class App
{
/**
* @psalm-if-this-is self<"idle">
* @psalm-this-out self<"started">
*/
public function start(): void
{
throw new RuntimeException("???");
}
}
/** @var App<"idle"> */
$app = new App();
$app->start();
'
],
'ifThisIsAndThisOutAtTheSameTime' => [ 'ifThisIsAndThisOutAtTheSameTime' => [
'<?php '<?php
/** /**