From 4783149773fe91549baec1df365cd64c8e88130a Mon Sep 17 00:00:00 2001 From: orklah Date: Wed, 27 Oct 2021 21:26:31 +0200 Subject: [PATCH] deprecate TEmpty --- psalm-baseline.xml | 156 +++++++++++++++++++++++++++++-- src/Psalm/Type.php | 3 + src/Psalm/Type/Atomic/TEmpty.php | 1 + 3 files changed, 154 insertions(+), 6 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index ca459252d11..3e1b8768bdb 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + $comment_block->tags['variablesfrom'][0] @@ -12,11 +12,6 @@ $matches[1] - - - $matches[$match_offset] - - $matches[0] @@ -125,7 +120,18 @@ $gettype_expr->getArgs()[0] + + + Type::getEmpty() + + + + Type::getEmpty() + Type::getEmpty() + Type::getEmpty() + Type::getEmpty() + $invalid_left_messages[0] $invalid_right_messages[0] @@ -145,6 +151,12 @@ + + new TEmpty + new TEmpty + new TEmpty + new TEmpty + $args[0] $args[0] @@ -158,6 +170,21 @@ $stmt->getArgs()[0] + + + Type::getEmpty() + + + + + Type\Atomic\TEmpty::class + + + + + Type::getEmpty() + + $result->existent_method_ids[0] @@ -169,6 +196,16 @@ $result->non_existent_magic_method_ids[0] + + + Type::getEmpty() + + + + + Type::getEmpty() + + $assertion->rule[0] @@ -176,16 +213,57 @@ $callable_arg->items[1] + + + Type::getEmpty() + Type::getEmpty() + + + + + Type::getEmpty() + + + + + Type\Atomic\TMixed|Type\Atomic\TTemplateParam|Type\Atomic\TEmpty + new TEmpty + new TEmpty + + + Type::getEmpty() + Type::getEmpty() + + $invalid_fetch_types[0] + + Type::getEmpty() + $atomic_return_type->type_params[2] + + + Type::getEmpty() + + + + + \Psalm\Type::getEmpty() + + + + + new Type\Atomic\TEmpty + new Type\Atomic\TEmpty + + $token_list[$iter] @@ -201,6 +279,16 @@ $stmt->expr->getArgs()[0] + + + new Type\Atomic\TEmpty() + new Type\Atomic\TEmpty() + + + Type::getEmpty() + Type::getEmpty() + + $callables[0] @@ -305,6 +393,49 @@ $cs[0] + + + new Type\Atomic\TEmpty() + new Type\Atomic\TEmpty() + + + + + Type::getEmpty() + Type::getEmpty() + Type::getEmpty() + + + + + new TEmpty() + new TEmpty() + + + Type::getEmpty() + Type::getEmpty() + Type::getEmpty() + Type::getEmpty() + Type::getEmpty() + Type::getEmpty() + Type::getEmpty() + Type::getEmpty() + Type::getEmpty() + Type::getEmpty() + Type::getEmpty() + Type::getEmpty() + Type::getEmpty() + + + + + new TEmpty + new TEmpty + + + Type::getEmpty() + + $combination->array_type_params[1] @@ -333,7 +464,17 @@ $rules[0] + + + new TEmpty + new TEmpty + new TEmpty() + + + + new TEmpty() + array_keys($template_type_map[$value])[0] @@ -344,6 +485,9 @@ + + new TEmpty + $type[0] diff --git a/src/Psalm/Type.php b/src/Psalm/Type.php index 0df0afe5423..b9aa81853df 100644 --- a/src/Psalm/Type.php +++ b/src/Psalm/Type.php @@ -299,6 +299,9 @@ public static function getScalar(): Union return new Union([$type]); } + /** + * @deprecated will be removed in Psalm 5. See getNever to retrieve a TNever that replaces TEmpty + */ public static function getEmpty(): Union { $type = new TEmpty(); diff --git a/src/Psalm/Type/Atomic/TEmpty.php b/src/Psalm/Type/Atomic/TEmpty.php index 89e55233993..992178047ca 100644 --- a/src/Psalm/Type/Atomic/TEmpty.php +++ b/src/Psalm/Type/Atomic/TEmpty.php @@ -4,6 +4,7 @@ /** * Denotes the `empty` type, used to describe a type corresponding to no value whatsoever. * Empty arrays `[]` have the type `array`. + * @deprecated Will be replaced by TNever when in type context and TAssertionEmpty for assertion context in Psalm 5 */ class TEmpty extends Scalar {