-
-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php72] Handle crash on CreateFunctionToAnonymousFunctionRector on qu…
…oted variable arg concat (#3300) Co-authored-by: GitHub Action <action@github.com>
- Loading branch information
1 parent
d2a553c
commit 93b225a
Showing
3 changed files
with
99 additions
and
6 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...ncCall/CreateFunctionToAnonymousFunctionRector/Fixture/quoted_variable_arg_concat.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\Php72\Rector\FuncCall\CreateFunctionToAnonymousFunctionRector\Fixture; | ||
|
||
class QuotedVariableArgConcat | ||
{ | ||
public function pk_gen() | ||
{ | ||
$argL = func_get_args(); | ||
$strFunc = array_shift($argL); | ||
$strArgs = join(', ',$argL); | ||
|
||
return create_function('$v', 'return '.$strFunc.'($v'.$strArgs.');'); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php72\Rector\FuncCall\CreateFunctionToAnonymousFunctionRector\Fixture; | ||
|
||
class QuotedVariableArgConcat | ||
{ | ||
public function pk_gen() | ||
{ | ||
$argL = func_get_args(); | ||
$strFunc = array_shift($argL); | ||
$strArgs = join(', ',$argL); | ||
|
||
return function ($v) use ($strFunc, $strArgs) { | ||
return $strFunc($v . $strArgs); | ||
}; | ||
} | ||
} | ||
|
||
?> |
37 changes: 37 additions & 0 deletions
37
...cCall/CreateFunctionToAnonymousFunctionRector/Fixture/quoted_variable_arg_concat2.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\Php72\Rector\FuncCall\CreateFunctionToAnonymousFunctionRector\Fixture; | ||
|
||
class QuotedVariableArgConcat2 | ||
{ | ||
public function pk_gen() | ||
{ | ||
$argL = func_get_args(); | ||
$strFunc = array_shift($argL); | ||
$strArgs = join(', ',$argL); | ||
|
||
return create_function('$v', 'return '.$strFunc.'('.$strArgs.'$v);'); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php72\Rector\FuncCall\CreateFunctionToAnonymousFunctionRector\Fixture; | ||
|
||
class QuotedVariableArgConcat2 | ||
{ | ||
public function pk_gen() | ||
{ | ||
$argL = func_get_args(); | ||
$strFunc = array_shift($argL); | ||
$strArgs = join(', ',$argL); | ||
|
||
return function ($v) use ($strFunc, $strArgs) { | ||
return $strFunc($strArgs . $v); | ||
}; | ||
} | ||
} | ||
|
||
?> |
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