-
-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add few union type fixtures to ReturnTypeFromStrictTypedCallRector
- Loading branch information
1 parent
296a2b2
commit f5ca43a
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
.../ClassMethod/ReturnTypeFromStrictTypedCallRector/Fixture/skip_union_type_on_php74.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,23 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector\Fixture; | ||
|
||
final class SkipUnionTypesOnPHP74 | ||
{ | ||
public function getTogether() | ||
{ | ||
if (mt_rand(0, 1)) { | ||
return $this->getValue(); | ||
} | ||
|
||
return $this->getNextValue(); | ||
} | ||
|
||
private function getValue(): int|string | ||
{ | ||
} | ||
|
||
private function getNextValue(): float|string | ||
{ | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
...or/ClassMethod/ReturnTypeFromStrictTypedCallRector/FixturePhp80/merge_union_types.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,51 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector\FixturePhp80; | ||
|
||
final class MergeUnionTypes | ||
{ | ||
public function getTogether() | ||
{ | ||
if (mt_rand(0, 1)) { | ||
return $this->getValue(); | ||
} | ||
|
||
return $this->getNextValue(); | ||
} | ||
|
||
private function getValue(): int|string | ||
{ | ||
} | ||
|
||
private function getNextValue(): float|string | ||
{ | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector\FixturePhp80; | ||
|
||
final class MergeUnionTypes | ||
{ | ||
public function getTogether(): int|string|float | ||
{ | ||
if (mt_rand(0, 1)) { | ||
return $this->getValue(); | ||
} | ||
|
||
return $this->getNextValue(); | ||
} | ||
|
||
private function getValue(): int|string | ||
{ | ||
} | ||
|
||
private function getNextValue(): float|string | ||
{ | ||
} | ||
} | ||
|
||
?> |