[TASK] Remove not existing exclude from .php_cs configuration
[Packages/TYPO3.CMS.git] / Build / .php_cs
1 <?php
2 /*
3 * This file is part of the TYPO3 CMS project.
4 *
5 * It is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License, either version 2
7 * of the License, or any later version.
8 *
9 * For the full copyright and license information, please read the
10 * LICENSE.txt file that was distributed with this source code.
11 *
12 * The TYPO3 project - inspiring people to share!
13 */
14
15 /**
16 * This file represents the configuration for Code Sniffing PSR-2-related
17 * automatic checks of coding guidelines
18 * Install @fabpot's great php-cs-fixer tool via
19 *
20 * $ composer global require friendsofphp/php-cs-fixer
21 *
22 * And then simply run
23 *
24 * $ php-cs-fixer fix --config-file Build/.php_cs
25 *
26 * inside the TYPO3 directory. Warning: This may take up to 10 minutes.
27 *
28 * For more information read:
29 * http://www.php-fig.org/psr/psr-2/
30 * http://cs.sensiolabs.org
31 */
32
33 if (PHP_SAPI !== 'cli') {
34 die('This script supports command line usage only. Please check your command.');
35 }
36 // Define in which folders to search and which folders to exclude
37 // Exclude some directories that are excluded by Git anyways to speed up the sniffing
38 $finder = Symfony\CS\Finder\DefaultFinder::create()
39 ->exclude('vendor')
40 ->exclude('typo3conf')
41 ->exclude('typo3temp')
42 ->exclude('adodb')
43 ->in(__DIR__ . '/../');
44
45 // Return a Code Sniffing configuration using
46 // all sniffers needed for PSR-2
47 // and additionally:
48 // - Remove leading slashes in use clauses.
49 // - PHP single-line arrays should not have trailing comma.
50 // - Single-line whitespace before closing semicolon are prohibited.
51 // - Remove unused use statements in the PHP source code
52 // - Ensure Concatenation to have at least one whitespace around
53 // - Remove trailing whitespace at the end of blank lines.
54 return Symfony\CS\Config\Config::create()
55 ->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
56 ->fixers([
57 // If changes to the fixers are done, please sync them with typo3/sysext/core/Build/Scripts/cglFixMyCommit.sh
58 'remove_leading_slash_use',
59 'single_array_no_trailing_comma',
60 'spaces_before_semicolon',
61 'unused_use',
62 'concat_with_spaces',
63 'whitespacy_lines',
64 'ordered_use',
65 'single_quote',
66 'duplicate_semicolon',
67 'extra_empty_lines',
68 'phpdoc_no_package',
69 'phpdoc_scalar',
70 'no_empty_lines_after_phpdocs',
71 'short_array_syntax',
72 'array_element_white_space_after_comma',
73 'function_typehint_space',
74 'hash_to_slash_comment',
75 'join_function',
76 'lowercase_cast',
77 'namespace_no_leading_whitespace',
78 'native_function_casing',
79 'no_empty_statement',
80 'self_accessor',
81 'short_bool_cast',
82 'unneeded_control_parentheses'
83 ])
84 ->finder($finder);