Skip to content

Commit ed2ed53

Browse files
committed
Update phpstan to v2
1 parent d320c12 commit ed2ed53

File tree

3 files changed

+81
-24
lines changed

3 files changed

+81
-24
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"patchlevel/event-sourcing-psalm-plugin": "^3.0.0",
4444
"phpbench/phpbench": "^1.2.15",
4545
"phpspec/prophecy-phpunit": "^2.1.0",
46-
"phpstan/phpstan": "^1.10.49",
46+
"phpstan/phpstan": "^2.0.4",
4747
"phpunit/phpunit": "^10.5.2",
4848
"psalm/plugin-phpunit": "^0.19.0",
4949
"roave/infection-static-analysis-plugin": "^1.34.0",

composer.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan-baseline.neon

Lines changed: 73 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,133 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Cannot unset offset 'url' on array\\{application_name\\?\\: string, charset\\?\\: string, dbname\\?\\: string, defaultTableOptions\\?\\: array\\<string, mixed\\>, driver\\?\\: 'ibm_db2'\\|'mysqli'\\|'oci8'\\|'pdo_mysql'\\|'pdo_oci'\\|'pdo_pgsql'\\|'pdo_sqlite'\\|'pdo_sqlsrv'\\|'pgsql'\\|'sqlite3'\\|'sqlsrv', driverClass\\?\\: class\\-string\\<Doctrine\\\\DBAL\\\\Driver\\>, driverOptions\\?\\: array, host\\?\\: string, \\.\\.\\.\\}\\.$#"
4+
message: '#^Cannot unset offset ''url'' on array\{application_name\?\: string, charset\?\: string, dbname\?\: string, defaultTableOptions\?\: array\<string, mixed\>, driver\?\: ''ibm_db2''\|''mysqli''\|''oci8''\|''pdo_mysql''\|''pdo_oci''\|''pdo_pgsql''\|''pdo_sqlite''\|''pdo_sqlsrv''\|''pgsql''\|''sqlite3''\|''sqlsrv'', driverClass\?\: class\-string\<Doctrine\\DBAL\\Driver\>, driverOptions\?\: array\<mixed\>, host\?\: string, \.\.\.\}\.$#'
5+
identifier: unset.offset
56
count: 1
67
path: src/Console/DoctrineHelper.php
78

89
-
9-
message: "#^Parameter \\#1 \\$key of class Patchlevel\\\\Hydrator\\\\Cryptography\\\\Cipher\\\\CipherKey constructor expects non\\-empty\\-string, string given\\.$#"
10+
message: '#^Parameter \#1 \$key of class Patchlevel\\Hydrator\\Cryptography\\Cipher\\CipherKey constructor expects non\-empty\-string, string given\.$#'
11+
identifier: argument.type
1012
count: 1
1113
path: src/Cryptography/DoctrineCipherKeyStore.php
1214

1315
-
14-
message: "#^Parameter \\#3 \\$iv of class Patchlevel\\\\Hydrator\\\\Cryptography\\\\Cipher\\\\CipherKey constructor expects non\\-empty\\-string, string given\\.$#"
16+
message: '#^Parameter \#3 \$iv of class Patchlevel\\Hydrator\\Cryptography\\Cipher\\CipherKey constructor expects non\-empty\-string, string given\.$#'
17+
identifier: argument.type
1518
count: 1
1619
path: src/Cryptography/DoctrineCipherKeyStore.php
1720

1821
-
19-
message: "#^Parameter \\#2 \\$data of method Patchlevel\\\\Hydrator\\\\Hydrator\\:\\:hydrate\\(\\) expects array\\<string, mixed\\>, mixed given\\.$#"
22+
message: '#^Call to function method_exists\(\) with ReflectionFunction and ''isAnonymous'' will always evaluate to true\.$#'
23+
identifier: function.alreadyNarrowedType
24+
count: 1
25+
path: src/EventBus/ListenerDescriptor.php
26+
27+
-
28+
message: '#^@readonly property Patchlevel\\EventSourcing\\Message\\Message\:\:\$headers is assigned outside of the constructor\.$#'
29+
identifier: property.readOnlyByPhpDocAssignNotInConstructor
30+
count: 3
31+
path: src/Message/Message.php
32+
33+
-
34+
message: '#^@readonly property cannot have a default value\.$#'
35+
identifier: property.readOnlyByPhpDocDefaultValue
36+
count: 1
37+
path: src/Message/Message.php
38+
39+
-
40+
message: '#^Parameter \#2 \$data of method Patchlevel\\Hydrator\\Hydrator\:\:hydrate\(\) expects array\<string, mixed\>, array\<mixed, mixed\> given\.$#'
41+
identifier: argument.type
42+
count: 1
43+
path: src/Message/Serializer/DefaultHeadersSerializer.php
44+
45+
-
46+
message: '#^Parameter \#2 \$data of method Patchlevel\\Hydrator\\Hydrator\:\:hydrate\(\) expects array\<string, mixed\>, mixed given\.$#'
47+
identifier: argument.type
2048
count: 1
2149
path: src/Snapshot/DefaultSnapshotStore.php
2250

2351
-
24-
message: "#^Property Patchlevel\\\\EventSourcing\\\\Store\\\\ArrayStream\\:\\:\\$index \\(int\\<1, max\\>\\|null\\) does not accept int\\<0, max\\>\\.$#"
52+
message: '#^Method Patchlevel\\EventSourcing\\Store\\ArrayStream\:\:current\(\) never returns null so it can be removed from the return type\.$#'
53+
identifier: return.unusedType
2554
count: 1
2655
path: src/Store/ArrayStream.php
2756

2857
-
29-
message: "#^Ternary operator condition is always true\\.$#"
58+
message: '#^Property Patchlevel\\EventSourcing\\Store\\ArrayStream\:\:\$index \(int\<1, max\>\|null\) does not accept int\<0, max\>\.$#'
59+
identifier: assign.propertyType
3060
count: 1
3161
path: src/Store/ArrayStream.php
3262

3363
-
34-
message: "#^Method Patchlevel\\\\EventSourcing\\\\Store\\\\Criteria\\\\Criteria\\:\\:get\\(\\) should return T of object but returns object\\.$#"
64+
message: '#^Ternary operator condition is always true\.$#'
65+
identifier: ternary.alwaysTrue
66+
count: 1
67+
path: src/Store/ArrayStream.php
68+
69+
-
70+
message: '#^Method Patchlevel\\EventSourcing\\Store\\Criteria\\Criteria\:\:get\(\) should return T of object but returns object\.$#'
71+
identifier: return.type
3572
count: 1
3673
path: src/Store/Criteria/Criteria.php
3774

3875
-
39-
message: "#^Parameter \\#3 \\$playhead of class Patchlevel\\\\EventSourcing\\\\Aggregate\\\\AggregateHeader constructor expects int\\<1, max\\>, int given\\.$#"
76+
message: '#^Method Patchlevel\\EventSourcing\\Store\\DoctrineDbalStoreStream\:\:current\(\) never returns null so it can be removed from the return type\.$#'
77+
identifier: return.unusedType
4078
count: 1
4179
path: src/Store/DoctrineDbalStoreStream.php
4280

4381
-
44-
message: "#^Parameter \\#4 \\$recordedOn of class Patchlevel\\\\EventSourcing\\\\Aggregate\\\\AggregateHeader constructor expects DateTimeImmutable, mixed given\\.$#"
82+
message: '#^Parameter \#3 \$playhead of class Patchlevel\\EventSourcing\\Aggregate\\AggregateHeader constructor expects int\<1, max\>, int given\.$#'
83+
identifier: argument.type
4584
count: 1
4685
path: src/Store/DoctrineDbalStoreStream.php
4786

4887
-
49-
message: "#^Ternary operator condition is always true\\.$#"
88+
message: '#^Parameter \#4 \$recordedOn of class Patchlevel\\EventSourcing\\Aggregate\\AggregateHeader constructor expects DateTimeImmutable, mixed given\.$#'
89+
identifier: argument.type
5090
count: 1
5191
path: src/Store/DoctrineDbalStoreStream.php
5292

5393
-
54-
message: "#^Property Patchlevel\\\\EventSourcing\\\\Store\\\\InMemoryStore\\:\\:\\$messages \\(array\\<int\\<0, max\\>, Patchlevel\\\\EventSourcing\\\\Message\\\\Message\\>\\) does not accept array\\<int, Patchlevel\\\\EventSourcing\\\\Message\\\\Message\\>\\.$#"
94+
message: '#^Ternary operator condition is always true\.$#'
95+
identifier: ternary.alwaysTrue
5596
count: 1
56-
path: src/Store/InMemoryStore.php
97+
path: src/Store/DoctrineDbalStoreStream.php
5798

5899
-
59-
message: "#^Parameter \\#1 \\$playhead of class Patchlevel\\\\EventSourcing\\\\Store\\\\Header\\\\PlayheadHeader constructor expects int\\<1, max\\>, int given\\.$#"
100+
message: '#^Method Patchlevel\\EventSourcing\\Store\\StreamDoctrineDbalStoreStream\:\:current\(\) never returns null so it can be removed from the return type\.$#'
101+
identifier: return.unusedType
60102
count: 1
61103
path: src/Store/StreamDoctrineDbalStoreStream.php
62104

63105
-
64-
message: "#^Ternary operator condition is always true\\.$#"
106+
message: '#^Parameter \#1 \$playhead of class Patchlevel\\EventSourcing\\Store\\Header\\PlayheadHeader constructor expects int\<1, max\>, int given\.$#'
107+
identifier: argument.type
65108
count: 1
66109
path: src/Store/StreamDoctrineDbalStoreStream.php
67110

68111
-
69-
message: "#^Strict comparison using \\=\\=\\= between DateTimeImmutable and false will always evaluate to false\\.$#"
112+
message: '#^Ternary operator condition is always true\.$#'
113+
identifier: ternary.alwaysTrue
114+
count: 1
115+
path: src/Store/StreamDoctrineDbalStoreStream.php
116+
117+
-
118+
message: '#^Strict comparison using \=\=\= between DateTimeImmutable and false will always evaluate to false\.$#'
119+
identifier: identical.alwaysFalse
70120
count: 1
71121
path: src/Subscription/RetryStrategy/ClockBasedRetryStrategy.php
72122

73123
-
74-
message: "#^Parameter \\#3 \\$errorContext of class Patchlevel\\\\EventSourcing\\\\Subscription\\\\SubscriptionError constructor expects array\\<int, array\\{class\\: class\\-string, message\\: string, code\\: int\\|string, file\\: string, line\\: int, trace\\: array\\<int, array\\{file\\?\\: string, line\\?\\: int, function\\?\\: string, class\\?\\: string, type\\?\\: string, args\\?\\: array\\}\\>\\}\\>\\|null, mixed given\\.$#"
124+
message: '#^Parameter \#3 \$errorContext of class Patchlevel\\EventSourcing\\Subscription\\SubscriptionError constructor expects list\<array\{class\: class\-string, message\: string, code\: int\|string, file\: string, line\: int, trace\: list\<array\{file\?\: string, line\?\: int, function\?\: string, class\?\: string, type\?\: string, args\?\: array\<mixed\>\}\>\}\>\|null, mixed given\.$#'
125+
identifier: argument.type
75126
count: 1
76127
path: src/Subscription/Store/DoctrineSubscriptionStore.php
128+
129+
-
130+
message: '#^Trait Patchlevel\\EventSourcing\\Subscription\\Subscriber\\SubscriberUtil is used zero times and is not analysed\.$#'
131+
identifier: trait.unused
132+
count: 1
133+
path: src/Subscription/Subscriber/SubscriberUtil.php

0 commit comments

Comments
 (0)