From 1abed2d1b7872baf486af1fac3d11a50be3b141c Mon Sep 17 00:00:00 2001 From: Paul Vogel Date: Mon, 19 Oct 2026 17:32:01 +0200 Subject: [PATCH] remove deprecated get* aliases of the fetch methods --- src/Client/Author.php | 14 -------------- src/Client/Project.php | 21 --------------------- src/Client/Version.php | 14 -------------- tests/Unit/Client/AuthorTest.php | 17 ----------------- tests/Unit/Client/ProjectTest.php | 18 ------------------ tests/Unit/Client/VersionTest.php | 17 ----------------- 6 files changed, 101 deletions(-) diff --git a/src/Client/Author.php b/src/Client/Author.php index e8f649c..e2a976c 100644 --- a/src/Client/Author.php +++ b/src/Client/Author.php @@ -43,18 +43,4 @@ public function fetchProjects(): PaginatedAuthorProjectList { return $this->client->getAuthorProjects($this->getId()); } - - /** - * Fetch the projects of this author from the API (paginated). - * - * This sends a request to the SpigotMC API every time it is called. The result is not cached. - * - * @deprecated Use {@see fetchProjects()} instead. Methods that send a request to the API are prefixed with "fetch". - * @return PaginatedAuthorProjectList - * @throws ApiException - */ - public function getProjects(): PaginatedAuthorProjectList - { - return $this->fetchProjects(); - } } diff --git a/src/Client/Project.php b/src/Client/Project.php index f957ae4..26b10cd 100644 --- a/src/Client/Project.php +++ b/src/Client/Project.php @@ -70,25 +70,4 @@ public function fetchVersions( { return $this->client->getProjectVersions($this->getId(), $page, $order, $direction); } - - /** - * Fetch the versions of this project from the API (paginated). - * - * This sends a request to the SpigotMC API every time it is called. The result is not cached. - * - * @deprecated Use {@see fetchVersions()} instead. Methods that send a request to the API are prefixed with "fetch". - * @param int $page - * @param VersionOrder|null $order Field to order the results by. When null, the API default (id) is used. - * @param SortDirection|null $direction Direction to order the results by. When null, the API default (asc) is used. - * @return PaginatedVersionList - * @throws ApiException - */ - public function getVersions( - int $page = 1, - ?VersionOrder $order = null, - ?SortDirection $direction = null, - ): PaginatedVersionList - { - return $this->fetchVersions($page, $order, $direction); - } } diff --git a/src/Client/Version.php b/src/Client/Version.php index 852118d..06d8585 100644 --- a/src/Client/Version.php +++ b/src/Client/Version.php @@ -52,18 +52,4 @@ public function fetchProject(): Project { return $this->client->getProject($this->getProjectId()); } - - /** - * Fetch the project this version belongs to from the API. - * - * This sends a request to the SpigotMC API every time it is called. The result is not cached. - * - * @deprecated Use {@see fetchProject()} instead. Methods that send a request to the API are prefixed with "fetch". - * @return Project - * @throws ApiException - */ - public function getProject(): Project - { - return $this->fetchProject(); - } } diff --git a/tests/Unit/Client/AuthorTest.php b/tests/Unit/Client/AuthorTest.php index cb6ca3f..9b11486 100644 --- a/tests/Unit/Client/AuthorTest.php +++ b/tests/Unit/Client/AuthorTest.php @@ -44,21 +44,4 @@ public function testFetchProjects(): void $this->assertEquals($author->getId(), $project->getData()->getAuthor()->getId()); } } - - /** - * @throws ApiException - */ - public function testDeprecatedGetProjectsFetchesProjects(): void - { - $handler = new MockHandler([ - new Response(200, [], file_get_contents(__DIR__ . "/Fixtures/getResourcesByAuthor.json")), - ]); - $this->apiClient->setHttpClient(new Client(['handler' => HandlerStack::create($handler)])); - $author = new Author($this->apiClient, $this->getAuthorModel()); - - $projects = $author->getProjects(); - $this->assertNotEmpty($projects); - $this->assertSame(0, $handler->count()); - } - } \ No newline at end of file diff --git a/tests/Unit/Client/ProjectTest.php b/tests/Unit/Client/ProjectTest.php index 9bf69fe..be67210 100644 --- a/tests/Unit/Client/ProjectTest.php +++ b/tests/Unit/Client/ProjectTest.php @@ -140,22 +140,4 @@ public function testFetchVersions(): void $this->assertEquals($project->getId(), $version->getProjectId()); } } - - /** - * @throws ApiException - */ - public function testDeprecatedGetVersionsFetchesVersions(): void - { - $handler = new MockHandler([ - new Response(200, [], file_get_contents(__DIR__ . "/Fixtures/getResourceUpdates.json")), - ]); - $this->apiClient->setHttpClient(new Client(['handler' => HandlerStack::create($handler)])); - $project = new Project($this->apiClient, $this->getResourceModel()); - - $versions = $project->getVersions(); - $this->assertNotEmpty($versions); - $this->assertSame(0, $handler->count()); - } - - } \ No newline at end of file diff --git a/tests/Unit/Client/VersionTest.php b/tests/Unit/Client/VersionTest.php index 2c554fe..e7615c3 100644 --- a/tests/Unit/Client/VersionTest.php +++ b/tests/Unit/Client/VersionTest.php @@ -65,21 +65,4 @@ public function testFetchProject(): void $this->assertEquals(57242, $project->getData()->getId()); $this->assertEquals("spark", $project->getData()->getTitle()); } - - /** - * @throws ApiException - */ - public function testDeprecatedGetProjectFetchesProject(): void - { - $handler = new MockHandler([ - new Response(200, [], file_get_contents(__DIR__ . "/Fixtures/getResource.json")), - ]); - $this->apiClient->setHttpClient(new Client(['handler' => HandlerStack::create($handler)])); - $version = new Version($this->apiClient, $this->getResourceUpdateModel()); - - $project = $version->getProject(); - $this->assertEquals(57242, $project->getId()); - $this->assertSame(0, $handler->count()); - } - } \ No newline at end of file