protected function autowireArguments(array &$objectConfigurations)
    {
        foreach ($objectConfigurations as $objectConfiguration) {
            /** @var Configuration $objectConfiguration */
            if ($objectConfiguration->getClassName() === '') {
                continue;
            }

            if ($objectConfiguration->getAutowiring() === Configuration::AUTOWIRING_MODE_OFF) {
                continue;
            }


            $className = $objectConfiguration->getClassName();
            if (!$this->reflectionService->hasMethod($className, '__construct')) {
                continue;
            }

            $autowiringAnnotation = $this->reflectionService->getMethodAnnotation($className, '__construct', Flow\Autowiring::class);
            if ($autowiringAnnotation !== null && $autowiringAnnotation->enabled === false) {
                continue;
            }

            $arguments = $objectConfiguration->getArguments();
            foreach ($this->reflectionService->getMethodParameters($className, '__construct') as $parameterName => $parameterInformation) {
                $debuggingHint = '';
                $index = $parameterInformation['position'] + 1;
                if (!isset($arguments[$index])) {
                    if ($parameterInformation['optional'] === true) {
                        $defaultValue = (isset($parameterInformation['defaultValue'])) ? $parameterInformation['defaultValue'] : null;
                        $arguments[$index] = new ConfigurationArgument($index, $defaultValue, ConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE);
                        $arguments[$index]->setAutowiring(Configuration::AUTOWIRING_MODE_OFF);
                    } elseif ($parameterInformation['class'] !== null && isset($objectConfigurations[$parameterInformation['class']])) {
                        $arguments[$index] = new ConfigurationArgument($index, $parameterInformation['class'], ConfigurationArgument::ARGUMENT_TYPES_OBJECT);
                    } elseif ($parameterInformation['allowsNull'] === true) {
                        $arguments[$index] = new ConfigurationArgument($index, null, ConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE);
                        $arguments[$index]->setAutowiring(Configuration::AUTOWIRING_MODE_OFF);
                    } elseif (interface_exists($parameterInformation['class'])) {
                        $debuggingHint = sprintf('No default implementation for the required interface %s was configured, therefore no specific class name could be used for this dependency. ', $parameterInformation['class']);
                    }
                }

                if (!isset($arguments[$index]) && $objectConfiguration->getScope() === Configuration::SCOPE_SINGLETON) {
                    throw new UnresolvedDependenciesException(sprintf('Could not autowire required constructor argument $%s for singleton class %s. %sCheck the type hint of that argument and your Objects.yaml configuration.', $parameterName, $className, $debuggingHint), 1298629392);
                }
            }

            $objectConfiguration->setArguments($arguments);
        }
    }
protected function autowireArguments(array &$objectConfigurations)
    {
        foreach ($objectConfigurations as $objectConfiguration) {
            /** @var Configuration $objectConfiguration */
            if ($objectConfiguration->getClassName() === '') {
                continue;
            }

            if ($objectConfiguration->getAutowiring() === Configuration::AUTOWIRING_MODE_OFF) {
                continue;
            }


            $className = $objectConfiguration->getClassName();
            if (!$this->reflectionService->hasMethod($className, '__construct')) {
                continue;
            }

            $autowiringAnnotation = $this->reflectionService->getMethodAnnotation($className, '__construct', Flow\Autowiring::class);
            if ($autowiringAnnotation !== null && $autowiringAnnotation->enabled === false) {
                continue;
            }

            $arguments = $objectConfiguration->getArguments();
            foreach ($this->reflectionService->getMethodParameters($className, '__construct') as $parameterName => $parameterInformation) {
                $debuggingHint = '';
                $index = $parameterInformation['position'] + 1;
                if (!isset($arguments[$index])) {
                    if ($parameterInformation['optional'] === true) {
                        $defaultValue = (isset($parameterInformation['defaultValue'])) ? $parameterInformation['defaultValue'] : null;
                        $arguments[$index] = new ConfigurationArgument($index, $defaultValue, ConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE);
                        $arguments[$index]->setAutowiring(Configuration::AUTOWIRING_MODE_OFF);
                    } elseif ($parameterInformation['class'] !== null && isset($objectConfigurations[$parameterInformation['class']])) {
                        $arguments[$index] = new ConfigurationArgument($index, $parameterInformation['class'], ConfigurationArgument::ARGUMENT_TYPES_OBJECT);
                    } elseif ($parameterInformation['allowsNull'] === true) {
                        $arguments[$index] = new ConfigurationArgument($index, null, ConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE);
                        $arguments[$index]->setAutowiring(Configuration::AUTOWIRING_MODE_OFF);
                    } elseif (interface_exists($parameterInformation['class'])) {
                        $debuggingHint = sprintf('No default implementation for the required interface %s was configured, therefore no specific class name could be used for this dependency. ', $parameterInformation['class']);
                    }
                }

                if (!isset($arguments[$index]) && $objectConfiguration->getScope() === Configuration::SCOPE_SINGLETON) {
                    throw new UnresolvedDependenciesException(sprintf('Could not autowire required constructor argument $%s for singleton class %s. %sCheck the type hint of that argument and your Objects.yaml configuration.', $parameterName, $className, $debuggingHint), 1298629392);
                }
            }

            $objectConfiguration->setArguments($arguments);
        }
    }
protected function autowireArguments ( array & $ objectConfigurations ) { foreach ( $ objectConfigurations as $ objectConfiguration ) { /** @var Configuration $objectConfiguration */ if ( $ objectConfiguration -> getClassName ( ) === '' ) { continue ; } if ( $ objectConfiguration -> getAutowiring ( ) === Configuration :: AUTOWIRING_MODE_OFF ) { continue ; } $ className = $ objectConfiguration -> getClassName ( ) ; if ( ! $ this -> reflectionService -> hasMethod ( $ className , '__construct' ) ) { continue ; } $ autowiringAnnotation = $ this -> reflectionService -> getMethodAnnotation ( $ className , '__construct' , Flow \ Autowiring :: class ) ; if ( $ autowiringAnnotation !== null && $ autowiringAnnotation -> enabled === false ) { continue ; } $ arguments = $ objectConfiguration -> getArguments ( ) ; foreach ( $ this -> reflectionService -> getMethodParameters ( $ className , '__construct' ) as $ parameterName => $ parameterInformation ) { $ debuggingHint = '' ; $ index = $ parameterInformation [ 'position' ] + 1 ; if ( ! isset ( $ arguments [ $ index ] ) ) { if ( $ parameterInformation [ 'optional' ] === true ) { $ defaultValue = ( isset ( $ parameterInformation [ 'defaultValue' ] ) ) ? $ parameterInformation [ 'defaultValue' ] : null ; $ arguments [ $ index ] = new ConfigurationArgument ( $ index , $ defaultValue , ConfigurationArgument :: ARGUMENT_TYPES_STRAIGHTVALUE ) ; $ arguments [ $ index ] -> setAutowiring ( Configuration :: AUTOWIRING_MODE_OFF ) ; } elseif ( $ parameterInformation [ 'class' ] !== null && isset ( $ objectConfigurations [ $ parameterInformation [ 'class' ] ] ) ) { $ arguments [ $ index ] = new ConfigurationArgument ( $ index , $ parameterInformation [ 'class' ] , ConfigurationArgument :: ARGUMENT_TYPES_OBJECT ) ; } elseif ( $ parameterInformation [ 'allowsNull' ] === true ) { $ arguments [ $ index ] = new ConfigurationArgument ( $ index , null , ConfigurationArgument :: ARGUMENT_TYPES_STRAIGHTVALUE ) ; $ arguments [ $ index ] -> setAutowiring ( Configuration :: AUTOWIRING_MODE_OFF ) ; } elseif ( interface_exists ( $ parameterInformation [ 'class' ] ) ) { $ debuggingHint = sprintf ( 'No default implementation for the required interface %s was configured, therefore no specific class name could be used for this dependency. ' , $ parameterInformation [ 'class' ] ) ; } } if ( ! isset ( $ arguments [ $ index ] ) && $ objectConfiguration -> getScope ( ) === Configuration :: SCOPE_SINGLETON ) { throw new UnresolvedDependenciesException ( sprintf ( 'Could not autowire required constructor argument $%s for singleton class %s. %sCheck the type hint of that argument and your Objects.yaml configuration.' , $ parameterName , $ className , $ debuggingHint ) , 1298629392 ) ; } } $ objectConfiguration -> setArguments ( $ arguments ) ; } }
If mandatory constructor arguments have not been defined yet, this function tries to autowire
them if possible.

@param array &$objectConfigurations
@return void
@throws UnresolvedDependenciesException
If mandatory constructor arguments have not been defined yet this function tries to autowire them if possible .