/** * Generate a constant declaration and return it. * * @return string The generated constant declaration. */ public function generate() { $lineFeed = self::getConfig()->getNewline(); $code = $this->generateDocBlock(); $code .= "const {$this->name} = {$this->value->generate()};" . $lineFeed; return $code; }
/** * Generate the parameter and return it. * * @return string The generated parameter. */ public function generate() { $code = $this->type ? $this->type . ' ' : ''; $code .= '$' . $this->name; $code .= $this->value ? ' = ' . $this->value->generate() : ''; return $code; }
/** * Generate the property and return it. * * @return string The generated property. */ public function generate() { $visibility = $this->getVisibilityKeyword(); $lineFeed = self::getConfig()->getNewline(); $code = $this->generateDocBlock(); $code .= $visibility . ' '; $code .= $this->isStatic ? 'static ' : ''; $code .= '$' . $this->name; $code .= $this->value ? " = " . $this->value->generate() : ''; $code .= ';' . $lineFeed; return $code; }
/** * Test if throws an exception if the value cannot be auto discovered. * * @expectedException \UnexpectedValueException */ public function testExceptionForTypeAutoDiscovering() { $value = new PHPValue(new \stdClass()); $value->generate(); }