Source:
public static String[] getControllerMethodShortcut(@NotNull Method method) { String methodName = method.getName(); PhpClass phpClass = method.getContainingClass(); if(null == phpClass) { return new String[0]; } String className = phpClass.getName(); if(!className.endsWith("Controller")) { return new String[0]; } SymfonyBundleUtil symfonyBundleUtil = new SymfonyBundleUtil(method.getProject()); SymfonyBundle symfonyBundle = symfonyBundleUtil.getContainingBundle(phpClass); if(symfonyBundle == null) { return new String[0]; } PhpClass bundleClass = symfonyBundle.getPhpClass(); if(!phpClass.getNamespaceName().startsWith(bundleClass.getNamespaceName() + "Controller\\")) { return new String[0]; } String templateFolderName = phpClass.getNamespaceName().substring(bundleClass.getNamespaceName().length() + 11); templateFolderName = templateFolderName.replace("\\", "/"); String shortcutName; String templateName = className.substring(0, className.lastIndexOf("Controller")); if(methodName.equals("__invoke")) { shortcutName = String.format( "%s::%s%s", symfonyBundle.getName(), underscore(templateFolderName), underscore(templateName) ); } else { shortcutName = String.format( "%s:%s%s:%s", symfonyBundle.getName(), underscore(templateFolderName), underscore(templateName), underscore(StringUtils.removeEnd(methodName, "Action")) ); } return new String[] { shortcutName + ".html.twig", shortcutName + ".json.twig", shortcutName + ".xml.twig", }; }

Target:
public static String[] getControllerMethodShortcut(@NotNull Method method) { String methodName = method.getName(); PhpClass phpClass = method.getContainingClass(); if(null == phpClass) { return new String[0]; } String className = phpClass.getName(); if(!className.endsWith("Controller")) { return new String[0]; } SymfonyBundleUtil symfonyBundleUtil = new SymfonyBundleUtil(method.getProject()); SymfonyBundle symfonyBundle = symfonyBundleUtil.getContainingBundle(phpClass); if(symfonyBundle == null) { return new String[0]; } PhpClass bundleClass = symfonyBundle.getPhpClass(); if(!phpClass.getNamespaceName().startsWith(bundleClass.getNamespaceName() + "Controller\\")) { return new String[0]; } String templateFolderName = phpClass.getNamespaceName().substring(bundleClass.getNamespaceName().length() + 11); templateFolderName = templateFolderName.replace("\\", "/"); String shortcutName; String shortcutNameForOldNotation; String templateName = className.substring(0, className.lastIndexOf("Controller")); if(methodName.equals("__invoke")) { shortcutName = String.format( "%s::%s%s", symfonyBundle.getName(), underscore(templateFolderName), underscore(templateName) ); shortcutNameForOldNotation = String.format( "%s::%s%s", symfonyBundle.getName(), templateFolderName, templateName ); } else { shortcutName = String.format( "%s:%s%s:%s", symfonyBundle.getName(), underscore(templateFolderName), underscore(templateName), underscore(StringUtils.removeEnd(methodName, "Action")) ); shortcutNameForOldNotation = String.format( "%s:%s%s:%s", symfonyBundle.getName(), templateFolderName, templateName, StringUtils.removeEnd(methodName, "Action") ); } return new String[] { shortcutName + ".html.twig", shortcutName + ".json.twig", shortcutName + ".xml.twig", shortcutNameForOldNotation + ".html.twig", shortcutNameForOldNotation + ".json.twig", shortcutNameForOldNotation + ".xml.twig", }; }