Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/AuditLog/AuditLogApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AuditLogApi extends BaseApiAbstract
/**
* {@inheritdoc}
*/
public function __construct($projectId, ClientInterface $client, LoggerInterface $logger = null, $service_url = null)
public function __construct($projectId, ClientInterface $client, ?LoggerInterface $logger = null, $service_url = null)
{
parent::__construct($projectId, $client, $logger, $service_url);

Expand All @@ -29,7 +29,7 @@ public function __construct($projectId, ClientInterface $client, LoggerInterface
$this->setBaseUrl(\rtrim($service_url, '/'));
}

public static function create(AuthApiInterface $authProvider, $projectId, LoggerInterface $logger = null)
public static function create(AuthApiInterface $authProvider, $projectId, ?LoggerInterface $logger = null)
{

$client = self::initializeHttpClient(self::ENDPOINT_URL);
Expand Down
4 changes: 2 additions & 2 deletions src/Batch/BatchApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function createBatch(CreateBatchParameters $parameters)
*
* @throws SmartlingApiException
*/
public function uploadBatchFile($realPath, $fileName, $fileType, $batchUid, UploadFileParameters $parameters = null) {
public function uploadBatchFile($realPath, $fileName, $fileType, $batchUid, ?UploadFileParameters $parameters = null) {
// @TODO: let's pass file, fileUri and fileType in UploadFileParameters.
// In this case we could get rid of passing these variables into this
// method. But this approach requires changes in UploadFileParameters
Expand Down Expand Up @@ -121,7 +121,7 @@ public function uploadBatchFile($realPath, $fileName, $fileType, $batchUid, Uplo
*
* @throws SmartlingApiException
*/
public function executeBatch($batchUid, ExecuteBatchParameters $parameters = null)
public function executeBatch($batchUid, ?ExecuteBatchParameters $parameters = null)
{
$endpoint = \vsprintf('batches/%s', [$batchUid]);

Expand Down
6 changes: 3 additions & 3 deletions src/Batch/BatchApiV2.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class BatchApiV2 extends BaseApiAbstract
public function __construct(
AuthApiInterface $authProvider,
string $projectId,
LoggerInterface $logger = null,
ClientInterface $client = null
?LoggerInterface $logger = null,
?ClientInterface $client = null
)
{
if ($client === null) {
Expand All @@ -33,7 +33,7 @@ public function __construct(
/**
* @throws SmartlingApiException
*/
public function cancelBatchFile(string $batchUid, string $fileUri, string $reason = null): void
public function cancelBatchFile(string $batchUid, string $fileUri, ?string $reason = null): void
{
if ($batchUid === '') {
throw new \UnexpectedValueException('BatchUid cannot be empty.');
Expand Down
6 changes: 3 additions & 3 deletions src/Context/ContextApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function uploadContext(UploadContextParameters $params)
* @return array
* @throws \Smartling\Exceptions\SmartlingApiException
*/
public function matchContext($contextUid, MatchContextParameters $params = null)
public function matchContext($contextUid, ?MatchContextParameters $params = null)
{
$endpoint = \vsprintf('contexts/%s/match/async', [$contextUid]);
$requestData = $this->getDefaultRequestData('json', \is_null($params) ? [] : $params->exportToArray());
Expand All @@ -165,7 +165,7 @@ public function matchContext($contextUid, MatchContextParameters $params = null)
*
* @throws \Smartling\Exceptions\SmartlingApiException
*/
public function matchContextSync($contextUid, MatchContextParameters $params = null)
public function matchContextSync($contextUid, ?MatchContextParameters $params = null)
{
$this->wait($this->matchContext($contextUid, $params));
}
Expand Down Expand Up @@ -216,7 +216,7 @@ public function getMatchStatus($processUid) {
* @return array
* @throws \Smartling\Exceptions\SmartlingApiException
*/
public function getMissingResources(MissingResourcesParameters $params = null) {
public function getMissingResources(?MissingResourcesParameters $params = null) {
$requestData = $this->getDefaultRequestData('query', \is_null($params) ? [] : $params->exportToArray());

return $this->sendRequest('missing-resources', $requestData, self::HTTP_METHOD_GET);
Expand Down
2 changes: 1 addition & 1 deletion src/DistributedLockService/DistributedLockServiceApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DistributedLockServiceApi extends BaseApiAbstract
*
* @return self
*/
public static function create(AuthApiInterface $authProvider, $projectId, LoggerInterface $logger = null)
public static function create(AuthApiInterface $authProvider, $projectId, ?LoggerInterface $logger = null)
{
$instance = new self($projectId, self::initializeHttpClient(self::ENDPOINT_URL), $logger, self::ENDPOINT_URL);
$instance->setAuth($authProvider);
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/SmartlingApiException.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SmartlingApiException extends \Exception
* @param int $code
* @param \Exception $previous
*/
public function __construct($errors, $code = 0, \Exception $previous = null)
public function __construct($errors, $code = 0, ?\Exception $previous = null)
{
$message = '';

Expand Down
26 changes: 13 additions & 13 deletions src/File/FileApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected function getDefaultRequestData($parametersType, $parameters, $auth = t
*
* @see http://docs.smartling.com/pages/API/FileAPI/Upload-File/
*/
public function uploadFile($realPath, $file_name, $file_type, UploadFileParameters $params = null)
public function uploadFile($realPath, $file_name, $file_type, ?UploadFileParameters $params = null)
{
if (\is_null($params)) {
$params = new UploadFileParameters();
Expand Down Expand Up @@ -170,7 +170,7 @@ public function uploadFile($realPath, $file_name, $file_type, UploadFileParamete
*
* @see http://docs.smartling.com/pages/API/FileAPI/Download-File/
*/
public function downloadFile($fileUri, $locale = '', DownloadFileParameters $params = null)
public function downloadFile($fileUri, $locale = '', ?DownloadFileParameters $params = null)
{
if ((!\is_string($locale)) || \strlen($locale) < 2) {
$message = \vsprintf(
Expand All @@ -192,7 +192,7 @@ public function downloadFile($fileUri, $locale = '', DownloadFileParameters $par
return $this->sendRequest("locales/{$locale}/file", $requestData, self::HTTP_METHOD_GET, true);
}

public function downloadAllTranslationsOfFile($fileUri, DownloadFileParameters $params = null)
public function downloadAllTranslationsOfFile($fileUri, ?DownloadFileParameters $params = null)
{
$params = (\is_null($params)) ? [] : $params->exportToArray();
$params['fileUri'] = $fileUri;
Expand All @@ -203,7 +203,7 @@ public function downloadAllTranslationsOfFile($fileUri, DownloadFileParameters $
return $this->sendRequest("locales/all/file/zip", $requestData, self::HTTP_METHOD_GET, true);
}

public function downloadMultipleTranslationsOfFiles(DownloadMultipleFilesParameters $params = null)
public function downloadMultipleTranslationsOfFiles(?DownloadMultipleFilesParameters $params = null)
{
$params = (\is_null($params)) ? [] : $params->exportToArray();

Expand All @@ -228,7 +228,7 @@ public function downloadMultipleTranslationsOfFiles(DownloadMultipleFilesParamet
* @throws SmartlingApiException
* @see http://docs.smartling.com/pages/API/FileAPI/Status/
*/
public function getStatus($fileUri, $locale, ParameterInterface $params = null)
public function getStatus($fileUri, $locale, ?ParameterInterface $params = null)
{
$params = (\is_null($params)) ? [] : $params->exportToArray();
$params['fileUri'] = $fileUri;
Expand All @@ -251,7 +251,7 @@ public function getStatus($fileUri, $locale, ParameterInterface $params = null)
* @throws SmartlingApiException
* @see http://docs.smartling.com/pages/API/v2/FileAPI/Status/All-Locales/
*/
public function getStatusForAllLocales($fileUri, ParameterInterface $params = null)
public function getStatusForAllLocales($fileUri, ?ParameterInterface $params = null)
{
$params = (\is_null($params)) ? [] : $params->exportToArray();
$params['fileUri'] = $fileUri;
Expand Down Expand Up @@ -291,7 +291,7 @@ public function getStatusForAllLocales($fileUri, ParameterInterface $params = nu
*
* @see http://docs.smartling.com/pages/API/FileAPI/List/
*/
public function getList(ListFilesParameters $params = null)
public function getList(?ListFilesParameters $params = null)
{
$params = (\is_null($params)) ? [] : $params->exportToArray();

Expand All @@ -307,7 +307,7 @@ public function getList(ListFilesParameters $params = null)
* can only be of a value 'COMPLETED'
* @return bool
*/
public function getExtendedList($locale, ExtendedListFilesParameters $params = null)
public function getExtendedList($locale, ?ExtendedListFilesParameters $params = null)
{
$params = (\is_null($params)) ? [] : $params->exportToArray();

Expand All @@ -334,7 +334,7 @@ public function getExtendedList($locale, ExtendedListFilesParameters $params = n
* @throws SmartlingApiException
* @see http://docs.smartling.com/pages/API/FileAPI/Rename/
*/
public function renameFile($fileUri, $newFileUri, ParameterInterface $params = null)
public function renameFile($fileUri, $newFileUri, ?ParameterInterface $params = null)
{
$params = (\is_null($params)) ? [] : $params->exportToArray();
$params['fileUri'] = $fileUri;
Expand All @@ -360,7 +360,7 @@ public function renameFile($fileUri, $newFileUri, ParameterInterface $params = n
* @return array
* @throws SmartlingApiException
*/
public function deleteFile($fileUri, ParameterInterface $params = null)
public function deleteFile($fileUri, ?ParameterInterface $params = null)
{
$params = (\is_null($params)) ? [] : $params->exportToArray();
$params['fileUri'] = $fileUri;
Expand Down Expand Up @@ -422,7 +422,7 @@ public function import($locale, $fileUri, $fileType, $fileRealPath, $translation
* @return array
* @throws SmartlingApiException
*/
public function getStatusAllLocales($fileUri, ParameterInterface $params = null)
public function getStatusAllLocales($fileUri, ?ParameterInterface $params = null)
{
$params = (\is_null($params)) ? [] : $params->exportToArray();
$params['fileUri'] = $fileUri;
Expand All @@ -442,7 +442,7 @@ public function getStatusAllLocales($fileUri, ParameterInterface $params = null)
* @return array
* @throws SmartlingApiException
*/
public function getLastModified($fileUri, ParameterInterface $params = null)
public function getLastModified($fileUri, ?ParameterInterface $params = null)
{
$params = (\is_null($params)) ? [] : $params->exportToArray();
$params['fileUri'] = $fileUri;
Expand All @@ -465,7 +465,7 @@ public function getLastModified($fileUri, ParameterInterface $params = null)
*
* @see http://docs.smartling.com/pages/API/v2/FileAPI/Last-Modified/All-Locales/
*/
public function lastModified($fileUri, ParameterInterface $params = null)
public function lastModified($fileUri, ?ParameterInterface $params = null)
{
$result = $this->getLastModified($fileUri, $params);

Expand Down