Skip to content

Commit

Permalink
Improve descriptor closing
Browse files Browse the repository at this point in the history
  • Loading branch information
donatj committed Oct 29, 2023
1 parent 8807147 commit 89f4ebd
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/MockWebServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class MockWebServer {
/**
* Contains the descriptors for the process after it has been started
*
* @var array|null
* @var resource[]
*/
private $descriptors = null;
private $descriptors = [];

/**
* TestWebServer constructor.
Expand Down Expand Up @@ -131,12 +131,8 @@ public function stop() : void {
}
}

if( $this->descriptors ) {
foreach( $this->descriptors as $descriptor ) {
if( is_resource($descriptor) ) {
fclose($descriptor);
}
}
foreach( $this->descriptors as $descriptor ) {
@fclose($descriptor);
}
}

Expand Down

0 comments on commit 89f4ebd

Please sign in to comment.