Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 31 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
branches:
- "2.0.x"

concurrency:
group: tests-${{ github.head_ref || github.run_id }} # will be canceled on subsequent pushes in pull requests but not branches
cancel-in-progress: true

jobs:
lint:
name: "Lint"
Expand Down Expand Up @@ -148,7 +152,7 @@ jobs:
mutation-testing:
name: "Mutation Testing"
runs-on: "ubuntu-latest"
needs: ["tests", "static-analysis"]
#needs: ["tests", "static-analysis"]

strategy:
fail-fast: false
Expand All @@ -169,7 +173,7 @@ jobs:
php-version: "${{ matrix.php-version }}"
ini-file: development
extensions: pdo, mysqli, pgsql, pdo_mysql, pdo_pgsql, pdo_sqlite, mongodb
tools: infection:0.31.6
tools: infection:0.31.7

- name: "Allow installing on PHP 8.4"
if: matrix.php-version == '8.4'
Expand All @@ -178,10 +182,32 @@ jobs:
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress"

- uses: "actions/download-artifact@v4"
- name: "Checkout build-infection"
uses: actions/checkout@v5
with:
name: "result-cache-${{ matrix.php-version }}"
path: "tmp/"
repository: "phpstan/build-infection"
path: "build-infection"
ref: "1.x"

- name: "Install build-infection dependencies"
working-directory: "build-infection"
run: "composer install --no-interaction --no-progress"

- name: "Configure mutators"
run: |
php build-infection/bin/infection-config.php \
--mutator-class='PHPStan\Infection\TrinaryLogicMutator' \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we can configure the used mutators by just appending
--mutator-class='PHPStan\Infection\TrinaryLogicMutator' \
as often as required

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like the list to be just in build-infection. I don't expect different projects to need different mutators.

> infection.json5
cat infection.json5 | jq

- name: "Cache Result cache"
uses: actions/cache@v4
if: always()
with:
path: ./tmp
key: "result-cache-v14-${{ matrix.php-version }}-${{ github.run_id }}"
restore-keys: |
result-cache-v14-${{ matrix.php-version }}-

- name: "Run infection"
run: |
Expand Down Expand Up @@ -240,9 +266,3 @@ jobs:

- name: "PHPStan"
run: "make phpstan"

- uses: "actions/upload-artifact@v4"
Copy link
Contributor Author

@staabm staabm Oct 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of uploading/downloading artifacts for caching, I changed to use actions/cache because that way it also works on phpstan-src. special in phpstan-src is that the "static-analysis" and "test" jobs are spread across 2 workflows, which makes artifact handling otherwise complicated

with:
# "update-packages" is not relevant for the download-artifact counterpart, but we need it here to get unique artifact names across all jobs
name: "result-cache-${{ matrix.php-version }}${{ matrix.update-packages && '-packages-updated' || '' }}"
path: "tmp/resultCache.php"
17 changes: 0 additions & 17 deletions infection.json5

This file was deleted.

1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ parameters:
- tests/*/data-attributes/*
- tests/*/data-php-*/*
- tests/Rules/Doctrine/ORM/entity-manager.php
- tests/Infection/

reportUnmatchedIgnoredErrors: false

Expand Down
9 changes: 9 additions & 0 deletions src/Rules/Doctrine/ORM/QueryBuilderDqlRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@
}

$calledOnType = $scope->getType($node->var);

// testing stuff
$obj = (new ObjectType('SomeClass'))->isSuperTypeOf($calledOnType);
if ($obj->yes()) {

Check warning on line 60 in src/Rules/Doctrine/ORM/QueryBuilderDqlRule.php

View workflow job for this annotation

GitHub Actions / Mutation Testing (8.2)

Escaped Mutant for Mutator "PHPStan\Infection\TrinaryLogicMutator": @@ @@ $calledOnType = $scope->getType($node->var); // testing stuff $obj = (new ObjectType('SomeClass'))->isSuperTypeOf($calledOnType); - if ($obj->yes()) { + if (!$obj->no()) { $x = 1; } else { $x = 2;
$x = 1;
} else {
$x = 2;
}

$queryBuilderTypes = DoctrineTypeUtils::getQueryBuilderTypes($calledOnType);
if (count($queryBuilderTypes) === 0) {
if (
Expand Down
69 changes: 0 additions & 69 deletions tests/Infection/TrinaryLogicMutator.php

This file was deleted.

Loading