1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fix #2277 - scan psalm-assert types always

This commit is contained in:
Matthew Brown 2019-10-25 23:39:33 +02:00
parent d2161dcd73
commit 0ac5c32f2f
2 changed files with 22 additions and 0 deletions

View File

@ -2609,6 +2609,12 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
)
);
$namespaced_type->queueClassLikesForScanning(
$this->codebase,
$this->file_storage,
$this->function_template_types + $this->class_template_types
);
$assertion_type_parts[$i] = $prefix . $namespaced_type->getId();
} else {
$assertion_type_parts[$i] = $prefix . $assertion_type_part;

View File

@ -632,6 +632,22 @@ class AssertAnnotationTest extends TestCase
return $arr;
}'
],
'scanAssertionTypes' => [
'<?php
/**
* @param mixed $_p
* @psalm-assert-if-true Exception $_p
* @psalm-assert-if-false Error $_p
* @psalm-assert Throwable $_p
*/
function f($_p): bool {
return true;
}
$q = null;
if (rand(0, 1) && f($q)) {}
if (!f($q)) {}'
],
];
}