forked from fossar/selfoss
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Travis will check for coding style violations. Symfony Coding Style mostly works for selfoss. It is essentially PSR-2 sprinkled with some more rules for cases when PSR-2 is silent. When the code base was not consistent, I choose the most common format. These are the deviations from Symfony CS: * Opening braces after functions, methods, classes, interfaces, traits, etc. go on the same line. (Unlike PSR-2) * Lambdas do not have a space after function keyword. (Unlike PSR-2) * Concatenation operator `.` requires spaces from both sides. The codebase was actually fairly tied on this issue: 170 vs 167 lines had to be changed. The spaced variant was, however, more widely spread 52 vs 34 affected files. (Unlike Symfony) * We also do not require adding a comma after last item of multi-line array. (Unlike Symfony) * Finally, there are some minor differences from Symfony with regards to docstring handling.
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ node_modules | |
_wiki | ||
.env | ||
vendor/ | ||
.php_cs.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->exclude('libs') | ||
->exclude('utils') | ||
->in(__DIR__) | ||
->name('*.phtml'); | ||
|
||
$rules = [ | ||
'@Symfony' => true, | ||
// why would anyone put braces on different line | ||
'braces' => ['position_after_functions_and_oop_constructs' => 'same'], | ||
'function_declaration' => ['closure_function_spacing' => 'none'], | ||
// overwrite some Symfony rules | ||
'concat_space' => ['spacing' => 'one'], | ||
'phpdoc_align' => false, | ||
'phpdoc_no_empty_return' => false, | ||
'phpdoc_summary' => false, | ||
'trailing_comma_in_multiline_array' => false, | ||
// additional rules | ||
'array_syntax' => ['syntax' => 'short'], | ||
'opening_tag_plus_echo_to_short_echo_tag' => true, | ||
'phpdoc_order' => true, | ||
]; | ||
|
||
return PhpCsFixer\Config::create() | ||
->setRules($rules) | ||
->setFinder($finder); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters