Closed
Description
Bug report
The following code raise an alwaysFalse violation:
$file = new \SplFileObject('/tmp/file', "wd+");
if ($file->fwrite('a') === false) { // Should not raise alwaysFalse for php >= 7.4 as per the php documentation https://www.php.net/manual/en/splfileobject.fwrite.php
throw new \Exception("write failed !");
}
The php documentation specify that since php 7.4, false is returned when fwrite fails. Since \SplFileInfo::isWritable does not promise the file will be written.
Code snippet that reproduces the problem
https://phpstan.org/r/17742407-4eb8-48a1-ab9e-f32b219ecf97
Expected output
No violation on php >= 7.4
Did PHPStan help you today? Did it make you happy in any way?
I love phpstan, all contributors are heroes in my eye.
Metadata
Metadata
Assignees
Labels
No labels