The expression yield array($f = fopen(__FILE__, 'r')) returns the type Generator which is incompatible with the documented return type array<mixed,array<mixed,resource>>.
It seems like you do not handle an error condition for fclose(). This can introduce security issues, and is generally not recommended.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-unhandled annotation
47
/** @scrutinizer ignore-unhandled */ @fclose($f);
If you suppress an error, we recommend checking for the error condition explicitly:
// For example instead of@mkdir($dir);// Better useif(@mkdir($dir)===false){thrownew\RuntimeException('The directory '.$dir.' could not be created.');}
It seems like $f can also be of type false; however, parameter $handle of fclose() does only seem to accept resource, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation