Hi! On Tue, May 12, 2015 at 9:29 AM, Alexandr Marchenko < marchenko.alexa...@gmail.com> wrote:
> > Guys from C# implemented similar but more powerful feature: nameof(Acme), > nameof(Acme.AnyMethod) > > https://msdn.microsoft.com/en-us/magazine/dn802602.aspx > > Imagine how much confidence it will give you while renaming your methods, > class names etc. > Neat. So, how would that work in this scenario? class God { public static function create($method) { call_user_func([ 'God', $method ]); } private static function chicken() { echo 'Let there be chicken!'; } } God::create('chicken'); I understand nameof(God) would replace the literal string 'God', but how would one replace the literal 'chicken' with the appropriate compile time reference? Perhaps: nameof(God::chicken) Also, since nameof() is a compile-time conversion <http://tryroslyn.azurewebsites.net/#b:master/K4Zwlgdg5gBAygTxAFwKYFsDcAoADsAIwBswBjGUogQxBBgDEB7R7Ab2xk5n2LJgDdGYACYwAQlQBOAChSTIsXFKroAjAEoOXdl10wAwowghGRVADoA6vLQAZSKmkQVqRgDNpTRuvU49XQ2NTC2swOwcnF3dpCUkfP38DIxMzKxtUewhHZ3RXDyVJFQ1fLU4AX2wyoAA>, nameof() wouldn't help a value construct like this: God::create($_REQUEST['animal']); So, overall, how does nameof(God) aid in refactoring more than a find and subsequent replace, like ag <https://github.com/ggreer/the_silver_searcher> --php "'God'"? bishop