Skip to content

Commit

Permalink
Run PHPStan as Github Action (#2)
Browse files Browse the repository at this point in the history
* Depend on PHPUnit for development

In order to run the unit tests, PHPUnit is a hard dev
dependency, so I've included it in this commit, and now
I can run the unit tests as part of this PR.

* Depend on PHPStan for development

This is for willdurand#89 - to ensure correct type hints are provided
to developers who use IDEs.

* Fix object model of AcceptHeader interface

Fixes willdurand#89 - IDEs and PHPStan are happy with this implementation

* Correct return type

* Correct nonexistent Priority class to AcceptHeader

* Improve typehint - allow looser type to be returned

* Improve typehint - more accurate types as parameters

* Improve typehint - more accurate generics as parameters

* Expose script property - was only ever written

* Properly typehint associative array

* Typehint nullable string

* Match typehints of parent method

* Add PHPStan to CI

* Configure PHPUnit versions for different PHP runtimes

* Use real phpunit
  • Loading branch information
g105b authored Feb 15, 2022
1 parent b453ccd commit 91a9d73
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,30 @@ jobs:
uses: "ramsey/composer-install@v1"

- name: "Run PHPUnit"
run: "vendor/bin/simple-phpunit --coverage-text"
run: "vendor/bin/phpunit --coverage-text"

phpstan:
runs-on: "ubuntu-20.04"

strategy:
fail-fast: false
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"

steps:
- uses: actions/checkout@v2

- name: "Install PHP ${{ matrix.php-version }}"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"

- name: "Run PHPStan"
run: "vendor/bin/phpstan analyse src --level 5"

0 comments on commit 91a9d73

Please sign in to comment.