1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Add a couple of currently-working tests

This commit is contained in:
Matthew Brown 2022-01-25 01:32:35 -05:00
parent c974f23852
commit 302c72d5b1
2 changed files with 25 additions and 0 deletions

View File

@ -183,6 +183,19 @@ class ReferenceConstraintTest extends TestCase
array_walk_recursive($val, /** @param mixed $arg */ function (&$arg): void {});
}'
],
'investigateByrefArg' => [
'code' => '<?php
class A {}
function takesNullableObj(?A &$a): bool { return true; }
$a = null;
if (takesNullableObj($a) === false) {
return;
} else {}
if ($a) {}',
],
];
}

View File

@ -2441,6 +2441,18 @@ class UnusedVariableTest extends TestCase
$a = false;
}'
],
'usedPlusInAddition' => [
'<?php
function takesAnInt(): void {
$i = 0;
while (rand(0, 1)) {
if (++$i > 10) {
break;
} else {}
}
}',
],
];
}