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

Merge pull request #7405 from klimick/fix-self-parsing-for-psalm-if-this-is

Fix `self` parsing for `psalm-if-this-is` and `psalm-self-out`
This commit is contained in:
orklah 2022-01-16 14:31:45 +01:00 committed by GitHub
commit a99c433f3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 2 deletions

View File

@ -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,

View File

@ -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
/**