Skip to content

Commit f28366b

Browse files
authored
Merge pull request #30 from glo71317/php8.4_deprecations
Explicit nullable type added with PHP 8.4 support
2 parents 29b6ee7 + f614612 commit f28366b

19 files changed

Lines changed: 192 additions & 194 deletions

src/Client/AdobeStock.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class AdobeStock
7979
* @param string $target_env Target Environment Prod/Stage
8080
* @param HttpInterface $http_client Custom http client
8181
*/
82-
public function __construct(string $api_key, string $product, string $target_env, HttpInterface $http_client = null)
82+
public function __construct(string $api_key, string $product, string $target_env, ?HttpInterface $http_client = null)
8383
{
8484
$this->_config = new CoreConfig($api_key, $product, $target_env);
8585
$this->_search_category_factory = new SearchCategoryFactory($this->_config);
@@ -143,7 +143,7 @@ public function searchCategoryTree(SearchCategoryRequest $request, string $acces
143143
* @return FilesResponse
144144
* @throws StockApiException
145145
*/
146-
public function getFiles(FilesRequest $request, string $access_token = null) : FilesResponse
146+
public function getFiles(FilesRequest $request, ?string $access_token = null) : FilesResponse
147147
{
148148
return $this->_files_factory->getFiles($request, $this->_http_client, $access_token);
149149
}
@@ -154,7 +154,7 @@ public function getFiles(FilesRequest $request, string $access_token = null) : F
154154
* @param string $access_token
155155
* @return AdobeStock
156156
*/
157-
public function searchFilesInitialize(SearchFilesRequest $request, string $access_token = null) : AdobeStock
157+
public function searchFilesInitialize(SearchFilesRequest $request, ?string $access_token = null) : AdobeStock
158158
{
159159
$this->_search_files_factory->searchFilesInitialize($request, $access_token, $this->_http_client, true);
160160
return $this;
@@ -331,7 +331,7 @@ public function downloadAssetStream(LicenseRequest $request, string $access_toke
331331
* @param string $access_token Access token
332332
* @return AdobeStock
333333
*/
334-
public function initializeLicenseHistory(LicenseHistoryRequest $request, string $access_token = null) : AdobeStock
334+
public function initializeLicenseHistory(LicenseHistoryRequest $request, ?string $access_token = null) : AdobeStock
335335
{
336336
$this->_license_history_factory->initializeLicenseHistory($request, $access_token, $this->_http_client);
337337
return $this;

src/Client/Files.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(CoreConfig $config)
4545
public function getFiles(
4646
FilesRequest $file_request,
4747
HttpClientInterface $http_client,
48-
string $access_token = null
48+
?string $access_token = null
4949
) : FilesResponse {
5050
$this->_validateRequest($file_request, $access_token);
5151
$response_json = $http_client->doGet(
@@ -64,7 +64,7 @@ public function getFiles(
6464
* @param string $access_token
6565
* @throws StockApiException
6666
*/
67-
private function _validateRequest(FilesRequest $request, string $access_token = null) : void
67+
private function _validateRequest(FilesRequest $request, ?string $access_token = null) : void
6868
{
6969
if (!empty($request->getResultColumns())) {
7070
if (in_array('is_licensed', $request->getResultColumns()) && $access_token === null) {

src/Client/Http/HttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class HttpClient implements HttpInterface
2727
* Constructor
2828
* @param Client $client GuzzleClient
2929
*/
30-
public function __construct(Client $client = null)
30+
public function __construct(?Client $client = null)
3131
{
3232
if ($client === null) {
3333
$client = new Client();

src/Client/License.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected function _getDownloadUrl(): string
6060
* @param string $url
6161
* @param string $access_token
6262
*/
63-
protected function _setDownloadUrl(string $url, string $access_token = null)
63+
protected function _setDownloadUrl(string $url, ?string $access_token = null)
6464
{
6565
if ($access_token) {
6666
$url .= '?token=' . $access_token;

0 commit comments

Comments
 (0)