public function __toString() { $string = parent::__toString(); // Add pre-release if ($this->hasPreRelease()) { $string .= '-' . $this->getPreRelease(); } // Add build if ($this->hasBuild()) { $string .= '+' . $this->getBuild(); } return $string; }