mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Fix #2277 - scan psalm-assert types always
This commit is contained in:
parent
d2161dcd73
commit
0ac5c32f2f
@ -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();
|
$assertion_type_parts[$i] = $prefix . $namespaced_type->getId();
|
||||||
} else {
|
} else {
|
||||||
$assertion_type_parts[$i] = $prefix . $assertion_type_part;
|
$assertion_type_parts[$i] = $prefix . $assertion_type_part;
|
||||||
|
@ -632,6 +632,22 @@ class AssertAnnotationTest extends TestCase
|
|||||||
return $arr;
|
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)) {}'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user