Smart detection of PHP functions in template expressions