Skip to content

Commit

Permalink
Updated Rector to commit f8c204a
Browse files Browse the repository at this point in the history
rectorphp/rector-src@f8c204a [Naming] Handle Grouped use import on UseImportsResolver (#2348)
  • Loading branch information
TomasVotruba committed May 22, 2022
1 parent b7c661c commit 291f513
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 23 deletions.
22 changes: 18 additions & 4 deletions rules/Naming/Naming/UseImportsResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
namespace Rector\Naming\Naming;

use PhpParser\Node;
use PhpParser\Node\Stmt;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\GroupUse;
use PhpParser\Node\Stmt\Namespace_;
use PhpParser\Node\Stmt\Use_;
use PhpParser\Node\Stmt\UseUse;
use Rector\Core\PhpParser\Node\BetterNodeFinder;
use Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace;
final class UseImportsResolver
Expand All @@ -29,8 +31,20 @@ public function resolveForNode(\PhpParser\Node $node) : array
if (!$namespace instanceof \PhpParser\Node) {
return [];
}
return \array_filter($namespace->stmts, function (\PhpParser\Node\Stmt $stmt) : bool {
return $stmt instanceof \PhpParser\Node\Stmt\Use_;
});
$collectedUses = [];
foreach ($namespace->stmts as $stmt) {
if ($stmt instanceof \PhpParser\Node\Stmt\Use_) {
$collectedUses[] = $stmt;
continue;
}
if ($stmt instanceof \PhpParser\Node\Stmt\GroupUse) {
$groupUseUses = [];
foreach ($stmt->uses as $useUse) {
$groupUseUses[] = new \PhpParser\Node\Stmt\UseUse(new \PhpParser\Node\Name($stmt->prefix . '\\' . $useUse->name), $useUse->alias, $useUse->type, $useUse->getAttributes());
}
$collectedUses[] = new \PhpParser\Node\Stmt\Use_($groupUseUses, $stmt->type, $stmt->getAttributes());
}
}
return $collectedUses;
}
}
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = 'a9c6d9bd06515b5e5bbbcad3b2f7e70d3ab59125';
public const PACKAGE_VERSION = 'f8c204adba7515823ad213f30d541bf87e921177';
/**
* @var string
*/
public const RELEASE_DATE = '2022-05-22 18:59:41';
public const RELEASE_DATE = '2022-05-22 19:34:31';
/**
* @var string
*/
Expand Down
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@

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

return ComposerAutoloaderInit98a9c775c4ee7c5a6022830708dc870a::getLoader();
return ComposerAutoloaderInit59fe6508ef1d2d638f1b1f715bc608ed::getLoader();
14 changes: 7 additions & 7 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 ComposerAutoloaderInit98a9c775c4ee7c5a6022830708dc870a
class ComposerAutoloaderInit59fe6508ef1d2d638f1b1f715bc608ed
{
private static $loader;

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

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

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

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

$includeFiles = \Composer\Autoload\ComposerStaticInit98a9c775c4ee7c5a6022830708dc870a::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit59fe6508ef1d2d638f1b1f715bc608ed::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire98a9c775c4ee7c5a6022830708dc870a($fileIdentifier, $file);
composerRequire59fe6508ef1d2d638f1b1f715bc608ed($fileIdentifier, $file);
}

return $loader;
Expand All @@ -46,7 +46,7 @@ public static function getLoader()
* @param string $file
* @return void
*/
function composerRequire98a9c775c4ee7c5a6022830708dc870a($fileIdentifier, $file)
function composerRequire59fe6508ef1d2d638f1b1f715bc608ed($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 ComposerStaticInit98a9c775c4ee7c5a6022830708dc870a
class ComposerStaticInit59fe6508ef1d2d638f1b1f715bc608ed
{
public static $files = array (
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
Expand Down Expand Up @@ -3909,9 +3909,9 @@ class ComposerStaticInit98a9c775c4ee7c5a6022830708dc870a
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit98a9c775c4ee7c5a6022830708dc870a::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit98a9c775c4ee7c5a6022830708dc870a::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit98a9c775c4ee7c5a6022830708dc870a::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit59fe6508ef1d2d638f1b1f715bc608ed::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit59fe6508ef1d2d638f1b1f715bc608ed::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit59fe6508ef1d2d638f1b1f715bc608ed::$classMap;

}, null, ClassLoader::class);
}
Expand Down
10 changes: 5 additions & 5 deletions vendor/scoper-autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20220522\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit98a9c775c4ee7c5a6022830708dc870a', false) && !interface_exists('ComposerAutoloaderInit98a9c775c4ee7c5a6022830708dc870a', false) && !trait_exists('ComposerAutoloaderInit98a9c775c4ee7c5a6022830708dc870a', false)) {
spl_autoload_call('RectorPrefix20220522\ComposerAutoloaderInit98a9c775c4ee7c5a6022830708dc870a');
if (!class_exists('ComposerAutoloaderInit59fe6508ef1d2d638f1b1f715bc608ed', false) && !interface_exists('ComposerAutoloaderInit59fe6508ef1d2d638f1b1f715bc608ed', false) && !trait_exists('ComposerAutoloaderInit59fe6508ef1d2d638f1b1f715bc608ed', false)) {
spl_autoload_call('RectorPrefix20220522\ComposerAutoloaderInit59fe6508ef1d2d638f1b1f715bc608ed');
}
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
spl_autoload_call('RectorPrefix20220522\Helmich\TypoScriptParser\Parser\AST\Statement');
Expand Down Expand Up @@ -59,9 +59,9 @@ function print_node() {
return \RectorPrefix20220522\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire98a9c775c4ee7c5a6022830708dc870a')) {
function composerRequire98a9c775c4ee7c5a6022830708dc870a() {
return \RectorPrefix20220522\composerRequire98a9c775c4ee7c5a6022830708dc870a(...func_get_args());
if (!function_exists('composerRequire59fe6508ef1d2d638f1b1f715bc608ed')) {
function composerRequire59fe6508ef1d2d638f1b1f715bc608ed() {
return \RectorPrefix20220522\composerRequire59fe6508ef1d2d638f1b1f715bc608ed(...func_get_args());
}
}
if (!function_exists('scanPath')) {
Expand Down

0 comments on commit 291f513

Please sign in to comment.