rector/rules-tests/DowngradePhp80/Rector/Expression/DowngradeThrowExprRector/Fixture/truthy_ternary.php.inc
Abdul Malik Ikhsan 4be1f2aee7
[DowngradePhp80] Allow Truthy with Ternary on DowngradeThrowExprRector (#539)
* [DowngradePhp80] Allow Truthy with Ternary on DowngradeThrowExprRector

* Trigger notification

* update test fixture to trigger test

* update test fixture to trigger test
2021-07-29 11:56:43 +02:00

52 lines
854 B
PHP

<?php
namespace Rector\Tests\DowngradePhp80\Rector\Expression\DowngradeThrowExprRector\Fixture;
use RuntimeException;
class TruthyTernary
{
public function run()
{
$var = 'test';
$id = $var ?: throw new RuntimeException();
}
public function run2()
{
$var = 'test';
$id = $var ? 'value' : throw new RuntimeException();
}
}
?>
-----
<?php
namespace Rector\Tests\DowngradePhp80\Rector\Expression\DowngradeThrowExprRector\Fixture;
use RuntimeException;
class TruthyTernary
{
public function run()
{
$var = 'test';
if (!$var) {
throw new RuntimeException();
}
$id = $var;
}
public function run2()
{
$var = 'test';
if (!$var) {
throw new RuntimeException();
}
$id = 'value';
}
}
?>