diff --git a/phpcs.xml b/phpcs.xml
index c34c9b83a..8ce34194d 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -25,7 +25,7 @@
tests/fixtures/
tests
- src/Psalm/Internal/Type/UnionTemplateHandler.php
+ src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php
diff --git a/src/Psalm/Internal/Analyzer/ClassAnalyzer.php b/src/Psalm/Internal/Analyzer/ClassAnalyzer.php
index fac50a4cf..4323677e9 100644
--- a/src/Psalm/Internal/Analyzer/ClassAnalyzer.php
+++ b/src/Psalm/Internal/Analyzer/ClassAnalyzer.php
@@ -7,7 +7,7 @@ use Psalm\DocComment;
use Psalm\Exception\DocblockParseException;
use Psalm\Internal\Analyzer\Statements\Expression\Call\ClassTemplateParamCollector;
use Psalm\Internal\FileManipulation\PropertyDocblockManipulator;
-use Psalm\Internal\Type\UnionTemplateHandler;
+use Psalm\Internal\Type\TemplateStandinTypeReplacer;
use Psalm\Internal\Type\Comparator\UnionTypeComparator;
use Psalm\Codebase;
use Psalm\CodeLocation;
@@ -1080,7 +1080,7 @@ class ClassAnalyzer extends ClassLikeAnalyzer
);
if ($class_template_params) {
- $fleshed_out_type = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $fleshed_out_type = TemplateStandinTypeReplacer::replace(
$fleshed_out_type,
$template_result,
$codebase,
@@ -2081,7 +2081,7 @@ class ClassAnalyzer extends ClassLikeAnalyzer
[]
);
- $return_type = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $return_type = TemplateStandinTypeReplacer::replace(
$return_type,
$template_result,
$codebase,
@@ -2228,7 +2228,7 @@ class ClassAnalyzer extends ClassLikeAnalyzer
[]
);
- $template_type_copy = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $template_type_copy = TemplateStandinTypeReplacer::replace(
$template_type_copy,
$template_result,
$codebase,
diff --git a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php
index 7f49dbb13..83db2649f 100644
--- a/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php
+++ b/src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php
@@ -813,7 +813,7 @@ class ReturnTypeAnalyzer
[]
);
- $fleshed_out_return_type = \Psalm\Internal\Type\UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $fleshed_out_return_type = \Psalm\Internal\Type\TemplateStandinTypeReplacer::replace(
$fleshed_out_return_type,
$template_result,
$codebase,
diff --git a/src/Psalm/Internal/Analyzer/MethodComparator.php b/src/Psalm/Internal/Analyzer/MethodComparator.php
index 714ef936c..b0cf2b3bd 100644
--- a/src/Psalm/Internal/Analyzer/MethodComparator.php
+++ b/src/Psalm/Internal/Analyzer/MethodComparator.php
@@ -1069,7 +1069,7 @@ class MethodComparator
$template_result = new \Psalm\Internal\Type\TemplateResult([], $template_types);
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$templated_type,
$template_result,
$codebase
diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php
index 5990f9c51..39d9b09b3 100644
--- a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php
+++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/ArrayAssignmentAnalyzer.php
@@ -522,7 +522,7 @@ class ArrayAssignmentAnalyzer
]
);
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$current_type,
$template_result,
$codebase
diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php
index 4885ee454..29840cc48 100644
--- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php
+++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentAnalyzer.php
@@ -17,7 +17,7 @@ use Psalm\Internal\Codebase\TaintFlowGraph;
use Psalm\Internal\MethodIdentifier;
use Psalm\Internal\Type\TemplateBound;
use Psalm\Internal\Type\TemplateResult;
-use Psalm\Internal\Type\UnionTemplateHandler;
+use Psalm\Internal\Type\TemplateStandinTypeReplacer;
use Psalm\Internal\Type\TemplateInferredTypeReplacer;
use Psalm\CodeLocation;
use Psalm\Context;
@@ -237,7 +237,7 @@ class ArgumentAnalyzer
$arg_value_type = $statements_analyzer->node_data->getType($arg->value);
- $param_type = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $param_type = TemplateStandinTypeReplacer::replace(
$param_type,
$empty_template_result,
$codebase,
@@ -247,7 +247,7 @@ class ArgumentAnalyzer
$context->self ?: 'fn-' . $context->calling_function_id
);
- $arg_type = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $arg_type = TemplateStandinTypeReplacer::replace(
$arg_type,
$empty_template_result,
$codebase,
@@ -294,7 +294,7 @@ class ArgumentAnalyzer
}
}
- $param_type = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $param_type = TemplateStandinTypeReplacer::replace(
$param_type,
$template_result,
$codebase,
diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php
index bb1af673b..97943b5fb 100644
--- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php
+++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArgumentsAnalyzer.php
@@ -16,7 +16,7 @@ use Psalm\Internal\Stubs\Generator\StubsGenerator;
use Psalm\Internal\Type\Comparator\UnionTypeComparator;
use Psalm\Internal\MethodIdentifier;
use Psalm\Internal\Type\TemplateResult;
-use Psalm\Internal\Type\UnionTemplateHandler;
+use Psalm\Internal\Type\TemplateStandinTypeReplacer;
use Psalm\Internal\Type\TemplateInferredTypeReplacer;
use Psalm\CodeLocation;
use Psalm\Context;
@@ -255,7 +255,7 @@ class ArgumentsAnalyzer
$existing_type = $statements_analyzer->node_data->getType($arg->value);
- \Psalm\Internal\Type\UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ \Psalm\Internal\Type\TemplateStandinTypeReplacer::replace(
$generic_param_type,
$replace_template_result,
$codebase,
@@ -337,7 +337,7 @@ class ArgumentsAnalyzer
[]
);
- $replaced_type = \Psalm\Internal\Type\UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $replaced_type = \Psalm\Internal\Type\TemplateStandinTypeReplacer::replace(
$replaced_type,
$replace_template_result,
$codebase,
@@ -348,7 +348,7 @@ class ArgumentsAnalyzer
'fn-' . ($context->calling_method_id ?: $context->calling_function_id)
);
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$replaced_type,
$replace_template_result,
$codebase
@@ -610,7 +610,7 @@ class ArgumentsAnalyzer
continue;
}
- UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ TemplateStandinTypeReplacer::replace(
$function_param->type,
$template_result,
$codebase,
@@ -896,7 +896,7 @@ class ArgumentsAnalyzer
&& !$param->is_variadic
&& $template_result
) {
- UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ TemplateStandinTypeReplacer::replace(
$param->type,
$template_result,
$codebase,
@@ -992,7 +992,7 @@ class ArgumentsAnalyzer
if ($template_result && $by_ref_type) {
$original_by_ref_type = clone $by_ref_type;
- $by_ref_type = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $by_ref_type = TemplateStandinTypeReplacer::replace(
clone $by_ref_type,
$template_result,
$codebase,
@@ -1003,7 +1003,7 @@ class ArgumentsAnalyzer
);
if ($template_result->upper_bounds) {
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$original_by_ref_type,
$template_result,
$codebase
@@ -1016,7 +1016,7 @@ class ArgumentsAnalyzer
if ($template_result && $by_ref_out_type) {
$original_by_ref_out_type = clone $by_ref_out_type;
- $by_ref_out_type = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $by_ref_out_type = TemplateStandinTypeReplacer::replace(
clone $by_ref_out_type,
$template_result,
$codebase,
@@ -1027,7 +1027,7 @@ class ArgumentsAnalyzer
);
if ($template_result->upper_bounds) {
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$original_by_ref_out_type,
$template_result,
$codebase
diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php
index f743d0253..dbed2214d 100644
--- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php
+++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/ArrayFunctionArgumentsAnalyzer.php
@@ -10,7 +10,7 @@ use Psalm\Internal\Analyzer\Statements\Expression\ExpressionIdentifier;
use Psalm\Internal\Analyzer\StatementsAnalyzer;
use Psalm\Internal\Codebase\InternalCallMapHandler;
use Psalm\Internal\Type\TypeCombiner;
-use Psalm\Internal\Type\UnionTemplateHandler;
+use Psalm\Internal\Type\TemplateStandinTypeReplacer;
use Psalm\Internal\Type\TemplateInferredTypeReplacer;
use Psalm\Internal\Type\Comparator\UnionTypeComparator;
use Psalm\CodeLocation;
@@ -831,7 +831,7 @@ class ArrayFunctionArgumentsAnalyzer
];
}
- $closure_param_type = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $closure_param_type = TemplateStandinTypeReplacer::replace(
$closure_param_type,
$template_result,
$codebase,
diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php
index bd249489f..1caa73e15 100644
--- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php
+++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php
@@ -105,7 +105,7 @@ class FunctionCallReturnTypeFetcher
null
);
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$return_type,
$template_result,
$codebase
@@ -496,7 +496,7 @@ class FunctionCallReturnTypeFetcher
foreach ($function_storage->conditionally_removed_taints as $conditionally_removed_taint) {
$conditionally_removed_taint = clone $conditionally_removed_taint;
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$conditionally_removed_taint,
$template_result,
$codebase
diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallReturnTypeFetcher.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallReturnTypeFetcher.php
index 8b28c6f01..d235850b3 100644
--- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallReturnTypeFetcher.php
+++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/Method/MethodCallReturnTypeFetcher.php
@@ -462,7 +462,7 @@ class MethodCallReturnTypeFetcher
null
);
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$return_type_candidate,
$template_result,
$codebase
diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticCallAnalyzer.php
index c1da4f927..22c1edf9e 100644
--- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticCallAnalyzer.php
+++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticCallAnalyzer.php
@@ -281,7 +281,7 @@ class StaticCallAnalyzer extends CallAnalyzer
foreach ($method_storage->conditionally_removed_taints as $conditionally_removed_taint) {
$conditionally_removed_taint = clone $conditionally_removed_taint;
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$conditionally_removed_taint,
$template_result,
$codebase
diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/ExistingAtomicStaticCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/ExistingAtomicStaticCallAnalyzer.php
index afac6c37a..5015356e9 100644
--- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/ExistingAtomicStaticCallAnalyzer.php
+++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/ExistingAtomicStaticCallAnalyzer.php
@@ -283,7 +283,7 @@ class ExistingAtomicStaticCallAnalyzer
null
);
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$return_type_candidate,
$template_result,
$codebase
diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php
index 3e52f8c5a..5bd99af1e 100644
--- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php
+++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php
@@ -1330,7 +1330,7 @@ class ArrayFetchAnalyzer
$expected_value_param_get = clone $type->value_param;
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$expected_value_param_get,
$template_result_get,
$codebase
@@ -1339,7 +1339,7 @@ class ArrayFetchAnalyzer
if ($replacement_type) {
$expected_value_param_set = clone $type->value_param;
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$replacement_type,
$template_result_set,
$codebase
diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php
index bef261490..4ddd548ea 100644
--- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php
+++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/AtomicPropertyFetchAnalyzer.php
@@ -752,7 +752,7 @@ class AtomicPropertyFetchAnalyzer
}
}
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$class_property_type,
new TemplateResult([], $template_types),
$codebase
diff --git a/src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php
index e433697e4..2602873df 100644
--- a/src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php
+++ b/src/Psalm/Internal/Analyzer/Statements/ReturnAnalyzer.php
@@ -269,7 +269,7 @@ class ReturnAnalyzer
$local_return_type = clone $local_return_type;
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$local_return_type,
new TemplateResult([], $found_generic_params),
$codebase
diff --git a/src/Psalm/Internal/Type/AssertionReconciler.php b/src/Psalm/Internal/Type/AssertionReconciler.php
index 82ba64272..470c9445f 100644
--- a/src/Psalm/Internal/Type/AssertionReconciler.php
+++ b/src/Psalm/Internal/Type/AssertionReconciler.php
@@ -833,7 +833,7 @@ class AssertionReconciler extends \Psalm\Type\Reconciler
);
if ($template_type_map) {
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$new_param,
new TemplateResult([], $template_type_map),
$codebase
@@ -882,7 +882,7 @@ class AssertionReconciler extends \Psalm\Type\Reconciler
);
if ($template_type_map) {
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$new_param,
new TemplateResult([], $template_type_map),
$codebase
diff --git a/src/Psalm/Internal/Type/Comparator/GenericTypeComparator.php b/src/Psalm/Internal/Type/Comparator/GenericTypeComparator.php
index f8ccbae27..fd2ff22f6 100644
--- a/src/Psalm/Internal/Type/Comparator/GenericTypeComparator.php
+++ b/src/Psalm/Internal/Type/Comparator/GenericTypeComparator.php
@@ -74,7 +74,7 @@ class GenericTypeComparator
$container_type_params_covariant = [];
- $input_type_params = \Psalm\Internal\Type\UnionTemplateHandler::getMappedGenericTypeParams(
+ $input_type_params = \Psalm\Internal\Type\TemplateStandinTypeReplacer::getMappedGenericTypeParams(
$codebase,
$input_type_part,
$container_type_part,
diff --git a/src/Psalm/Internal/Type/TemplateInferredTypeReplacer.php b/src/Psalm/Internal/Type/TemplateInferredTypeReplacer.php
index 85589d89b..58955fb12 100644
--- a/src/Psalm/Internal/Type/TemplateInferredTypeReplacer.php
+++ b/src/Psalm/Internal/Type/TemplateInferredTypeReplacer.php
@@ -43,7 +43,7 @@ class TemplateInferredTypeReplacer
/**
* This replaces template types in unions with the inferred types they should be
*/
- public static function replaceTemplateTypesWithArgTypes(
+ public static function replace(
Union $union,
TemplateResult $template_result,
?Codebase $codebase
@@ -62,7 +62,7 @@ class TemplateInferredTypeReplacer
if ($atomic_type instanceof Atomic\TTemplateParam) {
$template_type = null;
- $traversed_type = \Psalm\Internal\Type\UnionTemplateHandler::getRootTemplateType(
+ $traversed_type = \Psalm\Internal\Type\TemplateStandinTypeReplacer::getRootTemplateType(
$inferred_upper_bounds,
$atomic_type->param_name,
$atomic_type->defining_class
@@ -234,7 +234,7 @@ class TemplateInferredTypeReplacer
$atomic_type = clone $atomic_type;
if ($template_type) {
- self::replaceTemplateTypesWithArgTypes(
+ self::replace(
$atomic_type->as_type,
$template_result,
$codebase
@@ -250,7 +250,7 @@ class TemplateInferredTypeReplacer
$atomic_type->conditional_type
)) {
$class_template_type = clone $atomic_type->if_type;
- self::replaceTemplateTypesWithArgTypes(
+ self::replace(
$class_template_type,
$template_result,
$codebase
@@ -267,7 +267,7 @@ class TemplateInferredTypeReplacer
)
) {
$class_template_type = clone $atomic_type->else_type;
- self::replaceTemplateTypesWithArgTypes(
+ self::replace(
$class_template_type,
$template_result,
$codebase
@@ -276,13 +276,13 @@ class TemplateInferredTypeReplacer
}
if (!$class_template_type) {
- self::replaceTemplateTypesWithArgTypes(
+ self::replace(
$atomic_type->if_type,
$template_result,
$codebase
);
- self::replaceTemplateTypesWithArgTypes(
+ self::replace(
$atomic_type->else_type,
$template_result,
$codebase
diff --git a/src/Psalm/Internal/Type/UnionTemplateHandler.php b/src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php
similarity index 98%
rename from src/Psalm/Internal/Type/UnionTemplateHandler.php
rename to src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php
index e9b3c64f7..4e7d69f6c 100644
--- a/src/Psalm/Internal/Type/UnionTemplateHandler.php
+++ b/src/Psalm/Internal/Type/TemplateStandinTypeReplacer.php
@@ -16,12 +16,12 @@ use function is_string;
use function strpos;
use function substr;
-class UnionTemplateHandler
+class TemplateStandinTypeReplacer
{
/**
* This replaces template types in unions with standins (normally the template as type)
*/
- public static function replaceTemplateTypesWithStandins(
+ public static function replace(
Union $union_type,
TemplateResult $template_result,
?Codebase $codebase,
@@ -469,7 +469,7 @@ class UnionTemplateHandler
if ($atomic_type->extra_types) {
foreach ($atomic_type->extra_types as $extra_type) {
- $extra_type = self::replaceTemplateTypesWithStandins(
+ $extra_type = self::replace(
new \Psalm\Type\Union([$extra_type]),
$template_result,
$codebase,
@@ -518,7 +518,7 @@ class UnionTemplateHandler
}
if ($depth < 10) {
- $replacement_type = self::replaceTemplateTypesWithStandins(
+ $replacement_type = self::replace(
$replacement_type,
$template_result,
$codebase,
@@ -600,7 +600,7 @@ class UnionTemplateHandler
);
}
- $atomic_type->as = self::replaceTemplateTypesWithStandins(
+ $atomic_type->as = self::replace(
$atomic_type->as,
$template_result,
$codebase,
@@ -979,7 +979,7 @@ class UnionTemplateHandler
$new_input_param = clone $new_input_param;
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$new_input_param,
new TemplateResult([], $replacement_templates),
$codebase
diff --git a/src/Psalm/Type/Atomic/CallableTrait.php b/src/Psalm/Type/Atomic/CallableTrait.php
index 0b50eb24e..5c927384c 100644
--- a/src/Psalm/Type/Atomic/CallableTrait.php
+++ b/src/Psalm/Type/Atomic/CallableTrait.php
@@ -7,7 +7,7 @@ use function implode;
use Psalm\Codebase;
use Psalm\Internal\Analyzer\StatementsAnalyzer;
use Psalm\Internal\Type\TemplateResult;
-use Psalm\Internal\Type\UnionTemplateHandler;
+use Psalm\Internal\Type\TemplateStandinTypeReplacer;
use Psalm\Internal\Type\TemplateInferredTypeReplacer;
use Psalm\Storage\FunctionLikeParameter;
use Psalm\Type\Atomic;
@@ -206,7 +206,7 @@ trait CallableTrait
continue;
}
- $param->type = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $param->type = TemplateStandinTypeReplacer::replace(
$param->type,
$template_result,
$codebase,
@@ -226,7 +226,7 @@ trait CallableTrait
&& $callable->return_type
&& $input_type->return_type
) {
- $callable->return_type = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $callable->return_type = TemplateStandinTypeReplacer::replace(
$callable->return_type,
$template_result,
$codebase,
@@ -253,7 +253,7 @@ trait CallableTrait
continue;
}
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$param->type,
$template_result,
$codebase
@@ -262,7 +262,7 @@ trait CallableTrait
}
if ($this->return_type) {
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$this->return_type,
$template_result,
$codebase
diff --git a/src/Psalm/Type/Atomic/GenericTrait.php b/src/Psalm/Type/Atomic/GenericTrait.php
index f8aae8021..563d18513 100644
--- a/src/Psalm/Type/Atomic/GenericTrait.php
+++ b/src/Psalm/Type/Atomic/GenericTrait.php
@@ -6,7 +6,7 @@ use function implode;
use Psalm\Codebase;
use Psalm\Internal\Analyzer\StatementsAnalyzer;
use Psalm\Internal\Type\TemplateResult;
-use Psalm\Internal\Type\UnionTemplateHandler;
+use Psalm\Internal\Type\TemplateStandinTypeReplacer;
use Psalm\Internal\Type\TemplateInferredTypeReplacer;
use Psalm\Type;
use Psalm\Type\Atomic;
@@ -169,7 +169,7 @@ trait GenericTrait
&& ($this instanceof Atomic\TGenericObject || $this instanceof Atomic\TIterable)
&& $codebase
) {
- $input_object_type_params = UnionTemplateHandler::getMappedGenericTypeParams(
+ $input_object_type_params = TemplateStandinTypeReplacer::getMappedGenericTypeParams(
$codebase,
$input_type,
$this
@@ -202,7 +202,7 @@ trait GenericTrait
}
/** @psalm-suppress PropertyTypeCoercion */
- $atomic->type_params[$offset] = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $atomic->type_params[$offset] = TemplateStandinTypeReplacer::replace(
$type_param,
$template_result,
$codebase,
@@ -225,7 +225,7 @@ trait GenericTrait
?Codebase $codebase
) : void {
foreach ($this->type_params as $offset => $type_param) {
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$type_param,
$template_result,
$codebase
diff --git a/src/Psalm/Type/Atomic/TClassString.php b/src/Psalm/Type/Atomic/TClassString.php
index 65b048733..af1a26317 100644
--- a/src/Psalm/Type/Atomic/TClassString.php
+++ b/src/Psalm/Type/Atomic/TClassString.php
@@ -4,7 +4,7 @@ namespace Psalm\Type\Atomic;
use Psalm\Codebase;
use Psalm\Internal\Analyzer\StatementsAnalyzer;
use Psalm\Internal\Type\TemplateResult;
-use Psalm\Internal\Type\UnionTemplateHandler;
+use Psalm\Internal\Type\TemplateStandinTypeReplacer;
use Psalm\Type\Atomic;
use function preg_quote;
use function preg_replace;
@@ -132,7 +132,7 @@ class TClassString extends TString
$input_object_type = new TObject();
}
- $as_type = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $as_type = TemplateStandinTypeReplacer::replace(
new \Psalm\Type\Union([$class_string->as_type]),
$template_result,
$codebase,
diff --git a/src/Psalm/Type/Atomic/TClassStringMap.php b/src/Psalm/Type/Atomic/TClassStringMap.php
index a753cf79e..de9c02b03 100644
--- a/src/Psalm/Type/Atomic/TClassStringMap.php
+++ b/src/Psalm/Type/Atomic/TClassStringMap.php
@@ -5,7 +5,7 @@ use function get_class;
use Psalm\Codebase;
use Psalm\Internal\Analyzer\StatementsAnalyzer;
use Psalm\Internal\Type\TemplateResult;
-use Psalm\Internal\Type\UnionTemplateHandler;
+use Psalm\Internal\Type\TemplateStandinTypeReplacer;
use Psalm\Internal\Type\TemplateInferredTypeReplacer;
use Psalm\Type;
use Psalm\Type\Atomic;
@@ -171,7 +171,7 @@ class TClassStringMap extends \Psalm\Type\Atomic
$input_type_param = clone $input_type->type_param;
}
- $value_param = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $value_param = TemplateStandinTypeReplacer::replace(
$type_param,
$template_result,
$codebase,
@@ -197,7 +197,7 @@ class TClassStringMap extends \Psalm\Type\Atomic
TemplateResult $template_result,
?Codebase $codebase
) : void {
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$this->value_param,
$template_result,
$codebase
diff --git a/src/Psalm/Type/Atomic/TConditional.php b/src/Psalm/Type/Atomic/TConditional.php
index 5deb3860b..e47801d00 100644
--- a/src/Psalm/Type/Atomic/TConditional.php
+++ b/src/Psalm/Type/Atomic/TConditional.php
@@ -134,7 +134,7 @@ class TConditional extends \Psalm\Type\Atomic
TemplateResult $template_result,
?Codebase $codebase
) : void {
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$this->conditional_type,
$template_result,
$codebase
diff --git a/src/Psalm/Type/Atomic/TKeyedArray.php b/src/Psalm/Type/Atomic/TKeyedArray.php
index 9ff467124..d1979eea2 100644
--- a/src/Psalm/Type/Atomic/TKeyedArray.php
+++ b/src/Psalm/Type/Atomic/TKeyedArray.php
@@ -12,7 +12,7 @@ use Psalm\Codebase;
use Psalm\Internal\Analyzer\StatementsAnalyzer;
use Psalm\Internal\Type\TypeCombiner;
use Psalm\Internal\Type\TemplateResult;
-use Psalm\Internal\Type\UnionTemplateHandler;
+use Psalm\Internal\Type\TemplateStandinTypeReplacer;
use Psalm\Internal\Type\TemplateInferredTypeReplacer;
use Psalm\Type;
use Psalm\Type\Atomic;
@@ -330,7 +330,7 @@ class TKeyedArray extends \Psalm\Type\Atomic
$input_type_param = $input_type->properties[$offset];
}
- $object_like->properties[$offset] = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $object_like->properties[$offset] = TemplateStandinTypeReplacer::replace(
$property,
$template_result,
$codebase,
@@ -353,7 +353,7 @@ class TKeyedArray extends \Psalm\Type\Atomic
?Codebase $codebase
) : void {
foreach ($this->properties as $property) {
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$property,
$template_result,
$codebase
diff --git a/src/Psalm/Type/Atomic/TList.php b/src/Psalm/Type/Atomic/TList.php
index 0cf4ef01d..5882cf95b 100644
--- a/src/Psalm/Type/Atomic/TList.php
+++ b/src/Psalm/Type/Atomic/TList.php
@@ -5,7 +5,7 @@ use function get_class;
use Psalm\Codebase;
use Psalm\Internal\Analyzer\StatementsAnalyzer;
use Psalm\Internal\Type\TemplateResult;
-use Psalm\Internal\Type\UnionTemplateHandler;
+use Psalm\Internal\Type\TemplateStandinTypeReplacer;
use Psalm\Internal\Type\TemplateInferredTypeReplacer;
use Psalm\Type;
use Psalm\Type\Atomic;
@@ -141,7 +141,7 @@ class TList extends \Psalm\Type\Atomic
$input_type_param = clone $input_type->type_param;
}
- $type_param = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $type_param = TemplateStandinTypeReplacer::replace(
$type_param,
$template_result,
$codebase,
@@ -167,7 +167,7 @@ class TList extends \Psalm\Type\Atomic
TemplateResult $template_result,
?Codebase $codebase
) : void {
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$this->type_param,
$template_result,
$codebase
diff --git a/src/Psalm/Type/Atomic/TObjectWithProperties.php b/src/Psalm/Type/Atomic/TObjectWithProperties.php
index 06df9158c..666908b7d 100644
--- a/src/Psalm/Type/Atomic/TObjectWithProperties.php
+++ b/src/Psalm/Type/Atomic/TObjectWithProperties.php
@@ -10,7 +10,7 @@ use Psalm\Type\Atomic;
use Psalm\Type\Union;
use Psalm\Internal\Analyzer\StatementsAnalyzer;
use Psalm\Internal\Type\TemplateResult;
-use Psalm\Internal\Type\UnionTemplateHandler;
+use Psalm\Internal\Type\TemplateStandinTypeReplacer;
use Psalm\Internal\Type\TemplateInferredTypeReplacer;
use function array_merge;
use function array_values;
@@ -236,7 +236,7 @@ class TObjectWithProperties extends TObject
$input_type_param = $input_type->properties[$offset];
}
- $object_like->properties[$offset] = UnionTemplateHandler::replaceTemplateTypesWithStandins(
+ $object_like->properties[$offset] = TemplateStandinTypeReplacer::replace(
$property,
$template_result,
$codebase,
@@ -259,7 +259,7 @@ class TObjectWithProperties extends TObject
?Codebase $codebase
) : void {
foreach ($this->properties as $property) {
- TemplateInferredTypeReplacer::replaceTemplateTypesWithArgTypes(
+ TemplateInferredTypeReplacer::replace(
$property,
$template_result,
$codebase