Skip to content

Instantly share code, notes, and snippets.

@jrmessias
Created August 13, 2025 11:42
Show Gist options
  • Select an option

  • Save jrmessias/baafbd2dbd31b6797d3c2aacbcbac2ba to your computer and use it in GitHub Desktop.

Select an option

Save jrmessias/baafbd2dbd31b6797d3c2aacbcbac2ba to your computer and use it in GitHub Desktop.
PHP CS Fixer Configuration
<?php
$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__);
$config = new PhpCsFixer\Config();
return $config
->setRules([
'@PSR12' => true, // Use PSR-12 coding standards
'array_syntax' => [
'syntax' => 'short' // Enforce short array syntax
],
'binary_operator_spaces' => [
'default' => 'single_space' // Ensure consistent spacing around operators
],
'blank_line_before_statement' => [
'statements' => [
'return',
'throw',
'try'
]
],
'method_chaining_indentation' => true,
'no_unused_imports' => true,
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => ['class', 'function', 'const']
]
])
->setFinder($finder)
->setUsingCache(true)
->setRiskyAllowed(true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment