{"action":"opened","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/8531","labels_url":"https://api.github.com/repos/laravel/framework/issues/8531/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/8531/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/8531/events","html_url":"https://github.com/laravel/framework/issues/8531","id":70318173,"number":8531,"title":"Allow using not defined class name as type hint to set injection","user":{"login":"binaryoung","id":5364548,"avatar_url":"https://avatars.githubusercontent.com/u/5364548?v=3","gravatar_id":"","url":"https://api.github.com/users/binaryoung","html_url":"https://github.com/binaryoung","followers_url":"https://api.github.com/users/binaryoung/followers","following_url":"https://api.github.com/users/binaryoung/following{/other_user}","gists_url":"https://api.github.com/users/binaryoung/gists{/gist_id}","starred_url":"https://api.github.com/users/binaryoung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/binaryoung/subscriptions","organizations_url":"https://api.github.com/users/binaryoung/orgs","repos_url":"https://api.github.com/users/binaryoung/repos","events_url":"https://api.github.com/users/binaryoung/events{/privacy}","received_events_url":"https://api.github.com/users/binaryoung/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-23T06:00:12Z","updated_at":"2015-04-23T06:00:12Z","closed_at":null,"body":"Laravel container use these code to  get the type hint\r\n```\r\n\t/**\r\n\t * Get the type hint for this closure's first argument.\r\n\t *\r\n\t * @param  \\Closure  $callback\r\n\t * @return mixed\r\n\t */\r\n\tprotected function getFunctionHint(Closure $callback)\r\n\t{\r\n\t\t$function = new ReflectionFunction($callback);\r\n\t\tif ($function->getNumberOfParameters() == 0)\r\n\t\t{\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t$expected = $function->getParameters()[0];\r\n\t\tif ( ! $expected->getClass())\r\n\t\t{\r\n\t\t\treturn;\r\n\t\t}\r\n\t\treturn $expected->getClass()->name;\r\n\t}\r\n```\r\nBut it will cause a fatal error if the class required by the  type hint is not defined. Sometimes,i just want to bind some simple name with my services to service container and use type hint to setter injection .But i can't do that.Can you provide some background on the need for this code?Maybe you can use these code that post on http://php.net/manual/en/reflectionparameter.getclass.php to get type hint.\r\n```\r\nfunction getClassName(ReflectionParameter $param) {\r\n    preg_match('/\\[\\s\\<\\w+?>\\s([\\w]+)/s', $param->__toString(), $matches);\r\n    return isset($matches[1]) ? $matches[1] : null;\r\n}\r\n```\r\nAny ideas?"}}