Updated Rector to commit 5bf03c420e523f365ccc67eebb3f045e854caf55

5bf03c420e [Configuration] Fix detect /vendor on root project on vendor analyzed on VendorMissAnalyseGuard (#5569)
This commit is contained in:
Tomas Votruba 2024-02-07 00:22:31 +00:00
parent 1cd18a76ae
commit 9d4b461bdb
3 changed files with 6 additions and 4 deletions

View File

@ -102,7 +102,7 @@ final class ApplicationFileProcessor
{
$filePaths = $this->fileFactory->findFilesInPaths($configuration->getPaths(), $configuration);
if ($this->vendorMissAnalyseGuard->isVendorAnalyzed($filePaths)) {
$this->symfonyStyle->warning(\sprintf('Rector is running on your "/vendor" directory. This is not necessary, as Rector access /vendor by composer autoload. It will cause Rector tu run much slower and possibly with errors.%sRemove "/vendor" from Rector paths and run again.', \PHP_EOL . \PHP_EOL));
$this->symfonyStyle->warning(\sprintf('Rector has detected a "/vendor" directory in your configured paths. If this is Composer\'s vendor directory, this is not necessary as it will be autoloaded. Scanning the Composer vendor directory will cause Rector to run much slower and possibly with errors.%sRemove "/vendor" from Rector paths and run again.', \PHP_EOL . \PHP_EOL));
\sleep(3);
}
// no files found

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '6fe258536fc4a7fb903bea8eef548d37e1de8df5';
public const PACKAGE_VERSION = '5bf03c420e523f365ccc67eebb3f045e854caf55';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-02-07 05:52:02';
public const RELEASE_DATE = '2024-02-07 07:20:04';
/**
* @var int
*/

View File

@ -32,8 +32,10 @@ final class VendorMissAnalyseGuard
*/
private function containsVendorPath(array $filePaths) : bool
{
$cwd = PathNormalizer::normalize(\getcwd());
foreach ($filePaths as $filePath) {
if (\strpos(PathNormalizer::normalize($filePath), '/vendor/') !== \false) {
$normalizedPath = PathNormalizer::normalize(\realpath($filePath));
if (\strncmp(\substr($normalizedPath, \strlen($cwd)), '/vendor', \strlen('/vendor')) === 0) {
return \true;
}
}