mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Add better reconciliation of ints from array keys
This commit is contained in:
parent
788da0680e
commit
f097b9ae6c
@ -2633,7 +2633,11 @@ class AssertionReconciler extends \Psalm\Type\Reconciler
|
||||
if ($scalar_type === 'int') {
|
||||
$value = (int) $value;
|
||||
|
||||
if ($existing_var_type->hasMixed() || $existing_var_type->hasScalar() || $existing_var_type->hasNumeric()) {
|
||||
if ($existing_var_type->hasMixed()
|
||||
|| $existing_var_type->hasScalar()
|
||||
|| $existing_var_type->hasNumeric()
|
||||
|| $existing_var_type->hasArrayKey()
|
||||
) {
|
||||
if ($is_loose_equality) {
|
||||
return $existing_var_type;
|
||||
}
|
||||
@ -2650,6 +2654,7 @@ class AssertionReconciler extends \Psalm\Type\Reconciler
|
||||
if ($existing_var_atomic_type->as->hasMixed()
|
||||
|| $existing_var_atomic_type->as->hasScalar()
|
||||
|| $existing_var_atomic_type->as->hasNumeric()
|
||||
|| $existing_var_atomic_type->as->hasArrayKey()
|
||||
) {
|
||||
if ($is_loose_equality) {
|
||||
return $existing_var_type;
|
||||
|
Loading…
Reference in New Issue
Block a user