[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/symfony/dependency-injection/Exception/ -> ScopeWideningInjectionException.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <fabien@symfony.com>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Component\DependencyInjection\Exception;
  13  
  14  /**
  15   * Thrown when a scope widening injection is detected.
  16   *
  17   * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  18   */
  19  class ScopeWideningInjectionException extends RuntimeException
  20  {
  21      private $sourceServiceId;
  22      private $sourceScope;
  23      private $destServiceId;
  24      private $destScope;
  25  
  26      public function __construct($sourceServiceId, $sourceScope, $destServiceId, $destScope, \Exception $previous = null)
  27      {
  28          parent::__construct(sprintf(
  29              'Scope Widening Injection detected: The definition "%s" references the service "%s" which belongs to a narrower scope. '
  30             .'Generally, it is safer to either move "%s" to scope "%s" or alternatively rely on the provider pattern by injecting the container itself, and requesting the service "%s" each time it is needed. '
  31             .'In rare, special cases however that might not be necessary, then you can set the reference to strict=false to get rid of this error.',
  32             $sourceServiceId,
  33             $destServiceId,
  34             $sourceServiceId,
  35             $destScope,
  36             $destServiceId
  37          ), 0, $previous);
  38  
  39          $this->sourceServiceId = $sourceServiceId;
  40          $this->sourceScope = $sourceScope;
  41          $this->destServiceId = $destServiceId;
  42          $this->destScope = $destScope;
  43      }
  44  
  45      public function getSourceServiceId()
  46      {
  47          return $this->sourceServiceId;
  48      }
  49  
  50      public function getSourceScope()
  51      {
  52          return $this->sourceScope;
  53      }
  54  
  55      public function getDestServiceId()
  56      {
  57          return $this->destServiceId;
  58      }
  59  
  60      public function getDestScope()
  61      {
  62          return $this->destScope;
  63      }
  64  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1