From 16cf8f53e9d7106fedef98167d52b21c44cd0bf5 Mon Sep 17 00:00:00 2001 From: Felix Becker Date: Sun, 22 Oct 2017 17:34:08 -0700 Subject: [PATCH] fix(docblocks): update to phpdocumentor/reflection-docblock ^4.0.0 closes #139 --- composer.json | 4 ++-- src/Definition.php | 2 +- src/DefinitionResolver.php | 32 ++++++++++++++++---------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/composer.json b/composer.json index 225de3bc..0504c00c 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/src/Definition.php b/src/Definition.php index c03e8521..9a485c46 100644 --- a/src/Definition.php +++ b/src/Definition.php @@ -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 */ diff --git a/src/DefinitionResolver.php b/src/DefinitionResolver.php index 51c59550..dd1040e0 100644 --- a/src/DefinitionResolver.php +++ b/src/DefinitionResolver.php @@ -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 @@ -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 @@ -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) { @@ -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; @@ -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); } @@ -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) . '::'; @@ -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; } @@ -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(); } @@ -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_; } @@ -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 @@ -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 @@ -1012,7 +1012,7 @@ public function getTypeFromNode($node) } $type = $defaultType; } - return $type ?? new Types\Mixed; + return $type ?? new Types\Mixed_; } // FUNCTIONS AND METHODS @@ -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 @@ -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