I have a class which I cannot edit with the following constructor:
/**
* @param int|null $maxBodyLength
* @param string $binaryDetectionRegex By default, this is all non-printable ASCII characters and <DEL> except for t, r, n
*/
public function __construct($maxBodyLength = 1000, string $binaryDetectionRegex = '/([x00-x09x0Cx0E-x1Fx7F])/')
{
$this->maxBodyLength = $maxBodyLength;
$this->binaryDetectionRegex = $binaryDetectionRegex;
}
Using services.xml I want to set maxBodyLength
to null
. Doing this works:
<service id="meteor.api_logger.formatter" class="HttpMessageFormatterFullHttpMessageFormatter">
<argument>null</argument>
</service>
But when I use a named parameter as preferred I get an error:
<service id="meteor.api_logger.formatter" class="HttpMessageFormatterFullHttpMessageFormatter">
<argument key="$maxBodyLength">null</argument>
</service>
In AbstractRecursivePass.php line 174:
Invalid service "meteor.api_logger.formatter": class "HttpMessageFormatterFullHttpMessageFormatter" does not exist.
Already tried:
- Also passing the other argument in services.xml
- Removing
$
from the key - Using 0 instead of
null
- Using
<argument key="$maxBodyLength"/>
All gave the same error. How to use named arguments to pass value null
?
2