Skip to content

Commit

Permalink
Add documentation explanatio for auto-import
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jan 15, 2023
1 parent 751890e commit cd2352c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion docs/book/v1/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ return static function (RectorConfig $rectorConfig): void {
};
```

If you want to make renamed class type hint auto import enabled, you may use `SetList::LAMINAS_SERVICEMANGER_40_AUTO_IMPORT` set list, so the `rector.php` config will be as follow:
Rector works with all class names as fully qualified by default.In the most projects, that's not a desired behavior, because short version with use statement is easier to read.

To import FQCN, configure rector.php with:

```php
$rectorConfig->importNames();
```

If you want to make renamed class type hint to use short name with import its fully qualified ot use statement, you may use `SetList::LAMINAS_SERVICEMANGER_40_AUTO_IMPORT` set list that utilize `$rectorConfig->importNames()` on it, so the `rector.php` config will be as follow:

```php
use Laminas\ServiceManager\Migration\Rector\Set\ValueObject\SetList;
Expand Down

0 comments on commit cd2352c

Please sign in to comment.