Copied!

Checks whether injected parameters are compatible with type declarations.

This pass should be run after all optimization passes.

It can be added either:

  • before removing passes to check all services even if they are not currently used,
  • after removing passes to check only services are used in the app.
CloneableFinalInstantiable
Methods
public __construct(bool $autoload = false, array $skippedIds = [])
 
  • param bool $autoload Whether services who's class in not loaded should be checked or not. Defaults to false to save loading code during compilation.
  • param array $skippedIds An array indexed by the service ids to skip
public Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass::process(Symfony\Component\DependencyInjection\ContainerBuilder $container)
 
  • return void
Properties
protected ?Symfony\Component\DependencyInjection\ContainerBuilder Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass::$container
protected ?string Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass::$currentId = NULL
protected bool $skipScalars = true
Methods
protected Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass::enableExpressionProcessing() : void
protected Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass::getConstructor(Symfony\Component\DependencyInjection\Definition $definition, bool $required) : ?ReflectionFunctionAbstract
 
  • throws \RuntimeException
protected Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass::getReflectionMethod(Symfony\Component\DependencyInjection\Definition $definition, string $method) : ReflectionFunctionAbstract
 
  • throws \RuntimeException
protected Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass::inExpression(bool $reset = true) : bool
protected processValue(?mixed $value, bool $isRoot = false) : ?mixed
Constants
private Symfony\Component\DependencyInjection\Compiler\CheckTypeDeclarationsPass::BUILTIN_TYPES = ['array' => true, 'bool' => true, 'callable' => true, 'float' => true, 'int' => true, 'iterable' => true, 'object' => true, 'string' => true]
private Symfony\Component\DependencyInjection\Compiler\CheckTypeDeclarationsPass::SCALAR_TYPES = ['int' => true, 'float' => true, 'bool' => true, 'string' => true]
Properties
private bool $autoload
private Symfony\Component\DependencyInjection\ExpressionLanguage $expressionLanguage
private array $skippedIds
Methods
private checkType(Symfony\Component\DependencyInjection\Definition $checkedDefinition, ?mixed $value, ReflectionParameter $parameter, ?string $envPlaceholderUniquePrefix, ?ReflectionType $reflectionType = NULL) : void
 
  • throws \InvalidParameterTypeException When a parameter is not compatible with the declared type
private checkTypeDeclarations(Symfony\Component\DependencyInjection\Definition $checkedDefinition, ReflectionFunctionAbstract $reflectionFunction, array $values) : void
 
  • throws \InvalidArgumentException When not enough parameters are defined for the method
private getExpressionLanguage() : Symfony\Component\DependencyInjection\ExpressionLanguage
© 2025 Bruce Wells
Search Namespaces \ Classes
Configuration