Skip to content

Commit e94b259

Browse files
committed
Merge branch 'v2.x' into merge-v1.x-into-v2.x-1727254882102
* v2.x: PHPLIB-954: Add return types to all methods (#1391) PHPLIB-797: Remove unused methods in UnsupportedException (#1436) Revert "Add final annotations to non-internal Operation classes (#1410)" PHPLIB-953 Make internal classes and Operation classes final (#1392) PHPLIB-1218 Remove deprecated fields from GridFS files (#1398)
2 parents 9f4c1c8 + 251bd4b commit e94b259

File tree

114 files changed

+770
-1321
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+770
-1321
lines changed

.evergreen/config/generated/build/build-extension.yml

+99-87
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.evergreen/config/templates/build/build-extension.yml

+33-29
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,38 @@
55
vars:
66
PHP_VERSION: "%phpVersion%"
77
- func: "compile extension"
8-
- func: "upload extension"
9-
- name: "build-php-%phpVersion%-lowest"
10-
tags: ["build", "php%phpVersion%", "lowest", "pr", "tag"]
11-
commands:
12-
- func: "locate PHP binaries"
13-
vars:
14-
PHP_VERSION: "%phpVersion%"
15-
- func: "compile extension"
16-
vars:
17-
EXTENSION_VERSION: "1.20.0"
18-
- func: "upload extension"
19-
- name: "build-php-%phpVersion%-next-stable"
20-
tags: ["build", "php%phpVersion%", "next-stable", "pr", "tag"]
21-
commands:
22-
- func: "locate PHP binaries"
23-
vars:
24-
PHP_VERSION: "%phpVersion%"
25-
- func: "compile extension"
26-
vars:
27-
EXTENSION_BRANCH: "v1.20"
28-
- func: "upload extension"
29-
- name: "build-php-%phpVersion%-next-minor"
30-
tags: ["build", "php%phpVersion%", "next-minor"]
31-
commands:
32-
- func: "locate PHP binaries"
33-
vars:
34-
PHP_VERSION: "%phpVersion%"
35-
- func: "compile extension"
8+
# TODO: remove once 2.0.0 is released
369
vars:
37-
EXTENSION_BRANCH: "v1.x"
10+
EXTENSION_BRANCH: "v2.x"
3811
- func: "upload extension"
12+
# TODO: re-enable once 2.0.0 is released
13+
# - name: "build-php-%phpVersion%-lowest"
14+
# tags: ["build", "php%phpVersion%", "lowest", "pr", "tag"]
15+
# commands:
16+
# - func: "locate PHP binaries"
17+
# vars:
18+
# PHP_VERSION: "%phpVersion%"
19+
# - func: "compile extension"
20+
# vars:
21+
# EXTENSION_VERSION: "2.0.0"
22+
# - func: "upload extension"
23+
# - name: "build-php-%phpVersion%-next-stable"
24+
# tags: ["build", "php%phpVersion%", "next-stable", "pr", "tag"]
25+
# commands:
26+
# - func: "locate PHP binaries"
27+
# vars:
28+
# PHP_VERSION: "%phpVersion%"
29+
# - func: "compile extension"
30+
# vars:
31+
# EXTENSION_BRANCH: "v2.0"
32+
# - func: "upload extension"
33+
# - name: "build-php-%phpVersion%-next-minor"
34+
# tags: ["build", "php%phpVersion%", "next-minor"]
35+
# commands:
36+
# - func: "locate PHP binaries"
37+
# vars:
38+
# PHP_VERSION: "%phpVersion%"
39+
# - func: "compile extension"
40+
# vars:
41+
# EXTENSION_BRANCH: "v2.x"
42+
# - func: "upload extension"

.github/workflows/coding-standards.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ on:
1313

1414
env:
1515
PHP_VERSION: "8.2"
16-
DRIVER_VERSION: "stable"
16+
# TODO: change to "stable" once 2.0.0 is released
17+
# DRIVER_VERSION: "stable"
18+
DRIVER_VERSION: "mongodb/[email protected]"
1719

1820
jobs:
1921
phpcs:

.github/workflows/generator.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ on:
1313

1414
env:
1515
PHP_VERSION: "8.2"
16-
# TODO: change to "stable" once 1.20.0 is released
16+
# TODO: change to "stable" once 2.0.0 is released
1717
# DRIVER_VERSION: "stable"
18-
DRIVER_VERSION: "mongodb/mongo-php-driver@v1.20"
18+
DRIVER_VERSION: "mongodb/mongo-php-driver@v2.x"
1919

2020
jobs:
2121
psalm:

.github/workflows/static-analysis.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ on:
1919

2020
env:
2121
PHP_VERSION: "8.2"
22-
DRIVER_VERSION: "stable"
22+
# TODO: change to "stable" once 2.0.0 is released
23+
# DRIVER_VERSION: "stable"
24+
DRIVER_VERSION: "mongodb/[email protected]"
2325

2426
jobs:
2527
psalm:

.github/workflows/tests.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ on:
1212
- "feature/*"
1313

1414
env:
15-
DRIVER_VERSION: "stable"
15+
# TODO: change to "stable" once 2.0.0 is released
16+
# DRIVER_VERSION: "stable"
17+
DRIVER_VERSION: "mongodb/[email protected]"
1618

1719
jobs:
1820
phpunit:

UPGRADE-2.0.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
UPGRADE FROM 1.x to 2.0
2+
========================
3+
4+
* Classes in the namespace `MongoDB\Operation\` are `final`.
5+
* All methods in interfaces and classes now define a return type.
6+
7+
GridFS
8+
------
9+
10+
* The `md5` is no longer calculated when a file is uploaded to GridFS.
11+
Applications that require a file digest should implement it outside GridFS
12+
and store in metadata.
13+
14+
```php
15+
$hash = hash_file('sha256', $filename);
16+
$bucket->openUploadStream($fileId, ['metadata' => ['hash' => $hash]]);
17+
```
18+
19+
* The fields `contentType` and `aliases` are no longer stored in the `files`
20+
collection. Applications that require this information should store it in
21+
metadata.
22+
23+
**Before:**
24+
```php
25+
$bucket->openUploadStream($fileId, ['contentType' => 'image/png']);
26+
```
27+
28+
**After:**
29+
```php
30+
$bucket->openUploadStream($fileId, ['metadata' => ['contentType' => 'image/png']]);
31+
```
32+
33+
UnsupportedException method removals
34+
------------------------------------
35+
36+
The following methods have been removed from the
37+
`MongoDB\Exception\UnsupportedException` class:
38+
* `allowDiskUseNotSupported`
39+
* `arrayFiltersNotSupported`
40+
* `collationNotSupported`
41+
* `explainNotSupported`
42+
* `readConcernNotSupported`
43+
* `writeConcernNotSupported`
44+
45+
The remaining methods have been marked as internal and may be removed in a
46+
future minor version. Only the class itself is covered by the BC promise.

composer.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
],
1212
"require": {
1313
"php": "^8.1",
14-
"ext-hash": "*",
1514
"ext-json": "*",
16-
"ext-mongodb": "^1.20.0",
15+
"ext-mongodb": "^2.0",
1716
"composer-runtime-api": "^2.0",
1817
"psr/log": "^1.1.4|^2|^3",
1918
"symfony/polyfill-php80": "^1.27",

phpcs.xml.dist

-8
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,6 @@
133133
</rule>
134134

135135

136-
<!-- *********************************************************** -->
137-
<!-- Require native type hints for all code without a BC promise -->
138-
<!-- *********************************************************** -->
139-
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint">
140-
<exclude-pattern>src</exclude-pattern>
141-
</rule>
142-
143-
144136
<!-- ************************************************************* -->
145137
<!-- Ignore errors for certain files where this is part of the API -->
146138
<!-- ************************************************************* -->

0 commit comments

Comments
 (0)