Installe friendsofphp/php-cs-fixer en require-dev, configure le style PSR-12 avec guillemets simples et alignement des =>, et formate les fichiers PHP existants. Ajoute la config VS Codium pour le format on save. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
1 KiB
PHP
29 lines
1 KiB
PHP
<?php
|
|
|
|
$finder = PhpCsFixer\Finder::create()
|
|
->in([
|
|
__DIR__ . '/site/models',
|
|
__DIR__ . '/site/config',
|
|
__DIR__ . '/site/templates',
|
|
__DIR__ . '/site/snippets',
|
|
])
|
|
->append([__DIR__ . '/index.php'])
|
|
->notPath('picture.php') // bug php-cs-fixer : statement_indentation dans ce fichier
|
|
->ignoreDotFiles(true);
|
|
|
|
return (new PhpCsFixer\Config())
|
|
->setRules([
|
|
'@PSR12' => true,
|
|
'single_quote' => true,
|
|
'array_syntax' => ['syntax' => 'short'],
|
|
'no_unused_imports' => true,
|
|
'ordered_imports' => ['sort_algorithm' => 'alpha'],
|
|
'no_extra_blank_lines' => ['tokens' => ['extra', 'throw', 'use']],
|
|
'trailing_comma_in_multiline' => true,
|
|
'binary_operator_spaces' => [
|
|
'default' => 'single_space',
|
|
'operators' => ['=>' => 'align_single_space_minimal'],
|
|
],
|
|
])
|
|
->setFinder($finder)
|
|
->setCacheFile(__DIR__ . '/.php-cs-fixer.cache');
|