diff --git a/src/Auth/AuthService.php b/src/Auth/AuthService.php index d28391af9375e94e5882fe587e25a32fab5694bd..8ed530facbce520efad9ef4c6701ad52c08f5dba 100644 --- a/src/Auth/AuthService.php +++ b/src/Auth/AuthService.php @@ -80,7 +80,7 @@ class AuthService extends \JiraRestApi\JiraClient * @throws \Exception * @throws \JiraRestApi\JiraException */ - public function __construct(ConfigurationInterface $configuration = null, LoggerInterface $logger = null, $path = './') + public function __construct(?ConfigurationInterface $configuration = null, ?LoggerInterface $logger = null, $path = './') { parent::__construct($configuration, $logger, $path); $this->setAPIUri($this->auth_api_uri); diff --git a/src/Board/BoardService.php b/src/Board/BoardService.php index 8c7c0ae9f182ef8b6f65fdc75628f7343e9ddbef..fb2c5352bed3a934b416ac158465b2fb37719e34 100644 --- a/src/Board/BoardService.php +++ b/src/Board/BoardService.php @@ -14,7 +14,7 @@ class BoardService extends \JiraRestApi\JiraClient private $agileVersion = '1.0'; - public function __construct(ConfigurationInterface $configuration = null, LoggerInterface $logger = null, $path = './') + public function __construct(?ConfigurationInterface $configuration = null, ?LoggerInterface $logger = null, $path = './') { parent::__construct($configuration, $logger, $path); $this->setAPIUri('/rest/agile/'.$this->agileVersion); @@ -51,13 +51,14 @@ class BoardService extends \JiraRestApi\JiraClient * * @param array $paramArray * - * @return PaginatedResult|null array of Board class - *@throws \JiraRestApi\JiraException + * @throws \JiraRestApi\JiraException * + * @return PaginatedResult|null array of Board class */ public function getBoards($paramArray = []): ?PaginatedResult { $json = $this->exec($this->uri.$this->toHttpQueryParameter($paramArray), null); + try { return $this->json_mapper->map( json_decode($json, false, 512, $this->getJsonOptions()), @@ -65,6 +66,7 @@ class BoardService extends \JiraRestApi\JiraClient ); } catch (\JsonException $exception) { $this->log->error("Response cannot be decoded from json\nException: {$exception->getMessage()}"); + return null; } } @@ -165,6 +167,7 @@ class BoardService extends \JiraRestApi\JiraClient ); } catch (\JsonException $exception) { $this->log->error("Response cannot be decoded from json\nException: {$exception->getMessage()}"); + return null; } } diff --git a/src/Board/PaginatedResult.php b/src/Board/PaginatedResult.php index c3339aab84f0c3a24e3fa273a0078f2ccd57544f..62f62f4001e99ddab0cd7ddf2b58805b136000a6 100644 --- a/src/Board/PaginatedResult.php +++ b/src/Board/PaginatedResult.php @@ -3,7 +3,7 @@ namespace JiraRestApi\Board; /** - * Paginated Result object for BoardService + * Paginated Result object for BoardService. */ class PaginatedResult { diff --git a/src/Configuration/ArrayConfiguration.php b/src/Configuration/ArrayConfiguration.php index df0e6000e7662822bf4b200dba81286eb6874380..267568ba7aea2613a3aa9c0ec5c10a30bc4036c8 100644 --- a/src/Configuration/ArrayConfiguration.php +++ b/src/Configuration/ArrayConfiguration.php @@ -1,4 +1,5 @@ setAPIUri('/rest/agile/'.$this->version); diff --git a/src/Issue/AgileIssueService.php b/src/Issue/AgileIssueService.php index 50ef551100cb60b1f40a0bd215301044236087f9..85bdfcd1782c86e6232d7cb0fe945faee1c6b16e 100644 --- a/src/Issue/AgileIssueService.php +++ b/src/Issue/AgileIssueService.php @@ -11,7 +11,7 @@ class AgileIssueService extends \JiraRestApi\JiraClient private $agileVersion = '1.0'; - public function __construct(ConfigurationInterface $configuration = null, LoggerInterface $logger = null, $path = './') + public function __construct(?ConfigurationInterface $configuration = null, ?LoggerInterface $logger = null, $path = './') { parent::__construct($configuration, $logger, $path); $this->setAPIUri('/rest/agile/'.$this->agileVersion); diff --git a/src/Issue/IssueSearchResult.php b/src/Issue/IssueSearchResult.php index 3c0cb70ca7298d016b7137b7054d239c04cab422..27b3e9bbfe9a01f1e790612bdd6a65922cf9361f 100644 --- a/src/Issue/IssueSearchResult.php +++ b/src/Issue/IssueSearchResult.php @@ -1,4 +1,5 @@ createUrlByContext($context); @@ -441,7 +441,7 @@ class JiraClient /** * Add authorize to curl request. */ - protected function authorization(\CurlHandle $ch, array &$curl_http_headers, string $cookieFile = null): void + protected function authorization(\CurlHandle $ch, array &$curl_http_headers, ?string $cookieFile = null): void { // use cookie if ($this->getConfiguration()->isCookieAuthorizationEnabled()) { @@ -516,7 +516,7 @@ class JiraClient /** * download and save into outDir. */ - public function download(string $url, string $outDir, string $file, string $cookieFile = null): mixed + public function download(string $url, string $outDir, string $file, ?string $cookieFile = null): mixed { $curl_http_header = [ 'Accept: */*', diff --git a/src/JiraException.php b/src/JiraException.php index db14260d663bc5d7d76b95b67a7685e7353496a7..d838a725b2e083f2eefdc881326faef98b09c843 100644 --- a/src/JiraException.php +++ b/src/JiraException.php @@ -1,4 +1,5 @@ setupAPIUri(); diff --git a/src/Request/RequestService.php b/src/Request/RequestService.php index 0db86d6e2453afe4589b594ad0ddbc5242883a11..47b65019e4a80441052e1ead54dcf92f486ef7f1 100644 --- a/src/Request/RequestService.php +++ b/src/Request/RequestService.php @@ -23,7 +23,7 @@ class RequestService extends \JiraRestApi\JiraClient * @throws JiraException * @throws \Exception */ - public function __construct(ConfigurationInterface $configuration = null, LoggerInterface $logger = null, $path = './') + public function __construct(?ConfigurationInterface $configuration = null, ?LoggerInterface $logger = null, $path = './') { parent::__construct($configuration, $logger, $path); $this->setupAPIUri(); diff --git a/src/ServiceDesk/Request/RequestService.php b/src/ServiceDesk/Request/RequestService.php index 33cafcfd9d10504f7bb9b0b5a19a43b4ce284b29..ddae9f175bfded8ea4bcac128f7ab61aab0dc48c 100644 --- a/src/ServiceDesk/Request/RequestService.php +++ b/src/ServiceDesk/Request/RequestService.php @@ -65,7 +65,7 @@ class RequestService * * @see https://docs.atlassian.com/jira-servicedesk/REST/3.6.2/#servicedeskapi/request-getCustomerRequestByIdOrKey */ - public function get(string $issueId, array $expandParameters = [], Request $request = null): Request + public function get(string $issueId, array $expandParameters = [], ?Request $request = null): Request { $request = ($request) ?: new Request(); @@ -88,7 +88,7 @@ class RequestService * * @see https://docs.atlassian.com/jira-servicedesk/REST/3.6.2/#servicedeskapi/request-getMyCustomerRequests */ - public function getRequestsByCustomer(Customer $customer, array $searchParameters, int $serviceDeskId = null): array + public function getRequestsByCustomer(Customer $customer, array $searchParameters, ?int $serviceDeskId = null): array { $defaultSearchParameters = [ 'requestOwnership' => 'OWNED_REQUESTS', diff --git a/src/ServiceDesk/ServiceDeskClient.php b/src/ServiceDesk/ServiceDeskClient.php index 579dcaabe0668b7f9165e2cff4a765971a880cc3..d8809cfe87226af7732fc0e60be1336e2cfc3aea 100644 --- a/src/ServiceDesk/ServiceDeskClient.php +++ b/src/ServiceDesk/ServiceDeskClient.php @@ -12,8 +12,8 @@ use Psr\Log\LoggerInterface; class ServiceDeskClient extends JiraClient { public function __construct( - ConfigurationInterface $configuration = null, - LoggerInterface $logger = null, + ?ConfigurationInterface $configuration = null, + ?LoggerInterface $logger = null, string $path = './' ) { parent::__construct($configuration, $logger, $path); diff --git a/src/Sprint/SprintSearchResult.php b/src/Sprint/SprintSearchResult.php index 3c36d524bfd0688826f81c3c36bf7e48313ff60f..7d5611debef9651e0f6195d515cc25b22e1ffd64 100644 --- a/src/Sprint/SprintSearchResult.php +++ b/src/Sprint/SprintSearchResult.php @@ -1,4 +1,5 @@ setAPIUri('/rest/agile/1.0');