Skip to content

Commit 736586e

Browse files
committed
Update stubs for ext-mongodb 2.0
1 parent bcf0669 commit 736586e

Some content is hidden

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

42 files changed

+160
-617
lines changed

mongodb/BSON/Binary.php

+9-20
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
use JsonSerializable;
66
use MongoDB\Driver\Exception\InvalidArgumentException;
77
use MongoDB\Driver\Exception\UnexpectedValueException;
8+
use Stringable;
89

910
/**
1011
* Class Binary
1112
* @link https://php.net/manual/en/class.mongodb-bson-binary.php
1213
*/
13-
final class Binary implements Type, BinaryInterface, \Serializable, JsonSerializable
14+
final class Binary implements Type, BinaryInterface, JsonSerializable, Stringable
1415
{
1516
public const TYPE_GENERIC = 0, TYPE_FUNCTION = 1;
1617
public const TYPE_OLD_BINARY = 2;
@@ -27,6 +28,11 @@ final class Binary implements Type, BinaryInterface, \Serializable, JsonSerializ
2728
* @since 1.12.0
2829
*/
2930
public const TYPE_COLUMN = 7;
31+
32+
/**
33+
* @since 1.17.0
34+
*/
35+
public const TYPE_SENSITIVE = 8;
3036
public const TYPE_USER_DEFINED = 128;
3137

3238
/**
@@ -47,37 +53,20 @@ final public function getData(): string {}
4753
*/
4854
final public function getType(): int {}
4955

50-
public static function __set_state(array $properties) {}
56+
public static function __set_state(array $properties): self {}
5157

5258
/**
5359
* Returns the Binary's data
5460
* @link https://www.php.net/manual/en/mongodb-bson-binary.tostring.php
5561
*/
5662
final public function __toString(): string {}
5763

58-
/**
59-
* Serialize a Binary
60-
* @since 1.2.0
61-
* @link https://www.php.net/manual/en/mongodb-bson-binary.serialize.php
62-
* @throws InvalidArgumentException
63-
*/
64-
final public function serialize(): string {}
65-
66-
/**
67-
* Unserialize a Binary
68-
* @since 1.2.0
69-
* @link https://www.php.net/manual/en/mongodb-bson-binary.unserialize.php
70-
* @throws InvalidArgumentException on argument parsing errors or if the properties are invalid
71-
* @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed)
72-
*/
73-
final public function unserialize(string $data) {}
74-
7564
/**
7665
* Returns a representation that can be converted to JSON
7766
* @since 1.2.0
7867
* @link https://www.php.net/manual/en/mongodb-bson-binary.jsonserialize.php
7968
* @return mixed data which can be serialized by json_encode()
8069
* @throws InvalidArgumentException on argument parsing errors
8170
*/
82-
final public function jsonSerialize() {}
71+
final public function jsonSerialize(): mixed {}
8372
}

mongodb/BSON/BinaryInterface.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ interface BinaryInterface
1212
* @link https://www.php.net/manual/en/mongodb-bson-binaryinterface.getdata.php
1313
* @return string Returns the BinaryInterface's data
1414
*/
15-
public function getData();
15+
public function getData(): string;
1616

1717
/**
1818
* @link https://www.php.net/manual/en/mongodb-bson-binaryinterface.gettype.php
1919
* @return int Returns the BinaryInterface's type.
2020
*/
21-
public function getType();
21+
public function getType(): int;
2222

2323
/**
2424
* This method is an alias of: MongoDB\BSON\BinaryInterface::getData().
2525
* @link https://www.php.net/manual/en/mongodb-bson-binaryinterface.tostring.php
2626
* @return string Returns the BinaryInterface's data.
2727
*/
28-
public function __toString();
28+
public function __toString(): string;
2929
}

mongodb/BSON/DBPointer.php

+4-24
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
namespace MongoDB\BSON;
44

55
use JetBrains\PhpStorm\Deprecated;
6+
use JsonSerializable;
67
use MongoDB\Driver\Exception\InvalidArgumentException;
78
use MongoDB\Driver\Exception\UnexpectedValueException;
9+
use Stringable;
810

911
/**
1012
* BSON type for the "DbPointer" type. This BSON type is deprecated, and this class can not be instantiated. It will be created from a
@@ -14,40 +16,18 @@
1416
* @link https://secure.php.net/manual/en/class.mongodb-bson-dbpointer.php
1517
*/
1618
#[Deprecated]
17-
final class DBPointer implements Type, \Serializable, \JsonSerializable
19+
final class DBPointer implements Type, JsonSerializable, Stringable
1820
{
1921
final private function __construct() {}
2022

21-
/**
22-
* Serialize a DBPointer
23-
*
24-
* @link https://www.php.net/manual/en/mongodb-bson-dbpointer.serialize.php
25-
* @return string
26-
* @throws InvalidArgumentException
27-
*/
28-
final public function serialize(): string {}
29-
30-
/**
31-
* Unserialize a DBPointer
32-
*
33-
* @link https://www.php.net/manual/en/mongodb-bson-dbpointer.unserialize.php
34-
*
35-
* @param string $serialized
36-
*
37-
* @return void
38-
* @throws InvalidArgumentException on argument parsing errors or if the properties are invalid
39-
* @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed)
40-
*/
41-
final public function unserialize(string $data): void {}
42-
4323
/**
4424
* Returns a representation that can be converted to JSON
4525
*
4626
* @link https://www.php.net/manual/en/mongodb-bson-dbpointer.jsonserialize.php
4727
* @return mixed data which can be serialized by json_encode()
4828
* @throws InvalidArgumentException on argument parsing errors
4929
*/
50-
final public function jsonSerialize() {}
30+
final public function jsonSerialize(): mixed {}
5131

5232
/**
5333
* Returns the Symbol as a string

mongodb/BSON/Decimal128.php

+4-21
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
use JsonSerializable;
66
use MongoDB\Driver\Exception\InvalidArgumentException;
77
use MongoDB\Driver\Exception\UnexpectedValueException;
8+
use Stringable;
89

910
/**
1011
* BSON type for the Decimal128 floating-point format, which supports numbers with up to 34 decimal digits (i.e. significant digits) and an exponent range of −6143 to +6144.
1112
* @link https://php.net/manual/en/class.mongodb-bson-decimal128.php
1213
*/
13-
final class Decimal128 implements Type, Decimal128Interface, \Serializable, JsonSerializable
14+
final class Decimal128 implements Type, Decimal128Interface, JsonSerializable, Stringable
1415
{
1516
/**
1617
* Construct a new Decimal128
@@ -25,25 +26,7 @@ final public function __construct(string $value = '') {}
2526
*/
2627
final public function __toString(): string {}
2728

28-
public static function __set_state(array $properties) {}
29-
30-
/**
31-
* Serialize a Decimal128
32-
* @since 1.2.0
33-
* @link https://www.php.net/manual/en/mongodb-bson-decimal128.serialize.php
34-
* @return string
35-
* @throws InvalidArgumentException
36-
*/
37-
final public function serialize(): string {}
38-
39-
/**
40-
* Unserialize a Decimal128
41-
* @since 1.2.0
42-
* @link https://www.php.net/manual/en/mongodb-bson-decimal128.unserialize.php
43-
* @throws InvalidArgumentException on argument parsing errors or if the properties are invalid
44-
* @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed)
45-
*/
46-
final public function unserialize(string $data): void {}
29+
public static function __set_state(array $properties): self {}
4730

4831
/**
4932
* Returns a representation that can be converted to JSON
@@ -52,5 +35,5 @@ final public function unserialize(string $data): void {}
5235
* @return mixed data which can be serialized by json_encode()
5336
* @throws InvalidArgumentException on argument parsing errors
5437
*/
55-
final public function jsonSerialize() {}
38+
final public function jsonSerialize(): mixed {}
5639
}

mongodb/BSON/Decimal128Interface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ interface Decimal128Interface
1313
* @link https://www.php.net/manual/en/mongodb-bson-decimal128interface.tostring.php
1414
* @return string Returns the string representation of this Decimal128Interface
1515
*/
16-
public function __toString();
16+
public function __toString(): string;
1717
}

mongodb/BSON/Document.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
namespace MongoDB\BSON;
44

5+
use ArrayAccess;
6+
use IteratorAggregate;
7+
use Stringable;
8+
59
/**
610
* @since 1.16.0
711
* @link https://secure.php.net/manual/en/class.mongodb-bson-document.php
812
*/
9-
final class Document implements \ArrayAccess, \IteratorAggregate, \Serializable
13+
final class Document implements IteratorAggregate, ArrayAccess, Type, Stringable
1014
{
1115
private function __construct() {}
1216

@@ -44,10 +48,6 @@ final public function __toString(): string {}
4448

4549
final public static function __set_state(array $properties): Document {}
4650

47-
final public function serialize(): string {}
48-
49-
final public function unserialize(string $data): void {}
50-
5151
final public function __unserialize(array $data): void {}
5252

5353
final public function __serialize(): array {}

mongodb/BSON/Int64.php

+5-18
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,31 @@
22

33
namespace MongoDB\BSON;
44

5+
use JsonSerializable;
56
use MongoDB\Driver\Exception\InvalidArgumentException;
67
use MongoDB\Driver\Exception\UnexpectedValueException;
8+
use Stringable;
79

810
/**
911
* BSON type for a 64-bit integer.
1012
*
1113
* @since 1.5.0
1214
* @link https://secure.php.net/manual/en/class.mongodb-bson-int64.php
1315
*/
14-
final class Int64 implements Type, \Serializable, \JsonSerializable
16+
final class Int64 implements Type, JsonSerializable, Stringable
1517
{
1618
/** @since 1.16.0 */
1719
final public function __construct(string|int $value) {}
1820

19-
/**
20-
* Serialize an Int64
21-
* @link https://www.php.net/manual/en/mongodb-bson-int64.serialize.php
22-
* @throws InvalidArgumentException
23-
*/
24-
final public function serialize(): string {}
25-
26-
public static function __set_state(array $properties) {}
27-
28-
/**
29-
* Unserialize an Int64
30-
* @link https://www.php.net/manual/en/mongodb-bson-int64.unserialize.php
31-
* @throws InvalidArgumentException on argument parsing errors or if the properties are invalid
32-
* @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed)
33-
*/
34-
final public function unserialize(string $data): void {}
21+
public static function __set_state(array $properties): self {}
3522

3623
/**
3724
* Returns a representation that can be converted to JSON
3825
* @link https://www.php.net/manual/en/mongodb-bson-int64.jsonserialize.php
3926
* @return mixed data which can be serialized by json_encode()
4027
* @throws InvalidArgumentException on argument parsing errors
4128
*/
42-
final public function jsonSerialize() {}
29+
final public function jsonSerialize(): mixed {}
4330

4431
/**
4532
* Returns the Symbol as a string

mongodb/BSON/Javascript.php

+4-20
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,21 @@
55
use JsonSerializable;
66
use MongoDB\Driver\Exception\InvalidArgumentException;
77
use MongoDB\Driver\Exception\UnexpectedValueException;
8+
use Stringable;
89

910
/**
1011
* Class Javascript
1112
* @link https://php.net/manual/en/class.mongodb-bson-javascript.php
1213
*/
13-
final class Javascript implements Type, JavascriptInterface, \Serializable, JsonSerializable
14+
final class Javascript implements Type, JavascriptInterface, JsonSerializable, Stringable
1415
{
1516
/**
1617
* Construct a new Javascript
1718
* @link https://php.net/manual/en/mongodb-bson-javascript.construct.php
1819
*/
1920
final public function __construct(string $javascript, array|object|null $scope = null) {}
2021

21-
public static function __set_state(array $properties) {}
22+
public static function __set_state(array $properties): self {}
2223

2324
/**
2425
* Returns the Javascript's code
@@ -38,29 +39,12 @@ final public function getScope(): ?object {}
3839
*/
3940
final public function __toString(): string {}
4041

41-
/**
42-
* Serialize a Javascript
43-
* @since 1.2.0
44-
* @link https://www.php.net/manual/en/mongodb-bson-javascript.serialize.php
45-
* @throws InvalidArgumentException
46-
*/
47-
final public function serialize(): string {}
48-
49-
/**
50-
* Unserialize a Javascript
51-
* @since 1.2.0
52-
* @link https://www.php.net/manual/en/mongodb-bson-javascript.unserialize.php
53-
* @throws InvalidArgumentException on argument parsing errors or if the properties are invalid
54-
* @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed)
55-
*/
56-
final public function unserialize(string $data): void {}
57-
5842
/**
5943
* Returns a representation that can be converted to JSON
6044
* @since 1.2.0
6145
* @link https://www.php.net/manual/en/mongodb-bson-javascript.jsonserialize.php
6246
* @return mixed data which can be serialized by json_encode()
6347
* @throws InvalidArgumentException on argument parsing errors
6448
*/
65-
final public function jsonSerialize() {}
49+
final public function jsonSerialize(): mixed {}
6650
}

mongodb/BSON/JavascriptInterface.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ interface JavascriptInterface
1616
* @link https://secure.php.net/manual/en/mongodb-bson-javascriptinterface.getcode.php
1717
* @since 1.3.0
1818
*/
19-
public function getCode();
19+
public function getCode(): string;
2020

2121
/**
2222
* Returns the JavascriptInterface's scope document
2323
* @return object|null
2424
* @link https://secure.php.net/manual/en/mongodb-bson-javascriptinterface.getscope.php
2525
* @since 1.3.0
2626
*/
27-
public function getScope();
27+
public function getScope(): ?object;
2828

2929
/**
3030
* Returns the JavascriptInterface's code
3131
* @return string
3232
* @link https://secure.php.net/manual/en/mongodb-bson-javascriptinterface.tostring.php
3333
* @since 1.3.0
3434
*/
35-
public function __toString();
35+
public function __toString(): string;
3636
}

mongodb/BSON/MaxKey.php

+3-20
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,9 @@
1010
* Class MaxKey
1111
* @link https://php.net/manual/en/class.mongodb-bson-maxkey.php
1212
*/
13-
final class MaxKey implements Type, MaxKeyInterface, \Serializable, JsonSerializable
13+
final class MaxKey implements Type, MaxKeyInterface, JsonSerializable
1414
{
15-
public static function __set_state(array $properties) {}
16-
17-
/**
18-
* Serialize a MaxKey
19-
* @since 1.2.0
20-
* @link https://www.php.net/manual/en/mongodb-bson-maxkey.serialize.php
21-
* @throws InvalidArgumentException
22-
*/
23-
final public function serialize(): string {}
24-
25-
/**
26-
* Unserialize a MaxKey
27-
* @since 1.2.0
28-
* @link https://www.php.net/manual/en/mongodb-bson-maxkey.unserialize.php
29-
* @throws InvalidArgumentException on argument parsing errors or if the properties are invalid
30-
* @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed)
31-
*/
32-
final public function unserialize(string $data): void {}
15+
public static function __set_state(array $properties): self {}
3316

3417
/**
3518
* Returns a representation that can be converted to JSON
@@ -38,5 +21,5 @@ final public function unserialize(string $data): void {}
3821
* @return mixed data which can be serialized by json_encode()
3922
* @throws InvalidArgumentException on argument parsing errors
4023
*/
41-
final public function jsonSerialize() {}
24+
final public function jsonSerialize(): mixed {}
4225
}

0 commit comments

Comments
 (0)