Code Inspection: Fully qualified name usage
Configure inspections: Settings | Editor | Inspections
Show intention actions: AltEnter
Reports the fully qualified class names that can be shortened by adding the use
statement.
By replacing fully qualified class names with import statements, you can avoid repetition of long namespaces and thus improve code readability. For more information, refer to Using namespaces: Aliasing/Importing (php.net).
In the following example, the usage of the \Foo\Bar\Baz
fully qualified name is replaced with the use
statement.
Before
namespace Foo\Bar { class Baz {}}namespace A { new \Foo\Bar\Baz();}
After
namespace Foo\Bar { class Baz {}}namespace A { use Foo\Bar\Baz; new Baz();}
Place the caret at the highlighted line and press AltEnter or click
.
Click the arrow next to the inspection you want to suppress and select the necessary suppress action.