Skip to content

Conversation

@samsonasik
Copy link
Member

@samsonasik samsonasik commented May 20, 2025

@marcelthole @boesing while working on alternative PR for EnumCaseToPascalCaseRector:

I realized that when autoload provided, on parallel, the registered autoload input setup gone on parallel. This PR ensure it always included, as on parallel, that means it separate process.

  • to avoid setup autoload via -a gone on parallel because of separate process.
  • ensure the check of

if ($this->dynamicSourceLocatorDecorator->arePathsEmpty()) {

only check registered paths via withPaths() or path provided by command, not include autoloadPaths() because of no paths defined, but defined withPaths() is empty, it never empty:

->withPaths([]) // empty, should STOP, but because we have autoload paths defined
->withAutoloadPaths([__DIR__  . '/../some/file.php']);

and below added too early:

$this->additionalAutoloader->autoloadPaths();

it make never empty.


Last but not least:

I am thinking of discussing the usage of autoloadPaths() more properly, since it currently mix between "autoload" or "include files provided to be analyzed".

public function autoloadPaths(): void
{
$autoloadPaths = SimpleParameterProvider::provideArrayParameter(Option::AUTOLOAD_PATHS);
$this->dynamicSourceLocatorDecorator->addPaths($autoloadPaths);
}

but that's different PR to discuss to keep match with current documentation

https://getrector.com/documentation/static-reflection-and-autoload#content-register

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba it is ready for review.

/cc @staabm would be great if you can review as well :), thank you.

@samsonasik
Copy link
Member Author

Ok, it seems there is autoloadFromCommandLine() in bin/rector.php

https://github.com/rectorphp/rector-src/blob/b29132bd65fd8b5adb7226daedc9d22e5214595b/bin/rector.php#L74C21-L96

which seems mixed it.

Closing for now.

@github-actions
Copy link
Contributor

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants