Skip to content

Commit

Permalink
[Downgrade PHP 7.2] Downgrade object type also in Closure (#961)
Browse files Browse the repository at this point in the history
  • Loading branch information
leoloso committed Oct 6, 2021
1 parent e9e2877 commit 683077e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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) {
// ...
};
}
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
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;
Expand All @@ -28,7 +29,7 @@ public function __construct(
*/
public function getNodeTypes(): array
{
return [Function_::class, ClassMethod::class];
return [Function_::class, ClassMethod::class, Closure::class];
}

/**
Expand Down

0 comments on commit 683077e

Please sign in to comment.