Skip to content
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

[parallel] Let WorkerRunner know about paths, so PHPStan and Rector can handle static reflection over them #1629

Merged
merged 8 commits into from
Jan 4, 2022

Conversation

TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented Jan 4, 2022

Replaces #1613 (closes #1613)

Fixes rectorphp/rector#6903

@TomasVotruba TomasVotruba changed the title tv parallel class not found 2 [parallel] Let WorkerRunner know about paths, so PHPStan and Rector can handle static reflection over them Jan 4, 2022
Comment on lines -36 to +51
if ($matchedExpectedOutput === false) {
echo "\nEXPECTED:\n";
var_dump($expectedOutput);
echo "\nACTUAL:\n";
var_dump($output);
exit(1);
}
// print color diff, to make easy find the differences
$consoleDiffer = new ConsoleDiffer(new Differ(), new ColorConsoleDiffFormatter());
$diff = $consoleDiffer->diff($output, $expectedOutput);
$symfonyStyle->writeln($diff);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The former report only showed full texts and reported "some difference somewhere".

Now the diff only shows which exact line is different 👍 e.g.

image

) {
}

public function run(Encoder $encoder, Decoder $decoder, Configuration $configuration): void
{
$this->dynamicSourceLocatorDecorator->addPaths($configuration->getPaths());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 1st missing part was paths here. That's how we can tell Rector and PHPStan to use static reflection on specific directories

Comment on lines 75 to +78

// 1. allow PHPStan to work with static reflection on provided files
$this->nodeScopeResolver->setAnalysedFiles($filePaths);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2nd missing part was here. Now scope analyzer can work with provided paths.

@TomasVotruba
Copy link
Member Author

@samsonasik Ready for review and merge 👍

@samsonasik
Copy link
Member

@TomasVotruba let's give it a try and let's see if we can add more directory to list of downgrade parallel.

@samsonasik samsonasik merged commit c850701 into main Jan 4, 2022
@samsonasik samsonasik deleted the tv-parallel-class-not-found-2 branch January 4, 2022 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants