mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Improve error messaging
This commit is contained in:
parent
0897abf5cb
commit
60ae4a29da
@ -827,10 +827,6 @@ class Reconciler
|
|||||||
$not = !$not;
|
$not = !$not;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($not) {
|
|
||||||
$assertion = '!' . $assertion;
|
|
||||||
}
|
|
||||||
|
|
||||||
$existing_var_atomic_types = $existing_var_type->getAtomicTypes();
|
$existing_var_atomic_types = $existing_var_type->getAtomicTypes();
|
||||||
|
|
||||||
$from_docblock = $existing_var_type->from_docblock
|
$from_docblock = $existing_var_type->from_docblock
|
||||||
@ -843,7 +839,7 @@ class Reconciler
|
|||||||
new RedundantConditionGivenDocblockType(
|
new RedundantConditionGivenDocblockType(
|
||||||
'Docblock-defined type ' . $old_var_type_string
|
'Docblock-defined type ' . $old_var_type_string
|
||||||
. ' for ' . $key
|
. ' for ' . $key
|
||||||
. ' is always ' . $assertion,
|
. ' is ' . ($not ? 'never ' : 'always ') . $assertion,
|
||||||
$code_location,
|
$code_location,
|
||||||
$old_var_type_string . ' ' . $safe_assertion
|
$old_var_type_string . ' ' . $safe_assertion
|
||||||
),
|
),
|
||||||
@ -856,7 +852,7 @@ class Reconciler
|
|||||||
new RedundantCondition(
|
new RedundantCondition(
|
||||||
'Type ' . $old_var_type_string
|
'Type ' . $old_var_type_string
|
||||||
. ' for ' . $key
|
. ' for ' . $key
|
||||||
. ' is always ' . $assertion,
|
. ' is ' . ($not ? 'never ' : 'always ') . $assertion,
|
||||||
$code_location,
|
$code_location,
|
||||||
$old_var_type_string . ' ' . $safe_assertion
|
$old_var_type_string . ' ' . $safe_assertion
|
||||||
),
|
),
|
||||||
@ -871,7 +867,7 @@ class Reconciler
|
|||||||
new DocblockTypeContradiction(
|
new DocblockTypeContradiction(
|
||||||
'Docblock-defined type ' . $old_var_type_string
|
'Docblock-defined type ' . $old_var_type_string
|
||||||
. ' for ' . $key
|
. ' for ' . $key
|
||||||
. ' is never ' . $assertion,
|
. ' is ' . ($not ? 'always ' : 'never ') . $assertion,
|
||||||
$code_location,
|
$code_location,
|
||||||
$old_var_type_string . ' ' . $safe_assertion
|
$old_var_type_string . ' ' . $safe_assertion
|
||||||
),
|
),
|
||||||
@ -880,7 +876,7 @@ class Reconciler
|
|||||||
// fall through
|
// fall through
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($assertion === 'null') {
|
if ($assertion === 'null' && !$not) {
|
||||||
$issue = new TypeDoesNotContainNull(
|
$issue = new TypeDoesNotContainNull(
|
||||||
'Type ' . $old_var_type_string
|
'Type ' . $old_var_type_string
|
||||||
. ' for ' . $key
|
. ' for ' . $key
|
||||||
@ -892,7 +888,7 @@ class Reconciler
|
|||||||
$issue = new TypeDoesNotContainType(
|
$issue = new TypeDoesNotContainType(
|
||||||
'Type ' . $old_var_type_string
|
'Type ' . $old_var_type_string
|
||||||
. ' for ' . $key
|
. ' for ' . $key
|
||||||
. ' is never ' . $assertion,
|
. ' is ' . ($not ? 'always ' : 'never ') . $assertion,
|
||||||
$code_location,
|
$code_location,
|
||||||
$old_var_type_string . ' ' . $safe_assertion
|
$old_var_type_string . ' ' . $safe_assertion
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user