diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 81e12c0b..e07f6d06 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: operating-system: ["ubuntu-latest"] - php: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4", "8.5"] + php: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4", "8.5", "8.6"] steps: - name: Checkout @@ -93,7 +93,7 @@ jobs: fail-fast: false matrix: operating-system: ["ubuntu-latest"] - php: ["8.3"] + php: ["8.4"] tool: ["phpstan", "code-coverage", "code-style"] steps: diff --git a/.phpstan.neon b/.phpstan.neon index b5eae346..4b04a84b 100644 --- a/.phpstan.neon +++ b/.phpstan.neon @@ -5,9 +5,6 @@ parameters: - src/ - tests/ - scanDirectories: - - vendor - treatPhpDocTypesAsCertain: false ignoreErrors: diff --git a/.rector.php b/.rector.php new file mode 100644 index 00000000..92d725b5 --- /dev/null +++ b/.rector.php @@ -0,0 +1,21 @@ +withPaths([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]) + // uncomment to reach your current PHP version + //->withPhpSets() + ->withPhp74Sets() + ->withPhpVersion(70400) + ->withRules(\Art4\RectorBcLibrary\Set::withTypeCoverageLevel(28)) + ->withPreparedSets( + true, + true + ) +; diff --git a/composer.json b/composer.json index 6f2a63c5..e96d579e 100644 --- a/composer.json +++ b/composer.json @@ -30,12 +30,14 @@ "psr/http-factory": "^1.0" }, "require-dev": { + "art4/rector-bc-library": "1.0.0-beta.0", "behat/behat": "^3.14", "friendsofphp/php-cs-fixer": "^3.68", "guzzlehttp/psr7": "^2", "php-mock/php-mock-phpunit": "^2.13", "phpstan/phpstan": "^2.1", - "phpunit/phpunit": "^9.5 || ^10.5 || ^11.2 || ^12.0.9" + "phpunit/phpunit": "^9.5 || ^10.5 || ^11.2 || ^12.0.9", + "rector/rector": "^2.2" }, "autoload": { "psr-4": { @@ -62,6 +64,7 @@ "coverage": "phpunit --coverage-html=\".phpunit.cache/code-coverage\"", "phpstan": "phpstan analyze --memory-limit 512M --configuration .phpstan.neon", "phpunit": "phpunit", + "rector": "rector -c .rector.php", "test": [ "@phpstan", "@phpunit", diff --git a/docker-compose.yml b/docker-compose.yml index 8b11af78..356ba77a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,9 @@ services: - 8111:80 depends_on: - redmine-dev + - redmine-6-1 + - redmine-6-0 + - redmine-5-1 volumes: - ./:/var/www/project/ # Location of the project for php-fpm. Note this should be the same for NGINX.* diff --git a/src/Redmine/Api/AbstractApi.php b/src/Redmine/Api/AbstractApi.php index 9eb7c497..68962c69 100644 --- a/src/Redmine/Api/AbstractApi.php +++ b/src/Redmine/Api/AbstractApi.php @@ -28,10 +28,7 @@ abstract class AbstractApi implements Api */ protected $client; - /** - * @var HttpClient - */ - private $httpClient; + private \Redmine\Http\HttpClient $httpClient; /** * @var Response @@ -73,7 +70,7 @@ final protected function getHttpClient(): HttpClient final public function getLastResponse(): Response { - return $this->lastResponse !== null ? $this->lastResponse : HttpFactory::makeResponse(0, '', ''); + return ($this->lastResponse instanceof Response) ? $this->lastResponse : HttpFactory::makeResponse(0, '', ''); } /** @@ -300,7 +297,7 @@ protected function retrieveAll($endpoint, array $params = []) */ protected function retrieveData(string $endpoint, array $params = []): array { - if (empty($params)) { + if ($params === []) { $this->lastResponse = $this->getHttpClient()->request(HttpFactory::makeRequest( 'GET', strval($endpoint), @@ -366,7 +363,7 @@ protected function retrieveData(string $endpoint, array $params = []): array $offset += $realLimit; if ( - empty($newDataSet) + $newDataSet === [] || !isset($newDataSet['limit']) || ( isset($newDataSet['offset']) diff --git a/src/Redmine/Api/CustomField.php b/src/Redmine/Api/CustomField.php index bbd8e799..4e6a34be 100644 --- a/src/Redmine/Api/CustomField.php +++ b/src/Redmine/Api/CustomField.php @@ -23,7 +23,7 @@ class CustomField extends AbstractApi /** * @var null|array */ - private $customFieldNames = null; + private $customFieldNames; /** * List custom fields. @@ -83,7 +83,7 @@ final public function listNames(): array */ public function all(array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::list()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::list()` instead.', E_USER_DEPRECATED); try { $this->customFields = $this->list($params); @@ -92,7 +92,7 @@ public function all(array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } @@ -115,7 +115,7 @@ public function all(array $params = []) */ public function listing($forceUpdate = false, array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listNames()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNames()` instead.', E_USER_DEPRECATED); return $this->doListing($forceUpdate, $params); } @@ -133,7 +133,7 @@ public function listing($forceUpdate = false, array $params = []) */ public function getIdByName($name, array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listNames()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNames()` instead.', E_USER_DEPRECATED); $arr = $this->doListing(false, $params); @@ -151,7 +151,7 @@ public function getIdByName($name, array $params = []) */ private function doListing(bool $forceUpdate, array $params): array { - if (empty($this->customFields) || $forceUpdate) { + if ($this->customFields === [] || $forceUpdate) { $this->customFields = $this->list($params); } diff --git a/src/Redmine/Api/Group.php b/src/Redmine/Api/Group.php index 04d10064..954a4cc9 100644 --- a/src/Redmine/Api/Group.php +++ b/src/Redmine/Api/Group.php @@ -29,7 +29,7 @@ class Group extends AbstractApi /** * @var null|array */ - private $groupNames = null; + private $groupNames; /** * List groups. @@ -85,7 +85,7 @@ final public function listNames(): array */ public function all(array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::list()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::list()` instead.', E_USER_DEPRECATED); try { $this->groups = $this->list($params); @@ -94,7 +94,7 @@ public function all(array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } @@ -116,9 +116,9 @@ public function all(array $params = []) */ public function listing($forceUpdate = false) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listNames()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNames()` instead.', E_USER_DEPRECATED); - if (empty($this->groups) || $forceUpdate) { + if ($this->groups === [] || $forceUpdate) { $this->groups = $this->list(); } $ret = []; diff --git a/src/Redmine/Api/Issue.php b/src/Redmine/Api/Issue.php index 3b052777..267f1a63 100644 --- a/src/Redmine/Api/Issue.php +++ b/src/Redmine/Api/Issue.php @@ -126,7 +126,7 @@ final public function list(array $params = []): array */ public function all(array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::list()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::list()` instead.', E_USER_DEPRECATED); try { return $this->list($params); @@ -135,7 +135,7 @@ public function all(array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } diff --git a/src/Redmine/Api/IssueCategory.php b/src/Redmine/Api/IssueCategory.php index fa16fb39..443f1b94 100644 --- a/src/Redmine/Api/IssueCategory.php +++ b/src/Redmine/Api/IssueCategory.php @@ -111,7 +111,7 @@ final public function listNamesByProject($projectIdentifier): array */ public function all($project, array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::listByProject()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::listByProject()` instead.', E_USER_DEPRECATED); try { return $this->listByProject(strval($project), $params); @@ -120,7 +120,7 @@ public function all($project, array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } @@ -141,7 +141,7 @@ public function all($project, array $params = []) */ public function listing($project, $forceUpdate = false) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listNamesByProject()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNamesByProject()` instead.', E_USER_DEPRECATED); return $this->doListing($project, $forceUpdate); } @@ -159,7 +159,7 @@ public function listing($project, $forceUpdate = false) */ public function getIdByName($project, $name) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listNamesByProject()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNamesByProject()` instead.', E_USER_DEPRECATED); $arr = $this->doListing($project, false); @@ -296,7 +296,7 @@ public function remove($id, array $params = []) */ private function doListing($projectIdentifier, bool $forceUpdate): array { - if (true === $forceUpdate || empty($this->issueCategories)) { + if ($forceUpdate || $this->issueCategories === []) { $this->issueCategories = $this->listByProject($projectIdentifier); } diff --git a/src/Redmine/Api/IssuePriority.php b/src/Redmine/Api/IssuePriority.php index 6a6ca25b..167a590b 100644 --- a/src/Redmine/Api/IssuePriority.php +++ b/src/Redmine/Api/IssuePriority.php @@ -54,7 +54,7 @@ final public function list(array $params = []): array */ public function all(array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::list()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::list()` instead.', E_USER_DEPRECATED); try { $this->issuePriorities = $this->list($params); @@ -63,7 +63,7 @@ public function all(array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } diff --git a/src/Redmine/Api/IssueRelation.php b/src/Redmine/Api/IssueRelation.php index 36849c3e..33cdd415 100644 --- a/src/Redmine/Api/IssueRelation.php +++ b/src/Redmine/Api/IssueRelation.php @@ -59,7 +59,7 @@ final public function listByIssueId(int $issueId, array $params = []): array */ public function all($issueId, array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::listByIssueId()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::listByIssueId()` instead.', E_USER_DEPRECATED); try { $this->relations = $this->listByIssueId($issueId, $params); @@ -68,7 +68,7 @@ public function all($issueId, array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } diff --git a/src/Redmine/Api/IssueStatus.php b/src/Redmine/Api/IssueStatus.php index 293ed989..dff5e438 100644 --- a/src/Redmine/Api/IssueStatus.php +++ b/src/Redmine/Api/IssueStatus.php @@ -23,7 +23,7 @@ class IssueStatus extends AbstractApi /** * @var array */ - private $issueStatusNames = null; + private $issueStatusNames; /** * List issue statuses. @@ -83,7 +83,7 @@ final public function listNames(): array */ public function all(array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::list()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::list()` instead.', E_USER_DEPRECATED); try { $this->issueStatuses = $this->list($params); @@ -92,7 +92,7 @@ public function all(array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } @@ -114,7 +114,7 @@ public function all(array $params = []) */ public function listing($forceUpdate = false) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listNames()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNames()` instead.', E_USER_DEPRECATED); return $this->doListing($forceUpdate); } @@ -131,7 +131,7 @@ public function listing($forceUpdate = false) */ public function getIdByName($name) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listNames()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNames()` instead.', E_USER_DEPRECATED); $arr = $this->doListing(false); @@ -147,7 +147,7 @@ public function getIdByName($name) */ private function doListing(bool $forceUpdate): array { - if (empty($this->issueStatuses) || $forceUpdate) { + if ($this->issueStatuses === [] || $forceUpdate) { $this->issueStatuses = $this->list(); } diff --git a/src/Redmine/Api/Membership.php b/src/Redmine/Api/Membership.php index 81dc3de0..65f83220 100644 --- a/src/Redmine/Api/Membership.php +++ b/src/Redmine/Api/Membership.php @@ -69,7 +69,7 @@ final public function listByProject($projectIdentifier, array $params = []): arr */ public function all($project, array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::listByProject()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::listByProject()` instead.', E_USER_DEPRECATED); try { $this->memberships = $this->listByProject(strval($project), $params); @@ -78,7 +78,7 @@ public function all($project, array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } diff --git a/src/Redmine/Api/News.php b/src/Redmine/Api/News.php index 629fdcb1..f1473125 100644 --- a/src/Redmine/Api/News.php +++ b/src/Redmine/Api/News.php @@ -84,20 +84,16 @@ final public function list(array $params = []): array */ public function all($project = null, array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::list()` or `' . __CLASS__ . '::listByProject()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::list()` or `' . self::class . '::listByProject()` instead.', E_USER_DEPRECATED); try { - if (null === $project) { - $this->news = $this->list($params); - } else { - $this->news = $this->listByProject(strval($project), $params); - } + $this->news = null === $project ? $this->list($params) : $this->listByProject(strval($project), $params); } catch (Exception $e) { if ($this->getLastResponse()->getContent() === '') { return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } diff --git a/src/Redmine/Api/Project.php b/src/Redmine/Api/Project.php index 50ed0c46..e1e78e84 100755 --- a/src/Redmine/Api/Project.php +++ b/src/Redmine/Api/Project.php @@ -30,7 +30,7 @@ class Project extends AbstractApi /** * @var null|array */ - private $projectNames = null; + private $projectNames; /** * List projects. @@ -103,7 +103,7 @@ final public function listNames(): array */ public function all(array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::list()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::list()` instead.', E_USER_DEPRECATED); try { $this->projects = $this->list($params); @@ -112,7 +112,7 @@ public function all(array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } @@ -136,7 +136,7 @@ public function all(array $params = []) */ public function listing($forceUpdate = false, $reverse = true, array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listNames()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNames()` instead.', E_USER_DEPRECATED); return $this->doListing($forceUpdate, $reverse, $params); } @@ -154,7 +154,7 @@ public function listing($forceUpdate = false, $reverse = true, array $params = [ */ public function getIdByName($name, array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listNames()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNames()` instead.', E_USER_DEPRECATED); $arr = $this->doListing(false, true, $params); @@ -460,7 +460,7 @@ public function remove($id) */ private function doListing(bool $forceUpdate, bool $reverse, array $params): array { - if (true === $forceUpdate || empty($this->projects)) { + if ($forceUpdate || $this->projects === []) { $this->projects = $this->list($params); } diff --git a/src/Redmine/Api/Query.php b/src/Redmine/Api/Query.php index 35232c6a..7997b06d 100644 --- a/src/Redmine/Api/Query.php +++ b/src/Redmine/Api/Query.php @@ -54,7 +54,7 @@ final public function list(array $params = []): array */ public function all(array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::list()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::list()` instead.', E_USER_DEPRECATED); try { $this->query = $this->list($params); @@ -63,7 +63,7 @@ public function all(array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } diff --git a/src/Redmine/Api/Role.php b/src/Redmine/Api/Role.php index 8e61cb85..b1c85235 100644 --- a/src/Redmine/Api/Role.php +++ b/src/Redmine/Api/Role.php @@ -25,7 +25,7 @@ class Role extends AbstractApi /** * @var null|array */ - private $roleNames = null; + private $roleNames; /** * List roles. @@ -84,7 +84,7 @@ final public function listNames(): array */ public function all(array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::list()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::list()` instead.', E_USER_DEPRECATED); try { $this->roles = $this->list($params); @@ -93,7 +93,7 @@ public function all(array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } @@ -115,9 +115,9 @@ public function all(array $params = []) */ public function listing($forceUpdate = false) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listNames()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNames()` instead.', E_USER_DEPRECATED); - if (empty($this->roles) || $forceUpdate) { + if ($this->roles === [] || $forceUpdate) { $this->roles = $this->list(); } $ret = []; diff --git a/src/Redmine/Api/Search.php b/src/Redmine/Api/Search.php index 0b31e2a0..6d36ed7e 100644 --- a/src/Redmine/Api/Search.php +++ b/src/Redmine/Api/Search.php @@ -54,7 +54,7 @@ final public function listByQuery(string $query, array $params = []): array */ public function search($query, array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::listByQuery()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::listByQuery()` instead.', E_USER_DEPRECATED); try { $this->results = $this->listByQuery($query, $params); @@ -63,7 +63,7 @@ public function search($query, array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } diff --git a/src/Redmine/Api/TimeEntry.php b/src/Redmine/Api/TimeEntry.php index 5ad6e088..65b39ef4 100644 --- a/src/Redmine/Api/TimeEntry.php +++ b/src/Redmine/Api/TimeEntry.php @@ -59,7 +59,7 @@ final public function list(array $params = []): array */ public function all(array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::list()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::list()` instead.', E_USER_DEPRECATED); try { $this->timeEntries = $this->list($params); @@ -68,7 +68,7 @@ public function all(array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } diff --git a/src/Redmine/Api/TimeEntryActivity.php b/src/Redmine/Api/TimeEntryActivity.php index 7cda0f09..5bd2a69c 100644 --- a/src/Redmine/Api/TimeEntryActivity.php +++ b/src/Redmine/Api/TimeEntryActivity.php @@ -23,7 +23,7 @@ class TimeEntryActivity extends AbstractApi /** * @var null|array */ - private $timeEntryActivityNames = null; + private $timeEntryActivityNames; /** * List time entry activities. @@ -78,7 +78,7 @@ final public function listNames(): array */ public function all(array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::list()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::list()` instead.', E_USER_DEPRECATED); try { $this->timeEntryActivities = $this->list($params); @@ -87,7 +87,7 @@ public function all(array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } @@ -109,7 +109,7 @@ public function all(array $params = []) */ public function listing($forceUpdate = false) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listNames()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNames()` instead.', E_USER_DEPRECATED); return $this->doListing((bool) $forceUpdate); } @@ -126,7 +126,7 @@ public function listing($forceUpdate = false) */ public function getIdByName($name) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listNames()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNames()` instead.', E_USER_DEPRECATED); $arr = $this->doListing(false); @@ -142,7 +142,7 @@ public function getIdByName($name) */ private function doListing(bool $forceUpdate): array { - if (empty($this->timeEntryActivities) || $forceUpdate) { + if ($this->timeEntryActivities === [] || $forceUpdate) { $this->timeEntryActivities = $this->list(); } diff --git a/src/Redmine/Api/Tracker.php b/src/Redmine/Api/Tracker.php index 6d2c1ac1..36cdf415 100644 --- a/src/Redmine/Api/Tracker.php +++ b/src/Redmine/Api/Tracker.php @@ -23,7 +23,7 @@ class Tracker extends AbstractApi /** * @var null|array */ - private $trackerNames = null; + private $trackerNames; /** * List trackers. @@ -82,7 +82,7 @@ final public function listNames(): array */ public function all(array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::list()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::list()` instead.', E_USER_DEPRECATED); try { $this->trackers = $this->list($params); @@ -91,7 +91,7 @@ public function all(array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } @@ -113,7 +113,7 @@ public function all(array $params = []) */ public function listing($forceUpdate = false) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listNames()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNames()` instead.', E_USER_DEPRECATED); return $this->doListing($forceUpdate); } @@ -130,7 +130,7 @@ public function listing($forceUpdate = false) */ public function getIdByName($name) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listNames()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNames()` instead.', E_USER_DEPRECATED); $arr = $this->doListing(false); @@ -146,7 +146,7 @@ public function getIdByName($name) */ private function doListing(bool $forceUpdate): array { - if (empty($this->trackers) || $forceUpdate) { + if ($this->trackers === [] || $forceUpdate) { $this->trackers = $this->list(); } diff --git a/src/Redmine/Api/User.php b/src/Redmine/Api/User.php index dbec8396..a3d4639a 100644 --- a/src/Redmine/Api/User.php +++ b/src/Redmine/Api/User.php @@ -29,7 +29,7 @@ class User extends AbstractApi /** * @var null|array */ - private $userLogins = null; + private $userLogins; /** * List users. @@ -102,7 +102,7 @@ final public function listLogins(): array */ public function all(array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::list()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::list()` instead.', E_USER_DEPRECATED); try { $this->users = $this->list($params); @@ -111,7 +111,7 @@ public function all(array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } @@ -134,7 +134,7 @@ public function all(array $params = []) */ public function listing($forceUpdate = false, array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listLogins()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listLogins()` instead.', E_USER_DEPRECATED); return $this->doListing($forceUpdate, $params); } @@ -166,7 +166,7 @@ public function getCurrentUser(array $params = []) */ public function getIdByUsername($username, array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listLogins()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listLogins()` instead.', E_USER_DEPRECATED); $arr = $this->doListing(false, $params); @@ -199,7 +199,7 @@ public function show($id, array $params = []) // set default ones $params['include'] = array_unique( array_merge( - isset($params['include']) ? $params['include'] : [], + $params['include'] ?? [], [ 'memberships', 'groups', @@ -329,7 +329,7 @@ public function remove($id) */ private function doListing(bool $forceUpdate, array $params): array { - if (empty($this->users) || $forceUpdate) { + if ($this->users === [] || $forceUpdate) { $this->users = $this->list($params); } diff --git a/src/Redmine/Api/Version.php b/src/Redmine/Api/Version.php index 5c355116..aa7f83e8 100644 --- a/src/Redmine/Api/Version.php +++ b/src/Redmine/Api/Version.php @@ -109,7 +109,7 @@ final public function listNamesByProject($projectIdentifier): array */ public function all($project, array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::listByProject()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::listByProject()` instead.', E_USER_DEPRECATED); try { $this->versions = $this->listByProject(strval($project), $params); @@ -118,7 +118,7 @@ public function all($project, array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } @@ -143,7 +143,7 @@ public function all($project, array $params = []) */ public function listing($project, $forceUpdate = false, $reverse = true, array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listNamesByProject()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNamesByProject()` instead.', E_USER_DEPRECATED); return $this->doListing($project, $forceUpdate, $reverse, $params); } @@ -162,7 +162,7 @@ public function listing($project, $forceUpdate = false, $reverse = true, array $ */ public function getIdByName($project, $name, array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . __CLASS__ . '::listNamesByProject()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.7.0, use `' . self::class . '::listNamesByProject()` instead.', E_USER_DEPRECATED); $arr = $this->doListing($project, false, true, $params); @@ -345,7 +345,7 @@ public function remove($id) */ private function doListing($projectIdentifier, bool $forceUpdate, bool $reverse, array $params): array { - if (true === $forceUpdate || empty($this->versions)) { + if ($forceUpdate || $this->versions === []) { $this->versions = $this->listByProject($projectIdentifier, $params); } diff --git a/src/Redmine/Api/Wiki.php b/src/Redmine/Api/Wiki.php index 224ec81f..24fba406 100644 --- a/src/Redmine/Api/Wiki.php +++ b/src/Redmine/Api/Wiki.php @@ -69,7 +69,7 @@ final public function listByProject($projectIdentifier, array $params = []): arr */ public function all($project, array $params = []) { - @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . __CLASS__ . '::listByProject()` instead.', E_USER_DEPRECATED); + @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.4.0, use `' . self::class . '::listByProject()` instead.', E_USER_DEPRECATED); try { $this->wikiPages = $this->listByProject(strval($project), $params); @@ -78,7 +78,7 @@ public function all($project, array $params = []) return false; } - if ($e instanceof UnexpectedResponseException && $e->getPrevious() !== null) { + if ($e instanceof UnexpectedResponseException && $e->getPrevious() instanceof \Throwable) { $e = $e->getPrevious(); } diff --git a/src/Redmine/Client/ClientApiTrait.php b/src/Redmine/Client/ClientApiTrait.php index 3c1ad4a3..41215670 100644 --- a/src/Redmine/Client/ClientApiTrait.php +++ b/src/Redmine/Client/ClientApiTrait.php @@ -21,26 +21,26 @@ trait ClientApiTrait * @var array */ private array $apiClassnames = [ - 'attachment' => 'Redmine\Api\Attachment', - 'group' => 'Redmine\Api\Group', - 'custom_fields' => 'Redmine\Api\CustomField', - 'issue' => 'Redmine\Api\Issue', - 'issue_category' => 'Redmine\Api\IssueCategory', - 'issue_priority' => 'Redmine\Api\IssuePriority', - 'issue_relation' => 'Redmine\Api\IssueRelation', - 'issue_status' => 'Redmine\Api\IssueStatus', - 'membership' => 'Redmine\Api\Membership', - 'news' => 'Redmine\Api\News', - 'project' => 'Redmine\Api\Project', - 'query' => 'Redmine\Api\Query', - 'role' => 'Redmine\Api\Role', - 'search' => 'Redmine\Api\Search', - 'time_entry' => 'Redmine\Api\TimeEntry', - 'time_entry_activity' => 'Redmine\Api\TimeEntryActivity', - 'tracker' => 'Redmine\Api\Tracker', - 'user' => 'Redmine\Api\User', - 'version' => 'Redmine\Api\Version', - 'wiki' => 'Redmine\Api\Wiki', + 'attachment' => \Redmine\Api\Attachment::class, + 'group' => \Redmine\Api\Group::class, + 'custom_fields' => \Redmine\Api\CustomField::class, + 'issue' => \Redmine\Api\Issue::class, + 'issue_category' => \Redmine\Api\IssueCategory::class, + 'issue_priority' => \Redmine\Api\IssuePriority::class, + 'issue_relation' => \Redmine\Api\IssueRelation::class, + 'issue_status' => \Redmine\Api\IssueStatus::class, + 'membership' => \Redmine\Api\Membership::class, + 'news' => \Redmine\Api\News::class, + 'project' => \Redmine\Api\Project::class, + 'query' => \Redmine\Api\Query::class, + 'role' => \Redmine\Api\Role::class, + 'search' => \Redmine\Api\Search::class, + 'time_entry' => \Redmine\Api\TimeEntry::class, + 'time_entry_activity' => \Redmine\Api\TimeEntryActivity::class, + 'tracker' => \Redmine\Api\Tracker::class, + 'user' => \Redmine\Api\User::class, + 'version' => \Redmine\Api\Version::class, + 'wiki' => \Redmine\Api\Wiki::class, ]; /** diff --git a/src/Redmine/Client/NativeCurlClient.php b/src/Redmine/Client/NativeCurlClient.php index 6dfb2c06..a98d0038 100644 --- a/src/Redmine/Client/NativeCurlClient.php +++ b/src/Redmine/Client/NativeCurlClient.php @@ -410,13 +410,11 @@ private function createHttpHeader(string $path, string $contentType = ''): array // @see https://www.redmine.org/projects/redmine/wiki/Rest_api#Authentication if (null === $this->password && !array_key_exists(strtolower('X-Redmine-API-Key'), $this->httpHeadersNames)) { $httpHeaders[] = 'X-Redmine-API-Key: ' . $this->apikeyOrUsername; - } else { - if (!array_key_exists(strtolower('Authorization'), $this->httpHeadersNames)) { - // Setting Header "Authorization: Basic base64" is the same as - // $this->setCurlOption(CURLOPT_USERPWD, "$username:$password") - // @see https://stackoverflow.com/a/26285941 - $httpHeaders[] = 'Authorization: Basic ' . base64_encode($this->apikeyOrUsername . ':' . $this->password); - } + } elseif (!array_key_exists(strtolower('Authorization'), $this->httpHeadersNames)) { + // Setting Header "Authorization: Basic base64" is the same as + // $this->setCurlOption(CURLOPT_USERPWD, "$username:$password") + // @see https://stackoverflow.com/a/26285941 + $httpHeaders[] = 'Authorization: Basic ' . base64_encode($this->apikeyOrUsername . ':' . $this->password); } // prepare custom headers diff --git a/src/Redmine/Client/Psr18Client.php b/src/Redmine/Client/Psr18Client.php index 454c807c..dc5c5ffa 100644 --- a/src/Redmine/Client/Psr18Client.php +++ b/src/Redmine/Client/Psr18Client.php @@ -201,7 +201,7 @@ public function getLastResponseStatusCode(): int { @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.8.0, use `\Redmine\Api\AbstractApi::getLastResponse()` instead.', E_USER_DEPRECATED); - if (null === $this->lastResponse) { + if (!$this->lastResponse instanceof \Psr\Http\Message\ResponseInterface) { return 0; } @@ -218,7 +218,7 @@ public function getLastResponseContentType(): string { @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.8.0, use `\Redmine\Api\AbstractApi::getLastResponse()` instead.', E_USER_DEPRECATED); - if (null === $this->lastResponse) { + if (!$this->lastResponse instanceof \Psr\Http\Message\ResponseInterface) { return ''; } @@ -235,7 +235,7 @@ public function getLastResponseBody(): string { @trigger_error('`' . __METHOD__ . '()` is deprecated since v2.8.0, use `\Redmine\Api\AbstractApi::getLastResponse()` instead.', E_USER_DEPRECATED); - if (null === $this->lastResponse) { + if (!$this->lastResponse instanceof \Psr\Http\Message\ResponseInterface) { return ''; } diff --git a/src/Redmine/Exception/UnexpectedResponseException.php b/src/Redmine/Exception/UnexpectedResponseException.php index 12d65746..75ed2a38 100644 --- a/src/Redmine/Exception/UnexpectedResponseException.php +++ b/src/Redmine/Exception/UnexpectedResponseException.php @@ -19,13 +19,13 @@ final class UnexpectedResponseException extends RuntimeException implements Redm /** * @var Response|null */ - private $response = null; + private $response; public static function create(Response $response, ?Throwable $prev = null): self { $e = new self( 'The Redmine server replied with an unexpected response.', - ($prev !== null) ? $prev->getCode() : 1, + ($prev instanceof \Throwable) ? $prev->getCode() : 1, $prev, ); diff --git a/src/Redmine/Http/HttpFactory.php b/src/Redmine/Http/HttpFactory.php index b7cc4478..7d9c6130 100644 --- a/src/Redmine/Http/HttpFactory.php +++ b/src/Redmine/Http/HttpFactory.php @@ -80,11 +80,11 @@ public function getContent(): string public static function makeJsonRequest(string $method, string $path, string $content = ''): Request { - return static::makeRequest($method, $path, 'application/json', $content); + return self::makeRequest($method, $path, 'application/json', $content); } public static function makeXmlRequest(string $method, string $path, string $content = ''): Request { - return static::makeRequest($method, $path, 'application/xml', $content); + return self::makeRequest($method, $path, 'application/xml', $content); } } diff --git a/src/Redmine/Serializer/PathSerializer.php b/src/Redmine/Serializer/PathSerializer.php index c0191472..9926b6fb 100644 --- a/src/Redmine/Serializer/PathSerializer.php +++ b/src/Redmine/Serializer/PathSerializer.php @@ -37,7 +37,7 @@ public function getPath(): string { $queryString = ''; - if (!empty($this->queryParams)) { + if ($this->queryParams !== []) { $queryString = '?' . \http_build_query($this->queryParams); // @see #154: replace every encoded array (`foo[0]=`, `foo[1]=`, etc with `foo[]=`) diff --git a/tests/Behat/Bootstrap/FeatureContext.php b/tests/Behat/Bootstrap/FeatureContext.php index 48af4c9f..879e147d 100644 --- a/tests/Behat/Bootstrap/FeatureContext.php +++ b/tests/Behat/Bootstrap/FeatureContext.php @@ -45,27 +45,27 @@ final class FeatureContext implements Context /** * @BeforeSuite */ - public static function prepare(BeforeSuiteScope $scope) + public static function prepare(BeforeSuiteScope $scope): void { - static::$tracer = new BehatHookTracer(); - static::$tracer->hook($scope); + self::$tracer = new BehatHookTracer(); + self::$tracer->hook($scope); } /** * @AfterScenario */ - public static function reset(AfterScenarioScope $scope) + public static function reset(AfterScenarioScope $scope): void { - static::$tracer->hook($scope); + self::$tracer->hook($scope); } /** * @AfterSuite */ - public static function clean(AfterSuiteScope $scope) + public static function clean(AfterSuiteScope $scope): void { - static::$tracer->hook($scope); - static::$tracer = null; + self::$tracer->hook($scope); + self::$tracer = null; } private RedmineInstance $redmine; @@ -89,13 +89,13 @@ public function __construct(string $redmineVersion, string $rootPath) throw new InvalidArgumentException('Redmine ' . $redmineVersion . ' is not supported.'); } - $this->redmine = static::$tracer::getRedmineInstance($version, $rootPath); + $this->redmine = self::$tracer::getRedmineInstance($version, $rootPath); } /** * @Given I have a :clientName client */ - public function iHaveAClient($clientName) + public function iHaveAClient($clientName): void { if ($clientName !== 'NativeCurlClient') { throw new InvalidArgumentException('Client ' . $clientName . ' is not supported.'); @@ -122,7 +122,7 @@ private function registerClientResponse(mixed $lastReturn, Response $lastRespons /** * @Then the response has the status code :statusCode */ - public function theResponseHasTheStatusCode(int $statusCode) + public function theResponseHasTheStatusCode(int $statusCode): void { TestCase::assertSame( $statusCode, @@ -134,7 +134,7 @@ public function theResponseHasTheStatusCode(int $statusCode) /** * @Then the response has the content type :contentType */ - public function theResponseHasTheContentType(string $contentType) + public function theResponseHasTheContentType(string $contentType): void { TestCase::assertStringStartsWith( $contentType, @@ -146,7 +146,7 @@ public function theResponseHasTheContentType(string $contentType) /** * @Then the response has an empty content type */ - public function theResponseHasAnEmptyContentType() + public function theResponseHasAnEmptyContentType(): void { TestCase::assertSame('', $this->lastResponse->getContentType()); } @@ -154,7 +154,7 @@ public function theResponseHasAnEmptyContentType() /** * @Then the response has the content :content */ - public function theResponseHasTheContent(string $content) + public function theResponseHasTheContent(string $content): void { TestCase::assertSame($content, $this->lastResponse->getContent()); } @@ -162,7 +162,7 @@ public function theResponseHasTheContent(string $content) /** * @Then the response has the content */ - public function theResponseHasTheContentWithMultipleLines(PyStringNode $string) + public function theResponseHasTheContentWithMultipleLines(PyStringNode $string): void { TestCase::assertSame($string->getRaw(), $this->lastResponse->getContent()); } @@ -170,7 +170,7 @@ public function theResponseHasTheContentWithMultipleLines(PyStringNode $string) /** * @Then the returned data is true */ - public function theReturnedDataIsTrue() + public function theReturnedDataIsTrue(): void { TestCase::assertTrue($this->lastReturn); } @@ -178,7 +178,7 @@ public function theReturnedDataIsTrue() /** * @Then the returned data is false */ - public function theReturnedDataIsFalse() + public function theReturnedDataIsFalse(): void { TestCase::assertFalse($this->lastReturn); } @@ -186,7 +186,7 @@ public function theReturnedDataIsFalse() /** * @Then the returned data is exactly :content */ - public function theReturnedDataIsExactly(string $content) + public function theReturnedDataIsExactly(string $content): void { TestCase::assertSame($content, $this->lastReturn); } @@ -194,7 +194,7 @@ public function theReturnedDataIsExactly(string $content) /** * @Then the returned data is exactly */ - public function theReturnedDataIsExactlyWithMultipleLines(PyStringNode $string) + public function theReturnedDataIsExactlyWithMultipleLines(PyStringNode $string): void { TestCase::assertSame($string->getRaw(), $this->lastReturn); } @@ -202,7 +202,7 @@ public function theReturnedDataIsExactlyWithMultipleLines(PyStringNode $string) /** * @Then the returned data is an instance of :className */ - public function theReturnedDataIsAnInstanceOf(string $className) + public function theReturnedDataIsAnInstanceOf(string $className): void { TestCase::assertInstanceOf($className, $this->lastReturn); } @@ -210,7 +210,7 @@ public function theReturnedDataIsAnInstanceOf(string $className) /** * @Then the returned data is an array */ - public function theReturnedDataIsAnArray() + public function theReturnedDataIsAnArray(): void { TestCase::assertIsArray($this->lastReturn); } @@ -218,7 +218,7 @@ public function theReturnedDataIsAnArray() /** * @Then the returned data contains :count items */ - public function theReturnedDataContainsItems(int $count) + public function theReturnedDataContainsItems(int $count): void { TestCase::assertCount($count, $this->lastReturn); } @@ -226,7 +226,7 @@ public function theReturnedDataContainsItems(int $count) /** * @Then the returned data contains the following data */ - public function theReturnedDataContainsTheFollowingData(TableNode $table) + public function theReturnedDataContainsTheFollowingData(TableNode $table): void { $returnData = $this->lastReturn; @@ -240,7 +240,7 @@ public function theReturnedDataContainsTheFollowingData(TableNode $table) /** * @Then the returned data has only the following properties */ - public function theReturnedDataHasOnlyTheFollowingProperties(PyStringNode $string) + public function theReturnedDataHasOnlyTheFollowingProperties(PyStringNode $string): void { $this->theReturnedDataPropertyHasOnlyTheFollowingProperties(null, $string); } @@ -248,7 +248,7 @@ public function theReturnedDataHasOnlyTheFollowingProperties(PyStringNode $strin /** * @Then the returned data has proterties with the following data */ - public function theReturnedDataHasProtertiesWithTheFollowingData(TableNode $table) + public function theReturnedDataHasProtertiesWithTheFollowingData(TableNode $table): void { $this->theReturnedDataPropertyContainsTheFollowingData(null, $table); } @@ -256,7 +256,7 @@ public function theReturnedDataHasProtertiesWithTheFollowingData(TableNode $tabl /** * @Then the returned data :property property is an array */ - public function theReturnedDataPropertyIsAnArray($property) + public function theReturnedDataPropertyIsAnArray($property): void { $returnData = $this->getLastReturnAsArray(); @@ -268,7 +268,7 @@ public function theReturnedDataPropertyIsAnArray($property) /** * @Then the returned data :property property contains :count items */ - public function theReturnedDataPropertyContainsItems($property, int $count) + public function theReturnedDataPropertyContainsItems($property, int $count): void { $returnData = $this->getLastReturnAsArray(); @@ -281,7 +281,7 @@ public function theReturnedDataPropertyContainsItems($property, int $count) /** * @Then the returned data :property property contains the following data */ - public function theReturnedDataPropertyContainsTheFollowingData($property, TableNode $table) + public function theReturnedDataPropertyContainsTheFollowingData($property, TableNode $table): void { $returnData = $this->getItemFromArray($this->getLastReturnAsArray(), $property); @@ -295,7 +295,7 @@ public function theReturnedDataPropertyContainsTheFollowingData($property, Table /** * @Then the returned data :property property contains the following data with Redmine version :versionComparision */ - public function theReturnedDataPropertyContainsTheFollowingDataWithRedmineVersion($property, string $versionComparision, TableNode $table) + public function theReturnedDataPropertyContainsTheFollowingDataWithRedmineVersion($property, string $versionComparision, TableNode $table): void { $parts = explode(' ', $versionComparision); @@ -313,7 +313,7 @@ public function theReturnedDataPropertyContainsTheFollowingDataWithRedmineVersio /** * @Then the returned data :property property has only the following properties */ - public function theReturnedDataPropertyHasOnlyTheFollowingProperties($property, PyStringNode $string) + public function theReturnedDataPropertyHasOnlyTheFollowingProperties($property, PyStringNode $string): void { $value = $this->getItemFromArray($this->getLastReturnAsArray(), $property); @@ -325,7 +325,7 @@ public function theReturnedDataPropertyHasOnlyTheFollowingProperties($property, /** * @Then the returned data :property property has only the following properties with Redmine version :versionComparision */ - public function theReturnedDataPropertyHasOnlyTheFollowingPropertiesWithRedmineVersion($property, string $versionComparision, PyStringNode $string) + public function theReturnedDataPropertyHasOnlyTheFollowingPropertiesWithRedmineVersion($property, string $versionComparision, PyStringNode $string): void { $parts = explode(' ', $versionComparision); @@ -388,7 +388,7 @@ private function getItemFromArray(array $array, $key): mixed return $array; } - private function assertTableNodeIsSameAsArray(TableNode $table, array $data) + private function assertTableNodeIsSameAsArray(TableNode $table, array $data): void { foreach ($table as $row) { TestCase::assertArrayHasKey($row['property'], $data, 'Possible keys are: ' . implode(', ', array_keys($data))); diff --git a/tests/Fixtures/AssertingHttpClient.php b/tests/Fixtures/AssertingHttpClient.php index cbafd365..52610a96 100644 --- a/tests/Fixtures/AssertingHttpClient.php +++ b/tests/Fixtures/AssertingHttpClient.php @@ -57,12 +57,12 @@ private function assertRequestData( int $responseCode = 200, string $responseContentType = '', string $responseContent = '' - ) { + ): void { if ($responseContentType === '') { $responseContentType = $contentType; } - array_push($this->fifoStack, [ + $this->fifoStack[] = [ 'method' => $method, 'path' => $path, 'contentType' => $contentType, @@ -70,7 +70,7 @@ private function assertRequestData( 'responseCode' => $responseCode, 'responseContentType' => $responseContentType, 'responseContent' => $responseContent, - ]); + ]; } public function request(Request $request): Response diff --git a/tests/Fixtures/MockClient.php b/tests/Fixtures/MockClient.php index 735e47d7..0a03b870 100644 --- a/tests/Fixtures/MockClient.php +++ b/tests/Fixtures/MockClient.php @@ -26,7 +26,7 @@ public static function create(): self * * @var mixed */ - public $runRequestReturnValue = null; + public $runRequestReturnValue; /** * Return value the mocked runRequest method should return. @@ -95,7 +95,7 @@ public function requestDelete(string $path): bool */ public function getLastResponseStatusCode(): int { - return (int) $this->responseCodeMock; + return $this->responseCodeMock; } /** @@ -103,7 +103,7 @@ public function getLastResponseStatusCode(): int */ public function getLastResponseContentType(): string { - return (string) $this->responseContentTypeMock; + return $this->responseContentTypeMock; } /** @@ -111,7 +111,7 @@ public function getLastResponseContentType(): string */ public function getLastResponseBody(): string { - return (string) $this->responseBodyMock; + return $this->responseBodyMock; } private function runRequest(string $path, string $method = 'GET', string $data = ''): bool diff --git a/tests/Integration/IssueCategoryXmlTest.php b/tests/Integration/IssueCategoryXmlTest.php index 9b67f1a1..4b11e7d1 100644 --- a/tests/Integration/IssueCategoryXmlTest.php +++ b/tests/Integration/IssueCategoryXmlTest.php @@ -12,7 +12,7 @@ public function testCreateBlank(): void { /** @var \Redmine\Api\IssueCategory */ $api = MockClient::create()->getApi('issue_category'); - $this->assertInstanceOf('Redmine\Api\IssueCategory', $api); + $this->assertInstanceOf(\Redmine\Api\IssueCategory::class, $api); $this->expectException(MissingParameterException::class); $this->expectExceptionMessage('Theses parameters are mandatory: `name`'); diff --git a/tests/Integration/Psr18ClientRequestGenerationTest.php b/tests/Integration/Psr18ClientRequestGenerationTest.php index 36008986..842cd05e 100644 --- a/tests/Integration/Psr18ClientRequestGenerationTest.php +++ b/tests/Integration/Psr18ClientRequestGenerationTest.php @@ -26,12 +26,12 @@ class Psr18ClientRequestGenerationTest extends TestCase public function testPsr18ClientCreatesCorrectRequests( string $url, string $apikeyOrUsername, - $pwd, - $impersonateUser, + ?string $pwd, + ?string $impersonateUser, string $method, string $path, $data, - $expectedOutput + string $expectedOutput ): void { $response = $this->createMock(ResponseInterface::class); @@ -65,9 +65,7 @@ public function testPsr18ClientCreatesCorrectRequests( }); $requestFactory = $this->createMock(RequestFactoryInterface::class); - $requestFactory->method('createRequest')->willReturnCallback(function ($method, $uri) { - return new Request($method, $uri); - }); + $requestFactory->method('createRequest')->willReturnCallback(fn($method, $uri): \GuzzleHttp\Psr7\Request => new Request($method, $uri)); $streamFactory = new class implements StreamFactoryInterface { public function createStream(string $content = ''): StreamInterface diff --git a/tests/Integration/UserXmlTest.php b/tests/Integration/UserXmlTest.php index ea17370c..23a97a1b 100644 --- a/tests/Integration/UserXmlTest.php +++ b/tests/Integration/UserXmlTest.php @@ -12,7 +12,7 @@ public function testCreateBlank(): void { /** @var \Redmine\Api\User */ $api = MockClient::create()->getApi('user'); - $this->assertInstanceOf('Redmine\Api\User', $api); + $this->assertInstanceOf(\Redmine\Api\User::class, $api); $this->expectException(MissingParameterException::class); $this->expectExceptionMessage('Theses parameters are mandatory: `login`, `lastname`, `firstname`, `mail`'); diff --git a/tests/RedmineExtension/BehatHookTracer.php b/tests/RedmineExtension/BehatHookTracer.php index 04215442..75f422cf 100644 --- a/tests/RedmineExtension/BehatHookTracer.php +++ b/tests/RedmineExtension/BehatHookTracer.php @@ -24,45 +24,45 @@ final class BehatHookTracer implements InstanceRegistration public static function getRedmineInstance(RedmineVersion $redmineVersion, string $rootPath): RedmineInstance { - if (static::$tracer === null) { + if (!self::$tracer instanceof \Redmine\Tests\RedmineExtension\BehatHookTracer) { throw new RuntimeException('You can only get a Redmine instance while a Behat Suite is running.'); } - if (! array_key_exists($redmineVersion->asId(), static::$instances)) { - RedmineInstance::create(static::$tracer, $redmineVersion, $rootPath); + if (! array_key_exists($redmineVersion->asId(), self::$instances)) { + RedmineInstance::create(self::$tracer, $redmineVersion, $rootPath); } - return static::$instances[$redmineVersion->asId()]; + return self::$instances[$redmineVersion->asId()]; } public function registerInstance(RedmineInstance $instance): void { - static::$instances[$instance->getVersionId()] = $instance; + self::$instances[$instance->getVersionId()] = $instance; } public function deregisterInstance(RedmineInstance $instance): void { - unset(static::$instances[$instance->getVersionId()]); + unset(self::$instances[$instance->getVersionId()]); } public function hook(HookScope $event): void { if ($event instanceof BeforeSuiteScope) { - static::$tracer = $this; + self::$tracer = $this; } if ($event instanceof AfterScenarioScope) { - foreach (static::$instances as $instance) { + foreach (self::$instances as $instance) { $instance->reset($this); } } if ($event instanceof AfterSuiteScope) { - foreach (static::$instances as $instance) { + foreach (self::$instances as $instance) { $instance->shutdown($this); } - static::$tracer = null; + self::$tracer = null; } } } diff --git a/tests/RedmineExtension/RedmineInstance.php b/tests/RedmineExtension/RedmineInstance.php index e5f52708..0e8c32b2 100644 --- a/tests/RedmineExtension/RedmineInstance.php +++ b/tests/RedmineExtension/RedmineInstance.php @@ -66,7 +66,7 @@ private function __construct(InstanceRegistration $tracer, RedmineVersion $versi $parts = explode('.', $version->asString()); $this->redmineUrl = 'http://redmine-' . intval($parts[0]) . '-' . intval($parts[1]) . ':3000'; - $this->apiKey = sha1($versionId . (string) time()); + $this->apiKey = sha1($versionId . time()); $this->runHealthChecks($version); @@ -160,7 +160,7 @@ public function excecuteDatabaseQuery(string $query, array $options = [], ?array $stmt->execute($params); } - private function runDatabaseMigration() + private function runDatabaseMigration(): void { $now = new DateTimeImmutable(); $pdo = new PDO('sqlite:' . $this->dataPath . $this->workingDB); @@ -196,7 +196,7 @@ private function runDatabaseMigration() /** * Create backup of working database */ - private function createDatabaseBackup() + private function createDatabaseBackup(): void { $workingDB = new SQLite3($this->dataPath . $this->workingDB); @@ -211,7 +211,7 @@ private function createDatabaseBackup() /** * Create backup of migrated database */ - private function saveMigratedDatabase() + private function saveMigratedDatabase(): void { $workingDB = new SQLite3($this->dataPath . $this->workingDB); @@ -253,7 +253,7 @@ private function removeDatabaseBackups(): void unlink($this->dataPath . $this->backupDB); } - private function createFilesBackup() + private function createFilesBackup(): void { // Add an empty file to avoid warnings about copying and removing content from an empty folder touch($this->dataPath . $this->workingFiles . 'empty'); @@ -264,7 +264,7 @@ private function createFilesBackup() )); } - private function saveMigratedFiles() + private function saveMigratedFiles(): void { exec(sprintf( 'cp -r %s %s', diff --git a/tests/Unit/Api/AbstractApi/DeleteTest.php b/tests/Unit/Api/AbstractApi/DeleteTest.php index 9df99358..a86460d0 100644 --- a/tests/Unit/Api/AbstractApi/DeleteTest.php +++ b/tests/Unit/Api/AbstractApi/DeleteTest.php @@ -45,7 +45,7 @@ public function testDeleteWithHttpClient(): void * @dataProvider getXmlDecodingFromDeleteMethodData */ #[DataProvider('getXmlDecodingFromDeleteMethodData')] - public function testXmlDecodingFromDeleteMethod($response, $expected): void + public function testXmlDecodingFromDeleteMethod(string $response, string $expected): void { $client = $this->createMock(Client::class); $client->method('getLastResponseBody')->willReturn($response); diff --git a/tests/Unit/Api/AbstractApi/GetTest.php b/tests/Unit/Api/AbstractApi/GetTest.php index 3cf31e25..43f21085 100644 --- a/tests/Unit/Api/AbstractApi/GetTest.php +++ b/tests/Unit/Api/AbstractApi/GetTest.php @@ -47,7 +47,7 @@ public function testGetWithHttpClient(): void * @dataProvider getJsonDecodingFromGetMethodData */ #[DataProvider('getJsonDecodingFromGetMethodData')] - public function testJsonDecodingFromGetMethod($response, $decode, $expected): void + public function testJsonDecodingFromGetMethod(string $response, ?bool $decode, $expected): void { $client = $this->createMock(Client::class); $client->method('getLastResponseBody')->willReturn($response); @@ -82,7 +82,7 @@ public static function getJsonDecodingFromGetMethodData(): array * @dataProvider getXmlDecodingFromGetMethodData */ #[DataProvider('getXmlDecodingFromGetMethodData')] - public function testXmlDecodingFromGetMethod($response, $decode, $expected): void + public function testXmlDecodingFromGetMethod(string $response, ?bool $decode, string $expected): void { $client = $this->createMock(Client::class); $client->method('getLastResponseBody')->willReturn($response); diff --git a/tests/Unit/Api/AbstractApi/PostTest.php b/tests/Unit/Api/AbstractApi/PostTest.php index d9b351af..adcb7161 100644 --- a/tests/Unit/Api/AbstractApi/PostTest.php +++ b/tests/Unit/Api/AbstractApi/PostTest.php @@ -47,7 +47,7 @@ public function testPostWithHttpClient(): void * @dataProvider getXmlDecodingFromPostMethodData */ #[DataProvider('getXmlDecodingFromPostMethodData')] - public function testXmlDecodingFromPostMethod($response, $expected): void + public function testXmlDecodingFromPostMethod(string $response, string $expected): void { $client = $this->createMock(Client::class); $client->method('getLastResponseBody')->willReturn($response); diff --git a/tests/Unit/Api/AbstractApi/PutTest.php b/tests/Unit/Api/AbstractApi/PutTest.php index 9e262bd6..e6e80ef6 100644 --- a/tests/Unit/Api/AbstractApi/PutTest.php +++ b/tests/Unit/Api/AbstractApi/PutTest.php @@ -47,7 +47,7 @@ public function testPutWithHttpClient(): void * @dataProvider getXmlDecodingFromPutMethodData */ #[DataProvider('getXmlDecodingFromPutMethodData')] - public function testXmlDecodingFromPutMethod($response, $expected): void + public function testXmlDecodingFromPutMethod(string $response, string $expected): void { $client = $this->createMock(Client::class); $client->method('getLastResponseBody')->willReturn($response); diff --git a/tests/Unit/Api/AbstractApiTest.php b/tests/Unit/Api/AbstractApiTest.php index d886960c..2c8a2896 100644 --- a/tests/Unit/Api/AbstractApiTest.php +++ b/tests/Unit/Api/AbstractApiTest.php @@ -257,7 +257,7 @@ public function __construct($client) * @dataProvider getLastCallFailedData */ #[DataProvider('getLastCallFailedData')] - public function testLastCallFailedWithClientReturnsCorrectBoolean($statusCode, $expectedBoolean): void + public function testLastCallFailedWithClientReturnsCorrectBoolean(int $statusCode, bool $expectedBoolean): void { $client = $this->createMock(Client::class); $client->method('getLastResponseStatusCode')->willReturn($statusCode); @@ -271,7 +271,7 @@ public function testLastCallFailedWithClientReturnsCorrectBoolean($statusCode, $ * @dataProvider getLastCallFailedData */ #[DataProvider('getLastCallFailedData')] - public function testLastCallFailedWithHttpClientReturnsCorrectBoolean($statusCode, $expectedBoolean): void + public function testLastCallFailedWithHttpClientReturnsCorrectBoolean(int $statusCode, bool $expectedBoolean): void { $response = $this->createMock(Response::class); $response->method('getStatusCode')->willReturn($statusCode); @@ -365,7 +365,7 @@ public static function getLastCallFailedData(): array * @dataProvider retrieveDataData */ #[DataProvider('retrieveDataData')] - public function testRetrieveData($path, $contentType, $response, $expected): void + public function testRetrieveData(string $path, string $contentType, string $response, array $expected): void { $client = $this->createMock(Client::class); $client->method('requestGet')->willReturn(true); @@ -444,7 +444,7 @@ public function testRetrieveDataWith250ResultsMakes3Requests(): void * @dataProvider getRetrieveDataToExceptionData */ #[DataProvider('getRetrieveDataToExceptionData')] - public function testRetrieveDataThrowsException($response, $contentType, $expectedException, $expectedMessage): void + public function testRetrieveDataThrowsException(string $response, string $contentType, string $expectedException, string $expectedMessage): void { $client = $this->createMock(Client::class); $client->method('requestGet')->willReturn(true); @@ -473,7 +473,7 @@ public static function getRetrieveDataToExceptionData(): array * @dataProvider getRetrieveAllData */ #[DataProvider('getRetrieveAllData')] - public function testDeprecatedRetrieveAll($content, $contentType, $expected): void + public function testDeprecatedRetrieveAll(string $content, string $contentType, $expected): void { $client = $this->createMock(Client::class); $client->method('requestGet')->willReturn(true); diff --git a/tests/Unit/Api/Attachment/DownloadTest.php b/tests/Unit/Api/Attachment/DownloadTest.php index cb3ab759..87301202 100644 --- a/tests/Unit/Api/Attachment/DownloadTest.php +++ b/tests/Unit/Api/Attachment/DownloadTest.php @@ -15,7 +15,7 @@ class DownloadTest extends TestCase * @dataProvider getDownloadData */ #[DataProvider('getDownloadData')] - public function testDownloadReturnsCorrectResponse($id, $expectedPath, $responseCode, $response, $expectedReturn): void + public function testDownloadReturnsCorrectResponse($id, string $expectedPath, int $responseCode, string $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Attachment/ShowTest.php b/tests/Unit/Api/Attachment/ShowTest.php index 37315559..c929b4e6 100644 --- a/tests/Unit/Api/Attachment/ShowTest.php +++ b/tests/Unit/Api/Attachment/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn): void + public function testShowReturnsCorrectResponse($id, string $expectedPath, string $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Attachment/UpdateTest.php b/tests/Unit/Api/Attachment/UpdateTest.php index 8fd28190..02923902 100644 --- a/tests/Unit/Api/Attachment/UpdateTest.php +++ b/tests/Unit/Api/Attachment/UpdateTest.php @@ -16,7 +16,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, array $params, $expectedPath, $expectedContent, $expectedReturn): void + public function testUpdateReturnsCorrectResponse(int $id, array $params, string $expectedPath, string $expectedContent, bool $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Attachment/UploadTest.php b/tests/Unit/Api/Attachment/UploadTest.php index a86d9a0a..6f1d7540 100644 --- a/tests/Unit/Api/Attachment/UploadTest.php +++ b/tests/Unit/Api/Attachment/UploadTest.php @@ -15,7 +15,7 @@ class UploadTest extends TestCase * @dataProvider getUploadData */ #[DataProvider('getUploadData')] - public function testUploadReturnsCorrectResponse($attachment, $params, $expectedAttachment, $expectedPath, $responseCode, $response, $expectedReturn): void + public function testUploadReturnsCorrectResponse(string $attachment, array $params, string $expectedAttachment, string $expectedPath, int $responseCode, string $response, string $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/AttachmentTest.php b/tests/Unit/Api/AttachmentTest.php index a8f58fb3..a1ab9018 100644 --- a/tests/Unit/Api/AttachmentTest.php +++ b/tests/Unit/Api/AttachmentTest.php @@ -18,12 +18,9 @@ class AttachmentTest extends TestCase * Test lastCallFailed(). * * @dataProvider responseCodeProvider - * - * @param int $responseCode - * @param bool $hasFailed */ #[DataProvider('responseCodeProvider')] - public function testLastCallFailedTrue($responseCode, $hasFailed): void + public function testLastCallFailedTrue(int $responseCode, bool $hasFailed): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/CustomField/ListNamesTest.php b/tests/Unit/Api/CustomField/ListNamesTest.php index 66c94041..36153176 100644 --- a/tests/Unit/Api/CustomField/ListNamesTest.php +++ b/tests/Unit/Api/CustomField/ListNamesTest.php @@ -17,7 +17,7 @@ class ListNamesTest extends TestCase * @dataProvider getListNamesData */ #[DataProvider('getListNamesData')] - public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse): void + public function testListNamesReturnsCorrectResponse(string $expectedPath, int $responseCode, string $response, array $expectedResponse): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/CustomFieldTest.php b/tests/Unit/Api/CustomFieldTest.php index a713a7f9..6fd94f86 100644 --- a/tests/Unit/Api/CustomFieldTest.php +++ b/tests/Unit/Api/CustomFieldTest.php @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponse(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -151,12 +151,6 @@ public function testAllCallsEndpointUntilOffsetIsHigherThanTotalCount(): void // Test values $response = '{"limit":"100","offset":"10","total_count":"5","items":[]}'; $allParameters = ['limit' => 250]; - $returnDataSet = [ - 'limit' => '100', - 'offset' => '10', - 'total_count' => '5', - 'items' => [], - ]; // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Group/AddUserTest.php b/tests/Unit/Api/Group/AddUserTest.php index 7c85bfac..cfd15448 100644 --- a/tests/Unit/Api/Group/AddUserTest.php +++ b/tests/Unit/Api/Group/AddUserTest.php @@ -16,7 +16,7 @@ class AddUserTest extends TestCase * @dataProvider getAddUserData */ #[DataProvider('getAddUserData')] - public function testAddUserReturnsCorrectResponse($groupId, $userId, $expectedPath, $expectedBody, $responseCode, $response): void + public function testAddUserReturnsCorrectResponse(int $groupId, int $userId, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Group/CreateTest.php b/tests/Unit/Api/Group/CreateTest.php index 800f1158..ae269f54 100644 --- a/tests/Unit/Api/Group/CreateTest.php +++ b/tests/Unit/Api/Group/CreateTest.php @@ -20,7 +20,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testCreateReturnsCorrectResponse(array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Group/ListNamesTest.php b/tests/Unit/Api/Group/ListNamesTest.php index 3d952784..14b413b7 100644 --- a/tests/Unit/Api/Group/ListNamesTest.php +++ b/tests/Unit/Api/Group/ListNamesTest.php @@ -17,7 +17,7 @@ class ListNamesTest extends TestCase * @dataProvider getListNamesData */ #[DataProvider('getListNamesData')] - public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse): void + public function testListNamesReturnsCorrectResponse(string $expectedPath, int $responseCode, string $response, array $expectedResponse): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Group/ShowTest.php b/tests/Unit/Api/Group/ShowTest.php index 8bc8d12c..870c833a 100644 --- a/tests/Unit/Api/Group/ShowTest.php +++ b/tests/Unit/Api/Group/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($groupId, array $params, $expectedPath, $response, $expectedReturn): void + public function testShowReturnsCorrectResponse($groupId, array $params, string $expectedPath, string $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Group/UpdateTest.php b/tests/Unit/Api/Group/UpdateTest.php index e22de63d..d039e3ba 100644 --- a/tests/Unit/Api/Group/UpdateTest.php +++ b/tests/Unit/Api/Group/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testUpdateReturnsCorrectResponse(int $id, array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/GroupTest.php b/tests/Unit/Api/GroupTest.php index f3f35973..14d01398 100644 --- a/tests/Unit/Api/GroupTest.php +++ b/tests/Unit/Api/GroupTest.php @@ -47,7 +47,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponse(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Issue/AddNoteToIssueTest.php b/tests/Unit/Api/Issue/AddNoteToIssueTest.php index 771b3101..af5a9dc0 100644 --- a/tests/Unit/Api/Issue/AddNoteToIssueTest.php +++ b/tests/Unit/Api/Issue/AddNoteToIssueTest.php @@ -17,7 +17,7 @@ class AddNoteToIssueTest extends TestCase * @dataProvider getAddNoteToIssueData */ #[DataProvider('getAddNoteToIssueData')] - public function testAddNoteToIssueReturnsCorrectResponse($id, $note, $isPrivate, $expectedPath, $expectedBody, $responseCode, $response): void + public function testAddNoteToIssueReturnsCorrectResponse(int $id, string $note, bool $isPrivate, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/AddWatcherTest.php b/tests/Unit/Api/Issue/AddWatcherTest.php index 26fbda1c..868807e1 100644 --- a/tests/Unit/Api/Issue/AddWatcherTest.php +++ b/tests/Unit/Api/Issue/AddWatcherTest.php @@ -16,7 +16,7 @@ class AddWatcherTest extends TestCase * @dataProvider getAddWatcherData */ #[DataProvider('getAddWatcherData')] - public function testAddWatcherReturnsCorrectResponse($issueId, $watcherUserId, $expectedPath, $expectedBody, $responseCode, $response): void + public function testAddWatcherReturnsCorrectResponse(int $issueId, int $watcherUserId, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/AttachManyTest.php b/tests/Unit/Api/Issue/AttachManyTest.php index 038011ed..f88bf247 100644 --- a/tests/Unit/Api/Issue/AttachManyTest.php +++ b/tests/Unit/Api/Issue/AttachManyTest.php @@ -15,7 +15,7 @@ class AttachManyTest extends TestCase * @dataProvider getAttachManyData */ #[DataProvider('getAttachManyData')] - public function testAttachManyReturnsCorrectResponse($issueId, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testAttachManyReturnsCorrectResponse(int $issueId, array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/AttachTest.php b/tests/Unit/Api/Issue/AttachTest.php index 9cfce197..5ccd2641 100644 --- a/tests/Unit/Api/Issue/AttachTest.php +++ b/tests/Unit/Api/Issue/AttachTest.php @@ -15,7 +15,7 @@ class AttachTest extends TestCase * @dataProvider getAttachData */ #[DataProvider('getAttachData')] - public function testAttachReturnsCorrectResponse($issueId, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testAttachReturnsCorrectResponse(int $issueId, array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/CreateTest.php b/tests/Unit/Api/Issue/CreateTest.php index dd142481..09e1e1b9 100644 --- a/tests/Unit/Api/Issue/CreateTest.php +++ b/tests/Unit/Api/Issue/CreateTest.php @@ -16,7 +16,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testCreateReturnsCorrectResponse(array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/RemoveTest.php b/tests/Unit/Api/Issue/RemoveTest.php index cccf5b03..effe5f99 100644 --- a/tests/Unit/Api/Issue/RemoveTest.php +++ b/tests/Unit/Api/Issue/RemoveTest.php @@ -15,7 +15,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($issueId, $expectedPath, $responseCode, $response): void + public function testRemoveReturnsCorrectResponse(int $issueId, string $expectedPath, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/RemoveWatcherTest.php b/tests/Unit/Api/Issue/RemoveWatcherTest.php index 1e8f9c4b..677ef505 100644 --- a/tests/Unit/Api/Issue/RemoveWatcherTest.php +++ b/tests/Unit/Api/Issue/RemoveWatcherTest.php @@ -15,7 +15,7 @@ class RemoveWatcherTest extends TestCase * @dataProvider getRemoveWatcherData */ #[DataProvider('getRemoveWatcherData')] - public function testRemoveWatcherReturnsCorrectResponse($issueId, $watcherUserId, $expectedPath, $responseCode, $response): void + public function testRemoveWatcherReturnsCorrectResponse(int $issueId, int $watcherUserId, string $expectedPath, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/ShowTest.php b/tests/Unit/Api/Issue/ShowTest.php index 45718e7a..5d206f62 100644 --- a/tests/Unit/Api/Issue/ShowTest.php +++ b/tests/Unit/Api/Issue/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($issueId, array $params, $expectedPath, $response, $expectedReturn): void + public function testShowReturnsCorrectResponse($issueId, array $params, string $expectedPath, string $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Issue/UpdateTest.php b/tests/Unit/Api/Issue/UpdateTest.php index d30fb1b7..f61c20d4 100644 --- a/tests/Unit/Api/Issue/UpdateTest.php +++ b/tests/Unit/Api/Issue/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testUpdateReturnsCorrectResponse(int $id, array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/IssueCategory/CreateTest.php b/tests/Unit/Api/IssueCategory/CreateTest.php index 5fe5365e..576d9be3 100644 --- a/tests/Unit/Api/IssueCategory/CreateTest.php +++ b/tests/Unit/Api/IssueCategory/CreateTest.php @@ -18,7 +18,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($identifier, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testCreateReturnsCorrectResponse($identifier, array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, @@ -116,7 +116,7 @@ public function testCreateThrowsExceptionWithEmptyParameters(): void * @dataProvider incompleteCreateParameterProvider */ #[DataProvider('incompleteCreateParameterProvider')] - public function testCreateThrowsExceptionIfMandatoyParametersAreMissing($parameters): void + public function testCreateThrowsExceptionIfMandatoyParametersAreMissing(array $parameters): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/IssueCategory/ListNamesByProjectTest.php b/tests/Unit/Api/IssueCategory/ListNamesByProjectTest.php index aae301c5..2640f277 100644 --- a/tests/Unit/Api/IssueCategory/ListNamesByProjectTest.php +++ b/tests/Unit/Api/IssueCategory/ListNamesByProjectTest.php @@ -21,7 +21,7 @@ class ListNamesByProjectTest extends TestCase * @dataProvider getListNamesByProjectData */ #[DataProvider('getListNamesByProjectData')] - public function testListNamesByProjectReturnsCorrectResponse($projectIdentifier, $expectedPath, $responseCode, $response, $expectedResponse): void + public function testListNamesByProjectReturnsCorrectResponse($projectIdentifier, string $expectedPath, int $responseCode, string $response, array $expectedResponse): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/IssueCategory/RemoveTest.php b/tests/Unit/Api/IssueCategory/RemoveTest.php index f66d6e8f..42bfad30 100644 --- a/tests/Unit/Api/IssueCategory/RemoveTest.php +++ b/tests/Unit/Api/IssueCategory/RemoveTest.php @@ -15,7 +15,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($issueId, $params, $expectedPath, $responseCode, $response): void + public function testRemoveReturnsCorrectResponse(int $issueId, array $params, string $expectedPath, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/IssueCategory/ShowTest.php b/tests/Unit/Api/IssueCategory/ShowTest.php index e9e5c960..59ce6fba 100644 --- a/tests/Unit/Api/IssueCategory/ShowTest.php +++ b/tests/Unit/Api/IssueCategory/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn): void + public function testShowReturnsCorrectResponse($id, string $expectedPath, string $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/IssueCategory/UpdateTest.php b/tests/Unit/Api/IssueCategory/UpdateTest.php index c948ed67..fc8f0d95 100644 --- a/tests/Unit/Api/IssueCategory/UpdateTest.php +++ b/tests/Unit/Api/IssueCategory/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testUpdateReturnsCorrectResponse(int $id, array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/IssueCategoryTest.php b/tests/Unit/Api/IssueCategoryTest.php index 0838502d..12d63b4e 100644 --- a/tests/Unit/Api/IssueCategoryTest.php +++ b/tests/Unit/Api/IssueCategoryTest.php @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllDAta */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponseWithProject($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponseWithProject(string $response, string $responseType, $expectedResponse): void { // Test values $projectId = 5; diff --git a/tests/Unit/Api/IssuePriorityTest.php b/tests/Unit/Api/IssuePriorityTest.php index bb07580f..7363db9a 100644 --- a/tests/Unit/Api/IssuePriorityTest.php +++ b/tests/Unit/Api/IssuePriorityTest.php @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponse(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/IssueRelation/CreateTest.php b/tests/Unit/Api/IssueRelation/CreateTest.php index d273fdc8..004d8edb 100644 --- a/tests/Unit/Api/IssueRelation/CreateTest.php +++ b/tests/Unit/Api/IssueRelation/CreateTest.php @@ -18,7 +18,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($issueId, $parameters, $expectedPath, $expectedBody, $responseCode, $response, $expectedReturn): void + public function testCreateReturnsCorrectResponse(int $issueId, array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response, array $expectedReturn): void { $client = AssertingHttpClient::create( $this, @@ -102,7 +102,7 @@ public function testCreateThrowsExceptionWithEmptyParameters(): void * @dataProvider incompleteCreateParameterProvider */ #[DataProvider('incompleteCreateParameterProvider')] - public function testCreateThrowsExceptionIfMandatoyParametersAreMissing($parameters): void + public function testCreateThrowsExceptionIfMandatoyParametersAreMissing(array $parameters): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/IssueRelation/RemoveTest.php b/tests/Unit/Api/IssueRelation/RemoveTest.php index b754e9e8..0068abfa 100644 --- a/tests/Unit/Api/IssueRelation/RemoveTest.php +++ b/tests/Unit/Api/IssueRelation/RemoveTest.php @@ -15,7 +15,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($issueId, $expectedPath, $responseCode, $response): void + public function testRemoveReturnsCorrectResponse(int $issueId, string $expectedPath, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/IssueRelation/ShowTest.php b/tests/Unit/Api/IssueRelation/ShowTest.php index adf974e1..f3722d29 100644 --- a/tests/Unit/Api/IssueRelation/ShowTest.php +++ b/tests/Unit/Api/IssueRelation/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn): void + public function testShowReturnsCorrectResponse($id, string $expectedPath, string $response, array $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/IssueRelationTest.php b/tests/Unit/Api/IssueRelationTest.php index 79639c9d..f744ce29 100644 --- a/tests/Unit/Api/IssueRelationTest.php +++ b/tests/Unit/Api/IssueRelationTest.php @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponseWithProject($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponseWithProject(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/IssueStatus/ListNamesTest.php b/tests/Unit/Api/IssueStatus/ListNamesTest.php index b0e8f4a6..98789e13 100644 --- a/tests/Unit/Api/IssueStatus/ListNamesTest.php +++ b/tests/Unit/Api/IssueStatus/ListNamesTest.php @@ -17,7 +17,7 @@ class ListNamesTest extends TestCase * @dataProvider getListNamesData */ #[DataProvider('getListNamesData')] - public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse): void + public function testListNamesReturnsCorrectResponse(string $expectedPath, int $responseCode, string $response, array $expectedResponse): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/IssueStatusTest.php b/tests/Unit/Api/IssueStatusTest.php index 93c42aa0..32a27bd5 100644 --- a/tests/Unit/Api/IssueStatusTest.php +++ b/tests/Unit/Api/IssueStatusTest.php @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponse(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/IssueTest.php b/tests/Unit/Api/IssueTest.php index fd9b4660..cfddb4bc 100644 --- a/tests/Unit/Api/IssueTest.php +++ b/tests/Unit/Api/IssueTest.php @@ -40,7 +40,7 @@ public static function getPriorityConstantsData(): array * @dataProvider getPriorityConstantsData */ #[DataProvider('getPriorityConstantsData')] - public function testPriorityConstants($expected, $value): void + public function testPriorityConstants(int $expected, int $value): void { $this->assertSame($expected, $value); } @@ -75,7 +75,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponse(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Membership/CreateTest.php b/tests/Unit/Api/Membership/CreateTest.php index 9a5813cf..9473d818 100644 --- a/tests/Unit/Api/Membership/CreateTest.php +++ b/tests/Unit/Api/Membership/CreateTest.php @@ -18,7 +18,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($identifier, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testCreateReturnsCorrectResponse(int $identifier, array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, @@ -108,7 +108,7 @@ public function testCreateThrowsExceptionWithEmptyParameters(): void * @dataProvider incompleteCreateParameterProvider */ #[DataProvider('incompleteCreateParameterProvider')] - public function testCreateThrowsExceptionIfMandatoyParametersAreMissing($parameters): void + public function testCreateThrowsExceptionIfMandatoyParametersAreMissing(array $parameters): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/Membership/RemoveMemberTest.php b/tests/Unit/Api/Membership/RemoveMemberTest.php index 584c928b..495ea5d3 100644 --- a/tests/Unit/Api/Membership/RemoveMemberTest.php +++ b/tests/Unit/Api/Membership/RemoveMemberTest.php @@ -15,7 +15,7 @@ class RemoveMemberTest extends TestCase * @dataProvider getRemoveMemberData */ #[DataProvider('getRemoveMemberData')] - public function testRemoveMemberReturnsCorrectResponse($projectIdentifier, $userId, array $params, $expectedPath, $responseCode, $response): void + public function testRemoveMemberReturnsCorrectResponse(int $projectIdentifier, int $userId, array $params, string $expectedPath, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Membership/RemoveTest.php b/tests/Unit/Api/Membership/RemoveTest.php index 57bf7338..b18f65b0 100644 --- a/tests/Unit/Api/Membership/RemoveTest.php +++ b/tests/Unit/Api/Membership/RemoveTest.php @@ -15,7 +15,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($id, $expectedPath, $responseCode, $response): void + public function testRemoveReturnsCorrectResponse(int $id, string $expectedPath, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Membership/UpdateTest.php b/tests/Unit/Api/Membership/UpdateTest.php index e8e498b6..92e348c8 100644 --- a/tests/Unit/Api/Membership/UpdateTest.php +++ b/tests/Unit/Api/Membership/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testUpdateReturnsCorrectResponse(int $id, array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, @@ -105,7 +105,7 @@ public function testUpdateThrowsExceptionWithEmptyParameters(): void * @dataProvider incompleteUpdateParameterProvider */ #[DataProvider('incompleteUpdateParameterProvider')] - public function testUpdateThrowsExceptionIfMandatoyParametersAreMissing($parameters): void + public function testUpdateThrowsExceptionIfMandatoyParametersAreMissing(array $parameters): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/MembershipTest.php b/tests/Unit/Api/MembershipTest.php index 28b1e463..70af3a16 100644 --- a/tests/Unit/Api/MembershipTest.php +++ b/tests/Unit/Api/MembershipTest.php @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponseWithProject($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponseWithProject(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/NewsTest.php b/tests/Unit/Api/NewsTest.php index 1d26f327..32b589f4 100644 --- a/tests/Unit/Api/NewsTest.php +++ b/tests/Unit/Api/NewsTest.php @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponse(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Project/CreateTest.php b/tests/Unit/Api/Project/CreateTest.php index bb7b2ab8..c44e398c 100644 --- a/tests/Unit/Api/Project/CreateTest.php +++ b/tests/Unit/Api/Project/CreateTest.php @@ -18,7 +18,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testCreateReturnsCorrectResponse(array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, @@ -174,7 +174,7 @@ public function testCreateThrowsExceptionWithEmptyParameters(): void * @dataProvider incompleteCreateParameterProvider */ #[DataProvider('incompleteCreateParameterProvider')] - public function testCreateThrowsExceptionIfMandatoyParametersAreMissing($parameters): void + public function testCreateThrowsExceptionIfMandatoyParametersAreMissing(array $parameters): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/Project/ListNamesTest.php b/tests/Unit/Api/Project/ListNamesTest.php index 57e7dc99..44136945 100644 --- a/tests/Unit/Api/Project/ListNamesTest.php +++ b/tests/Unit/Api/Project/ListNamesTest.php @@ -17,7 +17,7 @@ class ListNamesTest extends TestCase * @dataProvider getListNamesData */ #[DataProvider('getListNamesData')] - public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse): void + public function testListNamesReturnsCorrectResponse(string $expectedPath, int $responseCode, string $response, array $expectedResponse): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Project/RemoveTest.php b/tests/Unit/Api/Project/RemoveTest.php index 048a857d..0a1c38c5 100644 --- a/tests/Unit/Api/Project/RemoveTest.php +++ b/tests/Unit/Api/Project/RemoveTest.php @@ -15,7 +15,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($id, $expectedPath, $responseCode, $response): void + public function testRemoveReturnsCorrectResponse(int $id, string $expectedPath, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Project/ShowTest.php b/tests/Unit/Api/Project/ShowTest.php index a1685e65..fb7ea5c9 100644 --- a/tests/Unit/Api/Project/ShowTest.php +++ b/tests/Unit/Api/Project/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($identifier, array $params, $expectedPath, $response, $expectedReturn): void + public function testShowReturnsCorrectResponse($identifier, array $params, string $expectedPath, string $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Project/UpdateTest.php b/tests/Unit/Api/Project/UpdateTest.php index 2328d467..5f12e417 100644 --- a/tests/Unit/Api/Project/UpdateTest.php +++ b/tests/Unit/Api/Project/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testUpdateReturnsCorrectResponse(int $id, array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/ProjectTest.php b/tests/Unit/Api/ProjectTest.php index 468b05d1..a100c14f 100644 --- a/tests/Unit/Api/ProjectTest.php +++ b/tests/Unit/Api/ProjectTest.php @@ -47,7 +47,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponse(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/QueryTest.php b/tests/Unit/Api/QueryTest.php index 22c8a158..86af788c 100644 --- a/tests/Unit/Api/QueryTest.php +++ b/tests/Unit/Api/QueryTest.php @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponse(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Role/ListNamesTest.php b/tests/Unit/Api/Role/ListNamesTest.php index c304cd97..aa849d73 100644 --- a/tests/Unit/Api/Role/ListNamesTest.php +++ b/tests/Unit/Api/Role/ListNamesTest.php @@ -17,7 +17,7 @@ class ListNamesTest extends TestCase * @dataProvider getListNamesData */ #[DataProvider('getListNamesData')] - public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse): void + public function testListNamesReturnsCorrectResponse(string $expectedPath, int $responseCode, string $response, array $expectedResponse): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Role/ShowTest.php b/tests/Unit/Api/Role/ShowTest.php index 10de7af7..5da8e4e8 100644 --- a/tests/Unit/Api/Role/ShowTest.php +++ b/tests/Unit/Api/Role/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn): void + public function testShowReturnsCorrectResponse($id, string $expectedPath, string $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/RoleTest.php b/tests/Unit/Api/RoleTest.php index f49f7d8c..e11ec6d9 100644 --- a/tests/Unit/Api/RoleTest.php +++ b/tests/Unit/Api/RoleTest.php @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponse(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Search/SearchTest.php b/tests/Unit/Api/Search/SearchTest.php index 22b953d3..5756a619 100644 --- a/tests/Unit/Api/Search/SearchTest.php +++ b/tests/Unit/Api/Search/SearchTest.php @@ -37,7 +37,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testSearchReturnsClientGetResponse($response, $responseType, $expectedResponse): void + public function testSearchReturnsClientGetResponse(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/TimeEntry/CreateTest.php b/tests/Unit/Api/TimeEntry/CreateTest.php index 79225dc7..821afdb3 100644 --- a/tests/Unit/Api/TimeEntry/CreateTest.php +++ b/tests/Unit/Api/TimeEntry/CreateTest.php @@ -18,7 +18,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testCreateReturnsCorrectResponse(array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, @@ -149,7 +149,7 @@ public function testCreateThrowsExceptionWithEmptyParameters(): void * @dataProvider incompleteCreateParameterProvider */ #[DataProvider('incompleteCreateParameterProvider')] - public function testCreateThrowsExceptionIfValueIsMissingInParameters($parameters): void + public function testCreateThrowsExceptionIfValueIsMissingInParameters(array $parameters): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/TimeEntry/RemoveTest.php b/tests/Unit/Api/TimeEntry/RemoveTest.php index fedc10f0..e5d71965 100644 --- a/tests/Unit/Api/TimeEntry/RemoveTest.php +++ b/tests/Unit/Api/TimeEntry/RemoveTest.php @@ -15,7 +15,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($id, $expectedPath, $responseCode, $response): void + public function testRemoveReturnsCorrectResponse(int $id, string $expectedPath, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/TimeEntry/ShowTest.php b/tests/Unit/Api/TimeEntry/ShowTest.php index 3dd3d737..414d90ac 100644 --- a/tests/Unit/Api/TimeEntry/ShowTest.php +++ b/tests/Unit/Api/TimeEntry/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($id, $expectedPath, $response, $expectedReturn): void + public function testShowReturnsCorrectResponse($id, string $expectedPath, string $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/TimeEntry/UpdateTest.php b/tests/Unit/Api/TimeEntry/UpdateTest.php index aebccee8..05e77d88 100644 --- a/tests/Unit/Api/TimeEntry/UpdateTest.php +++ b/tests/Unit/Api/TimeEntry/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testUpdateReturnsCorrectResponse(int $id, array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/TimeEntryActivity/ListNamesTest.php b/tests/Unit/Api/TimeEntryActivity/ListNamesTest.php index 9f60c1bb..7172ef9b 100644 --- a/tests/Unit/Api/TimeEntryActivity/ListNamesTest.php +++ b/tests/Unit/Api/TimeEntryActivity/ListNamesTest.php @@ -17,7 +17,7 @@ class ListNamesTest extends TestCase * @dataProvider getListNamesData */ #[DataProvider('getListNamesData')] - public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse): void + public function testListNamesReturnsCorrectResponse(string $expectedPath, int $responseCode, string $response, array $expectedResponse): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/TimeEntryActivityTest.php b/tests/Unit/Api/TimeEntryActivityTest.php index cd687797..1a9450ee 100644 --- a/tests/Unit/Api/TimeEntryActivityTest.php +++ b/tests/Unit/Api/TimeEntryActivityTest.php @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponse(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/TimeEntryTest.php b/tests/Unit/Api/TimeEntryTest.php index 965ce4f7..c53ce120 100644 --- a/tests/Unit/Api/TimeEntryTest.php +++ b/tests/Unit/Api/TimeEntryTest.php @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponse(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Tracker/ListNamesTest.php b/tests/Unit/Api/Tracker/ListNamesTest.php index cbd4cdb4..d962eec9 100644 --- a/tests/Unit/Api/Tracker/ListNamesTest.php +++ b/tests/Unit/Api/Tracker/ListNamesTest.php @@ -17,7 +17,7 @@ class ListNamesTest extends TestCase * @dataProvider getListNamesData */ #[DataProvider('getListNamesData')] - public function testListNamesReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse): void + public function testListNamesReturnsCorrectResponse(string $expectedPath, int $responseCode, string $response, array $expectedResponse): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/TrackerTest.php b/tests/Unit/Api/TrackerTest.php index 72a8c7e7..54dd54a0 100644 --- a/tests/Unit/Api/TrackerTest.php +++ b/tests/Unit/Api/TrackerTest.php @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponse(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/User/CreateTest.php b/tests/Unit/Api/User/CreateTest.php index c1abfbf5..538864a7 100644 --- a/tests/Unit/Api/User/CreateTest.php +++ b/tests/Unit/Api/User/CreateTest.php @@ -18,7 +18,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testCreateReturnsCorrectResponse(array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, @@ -136,7 +136,7 @@ public function testCreateThrowsExceptionWithEmptyParameters(): void * @dataProvider incompleteCreateParameterProvider */ #[DataProvider('incompleteCreateParameterProvider')] - public function testCreateThrowsExceptionIfValueIsMissingInParameters($parameters): void + public function testCreateThrowsExceptionIfValueIsMissingInParameters(array $parameters): void { // Create the used mock objects $client = $this->createMock(HttpClient::class); diff --git a/tests/Unit/Api/User/ListLoginsTest.php b/tests/Unit/Api/User/ListLoginsTest.php index c9a530f0..6aa2a463 100644 --- a/tests/Unit/Api/User/ListLoginsTest.php +++ b/tests/Unit/Api/User/ListLoginsTest.php @@ -17,7 +17,7 @@ class ListLoginsTest extends TestCase * @dataProvider getListLoginsData */ #[DataProvider('getListLoginsData')] - public function testListLoginsReturnsCorrectResponse($expectedPath, $responseCode, $response, $expectedResponse): void + public function testListLoginsReturnsCorrectResponse(string $expectedPath, int $responseCode, string $response, array $expectedResponse): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/User/RemoveTest.php b/tests/Unit/Api/User/RemoveTest.php index 84ae9967..ed20489c 100644 --- a/tests/Unit/Api/User/RemoveTest.php +++ b/tests/Unit/Api/User/RemoveTest.php @@ -15,7 +15,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($id, $expectedPath, $responseCode, $response): void + public function testRemoveReturnsCorrectResponse(int $id, string $expectedPath, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/User/ShowTest.php b/tests/Unit/Api/User/ShowTest.php index e872c025..eb4fbfcf 100644 --- a/tests/Unit/Api/User/ShowTest.php +++ b/tests/Unit/Api/User/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($userId, array $params, $expectedPath, $response, $expectedReturn): void + public function testShowReturnsCorrectResponse($userId, array $params, string $expectedPath, string $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/User/UpdateTest.php b/tests/Unit/Api/User/UpdateTest.php index 32d0a66a..7d1d2df6 100644 --- a/tests/Unit/Api/User/UpdateTest.php +++ b/tests/Unit/Api/User/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testUpdateReturnsCorrectResponse(int $id, array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/UserTest.php b/tests/Unit/Api/UserTest.php index 5eec179c..b76f8176 100644 --- a/tests/Unit/Api/UserTest.php +++ b/tests/Unit/Api/UserTest.php @@ -142,7 +142,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponse(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Api/Version/CreateTest.php b/tests/Unit/Api/Version/CreateTest.php index 9c8428b3..7632e805 100644 --- a/tests/Unit/Api/Version/CreateTest.php +++ b/tests/Unit/Api/Version/CreateTest.php @@ -19,7 +19,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($identifier, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testCreateReturnsCorrectResponse(int $identifier, array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Version/ListNamesByProjectTest.php b/tests/Unit/Api/Version/ListNamesByProjectTest.php index ea343ef1..2281727a 100644 --- a/tests/Unit/Api/Version/ListNamesByProjectTest.php +++ b/tests/Unit/Api/Version/ListNamesByProjectTest.php @@ -21,7 +21,7 @@ class ListNamesByProjectTest extends TestCase * @dataProvider getListNamesByProjectData */ #[DataProvider('getListNamesByProjectData')] - public function testListNamesByProjectReturnsCorrectResponse($projectIdentifier, $expectedPath, $responseCode, $response, $expectedResponse): void + public function testListNamesByProjectReturnsCorrectResponse($projectIdentifier, string $expectedPath, int $responseCode, string $response, array $expectedResponse): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Version/RemoveTest.php b/tests/Unit/Api/Version/RemoveTest.php index 2fe1c212..b9b3f9bc 100644 --- a/tests/Unit/Api/Version/RemoveTest.php +++ b/tests/Unit/Api/Version/RemoveTest.php @@ -15,7 +15,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($id, $expectedPath, $responseCode, $response): void + public function testRemoveReturnsCorrectResponse($id, string $expectedPath, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Version/ShowTest.php b/tests/Unit/Api/Version/ShowTest.php index 73da9055..1cc98cbd 100644 --- a/tests/Unit/Api/Version/ShowTest.php +++ b/tests/Unit/Api/Version/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($version, $expectedPath, $response, $expectedReturn): void + public function testShowReturnsCorrectResponse($version, string $expectedPath, string $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Version/UpdateTest.php b/tests/Unit/Api/Version/UpdateTest.php index 5b55302e..60253ded 100644 --- a/tests/Unit/Api/Version/UpdateTest.php +++ b/tests/Unit/Api/Version/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testUpdateReturnsCorrectResponse(int $id, array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/VersionTest.php b/tests/Unit/Api/VersionTest.php index 48033fab..1ab3fd59 100644 --- a/tests/Unit/Api/VersionTest.php +++ b/tests/Unit/Api/VersionTest.php @@ -46,7 +46,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponse(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); @@ -342,11 +342,9 @@ function ($errno, $errstr): bool { * Test validateSharing(). * * @dataProvider invalidSharingProvider - * - * @param string $sharingValue */ #[DataProvider('invalidSharingProvider')] - public function testCreateThrowsExceptionWithInvalidSharing($sharingValue): void + public function testCreateThrowsExceptionWithInvalidSharing(string $sharingValue): void { // Test values $parameters = [ diff --git a/tests/Unit/Api/Wiki/CreateTest.php b/tests/Unit/Api/Wiki/CreateTest.php index ebf9eda3..0bb30561 100644 --- a/tests/Unit/Api/Wiki/CreateTest.php +++ b/tests/Unit/Api/Wiki/CreateTest.php @@ -18,7 +18,7 @@ class CreateTest extends TestCase * @dataProvider getCreateData */ #[DataProvider('getCreateData')] - public function testCreateReturnsCorrectResponse($id, $page, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testCreateReturnsCorrectResponse(int $id, string $page, array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Wiki/RemoveTest.php b/tests/Unit/Api/Wiki/RemoveTest.php index 51bb3019..981d6462 100644 --- a/tests/Unit/Api/Wiki/RemoveTest.php +++ b/tests/Unit/Api/Wiki/RemoveTest.php @@ -17,7 +17,7 @@ class RemoveTest extends TestCase * @dataProvider getRemoveData */ #[DataProvider('getRemoveData')] - public function testRemoveReturnsCorrectResponse($id, $page, $expectedPath, $responseCode, $response): void + public function testRemoveReturnsCorrectResponse(int $id, string $page, string $expectedPath, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Wiki/ShowTest.php b/tests/Unit/Api/Wiki/ShowTest.php index 75ef788e..3ab8a1a4 100644 --- a/tests/Unit/Api/Wiki/ShowTest.php +++ b/tests/Unit/Api/Wiki/ShowTest.php @@ -15,7 +15,7 @@ class ShowTest extends TestCase * @dataProvider getShowData */ #[DataProvider('getShowData')] - public function testShowReturnsCorrectResponse($identifier, $page, $version, $expectedPath, $response, $expectedReturn): void + public function testShowReturnsCorrectResponse($identifier, string $page, ?int $version, string $expectedPath, string $response, $expectedReturn): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/Wiki/UpdateTest.php b/tests/Unit/Api/Wiki/UpdateTest.php index 923012d2..23126761 100644 --- a/tests/Unit/Api/Wiki/UpdateTest.php +++ b/tests/Unit/Api/Wiki/UpdateTest.php @@ -17,7 +17,7 @@ class UpdateTest extends TestCase * @dataProvider getUpdateData */ #[DataProvider('getUpdateData')] - public function testUpdateReturnsCorrectResponse($id, $page, $parameters, $expectedPath, $expectedBody, $responseCode, $response): void + public function testUpdateReturnsCorrectResponse(int $id, string $page, array $parameters, string $expectedPath, string $expectedBody, int $responseCode, string $response): void { $client = AssertingHttpClient::create( $this, diff --git a/tests/Unit/Api/WikiTest.php b/tests/Unit/Api/WikiTest.php index 9c487efa..ff907bf4 100644 --- a/tests/Unit/Api/WikiTest.php +++ b/tests/Unit/Api/WikiTest.php @@ -45,7 +45,7 @@ function ($errno, $errstr): bool { * @dataProvider getAllData */ #[DataProvider('getAllData')] - public function testAllReturnsClientGetResponse($response, $responseType, $expectedResponse): void + public function testAllReturnsClientGetResponse(string $response, string $responseType, $expectedResponse): void { // Create the used mock objects $client = $this->createMock(Client::class); diff --git a/tests/Unit/Client/NativeCurlClient/RequestTest.php b/tests/Unit/Client/NativeCurlClient/RequestTest.php index 05c25177..869c9e59 100644 --- a/tests/Unit/Client/NativeCurlClient/RequestTest.php +++ b/tests/Unit/Client/NativeCurlClient/RequestTest.php @@ -20,7 +20,7 @@ class RequestTest extends TestCase * @dataProvider getRequestReponseData */ #[DataProvider('getRequestReponseData')] - public function testRequestReturnsCorrectResponse($method, $data, $statusCode, $contentType, $content): void + public function testRequestReturnsCorrectResponse(string $method, string $data, int $statusCode, string $contentType, string $content): void { $namespace = 'Redmine\Client'; @@ -32,7 +32,7 @@ public function testRequestReturnsCorrectResponse($method, $data, $statusCode, $ $curlExec = $this->getFunctionMock($namespace, 'curl_exec'); $curlExec->expects($this->exactly(1))->willReturn($content); - $curlSetoptArray = $this->getFunctionMock($namespace, 'curl_setopt_array'); + $this->getFunctionMock($namespace, 'curl_setopt_array'); $curlGetinfo = $this->getFunctionMock($namespace, 'curl_getinfo'); $curlGetinfo->expects($this->exactly(2))->willReturnMap(([ @@ -43,7 +43,7 @@ public function testRequestReturnsCorrectResponse($method, $data, $statusCode, $ $curlErrno = $this->getFunctionMock($namespace, 'curl_errno'); $curlErrno->expects($this->exactly(1))->willReturn(CURLE_OK); - $curlClose = $this->getFunctionMock($namespace, 'curl_close'); + $this->getFunctionMock($namespace, 'curl_close'); $client = new NativeCurlClient( 'http://test.local', @@ -105,7 +105,7 @@ public function testRequestWithUploadAndFilepathReturnsCorrectResponse(): void $curlExec = $this->getFunctionMock($namespace, 'curl_exec'); $curlExec->expects($this->exactly(1))->willReturn('{"upload":{}}'); - $curlSetoptArray = $this->getFunctionMock($namespace, 'curl_setopt_array'); + $this->getFunctionMock($namespace, 'curl_setopt_array'); $curlGetinfo = $this->getFunctionMock($namespace, 'curl_getinfo'); $curlGetinfo->expects($this->exactly(2))->willReturnMap(([ @@ -116,7 +116,7 @@ public function testRequestWithUploadAndFilepathReturnsCorrectResponse(): void $curlErrno = $this->getFunctionMock($namespace, 'curl_errno'); $curlErrno->expects($this->exactly(1))->willReturn(CURLE_OK); - $curlClose = $this->getFunctionMock($namespace, 'curl_close'); + $this->getFunctionMock($namespace, 'curl_close'); $client = new NativeCurlClient( 'http://test.local', diff --git a/tests/Unit/Client/NativeCurlClientTest.php b/tests/Unit/Client/NativeCurlClientTest.php index c229db48..139e8f0d 100644 --- a/tests/Unit/Client/NativeCurlClientTest.php +++ b/tests/Unit/Client/NativeCurlClientTest.php @@ -204,7 +204,7 @@ public function testStartAndStopImpersonateUser(): void $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(3))->willReturn(0); - $curlClose = $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); $client = new NativeCurlClient( 'http://test.local', @@ -259,7 +259,7 @@ public function testSetSslVersion(): void $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(3))->willReturn(0); - $curlClose = $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); $client = new NativeCurlClient( 'http://test.local', @@ -315,7 +315,7 @@ public function testSetSslVerifypeer(): void $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(3))->willReturn(0); - $curlClose = $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); $client = new NativeCurlClient( 'http://test.local', @@ -371,7 +371,7 @@ public function testSetSslVerifyhost(): void $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(3))->willReturn(0); - $curlClose = $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); $client = new NativeCurlClient( 'http://test.local', @@ -428,7 +428,7 @@ public function testSetCustomHttpHeaders(): void $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(3))->willReturn(0); - $curlClose = $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); $client = new NativeCurlClient( 'http://test.local', @@ -489,7 +489,7 @@ public function testSetCustomHost(): void $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(3))->willReturn(0); - $curlClose = $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); $client = new NativeCurlClient( 'http://test.local', @@ -546,7 +546,7 @@ public function testSetPort(): void $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(3))->willReturn(0); - $curlClose = $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); $client = new NativeCurlClient( 'http://test.local', @@ -600,7 +600,7 @@ public function testCustomPortWillSetFromSchema(): void $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(1))->willReturn(0); - $curlClose = $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); $client = new NativeCurlClient( 'https://test.local', @@ -650,7 +650,7 @@ public function testCustomPortWillSetFromUrl(): void $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(1))->willReturn(0); - $curlClose = $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); $client = new NativeCurlClient( 'http://test.local:3456', @@ -664,7 +664,7 @@ public function testCustomPortWillSetFromUrl(): void * @dataProvider getRequestReponseData */ #[DataProvider('getRequestReponseData')] - public function testRequestsReturnsCorrectContent($method, $data, $boolReturn, $statusCode, $contentType, $content): void + public function testRequestsReturnsCorrectContent(string $method, string $data, bool $boolReturn, int $statusCode, string $contentType, string $content): void { $curl = $this->createMock(stdClass::class); @@ -674,7 +674,7 @@ public function testRequestsReturnsCorrectContent($method, $data, $boolReturn, $ $curlExec = $this->getFunctionMock(self::__NAMESPACE__, 'curl_exec'); $curlExec->expects($this->exactly(1))->willReturn($content); - $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); $curlGetinfo->expects($this->exactly(2))->willReturnMap(([ @@ -685,7 +685,7 @@ public function testRequestsReturnsCorrectContent($method, $data, $boolReturn, $ $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(1))->willReturn(CURLE_OK); - $curlClose = $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); $client = new NativeCurlClient( 'http://test.local', @@ -726,23 +726,17 @@ public static function getRequestReponseData(): array public function testRequestGetTriggersDeprecationWarning(): void { - $curl = $this->createMock(stdClass::class); - - $curlInit = $this->getFunctionMock(self::__NAMESPACE__, 'curl_init'); - - $curlExec = $this->getFunctionMock(self::__NAMESPACE__, 'curl_exec'); - - $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); - - $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); - + $this->getFunctionMock(self::__NAMESPACE__, 'curl_init'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_exec'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(1))->willReturn(CURLE_COULDNT_CONNECT); $curlError = $this->getFunctionMock(self::__NAMESPACE__, 'curl_error'); $curlError->expects($this->exactly(1))->willReturn(''); - $curlClose = $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); $client = new NativeCurlClient( 'http://test.local', @@ -771,23 +765,17 @@ function ($errno, $errstr): bool { public function testRequestPostTriggersDeprecationWarning(): void { - $curl = $this->createMock(stdClass::class); - - $curlInit = $this->getFunctionMock(self::__NAMESPACE__, 'curl_init'); - - $curlExec = $this->getFunctionMock(self::__NAMESPACE__, 'curl_exec'); - - $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); - - $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); - + $this->getFunctionMock(self::__NAMESPACE__, 'curl_init'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_exec'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(1))->willReturn(CURLE_COULDNT_CONNECT); $curlError = $this->getFunctionMock(self::__NAMESPACE__, 'curl_error'); $curlError->expects($this->exactly(1))->willReturn(''); - $curlClose = $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); $client = new NativeCurlClient( 'http://test.local', @@ -816,23 +804,17 @@ function ($errno, $errstr): bool { public function testRequestPutTriggersDeprecationWarning(): void { - $curl = $this->createMock(stdClass::class); - - $curlInit = $this->getFunctionMock(self::__NAMESPACE__, 'curl_init'); - - $curlExec = $this->getFunctionMock(self::__NAMESPACE__, 'curl_exec'); - - $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); - - $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); - + $this->getFunctionMock(self::__NAMESPACE__, 'curl_init'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_exec'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(1))->willReturn(CURLE_COULDNT_CONNECT); $curlError = $this->getFunctionMock(self::__NAMESPACE__, 'curl_error'); $curlError->expects($this->exactly(1))->willReturn(''); - $curlClose = $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); $client = new NativeCurlClient( 'http://test.local', @@ -861,23 +843,17 @@ function ($errno, $errstr): bool { public function testRequestDeleteTriggersDeprecationWarning(): void { - $curl = $this->createMock(stdClass::class); - - $curlInit = $this->getFunctionMock(self::__NAMESPACE__, 'curl_init'); - - $curlExec = $this->getFunctionMock(self::__NAMESPACE__, 'curl_exec'); - - $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); - - $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); - + $this->getFunctionMock(self::__NAMESPACE__, 'curl_init'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_exec'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(1))->willReturn(CURLE_COULDNT_CONNECT); $curlError = $this->getFunctionMock(self::__NAMESPACE__, 'curl_error'); $curlError->expects($this->exactly(1))->willReturn(''); - $curlClose = $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); $client = new NativeCurlClient( 'http://test.local', @@ -918,7 +894,7 @@ public function testHandlingOfResponseWithoutContent(): void $curlExec = $this->getFunctionMock(self::__NAMESPACE__, 'curl_exec'); $curlExec->expects($this->exactly(1))->willReturn(''); - $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); $curlGetinfo = $this->getFunctionMock(self::__NAMESPACE__, 'curl_getinfo'); $curlGetinfo->expects($this->exactly(2))->willReturnMap(([ @@ -929,7 +905,7 @@ public function testHandlingOfResponseWithoutContent(): void $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(1))->willReturn(CURLE_OK); - $curlClose = $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); $client = new NativeCurlClient( 'http://test.local', @@ -952,7 +928,7 @@ public function testCurlErrorThrowsException(): void $curlExec = $this->getFunctionMock(self::__NAMESPACE__, 'curl_exec'); $curlExec->expects($this->exactly(1))->willReturn(false); - $curlSetoptArray = $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_setopt_array'); $curlErrno = $this->getFunctionMock(self::__NAMESPACE__, 'curl_errno'); $curlErrno->expects($this->exactly(1))->willReturn(CURLE_URL_MALFORMAT); @@ -960,7 +936,7 @@ public function testCurlErrorThrowsException(): void $curlError = $this->getFunctionMock(self::__NAMESPACE__, 'curl_error'); $curlError->expects($this->exactly(1))->willReturn('cURL error 3: malformed'); - $curlClose = $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); + $this->getFunctionMock(self::__NAMESPACE__, 'curl_close'); $client = new NativeCurlClient( 'http://test.local', @@ -990,25 +966,25 @@ public function testGetApiShouldReturnApiInstance(string $apiName, string $class public static function getApiClassesProvider(): array { return [ - ['attachment', 'Redmine\Api\Attachment'], - ['group', 'Redmine\Api\Group'], - ['custom_fields', 'Redmine\Api\CustomField'], - ['issue', 'Redmine\Api\Issue'], - ['issue_category', 'Redmine\Api\IssueCategory'], - ['issue_priority', 'Redmine\Api\IssuePriority'], - ['issue_relation', 'Redmine\Api\IssueRelation'], - ['issue_status', 'Redmine\Api\IssueStatus'], - ['membership', 'Redmine\Api\Membership'], - ['news', 'Redmine\Api\News'], - ['project', 'Redmine\Api\Project'], - ['query', 'Redmine\Api\Query'], - ['role', 'Redmine\Api\Role'], - ['time_entry', 'Redmine\Api\TimeEntry'], - ['time_entry_activity', 'Redmine\Api\TimeEntryActivity'], - ['tracker', 'Redmine\Api\Tracker'], - ['user', 'Redmine\Api\User'], - ['version', 'Redmine\Api\Version'], - ['wiki', 'Redmine\Api\Wiki'], + ['attachment', \Redmine\Api\Attachment::class], + ['group', \Redmine\Api\Group::class], + ['custom_fields', \Redmine\Api\CustomField::class], + ['issue', \Redmine\Api\Issue::class], + ['issue_category', \Redmine\Api\IssueCategory::class], + ['issue_priority', \Redmine\Api\IssuePriority::class], + ['issue_relation', \Redmine\Api\IssueRelation::class], + ['issue_status', \Redmine\Api\IssueStatus::class], + ['membership', \Redmine\Api\Membership::class], + ['news', \Redmine\Api\News::class], + ['project', \Redmine\Api\Project::class], + ['query', \Redmine\Api\Query::class], + ['role', \Redmine\Api\Role::class], + ['time_entry', \Redmine\Api\TimeEntry::class], + ['time_entry_activity', \Redmine\Api\TimeEntryActivity::class], + ['tracker', \Redmine\Api\Tracker::class], + ['user', \Redmine\Api\User::class], + ['version', \Redmine\Api\Version::class], + ['wiki', \Redmine\Api\Wiki::class], ]; } diff --git a/tests/Unit/Client/Psr18Client/RequestTest.php b/tests/Unit/Client/Psr18Client/RequestTest.php index af0ab4f0..4062e1dd 100644 --- a/tests/Unit/Client/Psr18Client/RequestTest.php +++ b/tests/Unit/Client/Psr18Client/RequestTest.php @@ -25,7 +25,7 @@ class RequestTest extends TestCase * @dataProvider getRequestReponseData */ #[DataProvider('getRequestReponseData')] - public function testRequestReturnsCorrectResponse($method, $data, $statusCode, $contentType, $content): void + public function testRequestReturnsCorrectResponse(string $method, string $data, int $statusCode, string $contentType, string $content): void { $httpClient = $this->createConfiguredMock(ClientInterface::class, [ 'sendRequest' => $this->createConfiguredMock(ResponseInterface::class, [ diff --git a/tests/Unit/Client/Psr18ClientTest.php b/tests/Unit/Client/Psr18ClientTest.php index 472cf458..03332b9c 100644 --- a/tests/Unit/Client/Psr18ClientTest.php +++ b/tests/Unit/Client/Psr18ClientTest.php @@ -257,7 +257,7 @@ public function testRequestGetReturnsFalse(): void * @dataProvider getRequestReponseData */ #[DataProvider('getRequestReponseData')] - public function testRequestsReturnsCorrectContent($method, $data, $boolReturn, $statusCode, $contentType, $content): void + public function testRequestsReturnsCorrectContent(string $method, string $data, bool $boolReturn, int $statusCode, string $contentType, string $content): void { $stream = $this->createMock(StreamInterface::class); $stream->method('__toString')->willReturn($content); @@ -477,25 +477,25 @@ public function testGetApiShouldReturnApiInstance(string $apiName, string $class public static function getApiClassesProvider(): array { return [ - ['attachment', 'Redmine\Api\Attachment'], - ['group', 'Redmine\Api\Group'], - ['custom_fields', 'Redmine\Api\CustomField'], - ['issue', 'Redmine\Api\Issue'], - ['issue_category', 'Redmine\Api\IssueCategory'], - ['issue_priority', 'Redmine\Api\IssuePriority'], - ['issue_relation', 'Redmine\Api\IssueRelation'], - ['issue_status', 'Redmine\Api\IssueStatus'], - ['membership', 'Redmine\Api\Membership'], - ['news', 'Redmine\Api\News'], - ['project', 'Redmine\Api\Project'], - ['query', 'Redmine\Api\Query'], - ['role', 'Redmine\Api\Role'], - ['time_entry', 'Redmine\Api\TimeEntry'], - ['time_entry_activity', 'Redmine\Api\TimeEntryActivity'], - ['tracker', 'Redmine\Api\Tracker'], - ['user', 'Redmine\Api\User'], - ['version', 'Redmine\Api\Version'], - ['wiki', 'Redmine\Api\Wiki'], + ['attachment', \Redmine\Api\Attachment::class], + ['group', \Redmine\Api\Group::class], + ['custom_fields', \Redmine\Api\CustomField::class], + ['issue', \Redmine\Api\Issue::class], + ['issue_category', \Redmine\Api\IssueCategory::class], + ['issue_priority', \Redmine\Api\IssuePriority::class], + ['issue_relation', \Redmine\Api\IssueRelation::class], + ['issue_status', \Redmine\Api\IssueStatus::class], + ['membership', \Redmine\Api\Membership::class], + ['news', \Redmine\Api\News::class], + ['project', \Redmine\Api\Project::class], + ['query', \Redmine\Api\Query::class], + ['role', \Redmine\Api\Role::class], + ['time_entry', \Redmine\Api\TimeEntry::class], + ['time_entry_activity', \Redmine\Api\TimeEntryActivity::class], + ['tracker', \Redmine\Api\Tracker::class], + ['user', \Redmine\Api\User::class], + ['version', \Redmine\Api\Version::class], + ['wiki', \Redmine\Api\Wiki::class], ]; } @@ -504,7 +504,7 @@ public function testCreateWithoutFactoryThrowsException(): void $this->expectException(Exception::class); $this->expectExceptionMessage('Redmine\Client\Psr18Client::__construct(): Argument #2 ($requestFactory) must be of type Psr\Http\Message\RequestFactoryInterface'); - $client = new Psr18Client( + new Psr18Client( $this->createMock(ClientInterface::class), /** @phpstan-ignore-next-line We are providing an invalid parameter to test the exception */ new stdClass(), diff --git a/tests/Unit/Serializer/JsonSerializerTest.php b/tests/Unit/Serializer/JsonSerializerTest.php index 81f7df7c..7eecbff4 100644 --- a/tests/Unit/Serializer/JsonSerializerTest.php +++ b/tests/Unit/Serializer/JsonSerializerTest.php @@ -93,7 +93,7 @@ public function testCreateFromStringWithInvalidStringThrowsException(string $mes $this->expectException(SerializerException::class); $this->expectExceptionMessage($message); - $serializer = JsonSerializer::createFromString($data); + JsonSerializer::createFromString($data); } public static function getNormalizedToEncodedData(): array @@ -184,7 +184,7 @@ public static function getNormalizedToEncodedData(): array * @dataProvider getNormalizedToEncodedData */ #[DataProvider('getNormalizedToEncodedData')] - public function testCreateFromArrayEncodesToExpectedString(array $data, $expected): void + public function testCreateFromArrayEncodesToExpectedString(array $data, string $expected): void { $serializer = JsonSerializer::createFromArray($data); @@ -210,6 +210,6 @@ public function testCreateFromArrayWithInvalidDataThrowsException(string $messag $this->expectException(SerializerException::class); $this->expectExceptionMessage($message); - $serializer = JsonSerializer::createFromArray($data); + JsonSerializer::createFromArray($data); } } diff --git a/tests/Unit/Serializer/XmlSerializerTest.php b/tests/Unit/Serializer/XmlSerializerTest.php index cc077070..f4089d11 100644 --- a/tests/Unit/Serializer/XmlSerializerTest.php +++ b/tests/Unit/Serializer/XmlSerializerTest.php @@ -17,7 +17,7 @@ class XmlSerializerTest extends TestCase * @dataProvider getEncodedToNormalizedData */ #[DataProvider('getEncodedToNormalizedData')] - public function testCreateFromStringDecodesToExpectedNormalizedData(string $data, $expected): void + public function testCreateFromStringDecodesToExpectedNormalizedData(string $data, array $expected): void { $serializer = XmlSerializer::createFromString($data); @@ -115,7 +115,7 @@ public static function getInvalidEncodedData(): array * @dataProvider getNormalizedToEncodedData */ #[DataProvider('getNormalizedToEncodedData')] - public function testCreateFromArrayEncodesToExpectedString(array $data, $expected): void + public function testCreateFromArrayEncodesToExpectedString(array $data, string $expected): void { $serializer = XmlSerializer::createFromArray($data);