Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 7633e3f

Browse files
committed
Default value of ParameterGenerator is always a ValueGenerator
1 parent 0294464 commit 7633e3f

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/Generator/ParameterGenerator.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ParameterGenerator extends AbstractGenerator
3030
protected $type;
3131

3232
/**
33-
* @var string|ValueGenerator
33+
* @var ValueGenerator
3434
*/
3535
protected $defaultValue;
3636

@@ -226,7 +226,7 @@ public function setDefaultValue($defaultValue)
226226
}
227227

228228
/**
229-
* @return string
229+
* @return ValueGenerator
230230
*/
231231
public function getDefaultValue()
232232
{
@@ -306,16 +306,10 @@ public function generate()
306306

307307
$output .= '$' . $this->name;
308308

309-
if ($this->defaultValue !== null) {
309+
if ($this->defaultValue instanceof ValueGenerator) {
310310
$output .= ' = ';
311-
if (is_string($this->defaultValue)) {
312-
$output .= ValueGenerator::escape($this->defaultValue);
313-
} elseif ($this->defaultValue instanceof ValueGenerator) {
314-
$this->defaultValue->setOutputMode(ValueGenerator::OUTPUT_SINGLE_LINE);
315-
$output .= $this->defaultValue;
316-
} else {
317-
$output .= $this->defaultValue;
318-
}
311+
$this->defaultValue->setOutputMode(ValueGenerator::OUTPUT_SINGLE_LINE);
312+
$output .= $this->defaultValue;
319313
}
320314

321315
return $output;

0 commit comments

Comments
 (0)