-
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added CI with Github actions * Conservative CS fixes * Fix * Use Symfony PHPUnit bridge
- Loading branch information
Showing
26 changed files
with
393 additions
and
106 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,2 @@ | ||
[*.yml] | ||
indent_size = 2 |
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,49 @@ | ||
name: Tests | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 10 | ||
matrix: | ||
php: [ '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4'] | ||
|
||
steps: | ||
- name: Set up PHP | ||
uses: shivammathur/[email protected] | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: none | ||
tools: flex | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Download dependencies | ||
run: composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable | ||
|
||
- name: Run tests | ||
run: ./vendor/bin/phpunit | ||
|
||
lowest: | ||
name: Lowest deps | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up PHP | ||
uses: shivammathur/[email protected] | ||
with: | ||
php-version: 7.3 | ||
coverage: pcov | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Download dependencies | ||
run: composer update --no-interaction --prefer-dist --optimize-autoloader --prefer-stable --prefer-lowest | ||
|
||
- name: Run tests | ||
env: | ||
SYMFONY_DEPRECATIONS_HELPER: "max[self]=0" | ||
run: ./vendor/bin/phpunit --coverage-text |
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,44 @@ | ||
on: [push, pull_request] | ||
name: Static analysis | ||
|
||
jobs: | ||
phpstan: | ||
name: PHPStan | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Download dependencies | ||
run: | | ||
composer update --no-interaction --prefer-dist --optimize-autoloader | ||
- name: PHPStan | ||
uses: docker://oskarstark/phpstan-ga:0.12.23 | ||
with: | ||
entrypoint: /composer/vendor/bin/phpstan | ||
args: analyze --no-progress | ||
|
||
php-cs-fixer: | ||
name: PHP-CS-Fixer | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: PHP-CS-Fixer | ||
uses: OskarStark/[email protected] | ||
with: | ||
args: --dry-run --diff-format udiff | ||
|
||
psalm: | ||
name: Psalm | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Psalm | ||
uses: docker://vimeo/psalm-github-actions |
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 |
---|---|---|
|
@@ -2,3 +2,6 @@ artifacts/ | |
vendor/ | ||
composer.lock | ||
phpunit.xml | ||
.php_cs | ||
.php_cs.cache | ||
.phpunit.result.cache |
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,88 @@ | ||
<?php | ||
|
||
$config = PhpCsFixer\Config::create() | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'@PSR2' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'binary_operator_spaces' => ['operators' => ['=>' => null]], | ||
'blank_line_after_opening_tag' => true, | ||
'class_attributes_separation' => ['elements' => ['method']], | ||
'compact_nullable_typehint' => true, | ||
'concat_space' => ['spacing' => 'one'], | ||
'declare_equal_normalize' => ['space' => 'none'], | ||
'declare_strict_types' => false, | ||
'dir_constant' => true, | ||
'final_static_access' => true, | ||
'fully_qualified_strict_types' => true, | ||
'function_to_constant' => true, | ||
'function_typehint_space' => true, | ||
'header_comment' => false, | ||
'is_null' => ['use_yoda_style' => false], | ||
'list_syntax' => ['syntax' => 'short'], | ||
'lowercase_cast' => true, | ||
'magic_method_casing' => true, | ||
'modernize_types_casting' => true, | ||
'multiline_comment_opening_closing' => true, | ||
//'native_constant_invocation' => true, | ||
'no_alias_functions' => true, | ||
'no_alternative_syntax' => true, | ||
'no_blank_lines_after_phpdoc' => true, | ||
'no_empty_comment' => true, | ||
'no_empty_phpdoc' => true, | ||
'no_extra_blank_lines' => true, | ||
'no_leading_import_slash' => true, | ||
'no_leading_namespace_whitespace' => true, | ||
'no_spaces_around_offset' => true, | ||
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true], | ||
'no_trailing_comma_in_singleline_array' => true, | ||
'no_unneeded_control_parentheses' => true, | ||
'no_unset_cast' => true, | ||
'no_unused_imports' => true, | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
'no_whitespace_in_blank_line' => true, | ||
'normalize_index_brace' => true, | ||
'ordered_imports' => true, | ||
'php_unit_construct' => true, | ||
'php_unit_dedicate_assert' => ['target' => 'newest'], | ||
'php_unit_dedicate_assert_internal_type' => ['target' => 'newest'], | ||
'php_unit_expectation' => ['target' => 'newest'], | ||
'php_unit_mock' => ['target' => 'newest'], | ||
'php_unit_mock_short_will_return' => true, | ||
'php_unit_no_expectation_annotation' => ['target' => 'newest'], | ||
'php_unit_test_annotation' => ['style' => 'prefix'], | ||
//'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], | ||
'phpdoc_align' => ['align' => 'vertical'], | ||
//'phpdoc_line_span' => ['method' => 'multi', 'property' => 'multi'], | ||
'phpdoc_no_package' => true, | ||
'phpdoc_no_useless_inheritdoc' => true, | ||
'phpdoc_scalar' => true, | ||
'phpdoc_separation' => true, | ||
'phpdoc_single_line_var_spacing' => true, | ||
'phpdoc_trim' => true, | ||
'phpdoc_trim_consecutive_blank_line_separation' => true, | ||
'phpdoc_types' => true, | ||
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], | ||
'phpdoc_var_without_name' => true, | ||
'return_assignment' => true, | ||
'short_scalar_cast' => true, | ||
'single_trait_insert_per_statement' => true, | ||
'standardize_not_equals' => true, | ||
//'static_lambda' => true, | ||
'ternary_to_null_coalescing' => true, | ||
'trim_array_spaces' => true, | ||
'visibility_required' => true, | ||
'yoda_style' => false, | ||
// 'native_function_invocation' => true, | ||
'braces' => ['allow_single_line_closure'=>true], | ||
]) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->in(__DIR__.'/src') | ||
->in(__DIR__.'/tests') | ||
->name('*.php') | ||
) | ||
; | ||
|
||
return $config; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
parameters: | ||
ignoreErrors: | ||
- | ||
message: "#^If condition is always true\\.$#" | ||
count: 3 | ||
path: src/EachPromise.php | ||
|
||
- | ||
message: "#^Unreachable statement \\- code above always terminates\\.$#" | ||
count: 1 | ||
path: src/EachPromise.php | ||
|
||
- | ||
message: "#^Property GuzzleHttp\\\\Promise\\\\EachPromise\\:\\:\\$concurrency \\(\\(callable\\(\\)\\: mixed\\)\\|int\\) does not accept null\\.$#" | ||
count: 1 | ||
path: src/EachPromise.php | ||
|
||
- | ||
message: "#^Property GuzzleHttp\\\\Promise\\\\EachPromise\\:\\:\\$iterable \\(Iterator\\) does not accept null\\.$#" | ||
count: 1 | ||
path: src/EachPromise.php | ||
|
||
- | ||
message: "#^Property GuzzleHttp\\\\Promise\\\\EachPromise\\:\\:\\$onFulfilled \\(callable\\(\\)\\: mixed\\) does not accept null\\.$#" | ||
count: 1 | ||
path: src/EachPromise.php | ||
|
||
- | ||
message: "#^Property GuzzleHttp\\\\Promise\\\\EachPromise\\:\\:\\$onRejected \\(callable\\(\\)\\: mixed\\) does not accept null\\.$#" | ||
count: 1 | ||
path: src/EachPromise.php | ||
|
||
- | ||
message: "#^Negated boolean expression is always false\\.$#" | ||
count: 1 | ||
path: src/EachPromise.php | ||
|
||
- | ||
message: "#^Dead catch \\- Exception is already caught by Throwable above\\.$#" | ||
count: 1 | ||
path: src/EachPromise.php | ||
|
||
- | ||
message: "#^Dead catch \\- Exception is already caught by Throwable above\\.$#" | ||
count: 1 | ||
path: src/FulfilledPromise.php | ||
|
||
- | ||
message: "#^Dead catch \\- Exception is already caught by Throwable above\\.$#" | ||
count: 2 | ||
path: src/Promise.php | ||
|
||
- | ||
message: "#^Method GuzzleHttp\\\\Promise\\\\Promise\\:\\:callHandler\\(\\) should return array but empty return statement found\\.$#" | ||
count: 1 | ||
path: src/Promise.php | ||
|
||
- | ||
message: "#^Method GuzzleHttp\\\\Promise\\\\Promise\\:\\:callHandler\\(\\) should return array but return statement is missing\\.$#" | ||
count: 1 | ||
path: src/Promise.php | ||
|
||
- | ||
message: "#^Dead catch \\- Exception is already caught by Throwable above\\.$#" | ||
count: 1 | ||
path: src/RejectedPromise.php | ||
|
||
- | ||
message: "#^Parameter \\#1 \\$function of function register_shutdown_function expects callable\\(\\)\\: void, Closure\\(\\)\\: mixed given\\.$#" | ||
count: 1 | ||
path: src/TaskQueue.php | ||
|
||
- | ||
message: "#^Variable \\$task in PHPDoc tag @var does not exist\\.$#" | ||
count: 1 | ||
path: src/TaskQueue.php | ||
|
||
- | ||
message: "#^Dead catch \\- Exception is already caught by Throwable above\\.$#" | ||
count: 2 | ||
path: src/Utils.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,7 @@ | ||
includes: | ||
- phpstan-baseline.neon | ||
|
||
parameters: | ||
level: 5 | ||
paths: | ||
- src |
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<files psalm-version="3.11.5@3c60609c218d4d4b3b257728b8089094e5c6c6c2"> | ||
<file src="src/Promise.php"> | ||
<InvalidReturnType occurrences="1"> | ||
<code>array</code> | ||
</InvalidReturnType> | ||
<RedundantCondition occurrences="2"> | ||
<code>$this->state === self::PENDING</code> | ||
<code>$this->state === self::PENDING</code> | ||
</RedundantCondition> | ||
</file> | ||
<file src="src/RejectedPromise.php"> | ||
<InvalidReturnType occurrences="1"> | ||
<code>wait</code> | ||
</InvalidReturnType> | ||
</file> | ||
</files> |
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 @@ | ||
<?xml version="1.0"?> | ||
<psalm | ||
errorLevel="4" | ||
resolveFromConfigFile="true" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="https://getpsalm.org/schema/config" | ||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" | ||
errorBaseline="psalm.baseline.xml" | ||
> | ||
<projectFiles> | ||
<directory name="src" /> | ||
<ignoreFiles> | ||
<directory name="vendor" /> | ||
</ignoreFiles> | ||
</projectFiles> | ||
</psalm> |
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
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.