8000 [Application] Move autoload and paths setup to ApplicationFileProcessor by samsonasik · Pull Request #6915 · rectorphp/rector-src · GitHub
[go: up one dir, main page]

Skip to content

[Application] Move autoload and paths setup to ApplicationFileProcessor #6915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0