2017 © Pedro Peláez
 

library php-cs-fixer

image

litus/php-cs-fixer

  • Friday, March 2, 2018
  • by pmaene
  • Repository
  • 6 Watchers
  • 1 Stars
  • 46 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 39 % Grown

The README.md

Litus PHP CodeStyle

This project contains a custom fixer for php-cs-fixer. If a php file doesn't contain a license header, it is added. If the license header in the php file is different than the supplied file, the php file is updated., (*1)

Usage

Add the following to composer.json:, (*2)

{
    ...
    "require": {
        "litus/php-cs": "dev-master"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/LitusProject/PhpCodeStyle"
        }
    ],
    ...
}

Create a .license_header file (or pick any filename you want) and put the license header in this file.
Note: Add an unformatted version of the license header!, (*3)

Create a .php_cs file:, (*4)

<?php

$finder = Symfony\CS\Finder\DefaultFinder::create()
    ->in(__DIR__);

return Litus\CodeStyle\Config\Config::create()
    ->setLicense(__DIR__ . '/.license_header') // or the filename you chose
    ->finder($finder);

Code Style

We conform to the PSR-2 and PSR-4 coding styles with the following exceptions:, (*5)

  • We only have one use statement per file instead of one statement per declaration
  • We sometimes do prepend private variables and methods with an underscore ('_')
    note to ourselves: the "sometimes" indicates we're doing this wrong
  • We do not use a vendor namespace for the main project

The Versions

02/03 2018

dev-master

9999999-dev

  Sources   Download

GPL-3.0-or-later

The Requires