Skip to content

Commit

Permalink
Add few union type fixtures to ReturnTypeFromStrictTypedCallRector (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba authored Jun 30, 2024
1 parent 0482641 commit 9fa1da9
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
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
{
}
}
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
{
}
}

?>

0 comments on commit 9fa1da9

Please sign in to comment.