Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,11 @@ public function getConfigTreeBuilder()
->end()
->scalarNode('formatter')->defaultNull()->end()
->scalarNode('captured_body_length')
->beforeNormalization()
->always(function ($maxLength) {
if (null === $maxLength) {
return null;
}

if (!is_int($maxLength)) {
$invalidConfiguration = new InvalidConfigurationException('The child node "captured_body_length" at path "httplug.profiling" must be an integer or null.');
$invalidConfiguration->setPath('httplug.profiling');

throw $invalidConfiguration;
}

return $maxLength;
->validate()
->ifTrue(function ($v) {
return null !== $v && !is_int($v);
})
->thenInvalid('The child node "captured_body_length" at path "httplug.profiling" must be an integer or null ("%s" given).')
->end()
->defaultValue(0)
->info('Limit long HTTP message bodies to x characters. If set to 0 we do not read the message body. If null the body will not be truncated. Only available with the default formatter (FullHttpMessageFormatter).')
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ public function testLimitlessCapturedBodyLength()

/**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
* @expectedExceptionMessage The child node "captured_body_length" at path "httplug.profiling" must be an integer or null.
* @expectedExceptionMessage The child node "captured_body_length" at path "httplug.profiling" must be an integer or null
*/
public function testInvalidCapturedBodyLengthString()
{
Expand Down