Skip to content

Commit

Permalink
PhpGenerator: warns about suspicious dumping of objects
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Feb 4, 2024
1 parent 6949d80 commit 22790be
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/DI/PhpGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ public function convertArguments(array $args): array
} else {
$val = ContainerBuilder::literal('$this->getService(?)', [$name]);
}
} elseif (
is_object($val)
&& !$val instanceof Php\Literal && !$val instanceof \stdClass && !$val instanceof \UnitEnum
) {
trigger_error(sprintf('Nette DI: dumping the %s object when generating the container looks like a bug', $val::class));
}
});
return $args;
Expand Down

0 comments on commit 22790be

Please sign in to comment.