From ee97b7d6cb1f13438864d2ef583f644496d0e9a9 Mon Sep 17 00:00:00 2001 From: Sergio Brighenti Date: Sun, 17 Sep 2023 01:51:31 +0200 Subject: [PATCH] handle bools --- docs/docs/alterations/interlace.md | 4 ++-- docs/docs/alterations/resizeCanvas.md | 4 ++-- generator.php | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/docs/alterations/interlace.md b/docs/docs/alterations/interlace.md index b2a4ebc..875486f 100644 --- a/docs/docs/alterations/interlace.md +++ b/docs/docs/alterations/interlace.md @@ -1,7 +1,7 @@ # `interlace()` ``` -->interlace([bool $interlace = 1]): self +->interlace([bool $interlace = true]): self ``` ## Parameters @@ -18,6 +18,6 @@ Instance of `SergiX44\ImageZen\Image`. use SergiX44\ImageZen\Image; $image = Image::make('path/to/image.jpg') - ->interlace([bool $interlace = 1]); + ->interlace([bool $interlace = true]); ``` diff --git a/docs/docs/alterations/resizeCanvas.md b/docs/docs/alterations/resizeCanvas.md index 4f26012..438f6dd 100644 --- a/docs/docs/alterations/resizeCanvas.md +++ b/docs/docs/alterations/resizeCanvas.md @@ -1,7 +1,7 @@ # `resizeCanvas()` ``` -->resizeCanvas(?int $width, ?int $height, [SergiX44\ImageZen\Draws\Position $anchor = SergiX44\ImageZen\Draws\Position::CENTER], [bool $relative = ], [?SergiX44\ImageZen\Draws\Color $background = null]): self +->resizeCanvas(?int $width, ?int $height, [SergiX44\ImageZen\Draws\Position $anchor = SergiX44\ImageZen\Draws\Position::CENTER], [bool $relative = false], [?SergiX44\ImageZen\Draws\Color $background = null]): self ``` ## Parameters @@ -22,6 +22,6 @@ Instance of `SergiX44\ImageZen\Image`. use SergiX44\ImageZen\Image; $image = Image::make('path/to/image.jpg') - ->resizeCanvas(?int $width, ?int $height, [SergiX44\ImageZen\Draws\Position $anchor = SergiX44\ImageZen\Draws\Position::CENTER], [bool $relative = ], [?SergiX44\ImageZen\Draws\Color $background = null]); + ->resizeCanvas(?int $width, ?int $height, [SergiX44\ImageZen\Draws\Position $anchor = SergiX44\ImageZen\Draws\Position::CENTER], [bool $relative = false], [?SergiX44\ImageZen\Draws\Color $background = null]); ``` diff --git a/generator.php b/generator.php index 7418a42..c2d7428 100644 --- a/generator.php +++ b/generator.php @@ -37,7 +37,7 @@ $file = __DIR__ . "/docs/docs/alterations/$id.md"; if (file_exists($file) && AVOID_OVERWRITE) { - return; + continue; } @@ -67,6 +67,10 @@ $val = "{$e->getDeclaringClass()->getName()}::{$e->getName()}"; } + if (is_bool($val)) { + $val = $val ? 'true' : 'false'; + } + $params .= "[{$parameter->getType()} \${$parameter->getName()} = {$val}]"; } else { $params .= "{$parameter->getType()} \${$parameter->getName()}";