Skip to content

Commit 2775be4

Browse files
committed
Test block statement
1 parent 1c2e209 commit 2775be4

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace BlockStatement;
4+
5+
use PHPStan\TrinaryLogic;
6+
use function PHPStan\Testing\assertVariableCertainty;
7+
8+
class Foo
9+
{
10+
11+
public function doFoo(): void
12+
{
13+
$a = 1;
14+
{
15+
$b = 2;
16+
}
17+
18+
assertVariableCertainty(TrinaryLogic::createYes(), $a);
19+
assertVariableCertainty(TrinaryLogic::createYes(), $b);
20+
}
21+
22+
}

tests/PHPStan/Rules/Cast/EchoRuleTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public function testEchoRule(): void
4747
'Parameter #1 (\'string\'|array{\'string\'}) of echo cannot be converted to string.',
4848
17,
4949
],
50+
[
51+
'Parameter #1 (array{}) of echo cannot be converted to string.',
52+
29,
53+
],
5054
]);
5155
}
5256

tests/PHPStan/Rules/Cast/data/echo.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,9 @@ function (array $test)
2323
/** @var string $test */
2424
echo $test;
2525
};
26+
27+
function (): void {
28+
{
29+
echo [];
30+
}
31+
};

0 commit comments

Comments
 (0)