Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Analyser/NodeScopeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -6367,7 +6367,7 @@
if ($declaringClass->hasNativeProperty($propertyName)) {
$nativeProperty = $declaringClass->getNativeProperty($propertyName);
if (
!$nativeProperty->getNativeType()->accepts($assignedExprType, true)->yes()
!$nativeProperty->getNativeType()->toCoercedPropertyType()->isSuperTypeOf($assignedExprType)->yes()

Check warning on line 6370 in src/Analyser/NodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.3, ubuntu-latest)

Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ if ($declaringClass->hasNativeProperty($propertyName)) { $nativeProperty = $declaringClass->getNativeProperty($propertyName); if ( - !$nativeProperty->getNativeType()->toCoercedPropertyType()->isSuperTypeOf($assignedExprType)->yes() + $nativeProperty->getNativeType()->toCoercedPropertyType()->isSuperTypeOf($assignedExprType)->no() ) { $throwPoints[] = InternalThrowPoint::createExplicit($scope, new ObjectType(TypeError::class), $assignedExpr, false); }

Check warning on line 6370 in src/Analyser/NodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.3, ubuntu-latest)

Escaped Mutant for Mutator "PHPStan\Infection\IsSuperTypeOfCalleeAndArgumentMutator": @@ @@ if ($declaringClass->hasNativeProperty($propertyName)) { $nativeProperty = $declaringClass->getNativeProperty($propertyName); if ( - !$nativeProperty->getNativeType()->toCoercedPropertyType()->isSuperTypeOf($assignedExprType)->yes() + !$assignedExprType->isSuperTypeOf($nativeProperty->getNativeType()->toCoercedPropertyType())->yes() ) { $throwPoints[] = InternalThrowPoint::createExplicit($scope, new ObjectType(TypeError::class), $assignedExpr, false); }

Check warning on line 6370 in src/Analyser/NodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.4, ubuntu-latest)

Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ if ($declaringClass->hasNativeProperty($propertyName)) { $nativeProperty = $declaringClass->getNativeProperty($propertyName); if ( - !$nativeProperty->getNativeType()->toCoercedPropertyType()->isSuperTypeOf($assignedExprType)->yes() + $nativeProperty->getNativeType()->toCoercedPropertyType()->isSuperTypeOf($assignedExprType)->no() ) { $throwPoints[] = InternalThrowPoint::createExplicit($scope, new ObjectType(TypeError::class), $assignedExpr, false); }

Check warning on line 6370 in src/Analyser/NodeScopeResolver.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.4, ubuntu-latest)

Escaped Mutant for Mutator "PHPStan\Infection\IsSuperTypeOfCalleeAndArgumentMutator": @@ @@ if ($declaringClass->hasNativeProperty($propertyName)) { $nativeProperty = $declaringClass->getNativeProperty($propertyName); if ( - !$nativeProperty->getNativeType()->toCoercedPropertyType()->isSuperTypeOf($assignedExprType)->yes() + !$assignedExprType->isSuperTypeOf($nativeProperty->getNativeType()->toCoercedPropertyType())->yes() ) { $throwPoints[] = InternalThrowPoint::createExplicit($scope, new ObjectType(TypeError::class), $assignedExpr, false); }
) {
$throwPoints[] = InternalThrowPoint::createExplicit($scope, new ObjectType(TypeError::class), $assignedExpr, false);
}
Expand Down
5 changes: 5 additions & 0 deletions src/Type/Accessory/AccessoryArrayListType.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function traverse(callable $cb): Type
{
return $this;
Expand Down
5 changes: 5 additions & 0 deletions src/Type/Accessory/AccessoryLiteralStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function isNull(): TrinaryLogic
{
return TrinaryLogic::createNo();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/Accessory/AccessoryLowercaseStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function isNull(): TrinaryLogic
{
return TrinaryLogic::createNo();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/Accessory/AccessoryNonEmptyStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function isNull(): TrinaryLogic
{
return TrinaryLogic::createNo();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/Accessory/AccessoryNonFalsyStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function isNull(): TrinaryLogic
{
return TrinaryLogic::createNo();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/Accessory/AccessoryNumericStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function isNull(): TrinaryLogic
{
return TrinaryLogic::createNo();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/Accessory/AccessoryUppercaseStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function isNull(): TrinaryLogic
{
return TrinaryLogic::createNo();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/Accessory/HasOffsetType.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function getEnumCases(): array
{
return [];
Expand Down
5 changes: 5 additions & 0 deletions src/Type/Accessory/HasOffsetValueType.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function getEnumCases(): array
{
return [];
Expand Down
5 changes: 5 additions & 0 deletions src/Type/Accessory/NonEmptyArrayType.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function traverse(callable $cb): Type
{
return $this;
Expand Down
5 changes: 5 additions & 0 deletions src/Type/Accessory/OversizedArrayType.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function traverse(callable $cb): Type
{
return $this;
Expand Down
5 changes: 5 additions & 0 deletions src/Type/BooleanType.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function isOffsetAccessLegal(): TrinaryLogic
{
return TrinaryLogic::createYes();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/CallableType.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
);
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function getTemplateTypeMap(): TemplateTypeMap
{
return $this->templateTypeMap;
Expand Down
5 changes: 5 additions & 0 deletions src/Type/ClosureType.php
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return TypeCombinator::union($this, new CallableType());
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function getTemplateTypeMap(): TemplateTypeMap
{
return $this->templateTypeMap;
Expand Down
5 changes: 5 additions & 0 deletions src/Type/Constant/ConstantBooleanType.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function isTrue(): TrinaryLogic
{
return TrinaryLogic::createFromBoolean($this->value === true);
Expand Down
5 changes: 5 additions & 0 deletions src/Type/Constant/ConstantIntegerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return TypeCombinator::union($this, $this->toFloat());
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function generalize(GeneralizePrecision $precision): Type
{
return new IntegerType();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/FloatType.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return TypeCombinator::union($this, new IntegerType());
}

public function isOffsetAccessLegal(): TrinaryLogic
{
return TrinaryLogic::createYes();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/Generic/TemplateTypeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function inferTemplateTypes(Type $receivedType): TemplateTypeMap
{
if (
Expand Down
5 changes: 5 additions & 0 deletions src/Type/IntegerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return TypeCombinator::union($this, $this->toFloat());
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function isOffsetAccessLegal(): TrinaryLogic
{
return TrinaryLogic::createYes();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/IntersectionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this->intersectTypes(static fn (Type $type): Type => $type->toCoercedArgumentType($strictTypes));
}

public function toCoercedPropertyType(): Type
{
return $this->intersectTypes(static fn (Type $type): Type => $type->toCoercedPropertyType());
}

public function inferTemplateTypes(Type $receivedType): TemplateTypeMap
{
$types = TemplateTypeMap::createEmpty();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/IterableType.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
);
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function isIterable(): TrinaryLogic
{
return TrinaryLogic::createYes();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/MixedType.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function isIterable(): TrinaryLogic
{
if ($this->subtractedType !== null) {
Expand Down
5 changes: 5 additions & 0 deletions src/Type/NeverType.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function traverse(callable $cb): Type
{
return $this;
Expand Down
5 changes: 5 additions & 0 deletions src/Type/NonexistentParentClassType.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return new ErrorType();
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function isOffsetAccessLegal(): TrinaryLogic
{
return TrinaryLogic::createNo();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/NullType.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function isOffsetAccessible(): TrinaryLogic
{
return TrinaryLogic::createYes();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/ObjectType.php
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function toBoolean(): BooleanType
{
if (
Expand Down
5 changes: 5 additions & 0 deletions src/Type/ResourceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function isOffsetAccessLegal(): TrinaryLogic
{
return TrinaryLogic::createYes();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/StaticType.php
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this->getStaticObjectType()->toCoercedArgumentType($strictTypes);
}

public function toCoercedPropertyType(): Type
{
return $this->getStaticObjectType()->toCoercedPropertyType();
}

public function toBoolean(): BooleanType
{
return $this->getStaticObjectType()->toBoolean();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/StrictMixedType.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function inferTemplateTypes(Type $receivedType): TemplateTypeMap
{
return TemplateTypeMap::createEmpty();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/StringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function isNull(): TrinaryLogic
{
return TrinaryLogic::createNo();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/Traits/ArrayTypeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this;
}

public function toCoercedPropertyType(): Type
{
return $this;
}

public function isOffsetAccessible(): TrinaryLogic
{
return TrinaryLogic::createYes();
Expand Down
5 changes: 5 additions & 0 deletions src/Type/Traits/LateResolvableTypeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,11 @@ public function toCoercedArgumentType(bool $strictTypes): Type
return $this->resolve()->toCoercedArgumentType($strictTypes);
}

public function toCoercedPropertyType(): Type
{
return $this->resolve()->toCoercedPropertyType();
}

public function isSmallerThan(Type $otherType, PhpVersion $phpVersion): TrinaryLogic
{
return $this->resolve()->isSmallerThan($otherType, $phpVersion);
Expand Down
Loading
Loading