Skip to content

how to get dependency graphs – problems in generated code

I am trying to look at dependency graphs by setting MAGE_PROFILER=2, as explained here.

When I do, I get an error like

Fatal error: Declaration of MagentoFrameworkInterceptionConfigCacheManagerLogger::load(string $key) must be compatible with MagentoFrameworkInterceptionConfigCacheManager::load(string $key): ?array in /var/www/html/generated/code/Magento/Framework/Interception/Config/CacheManager/Logger.php on line 69

The problem is that the load method doesn’t have a return type set.

I can go in fix the file by hand in generated/, but there are many such errors — and editing generated code by hand isn’t sustainable in any case.

Do you need to do something special for generated code to include return type annotations?
Or is there a way to disable the check?

I’ve observed this problem both in a large production codebase as well as in a bare bones, nearly stock installation. And with both php 8.2 and 8.1.