Skip to content

Commit

Permalink
Generate code which better matches our formatting standards
Browse files Browse the repository at this point in the history
Currently we generate it wrong and then the auto-formatter fixes it -- generating it correctly in the first place isn't hard though
  • Loading branch information
shish committed Dec 5, 2024
1 parent a2a4072 commit 61a871c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
5 changes: 2 additions & 3 deletions generator/src/FileCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ public function generatePhpFile(array $functions, string $path): void
\fwrite($stream, "<?php\n
namespace Safe;
use Safe\\Exceptions\\".self::toExceptionName($module). ';
');
use Safe\\Exceptions\\".self::toExceptionName($module). ';');
foreach ($phpFunctions as $phpFunction) {
\fwrite($stream, $phpFunction."\n");
\fwrite($stream, "\n".$phpFunction);
}
\fclose($stream);
}
Expand Down
10 changes: 5 additions & 5 deletions generator/src/Parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ public function isNullable(): bool
return true;
}

if ($this->getDefaultValue() === "null") {
return true;
}

return $this->getDefaultValue() === "NULL";
return ($this->getDefaultValue() === "null");
}

/*
Expand Down Expand Up @@ -114,6 +110,10 @@ public function getDefaultValue(): ?string
return null;
}

if ($initializer === "NULL") {
return "null";
}

return $initializer;
}

Expand Down

0 comments on commit 61a871c

Please sign in to comment.