From ab21c97d13d181287c1f0b2719850f98e17f8a00 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 3 Oct 2022 11:05:34 +0200 Subject: [PATCH] Cleanup --- psalm-baseline.xml | 23 +------------------ src/Psalm/Internal/Type/TypeExpander.php | 1 + src/Psalm/Type/Atomic/TClassString.php | 5 ---- src/Psalm/Type/Atomic/TIterable.php | 2 +- .../Codebase/InternalCallMapHandlerTest.php | 4 ---- 5 files changed, 3 insertions(+), 32 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index f5d6ace1a6b..09f1f3a3587 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + $comment_block->tags['variablesfrom'][0] @@ -310,11 +310,6 @@ $combination->array_type_params[1] - - - if ($return_type instanceof TKeyOf - - $intersection_types[0] @@ -342,17 +337,6 @@ replaceTypeParams - - - !$this->as_type - !$this->as_type - - - - - $type_params - - replaceAs @@ -385,11 +369,6 @@ allFloatLiterals - - - UndefinedMethod - - $subNodes['expr'] diff --git a/src/Psalm/Internal/Type/TypeExpander.php b/src/Psalm/Internal/Type/TypeExpander.php index 82323cdf446..228c1d7b507 100644 --- a/src/Psalm/Internal/Type/TypeExpander.php +++ b/src/Psalm/Internal/Type/TypeExpander.php @@ -130,6 +130,7 @@ public static function expandUnion( * * @return non-empty-list * + * @psalm-suppress ConflictingReferenceConstraint Ultimately, the output type is always an Atomic * @psalm-suppress ComplexMethod */ public static function expandAtomic( diff --git a/src/Psalm/Type/Atomic/TClassString.php b/src/Psalm/Type/Atomic/TClassString.php index 1219c990167..29da5032327 100644 --- a/src/Psalm/Type/Atomic/TClassString.php +++ b/src/Psalm/Type/Atomic/TClassString.php @@ -197,11 +197,6 @@ public function replaceTemplateTypesWithStandins( : null; if ($this->as_type === $as_type) { - if (!$this->as_type && $this->as !== 'object') { - $cloned = clone $this; - $cloned->as = 'object'; - return $cloned; - } return $this; } $cloned = clone $this; diff --git a/src/Psalm/Type/Atomic/TIterable.php b/src/Psalm/Type/Atomic/TIterable.php index 248e86f5988..c052a2f0a99 100644 --- a/src/Psalm/Type/Atomic/TIterable.php +++ b/src/Psalm/Type/Atomic/TIterable.php @@ -42,7 +42,7 @@ final class TIterable extends Atomic */ public function __construct(array $type_params = [], array $extra_types = []) { - if (count($type_params) === 2) { + if (isset($type_params[0], $type_params[1])) { $this->has_docblock_params = true; $this->type_params = $type_params; } else { diff --git a/tests/Internal/Codebase/InternalCallMapHandlerTest.php b/tests/Internal/Codebase/InternalCallMapHandlerTest.php index e69385648bc..f8845eff215 100644 --- a/tests/Internal/Codebase/InternalCallMapHandlerTest.php +++ b/tests/Internal/Codebase/InternalCallMapHandlerTest.php @@ -754,10 +754,6 @@ private function assertParameter(array $normalizedEntry, ReflectionParameter $pa } } - /** - * - * @psalm-suppress UndefinedMethod - */ public function assertEntryReturnType(ReflectionFunction $function, string $entryReturnType): void { if (version_compare(PHP_VERSION, '8.1.0', '>=')) {