-
-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DowngradePhp80] Add return property downgrade case (#1415)
- Loading branch information
1 parent
a78fc17
commit 327144e
Showing
5 changed files
with
196 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...adePhp80/Rector/Expression/DowngradeThrowExprRector/Fixture/return_throw_variable.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DowngradePhp80\Rector\Expression\DowngradeThrowExprRector\Fixture; | ||
|
||
use Symfony\Component\Console\Helper\ProgressBar; | ||
|
||
final class ReturnThrowVariable | ||
{ | ||
public function run() | ||
{ | ||
return $variable ?? throw new \InvalidArgumentException(); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\DowngradePhp80\Rector\Expression\DowngradeThrowExprRector\Fixture; | ||
|
||
use Symfony\Component\Console\Helper\ProgressBar; | ||
|
||
final class ReturnThrowVariable | ||
{ | ||
public function run() | ||
{ | ||
if (!isset($variable)) { | ||
throw new \InvalidArgumentException(); | ||
} | ||
return $variable; | ||
} | ||
} | ||
|
||
?> |
44 changes: 44 additions & 0 deletions
44
...radePhp80/Rector/Expression/DowngradeThrowExprRector/Fixture/throw_property_fetch.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DowngradePhp80\Rector\Expression\DowngradeThrowExprRector\Fixture; | ||
|
||
use Symfony\Component\Console\Helper\ProgressBar; | ||
|
||
final class ThrowPropertyFetch | ||
{ | ||
public function __construct( | ||
private ProgressBar|null $progressBar | ||
) { | ||
} | ||
|
||
public function run() | ||
{ | ||
return $this->progressBar ?? throw new \InvalidArgumentException(); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\DowngradePhp80\Rector\Expression\DowngradeThrowExprRector\Fixture; | ||
|
||
use Symfony\Component\Console\Helper\ProgressBar; | ||
|
||
final class ThrowPropertyFetch | ||
{ | ||
public function __construct( | ||
private ProgressBar|null $progressBar | ||
) { | ||
} | ||
|
||
public function run() | ||
{ | ||
if ($this->progressBar === null) { | ||
throw new \InvalidArgumentException(); | ||
} | ||
return $this->progressBar; | ||
} | ||
} | ||
|
||
?> |
Oops, something went wrong.