Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplication mutator should not mutate when return value is integer #1514

Closed
maks-rafalko opened this issue May 3, 2021 · 0 comments · Fixed by #1515
Closed

Multiplication mutator should not mutate when return value is integer #1514

maks-rafalko opened this issue May 3, 2021 · 0 comments · Fixed by #1515

Comments

@maks-rafalko
Copy link
Member

maks-rafalko commented May 3, 2021

Question Answer
Infection version 0.22.0
Test Framework version PHPUnit
Reproducer https://infection-php.dev/r/dld0

The following mutation does not make sense:

public function mul(int $a, int $b): int
{
-    return $a * $b;
+    return $a / $b;
}

because it is always killed since result type of new $a / $b expression is float but int is expected.

Such mutant is killed with the following error message:

TypeError: Return value of Infected\SourceClass::mul() must be of the type int, float returned
@maks-rafalko maks-rafalko changed the title Multiplication mutator should not mutate when reutn value is integer Multiplication mutator should not mutate when return value is integer May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant