Skip to content

Commit

Permalink
PHPLIB-1119: Update to Psalm 5 (#1131)
Browse files Browse the repository at this point in the history
* Update to psalm 5

* Enable reporting about unused baseline entries

* Remove dangerous instantiation

Instantiating static in non-final classes makes assumptions about child class constructors, which is unsafe.

* Fix missing return types

* Fix more psalm errors
  • Loading branch information
alcaeus committed Jul 18, 2023
1 parent 5aff53f commit 0c1b8a6
Show file tree
Hide file tree
Showing 35 changed files with 394 additions and 567 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"rector/rector": "^0.16.0",
"squizlabs/php_codesniffer": "^3.7",
"symfony/phpunit-bridge": "^5.2",
"vimeo/psalm": "^4.28"
"vimeo/psalm": "^5.13"
},
"autoload": {
"psr-4": { "MongoDB\\": "src/" },
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/csfle-explicit_encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

/* Using the client configured without encryption, find the document and observe
* that the field is not automatically decrypted. */

/** @var object{encryptedField: Binary} $document */
$document = $collection->findOne();

print_r($document);
Expand Down
2 changes: 1 addition & 1 deletion examples/changestream.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function toJSON(object $document): string
$changeStream->next();

if (time() - $startTime > 3) {
printf("Aborting after 3 seconds...\n");
echo "Aborting after 3 seconds...\n";
break;
}
}
6 changes: 3 additions & 3 deletions examples/command_logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ public function commandStarted(CommandStartedEvent $event): void
printf("%s command started\n", $event->getCommandName());

printf("command: %s\n", toJson($event->getCommand()));
printf("\n");
echo "\n";
}

public function commandSucceeded(CommandSucceededEvent $event): void
{
printf("%s command succeeded\n", $event->getCommandName());
printf("reply: %s\n", toJson($event->getReply()));
printf("\n");
echo "\n";
}

public function commandFailed(CommandFailedEvent $event): void
Expand All @@ -50,7 +50,7 @@ public function commandFailed(CommandFailedEvent $event): void
printf("exception: %s\n", get_class($exception));
printf("exception.code: %d\n", $exception->getCode());
printf("exception.message: %s\n", $exception->getMessage());
printf("\n");
echo "\n";
}
}

Expand Down
Loading

0 comments on commit 0c1b8a6

Please sign in to comment.