Skip to content

Make offsets written in every iteration of a non-unrolled constant-array foreach required after the loop #35461

Make offsets written in every iteration of a non-unrolled constant-array foreach required after the loop

Make offsets written in every iteration of a non-unrolled constant-array foreach required after the loop #35461

Workflow file for this run

# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: "Static Analysis"
on:
pull_request:
paths-ignore:
- 'compiler/**'
- 'apigen/**'
push:
branches:
- "2.3.x"
paths-ignore:
- 'compiler/**'
- 'apigen/**'
concurrency:
group: sa-${{ github.head_ref || github.run_id }} # will be canceled on subsequent pushes in pull requests but not branches
cancel-in-progress: true
jobs:
static-analysis:
name: "PHPStan"
runs-on: ${{ matrix.operating-system }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
- "8.5"
- "8.6"
operating-system: [ubuntu-latest, windows-latest]
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@46b06cea07f9e64621fdf066ba77ac6915163d43 # v2.22.3
with:
egress-policy: audit
- name: "Checkout"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: "Install PHP"
uses: "shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962" # 2.40.0
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
ini-file: development
# parallel analysis forks its workers when pcntl and posix are usable, like
# it does for most Linux users; the runner's php.ini for 8.2+ disables the
# pcntl_* functions, so those jobs spawned their workers instead
extensions: "${{ matrix.operating-system == 'ubuntu-latest' && 'mbstring, pcntl, posix' || 'mbstring' }}"
ini-values: "${{ matrix.operating-system == 'ubuntu-latest' && 'disable_functions=' || '' }}"
- name: "Downgrade PHPUnit"
if: matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1'
shell: bash
run: "composer require --dev phpunit/phpunit:^9.6 sebastian/diff:^4.0 doctrine/instantiator:^1.0 --update-with-dependencies --ignore-platform-reqs"
- uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # v4.0.0
- uses: ./.github/actions/downgrade-code
with:
php-version: "${{ matrix.php-version }}"
# separate limit since some PHP8.1 only behavior is less efficient
- name: "PHPStan"
run: "php bin/phpstan clear-result-cache -q && php -d memory_limit=599M bin/phpstan -v"
if: matrix.php-version == '8.1'
- name: "PHPStan"
run: "make phpstan"
if: matrix.php-version != '8.1'
- name: "Generate baseline"
if: failure() && (matrix.php-version == '7.4' || matrix.php-version == '8.0' || matrix.php-version == '8.1')
run: "php -d memory_limit=599M bin/phpstan analyse --generate-baseline baseline-php-${{ matrix.php-version }}.neon"
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: ${{ failure() }}
with:
name: baseline-${{ matrix.php-version }}
path: baseline-php-${{ matrix.php-version }}.neon
static-analysis-with-result-cache:
name: "PHPStan with result cache"
runs-on: "ubuntu-latest"
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"
- "8.5"
- "8.6"
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@46b06cea07f9e64621fdf066ba77ac6915163d43 # v2.22.3
with:
egress-policy: audit
- name: "Checkout"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: "Install PHP"
uses: "shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962" # 2.40.0
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
ini-file: development
extensions: mbstring
- uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # v4.0.0
- name: "Cache Result cache"
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ./tmp
key: "result-cache-v15-${{ matrix.php-version }}-${{ github.run_id }}"
restore-keys: |
result-cache-v15-${{ matrix.php-version }}-
- name: "PHPStan with result cache"
run: |
make phpstan-result-cache
bin/phpstan clear-result-cache -c build/phpstan.neon
make phpstan-result-cache
echo -e "\n\n" >> src/TrinaryLogic.php
make phpstan-result-cache
make phpstan-result-cache
generate-baseline:
name: "Generate baseline"
runs-on: "ubuntu-latest"
timeout-minutes: 60
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@46b06cea07f9e64621fdf066ba77ac6915163d43 # v2.22.3
with:
egress-policy: audit
- name: "Checkout"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: "Install PHP"
uses: "shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962" # 2.40.0
with:
coverage: "none"
php-version: "8.2"
ini-file: development
- uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # v4.0.0
- name: "Generate baseline"
run: |
cp phpstan-baseline.neon phpstan-baseline-orig.neon && \
make phpstan-generate-baseline && \
diff phpstan-baseline.neon phpstan-baseline-orig.neon
generate-baseline-php:
name: "Generate PHP baseline"
runs-on: "ubuntu-latest"
timeout-minutes: 60
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@46b06cea07f9e64621fdf066ba77ac6915163d43 # v2.22.3
with:
egress-policy: audit
- name: "Checkout"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: "Install PHP"
uses: "shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962" # 2.40.0
with:
coverage: "none"
php-version: "8.2"
ini-file: development
- uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # v4.0.0
- name: "Generate baseline"
run: |
true > phpstan-baseline.neon && \
make phpstan-generate-baseline-php && \
make phpstan-result-cache