Rector: Prevent rewrite of partial namespace imports

Created on 9 May 2020  路  4Comments  路  Source: rectorphp/rector

Given this input

<?php
use Symfony\Component\Validator\Constraints as Assert;

$constraint = new Assert\Blank();

Rector would apply this change

--- Original
+++ New
@@ -1,4 +1,5 @@
 <?php
+use Symfony\Component\Validator\Constraints\Blank;
 use Symfony\Component\Validator\Constraints as Assert;

-$constraint = new Assert\Blank();
+$constraint = new Blank();

How to prevent rector to refactor towards fully qualified imports?

bug easy pick

All 4 comments

What can I do to help? Open a PR with the test case?

Yes :+1:

@TomasVotruba here we go: #3360

Was this page helpful?
0 / 5 - 0 ratings