Skip to content

Commit 4618169

Browse files
committed
Ignore PHPStan errors about possibly impure method calls
1 parent ff16728 commit 4618169

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

src/Math/BrickMathCalculator.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ public function add(NumberInterface $augend, NumberInterface ...$addends): Numbe
4949
$sum = BigInteger::of($augend->toString());
5050

5151
foreach ($addends as $addend) {
52+
/** @phpstan-ignore possiblyImpure.methodCall */
5253
$sum = $sum->plus($addend->toString());
5354
}
5455

55-
/** @phpstan-ignore possiblyImpure.new */
56+
/** @phpstan-ignore possiblyImpure.new, possiblyImpure.methodCall */
5657
return new IntegerObject((string) $sum);
5758
}
5859

@@ -61,10 +62,11 @@ public function subtract(NumberInterface $minuend, NumberInterface ...$subtrahen
6162
$difference = BigInteger::of($minuend->toString());
6263

6364
foreach ($subtrahends as $subtrahend) {
65+
/** @phpstan-ignore possiblyImpure.methodCall */
6466
$difference = $difference->minus($subtrahend->toString());
6567
}
6668

67-
/** @phpstan-ignore possiblyImpure.new */
69+
/** @phpstan-ignore possiblyImpure.new, possiblyImpure.methodCall */
6870
return new IntegerObject((string) $difference);
6971
}
7072

@@ -73,10 +75,11 @@ public function multiply(NumberInterface $multiplicand, NumberInterface ...$mult
7375
$product = BigInteger::of($multiplicand->toString());
7476

7577
foreach ($multipliers as $multiplier) {
78+
/** @phpstan-ignore possiblyImpure.methodCall */
7679
$product = $product->multipliedBy($multiplier->toString());
7780
}
7881

79-
/** @phpstan-ignore possiblyImpure.new */
82+
/** @phpstan-ignore possiblyImpure.new, possiblyImpure.methodCall */
8083
return new IntegerObject((string) $product);
8184
}
8285

@@ -92,22 +95,23 @@ public function divide(
9295
$quotient = BigDecimal::of($dividend->toString());
9396

9497
foreach ($divisors as $divisor) {
98+
/** @phpstan-ignore possiblyImpure.methodCall */
9599
$quotient = $quotient->dividedBy($divisor->toString(), $scale, $brickRounding);
96100
}
97101

98102
if ($scale === 0) {
99-
/** @phpstan-ignore possiblyImpure.new */
103+
/** @phpstan-ignore possiblyImpure.new, possiblyImpure.methodCall, possiblyImpure.methodCall */
100104
return new IntegerObject((string) $quotient->toBigInteger());
101105
}
102106

103-
/** @phpstan-ignore possiblyImpure.new */
107+
/** @phpstan-ignore possiblyImpure.new, possiblyImpure.methodCall */
104108
return new Decimal((string) $quotient);
105109
}
106110

107111
public function fromBase(string $value, int $base): IntegerObject
108112
{
109113
try {
110-
/** @phpstan-ignore possiblyImpure.new */
114+
/** @phpstan-ignore possiblyImpure.new, possiblyImpure.methodCall */
111115
return new IntegerObject((string) BigInteger::fromBase($value, $base));
112116
} catch (MathException | \InvalidArgumentException $exception) {
113117
throw new InvalidArgumentException(
@@ -121,6 +125,7 @@ public function fromBase(string $value, int $base): IntegerObject
121125
public function toBase(IntegerObject $value, int $base): string
122126
{
123127
try {
128+
/** @phpstan-ignore possiblyImpure.methodCall */
124129
return BigInteger::of($value->toString())->toBase($base);
125130
} catch (MathException | \InvalidArgumentException $exception) {
126131
throw new InvalidArgumentException(

0 commit comments

Comments
 (0)