diff --git a/visitor.php b/visitor.php index 3050486..ba5d55e 100644 --- a/visitor.php +++ b/visitor.php @@ -383,7 +383,7 @@ private function postProcessNode(Node $node): void $newDocComment = $this->addTags($name, $docComment); - if ($newDocComment !== null) { + if ($newDocComment instanceof Doc) { $node->setDocComment($newDocComment); } @@ -399,7 +399,7 @@ private function postProcessNode(Node $node): void $newDocComment = $this->addStringTags($name, $docComment); - if ($newDocComment !== null) { + if ($newDocComment instanceof Doc) { $node->setDocComment($newDocComment); } } @@ -434,7 +434,7 @@ private function generateAdditionalTagsFromDoc(Doc $docComment): array foreach ($params as $param) { $addition = self::getAdditionFromParam($param); - if ($addition !== null) { + if ($addition instanceof WordPressTag) { $additions[] = $addition; } } @@ -442,7 +442,7 @@ private function generateAdditionalTagsFromDoc(Doc $docComment): array foreach ($returns as $return) { $addition = self::getAdditionFromReturn($return); - if ($addition !== null) { + if ($addition instanceof WordPressTag) { $additions[] = $addition; } } @@ -450,7 +450,7 @@ private function generateAdditionalTagsFromDoc(Doc $docComment): array foreach ($vars as $var) { $addition = self::getAdditionFromVar($var); - if ($addition !== null) { + if ($addition instanceof WordPressTag) { $additions[] = $addition; } } @@ -549,7 +549,7 @@ private function getInheritedTagsForParam(Param $param): array { $type = $param->getType(); - if ($type === null) { + if (!$type instanceof Type) { return []; } @@ -561,7 +561,7 @@ private function getInheritedTagsForParam(Param $param): array $paramDescription = $param->getDescription(); - if ($paramDescription === null) { + if (!$paramDescription instanceof Description) { return []; } @@ -587,7 +587,7 @@ private function getInheritedTagsForParam(Param $param): array $match = self::getMatchingInheritedTag($param, $tags, $symbolName); - if ($match !== null) { + if ($match instanceof WordPressTag) { $additions[] = $match; } } @@ -698,7 +698,7 @@ private function getAdditionFromParam(Param $tag): ?WordPressTag $tagVariableType = $tag->getType(); // Skip if information we need is missing. - if (!$tagDescription || !$tagVariableName || !$tagVariableType) { + if (!$tagDescription instanceof Description || !$tagVariableName || !$tagVariableType instanceof Type) { return null; } @@ -744,7 +744,7 @@ private function getAdditionFromReturn(Return_ $tag): ?WordPressTag $tagVariableType = $tag->getType(); // Skip if information we need is missing. - if (!$tagDescription || !$tagVariableType) { + if (!$tagDescription instanceof Description || !$tagVariableType instanceof Type) { return null; } @@ -784,7 +784,7 @@ private static function getAdditionFromVar(Var_ $tag): ?WordPressTag $tagVariableType = $tag->getType(); // Skip if information we need is missing. - if (!$tagDescription || !$tagVariableType) { + if (!$tagDescription instanceof Description || !$tagVariableType instanceof Type) { return null; } @@ -1008,7 +1008,7 @@ private function voidOrNever(Node $node): string static function (Node $node): bool { return isset($node->expr); } - ) !== null + ) instanceof Node ) { return ''; }