CodeExplorer getDocBlockFromProperty example
catch (\ReflectionException
) { $reflectionProperty = null;
} $ucFirstProperty =
ucfirst($property);
switch (true
) { case $reflectionProperty?->
isPromoted() &&
$docBlock =
$this->
getDocBlockFromConstructor($class,
$property):
$data =
[$docBlock, self::MUTATOR, null
];
break;
case $docBlock =
$this->
getDocBlockFromProperty($class,
$property):
$data =
[$docBlock, self::PROPERTY, null
];
break;
case [$docBlock] =
$this->
getDocBlockFromMethod($class,
$ucFirstProperty, self::ACCESSOR
):
$data =
[$docBlock, self::ACCESSOR, null
];
break;
case [$docBlock,
$prefix] =
$this->
getDocBlockFromMethod($class,
$ucFirstProperty, self::MUTATOR
):
$data =
[$docBlock, self::MUTATOR,
$prefix];
break;
private function getDocBlock(string
$class, string
$property): array
{ $propertyHash =
$class.'::'.
$property;
if (isset($this->docBlocks
[$propertyHash])) { return $this->docBlocks
[$propertyHash];
} $ucFirstProperty =
ucfirst($property);
if ([$docBlock,
$source,
$declaringClass] =
$this->
getDocBlockFromProperty($class,
$property)) { $data =
[$docBlock,
$source, null,
$declaringClass];
} elseif ([$docBlock,
$_,
$declaringClass] =
$this->
getDocBlockFromMethod($class,
$ucFirstProperty, self::ACCESSOR
)) { $data =
[$docBlock, self::ACCESSOR, null,
$declaringClass];
} elseif ([$docBlock,
$prefix,
$declaringClass] =
$this->
getDocBlockFromMethod($class,
$ucFirstProperty, self::MUTATOR
)) { $data =
[$docBlock, self::MUTATOR,
$prefix,
$declaringClass];
} else { $data =
[null, null, null, null
];
} return $this->docBlocks
[$propertyHash] =
$data;
}