Skip to content

Commit 30e8e8b

Browse files
staabmondrejmirtes
authored andcommitted
Added regression test
1 parent 5677025 commit 30e8e8b

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tests/PHPStan/Rules/Operators/InvalidBinaryOperationRuleTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,4 +798,16 @@ public function testBenevolentUnion(): void
798798
]);
799799
}
800800

801+
public function testBug7863(): void
802+
{
803+
$this->checkImplicitMixed = true;
804+
805+
$this->analyse([__DIR__ . '/data/bug-7863.php'], [
806+
[
807+
'Binary operation "+" between mixed and array results in an error.',
808+
10,
809+
],
810+
]);
811+
}
812+
801813
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Bug7863;
4+
5+
function ($mixed, array $arr) {
6+
if (is_array($mixed)) {
7+
return;
8+
}
9+
// mixed~array + array
10+
$x = $mixed + $arr;
11+
};

0 commit comments

Comments
 (0)