Skip to content

Instantly share code, notes, and snippets.

@amochohan
Created February 21, 2017 16:43
Show Gist options
  • Save amochohan/81e32e5ad96d95cac765bacd74f0ef39 to your computer and use it in GitHub Desktop.
Save amochohan/81e32e5ad96d95cac765bacd74f0ef39 to your computer and use it in GitHub Desktop.
PHP code style rules
<?php
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'combine_consecutive_unsets' => true,
// one should use PHPUnit methods to set up expected exception instead of annotations
'general_phpdoc_annotation_remove' => ['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'],
'heredoc_to_nowdoc' => true,
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
'no_mixed_echo_print' => true,
'no_unreachable_default_argument_value' => true,
'no_multiline_whitespace_before_semicolons' => true,
'no_trailing_comma_in_singleline_array' => false,
'no_trailing_whitespace_in_comment' => true,
'no_trailing_whitespace' => true,
'no_short_echo_tag' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'not_operator_with_space' => false,
'not_operator_with_successor_space' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'linebreak_after_opening_tag' => true,
'php_unit_strict' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_align' => true,
'phpdoc_order' => true,
'phpdoc_summary' => true,
'psr4' => true,
'protected_to_private' => false,
'strict_comparison' => true,
'strict_param' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('tests/Fixtures')
->in(__DIR__)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment