diff --git a/metagen.inc.php b/metagen.inc.php index 4724cde..c853754 100644 --- a/metagen.inc.php +++ b/metagen.inc.php @@ -654,7 +654,7 @@ class mtgMetaService extends mtgMetaUnit implements mtgScope function addUserType(mtgUserType $utype) { - if($this->hasRPC($utype->getName())) + if($this->hasRPC($utype->getName()) || $this->hasUserType($utype->getName())) throw new Exception("Service '{$this->name}' already has type '{$utype->getName()}'"); $this->user_types[$utype->getName()] = $utype; @@ -675,7 +675,7 @@ class mtgMetaService extends mtgMetaUnit implements mtgScope function addEvent(mtgMetaStruct $evt) { $this->events[] = $evt; - $this->addUserStruct($evt); + $this->addUserType($evt); } function getEvents() : array diff --git a/parser2.inc.php b/parser2.inc.php index 5635d14..963cbf3 100644 --- a/parser2.inc.php +++ b/parser2.inc.php @@ -358,7 +358,7 @@ class mtgMetaInfoParser2 implements mtgIMetaInfoParser return $values; } - private function _parseEnum($is_global = true) + private function _parseEnum($is_global = true) : mtgMetaEnum { $this->_nextT(); $name = $this->_parseDotName(); @@ -694,7 +694,7 @@ class mtgMetaInfoParser2 implements mtgIMetaInfoParser $this->_nextT(); } - private function _parseRPC($is_global = true) + private function _parseRPC($is_global = true) : mtgMetaRPC { $this->_nextT(); $code = $this->T_value; @@ -754,7 +754,7 @@ class mtgMetaInfoParser2 implements mtgIMetaInfoParser else if($this->T == self::T_Enum) $service->addUserType($this->_parseEnum(false)); else if($this->T == self::T_Event) - $service->addUserType($this->_parseEvent()); + $service->addEvent($this->_parseEvent()); else $this->_error("Unsupported type"); }