Skip to content

Instantly share code, notes, and snippets.

@mattattui
Last active May 9, 2016 16:27
Show Gist options
  • Save mattattui/54bed5f6f80ce9bad9841e3550fd2ac9 to your computer and use it in GitHub Desktop.
Save mattattui/54bed5f6f80ce9bad9841e3550fd2ac9 to your computer and use it in GitHub Desktop.
Tui standard code guidelines
<?php
/* This is a cut-down version of the symfony standard code style guidelines
* To use it, add this file to your project root, and run `php-cs-fixer fix`
* gotcha: if you provide a filename, then the guidelines are ignored! Fortunately
* php-cs-fixer keeps a cache and so typically runs on a whole project in less
* than a couple of seconds
* Get PHP-CS-Fixer here: https://github.com/FriendsOfPhp/PHP-CS-Fixer
*/
$finder = Symfony\CS\Finder\DefaultFinder::create()
->in(__DIR__.'/src')
;
return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
->setUsingCache(true)
->fixers([
'psr2',
'short_array_syntax',
'ordered_use',
'concat_with_spaces',
// From [symfony]
'double_arrow_multiline_whitespaces',
'duplicate_semicolon',
'empty_return',
'extra_empty_lines',
'include',
'join_function',
'list_commas',
'multiline_array_trailing_comma,',
'namespace_no_leading_whitespace',
'new_with_braces',
'no_blank_lines_after_class_opening',
'no_empty_lines_after_phpdocs',
'object_operator',
'operators_spaces',
'remove_leading_slash_use',
'remove_lines_between_uses',
'return',
'self_accessor',
'single_array_no_trailing_comma',
'single_quote',
'spaces_before_semicolon',
'spaces_cast',
'standardize_not_equal',
'ternary_spaces',
'trim_array_spaces',
'unary_operators_spaces',
'unused_use',
'whitespacy_lines',
])
->finder($finder)
;
@mattattui
Copy link
Author

If you're keen on using and maintaining PHP-Doc comments, then this can do that too. I've disabled them here, but feel free to put them back in and send them back for me to put here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment