mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix #676 - bitwise operators didn’t have int return type
This commit is contained in:
parent
3cc549384f
commit
55153f9542
@ -401,7 +401,12 @@ class BinaryOpChecker
|
||||
$stmt instanceof PhpParser\Node\Expr\BinaryOp\Minus ||
|
||||
$stmt instanceof PhpParser\Node\Expr\BinaryOp\Mod ||
|
||||
$stmt instanceof PhpParser\Node\Expr\BinaryOp\Mul ||
|
||||
$stmt instanceof PhpParser\Node\Expr\BinaryOp\Pow
|
||||
$stmt instanceof PhpParser\Node\Expr\BinaryOp\Pow ||
|
||||
$stmt instanceof PhpParser\Node\Expr\BinaryOp\BitwiseOr ||
|
||||
$stmt instanceof PhpParser\Node\Expr\BinaryOp\BitwiseXor ||
|
||||
$stmt instanceof PhpParser\Node\Expr\BinaryOp\BitwiseAnd ||
|
||||
$stmt instanceof PhpParser\Node\Expr\BinaryOp\ShiftLeft ||
|
||||
$stmt instanceof PhpParser\Node\Expr\BinaryOp\ShiftRight
|
||||
) {
|
||||
self::analyzeNonDivArithmenticOp(
|
||||
$statements_checker,
|
||||
|
@ -44,6 +44,21 @@ class BinaryOperationTest extends TestCase
|
||||
'assertions' => [],
|
||||
'error_levels' => ['PossiblyFalseOperand'],
|
||||
],
|
||||
'bitwiseoperations' => [
|
||||
'<?php
|
||||
$a = 4 & 5;
|
||||
$b = 2 | 3;
|
||||
$c = 4 ^ 3;
|
||||
$d = 1 << 2;
|
||||
$e = 15 >> 2;',
|
||||
'assertions' => [
|
||||
'$a' => 'int',
|
||||
'$b' => 'int',
|
||||
'$c' => 'int',
|
||||
'$d' => 'int',
|
||||
'$e' => 'int',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user