-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
550 additions
and
403 deletions.
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
// Use PHP-CS-Fixer 2+ if it is available | ||
if (\class_exists('PhpCsFixer\Config', false)) { | ||
return require __DIR__.'/.php_cs.dist'; | ||
} | ||
|
||
$header = <<<'EOF' | ||
This file is part of PhpZabbixApi. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
@copyright The MIT License (MIT) | ||
@author confirm IT solutions GmbH, Rathausstrase 14, CH-6340 Baar | ||
EOF; | ||
|
||
return Symfony\CS\Config\Config::create() | ||
->setUsingCache(true) | ||
->fixers(array( | ||
'newline_after_open_tag', | ||
'no_useless_else', | ||
'no_useless_return', | ||
'ordered_use', | ||
'php_unit_construct', | ||
'-phpdoc_annotation_without_dot', | ||
'-phpdoc_params', | ||
'-phpdoc_to_comment', | ||
'-psr0', | ||
'unalign_double_arrow', | ||
'unalign_equals', | ||
)) | ||
->finder( | ||
Symfony\CS\Finder\DefaultFinder::create() | ||
->in(__DIR__) | ||
->exclude(array('vendor', 'build/templates')) | ||
) | ||
; |
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,108 @@ | ||
<?php | ||
|
||
$header = <<<'EOF' | ||
This file is part of PhpZabbixApi. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
@copyright The MIT License (MIT) | ||
@author confirm IT solutions GmbH, Rathausstrase 14, CH-6340 Baar | ||
EOF; | ||
|
||
// Use PHP-CS-Fixer 2+ if it is available | ||
return PhpCsFixer\Config::create() | ||
->setUsingCache(true) | ||
->setRiskyAllowed(true) | ||
->setRules(array( | ||
'@PSR2' => true, | ||
'@Symfony' => true, | ||
'@Symfony:risky' => true, | ||
'align_multiline_comment' => true, | ||
'array_indentation' => true, | ||
'array_syntax' => array('syntax' => 'long'), | ||
'blank_line_before_statement' => true, | ||
'combine_consecutive_issets' => true, | ||
'combine_consecutive_unsets' => true, | ||
'declare_strict_types' => false, | ||
'dir_constant' => true, | ||
'ereg_to_preg' => true, | ||
'explicit_string_variable' => true, | ||
'global_namespace_import' => array('import_classes' => false), | ||
'header_comment' => array('header' => $header), | ||
'heredoc_to_nowdoc' => true, | ||
'linebreak_after_opening_tag' => true, | ||
'logical_operators' => true, | ||
'method_argument_space' => true, | ||
'multiline_whitespace_before_semicolons' => true, | ||
'native_function_invocation' => false, | ||
'no_alternative_syntax' => true, | ||
'no_empty_comment' => true, | ||
'no_extra_consecutive_blank_lines' => array( | ||
'break', | ||
'continue', | ||
'extra', | ||
'return', | ||
'throw', | ||
'use', | ||
'parenthesis_brace_block', | ||
'square_brace_block', | ||
'curly_brace_block', | ||
), | ||
'no_homoglyph_names' => true, | ||
'no_null_property_initialization' => true, | ||
'no_short_echo_tag' => true, | ||
'no_spaces_inside_parenthesis' => true, | ||
'no_superfluous_elseif' => true, | ||
'no_superfluous_phpdoc_tags' => array('allow_mixed' => true), | ||
'no_unneeded_curly_braces' => true, | ||
'no_unneeded_final_method' => true, | ||
'no_unreachable_default_argument_value' => true, | ||
'no_unset_on_property' => true, | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
'no_whitespace_in_blank_line' => true, | ||
'ordered_class_elements' => true, | ||
'ordered_imports' => true, | ||
'phpdoc_add_missing_param_annotation' => true, | ||
'phpdoc_align' => false, | ||
'phpdoc_order' => true, | ||
'phpdoc_summary' => false, | ||
'phpdoc_to_comment' => false, | ||
'phpdoc_trim_consecutive_blank_line_separation' => true, | ||
'phpdoc_types_order' => array( | ||
'null_adjustment' => 'always_last', | ||
'sort_algorithm' => 'none', | ||
), | ||
'phpdoc_var_annotation_correct_order' => true, | ||
'php_unit_construct' => true, | ||
'php_unit_set_up_tear_down_visibility' => true, | ||
'php_unit_strict' => true, | ||
'pow_to_exponentiation' => true, | ||
'psr4' => true, | ||
'return_assignment' => true, | ||
'single_line_comment_style' => true, | ||
'void_return' => false, | ||
'yoda_style' => true, | ||
)) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->in(__DIR__) | ||
->exclude(array('vendor', 'build/templates')) | ||
) | ||
; |
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 |
---|---|---|
|
@@ -120,3 +120,4 @@ install: | |
|
||
script: | ||
- ./vendor/bin/phpunit | ||
- ./vendor/bin/php-cs-fixer fix -v |
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
Oops, something went wrong.