mirror of
https://github.com/danog/psalm.git
synced 2024-12-04 18:48:03 +01:00
Simplify some logic around negations to prevent unecessary looping
This commit is contained in:
parent
2c6d4f8687
commit
0fffb55a83
@ -176,20 +176,15 @@ class NegatedAssertionReconciler extends Reconciler
|
||||
|
||||
// if there wasn't a direct hit, go deeper, eliminating subtypes
|
||||
if (!$existing_var_type->removeType($assertion)) {
|
||||
foreach ($existing_var_type->getAtomicTypes() as $part_name => $existing_var_type_part) {
|
||||
if (!$existing_var_type_part->isObjectType() || strpos($assertion, '-')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strpos($assertion, '-')) {
|
||||
$assertion_type = Type::parseString($assertion, null, $template_type_map);
|
||||
|
||||
if (!$assertion_type->isSingle()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($assertion_type->isSingle()) {
|
||||
$new_type_part = $assertion_type->getSingleAtomic();
|
||||
|
||||
if (!$new_type_part instanceof TNamedObject) {
|
||||
if ($new_type_part instanceof TNamedObject) {
|
||||
foreach ($existing_var_type->getAtomicTypes() as $part_name => $existing_var_type_part) {
|
||||
if (!$existing_var_type_part->isObjectType()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -213,6 +208,9 @@ class NegatedAssertionReconciler extends Reconciler
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($is_strict_equality
|
||||
&& $assertion !== 'isset'
|
||||
|
Loading…
Reference in New Issue
Block a user