Skip to content
Merged
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
6 changes: 4 additions & 2 deletions src/Type/Accessory/AccessoryArrayListType.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
return $otherType->isSuperTypeOf($this);
}

return (new IsSuperTypeOfResult($otherType->isArray()->and($otherType->isList()), []))
->and($otherType instanceof self ? IsSuperTypeOfResult::createYes() : IsSuperTypeOfResult::createMaybe());
return new IsSuperTypeOfResult(
$otherType->isArray()->and($otherType->isList())->and($otherType instanceof self ? TrinaryLogic::createYes() : TrinaryLogic::createMaybe()),
[],
);
}

public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
Expand Down
6 changes: 4 additions & 2 deletions src/Type/Accessory/AccessoryLiteralStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
return $otherType->isSuperTypeOf($this);
}

return (new IsSuperTypeOfResult($otherType->isLiteralString(), []))
->and($otherType instanceof self ? IsSuperTypeOfResult::createYes() : IsSuperTypeOfResult::createMaybe());
return new IsSuperTypeOfResult(
$otherType->isLiteralString()->and($otherType instanceof self ? TrinaryLogic::createYes() : TrinaryLogic::createMaybe()),
[],
);
}

public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
Expand Down
6 changes: 4 additions & 2 deletions src/Type/Accessory/AccessoryLowercaseStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
return $otherType->isSuperTypeOf($this);
}

return (new IsSuperTypeOfResult($otherType->isLowercaseString(), []))
->and($otherType instanceof self ? IsSuperTypeOfResult::createYes() : IsSuperTypeOfResult::createMaybe());
return new IsSuperTypeOfResult(
$otherType->isLowercaseString()->and($otherType instanceof self ? TrinaryLogic::createYes() : TrinaryLogic::createMaybe()),
[],
);
}

public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
Expand Down
6 changes: 4 additions & 2 deletions src/Type/Accessory/AccessoryNonEmptyStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
return $otherType->isSuperTypeOf($this);
}

return (new IsSuperTypeOfResult($otherType->isNonEmptyString(), []))
->and($otherType instanceof self ? IsSuperTypeOfResult::createYes() : IsSuperTypeOfResult::createMaybe());
return new IsSuperTypeOfResult(
$otherType->isNonEmptyString()->and($otherType instanceof self ? TrinaryLogic::createYes() : TrinaryLogic::createMaybe()),
[],
);
}

public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
Expand Down
6 changes: 4 additions & 2 deletions src/Type/Accessory/AccessoryNonFalsyStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
return IsSuperTypeOfResult::createYes();
}

return (new IsSuperTypeOfResult($otherType->isNonFalsyString(), []))
->and($otherType instanceof self ? IsSuperTypeOfResult::createYes() : IsSuperTypeOfResult::createMaybe());
return new IsSuperTypeOfResult(
$otherType->isNonFalsyString()->and($otherType instanceof self ? TrinaryLogic::createYes() : TrinaryLogic::createMaybe()),
[],
);
}

public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
Expand Down
6 changes: 4 additions & 2 deletions src/Type/Accessory/AccessoryNumericStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
return $otherType->isSuperTypeOf($this);
}

return (new IsSuperTypeOfResult($otherType->isNumericString(), []))
->and($otherType instanceof self ? IsSuperTypeOfResult::createYes() : IsSuperTypeOfResult::createMaybe());
return new IsSuperTypeOfResult(
$otherType->isNumericString()->and($otherType instanceof self ? TrinaryLogic::createYes() : TrinaryLogic::createMaybe()),
[],
);
}

public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
Expand Down
6 changes: 4 additions & 2 deletions src/Type/Accessory/AccessoryUppercaseStringType.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
return $otherType->isSuperTypeOf($this);
}

return (new IsSuperTypeOfResult($otherType->isUppercaseString(), []))
->and($otherType instanceof self ? IsSuperTypeOfResult::createYes() : IsSuperTypeOfResult::createMaybe());
return new IsSuperTypeOfResult(
$otherType->isUppercaseString()->and($otherType instanceof self ? TrinaryLogic::createYes() : TrinaryLogic::createMaybe()),
[],
);
}

public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
Expand Down
6 changes: 3 additions & 3 deletions src/Type/Accessory/HasMethodType.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
}

if ($otherType instanceof self) {
$limit = IsSuperTypeOfResult::createYes();
$limit = TrinaryLogic::createYes();
} else {
$limit = IsSuperTypeOfResult::createMaybe();
$limit = TrinaryLogic::createMaybe();
}

return $limit->and(new IsSuperTypeOfResult($otherType->hasMethod($this->methodName), []));
return new IsSuperTypeOfResult($limit->and($otherType->hasMethod($this->methodName)), []);
}

public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
Expand Down
8 changes: 4 additions & 4 deletions src/Type/Accessory/HasOffsetType.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
return $otherType->isSuperTypeOf($this);
}

$result = new IsSuperTypeOfResult($otherType->isOffsetAccessible()->and($otherType->hasOffsetValueType($this->offsetType)), []);

return $result
->and($otherType instanceof self ? IsSuperTypeOfResult::createYes() : IsSuperTypeOfResult::createMaybe());
return new IsSuperTypeOfResult(
$otherType->isOffsetAccessible()->and($otherType->hasOffsetValueType($this->offsetType))->and($otherType instanceof self ? TrinaryLogic::createYes() : TrinaryLogic::createMaybe()),
[],
);
}

public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
Expand Down
10 changes: 7 additions & 3 deletions src/Type/Accessory/HasOffsetValueType.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,15 @@
return $otherType->isSuperTypeOf($this);
}

$result = new IsSuperTypeOfResult($otherType->isOffsetAccessible()->and($otherType->hasOffsetValueType($this->offsetType)), []);
$result = new IsSuperTypeOfResult(
$otherType->isOffsetAccessible()
->and($otherType->hasOffsetValueType($this->offsetType))
->and($otherType instanceof self ? TrinaryLogic::createYes() : TrinaryLogic::createMaybe()),
[],
);

return $result
->and($otherType->getOffsetValueType($this->offsetType)->isSuperTypeOf($this->valueType))
->and($otherType instanceof self ? IsSuperTypeOfResult::createYes() : IsSuperTypeOfResult::createMaybe());
->and($otherType->getOffsetValueType($this->offsetType)->isSuperTypeOf($this->valueType));

Check warning on line 127 in src/Type/Accessory/HasOffsetValueType.php

View workflow job for this annotation

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

Escaped Mutant for Mutator "PHPStan\Infection\IsSuperTypeOfCalleeAndArgumentMutator": @@ @@ ); return $result - ->and($otherType->getOffsetValueType($this->offsetType)->isSuperTypeOf($this->valueType)); + ->and($this->valueType->isSuperTypeOf($otherType->getOffsetValueType($this->offsetType))); } public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult

Check warning on line 127 in src/Type/Accessory/HasOffsetValueType.php

View workflow job for this annotation

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

Escaped Mutant for Mutator "PHPStan\Infection\IsSuperTypeOfCalleeAndArgumentMutator": @@ @@ ); return $result - ->and($otherType->getOffsetValueType($this->offsetType)->isSuperTypeOf($this->valueType)); + ->and($this->valueType->isSuperTypeOf($otherType->getOffsetValueType($this->offsetType))); } public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
}

public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
Expand Down
10 changes: 5 additions & 5 deletions src/Type/Accessory/HasPropertyType.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
}

if ($otherType instanceof self) {
$limit = IsSuperTypeOfResult::createYes();
$limit = TrinaryLogic::createYes();
} else {
$limit = IsSuperTypeOfResult::createMaybe();
$limit = TrinaryLogic::createMaybe();
}

return $limit->and(new IsSuperTypeOfResult(
$otherType->hasInstanceProperty($this->propertyName)->or($otherType->hasStaticProperty($this->propertyName)),
return new IsSuperTypeOfResult(
$limit->and($otherType->hasInstanceProperty($this->propertyName)->or($otherType->hasStaticProperty($this->propertyName))),
[],
));
);
}

public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
Expand Down
6 changes: 4 additions & 2 deletions src/Type/Accessory/NonEmptyArrayType.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
return $otherType->isSuperTypeOf($this);
}

return (new IsSuperTypeOfResult($otherType->isArray()->and($otherType->isIterableAtLeastOnce()), []))
->and($otherType instanceof self ? IsSuperTypeOfResult::createYes() : IsSuperTypeOfResult::createMaybe());
return new IsSuperTypeOfResult(
$otherType->isArray()->and($otherType->isIterableAtLeastOnce())->and($otherType instanceof self ? TrinaryLogic::createYes() : TrinaryLogic::createMaybe()),
[],
);
}

public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
Expand Down
6 changes: 4 additions & 2 deletions src/Type/Accessory/OversizedArrayType.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
return $otherType->isSuperTypeOf($this);
}

return (new IsSuperTypeOfResult($otherType->isArray()->and($otherType->isOversizedArray()), []))
->and($otherType instanceof self ? IsSuperTypeOfResult::createYes() : IsSuperTypeOfResult::createMaybe());
return new IsSuperTypeOfResult(
$otherType->isArray()->and($otherType->isOversizedArray())->and($otherType instanceof self ? TrinaryLogic::createYes() : TrinaryLogic::createMaybe()),
[],
);
}

public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
Expand Down
6 changes: 4 additions & 2 deletions src/Type/CallableType.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,10 @@ public function isSubTypeOf(Type $otherType): IsSuperTypeOfResult
return $otherType->isSuperTypeOf($this);
}

return (new IsSuperTypeOfResult($otherType->isCallable(), []))
->and($otherType instanceof self ? IsSuperTypeOfResult::createYes() : IsSuperTypeOfResult::createMaybe());
return new IsSuperTypeOfResult(
$otherType->isCallable()->and($otherType instanceof self ? TrinaryLogic::createYes() : TrinaryLogic::createMaybe()),
[],
);
}

public function isAcceptedBy(Type $acceptingType, bool $strictTypes): AcceptsResult
Expand Down
Loading