PHP best code formatter

wordpress

#1

What PHP code formatter configuration are you using to automatic format your PHP code?

I’m using Eclipse Luna and it has 3 configurations:

PHP Conventions (built-in)
Zend Framework 1 (built-in)
PSR-2 Conventions (built-in)

I see in WordPress core classes, for instance, that this is preferred:
return max( 1, $pagenum );

but I rather prefer (maybe because of my background in Java) this one:
return max(1, $pagenum);

That’s a simple example… but though, when you have lot of code, are you formatting it manually? Or which code formatter is the best? Are you using an online formatter? Which one?


#2

Usually you would use http://www.php-fig.org/psr/ but if you jump in a project like wordpress that has it’s own coding standards, then the respectful thing to do is to code using that standard.

L.E: So in your case, have eclipse use psr-2.