Skip to content

Commit 8f0d1ce

Browse files
committed
- update phpstan 's run level to 3
- fixed #332 phpstan warning
1 parent 583f93a commit 8f0d1ce

24 files changed

+144
-96
lines changed

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,11 @@ jobs:
2424
env: TYPE=phpstan
2525
script:
2626
- vendor/bin/phpstan analyse
27+
- php: 7.2
28+
env: TYPE=phpstan
29+
script:
30+
- vendor/bin/phpstan analyse
31+
- php: 7.3
32+
env: TYPE=phpstan
33+
script:
34+
- vendor/bin/phpstan analyse

phpstan-baseline.neon

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
11
parameters:
2-
ignoreErrors:
3-
-
4-
message: "#^Static method Dotenv\\\\Dotenv\\:\\:create\\(\\) invoked with 1 parameter, 2\\-4 required\\.$#"
5-
count: 1
6-
path: src/Configuration/DotEnvConfiguration.php
2+
ignoreErrors:
3+
-
4+
message: "#^Static method Dotenv\\\\Dotenv\\:\\:create\\(\\) invoked with 1 parameter, 2\\-4 required\\.$#"
5+
count: 1
6+
path: src/Configuration/DotEnvConfiguration.php
77

8-
-
9-
message: "#^Class Dotenv\\\\Dotenv constructor invoked with 1 parameter, 3 required\\.$#"
10-
count: 1
11-
path: src/Configuration/DotEnvConfiguration.php
8+
-
9+
message: "#^Class Dotenv\\\\Dotenv constructor invoked with 1 parameter, 3 required\\.$#"
10+
count: 1
11+
path: src/Configuration/DotEnvConfiguration.php
12+
-
13+
message: "#^Call to an undefined method Monolog\\\\Logger::addInfo\\(\\)\\.$#"
14+
count: 2
15+
path: src/Issue/IssueService.php
16+
-
17+
message: "#^Property JiraRestApi\\\\Issue\\\\IssueField::\\$duedate \\(DateTimeInterface|null\\) does not accept string\\.$#"
18+
count: 1
19+
path: src/Issue/IssueField.php
20+
-
21+
message: "#^Cannot access offset 'key' on JiraRestApi\\\\Issue\\\\Issue\\.$#"
22+
count: 2
23+
path: src/IssueLink/IssueLink.php
24+
-
25+
message: "#^Property JiraRestApi\\\\Issue\\\\Version::\\$releaseDate \\(DateTimeInterface|null\\) does not accept string\\.$#"
26+
count: 1
27+
path: src/Version/VersionService.php
28+
-
29+
message: "#^Property JiraRestApi\\\\JiraClient::\\$log \\(Monolog\\\\Logger\\) does not accept Psr\\\\Log\\\\LoggerInterface\\.$#"
30+
count: 1
31+
path: src/JiraClient.php

phpstan.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ includes:
22
- phpstan-baseline.neon
33

44
parameters:
5-
level: 1
5+
level: 3
66
paths:
77
- src
88
excludes_analyse:

src/Attachment/AttachmentService.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class AttachmentService extends \JiraRestApi\JiraClient
1414
/**
1515
* Returns the meta-data for an attachment, including the URI of the actual attached file.
1616
*
17-
* @param $id string|int attachment Id
17+
* @param string|int $id attachment Id
1818
* @outDir string downloads the content and store into outDir
1919
* @overwrite boolean determines whether to overwrite the file if it already exists.
2020
* @mode int outDir creation mode.
@@ -60,11 +60,11 @@ public function get($id, $outDir = null, $overwrite = false, $mode = 0777, $recu
6060
/**
6161
* Remove an attachment from an issue.
6262
*
63-
* @param $id string|int attachment id
63+
* @param string|int $id attachment id
6464
*
6565
* @throws \JiraRestApi\JiraException
6666
*
67-
* @return bool
67+
* @return string
6868
*/
6969
public function remove($id)
7070
{

src/Auth/AuthService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ class AuthService extends \JiraRestApi\JiraClient
1212
private $uri = 'session';
1313

1414
/**
15-
* @var string
15+
* @var string|null
1616
*/
1717
private $_sessionCookieName;
1818

1919
/**
20-
* @var string
20+
* @var string|null
2121
*/
2222
private $_sessionCookieValue;
2323

src/Component/Component.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ class Component implements \JsonSerializable
2323
*/
2424
public $self;
2525

26+
/** @var string */
27+
public $id;
28+
2629
/**
2730
* @var string
2831
*/

src/Component/ComponentService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function create($component)
3535
/**
3636
* get component.
3737
*
38-
* @param $id component id
38+
* @param string|int $id component id
3939
*
4040
* @return Component
4141
*/
@@ -79,7 +79,7 @@ public function update(Component $component)
7979
*
8080
* @throws JiraException
8181
*
82-
* @return bool
82+
* @return string
8383
*/
8484
public function delete(Component $component, $moveIssuesTo = false)
8585
{

src/Configuration/AbstractConfiguration.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,18 @@ abstract class AbstractConfiguration implements ConfigurationInterface
133133
*/
134134
protected $useV3RestApi;
135135

136+
/** @var string */
137+
protected $curlOptSslCert;
138+
139+
/** @var string */
140+
protected $curlOptSslCertPassword;
141+
142+
/** @var string */
143+
protected $curlOptSslKey;
144+
145+
/** @var string */
146+
protected $curlOptSslKeyPassword;
147+
136148
/**
137149
* @return string
138150
*/
@@ -256,7 +268,7 @@ public function getOAuthAccessToken()
256268
}
257269

258270
/**
259-
* @return string
271+
* @return bool
260272
*/
261273
public function isCookieAuthorizationEnabled()
262274
{

src/Configuration/DotEnvConfiguration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ public function endsWith($haystack, $needles)
125125
/**
126126
* load dotenv.
127127
*
128-
* @param $path
128+
* @param string $path
129129
*
130130
* @throws JiraException
131131
*/
132-
private function loadDotEnv($path)
132+
private function loadDotEnv(string $path)
133133
{
134134
$requireParam = [
135135
'JIRA_HOST', 'JIRA_USER', 'JIRA_PASS',

src/Field/Field.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ public function setDescription($description)
4747
*
4848
* @see https://confluence.atlassian.com/jira064/changing-custom-field-types-720415917.html
4949
*
50-
* @param $type
50+
* @param string $type
5151
*
5252
* @return $this
5353
*/
54-
public function setType($type)
54+
public function setType(string $type)
5555
{
5656
$this->type = $type;
5757

@@ -61,11 +61,11 @@ public function setType($type)
6161
/**
6262
* atlassian supplied poor documentation.
6363
*
64-
* @param $searcherKey
64+
* @param string $searcherKey
6565
*
6666
* @return $this
6767
*/
68-
public function setSearcherKey($searcherKey)
68+
public function setSearcherKey(string $searcherKey)
6969
{
7070
$this->searcherKey = $searcherKey;
7171

@@ -96,6 +96,7 @@ public function setSearcherKey($searcherKey)
9696
/* @var boolean */
9797
public $searchable;
9898

99+
/** @var string */
99100
public $searcherKey;
100101

101102
/**

0 commit comments

Comments
 (0)