Skip to content

Commit

Permalink
More tests + cleanup + psalm improvements (#55)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
vjik committed Jun 17, 2021
1 parent 99384dd commit 2c36a5d
Show file tree
Hide file tree
Showing 24 changed files with 221 additions and 172 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Expand Up @@ -12,3 +12,6 @@ trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
1 change: 0 additions & 1 deletion .gitattributes
Expand Up @@ -34,4 +34,3 @@
# Avoid merge conflicts in CHANGELOG
# https://about.gitlab.com/2015/02/10/gitlab-reduced-merge-conflicts-by-90-percent-with-changelog-placeholders/
/CHANGELOG.md merge=union

22 changes: 11 additions & 11 deletions .github/workflows/bc.yml_
@@ -1,15 +1,15 @@
on:
- pull_request
- push
- pull_request
- push

name: backwards compatibility
jobs:
roave_bc_check:
name: Roave BC Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Roave BC Check
uses: docker://nyholm/roave-bc-check-ga
roave_bc_check:
name: Roave BC Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Roave BC Check
uses: docker://nyholm/roave-bc-check-ga
7 changes: 1 addition & 6 deletions .github/workflows/build.yml
Expand Up @@ -54,13 +54,8 @@ jobs:
- name: Update composer
run: composer self-update

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

- name: Install dependencies with composer php 8.0
if: matrix.php == '8.0'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Run tests with phpunit
run: vendor/bin/phpunit --colors=always
1 change: 1 addition & 0 deletions .github/workflows/static.yml
Expand Up @@ -17,6 +17,7 @@ jobs:

php:
- "7.4"
- "8.0"

steps:
- name: Checkout
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Expand Up @@ -29,7 +29,3 @@ phpunit.phar
/phpunit.xml
# phpunit cache
.phpunit.result.cache

# Phan
analysis.txt

16 changes: 8 additions & 8 deletions .phpunit-watcher.yml
@@ -1,11 +1,11 @@
watch:
directories:
- src
- tests
fileMask: '*.php'
directories:
- src
- tests
fileMask: '*.php'
notifications:
passingTests: false
failingTests: false
passingTests: false
failingTests: false
phpunit:
binaryPath: vendor/bin/phpunit
timeout: 180
binaryPath: vendor/bin/phpunit
timeout: 180
59 changes: 28 additions & 31 deletions .scrutinizer.yml
@@ -1,36 +1,33 @@
checks:
php: true
php: true

filter:
paths:
- "src/*"
paths:
- "src/*"

build:
nodes:
analysis:
environment:
php: 7.4.12

tests:
override:
- php-scrutinizer-run

tests-and-coverage:
environment:
php: 7.4.12

dependencies:
override:
- composer self-update
- composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

tests:
override:
-
command: "./vendor/bin/phpunit --coverage-clover ./coverage.xml"
on_node: 1
coverage:
file: coverage.xml
format: php-clover


nodes:
analysis:
environment:
php: 7.4.12

tests:
override:
- php-scrutinizer-run

tests-and-coverage:
environment:
php: 7.4.12

dependencies:
override:
- composer self-update
- composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

tests:
override:
- command: "./vendor/bin/phpunit --coverage-clover ./coverage.xml"
on_node: 1
coverage:
file: coverage.xml
format: php-clover
162 changes: 81 additions & 81 deletions .styleci.yml
Expand Up @@ -4,86 +4,86 @@ risky: true
version: 8

finder:
exclude:
- docs
- vendor
- resources
- views
- public
- templates
not-name:
- UnionCar.php
- TimerUnionTypes.php
- schema1.php
exclude:
- docs
- vendor
- resources
- views
- public
- templates
not-name:
- UnionCar.php
- TimerUnionTypes.php
- schema1.php

enabled:
- alpha_ordered_traits
- array_indentation
- array_push
- combine_consecutive_issets
- combine_consecutive_unsets
- combine_nested_dirname
- declare_strict_types
- dir_constant
- final_static_access
- fully_qualified_strict_types
- function_to_constant
- hash_to_slash_comment
- is_null
- logical_operators
- magic_constant_casing
- magic_method_casing
- method_separation
- modernize_types_casting
- native_function_casing
- native_function_type_declaration_casing
- no_alias_functions
- no_empty_comment
- no_empty_phpdoc
- no_empty_statement
- no_extra_block_blank_lines
- no_short_bool_cast
- no_superfluous_elseif
- no_unneeded_control_parentheses
- no_unneeded_curly_braces
- no_unneeded_final_method
- no_unset_cast
- no_unused_imports
- no_unused_lambda_imports
- no_useless_else
- no_useless_return
- normalize_index_brace
- php_unit_dedicate_assert
- php_unit_dedicate_assert_internal_type
- php_unit_expectation
- php_unit_mock
- php_unit_mock_short_will_return
- php_unit_namespaced
- php_unit_no_expectation_annotation
- phpdoc_no_empty_return
- phpdoc_no_useless_inheritdoc
- phpdoc_order
- phpdoc_property
- phpdoc_scalar
- phpdoc_separation
- phpdoc_singular_inheritdoc
- phpdoc_trim
- phpdoc_trim_consecutive_blank_line_separation
- phpdoc_type_to_var
- phpdoc_types
- phpdoc_types_order
- print_to_echo
- regular_callable_call
- return_assignment
- self_accessor
- self_static_accessor
- set_type_to_cast
- short_array_syntax
- short_list_syntax
- simplified_if_return
- single_quote
- standardize_not_equals
- ternary_to_null_coalescing
- trailing_comma_in_multiline_array
- unalign_double_arrow
- unalign_equals
- alpha_ordered_traits
- array_indentation
- array_push
- combine_consecutive_issets
- combine_consecutive_unsets
- combine_nested_dirname
- declare_strict_types
- dir_constant
- final_static_access
- fully_qualified_strict_types
- function_to_constant
- hash_to_slash_comment
- is_null
- logical_operators
- magic_constant_casing
- magic_method_casing
- method_separation
- modernize_types_casting
- native_function_casing
- native_function_type_declaration_casing
- no_alias_functions
- no_empty_comment
- no_empty_phpdoc
- no_empty_statement
- no_extra_block_blank_lines
- no_short_bool_cast
- no_superfluous_elseif
- no_unneeded_control_parentheses
- no_unneeded_curly_braces
- no_unneeded_final_method
- no_unset_cast
- no_unused_imports
- no_unused_lambda_imports
- no_useless_else
- no_useless_return
- normalize_index_brace
- php_unit_dedicate_assert
- php_unit_dedicate_assert_internal_type
- php_unit_expectation
- php_unit_mock
- php_unit_mock_short_will_return
- php_unit_namespaced
- php_unit_no_expectation_annotation
- phpdoc_no_empty_return
- phpdoc_no_useless_inheritdoc
- phpdoc_order
- phpdoc_property
- phpdoc_scalar
- phpdoc_separation
- phpdoc_singular_inheritdoc
- phpdoc_trim
- phpdoc_trim_consecutive_blank_line_separation
- phpdoc_type_to_var
- phpdoc_types
- phpdoc_types_order
- print_to_echo
- regular_callable_call
- return_assignment
- self_accessor
- self_static_accessor
- set_type_to_cast
- short_array_syntax
- short_list_syntax
- simplified_if_return
- single_quote
- standardize_not_equals
- ternary_to_null_coalescing
- trailing_comma_in_multiline_array
- unalign_double_arrow
- unalign_equals
2 changes: 1 addition & 1 deletion CHANGELOG.md
@@ -1,4 +1,4 @@
# Data response Change Log
# Yii Data Response Change Log

## 1.0.0 under development

Expand Down
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -2,7 +2,7 @@
<a href="https://github.com/yiisoft" target="_blank">
<img src="https://yiisoft.github.io/docs/images/yii_logo.svg" height="100px">
</a>
<h1 align="center">Yii Data response</h1>
<h1 align="center">Yii Data Response</h1>
<br>
</p>

Expand All @@ -21,6 +21,7 @@ response.
## Requirements

- PHP 7.4 or higher.
- `JSON` PHP extension.
- `DOM` PHP extension.

## Installation
Expand Down
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -19,6 +19,7 @@
"require": {
"php": "^7.4|^8.0",
"ext-dom": "*",
"ext-json": "*",
"psr/http-message": "^1.0",
"psr/http-server-middleware": "^1.0",
"yiisoft/http": "^1.0",
Expand Down
3 changes: 0 additions & 3 deletions psalm.xml
Expand Up @@ -7,8 +7,5 @@
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>

0 comments on commit 2c36a5d

Please sign in to comment.