Skip to content

Commit

Permalink
Apply fixes from StyleCI (#501)
Browse files Browse the repository at this point in the history
[ci skip] [skip ci]

Co-authored-by: StyleCI Bot <bot@styleci.io>
  • Loading branch information
lesstif and StyleCIBot authored Feb 12, 2023
1 parent 2a1c1a7 commit b5eb3ca
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 65 deletions.
1 change: 0 additions & 1 deletion src/Issue/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace JiraRestApi\Issue;

use DateTime;
use DateTimeInterface;

class Version implements \JsonSerializable
Expand Down
69 changes: 34 additions & 35 deletions src/Project/ProjectService.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getAllProjects($paramArray = [])
*
* @return Project
*/
public function get($projectIdOrKey) : Project
public function get($projectIdOrKey): Project
{
$ret = $this->exec($this->uri."/$projectIdOrKey", null);

Expand All @@ -65,11 +65,11 @@ public function get($projectIdOrKey) : Project
*
* @param int|string $projectIdOrKey Project Key
*
* @return Reporter[]
*@throws \JiraRestApi\JiraException
*
* @return Reporter[]
*/
public function getAssignable(int|string $projectIdOrKey) : array
public function getAssignable(int|string $projectIdOrKey): array
{
$ret = $this->exec("/user/assignable/search?project=$projectIdOrKey", null);
$json = json_decode($ret);
Expand All @@ -83,11 +83,11 @@ public function getAssignable(int|string $projectIdOrKey) : array
/**
* @param int|string $projectIdOrKey
*
* @return IssueType[]
*@throws \JiraRestApi\JiraException
*
* @return IssueType[]
*/
public function getStatuses(int|string $projectIdOrKey) : array
public function getStatuses(int|string $projectIdOrKey): array
{
$ret = $this->exec($this->uri."/$projectIdOrKey/statuses", null);
$json = json_decode($ret);
Expand All @@ -103,11 +103,11 @@ public function getStatuses(int|string $projectIdOrKey) : array
*
* @param int|string $projectIdOrKey
*
* @return \JiraRestApi\Component\Component[]
*@throws \JiraRestApi\JiraException
*
* @return \JiraRestApi\Component\Component[]
*/
public function getProjectComponents(int|string $projectIdOrKey) : array
public function getProjectComponents(int|string $projectIdOrKey): array
{
$ret = $this->exec($this->uri."/$projectIdOrKey/components", null);
$json = json_decode($ret);
Expand All @@ -123,12 +123,12 @@ public function getProjectComponents(int|string $projectIdOrKey) : array
*
* @param int|string $projectIdOrKey
*
* @return array
* @return array
*@throws JiraException
*
* @return array
* @return array
*/
public function getProjectTransitionsToArray(int|string $projectIdOrKey) : array
public function getProjectTransitionsToArray(int|string $projectIdOrKey): array
{
$ret = $this->exec($this->uri."/$projectIdOrKey/statuses", null);
$json = json_decode($ret);
Expand Down Expand Up @@ -157,7 +157,7 @@ public function getProjectTransitionsToArray(int|string $projectIdOrKey) : array
*
* @return ProjectType[]
*/
public function getProjectTypes() : array
public function getProjectTypes(): array
{
$ret = $this->exec($this->uri.'/type');

Expand All @@ -174,12 +174,12 @@ public function getProjectTypes() : array
/**
* @param int|string $key
*
* @return ProjectType
*@throws \JsonMapper_Exception
*
* @throws \JiraRestApi\JiraException
*
* @return ProjectType
*/
public function getProjectType(int|string $key) : ProjectType
public function getProjectType(int|string $key): ProjectType
{
$ret = $this->exec($this->uri."/type/$key");

Expand All @@ -196,12 +196,12 @@ public function getProjectType(int|string $key) : ProjectType
/**
* @param int|string $key
*
* @return ProjectType
*@throws \JsonMapper_Exception
*
* @throws \JiraRestApi\JiraException
*
* @return ProjectType
*/
public function getAccessibleProjectType(int|string $key) : ProjectType
public function getAccessibleProjectType(int|string $key): ProjectType
{
$ret = $this->exec($this->uri."/type/$key/accessible");

Expand All @@ -219,13 +219,13 @@ public function getAccessibleProjectType(int|string $key) : ProjectType
* get pagenated Project versions.
*
* @param int|string $projectIdOrKey
* @param array $queryParam
* @param array $queryParam
*
* @return Version[] array of version
*@throws \JiraRestApi\JiraException
*
* @return Version[] array of version
*/
public function getVersionsPagenated(int|string $projectIdOrKey, array $queryParam = []) : array
public function getVersionsPagenated(int|string $projectIdOrKey, array $queryParam = []): array
{
$default = [
'startAt' => 0,
Expand Down Expand Up @@ -277,13 +277,13 @@ public function getVersions(string $projectIdOrKey): \ArrayObject
* get specified's project version.
*
* @param int|string $projectIdOrKey
* @param string $versionName
* @param string $versionName
*
* @return Version version
*@throws \JiraRestApi\JiraException
*
* @return Version version
*/
public function getVersion(int|string $projectIdOrKey, string $versionName) : Version
public function getVersion(int|string $projectIdOrKey, string $versionName): Version
{
$ret = $this->exec($this->uri."/$projectIdOrKey/versions");

Expand All @@ -309,12 +309,11 @@ public function getVersion(int|string $projectIdOrKey, string $versionName) : Ve
*
* @param Project $project
*
* @return Project project
*
* @throws JiraException
*
* @return Project project
*/
public function createProject(Project $project) : Project
public function createProject(Project $project): Project
{
$data = json_encode($project);

Expand All @@ -336,12 +335,12 @@ public function createProject(Project $project) : Project
*
* @param Project $project
*
* @return Project
*@throws \JsonMapper_Exception
*
* @throws JiraException
*
* @return Project
*/
public function updateProject(Project $project, string|int $projectIdOrKey) : Project
public function updateProject(Project $project, string|int $projectIdOrKey): Project
{
$data = json_encode($project);

Expand All @@ -358,16 +357,16 @@ public function updateProject(Project $project, string|int $projectIdOrKey) : Pr
/**
* @param int|string $projectIdOrKey
*
*@throws JiraException
*
* @return string response status
*
* STATUS 401 Returned if the user is not logged in.
* STATUS 204 - application/json Returned if the project is successfully deleted.
* STATUS 403 - Returned if the currently authenticated user does not have permission to delete the project.
* STATUS 404 - Returned if the project does not exist.
*@throws JiraException
*
*/
public function deleteProject(int|string $projectIdOrKey) : string
public function deleteProject(int|string $projectIdOrKey): string
{
$ret = $this->exec($this->uri.'/'.$projectIdOrKey, null, 'DELETE');

Expand All @@ -379,17 +378,17 @@ public function deleteProject(int|string $projectIdOrKey) : string
*
* @param int|string $projectIdOrKey
*
*@throws JiraException
*
* @return string response status
*
* STATUS 401 Returned if the user is not logged in.
* STATUS 204 - application/json Returned if the project is successfully archived.
* STATUS 403 - Returned if the currently authenticated user does not have permission to archive the project.
* STATUS 404 - Returned if the project does not exist.
* STATUS 405 - Method not allowed specified request HTTP method was received and recognized by the server, but is not supported by the target resource.
*@throws JiraException
*
*/
public function archiveProject(int|string $projectIdOrKey) : string
public function archiveProject(int|string $projectIdOrKey): string
{
$ret = $this->exec($this->uri.'/'.$projectIdOrKey.'/archive', null, 'PUT');

Expand Down
1 change: 0 additions & 1 deletion src/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace JiraRestApi\User;

use JiraRestApi\ClassSerialize;
use JiraRestApi\Issue\Reporter;

/**
Expand Down
54 changes: 26 additions & 28 deletions src/User/UserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace JiraRestApi\User;

use JiraRestApi\Issue\Reporter;

/**
* Class to perform all user related queries.
*
Expand All @@ -18,12 +16,12 @@ class UserService extends \JiraRestApi\JiraClient
*
* @param array|User $user
*
* @return User User class
* @throws \JsonMapper_Exception
*
* @throws \JiraRestApi\JiraException
*
* @return User User class
*/
public function create(array|User $user) : User
public function create(array|User $user): User
{
$data = json_encode($user);

Expand All @@ -43,12 +41,12 @@ public function create(array|User $user) : User
* @param array $paramArray Possible values for $paramArray 'username', 'key'.
* "Either the 'username' or the 'key' query parameters need to be provided".
*
* @return User
* @throws \JsonMapper_Exception
*
* @throws \JiraRestApi\JiraException
*
* @return User
*/
public function get(array $paramArray) : User
public function get(array $paramArray): User
{
$queryParam = '?'.http_build_query($paramArray);

Expand All @@ -67,12 +65,12 @@ public function get(array $paramArray) : User
*
* @param array $paramArray
*
* @return User[]
*@throws \JsonMapper_Exception
*
* @throws \JiraRestApi\JiraException
*
* @return User[]
*/
public function findUsers(array $paramArray) : array
public function findUsers(array $paramArray): array
{
$queryParam = '?'.http_build_query($paramArray);

Expand All @@ -99,14 +97,14 @@ public function findUsers(array $paramArray) : array
*
* @param array $paramArray
*
* @return User[]
*
* @throws \JsonMapper_Exception
*
* @throws \JiraRestApi\JiraException
*
* @return User[]
*
* @see https://docs.atlassian.com/jira/REST/cloud/#api/2/user-findAssignableUsers
*/
public function findAssignableUsers(array $paramArray) : array
public function findAssignableUsers(array $paramArray): array
{
$queryParam = '?'.http_build_query($paramArray);

Expand All @@ -132,14 +130,14 @@ public function findAssignableUsers(array $paramArray) : array
*
* @param array $paramArray
*
* @return User[]
*
* @throws \JsonMapper_Exception
*
* @throws \JiraRestApi\JiraException
*
* @return User[]
*
* @see https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-user-search-query-get
*/
public function findUsersByQuery(array $paramArray) : array
public function findUsersByQuery(array $paramArray): array
{
$queryParam = '?'.http_build_query($paramArray);

Expand Down Expand Up @@ -169,7 +167,7 @@ public function findUsersByQuery(array $paramArray) : array
*
* @return string
*/
public function deleteUser(array $paramArray) : string
public function deleteUser(array $paramArray): string
{
$queryParam = '?'.http_build_query($paramArray);

Expand All @@ -185,7 +183,7 @@ public function deleteUser(array $paramArray) : string
*
* @return User
*/
public function getMyself() : User
public function getMyself(): User
{
$ret = $this->exec('myself', null);

Expand All @@ -200,12 +198,12 @@ public function getMyself() : User
/**
* @param array $paramArray
*
* @return User[]
*@throws \JsonMapper_Exception
*
* @throws \JiraRestApi\JiraException
*
* @return User[]
*/
public function getUsers(array $paramArray) : array
public function getUsers(array $paramArray): array
{
$queryParam = '?'.http_build_query($paramArray);

Expand All @@ -226,15 +224,15 @@ public function getUsers(array $paramArray) : array
/**
* Function to update an existing user.
*
* @param array $paramArray
* @param array $paramArray
* @param array|User $user
*
* @return User
* @throws \JsonMapper_Exception
*
* @throws \JiraRestApi\JiraException
*
* @return User
*/
public function update(array $paramArray, array|User $user) : User
public function update(array $paramArray, array|User $user): User
{
$queryParam = '?'.http_build_query($paramArray);

Expand Down

0 comments on commit b5eb3ca

Please sign in to comment.