Skip to content

Commit 19730a1

Browse files
committed
add: php cs fixer and run script
1 parent f7cb80e commit 19730a1

File tree

2 files changed

+154
-1
lines changed

2 files changed

+154
-1
lines changed

Diff for: .php-cs-fixer.php

+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
<?php
2+
3+
return (new PhpCsFixer\Config())
4+
->setRules([
5+
'@PSR12' => true,
6+
'array_indentation' => true,
7+
'array_syntax' => ['syntax' => 'short'],
8+
'combine_consecutive_unsets' => true,
9+
'class_attributes_separation' => ['elements' => ['method' => 'one']],
10+
'multiline_whitespace_before_semicolons' => [
11+
'strategy' => 'no_multi_line',
12+
],
13+
'single_quote' => true,
14+
15+
'binary_operator_spaces' => [
16+
'operators' => [
17+
'=>' => 'align',
18+
// '=' => 'align'
19+
]
20+
],
21+
// 'blank_line_after_opening_tag' => true,
22+
// 'blank_line_before_statement' => true,
23+
'braces' => [
24+
'allow_single_line_closure' => true,
25+
'position_after_functions_and_oop_constructs' => 'same'
26+
],
27+
// 'cast_spaces' => true,
28+
// 'class_definition' => array('singleLine' => true),
29+
'concat_space' => ['spacing' => 'one'],
30+
'declare_equal_normalize' => true,
31+
'function_typehint_space' => true,
32+
'single_line_comment_style' => ['comment_types' => ['hash']],
33+
'include' => true,
34+
'lowercase_cast' => true,
35+
'method_argument_space' => [
36+
'keep_multiple_spaces_after_comma' => true,
37+
],
38+
/*ekan teke check korete hobe start*/
39+
'elseif' => true,
40+
'full_opening_tag' => true,
41+
'function_declaration' => true,
42+
'linebreak_after_opening_tag' => true,
43+
'lowercase_cast' => true,
44+
'magic_method_casing' => true,
45+
'magic_constant_casing' => true,
46+
'lowercase_keywords' => true,
47+
'lowercase_static_reference' => true,
48+
// 'global_namespace_import' => [
49+
// 'import_classes' => null,
50+
// 'import_constants' => true,
51+
// 'import_functions' => true,
52+
// ],
53+
'ordered_imports' => [
54+
'sort_algorithm' => 'alpha'
55+
],
56+
'increment_style' => ['style' => 'post'],
57+
'single_import_per_statement' => true,
58+
'single_line_after_imports' => true,
59+
'no_spaces_inside_parenthesis' => true,
60+
'no_trailing_comma_in_singleline' => true,
61+
'no_trailing_whitespace' => true,
62+
'no_trailing_whitespace_in_comment' => true,
63+
64+
/*ekan teke check korete hobe end*/
65+
66+
'native_function_casing' => true,
67+
// 'new_with_braces' => true,
68+
'no_blank_lines_after_class_opening' => true,
69+
// 'no_blank_lines_after_phpdoc' => true,
70+
// 'no_blank_lines_before_namespace' => true,
71+
// 'no_empty_comment' => true,
72+
// 'no_empty_phpdoc' => true,
73+
// 'no_empty_statement' => true,
74+
'no_extra_blank_lines' => [
75+
'tokens' => [
76+
'curly_brace_block',
77+
'extra',
78+
// 'parenthesis_brace_block',
79+
// 'square_brace_block',
80+
'throw',
81+
'use',
82+
]
83+
],
84+
85+
'no_leading_import_slash' => true,
86+
'no_leading_namespace_whitespace' => true,
87+
// 'no_mixed_echo_print' => array('use' => 'print'),
88+
'no_multiline_whitespace_around_double_arrow' => true,
89+
// 'no_short_bool_cast' => true,
90+
'no_singleline_whitespace_before_semicolons' => true,
91+
'no_spaces_around_offset' => true,
92+
// 'no_trailing_comma_in_list_call' => true,
93+
'no_unneeded_control_parentheses' => [
94+
'statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield'],
95+
],
96+
'strict_comparison' => true,
97+
'no_unused_imports' => true,
98+
'no_useless_return' => true,
99+
'no_whitespace_before_comma_in_array' => true,
100+
'no_whitespace_in_blank_line' => true,
101+
// 'normalize_index_brace' => true,
102+
'object_operator_without_whitespace' => true,
103+
'yoda_style' => true,
104+
'combine_consecutive_issets' => true,
105+
// 'php_unit_fqcn_annotation' => true,
106+
// 'phpdoc_align' => true,
107+
// 'phpdoc_annotation_without_dot' => true,
108+
// 'phpdoc_indent' => true,
109+
// 'phpdoc_inline_tag' => true,
110+
// 'phpdoc_no_access' => true,
111+
// 'phpdoc_no_alias_tag' => true,
112+
// 'phpdoc_no_empty_return' => true,
113+
// 'phpdoc_no_package' => true,
114+
// 'phpdoc_no_useless_inheritdoc' => true,
115+
// 'phpdoc_return_self_reference' => true,
116+
// 'phpdoc_scalar' => true,
117+
// 'phpdoc_separation' => true,
118+
// 'phpdoc_single_line_var_spacing' => true,
119+
// 'phpdoc_summary' => true,
120+
// 'phpdoc_to_comment' => true,
121+
// 'phpdoc_trim' => true,
122+
// 'phpdoc_types' => true,
123+
// 'phpdoc_var_without_name' => true,
124+
// 'increment_style' => true,
125+
// 'return_type_declaration' => true,
126+
// 'self_accessor' => true,
127+
// 'short_scalar_cast' => true,
128+
// 'single_blank_line_before_namespace' => true,
129+
// 'single_class_element_per_statement' => true,
130+
// 'space_after_semicolon' => true,
131+
// 'standardize_not_equals' => true,
132+
'ternary_operator_spaces' => true,
133+
// 'trailing_comma_in_multiline' => ['elements' => ['arrays']],
134+
'trim_array_spaces' => true,
135+
'unary_operator_spaces' => true,
136+
'whitespace_after_comma_in_array' => true,
137+
'space_after_semicolon' => true,
138+
// 'single_blank_line_at_eof' => false
139+
])
140+
->setIndent(' ')
141+
->setRiskyAllowed(true)
142+
->setLineEnding("\n");

Diff for: composer.json

+12-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"wiki": "https://github.com/mdabbas-cse/php-mvc-framework/wiki"
1818
},
1919
"require": {
20-
"php": "7.4|^8.0"
20+
"php": "7.4|^8.0",
21+
"friendsofphp/php-cs-fixer": "^3.13"
2122
},
2223
"license": "MIT",
2324
"authors": [
@@ -40,5 +41,15 @@
4041
"psr-4": {
4142
"Lora\\Core\\Tests\\": "tests/"
4243
}
44+
},
45+
"scripts": {
46+
"test": "./vendor/bin/phpunit --testdox --colors=always tests/ --exclude-group db",
47+
"unused-variables": "phpcs -p --standard=VariableAnalysis includes",
48+
"variable-fix": "vendor/bin/psalter --alter --issues=UnusedVariable",
49+
"version": "phpcs -p --standard=PHPCompatibilityWP --runtime-set testVersion 5.6-8.1 includes",
50+
"fix-all": "php-cs-fixer fix includes",
51+
"fix": "php-cs-fixer fix",
52+
"pcf-commands": "php-cs-fixer",
53+
"code-status": "php-cs-fixer fix --dry-run --show-progress=dots --ansi --diff -vv ./"
4354
}
4455
}

0 commit comments

Comments
 (0)