-
-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CodeQuality] Handle Param by reference in target method on CallableT…
…hisArrayToAnonymousFunctionRector (#1974) Co-authored-by: GitHub Action <action@github.com>
- Loading branch information
1 parent
df0d552
commit b97ce48
Showing
3 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...bleThisArrayToAnonymousFunctionRector/Fixture/param_by_reference_in_target_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,41 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector\Fixture; | ||
|
||
class ParamByReferenceInTargetMethod | ||
{ | ||
public function run() | ||
{ | ||
$arr = ['string']; | ||
array_walk_recursive($arr, [$this, 'append']); | ||
var_dump($arr); | ||
} | ||
|
||
private function append (string &$str) { | ||
$str .= " append this"; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector\Fixture; | ||
|
||
class ParamByReferenceInTargetMethod | ||
{ | ||
public function run() | ||
{ | ||
$arr = ['string']; | ||
array_walk_recursive($arr, function (string &$str) { | ||
return $this->append($str); | ||
}); | ||
var_dump($arr); | ||
} | ||
|
||
private function append (string &$str) { | ||
$str .= " append this"; | ||
} | ||
} | ||
|
||
?> |
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
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