accept null as input and returm if so
authorEduardo <[email protected]>
Fri, 10 Nov 2023 02:22:50 +0000 (03:22 +0100)
committerEduardo <[email protected]>
Fri, 10 Nov 2023 02:22:50 +0000 (03:22 +0100)
page-generator/generator.php

index 15a724e7c50fa7fd71d9e932c6724cfc759ed74b..c7e5f3a3a811e1f77b72f2da3d0667cd6fe196c2 100644 (file)
@@ -57,8 +57,11 @@ class CodeGenerator
     /**
      * Create or append to a file ($filePath) the text in $content
      */
-    function writeToFile(string $filePath, string $content)
+    function writeToFile(string $filePath, string | null $content)
     {
+        if (is_null($content))
+            return;
+        
         file_put_contents($filePath, $content, FILE_APPEND | LOCK_EX);
     }