Skip to content

Commit 61a871c

Browse files
committed
Generate code which better matches our formatting standards
Currently we generate it wrong and then the auto-formatter fixes it -- generating it correctly in the first place isn't hard though
1 parent a2a4072 commit 61a871c

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

generator/src/FileCreator.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ public function generatePhpFile(array $functions, string $path): void
3535
\fwrite($stream, "<?php\n
3636
namespace Safe;
3737
38-
use Safe\\Exceptions\\".self::toExceptionName($module). ';
39-
');
38+
use Safe\\Exceptions\\".self::toExceptionName($module). ';');
4039
foreach ($phpFunctions as $phpFunction) {
41-
\fwrite($stream, $phpFunction."\n");
40+
\fwrite($stream, "\n".$phpFunction);
4241
}
4342
\fclose($stream);
4443
}

generator/src/Parameter.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,7 @@ public function isNullable(): bool
8181
return true;
8282
}
8383

84-
if ($this->getDefaultValue() === "null") {
85-
return true;
86-
}
87-
88-
return $this->getDefaultValue() === "NULL";
84+
return ($this->getDefaultValue() === "null");
8985
}
9086

9187
/*
@@ -114,6 +110,10 @@ public function getDefaultValue(): ?string
114110
return null;
115111
}
116112

113+
if ($initializer === "NULL") {
114+
return "null";
115+
}
116+
117117
return $initializer;
118118
}
119119

0 commit comments

Comments
 (0)