mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-25 20:32:35 +00:00
[DowngradePhp80] Handle DowngradeMixedTypeDeclarationRector on Closure (#106)
Co-authored-by: kaizen-ci <info@kaizen-ci.org>
This commit is contained in:
parent
21dc1db942
commit
ed8487954d
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\DowngradePhp80\Rector\FunctionLike\DowngradeMixedTypeDeclarationRector\Fixture;
|
||||
|
||||
class OnClosure
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$foo = array_filter(
|
||||
$list,
|
||||
function (mixed $fieldArgValue) {
|
||||
return is_null($fieldArgValue);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\DowngradePhp80\Rector\FunctionLike\DowngradeMixedTypeDeclarationRector\Fixture;
|
||||
|
||||
class OnClosure
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$foo = array_filter(
|
||||
$list,
|
||||
function ($fieldArgValue) {
|
||||
return is_null($fieldArgValue);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\DowngradePhp80\Rector\FunctionLike;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
use PHPStan\Type\MixedType;
|
||||
|
@ -28,7 +29,7 @@ final class DowngradeMixedTypeDeclarationRector extends AbstractRector
|
|||
*/
|
||||
public function getNodeTypes(): array
|
||||
{
|
||||
return [Function_::class, ClassMethod::class];
|
||||
return [Function_::class, ClassMethod::class, Closure::class];
|
||||
}
|
||||
|
||||
public function getRuleDefinition(): RuleDefinition
|
||||
|
|
Loading…
Reference in New Issue
Block a user