Skip to content

Revert "Revert "use NewOptimizedDirectorySourceLocator""#4846

Merged
samsonasik merged 3 commits intomainfrom
revert-4845-revert-4844-remove-unused-patches
Aug 24, 2023
Merged

Revert "Revert "use NewOptimizedDirectorySourceLocator""#4846
samsonasik merged 3 commits intomainfrom
revert-4845-revert-4844-remove-unused-patches

Conversation

@samsonasik
Copy link
Copy Markdown
Member

Reverts #4845

@samsonasik
Copy link
Copy Markdown
Member Author

@TomasVotruba I am looking why new PHPStan 1.10.31 cause error:

https://github.com/rectorphp/rector-src/actions/runs/5965825544/job/16184110293#step:10:19

@TomasVotruba
Copy link
Copy Markdown
Member

TomasVotruba commented Aug 24, 2023

Thanks 👍

Could you lock main for the last PHPStan working version? Just so we have passing build and no stress on fixing this

@samsonasik
Copy link
Copy Markdown
Member Author

Ok, I will temporary lock phpstan to [1.10.30](https://github.com/phpstan/phpstan/releases/tag/1.10.30) on separate PR, and continue fixing here.

@samsonasik samsonasik force-pushed the revert-4845-revert-4844-remove-unused-patches branch from dd2aa10 to f54fa71 Compare August 24, 2023 16:27
This reverts commit f54fa71.
@samsonasik
Copy link
Copy Markdown
Member Author

@TomasVotruba since the build is working ok now, let's try this 👍

@samsonasik samsonasik merged commit 3c34942 into main Aug 24, 2023
@samsonasik samsonasik deleted the revert-4845-revert-4844-remove-unused-patches branch August 24, 2023 16:35

foreach ($this->filesByDirectory as $files) {
$sourceLocators[] = new OptimizedDirectorySourceLocator($this->fileNodesFetcher, $this->phpVersion, $files);
foreach ($this->directories as $directory) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@TomasVotruba I tested this in CodeIgniter4 project, it make consistency 1 second faster.

Also make correct apply ::class tested at:

I will check more if this while improve performance, on complex files in target dir, eg contains .xml file, it read unnecessary files, since it fetch files under directory instead of read only listed files in the directory.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@TomasVotruba I debugged, the OptimizedDirectorySourceLocatorFactory utilize PHPStan FileFinder that already only cover php extensions, so I guess it already cover only scan php files.

PHPStan\File\FileFinder #3115
   fileExcluder: PHPStan\File\FileExcluder #3113
   fileExtensions: array (1)
   |  0 => 'php'

so I think it already ok 👍

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.

2 participants