mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
parent
d881f57e85
commit
0355465b38
@ -460,6 +460,13 @@ class StatementsAnalyzer extends SourceAnalyzer
|
||||
$var_comment,
|
||||
$context
|
||||
);
|
||||
|
||||
if ($var_comment->var_id === '$this'
|
||||
&& $var_comment->type
|
||||
&& $codebase->classExists((string)$var_comment->type)
|
||||
) {
|
||||
$statements_analyzer->setFQCLN((string)$var_comment->type);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -192,6 +192,20 @@ class ScopeTest extends \Psalm\Tests\TestCase
|
||||
?>
|
||||
<h1><?= $this->getMessage() ?></h1>',
|
||||
],
|
||||
'psalmVarThisInTemplate' => [
|
||||
'<?php
|
||||
$e = new Exception(); // necessary to trick Psalm’s scanner for test
|
||||
/** @var Exception $this */
|
||||
?>
|
||||
<h1><?= $this->getMessage() ?></h1>',
|
||||
],
|
||||
'psalmVarThisAbsoluteClassInTemplate' => [
|
||||
'<?php
|
||||
$e = new Exception(); // necessary to trick Psalm’s scanner for test
|
||||
/** @var \Exception $this */
|
||||
?>
|
||||
<h1><?= $this->getMessage() ?></h1>',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user