PHP in Aptana - function declarations?
Asked Answered
I

1

11

I was wondering if there is an easier (or just any) way to declare functions in PHP files. For example, let's say we have following function:

function myfunc($parama = '', $paramb = 0) {}

Would it be possible to add (as part of PHP bundle) a snippet to create:

  /***
   * 
   * 
   * @param     $parama String
   * @param     $paramb Integer
   * @return   
   * @author   
   * @copyright {current_date}
   */

In case it's doable, the bundle would auto-add it just by typing /*** above function.

Any thoughts are warmly welcome. I managed to do that in TextMate a while ago, but can't figure out how to do it in Aptana.

FYI: I'm referring to Aptana 3.0.6.

Thanks! :)

...

(an hour later)

Actually, I figured it out - created a snippet for this:

snippet 'Declare Function' do |s|
  s.trigger = 'docf'
  s.scope = 'source.php'
  s.expansion = '/***
 * 
 *
 * @param   
 * @return  
 * @author  $6
 * @copyright ' + Time.now.strftime('%Y-%m-%d') + '
 */
function ${1:functionName}($2) 
{
  $0
}'
end

Hope it's useful for other devs. :)

Illegalize answered 27/10, 2011 at 7:6 Comment(1)
You should cut your solution out of your question and add it as an answer below!Pangenesis
F
1

This is a feature of PHPed (http://www.nusphere.com/). This has been my IDE of choice for the past 4 years. After a function has been defined, you start the comment block with:

/**

And press enter. It reads the function signature and generates some nice javadoc comments, much like the ones you've provided above.

Flame answered 10/11, 2011 at 5:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.