Skip to content

Commit

Permalink
remove test dependency on DateTime changing api
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Dec 6, 2020
1 parent 7d4e501 commit ef0643e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;

/**
* @requires PHP >= 8.0
*/
final class DowngradeUnionTypeParamDeclarationRectorTest extends AbstractRectorTestCase
{
/**
Expand All @@ -32,6 +35,6 @@ protected function getRectorClass(): string

protected function getPhpVersion(): int
{
return PhpVersionFeature::UNION_TYPES - 1;
return PhpVersionFeature::UNION_TYPES;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

namespace Rector\Naming\Tests\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector\FixturePhp74;

use DateTime;
use Rector\Naming\Tests\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector\Source\SameNameMethod;

class ArrowFunction
{
public function run()
public function run(SameNameMethod $sameNameMethod)
{
$datetime = new DateTime();

$fn1 = fn($x) => $x + $stamp = $datetime->getTimezone();
$fn1 = fn($x) => $x + $stamp = $sameNameMethod->getName();
}
}

Expand All @@ -20,15 +18,13 @@ class ArrowFunction

namespace Rector\Naming\Tests\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector\FixturePhp74;

use DateTime;
use Rector\Naming\Tests\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector\Source\SameNameMethod;

class ArrowFunction
{
public function run()
public function run(SameNameMethod $sameNameMethod)
{
$datetime = new DateTime();

$fn1 = fn($x) => $x + $dateTimeZone = $datetime->getTimezone();
$fn1 = fn($x) => $x + $fullName = $sameNameMethod->getName();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace Rector\Naming\Tests\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector\Source;

final class FullName
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Rector\Naming\Tests\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector\Source;

final class SameNameMethod
{
public function getName(): FullName
{
return new FullName();
}
}

0 comments on commit ef0643e

Please sign in to comment.