refactor(FileStream): ensure resource is closed in destructor
Added a destructor to close the resource when the object is destroyed.
This commit is contained in:
parent
08fda2cdfd
commit
f658df0c7b
1 changed files with 5 additions and 0 deletions
|
|
@ -89,4 +89,9 @@ final readonly class FileStream
|
|||
fclose($this->resource);
|
||||
}
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->close();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue