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:
parent
de824d6724
commit
10012c9e09
@ -303,7 +303,8 @@ class FunctionLikeDocblockScanner
|
||||
$docblock_info->self_out['type'],
|
||||
$aliases,
|
||||
$function_template_types + $class_template_types,
|
||||
$type_aliases
|
||||
$type_aliases,
|
||||
$classlike_storage ? $classlike_storage->name : null
|
||||
),
|
||||
null,
|
||||
$function_template_types + $class_template_types,
|
||||
@ -319,7 +320,8 @@ class FunctionLikeDocblockScanner
|
||||
$docblock_info->if_this_is['type'],
|
||||
$aliases,
|
||||
$function_template_types + $class_template_types,
|
||||
$type_aliases
|
||||
$type_aliases,
|
||||
$classlike_storage ? $classlike_storage->name : null
|
||||
),
|
||||
null,
|
||||
$function_template_types + $class_template_types,
|
||||
|
@ -112,6 +112,28 @@ class IfThisIsTest extends TestCase
|
||||
$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' => [
|
||||
'<?php
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user