Skip to content

Commit c257fa9

Browse files
committed
PhpGenerator: warns about suspicious dumping of objects
1 parent 1fbc8f9 commit c257fa9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/DI/PhpGenerator.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ public function convertArguments(array $args): array
179179
} else {
180180
$val = ContainerBuilder::literal('$this->getService(?)', [$name]);
181181
}
182+
} elseif (
183+
is_object($val)
184+
&& !$val instanceof Php\Literal && !$val instanceof \stdClass && !$val instanceof \UnitEnum
185+
) {
186+
trigger_error(sprintf('Nette DI: suspicious dumping of objects %s when generating the container', $val::class));
182187
}
183188
});
184189
return $args;

0 commit comments

Comments
 (0)