/** * {@inheritdoc} */ public function transform(ParameterBag $item) { $transformer = new EmptyValueToNullTransformer(); // check for any default values that could be set foreach ($this->defaultValues as $key => $value) { // only set when it's not existing in the data or has no value if (!$item->has($key) || null === $transformer->transform($item->get($key), $key, $item) || $this->overwrite) { $item->set($key, $value); } } }
/** * @dataProvider getNonEmptyValues */ public function testNonEmptyValues($value) { $this->assertNotNull($this->transformer->transform($value)); }