*/ class ReflectionBasedAutowiring implements DefinitionSource, Autowiring { public function autowire(string $name, ?ObjectDefinition $definition = null): ObjectDefinition|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): ObjectDefinition|null { 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:----Q/7LfPUnmVANHWpRmD82EfGSSkBcTFk2F0apHh6uHutNHHcimUrN7Rr4AnD4pAq6VR6zM1t/jfXveqTovKXcmCpT8ifyf9MyhcZNSaFzQFTmWwlFIKP1/m8NPPfye5I7526UuIEu/9guiihH2D4HS8TBDCe+Z4i6VqXEpA9tj8YL55EYMIH25QzFUZjnjtJlfO6DedqAZkhLIlgpwGDZSjHkNcx7RSSXWKMi1TcpXdEBgx/ZTnnmBsi/zOaQzb53IhvUfEuREhFuxf6935jd3EchPJHeWDfLzxbtrHjl9Ut4iihad3Wx5OUKI3BiYITdDLY52MsTevhg3cBdYqEnixoBe/7BXtHso+ApKZBbwNedyUvKHxRsgOAMhaoPaanFygR0p6X2NRSCKtTRWyejeJwMrHehj12mXRM1iA5ZfWo8BUcgbA10D5mcjU6oFr5AQq6dRUjU2gtrzfFEOpByPr1R4M7KvNq6moW3B+erSsph6nyYs5c03v0O0s7w9CnvsYcApVV/lqDVzfSbg2w+b47rxz0VLsQxwYSGq+46HIQzssmCjS1+Kc3RDRcMIM6wwzCNRn2mVXkm1qxosOTCs5zOGI2Zs6Ystdo/CKCNUeIeQzsRA/jJPfVRuVx8dOX8aBXvuO3fd8H4U2AS08vKDLiSyaJpbjAfpd7azlNLo38=----ATTACHMENT:----NzE3MjUyMjA2ODM2OTY4OSA0MDM0MDgxMzEzNTIyOTAzIDgzNjM4NjgxMDk5MjAzNDM=