Skip to content

Commit 26a503a

Browse files
authored
PHPC-2140: Make tentative return types definitive (#1658)
* PHPC-2140: Make tentative return types definitive * Change return type of manager and server methods to CursorInterface * Define return types for key() and current() in CursorInterface * Add upgrade note
1 parent ea94e98 commit 26a503a

Some content is hidden

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

55 files changed

+109
-156
lines changed

UPGRADE-2.0.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ UPGRADE FROM 1.x to 2.0
99
* The constants `MongoDB\Driver\ClientEncryption::ALGORITHM_RANGE_PREVIEW` and
1010
`MongoDB\Driver\ClientEncryption::QUERY_TYPE_RANGE_PREVIEW` have been
1111
removed. Use the `ALGORITHM_RANGE` and `QUERY_TYPE_RANGE` instead.
12+
* All tentative return types defined in interface and non-final classes are now
13+
fixed and are required in implementing or extending classes.
14+
* `MongoDB\Driver\CursorInterface` now extends `Iterator`, requiring
15+
implementing classes to also implement iterator methods. The return types for
16+
the `key` and `current` methods have been narrowed to the types returned by
17+
cursor instances.

src/BSON/BinaryInterface.stub.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99

1010
interface BinaryInterface
1111
{
12-
/** @tentative-return-type */
1312
public function getData(): string;
1413

15-
/** @tentative-return-type */
1614
public function getType(): int;
1715

1816
public function __toString(): string;

src/BSON/BinaryInterface_arginfo.h

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/BSON/Decimal128Interface.stub.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@
99

1010
interface Decimal128Interface
1111
{
12-
/** @tentative-return-type */
1312
public function __toString(): string;
1413
}

src/BSON/Decimal128Interface_arginfo.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/BSON/JavascriptInterface.stub.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@
99

1010
interface JavascriptInterface
1111
{
12-
/** @tentative-return-type */
1312
public function getCode(): string;
1413

15-
/** @tentative-return-type */
1614
public function getScope(): ?object;
1715

18-
/** @tentative-return-type */
1916
public function __toString(): string;
2017
}

src/BSON/JavascriptInterface_arginfo.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/BSON/ObjectIdInterface.stub.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99

1010
interface ObjectIdInterface
1111
{
12-
/** @tentative-return-type */
1312
public function getTimestamp(): int;
1413

15-
/** @tentative-return-type */
1614
public function __toString(): string;
1715
}

src/BSON/ObjectIdInterface_arginfo.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/BSON/Persistable.stub.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@
99

1010
interface Persistable extends Serializable, Unserializable
1111
{
12-
/** @tentative-return-type */
1312
public function bsonSerialize(): array|\stdClass|Document;
1413
}

0 commit comments

Comments
 (0)