Skip to content

Commit 84fe73a

Browse files
authored
[CodeQuality] Rename MatchAssertSameExpectedTypeRector to MatchAssertEqualsExpectedTypeRector to only apply on assertEquals (#514)
1 parent a2c2427 commit 84fe73a

File tree

11 files changed

+35
-35
lines changed

11 files changed

+35
-35
lines changed

config/sets/phpunit-code-quality.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertSameTrueFalseToAssertTrueFalseRector;
3232
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertTrueFalseToSpecificMethodRector;
3333
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\FlipAssertRector;
34-
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\MatchAssertSameExpectedTypeRector;
34+
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\MatchAssertEqualsExpectedTypeRector;
3535
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\NarrowIdenticalWithConsecutiveRector;
3636
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\NarrowSingleWillReturnCallbackRector;
3737
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\RemoveExpectAnyFromMockRector;
@@ -46,7 +46,7 @@
4646
ConstructClassMethodToSetUpTestCaseRector::class,
4747

4848
AssertSameTrueFalseToAssertTrueFalseRector::class,
49-
MatchAssertSameExpectedTypeRector::class,
49+
MatchAssertEqualsExpectedTypeRector::class,
5050

5151
AssertEqualsToSameRector::class,
5252
PreferPHPUnitThisCallRector::class,

rules-tests/CodeQuality/Rector/MethodCall/MatchAssertSameExpectedTypeRector/Fixture/match_assert_type.php.inc renamed to rules-tests/CodeQuality/Rector/MethodCall/MatchAssertEqualsExpectedTypeRector/Fixture/match_assert_type.php.inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22

3-
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertSameExpectedTypeRector\Fixture;
3+
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertEqualsExpectedTypeRector\Fixture;
44

55
use PHPUnit\Framework\TestCase;
66

77
final class MatchAssertType extends TestCase
88
{
99
public function test()
1010
{
11-
$this->assertSame('123', $this->getOrderId());
11+
$this->assertEquals('123', $this->getOrderId());
1212
}
1313

1414
private function getOrderId(): int
@@ -21,15 +21,15 @@ final class MatchAssertType extends TestCase
2121
-----
2222
<?php
2323

24-
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertSameExpectedTypeRector\Fixture;
24+
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertEqualsExpectedTypeRector\Fixture;
2525

2626
use PHPUnit\Framework\TestCase;
2727

2828
final class MatchAssertType extends TestCase
2929
{
3030
public function test()
3131
{
32-
$this->assertSame(123, $this->getOrderId());
32+
$this->assertEquals(123, $this->getOrderId());
3333
}
3434

3535
private function getOrderId(): int

rules-tests/CodeQuality/Rector/MethodCall/MatchAssertSameExpectedTypeRector/Fixture/match_integer_to_string.php.inc renamed to rules-tests/CodeQuality/Rector/MethodCall/MatchAssertEqualsExpectedTypeRector/Fixture/match_integer_to_string.php.inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22

3-
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertSameExpectedTypeRector\Fixture;
3+
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertEqualsExpectedTypeRector\Fixture;
44

55
use PHPUnit\Framework\TestCase;
66

77
final class MatchIntegerToString extends TestCase
88
{
99
public function test()
1010
{
11-
$this->assertSame(123, $this->getOrderId());
11+
$this->assertEquals(123, $this->getOrderId());
1212
}
1313

1414
private function getOrderId(): string
@@ -21,15 +21,15 @@ final class MatchIntegerToString extends TestCase
2121
-----
2222
<?php
2323

24-
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertSameExpectedTypeRector\Fixture;
24+
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertEqualsExpectedTypeRector\Fixture;
2525

2626
use PHPUnit\Framework\TestCase;
2727

2828
final class MatchIntegerToString extends TestCase
2929
{
3030
public function test()
3131
{
32-
$this->assertSame('123', $this->getOrderId());
32+
$this->assertEquals('123', $this->getOrderId());
3333
}
3434

3535
private function getOrderId(): string

rules-tests/CodeQuality/Rector/MethodCall/MatchAssertSameExpectedTypeRector/Fixture/nullable_match_assert_type.php.inc renamed to rules-tests/CodeQuality/Rector/MethodCall/MatchAssertEqualsExpectedTypeRector/Fixture/nullable_match_assert_type.php.inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22

3-
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertSameExpectedTypeRector\Fixture;
3+
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertEqualsExpectedTypeRector\Fixture;
44

55
use PHPUnit\Framework\TestCase;
66

77
final class NullableMatchAssertType extends TestCase
88
{
99
public function test()
1010
{
11-
$this->assertSame('123', $this->getOrderId());
11+
$this->assertEquals('123', $this->getOrderId());
1212
}
1313

1414
private function getOrderId(): ?int
@@ -21,15 +21,15 @@ final class NullableMatchAssertType extends TestCase
2121
-----
2222
<?php
2323

24-
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertSameExpectedTypeRector\Fixture;
24+
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertEqualsExpectedTypeRector\Fixture;
2525

2626
use PHPUnit\Framework\TestCase;
2727

2828
final class NullableMatchAssertType extends TestCase
2929
{
3030
public function test()
3131
{
32-
$this->assertSame(123, $this->getOrderId());
32+
$this->assertEquals(123, $this->getOrderId());
3333
}
3434

3535
private function getOrderId(): ?int

rules-tests/CodeQuality/Rector/MethodCall/MatchAssertSameExpectedTypeRector/Fixture/skip_argument_less.php.inc renamed to rules-tests/CodeQuality/Rector/MethodCall/MatchAssertEqualsExpectedTypeRector/Fixture/skip_argument_less.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertSameExpectedTypeRector\Fixture;
3+
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertEqualsExpectedTypeRector\Fixture;
44

55
use PHPUnit\Framework\TestCase;
66

rules-tests/CodeQuality/Rector/MethodCall/MatchAssertSameExpectedTypeRector/Fixture/skip_docblock_type.php.inc renamed to rules-tests/CodeQuality/Rector/MethodCall/MatchAssertEqualsExpectedTypeRector/Fixture/skip_docblock_type.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertSameExpectedTypeRector\Fixture;
3+
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertEqualsExpectedTypeRector\Fixture;
44

55
use PHPUnit\Framework\TestCase;
66

rules-tests/CodeQuality/Rector/MethodCall/MatchAssertSameExpectedTypeRector/Fixture/skip_first_class_callable.php.inc renamed to rules-tests/CodeQuality/Rector/MethodCall/MatchAssertEqualsExpectedTypeRector/Fixture/skip_first_class_callable.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertSameExpectedTypeRector\Fixture;
3+
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertEqualsExpectedTypeRector\Fixture;
44

55
use PHPUnit\Framework\TestCase;
66

rules-tests/CodeQuality/Rector/MethodCall/MatchAssertSameExpectedTypeRector/MatchAssertSameExpectedTypeRectorTest.php renamed to rules-tests/CodeQuality/Rector/MethodCall/MatchAssertEqualsExpectedTypeRector/MatchAssertEqualsExpectedTypeRectorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
declare(strict_types=1);
44

5-
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertSameExpectedTypeRector;
5+
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\MatchAssertEqualsExpectedTypeRector;
66

77
use Iterator;
88
use PHPUnit\Framework\Attributes\DataProvider;
99
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
1010

11-
final class MatchAssertSameExpectedTypeRectorTest extends AbstractRectorTestCase
11+
final class MatchAssertEqualsExpectedTypeRectorTest extends AbstractRectorTestCase
1212
{
1313
#[DataProvider('provideData')]
1414
public function test(string $filePath): void
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\MatchAssertEqualsExpectedTypeRector;
7+
8+
return static function (RectorConfig $rectorConfig): void {
9+
$rectorConfig->rule(MatchAssertEqualsExpectedTypeRector::class);
10+
};

rules-tests/CodeQuality/Rector/MethodCall/MatchAssertSameExpectedTypeRector/config/configured_rule.php

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)