Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate code which better matches our formatting standards #501

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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