-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
271 additions
and
17 deletions.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
rules-tests/Php70/Rector/If_/IfToSpaceshipRector/Fixture/ascending.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,83 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php70\Rector\If_\IfToSpaceshipRector\Reverse; | ||
|
||
class Ascending | ||
{ | ||
public function run() | ||
{ | ||
$languages = []; | ||
usort($languages, function ($a, $b) { | ||
if ($a[0] === $b[0]) { | ||
return 0; | ||
} else { | ||
return ($a[0] < $b[0]) ? -1 : 1; | ||
} | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
if ($a[0] === $b[0]) { | ||
return 0; | ||
} else { | ||
return ($b[0] < $a[0]) ? 1 : -1; | ||
} | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
if ($a[0] === $b[0]) { | ||
return 0; | ||
} | ||
return ($a[0] < $b[0]) ? -1 : 1; | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
if ($a[0] === $b[0]) { | ||
return 0; | ||
} else { | ||
return ($a[0] > $b[0]) ? 1 : -1; | ||
} | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
if ($a[0] === $b[0]) { | ||
return 0; | ||
} | ||
return ($a[0] > $b[0]) ? 1 : -1; | ||
}); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php70\Rector\If_\IfToSpaceshipRector\Reverse; | ||
|
||
class Ascending | ||
{ | ||
public function run() | ||
{ | ||
$languages = []; | ||
usort($languages, function ($a, $b) { | ||
return $a[0] <=> $b[0]; | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
return $a[0] <=> $b[0]; | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
return $a[0] <=> $b[0]; | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
return $a[0] <=> $b[0]; | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
return $a[0] <=> $b[0]; | ||
}); | ||
} | ||
} | ||
|
||
?> |
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
83 changes: 83 additions & 0 deletions
83
rules-tests/Php70/Rector/If_/IfToSpaceshipRector/Fixture/descending.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,83 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php70\Rector\If_\IfToSpaceshipRector\Reverse; | ||
|
||
class Descending | ||
{ | ||
public function run() | ||
{ | ||
$languages = []; | ||
usort($languages, function ($a, $b) { | ||
if ($a[0] === $b[0]) { | ||
return 0; | ||
} else { | ||
return ($a[0] < $b[0]) ? 1 : -1; | ||
} | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
if ($a[0] === $b[0]) { | ||
return 0; | ||
} else { | ||
return ($b[0] < $a[0]) ? -1 : 1; | ||
} | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
if ($a[0] === $b[0]) { | ||
return 0; | ||
} | ||
return ($a[0] < $b[0]) ? 1 : -1; | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
if ($a[0] === $b[0]) { | ||
return 0; | ||
} else { | ||
return ($a[0] > $b[0]) ? -1 : 1; | ||
} | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
if ($a[0] === $b[0]) { | ||
return 0; | ||
} | ||
return ($a[0] > $b[0]) ? -1 : 1; | ||
}); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php70\Rector\If_\IfToSpaceshipRector\Reverse; | ||
|
||
class Descending | ||
{ | ||
public function run() | ||
{ | ||
$languages = []; | ||
usort($languages, function ($a, $b) { | ||
return $b[0] <=> $a[0]; | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
return $b[0] <=> $a[0]; | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
return $b[0] <=> $a[0]; | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
return $b[0] <=> $a[0]; | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
return $b[0] <=> $a[0]; | ||
}); | ||
} | ||
} | ||
|
||
?> |
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
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
49 changes: 49 additions & 0 deletions
49
rules-tests/Php70/Rector/If_/IfToSpaceshipRector/Fixture/reverse3.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\Reverse; | ||
|
||
class Reverse3 | ||
{ | ||
public function run() | ||
{ | ||
$languages = []; | ||
usort($languages, function ($a, $b) { | ||
if ($a[0] === $b[0]) { | ||
return 0; | ||
} | ||
|
||
return ($a[0] > $b[0]) ? -1 : 1; | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
if ($a[0] === $b[0]) { | ||
return 0; | ||
} else { | ||
return ($a[0] > $b[0]) ? -1 : 1; | ||
} | ||
}); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php70\Rector\If_\IfToSpaceshipRector\Reverse; | ||
|
||
class Reverse3 | ||
{ | ||
public function run() | ||
{ | ||
$languages = []; | ||
usort($languages, function ($a, $b) { | ||
return $b[0] <=> $a[0]; | ||
}); | ||
|
||
usort($languages, function ($a, $b) { | ||
return $b[0] <=> $a[0]; | ||
}); | ||
} | ||
} | ||
|
||
?> |
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