1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-12 09:19:40 +01:00

Refactoring

This commit is contained in:
Daniil Gentili 2022-11-26 15:53:16 +01:00
parent 864a76459e
commit 120ba1f64c

View File

@ -522,18 +522,11 @@ class SimpleNegatedAssertionReconciler extends Reconciler
$array_atomic_type = $existing_var_atomic_types['array']; $array_atomic_type = $existing_var_atomic_types['array'];
$redundant = true; $redundant = true;
if (($array_atomic_type instanceof TNonEmptyArray if ($array_atomic_type instanceof TKeyedArray) {
|| $array_atomic_type instanceof TNonEmptyList) if ($count !== null) {
&& ($count === null $prop_max_count = $array_atomic_type->fallback_params === null
|| $array_atomic_type->count >= $count ? count($array_atomic_type->properties)
|| $array_atomic_type->min_count >= $count) : INF;
) {
$redundant = false;
$existing_var_type->removeType('array');
} elseif ($array_atomic_type instanceof TKeyedArray) {
if ($array_atomic_type->fallback_params === null && $count !== null) {
$prop_max_count = count($array_atomic_type->properties);
$prop_min_count = 0; $prop_min_count = 0;
foreach ($array_atomic_type->properties as $property_type) { foreach ($array_atomic_type->properties as $property_type) {
if (!$property_type->possibly_undefined) { if (!$property_type->possibly_undefined) {