Skip to content

Commit

Permalink
Updated Rector to commit 79953f61e341fdb7263316b34eeaa2be737d12ef
Browse files Browse the repository at this point in the history
rectorphp/rector-src@79953f6 [TypeDeclaration] Add Closure support on StrictArrayParamDimFetchRector (#4632)
  • Loading branch information
TomasVotruba committed Aug 3, 2023
1 parent 59b728d commit 3619383
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
use PhpParser\Node\Expr\ArrayDimFetch;
use PhpParser\Node\Expr\AssignOp\Coalesce as AssignOpCoalesce;
use PhpParser\Node\Expr\BinaryOp\Coalesce;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\FunctionLike;
use PhpParser\Node\Identifier;
use PhpParser\Node\Param;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use PhpParser\NodeTraverser;
Expand Down Expand Up @@ -59,10 +62,10 @@ public function resolve(array $item)
*/
public function getNodeTypes() : array
{
return [ClassMethod::class, Function_::class];
return [ClassMethod::class, Function_::class, Closure::class];
}
/**
* @param ClassMethod|Function_ $node
* @param ClassMethod|Function_|Closure $node
*/
public function refactor(Node $node) : ?Node
{
Expand All @@ -86,13 +89,19 @@ public function refactor(Node $node) : ?Node
return null;
}
/**
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_ $functionLike
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure $functionLike
*/
private function isParamAccessedArrayDimFetch(Param $param, $functionLike) : bool
{
if ($functionLike->stmts === null) {
return \false;
}
$paramName = $this->getName($param);
$isParamAccessedArrayDimFetch = \false;
$this->traverseNodesWithCallable($functionLike, function (Node $node) use($paramName, &$isParamAccessedArrayDimFetch) : ?int {
$this->traverseNodesWithCallable($functionLike->stmts, function (Node $node) use($paramName, &$isParamAccessedArrayDimFetch) : ?int {
if ($node instanceof Class_ || $node instanceof FunctionLike) {
return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
}
if ($this->shouldStop($node, $paramName)) {
// force set to false to avoid too early replaced
$isParamAccessedArrayDimFetch = \false;
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '36e88e13e5d41db048494b497d59ae0e96c877f0';
public const PACKAGE_VERSION = '79953f61e341fdb7263316b34eeaa2be737d12ef';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-08-03 20:52:40';
public const RELEASE_DATE = '2023-08-03 21:00:56';
/**
* @var int
*/
Expand Down
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit3d41daa140625cb5a46044552327926a::getLoader();
return ComposerAutoloaderInitf3635f7070cdd35c0d9b3bdb494eb86c::getLoader();
10 changes: 5 additions & 5 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit3d41daa140625cb5a46044552327926a
class ComposerAutoloaderInitf3635f7070cdd35c0d9b3bdb494eb86c
{
private static $loader;

Expand All @@ -22,17 +22,17 @@ public static function getLoader()
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInit3d41daa140625cb5a46044552327926a', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitf3635f7070cdd35c0d9b3bdb494eb86c', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit3d41daa140625cb5a46044552327926a', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitf3635f7070cdd35c0d9b3bdb494eb86c', 'loadClassLoader'));

require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit3d41daa140625cb5a46044552327926a::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitf3635f7070cdd35c0d9b3bdb494eb86c::getInitializer($loader));

$loader->setClassMapAuthoritative(true);
$loader->register(true);

$filesToLoad = \Composer\Autoload\ComposerStaticInit3d41daa140625cb5a46044552327926a::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInitf3635f7070cdd35c0d9b3bdb494eb86c::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInit3d41daa140625cb5a46044552327926a
class ComposerStaticInitf3635f7070cdd35c0d9b3bdb494eb86c
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
Expand Down Expand Up @@ -3025,9 +3025,9 @@ class ComposerStaticInit3d41daa140625cb5a46044552327926a
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit3d41daa140625cb5a46044552327926a::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit3d41daa140625cb5a46044552327926a::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit3d41daa140625cb5a46044552327926a::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitf3635f7070cdd35c0d9b3bdb494eb86c::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitf3635f7070cdd35c0d9b3bdb494eb86c::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitf3635f7070cdd35c0d9b3bdb494eb86c::$classMap;

}, null, ClassLoader::class);
}
Expand Down

0 comments on commit 3619383

Please sign in to comment.