Skip to content

Commit

Permalink
fix(docblocks): update to phpdocumentor/reflection-docblock ^4.0.0
Browse files Browse the repository at this point in the history
closes #139
  • Loading branch information
felixfbecker committed Oct 23, 2017
1 parent 4384d49 commit 16cf8f5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -23,11 +23,11 @@
"require": {
"php": "^7.0",
"composer/composer": "^1.3",
"felixfbecker/advanced-json-rpc": "^2.0",
"felixfbecker/advanced-json-rpc": "^3.0.0",
"jetbrains/phpstorm-stubs": "dev-master",
"microsoft/tolerant-php-parser": "^0.0.6",
"netresearch/jsonmapper": "^1.0",
"phpdocumentor/reflection-docblock": "~3.1.1",
"phpdocumentor/reflection-docblock": "^4.0.0",
"sabre/event": "^5.0",
"sabre/uri": "^2.0",
"squizlabs/php_codesniffer": "3.0.0RC3",
Expand Down
2 changes: 1 addition & 1 deletion src/Definition.php
Expand Up @@ -78,7 +78,7 @@ class Definition
* For functions and methods, this is the return type.
* For any other declaration it will be null.
* Can also be a compound type.
* If it is unknown, will be Types\Mixed.
* If it is unknown, will be Types\Mixed_.
*
* @var \phpDocumentor\Type|null
*/
Expand Down
32 changes: 16 additions & 16 deletions src/DefinitionResolver.php
Expand Up @@ -551,7 +551,7 @@ public function resolveVariableToNode($var)

/**
* Given an expression node, resolves that expression recursively to a type.
* If the type could not be resolved, returns Types\Mixed.
* If the type could not be resolved, returns Types\Mixed_.
*
* @param Node\Expression $expr
* @return \phpDocumentor\Reflection\Type|null
Expand All @@ -567,7 +567,7 @@ public function resolveExpressionNodeToType($expr)
if ($expr == null || $expr instanceof PhpParser\MissingToken || $expr instanceof PhpParser\SkippedToken) {
// TODO some members are null or Missing/SkippedToken
// How do we handle this more generally?
return new Types\Mixed;
return new Types\Mixed_;
}

// VARIABLE
Expand Down Expand Up @@ -597,7 +597,7 @@ public function resolveExpressionNodeToType($expr)
// Find the function definition
if ($expr->callableExpression instanceof Node\Expression) {
// Cannot get type for dynamic function call
return new Types\Mixed;
return new Types\Mixed_;
}

if ($expr->callableExpression instanceof Node\QualifiedName) {
Expand Down Expand Up @@ -646,7 +646,7 @@ public function resolveExpressionNodeToType($expr)
// MEMBER ACCESS EXPRESSION
if ($expr instanceof Node\Expression\MemberAccessExpression) {
if ($expr->memberName instanceof Node\Expression) {
return new Types\Mixed;
return new Types\Mixed_;
}
$var = $expr->dereferencableExpression;

Expand All @@ -659,10 +659,10 @@ public function resolveExpressionNodeToType($expr)
if ($t instanceof Types\This) {
$classFqn = self::getContainingClassFqn($expr);
if ($classFqn === null) {
return new Types\Mixed;
return new Types\Mixed_;
}
} else if (!($t instanceof Types\Object_) || $t->getFqsen() === null) {
return new Types\Mixed;
return new Types\Mixed_;
} else {
$classFqn = substr((string)$t->getFqsen(), 1);
}
Expand All @@ -689,7 +689,7 @@ public function resolveExpressionNodeToType($expr)
if ($expr instanceof Node\Expression\ScopedPropertyAccessExpression) {
$classType = $this->resolveClassNameToType($expr->scopeResolutionQualifier);
if (!($classType instanceof Types\Object_) || $classType->getFqsen() === null) {
return new Types\Mixed;
return new Types\Mixed_;
}
$fqn = substr((string)$classType->getFqsen(), 1) . '::';

Expand All @@ -701,7 +701,7 @@ public function resolveExpressionNodeToType($expr)

$def = $this->index->getDefinition($fqn);
if ($def === null) {
return new Types\Mixed;
return new Types\Mixed_;
}
return $def->type;
}
Expand Down Expand Up @@ -888,7 +888,7 @@ public function resolveExpressionNodeToType($expr)
if ($expr instanceof Node\Expression\SubscriptExpression) {
$varType = $this->resolveExpressionNodeToType($expr->postfixExpression);
if (!($varType instanceof Types\Array_)) {
return new Types\Mixed;
return new Types\Mixed_;
}
return $varType->getValueType();
}
Expand All @@ -897,14 +897,14 @@ public function resolveExpressionNodeToType($expr)
// include, require, include_once, require_once
if ($expr instanceof Node\Expression\ScriptInclusionExpression) {
// TODO: resolve path to PhpDocument and find return statement
return new Types\Mixed;
return new Types\Mixed_;
}

if ($expr instanceof Node\QualifiedName) {
return $this->resolveClassNameToType($expr);
}

return new Types\Mixed;
return new Types\Mixed_;
}


Expand All @@ -918,7 +918,7 @@ public function resolveExpressionNodeToType($expr)
public function resolveClassNameToType($class): Type
{
if ($class instanceof Node\Expression) {
return new Types\Mixed;
return new Types\Mixed_;
}
if ($class instanceof PhpParser\Token && $class->kind === PhpParser\TokenKind::ClassKeyword) {
// Anonymous class
Expand Down Expand Up @@ -958,7 +958,7 @@ public function resolveClassNameToType($class): Type
* For classes and interfaces, this is the class type (object).
* For variables / assignments, this is the documented type or type the assignment resolves to.
* Can also be a compound type.
* If it is unknown, will be Types\Mixed.
* If it is unknown, will be Types\Mixed_.
* Returns null if the node does not have a type.
*
* @param Node $node
Expand Down Expand Up @@ -1012,7 +1012,7 @@ public function getTypeFromNode($node)
}
$type = $defaultType;
}
return $type ?? new Types\Mixed;
return $type ?? new Types\Mixed_;
}

// FUNCTIONS AND METHODS
Expand Down Expand Up @@ -1040,7 +1040,7 @@ public function getTypeFromNode($node)
return new Types\Object_(new Fqsen('\\' . (string)$node->returnType->getResolvedName()));
}
// Unknown return type
return new Types\Mixed;
return new Types\Mixed_;
}

// PROPERTIES, CONSTS, CLASS CONSTS, ASSIGNMENT EXPRESSIONS
Expand Down Expand Up @@ -1077,7 +1077,7 @@ public function getTypeFromNode($node)
// TODO: read @property tags of class
// TODO: Try to infer the type from default value / constant value
// Unknown
return new Types\Mixed;
return new Types\Mixed_;
}

// The node does not have a type
Expand Down

0 comments on commit 16cf8f5

Please sign in to comment.