Skip to content

Commit

Permalink
Merge branch 'master' into merge-v1.18-into-master-1715369105478
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikola authored May 10, 2024
2 parents cd051e2 + 783dba8 commit e7ce816
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 49 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
mongodb-version:
- "4.4"
topology:
Expand Down Expand Up @@ -104,7 +105,10 @@ jobs:
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@3.0.0"
with:
composer-options: "--no-suggest"
# Revert when psalm supports PHP 8.4
# composer-options: "--no-suggest"
composer-options: "--no-suggest ${{ matrix.php-version == '8.4' && '--ignore-platform-req=php+' || '' }}"


- name: "Run PHPUnit"
run: "vendor/bin/simple-phpunit -v"
Expand Down
41 changes: 12 additions & 29 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ changes in this maintenance branch. This is important because we will later
merge the ensuing release commits up to master with `--strategy=ours`, which
will ignore changes from the merged commits.

## Update composer.json and CI matrices
## Update extension requirement

This is especially important before releasing a new minor version.
In `composer.json`, ensure that the version of `ext-mongodb` is correct for
the library version being released.

## Update CI matrices

Ensure that the extension requirement and branch alias in `composer.json` are
correct for the library version being released. For example, the 1.15.0 release
of the library should depend on version `^1.15.0` of the extension and master
branch alias should be `1.15.x-dev`.
This is especially important before releasing a new minor version.

If this is the first release of a minor version for the library, it is likely
following an extension release. The `vars` for calling `compile extension` from
Expand Down Expand Up @@ -90,21 +90,22 @@ After releasing a new major or minor version (e.g. 1.9.0), a maintenance branch
1.9.1) would then be done within that branch and any development for the next
major or minor release can continue in master.

After creating a maintenance branch, the `extra.branch-alias.dev-master` field
in the master branch's `composer.json` file should be updated. For example,
after branching v1.9, `composer.json` in the master branch may still read:
When work begins on a major new version, create a maintenance branch for the
last minor version and update the `extra.branch-alias.dev-master` field
in the master branch's `composer.json` file. For example, after branching v1.99,
`composer.json` in the master branch may still read:

```
"branch-alias": {
"dev-master": "1.9.x-dev"
"dev-master": "1.x-dev"
}
```

The above would be changed to:

```
"branch-alias": {
"dev-master": "1.10.x-dev"
"dev-master": "2.x-dev"
}
```

Expand All @@ -124,24 +125,6 @@ $ git checkout -b vX.Y
$ git push mongodb vX.Y
```

Update the master branch alias in `composer.json`:

```diff
"extra": {
"branch-alias": {
- "dev-master": "1.15.x-dev"
+ "dev-master": "1.16.x-dev"
}
},
```

Commit and push this change:

```console
$ git commit -m "Master is now X.Y-dev" composer.json
$ git push mongodb
```

### After releasing a patch version

If this was a patch release, the maintenance branch must be merged up to master:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.18.x-dev"
"dev-master": "1.x-dev"
}
},
"config": {
Expand Down
1 change: 1 addition & 0 deletions docs/includes/extracts-option-requires.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ source:
replacement:
version: "7.0"
...

5 changes: 2 additions & 3 deletions docs/reference/method/MongoDBClient-addSubscriber.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ notified once of each event for this Client.
Example
-------

Create a :php:`MongoDB\Driver\Monitoring\CommandSubscriber
<manual/en/class.mongodb-driver-monitoring-commandsubscriber>` that
logs all events:
Create a :php:`MongoDB\Driver\Monitoring\CommandSubscriber <manual/en/class.mongodb-driver-monitoring-commandsubscriber>`
that logs all events:

.. code-block:: php

Expand Down
3 changes: 1 addition & 2 deletions docs/reference/method/MongoDBCollection-dropIndexes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ Parameters

``$indexName`` : string| :phpclass:`MongoDB\Model\IndexInfo`
The name or model object of the index to drop. View the existing indexes on
the collection using the :phpmethod:`listIndexes()
<MongoDB\Collection::listIndexes()>` method.
the collection by using the :phpmethod:`MongoDB\Collection::listIndexes()` method.

``$options`` : array
An array specifying the desired options.
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/method/MongoDBCollection-updateMany.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ Parameters

``$update`` : array|object
Specifies the field and value combinations to update and any relevant update
operators. ``$update`` uses MongoDB's :manual:`update operators
</reference/operator/update>`. Starting with MongoDB 4.2, an `aggregation
pipeline <https://mongodb.com/docs/master/reference/command/update/#update-with-an-aggregation-pipeline>`_
operators. ``$update`` uses MongoDB's :manual:`update operators </reference/operator/update>`.
Starting with MongoDB 4.2, an `aggregation pipeline
<https://mongodb.com/docs/master/reference/command/update/#update-with-an-aggregation-pipeline>`_
can be passed as this parameter.

``$options`` : array
Expand Down
4 changes: 0 additions & 4 deletions docs/tutorial/encryption.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Additionally, either ``crypt_shared`` or ``mongocryptd`` are required in order t
use *automatic* client-side encryption. Neither is required for *explicit*
encryption.


``crypt_shared``
~~~~~~~~~~~~~~~~

Expand All @@ -43,7 +42,6 @@ fail if it cannot be loaded.
For detailed installation instructions see the MongoDB documentation for the
:manual:`Automatic Encryption Shared Library </core/queryable-encryption/reference/shared-library/>`.


``mongocryptd``
~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -74,7 +72,6 @@ the spawning behavior via various auto encryption
``mongocryptd`` is only responsible for supporting automatic client-side encryption
and does not itself perform any encryption or decryption.


Managing Encryption Keys
------------------------

Expand Down Expand Up @@ -105,7 +102,6 @@ encryption key (e.g. user-specific encryption keys) or create them dynamically.
.. literalinclude:: /examples/encryption/create_data_key.php
:language: php


.. _alt_name:

Referencing Encryption Keys by an Alternative Name
Expand Down
3 changes: 2 additions & 1 deletion src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
use function is_string;
use function MongoDB\BSON\fromPHP;
use function MongoDB\BSON\toPHP;
use function str_ends_with;
use function substr;

/**
Expand Down Expand Up @@ -497,7 +498,7 @@ function create_field_path_type_map(array $typeMap, string $fieldPath): array
/* Special case if we want to convert an array, in which case we need to
* ensure that the field containing the array is exposed as an array,
* instead of the type given in the type map's array key. */
if (substr($fieldPath, -2, 2) === '.$') {
if (str_ends_with($fieldPath, '.$')) {
$typeMap['fieldPaths'][substr($fieldPath, 0, -2)] = 'array';
}

Expand Down
6 changes: 3 additions & 3 deletions tests/UnifiedSpecTests/Constraint/Matches.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
use function PHPUnit\Framework\logicalOr;
use function range;
use function sprintf;
use function strpos;
use function str_starts_with;
use function strrchr;

/**
Expand Down Expand Up @@ -373,7 +373,7 @@ private static function getOperatorName(BSONDocument $document): string
{
// phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps
foreach ($document as $key => $_) {
if (strpos((string) $key, '$$') === 0) {
if (str_starts_with((string) $key, '$$')) {
return $key;
}
}
Expand All @@ -394,7 +394,7 @@ private static function isOperator(BSONDocument $document): bool

// phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps
foreach ($document as $key => $_) {
return strpos((string) $key, '$$') === 0;
return str_starts_with((string) $key, '$$');
}

throw new LogicException('should not reach this point');
Expand Down
3 changes: 2 additions & 1 deletion tests/UnifiedSpecTests/UnifiedTestRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
use function PHPUnit\Framework\assertNotFalse;
use function preg_replace;
use function sprintf;
use function str_starts_with;
use function strlen;
use function strpos;
use function substr_replace;
Expand Down Expand Up @@ -528,7 +529,7 @@ private function createContext(): Context
// We assume the internal client URI has multiple mongos hosts
$multiMongosUri = $this->internalClientUri;

if (strpos($multiMongosUri, 'mongodb+srv://') === 0) {
if (str_starts_with($multiMongosUri, 'mongodb+srv://')) {
/* TODO: If an SRV URI is provided, we can consider connecting and
* checking the topology for multiple mongoses and then selecting a
* single mongos to reconstruct a single mongos URI; however, that
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"description": "unacknowledgedBulkWrite",
"schemaVersion": "1.0",
"schemaVersion": "1.7",
"createEntities": [
{
"client": {
Expand Down Expand Up @@ -64,11 +64,29 @@
],
"ordered": false
}
},
{
"name": "find",
"object": "collection",
"arguments": {
"filter": {}
},
"expectResult": [
{
"_id": 1,
"x": 11
},
{
"_id": "unorderedBulkWriteInsertW0",
"x": 44
}
]
}
],
"expectEvents": [
{
"client": "client",
"ignoreExtraEvents": true,
"events": [
{
"commandStartedEvent": {
Expand Down

0 comments on commit e7ce816

Please sign in to comment.