Skip to content

Commit 89718ec

Browse files
committed
Fix BcMath\Number increment/decrement
1 parent c87e6cf commit 89718ec

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

src/Rules/Operators/InvalidIncDecOperationRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function processNode(Node $node, Scope $scope): array
113113
$deprecatedString = true;
114114
}
115115

116-
$allowedTypes = [new FloatType(), new IntegerType(), $string, new ObjectType('SimpleXMLElement')];
116+
$allowedTypes = [new FloatType(), new IntegerType(), $string, new ObjectType('SimpleXMLElement'), new ObjectType('BcMath\Number')];
117117
$deprecatedNull = false;
118118
if (
119119
!$this->phpVersion->deprecatesDecOnNonNumericString()

tests/PHPStan/Rules/Operators/InvalidIncDecOperationRuleTest.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -237,24 +237,7 @@ public function testIncNonNumericString(): void
237237
#[RequiresPhp('>= 8.4')]
238238
public function testBcMathNumber(): void
239239
{
240-
$this->analyse([__DIR__ . '/data/inc-dec-bcmath-number.php'], [
241-
[
242-
'Cannot use ++ on BcMath\Number.',
243-
9,
244-
],
245-
[
246-
'Cannot use ++ on BcMath\Number.',
247-
10,
248-
],
249-
[
250-
'Cannot use -- on BcMath\Number.',
251-
11,
252-
],
253-
[
254-
'Cannot use -- on BcMath\Number.',
255-
12,
256-
],
257-
]);
240+
$this->analyse([__DIR__ . '/data/inc-dec-bcmath-number.php'], []);
258241
}
259242

260243
}

0 commit comments

Comments
 (0)