Skip to content

Commit 841e810

Browse files
committed
Bugfix, only write return types when allowed
1 parent abe060a commit 841e810

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/generator/builder/parts/RoutineBuilderPart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected function writeParameters(RoutineInterface $model) {
4141

4242
protected function writeFunctionReturnType(RoutineInterface $model) {
4343
$type = $this->getType($model, $this->config->getGenerateReturnTypeHints());
44-
if ($type !== null) {
44+
if ($type !== null && $this->config->getGenerateReturnTypeHints()) {
4545
$this->writer->write(': ')->write($type);
4646
}
4747
}

src/generator/builder/parts/TypeBuilderPart.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ trait TypeBuilderPart {
3232
private function getType(AbstractModel $model, $allowed) {
3333
$type = $model->getType();
3434
if (!empty($type) && strpos($type, '|') === false
35-
&& (!in_array($type, self::$noTypeHints) || (
36-
$allowed && in_array($type, self::$php7typeHints))
37-
)
35+
&& (!in_array($type, self::$noTypeHints)
36+
|| ($allowed && in_array($type, self::$php7typeHints)))
3837
) {
3938
if (isset(self::$typeHintMap[$type])) {
4039
return self::$typeHintMap[$type];

0 commit comments

Comments
 (0)