mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
4.x - rename GetClassT to TDependentGetClass
This commit is contained in:
parent
211553c53f
commit
74934ffdbb
@ -122,7 +122,7 @@ class SwitchCaseAnalyzer
|
||||
$type_statements = [];
|
||||
|
||||
foreach ($switch_var_type->getAtomicTypes() as $type) {
|
||||
if ($type instanceof Type\Atomic\GetClassT) {
|
||||
if ($type instanceof Type\Atomic\TDependentGetClass) {
|
||||
$type_statements[] = new PhpParser\Node\Expr\FuncCall(
|
||||
new PhpParser\Node\Name(['get_class']),
|
||||
[
|
||||
@ -131,7 +131,7 @@ class SwitchCaseAnalyzer
|
||||
),
|
||||
]
|
||||
);
|
||||
} elseif ($type instanceof Type\Atomic\GetTypeT) {
|
||||
} elseif ($type instanceof Type\Atomic\TDependentGetType) {
|
||||
$type_statements[] = new PhpParser\Node\Expr\FuncCall(
|
||||
new PhpParser\Node\Name(['gettype']),
|
||||
[
|
||||
|
@ -1338,13 +1338,13 @@ class FunctionCallAnalyzer extends CallAnalyzer
|
||||
|
||||
if (isset($context->vars_in_scope[$var_id])) {
|
||||
$atomic_type = $function_name->parts === ['get_class']
|
||||
? new Type\Atomic\GetClassT(
|
||||
? new Type\Atomic\TDependentGetClass(
|
||||
$var_id,
|
||||
$context->vars_in_scope[$var_id]->hasMixed()
|
||||
? Type::getObject()
|
||||
: $context->vars_in_scope[$var_id]
|
||||
)
|
||||
: new Type\Atomic\GetTypeT($var_id);
|
||||
: new Type\Atomic\TDependentGetType($var_id);
|
||||
|
||||
$statements_analyzer->node_data->setType($real_stmt, new Type\Union([$atomic_type]));
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ class NewAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\CallAna
|
||||
|
||||
if ($lhs_type_part instanceof Type\Atomic\TLiteralClassString
|
||||
|| $lhs_type_part instanceof Type\Atomic\TClassString
|
||||
|| $lhs_type_part instanceof Type\Atomic\GetClassT
|
||||
|| $lhs_type_part instanceof Type\Atomic\TDependentGetClass
|
||||
) {
|
||||
if (!$statements_analyzer->node_data->getType($stmt)) {
|
||||
if ($lhs_type_part instanceof Type\Atomic\TClassString) {
|
||||
@ -238,7 +238,7 @@ class NewAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\CallAna
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($lhs_type_part instanceof Type\Atomic\GetClassT) {
|
||||
} elseif ($lhs_type_part instanceof Type\Atomic\TDependentGetClass) {
|
||||
$generated_type = new Type\Atomic\TObject();
|
||||
|
||||
if ($lhs_type_part->as_type->hasObjectType()
|
||||
|
@ -261,7 +261,7 @@ class StaticCallAnalyzer extends CallAnalyzer
|
||||
}
|
||||
|
||||
$intersection_types = $lhs_type_part->as_type->extra_types;
|
||||
} elseif ($lhs_type_part instanceof Type\Atomic\GetClassT
|
||||
} elseif ($lhs_type_part instanceof Type\Atomic\TDependentGetClass
|
||||
&& !$lhs_type_part->as_type->hasObject()
|
||||
) {
|
||||
$fq_class_name = 'object';
|
||||
|
@ -15,8 +15,8 @@ use Psalm\Type\Atomic\TFalse;
|
||||
use Psalm\Type\Atomic\TFloat;
|
||||
use Psalm\Type\Atomic\TTemplateParam;
|
||||
use Psalm\Type\Atomic\TTemplateParamClass;
|
||||
use Psalm\Type\Atomic\GetClassT;
|
||||
use Psalm\Type\Atomic\GetTypeT;
|
||||
use Psalm\Type\Atomic\TDependentGetClass;
|
||||
use Psalm\Type\Atomic\TDependentGetType;
|
||||
use Psalm\Type\Atomic\THtmlEscapedString;
|
||||
use Psalm\Type\Atomic\TInt;
|
||||
use Psalm\Type\Atomic\TLiteralClassString;
|
||||
@ -114,7 +114,7 @@ class ScalarTypeComparator
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($container_type_part instanceof GetClassT) {
|
||||
if ($container_type_part instanceof TDependentGetClass) {
|
||||
$first_type = array_values($container_type_part->as_type->getAtomicTypes())[0];
|
||||
|
||||
$container_type_part = new TClassString(
|
||||
@ -123,7 +123,7 @@ class ScalarTypeComparator
|
||||
);
|
||||
}
|
||||
|
||||
if ($input_type_part instanceof GetClassT) {
|
||||
if ($input_type_part instanceof TDependentGetClass) {
|
||||
$first_type = array_values($input_type_part->as_type->getAtomicTypes())[0];
|
||||
|
||||
if ($first_type instanceof TTemplateParam) {
|
||||
@ -143,7 +143,7 @@ class ScalarTypeComparator
|
||||
}
|
||||
}
|
||||
|
||||
if ($input_type_part instanceof GetTypeT) {
|
||||
if ($input_type_part instanceof TDependentGetType) {
|
||||
$input_type_part = new TString();
|
||||
|
||||
if ($container_type_part instanceof TLiteralString) {
|
||||
@ -151,7 +151,7 @@ class ScalarTypeComparator
|
||||
}
|
||||
}
|
||||
|
||||
if ($container_type_part instanceof GetTypeT) {
|
||||
if ($container_type_part instanceof TDependentGetType) {
|
||||
$container_type_part = new TString();
|
||||
|
||||
if ($input_type_part instanceof TLiteralString) {
|
||||
|
@ -654,7 +654,7 @@ class SimpleNegatedAssertionReconciler extends Reconciler
|
||||
if (isset($existing_var_atomic_types['string'])) {
|
||||
if (!$existing_var_atomic_types['string'] instanceof Type\Atomic\TNonEmptyString
|
||||
&& !$existing_var_atomic_types['string'] instanceof Type\Atomic\TClassString
|
||||
&& !$existing_var_atomic_types['string'] instanceof Type\Atomic\GetClassT
|
||||
&& !$existing_var_atomic_types['string'] instanceof Type\Atomic\TDependentGetClass
|
||||
) {
|
||||
$did_remove_type = true;
|
||||
|
||||
|
@ -829,7 +829,7 @@ class UnionTemplateHandler
|
||||
} else {
|
||||
$valid_input_atomic_types[] = new Atomic\TObject();
|
||||
}
|
||||
} elseif ($input_atomic_type instanceof Atomic\GetClassT) {
|
||||
} elseif ($input_atomic_type instanceof Atomic\TDependentGetClass) {
|
||||
$valid_input_atomic_types[] = new Atomic\TObject();
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ use Psalm\Type\Union;
|
||||
/**
|
||||
* Represents a string whose value is a fully-qualified class found by get_class($var)
|
||||
*/
|
||||
class GetClassT extends TString
|
||||
class TDependentGetClass extends TString
|
||||
{
|
||||
/**
|
||||
* Used to hold information as to what this refers to
|
@ -4,7 +4,7 @@ namespace Psalm\Type\Atomic;
|
||||
/**
|
||||
* Represents a string whose value is that of a type found by gettype($var)
|
||||
*/
|
||||
class GetTypeT extends TString
|
||||
class TDependentGetType extends TString
|
||||
{
|
||||
/**
|
||||
* Used to hold information as to what this refers to
|
Loading…
x
Reference in New Issue
Block a user