mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-01 17:00:51 +00:00
[Downgrade PHP 7.2] Downgrade object type also in Closure (#961)
This commit is contained in:
parent
e9e2877d95
commit
683077ed2a
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\DowngradePhp72\Rector\FunctionLike\DowngradeObjectTypeDeclarationRector\Fixture;
|
||||
|
||||
class AnonymousFunction
|
||||
{
|
||||
public function return()
|
||||
{
|
||||
$callable = function (object $someObject) {
|
||||
// ...
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\DowngradePhp72\Rector\FunctionLike\DowngradeObjectTypeDeclarationRector\Fixture;
|
||||
|
||||
class AnonymousFunction
|
||||
{
|
||||
public function return()
|
||||
{
|
||||
$callable = function ($someObject) {
|
||||
// ...
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Rector\DowngradePhp72\Rector\FunctionLike;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Function_;
|
||||
use PHPStan\Type\ObjectWithoutClassType;
|
||||
|
@ -28,7 +29,7 @@ final class DowngradeObjectTypeDeclarationRector extends AbstractRector
|
|||
*/
|
||||
public function getNodeTypes(): array
|
||||
{
|
||||
return [Function_::class, ClassMethod::class];
|
||||
return [Function_::class, ClassMethod::class, Closure::class];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user