8000 minor #43647 [DependencyInjection] show class name on DI errors (hhoe… · symfony/symfony@617a612 · GitHub
[go: up one dir, main page]

Skip to content

Commit 617a612

Browse files
committed
minor #43647 [DependencyInjection] show class name on DI errors (hhoechtl)
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [DependencyInjection] show class name on DI errors #43645 | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fix #43645 | License | MIT Commits ------- b74c36a [DependencyInjection] show class name on DI errors
2 parents ee53863 + b74c36a commit 617a612

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Symfony/Component/DependencyInjection/Definition.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,15 +265,15 @@ public function addArgument($argument)
265265
public function replaceArgument($index, $argument)
266266
{
267267
if (0 === \count($this->arguments)) {
268-
throw new OutOfBoundsException('Cannot replace arguments if none have been configured yet.');
268+
throw new OutOfBoundsException(sprintf('Cannot replace arguments for class "%s" if none have been configured yet.', $this->class));
269269
}
270270

271271
if (\is_int($index) && ($index < 0 || $index > \count($this->arguments) - 1)) {
272-
throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, \count($this->arguments) - 1));
272+
throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d] of the arguments of class "%s".', $index, \count($this->arguments) - 1, $this->class));
273273
}
274274

275275
if (!\array_key_exists($index, $this->arguments)) {
276-
throw new OutOfBoundsException(sprintf('The argument "%s" doesn\'t exist.', $index));
276+
throw new OutOfBoundsException(sprintf('The argument "%s" doesn\'t exist in class "%s".', $index, $this->class));
277277
}
278278

279279
$this->arguments[$index] = $argument;
@@ -318,7 +318,7 @@ public function getArguments()
318318
public function getArgument($index)
319319
{
320320
if (!\array_key_exists($index, $this->arguments)) {
321-
throw new OutOfBoundsException(sprintf('The argument "%s" doesn\'t exist.', $index));
321+
throw new OutOfBoundsException(sprintf('The argument "%s" doesn\'t exist in class "%s".', $index, $this->class));
322322
}
323323

324324
return $this->arguments[$index];

0 commit comments

Comments
 (0)
0