@@ -49,6 +49,9 @@ |
||
49 | 49 | return new static($name); |
50 | 50 | } |
51 | 51 | |
52 | + /** |
|
53 | + * @param string $name |
|
54 | + */ |
|
52 | 55 | public function __construct($name) { |
53 | 56 | parent::__construct($name); |
54 | 57 | $this->initParameters(); |
@@ -17,6 +17,9 @@ |
||
17 | 17 | private $visitors; |
18 | 18 | private $filename; |
19 | 19 | |
20 | + /** |
|
21 | + * @param string $filename |
|
22 | + */ |
|
20 | 23 | public function __construct($filename) { |
21 | 24 | $this->filename = $filename; |
22 | 25 | $this->visitors = new Set(); |
@@ -4,7 +4,7 @@ |
||
4 | 4 | use gossi\codegen\model\AbstractModel; |
5 | 5 | use gossi\codegen\model\RoutineInterface; |
6 | 6 | |
7 | -Trait RoutineBuilderPart { |
|
7 | +trait RoutineBuilderPart { |
|
8 | 8 | |
9 | 9 | use TypeBuilderPart; |
10 | 10 |
@@ -42,7 +42,7 @@ |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | protected function writeFunctionReturnType(RoutineInterface $model): void { |
45 | - $type = $this->getType($model, $this->config->getGenerateReturnTypeHints(), $this->config->getGenerateNullableTypes()); |
|
45 | + $type = $this->getType($model, $this->config->getGenerateReturnTypeHints(), $this->config->getGenerateNullableTypes()); |
|
46 | 46 | if ($type !== null && $this->config->getGenerateReturnTypeHints()) { |
47 | 47 | $this->writer->write(': ')->write($type); |
48 | 48 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * Returns whether this node is a boolean value |
75 | 75 | * |
76 | 76 | * @param Node $node |
77 | - * @return boolean |
|
77 | + * @return boolean|null |
|
78 | 78 | */ |
79 | 79 | private function isBool(Node $node) { |
80 | 80 | if ($node instanceof ConstFetch) { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * Returns whether this node is a null value |
92 | 92 | * |
93 | 93 | * @param Node $node |
94 | - * @return boolean |
|
94 | + * @return boolean|null |
|
95 | 95 | */ |
96 | 96 | private function isNull(Node $node) { |
97 | 97 | if ($node instanceof ConstFetch) { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * Returns the value from a node |
105 | 105 | * |
106 | 106 | * @param Node $node |
107 | - * @return mixed |
|
107 | + * @return string |
|
108 | 108 | */ |
109 | 109 | private function getExpression(Node $node) { |
110 | 110 | if ($node instanceof ConstFetch) { |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @return bool `true` if they will be generated and `false` if not |
238 | 238 | */ |
239 | 239 | public function getGenerateNullableTypes(): bool { |
240 | - return $this->options['generateNullableTypes']; |
|
240 | + return $this->options['generateNullableTypes']; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | * @return $this |
248 | 248 | */ |
249 | 249 | public function setGenerateNullableTypes(bool $generate) { |
250 | - $this->options['generateNullableTypes'] = $generate; |
|
251 | - return $this; |
|
250 | + $this->options['generateNullableTypes'] = $generate; |
|
251 | + return $this; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return bool |
73 | 73 | */ |
74 | 74 | public function getNullable(): bool { |
75 | - return $this->typeNullable; |
|
75 | + return $this->typeNullable; |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @return $this |
83 | 83 | */ |
84 | 84 | public function setNullable(bool $nullable) { |
85 | - $this->typeNullable = $nullable; |
|
86 | - return $this; |
|
85 | + $this->typeNullable = $nullable; |
|
86 | + return $this; |
|
87 | 87 | } |
88 | 88 | } |
@@ -38,13 +38,13 @@ |
||
38 | 38 | || ($allowed && in_array($type, self::$php7typeHints))) |
39 | 39 | ) { |
40 | 40 | |
41 | - $type = isset(self::$typeHintMap[$type]) |
|
42 | - ? self::$typeHintMap[$type] |
|
43 | - : $type; |
|
41 | + $type = isset(self::$typeHintMap[$type]) |
|
42 | + ? self::$typeHintMap[$type] |
|
43 | + : $type; |
|
44 | 44 | |
45 | - if ($nullable && $model->getNullable()) { |
|
46 | - $type = '?' . $type; |
|
47 | - } |
|
45 | + if ($nullable && $model->getNullable()) { |
|
46 | + $type = '?' . $type; |
|
47 | + } |
|
48 | 48 | |
49 | 49 | return $type; |
50 | 50 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | use TypeBuilderPart; |
14 | 14 | |
15 | 15 | public function build(AbstractModel $model): void { |
16 | - $type = $this->getType($model, $this->config->getGenerateScalarTypeHints(), $this->config->getGenerateNullableTypes()); |
|
16 | + $type = $this->getType($model, $this->config->getGenerateScalarTypeHints(), $this->config->getGenerateNullableTypes()); |
|
17 | 17 | if ($type !== null) { |
18 | 18 | $this->writer->write($type . ' '); |
19 | 19 | } |