name: "Static analysis"

on:
    pull_request:
        paths-ignore:
            - "*.md"
    push:
        branches-ignore:
            - 'dependabot/**'
    release:
        types: [ created ]

jobs:
    static-analysis-phpstan:
        runs-on: "ubuntu-latest"

        name: "Static analysis with PHPStan"

        strategy:
            fail-fast: false
            matrix:
                php: ["8.1"]

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

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

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

            -   name: "Run a static analysis with phpstan"
                run: "vendor/bin/phpstan analyse"
