name: "Static analysis"

on:
    push:
        branches:
            - "main"
            - "master"
    pull_request: null

jobs:
    static-analysis:
        runs-on: "ubuntu-latest"
        name: "PHPStan on PHP ${{ matrix.php }}"
        strategy:
            fail-fast: false
            matrix:
                php:
                    - "8.1"
        steps:
            -   name: "Check out repository code"
                uses: "actions/checkout@v2"

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

            -   name: "Install Composer dependencies"
                uses: "ramsey/composer-install@v2"
                with:
                    dependency-versions: "highest"

            -   name: "Perform static analysis"
                run: "make phpstan"
