PhpStorm 2022.3 Help

Code Inspection: Fully qualified name usage

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 readbility. See Using namespaces: Aliasing/Importing (php.net) for details.

In the following example, the usage of the \Foo\Bar\Baz fully qualified name is replaced with the use statement.

namespace Foo\Bar { class Baz {} } namespace A { new \Foo\Bar\Baz(); }
namespace Foo\Bar { class Baz {} } namespace A { use Foo\Bar\Baz; new Baz(); }

Suppress an inspection in the editor

  1. Position the caret at the highlighted line and press Alt+Enter or click the Intention action icon.

  2. Click the arrow next to the inspection you want to suppress and select the necessary suppress action.

Last modified: 16 May 2022