Skip to content

Commit

Permalink
phpstan fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
smoench committed Feb 17, 2020
1 parent 3afefa8 commit fa4a129
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/AstRunner/AstMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getClassInherits(ClassLikeName $classLikeName): iterable
}

/**
* @param ArrayObject|null $alreadyResolved
* @param ArrayObject<string, true>|null $alreadyResolved
*
* @return iterable<AstInherit>
*/
Expand Down
4 changes: 4 additions & 0 deletions src/AstRunner/AstMap/AstFileReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public function __construct(string $filepath)
$this->dependencies = [];
}

/**
* @param AstInherit[] $inherits
* @param AstDependency[] $dependencies
*/
public function addClassReference(ClassLikeName $className, array $inherits = [], array $dependencies = []): AstClassReference
{
$astClassReference = new AstClassReference($className, $this, $inherits, $dependencies);
Expand Down
9 changes: 9 additions & 0 deletions src/AstRunner/Resolver/TypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public function resolvePHPParserTypes(TypeScope $typeScope, NodeAbstract ...$nod
return array_merge([], ...$types);
}

/**
* @return string[]
*/
private function resolvePHPParserType(TypeScope $typeScope, NodeAbstract $node): array
{
if ($node instanceof Node\Name && $node->isSpecialClassName()) {
Expand Down Expand Up @@ -87,6 +90,9 @@ public function resolvePHPStanDocParserType(TypeNode $type, TypeScope $nameScope
return $this->resolveString((string) $type, $nameScope);
}

/**
* @return string[]
*/
public function resolveString(string $type, TypeScope $nameScope): array
{
$context = new Context($nameScope->getNamespace(), $nameScope->getUses());
Expand All @@ -95,6 +101,9 @@ public function resolveString(string $type, TypeScope $nameScope): array
return $this->resolveReflectionType($resolvedType);
}

/**
* @return string[]
*/
private function resolveReflectionType(Type $resolvedType): array
{
if ($resolvedType instanceof Object_) {
Expand Down

0 comments on commit fa4a129

Please sign in to comment.