magento_trace_dependency
Traces how Magento resolves a PHP class or interface by parsing di.xml files to find preferences, plugins, virtualTypes, and constructor overrides, aiding in debugging dependency injection errors.
Instructions
Trace dependency injection graph for a PHP class or interface. Parses di.xml files across all modules to find: preferences (interface→implementation), plugins (interceptors), virtualTypes, and constructor argument overrides. Use this to understand how Magento resolves a class at runtime — especially useful for "Cannot instantiate interface" errors.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| className | Yes | Full or partial PHP class/interface name to trace. Examples: "ProductRepositoryInterface", "CartManagementInterface", "LoggerInterface", "StoreManagerInterface" | |
| direction | No | "resolve" finds what implements/replaces this class (preferences, virtualTypes). "dependents" finds what depends on this class (plugins, type arguments). "both" does both. Default: both. | both |