Share this page: Follow me to be notified of new articles:

PHP PSR-2 Fixer: Coda plug-in to automatically fix PHP coding standards issues

Introduction

PHP PSR-2 Fixer is a Coda Plugin designed to help automatically apply PSR-2 standards to PHP code.
You can install the plug-in directly from Coda's plug-in page or download the latest version from the Github repository.
It allows you to fix standards for an entire file or a selected portion of code.

Source code

You can find the source code on Github:
Watch Star Fork Download

Usage

Fix standards for an entire file: Fix standards for the selected code only:

Sample input / output

Input

<?php
class Foo extends Bar implements FooInterface {
    public function sampleMethod($a, $b=null){
        
        
        if($a === $b) {
            bar();
        } elseif($a > $b) {
            
            
            $foo->bar($arg1);
        } else{
            BazClass::bar($arg2, $arg3);
        }
        
        
        
    }
}

Output

<?php
class Foo extends Bar implements FooInterface
{
    public function sampleMethod($a, $b = null)
    {
        if ($a === $b) {
            bar();
        } elseif ($a > $b) {
            $foo->bar($arg1);
        } else {
            BazClass::bar($arg2, $arg3);
        }
    }
}
Last update of this page: March 27, 2017
Please do not copy any of the content of this website without asking me first.