1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

4.x - rename GetClassT to TDependentGetClass

This commit is contained in:
Matt Brown 2020-10-02 18:47:23 -04:00
parent 211553c53f
commit 74934ffdbb
9 changed files with 17 additions and 17 deletions

View File

@ -122,7 +122,7 @@ class SwitchCaseAnalyzer
$type_statements = []; $type_statements = [];
foreach ($switch_var_type->getAtomicTypes() as $type) { 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( $type_statements[] = new PhpParser\Node\Expr\FuncCall(
new PhpParser\Node\Name(['get_class']), 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( $type_statements[] = new PhpParser\Node\Expr\FuncCall(
new PhpParser\Node\Name(['gettype']), new PhpParser\Node\Name(['gettype']),
[ [

View File

@ -1338,13 +1338,13 @@ class FunctionCallAnalyzer extends CallAnalyzer
if (isset($context->vars_in_scope[$var_id])) { if (isset($context->vars_in_scope[$var_id])) {
$atomic_type = $function_name->parts === ['get_class'] $atomic_type = $function_name->parts === ['get_class']
? new Type\Atomic\GetClassT( ? new Type\Atomic\TDependentGetClass(
$var_id, $var_id,
$context->vars_in_scope[$var_id]->hasMixed() $context->vars_in_scope[$var_id]->hasMixed()
? Type::getObject() ? Type::getObject()
: $context->vars_in_scope[$var_id] : $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])); $statements_analyzer->node_data->setType($real_stmt, new Type\Union([$atomic_type]));
} }

View File

@ -209,7 +209,7 @@ class NewAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\CallAna
if ($lhs_type_part instanceof Type\Atomic\TLiteralClassString if ($lhs_type_part instanceof Type\Atomic\TLiteralClassString
|| $lhs_type_part instanceof Type\Atomic\TClassString || $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 (!$statements_analyzer->node_data->getType($stmt)) {
if ($lhs_type_part instanceof Type\Atomic\TClassString) { 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(); $generated_type = new Type\Atomic\TObject();
if ($lhs_type_part->as_type->hasObjectType() if ($lhs_type_part->as_type->hasObjectType()

View File

@ -261,7 +261,7 @@ class StaticCallAnalyzer extends CallAnalyzer
} }
$intersection_types = $lhs_type_part->as_type->extra_types; $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() && !$lhs_type_part->as_type->hasObject()
) { ) {
$fq_class_name = 'object'; $fq_class_name = 'object';

View File

@ -15,8 +15,8 @@ use Psalm\Type\Atomic\TFalse;
use Psalm\Type\Atomic\TFloat; use Psalm\Type\Atomic\TFloat;
use Psalm\Type\Atomic\TTemplateParam; use Psalm\Type\Atomic\TTemplateParam;
use Psalm\Type\Atomic\TTemplateParamClass; use Psalm\Type\Atomic\TTemplateParamClass;
use Psalm\Type\Atomic\GetClassT; use Psalm\Type\Atomic\TDependentGetClass;
use Psalm\Type\Atomic\GetTypeT; use Psalm\Type\Atomic\TDependentGetType;
use Psalm\Type\Atomic\THtmlEscapedString; use Psalm\Type\Atomic\THtmlEscapedString;
use Psalm\Type\Atomic\TInt; use Psalm\Type\Atomic\TInt;
use Psalm\Type\Atomic\TLiteralClassString; use Psalm\Type\Atomic\TLiteralClassString;
@ -114,7 +114,7 @@ class ScalarTypeComparator
return false; 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]; $first_type = array_values($container_type_part->as_type->getAtomicTypes())[0];
$container_type_part = new TClassString( $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]; $first_type = array_values($input_type_part->as_type->getAtomicTypes())[0];
if ($first_type instanceof TTemplateParam) { 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(); $input_type_part = new TString();
if ($container_type_part instanceof TLiteralString) { 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(); $container_type_part = new TString();
if ($input_type_part instanceof TLiteralString) { if ($input_type_part instanceof TLiteralString) {

View File

@ -654,7 +654,7 @@ class SimpleNegatedAssertionReconciler extends Reconciler
if (isset($existing_var_atomic_types['string'])) { if (isset($existing_var_atomic_types['string'])) {
if (!$existing_var_atomic_types['string'] instanceof Type\Atomic\TNonEmptyString 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\TClassString
&& !$existing_var_atomic_types['string'] instanceof Type\Atomic\GetClassT && !$existing_var_atomic_types['string'] instanceof Type\Atomic\TDependentGetClass
) { ) {
$did_remove_type = true; $did_remove_type = true;

View File

@ -829,7 +829,7 @@ class UnionTemplateHandler
} else { } else {
$valid_input_atomic_types[] = new Atomic\TObject(); $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(); $valid_input_atomic_types[] = new Atomic\TObject();
} }
} }

View File

@ -6,7 +6,7 @@ use Psalm\Type\Union;
/** /**
* Represents a string whose value is a fully-qualified class found by get_class($var) * 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 * Used to hold information as to what this refers to

View File

@ -4,7 +4,7 @@ namespace Psalm\Type\Atomic;
/** /**
* Represents a string whose value is that of a type found by gettype($var) * 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 * Used to hold information as to what this refers to