/** * Test that property annotations are returned across @inheritDoc */ public function testGetDocBlockForProperty() { $grandChild = new TestV4ReflectionGrandchild(); $reflection = new \ReflectionClass($grandChild); $doc = ReflectionUtils::getCodeDocs($reflection->getProperty('foo'), 'Property'); $this->assertEquals('This is the foo property.', $doc['description']); $this->assertEquals("In the child class, foo has been barred.\n\nIn general, you can do nothing with it.", $doc['comment']); }
/** * @param $actionName */ private function loadAction($actionName) { try { if (!isset($this->_actions[$actionName])) { /* @var Action $action */ $action = call_user_func(array('\\Civi\\Api4\\' . $this->getEntity(), $actionName)); $actionReflection = new \ReflectionClass($action); $actionInfo = ReflectionUtils::getCodeDocs($actionReflection); unset($actionInfo['method']); $this->_actions[$actionName] = array('name' => $actionName) + $actionInfo; $this->_actions[$actionName]['params'] = $action->getParamInfo(); } } catch (NotImplementedException $e) { } }
/** * Get documentation for one or all params * * @param string $param * @return array */ public function getParamInfo($param = NULL) { if (!isset($this->thisParamInfo)) { $defaults = $this->getParamDefaults(); foreach ($this->thisReflection->getProperties(\ReflectionProperty::IS_PROTECTED) as $property) { $name = $property->getName(); $this->thisParamInfo[$name] = ReflectionUtils::getCodeDocs($property, 'Property'); $this->thisParamInfo[$name]['default'] = $defaults[$name]; } } return $param ? $this->thisParamInfo[$param] : $this->thisParamInfo; }