Skip to content

Commit

Permalink
Update code style to use PHP 8.0 features (#2)
Browse files Browse the repository at this point in the history
* Update code style for PHP 8.0

* Add mutation testing

* Add psalm static type checks

* Remove unsupported features

Raises types to psalm level 2

* Raise psalm level to 1 and totally typed

* Add more tests to squash mutations

* For now reduce required minCoverageMsi
  • Loading branch information
dkreuer authored Jul 28, 2021
1 parent 9573d8b commit d703514
Show file tree
Hide file tree
Showing 24 changed files with 4,297 additions and 1,591 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/mutation-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: "Mutation tests"

on:
pull_request:
push:

jobs:
mutation-tests:
name: "Mutation tests"

runs-on: ${{ matrix.operating-system }}

strategy:
matrix:
dependencies:
- "locked"
php-version:
- "8.0"
operating-system:
- "ubuntu-latest"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 0

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2, cs2pr

- name: "Cache dependencies"
uses: "actions/cache@v2"
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"

- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --no-interaction --no-progress"

- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress"

- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install --no-interaction --no-progress"

- name: "Checkout current HEAD as a named ref"
run: "git checkout -b ci-run-branch"

- name: "Infection"
run: "vendor/bin/infection"
56 changes: 56 additions & 0 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: "Static Analysis by Psalm"

on:
pull_request:
push:

jobs:
static-analysis-psalm:
name: "Static Analysis by Psalm"

runs-on: ${{ matrix.operating-system }}

strategy:
matrix:
dependencies:
- "locked"
php-version:
- "8.0"
operating-system:
- "ubuntu-latest"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2, cs2pr

- name: "Cache dependencies"
uses: "actions/cache@v2"
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}"

- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --no-interaction --no-progress"

- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress"

- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install --no-interaction --no-progress"

- name: "psalm"
run: "vendor/bin/psalm --output-format=github --shepherd --stats"
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
"php": "8.0.*"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
"infection/infection": "^0.24.0",
"phpunit/phpunit": "^9.5",
"mikey179/vfsstream": "^v1.6.9",
"vimeo/psalm": "^4.8.1"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit d703514

Please sign in to comment.