-
-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TypeDeclaration] Add isset(), empty(), and negation support on BoolR…
…eturnTypeFromBooleanStrictReturnsRector (#6339) * [TypeDeclaration] Add isset(), empty(), and negation support on BoolReturnTypeFromBooleanStrictReturnsRector * implemented
- Loading branch information
1 parent
6b065ef
commit 54a6620
Showing
4 changed files
with
99 additions
and
3 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...ector/ClassMethod/BoolReturnTypeFromBooleanStrictReturnsRector/Fixture/with_empty.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\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromBooleanStrictReturnsRector\Fixture; | ||
|
||
final class WithEmpty | ||
{ | ||
public function resolve($a) | ||
{ | ||
return empty($a['test']); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromBooleanStrictReturnsRector\Fixture; | ||
|
||
final class WithEmpty | ||
{ | ||
public function resolve($a): bool | ||
{ | ||
return empty($a['test']); | ||
} | ||
} | ||
|
||
?> |
27 changes: 27 additions & 0 deletions
27
...ector/ClassMethod/BoolReturnTypeFromBooleanStrictReturnsRector/Fixture/with_isset.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\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromBooleanStrictReturnsRector\Fixture; | ||
|
||
final class WithIsset | ||
{ | ||
public function resolve($a) | ||
{ | ||
return isset($a['test']); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromBooleanStrictReturnsRector\Fixture; | ||
|
||
final class WithIsset | ||
{ | ||
public function resolve($a): bool | ||
{ | ||
return isset($a['test']); | ||
} | ||
} | ||
|
||
?> |
27 changes: 27 additions & 0 deletions
27
...or/ClassMethod/BoolReturnTypeFromBooleanStrictReturnsRector/Fixture/with_negation.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\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromBooleanStrictReturnsRector\Fixture; | ||
|
||
final class WithNegation | ||
{ | ||
public function resolve($a) | ||
{ | ||
return ! $a; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\BoolReturnTypeFromBooleanStrictReturnsRector\Fixture; | ||
|
||
final class WithNegation | ||
{ | ||
public function resolve($a): bool | ||
{ | ||
return ! $a; | ||
} | ||
} | ||
|
||
?> |
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