-
-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TypeDeclaration] Allow defined in non-setUp() on TypedPropertyFromCr…
…eateMockAssignRector (#6180) * [TypeDeclaration] Skip defined in non-setUp() method on TypedPropertyFromCreateMockAssignRector * nullable if setUp() method exists, but not assign * allow non-setup * Fix * [ci-review] Rector Rectify --------- Co-authored-by: GitHub Action <[email protected]>
- Loading branch information
1 parent
1a58300
commit eba6153
Showing
3 changed files
with
96 additions
and
5 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
...ypedPropertyFromCreateMockAssignRector/Fixture/setup_method_exists_but_not_assign.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,45 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Class_\TypedPropertyFromCreateMockAssignRector\Fixture; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Rector\Tests\TypeDeclaration\Rector\Class_\TypedPropertyFromCreateMockAssignRector\Source\SomeMockedClass; | ||
|
||
class SetupMethodExistsButNotAssign extends TestCase | ||
{ | ||
public $someMock; | ||
|
||
protected function setUp(): void | ||
{ | ||
} | ||
|
||
private function factory() | ||
{ | ||
$this->someMock = $this->createMock(SomeMockedClass::class); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Class_\TypedPropertyFromCreateMockAssignRector\Fixture; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Rector\Tests\TypeDeclaration\Rector\Class_\TypedPropertyFromCreateMockAssignRector\Source\SomeMockedClass; | ||
|
||
class SetupMethodExistsButNotAssign extends TestCase | ||
{ | ||
public ?\PHPUnit\Framework\MockObject\MockObject $someMock = null; | ||
|
||
protected function setUp(): void | ||
{ | ||
} | ||
|
||
private function factory() | ||
{ | ||
$this->someMock = $this->createMock(SomeMockedClass::class); | ||
} | ||
} | ||
|
||
?> |
37 changes: 37 additions & 0 deletions
37
...ctor/Class_/TypedPropertyFromCreateMockAssignRector/Fixture/with_non_setup_method.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,37 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Class_\TypedPropertyFromCreateMockAssignRector\Fixture; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Rector\Tests\TypeDeclaration\Rector\Class_\TypedPropertyFromCreateMockAssignRector\Source\SomeMockedClass; | ||
|
||
class WithNonSetupMethod extends TestCase | ||
{ | ||
public $someMock; | ||
|
||
protected function factory(): void | ||
{ | ||
$this->someMock = $this->createMock(SomeMockedClass::class); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\TypeDeclaration\Rector\Class_\TypedPropertyFromCreateMockAssignRector\Fixture; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Rector\Tests\TypeDeclaration\Rector\Class_\TypedPropertyFromCreateMockAssignRector\Source\SomeMockedClass; | ||
|
||
class WithNonSetupMethod extends TestCase | ||
{ | ||
public ?\PHPUnit\Framework\MockObject\MockObject $someMock = null; | ||
|
||
protected function factory(): void | ||
{ | ||
$this->someMock = $this->createMock(SomeMockedClass::class); | ||
} | ||
} | ||
|
||
?> |
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