Skip to content

Commit eaa0fcc

Browse files
committed
add php-cs-fixer
1 parent cc366b1 commit eaa0fcc

File tree

3 files changed

+117
-5
lines changed

3 files changed

+117
-5
lines changed

.gitignore

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/tests/cache/
22

3-
# Created by https://www.toptal.com/developers/gitignore/api/windows,macos,linux,composer,phpunit,phpstorm+all,visualstudiocode
4-
# Edit at https://www.toptal.com/developers/gitignore?templates=windows,macos,linux,composer,phpunit,phpstorm+all,visualstudiocode
3+
# Created by https://www.toptal.com/developers/gitignore/api/windows,macos,linux,composer,phpunit,phpstorm+all,visualstudiocode,php-cs-fixer
4+
# Edit at https://www.toptal.com/developers/gitignore?templates=windows,macos,linux,composer,phpunit,phpstorm+all,visualstudiocode,php-cs-fixer
55

66
### Composer ###
77
composer.phar
@@ -59,6 +59,16 @@ Temporary Items
5959
# iCloud generated files
6060
*.icloud
6161

62+
### PHP-CS-Fixer ###
63+
# Covers PHP CS Fixer
64+
# Reference: https://cs.symfony.com/
65+
66+
# Generated files
67+
.php-cs-fixer.cache
68+
69+
# Local config See: https://cs.symfony.com/doc/config.html
70+
.php-cs-fixer.php
71+
6272
### PhpStorm+all ###
6373
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
6474
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
@@ -207,4 +217,4 @@ $RECYCLE.BIN/
207217
# Windows shortcuts
208218
*.lnk
209219

210-
# End of https://www.toptal.com/developers/gitignore/api/windows,macos,linux,composer,phpunit,phpstorm+all,visualstudiocode
220+
# End of https://www.toptal.com/developers/gitignore/api/windows,macos,linux,composer,phpunit,phpstorm+all,visualstudiocode,php-cs-fixer

.php-cs-fixer.dist.php

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?php declare(strict_types=1);
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->files()
5+
->in(__DIR__ . '/src')
6+
->in(__DIR__ . '/tests');
7+
8+
return (new PhpCsFixer\Config())
9+
->setFinder($finder)
10+
->setRiskyAllowed(true)
11+
->setRules([
12+
'@PSR12' => true,
13+
'modernize_types_casting' => true,
14+
'multiline_comment_opening_closing' => true,
15+
'multiline_whitespace_before_semicolons' => true,
16+
'native_type_declaration_casing' => true,
17+
'no_alias_functions' => true,
18+
'no_alias_language_construct_call' => true,
19+
'no_alternative_syntax' => true,
20+
'no_binary_string' => true,
21+
'no_blank_lines_after_phpdoc' => true,
22+
'no_empty_comment' => true,
23+
'no_empty_statement' => true,
24+
'no_extra_blank_lines' => true,
25+
'no_homoglyph_names' => true,
26+
'no_leading_namespace_whitespace' => true,
27+
'no_multiline_whitespace_around_double_arrow' => true,
28+
'no_null_property_initialization' => true,
29+
'no_short_bool_cast' => true,
30+
'no_singleline_whitespace_before_semicolons' => true,
31+
'no_spaces_around_offset' => true,
32+
'no_superfluous_elseif' => true,
33+
'no_superfluous_phpdoc_tags' => [
34+
'allow_mixed' => true,
35+
],
36+
'no_trailing_comma_in_singleline' => true,
37+
'no_trailing_whitespace_in_string' => true,
38+
'no_unneeded_braces' => true,
39+
'no_unneeded_control_parentheses' => true,
40+
'no_unneeded_import_alias' => true,
41+
'no_unset_cast' => true,
42+
'no_unset_on_property' => true,
43+
'no_unused_imports' => true,
44+
'no_useless_concat_operator' => true,
45+
'no_useless_else' => true,
46+
'no_useless_nullsafe_operator' => true,
47+
'no_useless_return' => true,
48+
'no_whitespace_before_comma_in_array' => true,
49+
'non_printable_character' => true,
50+
'normalize_index_brace' => true,
51+
'php_unit_set_up_tear_down_visibility' => true,
52+
'php_unit_test_case_static_method_calls' => [
53+
'call_type' => 'this',
54+
],
55+
'phpdoc_add_missing_param_annotation' => false,
56+
'phpdoc_align' => true,
57+
'phpdoc_annotation_without_dot' => true,
58+
'phpdoc_indent' => true,
59+
'phpdoc_inline_tag_normalizer' => true,
60+
'phpdoc_no_access' => true,
61+
'phpdoc_no_alias_tag' => true,
62+
'phpdoc_no_empty_return' => true,
63+
'phpdoc_no_package' => true,
64+
'phpdoc_no_useless_inheritdoc' => true,
65+
'phpdoc_order' => true,
66+
'phpdoc_order_by_value' => [
67+
'annotations' => [
68+
'covers',
69+
'dataProvider',
70+
'throws',
71+
'uses',
72+
],
73+
],
74+
'phpdoc_param_order' => true,
75+
'phpdoc_return_self_reference' => true,
76+
'phpdoc_scalar' => true,
77+
'phpdoc_separation' => true,
78+
'phpdoc_single_line_var_spacing' => true,
79+
'phpdoc_summary' => true,
80+
'phpdoc_tag_casing' => true,
81+
'phpdoc_tag_type' => true,
82+
'phpdoc_to_comment' => false,
83+
'phpdoc_trim' => true,
84+
'simplified_null_return' => true,
85+
'single_line_comment_spacing' => true,
86+
'single_quote' => true,
87+
'single_space_around_construct' => true,
88+
'space_after_semicolon' => true,
89+
'standardize_increment' => true,
90+
'standardize_not_equals' => true,
91+
'static_lambda' => true,
92+
'strict_param' => true,
93+
'string_length_to_empty'=> true,
94+
'string_line_ending' => true,
95+
'switch_continue_to_break' => true,
96+
'trim_array_spaces' => true,
97+
'whitespace_after_comma_in_array' => true,
98+
])
99+
->setLineEnding("\n");

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"description": "Simple API Integration for Lexoffice",
55
"scripts": {
66
"test": "phpunit",
7-
"lint": "phpstan analyse --ansi --error-format raw"
7+
"lint": "phpstan analyse --ansi --error-format raw",
8+
"codestyle:check": "php-cs-fixer check",
9+
"codestyle:fix": "php-cs-fixer fix"
810
},
911
"keywords": [
1012
"lex-office",
@@ -22,7 +24,8 @@
2224
"require-dev": {
2325
"phpstan/phpstan": "^1.10",
2426
"phpunit/phpunit": "^10.4",
25-
"guzzlehttp/guzzle": "^7.8"
27+
"guzzlehttp/guzzle": "^7.8",
28+
"friendsofphp/php-cs-fixer": "^3.41"
2629
},
2730
"suggest": {
2831
"guzzlehttp/guzzle": "^7.0",

0 commit comments

Comments
 (0)