Skip to content

Commit

Permalink
Merge pull request #7405 from klimick/fix-self-parsing-for-psalm-if-t…
Browse files Browse the repository at this point in the history
…his-is

Fix `self` parsing for `psalm-if-this-is` and `psalm-self-out`
  • Loading branch information
orklah committed Jan 16, 2022
2 parents de824d6 + 10012c9 commit a99c433
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
Expand Up @@ -303,7 +303,8 @@ function (FunctionLikeParameter $p): bool {
$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,
Expand All @@ -319,7 +320,8 @@ function (FunctionLikeParameter $p): bool {
$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,
Expand Down
22 changes: 22 additions & 0 deletions tests/IfThisIsTest.php
Expand Up @@ -112,6 +112,28 @@ class F extends G
$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
/**
Expand Down

0 comments on commit a99c433

Please sign in to comment.