Fix phpcs #323
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PHP Code Sniffer and Static Analysis | |
| on: | |
| push: | |
| branches: | |
| - 5.x | |
| - '5.0.0' | |
| pull_request: | |
| paths: | |
| - 'src/**/*.php' | |
| - 'phpcs.xml' | |
| - 'tests/phpcs.xml' | |
| - 'tests/phpstan.neon' | |
| - 'composer.json' | |
| - 'composer.lock' | |
| - '.github/workflows/analysis.yml' | |
| jobs: | |
| analyze: | |
| runs-on: ${{ matrix.operating-system }} | |
| strategy: | |
| matrix: | |
| operating-system: [ ubuntu-latest ] | |
| php-versions: [ '8.2' ] | |
| env: | |
| cache_version: 2 | |
| php_extensions: tokenizer, xmlwriter, simplexml, mbstring | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP extension cache | |
| id: cache-php-extensions | |
| uses: shivammathur/cache-extensions@v1 | |
| with: | |
| php-version: ${{ matrix.php-versions }} | |
| extensions: ${{ env.php_extensions }} | |
| key: ${{ matrix.operating-system }}-${{ env.cache_version }}-phpextensions-${{ matrix.php-versions }} | |
| - name: Cache PHP extensions | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.cache-php-extensions.outputs.dir }} | |
| key: ${{ steps.cache-php-extensions.outputs.key }} | |
| restore-keys: ${{ steps.cache-php-extensions.outputs.key }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-versions }} | |
| extensions: ${{ env.php_extensions }} | |
| coverage: none | |
| tools: composer:v2 | |
| - name: Validate composer.json | |
| run: composer validate --no-check-publish --no-check-lock | |
| - name: Get composer cache directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-${{ env.cache_version }}-php${{ matrix.php-versions }}-composer-${{ hashFiles('composer.json', 'composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-${{ env.cache_version }}-php${{ matrix.php-versions }}-composer- | |
| - name: Install Composer dependencies | |
| run: composer update --prefer-stable --prefer-dist --no-interaction --optimize-autoloader | |
| - name: Run PHPCS code sniffer | |
| run: php vendor/bin/phpcs | |
| - name: Run PHPStan static analysis | |
| run: php vendor/bin/phpstan analyse -c tests/phpstan.neon --memory-limit=-1 |