-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat: set up project to use Paratest #136
base: master
Are you sure you want to change the base?
Conversation
@DenTray Could you please review this one? |
src/Drivers/BaseDriver.php
Outdated
rewind($handle); | ||
fwrite($handle, json_encode($data, JSON_THROW_ON_ERROR)); | ||
|
||
flock($handle, LOCK_UN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flock($handle, LOCK_UN); | |
fclose($handle); |
src/Drivers/BaseDriver.php
Outdated
$handle = @fopen($this->tempFilePath, 'r'); | ||
|
||
return json_decode($content, true); | ||
if ($handle === false) { | ||
return null; | ||
} | ||
|
||
return null; | ||
flock($handle, LOCK_SH); | ||
|
||
$content = stream_get_contents($handle); | ||
|
||
return json_decode($content, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move all low-level code to the separate function
$content = $this->getFileContentWithLock($this->tempFilePath);
return json_decode($content, true);
src/Drivers/BaseDriver.php
Outdated
} | ||
|
||
public function getTmpData(): ?array | ||
{ | ||
if (file_exists($this->tempFilePath)) { | ||
$content = file_get_contents($this->tempFilePath); | ||
$handle = @fopen($this->tempFilePath, 'r'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use try catch instead
…in different workers;
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
Done: