Skip to content

Commit 8328b06

Browse files
committed
Merge branch 2.1.x into 2.2.x
2 parents 0c15ab7 + 9009697 commit 8328b06

3 files changed

Lines changed: 27 additions & 1 deletion

File tree

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('GMP')];
117117
$deprecatedNull = false;
118118
if (
119119
!$this->phpVersion->deprecatesDecOnNonNumericString()

tests/PHPStan/Rules/Operators/InvalidIncDecOperationRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,4 +249,9 @@ public function testBcMathNumber(): void
249249
$this->analyse([__DIR__ . '/data/inc-dec-bcmath-number.php'], []);
250250
}
251251

252+
public function testGmp(): void
253+
{
254+
$this->analyse([__DIR__ . '/data/inc-dec-gmp.php'], []);
255+
}
256+
252257
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace IncDecGmp;
4+
5+
use GMP;
6+
7+
function testPreInc(GMP $x): void {
8+
++$x;
9+
}
10+
11+
function testPostInc(GMP $x): void {
12+
$x++;
13+
}
14+
15+
function testPreDec(GMP $x): void {
16+
--$x;
17+
}
18+
19+
function testPostDec(GMP $x): void {
20+
$x--;
21+
}

0 commit comments

Comments
 (0)