-
-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php70] Do not take side effect on IfToSpaceshipRector (#1696)
* [Php70] Do not take side effect on IfToSpaceshipRector * [ci-review] Rector Rectify * [ci-review] Rector Rectify * [ci-review] Rector Rectify * Fixed 🎉 * [ci-review] Rector Rectify Co-authored-by: GitHub Action <action@github.com>
- Loading branch information
1 parent
9d781bb
commit 71719b5
Showing
3 changed files
with
59 additions
and
13 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
rules-tests/Php70/Rector/If_/IfToSpaceshipRector/Fixture/do_not_take_side_effect.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,49 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php70\Rector\If_\IfToSpaceshipRector\SideEffect; | ||
|
||
class SideEffect { | ||
|
||
public static function foo( $param ) { | ||
if ( 0 === strpos( $param, '/*' ) ) { | ||
$foo = 1; | ||
} | ||
|
||
$foo = 2; | ||
return $foo; | ||
} | ||
|
||
private static function rsort( $a, $b ) { | ||
if ( $a['bar'] === $b['bar'] ) { | ||
return 0; | ||
} else { | ||
return ( $a['bar'] > $b['bar'] ) ? -1 : 1; | ||
} | ||
} | ||
|
||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php70\Rector\If_\IfToSpaceshipRector\SideEffect; | ||
|
||
class SideEffect { | ||
|
||
public static function foo( $param ) { | ||
if ( 0 === strpos( $param, '/*' ) ) { | ||
$foo = 1; | ||
} | ||
|
||
$foo = 2; | ||
return $foo; | ||
} | ||
|
||
private static function rsort( $a, $b ) { | ||
return $a['bar'] <=> $b['bar']; | ||
} | ||
|
||
} | ||
|
||
?> |
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
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