Description
Describe the bug
Constants are marked as unused elements if they are used only in di.xml
. During refactoring, such constants may be deleted, since the developer may forget to check the actual use of such constants, and even more so if there are many of them. The developer can simply trust the IDE and think that the constant is not really used anywhere and get rid of it.
To Reproduce
- Create any class with a public constant
- Use this constant in
di.xml
as an argument withxsi:type="const"
- Go back to your class
- And check that the constant is grayed out and marked as
Unused element
Expected behavior
The constant must be marked as a used element and have the appropriate color
Screenshots

The constant BASE
is highlighted in purple and marked as used, actually used in php code and in di.xml
, Inlay Hints says that it is used in 5 different places.
The constant BASE_LABEL
is highlighted in gray and marked as unused, actually used only in di.xml
, Inlay Hints says that it is used in 1 place.
Please complete the following information:
- OS: MacOS
- PhpStorm version: 2023.1.2
- Plugin Version: 5.1.1
Additional context
If you activate Inlay Hints, the number of uses for this constant will be greater than 0, and when you click on 1 usage
, the transition to di.xml
on the line where this constant is actually used.
