Skip to content

Commit 2c36a5d

Browse files
authored
More tests + cleanup + psalm improvements (#55)
* Add yml section to .editorconfig * Remove extra line in .gitattributes * Remove phan from .gitignore * Add PHP 8.0 to static analyze * Update build workflow * Format yml files * Improve changelog * Improve psalm config * Improve readme * Add JSON PHP extension to composer.json * Minor improvements * Add JSON PHP extension to requirements in readme * Fix type * Improve psalm annotations * Add immutability tests
1 parent 99384dd commit 2c36a5d

24 files changed

+221
-172
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ trim_trailing_whitespace = true
1212

1313
[*.md]
1414
trim_trailing_whitespace = false
15+
16+
[*.yml]
17+
indent_size = 2

.gitattributes

-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,3 @@
3434
# Avoid merge conflicts in CHANGELOG
3535
# https://about.gitlab.com/2015/02/10/gitlab-reduced-merge-conflicts-by-90-percent-with-changelog-placeholders/
3636
/CHANGELOG.md merge=union
37-

.github/workflows/bc.yml_

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
on:
2-
- pull_request
3-
- push
2+
- pull_request
3+
- push
44

55
name: backwards compatibility
66
jobs:
7-
roave_bc_check:
8-
name: Roave BC Check
9-
runs-on: ubuntu-latest
10-
steps:
11-
- uses: actions/checkout@master
12-
- name: fetch tags
13-
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
14-
- name: Roave BC Check
15-
uses: docker://nyholm/roave-bc-check-ga
7+
roave_bc_check:
8+
name: Roave BC Check
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@master
12+
- name: fetch tags
13+
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
14+
- name: Roave BC Check
15+
uses: docker://nyholm/roave-bc-check-ga

.github/workflows/build.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,8 @@ jobs:
5454
- name: Update composer
5555
run: composer self-update
5656

57-
- name: Install dependencies with composer php 7.4
58-
if: matrix.php == '7.4'
57+
- name: Install dependencies with composer
5958
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
6059

61-
- name: Install dependencies with composer php 8.0
62-
if: matrix.php == '8.0'
63-
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
64-
6560
- name: Run tests with phpunit
6661
run: vendor/bin/phpunit --colors=always

.github/workflows/static.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717

1818
php:
1919
- "7.4"
20+
- "8.0"
2021

2122
steps:
2223
- name: Checkout

.gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,3 @@ phpunit.phar
2929
/phpunit.xml
3030
# phpunit cache
3131
.phpunit.result.cache
32-
33-
# Phan
34-
analysis.txt
35-

.phpunit-watcher.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
watch:
2-
directories:
3-
- src
4-
- tests
5-
fileMask: '*.php'
2+
directories:
3+
- src
4+
- tests
5+
fileMask: '*.php'
66
notifications:
7-
passingTests: false
8-
failingTests: false
7+
passingTests: false
8+
failingTests: false
99
phpunit:
10-
binaryPath: vendor/bin/phpunit
11-
timeout: 180
10+
binaryPath: vendor/bin/phpunit
11+
timeout: 180

.scrutinizer.yml

+28-31
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,33 @@
11
checks:
2-
php: true
2+
php: true
33

44
filter:
5-
paths:
6-
- "src/*"
5+
paths:
6+
- "src/*"
77

88
build:
9-
nodes:
10-
analysis:
11-
environment:
12-
php: 7.4.12
13-
14-
tests:
15-
override:
16-
- php-scrutinizer-run
17-
18-
tests-and-coverage:
19-
environment:
20-
php: 7.4.12
21-
22-
dependencies:
23-
override:
24-
- composer self-update
25-
- composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
26-
27-
tests:
28-
override:
29-
-
30-
command: "./vendor/bin/phpunit --coverage-clover ./coverage.xml"
31-
on_node: 1
32-
coverage:
33-
file: coverage.xml
34-
format: php-clover
35-
36-
9+
nodes:
10+
analysis:
11+
environment:
12+
php: 7.4.12
13+
14+
tests:
15+
override:
16+
- php-scrutinizer-run
17+
18+
tests-and-coverage:
19+
environment:
20+
php: 7.4.12
21+
22+
dependencies:
23+
override:
24+
- composer self-update
25+
- composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
26+
27+
tests:
28+
override:
29+
- command: "./vendor/bin/phpunit --coverage-clover ./coverage.xml"
30+
on_node: 1
31+
coverage:
32+
file: coverage.xml
33+
format: php-clover

.styleci.yml

+81-81
Original file line numberDiff line numberDiff line change
@@ -4,86 +4,86 @@ risky: true
44
version: 8
55

66
finder:
7-
exclude:
8-
- docs
9-
- vendor
10-
- resources
11-
- views
12-
- public
13-
- templates
14-
not-name:
15-
- UnionCar.php
16-
- TimerUnionTypes.php
17-
- schema1.php
7+
exclude:
8+
- docs
9+
- vendor
10+
- resources
11+
- views
12+
- public
13+
- templates
14+
not-name:
15+
- UnionCar.php
16+
- TimerUnionTypes.php
17+
- schema1.php
1818

1919
enabled:
20-
- alpha_ordered_traits
21-
- array_indentation
22-
- array_push
23-
- combine_consecutive_issets
24-
- combine_consecutive_unsets
25-
- combine_nested_dirname
26-
- declare_strict_types
27-
- dir_constant
28-
- final_static_access
29-
- fully_qualified_strict_types
30-
- function_to_constant
31-
- hash_to_slash_comment
32-
- is_null
33-
- logical_operators
34-
- magic_constant_casing
35-
- magic_method_casing
36-
- method_separation
37-
- modernize_types_casting
38-
- native_function_casing
39-
- native_function_type_declaration_casing
40-
- no_alias_functions
41-
- no_empty_comment
42-
- no_empty_phpdoc
43-
- no_empty_statement
44-
- no_extra_block_blank_lines
45-
- no_short_bool_cast
46-
- no_superfluous_elseif
47-
- no_unneeded_control_parentheses
48-
- no_unneeded_curly_braces
49-
- no_unneeded_final_method
50-
- no_unset_cast
51-
- no_unused_imports
52-
- no_unused_lambda_imports
53-
- no_useless_else
54-
- no_useless_return
55-
- normalize_index_brace
56-
- php_unit_dedicate_assert
57-
- php_unit_dedicate_assert_internal_type
58-
- php_unit_expectation
59-
- php_unit_mock
60-
- php_unit_mock_short_will_return
61-
- php_unit_namespaced
62-
- php_unit_no_expectation_annotation
63-
- phpdoc_no_empty_return
64-
- phpdoc_no_useless_inheritdoc
65-
- phpdoc_order
66-
- phpdoc_property
67-
- phpdoc_scalar
68-
- phpdoc_separation
69-
- phpdoc_singular_inheritdoc
70-
- phpdoc_trim
71-
- phpdoc_trim_consecutive_blank_line_separation
72-
- phpdoc_type_to_var
73-
- phpdoc_types
74-
- phpdoc_types_order
75-
- print_to_echo
76-
- regular_callable_call
77-
- return_assignment
78-
- self_accessor
79-
- self_static_accessor
80-
- set_type_to_cast
81-
- short_array_syntax
82-
- short_list_syntax
83-
- simplified_if_return
84-
- single_quote
85-
- standardize_not_equals
86-
- ternary_to_null_coalescing
87-
- trailing_comma_in_multiline_array
88-
- unalign_double_arrow
89-
- unalign_equals
20+
- alpha_ordered_traits
21+
- array_indentation
22+
- array_push
23+
- combine_consecutive_issets
24+
- combine_consecutive_unsets
25+
- combine_nested_dirname
26+
- declare_strict_types
27+
- dir_constant
28+
- final_static_access
29+
- fully_qualified_strict_types
30+
- function_to_constant
31+
- hash_to_slash_comment
32+
- is_null
33+
- logical_operators
34+
- magic_constant_casing
35+
- magic_method_casing
36+
- method_separation
37+
- modernize_types_casting
38+
- native_function_casing
39+
- native_function_type_declaration_casing
40+
- no_alias_functions
41+
- no_empty_comment
42+
- no_empty_phpdoc
43+
- no_empty_statement
44+
- no_extra_block_blank_lines
45+
- no_short_bool_cast
46+
- no_superfluous_elseif
47+
- no_unneeded_control_parentheses
48+
- no_unneeded_curly_braces
49+
- no_unneeded_final_method
50+
- no_unset_cast
51+
- no_unused_imports
52+
- no_unused_lambda_imports
53+
- no_useless_else
54+
- no_useless_return
55+
- normalize_index_brace
56+
- php_unit_dedicate_assert
57+
- php_unit_dedicate_assert_internal_type
58+
- php_unit_expectation
59+
- php_unit_mock
60+
- php_unit_mock_short_will_return
61+
- php_unit_namespaced
62+
- php_unit_no_expectation_annotation
63+
- phpdoc_no_empty_return
64+
- phpdoc_no_useless_inheritdoc
65+
- phpdoc_order
66+
- phpdoc_property
67+
- phpdoc_scalar
68+
- phpdoc_separation
69+
- phpdoc_singular_inheritdoc
70+
- phpdoc_trim
71+
- phpdoc_trim_consecutive_blank_line_separation
72+
- phpdoc_type_to_var
73+
- phpdoc_types
74+
- phpdoc_types_order
75+
- print_to_echo
76+
- regular_callable_call
77+
- return_assignment
78+
- self_accessor
79+
- self_static_accessor
80+
- set_type_to_cast
81+
- short_array_syntax
82+
- short_list_syntax
83+
- simplified_if_return
84+
- single_quote
85+
- standardize_not_equals
86+
- ternary_to_null_coalescing
87+
- trailing_comma_in_multiline_array
88+
- unalign_double_arrow
89+
- unalign_equals

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Data response Change Log
1+
# Yii Data Response Change Log
22

33
## 1.0.0 under development
44

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<a href="https://github.com/yiisoft" target="_blank">
33
<img src="https://yiisoft.github.io/docs/images/yii_logo.svg" height="100px">
44
</a>
5-
<h1 align="center">Yii Data response</h1>
5+
<h1 align="center">Yii Data Response</h1>
66
<br>
77
</p>
88

@@ -21,6 +21,7 @@ response.
2121
## Requirements
2222

2323
- PHP 7.4 or higher.
24+
- `JSON` PHP extension.
2425
- `DOM` PHP extension.
2526

2627
## Installation

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"require": {
2020
"php": "^7.4|^8.0",
2121
"ext-dom": "*",
22+
"ext-json": "*",
2223
"psr/http-message": "^1.0",
2324
"psr/http-server-middleware": "^1.0",
2425
"yiisoft/http": "^1.0",

psalm.xml

-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,5 @@
77
>
88
<projectFiles>
99
<directory name="src" />
10-
<ignoreFiles>
11-
<directory name="vendor" />
12-
</ignoreFiles>
1310
</projectFiles>
1411
</psalm>

0 commit comments

Comments
 (0)