-
-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php71] Handle not identical to Float for empty string should compare…
… to 0.0 on BinaryOpBetweenNumberAndStringRector (#6117) * [Php71] Handle not identical to Float for empty string should compare to 0.0 on BinaryOpBetweenNumberAndStringRector * Fix
- Loading branch information
1 parent
3fe5553
commit e63e9a2
Showing
3 changed files
with
52 additions
and
4 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
43 changes: 43 additions & 0 deletions
43
.../Rector/BinaryOp/BinaryOpBetweenNumberAndStringRector/Fixture/not_identical_float.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,43 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php71\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector\Fixture; | ||
|
||
class NotIdenticalFloat | ||
{ | ||
function foo(): ?float | ||
{ | ||
return 0; | ||
} | ||
|
||
public function run() | ||
{ | ||
$data = $this->foo(); | ||
if (! is_null($data)) { | ||
var_dump($data !== ''); | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php71\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector\Fixture; | ||
|
||
class NotIdenticalFloat | ||
{ | ||
function foo(): ?float | ||
{ | ||
return 0; | ||
} | ||
|
||
public function run() | ||
{ | ||
$data = $this->foo(); | ||
if (! is_null($data)) { | ||
var_dump($data !== 0.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