-
-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CodeQuality] Skip multi params on method on on setValue($a, $b, $c .…
…..) on ExplicitMethodCallOverMagicGetSetRector on assign (#1763)
- Loading branch information
1 parent
335206f
commit 1090aa6
Showing
4 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...licitMethodCallOverMagicGetSetRector/Fixture/skip_no_method_multi_param_on_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,13 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\PropertyFetch\ExplicitMethodCallOverMagicGetSetRector\Fixture; | ||
|
||
use Rector\Tests\CodeQuality\Rector\PropertyFetch\ExplicitMethodCallOverMagicGetSetRector\Source\ObjectWithMagicCallsMultiParam; | ||
|
||
final class SkipNoMethodOnMultiParamOnAssign | ||
{ | ||
public function run(ObjectWithMagicCallsMultiParam $obj) | ||
{ | ||
$obj->name = 20; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...icitMethodCallOverMagicGetSetRector/Fixture/skip_no_method_multi_param_on_assign2.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,14 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\PropertyFetch\ExplicitMethodCallOverMagicGetSetRector\Fixture; | ||
|
||
use Rector\Tests\CodeQuality\Rector\PropertyFetch\ExplicitMethodCallOverMagicGetSetRector\Source\ObjectWithMagicCallsMultiParam; | ||
|
||
final class SkipNoMethodOnMultiParamOnAssign2 | ||
{ | ||
public function run() | ||
{ | ||
$obj = new ObjectWithMagicCallsMultiParam(); | ||
$obj->name = 20; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...tyFetch/ExplicitMethodCallOverMagicGetSetRector/Source/ObjectWithMagicCallsMultiParam.php
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,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\PropertyFetch\ExplicitMethodCallOverMagicGetSetRector\Source; | ||
|
||
use Nette\SmartObject; | ||
|
||
final class ObjectWithMagicCallsMultiParam | ||
{ | ||
// adds magic __get() and __set() methods | ||
use SmartObject; | ||
|
||
private $name; | ||
|
||
public function getName() | ||
{ | ||
return $this->name; | ||
} | ||
|
||
public function setName(string $name, string $value) | ||
{ | ||
$this->name = $name . $value; | ||
} | ||
} |
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