Skip to content

Instantly share code, notes, and snippets.

@jehoshua02
Created October 8, 2012 17:01
Show Gist options
  • Select an option

  • Save jehoshua02/3853607 to your computer and use it in GitHub Desktop.

Select an option

Save jehoshua02/3853607 to your computer and use it in GitHub Desktop.
PHP Method template for Eclipse IDE

I use this template for PHP methods in Eclipse:

${cursor}
${visibility} function ${functionName}(${dollar}${param})
{
    // @todo method body for ${class_container}::${functionName}()
    return ${value};
}

I just type fnc (which can be customized), and it gives me the option to insert the template, and tabs the cursor through the template variables so I can fill them in. I like to define my method signatures before filling in the body, so I add a @todo comment to keep track of loose ends in Eclipse task view. I like to end with the cursor above the method signature so that I can immediately start a docblock by /**. This is why I like to put a dummy return in there so that the docblock will detect the return type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment