Skip to content

Commit

Permalink
Updated CS-Fixer configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentmuller committed Feb 14, 2025
1 parent 9cf661c commit 0f3fcd9
Show file tree
Hide file tree
Showing 18 changed files with 294 additions and 212 deletions.
47 changes: 28 additions & 19 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file is part of the Calculation package.
*
Expand Down Expand Up @@ -37,44 +38,52 @@
// --------------------------------------------------------------
// Rules override
// --------------------------------------------------------------
'method_chaining_indentation' => true,
'native_function_invocation' => ['include' => ['@internal', 'all']],
'final_internal_class' => true,
'header_comment' => ['header' => $comment, 'location' => 'after_open', 'separate' => 'bottom'],
'blank_line_before_statement' => ['statements' => ['declare', 'try', 'return']],
'strict_param' => true,
'php_unit_strict' => true,
'no_useless_else' => true,
'no_unused_imports' => true,
'no_useless_return' => true,
'strict_comparison' => true,
'strict_param' => true,
'ordered_imports' => ['imports_order' => ['const', 'class', 'function']],
'ordered_class_elements' => ['sort_algorithm' => 'alpha'],
'ordered_interfaces' => true,
'final_internal_class' => true,
'method_chaining_indentation' => true,
'concat_space' => ['spacing' => 'one'],
'array_syntax' => ['syntax' => 'short'],
'list_syntax' => ['syntax' => 'short'],
'array_syntax' => ['syntax' => 'short'],
'ordered_class_elements' => ['sort_algorithm' => 'alpha'],
'attribute_empty_parentheses' => ['use_parentheses' => false],
'doctrine_annotation_array_assignment' => ['operator' => '='],
'ordered_interfaces' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'php_unit_strict' => true,
'native_function_invocation' => ['include' => ['@internal', 'all']],
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'new_with_braces' => ['anonymous_class' => true, 'named_class' => true],
'ordered_imports' => ['imports_order' => ['const', 'class', 'function']],
'blank_line_before_statement' => ['statements' => ['declare', 'try', 'return']],
'header_comment' => [
'header' => $comment,
'location' => 'after_open',
'separate' => 'bottom'],
'phpdoc_to_comment' => [
'allow_before_return_statement' => true,
'ignored_tags' => ['phpstan-var', 'psalm-suppress'],
'allow_before_return_statement' => true
],
'attribute_empty_parentheses' => ['use_parentheses' => false],
'new_with_braces' => ['anonymous_class' => true, 'named_class' => true],

];

$finder = Finder::create()
->in(__DIR__ . '/config')
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests');
->in(__DIR__ . '/tests')
->append([
__FILE__,
__DIR__ . '/public/index.php',
__DIR__ . '/.twig-cs-fixer.php',
__DIR__ . '/rector.php',
]);

$config = new Config();

return $config
->setParallelConfig(ParallelConfigFactory::detect())
->setCacheFile(__DIR__ . '/var/cache/php-cs-fixer/.php-cs-fixer.cache')
->setParallelConfig(ParallelConfigFactory::detect())
->setRiskyAllowed(true)
->setFinder($finder)
->setRules($rules);
5 changes: 3 additions & 2 deletions .twig-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file is part of the Calculation package.
*
Expand All @@ -13,8 +14,8 @@
use TwigCsFixer\Config\Config;

$cache_dir = __DIR__ . '/var/cache/twig-cs-fixer';
if (!file_exists($cache_dir)) {
mkdir($cache_dir, 0777, true);
if (!\file_exists($cache_dir)) {
\mkdir($cache_dir, 0o777, true);
}

$config = new Config();
Expand Down
99 changes: 49 additions & 50 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion public/index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file is part of the Calculation package.
*
Expand All @@ -14,4 +15,4 @@

require_once \dirname(__DIR__) . '/vendor/autoload_runtime.php';

return fn (array $context): kernel => new Kernel((string) $context['APP_ENV'], (bool) $context['APP_DEBUG']);
return fn (array $context): Kernel => new Kernel((string) $context['APP_ENV'], (bool) $context['APP_DEBUG']);
Loading

0 comments on commit 0f3fcd9

Please sign in to comment.