diff --git a/templates/html/ApiRenderer.php b/templates/html/ApiRenderer.php index 7cc22abd..871385b3 100644 --- a/templates/html/ApiRenderer.php +++ b/templates/html/ApiRenderer.php @@ -247,7 +247,7 @@ public function renderPropertySignature($property, $context = null) return '' . implode(' ', $definition) . ' ' . '' . $this->createTypeLink($property->types, $context) . '' . ' ' . $this->createSubjectLink($property, $property->name) . ' ' - . ApiMarkdown::highlight('= ' . ($property->defaultValue === null ? 'null' : $property->defaultValue), 'php'); + . ApiMarkdown::highlight('= ' . $this->renderDefaultValue($property->defaultValue), 'php'); } /** @@ -262,7 +262,7 @@ public function renderMethodSignature($method, $context = null) . ($param->isPassedByReference ? '&' : '') . ApiMarkdown::highlight( $param->name - . ($param->isOptional ? ' = ' . $param->defaultValue : ''), + . ($param->isOptional ? ' = ' . $this->renderDefaultValue($param->defaultValue) : ''), 'php' ); } @@ -283,6 +283,33 @@ public function renderMethodSignature($method, $context = null) . str_replace(' ', ' ', ' ( ' . implode(', ', $params) . ' )'); } + /** + * @param mixed $value + * @return string + */ + public function renderDefaultValue($value) + { + if ($value===null) { + return 'null'; + } + + static $specials = [ + '420' => '0644', + '436' => '0664', + '438' => '0666', + '493' => '0755', + '509' => '0775', + '511' => '0777', + '2113696' => '0x2040A0', + '16777215' => '0xFFFFFF', + ]; + if (isset($specials[$value])) { + return $specials[$value]; + } + + return $value; + } + /** * @inheritdoc */