Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ParameterNotFoundException.php

function ParameterNotFoundException::updateRepr

5 calls to ParameterNotFoundException::updateRepr()
ParameterNotFoundException::setExtraMessage in vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php
ParameterNotFoundException::setSourceExtensionName in vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php
ParameterNotFoundException::setSourceId in vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php
ParameterNotFoundException::setSourceKey in vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php
ParameterNotFoundException::__construct in vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php

File

vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php, line 46

Class

ParameterNotFoundException
This exception is thrown when a non-existent parameter is used.

Namespace

Symfony\Component\DependencyInjection\Exception

Code

public function updateRepr() : void {
    if (null !== $this->sourceId) {
        $this->message = \sprintf('The service "%s" has a dependency on a non-existent parameter "%s".', $this->sourceId, $this->key);
    }
    elseif (null !== $this->sourceKey) {
        $this->message = \sprintf('The parameter "%s" has a dependency on a non-existent parameter "%s".', $this->sourceKey, $this->key);
    }
    elseif (null !== $this->sourceExtensionName) {
        $this->message = \sprintf('You have requested a non-existent parameter "%s" while loading extension "%s".', $this->key, $this->sourceExtensionName);
    }
    elseif ('.' === ($this->key[0] ?? '')) {
        $this->message = \sprintf('Parameter "%s" not found. It was probably deleted during the compilation of the container.', $this->key);
    }
    else {
        $this->message = \sprintf('You have requested a non-existent parameter "%s".', $this->key);
    }
    if ($this->alternatives) {
        if (1 === \count($this->alternatives)) {
            $this->message .= ' Did you mean this: "';
        }
        else {
            $this->message .= ' Did you mean one of these: "';
        }
        $this->message .= implode('", "', $this->alternatives) . '"?';
    }
    elseif (null !== $this->nonNestedAlternative) {
        $this->message .= ' You cannot access nested array items, do you want to inject "' . $this->nonNestedAlternative . '" instead?';
    }
    if ($this->extraMessage) {
        $this->message .= ' ' . $this->extraMessage;
    }
}
RSS feed
Powered by Drupal