From 82affd515433da6e9dc0a5d84c1e75af6911e78f Mon Sep 17 00:00:00 2001 From: Wes Hulette Date: Wed, 26 Sep 2018 15:10:11 -0400 Subject: [PATCH] Added PHP_CS & PHPMD files (#6234) Added PHP_CS & PHP mess detector file to help with code standardization. --- .php_cs.dist | 39 +++++++++++++++++++++++++++++++++++++ phpmd.xml | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 .php_cs.dist create mode 100644 phpmd.xml diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 0000000000..87846540f9 --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,39 @@ +notPath('bootstrap/cache') + ->notPath('storage') + ->notPath('vendor') + ->notPath('node_modules') + ->in(__DIR__) + ->name('*.php') + ->notName('*.blade.php') + ->ignoreDotFiles(true) + ->ignoreVCS(true) +; + +return PhpCsFixer\Config::create() + ->setRules(array( + '@Symfony' => true, + 'class_definition' => [ + 'multiLineExtendsEachSingleLine' => true, + ], + 'ordered_class_elements' => [ + 'use_trait', 'constant_public', 'constant_protected', 'constant_private', + 'property_public', 'property_protected', 'property_private', 'construct', + 'destruct', 'magic', 'phpunit', 'method_public', 'method_protected', + 'method_private' + ], + 'function_declaration' => ['closure_function_spacing' => 'none'], + 'binary_operator_spaces' => ['default' => 'align_single_space_minimal'], + 'array_syntax' => ['syntax' => 'short'], + 'concat_space' => ['spacing' => 'one'], + 'blank_line_after_namespace' => true, + 'linebreak_after_opening_tag' => true, + 'not_operator_with_successor_space' => true, + 'ordered_imports' => true, + 'phpdoc_order' => true, + )) + ->setFinder($finder); diff --git a/phpmd.xml b/phpmd.xml new file mode 100644 index 0000000000..d991b90fbb --- /dev/null +++ b/phpmd.xml @@ -0,0 +1,54 @@ + + + + Inspired by https://github.com/phpmd/phpmd/issues/137 + using http://phpmd.org/documentation/creating-a-ruleset.html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + + + + + + + \ No newline at end of file