From dc8764153e27f9034ee0f9f55767d92fda41b54e Mon Sep 17 00:00:00 2001 From: "a.dmitryuk" Date: Fri, 18 Feb 2022 10:05:23 +0700 Subject: [PATCH 1/2] Throw exception if file_put_contents failed --- src/Psalm/Internal/PluginManager/ConfigFile.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Internal/PluginManager/ConfigFile.php b/src/Psalm/Internal/PluginManager/ConfigFile.php index 4fd02542575..db3a3242bd6 100644 --- a/src/Psalm/Internal/PluginManager/ConfigFile.php +++ b/src/Psalm/Internal/PluginManager/ConfigFile.php @@ -143,6 +143,9 @@ private function saveXml(DOMDocument $config_xml): void } } - file_put_contents($this->path, $new_file_contents); + $result = file_put_contents($this->path, $new_file_contents); + if ($result === false) { + throw new RuntimeException(sprintf('Unable to save xml to %s', $this->path)); + } } } From 8e1e0d1e5ed12d00754cf5e547f1c90db5e0ee1d Mon Sep 17 00:00:00 2001 From: "a.dmitryuk" Date: Fri, 18 Feb 2022 10:33:35 +0700 Subject: [PATCH 2/2] style-ci --- src/Psalm/Internal/PluginManager/ConfigFile.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Psalm/Internal/PluginManager/ConfigFile.php b/src/Psalm/Internal/PluginManager/ConfigFile.php index db3a3242bd6..a945dd24931 100644 --- a/src/Psalm/Internal/PluginManager/ConfigFile.php +++ b/src/Psalm/Internal/PluginManager/ConfigFile.php @@ -10,6 +10,7 @@ use function assert; use function file_get_contents; use function file_put_contents; +use function sprintf; use function strpos; use function substr;