Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Oct 24, 2025

@staabm staabm force-pushed the types-lost-in-never-cond branch from fb48fb4 to d93abb5 Compare October 24, 2025 06:11
@staabm staabm marked this pull request as ready for review October 24, 2025 07:05
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@VincentLanglet
Copy link
Contributor

So no issue with this PR ?

Thanks for finding it !

@staabm
Copy link
Contributor Author

staabm commented Oct 24, 2025

I think it works (but did not re-use your previous implementation)

@staabm staabm force-pushed the types-lost-in-never-cond branch 2 times, most recently from 6b9f420 to 0844b34 Compare October 28, 2025 07:07
@staabm staabm force-pushed the types-lost-in-never-cond branch from 0844b34 to d02bcc3 Compare October 29, 2025 08:51

if ($context->true()) {
if (
$scope->getType($expr->left)->isFalse()->yes()
Copy link
Member

Choose a reason for hiding this comment

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

My head hurts 😅

I think all the isTrue/isFalse calls should do toBoolean() beforehand.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great catch. fixed.

thank you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm maybe we should have a $type->isFalse()->yes()/$type->isTrue()->yes() to $type->toBoolean()->isFalse()->yes()/$type->toBoolean()->isTrue()->yes() mutator.

it would make us aware of false/falsey coverage

run: |
php build-infection/bin/infection-config.php \
--source-directory='build/PHPStan/Build' \
--timeout=180 \
Copy link
Contributor Author

@staabm staabm Oct 29, 2025

Choose a reason for hiding this comment

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

in the worst case infection needs enough time to run the full test-suite.
otherwise mutants are considered 'skipped', which we saw in CI:

grafik

this setting means: "how many seconds can infection spent on a single mutant"

Copy link
Contributor Author

@staabm staabm Oct 29, 2025

Choose a reason for hiding this comment

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

opened a new ticket, as we need more information to proceed.
infection/infection#2510

even after raising the timeout to 300 it still times out.
so at phpstan-src repo we are so slow, that we can't even check 3 mutants in 15minutes CI runtime.

we can merge for now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lets fix this in a separate PR

@ondrejmirtes
Copy link
Member

Make a build-infection issue for the new mutator idea 😊

@ondrejmirtes ondrejmirtes merged commit 95d3e90 into phpstan:2.1.x Oct 29, 2025
539 of 553 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

array_key_exist inference is lost when adding a false condition AssertArrayHasKey seems to be not supported

4 participants