Skip to content

Commit f292798

Browse files
authored
Fix boolean values handling in enum/const blocks (#44)
1 parent b3e41b0 commit f292798

File tree

7 files changed

+214
-296
lines changed

7 files changed

+214
-296
lines changed

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,22 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [0.4.47] - 2022-01-02
7+
## [0.4.49] - 2022-04-28
8+
9+
### Fixed
10+
11+
- Boolean values handling in enum/const block
12+
13+
## [0.4.48] - 2022-01-02
814

915
### Added
1016
- Support for PHP 8.1
1117

18+
## [0.4.47] - 2022-01-02
19+
20+
### Fixed
21+
- Code generation for AsyncAPI 2.1.0 schema
22+
1223
## [0.4.46] - 2021-08-29
1324

1425
### Fixed
@@ -277,6 +288,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
277288
### Fixed
278289
- Removed unnecessary regexp dependency, #7.
279290

291+
[0.4.49]: https://github.com/swaggest/go-code-builder/compare/v0.4.48...v0.4.49
292+
[0.4.48]: https://github.com/swaggest/go-code-builder/compare/v0.4.47...v0.4.48
280293
[0.4.47]: https://github.com/swaggest/go-code-builder/compare/v0.4.46...v0.4.47
281294
[0.4.46]: https://github.com/swaggest/go-code-builder/compare/v0.4.45...v0.4.46
282295
[0.4.45]: https://github.com/swaggest/go-code-builder/compare/v0.4.44...v0.4.45

composer.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"swaggest/json-schema-maker": "^0.3.2"
2424
},
2525
"require-dev": {
26-
"phpunit/phpunit": "4.8.36",
26+
"phperf/phpunit": "4.8.37",
2727
"victorjonsson/markdowndocs": "^1.3"
2828
},
2929
"autoload": {
@@ -40,10 +40,5 @@
4040
"platform": {
4141
"php": "5.6.1"
4242
}
43-
},
44-
"scripts": {
45-
"post-install-cmd": [
46-
"patch -N -s -p0 < ./tests/phpunit.patch"
47-
]
4843
}
4944
}

composer.lock

Lines changed: 91 additions & 86 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Templates/Constant/TypeConstBlock.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ protected function toString()
4141
if (!is_scalar($value)) {
4242
continue;
4343
}
44-
$value = $this->escapeValue($value);
44+
if ($value === true) {
45+
$value = 'true';
46+
} elseif ($value === false) {
47+
$value = 'false';
48+
} else {
49+
$value = $this->escapeValue($value);
50+
}
4551

4652
if (isset($this->comments[$name])) {
4753
$result .= "\t//" . $name . ' ' . $this->comments[$name] . "\n";

0 commit comments

Comments
 (0)