-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from abbadon1334/upgrade-to-unit-8
upgrade to phpunit8 + php7.2+
- Loading branch information
Showing
12 changed files
with
441 additions
and
1,737 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,120 @@ | ||
version: "2" | ||
plugins: | ||
# Disabling plugins until there is a reasonable way to sanitize their output | ||
phpcodesniffer: | ||
enabled: false | ||
config: | ||
standard: "PSR1,PSR2" | ||
ignore_warnings: true | ||
encoding: utf-8 | ||
phpmd: | ||
enabled: false | ||
sonar-php: | ||
enabled: false | ||
|
||
checks: | ||
argument-count: | ||
config: | ||
threshold: 5 | ||
complex-logic: | ||
config: | ||
threshold: 4 | ||
file-lines: | ||
config: | ||
threshold: 1000 | ||
method-complexity: | ||
config: | ||
threshold: 50 | ||
method-count: | ||
config: | ||
threshold: 40 | ||
method-lines: | ||
config: | ||
threshold: 100 | ||
nested-control-flow: | ||
config: | ||
threshold: 4 | ||
return-statements: | ||
config: | ||
threshold: 7 | ||
similar-code: | ||
config: | ||
threshold: 100 | ||
identical-code: | ||
config: | ||
threshold: 150 | ||
|
||
|
||
#engines: | ||
# duplication: | ||
# enabled: true | ||
# config: | ||
# languages: | ||
# php: | ||
# mass_threshold: 50 | ||
# fixme: | ||
# enabled: true | ||
# phpmd: | ||
# enabled: true | ||
# exclude_fingerprints: | ||
# - 9d462b7c90c564bf28007ee399340fad # table() NPath is too complex. | ||
# - 7c90035f65bb3bdbd2c03c648a705aac # we use static for factory, so it's good | ||
# - 80ef7f404dd4f054ca51d9ee12d9e9dd # we exit from toStrign() because it can't throw exceptions | ||
# - ae61f5e0cda0328c140f3b7298dbb8af # don't complain about call to static connection, as it's a fallback | ||
# - e71149b967391adfaf3347a53d3c0023 # don't complain about $junk used in foreach when we only need keys | ||
# checks: | ||
# CyclomaticComplexity: # because we solve complex stuff | ||
# enabled: false | ||
# Naming/LongVariable: # because we have variable naming patterns | ||
# enabled: false | ||
# UnusedFormalParameter: # because when we extend methods/hooks we wish to keep unified method call interface | ||
# enabled: false | ||
# Design/TooManyPublicMethods: # because we follow our internal design patters | ||
# enabled: false | ||
# Design/TooManyMethods: # because we solve complex stuff | ||
# enabled: false | ||
# Design/LongMethod: # because methods are as long as we need them to be | ||
# enabled: false | ||
# ExcessivePublicCount: # because Model has too many public methods | ||
# enabled: false | ||
# Design/TooManyFields: # because we solve complex things | ||
# enabled: false | ||
# Design/NpathComplexity: # because splitting up complex stuff into methods makes things even more complex | ||
# enabled: false | ||
# Design/WeightedMethodCount: # because we we solve complex stuff | ||
# enabled: false | ||
# Design/LongClass: # because we design carefully what is native and what is extension | ||
# enabled: false | ||
# Controversial/CamelCaseMethodName: # because we need certain method naming patterns, render_blah for rendering [blah] | ||
# enabled: false | ||
# Controversial/CamelCaseParameterName: # | ||
# enabled: false | ||
# Controversial/CamelCasePropertyName: # because we use _better_dont_change properties | ||
# enabled: false | ||
# Controversial/CamelCaseVariableName: # | ||
# enabled: false | ||
# Controversial/CamelCaseClassName: # Because we use Join_SQL where we specifically include _ | ||
# enabled: false | ||
# Naming/ShortVariable: # because sometimes variables should be short | ||
# enabled: false | ||
# CleanCode/ElseExpression: # because following this makes code more complex | ||
# enabled: false | ||
# | ||
# radon: | ||
# enabled: true | ||
#ratings: | ||
# paths: | ||
# - "src/**" | ||
#exclude_paths: | ||
#- "docs/**" | ||
#- "tests/**" | ||
#- "vendor/**" | ||
## exclude obsolete classes | ||
#- "src/Field_Many.php" | ||
#- "src/Field_One.php" | ||
#- "src/Field_SQL_One.php" | ||
#- "src/Relation_Many.php" | ||
#- "src/Relation_One.php" | ||
#- "src/Relation_SQL_One.php" | ||
## exclude classes completely inherited from other repos | ||
#- "src/Exception.php" |
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,6 @@ | ||
# Set folder to clover (must be the same on travis) | ||
coverage_clover: build/logs/clover.xml | ||
# Same folder here | ||
json_path: build/logs/coveralls-upload.json | ||
# Don't touch that | ||
service_name: travis-ci |
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,105 @@ | ||
<?php | ||
/* | ||
* This document has been generated with | ||
* https://mlocati.github.io/php-cs-fixer-configurator/?version=2.15#configurator | ||
* you can change this configuration by importing this file. | ||
*/ | ||
return PhpCsFixer\Config::create() | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'@PSR1' => true, | ||
'@PSR2' => true, | ||
// Each line of multi-line DocComments must have an asterisk [PSR-5] and must be aligned with the first one. | ||
'align_multiline_comment' => ['comment_type' => 'phpdocs_like'], | ||
// PHP arrays should be declared using the configured syntax. | ||
'array_syntax' => ['syntax' => 'short'], | ||
// Binary operators should be surrounded by space as configured. | ||
'binary_operator_spaces' => [ | ||
'align_double_arrow' => true, | ||
'align_equals' => true | ||
], | ||
// An empty line feed should precede a return statement. | ||
'blank_line_before_return' => true, | ||
// Concatenation should be spaced according configuration. | ||
'concat_space' => true, | ||
// Equal sign in declare statement should be surrounded by spaces or not following configuration. | ||
'declare_equal_normalize' => true, | ||
// Force strict types declaration in all files. | ||
// Requires PHP >= 7.0. | ||
'declare_strict_types' => true, | ||
// Transforms imported FQCN parameters and return types in function arguments to short version. | ||
'fully_qualified_strict_types' => true, | ||
// All instances created with new keyword must be followed by braces. | ||
'new_with_braces' => true, | ||
// There should not be blank lines between docblock and the documented element. | ||
'no_blank_lines_after_phpdoc' => true, | ||
// There should not be any empty comments. | ||
'no_empty_comment' => true, | ||
// There should not be empty PHPDoc blocks. | ||
'no_empty_phpdoc' => true, | ||
// Remove useless semicolon statements. | ||
'no_empty_statement' => true, | ||
// Remove trailing commas in list function calls. | ||
'no_trailing_comma_in_list_call' => true, | ||
// PHP single-line arrays should not have trailing comma. | ||
'no_trailing_comma_in_singleline_array' => true, | ||
// Removes unneeded curly braces that are superfluous and aren't part of a control structure's body. | ||
'no_unneeded_curly_braces' => true, | ||
// There should not be useless `else` cases. | ||
'no_useless_else' => true, | ||
// There should not be an empty `return` statement at the end of a function. | ||
'no_useless_return' => true, | ||
// Array index should always be written by using square braces. | ||
'normalize_index_brace' => true, | ||
// PHPDoc should contain `@param` for all params. | ||
'phpdoc_add_missing_param_annotation' => true, | ||
// All items of the given phpdoc tags must be either left-aligned or (by default) aligned vertically. | ||
'phpdoc_align' => true, | ||
// PHPDoc annotation descriptions should not be a sentence. | ||
'phpdoc_annotation_without_dot' => true, | ||
// Docblocks should have the same indentation as the documented subject. | ||
'phpdoc_indent' => true, | ||
// Fix PHPDoc inline tags, make `@inheritdoc` always inline. | ||
'phpdoc_inline_tag' => true, | ||
// `@access` annotations should be omitted from PHPDoc. | ||
'phpdoc_no_access' => true, | ||
// `@return void` and `@return null` annotations should be omitted from PHPDoc. | ||
'phpdoc_no_empty_return' => true, | ||
// `@package` and `@subpackage` annotations should be omitted from PHPDoc. | ||
'phpdoc_no_package' => true, | ||
// Classy that does not inherit must not have `@inheritdoc` tags. | ||
'phpdoc_no_useless_inheritdoc' => true, | ||
// Annotations in PHPDoc should be ordered so that `@param` annotations come first, then `@throws` annotations, then `@return` annotations. | ||
'phpdoc_order' => true, | ||
// Scalar types should always be written in the same form. | ||
// `int` not `integer`, `bool` not `boolean`, `float` not `real` or `double`. | ||
'phpdoc_scalar' => true, | ||
// Single line `@var` PHPDoc should have proper spacing. | ||
'phpdoc_single_line_var_spacing' => true, | ||
// PHPDoc summary should end in either a full stop, exclamation mark, or question mark. | ||
'phpdoc_summary' => true, | ||
// Docblocks should only be used on structural elements. | ||
'phpdoc_to_comment' => true, | ||
// PHPDoc should start and end with content, excluding the very first and last line of the docblocks. | ||
'phpdoc_trim' => true, | ||
// The correct case must be used for standard PHP types in PHPDoc. | ||
'phpdoc_types' => true, | ||
// There should be one or no space before colon, and one space after it in return type declarations, according to configuration. | ||
'return_type_declaration' => true, | ||
// Replace all `<>` with `!=`. | ||
'standardize_not_equals' => true, | ||
// Comparisons should be strict. | ||
'strict_comparison' => true, | ||
// PHP multi-line arrays should have a trailing comma. | ||
'trailing_comma_in_multiline_array' => true, | ||
// Add void return type to functions with missing or empty return statements, but priority is given to `@return` annotations. | ||
// Requires PHP >= 7.1. | ||
'void_return' => true, | ||
// Write conditions in Yoda style (`true`), non-Yoda style (`false`) or ignore those conditions (`null`) based on configuration. | ||
'yoda_style' => true, | ||
]) | ||
->setFinder(PhpCsFixer\Finder::create() | ||
->exclude('vendor') | ||
->in(__DIR__) | ||
) | ||
; |
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,16 @@ | ||
{ | ||
"extensions": [ | ||
"php" | ||
], | ||
"exclude": [ | ||
"demos", | ||
"infra", | ||
"tests", | ||
"composer", | ||
"vendor", | ||
"generated" | ||
], | ||
"report-xml": "./build/report/phpmetrics.xml", | ||
"report-html": "./build/report/phpmetrics.html", | ||
"report-csv": "./build/report/phpmetrics.csv" | ||
} |
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,7 @@ | ||
preset: laravel | ||
|
||
enabled: | ||
- alpha_ordered_imports | ||
|
||
disabled: | ||
- length_ordered_imports |
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 |
---|---|---|
@@ -1,18 +1,23 @@ | ||
language: php | ||
|
||
php: | ||
- 5.6 | ||
- 7.0 | ||
- 7.1 | ||
- 7.2 | ||
- 7.3 | ||
|
||
before_script: | ||
- composer self-update | ||
- composer install --prefer-source --dev | ||
- curl -s http://getcomposer.org/installer | php | ||
- php composer.phar install -n | ||
- composer require satooshi/php-coveralls:~1.0@stable # Require phpCoveralls | ||
- mkdir -p coverage/xml # Create a folder to store clover files #1 | ||
- mkdir -p build/logs # Create a folder to store clover files #2 | ||
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | ||
- chmod +x ./cc-test-reporter | ||
- ./cc-test-reporter before-build | ||
|
||
script: | ||
- phpunit | ||
- php vendor/bin/phpunit --coverage-clover build/logs/clover.xml | ||
|
||
notifications: | ||
email: false | ||
after_script: | ||
- php vendor/bin/codacycoverage clover build/logs/clover.xml | ||
- sh -c 'if( [ "$TRAVIS_PHP_VERSION" != "hhvm" ] ); then php vendor/bin/coveralls -v; fi;' | ||
- ./cc-test-reporter after-build --coverage-input-type clover --exit-code $TRAVIS_TEST_RESULT |
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
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.