Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmajor committed Oct 31, 2023
1 parent b68a40d commit a293912
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 0 additions & 4 deletions src/Type/Constant/ConstantStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
use PHPStan\Type\MixedType;
use PHPStan\Type\NullType;
use PHPStan\Type\ObjectType;
use PHPStan\Type\ObjectWithoutClassType;
use PHPStan\Type\StaticType;
use PHPStan\Type\StringType;
use PHPStan\Type\Traits\ConstantScalarTypeTrait;
Expand Down Expand Up @@ -152,9 +151,6 @@ public function isSuperTypeOf(Type $type): TrinaryLogic
}

$genericType = $type->getGenericType();
if ($genericType instanceof MixedType) {
return TrinaryLogic::createMaybe();
}
if ($genericType instanceof StaticType) {
$genericType = $genericType->getStaticObjectType();
}
Expand Down
7 changes: 3 additions & 4 deletions src/Type/Generic/GenericClassStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use PHPStan\Type\CompoundType;
use PHPStan\Type\Constant\ConstantStringType;
use PHPStan\Type\IntersectionType;
use PHPStan\Type\MixedType;
use PHPStan\Type\NeverType;
use PHPStan\Type\ObjectType;
use PHPStan\Type\ObjectWithoutClassType;
Expand Down Expand Up @@ -92,11 +91,11 @@ public function isSuperTypeOf(Type $type): TrinaryLogic
}

if ($type instanceof ConstantStringType) {
$genericType = $this->type;
if ($genericType instanceof MixedType) {
return $type->isClassStringType();
if ($type->isClassStringType()->no()) {
return TrinaryLogic::createNo();
}

$genericType = $this->type;
if ($genericType instanceof StaticType) {
$genericType = $genericType->getStaticObjectType();
}
Expand Down

0 comments on commit a293912

Please sign in to comment.