Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"license": "MIT",
"name": "php-tmdb/api",
"require": {
"php": "^7.3 || ^7.4 || ^8.0 || ^8.1",
"php": "^7.3 || ^8.0",
"ext-json": "*",
"symfony/options-resolver": "^4.4 || ^5 || ^6",
"psr/cache": "^1 || ^2 || ^3",
Expand Down
4 changes: 2 additions & 2 deletions lib/Tmdb/Event/HydrationEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function getLastRequest(): ?RequestInterface
* @param RequestInterface|null $lastRequest
* @return self
*/
public function setLastRequest(RequestInterface $lastRequest = null): HydrationEvent
public function setLastRequest(?RequestInterface $lastRequest = null): HydrationEvent
{
$this->lastRequest = $lastRequest;

Expand All @@ -130,7 +130,7 @@ public function getLastResponse(): ?ResponseInterface
* @param ResponseInterface|null $lastResponse
* @return self
*/
public function setLastResponse(ResponseInterface $lastResponse = null): HydrationEvent
public function setLastResponse(?ResponseInterface $lastResponse = null): HydrationEvent
{
$this->lastResponse = $lastResponse;

Expand Down
2 changes: 1 addition & 1 deletion lib/Tmdb/Event/Listener/Logger/LogApiErrorListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class LogApiErrorListener
* @param LoggerInterface $logger
* @param TmdbApiExceptionFormatterInterface|null $formatter
*/
public function __construct(LoggerInterface $logger, TmdbApiExceptionFormatterInterface $formatter = null)
public function __construct(LoggerInterface $logger, ?TmdbApiExceptionFormatterInterface $formatter = null)
{
$this->logger = $logger;
$this->formatter = $formatter ?: new SimpleTmdbApiExceptionFormatter();
Expand Down
2 changes: 1 addition & 1 deletion lib/Tmdb/Event/Listener/Logger/LogHttpMessageListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class LogHttpMessageListener
* @param LoggerInterface $logger
* @param HttpMessageFormatterInterface|null $formatter
*/
public function __construct(LoggerInterface $logger, HttpMessageFormatterInterface $formatter = null)
public function __construct(LoggerInterface $logger, ?HttpMessageFormatterInterface $formatter = null)
{
$this->logger = $logger;
$this->formatter = $formatter ?: new SimpleHttpMessageFormatter();
Expand Down
2 changes: 1 addition & 1 deletion lib/Tmdb/Event/Listener/Logger/LogHydrationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class LogHydrationListener
*/
public function __construct(
LoggerInterface $logger,
HydrationFormatterInterface $formatter = null,
?HydrationFormatterInterface $formatter = null,
bool $withData = false
) {
$this->logger = $logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
class SessionTokenRequestListener
{
/**
* @var string|SessionBearerToken|GuestSessionToken
* @var SessionToken
*/
private $token;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class UserAgentRequestListener
* UserAgentRequestListener constructor.
* @param string|null $userAgent
*/
public function __construct(string $userAgent = null)
public function __construct(?string $userAgent = null)
{
$this->userAgent = $userAgent ?? sprintf('php-tmdb/api/%s', Client::VERSION);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Tmdb/Event/RequestEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class RequestEvent extends StoppableEvent implements LoggableHttpEventInterface
* @param RequestInterface $request
* @param SessionToken|null $sessionToken
*/
public function __construct(RequestInterface $request, SessionToken $sessionToken = null)
public function __construct(RequestInterface $request, ?SessionToken $sessionToken = null)
{
$this->request = $request;
$this->sessionToken = $sessionToken;
Expand Down Expand Up @@ -109,7 +109,7 @@ public function getSessionToken(): ?SessionToken
* @param SessionToken|null $sessionToken
* @return self
*/
public function setSessionToken(SessionToken $sessionToken = null): RequestEvent
public function setSessionToken(?SessionToken $sessionToken = null): RequestEvent
{
$this->sessionToken = $sessionToken;

Expand Down
6 changes: 3 additions & 3 deletions lib/Tmdb/Exception/TmdbApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ class TmdbApiException extends Exception
public function __construct(
int $code,
string $message,
RequestInterface $request = null,
ResponseInterface $response = null,
Exception $previous = null
?RequestInterface $request = null,
?ResponseInterface $response = null,
?Exception $previous = null
) {
parent::__construct($message, $code, $previous);

Expand Down
2 changes: 1 addition & 1 deletion lib/Tmdb/HttpClient/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public function getPsr14EventDispatcher(): EventDispatcherInterface
* @param string|null $key
* @return array|mixed
*/
public function getOptions(string $key = null)
public function getOptions(?string $key = null)
{
if ($key) {
return isset($this->options[$key]) ? $this->options[$key] : null;
Expand Down
3 changes: 1 addition & 2 deletions lib/Tmdb/Model/Collection/Images.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,8 @@ public function filterBestVotedImage()

foreach ($this->data as $image) {
/**
* @var $image Image
* @var Image $image
*/

if ($image->getVoteAverage() > $voteAverage) {
$voteAverage = $image->getVoteAverage();
$currentImage = $image;
Expand Down
2 changes: 1 addition & 1 deletion lib/Tmdb/Model/Common/GenericCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public function filter(Closure $closure, $static = true)
*
* @return array Returns an array of all matching key value pairs
*/
public function getAll(array $keys = null)
public function getAll(?array $keys = null)
{
return $keys ? array_intersect_key($this->data, array_flip($keys)) : $this->data;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Tmdb/Token/Session/RequestToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function getToken()
* @param string|null $token
* @return self
*/
public function setToken(string $token = null)
public function setToken(?string $token = null)
{
$this->token = $token;

Expand Down
2 changes: 1 addition & 1 deletion lib/Tmdb/Token/Session/SessionToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SessionToken
*
* @param string|null $sessionToken
*/
public function __construct(string $sessionToken = null)
public function __construct(?string $sessionToken = null)
{
$this->sessionToken = $sessionToken;
}
Expand Down
13 changes: 5 additions & 8 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ parameters:
count: 1
path: lib/Tmdb/Factory/MovieFactory.php

-
message: "#^Return type \\(Tmdb\\\\Model\\\\Collection\\\\People\\) of method Tmdb\\\\Factory\\\\PeopleFactory\\:\\:createCollection\\(\\) should be compatible with return type \\(Tmdb\\\\Model\\\\Common\\\\GenericCollection\\<Tmdb\\\\Model\\\\AbstractModel\\>\\) of method Tmdb\\\\Factory\\\\AbstractFactory\\<Tmdb\\\\Model\\\\AbstractModel\\>\\:\\:createCollection\\(\\)$#"
count: 1
path: lib/Tmdb/Factory/PeopleFactory.php

-
message: "#^Property Tmdb\\\\HttpClient\\\\HttpClient\\:\\:\\$sessionToken is never written, only read\\.$#"
count: 1
Expand All @@ -54,14 +59,6 @@ parameters:
count: 1
path: lib/Tmdb/Model/Movie.php

-
message: """
#^Call to deprecated method getReleases\\(\\) of class Tmdb\\\\Model\\\\Movie\\:
Use the getReleaseDates instead$#
"""
count: 1
path: lib/Tmdb/Repository/MovieRepository.php

-
message: """
#^Return type of method Tmdb\\\\Repository\\\\MovieRepository\\:\\:getReleases\\(\\) has typehint with deprecated class Tmdb\\\\Model\\\\Movie\\\\Release\\:
Expand Down
Loading