mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-07 20:00:50 +00:00
4be1f2aee7
* [DowngradePhp80] Allow Truthy with Ternary on DowngradeThrowExprRector * Trigger notification * update test fixture to trigger test * update test fixture to trigger test
52 lines
854 B
PHP
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';
|
|
}
|
|
}
|
|
|
|
?>
|