Skip to content

Commit 2d1895b

Browse files
committed
PHPLIB-1752 Upgrade to psalm 6.14
1 parent 8eb0501 commit 2d1895b

File tree

6 files changed

+17
-9
lines changed

6 files changed

+17
-9
lines changed

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818
required: true
1919

2020
env:
21-
PHP_VERSION: "8.2"
21+
PHP_VERSION: "8.5"
2222
# TODO: change to "stable" once 2.0.0 is released
2323
# DRIVER_VERSION: "stable"
2424
DRIVER_VERSION: "mongodb/mongo-php-driver@v2.x"

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"phpunit/phpunit": "^10.5.35",
2222
"rector/rector": "^2.1.4",
2323
"squizlabs/php_codesniffer": "^3.7",
24-
"vimeo/psalm": "6.5.*"
24+
"vimeo/psalm": "~6.14.2"
2525
},
2626
"replace": {
2727
"mongodb/builder": "*"

psalm-baseline.xml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="6.5.1@3f17a6b24a2dbe543e21408c2b19108cf6a355ef">
2+
<files psalm-version="6.14.2@bbd217fc98c0daa0a13aea2a7f119d03ba3fc9a0">
33
<file src="examples/atlas_search.php">
44
<MixedArgument>
55
<code><![CDATA[$document['name']]]></code>
@@ -23,6 +23,11 @@
2323
<code><![CDATA[$document['name']]]></code>
2424
</PossiblyInvalidArrayAccess>
2525
</file>
26+
<file src="examples/gridfs_stream.php">
27+
<ImplicitToStringCast>
28+
<code><![CDATA[$id]]></code>
29+
</ImplicitToStringCast>
30+
</file>
2631
<file src="examples/persistable.php">
2732
<LessSpecificReturnStatement>
2833
<code><![CDATA[(object) [
@@ -240,6 +245,10 @@
240245
</PossiblyInvalidArgument>
241246
</file>
242247
<file src="src/ClientBulkWrite.php">
248+
<InvalidAttribute>
249+
<code><![CDATA[NoDiscard]]></code>
250+
<code><![CDATA[NoDiscard]]></code>
251+
</InvalidAttribute>
243252
<PossiblyInvalidArgument>
244253
<code><![CDATA[$document]]></code>
245254
<code><![CDATA[$replacement]]></code>
@@ -388,9 +397,6 @@
388397
<InvalidReturnType>
389398
<code><![CDATA[CursorInterface<TValue>]]></code>
390399
</InvalidReturnType>
391-
<LessSpecificImplementedReturnType>
392-
<code><![CDATA[CursorInterface<TValue>]]></code>
393-
</LessSpecificImplementedReturnType>
394400
<MixedArgument>
395401
<code><![CDATA[$reply->cursor->nextBatch]]></code>
396402
</MixedArgument>
@@ -559,9 +565,6 @@
559565
<MixedMethodCall>
560566
<code><![CDATA[isInTransaction]]></code>
561567
</MixedMethodCall>
562-
<MixedReturnStatement>
563-
<code><![CDATA[$server->executeBulkWriteCommand($this->bulkWriteCommand, $options)]]></code>
564-
</MixedReturnStatement>
565568
</file>
566569
<file src="src/Operation/Count.php">
567570
<MixedAssignment>

psalm.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,8 @@
4545
<directory name="examples" />
4646
</errorLevel>
4747
</RiskyTruthyFalsyComparison>
48+
49+
<MissingOverrideAttribute errorLevel="suppress" />
50+
<ClassMustBeFinal errorLevel="info" />
4851
</issueHandlers>
4952
</psalm>

src/Client.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
use function is_array;
5555
use function is_string;
5656

57+
/** @psalm-no-seal-properties */
5758
class Client implements Stringable
5859
{
5960
public const DEFAULT_URI = 'mongodb://127.0.0.1/';

src/Database.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
use function is_bool;
5959
use function strlen;
6060

61+
/** @psalm-no-seal-properties */
6162
class Database implements Stringable
6263
{
6364
private const DEFAULT_TYPE_MAP = [

0 commit comments

Comments
 (0)