Commit 65d08423 by Alexander Makarov

Safer checks for apidoc renderer

parent 46b553f0
...@@ -71,7 +71,7 @@ abstract class BaseRenderer extends Component ...@@ -71,7 +71,7 @@ abstract class BaseRenderer extends Component
$links = []; $links = [];
foreach ($types as $type) { foreach ($types as $type) {
$postfix = ''; $postfix = '';
if (!is_object($type)) { if (is_string($type)) {
if (substr_compare($type, '[]', -2, 2) === 0) { if (substr_compare($type, '[]', -2, 2) === 0) {
$postfix = '[]'; $postfix = '[]';
$type = substr($type, 0, -2); $type = substr($type, 0, -2);
...@@ -85,7 +85,7 @@ abstract class BaseRenderer extends Component ...@@ -85,7 +85,7 @@ abstract class BaseRenderer extends Component
ltrim($type, '\\'); ltrim($type, '\\');
} }
} }
if (!is_object($type)) { if (is_string($type)) {
$linkText = ltrim($type, '\\'); $linkText = ltrim($type, '\\');
if ($title !== null) { if ($title !== null) {
$linkText = $title; $linkText = $title;
...@@ -110,7 +110,7 @@ abstract class BaseRenderer extends Component ...@@ -110,7 +110,7 @@ abstract class BaseRenderer extends Component
} else { } else {
$links[] = $type; $links[] = $type;
} }
} else { } elseif ($type instanceof BaseDoc) {
$linkText = $type->name; $linkText = $type->name;
if ($title !== null) { if ($title !== null) {
$linkText = $title; $linkText = $title;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment