Skip to content

Commit

Permalink
Use count instead of empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrolGenhald committed Jun 2, 2022
1 parent 307b8e6 commit 81c003b
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static function analyze(
Context $context
): bool {
// if the array is empty, this special type allows us to match any other array type against it
if (empty($stmt->items)) {
if (count($stmt->items) === 0) {
$statements_analyzer->node_data->setType($stmt, Type::getEmptyArray());

return true;
Expand Down Expand Up @@ -94,7 +94,7 @@ public static function analyze(
);
}

if (!empty($array_creation_info->item_key_atomic_types)) {
if (count($array_creation_info->item_key_atomic_types) !== 0) {
$item_key_type = TypeCombiner::combine(
$array_creation_info->item_key_atomic_types,
$codebase,
Expand All @@ -106,7 +106,7 @@ public static function analyze(
$item_key_type = null;
}

if (!empty($array_creation_info->item_value_atomic_types)) {
if (count($array_creation_info->item_value_atomic_types) !== 0) {
$item_value_type = TypeCombiner::combine(
$array_creation_info->item_value_atomic_types,
$codebase,
Expand All @@ -119,7 +119,7 @@ public static function analyze(
}

// if this array looks like an object-like array, let's return that instead
if (!empty($array_creation_info->property_types)) {
if (count($array_creation_info->property_types) !== 0) {
$atomic_type = new TKeyedArray($array_creation_info->property_types, $array_creation_info->class_strings);
if ($array_creation_info->can_create_objectlike) {
$atomic_type->sealed = true;
Expand Down

0 comments on commit 81c003b

Please sign in to comment.