Class yii\apidoc\helpers\PrettyPrinter
| Inheritance | yii\apidoc\helpers\PrettyPrinter » PhpParser\PrettyPrinter\Standard |
|---|---|
| Available since extension's version | 2.0 |
| Source Code | https://github.com/yiisoft/yii2-apidoc/blob/master/helpers/PrettyPrinter.php |
Enhances the phpDocumentor PrettyPrinter:
- Fix for single slash becoming double in values of properties and class constants.
- All comments in values are removed because inline comments are shifted to the next line (can be confusing).
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| pMaybeMultiline() | yii\apidoc\helpers\PrettyPrinter | |
| pSingleQuotedString() | yii\apidoc\helpers\PrettyPrinter |
Method Details
| protected string pMaybeMultiline ( \PhpParser\NodeAbstract[] $nodes, boolean $trailingComma = false ) | ||
| $nodes | \PhpParser\NodeAbstract[] | |
| $trailingComma | boolean | |
protected function pMaybeMultiline(array $nodes, bool $trailingComma = false): string
{
foreach ($nodes as $node) {
$node->setAttribute('comments', []);
}
if (!$nodes) {
return $this->pCommaSeparated($nodes);
} else {
return $this->pCommaSeparatedMultiline($nodes, $trailingComma) . $this->nl;
}
}
| protected string pSingleQuotedString ( string $string ) | ||
| $string | string | |
protected function pSingleQuotedString(string $string): string
{
return '\'' . preg_replace("/'|\\\\(?=[\\\\']|$)/", '\\\\$0', $string) . '\'';
}