Skip to content

Commit

Permalink
Merge branch 'v2.x' into merge-v1.x-into-v2.x-1727254882102
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
alcaeus committed Sep 25, 2024
2 parents 9f4c1c8 + 251bd4b commit e94b259
Show file tree
Hide file tree
Showing 114 changed files with 770 additions and 1,321 deletions.
186 changes: 99 additions & 87 deletions .evergreen/config/generated/build/build-extension.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 33 additions & 29 deletions .evergreen/config/templates/build/build-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,38 @@
vars:
PHP_VERSION: "%phpVersion%"
- func: "compile extension"
- func: "upload extension"
- name: "build-php-%phpVersion%-lowest"
tags: ["build", "php%phpVersion%", "lowest", "pr", "tag"]
commands:
- func: "locate PHP binaries"
vars:
PHP_VERSION: "%phpVersion%"
- func: "compile extension"
vars:
EXTENSION_VERSION: "1.20.0"
- func: "upload extension"
- name: "build-php-%phpVersion%-next-stable"
tags: ["build", "php%phpVersion%", "next-stable", "pr", "tag"]
commands:
- func: "locate PHP binaries"
vars:
PHP_VERSION: "%phpVersion%"
- func: "compile extension"
vars:
EXTENSION_BRANCH: "v1.20"
- func: "upload extension"
- name: "build-php-%phpVersion%-next-minor"
tags: ["build", "php%phpVersion%", "next-minor"]
commands:
- func: "locate PHP binaries"
vars:
PHP_VERSION: "%phpVersion%"
- func: "compile extension"
# TODO: remove once 2.0.0 is released
vars:
EXTENSION_BRANCH: "v1.x"
EXTENSION_BRANCH: "v2.x"
- func: "upload extension"
# TODO: re-enable once 2.0.0 is released
# - name: "build-php-%phpVersion%-lowest"
# tags: ["build", "php%phpVersion%", "lowest", "pr", "tag"]
# commands:
# - func: "locate PHP binaries"
# vars:
# PHP_VERSION: "%phpVersion%"
# - func: "compile extension"
# vars:
# EXTENSION_VERSION: "2.0.0"
# - func: "upload extension"
# - name: "build-php-%phpVersion%-next-stable"
# tags: ["build", "php%phpVersion%", "next-stable", "pr", "tag"]
# commands:
# - func: "locate PHP binaries"
# vars:
# PHP_VERSION: "%phpVersion%"
# - func: "compile extension"
# vars:
# EXTENSION_BRANCH: "v2.0"
# - func: "upload extension"
# - name: "build-php-%phpVersion%-next-minor"
# tags: ["build", "php%phpVersion%", "next-minor"]
# commands:
# - func: "locate PHP binaries"
# vars:
# PHP_VERSION: "%phpVersion%"
# - func: "compile extension"
# vars:
# EXTENSION_BRANCH: "v2.x"
# - func: "upload extension"
4 changes: 3 additions & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ on:

env:
PHP_VERSION: "8.2"
DRIVER_VERSION: "stable"
# TODO: change to "stable" once 2.0.0 is released
# DRIVER_VERSION: "stable"
DRIVER_VERSION: "mongodb/[email protected]"

jobs:
phpcs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ on:

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

jobs:
psalm:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ on:

env:
PHP_VERSION: "8.2"
DRIVER_VERSION: "stable"
# TODO: change to "stable" once 2.0.0 is released
# DRIVER_VERSION: "stable"
DRIVER_VERSION: "mongodb/[email protected]"

jobs:
psalm:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ on:
- "feature/*"

env:
DRIVER_VERSION: "stable"
# TODO: change to "stable" once 2.0.0 is released
# DRIVER_VERSION: "stable"
DRIVER_VERSION: "mongodb/[email protected]"

jobs:
phpunit:
Expand Down
46 changes: 46 additions & 0 deletions UPGRADE-2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
UPGRADE FROM 1.x to 2.0
========================

* Classes in the namespace `MongoDB\Operation\` are `final`.
* All methods in interfaces and classes now define a return type.

GridFS
------

* The `md5` is no longer calculated when a file is uploaded to GridFS.
Applications that require a file digest should implement it outside GridFS
and store in metadata.

```php
$hash = hash_file('sha256', $filename);
$bucket->openUploadStream($fileId, ['metadata' => ['hash' => $hash]]);
```

* The fields `contentType` and `aliases` are no longer stored in the `files`
collection. Applications that require this information should store it in
metadata.

**Before:**
```php
$bucket->openUploadStream($fileId, ['contentType' => 'image/png']);
```

**After:**
```php
$bucket->openUploadStream($fileId, ['metadata' => ['contentType' => 'image/png']]);
```

UnsupportedException method removals
------------------------------------

The following methods have been removed from the
`MongoDB\Exception\UnsupportedException` class:
* `allowDiskUseNotSupported`
* `arrayFiltersNotSupported`
* `collationNotSupported`
* `explainNotSupported`
* `readConcernNotSupported`
* `writeConcernNotSupported`

The remaining methods have been marked as internal and may be removed in a
future minor version. Only the class itself is covered by the BC promise.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
],
"require": {
"php": "^8.1",
"ext-hash": "*",
"ext-json": "*",
"ext-mongodb": "^1.20.0",
"ext-mongodb": "^2.0",
"composer-runtime-api": "^2.0",
"psr/log": "^1.1.4|^2|^3",
"symfony/polyfill-php80": "^1.27",
Expand Down
8 changes: 0 additions & 8 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,6 @@
</rule>


<!-- *********************************************************** -->
<!-- Require native type hints for all code without a BC promise -->
<!-- *********************************************************** -->
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint">
<exclude-pattern>src</exclude-pattern>
</rule>


<!-- ************************************************************* -->
<!-- Ignore errors for certain files where this is part of the API -->
<!-- ************************************************************* -->
Expand Down
Loading

0 comments on commit e94b259

Please sign in to comment.