Stream not closed (ARCH7081)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key php.performance.stream-not-closed · Severity warning · Category performance
A file handle opened with fopen() that is never closed leaks file descriptors and may leave data unflushed. Close it with fclose() when done.
Incorrect
Section titled “Incorrect”<?phpfunction appendLine(string $path, string $line): void{ $fh = fopen($path, 'a'); fwrite($fh, $line . "\n");}Correct
Section titled “Correct”<?phpfunction appendLine(string $path, string $line): void{ $fh = fopen($path, 'a'); fwrite($fh, $line . "\n"); fclose($fh);}Close stream and file handles with fclose() as soon as you are done with them.