ezrpg-legacy / ezrpg-2.0.X-discontinued-

http://ezrpgproject.net
Other
6 stars 0 forks source link

Standardize code #21

Open JakeBooher opened 10 years ago

JakeBooher commented 10 years ago

I think we really need to go through every single line of code and make sure it is all standardized (such as spacing before parenthesis, no new line before curly brace, etc.) as currently there is a mix of things. For example, in one file you'll have something like:

<?php
class className {
     function functionName ( $param1, $param2 ) {
           //stuff
     }
}

and in others we have things like this

<?php
class className
{
     function functionName($param1, $param2)
     {
           //stuff
     }
}

when it should all be standardized throught everything.

ferdis commented 10 years ago

I prefer the second method, most, if not all, of the code that I've written is this way.

JakeBooher commented 10 years ago

So remove the annoying spaces before and inside the parenthesis? I +1 that.

ferdis commented 10 years ago

I +2 that. mralex's vote is mine, ha!

uaktags commented 10 years ago

this should show a depiction of K&R style that I'll be amending

<?php

namespace ezRPG\Something;

/**
 * Comment
*/
class className
{
     protected $var;
     protected $var2;

     /**
      * functionName comment
     */
     function functionName($param1, $param2)
     {
           $this->var = $param1;
           $this->var2 = $param2;

           if (some_thing) {
              doSomething();
           } else {
              dontDoSomething();
          }

          return true;
     }
}
JakeBooher commented 10 years ago

Also, start implementing phpDOC style comments for functions and classes

REF: http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_tags.pkg.html

JakeBooher commented 10 years ago

In Library* you have

class className extends extendClass {

but in Module* you have

class className extends extendClass
{
ferdis commented 10 years ago

New line for declaration statements.

uaktags commented 10 years ago

There seems to be issues popping up with my last commit. App::error was said to be deprecated and not to use so I removed it.