Skip to content

Commit

Permalink
Merge pull request #9 from dotkernel/issue-8
Browse files Browse the repository at this point in the history
Replaced Psalm with PHPStan
  • Loading branch information
arhimede authored Nov 22, 2024
2 parents 97f6304 + 073392c commit d24d01f
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 21 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
on:
- push

name: Run PHPStan checks

jobs:
mutation:
name: PHPStan ${{ matrix.php }}-${{ matrix.os }}

runs-on: ${{ matrix.os }}

strategy:
matrix:
os:
- ubuntu-latest

php:
- "8.2"
- "8.3"

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
coverage: pcov
ini-values: assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On
tools: composer:v2, cs2pr

- name: Determine composer cache directory
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php }}-composer-
- name: Install dependencies with composer
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Setup project
run: |
mv config/autoload/local.php.dist config/autoload/local.php
- name: Run static analysis with PHPStan
run: vendor/bin/phpstan analyse
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ Minimal project to generate a simple website.
[![Continuous Integration](https://github.com/dotkernel/light/actions/workflows/continuous-integration.yml/badge.svg?branch=1.0)](https://github.com/dotkernel/light/actions/workflows/continuous-integration.yml)
[![codecov](https://codecov.io/gh/dotkernel/light/graph/badge.svg?token=UpVJ5ELvfZ)](https://codecov.io/gh/dotkernel/light)
[![Qodana](https://github.com/dotkernel/light/actions/workflows/qodana_code_quality.yml/badge.svg)](https://github.com/dotkernel/light/actions/workflows/qodana_code_quality.yml)

[![SymfonyInsight](https://insight.symfony.com/projects/aabcfa50-aee5-4919-bb60-13a8e9a21333/big.svg)](https://insight.symfony.com/projects/aabcfa50-aee5-4919-bb60-13a8e9a21333)
[![PHPStan](https://github.com/dotkernel/light/actions/workflows/static-analysis.yml/badge.svg?branch=1.0)](https://github.com/dotkernel/light/actions/workflows/static-analysis.yml)

## Installing Dotkernel `light`

Expand Down
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@
"laminas/laminas-development-mode": "^3.12.0",
"phpunit/phpunit": "^10.5",
"roave/security-advisories": "dev-master",
"vimeo/psalm": "^5.21.1",
"vincentlanglet/twig-cs-fixer": "^2.12"
"vincentlanglet/twig-cs-fixer": "^2.12",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"symfony/var-dumper": "^7.1"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -90,7 +92,7 @@
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"serve": "php -S 0.0.0.0:8080 -t public/",
"static-analysis": "psalm --shepherd --stats",
"static-analysis": "phpstan analyse",
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
"twig-cs-check": "vendor/bin/twig-cs-fixer lint --config=config/twig-cs-fixer.php",
Expand Down
13 changes: 13 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
parameters:
level: 5
paths:
- src
- test
treatPhpDocTypesAsCertain: false
ignoreErrors:
-
message: '#Call to method PHPUnit\\Framework\\Assert::assertInstanceOf\(\) with .* will always evaluate to true.#'
path: test

16 changes: 0 additions & 16 deletions psalm.xml

This file was deleted.

0 comments on commit d24d01f

Please sign in to comment.