Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
103 - 1
<?php
2
/**
3
 * This file represents the configuration for Code Sniffing PSR-2-related
4
 * automatic checks of coding guidelines
5
 * Install @fabpot's great php-cs-fixer tool via
6
 *
7
 *  $ composer global require fabpot/php-cs-fixer
8
 *
9
 * And then simply run
10
 *
11
 *  $ php-cs-fixer fix --config-file .php_cs
12
 *
13
 * inside the root directory.
14
 *
15
 * 	 http://www.php-fig.org/psr/psr-2/
16
 * 	 http://cs.sensiolabs.org
17
 */
18
 
19
if (PHP_SAPI !== 'cli') {
20
    die('This script supports command line usage only. Please check your command.');
21
}
22
// Define in which folders to search and which folders to exclude
23
// Exclude some directories that are excluded by Git anyways to speed up the sniffing
24
$finder = Symfony\CS\Finder\DefaultFinder::create()
25
    ->exclude('vendor')
26
    ->in(__DIR__);
27
 
28
// Return a Code Sniffing configuration using
29
// all sniffers needed for PSR-2
30
// and additionally:
31
//  - Remove leading slashes in use clauses.
32
//  - PHP single-line arrays should not have trailing comma.
33
//  - Single-line whitespace before closing semicolon are prohibited.
34
//  - Remove unused use statements in the PHP source code
35
//  - Ensure Concatenation to have at least one whitespace around
36
//  - Remove trailing whitespace at the end of blank lines.
37
return Symfony\CS\Config\Config::create()
38
    ->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
39
    ->fixers([
40
        'remove_leading_slash_use',
41
        'single_array_no_trailing_comma',
42
        'spaces_before_semicolon',
43
        'unused_use',
44
        'concat_with_spaces',
45
        'whitespacy_lines',
46
        'ordered_use',
47
        'single_quote',
48
        'duplicate_semicolon',
49
        'extra_empty_lines',
50
        'phpdoc_no_package',
51
        'phpdoc_scalar',
52
        'no_empty_lines_after_phpdocs'
53
    ])
54
    ->finder($finder);