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
False Positive (not finding deprecated warning on Implicit conversion from float to int) #1620
Comments
could you please try adding |
@maks-rafalko Thank you for the suggestion. That did not appear to have any effect. I had the smart idea of ensuring PHP is setup with error_reporting being set to -1, but the problem persists. Commits: failOnWarning error_reporting=-1 |
Ok, the issue is much more complex than I thought. First of all, let's state that PHPUnit does not fail on PHP 8.1 with implicit conversion deprecation. You can check it by removing docker run --rm -v "$PWD":/opt -w /opt php:8.1-cli /opt/vendor/bin/phpunit
PHPUnit 9.5.10 by Sebastian Bergmann and contributors.
.........
[PHP Deprecated: Implicit conversion from float 2.807354922057604 to int loses precision in /opt/src/LogarithmicBinaryExploder.php on line 25]
[PHP Deprecated: Implicit conversion from float 1.584962500721156 to int loses precision in /opt/src/LogarithmicBinaryExploder.php on line 25]
. 10 / 10 (100%)
Time: 00:00.003, Memory: 10.00 MB
OK (10 tests, 32 assertions) and checking by Then there is a question - how to return non-zero error code for these deprecations? From what I know, only I tried to install it and configure, and it fails PHPUnit execution with docker run --rm -v "$PWD":/opt -w /opt php:8.1-cli sh -c "SYMFONY_DEPRECATIONS_HELPER=max[self]=0 vendor/bin/simple-phpunit"
PHPUnit 9.5.10 by Sebastian Bergmann and contributors.
Testing
.......... 10 / 10 (100%)
Time: 00:00.004, Memory: 8.00 MB
OK (10 tests, 32 assertions)
Remaining self deprecation notices (2)
1x: Implicit conversion from float 2.807354922057604 to int loses precision
1x in LogarithmicBinaryExploderTest::testSeven from Navarr\BinaryExploder\Test
1x: Implicit conversion from float 1.584962500721156 to int loses precision
1x in LogarithmicBinaryExploderTest::testSeven from Navarr\BinaryExploder\Test
check by Ok, but there is one more issue. Infection does not check return code infection/src/TestFramework/PhpUnit/Adapter/PhpUnitAdapter.php Lines 121 to 144 in c770354
Probably, we can solve this issue by updating this code infection/src/Mutant/MutantExecutionResultFactory.php Lines 102 to 105 in c770354
to the following: - if ($process->getExitCode() > 100) {
+ if ($process->getExitCode() !== 0) {
// See \Symfony\Component\Process\Process::$exitCodes
return DetectionStatus::ERROR;
} and in this case Infection will treat such execution as failure. However, you will still need to use @infection/core am I missing something here? what do you think about it? |
PHPUnit can return "Tests passed! OK (10 tests, 32 assertions)" output, however return code will be non-zero. This happens when, for example, `symfony/phpunit-bridge` is used, and it detects outstanding deprecations which fails PHPUnit execution, while all the tests are passing See #1620 (comment) Now, when Test Framework exit code is > 100, Mutant will be treated as `E`rrored (retained behavior). When Test Framework exit code is non-zero, Mutant will be treated as Killed (new behavior), even if from output's point of view tests pass.
…1621) PHPUnit can return "Tests passed! OK (10 tests, 32 assertions)" output, however return code will be non-zero. This happens when, for example, `symfony/phpunit-bridge` is used, and it detects outstanding deprecations which fails PHPUnit execution, while all the tests are passing See #1620 (comment) Now, when Test Framework exit code is > 100, Mutant will be treated as `E`rrored (retained behavior). When Test Framework exit code is non-zero, Mutant will be treated as Killed (new behavior), even if from output's point of view tests pass.
After some time away from the computer, revisiting this, I found Adding this to the phpunit.xml file and setting true on it has turned the result from |
Nice, but I don't think Infection should set it automatically as many projects allow deprecations. Is there anything we can do on our side from your point of view? Should we close it? |
Feel free to reopen if needed |
infection.phar --version
)Github Actions run: https://github.com/navarr/binary-explode/runs/4596804439?check_suite_focus=true
log
to anint
Linephpunit.xml
Output with issue
The text was updated successfully, but these errors were encountered: