Skip to content

Conversation

@VincentLanglet
Copy link
Contributor

@ondrejmirtes
Copy link
Member

Escaped mutants here. This means tests need to be written so that when the code changes like that, there will be some tests that will fail. Possibly the code logic might be wrong too.

@VincentLanglet
Copy link
Contributor Author

Escaped mutants here. This means tests need to be written so that when the code changes like that, there will be some tests that will fail. Possibly the code logic might be wrong too.

I'm not sure what should be expected here.

The mutant can only occurs if we pass string|array as second param and wether it infers non-empty-string or not seems kinda useless to me because it's already reported as an error by PHPStan which should be fixed first https://phpstan.org/r/1b1f1f8a-dbd4-417c-b251-be553d4d64d3.

Also if I try to support "maybe array" with something like

TypeCombinator::intersect(new ArrayType(new MixedType(), new MixedType()), $secondArgumentType)

I'll still get "false positive" escaped mutant because now $type->isArray()->maybe() will be useless and therefor ->yes() or ! -> no() are equivalent.

@ondrejmirtes
Copy link
Member

Maybe array is also for example mixed or array|null.

kinda useless to me because it's already reported as an error by PHPStan

Type inference and error reporting are two independent different parts of PHPStan. Type inference should still do something sensible even if the user passes a wrong type there. Especially when the wrong type might not even be reported on a lower rule level.

@VincentLanglet
Copy link
Contributor Author

No mutant escaped now @ondrejmirtes :)

The lint 8.0 failure seems unrelated/random

@VincentLanglet
Copy link
Contributor Author

No mutant escaped now @ondrejmirtes :)

The lint 8.0 failure seems unrelated/random

I also rebased and fixed all my existing PR if you have time for a look https://github.com/phpstan/phpstan-src/pulls/VincentLanglet.
I commented those with failing build, some failure are unrelated/random ; and some mutant are (I think) not fixable.

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.

non-empty-string support for strtr

3 participants