parent
4384d49414
commit
16cf8f53e9
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -551,7 +551,7 @@ class DefinitionResolver
|
|||
|
||||
/**
|
||||
* 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
|
||||
|
@ -567,7 +567,7 @@ class DefinitionResolver
|
|||
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
|
||||
|
@ -597,7 +597,7 @@ class DefinitionResolver
|
|||
// 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) {
|
||||
|
@ -646,7 +646,7 @@ class DefinitionResolver
|
|||
// 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;
|
||||
|
||||
|
@ -659,10 +659,10 @@ class DefinitionResolver
|
|||
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);
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ class DefinitionResolver
|
|||
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) . '::';
|
||||
|
||||
|
@ -701,7 +701,7 @@ class DefinitionResolver
|
|||
|
||||
$def = $this->index->getDefinition($fqn);
|
||||
if ($def === null) {
|
||||
return new Types\Mixed;
|
||||
return new Types\Mixed_;
|
||||
}
|
||||
return $def->type;
|
||||
}
|
||||
|
@ -888,7 +888,7 @@ class DefinitionResolver
|
|||
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();
|
||||
}
|
||||
|
@ -897,14 +897,14 @@ class DefinitionResolver
|
|||
// 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_;
|
||||
}
|
||||
|
||||
|
||||
|
@ -918,7 +918,7 @@ class DefinitionResolver
|
|||
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
|
||||
|
@ -958,7 +958,7 @@ class DefinitionResolver
|
|||
* 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
|
||||
|
@ -1012,7 +1012,7 @@ class DefinitionResolver
|
|||
}
|
||||
$type = $defaultType;
|
||||
}
|
||||
return $type ?? new Types\Mixed;
|
||||
return $type ?? new Types\Mixed_;
|
||||
}
|
||||
|
||||
// FUNCTIONS AND METHODS
|
||||
|
@ -1040,7 +1040,7 @@ class DefinitionResolver
|
|||
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
|
||||
|
@ -1077,7 +1077,7 @@ class DefinitionResolver
|
|||
// 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
|
||||
|
|
Loading…
Reference in New Issue