Skip to content

Commit

Permalink
Test block statement
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 6, 2024
1 parent 1c2e209 commit 2775be4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/PHPStan/Analyser/nsrt/block-statement.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace BlockStatement;

use PHPStan\TrinaryLogic;
use function PHPStan\Testing\assertVariableCertainty;

class Foo
{

public function doFoo(): void
{
$a = 1;
{
$b = 2;
}

assertVariableCertainty(TrinaryLogic::createYes(), $a);
assertVariableCertainty(TrinaryLogic::createYes(), $b);
}

}
4 changes: 4 additions & 0 deletions tests/PHPStan/Rules/Cast/EchoRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public function testEchoRule(): void
'Parameter #1 (\'string\'|array{\'string\'}) of echo cannot be converted to string.',
17,
],
[
'Parameter #1 (array{}) of echo cannot be converted to string.',
29,
],
]);
}

Expand Down
6 changes: 6 additions & 0 deletions tests/PHPStan/Rules/Cast/data/echo.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ function (array $test)
/** @var string $test */
echo $test;
};

function (): void {
{
echo [];
}
};

0 comments on commit 2775be4

Please sign in to comment.