X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=mdref%2FStructure.php;h=ace780b4d0c62b340be869c124cdefebc3132cda;hb=a94ecb1009610a763dd74a7eebc4754b6643d832;hp=dc871d1b960a8f3c00b762b88d27554016c8d8ac;hpb=ef5031e18d8497180ad6fc1bc5bc4ea59c64c9d5;p=mdref%2Fmdref diff --git a/mdref/Structure.php b/mdref/Structure.php index dc871d1..ace780b 100644 --- a/mdref/Structure.php +++ b/mdref/Structure.php @@ -129,7 +129,9 @@ class Structure { private function getConstants() : array { static $pattern = '/ \*\s+ + (?:[<]span[ ]class="constant"[>])? (?\w+) + (?:[<]\/span[>])? (?:\s*=\s*(?P.+))? (?P(?:\s*\n\s*[^\*\n#].*)*) /x'; @@ -149,6 +151,7 @@ class Structure { static $pattern = '/ \*\s+ (?P\w+\s+)* + (?:\((?P(?:(?:\w+)\s*)*)\))*\s* (?P[\\\\\w]+)\s+ (?\$\w+) (?:\s*=\s*(?P.+))? @@ -208,7 +211,7 @@ class Structure { \s*,?\s* (?P(?:.|\n(?!\s*\*))*) /x'; - + $returns = $this->splitList($pattern, $this->getSection("Returns")); $retvals = []; foreach ($returns as list(, $type, $desc)) { @@ -294,7 +297,7 @@ abstract class StructureOf { return $type; break; default: - return ($type{0} === "\\" ? "":"\\") . $type; + return ($type[0] === "\\" ? "":"\\") . $type; break; } } @@ -466,6 +469,7 @@ class StructureOfVar extends StructureOf { public $type; public $desc; public $modifiers; + public $usages; public $defval; public $ref; @@ -475,7 +479,7 @@ class StructureOfVar extends StructureOf { printf(" = "); var_export(constant($this->defval)); } else if (strlen($this->defval)) { - if (false !== strchr($this->defval, "\\") && $this->defval{0} != "\\") { + if (false !== strchr($this->defval, "\\") && $this->defval[0] != "\\") { $this->defval = "\\" . $this->defval; } printf(" = %s", $this->defval); @@ -489,8 +493,8 @@ class StructureOfVar extends StructureOf { function formatAsProp($level) { $indent = str_repeat("\t", $level); $this->formatDesc($level, - preg_split('/\s+/', $this->modifiers, -1, PREG_SPLIT_NO_EMPTY) - + [-1 => "var " . $this->saneType($this->type)] + preg_split('/\s+/', $this->modifiers ." " . $this->usages, -1, PREG_SPLIT_NO_EMPTY) + + [-1 => "var " . $this->saneType($this->type, false)] ); printf("%s%s %s", $indent, $this->modifiers, $this->name); $this->formatDefval();