mongo-php-library icon indicating copy to clipboard operation
mongo-php-library copied to clipboard

Improve type of Collection Bulk Write operations

Open GromNaN opened this issue 7 months ago • 1 comments

The Collection::bulkWrite($operations) method requires a complex array structure for the operations list. Describing this type using psalm custom type feature to helps static analysis.

PHPStorm is able to make the completion only with the full @param annotation, not @phpstan-param nor @psaml-param. And only when I start typing the first letter. image image

Both Psalm and PHPStan detect when the argument is invalid. The PHPStorm inspection does not detect issues when the array does not match the expected @param type.

image

GromNaN avatar May 20 '25 11:05 GromNaN