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:
parent
c974f23852
commit
302c72d5b1
@ -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) {}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -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 {}
|
||||
}
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user