Commit 6b353bb5 by Carsten Brandt

added documentation about #5175

parent 6f9d2c66
...@@ -36,6 +36,7 @@ trait ApiMarkdownTrait ...@@ -36,6 +36,7 @@ trait ApiMarkdownTrait
// Collection resolves relative types // Collection resolves relative types
$typeName = (new Collection([$typeName], $context->phpDocContext))->__toString(); $typeName = (new Collection([$typeName], $context->phpDocContext))->__toString();
} }
/** @var $type TypeDoc */
$type = static::$renderer->apiContext->getType($typeName); $type = static::$renderer->apiContext->getType($typeName);
if ($type === null) { if ($type === null) {
static::$renderer->apiContext->errors[] = [ static::$renderer->apiContext->errors[] = [
......
...@@ -37,6 +37,21 @@ class TypeDoc extends BaseDoc ...@@ -37,6 +37,21 @@ class TypeDoc extends BaseDoc
public $namespace; 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) public function findSubject($subjectName)
{ {
if ($subjectName[0] != '$') { if ($subjectName[0] != '$') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment