-
-
Notifications
You must be signed in to change notification settings - Fork 692
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CodingStyle] Handle FuncGetArgsToVariadicParamRector in Method/Stati…
…c Call (#389)
- Loading branch information
1 parent
dc78a3e
commit 95e6a5e
Showing
3 changed files
with
142 additions
and
4 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...tor/ClassMethod/FuncGetArgsToVariadicParamRector/Fixture/in_method_or_static_call.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,43 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector\Fixture; | ||
|
||
use Webmozart\Assert\Assert; | ||
|
||
final class InMethodOrStaticCall | ||
{ | ||
public function run(): void | ||
{ | ||
$this->count($args = func_get_args(), 1); | ||
Assert::count($args = func_get_args(), 1); | ||
} | ||
|
||
private function count($args, $value) | ||
{ | ||
Assert::count($args, $value); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector\Fixture; | ||
|
||
use Webmozart\Assert\Assert; | ||
|
||
final class InMethodOrStaticCall | ||
{ | ||
public function run(...$args): void | ||
{ | ||
$this->count($args, 1); | ||
Assert::count($args, 1); | ||
} | ||
|
||
private function count($args, $value) | ||
{ | ||
Assert::count($args, $value); | ||
} | ||
} | ||
|
||
?> |
61 changes: 61 additions & 0 deletions
61
...or/ClassMethod/FuncGetArgsToVariadicParamRector/Fixture/in_method_or_static_call2.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,61 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector\Fixture; | ||
|
||
use Webmozart\Assert\Assert; | ||
|
||
final class InMethodOrStaticCall2 | ||
{ | ||
public function run(): void | ||
{ | ||
function () { | ||
$this->count($args = func_get_args(), 1); | ||
Assert::count($args = func_get_args(), 1); | ||
}; | ||
} | ||
|
||
public function run2(): void | ||
{ | ||
function innerFunc() { | ||
Assert::count($args = func_get_args(), 1); | ||
}; | ||
} | ||
|
||
private function count($args, $value) | ||
{ | ||
Assert::count($args, $value); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector\Fixture; | ||
|
||
use Webmozart\Assert\Assert; | ||
|
||
final class InMethodOrStaticCall2 | ||
{ | ||
public function run(): void | ||
{ | ||
function (...$args) { | ||
$this->count($args, 1); | ||
Assert::count($args, 1); | ||
}; | ||
} | ||
|
||
public function run2(): void | ||
{ | ||
function innerFunc(...$args) { | ||
Assert::count($args, 1); | ||
}; | ||
} | ||
|
||
private function count($args, $value) | ||
{ | ||
Assert::count($args, $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