mirror of
https://github.com/danog/psalm.git
synced 2024-12-02 17:52:45 +01:00
parent
b775d297bb
commit
70075e778c
@ -432,6 +432,10 @@ final class CommentAnalyzer
|
|||||||
$var_comments = [];
|
$var_comments = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$file_path = $statements_analyzer->getRootFilePath();
|
||||||
|
$file_storage_provider = $codebase->file_storage_provider;
|
||||||
|
$file_storage = $file_storage_provider->get($file_path);
|
||||||
|
|
||||||
$var_comments = $codebase->config->disable_var_parsing
|
$var_comments = $codebase->config->disable_var_parsing
|
||||||
? []
|
? []
|
||||||
: self::arrayToDocblocks(
|
: self::arrayToDocblocks(
|
||||||
@ -440,6 +444,7 @@ final class CommentAnalyzer
|
|||||||
$statements_analyzer->getSource(),
|
$statements_analyzer->getSource(),
|
||||||
$statements_analyzer->getSource()->getAliases(),
|
$statements_analyzer->getSource()->getAliases(),
|
||||||
$statements_analyzer->getSource()->getTemplateTypeMap(),
|
$statements_analyzer->getSource()->getTemplateTypeMap(),
|
||||||
|
$file_storage->type_aliases,
|
||||||
);
|
);
|
||||||
} catch (IncorrectDocblockException $e) {
|
} catch (IncorrectDocblockException $e) {
|
||||||
IssueBuffer::maybeAdd(
|
IssueBuffer::maybeAdd(
|
||||||
|
@ -1013,6 +1013,21 @@ class AnnotationTest extends TestCase
|
|||||||
return json_decode($json, true);
|
return json_decode($json, true);
|
||||||
}',
|
}',
|
||||||
],
|
],
|
||||||
|
'psalmTypeAnnotationForStaticVar' => [
|
||||||
|
'code' => '<?php
|
||||||
|
/**
|
||||||
|
* @psalm-type _Type A::TYPE_*
|
||||||
|
*/
|
||||||
|
class A{
|
||||||
|
const TYPE_A = 1;
|
||||||
|
const TYPE_B = 2;
|
||||||
|
|
||||||
|
public function f(): void {
|
||||||
|
/** @psalm-var _Type $var*/
|
||||||
|
static $var;
|
||||||
|
}
|
||||||
|
}',
|
||||||
|
],
|
||||||
'allowDocblockDefinedTKeyedArrayIntoNonEmpty' => [
|
'allowDocblockDefinedTKeyedArrayIntoNonEmpty' => [
|
||||||
'code' => '<?php
|
'code' => '<?php
|
||||||
/** @param non-empty-array $_bar */
|
/** @param non-empty-array $_bar */
|
||||||
|
Loading…
Reference in New Issue
Block a user