Skip to content

Commit

Permalink
Added regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored and ondrejmirtes committed Sep 23, 2024
1 parent 5677025 commit 30e8e8b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/PHPStan/Rules/Operators/InvalidBinaryOperationRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -798,4 +798,16 @@ public function testBenevolentUnion(): void
]);
}

public function testBug7863(): void
{
$this->checkImplicitMixed = true;

$this->analyse([__DIR__ . '/data/bug-7863.php'], [
[
'Binary operation "+" between mixed and array results in an error.',
10,
],
]);
}

}
11 changes: 11 additions & 0 deletions tests/PHPStan/Rules/Operators/data/bug-7863.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Bug7863;

function ($mixed, array $arr) {
if (is_array($mixed)) {
return;
}
// mixed~array + array
$x = $mixed + $arr;
};

0 comments on commit 30e8e8b

Please sign in to comment.