Skip to content

Commit 33717ea

Browse files
Added config files
1 parent 4e17d82 commit 33717ea

File tree

4 files changed

+183
-0
lines changed

4 files changed

+183
-0
lines changed

.php_cs

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use PhpCsFixer\Config;
6+
use PhpCsFixer\Finder;
7+
8+
$finder = Finder::create()
9+
->in(__DIR__)
10+
->exclude([
11+
'media',
12+
'tests',
13+
'vendor',
14+
]);
15+
16+
$rules = [
17+
'@PSR1' => true,
18+
'@PSR2' => true,
19+
20+
'align_multiline_comment' => true,
21+
'array_indentation' => true,
22+
'array_syntax' => [
23+
'syntax' => 'short',
24+
],
25+
'blank_line_after_opening_tag' => true,
26+
'blank_line_before_statement' => [
27+
'statements' => ['return', 'throw'],
28+
],
29+
'cast_spaces' => [
30+
'space' => 'none',
31+
],
32+
'class_attributes_separation' => [
33+
'elements' => ['method', 'property'],
34+
],
35+
'combine_consecutive_issets' => true,
36+
'combine_consecutive_unsets' => true,
37+
'compact_nullable_typehint' => true,
38+
'concat_space' => [
39+
'spacing' => 'one',
40+
],
41+
'declare_equal_normalize' => true,
42+
'declare_strict_types' => true,
43+
'ereg_to_preg' => true,
44+
'fully_qualified_strict_types' => true,
45+
'function_to_constant' => true,
46+
'function_typehint_space' => true,
47+
'heredoc_indentation' => true,
48+
'heredoc_to_nowdoc' => true,
49+
'list_syntax' => true,
50+
'logical_operators' => true,
51+
'lowercase_cast' => true,
52+
'lowercase_static_reference' => true,
53+
'magic_constant_casing' => true,
54+
'magic_method_casing' => true,
55+
'mb_str_functions' => true,
56+
'method_chaining_indentation' => true,
57+
'modernize_types_casting' => true,
58+
'multiline_comment_opening_closing' => true,
59+
'multiline_whitespace_before_semicolons' => true,
60+
'native_function_casing' => true,
61+
'native_function_type_declaration_casing' => true,
62+
'new_with_braces' => true,
63+
'no_alias_functions' => true,
64+
'no_alternative_syntax' => true,
65+
'no_blank_lines_after_class_opening' => true,
66+
'no_blank_lines_after_phpdoc' => true,
67+
'no_break_comment' => [
68+
'comment_text' => 'No break.',
69+
],
70+
'no_empty_phpdoc' => true,
71+
'no_empty_statement' => true,
72+
'no_extra_blank_lines' => true,
73+
'no_leading_import_slash' => true,
74+
'no_leading_namespace_whitespace' => true,
75+
'no_mixed_echo_print' => true,
76+
'no_multiline_whitespace_around_double_arrow' => true,
77+
'no_php4_constructor' => true,
78+
'no_short_bool_cast' => true,
79+
'no_short_echo_tag' => true,
80+
'no_singleline_whitespace_before_semicolons' => true,
81+
'no_spaces_around_offset' => true,
82+
'no_unused_imports' => true,
83+
'no_whitespace_before_comma_in_array' => true,
84+
'no_whitespace_in_blank_line' => true,
85+
'normalize_index_brace' => true,
86+
'object_operator_without_whitespace' => true,
87+
'ordered_imports' => true,
88+
'phpdoc_add_missing_param_annotation' => true,
89+
'phpdoc_align' => [
90+
'align' => 'left',
91+
],
92+
'phpdoc_annotation_without_dot' => true,
93+
'phpdoc_indent' => true,
94+
'phpdoc_no_empty_return' => true,
95+
'phpdoc_no_package' => true,
96+
'phpdoc_order' => true,
97+
'phpdoc_scalar' => true,
98+
'phpdoc_single_line_var_spacing' => true,
99+
'phpdoc_summary' => true,
100+
'phpdoc_trim' => true,
101+
'phpdoc_trim_consecutive_blank_line_separation' => true,
102+
'phpdoc_types' => true,
103+
'phpdoc_types_order' => [
104+
'null_adjustment' => 'always_last',
105+
'sort_algorithm' => 'none',
106+
],
107+
'phpdoc_var_annotation_correct_order' => true,
108+
'phpdoc_var_without_name' => true,
109+
'random_api_migration' => true,
110+
'return_type_declaration' => true,
111+
'semicolon_after_instruction' => true,
112+
'set_type_to_cast' => true,
113+
'short_scalar_cast' => true,
114+
'simple_to_complex_string_variable' => true,
115+
'simplified_null_return' => true,
116+
'single_blank_line_before_namespace' => true,
117+
'single_line_comment_style' => true,
118+
'single_quote' => true,
119+
'single_trait_insert_per_statement' => true,
120+
'standardize_not_equals' => true,
121+
'ternary_operator_spaces' => true,
122+
'ternary_to_null_coalescing' => true,
123+
'trailing_comma_in_multiline_array' => true,
124+
'trim_array_spaces' => true,
125+
'unary_operator_spaces' => true,
126+
];
127+
128+
return Config::create()
129+
->setRules($rules)
130+
->setFinder($finder);

.travis.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Only run on the following branches.
2+
branches:
3+
only:
4+
- master
5+
- develop
6+
7+
# The language of the Travis CI container.
8+
language: php
9+
10+
# The versions of PHP to run builds against.
11+
php:
12+
- "7.1"
13+
- "7.2"
14+
- "7.3"
15+
16+
# Cache the vendor directory for quicker builds.
17+
cache:
18+
directories:
19+
- vendor
20+
21+
# Update composer and install the package dependencies.
22+
install:
23+
- composer self-update
24+
- composer install --no-interaction
25+
26+
# Run the code style and unit tests.
27+
script:
28+
- composer test:style
29+
- composer test:unit

composer.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,19 @@
2727
"illuminate/support": "~5.8.0"
2828
},
2929
"require-dev": {
30+
"friendsofphp/php-cs-fixer": "^2.15",
3031
"phpunit/phpunit": "^8.2"
3132
},
3233
"config": {
3334
"sort-packages": true
35+
},
36+
"scripts": {
37+
"test": [
38+
"@php vendor/bin/php-cs-fixer fix --config=.php_cs --allow-risky=yes --dry-run --diff --verbose --using-cache=no",
39+
"@php vendor/bin/phpunit"
40+
],
41+
"test:style": "@php vendor/bin/php-cs-fixer fix --config=.php_cs --allow-risky=yes --dry-run --diff --verbose --using-cache=no",
42+
"test:unit": "@php vendor/bin/phpunit",
43+
"fix:style": "@php vendor/bin/php-cs-fixer fix --config=.php_cs --allow-risky=yes --diff --verbose --using-cache=no"
3444
}
3545
}

phpunit.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<phpunit
2+
bootstrap="vendor/autoload.php"
3+
colors="true"
4+
convertErrorsToExceptions="true"
5+
convertNoticesToExceptions="true"
6+
convertWarningsToExceptions="true"
7+
stopOnFailure="true"
8+
>
9+
<testsuites>
10+
<testsuite name="Unit Tests">
11+
<directory>tests</directory>
12+
</testsuite>
13+
</testsuites>
14+
</phpunit>

0 commit comments

Comments
 (0)