diff --git a/extensions/apidoc/helpers/ApiMarkdownTrait.php b/extensions/apidoc/helpers/ApiMarkdownTrait.php index 90e7775..39e7b47 100644 --- a/extensions/apidoc/helpers/ApiMarkdownTrait.php +++ b/extensions/apidoc/helpers/ApiMarkdownTrait.php @@ -36,6 +36,7 @@ trait ApiMarkdownTrait // Collection resolves relative types $typeName = (new Collection([$typeName], $context->phpDocContext))->__toString(); } + /** @var $type TypeDoc */ $type = static::$renderer->apiContext->getType($typeName); if ($type === null) { static::$renderer->apiContext->errors[] = [ diff --git a/extensions/apidoc/models/TypeDoc.php b/extensions/apidoc/models/TypeDoc.php index be24cef..4278fb3 100644 --- a/extensions/apidoc/models/TypeDoc.php +++ b/extensions/apidoc/models/TypeDoc.php @@ -37,6 +37,21 @@ class TypeDoc extends BaseDoc public $namespace; + /** + * Finds subject (method or property) by name + * + * If there is a property with the same as a method, the method will be returned if the name is not stated + * explicitly by prefixing with `$`. + * + * Example for method `attributes()` and property `$attributes` which both may exist: + * + * - `$subjectName = '$attributes'` finds a property or nothing. + * - `$subjectName = 'attributes()'` finds a method or nothing. + * - `$subjectName = 'attributes'` finds the method if it exists, if not it will find the property. + * + * @param $subjectName + * @return null|MethodDoc|PropertyDoc + */ public function findSubject($subjectName) { if ($subjectName[0] != '$') {