Skip to content

Commit 83b9a5d

Browse files
committed
Add more typehints
1 parent 6254b64 commit 83b9a5d

File tree

13 files changed

+36
-24
lines changed

13 files changed

+36
-24
lines changed

lib/Tmdb/Factory/AbstractFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ protected function getHttpClient()
167167
* Create the account states
168168
*
169169
* @param array $data
170-
* @return AbstractModel
170+
* @return AccountStates
171171
*/
172172
public function createAccountStates(array $data = [])
173173
{
@@ -190,7 +190,7 @@ public function createAccountStates(array $data = [])
190190
* Create result
191191
*
192192
* @param array $data
193-
* @return AbstractModel
193+
* @return Result
194194
*/
195195
public function createResult(array $data = [])
196196
{

lib/Tmdb/Factory/AuthenticationFactory.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
use DateTime;
1818
use RuntimeException;
19+
use Tmdb\Model\AbstractModel;
20+
use Tmdb\Model\Common\GenericCollection;
1921
use Tmdb\Token\Session\GuestSessionToken;
2022
use Tmdb\Token\Session\RequestToken;
2123
use Tmdb\Token\Session\SessionToken;
@@ -29,7 +31,7 @@ class AuthenticationFactory extends AbstractFactory
2931
/**
3032
* @param array $data
3133
*
32-
* @return void
34+
* @return AbstractModel
3335
* @throws RuntimeException
3436
*/
3537
public function create(array $data = [])
@@ -44,7 +46,7 @@ public function create(array $data = [])
4446
/**
4547
* @param array $data
4648
*
47-
* @return void
49+
* @return GenericCollection
4850
* @throws RuntimeException
4951
*/
5052
public function createCollection(array $data = [])
@@ -106,7 +108,7 @@ public function createSessionToken(array $data = [])
106108
* Create session token for guest
107109
*
108110
* @param array $data
109-
* @return SessionToken
111+
* @return GuestSessionToken
110112
*/
111113
public function createGuestSessionToken(array $data = [])
112114
{

lib/Tmdb/Factory/GuestSessionFactory.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
namespace Tmdb\Factory;
1616

17+
use Tmdb\Exception\NotImplementedException;
18+
use Tmdb\Model\AbstractModel;
19+
use Tmdb\Model\Common\GenericCollection;
20+
1721
/**
1822
* Currently a place-holder for future expansions
1923
*
@@ -25,18 +29,20 @@ class GuestSessionFactory extends AbstractFactory
2529
/**
2630
* {@inheritdoc}
2731
*
28-
* @return void
32+
* @throws NotImplementedException
2933
*/
3034
public function create(array $data = [])
3135
{
36+
throw new NotImplementedException('GuestSessionFactory does not implement create.');
3237
}
3338

3439
/**
3540
* {@inheritdoc}
3641
*
37-
* @return void
42+
* @throws NotImplementedException
3843
*/
3944
public function createCollection(array $data = [])
4045
{
46+
throw new NotImplementedException('GuestSessionFactory does not implement createCollection.');
4147
}
4248
}

lib/Tmdb/HttpClient/HttpClient.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ public function __construct(
7575
* @param array $headers
7676
* @param null $body
7777
*
78-
* @return array|string
79-
*
80-
* @psalm-return array<empty, empty>|string
78+
* @return ResponseInterface
8179
*/
8280
public function send(string $path, string $method, array $parameters = [], array $headers = [], $body = null)
8381
{

lib/Tmdb/Model/Account/ListItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class ListItem extends AbstractModel
7070
*/
7171
private $posterPath;
7272
/**
73-
* @var PosterImage
73+
* @var PosterImage|Image
7474
*/
7575
private $posterImage;
7676

lib/Tmdb/Model/Collection/Images.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function getImages()
3838
* Retrieve a image from the collection
3939
*
4040
* @param $id
41-
* @return GenericCollection
41+
* @return ?Image
4242
*/
4343
public function getImage($id)
4444
{

lib/Tmdb/Model/Movie.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class Movie extends AbstractModel
195195
*/
196196
private $productionCountries;
197197
/**
198-
* @var DateTime
198+
* @var ?DateTime
199199
*/
200200
private $releaseDate;
201201
/**
@@ -309,7 +309,7 @@ public function getBelongsToCollection()
309309
}
310310

311311
/**
312-
* @param null $belongsToCollection
312+
* @param GenericCollection $belongsToCollection
313313
* @return self
314314
*/
315315
public function setBelongsToCollection($belongsToCollection)

lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ protected function getDate($year, $format = 'Y-m-d')
202202
}
203203

204204
/**
205-
* @return static
205+
* @return self
206206
* @deprecated
207207
*
208208
*/
@@ -227,7 +227,7 @@ public function primaryReleaseDateGte($year)
227227
}
228228

229229
/**
230-
* @return static
230+
* @return self
231231
* @deprecated
232232
*
233233
*/

lib/Tmdb/Repository/DiscoverRepository.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Tmdb\Api\Discover;
1818
use Tmdb\Exception\NotImplementedException;
1919
use Tmdb\Exception\RuntimeException;
20+
use Tmdb\Factory\AbstractFactory;
2021
use Tmdb\Factory\FactoryInterface;
2122
use Tmdb\Factory\MovieFactory;
2223
use Tmdb\Factory\TvFactory;
@@ -102,7 +103,7 @@ public function getTvFactory()
102103
/**
103104
* Discover currently does not offer an factory
104105
*
105-
* @return void
106+
* @return AbstractFactory
106107
* @throws NotImplementedException
107108
*/
108109
public function getFactory()

lib/Tmdb/Repository/MovieRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public function getLists($id, array $parameters = [], array $headers = []): Gene
316316
* @param $id
317317
* @param $parameters
318318
* @param $headers
319-
* @return null|AbstractModel
319+
* @return GenericCollection
320320
*/
321321
public function getChanges($id, array $parameters = [], array $headers = [])
322322
{

0 commit comments

Comments
 (0)