Skip to content

Commit 8d45fb8

Browse files
Fixes
1 parent c70316f commit 8d45fb8

17 files changed

+285
-103
lines changed

.php-cs-fixer.cache

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ CHANGE LOG
22
==========
33

44

5+
## 5.0.0 (UPCOMING)
6+
7+
* Add PHP 8.4 support
8+
* Drop support for PHP earlier than 8.1
9+
* Moved various param types to native PHP types
10+
11+
512
## 4.9.0 (03/12/2023)
613

714
* Add support for `symfony/options-resolver:^7.0`

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
}
2222
],
2323
"require": {
24-
"php": "^7.4.15 || ^8.0.2",
24+
"php": "^8.1",
2525
"ext-json": "*",
2626
"php-http/client-common": "^2.7.2",
2727
"php-http/discovery": "^1.20.0",

phpstan-baseline.neon

Lines changed: 248 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,278 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Property DigitalOceanV2\\\\Api\\\\AbstractApi\\:\\:\\$page is never written, only read\\.$#"
4+
message: '#^Property DigitalOceanV2\\Api\\AbstractApi\:\:\$page \(int\|null\) is never assigned int so it can be removed from the property type\.$#'
5+
identifier: property.unusedType
56
count: 1
67
path: src/Api/AbstractApi.php
78

89
-
9-
message: "#^Property DigitalOceanV2\\\\Api\\\\AbstractApi\\:\\:\\$perPage is never written, only read\\.$#"
10+
message: '#^Property DigitalOceanV2\\Api\\AbstractApi\:\:\$perPage \(int\|null\) is never assigned int so it can be removed from the property type\.$#'
11+
identifier: property.unusedType
1012
count: 1
1113
path: src/Api/AbstractApi.php
1214

1315
-
14-
message: "#^Offset 'file' does not exist on array\\{function\\: string, line\\?\\: int, file\\?\\: string, class\\?\\: class\\-string, type\\?\\: '\\-\\>'\\|'\\:\\:', args\\?\\: array, object\\?\\: object\\}\\.$#"
16+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
17+
identifier: argument.type
18+
count: 1
19+
path: src/Api/Action.php
20+
21+
-
22+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
23+
identifier: argument.type
24+
count: 5
25+
path: src/Api/App.php
26+
27+
-
28+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
29+
identifier: argument.type
30+
count: 1
31+
path: src/Api/CdnEndpoint.php
32+
33+
-
34+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
35+
identifier: argument.type
36+
count: 1
37+
path: src/Api/Certificate.php
38+
39+
-
40+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
41+
identifier: argument.type
42+
count: 7
43+
path: src/Api/Database.php
44+
45+
-
46+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
47+
identifier: argument.type
48+
count: 1
49+
path: src/Api/Domain.php
50+
51+
-
52+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
53+
identifier: argument.type
54+
count: 1
55+
path: src/Api/DomainRecord.php
56+
57+
-
58+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
59+
identifier: argument.type
60+
count: 8
61+
path: src/Api/Droplet.php
62+
63+
-
64+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
65+
identifier: argument.type
66+
count: 1
67+
path: src/Api/Firewall.php
68+
69+
-
70+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
71+
identifier: argument.type
72+
count: 2
73+
path: src/Api/FloatingIp.php
74+
75+
-
76+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
77+
identifier: argument.type
78+
count: 1
79+
path: src/Api/Image.php
80+
81+
-
82+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
83+
identifier: argument.type
84+
count: 1
85+
path: src/Api/Key.php
86+
87+
-
88+
message: '#^Parameter \#1 \$config of static method DigitalOceanV2\\Api\\LoadBalancer\:\:formatConfigurationOptions\(\) expects array\|DigitalOceanV2\\Entity\\AbstractEntity, mixed given\.$#'
89+
identifier: argument.type
90+
count: 1
91+
path: src/Api/LoadBalancer.php
92+
93+
-
94+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
95+
identifier: argument.type
96+
count: 1
97+
path: src/Api/LoadBalancer.php
98+
99+
-
100+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
101+
identifier: argument.type
102+
count: 1
103+
path: src/Api/Monitoring.php
104+
105+
-
106+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
107+
identifier: argument.type
108+
count: 4
109+
path: src/Api/ProjectResource.php
110+
111+
-
112+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
113+
identifier: argument.type
114+
count: 1
115+
path: src/Api/Region.php
116+
117+
-
118+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
119+
identifier: argument.type
120+
count: 2
121+
path: src/Api/ReservedIp.php
122+
123+
-
124+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
125+
identifier: argument.type
126+
count: 1
127+
path: src/Api/Size.php
128+
129+
-
130+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
131+
identifier: argument.type
132+
count: 1
133+
path: src/Api/Snapshot.php
134+
135+
-
136+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
137+
identifier: argument.type
138+
count: 1
139+
path: src/Api/Tag.php
140+
141+
-
142+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
143+
identifier: argument.type
144+
count: 4
145+
path: src/Api/Volume.php
146+
147+
-
148+
message: '#^Parameter \#2 \$array of function array_map expects array, mixed given\.$#'
149+
identifier: argument.type
150+
count: 1
151+
path: src/Api/Vpc.php
152+
153+
-
154+
message: '#^Cannot access offset 2 on mixed\.$#'
155+
identifier: offsetAccess.nonOffsetAccessible
156+
count: 1
157+
path: src/Entity/AbstractEntity.php
158+
159+
-
160+
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
161+
identifier: equal.notAllowed
162+
count: 1
163+
path: src/Entity/AbstractEntity.php
164+
165+
-
166+
message: '#^Offset ''file'' might not exist on array\{function\: string, line\?\: int, file\?\: string, class\?\: class\-string, type\?\: ''\-\>''\|''\:\:'', args\?\: array\<mixed\>, object\?\: object\}\.$#'
167+
identifier: offsetAccess.notFound
15168
count: 1
16169
path: src/Entity/AbstractEntity.php
17170

18171
-
19-
message: "#^Offset 'line' does not exist on array\\{function\\: string, line\\?\\: int, file\\?\\: string, class\\?\\: class\\-string, type\\?\\: '\\-\\>'\\|'\\:\\:', args\\?\\: array, object\\?\\: object\\}\\.$#"
172+
message: '#^Offset ''line'' might not exist on array\{function\: string, line\?\: int, file\?\: string, class\?\: class\-string, type\?\: ''\-\>''\|''\:\:'', args\?\: array\<mixed\>, object\?\: object\}\.$#'
173+
identifier: offsetAccess.notFound
20174
count: 1
21175
path: src/Entity/AbstractEntity.php
22176

23177
-
24-
message: "#^Variable property access on \\$this\\(DigitalOceanV2\\\\Entity\\\\AbstractEntity\\)\\.$#"
178+
message: '#^Parameter \#1 \$string of function strtoupper expects string, mixed given\.$#'
179+
identifier: argument.type
180+
count: 1
181+
path: src/Entity/AbstractEntity.php
182+
183+
-
184+
message: '#^Variable property access on \$this\(DigitalOceanV2\\Entity\\AbstractEntity\)\.$#'
185+
identifier: property.dynamicName
25186
count: 4
26187
path: src/Entity/AbstractEntity.php
27188

28189
-
29-
message: "#^Method DigitalOceanV2\\\\HttpClient\\\\Message\\\\ResponseMediator\\:\\:getPagination\\(\\) should return array\\<string, string\\> but returns array\\<string, mixed\\>\\.$#"
190+
message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#'
191+
identifier: foreach.nonIterable
192+
count: 2
193+
path: src/Entity/Droplet.php
194+
195+
-
196+
message: '#^Cannot access property \$cidr on mixed\.$#'
197+
identifier: property.nonObject
198+
count: 1
199+
path: src/Entity/Droplet.php
200+
201+
-
202+
message: '#^Cannot access property \$netmask on mixed\.$#'
203+
identifier: property.nonObject
204+
count: 2
205+
path: src/Entity/Droplet.php
206+
207+
-
208+
message: '#^Cannot access property \$version on mixed\.$#'
209+
identifier: property.nonObject
210+
count: 2
211+
path: src/Entity/Droplet.php
212+
213+
-
214+
message: '#^Anonymous function should return array but returns mixed\.$#'
215+
identifier: return.type
216+
count: 2
217+
path: src/Entity/Firewall.php
218+
219+
-
220+
message: '#^Cannot call method toArray\(\) on mixed\.$#'
221+
identifier: method.nonObject
222+
count: 2
223+
path: src/Entity/Firewall.php
224+
225+
-
226+
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
227+
identifier: notEqual.notAllowed
228+
count: 1
229+
path: src/Entity/FirewallRule.php
230+
231+
-
232+
message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#'
233+
identifier: foreach.nonIterable
234+
count: 1
235+
path: src/Entity/LoadBalancer.php
236+
237+
-
238+
message: '#^Call to function array_filter\(\) requires parameter \#2 to be passed to avoid loose comparison semantics\.$#'
239+
identifier: arrayFilter.strict
240+
count: 1
241+
path: src/HttpClient/Message/ResponseMediator.php
242+
243+
-
244+
message: '#^Cannot access property \$pages on mixed\.$#'
245+
identifier: property.nonObject
30246
count: 1
31247
path: src/HttpClient/Message/ResponseMediator.php
32248

33249
-
34-
message: "#^Variable method call on DigitalOceanV2\\\\Api\\\\AbstractApi\\.$#"
250+
message: '#^Method DigitalOceanV2\\HttpClient\\Message\\ResponseMediator\:\:getPagination\(\) should return array\<string, string\> but returns array\<string, mixed\>\.$#'
251+
identifier: return.type
252+
count: 1
253+
path: src/HttpClient/Message/ResponseMediator.php
254+
255+
-
256+
message: '#^Property DigitalOceanV2\\HttpClient\\Plugin\\History\:\:\$lastResponse \(Psr\\Http\\Message\\ResponseInterface\|null\) is never assigned null so it can be removed from the property type\.$#'
257+
identifier: property.unusedType
258+
count: 1
259+
path: src/HttpClient/Plugin/History.php
260+
261+
-
262+
message: '#^PHPDoc tag @var with type string is not subtype of native type non\-empty\-string\|false\.$#'
263+
identifier: varTag.nativeType
264+
count: 1
265+
path: src/HttpClient/Util/JsonObject.php
266+
267+
-
268+
message: '#^PHPDoc tag @var with type Closure\(DigitalOceanV2\\Api\\AbstractApi\)\: DigitalOceanV2\\Api\\AbstractApi is not subtype of type Closure\(DigitalOceanV2\\Api\\AbstractApi\)\: DigitalOceanV2\\Api\\AbstractApi\.$#'
269+
identifier: varTag.type
270+
count: 2
271+
path: src/ResultPager.php
272+
273+
-
274+
message: '#^Variable method call on DigitalOceanV2\\Api\\AbstractApi\.$#'
275+
identifier: method.dynamicName
35276
count: 1
36277
path: src/ResultPager.php
37278

phpstan.neon.dist

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,11 @@ includes:
22
- phpstan-baseline.neon
33
- vendor-bin/phpstan/vendor/phpstan/phpstan-deprecation-rules/rules.neon
44
- vendor-bin/phpstan/vendor/phpstan/phpstan-strict-rules/rules.neon
5-
- vendor-bin/phpstan/vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon
6-
7-
rules:
8-
- Ergebnis\PHPStan\Rules\Closures\NoNullableReturnTypeDeclarationRule
9-
- Ergebnis\PHPStan\Rules\Expressions\NoCompactRule
10-
- Ergebnis\PHPStan\Rules\Expressions\NoEvalRule
11-
- Ergebnis\PHPStan\Rules\Files\DeclareStrictTypesRule
12-
- Ergebnis\PHPStan\Rules\Methods\PrivateInFinalClassRule
135

146
parameters:
157
level: max
168
paths:
179
- src
18-
checkMissingIterableValueType: false
1910
stubFiles:
2011
- .stubs/Psr/Http/Message/StreamInterface.phpstub
2112
- .stubs/Psr/Http/Message/UriInterface.phpstub
@@ -24,3 +15,7 @@ parameters:
2415
- .stubs/Psr/Http/Message/ResponseInterface.phpstub
2516
- .stubs/Http/Promise/Promise.phpstub
2617
- .stubs/Http/Client/Common/Plugin.phpstub
18+
ignoreErrors:
19+
- '#return type has no value type specified in iterable type array#'
20+
- '#no value type specified in iterable type array#'
21+
- '#^Parameter \#1 \$parameters of class DigitalOceanV2\\Entity\\.+ constructor expects array\|object\|null, mixed given\.$#'

psalm-baseline.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="5.16.0@2897ba636551a8cb61601cc26f6ccfbba6c36591">
2+
<files psalm-version="5.26.1@d747f6500b38ac4f7dfc5edbcae6e4b637d7add0">
33
<file src="src/Entity/AbstractEntity.php">
44
<PossiblyUndefinedArrayOffset>
55
<code><![CDATA[$trace[0]['file']]]></code>

psalm.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
xmlns="https://getpsalm.org/schema/config"
77
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
88
errorBaseline="psalm-baseline.xml"
9+
findUnusedBaselineEntry="true"
10+
findUnusedCode="false"
911
>
1012
<projectFiles>
1113
<directory name="src" />

0 commit comments

Comments
 (0)