Skip to content

Commit 16cf8f5

Browse files
committed
fix(docblocks): update to phpdocumentor/reflection-docblock ^4.0.0
closes #139
1 parent 4384d49 commit 16cf8f5

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
"require": {
2424
"php": "^7.0",
2525
"composer/composer": "^1.3",
26-
"felixfbecker/advanced-json-rpc": "^2.0",
26+
"felixfbecker/advanced-json-rpc": "^3.0.0",
2727
"jetbrains/phpstorm-stubs": "dev-master",
2828
"microsoft/tolerant-php-parser": "^0.0.6",
2929
"netresearch/jsonmapper": "^1.0",
30-
"phpdocumentor/reflection-docblock": "~3.1.1",
30+
"phpdocumentor/reflection-docblock": "^4.0.0",
3131
"sabre/event": "^5.0",
3232
"sabre/uri": "^2.0",
3333
"squizlabs/php_codesniffer": "3.0.0RC3",

src/Definition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Definition
7878
* For functions and methods, this is the return type.
7979
* For any other declaration it will be null.
8080
* Can also be a compound type.
81-
* If it is unknown, will be Types\Mixed.
81+
* If it is unknown, will be Types\Mixed_.
8282
*
8383
* @var \phpDocumentor\Type|null
8484
*/

src/DefinitionResolver.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ public function resolveVariableToNode($var)
551551

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

573573
// VARIABLE
@@ -597,7 +597,7 @@ public function resolveExpressionNodeToType($expr)
597597
// Find the function definition
598598
if ($expr->callableExpression instanceof Node\Expression) {
599599
// Cannot get type for dynamic function call
600-
return new Types\Mixed;
600+
return new Types\Mixed_;
601601
}
602602

603603
if ($expr->callableExpression instanceof Node\QualifiedName) {
@@ -646,7 +646,7 @@ public function resolveExpressionNodeToType($expr)
646646
// MEMBER ACCESS EXPRESSION
647647
if ($expr instanceof Node\Expression\MemberAccessExpression) {
648648
if ($expr->memberName instanceof Node\Expression) {
649-
return new Types\Mixed;
649+
return new Types\Mixed_;
650650
}
651651
$var = $expr->dereferencableExpression;
652652

@@ -659,10 +659,10 @@ public function resolveExpressionNodeToType($expr)
659659
if ($t instanceof Types\This) {
660660
$classFqn = self::getContainingClassFqn($expr);
661661
if ($classFqn === null) {
662-
return new Types\Mixed;
662+
return new Types\Mixed_;
663663
}
664664
} else if (!($t instanceof Types\Object_) || $t->getFqsen() === null) {
665-
return new Types\Mixed;
665+
return new Types\Mixed_;
666666
} else {
667667
$classFqn = substr((string)$t->getFqsen(), 1);
668668
}
@@ -689,7 +689,7 @@ public function resolveExpressionNodeToType($expr)
689689
if ($expr instanceof Node\Expression\ScopedPropertyAccessExpression) {
690690
$classType = $this->resolveClassNameToType($expr->scopeResolutionQualifier);
691691
if (!($classType instanceof Types\Object_) || $classType->getFqsen() === null) {
692-
return new Types\Mixed;
692+
return new Types\Mixed_;
693693
}
694694
$fqn = substr((string)$classType->getFqsen(), 1) . '::';
695695

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

702702
$def = $this->index->getDefinition($fqn);
703703
if ($def === null) {
704-
return new Types\Mixed;
704+
return new Types\Mixed_;
705705
}
706706
return $def->type;
707707
}
@@ -888,7 +888,7 @@ public function resolveExpressionNodeToType($expr)
888888
if ($expr instanceof Node\Expression\SubscriptExpression) {
889889
$varType = $this->resolveExpressionNodeToType($expr->postfixExpression);
890890
if (!($varType instanceof Types\Array_)) {
891-
return new Types\Mixed;
891+
return new Types\Mixed_;
892892
}
893893
return $varType->getValueType();
894894
}
@@ -897,14 +897,14 @@ public function resolveExpressionNodeToType($expr)
897897
// include, require, include_once, require_once
898898
if ($expr instanceof Node\Expression\ScriptInclusionExpression) {
899899
// TODO: resolve path to PhpDocument and find return statement
900-
return new Types\Mixed;
900+
return new Types\Mixed_;
901901
}
902902

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

907-
return new Types\Mixed;
907+
return new Types\Mixed_;
908908
}
909909

910910

@@ -918,7 +918,7 @@ public function resolveExpressionNodeToType($expr)
918918
public function resolveClassNameToType($class): Type
919919
{
920920
if ($class instanceof Node\Expression) {
921-
return new Types\Mixed;
921+
return new Types\Mixed_;
922922
}
923923
if ($class instanceof PhpParser\Token && $class->kind === PhpParser\TokenKind::ClassKeyword) {
924924
// Anonymous class
@@ -958,7 +958,7 @@ public function resolveClassNameToType($class): Type
958958
* For classes and interfaces, this is the class type (object).
959959
* For variables / assignments, this is the documented type or type the assignment resolves to.
960960
* Can also be a compound type.
961-
* If it is unknown, will be Types\Mixed.
961+
* If it is unknown, will be Types\Mixed_.
962962
* Returns null if the node does not have a type.
963963
*
964964
* @param Node $node
@@ -1012,7 +1012,7 @@ public function getTypeFromNode($node)
10121012
}
10131013
$type = $defaultType;
10141014
}
1015-
return $type ?? new Types\Mixed;
1015+
return $type ?? new Types\Mixed_;
10161016
}
10171017

10181018
// FUNCTIONS AND METHODS
@@ -1040,7 +1040,7 @@ public function getTypeFromNode($node)
10401040
return new Types\Object_(new Fqsen('\\' . (string)$node->returnType->getResolvedName()));
10411041
}
10421042
// Unknown return type
1043-
return new Types\Mixed;
1043+
return new Types\Mixed_;
10441044
}
10451045

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

10831083
// The node does not have a type

0 commit comments

Comments
 (0)