Skip to content

Commit

Permalink
Fixes See tag tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapio committed Sep 15, 2017
1 parent 1a957ab commit d6dab6d
Show file tree
Hide file tree
Showing 18 changed files with 20 additions and 365 deletions.
Expand Up @@ -12,9 +12,7 @@
namespace phpDocumentor\Descriptor\Builder\Reflector;

use phpDocumentor\Descriptor\ArgumentDescriptor;
use phpDocumentor\Reflection\DocBlock\Type\Collection;
use phpDocumentor\Descriptor\Tag\ParamDescriptor;
use phpDocumentor\Reflection\FunctionReflector\ArgumentReflector;
use phpDocumentor\Reflection\Php\Argument;

/**
Expand Down
Expand Up @@ -14,11 +14,7 @@

use phpDocumentor\Descriptor\ArgumentDescriptor;
use phpDocumentor\Reflection\DocBlock\Tags\Param;
use phpDocumentor\Reflection\DocBlock\Type\Collection;
use phpDocumentor\Descriptor\MethodDescriptor;
use phpDocumentor\Reflection\ClassReflector\MethodReflector;
use phpDocumentor\Reflection\DocBlock\Tag\ParamTag;
use phpDocumentor\Reflection\FunctionReflector\ArgumentReflector;
use phpDocumentor\Reflection\Php\Argument;
use phpDocumentor\Reflection\Php\Method;

Expand Down
Expand Up @@ -13,9 +13,7 @@

use phpDocumentor\Descriptor\Builder\Reflector\AssemblerAbstract;
use phpDocumentor\Descriptor\Tag\ParamDescriptor;
use phpDocumentor\Reflection\DocBlock\Tag\ParamTag;
use phpDocumentor\Reflection\DocBlock\Tags\Param;
use phpDocumentor\Reflection\DocBlock\Type\Collection;

/**
* Constructs a new descriptor from the Reflector for an `@param` tag.
Expand Down
Expand Up @@ -13,9 +13,7 @@

use phpDocumentor\Descriptor\Builder\Reflector\AssemblerAbstract;
use phpDocumentor\Descriptor\Tag\PropertyDescriptor;
use phpDocumentor\Reflection\DocBlock\Tag\PropertyTag;
use phpDocumentor\Reflection\DocBlock\Tags\Property;
use phpDocumentor\Reflection\DocBlock\Type\Collection;

/**
* Constructs a new descriptor from the Reflector for an `@property` tag.
Expand Down
Expand Up @@ -14,10 +14,8 @@
use phpDocumentor\Compiler\Linker\Linker;
use phpDocumentor\Descriptor\Builder\Reflector\AssemblerAbstract;
use phpDocumentor\Descriptor\Tag\SeeDescriptor;
use phpDocumentor\Reflection\DocBlock\Context;
use phpDocumentor\Reflection\DocBlock\Tag\SeeTag;
use phpDocumentor\Reflection\DocBlock\Tags\See;
use phpDocumentor\Reflection\DocBlock\Type\Collection;
use phpDocumentor\Reflection\Types\Context;

/**
* Constructs a new Descriptor from a Reflector object for the `@see` tag.
Expand All @@ -44,37 +42,4 @@ public function create($data)

return $descriptor;
}

/**
* @param Context $context
* @param string[] $referenceParts
* @return array The returned array will consist of a Collection object with the type, and strings for methods, etc.
*/
private function setFirstReferencePartAsType($context, $referenceParts)
{
$type = current($referenceParts);
$type = new Collection(
array($type),
$context
);
$referenceParts[0] = $type;
return $referenceParts;
}

/**
* When you have a relative reference to a class, we need to check if this class exists in the namespace aliases
*
* @param string $reference
* @param Context $context
* @return bool
*/
private function referenceIsNamespaceAlias($reference, $context)
{
/** @var \phpDocumentor\Reflection\DocBlock\Context $context*/
foreach ($context->getNamespaceAliases() as $alias) {
if (substr($alias, -strlen($reference)) === $reference) {
return true;
}
}
}
}
Expand Up @@ -13,9 +13,7 @@

use phpDocumentor\Descriptor\Builder\Reflector\AssemblerAbstract;
use phpDocumentor\Descriptor\Tag\ThrowsDescriptor;
use phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag;
use phpDocumentor\Reflection\DocBlock\Tags\Throws;
use phpDocumentor\Reflection\DocBlock\Type\Collection;

/**
* Constructs a new descriptor from the Reflector for an `@throws` tag.
Expand Down

This file was deleted.

Expand Up @@ -14,7 +14,6 @@
use phpDocumentor\Descriptor\Builder\Reflector\AssemblerAbstract;
use phpDocumentor\Descriptor\Tag\VarDescriptor;
use phpDocumentor\Reflection\DocBlock\Tags\Var_;
use phpDocumentor\Reflection\DocBlock\Type\Collection;

/**
* Constructs a new descriptor from the Reflector for an `@var` tag.
Expand Down
35 changes: 0 additions & 35 deletions src/phpDocumentor/Transformer/Router/Renderer.php
Expand Up @@ -4,7 +4,6 @@

use phpDocumentor\Descriptor\Collection;
use phpDocumentor\Descriptor\DescriptorAbstract;
use phpDocumentor\Descriptor\Type\CollectionDescriptor;

/**
* Renders an HTML anchor pointing to the location of the provided element.
Expand Down Expand Up @@ -93,10 +92,6 @@ public function render($value, $presentation)
return $this->renderASeriesOfLinks($value, $presentation);
}

if ($value instanceof CollectionDescriptor) {
return $this->renderTypeCollection($value, $presentation);
}

return $this->renderLink($value, $presentation);
}

Expand Down Expand Up @@ -169,36 +164,6 @@ protected function renderASeriesOfLinks($value, $presentation)
return $result;
}

/**
* Renders the view representation for an array or collection.
*
* @param CollectionDescriptor $value
* @param string $presentation
*
* @return string
*/
protected function renderTypeCollection($value, $presentation)
{
$baseType = $this->render($value->getBaseType(), $presentation);
$keyTypes = $this->render($value->getKeyTypes(), $presentation);
$types = $this->render($value->getTypes(), $presentation);

$arguments = array();
if ($keyTypes) {
$arguments[] = implode('|', $keyTypes);
}
$arguments[] = implode('|', $types);

if ($value->getName() == 'array' && count($value->getKeyTypes()) == 0) {
$typeString = (count($types) > 1) ? '(' . reset($arguments) . ')' : reset($arguments);
$collection = $typeString . '[]';
} else {
$collection = ($baseType ? : $value->getName()) . '<' . implode(',', $arguments) . '>';
}

return $collection;
}

protected function renderLink($path, $presentation)
{
$url = false;
Expand Down
1 change: 0 additions & 1 deletion src/phpDocumentor/Transformer/ServiceProvider.php
Expand Up @@ -100,7 +100,6 @@ public function register(Application $app)
'phpDocumentor\Descriptor\Tag\ReturnDescriptor' => array('types'),
'phpDocumentor\Descriptor\Tag\SeeDescriptor' => array('reference'),
'phpDocumentor\Descriptor\Tag\UsesDescriptor' => array('reference'),
'phpDocumentor\Descriptor\Type\CollectionDescriptor' => array('baseType', 'types', 'keyTypes'),
);

// services
Expand Down
12 changes: 0 additions & 12 deletions tests/features/assets/singlefile/tags/internalSee.php
Expand Up @@ -59,9 +59,6 @@
* @see \phpDocumentor\Descriptor\TestSeeTagIssue::CONSTANT
* @see \phpDocumentor\Descriptor\TestSeeTagIssue::CONSTANT own constant
*
* @see CONSTANT
* @see $property
* @see method()
*/
class TestSeeTagIssue
{
Expand Down Expand Up @@ -122,9 +119,6 @@ class TestSeeTagIssue
* @see \phpDocumentor\Descriptor\TestSeeTagIssue::CONSTANT
* @see \phpDocumentor\Descriptor\TestSeeTagIssue::CONSTANT own constant
*
* @see CONSTANT
* @see $property
* @see method()
*/
const CONSTANT = 1;

Expand Down Expand Up @@ -185,9 +179,6 @@ class TestSeeTagIssue
* @see \phpDocumentor\Descriptor\TestSeeTagIssue::CONSTANT
* @see \phpDocumentor\Descriptor\TestSeeTagIssue::CONSTANT own constant
*
* @see CONSTANT
* @see $property
* @see method()
*/
public $property;

Expand Down Expand Up @@ -248,9 +239,6 @@ class TestSeeTagIssue
* @see \phpDocumentor\Descriptor\TestSeeTagIssue::CONSTANT
* @see \phpDocumentor\Descriptor\TestSeeTagIssue::CONSTANT own constant
*
* @see CONSTANT
* @see $property
* @see method()
*/
public function method()
{
Expand Down
12 changes: 0 additions & 12 deletions tests/features/assets/singlefile/tags/internalUses.php
Expand Up @@ -29,9 +29,6 @@
* @uses \phpDocumentor\Descriptor\TestUsesTagIssue::CONSTANT
* @uses \phpDocumentor\Descriptor\TestUsesTagIssue::CONSTANT own constant
*
* @uses CONSTANT
* @uses $property
* @uses method()
*/
class TestUsesTagIssue
{
Expand Down Expand Up @@ -62,9 +59,6 @@ class TestUsesTagIssue
* @uses \phpDocumentor\Descriptor\TestUsesTagIssue::CONSTANT
* @uses \phpDocumentor\Descriptor\TestUsesTagIssue::CONSTANT own constant
*
* @uses CONSTANT
* @uses $property
* @uses method()
*/
const CONSTANT = 1;

Expand Down Expand Up @@ -95,9 +89,6 @@ class TestUsesTagIssue
* @uses \phpDocumentor\Descriptor\TestUsesTagIssue::CONSTANT
* @uses \phpDocumentor\Descriptor\TestUsesTagIssue::CONSTANT own constant
*
* @uses CONSTANT
* @uses $property
* @uses method()
*/
public $property;

Expand Down Expand Up @@ -128,9 +119,6 @@ class TestUsesTagIssue
* @uses \phpDocumentor\Descriptor\TestUsesTagIssue::CONSTANT
* @uses \phpDocumentor\Descriptor\TestUsesTagIssue::CONSTANT own constant
*
* @uses CONSTANT
* @uses $property
* @uses method()
*/
public function method()
{
Expand Down

0 comments on commit d6dab6d

Please sign in to comment.