Skip to content

Commit

Permalink
fix: check file existence before unlinking, suppresses warning (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi authored Jan 9, 2025
1 parent 140192e commit 6a6d696
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 1.13.6

* chore: rector run
* fix: check file existence before unlinking, suppresses warning

## 1.13.5

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public function createObjectMapperTable(): ObjectMapperTable

return $this->objectMapperTableCache = $result;
} catch (\Throwable) {
@unlink($this->getCacheFilePath());
if (file_exists($this->getCacheFilePath())) {
@unlink($this->getCacheFilePath());
}

return $this->objectMapperTableCache = $this->warmUpAndGetResult();
}
Expand Down
4 changes: 3 additions & 1 deletion src/Mapping/Implementation/WarmableMappingFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ public function getMapping(): Mapping
throw new UnexpectedValueException();
}
} catch (\Throwable) {
@unlink($this->getCacheFilePath());
if (file_exists($this->getCacheFilePath())) {
@unlink($this->getCacheFilePath());
}

return $this->mapping = $this->warmUpAndGetMapping();
}
Expand Down

0 comments on commit 6a6d696

Please sign in to comment.