From 38cc83a4eeadb4de81c632d3ad83335f9d6baaf9 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 17 Feb 2019 20:32:18 +0100 Subject: [PATCH] Removed uneeded inline type hints --- .../CLI/test/Command/Tag/CreateTagCommandTest.php | 2 -- .../CLI/test/Command/Tag/DeleteTagsCommandTest.php | 2 -- .../CLI/test/Command/Tag/ListTagsCommandTest.php | 3 --- .../CLI/test/Command/Tag/RenameTagCommandTest.php | 3 --- module/Core/test/Action/PreviewActionTest.php | 2 -- module/Core/test/Action/QrCodeActionTest.php | 2 -- module/Core/test/Service/Tag/TagServiceTest.php | 14 -------------- module/Core/test/Service/UrlShortenerTest.php | 2 -- .../Rest/test/Action/Tag/DeleteTagsActionTest.php | 2 -- module/Rest/test/Action/Tag/ListTagsActionTest.php | 2 -- .../Rest/test/Action/Tag/UpdateTagActionTest.php | 3 --- .../test/Middleware/BodyParserMiddlewareTest.php | 3 --- 12 files changed, 40 deletions(-) diff --git a/module/CLI/test/Command/Tag/CreateTagCommandTest.php b/module/CLI/test/Command/Tag/CreateTagCommandTest.php index eaf918ce..7b482478 100644 --- a/module/CLI/test/Command/Tag/CreateTagCommandTest.php +++ b/module/CLI/test/Command/Tag/CreateTagCommandTest.php @@ -5,7 +5,6 @@ namespace ShlinkioTest\Shlink\CLI\Command\Tag; use Doctrine\Common\Collections\ArrayCollection; use PHPUnit\Framework\TestCase; -use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\ObjectProphecy; use Shlinkio\Shlink\CLI\Command\Tag\CreateTagCommand; use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface; @@ -43,7 +42,6 @@ class CreateTagCommandTest extends TestCase public function serviceIsInvokedOnSuccess() { $tagNames = ['foo', 'bar']; - /** @var MethodProphecy $createTags */ $createTags = $this->tagService->createTags($tagNames)->willReturn(new ArrayCollection()); $this->commandTester->execute([ diff --git a/module/CLI/test/Command/Tag/DeleteTagsCommandTest.php b/module/CLI/test/Command/Tag/DeleteTagsCommandTest.php index 7c57157d..81d89953 100644 --- a/module/CLI/test/Command/Tag/DeleteTagsCommandTest.php +++ b/module/CLI/test/Command/Tag/DeleteTagsCommandTest.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace ShlinkioTest\Shlink\CLI\Command\Tag; use PHPUnit\Framework\TestCase; -use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\ObjectProphecy; use Shlinkio\Shlink\CLI\Command\Tag\DeleteTagsCommand; use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface; @@ -44,7 +43,6 @@ class DeleteTagsCommandTest extends TestCase public function serviceIsInvokedOnSuccess() { $tagNames = ['foo', 'bar']; - /** @var MethodProphecy $deleteTags */ $deleteTags = $this->tagService->deleteTags($tagNames)->will(function () { }); diff --git a/module/CLI/test/Command/Tag/ListTagsCommandTest.php b/module/CLI/test/Command/Tag/ListTagsCommandTest.php index 91cddfb3..b651db09 100644 --- a/module/CLI/test/Command/Tag/ListTagsCommandTest.php +++ b/module/CLI/test/Command/Tag/ListTagsCommandTest.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace ShlinkioTest\Shlink\CLI\Command\Tag; use PHPUnit\Framework\TestCase; -use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\ObjectProphecy; use Shlinkio\Shlink\CLI\Command\Tag\ListTagsCommand; use Shlinkio\Shlink\Core\Entity\Tag; @@ -35,7 +34,6 @@ class ListTagsCommandTest extends TestCase /** @test */ public function noTagsPrintsEmptyMessage() { - /** @var MethodProphecy $listTags */ $listTags = $this->tagService->listTags()->willReturn([]); $this->commandTester->execute([]); @@ -48,7 +46,6 @@ class ListTagsCommandTest extends TestCase /** @test */ public function listOfTagsIsPrinted() { - /** @var MethodProphecy $listTags */ $listTags = $this->tagService->listTags()->willReturn([ new Tag('foo'), new Tag('bar'), diff --git a/module/CLI/test/Command/Tag/RenameTagCommandTest.php b/module/CLI/test/Command/Tag/RenameTagCommandTest.php index a58a15cc..f2dba891 100644 --- a/module/CLI/test/Command/Tag/RenameTagCommandTest.php +++ b/module/CLI/test/Command/Tag/RenameTagCommandTest.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace ShlinkioTest\Shlink\CLI\Command\Tag; use PHPUnit\Framework\TestCase; -use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\ObjectProphecy; use Shlinkio\Shlink\CLI\Command\Tag\RenameTagCommand; use Shlinkio\Shlink\Core\Entity\Tag; @@ -38,7 +37,6 @@ class RenameTagCommandTest extends TestCase { $oldName = 'foo'; $newName = 'bar'; - /** @var MethodProphecy $renameTag */ $renameTag = $this->tagService->renameTag($oldName, $newName)->willThrow(EntityDoesNotExistException::class); $this->commandTester->execute([ @@ -56,7 +54,6 @@ class RenameTagCommandTest extends TestCase { $oldName = 'foo'; $newName = 'bar'; - /** @var MethodProphecy $renameTag */ $renameTag = $this->tagService->renameTag($oldName, $newName)->willReturn(new Tag($newName)); $this->commandTester->execute([ diff --git a/module/Core/test/Action/PreviewActionTest.php b/module/Core/test/Action/PreviewActionTest.php index 4557c396..6bf227ac 100644 --- a/module/Core/test/Action/PreviewActionTest.php +++ b/module/Core/test/Action/PreviewActionTest.php @@ -6,7 +6,6 @@ namespace ShlinkioTest\Shlink\Core\Action; use finfo; use PHPUnit\Framework\TestCase; use Prophecy\Argument; -use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\ObjectProphecy; use Psr\Http\Server\RequestHandlerInterface; use Shlinkio\Shlink\Common\Service\PreviewGenerator; @@ -76,7 +75,6 @@ class PreviewActionTest extends TestCase $this->urlShortener->shortCodeToUrl($shortCode)->willThrow(InvalidShortCodeException::class) ->shouldBeCalledOnce(); $delegate = $this->prophesize(RequestHandlerInterface::class); - /** @var MethodProphecy $process */ $process = $delegate->handle(Argument::any())->willReturn(new Response()); $this->action->process( diff --git a/module/Core/test/Action/QrCodeActionTest.php b/module/Core/test/Action/QrCodeActionTest.php index d3ef464c..12e294ef 100644 --- a/module/Core/test/Action/QrCodeActionTest.php +++ b/module/Core/test/Action/QrCodeActionTest.php @@ -5,7 +5,6 @@ namespace ShlinkioTest\Shlink\Core\Action; use PHPUnit\Framework\TestCase; use Prophecy\Argument; -use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\ObjectProphecy; use Psr\Http\Server\RequestHandlerInterface; use Shlinkio\Shlink\Common\Response\QrCodeResponse; @@ -56,7 +55,6 @@ class QrCodeActionTest extends TestCase $this->urlShortener->shortCodeToUrl($shortCode)->willThrow(InvalidShortCodeException::class) ->shouldBeCalledOnce(); $delegate = $this->prophesize(RequestHandlerInterface::class); - /** @var MethodProphecy $process */ $process = $delegate->handle(Argument::any())->willReturn(new Response()); $this->action->process((new ServerRequest())->withAttribute('shortCode', $shortCode), $delegate->reveal()); diff --git a/module/Core/test/Service/Tag/TagServiceTest.php b/module/Core/test/Service/Tag/TagServiceTest.php index ff32ad96..e3c907e8 100644 --- a/module/Core/test/Service/Tag/TagServiceTest.php +++ b/module/Core/test/Service/Tag/TagServiceTest.php @@ -7,7 +7,6 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; use PHPUnit\Framework\TestCase; use Prophecy\Argument; -use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\ObjectProphecy; use Shlinkio\Shlink\Core\Entity\Tag; use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException; @@ -33,9 +32,7 @@ class TagServiceTest extends TestCase $expected = [new Tag('foo'), new Tag('bar')]; $repo = $this->prophesize(EntityRepository::class); - /** @var MethodProphecy $find */ $find = $repo->findBy(Argument::cetera())->willReturn($expected); - /** @var MethodProphecy $getRepo */ $getRepo = $this->em->getRepository(Tag::class)->willReturn($repo->reveal()); $result = $this->service->listTags(); @@ -49,9 +46,7 @@ class TagServiceTest extends TestCase public function deleteTagsDelegatesOnRepository() { $repo = $this->prophesize(TagRepository::class); - /** @var MethodProphecy $delete */ $delete = $repo->deleteByName(['foo', 'bar'])->willReturn(4); - /** @var MethodProphecy $getRepo */ $getRepo = $this->em->getRepository(Tag::class)->willReturn($repo->reveal()); $this->service->deleteTags(['foo', 'bar']); @@ -64,13 +59,9 @@ class TagServiceTest extends TestCase public function createTagsPersistsEntities() { $repo = $this->prophesize(TagRepository::class); - /** @var MethodProphecy $find */ $find = $repo->findOneBy(Argument::cetera())->willReturn(new Tag('foo')); - /** @var MethodProphecy $getRepo */ $getRepo = $this->em->getRepository(Tag::class)->willReturn($repo->reveal()); - /** @var MethodProphecy $persist */ $persist = $this->em->persist(Argument::type(Tag::class))->willReturn(null); - /** @var MethodProphecy $flush */ $flush = $this->em->flush()->willReturn(null); $result = $this->service->createTags(['foo', 'bar']); @@ -86,9 +77,7 @@ class TagServiceTest extends TestCase public function renameInvalidTagThrowsException() { $repo = $this->prophesize(TagRepository::class); - /** @var MethodProphecy $find */ $find = $repo->findOneBy(Argument::cetera())->willReturn(null); - /** @var MethodProphecy $getRepo */ $getRepo = $this->em->getRepository(Tag::class)->willReturn($repo->reveal()); $find->shouldBeCalled(); @@ -104,11 +93,8 @@ class TagServiceTest extends TestCase $expected = new Tag('foo'); $repo = $this->prophesize(TagRepository::class); - /** @var MethodProphecy $find */ $find = $repo->findOneBy(Argument::cetera())->willReturn($expected); - /** @var MethodProphecy $getRepo */ $getRepo = $this->em->getRepository(Tag::class)->willReturn($repo->reveal()); - /** @var MethodProphecy $flush */ $flush = $this->em->flush($expected)->willReturn(null); $tag = $this->service->renameTag('foo', 'bar'); diff --git a/module/Core/test/Service/UrlShortenerTest.php b/module/Core/test/Service/UrlShortenerTest.php index 705c1559..bc91dcb8 100644 --- a/module/Core/test/Service/UrlShortenerTest.php +++ b/module/Core/test/Service/UrlShortenerTest.php @@ -13,7 +13,6 @@ use GuzzleHttp\Exception\ClientException; use GuzzleHttp\Psr7\Request; use PHPUnit\Framework\TestCase; use Prophecy\Argument; -use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\ObjectProphecy; use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Entity\Tag; @@ -123,7 +122,6 @@ class UrlShortenerTest extends TestCase $repo = $this->prophesize(ShortUrlRepository::class); $countBySlug = $repo->count(['shortCode' => 'custom-slug'])->willReturn(1); $repo->findOneBy(Argument::cetera())->willReturn(null); - /** @var MethodProphecy $getRepo */ $getRepo = $this->em->getRepository(ShortUrl::class)->willReturn($repo->reveal()); $countBySlug->shouldBeCalledOnce(); diff --git a/module/Rest/test/Action/Tag/DeleteTagsActionTest.php b/module/Rest/test/Action/Tag/DeleteTagsActionTest.php index 2cd5489e..0fbcba80 100644 --- a/module/Rest/test/Action/Tag/DeleteTagsActionTest.php +++ b/module/Rest/test/Action/Tag/DeleteTagsActionTest.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace ShlinkioTest\Shlink\Rest\Action\Tag; use PHPUnit\Framework\TestCase; -use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\ObjectProphecy; use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface; use Shlinkio\Shlink\Rest\Action\Tag\DeleteTagsAction; @@ -30,7 +29,6 @@ class DeleteTagsActionTest extends TestCase public function processDelegatesIntoService(?array $tags): void { $request = (new ServerRequest())->withQueryParams(['tags' => $tags]); - /** @var MethodProphecy $deleteTags */ $deleteTags = $this->tagService->deleteTags($tags ?: []); $response = $this->action->handle($request); diff --git a/module/Rest/test/Action/Tag/ListTagsActionTest.php b/module/Rest/test/Action/Tag/ListTagsActionTest.php index bfd7cf5d..cc8dc93c 100644 --- a/module/Rest/test/Action/Tag/ListTagsActionTest.php +++ b/module/Rest/test/Action/Tag/ListTagsActionTest.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace ShlinkioTest\Shlink\Rest\Action\Tag; use PHPUnit\Framework\TestCase; -use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\ObjectProphecy; use Shlinkio\Shlink\Core\Entity\Tag; use Shlinkio\Shlink\Core\Service\Tag\TagServiceInterface; @@ -28,7 +27,6 @@ class ListTagsActionTest extends TestCase /** @test */ public function returnsDataFromService() { - /** @var MethodProphecy $listTags */ $listTags = $this->tagService->listTags()->willReturn([new Tag('foo'), new Tag('bar')]); $resp = $this->action->handle(new ServerRequest()); diff --git a/module/Rest/test/Action/Tag/UpdateTagActionTest.php b/module/Rest/test/Action/Tag/UpdateTagActionTest.php index 12790e42..d39b81f1 100644 --- a/module/Rest/test/Action/Tag/UpdateTagActionTest.php +++ b/module/Rest/test/Action/Tag/UpdateTagActionTest.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace ShlinkioTest\Shlink\Rest\Action\Tag; use PHPUnit\Framework\TestCase; -use Prophecy\Prophecy\MethodProphecy; use Prophecy\Prophecy\ObjectProphecy; use Shlinkio\Shlink\Core\Entity\Tag; use Shlinkio\Shlink\Core\Exception\EntityDoesNotExistException; @@ -51,7 +50,6 @@ class UpdateTagActionTest extends TestCase 'oldName' => 'foo', 'newName' => 'bar', ]); - /** @var MethodProphecy $rename */ $rename = $this->tagService->renameTag('foo', 'bar')->willThrow(EntityDoesNotExistException::class); $resp = $this->action->handle($request); @@ -67,7 +65,6 @@ class UpdateTagActionTest extends TestCase 'oldName' => 'foo', 'newName' => 'bar', ]); - /** @var MethodProphecy $rename */ $rename = $this->tagService->renameTag('foo', 'bar')->willReturn(new Tag('bar')); $resp = $this->action->handle($request); diff --git a/module/Rest/test/Middleware/BodyParserMiddlewareTest.php b/module/Rest/test/Middleware/BodyParserMiddlewareTest.php index b7fb751e..33c1aab2 100644 --- a/module/Rest/test/Middleware/BodyParserMiddlewareTest.php +++ b/module/Rest/test/Middleware/BodyParserMiddlewareTest.php @@ -5,7 +5,6 @@ namespace ShlinkioTest\Shlink\Rest\Middleware; use PHPUnit\Framework\TestCase; use Prophecy\Argument; -use Prophecy\Prophecy\MethodProphecy; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; use Shlinkio\Shlink\Rest\Middleware\BodyParserMiddleware; @@ -68,7 +67,6 @@ class BodyParserMiddlewareTest extends TestCase ->withBody($body) ->withHeader('content-type', 'application/json'); $delegate = $this->prophesize(RequestHandlerInterface::class); - /** @var MethodProphecy $process */ $process = $delegate->handle(Argument::type(ServerRequestInterface::class))->will( function (array $args) use ($test) { /** @var ServerRequestInterface $req */ @@ -97,7 +95,6 @@ class BodyParserMiddlewareTest extends TestCase $request = (new ServerRequest())->withMethod('PUT') ->withBody($body); $delegate = $this->prophesize(RequestHandlerInterface::class); - /** @var MethodProphecy $process */ $process = $delegate->handle(Argument::type(ServerRequestInterface::class))->will( function (array $args) use ($test) { /** @var ServerRequestInterface $req */