Reputation: 3451
Throughout our project, we currently have:
use Twig_Environment;
// then later in the file:
Twig_Environment $twig
Twig updated their class namespaces, so that these need to now be:
use Twig\Environment;
// then later in the file:
Environment $tw
Is there refactoring functionality in Phpstorm that will handle this for us? Find/Replace isn't ideal here, due to type hinting, comments, etc.
Upvotes: 0
Views: 52
Reputation: 14927
You could simply alias the class by replacing:
use Twig_Environment;
with:
use Twig\Environment as Twig_Environment;
This will allow you to continue using Twig_Environment
everywhere else in the file.
To do so, you could use PHPStorm's find and replace feature (which should be safe):
^\s*use\s+Twig_Environment\s*;
use Twig\\Environment as Twig_Environment;
In any case, and especially if you're not using any VCS, you should backup your code beforehand and make sure it works on a few individual files first.
Upvotes: 5