1
0
mirror of https://github.com/rectorphp/rector.git synced 2025-03-14 04:19:44 +01:00

Updated Rector to commit 449e5ff7e0b30d9cb15e5b31e9cb96d31f4556a7

449e5ff7e0 [Privatization] Skip magic method on PrivatizeFinalClassMethodRector ()
This commit is contained in:
Tomas Votruba 2025-02-13 09:09:11 +00:00
parent c0e2ec7e5c
commit d8deb2ab52
7 changed files with 26 additions and 23 deletions
rules/Privatization/Rector/ClassMethod
src
Application
DependencyInjection
functions
vendor

@ -117,6 +117,9 @@ CODE_SAMPLE
if (!$classMethod->isProtected()) { if (!$classMethod->isProtected()) {
return \true; return \true;
} }
if ($classMethod->isMagic()) {
return \true;
}
// if has parent call, its probably overriding parent one → skip it // if has parent call, its probably overriding parent one → skip it
$hasParentCall = (bool) $this->betterNodeFinder->findFirst((array) $classMethod->stmts, function (Node $node) : bool { $hasParentCall = (bool) $this->betterNodeFinder->findFirst((array) $classMethod->stmts, function (Node $node) : bool {
if (!$node instanceof StaticCall) { if (!$node instanceof StaticCall) {

@ -19,12 +19,12 @@ final class VersionResolver
* @api * @api
* @var string * @var string
*/ */
public const PACKAGE_VERSION = 'e1841aebb73cb1fdc6f330b91555433cbb69ab34'; public const PACKAGE_VERSION = '449e5ff7e0b30d9cb15e5b31e9cb96d31f4556a7';
/** /**
* @api * @api
* @var string * @var string
*/ */
public const RELEASE_DATE = '2025-02-12 00:22:14'; public const RELEASE_DATE = '2025-02-13 16:06:26';
/** /**
* @var int * @var int
*/ */

@ -244,13 +244,13 @@ final class LazyContainerFactory
$rectorConfig = new RectorConfig(); $rectorConfig = new RectorConfig();
$rectorConfig->import(__DIR__ . '/../../config/config.php'); $rectorConfig->import(__DIR__ . '/../../config/config.php');
$rectorConfig->singleton(Application::class, static function (Container $container) : Application { $rectorConfig->singleton(Application::class, static function (Container $container) : Application {
$application = $container->make(ConsoleApplication::class); $consoleApplication = $container->make(ConsoleApplication::class);
$commandNamesToHide = ['list', 'completion', 'help', 'worker']; $commandNamesToHide = ['list', 'completion', 'help', 'worker'];
foreach ($commandNamesToHide as $commandNameToHide) { foreach ($commandNamesToHide as $commandNameToHide) {
$commandToHide = $application->get($commandNameToHide); $commandToHide = $consoleApplication->get($commandNameToHide);
$commandToHide->setHidden(); $commandToHide->setHidden();
} }
return $application; return $consoleApplication;
}); });
$rectorConfig->when(ConsoleApplication::class)->needs('$commands')->giveTagged(Command::class); $rectorConfig->when(ConsoleApplication::class)->needs('$commands')->giveTagged(Command::class);
$rectorConfig->singleton(Inflector::class, static function () : Inflector { $rectorConfig->singleton(Inflector::class, static function () : Inflector {
@ -335,8 +335,8 @@ final class LazyContainerFactory
$rectorConfig->when(OutputFormatterCollector::class)->needs('$outputFormatters')->giveTagged(OutputFormatterInterface::class); $rectorConfig->when(OutputFormatterCollector::class)->needs('$outputFormatters')->giveTagged(OutputFormatterInterface::class);
// required-like setter // required-like setter
$rectorConfig->afterResolving(ArrayAnnotationToAttributeMapper::class, static function (ArrayAnnotationToAttributeMapper $arrayAnnotationToAttributeMapper, Container $container) : void { $rectorConfig->afterResolving(ArrayAnnotationToAttributeMapper::class, static function (ArrayAnnotationToAttributeMapper $arrayAnnotationToAttributeMapper, Container $container) : void {
$annotationToAttributesMapper = $container->make(AnnotationToAttributeMapper::class); $annotationToAttributeMapper = $container->make(AnnotationToAttributeMapper::class);
$arrayAnnotationToAttributeMapper->autowire($annotationToAttributesMapper); $arrayAnnotationToAttributeMapper->autowire($annotationToAttributeMapper);
}); });
$rectorConfig->afterResolving(ArrayItemNodeAnnotationToAttributeMapper::class, static function (ArrayItemNodeAnnotationToAttributeMapper $arrayItemNodeAnnotationToAttributeMapper, Container $container) : void { $rectorConfig->afterResolving(ArrayItemNodeAnnotationToAttributeMapper::class, static function (ArrayItemNodeAnnotationToAttributeMapper $arrayItemNodeAnnotationToAttributeMapper, Container $container) : void {
$annotationToAttributeMapper = $container->make(AnnotationToAttributeMapper::class); $annotationToAttributeMapper = $container->make(AnnotationToAttributeMapper::class);
@ -375,17 +375,17 @@ final class LazyContainerFactory
private function createPHPStanServices(RectorConfig $rectorConfig) : void private function createPHPStanServices(RectorConfig $rectorConfig) : void
{ {
$rectorConfig->singleton(Parser::class, static function (Container $container) { $rectorConfig->singleton(Parser::class, static function (Container $container) {
$phpstanServiceFactory = $container->make(PHPStanServicesFactory::class); $phpStanServicesFactory = $container->make(PHPStanServicesFactory::class);
return $phpstanServiceFactory->createPHPStanParser(); return $phpStanServicesFactory->createPHPStanParser();
}); });
$rectorConfig->singleton(Lexer::class, static function (Container $container) { $rectorConfig->singleton(Lexer::class, static function (Container $container) {
$phpstanServiceFactory = $container->make(PHPStanServicesFactory::class); $phpStanServicesFactory = $container->make(PHPStanServicesFactory::class);
return $phpstanServiceFactory->createEmulativeLexer(); return $phpStanServicesFactory->createEmulativeLexer();
}); });
foreach (self::PUBLIC_PHPSTAN_SERVICE_TYPES as $publicPhpstanServiceType) { foreach (self::PUBLIC_PHPSTAN_SERVICE_TYPES as $publicPhpstanServiceType) {
$rectorConfig->singleton($publicPhpstanServiceType, static function (Container $container) use($publicPhpstanServiceType) { $rectorConfig->singleton($publicPhpstanServiceType, static function (Container $container) use($publicPhpstanServiceType) {
$phpstanServiceFactory = $container->make(PHPStanServicesFactory::class); $phpStanServicesFactory = $container->make(PHPStanServicesFactory::class);
return $phpstanServiceFactory->getByType($publicPhpstanServiceType); return $phpStanServicesFactory->getByType($publicPhpstanServiceType);
}); });
} }
} }

@ -29,12 +29,12 @@ if (!\function_exists('dump_node')) {
*/ */
function dump_node($node) : void function dump_node($node) : void
{ {
$symfonyStyle = Container::getInstance()->make(SymfonyStyleFactory::class)->create(); $rectorStyle = Container::getInstance()->make(SymfonyStyleFactory::class)->create();
// we turn up the verbosity so it's visible in tests overriding the // we turn up the verbosity so it's visible in tests overriding the
// default which is to be quite during tests // default which is to be quite during tests
$symfonyStyle->setVerbosity(OutputInterface::VERBOSITY_VERBOSE); $rectorStyle->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
$symfonyStyle->newLine(); $rectorStyle->newLine();
$nodePrinter = new NodePrinter($symfonyStyle); $nodePrinter = new NodePrinter($rectorStyle);
$nodePrinter->printNodes($node); $nodePrinter->printNodes($node);
} }
} }

@ -512,8 +512,8 @@
}, },
{ {
"name": "illuminate\/container", "name": "illuminate\/container",
"version": "v11.42.0", "version": "v11.42.1",
"version_normalized": "11.42.0.0", "version_normalized": "11.42.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https:\/\/github.com\/illuminate\/container.git", "url": "https:\/\/github.com\/illuminate\/container.git",
@ -569,8 +569,8 @@
}, },
{ {
"name": "illuminate\/contracts", "name": "illuminate\/contracts",
"version": "v11.42.0", "version": "v11.42.1",
"version_normalized": "11.42.0.0", "version_normalized": "11.42.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https:\/\/github.com\/illuminate\/contracts.git", "url": "https:\/\/github.com\/illuminate\/contracts.git",

File diff suppressed because one or more lines are too long

@ -14,7 +14,7 @@ $loader = (static function () {
// Restore the backup and ensure the excluded files are properly marked as loaded // Restore the backup and ensure the excluded files are properly marked as loaded
$GLOBALS['__composer_autoload_files'] = \array_merge( $GLOBALS['__composer_autoload_files'] = \array_merge(
$existingComposerAutoloadFiles, $existingComposerAutoloadFiles,
\array_fill_keys(['5928a00fa978807cf85d90ec3f4b0147', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a'], true) \array_fill_keys(['0e6d7bf4a5811bfa5cf40c5ccd6fae6a', '5928a00fa978807cf85d90ec3f4b0147'], true)
); );
return $loader; return $loader;