Skip to content

Commit

Permalink
[DX] Cleanup and simplify class naming tests (#4749)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba authored Aug 9, 2023
1 parent db0388f commit 9f4d232
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 502 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,13 @@

namespace Rector\Tests\Renaming\Rector\Name\RenameClassRector\Fixture;

class ClassToInterface extends \DateTime
{
public function run(\DateTime $dateTime): \DateTime
{
$oldClassWithTypo = new \DateTime();
}
}

?>
-----
<?php

namespace Rector\Tests\Renaming\Rector\Name\RenameClassRector\Fixture;
use Rector\Tests\Renaming\Rector\Name\RenameClassRector\Source\InterfaceAndClass\SomeBasicDateTime;

class ClassToInterface extends \DateTime
class ClassToInterface extends SomeBasicDateTime
{
public function run(\DateTimeInterface $dateTime): \DateTimeInterface
public function run(\Rector\Tests\Renaming\Rector\Name\RenameClassRector\Source\InterfaceAndClass\SomeBasicDateTimeInterface $dateTime): \Rector\Tests\Renaming\Rector\Name\RenameClassRector\Source\InterfaceAndClass\SomeBasicDateTimeInterface
{
$oldClassWithTypo = new \DateTime();
$oldClassWithTypo = new SomeBasicDateTime;
}
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,14 @@

namespace Rector\Tests\Renaming\Rector\Name\RenameClassRector\Fixture;

use DateTime;
use Rector\Tests\Renaming\Rector\Name\RenameClassRector\Source\InterfaceAndClass\SomeBasicDateTime;

final class DoNotReplaceInterfaceCall
{
public function run($dateTime)
{
if (! $dateTime instanceof DateTime) {
$dateTime = DateTime::createFromFormat('Y-m-d', date('Y-m-d'));
}

return $dateTime;
}
}

?>
-----
<?php

namespace Rector\Tests\Renaming\Rector\Name\RenameClassRector\Fixture;

use DateTime;

final class DoNotReplaceInterfaceCall
{
public function run($dateTime)
{
if (! $dateTime instanceof \DateTimeInterface) {
$dateTime = DateTime::createFromFormat('Y-m-d', date('Y-m-d'));
if (! $dateTime instanceof \Rector\Tests\Renaming\Rector\Name\RenameClassRector\Source\InterfaceAndClass\SomeBasicDateTimeInterface) {
$dateTime = SomeBasicDateTime::createFromFormat('Y-m-d', date('Y-m-d'));
}

return $dateTime;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 9f4d232

Please sign in to comment.