From 8078b6dcbf73fd69caab14f3f337817852036628 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 21 Apr 2023 15:58:05 +0200 Subject: [PATCH] Fixes --- psalm-baseline.xml | 7 +------ src/Psalm/Internal/Type/ParseTreeCreator.php | 1 - src/Psalm/Type.php | 1 - tests/ArrayAssignmentTest.php | 2 +- tests/ArrayFunctionCallTest.php | 4 ++-- tests/FunctionCallTest.php | 4 ++-- tests/ReturnTypeTest.php | 4 ++-- tests/TypeCombinationTest.php | 4 ++-- 8 files changed, 10 insertions(+), 17 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index f154dc936..70c788cbd 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + tags['variablesfrom'][0]]]> @@ -439,11 +439,6 @@ traverse - - - self::$listKey - - classExtendsOrImplements diff --git a/src/Psalm/Internal/Type/ParseTreeCreator.php b/src/Psalm/Internal/Type/ParseTreeCreator.php index c0e047143..9fdd3fcc4 100644 --- a/src/Psalm/Internal/Type/ParseTreeCreator.php +++ b/src/Psalm/Internal/Type/ParseTreeCreator.php @@ -252,7 +252,6 @@ class ParseTreeCreator $generic_leaf = new GenericTree( '', $current_parent, - true, ); $current_parent->children []= $generic_leaf; diff --git a/src/Psalm/Type.php b/src/Psalm/Type.php index 4f667d19f..3b98f05c9 100644 --- a/src/Psalm/Type.php +++ b/src/Psalm/Type.php @@ -488,7 +488,6 @@ abstract class Type /** * @psalm-pure - * * @psalm-suppress ImpureStaticProperty Used for caching */ public static function getListKey(bool $from_docblock = false): Union diff --git a/tests/ArrayAssignmentTest.php b/tests/ArrayAssignmentTest.php index c96f2c9f0..f18fee7eb 100644 --- a/tests/ArrayAssignmentTest.php +++ b/tests/ArrayAssignmentTest.php @@ -1540,7 +1540,7 @@ class ArrayAssignmentTest extends TestCase $x = [...$x, ...$y]; ', - 'assertions' => ['$x===' => 'list{int, int, ..., int>}'], + 'assertions' => ['$x===' => 'list{int, int, ...}'], ], 'unpackEmptyKeepsCorrectKeys' => [ 'code' => ' [ // todo: this first type is not entirely correct //'$c===' => "list{int|string, ..., int|string>}", - '$c===' => "list{string, ..., int|string>}", - '$d===' => "list{string, ..., int|string>}", + '$c===' => "list{string, ...}", + '$d===' => "list{string, ...}", ], ], 'arrayMergeEmpty' => [ diff --git a/tests/FunctionCallTest.php b/tests/FunctionCallTest.php index 934c1affe..6429cf6a6 100644 --- a/tests/FunctionCallTest.php +++ b/tests/FunctionCallTest.php @@ -624,7 +624,7 @@ class FunctionCallTest extends TestCase */ $elements = explode(" ", $string, $limit);', 'assertions' => [ - '$elements' => 'list{0?: string, 1?: string, 2?: string, ..., string>}', + '$elements' => 'list{0?: string, 1?: string, 2?: string, ...}', ], ], 'explodeWithDynamicDelimiter' => [ @@ -680,7 +680,7 @@ class FunctionCallTest extends TestCase */ $elements = explode($delim, $string, $limit);', 'assertions' => [ - '$elements' => 'list{0?: string, 1?: string, 2?: string, ..., string>}', + '$elements' => 'list{0?: string, 1?: string, 2?: string, ...}', ], ], 'explodeWithDynamicNonEmptyDelimiter' => [ diff --git a/tests/ReturnTypeTest.php b/tests/ReturnTypeTest.php index 43f35b609..fe9022c7a 100644 --- a/tests/ReturnTypeTest.php +++ b/tests/ReturnTypeTest.php @@ -29,7 +29,7 @@ class ReturnTypeTest extends TestCase $result = ret(); ', 'assertions' => [ - '$result===' => 'list{0?: 0|a, 1?: 0|a, ..., a>}', + '$result===' => 'list{0?: 0|a, 1?: 0|a, ...}', ], ], 'arrayCombineInv' => [ @@ -46,7 +46,7 @@ class ReturnTypeTest extends TestCase $result = ret(); ', 'assertions' => [ - '$result===' => 'list{0?: 0|a, 1?: 0|a, ..., a>}', + '$result===' => 'list{0?: 0|a, 1?: 0|a, ...}', ], ], 'arrayCombine2' => [ diff --git a/tests/TypeCombinationTest.php b/tests/TypeCombinationTest.php index f116e3703..2b85c5517 100644 --- a/tests/TypeCombinationTest.php +++ b/tests/TypeCombinationTest.php @@ -105,7 +105,7 @@ class TypeCombinationTest extends TestCase ], ], 'complexArrayFallback2' => [ - 'list{0?: 0|a, 1?: 0|a, ..., a>}', + 'list{0?: 0|a, 1?: 0|a, ...}', [ 'list', 'list{0, 0}', @@ -639,7 +639,7 @@ class TypeCombinationTest extends TestCase ], ], 'combineNonEmptyListWithTKeyedArrayList' => [ - 'list{null|string, ..., string>}', + 'list{null|string, ...}', [ 'non-empty-list', 'array{null}',