projects
/
mdref
/
mdref
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (from parent 1:
cbda4b2
)
fix var names and references
author
Michael Wallner
<mike@php.net>
Wed, 13 Mar 2019 13:51:03 +0000
(14:51 +0100)
committer
Michael Wallner
<mike@php.net>
Wed, 13 Mar 2019 13:51:03 +0000
(14:51 +0100)
mdref/Structure.php
patch
|
blob
|
history
diff --git
a/mdref/Structure.php
b/mdref/Structure.php
index 602bca2a7b6464d68aeb7b05c42c59acc02d4475..dc871d1b960a8f3c00b762b88d27554016c8d8ac 100644
(file)
--- a/
mdref/Structure.php
+++ b/
mdref/Structure.php
@@
-187,8
+187,8
@@
class Structure {
static $pattern = '/
\*\s+
(?P<modifiers>\w+\s+)*
static $pattern = '/
\*\s+
(?P<modifiers>\w+\s+)*
- (?P<type>[\\\\\w]+)\s+
- (?
<name>\$\w
+)
+ (?P<type>[\\\\\w
_
]+)\s+
+ (?
P<ref>&)?(?P<name>\$[\w_]
+)
(?:\s*=\s*(?P<defval>.+))?
(?P<desc>(?:\s*[^*]*\n(?!\n)\s*[^\*].*)*)
/x';
(?:\s*=\s*(?P<defval>.+))?
(?P<desc>(?:\s*[^*]*\n(?!\n)\s*[^\*].*)*)
/x';
@@
-204,7
+204,7
@@
class Structure {
private function getReturns() : array {
static $pattern = '/
\*\s+
private function getReturns() : array {
static $pattern = '/
\*\s+
- (?<type>[\\\\\w]+)
+ (?<type>[\\\\\w
_
]+)
\s*,?\s*
(?P<desc>(?:.|\n(?!\s*\*))*)
/x';
\s*,?\s*
(?P<desc>(?:.|\n(?!\s*\*))*)
/x';
@@
-353,8
+353,6
@@
class StructureOfClass extends StructureOfNs
public $ns;
public $props;
public $ns;
public $props;
- static $lastNs;
-
function format() {
if ($this->ns !== StructureOfNs::$last) {
printf("namespace %s;\n", $this->ns);
function format() {
if ($this->ns !== StructureOfNs::$last) {
printf("namespace %s;\n", $this->ns);
@@
-469,6
+467,7
@@
class StructureOfVar extends StructureOf {
public $desc;
public $modifiers;
public $defval;
public $desc;
public $modifiers;
public $defval;
+ public $ref;
function formatDefval() {
if (strlen($this->defval)) {
function formatDefval() {
if (strlen($this->defval)) {
@@
-476,6
+475,9
@@
class StructureOfVar extends StructureOf {
printf(" = ");
var_export(constant($this->defval));
} else if (strlen($this->defval)) {
printf(" = ");
var_export(constant($this->defval));
} else if (strlen($this->defval)) {
+ if (false !== strchr($this->defval, "\\") && $this->defval{0} != "\\") {
+ $this->defval = "\\" . $this->defval;
+ }
printf(" = %s", $this->defval);
}
} elseif ($this->modifiers) {
printf(" = %s", $this->defval);
}
} elseif ($this->modifiers) {
@@
-498,7
+500,7
@@
class StructureOfVar extends StructureOf {
if ($with_type && strlen($type = $this->saneType($this->type))) {
printf("%s ", $type);
}
if ($with_type && strlen($type = $this->saneType($this->type))) {
printf("%s ", $type);
}
- printf("%s
"
, $this->name);
+ printf("%s
%s", $this->ref
, $this->name);
$this->formatDefval();
}
}
$this->formatDefval();
}
}