This standard enforces:
-
PSR-0, PSR-1 and PSR-2. The standards were approved by the PHP Framework Interoperability Group.
-
the removal of old and deprecated PHP functions (This is helpful, when working with legacy code.)
-
the usage of faster functions. Which in fact are premature or micro optimizations. Uh, oh! That’s BAD for sure :)
Requirements
PHP 5.3+
PHP_CodeSniffer (http://pear.php.net/package/PHP_CodeSniffer)
Installation
-
PHP_CodeSniffer is installed via Composer
-
Clone this repository
-
git clone https://github.com/jakoch/Goldstandard-for-PHP.git Goldstandard
-
-
Create a symlink PHP/CodeSniffer/Standards/Goldstandard pointing to the Goldstandard directory
-
ln -s [somewhere]/PHP/CodeSniffer/Standards/Goldstandard /Goldstandard
-
Usage
-
Use the coding standard with phpcs --standard=Goldstandard
-
You might also set it as default standard phpcs --config-set default_standard Goldstandard
-
If you didn’t symlink or install it, then reference it by path phpcs --standard=path/to/Goldstandard path/to/code
IDE Integration
NetBeans
http://plugins.netbeans.org/plugin/40282/phpmd-php-codesniffer-plugin
PHPStorm
http://www.jetbrains.com/phpstorm/webhelp/using-php-code-sniffer-tool.html
Zend Studio
http://files.zend.com/help/Zend-Studio/content/working_with_php_codesniffer.htm