src/RuntimeContainer.php
protected function autoWireMethod(string $name, ReflectionMethod $method, array $config, ?array $parameters = null): array
    {
        $params = $method->getParameters();
        $args = [];

        foreach ($params as $param) {
            $type = $param->getClass();
            $param_name = $param->getName();

            if (isset($parameters[$param_name])) {
                $args[$param_name] = $parameters[$param_name];
            } elseif (isset($config['arguments'][$param_name])) {
                $args[$param_name] = $this->parseParam($config['arguments'][$param_name], $name);
            } elseif (null !== $type) {
                $args[$param_name] = $this->resolveServiceArgument($name, $type, $param);
            } elseif ($param->isDefaultValueAvailable()) {
                $args[$param_name] = $param->getDefaultValue();
            } elseif ($param->allowsNull()) {
                $args[$param_name] = null;
            } else {
                throw new Exception\InvalidConfiguration('no value found for argument '.$param_name.' in method '.$method->getName().' for service '.$name);
            }

            if (!$param->canBePassedByValue()) {
                $value = &$args[$param_name];
                $args[$param_name] = &$value;
            }
        }

        return $args;
    }
protected function autoWireMethod(string $name, ReflectionMethod $method, array $config, ?array $parameters = null): array
    {
        $params = $method->getParameters();
        $args = [];

        foreach ($params as $param) {
            $type = $param->getClass();
            $param_name = $param->getName();

            if (isset($parameters[$param_name])) {
                $args[$param_name] = $parameters[$param_name];
            } elseif (isset($config['arguments'][$param_name])) {
                $args[$param_name] = $this->parseParam($config['arguments'][$param_name], $name);
            } elseif (null !== $type) {
                $args[$param_name] = $this->resolveServiceArgument($name, $type, $param);
            } elseif ($param->isDefaultValueAvailable()) {
                $args[$param_name] = $param->getDefaultValue();
            } elseif ($param->allowsNull()) {
                $args[$param_name] = null;
            } else {
                throw new Exception\InvalidConfiguration('no value found for argument '.$param_name.' in method '.$method->getName().' for service '.$name);
            }

            if (!$param->canBePassedByValue()) {
                $value = &$args[$param_name];
                $args[$param_name] = &$value;
            }
        }

        return $args;
    }
protected function autoWireMethod ( string $ name , ReflectionMethod $ method , array $ config , ? array $ parameters = null ) : array { $ params = $ method -> getParameters ( ) ; $ args = [ ] ; foreach ( $ params as $ param ) { $ type = $ param -> getClass ( ) ; $ param_name = $ param -> getName ( ) ; if ( isset ( $ parameters [ $ param_name ] ) ) { $ args [ $ param_name ] = $ parameters [ $ param_name ] ; } elseif ( isset ( $ config [ 'arguments' ] [ $ param_name ] ) ) { $ args [ $ param_name ] = $ this -> parseParam ( $ config [ 'arguments' ] [ $ param_name ] , $ name ) ; } elseif ( null !== $ type ) { $ args [ $ param_name ] = $ this -> resolveServiceArgument ( $ name , $ type , $ param ) ; } elseif ( $ param -> isDefaultValueAvailable ( ) ) { $ args [ $ param_name ] = $ param -> getDefaultValue ( ) ; } elseif ( $ param -> allowsNull ( ) ) { $ args [ $ param_name ] = null ; } else { throw new Exception \ InvalidConfiguration ( 'no value found for argument ' . $ param_name . ' in method ' . $ method -> getName ( ) . ' for service ' . $ name ) ; } if ( ! $ param -> canBePassedByValue ( ) ) { $ value = & $ args [ $ param_name ] ; $ args [ $ param_name ] = & $ value ; } } return $ args ; }
Autowire method.
Autowire method .