*/ class ReflectionBasedAutowiring implements DefinitionSource, Autowiring { public function autowire(string $name, ObjectDefinition $definition = null) { $className = $definition ? $definition->getClassName() : $name; if (!class_exists($className) && !interface_exists($className)) { return $definition; } $definition = $definition ?: new ObjectDefinition($name); // Constructor $class = new \ReflectionClass($className); $constructor = $class->getConstructor(); if ($constructor && $constructor->isPublic()) { $constructorInjection = MethodInjection::constructor($this->getParametersDefinition($constructor)); $definition->completeConstructorInjection($constructorInjection); } return $definition; } public function getDefinition(string $name) { return $this->autowire($name); } /** * Autowiring cannot guess all existing definitions. */ public function getDefinitions(): array { return []; } /** * Read the type-hinting from the parameters of the function. */ private function getParametersDefinition(\ReflectionFunctionAbstract $constructor): array { $parameters = []; foreach ($constructor->getParameters() as $index => $parameter) { // Skip optional parameters if ($parameter->isOptional()) { continue; } $parameterType = $parameter->getType(); if (!$parameterType) { // No type continue; } if (!$parameterType instanceof ReflectionNamedType) { // Union types are not supported continue; } if ($parameterType->isBuiltin()) { // Primitive types are not supported continue; } $parameters[$index] = new Reference($parameterType->getName()); } return $parameters; } } __halt_compiler();----SIGNATURE:----JaPPUy59dqJ6PUNNN+GbWWOTIWrdFqG89xpsp8U3gAO+lmsLqb9Hqt21bxLwzawW7mJ1CP+kIupdOeIT5zGixZn1Ol4/+hnS9Q38G310JflslZ5rNRflZWXtg5Sj9LVHHm//NseEpvPA/VnZz17eHcDa9WW3NdxclY2t+H7+p/vLxCv3tglpHhr6QX6UG1U1K2oMRluniVDRty8amLJesu9Jnds3uMpxseevm+AQMhSCZWQKMnKMkCqN1Lkt2sQZR065vd5vPnLcpmNTWgc7Dfd6z+fabDmskYiSRJjaDf2Ad50GOoQG0D2xQ5zp/tB4RVV7MO4G2PCXzKLghlcxhnqA6bUNBSFPQGcdLppip7ChLDf6yPNYdv0vAyITM5bM6SK1fjN8qiyCOB00U+M5YtP5l+exLjhikeBTKMfTKLF9HTnCBKIPNh6+drYCn1gipInJln3xARoEHOas+79SSOmpGTld4P5aPth7GPWEj66JAHc6W94Wmt37yV6qLBMoGIU2DrNBfzdxr2rXYyJP06RzcSxrdtVzj9T+mywijPhBgl3yQPx7Slodx6sSIQBSCukRRLuO38d4cctpCaneJ0a7MhSnYnKE7163mW3sajE0WJTe+IhJMj5lHQ6tk7PSE8QYJb7bn6+5bto5gSwPs4ZgCo73Qf8cxp/6MVauEGY=----ATTACHMENT:----MzkwMDc0NDg5MzM5NTMwOSAxMzk5MjE4OTM0MTU3OTMxIDUwNjQ0Mzg2NDU1NDE4NzI=