*/ 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:----hZCKG+ijjs6Zb4WEhnKFjXAw1LrZ4BCf3ZywJLwOe6RywJ6Hv1N5PIiXbhbbGhI84bCrLZJTzn888k9uy1oWaG+Y/VBXp7+WxUl9X1SWovAvo1zUHyeclBfLfjbdQof6PbtjCzTwjyUBxHL+p1OxRyNB5d2kG5+7f4S41AGpSnfp30Sh6JLPPlI5kZkCFGcIi5vfvW84h08O7dBhZ3G8YNSrKU1djNPnLvRHa8Kb/oa9Tn2y56xesDvJ2yHEfPpIN+sBWxJxMHuFKSScATknVarSyVTBrM8jsdhmmuh9L879zU6mcX4j3SRr83yZMwMVYR+thtsuQUEeac5UOc83MIzFDcYPpYxSMJOeuEm3aRjsaEy8FiTO/l8V+NnospuIrNO/1oUOwBv+dNylu4ETcwgrtaTTzn3hFZSSBU0sJxhfo3L8Yvcvk8zmP5LociFWLqmjtxyGo1CsqMrUe8vb2iJ7ZKBoW3voRgjjwhit+b2TC1wb0Alau52mnAUx/1oDLkyWU9xyDo13Smipw8CXdFCKXFKknZVv0p4A5wVDh8hR1fGw90bI9D7GZR7pbuxUiOkrUjjxutdwBpwr3r1oXHrLDFFrYKmM5Q5uo9+pGNifFhvlfxY8loQtA7TyPxvu3kcMwtHJuH62xc6tA/1gxPNNbEgHw97MLra9KAtBKsc=----ATTACHMENT:----MzA4Nzg0NzAzNzg5NTkwNiAyNTUxOTEyNTM3NzEzMTM2IDI0Njc1NDkyMzYwNTU5MDQ=