How to use rector with Yii2?

Hello,

I trying to run rector on my yii2-app-advanced based code, but got errors.

the steps i done:
git clone https://github.com/yiisoft/yii2-app-advanced.git
cd yii2-app-advanced
composer install
I am using rector with phpqa https://phpqa.io/projects/rector.html
phpqa rector process common/ --level code-quality

errors:
[ERROR] Could not process "/project/common/fixtures/UserFixture.php" file, due to: "Analyze error: "Class common\fixtures\UserFixture was not found while trying to analyse it - autoloading is probably not configured properly.". Include your files in "parameters > autoload_paths". See https://github.com/rectorphp/rector#extra-autoloading".

new test with autoload-file
phpqa rector process common/ --level code-quality --autoload-file vendor/autoload.php

got same errors.
can someone please help me with this?

Ok, i figured it out.
I had to setup the autoload_paths in rector.yaml as this:

# rector.yaml
parameters:
  exclude_paths:
    - 'vendor/*'
  autoload_paths:
    - '.'
1 Like

I always thought phpqa is just a listing of projects, not a tool :slight_smile: