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

SplFileInfo::getSize can return false #6680

Closed
siganushka opened this issue Feb 22, 2022 · 3 comments
Closed

SplFileInfo::getSize can return false #6680

siganushka opened this issue Feb 22, 2022 · 3 comments
Labels
Milestone

Comments

@siganushka
Copy link

Bug report

SplFileInfo::getSize can return int|false,

see https://www.php.net/manual/zh/splfileinfo.getsize.php

The filesize in bytes on success, or false on failure.

Code snippet that reproduces the problem

$file = new \SplFileInfo('./README.md');
$bytes = $file->getSize();
if (false === $bytes) {
    throw new \RuntimeException('Unable to get file size.');
}

Expected output

Strict comparison using === between false and int will always evaluate to false.
@ondrejmirtes
Copy link
Member

Please send a PR that updates https://github.com/phpstan/phpstan-src/blob/master/resources/functionMap.php. Thanks.

@ondrejmirtes
Copy link
Member

Fixed by phpstan/phpstan-src#1034

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants