1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-03 10:07:52 +01:00

Deprecate TList and TNonEmptyList

This commit is contained in:
Daniil Gentili 2022-11-21 19:26:09 +01:00
parent 7683a48de3
commit 03c53d7c97
3 changed files with 225 additions and 1 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="dev-master@53e3889745852409b704e0035d93e0819d522912">
<files psalm-version="dev-master@12188caad4b2e4fd7a49a7199e97af2ba1d4c58e">
<file src="examples/TemplateChecker.php">
<PossiblyUndefinedIntArrayOffset occurrences="2">
<code>$comment_block-&gt;tags['variablesfrom'][0]</code>
@ -37,6 +37,11 @@
<code>$uninitialized_variables[0]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php">
<DeprecatedClass occurrences="1">
<code>new TList($param_type)</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Analyzer/ProjectAnalyzer.php">
<PossiblyUndefinedIntArrayOffset occurrences="4">
<code>$destination_parts[1]</code>
@ -71,7 +76,16 @@
<code>$traverser-&gt;traverse([$switch_condition])[0]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php">
<DeprecatedClass occurrences="2">
<code>new TList($item_value_type ?? Type::getMixed())</code>
<code>new TNonEmptyList($item_value_type ?? Type::getMixed())</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php">
<DeprecatedClass occurrences="1">
<code>new Atomic\TList(Type::getMixed())</code>
</DeprecatedClass>
<PossiblyUndefinedIntArrayOffset occurrences="28">
<code>$assertion-&gt;rule[0]</code>
<code>$assertion-&gt;rule[0]</code>
@ -103,6 +117,12 @@
<code>$gettype_expr-&gt;getArgs()[0]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php">
<DeprecatedClass occurrences="4">
<code>new TList($current_type)</code>
<code>new TNonEmptyList($value_type)</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ArithmeticOpAnalyzer.php">
<PossiblyUndefinedIntArrayOffset occurrences="2">
<code>$invalid_left_messages[0]</code>
@ -113,6 +133,14 @@
<ComplexMethod occurrences="1">
<code>verifyType</code>
</ComplexMethod>
<DeprecatedClass occurrences="6">
<code>$array_type</code>
<code>$unpacked_atomic_array</code>
<code>TKeyedArray|TArray|TList|TClassStringMap</code>
<code>TKeyedArray|TArray|TList|TClassStringMap|null</code>
<code>new TList($input_type)</code>
<code>new TNonEmptyList($input_type)</code>
</DeprecatedClass>
<PossiblyUndefinedIntArrayOffset occurrences="3">
<code>$non_existent_method_ids[0]</code>
<code>$parts[1]</code>
@ -120,11 +148,34 @@
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php">
<DeprecatedClass occurrences="2">
<code>$array_type</code>
<code>$array_type</code>
</DeprecatedClass>
<PossiblyUndefinedIntArrayOffset occurrences="1">
<code>$arg_function_params[$argument_offset][0]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php">
<DeprecatedClass occurrences="17">
<code>$array_arg_type</code>
<code>$array_type</code>
<code>$array_type</code>
<code>$replacement_array_type</code>
<code>new TList($arg_value_atomic_type-&gt;type_params[1])</code>
<code>new TList($array_atomic_type-&gt;type_param)</code>
<code>new TList($array_type-&gt;type_params[1])</code>
<code>new TList($array_type-&gt;type_params[1])</code>
<code>new TList($replacement_array_type-&gt;type_params[1])</code>
<code>new TList(Type::getNever())</code>
<code>new TList(Type::getNever())</code>
<code>new TNonEmptyList($arg_value_atomic_type-&gt;type_params[1])</code>
<code>new TNonEmptyList($arg_value_type)</code>
<code>new TNonEmptyList($array_type-&gt;getGenericValueType())</code>
<code>new TNonEmptyList($array_type-&gt;type_params[1])</code>
<code>new TNonEmptyList($array_type-&gt;type_params[1])</code>
<code>new TNonEmptyList($replacement_array_type-&gt;type_params[1])</code>
</DeprecatedClass>
<PossiblyUndefinedIntArrayOffset occurrences="4">
<code>$args[0]</code>
<code>$args[0]</code>
@ -138,6 +189,9 @@
<code>$stmt-&gt;getArgs()[0]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php">
<DeprecatedClass occurrences="1"/>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php">
<PossiblyUndefinedIntArrayOffset occurrences="6">
<code>$result-&gt;invalid_method_call_types[0]</code>
@ -155,6 +209,14 @@
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php">
<DeprecatedClass occurrences="6">
<code>$array_type</code>
<code>$array_type</code>
<code>TArray|TKeyedArray|TList|TClassStringMap</code>
<code>TList</code>
<code>new TList($generic_params)</code>
<code>new TNonEmptyList($replacement_type)</code>
</DeprecatedClass>
<ReferenceConstraintViolation occurrences="3">
<code>$stmt_type</code>
<code>$stmt_type</code>
@ -171,6 +233,18 @@
<code>$invalid_fetch_types[0]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/VariableFetchAnalyzer.php">
<DeprecatedClass occurrences="3">
<code>new TList(Type::getNonEmptyString())</code>
<code>new TNonEmptyList(Type::getString())</code>
<code>new TNonEmptyList(Type::getString())</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/SimpleTypeInferer.php">
<DeprecatedClass occurrences="1">
<code>new TNonEmptyList($item_value_type)</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/YieldAnalyzer.php">
<PossiblyUndefinedIntArrayOffset occurrences="1">
<code>$atomic_return_type-&gt;type_params[2]</code>
@ -192,6 +266,9 @@
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Codebase/InternalCallMapHandler.php">
<DeprecatedClass occurrences="1">
<code>$array_atomic_type</code>
</DeprecatedClass>
<PossiblyUndefinedIntArrayOffset occurrences="2">
<code>$callables[0]</code>
<code>$callables[0]</code>
@ -286,6 +363,9 @@
</RedundantCondition>
</file>
<file src="src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeDocblockScanner.php">
<DeprecatedClass occurrences="1">
<code>$array_type</code>
</DeprecatedClass>
<PossiblyUndefinedIntArrayOffset occurrences="1">
<code>$flow_parts[0]</code>
</PossiblyUndefinedIntArrayOffset>
@ -300,6 +380,97 @@
<code>$cs[0]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayChunkReturnTypeProvider.php">
<DeprecatedClass occurrences="3">
<code>new TList(Type::getArray())</code>
<code>new TNonEmptyList($array_type-&gt;value)</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayColumnReturnTypeProvider.php">
<DeprecatedClass occurrences="2">
<code>new TList($result_element_type ?? Type::getMixed())</code>
<code>new TNonEmptyList($result_element_type ?? Type::getMixed())</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFillReturnTypeProvider.php">
<DeprecatedClass occurrences="2"/>
</file>
<file src="src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayFilterReturnTypeProvider.php">
<DeprecatedClass occurrences="1"/>
</file>
<file src="src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMapReturnTypeProvider.php">
<DeprecatedClass occurrences="2"/>
</file>
<file src="src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMergeReturnTypeProvider.php">
<DeprecatedClass occurrences="2">
<code>new TList($inner_value_type)</code>
<code>new TNonEmptyList($inner_value_type)</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayPadReturnTypeProvider.php">
<DeprecatedClass occurrences="2">
<code>new TList($value_type)</code>
<code>new TNonEmptyList($value_type)</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayRandReturnTypeProvider.php">
<DeprecatedClass occurrences="1"/>
</file>
<file src="src/Psalm/Internal/Provider/ReturnTypeProvider/ArraySliceReturnTypeProvider.php">
<DeprecatedClass occurrences="1">
<code>new TList($return_atomic_type-&gt;type_params[1])</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Provider/ReturnTypeProvider/ArraySpliceReturnTypeProvider.php">
<DeprecatedClass occurrences="3">
<code>new TList(Type::getInt())</code>
<code>new TList(Type::getMixed())</code>
<code>new TList(Type::getString())</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Provider/ReturnTypeProvider/ExplodeReturnTypeProvider.php">
<DeprecatedClass occurrences="6">
<code>new TList($inner_type)</code>
<code>new TList($inner_type)</code>
<code>new TList($inner_type)</code>
<code>new TNonEmptyList($inner_type)</code>
<code>new TNonEmptyList($inner_type)</code>
<code>new TNonEmptyList($inner_type)</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Provider/ReturnTypeProvider/InArrayReturnTypeProvider.php">
<DeprecatedClass occurrences="1">
<code>$array_arg_type</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Provider/ReturnTypeProvider/IteratorToArrayReturnTypeProvider.php">
<DeprecatedClass occurrences="1">
<code>new TList($value_type)</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Provider/ReturnTypeProvider/PdoStatementReturnTypeProvider.php">
<DeprecatedClass occurrences="2">
<code>new TList(Type::getScalar())</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Scanner/PhpStormMetaScanner.php">
<DeprecatedClass occurrences="2">
<code>$array_atomic_type</code>
<code>$array_atomic_type</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php">
<DeprecatedClass occurrences="2">
<code>TArray|TKeyedArray|TList|TClassStringMap</code>
<code>TArray|TKeyedArray|TList|TClassStringMap</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Type/Comparator/AtomicTypeComparator.php">
<DeprecatedClass occurrences="2">
<code>TList::class</code>
<code>TList::class</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Type/Comparator/CallableTypeComparator.php">
<LessSpecificReturnStatement occurrences="1">
<code>$callable</code>
@ -308,6 +479,17 @@
<code>TCallable|TClosure|null</code>
</MoreSpecificReturnType>
</file>
<file src="src/Psalm/Internal/Type/SimpleAssertionReconciler.php">
<DeprecatedClass occurrences="9">
<code>TList::class</code>
<code>new TList($type-&gt;type_params[1])</code>
<code>new TList($type-&gt;type_params[1])</code>
<code>new TNonEmptyList($array_atomic_type-&gt;type_param)</code>
<code>new TNonEmptyList($type-&gt;type_param)</code>
<code>new TNonEmptyList($type-&gt;type_param)</code>
<code>new TNonEmptyList($type-&gt;type_params[1])</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php">
<ImpureMethodCall occurrences="2">
<code>getClassTemplateTypes</code>
@ -315,6 +497,9 @@
</ImpureMethodCall>
</file>
<file src="src/Psalm/Internal/Type/TypeCombiner.php">
<DeprecatedClass occurrences="2">
<code>new TList($generic_type_params[1])</code>
</DeprecatedClass>
<PossiblyUndefinedIntArrayOffset occurrences="6">
<code>$combination-&gt;array_type_params[1]</code>
<code>$combination-&gt;array_type_params[1]</code>
@ -325,6 +510,10 @@
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Type/TypeParser.php">
<DeprecatedClass occurrences="2">
<code>new TList($generic_params[0], $from_docblock)</code>
<code>new TNonEmptyList($generic_params[0], null, null, $from_docblock)</code>
</DeprecatedClass>
<PossiblyUndefinedIntArrayOffset occurrences="8">
<code>$intersection_types[0]</code>
<code>$parse_tree-&gt;children[0]</code>
@ -349,7 +538,17 @@
<code>traverse</code>
</ImpureMethodCall>
</file>
<file src="src/Psalm/Type.php">
<DeprecatedClass occurrences="2">
<code>new TList(new Union([new TMixed]))</code>
<code>new TNonEmptyList(new Union([new TMixed]))</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Type/Atomic.php">
<DeprecatedClass occurrences="2">
<code>new TList(Type::getMixed(false, $from_docblock))</code>
<code>new TNonEmptyList(Type::getMixed(false, $from_docblock))</code>
</DeprecatedClass>
<ImpureMethodCall occurrences="12">
<code>classExtendsOrImplements</code>
<code>classExtendsOrImplements</code>
@ -394,6 +593,11 @@
<code>getMostSpecificTypeFromBounds</code>
</ImpureMethodCall>
</file>
<file src="src/Psalm/Type/Atomic/TCallableList.php">
<DeprecatedClass occurrences="1">
<code>TNonEmptyList</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Type/Atomic/TClassString.php">
<ImpureMethodCall occurrences="1">
<code>replace</code>
@ -416,6 +620,11 @@
</ImpureMethodCall>
</file>
<file src="src/Psalm/Type/Atomic/TKeyedArray.php">
<DeprecatedClass occurrences="3">
<code>TList</code>
<code>new TList($this-&gt;getGenericValueType())</code>
<code>new TNonEmptyList($this-&gt;getGenericValueType())</code>
</DeprecatedClass>
<ImpureMethodCall occurrences="10">
<code>combine</code>
<code>combine</code>
@ -441,6 +650,11 @@
<code>$cloned-&gt;type_param</code>
</ImpurePropertyAssignment>
</file>
<file src="src/Psalm/Type/Atomic/TNonEmptyList.php">
<DeprecatedClass occurrences="1">
<code>TList</code>
</DeprecatedClass>
</file>
<file src="src/Psalm/Type/Atomic/TObjectWithProperties.php">
<ImpureMethodCall occurrences="2">
<code>replace</code>
@ -506,6 +720,11 @@
<code>allFloatLiterals</code>
</PossiblyUnusedMethod>
</file>
<file src="tests/Config/Plugin/Hook/CustomArrayMapFunctionStorageProvider.php">
<DeprecatedClass occurrences="1">
<code>new Type\Atomic\TList($last_callable_arg-&gt;return_type ?? Type::getMixed())</code>
</DeprecatedClass>
</file>
<file src="tests/Internal/Codebase/InternalCallMapHandlerTest.php">
<UnusedPsalmSuppress occurrences="1">
<code>UndefinedMethod</code>

View File

@ -19,6 +19,8 @@ use function get_class;
* - they start at 0
* - they are consecutive and go upwards (no negative int)
*
* @deprecated Will be removed and replaced with TKeyedArray in Psalm 5.1
*
* @psalm-immutable
*/
class TList extends Atomic

View File

@ -6,6 +6,9 @@ use Psalm\Type\Union;
/**
* Represents a non-empty list
*
* @deprecated Will be removed and replaced with TKeyedArray in Psalm 5.1
*
* @psalm-immutable
*/
class TNonEmptyList extends TList