rector: [Parallel]: Class was not found while trying to analyse it

Bug Report

Subject Details
Rector version 0.12.10

Minimal PHP Code Causing Issue

When enable parallel option, it can got error:

 [ERROR] Could not process "tests/system/Files/FileCollectionTest.php" file, due to:                                    
         "System error: "Class FileCollectionTest was not found while trying to analyse it - discovering symbols is     
         probably not configured properly."                                                                             
         Run Rector with "--debug" option and post the report here: https://github.com/rectorphp/rector/issues/new". On 
         line: 45     

Step to reproduce:

  1. Clone repo
git clone git@github.com:codeigniter4/CodeIgniter4.git
  1. Run composer install
composer install
  1. Open rector.php, add option parall:
$parameters->set(Option::PARALLEL, true);
  1. Run against tests directory:
vendor/bin/rector process tests

Expected Behaviour

It should show [OK] Rector is done! without diff and error:

vendor/bin/rector process tests 
 257/257 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

                                                                                                                        
 [OK] Rector is done!                                                                                    

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 32 (9 by maintainers)

Most upvoted comments

@MGatner how about add vendor/codeigniter4/framework/system/Test/bootstrap.php into “files” config in composer.json? Ref https://github.com/rectorphp/rector/blob/main/docs/static_reflection_and_autoload.md#dealing-with-class--was-not-found-while-trying-to-analyse-it

If I strip that one file down to the following (note public property)

vendor/bin/rector process tests/system/Files/FileCollectionTest.php --debug --clear-cache
<?php
class FileCollectionTest
{
    public $test = '';
}

Then its fine, but change the property back to private and then it breaks consistently.

<?php
class FileCollectionTest
{
    private $test = '';
}
 [ERROR] Could not process "tests/system/Files/FileCollectionTest.php" file, due to:
         "System error: "Class FileCollectionTest was not found while trying to analyse it - discovering symbols is
         probably not configured properly."
         Run Rector with "--debug" option and post the report here: https://github.com/rectorphp/rector/issues/new". On
         line: 45

Even if I change the class name, public property works, private property causes issues.

Hope that helps.