Skip to content

Commit 98e67cb

Browse files
committed
Update stubs for ext-mongodb 2.0
1 parent def1c15 commit 98e67cb

Some content is hidden

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

43 files changed

+160
-644
lines changed

PhpStormStubsMap.php

-9
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,6 @@ final class PhpStormStubsMap
710710
'MongoDB\\Driver\\ClientEncryption' => 'mongodb/ClientEncryption.php',
711711
'MongoDB\\Driver\\Command' => 'mongodb/Command.php',
712712
'MongoDB\\Driver\\Cursor' => 'mongodb/Cursor.php',
713-
'MongoDB\\Driver\\CursorId' => 'mongodb/CursorId.php',
714713
'MongoDB\\Driver\\CursorInterface' => 'mongodb/CursorInterface.php',
715714
'MongoDB\\Driver\\Exception\\AuthenticationException' => 'mongodb/Exception/AuthenticationException.php',
716715
'MongoDB\\Driver\\Exception\\BulkWriteException' => 'mongodb/Exception/BulkWriteException.php',
@@ -723,11 +722,9 @@ final class PhpStormStubsMap
723722
'MongoDB\\Driver\\Exception\\InvalidArgumentException' => 'mongodb/Exception/InvalidArgumentException.php',
724723
'MongoDB\\Driver\\Exception\\LogicException' => 'mongodb/Exception/LogicException.php',
725724
'MongoDB\\Driver\\Exception\\RuntimeException' => 'mongodb/Exception/RuntimeException.php',
726-
'MongoDB\\Driver\\Exception\\SSLConnectionException' => 'mongodb/Exception/SSLConnectionException.php',
727725
'MongoDB\\Driver\\Exception\\ServerException' => 'mongodb/Exception/ServerException.php',
728726
'MongoDB\\Driver\\Exception\\UnexpectedValueException' => 'mongodb/Exception/UnexpectedValueException.php',
729727
'MongoDB\\Driver\\Exception\\WriteConcernException' => 'mongodb/Exception/WriteConcernException.php',
730-
'MongoDB\\Driver\\Exception\\WriteException' => 'mongodb/Exception/WriteException.php',
731728
'MongoDB\\Driver\\Manager' => 'mongodb/Manager.php',
732729
'MongoDB\\Driver\\Monitoring\\CommandFailedEvent' => 'mongodb/Monitoring/CommandFailedEvent.php',
733730
'MongoDB\\Driver\\Monitoring\\CommandStartedEvent' => 'mongodb/Monitoring/CommandStartedEvent.php',
@@ -1466,12 +1463,6 @@ final class PhpStormStubsMap
14661463
'GEOSRelateMatch' => 'geos/geos.php',
14671464
'GEOSSharedPaths' => 'geos/geos.php',
14681465
'GEOSVersion' => 'geos/geos.php',
1469-
'MongoDB\\BSON\\fromJSON' => 'mongodb/BSON/functions.php',
1470-
'MongoDB\\BSON\\fromPHP' => 'mongodb/BSON/functions.php',
1471-
'MongoDB\\BSON\\toCanonicalExtendedJSON' => 'mongodb/BSON/functions.php',
1472-
'MongoDB\\BSON\\toJSON' => 'mongodb/BSON/functions.php',
1473-
'MongoDB\\BSON\\toPHP' => 'mongodb/BSON/functions.php',
1474-
'MongoDB\\BSON\\toRelaxedExtendedJSON' => 'mongodb/BSON/functions.php',
14751466
'MongoDB\\Driver\\Monitoring\\addSubscriber' => 'mongodb/Monitoring/functions.php',
14761467
'MongoDB\\Driver\\Monitoring\\removeSubscriber' => 'mongodb/Monitoring/functions.php',
14771468
'OpenTelemetry\\Instrumentation\\hook' => 'opentelemetry/opentelemetry.php',

mongodb/BSON/Binary.php

+9-21
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
use JsonSerializable;
66
use MongoDB\Driver\Exception\InvalidArgumentException;
7-
use MongoDB\Driver\Exception\UnexpectedValueException;
7+
use Stringable;
88

99
/**
1010
* Class Binary
1111
* @link https://php.net/manual/en/class.mongodb-bson-binary.php
1212
*/
13-
final class Binary implements Type, BinaryInterface, \Serializable, JsonSerializable
13+
final class Binary implements Type, BinaryInterface, JsonSerializable, Stringable
1414
{
1515
public const TYPE_GENERIC = 0, TYPE_FUNCTION = 1;
1616
public const TYPE_OLD_BINARY = 2;
@@ -27,6 +27,11 @@ final class Binary implements Type, BinaryInterface, \Serializable, JsonSerializ
2727
* @since 1.12.0
2828
*/
2929
public const TYPE_COLUMN = 7;
30+
31+
/**
32+
* @since 1.17.0
33+
*/
34+
public const TYPE_SENSITIVE = 8;
3035
public const TYPE_USER_DEFINED = 128;
3136

3237
/**
@@ -47,37 +52,20 @@ final public function getData(): string {}
4752
*/
4853
final public function getType(): int {}
4954

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

5257
/**
5358
* Returns the Binary's data
5459
* @link https://www.php.net/manual/en/mongodb-bson-binary.tostring.php
5560
*/
5661
final public function __toString(): string {}
5762

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-
7563
/**
7664
* Returns a representation that can be converted to JSON
7765
* @since 1.2.0
7866
* @link https://www.php.net/manual/en/mongodb-bson-binary.jsonserialize.php
7967
* @return mixed data which can be serialized by json_encode()
8068
* @throws InvalidArgumentException on argument parsing errors
8169
*/
82-
final public function jsonSerialize() {}
70+
final public function jsonSerialize(): mixed {}
8371
}

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-25
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
namespace MongoDB\BSON;
44

55
use JetBrains\PhpStorm\Deprecated;
6+
use JsonSerializable;
67
use MongoDB\Driver\Exception\InvalidArgumentException;
7-
use MongoDB\Driver\Exception\UnexpectedValueException;
8+
use Stringable;
89

910
/**
1011
* 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 +15,18 @@
1415
* @link https://secure.php.net/manual/en/class.mongodb-bson-dbpointer.php
1516
*/
1617
#[Deprecated]
17-
final class DBPointer implements Type, \Serializable, \JsonSerializable
18+
final class DBPointer implements Type, JsonSerializable, Stringable
1819
{
1920
final private function __construct() {}
2021

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-
4322
/**
4423
* Returns a representation that can be converted to JSON
4524
*
4625
* @link https://www.php.net/manual/en/mongodb-bson-dbpointer.jsonserialize.php
4726
* @return mixed data which can be serialized by json_encode()
4827
* @throws InvalidArgumentException on argument parsing errors
4928
*/
50-
final public function jsonSerialize() {}
29+
final public function jsonSerialize(): mixed {}
5130

5231
/**
5332
* Returns the Symbol as a string

mongodb/BSON/Decimal128.php

+4-22
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
use JsonSerializable;
66
use MongoDB\Driver\Exception\InvalidArgumentException;
7-
use MongoDB\Driver\Exception\UnexpectedValueException;
7+
use Stringable;
88

99
/**
1010
* 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.
1111
* @link https://php.net/manual/en/class.mongodb-bson-decimal128.php
1212
*/
13-
final class Decimal128 implements Type, Decimal128Interface, \Serializable, JsonSerializable
13+
final class Decimal128 implements Type, Decimal128Interface, JsonSerializable, Stringable
1414
{
1515
/**
1616
* Construct a new Decimal128
@@ -25,25 +25,7 @@ final public function __construct(string $value = '') {}
2525
*/
2626
final public function __toString(): string {}
2727

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 {}
28+
public static function __set_state(array $properties): self {}
4729

4830
/**
4931
* Returns a representation that can be converted to JSON
@@ -52,5 +34,5 @@ final public function unserialize(string $data): void {}
5234
* @return mixed data which can be serialized by json_encode()
5335
* @throws InvalidArgumentException on argument parsing errors
5436
*/
55-
final public function jsonSerialize() {}
37+
final public function jsonSerialize(): mixed {}
5638
}

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-19
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,30 @@
22

33
namespace MongoDB\BSON;
44

5+
use JsonSerializable;
56
use MongoDB\Driver\Exception\InvalidArgumentException;
6-
use MongoDB\Driver\Exception\UnexpectedValueException;
7+
use Stringable;
78

89
/**
910
* BSON type for a 64-bit integer.
1011
*
1112
* @since 1.5.0
1213
* @link https://secure.php.net/manual/en/class.mongodb-bson-int64.php
1314
*/
14-
final class Int64 implements Type, \Serializable, \JsonSerializable
15+
final class Int64 implements Type, JsonSerializable, Stringable
1516
{
1617
/** @since 1.16.0 */
1718
final public function __construct(string|int $value) {}
1819

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 {}
20+
public static function __set_state(array $properties): self {}
3521

3622
/**
3723
* Returns a representation that can be converted to JSON
3824
* @link https://www.php.net/manual/en/mongodb-bson-int64.jsonserialize.php
3925
* @return mixed data which can be serialized by json_encode()
4026
* @throws InvalidArgumentException on argument parsing errors
4127
*/
42-
final public function jsonSerialize() {}
28+
final public function jsonSerialize(): mixed {}
4329

4430
/**
4531
* Returns the Symbol as a string

mongodb/BSON/Javascript.php

+4-21
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44

55
use JsonSerializable;
66
use MongoDB\Driver\Exception\InvalidArgumentException;
7-
use MongoDB\Driver\Exception\UnexpectedValueException;
7+
use Stringable;
88

99
/**
1010
* Class Javascript
1111
* @link https://php.net/manual/en/class.mongodb-bson-javascript.php
1212
*/
13-
final class Javascript implements Type, JavascriptInterface, \Serializable, JsonSerializable
13+
final class Javascript implements Type, JavascriptInterface, JsonSerializable, Stringable
1414
{
1515
/**
1616
* Construct a new Javascript
1717
* @link https://php.net/manual/en/mongodb-bson-javascript.construct.php
1818
*/
1919
final public function __construct(string $javascript, array|object|null $scope = null) {}
2020

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

2323
/**
2424
* Returns the Javascript's code
@@ -38,29 +38,12 @@ final public function getScope(): ?object {}
3838
*/
3939
final public function __toString(): string {}
4040

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-
5841
/**
5942
* Returns a representation that can be converted to JSON
6043
* @since 1.2.0
6144
* @link https://www.php.net/manual/en/mongodb-bson-javascript.jsonserialize.php
6245
* @return mixed data which can be serialized by json_encode()
6346
* @throws InvalidArgumentException on argument parsing errors
6447
*/
65-
final public function jsonSerialize() {}
48+
final public function jsonSerialize(): mixed {}
6649
}

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
}

0 commit comments

Comments
 (0)