According to my researches, here is what I've found:
The argument interpreter is created in the lib\internal\Magento\Framework\App\ObjectManagerFactory.php :
protected function createArgumentInterpreter( \Magento\Framework\Stdlib\BooleanUtils $booleanUtils ) { $constInterpreter = new \Magento\Framework\Data\Argument\Interpreter\Constant(); $result = new \Magento\Framework\Data\Argument\Interpreter\Composite( [ 'boolean' => new \Magento\Framework\Data\Argument\Interpreter\Boolean($booleanUtils), 'string' => new \Magento\Framework\Data\Argument\Interpreter\StringUtils($booleanUtils), 'number' => new \Magento\Framework\Data\Argument\Interpreter\Number(), 'null' => new \Magento\Framework\Data\Argument\Interpreter\NullType(), 'object' => new \Magento\Framework\Data\Argument\Interpreter\DataObject($booleanUtils), 'const' => $constInterpreter, 'init_parameter' => new \Magento\Framework\App\Arguments\ArgumentInterpreter($constInterpreter), ], \Magento\Framework\ObjectManager\Config\Reader\Dom::TYPE_ATTRIBUTE ); // Add interpreters that reference the composite $result->addInterpreter('array', new \Magento\Framework\Data\Argument\Interpreter\ArrayType($result)); return $result; }
In this code, you can clearly see that different interpreters are used based on the type attribute of the argument \Magento\Framework\ObjectManager\Config\Reader\Dom::TYPE_ATTRIBUTE:
- boolean =>
\Magento\Framework\Data\Argument\Interpreter\Boolean - string =>
\Magento\Framework\Data\Argument\Interpreter\StringUtils - number =>
\Magento\Framework\Data\Argument\Interpreter\Number - null =>
\Magento\Framework\Data\Argument\Interpreter\NullType - object =>
\Magento\Framework\Data\Argument\Interpreter\DataObject - const =>
\Magento\Framework\Data\Argument\Interpreter\Constant - init_parameter =>
\Magento\Framework\App\Arguments\ArgumentInterpreter (note that this one takes the \Magento\Framework\Data\Argument\Interpreter\Constant as parameter and not the constructor parameter)
Also an extra interpreter is added on the fly to handle array types:
- array =>
\Magento\Framework\Data\Argument\Interpreter\ArrayType
Note: it seems like the init_parameter type is only used in the app\code\Magento\Store\etc\di.xml to initiate some constants:
<argument name="xFrameOpt" xsi:type="init_parameter">Magento\Framework\App\Response\XFrameOptPlugin::DEPLOYMENT_CONFIG_X_FRAME_OPT</argument> ... <argument name="isCustomEntryPoint" xsi:type="init_parameter">Magento\Store\Model\Store::CUSTOM_ENTRY_POINT_PARAM</argument> ... <argument name="runMode" xsi:type="init_parameter">Magento\Store\Model\StoreManager::PARAM_RUN_TYPE</argument> <argument name="scopeCode" xsi:type="init_parameter">Magento\Store\Model\StoreManager::PARAM_RUN_CODE</argument>
staticinstead of aconstfor such an argument? I can't seem to find a type that works for astaticfield in my class :-(static