-
-
Notifications
You must be signed in to change notification settings - Fork 699
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DowngradePhp81/80] Skip combine check with is_resource and instanceo…
…f Object (#1192) * [DowngradePhp81/80] Skip combine check with is_resource and instanceof Object * regenerate docs * only check after classname comparison * test for different check
- Loading branch information
1 parent
4ac7fa4
commit 4815cd9
Showing
4 changed files
with
148 additions
and
5 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
27 changes: 27 additions & 0 deletions
27
...or/Instanceof_/DowngradePhp80ResourceReturnToObjectRector/Fixture/different_check.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,27 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DowngradePhp80\Rector\Instanceof_\DowngradePhp80ResourceReturnToObjectRector\Fixture; | ||
|
||
class DifferentCheck | ||
{ | ||
public function run($obj) | ||
{ | ||
$obj instanceof \CurlHandle && rand(0, 1) === 1; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\DowngradePhp80\Rector\Instanceof_\DowngradePhp80ResourceReturnToObjectRector\Fixture; | ||
|
||
class DifferentCheck | ||
{ | ||
public function run($obj) | ||
{ | ||
is_resource($obj) && rand(0, 1) === 1; | ||
} | ||
} | ||
|
||
?> |
12 changes: 12 additions & 0 deletions
12
...radePhp80ResourceReturnToObjectRector/Fixture/skip_combine_check_with_is_resource.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,12 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DowngradePhp80\Rector\Instanceof_\DowngradePhp80ResourceReturnToObjectRector\Fixture; | ||
|
||
class SkipCombineCheckWithIsResource | ||
{ | ||
public function run($image) | ||
{ | ||
if (!$image instanceof \GdImage && !(\is_resource($image) && \get_resource_type($image) === 'gd')) { | ||
} | ||
} | ||
} |
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