Skip to content

Commit

Permalink
Fix: Avoid unnecessary imports
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed May 8, 2020
1 parent 0ef2654 commit d7952a9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/PhpDoc/ObjectProphecy/TypeNodeResolverExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use PHPStan\PhpDocParser;
use PHPStan\Type;
use Prophecy\Prophecy;
use Prophecy\Prophecy\ObjectProphecy;

/**
* @internal
Expand Down Expand Up @@ -65,7 +64,7 @@ public function resolve(PhpDocParser\Ast\Type\TypeNode $typeNode, Analyser\NameS
}

if (null !== $objectProphecyType && null !== $prophesizedType) {
return new Type\Generic\GenericObjectType(ObjectProphecy::class, [$prophesizedType]);
return new Type\Generic\GenericObjectType(Prophecy\ObjectProphecy::class, [$prophesizedType]);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
use PHPStan\Reflection;
use PHPStan\ShouldNotHappenException;
use PHPStan\Type;
use PHPStan\Type\Generic\GenericObjectType;
use Prophecy\Prophecy\ObjectProphecy;
use Prophecy\Prophecy;

/**
* @internal
Expand Down Expand Up @@ -56,7 +55,7 @@ public function getTypeFromMethodCall(

$returnType = $parametersAcceptor->getReturnType();

if (!$calledOnType instanceof Type\Generic\GenericObjectType || ObjectProphecy::class !== $calledOnType->getClassName()) {
if (!$calledOnType instanceof Type\Generic\GenericObjectType || Prophecy\ObjectProphecy::class !== $calledOnType->getClassName()) {
return $returnType;
}

Expand Down Expand Up @@ -86,6 +85,6 @@ public function getTypeFromMethodCall(

$mockTypeIntersection = Type\TypeCombinator::intersect(new Type\ObjectType($className), ...$calledOnType->getTypes());

return new GenericObjectType(ObjectProphecy::class, [$mockTypeIntersection]);
return new Type\Generic\GenericObjectType(Prophecy\ObjectProphecy::class, [$mockTypeIntersection]);
}
}
6 changes: 3 additions & 3 deletions src/Type/Prophet/ProphesizeDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use PHPStan\Reflection;
use PHPStan\ShouldNotHappenException;
use PHPStan\Type;
use Prophecy\Prophecy\ObjectProphecy;
use Prophecy\Prophecy;

/**
* @internal
Expand Down Expand Up @@ -52,7 +52,7 @@ public function getTypeFromMethodCall(
$returnType = $parametersAcceptor->getReturnType();

if (0 === \count($methodCall->args)) {
return new Type\Generic\GenericObjectType(ObjectProphecy::class, []);
return new Type\Generic\GenericObjectType(Prophecy\ObjectProphecy::class, []);
}

$argumentType = $scope->getType($methodCall->args[0]->value);
Expand All @@ -75,6 +75,6 @@ public function getTypeFromMethodCall(
$className = $scope->getClassReflection()->getName();
}

return new Type\Generic\GenericObjectType(ObjectProphecy::class, [new Type\ObjectType($className)]);
return new Type\Generic\GenericObjectType(Prophecy\ObjectProphecy::class, [new Type\ObjectType($className)]);
}
}

0 comments on commit d7952a9

Please sign in to comment.