Files
livetrail/.php-cs-fixer.dist.php
T
2026-08-27 12:45:30 +02:00

54 lines
1.7 KiB
PHP

<?php
/*
* PHP-CS-Fixer config codifying the style already in use under lib/ and
* public/. Deliberately NOT based on @PSR2/@PSR12 - this codebase diverges
* from those on purpose (tabs, no space before control-structure parens),
* so pulling in a preset would rewrite most of the codebase to match a
* style nobody uses here. Rules below were derived by sampling lib/*.php,
* not from a style guide.
*/
$finder = (new PhpCsFixer\Finder())
->in([__DIR__.'/lib', __DIR__.'/public'])
->append([__DIR__.'/config/settings-sample.php'])
->name('*.php');
return (new PhpCsFixer\Config())
->setIndent("\t")
->setLineEnding("\n")
->setRules([
//Strings: single quotes except where interpolation needs double
'single_quote' => true,
//Arrays: short [] syntax, not long-form array()
'array_syntax' => ['syntax' => 'short'],
//Braces: same line as class/function signature (dominant in lib/,
//not the PSR-2 next-line-for-class convention)
'braces_position' => [
'classes_opening_brace' => 'same_line',
'functions_opening_brace' => 'same_line',
'anonymous_functions_opening_brace' => 'same_line'
],
//Concatenation: no padding around `.`
'concat_space' => ['spacing' => 'none'],
//true/false/null: lowercase (100% consistent already)
'constant_case' => ['case' => 'lower'],
'lowercase_keywords' => true,
'visibility_required' => ['elements' => ['method', 'property', 'const']],
//Housekeeping - safe regardless of style
'no_unused_imports' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'single_blank_line_at_eof' => true,
'no_empty_statement' => true,
'trim_array_spaces' => true,
'new_with_parentheses' => true
])
->setFinder($finder);