diff --git a/.github/workflows/reusable-phpstan.yml b/.github/workflows/reusable-phpstan.yml index d33b0a7..0ae5da0 100644 --- a/.github/workflows/reusable-phpstan.yml +++ b/.github/workflows/reusable-phpstan.yml @@ -2,6 +2,12 @@ name: PHPStan on: workflow_call: + inputs: + version: + description: "The PHPStan version to use. Defaults to the latest available version." + type: string + required: false + default: "" jobs: phpstan: @@ -18,13 +24,22 @@ jobs: with: files: "phpstan.neon*" + - name: Create tools string + id: tools + run: | + if [ "${{ inputs.version }}" == "" ]; then + echo 'TOOLS=phpstan' >> "$GITHUB_OUTPUT" + else + echo 'TOOLS=phpstan:${{ inputs.version }}' >> "$GITHUB_OUTPUT" + fi + - name: Install PHP if: ${{ steps.has_config.outputs.files_exists == 'true' }} uses: shivammathur/setup-php@v2 with: php-version: 'latest' coverage: none - tools: phpstan + tools: ${{ steps.tools.outputs.TOOLS }} # Install dependencies and handle caching in one go. # Dependencies need to be installed to make sure the PHPUnit classes are recognized.