Skip to content

Commit 9dab329

Browse files
committed
Ativando phpstan para outras versões do php
1 parent e20916d commit 9dab329

7 files changed

+344
-1
lines changed

.github/workflows/ci.yml

+10
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ jobs:
4040
run: |
4141
composer stan
4242
43+
- name: Análises estáticas PHP 8.0
44+
if: matrix.php-version == '8.0'
45+
run: |
46+
composer stan80
47+
48+
- name: Análises estáticas PHP 8.1
49+
if: matrix.php-version == '8.1'
50+
run: |
51+
composer stan81
52+
4353
- name: Rodando PHPUnit
4454
run: |
4555
composer test

composer.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
"test": "phpunit",
6969
"phpcs": "./vendor/bin/phpcs src/",
7070
"phpcbf": "./vendor/bin/phpcbf src/",
71-
"stan": "phpstan analyse src/"
71+
"stan": "phpstan analyse src/",
72+
"stan80": "phpstan analyse src/ -c phpstan80.neon",
73+
"stan81": "phpstan analyse src/ -c phpstan81.neon"
7274
}
7375
}

phpstan-baseline80.neon

+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Unsafe usage of new static\\(\\)\\.$#"
5+
count: 1
6+
path: src/Certificate.php
7+
8+
-
9+
message: "#^Binary operation \"\\*\" between 40 and string results in an error\\.$#"
10+
count: 1
11+
path: src/Certificate/Asn1.php
12+
13+
-
14+
message: "#^Parameter \\#2 \\$qIn of static method NFePHP\\\\Common\\\\Certificate\\\\Asn1\\:\\:xBase128\\(\\) expects int, float given\\.$#"
15+
count: 1
16+
path: src/Certificate/Asn1.php
17+
18+
-
19+
message: "#^Unsafe usage of new static\\(\\)\\.$#"
20+
count: 1
21+
path: src/Certificate/PublicKey.php
22+
23+
-
24+
message: "#^Method NFePHP\\\\Common\\\\DOMImproved\\:\\:loadXMLFile\\(\\) should return bool but return statement is missing\\.$#"
25+
count: 1
26+
path: src/DOMImproved.php
27+
28+
-
29+
message: "#^Unsafe usage of new static\\(\\)\\.$#"
30+
count: 5
31+
path: src/Exception/CertificateException.php
32+
33+
-
34+
message: "#^Unsafe usage of new static\\(\\)\\.$#"
35+
count: 4
36+
path: src/Exception/SignerException.php
37+
38+
-
39+
message: "#^Unsafe usage of new static\\(\\)\\.$#"
40+
count: 2
41+
path: src/Exception/SoapException.php
42+
43+
-
44+
message: "#^Unsafe usage of new static\\(\\)\\.$#"
45+
count: 2
46+
path: src/Exception/ValidatorException.php
47+
48+
-
49+
message: "#^Binary operation \"\\*\" between string and 2\\|3\\|4\\|5\\|6\\|7\\|8\\|9 results in an error\\.$#"
50+
count: 1
51+
path: src/Keys.php
52+
53+
-
54+
message: "#^Access to an undefined property SoapHeader\\:\\:\\$data\\.$#"
55+
count: 1
56+
path: src/Soap/SoapBase.php
57+
58+
-
59+
message: "#^Access to an undefined property SoapHeader\\:\\:\\$name\\.$#"
60+
count: 2
61+
path: src/Soap/SoapBase.php
62+
63+
-
64+
message: "#^Access to an undefined property SoapHeader\\:\\:\\$namespace\\.$#"
65+
count: 1
66+
path: src/Soap/SoapBase.php
67+
68+
-
69+
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
70+
count: 1
71+
path: src/Soap/SoapBase.php
72+
73+
-
74+
message: "#^Method NFePHP\\\\Common\\\\Files\\:\\:listContents\\(\\) invoked with 2 parameters, 0\\-1 required\\.$#"
75+
count: 1
76+
path: src/Soap/SoapBase.php
77+
78+
-
79+
message: "#^Method NFePHP\\\\Common\\\\Soap\\\\SoapBase\\:\\:randomName\\(\\) should return string but return statement is missing\\.$#"
80+
count: 1
81+
path: src/Soap/SoapBase.php
82+
83+
-
84+
message: "#^Method NFePHP\\\\Common\\\\Soap\\\\SoapBase\\:\\:uid\\(\\) should return string but returns int\\.$#"
85+
count: 1
86+
path: src/Soap/SoapBase.php
87+
88+
-
89+
message: "#^Method NFePHP\\\\Common\\\\Soap\\\\SoapBase\\:\\:uid\\(\\) should return string but returns int\\|false\\.$#"
90+
count: 1
91+
path: src/Soap/SoapBase.php
92+
93+
-
94+
message: "#^Parameter \\#8 \\$soapheader \\(null\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapBase\\:\\:send\\(\\) should be compatible with parameter \\$soapheader \\(SoapHeader\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapInterface\\:\\:send\\(\\)$#"
95+
count: 1
96+
path: src/Soap/SoapBase.php
97+
98+
-
99+
message: "#^Property NFePHP\\\\Common\\\\Soap\\\\SoapBase\\:\\:\\$filesystem \\(NFePHP\\\\Common\\\\Files\\) in empty\\(\\) is not falsy\\.$#"
100+
count: 2
101+
path: src/Soap/SoapBase.php
102+
103+
-
104+
message: "#^Parameter \\#5 \\$oneWay \\(int\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapClientExtended\\:\\:__doRequest\\(\\) should be compatible with parameter \\$oneWay \\(bool\\) of method SoapClient\\:\\:__doRequest\\(\\)$#"
105+
count: 1
106+
path: src/Soap/SoapClientExtended.php
107+
108+
-
109+
message: "#^Parameter \\#5 \\$oneWay of method SoapClient\\:\\:__doRequest\\(\\) expects bool, int given\\.$#"
110+
count: 1
111+
path: src/Soap/SoapClientExtended.php
112+
113+
-
114+
message: "#^Parameter \\#8 \\$soapheader \\(SoapHeader\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapCurl\\:\\:send\\(\\) should be compatible with parameter \\$soapheader \\(null\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapBase\\:\\:send\\(\\)$#"
115+
count: 1
116+
path: src/Soap/SoapCurl.php
117+
118+
-
119+
message: "#^Parameter \\#8 \\$soapheader \\(null\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapFake\\:\\:send\\(\\) should be compatible with parameter \\$soapheader \\(SoapHeader\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapInterface\\:\\:send\\(\\)$#"
120+
count: 1
121+
path: src/Soap/SoapFake.php
122+
123+
-
124+
message: "#^Parameter \\#8 \\$soapheader \\(SoapHeader\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapNative\\:\\:send\\(\\) should be compatible with parameter \\$soapheader \\(null\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapBase\\:\\:send\\(\\)$#"
125+
count: 1
126+
path: src/Soap/SoapNative.php
127+
128+
-
129+
message: "#^Static method NFePHP\\\\Common\\\\Exception\\\\SoapException\\:\\:soapFault\\(\\) invoked with 1 parameter, 2 required\\.$#"
130+
count: 4
131+
path: src/Soap/SoapNative.php
132+
133+
-
134+
message: "#^Access to an undefined property NFePHP\\\\Common\\\\Tags\\\\MakeBase\\:\\:\\$emit\\.$#"
135+
count: 2
136+
path: src/Tags/MakeBase.php
137+
138+
-
139+
message: "#^Access to an undefined property NFePHP\\\\Common\\\\Tags\\\\MakeBase\\:\\:\\$ide\\.$#"
140+
count: 10
141+
path: src/Tags/MakeBase.php
142+
143+
-
144+
message: "#^Access to an undefined property NFePHP\\\\Common\\\\Tags\\\\MakeBase\\:\\:\\$infnfe\\.$#"
145+
count: 2
146+
path: src/Tags/MakeBase.php
147+
148+
-
149+
message: "#^Parameter \\#2 \\$value of method NFePHP\\\\Common\\\\Tags\\\\MakeBase\\:\\:createProperty\\(\\) expects NFePHP\\\\Common\\\\Tags\\\\TagInterface, array given\\.$#"
150+
count: 1
151+
path: src/Tags/MakeBase.php
152+
153+
-
154+
message: "#^Undefined variable\\: \\$infId$#"
155+
count: 1
156+
path: src/Tags/MakeBase.php
157+
158+
-
159+
message: "#^Variable \\$value in isset\\(\\) always exists and is not nullable\\.$#"
160+
count: 1
161+
path: src/Tags/Tag.php
162+

phpstan-baseline81.neon

+152
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Unsafe usage of new static\\(\\)\\.$#"
5+
count: 1
6+
path: src/Certificate.php
7+
8+
-
9+
message: "#^Binary operation \"\\*\" between 40 and string results in an error\\.$#"
10+
count: 1
11+
path: src/Certificate/Asn1.php
12+
13+
-
14+
message: "#^Parameter \\#2 \\$qIn of static method NFePHP\\\\Common\\\\Certificate\\\\Asn1\\:\\:xBase128\\(\\) expects int, float given\\.$#"
15+
count: 1
16+
path: src/Certificate/Asn1.php
17+
18+
-
19+
message: "#^Unsafe usage of new static\\(\\)\\.$#"
20+
count: 1
21+
path: src/Certificate/PublicKey.php
22+
23+
-
24+
message: "#^Method NFePHP\\\\Common\\\\DOMImproved\\:\\:loadXMLFile\\(\\) should return bool but return statement is missing\\.$#"
25+
count: 1
26+
path: src/DOMImproved.php
27+
28+
-
29+
message: "#^Unsafe usage of new static\\(\\)\\.$#"
30+
count: 5
31+
path: src/Exception/CertificateException.php
32+
33+
-
34+
message: "#^Unsafe usage of new static\\(\\)\\.$#"
35+
count: 4
36+
path: src/Exception/SignerException.php
37+
38+
-
39+
message: "#^Unsafe usage of new static\\(\\)\\.$#"
40+
count: 2
41+
path: src/Exception/SoapException.php
42+
43+
-
44+
message: "#^Unsafe usage of new static\\(\\)\\.$#"
45+
count: 2
46+
path: src/Exception/ValidatorException.php
47+
48+
-
49+
message: "#^Binary operation \"\\*\" between string and 2\\|3\\|4\\|5\\|6\\|7\\|8\\|9 results in an error\\.$#"
50+
count: 1
51+
path: src/Keys.php
52+
53+
-
54+
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
55+
count: 1
56+
path: src/Soap/SoapBase.php
57+
58+
-
59+
message: "#^Method NFePHP\\\\Common\\\\Files\\:\\:listContents\\(\\) invoked with 2 parameters, 0\\-1 required\\.$#"
60+
count: 1
61+
path: src/Soap/SoapBase.php
62+
63+
-
64+
message: "#^Method NFePHP\\\\Common\\\\Soap\\\\SoapBase\\:\\:randomName\\(\\) should return string but return statement is missing\\.$#"
65+
count: 1
66+
path: src/Soap/SoapBase.php
67+
68+
-
69+
message: "#^Method NFePHP\\\\Common\\\\Soap\\\\SoapBase\\:\\:uid\\(\\) should return string but returns int\\.$#"
70+
count: 1
71+
path: src/Soap/SoapBase.php
72+
73+
-
74+
message: "#^Method NFePHP\\\\Common\\\\Soap\\\\SoapBase\\:\\:uid\\(\\) should return string but returns int\\|false\\.$#"
75+
count: 1
76+
path: src/Soap/SoapBase.php
77+
78+
-
79+
message: "#^Parameter \\#8 \\$soapheader \\(null\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapBase\\:\\:send\\(\\) should be compatible with parameter \\$soapheader \\(SoapHeader\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapInterface\\:\\:send\\(\\)$#"
80+
count: 1
81+
path: src/Soap/SoapBase.php
82+
83+
-
84+
message: "#^Property NFePHP\\\\Common\\\\Soap\\\\SoapBase\\:\\:\\$filesystem \\(NFePHP\\\\Common\\\\Files\\) in empty\\(\\) is not falsy\\.$#"
85+
count: 2
86+
path: src/Soap/SoapBase.php
87+
88+
-
89+
message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#"
90+
count: 1
91+
path: src/Soap/SoapBase.php
92+
93+
-
94+
message: "#^Parameter \\#5 \\$oneWay \\(int\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapClientExtended\\:\\:__doRequest\\(\\) should be compatible with parameter \\$oneWay \\(bool\\) of method SoapClient\\:\\:__doRequest\\(\\)$#"
95+
count: 1
96+
path: src/Soap/SoapClientExtended.php
97+
98+
-
99+
message: "#^Parameter \\#5 \\$oneWay of method SoapClient\\:\\:__doRequest\\(\\) expects bool, int given\\.$#"
100+
count: 1
101+
path: src/Soap/SoapClientExtended.php
102+
103+
-
104+
message: "#^Parameter \\#8 \\$soapheader \\(SoapHeader\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapCurl\\:\\:send\\(\\) should be compatible with parameter \\$soapheader \\(null\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapBase\\:\\:send\\(\\)$#"
105+
count: 1
106+
path: src/Soap/SoapCurl.php
107+
108+
-
109+
message: "#^Parameter \\#8 \\$soapheader \\(null\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapFake\\:\\:send\\(\\) should be compatible with parameter \\$soapheader \\(SoapHeader\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapInterface\\:\\:send\\(\\)$#"
110+
count: 1
111+
path: src/Soap/SoapFake.php
112+
113+
-
114+
message: "#^Parameter \\#8 \\$soapheader \\(SoapHeader\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapNative\\:\\:send\\(\\) should be compatible with parameter \\$soapheader \\(null\\) of method NFePHP\\\\Common\\\\Soap\\\\SoapBase\\:\\:send\\(\\)$#"
115+
count: 1
116+
path: src/Soap/SoapNative.php
117+
118+
-
119+
message: "#^Static method NFePHP\\\\Common\\\\Exception\\\\SoapException\\:\\:soapFault\\(\\) invoked with 1 parameter, 2 required\\.$#"
120+
count: 4
121+
path: src/Soap/SoapNative.php
122+
123+
-
124+
message: "#^Access to an undefined property NFePHP\\\\Common\\\\Tags\\\\MakeBase\\:\\:\\$emit\\.$#"
125+
count: 2
126+
path: src/Tags/MakeBase.php
127+
128+
-
129+
message: "#^Access to an undefined property NFePHP\\\\Common\\\\Tags\\\\MakeBase\\:\\:\\$ide\\.$#"
130+
count: 10
131+
path: src/Tags/MakeBase.php
132+
133+
-
134+
message: "#^Access to an undefined property NFePHP\\\\Common\\\\Tags\\\\MakeBase\\:\\:\\$infnfe\\.$#"
135+
count: 2
136+
path: src/Tags/MakeBase.php
137+
138+
-
139+
message: "#^Parameter \\#2 \\$value of method NFePHP\\\\Common\\\\Tags\\\\MakeBase\\:\\:createProperty\\(\\) expects NFePHP\\\\Common\\\\Tags\\\\TagInterface, array given\\.$#"
140+
count: 1
141+
path: src/Tags/MakeBase.php
142+
143+
-
144+
message: "#^Undefined variable\\: \\$infId$#"
145+
count: 1
146+
path: src/Tags/MakeBase.php
147+
148+
-
149+
message: "#^Variable \\$value in isset\\(\\) always exists and is not nullable\\.$#"
150+
count: 1
151+
path: src/Tags/Tag.php
152+

phpstan80.neon

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
includes:
2+
- phpstan-baseline80.neon
3+
4+
parameters:
5+
level: 5
6+
checkMissingIterableValueType: false
7+
checkGenericClassInNonGenericObjectType: false
8+
treatPhpDocTypesAsCertain: false

phpstan81.neon

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
includes:
2+
- phpstan-baseline81.neon
3+
4+
parameters:
5+
level: 5
6+
checkMissingIterableValueType: false
7+
checkGenericClassInNonGenericObjectType: false
8+
treatPhpDocTypesAsCertain: false

src/Soap/SoapClientExtended.php

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function __construct($wsdl, $options)
2828
* @param int $oneWay
2929
* @return string
3030
*/
31+
#[\ReturnTypeWillChange]
3132
public function __doRequest($request, $location, $action, $version, $oneWay = 0)
3233
{
3334
$search = [":ns1","ns1:","\n","\r"];

0 commit comments

Comments
 (0)