diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 79e52172b..679d22906 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,6 +43,9 @@ jobs: - name: Composer Install run: docker-compose -f docker-compose.yml run test_runner composer install + - name: Test PhpDoc + run: docker-compose -f docker-compose.yml run test_runner vendor/bin/phpunit --testsuite PhpDoc + - name: Test Stubs Map, Structure and Reflection run: docker-compose -f docker-compose.yml run test_runner vendor/bin/phpunit --testsuite Structure diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..8eca7ef80 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,34 @@ +### Code of Conduct + +This code of conduct outlines our expectations for all those who participate in our open source projects and communities (community programs), as well as the consequences for unacceptable behaviour. We invite all those who participate to help us create safe and positive experiences for everyone. Communities mirror the societies in which they exist and positive action is essential to counteract the many forms of inequality and abuses of power that exist in society. + +#### How to behave +The following behaviours are expected and requested of all community members: + +* Participate in an authentic and active way. In doing so, you contribute to the health and longevity of this community. +* Exercise consideration, respect and empathy in your speech and actions. Remember, we have all been through different stages of learning when adopting technologies. +* Refrain from demeaning, discriminatory, or harassing behaviour and speech. +* Disagreements on things are fine, argumentative behaviour or trolling are not. + +#### How not to behave + +* Do not perform threats of violence or use violent language directed against another person. +* Do not make jokes of sexist, racist, homophobic, transphobic, ableist or otherwise discriminatory nature, or use language of this nature. +* Do not post or display sexually explicit or violent material. +* Do not post or threaten to post other people’s personally identifying information ("doxing"). +* Do not make personal insults, particularly those related to gender, sexual orientation, race, religion, or disability. +* Do not engage in sexual attention. This includes, sexualised comments or jokes and sexual advances. +* Do not advocate for, or encourage, any of the above behaviour. + +Please take into account that online communities bring together people from many different cultures and backgrounds. It's important to understand that sometimes the combination of cultural differences and online interaction can lead to misunderstandings. That is why having empathy is very important. + +#### How to report issues + +If someone is acting inappropriately or violating this Code of Conduct in any shape or form, and they are not receptive to your feedback or you prefer not to confront them, please reach out to JetBrains via codeofconduct@jetbrains.com + +#### Consequences of Unacceptable Behaviour + +Unacceptable behaviour from any community member will not be tolerated. Anyone asked to stop unacceptable behaviour is expected to comply immediately. If a community member engages in unacceptable behaviour, JetBrains and/or community organisers may take any action they deem appropriate, up to and including a temporary ban or permanent expulsion from the community without warning. + +##### License and attribution +The license is based off of The Citizen Code of Conduct is distributed by Stumptown Syndicate under a Creative Commons Attribution-ShareAlike license. diff --git a/Core/Core.php b/Core/Core.php index e5b1857e0..7e4d5b5ac 100755 --- a/Core/Core.php +++ b/Core/Core.php @@ -326,7 +326,7 @@ function error_reporting(?int $error_level): int {} * It is possible to define resource constants, * however it is not recommended and may cause unpredictable behavior. *

- * @param bool $case_insensitive

+ * @param bool $case_insensitive [optional]

* If set to true, the constant will be defined case-insensitive. * The default behavior is case-sensitive; i.e. * CONSTANT and Constant represent @@ -341,8 +341,7 @@ function error_reporting(?int $error_level): int {} function define( string $constant_name, #[LanguageLevelTypeAware(['8.1' => 'mixed'], default: 'null|array|bool|int|float|string')] $value, - #[PhpStormStubsElementAvailable(from: '5.3', to: '5.6')] bool $case_insensitive, - #[PhpStormStubsElementAvailable(from: '7.0')] #[Deprecated(since: 7.3)] bool $case_insensitive = false + #[Deprecated(since: "7.3")] bool $case_insensitive = false ): bool {} /** diff --git a/Core/Core_c.php b/Core/Core_c.php index 93f091f69..696095752 100644 --- a/Core/Core_c.php +++ b/Core/Core_c.php @@ -653,7 +653,7 @@ public function __invoke(...$_) {} * @param mixed $newScope The class scope to which associate the closure is to be associated, or 'static' to keep the current one. * If an object is given, the type of the object will be used instead. * This determines the visibility of protected and private methods of the bound object. - * @return Closure|false Returns the newly created Closure object or FALSE on failure + * @return Closure|null Returns the newly created Closure object or null on failure */ public function bindTo(?object $newThis, object|string|null $newScope = 'static'): ?Closure {} @@ -666,7 +666,7 @@ public function bindTo(?object $newThis, object|string|null $newScope = 'static' * @param mixed $newScope The class scope to which associate the closure is to be associated, or 'static' to keep the current one. * If an object is given, the type of the object will be used instead. * This determines the visibility of protected and private methods of the bound object. - * @return Closure|false Returns the newly created Closure object or FALSE on failure + * @return Closure|null Returns the newly created Closure object or null on failure */ public static function bind(Closure $closure, ?object $newThis, object|string|null $newScope = 'static'): ?Closure {} @@ -1057,7 +1057,7 @@ public function isTerminated(): bool {} public function getReturn(): mixed {} /** - * @return self|null Returns the currently executing fiber instance or NULL if in {main}. + * @return Fiber|null Returns the currently executing fiber instance or NULL if in {main}. */ public static function getCurrent(): ?Fiber {} diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..ffbec714c --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2010-2023 JetBrains s.r.o. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/PDO/PDO.php b/PDO/PDO.php index e1fc82d80..98c06135a 100644 --- a/PDO/PDO.php +++ b/PDO/PDO.php @@ -963,7 +963,10 @@ public function __construct( * so PDO::prepare does not check the statement. */ #[TentativeType] - public function prepare(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $query, array $options = []): PDOStatement|false {} + public function prepare( + #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $query, + #[LanguageLevelTypeAware(['8.0' => 'array'], default: '')] $options = [] + ): PDOStatement|false {} /** * (PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
@@ -1070,13 +1073,13 @@ public function exec(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] * (PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.2.0)
* Executes an SQL statement, returning a result set as a PDOStatement object * @link https://php.net/manual/en/pdo.query.php - * @param string $statement

+ * @param string $query

* The SQL statement to prepare and execute. *

*

* Data inside the query should be properly escaped. *

- * @param int $mode

+ * @param int $fetchMode

* The fetch mode must be one of the PDO::FETCH_* constants. *

* @param mixed $arg3

@@ -1091,22 +1094,22 @@ public function exec(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] * @see PDOStatement::setFetchMode For a full description of the second and following parameters. */ #[PhpStormStubsElementAvailable(to: '7.4')] - public function query($statement, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = []) {} + public function query($query, $fetchMode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, $ctorargs = []) {} /** - * (PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.2.0)
+ * (PHP 5 >= 5.1.0, PHP 7, PHP 8, PECL pdo >= 0.2.0)
* Executes an SQL statement, returning a result set as a PDOStatement object * @link https://php.net/manual/en/pdo.query.php - * @param string $statement

+ * @param string $query

* The SQL statement to prepare and execute. *

*

* Data inside the query should be properly escaped. *

- * @param int $mode

+ * @param int|null $fetchMode

* The fetch mode must be one of the PDO::FETCH_* constants. *

- * @param mixed $fetch_mode_args

+ * @param mixed ...$fetch_mode_args

* Arguments of custom class constructor when the mode * parameter is set to PDO::FETCH_CLASS. *

@@ -1115,7 +1118,11 @@ public function query($statement, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = * @see PDOStatement::setFetchMode For a full description of the second and following parameters. */ #[PhpStormStubsElementAvailable('8.0')] - public function query($statement, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, ...$fetch_mode_args) {} + public function query( + #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $query, + #[LanguageLevelTypeAware(['8.0' => 'int|null'], default: '')] $fetchMode = null, + #[LanguageLevelTypeAware(['8.0' => 'mixed'], default: '')] ...$fetch_mode_args + ) {} /** * (PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
@@ -1275,6 +1282,40 @@ final public function __sleep() {} #[TentativeType] public static function getAvailableDrivers(): array {} + /** + * (PHP 5 >= 5.1.0, PHP 7, PECL pdo_sqlite >= 1.0.0)
+ * Registers an aggregating User Defined Function for use in SQL statements + * @link https://php.net/manual/en/pdo.sqlitecreateaggregate.php + * @param string $function_name

+ * The name of the function used in SQL statements. + *

+ * @param callable $step_func

+ * Callback function called for each row of the result set. Your PHP function should accumulate the result and store it in the aggregation context. + *

+ * @param callable $finalize_func

+ * Callback function to aggregate the "stepped" data from each row. Once all the rows have been processed, this function will be called and it should then take the data from the aggregation context and return the result. This callback function should return a type understood by SQLite (i.e. scalar type). + *

+ * @param int $num_args [optional]

+ * Hint to the SQLite parser if the callback function accepts a predetermined number of arguments. + *

+ * @return bool TRUE on success or FALSE on failure. + */ + public function sqliteCreateAggregate($function_name, $step_func, $finalize_func, $num_args = -1) {} + + /** + * (PHP 5 >= 5.3.11, PHP 7)
+ * Registers a User Defined Function for use as a collating function in SQL statements + * @link https://php.net/manual/en/pdo.sqlitecreatecollation.php + * @param string $name

+ * Name of the SQL collating function to be created or redefined. + *

+ * @param callable $callback

+ * The name of a PHP function or user-defined function to apply as a callback, defining the behavior of the collation. It should accept two strings and return as strcmp() does, i.e. it should return -1, 1, or 0 if the first string sorts before, sorts after, or is equal to the second. + *

+ * @return bool TRUE on success or FALSE on failure. + */ + public function sqliteCreateCollation($name, $callback) {} + /** * (PHP 5 >= 5.1.0, PHP 7, PECL pdo_sqlite >= 1.0.0)
* Registers a User Defined Function for use in SQL statements @@ -1672,7 +1713,7 @@ public function fetchColumn(#[LanguageLevelTypeAware(['8.0' => 'int'], default: * column, bitwise-OR PDO::FETCH_COLUMN with * PDO::FETCH_GROUP. *

- * @param mixed ...$args [optional]

+ * @param mixed ...$args

* Arguments of custom class constructor when the fetch_style * parameter is PDO::FETCH_CLASS. *

@@ -1713,7 +1754,10 @@ public function fetchAll( * correspond to the column names or FALSE on failure. */ #[TentativeType] - public function fetchObject(#[LanguageLevelTypeAware(['8.0' => 'string|null'], default: '')] $class = "stdClass", array $constructorArgs = []): object|false {} + public function fetchObject( + #[LanguageLevelTypeAware(['8.0' => 'string|null'], default: '')] $class = "stdClass", + #[LanguageLevelTypeAware(['8.0' => 'array'], default: '')] $constructorArgs = [] + ): object|false {} /** * (PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
@@ -1877,7 +1921,7 @@ public function getColumnMeta(#[LanguageLevelTypeAware(['8.0' => 'int'], default * @return bool TRUE on success or FALSE on failure. */ #[PhpStormStubsElementAvailable(to: '7.4')] - public function setFetchMode($mode, $className = null, array $params = []) {} + public function setFetchMode($mode, $className = null, $params = []) {} /** * (PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.2.0)
diff --git a/PhpStormStubsMap.php b/PhpStormStubsMap.php index 59c57d354..0b7d2f538 100644 --- a/PhpStormStubsMap.php +++ b/PhpStormStubsMap.php @@ -25,7 +25,6 @@ final class PhpStormStubsMap 'AMQPQueue' => 'amqp/amqp.php', 'AMQPQueueException' => 'amqp/amqp.php', 'AMQPTimestamp' => 'amqp/amqp.php', - 'AMQPValueException' => 'amqp/amqp.php', 'APCIterator' => 'apcu/apcu.php', 'APCUIterator' => 'apcu/apcu.php', 'AddressInfo' => 'sockets/sockets.php', @@ -627,70 +626,85 @@ final class PhpStormStubsMap 'MongoCursorTimeoutException' => 'mongo/mongo.php', 'MongoDB' => 'mongo/mongo.php', 'MongoDBRef' => 'mongo/mongo.php', - 'MongoDB\\BSON\\Binary' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\BinaryInterface' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\DBPointer' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\Decimal128' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\Decimal128Interface' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\Int64' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\Javascript' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\JavascriptInterface' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\MaxKey' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\MaxKeyInterface' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\MinKey' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\MinKeyInterface' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\ObjectId' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\ObjectIdInterface' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\Persistable' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\Regex' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\RegexInterface' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\Serializable' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\Symbol' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\Timestamp' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\TimestampInterface' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\Type' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\UTCDateTime' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\UTCDateTimeInterface' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\Undefined' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\Unserializable' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\BulkWrite' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\ClientEncryption' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Command' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Cursor' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\CursorId' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\CursorInterface' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Exception\\AuthenticationException' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Exception\\BulkWriteException' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Exception\\CommandException' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Exception\\ConnectionException' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Exception\\ConnectionTimeoutException' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Exception\\EncryptionException' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Exception\\Exception' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Exception\\ExecutionTimeoutException' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Exception\\InvalidArgumentException' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Exception\\LogicException' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Exception\\RuntimeException' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Exception\\SSLConnectionException' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Exception\\ServerException' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Exception\\UnexpectedValueException' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Exception\\WriteConcernException' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Exception\\WriteException' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Manager' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Monitoring\\CommandFailedEvent' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Monitoring\\CommandStartedEvent' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Monitoring\\CommandSubscriber' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Monitoring\\CommandSucceededEvent' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Monitoring\\Subscriber' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Query' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\ReadConcern' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\ReadPreference' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Server' => 'mongodb/mongodb.php', + 'MongoDB\\BSON\\Binary' => 'mongodb/BSON/Binary.php', + 'MongoDB\\BSON\\BinaryInterface' => 'mongodb/BSON/BinaryInterface.php', + 'MongoDB\\BSON\\DBPointer' => 'mongodb/BSON/DBPointer.php', + 'MongoDB\\BSON\\Decimal128' => 'mongodb/BSON/Decimal128.php', + 'MongoDB\\BSON\\Decimal128Interface' => 'mongodb/BSON/Decimal128Interface.php', + 'MongoDB\\BSON\\Document' => 'mongodb/BSON/Document.php', + 'MongoDB\\BSON\\Int64' => 'mongodb/BSON/Int64.php', + 'MongoDB\\BSON\\Iterator' => 'mongodb/BSON/Iterator.php', + 'MongoDB\\BSON\\Javascript' => 'mongodb/BSON/Javascript.php', + 'MongoDB\\BSON\\JavascriptInterface' => 'mongodb/BSON/JavascriptInterface.php', + 'MongoDB\\BSON\\MaxKey' => 'mongodb/BSON/MaxKey.php', + 'MongoDB\\BSON\\MaxKeyInterface' => 'mongodb/BSON/MaxKeyInterface.php', + 'MongoDB\\BSON\\MinKey' => 'mongodb/BSON/MinKey.php', + 'MongoDB\\BSON\\MinKeyInterface' => 'mongodb/BSON/MinKeyInterface.php', + 'MongoDB\\BSON\\ObjectId' => 'mongodb/BSON/ObjectId.php', + 'MongoDB\\BSON\\ObjectIdInterface' => 'mongodb/BSON/ObjectIdInterface.php', + 'MongoDB\\BSON\\PackedArray' => 'mongodb/BSON/PackedArray.php', + 'MongoDB\\BSON\\Persistable' => 'mongodb/BSON/Persistable.php', + 'MongoDB\\BSON\\Regex' => 'mongodb/BSON/Regex.php', + 'MongoDB\\BSON\\RegexInterface' => 'mongodb/BSON/RegexInterface.php', + 'MongoDB\\BSON\\Serializable' => 'mongodb/BSON/Serializable.php', + 'MongoDB\\BSON\\Symbol' => 'mongodb/BSON/Symbol.php', + 'MongoDB\\BSON\\Timestamp' => 'mongodb/BSON/Timestamp.php', + 'MongoDB\\BSON\\TimestampInterface' => 'mongodb/BSON/TimestampInterface.php', + 'MongoDB\\BSON\\Type' => 'mongodb/BSON/Type.php', + 'MongoDB\\BSON\\UTCDateTime' => 'mongodb/BSON/UTCDateTime.php', + 'MongoDB\\BSON\\UTCDateTimeInterface' => 'mongodb/BSON/UTCDateTimeInterface.php', + 'MongoDB\\BSON\\Undefined' => 'mongodb/BSON/Undefined.php', + 'MongoDB\\BSON\\Unserializable' => 'mongodb/BSON/Unserializable.php', + 'MongoDB\\Driver\\BulkWrite' => 'mongodb/BulkWrite.php', + 'MongoDB\\Driver\\ClientEncryption' => 'mongodb/ClientEncryption.php', + 'MongoDB\\Driver\\Command' => 'mongodb/Command.php', + 'MongoDB\\Driver\\Cursor' => 'mongodb/Cursor.php', + 'MongoDB\\Driver\\CursorId' => 'mongodb/CursorId.php', + 'MongoDB\\Driver\\CursorInterface' => 'mongodb/CursorInterface.php', + 'MongoDB\\Driver\\Exception\\AuthenticationException' => 'mongodb/Exception/AuthenticationException.php', + 'MongoDB\\Driver\\Exception\\BulkWriteException' => 'mongodb/Exception/BulkWriteException.php', + 'MongoDB\\Driver\\Exception\\CommandException' => 'mongodb/Exception/CommandException.php', + 'MongoDB\\Driver\\Exception\\ConnectionException' => 'mongodb/Exception/ConnectionException.php', + 'MongoDB\\Driver\\Exception\\ConnectionTimeoutException' => 'mongodb/Exception/ConnectionTimeoutException.php', + 'MongoDB\\Driver\\Exception\\EncryptionException' => 'mongodb/Exception/EncryptionException.php', + 'MongoDB\\Driver\\Exception\\Exception' => 'mongodb/Exception/Exception.php', + 'MongoDB\\Driver\\Exception\\ExecutionTimeoutException' => 'mongodb/Exception/ExecutionTimeoutException.php', + 'MongoDB\\Driver\\Exception\\InvalidArgumentException' => 'mongodb/Exception/InvalidArgumentException.php', + 'MongoDB\\Driver\\Exception\\LogicException' => 'mongodb/Exception/LogicException.php', + 'MongoDB\\Driver\\Exception\\RuntimeException' => 'mongodb/Exception/RuntimeException.php', + 'MongoDB\\Driver\\Exception\\SSLConnectionException' => 'mongodb/Exception/SSLConnectionException.php', + 'MongoDB\\Driver\\Exception\\ServerException' => 'mongodb/Exception/ServerException.php', + 'MongoDB\\Driver\\Exception\\UnexpectedValueException' => 'mongodb/Exception/UnexpectedValueException.php', + 'MongoDB\\Driver\\Exception\\WriteConcernException' => 'mongodb/Exception/WriteConcernException.php', + 'MongoDB\\Driver\\Exception\\WriteException' => 'mongodb/Exception/WriteException.php', + 'MongoDB\\Driver\\Manager' => 'mongodb/Manager.php', + 'MongoDB\\Driver\\Monitoring\\CommandFailedEvent' => 'mongodb/Monitoring/CommandFailedEvent.php', + 'MongoDB\\Driver\\Monitoring\\CommandStartedEvent' => 'mongodb/Monitoring/CommandStartedEvent.php', + 'MongoDB\\Driver\\Monitoring\\CommandSubscriber' => 'mongodb/Monitoring/CommandSubscriber.php', + 'MongoDB\\Driver\\Monitoring\\CommandSucceededEvent' => 'mongodb/Monitoring/CommandSucceededEvent.php', + 'MongoDB\\Driver\\Monitoring\\SDAMSubscriber' => 'mongodb/Monitoring/SDAMSubscriber.php', + 'MongoDB\\Driver\\Monitoring\\ServerChangedEvent' => 'mongodb/Monitoring/ServerChangedEvent.php', + 'MongoDB\\Driver\\Monitoring\\ServerClosedEvent' => 'mongodb/Monitoring/ServerClosedEvent.php', + 'MongoDB\\Driver\\Monitoring\\ServerHeartbeatFailedEvent' => 'mongodb/Monitoring/ServerHeartbeatFailedEvent.php', + 'MongoDB\\Driver\\Monitoring\\ServerHeartbeatStartedEvent' => 'mongodb/Monitoring/ServerHeartbeatStartedEvent.php', + 'MongoDB\\Driver\\Monitoring\\ServerHeartbeatSucceededEvent' => 'mongodb/Monitoring/ServerHeartbeatSucceededEvent.php', + 'MongoDB\\Driver\\Monitoring\\ServerOpeningEvent' => 'mongodb/Monitoring/ServerOpeningEvent.php', + 'MongoDB\\Driver\\Monitoring\\Subscriber' => 'mongodb/Monitoring/Subscriber.php', + 'MongoDB\\Driver\\Monitoring\\TopologyChangedEvent' => 'mongodb/Monitoring/TopologyChangedEvent.php', + 'MongoDB\\Driver\\Monitoring\\TopologyClosedEvent' => 'mongodb/Monitoring/TopologyClosedEvent.php', + 'MongoDB\\Driver\\Monitoring\\TopologyOpeningEvent' => 'mongodb/Monitoring/TopologyOpeningEvent.php', + 'MongoDB\\Driver\\Query' => 'mongodb/Query.php', + 'MongoDB\\Driver\\ReadConcern' => 'mongodb/ReadConcern.php', + 'MongoDB\\Driver\\ReadPreference' => 'mongodb/ReadPreference.php', + 'MongoDB\\Driver\\Server' => 'mongodb/Server.php', 'MongoDB\\Driver\\ServerApi' => 'mongodb/ServerApi.php', - 'MongoDB\\Driver\\Session' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\WriteConcern' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\WriteConcernError' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\WriteError' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\WriteResult' => 'mongodb/mongodb.php', + 'MongoDB\\Driver\\ServerDescription' => 'mongodb/ServerDescription.php', + 'MongoDB\\Driver\\Session' => 'mongodb/Session.php', + 'MongoDB\\Driver\\TopologyDescription' => 'mongodb/TopologyDescription.php', + 'MongoDB\\Driver\\WriteConcern' => 'mongodb/WriteConcern.php', + 'MongoDB\\Driver\\WriteConcernError' => 'mongodb/WriteConcernError.php', + 'MongoDB\\Driver\\WriteError' => 'mongodb/WriteError.php', + 'MongoDB\\Driver\\WriteResult' => 'mongodb/WriteResult.php', 'MongoDate' => 'mongo/mongo.php', 'MongoDuplicateKeyException' => 'mongo/mongo.php', 'MongoException' => 'mongo/mongo.php', @@ -840,6 +854,11 @@ final class PhpStormStubsMap 'ReflectionZendExtension' => 'Reflection/ReflectionZendExtension.php', 'Reflector' => 'Reflection/Reflector.php', 'RegexIterator' => 'SPL/SPL.php', + 'Relay\\Event' => 'relay/Event.php', + 'Relay\\Exception' => 'relay/Exception.php', + 'Relay\\KeyType' => 'relay/KeyType.php', + 'Relay\\Relay' => 'relay/Relay.php', + 'Relay\\Sentinel' => 'relay/Sentinel.php', 'ResourceBundle' => 'intl/intl.php', 'ReturnTypeWillChange' => 'Core/Core_c.php', 'RuntimeException' => 'SPL/SPL.php', @@ -1356,14 +1375,14 @@ final class PhpStormStubsMap 'GEOSRelateMatch' => 'geos/geos.php', 'GEOSSharedPaths' => 'geos/geos.php', 'GEOSVersion' => 'geos/geos.php', - 'MongoDB\\BSON\\fromJSON' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\fromPHP' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\toCanonicalExtendedJSON' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\toJSON' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\toPHP' => 'mongodb/mongodb.php', - 'MongoDB\\BSON\\toRelaxedExtendedJSON' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Monitoring\\addSubscriber' => 'mongodb/mongodb.php', - 'MongoDB\\Driver\\Monitoring\\removeSubscriber' => 'mongodb/mongodb.php', + 'MongoDB\\BSON\\fromJSON' => 'mongodb/BSON/functions.php', + 'MongoDB\\BSON\\fromPHP' => 'mongodb/BSON/functions.php', + 'MongoDB\\BSON\\toCanonicalExtendedJSON' => 'mongodb/BSON/functions.php', + 'MongoDB\\BSON\\toJSON' => 'mongodb/BSON/functions.php', + 'MongoDB\\BSON\\toPHP' => 'mongodb/BSON/functions.php', + 'MongoDB\\BSON\\toRelaxedExtendedJSON' => 'mongodb/BSON/functions.php', + 'MongoDB\\Driver\\Monitoring\\addSubscriber' => 'mongodb/Monitoring/functions.php', + 'MongoDB\\Driver\\Monitoring\\removeSubscriber' => 'mongodb/Monitoring/functions.php', 'PDF_activate_item' => 'pdflib/PDFlib.php', 'PDF_add_launchlink' => 'pdflib/PDFlib.php', 'PDF_add_locallink' => 'pdflib/PDFlib.php', @@ -3129,6 +3148,7 @@ final class PhpStormStubsMap 'imap_header' => 'imap/imap.php', 'imap_headerinfo' => 'imap/imap.php', 'imap_headers' => 'imap/imap.php', + 'imap_is_open' => 'imap/imap.php', 'imap_last_error' => 'imap/imap.php', 'imap_list' => 'imap/imap.php', 'imap_listmailbox' => 'imap/imap.php', @@ -4563,6 +4583,8 @@ final class PhpStormStubsMap 'output_cache_stop' => 'zend/zend.php', 'output_reset_rewrite_vars' => 'standard/standard_9.php', 'pack' => 'standard/standard_7.php', + 'pam_auth' => 'pam/pam.php', + 'pam_chpass' => 'pam/pam.php', 'parallel\\bootstrap' => 'parallel/parallel.php', 'parallel\\count' => 'parallel/parallel.php', 'parallel\\run' => 'parallel/parallel.php', @@ -11897,7 +11919,7 @@ final class PhpStormStubsMap 'SQLITE3_ASSOC' => 'sqlite3/sqlite3.php', 'SQLITE3_BLOB' => 'sqlite3/sqlite3.php', 'SQLITE3_BOTH' => 'sqlite3/sqlite3.php', - 'SQLITE3_DETERMINISTIC' => 'SQLite/SQLite.php', + 'SQLITE3_DETERMINISTIC' => 'sqlite3/sqlite3.php', 'SQLITE3_FLOAT' => 'sqlite3/sqlite3.php', 'SQLITE3_INTEGER' => 'sqlite3/sqlite3.php', 'SQLITE3_NULL' => 'sqlite3/sqlite3.php', diff --git a/Reflection/ReflectionEnum.php b/Reflection/ReflectionEnum.php index c04834d91..3d01dac4e 100644 --- a/Reflection/ReflectionEnum.php +++ b/Reflection/ReflectionEnum.php @@ -22,7 +22,7 @@ public function hasCase(string $name): bool {} public function getCases(): array {} /** - * @return ReflectionEnumPureCase|ReflectionEnumBackedCase + * @return ReflectionEnumUnitCase|ReflectionEnumBackedCase * @throws ReflectionException If no found single reflection object for the corresponding case */ public function getCase(string $name): ReflectionEnumUnitCase {} diff --git a/Reflection/ReflectionEnumBackedCase.php b/Reflection/ReflectionEnumBackedCase.php index 4409ba0a2..d3fd7d8ab 100644 --- a/Reflection/ReflectionEnumBackedCase.php +++ b/Reflection/ReflectionEnumBackedCase.php @@ -1,5 +1,7 @@ 'ReflectionNamedType[]|ReflectionIntersectionType[]' + ], + default: 'ReflectionNamedType[]' + )] public function getTypes(): array {} } diff --git a/SPL/SPL.php b/SPL/SPL.php index a37021679..4353bb7d4 100644 --- a/SPL/SPL.php +++ b/SPL/SPL.php @@ -1525,6 +1525,10 @@ public function getPostfix(): string {} /** * This class allows objects to work as arrays. * @link https://php.net/manual/en/class.arrayobject.php + * @template TKey + * @template TValue + * @template-implements IteratorAggregate + * @template-implements ArrayAccess */ class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Countable { @@ -1541,9 +1545,9 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Count /** * Construct a new array object * @link https://php.net/manual/en/arrayobject.construct.php - * @param array|object $array The input parameter accepts an array or an Object. + * @param array|object $array The input parameter accepts an array or an Object. * @param int $flags Flags to control the behaviour of the ArrayObject object. - * @param string $iteratorClass Specify the class that will be used for iteration of the ArrayObject object. ArrayIterator is the default class used. + * @param class-string $iteratorClass Specify the class that will be used for iteration of the ArrayObject object. ArrayIterator is the default class used. */ public function __construct( #[LanguageLevelTypeAware(['8.0' => 'object|array'], default: '')] $array = [], @@ -1554,7 +1558,7 @@ public function __construct( /** * Returns whether the requested index exists * @link https://php.net/manual/en/arrayobject.offsetexists.php - * @param int|string $key

+ * @param TKey $key

* The index being checked. *

* @return bool true if the requested index exists, otherwise false @@ -1565,7 +1569,7 @@ public function offsetExists(#[LanguageLevelTypeAware(['8.0' => 'mixed'], defaul /** * Returns the value at the specified index * @link https://php.net/manual/en/arrayobject.offsetget.php - * @param int|string $key

+ * @param TKey $key

* The index with the value. *

* @return mixed|false The value at the specified index or false. @@ -1576,10 +1580,10 @@ public function offsetGet(#[LanguageLevelTypeAware(['8.0' => 'mixed'], default: /** * Sets the value at the specified index to newval * @link https://php.net/manual/en/arrayobject.offsetset.php - * @param int|string $key

+ * @param TKey $key

* The index being set. *

- * @param mixed $value

+ * @param TValue $value

* The new value for the index. *

* @return void @@ -1593,7 +1597,7 @@ public function offsetSet( /** * Unsets the value at the specified index * @link https://php.net/manual/en/arrayobject.offsetunset.php - * @param int|string $key

+ * @param TKey $key

* The index being unset. *

* @return void @@ -1604,7 +1608,7 @@ public function offsetUnset(#[LanguageLevelTypeAware(['8.0' => 'mixed'], default /** * Appends the value * @link https://php.net/manual/en/arrayobject.append.php - * @param mixed $value

+ * @param TValue $value

* The value being appended. *

* @return void @@ -1615,7 +1619,7 @@ public function append(#[LanguageLevelTypeAware(['8.0' => 'mixed'], default: '') /** * Creates a copy of the ArrayObject. * @link https://php.net/manual/en/arrayobject.getarraycopy.php - * @return array a copy of the array. When the ArrayObject refers to an object + * @return array a copy of the array. When the ArrayObject refers to an object * an array of the public properties of that object will be returned. */ #[TentativeType] @@ -1697,7 +1701,7 @@ public function ksort(#[PhpStormStubsElementAvailable(from: '8.0')] int $flags = /** * Sort the entries with a user-defined comparison function and maintain key association * @link https://php.net/manual/en/arrayobject.uasort.php - * @param callable $callback

+ * @param callable(TValue, TValue):int $callback

* Function cmp_function should accept two * parameters which will be filled by pairs of entries. * The comparison function must return an integer less than, equal @@ -1713,7 +1717,7 @@ public function uasort(#[LanguageLevelTypeAware(['8.0' => 'callable'], default: /** * Sort the entries by keys using a user-defined comparison function * @link https://php.net/manual/en/arrayobject.uksort.php - * @param callable $callback

+ * @param callable(TValue, TValue):int $callback

* The callback comparison function. *

*

@@ -1788,7 +1792,7 @@ public function __unserialize(array $data): void {} /** * Create a new iterator from an ArrayObject instance * @link https://php.net/manual/en/arrayobject.getiterator.php - * @return ArrayIterator An iterator from an ArrayObject. + * @return ArrayIterator An iterator from an ArrayObject. */ #[TentativeType] public function getIterator(): Iterator {} @@ -1807,7 +1811,7 @@ public function exchangeArray(#[LanguageLevelTypeAware(['8.0' => 'object|array'] /** * Sets the iterator classname for the ArrayObject. * @link https://php.net/manual/en/arrayobject.setiteratorclass.php - * @param string $iteratorClass

+ * @param class-string $iteratorClass

* The classname of the array iterator to use when iterating over this object. *

* @return void @@ -1818,7 +1822,7 @@ public function setIteratorClass(#[LanguageLevelTypeAware(['8.0' => 'string'], d /** * Gets the iterator classname for the ArrayObject. * @link https://php.net/manual/en/arrayobject.getiteratorclass.php - * @return string the iterator class name that is used to iterate over this object. + * @return class-string the iterator class name that is used to iterate over this object. */ #[TentativeType] public function getIteratorClass(): string {} diff --git a/SPL/SPL_c1.php b/SPL/SPL_c1.php index ff5638bc5..010b8dcda 100644 --- a/SPL/SPL_c1.php +++ b/SPL/SPL_c1.php @@ -860,7 +860,7 @@ public function fgetss($allowable_tags = null) {} * @param mixed &...$vars [optional]

* The optional assigned values. *

- * @return array|int If only one parameter is passed to this method, the values parsed will be + * @return array|int|null If only one parameter is passed to this method, the values parsed will be * returned as an array. Otherwise, if optional parameters are passed, the * function will return the number of assigned values. The optional * parameters must be passed by reference. @@ -1960,7 +1960,7 @@ public function __serialize(): array {} public function __unserialize(array $data): void {} /** - * @return Traversable + * @return Iterator */ public function getIterator(): Iterator {} diff --git a/SQLite/SQLite.php b/SQLite/SQLite.php index f6bbabf9a..21613d692 100644 --- a/SQLite/SQLite.php +++ b/SQLite/SQLite.php @@ -1399,11 +1399,3 @@ function sqlite_fetch_column_types($dbhandle, $table_name, $result_type = null) * @link https://php.net/manual/en/sqlite.constants.php */ define('SQLITE_DONE', 101); - -/** - * Specifies that a function created with {@see SQLite3::createFunction()} is deterministic, - * i.e. it always returns the same result given the same inputs within a single SQL statement. - * @since 7.1.4 - * @link https://php.net/manual/en/sqlite.constants.php - */ -define('SQLITE3_DETERMINISTIC', 2048); diff --git a/Zend OPcache/OPcache.php b/Zend OPcache/OPcache.php index c2f9a97d1..0e959fa1e 100644 --- a/Zend OPcache/OPcache.php +++ b/Zend OPcache/OPcache.php @@ -58,6 +58,7 @@ function opcache_reset(): bool {} 'opcache_statistics' => 'array', 'preload_statistics' => 'array', 'scripts' => 'array', + 'jit' => 'array', ])] function opcache_get_status(bool $include_scripts = true): array|false {} diff --git a/amqp/amqp.php b/amqp/amqp.php index 8aaea79bc..077495d4c 100644 --- a/amqp/amqp.php +++ b/amqp/amqp.php @@ -5,13 +5,12 @@ * https://github.com/pdezwart/php-amqp */ +use JetBrains\PhpStorm\Deprecated; + /** * Passing in this constant as a flag will forcefully disable all other flags. * Use this if you want to temporarily disable the amqp.auto_ack ini setting. */ - -use JetBrains\PhpStorm\Deprecated; - define('AMQP_NOPARAM', 0); /** @@ -124,7 +123,7 @@ /** * The error number of OS socket timeout. */ -define('AMQP_OS_SOCKET_TIMEOUT_ERRNO', 536870923); +define('AMQP_OS_SOCKET_TIMEOUT_ERRNO', 536870947); /** * The maximum number of channels that can be open on a connection. @@ -953,19 +952,6 @@ public function setSaslMethod($method) {} * @return int AMQP_SASL_METHOD_PLAIN | AMQP_SASL_METHOD_EXTERNAL */ public function getSaslMethod() {} - - /** - * Return the connection name - * @return string|null - */ - public function getConnectionName() {} - - /** - * Set the connection name - * @param string $connection_name - * @return void - */ - public function setConnectionName($connection_name) {} } /** @@ -1029,7 +1015,7 @@ public function getConsumerTag() {} /** * Get the delivery tag of the message. * - * @return string The delivery tag of the message. + * @return int The delivery tag of the message. */ public function getDeliveryTag() {} @@ -1268,7 +1254,7 @@ public function setArguments(array $arguments) {} /** * Set the flags on an exchange. * - * @param int $flags A bitmask of flags. This call currently only + * @param int|null $flags A bitmask of flags. This call currently only * considers the following flags: * AMQP_DURABLE, AMQP_PASSIVE * (and AMQP_DURABLE, if librabbitmq version >= 0.5.3) @@ -1311,17 +1297,6 @@ public function getChannel() {} * @return AMQPConnection */ public function getConnection() {} - - /** - * Declare a new exchange on the broker. - * @return int - * @throws AMQPExchangeException - * @throws AMQPChannelException - * @throws AMQPConnectionException - * @see AMQPExchange::declareExchange() - */ - #[Deprecated] - public function declare() {} } /** @@ -1341,7 +1316,7 @@ class AMQPQueue * without the AMQP_AUTOACK flag through AMQPQueue::get() or * AMQPQueue::consume() * - * @param string $delivery_tag The message delivery tag of which to + * @param int $delivery_tag The message delivery tag of which to * acknowledge receipt. * @param int $flags The only valid flag that can be passed is * AMQP_MULTIPLE. @@ -1541,7 +1516,7 @@ public function getName() {} * behavior of calling this method while connected to any other broker is * undefined. * - * @param string $delivery_tag Delivery tag of last message to reject. + * @param int $delivery_tag Delivery tag of last message to reject. * @param int $flags AMQP_REQUEUE to requeue the message(s), * AMQP_MULTIPLE to nack all previous * unacked messages as well. @@ -1562,7 +1537,7 @@ public function nack($delivery_tag, $flags = AMQP_NOPARAM) {} * AMQPQueue::consume() and AMQPQueue::get() and using the AMQP_AUTOACK * flag are not eligible. * - * @param string $delivery_tag Delivery tag of the message to reject. + * @param int $delivery_tag Delivery tag of the message to reject. * @param int $flags AMQP_REQUEUE to requeue the message(s). * * @throws AMQPChannelException If the channel is not open. @@ -1668,16 +1643,6 @@ public function getConnection() {} * @return string|null */ public function getConsumerTag() {} - - /** - * Declare a new queue - * @return int - * @throws AMQPChannelException - * @throws AMQPConnectionException - * @see AMQPQueue::declareQueue() - */ - #[Deprecated] - public function declare() {} } /** @@ -1711,8 +1676,3 @@ public function __toString() {} * stub class representing AMQPExchangeValue from pecl-amqp */ class AMQPExchangeValue extends AMQPException {} - -/** - * stub class representing AMQPExchangeValue from pecl-amqp - */ -class AMQPValueException extends AMQPException {} diff --git a/bcmath/bcmath.php b/bcmath/bcmath.php index bf099e48a..c7042adbf 100644 --- a/bcmath/bcmath.php +++ b/bcmath/bcmath.php @@ -106,7 +106,7 @@ function bcdiv(string $num1, string $num2, ?int $scale = 0): ?string {} */ #[Pure] #[PhpStormStubsElementAvailable('8.0')] -function bcdiv(string $num1, string $num2, ?int $scale = 0): string {} +function bcdiv(string $num1, string $num2, ?int $scale = null): string {} /** * Get modulus of an arbitrary precision number @@ -150,7 +150,7 @@ function bcmod(string $num1, string $num2, ?int $scale = 0): ?string {} */ #[Pure] #[PhpStormStubsElementAvailable('8.0')] -function bcmod(string $num1, string $num2, ?int $scale = 0): string {} +function bcmod(string $num1, string $num2, ?int $scale = null): string {} /** * Raise an arbitrary precision number to another diff --git a/cassandra/cassandra.php b/cassandra/cassandra.php index f359fec63..23deaa61e 100644 --- a/cassandra/cassandra.php +++ b/cassandra/cassandra.php @@ -832,7 +832,7 @@ public function columns(); /** * Returns the partition key columns of the table * - * @return array A list of of Column instances + * @return array A list of Column instances * @link https://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/interface.Table/#method-partitionKey */ public function partitionKey(); @@ -840,7 +840,7 @@ public function partitionKey(); /** * Returns both the partition and clustering key columns of the table * - * @return array A list of of Column instances + * @return array A list of Column instances * @link https://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/interface.Table/#method-primaryKey */ public function primaryKey(); @@ -848,7 +848,7 @@ public function primaryKey(); /** * Returns the clustering key columns of the table * - * @return array A list of of Column instances + * @return array A list of Column instances * @link https://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/interface.Table/#method-clusteringKey */ public function clusteringKey(); @@ -1253,7 +1253,7 @@ public function userTypes(); * * @param string $name Materialized view name * - * @return \Cassandra\MaterizedView|null A materialized view or null + * @return \Cassandra\MaterializedView|null A materialized view or null * @link https://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/interface.Keyspace/#method-materializedView */ public function materializedView($name); @@ -2399,7 +2399,7 @@ public function columns() {} /** * Returns the partition key columns of the view * - * @return array A list of of Column instances + * @return array A list of Column instances * @link https://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/class.DefaultMaterializedView/#method-partitionKey */ public function partitionKey() {} @@ -2407,7 +2407,7 @@ public function partitionKey() {} /** * Returns both the partition and clustering key columns of the view * - * @return array A list of of Column instances + * @return array A list of Column instances * @link https://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/class.DefaultMaterializedView/#method-primaryKey */ public function primaryKey() {} @@ -2415,7 +2415,7 @@ public function primaryKey() {} /** * Returns the clustering key columns of the view * - * @return array A list of of Column instances + * @return array A list of Column instances * @link https://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/class.DefaultMaterializedView/#method-clusteringKey */ public function clusteringKey() {} @@ -3425,7 +3425,7 @@ abstract public function columns(); /** * Returns the partition key columns of the view * - * @return array A list of of `Column` instances + * @return array A list of `Column` instances * @link https://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/class.MaterializedView/#method-partitionKey */ abstract public function partitionKey(); @@ -3433,7 +3433,7 @@ abstract public function partitionKey(); /** * Returns both the partition and clustering key columns of the view * - * @return array A list of of `Column` instances + * @return array A list of `Column` instances * @link https://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/class.MaterializedView/#method-primaryKey */ abstract public function primaryKey(); @@ -3441,7 +3441,7 @@ abstract public function primaryKey(); /** * Returns the clustering key columns of the view * - * @return array A list of of `Column` instances + * @return array A list of `Column` instances * @link https://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/class.MaterializedView/#method-clusteringKey */ abstract public function clusteringKey(); @@ -4386,7 +4386,7 @@ public function userTypes() {} * * @param string $name Materialized view name * - * @return \Cassandra\MaterizedView|null A materialized view or null + * @return \Cassandra\MaterializedView|null A materialized view or null * @link https://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/class.DefaultKeyspace/#method-materializedView */ public function materializedView($name) {} @@ -4834,7 +4834,7 @@ public function columns() {} /** * Returns the partition key columns of the table * - * @return array A list of of `Column` instance + * @return array A list of `Column` instance * @link https://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/class.DefaultTable/#method-partitionKey */ public function partitionKey() {} @@ -4842,7 +4842,7 @@ public function partitionKey() {} /** * Returns both the partition and clustering key columns of the table * - * @return array A list of of `Column` instance + * @return array A list of `Column` instance * @link https://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/class.DefaultTable/#method-primaryKey */ public function primaryKey() {} @@ -4850,7 +4850,7 @@ public function primaryKey() {} /** * Returns the clustering key columns of the table * - * @return array A list of of `Column` instances + * @return array A list of `Column` instances * @link https://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/class.DefaultTable/#method-clusteringKey */ public function clusteringKey() {} @@ -4884,7 +4884,7 @@ public function indexes() {} * * @param string $name Materialized view name * - * @return \Cassandra\MaterizedView|null A materialized view or null + * @return \Cassandra\MaterializedView|null A materialized view or null * @link https://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/class.DefaultTable/#method-materializedView */ public function materializedView($name) {} @@ -5514,7 +5514,7 @@ public function withTCPKeepalive($delay) {} /** * Configures the retry policy. * - * @param \Cassandra\Cluster\RetryPolicy $policy the retry policy to use. + * @param \Cassandra\RetryPolicy $policy the retry policy to use. * * @return \Cassandra\Cluster\Builder self * @link https://docs.datastax.com/en/developer/php-driver/latest/api/Cassandra/Cluster/class.Builder/#method-withRetryPolicy diff --git a/composer.json b/composer.json index 0dad9a11b..bf747709d 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "php": "^8.0", "nikic/php-parser": "@stable", "phpdocumentor/reflection-docblock": "@stable", - "phpunit/phpunit": "@stable", + "phpunit/phpunit": "^9.6", "friendsofphp/php-cs-fixer": "@stable" }, "autoload": { diff --git a/curl/curl_d.php b/curl/curl_d.php index 81afa35a9..233e564bc 100644 --- a/curl/curl_d.php +++ b/curl/curl_d.php @@ -1144,7 +1144,7 @@ * Will be the most recent age value for the libcurl. * @link https://php.net/manual/en/curl.constants.php */ -define('CURLVERSION_NOW', 9); +define('CURLVERSION_NOW', 10); /** * All fine. Proceed as usual. * @link https://php.net/manual/en/curl.constants.php @@ -2272,7 +2272,7 @@ * @link https://php.net/manual/en/curl.constants.php * @since 7.0.7 */ -define('CURL_MAX_READ_SIZE', 524288); +define('CURL_MAX_READ_SIZE', 10485760); /** * Enables the use of an abstract Unix domain socket instead of establishing a TCP connection to a host and sets the path to the given string. @@ -2973,7 +2973,7 @@ /** * @link https://php.net/manual/en/curl.constants.php */ -define("CURLINFO_LASTONE", 60); +define("CURLINFO_LASTONE", 62); /** * An easy handle already added to a multi handle was attempted to get added a second time. * @link https://www.php.net/manual/en/function.curl-multi-exec.php diff --git a/date/date.php b/date/date.php index a31adf912..36e1766ec 100644 --- a/date/date.php +++ b/date/date.php @@ -1381,7 +1381,7 @@ function timezone_identifiers_list(int $timezoneGroup = DateTimeZone::ALL, ?stri * Alias: * {@see DateTimeZone::listAbbreviations} * @link https://php.net/manual/en/function.timezone-abbreviations-list.php - * @return array|false Array on success or FALSE on failure. + * @return array>|false Array on success or FALSE on failure. */ #[Pure] #[LanguageLevelTypeAware(["8.0" => "array"], default: "array|false")] diff --git a/date/date_c.php b/date/date_c.php index 5631170bb..d6db7e837 100644 --- a/date/date_c.php +++ b/date/date_c.php @@ -196,6 +196,7 @@ public function __construct( * Adds an amount of days, months, years, hours, minutes and seconds * @param DateInterval $interval * @return static + * @link https://secure.php.net/manual/en/datetimeimmutable.add.php */ #[TentativeType] public function add(DateInterval $interval): DateTimeImmutable {} @@ -762,6 +763,7 @@ class DateTimeZone /** * @param string $timezone * @link https://php.net/manual/en/datetimezone.construct.php + * @throws Exception Emits Exception in case of an error. */ public function __construct(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $timezone) {} @@ -813,7 +815,7 @@ public function getTransitions( /** * Returns associative array containing dst, offset and the timezone name - * @return array + * @return array> * @link https://php.net/manual/en/datetimezone.listabbreviations.php */ #[TentativeType] diff --git a/dom/dom_c.php b/dom/dom_c.php index 58e1a23be..9622a4ef6 100644 --- a/dom/dom_c.php +++ b/dom/dom_c.php @@ -1640,6 +1640,14 @@ class DOMElement extends DOMNode implements DOMParentNode, DOMChildNode */ public $nextSibling; + /** + * @var DOMNamedNodeMap + * A DOMNamedNodeMap containing the attributes of this node (if it is a DOMElement) or NULL otherwise. + * @link https://php.net/manual/en/class.domnode.php#domnode.props.attributes + */ + #[LanguageLevelTypeAware(['8.1' => 'DOMNamedNodeMap'], default: '')] + public $attributes; + /** * @var bool * Not implemented yet, always return NULL diff --git a/ds/ds.php b/ds/ds.php index 8272ef5ad..da2215bc1 100644 --- a/ds/ds.php +++ b/ds/ds.php @@ -10,6 +10,7 @@ namespace Ds; + use ArrayAccess; use Countable; use IteratorAggregate; use JsonSerializable; @@ -24,6 +25,10 @@ * are traversable, countable, and can be converted to json using * json_encode(). * @package Ds + * + * @template-covariant TKey + * @template-covariant TValue + * @extends IteratorAggregate */ interface Collection extends Countable, IteratorAggregate, JsonSerializable { @@ -36,7 +41,7 @@ public function clear(): void; /** * Returns a shallow copy of the collection. * @link https://www.php.net/manual/en/ds-collection.copy.php - * @return Collection + * @return Collection */ public function copy(); @@ -51,7 +56,7 @@ public function isEmpty(): bool; * Converts the collection to an array. *

Note: Casting to an array is not supported yet.

* @link https://www.php.net/manual/en/ds-collection.toarray.php - * @return array An array containing all the values in the same order as + * @return array An array containing all the values in the same order as * the collection. */ public function toArray(): array; @@ -140,8 +145,10 @@ public function hash(); *
  • A more efficient alternative to SplDoublyLinkedList and SplFixedArray.
  • * * @package Ds + * @template TValue + * @extends Collection */ - interface Sequence extends Collection + interface Sequence extends Collection, ArrayAccess { /** * Ensures that enough memory is allocated for a required capacity. @@ -157,7 +164,7 @@ public function allocate(int $capacity): void; /** * Updates all values by applying a callback function to each value in * the sequence. - * @param callable $callback A callable to apply to each value in the + * @param callable(TValue): TValue $callback A callable to apply to each value in the * sequence. The callback should return what the value should be * replaced by. * callback ( mixed $value ) : mixed @@ -174,7 +181,7 @@ public function capacity(): int; /** * Determines if the sequence contains all values. - * @param mixed $values Values to check. + * @param TValue ...$values Values to check. * @return bool FALSE if any of the provided values are not in the * sequence, TRUE otherwise. * @link https://www.php.net/manual/en/ds-sequence.contains.php @@ -184,12 +191,12 @@ public function contains(...$values): bool; /** * Creates a new sequence using a callable to determine which values * to include. - * @param null|callable $callback Optional callable which returns TRUE if the + * @param null|callable(TValue): bool $callback Optional callable which returns TRUE if the * value should be included, FALSE otherwise. If a callback is not * provided, only values which are TRUE (see converting to boolean) will * be included. * callback ( mixed $value ) : bool - * @return Sequence A new sequence containing all the values for which + * @return Sequence A new sequence containing all the values for which * either the callback returned TRUE, or all values that convert to * TRUE if a callback was not provided. * @link https://www.php.net/manual/en/ds-sequence.filter.php @@ -198,7 +205,7 @@ public function filter(?callable $callback = null); /** * Returns the index of the value, or FALSE if not found. - * @param mixed $value The value to find. + * @param TValue $value The value to find. * @return int|false The index of the value, or FALSE if not found. * @link https://www.php.net/manual/en/ds-sequence.find.php */ @@ -206,7 +213,7 @@ public function find($value); /** * Returns the first value in the sequence. - * @return mixed The first value in the sequence. + * @return TValue The first value in the sequence. * @throws UnderflowException if empty. * @link https://www.php.net/manual/en/ds-sequence.first.php */ @@ -215,7 +222,7 @@ public function first(); /** * Returns the value at a given index. * @param int $index The index to access, starting at 0. - * @return mixed The value at the requested index. + * @return TValue The value at the requested index. * @throws OutOfRangeException if the index is not valid. * @link https://www.php.net/manual/en/ds-sequence.get.php */ @@ -226,7 +233,7 @@ public function get(int $index); * * @param int $index The index at which to insert. 0 <= index <= count *

    Note: You can insert at the index equal to the number of values.

    - * @param mixed ...$values The value or values to insert. + * @param TValue ...$values The value or values to insert. * @throws OutOfRangeException if the index is not valid. * @link https://www.php.net/manual/en/ds-sequence.insert.php */ @@ -244,7 +251,7 @@ public function join(string $glue = ''): string; /** * Returns the last value in the sequence. - * @return mixed The last value in the sequence. + * @return TValue The last value in the sequence. * @throws UnderflowException if empty. * @link https://www.php.net/manual/en/ds-sequence.last.php */ @@ -253,31 +260,33 @@ public function last(); /** * Returns the result of applying a callback function to each value in * the sequence. - * @param callable $callback A callable to apply to each value in the + * @template TNewValue + * @param callable(TValue): TNewValue $callback A callable to apply to each value in the * sequence. * The callable should return what the new value will be in the new * sequence. * callback ( mixed $value ) : mixed - * @return Sequence The result of applying a callback to each value in + * @return Sequence The result of applying a callback to each value in * the sequence.

    Note: The values of the current instance won't be * affected.

    * @link https://www.php.net/manual/en/ds-sequence.map.php */ - public function map(callable $callback); + public function map(callable $callback): Sequence; /** * Returns the result of adding all given values to the sequence. - * @param iterable $values A traversable object or an array. - * @return Sequence The result of adding all given values to the + * @template TValue2 + * @param iterable $values A traversable object or an array. + * @return Sequence The result of adding all given values to the * sequence, effectively the same as adding the values to a copy, * then returning that copy. * @link https://www.php.net/manual/en/ds-sequence.merge.php */ - public function merge($values); + public function merge($values): Sequence; /** * Removes and returns the last value. - * @return mixed The removed last value. + * @return TValue The removed last value. * @throws UnderflowException if empty. * @link https://www.php.net/manual/en/ds-sequence.pop.php */ @@ -285,21 +294,22 @@ public function pop(); /** * Adds values to the end of the sequence. - * @param mixed ...$values The values to add. + * @param TValue ...$values The values to add. */ public function push(...$values): void; /** * Reduces the sequence to a single value using a callback function. - * @param callable $callback

    + * @template TCarry + * @param callable(TCarry, TValue): TCarry $callback

    * * callback ( mixed $carry , mixed $value ) : mixed * $carry The return value of the previous callback, or initial if it's * the first iteration.
    * $value The value of the current iteration. *

    - * @param mixed $initial The initial value of the carry value. Can be NULL. - * @return mixed The return value of the final callback. + * @param TCarry $initial The initial value of the carry value. Can be NULL. + * @return TCarry The return value of the final callback. * @link https://www.php.net/manual/en/ds-sequence.reduce.php */ public function reduce(callable $callback, $initial = null); @@ -307,7 +317,7 @@ public function reduce(callable $callback, $initial = null); /** * Removes and returns a value by index. * @param int $index The index of the value to remove. - * @return mixed The value that was removed. + * @return TValue The value that was removed. * @link https://www.php.net/manual/en/ds-sequence.remove.php */ public function remove(int $index); @@ -320,7 +330,7 @@ public function reverse(): void; /** * Returns a reversed copy of the sequence. - * @return Sequence A reversed copy of the sequence. + * @return Sequence A reversed copy of the sequence. *

    Note: The current instance is not affected.

    */ public function reversed(); @@ -339,7 +349,7 @@ public function rotate(int $rotations): void; /** * Updates a value at a given index. * @param int $index The index of the value to update. - * @param mixed $value The new value. + * @param TValue $value The new value. * @throws OutOfRangeException if the index is not valid. * @link https://www.php.net/manual/en/ds-sequence.set.php */ @@ -347,7 +357,7 @@ public function set(int $index, $value): void; /** * Removes and returns the first value. - * @return mixed + * @return TValue * @throws UnderflowException if empty. * @link https://www.php.net/manual/en/ds-sequence.shift.php */ @@ -365,14 +375,14 @@ public function shift(); * the sequence will stop that many values from the end. If a length * is not provided, the resulting sequence will contain all values * between the index and the end of the sequence. - * @return Sequence A sub-sequence of the given range. + * @return Sequence A sub-sequence of the given range. * @link https://www.php.net/manual/en/ds-sequence.slice.php */ public function slice(int $index, int $length = null); /** * Sorts the sequence in-place, using an optional comparator function. - * @param callable|null $comparator The comparison function must return + * @param callable(TValue, TValue): int|null $comparator The comparison function must return * an integer less than, equal to, or greater than zero if the first * argument is considered to be respectively less than, equal to, or * greater than the second. Note that before PHP 7.0.0 this integer had @@ -389,7 +399,7 @@ public function sort(?callable $comparator = null): void; /** * Returns a sorted copy, using an optional comparator function. - * @param callable|null $comparator The comparison function must return + * @param callable(TValue, TValue): int|null $comparator The comparison function must return * an integer less than, equal to, or greater than zero if the first * argument is considered to be respectively less than, equal to, or * greater than the second. Note that before PHP 7.0.0 this integer had @@ -400,7 +410,7 @@ public function sort(?callable $comparator = null): void; * of the callback's return value. So values such as 0.99 and 0.1 will * both be cast to an integer value of 0, which will compare such * values as equal.

    - * @return Sequence Returns a sorted copy of the sequence. + * @return Sequence Returns a sorted copy of the sequence. * @link https://www.php.net/manual/en/ds-sequence.sort.php */ public function sorted(?callable $comparator = null); @@ -417,11 +427,11 @@ public function sum(): float|int; /** * Adds values to the front of the sequence, moving all the current * values forward to make room for the new values. - * @param mixed $values The values to add to the front of the sequence. + * @param TValue ...$values The values to add to the front of the sequence. *

    Note: Multiple values will be added in the same order that they * are passed.

    */ - public function unshift($values): void; + public function unshift(...$values): void; } /** @@ -448,6 +458,8 @@ public function unshift($values): void; * @link https://www.php.net/manual/en/class.ds-vector.php * * @package Ds + * @template TValue + * @implements Sequence */ class Vector implements Sequence { @@ -456,7 +468,7 @@ class Vector implements Sequence /** * Creates a new instance, using either a traversable object or an array for the initial values. * - * @param iterable $values + * @param array $values */ public function __construct($values = []) {} @@ -474,7 +486,7 @@ public function allocate(int $capacity): void {} /** * Updates all values by applying a callback function to each value in * the vector. - * @param callable $callback + * @param callable(TValue): TValue $callback * callback ( mixed $value ) : mixed * A callable to apply to each value in the vector. The callback should * return what the value should be replaced by. @@ -497,7 +509,7 @@ public function clear(): void {} /** * Determines if the vector contains all values. - * @param mixed ...$values Values to check. + * @param TValue ...$values Values to check. * @return bool FALSE if any of the provided values are not in the * vector, TRUE otherwise. * @link https://www.php.net/manual/en/ds-vector.contains.php @@ -506,7 +518,7 @@ public function contains(...$values): bool {} /** *Returns a shallow copy of the vector. - * @return Vector Returns a shallow copy of the vector. + * @return Vector Returns a shallow copy of the vector. */ public function copy(): Vector {} @@ -514,12 +526,12 @@ public function copy(): Vector {} * Creates a new vector using a callable to determine which values to * include. * - * @param null|callable $callback + * @param null|callable(TValue): bool $callback * Optional callable which returns TRUE if the value should be included, * FALSE otherwise. If a callback is not provided, only values which are * TRUE (see converting to boolean) will be included. * callback ( mixed $value ) : bool - * @return Vector A new vector containing all the values for which + * @return Vector A new vector containing all the values for which * either the callback returned TRUE, or all values that convert to * TRUE if a callback was not provided. * @link https://www.php.net/manual/en/ds-vector.filter.php @@ -528,8 +540,8 @@ public function filter(?callable $callback = null): Vector {} /** * Returns the index of the value, or FALSE if not found. - * @param mixed $value The value to find. - * @return mixed|false The index of the value, or FALSE if not found. + * @param TValue $value The value to find. + * @return int|false The index of the value, or FALSE if not found. *

    Note: Values will be compared by value and by type.

    * @link https://www.php.net/manual/en/ds-vector.find.php */ @@ -537,7 +549,7 @@ public function find($value) {} /** * Returns the first value in the vector. - * @return mixed + * @return TValue * @throws UnderflowException if empty. * @link https://www.php.net/manual/en/ds-vector.first.php */ @@ -546,7 +558,7 @@ public function first() {} /** * Returns the value at a given index. * @param int $index The index to access, starting at 0. - * @return mixed + * @return TValue * @link https://www.php.net/manual/en/ds-vector.get.php */ public function get(int $index) {} @@ -559,7 +571,7 @@ public function getIterator(): Traversable {} * @param int $index The index at which to insert. 0 <= index <= count * Note:
    * You can insert at the index equal to the number of values. - * @param array $values The value or values to insert. + * @param array ...$values The value or values to insert. * @link https://www.php.net/manual/en/ds-vector.insert.php */ public function insert(int $index, ...$values): void {} @@ -576,7 +588,7 @@ public function join(?string $glue = null): string {} /** * Returns the last value in the sequence. * - * @return mixed The last value in the sequence. + * @return TValue The last value in the sequence. * @link https://www.php.net/manual/en/ds-vector.last.php */ public function last() {} @@ -584,10 +596,11 @@ public function last() {} /** * Returns the result of applying a callback function to each value in the sequence. * - * @param callable $callback A callable to apply to each value in the sequence. + * @template TNewValue + * @param callable(TValue): TNewValue $callback A callable to apply to each value in the sequence. *
    The callable should return what the new value will be in the new sequence. * - * @return Vector + * @return Vector * @link https://www.php.net/manual/en/ds-vector.map.php */ public function map(callable $callback): Vector {} @@ -595,8 +608,9 @@ public function map(callable $callback): Vector {} /** * Returns the result of adding all given values to the sequence. * - * @param Traversable|array $values A traversable object or an array. - * @return Vector The result of adding all given values to the sequence, effectively the same as adding the + * @template TValue2 + * @param iterable $values A traversable object or an array. + * @return Vector The result of adding all given values to the sequence, effectively the same as adding the * values to a copy, then returning that copy.
    * Note:
    * The current instance won't be affected. @@ -607,27 +621,28 @@ public function merge($values): Vector {} /** * Removes and returns the last value. * - * @return mixed + * @return TValue * @link https://www.php.net/manual/en/ds-vector.pop.php */ public function pop() {} /** * Adds values to the end of the sequence. - * @param array $values + * @param TValue ...$values * @link https://www.php.net/manual/en/ds-vector.push.php */ public function push(...$values): void {} /** * Reduces the sequence to a single value using a callback function. - * @param callable $callback
    + * @template TCarry + * @param callable(TCarry, TValue): TCarry $callback
    * callback ( mixed $carry , mixed $value ) : mixed
    * carry The return value of the previous callback, or initial if it's the first iteration.
    * value The value of the current iteration. - * @param mixed $initial The initial value of the carry value. Can be NULL. + * @param TCarry $initial The initial value of the carry value. Can be NULL. * - * @return mixed|void The return value of the final callback. + * @return TCarry The return value of the final callback. * * @link https://www.php.net/manual/en/ds-vector.reduce.php */ @@ -636,7 +651,7 @@ public function reduce(callable $callback, $initial = null) {} /** * Removes and returns a value by index. * @param int $index The index of the value to remove. - * @return mixed The value that was removed. + * @return TValue The value that was removed. * @link https://www.php.net/manual/en/ds-vector.remove.php */ public function remove(int $index) {} @@ -649,7 +664,7 @@ public function reverse(): void {} /** * Returns a reversed copy of the sequence. - * @return Vector A reversed copy of the sequence.
    + * @return Vector A reversed copy of the sequence.
    * Note: The current instance is not affected. * @link https://www.php.net/manual/en/ds-vector.reversed.php */ @@ -673,7 +688,7 @@ public function rotate(int $rotations): void {} * @link https://www.php.net/manual/en/ds-vector.set.php * * @param int $index The index of the value to update. - * @param mixed $value The new value. + * @param TValue $value The new value. * * @throws OutOfRangeException if the index is not valid. */ @@ -684,7 +699,7 @@ public function set(int $index, $value): void {} * * @link https://www.php.net/manual/en/ds-vector.shift.php * - * @return mixed The first value, which was removed. + * @return TValue The first value, which was removed. * @throws UnderflowException if empty. */ public function shift() {} @@ -703,14 +718,14 @@ public function shift() {} * the sequence will stop that many values from the end. If a length * is not provided, the resulting sequence will contain all values * between the index and the end of the sequence. - * @return Vector + * @return Vector */ public function slice(int $index, int $length = null): Vector {} /** * Sorts the sequence in-place, using an optional comparator function. * @link https://www.php.net/manual/en/ds-vector.sort.php - * @param callable|null $comparator The comparison function must return an + * @param callable(TValue, TValue): int|null $comparator The comparison function must return an * integer less than, equal to, or greater * than zero if the first argument is considered to be respectively less than, equal to, or greater than the * second. Note that before PHP 7.0.0 this integer had to be in the @@ -727,7 +742,7 @@ public function sort(?callable $comparator = null): void {} /** * Returns a sorted copy, using an optional comparator function. * @link https://www.php.net/manual/en/ds-vector.sorted.php - * @param callable|null $comparator The comparison function must return an integer less than, equal to, or + * @param callable(TValue, TValue): int|null $comparator The comparison function must return an integer less than, equal to, or * greater than zero if the first argument is considered to be respectively less than, equal to, or greater * than the second. Note that before PHP 7.0.0 this integer had to be in the range from -2147483648 to * 2147483647.
    @@ -735,7 +750,7 @@ public function sort(?callable $comparator = null): void {} * Caution: Returning non-integer values from the comparison function, such as float, will result in an * internal cast to integer of the callback's return value. So values such as 0.99 and 0.1 will both be cast to * an integer value of 0, which will compare such values as equal. - * @return Vector Returns a sorted copy of the sequence. + * @return Vector Returns a sorted copy of the sequence. */ public function sorted(?callable $comparator = null): Vector {} @@ -751,7 +766,7 @@ public function sum(): float {} /** * Adds values to the front of the sequence, moving all the current * values forward to make room for the new values. - * @param mixed $values The values to add to the front of the sequence.
    + * @param TValue ...$values The values to add to the front of the sequence.
    * Note: Multiple values will be added in the same order that they are * passed. * @link https://www.php.net/manual/en/ds-vector.unshift.php @@ -780,7 +795,7 @@ public function isEmpty(): bool {} * Converts the collection to an array. *

    Note: Casting to an array is not supported yet.

    * @link https://www.php.net/manual/en/ds-vector.toarray.php - * @return array An array containing all the values in the same order as + * @return array An array containing all the values in the same order as * the collection. */ public function toArray(): array {} @@ -793,13 +808,40 @@ public function toArray(): array {} * @since 5.4 */ public function jsonSerialize() {} + + /** + * @param int $offset + */ + public function offsetExists(mixed $offset): bool {} + + /** + * @param int $offset + * + * @return TValue + */ + public function offsetGet(mixed $offset) {} + + /** + * @param int $offset + * @param TValue $value + */ + public function offsetSet(mixed $offset, mixed $value) {} + + /** + * @param int $offset + */ + public function offsetUnset(mixed $offset): void {} } + /** + * @template TValue + * @implements Sequence + */ class Deque implements Sequence { /** * Creates a new instance, using either a traversable object or an array for the initial values. - * @param mixed ...$values A traversable object or an array to use for the initial values. + * @param TValue ...$values A traversable object or an array to use for the initial values. * * @link https://www.php.net/manual/en/ds-deque.construct.php */ @@ -825,7 +867,7 @@ public function clear(): void {} /** * Returns a shallow copy of the deque. * @link https://www.php.net/manual/en/ds-deque.copy.php - * @return Collection + * @return Deque */ public function copy(): Collection {} @@ -842,7 +884,7 @@ public function isEmpty(): bool {} * Converts the deque to an array. *

    Note: Casting to an array is not supported yet.

    * @link https://www.php.net/manual/en/ds-deque.toarray.php - * @return array An array containing all the values in the same order as + * @return array An array containing all the values in the same order as * the deque. */ public function toArray(): array {} @@ -862,7 +904,7 @@ public function allocate(int $capacity): void {} /** * Updates all values by applying a callback function to each value in * the deque. - * @param callable $callback A callable to apply to each value in the + * @param callable(TValue): TValue $callback A callable to apply to each value in the * deque. The callback should return what the value should be * replaced by.

    * callback ( mixed $value ) : mixed @@ -880,7 +922,7 @@ public function capacity(): int {} /** * Determines if the deque contains all values. - * @param mixed $values Values to check. + * @param TValue $values Values to check. * @return bool FALSE if any of the provided values are not in the * deque, TRUE otherwise. * @link https://www.php.net/manual/en/ds-deque.contains.php @@ -890,13 +932,13 @@ public function contains(...$values): bool {} /** * Creates a new deque using a callable to determine which values * to include. - * @param null|callable $callback Optional callable which returns TRUE if the + * @param null|callable(TValue): bool $callback Optional callable which returns TRUE if the * value should be included, FALSE otherwise. If a callback is not * provided, only values which are TRUE (see converting to boolean) will * be included.

    * callback ( mixed $value ) : bool *

    - * @return Deque A new deque containing all the values for which + * @return Deque A new deque containing all the values for which * either the callback returned TRUE, or all values that convert to * TRUE if a callback was not provided. * @link https://www.php.net/manual/en/ds-deque.filter.php @@ -905,7 +947,7 @@ public function filter(?callable $callback = null): Deque {} /** * Returns the index of the value, or FALSE if not found. - * @param mixed $value The value to find. + * @param TValue $value The value to find. * @return int|false The index of the value, or FALSE if not found. * @link https://www.php.net/manual/en/ds-deque.find.php */ @@ -913,7 +955,7 @@ public function find($value) {} /** * Returns the first value in the deque. - * @return mixed The first value in the deque. + * @return TValue The first value in the deque. * @throws UnderflowException if empty. * @link https://www.php.net/manual/en/ds-deque.first.php */ @@ -922,7 +964,7 @@ public function first() {} /** * Returns the value at a given index. * @param int $index The index to access, starting at 0. - * @return mixed The value at the requested index. + * @return TValue The value at the requested index. * @throws OutOfRangeException if the index is not valid. * @link https://www.php.net/manual/en/ds-deque.get.php */ @@ -933,7 +975,7 @@ public function get(int $index) {} * * @param int $index The index at which to insert. 0 <= index <= count *

    Note: You can insert at the index equal to the number of values.

    - * @param mixed ...$values The value or values to insert. + * @param TValue ...$values The value or values to insert. * @throws OutOfRangeException if the index is not valid. * @link https://www.php.net/manual/en/ds-deque.insert.php */ @@ -951,7 +993,7 @@ public function join(string $glue = ''): string {} /** * Returns the last value in the deque. - * @return mixed The last value in the deque. + * @return TValue The last value in the deque. * @throws UnderflowException if empty. * @link https://www.php.net/manual/en/ds-deque.last.php */ @@ -961,13 +1003,14 @@ public function last() {} * Returns the result of applying a callback function to each value in * the deque. * - * @param callable $callback A callable to apply to each value in the + * @template TNewValue + * @param callable(TValue): TNewValue $callback A callable to apply to each value in the * deque. * The callable should return what the new value will be in the new * deque. * callback ( mixed $value ) : mixed * - * @return Deque The result of applying a callback to each value in + * @return Deque The result of applying a callback to each value in * the deque. *

    Note: The values of the current instance won't be * affected.

    @@ -977,8 +1020,9 @@ public function map(callable $callback): Deque {} /** * Returns the result of adding all given values to the deque. - * @param iterable $values A traversable object or an array. - * @return Deque The result of adding all given values to the + * @template TValue2 + * @param iterable $values A traversable object or an array. + * @return Deque The result of adding all given values to the * deque, effectively the same as adding the values to a copy, * then returning that copy. * @link https://www.php.net/manual/en/ds-deque.merge.php @@ -987,7 +1031,7 @@ public function merge($values): Deque {} /** * Removes and returns the last value. - * @return mixed The removed last value. + * @return TValue The removed last value. * @throws UnderflowException if empty. * @link https://www.php.net/manual/en/ds-deque.pop.php */ @@ -995,20 +1039,21 @@ public function pop() {} /** * Adds values to the end of the deque. - * @param mixed ...$values The values to add. + * @param TValue ...$values The values to add. */ public function push(...$values): void {} /** * Reduces the deque to a single value using a callback function. - * @param callable $callback + * @template TCarry + * @param callable(TCarry, TValue): TCarry $callback * callback ( mixed $carry , mixed $value ) : mixed * $carry The return value of the previous callback, or initial if it's * the first iteration.

    * $value The value of the current iteration. *

    - * @param mixed $initial The initial value of the carry value. Can be NULL. - * @return mixed The return value of the final callback. + * @param TCarry $initial The initial value of the carry value. Can be NULL. + * @return TCarry The return value of the final callback. * @link https://www.php.net/manual/en/ds-deque.reduce.php */ public function reduce(callable $callback, $initial = null) {} @@ -1016,7 +1061,7 @@ public function reduce(callable $callback, $initial = null) {} /** * Removes and returns a value by index. * @param int $index The index of the value to remove. - * @return mixed The value that was removed. + * @return TValue The value that was removed. * @link https://www.php.net/manual/en/ds-deque.remove.php */ public function remove(int $index) {} @@ -1029,7 +1074,7 @@ public function reverse(): void {} /** * Returns a reversed copy of the deque. - * @return Deque A reversed copy of the deque. + * @return Deque A reversed copy of the deque. *

    Note: The current instance is not affected.

    */ public function reversed(): Deque {} @@ -1048,7 +1093,7 @@ public function rotate(int $rotations): void {} /** * Updates a value at a given index. * @param int $index The index of the value to update. - * @param mixed $value The new value. + * @param TValue $value The new value. * @throws OutOfRangeException if the index is not valid. * @link https://www.php.net/manual/en/ds-deque.set.php */ @@ -1056,7 +1101,7 @@ public function set(int $index, $value): void {} /** * Removes and returns the first value. - * @return mixed + * @return TValue * @throws UnderflowException if empty. * @link https://www.php.net/manual/en/ds-deque.shift.php */ @@ -1074,14 +1119,14 @@ public function shift() {} * the deque will stop that many values from the end. If a length * is not provided, the resulting deque will contain all values * between the index and the end of the deque. - * @return Deque A sub-deque of the given range. + * @return Deque A sub-deque of the given range. * @link https://www.php.net/manual/en/ds-deque.slice.php */ public function slice(int $index, int $length = null): Deque {} /** * Sorts the deque in-place, using an optional comparator function. - * @param callable|null $comparator The comparison function must return + * @param callable(TValue, TValue): int|null $comparator The comparison function must return * an integer less than, equal to, or greater than zero if the first * argument is considered to be respectively less than, equal to, or * greater than the second. Note that before PHP 7.0.0 this integer had @@ -1098,7 +1143,7 @@ public function sort(?callable $comparator = null): void {} /** * Returns a sorted copy, using an optional comparator function. - * @param callable|null $comparator The comparison function must return + * @param callable(TValue, TValue): int|null $comparator The comparison function must return * an integer less than, equal to, or greater than zero if the first * argument is considered to be respectively less than, equal to, or * greater than the second. Note that before PHP 7.0.0 this integer had @@ -1109,7 +1154,7 @@ public function sort(?callable $comparator = null): void {} * of the callback's return value. So values such as 0.99 and 0.1 will * both be cast to an integer value of 0, which will compare such * values as equal.

    - * @return Deque Returns a sorted copy of the deque. + * @return Deque Returns a sorted copy of the deque. * @link https://www.php.net/manual/en/ds-deque.sort.php */ public function sorted(?callable $comparator = null): Deque {} @@ -1126,11 +1171,11 @@ public function sum(): float|int {} /** * Adds values to the front of the deque, moving all the current * values forward to make room for the new values. - * @param mixed $values The values to add to the front of the deque. + * @param TValue ...$values The values to add to the front of the deque. *

    Note: Multiple values will be added in the same order that they * are passed.

    */ - public function unshift($values): void {} + public function unshift(...$values): void {} /** * Specify data which should be serialized to JSON @@ -1140,13 +1185,41 @@ public function unshift($values): void {} * @since 5.4 */ public function jsonSerialize() {} + + /** + * @param int $offset + */ + public function offsetExists(mixed $offset): bool {} + + /** + * @param int $offset + * + * @return TValue + */ + public function offsetGet(mixed $offset) {} + + /** + * @param int $offset + * @param TValue $value + */ + public function offsetSet(mixed $offset, mixed $value) {} + + /** + * @param int $offset + */ + public function offsetUnset(mixed $offset): void {} } - class Map implements Collection + /** + * @template TKey + * @template TValue + * @implements Collection + */ + class Map implements Collection, ArrayAccess { /** * Creates a new instance, using either a traversable object or an array for the initial values. - * @param mixed ...$values A traversable object or an array to use for the initial values. + * @param iterable ...$values A traversable object or an array to use for the initial values. * * @link https://www.php.net/manual/en/ds-map.construct.php */ @@ -1166,7 +1239,7 @@ public function allocate(int $capacity) {} /** * Updates all values by applying a callback function to each value in the map. * - * @param callable $callback A callable to apply to each value in the map. The callback should return what + * @param callable(TKey, TValue): TValue $callback A callable to apply to each value in the map. The callback should return what * the value should be replaced by. * * @link https://www.php.net/manual/en/ds-map.apply.php @@ -1202,7 +1275,7 @@ public function clear(): void {} /** * Returns a shallow copy of the collection. * @link https://www.php.net/manual/en/ds-collection.copy.php - * @return Collection + * @return Map */ public function copy(): Collection {} @@ -1211,9 +1284,10 @@ public function copy(): Collection {} * * A \ B = {x ∈ A | x ∉ B} * - * @param Map $map The map containing the keys to exclude in the resulting map. + * @template TValue2 + * @param Map $map The map containing the keys to exclude in the resulting map. * - * @return Map The result of removing all keys from the current instance that are present in a given map. + * @return Map The result of removing all keys from the current instance that are present in a given map. * * @link https://www.php.net/manual/en/ds-map.diff.php */ @@ -1222,10 +1296,10 @@ public function diff(Map $map): Map {} /** * Creates a new map using a callable to determine which pairs to include * - * @param null|callable $callback Optional callable which returns TRUE if the pair should be included, FALSE + * @param null|callable(TKey, TValue): bool $callback Optional callable which returns TRUE if the pair should be included, FALSE * otherwise. If a callback is not provided, only values which are TRUE (see converting to boolean) will be included. * - * @return Map + * @return Map * * @link https://www.php.net/manual/en/ds-map.filter.php */ @@ -1234,7 +1308,7 @@ public function filter(?callable $callback = null): Map {} /** * Returns the first pair in the map * - * @return Pair The first pair in the map. + * @return Pair The first pair in the map. * * @throws UnderflowException if empty * @@ -1256,10 +1330,11 @@ public function first(): Pair {} * example, $map["1"] will attempt to access int(1), while $map->get("1") will correctly look up the string key. *

    * - * @param mixed $key The key to look up. - * @param mixed $default The optional default value, returned if the key could not be found. + * @template TDefault + * @param TKey $key The key to look up. + * @param TDefault $default The optional default value, returned if the key could not be found. * - * @return mixed The value mapped to the given key, or the default value if provided and the key could not be found in the map. + * @return TValue|TDefault The value mapped to the given key, or the default value if provided and the key could not be found in the map. * * @throws OutOfBoundsException if the key could not be found and a default value was not provided. * @@ -1272,7 +1347,7 @@ public function getIterator(): Traversable {} /** * Determines whether the map contains a given key * - * @param mixed $key The key to look for. + * @param TKey $key The key to look for. * * @return bool Returns TRUE if the key could found, FALSE otherwise. * @@ -1283,7 +1358,7 @@ public function hasKey($key): bool {} /** * Determines whether the map contains a given value * - * @param mixed $value The value to look for. + * @param TValue $value The value to look for. * * @return bool Returns TRUE if the value could found, FALSE otherwise. * @@ -1301,9 +1376,11 @@ public function hasValue($value): bool {} * *

    Note: Values from the current instance will be kept.

    * - * @param Map $map The other map, containing the keys to intersect with. + * @template TKey2 + * @template TValue2 + * @param Map $map The other map, containing the keys to intersect with. * - * @return Map The key intersection of the current instance and another map. + * @return Map The key intersection of the current instance and another map. * * @link https://www.php.net/manual/en/ds-map.intersect.php */ @@ -1332,7 +1409,7 @@ public function isEmpty(): bool {} *

    * * @link https://www.php.net/manual/en/ds-map.toarray.php - * @return array An array containing all the values in the same order as + * @return array An array containing all the values in the same order as * the map. */ public function toArray(): array {} @@ -1349,13 +1426,13 @@ public function jsonSerialize() {} /** * Returns a set containing all the keys of the map, in the same order. * @link https://www.php.net/manual/en/ds-map.keys.php - * @return Set A Ds\Set containing all the keys of the map. + * @return Set A Ds\Set containing all the keys of the map. */ public function keys(): Set {} /** * Sorts the map in-place by key, using an optional comparator function. - * @param callable|null $comparator The comparison function must return + * @param callable(TKey, TKey):int|null $comparator The comparison function must return * an integer less than, equal to, or greater than zero if the first * argument is considered to be respectively less than, equal to, or * greater than the second. Note that before PHP 7.0.0 this integer had @@ -1372,7 +1449,7 @@ public function ksort(?callable $comparator = null) {} /** * Returns a copy sorted by key, using an optional comparator function. - * @param callable|null $comparator The comparison function must return + * @param callable(TKey, TKey): int|null $comparator The comparison function must return * an integer less than, equal to, or greater than zero if the first * argument is considered to be respectively less than, equal to, or * greater than the second. Note that before PHP 7.0.0 this integer had @@ -1383,14 +1460,14 @@ public function ksort(?callable $comparator = null) {} * callback's return value. So values such as 0.99 and 0.1 will both be * cast to an integer value of 0, which will compare such values as * equal.

    - * @return Map Returns a copy of the map, sorted by key. + * @return Map Returns a copy of the map, sorted by key. * @link https://www.php.net/manual/en/ds-map.ksorted.php */ public function ksorted(?callable $comparator = null): Map {} /** * Returns the last pair of the map. - * @return Pair The last pair of the map. + * @return Pair The last pair of the map. * @throws UnderflowException if empty * @link https://www.php.net/manual/en/ds-map.last.php */ @@ -1399,11 +1476,12 @@ public function last(): Pair {} /** * Returns the result of applying a callback function to each value of * the map. - * @param callable $callback A callable to apply to each value in the + * @template TNewValue + * @param callable(TKey, TValue): TNewValue $callback A callable to apply to each value in the * map. The callable should return what the key will be mapped to in the * resulting map. * callback ( mixed $key , mixed $value ) : mixed - * @return Map The result of applying a callback to each value in the + * @return Map The result of applying a callback to each value in the * map. * * Note: The keys and values of the current instance won't be affected. @@ -1416,8 +1494,10 @@ public function map(callable $callback): Map {} * Returns the result of associating all keys of a given traversable * object or array with their corresponding values, combined with the * current instance. - * @param iterable $values A traversable object or an array. - * @return Map The result of associating all keys of a given traversable + * @template TKey2 + * @template TValue2 + * @param iterable $values A traversable object or an array. + * @return Map The result of associating all keys of a given traversable * object or array with their corresponding values, combined with the * current instance. * @@ -1430,7 +1510,7 @@ public function merge($values): Map {} /** * Returns a Ds\Sequence containing all the pairs of the map. * - * @return Sequence Ds\Sequence containing all the pairs of the map. + * @return Sequence> Ds\Sequence containing all the pairs of the map. * * @link https://www.php.net/manual/en/ds-map.pairs.php */ @@ -1439,8 +1519,8 @@ public function pairs(): Sequence {} /** * Associates a key with a value, overwriting a previous association if * one exists. - * @param mixed $key The key to associate the value with. - * @param mixed $value The value to be associated with the key. + * @param TKey $key The key to associate the value with. + * @param TValue $value The value to be associated with the key. * * Note: Keys of type object are supported. If an object implements * Ds\Hashable, equality will be determined by the object's equals @@ -1468,7 +1548,7 @@ public function put($key, $value) {} * Ds\Hashable, objects must be references to the same instance to be * considered equal. * - * @param iterable $pairs traversable object or array. + * @param iterable $pairs traversable object or array. * * @link https://www.php.net/manual/en/ds-map.putall.php */ @@ -1477,16 +1557,18 @@ public function putAll($pairs) {} /** * Reduces the map to a single value using a callback function. * - * @param callable $callback + * @template TCarry + * @param callable(TCarry, TKey, TValue): TCarry $callback * callback ( mixed $carry , mixed $key , mixed $value ) : mixed * carry The return value of the previous callback, or initial if * it's the first iteration. * key The key of the current iteration. * value The value of the current iteration. * - * @param mixed $initial The initial value of the carry value. Can be + * @param TCarry $initial The initial value of the carry value. Can be * NULL. * + * @return TCarry * @link https://www.php.net/manual/en/ds-map.reduce.php */ public function reduce(callable $callback, $initial) {} @@ -1495,8 +1577,9 @@ public function reduce(callable $callback, $initial) {} * Removes and returns a value by key, or return an optional default * value if the key could not be found. * - * @param mixed $key The key to remove. - * @param mixed $default The optional default value, returned if the key + * @template TDefault + * @param TKey $key The key to remove. + * @param TDefault $default The optional default value, returned if the key * could not be found. * * Note: Keys of type object are supported. If an object implements @@ -1513,7 +1596,7 @@ public function reduce(callable $callback, $initial) {} * attempt to access int(1), while $map->get("1") will correctly look up * the string key. * - * @return mixed The value that was removed, or the default value if + * @return TValue|TDefault The value that was removed, or the default value if * provided and the key could not be found in the map. * * @throws OutOfBoundsException if the key could not be found and a @@ -1533,7 +1616,7 @@ public function reverse() {} /** * Returns a reversed copy of the map. * - * @return Map A reversed copy of the map. + * @return Map A reversed copy of the map. * *

    Note: The current instance is not affected.

    * @@ -1546,7 +1629,7 @@ public function reversed(): Map {} * * @param int $position The zero-based positional index to return. * - * @return Pair Returns the Ds\Pair at the given position. + * @return Pair Returns the Ds\Pair at the given position. * * @throws OutOfRangeException if the position is not valid. * @@ -1569,7 +1652,7 @@ public function skip(int $position): Pair {} * resulting map will contain all pairs between the index and the end of * the map. * - * @return Map A subset of the map defined by a starting index and + * @return Map A subset of the map defined by a starting index and * length. * * @link https://www.php.net/manual/en/ds-map.slice.php @@ -1580,7 +1663,7 @@ public function slice(int $index, ?int $length = null): Map {} * Sorts the map in-place by value, using an optional comparator * function. * - * @param callable|null $comparator The comparison function must return + * @param callable(TValue, TValue): int|null $comparator The comparison function must return * an integer less than, equal to, or greater than zero if the first * argument is considered to be respectively less than, equal to, or * greater than the second. Note that before PHP 7.0.0 this integer had @@ -1601,7 +1684,7 @@ public function sort(?callable $comparator = null) {} /** * Returns a copy, sorted by value using an optional comparator function. * - * @param callable|null $comparator The comparison function must return + * @param callable(TValue, TValue): int|null $comparator The comparison function must return * an integer less than, equal to, or greater than zero if the first * argument is considered to be respectively less than, equal to, or * greater than the second. Note that before PHP 7.0.0 this integer had @@ -1615,7 +1698,7 @@ public function sort(?callable $comparator = null) {} * cast to an integer value of 0, which will compare such values as * equal. * - * @return Map + * @return Map * * @link https://www.php.net/manual/en/ds-map.sorted.php */ @@ -1643,9 +1726,11 @@ public function sum(): float|int {} *

    Note: Values of the current instance will be overwritten by those * provided where keys are equal.

    * - * @param Map $map The other map, to combine with the current instance. + * @template TKey2 + * @template TValue2 + * @param Map $map The other map, to combine with the current instance. * - * @return Map A new map containing all the pairs of the current + * @return Map A new map containing all the pairs of the current * instance as well as another map. * * @link https://www.php.net/manual/en/ds-map.union.php @@ -1656,7 +1741,7 @@ public function union(Map $map): Map {} * Returns a sequence containing all the values of the map, in the same * order. * - * @return Sequence A Ds\Sequence containing all the values of the map. + * @return Sequence A Ds\Sequence containing all the values of the map. * * @link https://www.php.net/manual/en/ds-map.values.php */ @@ -1668,37 +1753,64 @@ public function values(): Sequence {} * * A ⊖ B = {x : x ∈ (A \ B) ∪ (B \ A)} * - * @param Map $map The other map. + * @template TKey2 + * @template TValue2 + * @param Map $map The other map. * - * @return Map A new map containing keys in the current instance as well + * @return Map A new map containing keys in the current instance as well * as another map, but not in both. * * @link https://www.php.net/manual/en/ds-map.xor.php */ public function xor(Map $map): Map {} + + /** + * @param TKey $offset + */ + public function offsetExists(mixed $offset): bool {} + + /** + * @param TKey $offset + * + * @return TValue + */ + public function offsetGet(mixed $offset) {} + + /** + * @param TKey $offset + * @param TValue $value + */ + public function offsetSet(mixed $offset, mixed $value) {} + + /** + * @param TKey $offset + */ + public function offsetUnset(mixed $offset): void {} } /** * A pair is used by Ds\Map to pair keys with values. * @package Ds + * @template-covariant TKey + * @template-covariant TValue */ class Pair implements JsonSerializable { /** - * @var mixed + * @var TKey */ public $key; /** - * @var mixed + * @var TValue */ public $value; /** * Creates a new instance using a given key and value. * - * @param mixed $key - * @param mixed $value + * @param TKey $key + * @param TValue $value * * @link https://php.net/manual/en/ds-pair.construct.php */ @@ -1714,7 +1826,7 @@ public function clear() {} /** * Returns a shallow copy of the pair. * - * @return Pair Returns a shallow copy of the pair. + * @return Pair Returns a shallow copy of the pair. * * @link https://php.net/manual/en/ds-pair.copy.php */ @@ -1734,7 +1846,7 @@ public function isEmpty(): bool {} * *

    Note: Casting to an array is not supported yet.

    * - * @return array An array containing all the values in the same order as + * @return array{key: TKey, value: TValue} An array containing all the values in the same order as * the pair. * * @link https://php.net/manual/en/ds-pair.toarray.php @@ -1758,14 +1870,16 @@ public function jsonSerialize() {} * @link https://www.php.net/manual/en/class.ds-set.php * * @package Ds + * @template TValue + * @implements Collection */ - class Set implements Collection + class Set implements Collection, ArrayAccess { /** * Creates a new instance, using either a traversable object or an array * for the initial values. * - * @param iterable $values A traversable object of an array to + * @param iterable $values A traversable object of an array to * use the initial values. * * @link https://php.net/manual/en/ds-set.construct.php @@ -1782,7 +1896,7 @@ public function __construct(iterable $values = []) {} * *

    Caution: All comparisons are strict (type and value). * - * @param mixed ...$values Values to add to the set. + * @param TValue ...$values Values to add to the set. * * @link https://php.net/manual/en/ds-set.add.php */ @@ -1813,7 +1927,7 @@ public function allocate(int $capacity) {} * *

    Caution: All comparisons are strict (type and value). * - * @param mixed ...$values Values to check. + * @param TValue ...$values Values to check. * * @return bool * @@ -1849,7 +1963,7 @@ public function count(): int {} /** * Returns a shallow copy of the set. * @link https://www.php.net/manual/en/ds-set.copy.php - * @return Set + * @return Set */ public function copy(): Set {} @@ -1860,9 +1974,10 @@ public function copy(): Set {} * * @link https://www.php.net/manual/en/ds-set.diff.php * - * @param Set $set Set containing the values to exclude. + * @template TValue2 + * @param Set $set Set containing the values to exclude. * - * @return Set A new set containing all values that were not in the + * @return Set A new set containing all values that were not in the * other set. */ public function diff(Set $set): Set {} @@ -1873,12 +1988,12 @@ public function diff(Set $set): Set {} * * @link https://www.php.net/manual/en/ds-set.filter.php * - * @param null|callable $callback Optional callable which returns TRUE if the + * @param null|callable(TValue): bool $callback Optional callable which returns TRUE if the * value should be included, FALSE otherwise. * If a callback is not provided, only values which are TRUE (see * converting to boolean) will be included. * - * @return Set A new set containing all the values for which either the + * @return Set A new set containing all the values for which either the * callback returned TRUE, or all values that convert to TRUE if a * callback was not provided. */ @@ -1889,7 +2004,7 @@ public function filter(?callable $callback = null): Set {} * * @link https://www.php.net/manual/en/ds-set.first.php * - * @return mixed The first value in the set. + * @return TValue The first value in the set. */ public function first() {} @@ -1900,7 +2015,7 @@ public function first() {} * * @param int $index The index to access, starting at 0. * - * @return mixed The value at the requested index. + * @return TValue The value at the requested index. */ public function get(int $index) {} @@ -1915,9 +2030,9 @@ public function getIterator(): Traversable {} * * @link https://www.php.net/manual/en/ds-set.intersect.php * - * @param Set $set The other set. - * - * @return Set The intersection of the current instance and another set. + * @template TValue2 + * @param Set $set The other set. + * @return Set The intersection of the current instance and another set. */ public function intersect(Set $set): Set {} @@ -1944,12 +2059,13 @@ public function join(?string $glue = null): string {} /** * Returns the result of applying a callback function to each value in * the set. - * @param callable $callback A callable to apply to each value in the + * @template TNewValue + * @param callable(TValue): TNewValue $callback A callable to apply to each value in the * set. * The callable should return what the new value will be in the new * set. * callback ( mixed $value ) : mixed - * @return Set The result of applying a callback to each value in + * @return Set The result of applying a callback to each value in * the set. *

    Note: The values of the current instance won't be affected.

    */ @@ -1962,9 +2078,10 @@ public function map(callable $callback): Set {} * * @link https://www.php.net/manual/en/ds-set.merge.php * - * @param iterable $values A traversable object or an array. + * @template TValue2 + * @param iterable $values A traversable object or an array. * - * @return Set The result of adding all given values to the set, + * @return Set The result of adding all given values to the set, * effectively the same as adding the values to a copy, then returning * that copy. */ @@ -1975,16 +2092,17 @@ public function merge($values): Set {} * * @link https://www.php.net/manual/en/ds-set.reduce.php * - * @param callable $callback + * @template TCarry + * @param callable(TCarry, TValue): TCarry $callback * callback ( mixed $carry , mixed $value ) : mixed * $carry The return value of the previous callback, or initial if * it's the first iteration. * $value The value of the current iteration. * - * @param mixed|null $initial The initial value of the carry value. Can be + * @param TCarry $initial The initial value of the carry value. Can be * NULL. * - * @return mixed The return value of the final callback. + * @return TCarry The return value of the final callback. */ public function reduce(callable $callback, $initial = null) {} @@ -1994,7 +2112,7 @@ public function reduce(callable $callback, $initial = null) {} * * @link https://www.php.net/manual/en/ds-set.remove.php * - * @param mixed ...$values The values to remove. + * @param TValue ...$values The values to remove. */ public function remove(...$values) {} @@ -2012,7 +2130,7 @@ public function reverse() {} * *

    Note: The current instance is not affected.

    * - * @return Set A reversed copy of the set. + * @return Set A reversed copy of the set. */ public function reversed(): Set {} @@ -2031,7 +2149,7 @@ public function reversed(): Set {} * resulting set will contain all values between the index and the end * of the set. * - * @return Set A sub-set of the given range. + * @return Set A sub-set of the given range. */ public function slice(int $index, ?int $length = null): Set {} @@ -2040,7 +2158,7 @@ public function slice(int $index, ?int $length = null): Set {} * * @link https://www.php.net/manual/en/ds-set.last.php * - * @return mixed The last value in the set. + * @return TValue The last value in the set. * * @throws UnderflowException if empty. */ @@ -2049,7 +2167,7 @@ public function last() {} /** * Sorts the set in-place, using an optional comparator function. * - * @param callable|null $comparator The comparison function must return + * @param callable(TValue, TValue): int|null $comparator The comparison function must return * an integer less than, equal to, or greater than zero if the first * argument is considered to be respectively less than, equal to, or * greater than the second. Note that before PHP 7.0.0 this integer had @@ -2070,7 +2188,7 @@ public function sort(?callable $comparator = null) {} * * @link https://www.php.net/manual/en/ds-set.sorted.php * - * @param null|callable $comparator The comparison function must return an + * @param null|callable(TValue, TValue): int $comparator The comparison function must return an * integer less than, equal to, or greater than zero if the first * argument is considered to be respectively less than, equal to, or * greater than the second. Note that before PHP 7.0.0 this integer had @@ -2084,7 +2202,7 @@ public function sort(?callable $comparator = null) {} * such as 0.99 and 0.1 will both be cast to an integer value of 0, * which will compare such values as equal.

    * - * @return Set Returns a sorted copy of the set. + * @return Set Returns a sorted copy of the set. */ public function sorted(?callable $comparator = null): Set {} @@ -2109,9 +2227,10 @@ public function sum(): float|int {} * * @link https://www.php.net/manual/en/ds-set.union.php * - * @param Set $set The other set, to combine with the current instance. + * @template TValue2 + * @param Set $set The other set, to combine with the current instance. * - * @return Set A new set containing all the values of the current + * @return Set A new set containing all the values of the current * instance as well as another set. */ public function union(Set $set): Set {} @@ -2124,9 +2243,10 @@ public function union(Set $set): Set {} * * @link https://www.php.net/manual/en/ds-set.xor.php * - * @param Set $set The other set. + * @template TValue2 + * @param Set $set The other set. * - * @return Set A new set containing values in the current instance as + * @return Set A new set containing values in the current instance as * well as another set, but not in both. */ public function xor(Set $set): Set {} @@ -2135,7 +2255,7 @@ public function xor(Set $set): Set {} * Converts the set to an array. *

    Note: Casting to an array is not supported yet.

    * @link https://www.php.net/manual/en/ds-set.toarray.php - * @return array An array containing all the values in the same order as + * @return array An array containing all the values in the same order as * the collection. */ public function toArray(): array {} @@ -2148,6 +2268,29 @@ public function toArray(): array {} * @since 5.4 */ public function jsonSerialize() {} + + /** + * @param int $offset + */ + public function offsetExists(mixed $offset): bool {} + + /** + * @param int $offset + * + * @return TValue + */ + public function offsetGet(mixed $offset) {} + + /** + * @param int $offset + * @param TValue $value + */ + public function offsetSet(mixed $offset, mixed $value) {} + + /** + * @param int $offset + */ + public function offsetUnset(mixed $offset): void {} } /** @@ -2156,10 +2299,12 @@ public function jsonSerialize() {} * order, destructively. * * @package Ds + * @template TValue + * @implements Collection * * @link https://www.php.net/manual/en/class.ds-stack.php */ - class Stack implements Collection + class Stack implements Collection, ArrayAccess { /** * Creates a new instance, using either a traversable object or an array @@ -2167,7 +2312,7 @@ class Stack implements Collection * * @link https://www.php.net/manual/en/ds-stack.construct.php * - * @param iterable $values A traversable object or an + * @param iterable $values A traversable object or an * array to use for the initial values. */ public function __construct($values = []) {} @@ -2215,7 +2360,7 @@ public function count(): int {} /** * Returns a shallow copy of the collection. * @link https://www.php.net/manual/en/ds-stack.copy.php - * @return Stack + * @return Stack */ public function copy(): Stack {} @@ -2232,7 +2377,7 @@ public function isEmpty(): bool {} * Converts the collection to an array. *

    Note: Casting to an array is not supported yet.

    * @link https://www.php.net/manual/en/ds-stack.toarray.php - * @return array An array containing all the values in the same order as + * @return array An array containing all the values in the same order as * the collection. */ public function toArray(): array {} @@ -2251,7 +2396,7 @@ public function jsonSerialize() {} * * @link https://www.php.net/manual/en/ds-queue.peek.php * - * @return mixed The value at the top of the stack. + * @return TValue The value at the top of the stack. * * @throws UnderflowException */ @@ -2262,7 +2407,7 @@ public function peek() {} * * @link https://www.php.net/manual/en/ds-queue.pop.php * - * @return mixed The removed value which was at the top of the stack. + * @return TValue The removed value which was at the top of the stack. * * @throws UnderflowException */ @@ -2273,9 +2418,32 @@ public function pop() {} * * @link https://www.php.net/manual/en/ds-queue.push.php * - * @param array $values The values to push onto the stack. + * @param TValue ...$values The values to push onto the stack. */ public function push(...$values) {} + + /** + * @param int $offset + */ + public function offsetExists(mixed $offset): bool {} + + /** + * @param int $offset + * + * @return TValue + */ + public function offsetGet(mixed $offset) {} + + /** + * @param int $offset + * @param TValue $value + */ + public function offsetSet(mixed $offset, mixed $value) {} + + /** + * @param int $offset + */ + public function offsetUnset(mixed $offset): void {} } /** @@ -2286,8 +2454,10 @@ public function push(...$values) {} * Uses a Ds\Vector internally. * * @package Ds + * @template TValue + * @implements Collection */ - class Queue implements Collection + class Queue implements Collection, ArrayAccess { /** * Creates a new instance, using either a traversable object or an array @@ -2295,7 +2465,7 @@ class Queue implements Collection * * @link https://www.php.net/manual/en/ds-queue.construct.php * - * @param iterable $values A traversable object or an + * @param iterable $values A traversable object or an * array to use for the initial values. */ public function __construct($values = []) {} @@ -2343,10 +2513,13 @@ public function count(): int {} /** * Returns a shallow copy of the collection. * @link https://www.php.net/manual/en/ds-queue.copy.php - * @return Stack + * @return Queue */ - public function copy(): Stack {} + public function copy(): Queue {} + /** + * @return Traversable + */ public function getIterator(): Traversable {} /** @@ -2360,7 +2533,7 @@ public function isEmpty(): bool {} * Converts the collection to an array. *

    Note: Casting to an array is not supported yet.

    * @link https://www.php.net/manual/en/ds-queue.toarray.php - * @return array An array containing all the values in the same order as + * @return array An array containing all the values in the same order as * the collection. */ public function toArray(): array {} @@ -2379,7 +2552,7 @@ public function jsonSerialize() {} * * @link https://www.php.net/manual/en/ds-queue.peek.php * - * @return mixed The value at the top of the queue. + * @return TValue The value at the top of the queue. * * @throws UnderflowException */ @@ -2390,7 +2563,7 @@ public function peek() {} * * @link https://www.php.net/manual/en/ds-queue.pop.php * - * @return mixed The removed value which was at the top of the queue. + * @return TValue The removed value which was at the top of the queue. * * @throws UnderflowException */ @@ -2401,9 +2574,32 @@ public function pop() {} * * @link https://www.php.net/manual/en/ds-queue.push.php * - * @param array $values The values to push onto the queue. + * @param TValue ...$values The values to push onto the queue. */ public function push(...$values) {} + + /** + * @param int $offset + */ + public function offsetExists(mixed $offset): bool {} + + /** + * @param int $offset + * + * @return TValue + */ + public function offsetGet(mixed $offset) {} + + /** + * @param int $offset + * @param TValue $value + */ + public function offsetSet(mixed $offset, mixed $value) {} + + /** + * @param int $offset + */ + public function offsetUnset(mixed $offset): void {} } /** @@ -2414,6 +2610,8 @@ public function push(...$values) {} * Implemented using a max heap. * * @package Ds + * @template TValue + * @implements Collection * * @link https://www.php.net/manual/en/class.ds-priorityqueue.php */ @@ -2436,7 +2634,7 @@ public function count(): int {} * Allocates enough memory for a required capacity * @link https://www.php.net/manual/en/ds-priorityqueue.allocate.php * - * @param int $capacity + * @param int $capacity */ public function allocate(int $capacity): void {} @@ -2457,7 +2655,7 @@ public function clear(): void {} /** * Returns a shallow copy of the collection. * @link https://www.php.net/manual/en/ds-collection.copy.php - * @return Collection + * @return PriorityQueue */ public function copy() {} @@ -2474,7 +2672,7 @@ public function isEmpty(): bool {} * Returns the value at the front of the queue, but does not remove it. * @link https://www.php.net/manual/en/ds-priorityqueue.peek.php * - * @return mixed The value at the front of the queue. + * @return TValue The value at the front of the queue. * @throws UnderflowException if empty. */ public function peek() {} @@ -2483,7 +2681,7 @@ public function peek() {} * Removes and returns the value with the highest priority * @link https://www.php.net/manual/en/ds-priorityqueue.pop.php * - * @return mixed The removed value which was at the front of the queue. + * @return TValue The removed value which was at the front of the queue. * @throws UnderflowException if empty. */ public function pop() {} @@ -2491,8 +2689,8 @@ public function pop() {} /** * Pushes a value with a given priority into the queue. * - * @param mixed $value - * @param int $priority + * @param TValue $value + * @param int $priority */ public function push($value, int $priority) {} @@ -2500,7 +2698,7 @@ public function push($value, int $priority) {} * Converts the collection to an array. *

    Note: Casting to an array is not supported yet.

    * @link https://www.php.net/manual/en/ds-collection.toarray.php - * @return array An array containing all the values in the same order as + * @return array An array containing all the values in the same order as * the collection. */ public function toArray(): array {} diff --git a/ftp/ftp.php b/ftp/ftp.php index 727a95597..ee50cbc4c 100644 --- a/ftp/ftp.php +++ b/ftp/ftp.php @@ -609,10 +609,11 @@ function ftp_nb_fget( * The transfer mode. Must be either FTP_ASCII or FTP_BINARY. Optional since PHP 7.3 *

    * @param int $offset [optional]

    The position in the remote file to start downloading from.

    - * @return int FTP_FAILED or FTP_FINISHED + * @return int|false FTP_FAILED or FTP_FINISHED * or FTP_MOREDATA. */ #[EV([FTP_FAILED, FTP_FINISHED, FTP_MOREDATA])] +#[LanguageLevelTypeAware(["8.1" => "int|false"], default: "int")] function ftp_nb_get( #[LanguageLevelTypeAware(['8.1' => 'FTP\Connection'], default: 'resource')] $ftp, string $local_filename, @@ -624,7 +625,7 @@ function ftp_nb_get( #[PhpStormStubsElementAvailable(from: '7.3')] int $mode = FTP_BINARY, int $offset = 0 -): int {} +) {} /** * Continues retrieving/sending a file (non-blocking) diff --git a/gd/gd.php b/gd/gd.php index 27b74d859..08537aeb2 100644 --- a/gd/gd.php +++ b/gd/gd.php @@ -1051,7 +1051,7 @@ function imagegif(GdImage $image, $file = null): bool {} * Output image to browser or file * @link https://php.net/manual/en/function.imagejpeg.php * @param resource|GdImage $image - * @param string $filename [optional]

    + * @param string $file [optional]

    * The path to save the file to. If not set or null, the raw image stream * will be outputted directly. *

    @@ -1066,7 +1066,7 @@ function imagegif(GdImage $image, $file = null): bool {} *

    * @return bool true on success or false on failure. */ -function imagejpeg($image, $filename = null, $quality = null): bool {} +function imagejpeg($image, $file = null, $quality = null): bool {} /** * Output image to browser or file @@ -1179,8 +1179,28 @@ function imagefilledpolygon( GdImage $image, array $points, #[Deprecated(since: "8.1")] int $num_points_or_color, - #[PhpStormStubsElementAvailable(from: '5.3', to: '7.4')] ?int $color, - #[PhpStormStubsElementAvailable(from: '8.0')] ?int $color = null + ?int $color +): bool {} + +/** + * Draw a filled polygon + * @link https://php.net/manual/en/function.imagefilledpolygon.php + * @param GdImage $image + * @param int[] $points

    + * An array containing the x and y + * coordinates of the polygons vertices consecutively. + *

    + * @param int|null $color

    + * A color identifier created with + * imagecolorallocate. + *

    + * @return bool true on success or false on failure. + */ +#[PhpStormStubsElementAvailable(from: '8.0')] +function imagefilledpolygon( + GdImage $image, + array $points, + ?int $color ): bool {} /** diff --git a/gmp/gmp.php b/gmp/gmp.php index aa30438f2..37266e501 100644 --- a/gmp/gmp.php +++ b/gmp/gmp.php @@ -800,6 +800,11 @@ function gmp_perfect_power(GMP|string|int $num): bool {} class GMP implements Serializable { + /** + * @since 8.2 + */ + public function __construct(int|string $num = 0, int $base = 0) {} + /** * String representation of object * @link https://php.net/manual/en/serializable.serialize.php @@ -812,12 +817,12 @@ public function __serialize(): array {} /** * Constructs the object * @link https://php.net/manual/en/serializable.unserialize.php - * @param string $serialized

    + * @param string $data

    * The string representation of the object. *

    * @return void */ - public function unserialize($serialized) {} + public function unserialize($data) {} public function __unserialize(array $data): void {} } diff --git a/ibm_db2/ibm_db2.php b/ibm_db2/ibm_db2.php index 9130c7676..b074a0baf 100644 --- a/ibm_db2/ibm_db2.php +++ b/ibm_db2/ibm_db2.php @@ -6,32 +6,23 @@ * Returns a connection to a database * @link https://php.net/manual/en/function.db2-connect.php * @param string $database

    - * For a cataloged connection to a database, database - * represents the database alias in the DB2 client catalog. + * For a cataloged connection to a database, this parameter + * represents the connection alias in the DB2 client catalog. *

    *

    * For an uncataloged connection to a database, - * database represents a complete connection - * string in the following format: - * DATABASE=database;HOSTNAME=hostname;PORT=port;PROTOCOL=TCPIP;UID=username;PWD=password; - * where the parameters represent the following values: - * database - *

    - * The name of the database. + * this parameter represents a complete DSN in the following format: + * DRIVER=driver;DATABASE=database;HOSTNAME=hostname;PORT=port;PROTOCOL=TCPIP;UID=username;PWD=password; *

    - * @param string $username

    - * The username with which you are connecting to the database. + * @param string|null $username

    + * The username with which you are connecting to the database, or null if + * the $database parameter contains a DSN which already provides the username for + * the connection. *

    - *

    - * For uncataloged connections, you must pass a null value or empty - * string. - *

    - * @param string $password

    - * The password with which you are connecting to the database. - *

    - *

    - * For uncataloged connections, you must pass a null value or empty - * string. + * @param string|null $password

    + * The password with which you are connecting to the database, or null if + * the $database parameter contains a DSN which already provides the password for + * the connection. *

    * @param array $options

    * An associative array of connection options that affect the behavior @@ -49,7 +40,7 @@ * successful. If the connection attempt fails, db2_connect * returns false. */ -function db2_connect($database, $username, $password, array $options = null) {} +function db2_connect(#[\SensitiveParameter] string $database, ?string $username, #[\SensitiveParameter] ?string $password, array $options = []) {} /** * Commits a transaction @@ -60,19 +51,29 @@ function db2_connect($database, $username, $password, array $options = null) {} *

    * @return bool true on success or false on failure. */ -function db2_commit($connection) {} +function db2_commit($connection): bool {} /** * Returns a persistent connection to a database * @link https://php.net/manual/en/function.db2-pconnect.php * @param string $database

    - * The database alias in the DB2 client catalog. + * For a cataloged connection to a database, this parameter + * represents the connection alias in the DB2 client catalog. + *

    + *

    + * For an uncataloged connection to a database, + * this parameter represents a complete DSN in the following format: + * DRIVER=driver;DATABASE=database;HOSTNAME=hostname;PORT=port;PROTOCOL=TCPIP;UID=username;PWD=password; *

    - * @param string $username

    - * The username with which you are connecting to the database. + * @param string|null $username

    + * The username with which you are connecting to the database, or null if + * the $database parameter contains a DSN which already provides the username for + * the connection. *

    - * @param string $password

    - * The password with which you are connecting to the database. + * @param string|null $password

    + * The password with which you are connecting to the database, or null if + * the $database parameter contains a DSN which already provides the password for + * the connection. *

    * @param array $options

    * An associative array of connection options that affect the behavior @@ -94,7 +95,7 @@ function db2_commit($connection) {} * password parameters. If the connection attempt fails, * db2_pconnect returns false. */ -function db2_pconnect($database, $username, $password, array $options = null) {} +function db2_pconnect(#[\SensitiveParameter] string $database, ?string $username, #[\SensitiveParameter] ?string $password, array $options = []) {} /** * Returns or sets the AUTOCOMMIT state for a database connection @@ -103,7 +104,7 @@ function db2_pconnect($database, $username, $password, array $options = null) {} * A valid database connection resource variable as returned from * db2_connect or db2_pconnect. *

    - * @param bool $value

    + * @param int $value

    * One of the following constants:

    *

    * DB2_AUTOCOMMIT_OFF @@ -113,7 +114,7 @@ function db2_pconnect($database, $username, $password, array $options = null) {} * DB2_AUTOCOMMIT_ON * Turns AUTOCOMMIT on. *

    - * @return mixed

    When db2_autocommit receives only the + * @return int|bool

    When db2_autocommit receives only the * connection parameter, it returns the current state * of AUTOCOMMIT for the requested connection as an integer value. A value of * 0 indicates that AUTOCOMMIT is off, while a value of 1 indicates that @@ -126,7 +127,7 @@ function db2_pconnect($database, $username, $password, array $options = null) {} * AUTOCOMMIT state of the requested connection to the corresponding state. * true on success or false on failure.

    */ -function db2_autocommit($connection, $value = null) {} +function db2_autocommit($connection, int $value = null): int|bool {} /** * Binds a PHP variable to an SQL statement parameter @@ -152,7 +153,7 @@ function db2_autocommit($connection, $value = null) {} *

    * @return bool true on success or false on failure. */ -function db2_bind_param($stmt, $parameter_number, $variable_name, $parameter_type = null, $data_type = null, $precision = null, $scale = null) {} +function db2_bind_param($stmt, int $parameter_number, string $variable_name, int $parameter_type = DB2_PARAM_IN, int $data_type = 0, int $precision = -1, int $scale = 0): bool {} /** * Closes a database connection @@ -162,7 +163,7 @@ function db2_bind_param($stmt, $parameter_number, $variable_name, $parameter_typ *

    * @return bool true on success or false on failure. */ -function db2_close($connection) {} +function db2_close($connection): bool {} /** * Returns a result set listing the columns and associated privileges for a table @@ -170,16 +171,16 @@ function db2_close($connection) {} * @param resource $connection

    * A valid connection to an IBM DB2, Cloudscape, or Apache Derby database. *

    - * @param string $qualifier

    + * @param string|null $qualifier

    * A qualifier for DB2 databases running on OS/390 or z/OS servers. For * other databases, pass null or an empty string. *

    - * @param string $schema

    + * @param string|null $schema

    * The schema which contains the tables. To match all schemas, pass null * or an empty string. *

    - * @param string $table_name - * @param string $column_name + * @param string|null $table_name + * @param string|null $column_name * @return resource|false a statement resource with a result set containing rows describing * the column privileges for columns matching the specified parameters. The * rows are composed of the following columns: @@ -223,7 +224,7 @@ function db2_close($connection) {} * other users. * */ -function db2_column_privileges($connection, $qualifier = null, $schema = null, $table_name = null, $column_name = null) {} +function db2_column_privileges($connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null, ?string $column_name = null) {} function db2_columnprivileges() {} @@ -352,11 +353,11 @@ function db2_columns($connection, $qualifier = null, $schema = null, $table_name * @param resource $connection

    * A valid connection to an IBM DB2, Cloudscape, or Apache Derby database. *

    - * @param string $qualifier

    + * @param string|null $qualifier

    * A qualifier for DB2 databases running on OS/390 or z/OS servers. For * other databases, pass null or an empty string. *

    - * @param string $schema

    + * @param string|null $schema

    * The schema which contains the tables. If schema * is null, db2_foreign_keys matches the schema for * the current connection. @@ -446,7 +447,7 @@ function db2_columns($connection, $qualifier = null, $schema = null, $table_name * * */ -function db2_foreign_keys($connection, $qualifier, $schema, $table_name) {} +function db2_foreign_keys($connection, ?string $qualifier, ?string $schema, string $table_name) {} function db2_foreignkeys() {} @@ -456,11 +457,11 @@ function db2_foreignkeys() {} * @param resource $connection

    * A valid connection to an IBM DB2, Cloudscape, or Apache Derby database. *

    - * @param string $qualifier

    + * @param string|null $qualifier

    * A qualifier for DB2 databases running on OS/390 or z/OS servers. For * other databases, pass null or an empty string. *

    - * @param string $schema

    + * @param string|null $schema

    * The schema which contains the tables. If schema * is null, db2_primary_keys matches the schema for * the current connection. @@ -503,7 +504,7 @@ function db2_foreignkeys() {} * The name of the primary key. * */ -function db2_primary_keys($connection, $qualifier, $schema, $table_name) {} +function db2_primary_keys($connection, ?string $qualifier, ?string $schema, string $table_name) {} function db2_primarykeys() {} @@ -513,7 +514,7 @@ function db2_primarykeys() {} * @param resource $connection

    * A valid connection to an IBM DB2, Cloudscape, or Apache Derby database. *

    - * @param string $qualifier

    + * @param string|null $qualifier

    * A qualifier for DB2 databases running on OS/390 or z/OS servers. For * other databases, pass null or an empty string. *

    @@ -527,7 +528,7 @@ function db2_primarykeys() {} * search pattern containing _ and % * as wildcards. *

    - * @param string $parameter

    + * @param string|null $parameter

    * The name of the parameter. This parameter accepts a search pattern * containing _ and % as wildcards. * If this parameter is null, all parameters for the specified stored @@ -661,7 +662,7 @@ function db2_primarykeys() {} * * */ -function db2_procedure_columns($connection, $qualifier, $schema, $procedure, $parameter) {} +function db2_procedure_columns($connection, ?string $qualifier, string $schema, string $procedure, ?string $parameter) {} function db2_procedurecolumns() {} @@ -671,7 +672,7 @@ function db2_procedurecolumns() {} * @param resource $connection

    * A valid connection to an IBM DB2, Cloudscape, or Apache Derby database. *

    - * @param string $qualifier

    + * @param string|null $qualifier

    * A qualifier for DB2 databases running on OS/390 or z/OS servers. For * other databases, pass null or an empty string. *

    @@ -727,7 +728,7 @@ function db2_procedurecolumns() {} * procedure does not return a return value. * */ -function db2_procedures($connection, $qualifier, $schema, $procedure) {} +function db2_procedures($connection, ?string $qualifier, string $schema, string $procedure) {} /** * Returns a result set listing the unique row identifier columns for a table @@ -735,7 +736,7 @@ function db2_procedures($connection, $qualifier, $schema, $procedure) {} * @param resource $connection

    * A valid connection to an IBM DB2, Cloudscape, or Apache Derby database. *

    - * @param string $qualifier

    + * @param string|null $qualifier

    * A qualifier for DB2 databases running on OS/390 or z/OS servers. For * other databases, pass null or an empty string. *

    @@ -853,7 +854,7 @@ function db2_procedures($connection, $qualifier, $schema, $procedure) {} * Always returns 1. * */ -function db2_special_columns($connection, $qualifier, $schema, $table_name, $scope) {} +function db2_special_columns($connection, ?string $qualifier, string $schema, string $table_name, int $scope) {} function db2_specialcolumns() {} @@ -863,11 +864,11 @@ function db2_specialcolumns() {} * @param resource $connection

    * A valid connection to an IBM DB2, Cloudscape, or Apache Derby database. *

    - * @param string $qualifier

    + * @param string|null $qualifier

    * A qualifier for DB2 databases running on OS/390 or z/OS servers. For * other databases, pass null or an empty string. *

    - * @param string $schema

    + * @param string|null $schema

    * The schema that contains the targeted table. If this parameter is * null, the statistics and indexes are returned for the schema of the * current user. @@ -876,8 +877,7 @@ function db2_specialcolumns() {} * The name of the table. *

    * @param bool $unique

    - * An integer value representing the type of index information to return. - * 0 + * Whether to return the only the unique indexes or all the indexes in the table. *

    *

    * Return only the information for unique indexes on the table. @@ -908,18 +908,18 @@ function db2_specialcolumns() {} * * *

    - * An integer value representing whether the index prohibits unique + * An boolean value representing whether the index prohibits unique * values, or whether the row represents statistics on the table itself:

    * * * * * - * + * * * * - * + * * * * @@ -1024,7 +1024,7 @@ function db2_specialcolumns() {} * *
    Return valueParameter type
    0 (SQL_FALSE)false (SQL_FALSE)The index allows duplicate values.
    1 (SQL_TRUE)true (SQL_TRUE)The index values must be unique.
    */ -function db2_statistics($connection, $qualifier, $schema, $table_name, $unique) {} +function db2_statistics($connection, ?string $qualifier, ?string $schema, string $table_name, bool $unique) {} /** * Returns a result set listing the tables and associated privileges in a database @@ -1032,16 +1032,16 @@ function db2_statistics($connection, $qualifier, $schema, $table_name, $unique) * @param resource $connection

    * A valid connection to an IBM DB2, Cloudscape, or Apache Derby database. *

    - * @param string $qualifier

    + * @param string|null $qualifier

    * A qualifier for DB2 databases running on OS/390 or z/OS servers. For * other databases, pass null or an empty string. *

    - * @param string $schema

    + * @param string|null $schema

    * The schema which contains the tables. This parameter accepts a * search pattern containing _ and % * as wildcards. *

    - * @param string $table_name

    + * @param string|null $table_name

    * The name of the table. This parameter accepts a search pattern * containing _ and % as wildcards. *

    @@ -1089,7 +1089,7 @@ function db2_statistics($connection, $qualifier, $schema, $table_name, $unique) * * */ -function db2_table_privileges($connection, $qualifier = null, $schema = null, $table_name = null) {} +function db2_table_privileges($connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null) {} function db2_tableprivileges() {} @@ -1099,17 +1099,17 @@ function db2_tableprivileges() {} * @param resource $connection

    * A valid connection to an IBM DB2, Cloudscape, or Apache Derby database. *

    - * @param string $qualifier

    + * @param string|null $qualifier

    * A qualifier for DB2 databases running on OS/390 or z/OS servers. For * other databases, pass null or an empty string. *

    - * @param string $schema

    + * @param string|null $schema

    * The schema which contains the tables. This parameter accepts a * search pattern containing _ and % * as wildcards. *

    - * @param string $table_name - * @param string $table_type + * @param string|null $table_name + * @param string|null $table_type * @return resource|false A statement resource with a result set containing rows describing * the tables that match the specified parameters. The rows are composed of * the following columns: @@ -1139,7 +1139,7 @@ function db2_tableprivileges() {} * Description of the table. * */ -function db2_tables($connection, $qualifier = null, $schema = null, $table_name = null, $table_type = null) {} +function db2_tables($connection, ?string $qualifier = null, ?string $schema = null, ?string $table_name = null, ?string $table_type = null) {} /** * Executes an SQL statement directly @@ -1173,7 +1173,7 @@ function db2_tables($connection, $qualifier = null, $schema = null, $table_name * @return resource|false A statement resource if the SQL statement was issued successfully, * or false if the database failed to execute the SQL statement. */ -function db2_exec($connection, $statement, array $options = null) {} +function db2_exec($connection, string $statement, array $options = []) {} /** * Prepares an SQL statement to be executed @@ -1209,7 +1209,7 @@ function db2_exec($connection, $statement, array $options = null) {} * returned an error. You can determine which error was returned by calling * db2_stmt_error or db2_stmt_errormsg. */ -function db2_prepare($connection, $statement, array $options = null) {} +function db2_prepare($connection, string $statement, array $options = []) {} /** * Executes a prepared SQL statement @@ -1223,13 +1223,13 @@ function db2_prepare($connection, $statement, array $options = null) {} *

    * @return bool true on success or false on failure. */ -function db2_execute($stmt, array $parameters = null) {} +function db2_execute($stmt, array $parameters = []): bool {} /** * Returns a string containing the last SQL statement error message * @link https://php.net/manual/en/function.db2-stmt-errormsg.php - * @param resource $stmt

    - * A valid statement resource. + * @param resource|null $stmt

    + * A valid statement resource or NULL. *

    * @return string a string containing the error message and SQLCODE value for the * last error that occurred issuing an SQL statement. @@ -1239,7 +1239,7 @@ function db2_stmt_errormsg($stmt = null) {} /** * Returns the last connection error message and SQLCODE value * @link https://php.net/manual/en/function.db2-conn-errormsg.php - * @param resource $connection

    + * @param resource|null $connection

    * A connection resource associated with a connection that initially * succeeded, but which over time became invalid. *

    @@ -1253,7 +1253,7 @@ function db2_conn_errormsg($connection = null) {} /** * Returns a string containing the SQLSTATE returned by the last connection attempt * @link https://php.net/manual/en/function.db2-conn-error.php - * @param resource $connection

    + * @param resource|null $connection

    * A connection resource associated with a connection that initially * succeeded, but which over time became invalid. *

    @@ -1266,8 +1266,8 @@ function db2_conn_error($connection = null) {} /** * Returns a string containing the SQLSTATE returned by an SQL statement * @link https://php.net/manual/en/function.db2-stmt-error.php - * @param resource $stmt

    - * A valid statement resource. + * @param resource|null $stmt

    + * A valid statement resource or NULL. *

    * @return string a string containing an SQLSTATE value. */ @@ -1296,7 +1296,7 @@ function db2_next_result($stmt) {} * set associated with the specified statement resource. Returns false if * the statement resource is not a valid input value. */ -function db2_num_fields($stmt) {} +function db2_num_fields($stmt): int|false {} /** * Returns the number of rows affected by an SQL statement @@ -1304,10 +1304,10 @@ function db2_num_fields($stmt) {} * @param resource $stmt

    * A valid stmt resource containing a result set. *

    - * @return int the number of rows affected by the last SQL statement issued by - * the specified statement handle. + * @return int|false the number of rows affected by the last SQL statement issued by + * the specified statement handle, or false in case of failure. */ -function db2_num_rows($stmt) {} +function db2_num_rows($stmt): int|false {} /** * Returns the name of the column in the result set @@ -1315,7 +1315,7 @@ function db2_num_rows($stmt) {} * @param resource $stmt

    * Specifies a statement resource containing a result set. *

    - * @param mixed $column

    + * @param int|string $column

    * Specifies the column in the result set. This can either be an integer * representing the 0-indexed position of the column, or a string * containing the name of the column. @@ -1324,7 +1324,7 @@ function db2_num_rows($stmt) {} * specified column does not exist in the result * set, db2_field_name returns false. */ -function db2_field_name($stmt, $column) {} +function db2_field_name($stmt, int|string $column): string|false {} /** * Returns the maximum number of bytes required to display a column @@ -1332,7 +1332,7 @@ function db2_field_name($stmt, $column) {} * @param resource $stmt

    * Specifies a statement resource containing a result set. *

    - * @param mixed $column

    + * @param int|string $column

    * Specifies the column in the result set. This can either be an integer * representing the 0-indexed position of the column, or a string * containing the name of the column. @@ -1341,7 +1341,7 @@ function db2_field_name($stmt, $column) {} * display the specified column. If the column does not exist in the result * set, db2_field_display_size returns false. */ -function db2_field_display_size($stmt, $column) {} +function db2_field_display_size($stmt, int|string $column): int|false {} /** * Returns the position of the named column in a result set @@ -1349,7 +1349,7 @@ function db2_field_display_size($stmt, $column) {} * @param resource $stmt

    * Specifies a statement resource containing a result set. *

    - * @param mixed $column

    + * @param int|string $column

    * Specifies the column in the result set. This can either be an integer * representing the 0-indexed position of the column, or a string * containing the name of the column. @@ -1358,7 +1358,7 @@ function db2_field_display_size($stmt, $column) {} * the result set. If the specified column does not exist in the result set, * db2_field_num returns false. */ -function db2_field_num($stmt, $column) {} +function db2_field_num($stmt, int|string $column): int|false {} /** * Returns the precision of the indicated column in a result set @@ -1366,7 +1366,7 @@ function db2_field_num($stmt, $column) {} * @param resource $stmt

    * Specifies a statement resource containing a result set. *

    - * @param mixed $column

    + * @param int|string $column

    * Specifies the column in the result set. This can either be an integer * representing the 0-indexed position of the column, or a string * containing the name of the column. @@ -1375,7 +1375,7 @@ function db2_field_num($stmt, $column) {} * specified column does not exist in the result set, * db2_field_precision returns false. */ -function db2_field_precision($stmt, $column) {} +function db2_field_precision($stmt, int|string $column): int|false {} /** * Returns the scale of the indicated column in a result set @@ -1383,7 +1383,7 @@ function db2_field_precision($stmt, $column) {} * @param resource $stmt

    * Specifies a statement resource containing a result set. *

    - * @param mixed $column

    + * @param int|string $column

    * Specifies the column in the result set. This can either be an integer * representing the 0-indexed position of the column, or a string * containing the name of the column. @@ -1392,7 +1392,7 @@ function db2_field_precision($stmt, $column) {} * specified column does not exist in the result set, * db2_field_scale returns false. */ -function db2_field_scale($stmt, $column) {} +function db2_field_scale($stmt, int|string $column): int|false {} /** * Returns the data type of the indicated column in a result set @@ -1400,7 +1400,7 @@ function db2_field_scale($stmt, $column) {} * @param resource $stmt

    * Specifies a statement resource containing a result set. *

    - * @param mixed $column

    + * @param int|string $column

    * Specifies the column in the result set. This can either be an integer * representing the 0-indexed position of the column, or a string * containing the name of the column. @@ -1409,7 +1409,7 @@ function db2_field_scale($stmt, $column) {} * If the specified column does not exist in the result set, * db2_field_type returns false. */ -function db2_field_type($stmt, $column) {} +function db2_field_type($stmt, int|string $column): string|false {} /** * Returns the width of the current value of the indicated column in a result set @@ -1417,7 +1417,7 @@ function db2_field_type($stmt, $column) {} * @param resource $stmt

    * Specifies a statement resource containing a result set. *

    - * @param mixed $column

    + * @param int|string $column

    * Specifies the column in the result set. This can either be an integer * representing the 0-indexed position of the column, or a string * containing the name of the column. @@ -1427,7 +1427,7 @@ function db2_field_type($stmt, $column) {} * exist in the result set, db2_field_width returns * false. */ -function db2_field_width($stmt, $column) {} +function db2_field_width($stmt, int|string $column): int|false {} /** * Returns the cursor type used by a statement resource @@ -1439,7 +1439,7 @@ function db2_field_width($stmt, $column) {} * resource uses a forward-only cursor or DB2_SCROLLABLE if * the statement resource uses a scrollable cursor. */ -function db2_cursor_type($stmt) {} +function db2_cursor_type($stmt): int {} /** * Rolls back a transaction @@ -1450,7 +1450,7 @@ function db2_cursor_type($stmt) {} *

    * @return bool true on success or false on failure. */ -function db2_rollback($connection) {} +function db2_rollback($connection): bool {} /** * Frees resources associated with the indicated statement resource @@ -1460,7 +1460,7 @@ function db2_rollback($connection) {} *

    * @return bool true on success or false on failure. */ -function db2_free_stmt($stmt) {} +function db2_free_stmt($stmt): bool {} /** * Returns a single column from a row in the result set @@ -1468,14 +1468,14 @@ function db2_free_stmt($stmt) {} * @param resource $stmt

    * A valid stmt resource. *

    - * @param mixed $column

    + * @param int|string $column

    * Either an integer mapping to the 0-indexed field in the result set, or * a string matching the name of the column. *

    * @return mixed the value of the requested field if the field exists in the result * set. Returns NULL if the field does not exist, and issues a warning. */ -function db2_result($stmt, $column) {} +function db2_result($stmt, int|string $column): mixed {} /** * Sets the result set pointer to the next row or requested row @@ -1490,7 +1490,7 @@ function db2_result($stmt, $column) {} * @return bool true if the requested row exists in the result set. Returns * false if the requested row does not exist in the result set. */ -function db2_fetch_row($stmt, $row_number = null) {} +function db2_fetch_row($stmt, int $row_number = null) {} /** * Returns an array, indexed by column name, representing a row in a result set @@ -1508,7 +1508,7 @@ function db2_fetch_row($stmt, $row_number = null) {} * there are no rows left in the result set, or if the row requested by * row_number does not exist in the result set. */ -function db2_fetch_assoc($stmt, $row_number = null) {} +function db2_fetch_assoc($stmt, int $row_number = null): array|false {} /** * Returns an array, indexed by column position, representing a row in a result set @@ -1526,7 +1526,7 @@ function db2_fetch_assoc($stmt, $row_number = null) {} * there are no rows left in the result set, or if the row requested by * row_number does not exist in the result set. */ -function db2_fetch_array($stmt, $row_number = null) {} +function db2_fetch_array($stmt, int $row_number = null): array|false {} /** * Returns an array, indexed by both column name and position, representing a row in a result set @@ -1545,7 +1545,7 @@ function db2_fetch_array($stmt, $row_number = null) {} * in the result set, or if the row requested by * row_number does not exist in the result set. */ -function db2_fetch_both($stmt, $row_number = null) {} +function db2_fetch_both($stmt, int $row_number = null): array|false {} /** * Frees resources associated with a result set @@ -1555,7 +1555,7 @@ function db2_fetch_both($stmt, $row_number = null) {} *

    * @return bool true on success or false on failure. */ -function db2_free_result($stmt) {} +function db2_free_result($stmt): bool {} /** * Set options for connection or statement resources @@ -1596,9 +1596,9 @@ function db2_free_result($stmt) {} *

    * @return bool true on success or false on failure. */ -function db2_set_option($resource, array $options, $type) {} +function db2_set_option($resource, array $options, int $type): bool {} -function db2_setoption() {} +function db2_setoption(): bool {} /** * Returns an object with properties representing columns in the fetched row @@ -1611,7 +1611,7 @@ function db2_setoption() {} * parameter results in a PHP warning if the result set uses a * forward-only cursor. *

    - * @return object|false An object representing a single row in the result set. The + * @return stdClass|false An object representing a single row in the result set. The * properties of the object map to the names of the columns in the result set. *

    *

    @@ -1628,7 +1628,7 @@ function db2_setoption() {} *

    * Returns false if no row was retrieved. */ -function db2_fetch_object($stmt, $row_number = null) {} +function db2_fetch_object($stmt, int $row_number = null): stdClass|false {} /** * Returns an object with properties that describe the DB2 database server @@ -1636,9 +1636,9 @@ function db2_fetch_object($stmt, $row_number = null) {} * @param resource $connection

    * Specifies an active DB2 client connection. *

    - * @return object|false An object on a successful call. Returns false on failure. + * @return stdClass|false An object on a successful call. Returns false on failure. */ -function db2_server_info($connection) {} +function db2_server_info($connection): stdClass|false {} /** * Returns an object with properties that describe the DB2 database client @@ -1646,9 +1646,9 @@ function db2_server_info($connection) {} * @param resource $connection

    * Specifies an active DB2 client connection. *

    - * @return object|false An object on a successful call. Returns false on failure. + * @return stdClass|false An object on a successful call. Returns false on failure. */ -function db2_client_info($connection) {} +function db2_client_info($connection): stdClass|false {} /** * Used to escape certain characters @@ -1662,7 +1662,7 @@ function db2_client_info($connection) {} * @return string string_literal with the special characters * noted above prepended with backslashes. */ -function db2_escape_string($string_literal) {} +function db2_escape_string(string $string_literal): string {} /** * Gets a user defined size of LOB files with each invocation @@ -1679,7 +1679,7 @@ function db2_escape_string($string_literal) {} * @return string|false The amount of data the user specifies. Returns * false if the data cannot be retrieved. */ -function db2_lob_read($stmt, $colnum, $length) {} +function db2_lob_read($stmt, int $colnum, int $length): string|false {} /** * Retrieves an option value for a statement resource or a connection resource @@ -1720,7 +1720,7 @@ function db2_lob_read($stmt, $colnum, $length) {} * @return string|false The current setting of the connection attribute provided on success * or false on failure. */ -function db2_get_option($resource, $option) {} +function db2_get_option($resource, string $option): string|false {} /** * Returns the auto generated ID of the last insert query that successfully executed on this connection. @@ -1736,7 +1736,7 @@ function db2_get_option($resource, $option) {} * @return string|null Returns the auto generated ID of last insert query that successfully executed on this connection * or NULL if no ID was found. */ -function db2_last_insert_id($resource) {} +function db2_last_insert_id($resource): ?string {} /** * Specifies that binary data shall be returned as is. This is the default diff --git a/imagick/imagick.php b/imagick/imagick.php index b010fa4e0..4c0d5a699 100644 --- a/imagick/imagick.php +++ b/imagick/imagick.php @@ -7278,9 +7278,9 @@ public function addUnityKernel() {} * Create a kernel from a builtin in kernel. See https://www.imagemagick.org/Usage/morphology/#kernel for examples.
    * Currently the 'rotation' symbols are not supported. Example: $diamondKernel = ImagickKernel::fromBuiltIn(\Imagick::KERNEL_DIAMOND, "2"); * @link https://php.net/manual/en/imagickkernel.frombuiltin.php - * @param string $kernelType The type of kernel to build e.g. \Imagick::KERNEL_DIAMOND + * @param int $kernelType The type of kernel to build e.g. \Imagick::KERNEL_DIAMOND * @param string $kernelString A string that describes the parameters e.g. "4,2.5" - * @return void + * @return ImagickKernel * @since 3.3.0 */ public static function fromBuiltin($kernelType, $kernelString) {} diff --git a/imap/imap.php b/imap/imap.php index 86e74f986..7f92a91a3 100644 --- a/imap/imap.php +++ b/imap/imap.php @@ -1566,6 +1566,11 @@ function imap_mutf7_to_utf8(string $string): string|false {} */ function imap_utf8_to_mutf7(string $string): string|false {} +/** + * @since 8.2 + */ +function imap_is_open(IMAP\Connection $imap): bool {} + /** * @deprecated 8.1 */ diff --git a/interbase/interbase.php b/interbase/interbase.php index b4a609588..3dedfd831 100644 --- a/interbase/interbase.php +++ b/interbase/interbase.php @@ -41,7 +41,6 @@ * @param int $sync [optional]

    *

    * @return resource|false an InterBase link identifier on success, or false on error. - * @removed 7.4 */ function ibase_connect($database = null, $username = null, $password = null, $charset = null, $buffers = null, $dialect = null, $role = null, $sync = null) {} @@ -84,7 +83,6 @@ function ibase_connect($database = null, $username = null, $password = null, $ch * @param int $sync [optional]

    *

    * @return resource|false an InterBase link identifier on success, or false on error. - * @removed 7.4 */ function ibase_pconnect($database = null, $username = null, $password = null, $charset = null, $buffers = null, $dialect = null, $role = null, $sync = null) {} @@ -97,7 +95,6 @@ function ibase_pconnect($database = null, $username = null, $password = null, $c * is assumed. *

    * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_close($connection_id = null) {} @@ -109,7 +106,6 @@ function ibase_close($connection_id = null) {} * assumed. *

    * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_drop_db($connection = null) {} @@ -135,7 +131,6 @@ function ibase_drop_db($connection = null) {} * affected by the query for INSERT, UPDATE and DELETE statements. In order * to retain backward compatibility, it will return true for these * statements if the query succeeded without affecting any rows. - * @removed 7.4 */ function ibase_query($link_identifier = null, $query, $bind_args = null) {} @@ -156,7 +151,6 @@ function ibase_query($link_identifier = null, $query, $bind_args = null) {} * @return array|false an array that corresponds to the fetched row, or false if there * are no more rows. Each result column is stored in an array offset, * starting at offset 0. - * @removed 7.4 */ function ibase_fetch_row($result_identifier, $fetch_flag = null) {} @@ -177,7 +171,6 @@ function ibase_fetch_row($result_identifier, $fetch_flag = null) {} * @return array|false an associative array that corresponds to the fetched row. * Subsequent calls will return the next row in the result set, or false if * there are no more rows. - * @removed 7.4 */ function ibase_fetch_assoc($result, $fetch_flag = null) {} @@ -198,7 +191,6 @@ function ibase_fetch_assoc($result, $fetch_flag = null) {} *

    * @return object|false an object with the next row information, or false if there are * no more rows. - * @removed 7.4 */ function ibase_fetch_object($result_id, $fetch_flag = null) {} @@ -210,7 +202,6 @@ function ibase_fetch_object($result_id, $fetch_flag = null) {} * ibase_execute. *

    * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_free_result($result_identifier) {} @@ -224,7 +215,6 @@ function ibase_free_result($result_identifier) {} * The name to be assigned. *

    * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_name_result($result, $name) {} @@ -235,7 +225,6 @@ function ibase_name_result($result, $name) {} * An InterBase query. *

    * @return resource|false a prepared query handle, or false on error. - * @removed 7.4 */ function ibase_prepare($query) {} @@ -257,7 +246,6 @@ function ibase_prepare($query) {} * the query (if > 0 and applicable to the statement type). A query that * succeeded, but did not affect any rows (e.g. an UPDATE of a non-existent * record) will return true. - * @removed 7.4 */ function ibase_execute($query, ...$bind_arg) {} @@ -268,7 +256,6 @@ function ibase_execute($query, ...$bind_arg) {} * A query prepared with ibase_prepare. *

    * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_free_query($query) {} @@ -279,7 +266,6 @@ function ibase_free_query($query) {} * @param int $increment [optional] * @param resource $link_identifier [optional] * @return mixed new generator value as integer, or as string if the value is too big. - * @removed 7.4 */ function ibase_gen_id($generator, $increment = null, $link_identifier = null) {} @@ -290,7 +276,6 @@ function ibase_gen_id($generator, $increment = null, $link_identifier = null) {} * An InterBase result identifier. *

    * @return int the number of fields as an integer. - * @removed 7.4 */ function ibase_num_fields($result_id) {} @@ -301,7 +286,6 @@ function ibase_num_fields($result_id) {} * The prepared query handle. *

    * @return int the number of parameters as an integer. - * @removed 7.4 */ function ibase_num_params($query) {} @@ -313,7 +297,6 @@ function ibase_num_params($query) {} * connection resource, its default transaction is used. *

    * @return int the number of rows as an integer. - * @removed 7.4 */ function ibase_affected_rows($link_identifier = null) {} @@ -329,7 +312,6 @@ function ibase_affected_rows($link_identifier = null) {} * @return array an array with the following keys: name, * alias, relation, * length and type. - * @removed 7.4 */ function ibase_field_info($result, $field_number) {} @@ -345,7 +327,6 @@ function ibase_field_info($result, $field_number) {} * @return array an array with the following keys: name, * alias, relation, * length and type. - * @removed 7.4 */ function ibase_param_info($query, $param_number) {} @@ -369,7 +350,6 @@ function ibase_param_info($query, $param_number) {} * assumed. *

    * @return resource|false a transaction handle, or false on error. - * @removed 7.4 */ function ibase_trans($trans_args = null, $link_identifier = null) {} @@ -384,7 +364,6 @@ function ibase_trans($trans_args = null, $link_identifier = null) {} * corresponding transaction will be committed. *

    * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_commit($link_or_trans_identifier = null) {} @@ -399,7 +378,6 @@ function ibase_commit($link_or_trans_identifier = null) {} * corresponding transaction will be rolled back. *

    * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_rollback($link_or_trans_identifier = null) {} @@ -416,7 +394,6 @@ function ibase_rollback($link_or_trans_identifier = null) {} * will not be invalidated. *

    * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_commit_ret($link_or_trans_identifier = null) {} @@ -433,7 +410,6 @@ function ibase_commit_ret($link_or_trans_identifier = null) {} * will not be invalidated. *

    * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_rollback_ret($link_or_trans_identifier = null) {} @@ -450,7 +426,6 @@ function ibase_rollback_ret($link_or_trans_identifier = null) {} * @return array an array containing information about a BLOB. The information returned * consists of the length of the BLOB, the number of segments it contains, the size * of the largest segment, and whether it is a stream BLOB or a segmented BLOB. - * @removed 7.4 */ function ibase_blob_info($link_identifier, $blob_id) {} @@ -463,7 +438,6 @@ function ibase_blob_info($link_identifier, $blob_id) {} *

    * @return resource|false a BLOB handle for later use with * ibase_blob_add or false on failure. - * @removed 7.4 */ function ibase_blob_create($link_identifier = null) {} @@ -477,7 +451,6 @@ function ibase_blob_create($link_identifier = null) {} * The data to be added. *

    * @return void - * @removed 7.4 */ function ibase_blob_add($blob_handle, $data) {} @@ -488,7 +461,6 @@ function ibase_blob_add($blob_handle, $data) {} * A BLOB handle opened with ibase_blob_create. *

    * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_blob_cancel($blob_handle) {} @@ -503,7 +475,6 @@ function ibase_blob_cancel($blob_handle) {} * the BLOB was being written to, this function returns a string containing * the BLOB id that has been assigned to it by the database. On failure, this * function returns false. - * @removed 7.4 */ function ibase_blob_close($blob_handle) {} @@ -519,7 +490,6 @@ function ibase_blob_close($blob_handle) {} *

    * @return resource|false a BLOB handle for later use with * ibase_blob_get or false on failure. - * @removed 7.4 */ function ibase_blob_open($link_identifier, $blob_id) {} @@ -534,7 +504,6 @@ function ibase_blob_open($link_identifier, $blob_id) {} *

    * @return string|false at most len bytes from the BLOB, or false * on failure. - * @removed 7.4 */ function ibase_blob_get($blob_handle, $len) {} @@ -544,7 +513,6 @@ function ibase_blob_get($blob_handle, $len) {} * @param string $blob_id

    *

    * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_blob_echo($blob_id) {} @@ -559,7 +527,6 @@ function ibase_blob_echo($blob_id) {} * The file handle is a handle returned by fopen. *

    * @return string|false the BLOB id on success, or false on error. - * @removed 7.4 */ function ibase_blob_import($link_identifier, $file_handle) {} @@ -567,7 +534,6 @@ function ibase_blob_import($link_identifier, $file_handle) {} * Return error messages * @link https://php.net/manual/en/function.ibase-errmsg.php * @return string|false the error message as a string, or false if no error occurred. - * @removed 7.4 */ function ibase_errmsg() {} @@ -575,7 +541,6 @@ function ibase_errmsg() {} * Return an error code * @link https://php.net/manual/en/function.ibase-errcode.php * @return int|false the error code as an integer, or false if no error occurred. - * @removed 7.4 */ function ibase_errcode() {} @@ -589,7 +554,6 @@ function ibase_errcode() {} * @param string $middle_name [optional] * @param string $last_name [optional] * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_add_user($service_handle, $user_name, $password, $first_name = null, $middle_name = null, $last_name = null) {} @@ -603,7 +567,6 @@ function ibase_add_user($service_handle, $user_name, $password, $first_name = nu * @param string $middle_name [optional] * @param string $last_name [optional] * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_modify_user($service_handle, $user_name, $password, $first_name = null, $middle_name = null, $last_name = null) {} @@ -613,7 +576,6 @@ function ibase_modify_user($service_handle, $user_name, $password, $first_name = * @param resource $service_handle * @param string $user_name * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_delete_user($service_handle, $user_name) {} @@ -624,7 +586,6 @@ function ibase_delete_user($service_handle, $user_name) {} * @param string $dba_username * @param string $dba_password * @return resource|false - * @removed 7.4 */ function ibase_service_attach($host, $dba_username, $dba_password) {} @@ -633,7 +594,6 @@ function ibase_service_attach($host, $dba_username, $dba_password) {} * @link https://php.net/manual/en/function.ibase-service-detach.php * @param resource $service_handle * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_service_detach($service_handle) {} @@ -646,7 +606,6 @@ function ibase_service_detach($service_handle) {} * @param int $options [optional] * @param bool $verbose [optional] * @return mixed - * @removed 7.4 */ function ibase_backup($service_handle, $source_db, $dest_file, $options = null, $verbose = null) {} @@ -659,7 +618,6 @@ function ibase_backup($service_handle, $source_db, $dest_file, $options = null, * @param int $options [optional] * @param bool $verbose [optional] * @return mixed - * @removed 7.4 */ function ibase_restore($service_handle, $source_file, $dest_db, $options = null, $verbose = null) {} @@ -671,7 +629,6 @@ function ibase_restore($service_handle, $source_file, $dest_db, $options = null, * @param int $action * @param int $argument [optional] * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_maintain_db($service_handle, $db, $action, $argument = null) {} @@ -683,7 +640,6 @@ function ibase_maintain_db($service_handle, $db, $action, $argument = null) {} * @param int $action * @param int $argument [optional] * @return string - * @removed 7.4 */ function ibase_db_info($service_handle, $db, $action, $argument = null) {} @@ -693,7 +649,6 @@ function ibase_db_info($service_handle, $db, $action, $argument = null) {} * @param resource $service_handle * @param int $action * @return string - * @removed 7.4 */ function ibase_server_info($service_handle, $action) {} @@ -707,7 +662,6 @@ function ibase_server_info($service_handle, $action) {} *

    * @param string ...$_ [optional] * @return string the name of the event that was posted. - * @removed 7.4 */ function ibase_wait_event($event_name1, $event_name2 = null, ...$_) {} @@ -733,7 +687,6 @@ function ibase_wait_event($event_name1, $event_name2 = null, ...$_) {} * @param string ...$_ [optional] * @return resource The return value is an event resource. This resource can be used to free * the event handler using ibase_free_event_handler. - * @removed 7.4 */ function ibase_set_event_handler($event_handler, $event_name1, $event_name2 = null, ...$_) {} @@ -745,7 +698,6 @@ function ibase_set_event_handler($event_handler, $event_name1, $event_name2 = nu * ibase_set_event_handler. *

    * @return bool true on success or false on failure. - * @removed 7.4 */ function ibase_free_event_handler($event) {} @@ -1499,7 +1451,6 @@ function fbird_free_event_handler($event) {} * The default transaction settings are to be used. * This default is determined by the client library, which defines it as IBASE_WRITE|IBASE_CONCURRENCY|IBASE_WAIT in most cases. * @link https://www.php.net/manual/en/ibase.constants.php - * @removed 7.4 */ define('IBASE_DEFAULT', 0); /** @@ -1515,33 +1466,28 @@ function fbird_free_event_handler($event) {} * Also available as IBASE_TEXT for backward compatibility. * Causes BLOB contents to be fetched inline, instead of being fetched as BLOB identifiers. * @link https://www.php.net/manual/en/ibase.constants.php - * @removed 7.4 */ define('IBASE_FETCH_BLOBS', 1); /** * Causes arrays to be fetched inline. Otherwise, array identifiers are returned. * Array identifiers can only be used as arguments to INSERT operations, as no functions to handle array identifiers are currently available. * @link https://www.php.net/manual/en/ibase.constants.php - * @removed 7.4 */ define('IBASE_FETCH_ARRAYS', 2); /** * Causes date and time fields not to be returned as strings, but as UNIX timestamps (the number of seconds since the epoch, which is 1-Jan-1970 0:00 UTC). * Might be problematic if used with dates before 1970 on some systems. * @link https://www.php.net/manual/en/ibase.constants.php - * @removed 7.4 */ define('IBASE_UNIXTIME', 4); /** * Starts a read-write transaction. * @link https://www.php.net/manual/en/ibase.constants.php - * @removed 7.4 */ define('IBASE_WRITE', 1); /** * Starts a read-only transaction. * @link https://www.php.net/manual/en/ibase.constants.php - * @removed 7.4 */ define('IBASE_READ', 2); /** @@ -1551,14 +1497,12 @@ function fbird_free_event_handler($event) {} * If IBASE_REC_NO_VERSION was specified, only the latest version of a row can be read. * If IBASE_REC_VERSION was specified, a row can even be read when a modification to it is pending in a concurrent transaction. * @link https://www.php.net/manual/en/ibase.constants.php - * @removed 7.4 */ define('IBASE_COMMITTED', 8); /** * Starts a transaction with the isolation level set to 'consistency', * which means the transaction cannot read from tables that are being modified by other concurrent transactions. * @link https://www.php.net/manual/en/ibase.constants.php - * @removed 7.4 */ define('IBASE_CONSISTENCY', 16); /** @@ -1566,7 +1510,6 @@ function fbird_free_event_handler($event) {} * which means the transaction has access to all tables, * but cannot see changes that were committed by other transactions after the transaction was started. * @link https://www.php.net/manual/en/ibase.constants.php - * @removed 7.4 */ define('IBASE_CONCURRENCY', 4); /** @@ -1582,232 +1525,87 @@ function fbird_free_event_handler($event) {} /** * Indicated that a transaction should fail immediately when a conflict occurs. * @link https://www.php.net/manual/en/ibase.constants.php - * @removed 7.4 */ define('IBASE_NOWAIT', 256); /** * Indicated that a transaction should wait and retry when a conflict occurs. * @link https://www.php.net/manual/en/ibase.constants.php - * @removed 7.4 */ define('IBASE_WAIT', 128); -/** - * @removed 7.4 - */ define('IBASE_BKP_IGNORE_CHECKSUMS', 1); -/** - * @removed 7.4 - */ define('IBASE_BKP_IGNORE_LIMBO', 2); -/** - * @removed 7.4 - */ define('IBASE_BKP_METADATA_ONLY', 4); -/** - * @removed 7.4 - */ define('IBASE_BKP_NO_GARBAGE_COLLECT', 8); -/** - * @removed 7.4 - */ define('IBASE_BKP_OLD_DESCRIPTIONS', 16); -/** - * @removed 7.4 - */ define('IBASE_BKP_NON_TRANSPORTABLE', 32); /** * Options to ibase_backup * @link https://php.net/manual/en/ibase.constants.php - * @removed 7.4 */ define('IBASE_BKP_CONVERT', 64); -/** - * @removed 7.4 - */ define('IBASE_RES_DEACTIVATE_IDX', 256); -/** - * @removed 7.4 - */ define('IBASE_RES_NO_SHADOW', 512); -/** - * @removed 7.4 - */ define('IBASE_RES_NO_VALIDITY', 1024); -/** - * @removed 7.4 - */ define('IBASE_RES_ONE_AT_A_TIME', 2048); -/** - * @removed 7.4 - */ define('IBASE_RES_REPLACE', 4096); -/** - * @removed 7.4 - */ define('IBASE_RES_CREATE', 8192); /** * Options to ibase_restore * @link https://php.net/manual/en/ibase.constants.php - * @removed 7.4 */ define('IBASE_RES_USE_ALL_SPACE', 16384); -/** - * @removed 7.4 - */ define('IBASE_PRP_PAGE_BUFFERS', 5); -/** - * @removed 7.4 - */ define('IBASE_PRP_SWEEP_INTERVAL', 6); -/** - * @removed 7.4 - */ define('IBASE_PRP_SHUTDOWN_DB', 7); -/** - * @removed 7.4 - */ define('IBASE_PRP_DENY_NEW_TRANSACTIONS', 10); -/** - * @removed 7.4 - */ define('IBASE_PRP_DENY_NEW_ATTACHMENTS', 9); -/** - * @removed 7.4 - */ define('IBASE_PRP_RESERVE_SPACE', 11); -/** - * @removed 7.4 - */ define('IBASE_PRP_RES_USE_FULL', 35); -/** - * @removed 7.4 - */ define('IBASE_PRP_RES', 36); -/** - * @removed 7.4 - */ define('IBASE_PRP_WRITE_MODE', 12); -/** - * @removed 7.4 - */ define('IBASE_PRP_WM_ASYNC', 37); -/** - * @removed 7.4 - */ define('IBASE_PRP_WM_SYNC', 38); -/** - * @removed 7.4 - */ define('IBASE_PRP_ACCESS_MODE', 13); -/** - * @removed 7.4 - */ define('IBASE_PRP_AM_READONLY', 39); -/** - * @removed 7.4 - */ define('IBASE_PRP_AM_READWRITE', 40); -/** - * @removed 7.4 - */ define('IBASE_PRP_SET_SQL_DIALECT', 14); -/** - * @removed 7.4 - */ define('IBASE_PRP_ACTIVATE', 256); -/** - * @removed 7.4 - */ define('IBASE_PRP_DB_ONLINE', 512); -/** - * @removed 7.4 - */ define('IBASE_RPR_CHECK_DB', 16); -/** - * @removed 7.4 - */ define('IBASE_RPR_IGNORE_CHECKSUM', 32); -/** - * @removed 7.4 - */ define('IBASE_RPR_KILL_SHADOWS', 64); -/** - * @removed 7.4 - */ define('IBASE_RPR_MEND_DB', 4); -/** - * @removed 7.4 - */ define('IBASE_RPR_VALIDATE_DB', 1); -/** - * @removed 7.4 - */ define('IBASE_RPR_FULL', 128); /** * Options to ibase_maintain_db * @link https://php.net/manual/en/ibase.constants.php - * @removed 7.4 */ define('IBASE_RPR_SWEEP_DB', 2); -/** - * @removed 7.4 - */ define('IBASE_STS_DATA_PAGES', 1); -/** - * @removed 7.4 - */ define('IBASE_STS_DB_LOG', 2); -/** - * @removed 7.4 - */ define('IBASE_STS_HDR_PAGES', 4); -/** - * @removed 7.4 - */ define('IBASE_STS_IDX_PAGES', 8); /** * Options to ibase_db_info * @link https://php.net/manual/en/ibase.constants.php - * @removed 7.4 */ define('IBASE_STS_SYS_RELATIONS', 16); -/** - * @removed 7.4 - */ define('IBASE_SVC_SERVER_VERSION', 55); -/** - * @removed 7.4 - */ define('IBASE_SVC_IMPLEMENTATION', 56); -/** - * @removed 7.4 - */ define('IBASE_SVC_GET_ENV', 59); -/** - * @removed 7.4 - */ define('IBASE_SVC_GET_ENV_LOCK', 60); -/** - * @removed 7.4 - */ define('IBASE_SVC_GET_ENV_MSG', 61); -/** - * @removed 7.4 - */ define('IBASE_SVC_USER_DBPATH', 58); -/** - * @removed 7.4 - */ define('IBASE_SVC_SVR_DB_INFO', 50); /** * Options to ibase_server_info * @link https://php.net/manual/en/ibase.constants.php - * @removed 7.4 */ define('IBASE_SVC_GET_USERS', 68); diff --git a/intl/intl.php b/intl/intl.php index 718e6f8a2..587a55a84 100644 --- a/intl/intl.php +++ b/intl/intl.php @@ -1176,7 +1176,7 @@ public function getPattern(): string|false {} * Locale::ACTUAL_LOCALE, * respectively). The default is the actual locale. *

    - * @return string The locale name used to create the formatter. + * @return string|false The locale name used to create the formatter. */ #[Pure] #[TentativeType] @@ -1289,7 +1289,7 @@ public static function isNormalized( /** * @param string $string

    The input string to normalize

    - * @param string $form + * @param int $form * @return string|null

    Returns a string containing the Decomposition_Mapping property, if present in the UCD. * Returns null if there is no Decomposition_Mapping property for the character.

    * @link https://www.php.net/manual/en/normalizer.getrawdecomposition.php @@ -1444,7 +1444,7 @@ public static function getKeywords(#[TypeAware(['8.0' => 'string'], default: '') * @param string $displayLocale

    * Optional format locale to use to display the script name *

    - * @return string Display name of the script for the $locale in the format appropriate for + * @return string|false Display name of the script for the $locale in the format appropriate for * $in_locale. */ #[TentativeType] @@ -1464,7 +1464,7 @@ public static function getDisplayScript( * @param string $displayLocale

    * Optional format locale to use to display the region name *

    - * @return string display name of the region for the $locale in the format appropriate for + * @return string|false display name of the region for the $locale in the format appropriate for * $in_locale. */ #[TentativeType] @@ -1553,7 +1553,7 @@ public static function getDisplayVariant( * (e.g. 'variant0', 'variant1', etc.). *

    *

    - * @return string The corresponding locale identifier. + * @return string|false The corresponding locale identifier. */ #[TentativeType] public static function composeLocale(array $subtags): string|false {} @@ -1567,7 +1567,7 @@ public static function composeLocale(array $subtags): string|false {} * 'private' subtags can take maximum 15 values whereas 'extlang' can take * maximum 3 values. *

    - * @return array an array containing a list of key-value pairs, where the keys + * @return array|null an array containing a list of key-value pairs, where the keys * identify the particular locale ID subtags, and the values are the * associated subtag values. The array will be ordered as the locale id * subtags e.g. in the locale id if variants are '-varX-varY-varZ' then the @@ -1604,7 +1604,7 @@ public static function getAllVariants(#[TypeAware(['8.0' => 'string'], default: * If true, the arguments will be converted to canonical form before * matching. *

    - * @return bool TRUE if $locale matches $langtag FALSE otherwise. + * @return bool|null TRUE if $locale matches $langtag FALSE otherwise. */ #[TentativeType] public static function filterMatches( @@ -1632,7 +1632,7 @@ public static function filterMatches( * @param string $defaultLocale

    * The locale to use if no match is found. *

    - * @return string The closest matching language tag or default value. + * @return string|null The closest matching language tag or default value. */ #[TentativeType] public static function lookup( @@ -1647,7 +1647,7 @@ public static function lookup( /** * @link https://php.net/manual/en/locale.canonicalize.php * @param string $locale - * @return string + * @return string|null */ #[TentativeType] public static function canonicalize(#[TypeAware(['8.0' => 'string'], default: '')] $locale): ?string {} @@ -1659,7 +1659,7 @@ public static function canonicalize(#[TypeAware(['8.0' => 'string'], default: '' * @param string $header

    * The string containing the "Accept-Language" header according to format in RFC 2616. *

    - * @return string The corresponding locale identifier. + * @return string|false The corresponding locale identifier. */ #[TentativeType] public static function acceptFromHttp(#[TypeAware(['8.0' => 'string'], default: '')] $header): string|false {} @@ -1801,7 +1801,7 @@ public function setPattern(#[TypeAware(['8.0' => 'string'], default: '')] $patte * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
    * Get the pattern used by the formatter * @link https://php.net/manual/en/messageformatter.getpattern.php - * @return string The pattern string for this message formatter + * @return string|false The pattern string for this message formatter */ #[Pure] #[TentativeType] @@ -1939,7 +1939,7 @@ public function __construct( * Optional pattern to use when formatting or parsing. * Possible patterns are documented at http://userguide.icu-project.org/formatparse/datetime. *

    - * @return IntlDateFormatter + * @return IntlDateFormatter|null */ #[TentativeType] public static function create( @@ -2077,7 +2077,7 @@ public function setTimeZoneId($zone) {} * * *

    - * @return bool TRUE on success or FALSE on failure. + * @return bool|null TRUE on success or FALSE on failure. */ #[TentativeType] public function setTimeZone($timezone): ?bool {} @@ -2100,7 +2100,7 @@ public function setPattern(#[TypeAware(['8.0' => 'string'], default: '')] $patte * (PHP 5 >= 5.3.0, PECL intl >= 1.0.0)
    * Get the pattern used for the IntlDateFormatter * @link https://php.net/manual/en/intldateformatter.getpattern.php - * @return string The pattern string being used to format/parse. + * @return string|false The pattern string being used to format/parse. */ #[Pure] #[TentativeType] @@ -2128,7 +2128,7 @@ public function getLocale( * @param bool $lenient

    * Sets whether the parser is lenient or not, default is TRUE (lenient). *

    - * @return bool TRUE on success or FALSE on failure. + * @return void */ #[TentativeType] public function setLenient(#[TypeAware(['8.0' => 'bool'], default: '')] $lenient): void {} @@ -2318,7 +2318,7 @@ public function count(): int {} * Path of ResourceBundle for which to get available locales, or * empty string for default locales list. *

    - * @return array the list of locales supported by the bundle. + * @return array|false the list of locales supported by the bundle. */ #[TentativeType] public static function getLocales(#[TypeAware(['8.0' => 'string'], default: '')] $bundle): array|false {} @@ -2344,7 +2344,7 @@ public function getErrorCode(): int {} public function getErrorMessage(): string {} /** - * @return Traversable + * @return Iterator * @since 8.0 */ #[Pure] @@ -2819,7 +2819,7 @@ public function equals(#[TypeAware(['8.0' => 'IntlCalendar'], default: '')] $oth * values between 0 and * IntlCalendar::FIELD_COUNT. *

    - * @return int Returns a (signed) difference of time in the unit associated with the + * @return int|false Returns a (signed) difference of time in the unit associated with the * specified field or FALSE on failure. */ #[Pure] @@ -2858,7 +2858,7 @@ public static function fromDateTime( * values between 0 and * IntlCalendar::FIELD_COUNT. *

    - * @return int An integer with the value of the time field. + * @return int|false An integer with the value of the time field. */ #[Pure] #[TentativeType] @@ -2873,7 +2873,7 @@ public function get(#[TypeAware(['8.0' => 'int'], default: '')] $field): int|fal * values between 0 and * IntlCalendar::FIELD_COUNT. *

    - * @return int + * @return int|false * An {@link https://secure.php.net/manual/en/language.types.integer.php int} representing the maximum value in the units associated * with the given field or FALSE on failure. */ @@ -2890,7 +2890,7 @@ public function getActualMaximum(#[TypeAware(['8.0' => 'int'], default: '')] $fi * These are integer values between 0 and * IntlCalendar::FIELD_COUNT. *

    - * @return int + * @return int|false * An {@link https://secure.php.net/manual/en/language.types.integer.php int} representing the minimum value in the field's * unit or FALSE on failure. */ @@ -3027,7 +3027,7 @@ public function getLeastMaximum(#[TypeAware(['8.0' => 'int'], default: '')] $fie * From the most general to the most specific, the locales are ordered in * this fashion – actual locale, valid locale, requested locale. *

    - * @return string + * @return string|false */ #[Pure] #[TentativeType] @@ -3597,7 +3597,7 @@ public static function getEquivalentID( * (PHP 5 >=5.5.0 PECL intl >= 3.0.0a1)
    * Get last error code on the object * @link https://secure.php.net/manual/en/intltimezone.geterrorcode.php - * @return int + * @return int|false */ #[Pure] #[TentativeType] @@ -3625,7 +3625,7 @@ public static function getGMT(): IntlTimeZone {} /** * (PHP 5 >=5.5.0 PECL intl >= 3.0.0a1)
    * Get timezone ID - * @return string + * @return string|false */ #[Pure] #[TentativeType] @@ -3683,7 +3683,7 @@ public static function getRegion(#[TypeAware(['8.0' => 'string'], default: '')] * (PHP 5 >=5.5.0 PECL intl >= 3.0.0a1)
    * Get the timezone data version currently used by ICU * @link https://secure.php.net/manual/en/intltimezone.gettzdataversion.php - * @return string + * @return string|false */ #[TentativeType] public static function getTZDataVersion(): string|false {} @@ -3830,7 +3830,7 @@ function collator_set_attribute(Collator $object, int $attribute, int $value): b * Get current collation strength * @link https://php.net/manual/en/collator.getstrength.php * @param Collator $object - * @return int|false current collation strength, or boolean FALSE on error. + * @return int current collation strength */ #[Pure] function collator_get_strength(Collator $object): int {} @@ -3974,7 +3974,7 @@ function collator_get_sort_key( * @param string|null $pattern [optional]

    * Pattern string if the chosen style requires a pattern. *

    - * @return NumberFormatter|false|null NumberFormatter object or FALSE on error. + * @return NumberFormatter|null NumberFormatter object or NULL on error. */ #[Pure] function numfmt_create(string $locale, int $style, #[TypeAware(['8.0' => 'string|null'], default: 'string')] $pattern = null): ?NumberFormatter {} @@ -5110,7 +5110,7 @@ function grapheme_strripos(string $haystack, string $needle, int $offset = 0): i * the returned string will start at the $start'th grapheme unit from the * end of string. *

    - * @param int $length [optional]

    + * @param int|null $length [optional]

    * Length in grapheme units. * If $length is given and is positive, the string returned will contain * at most $length grapheme units beginning from $start (depending on the @@ -5880,7 +5880,7 @@ function intlcal_get_type(IntlCalendar $calendar): string {} * @param IntlCalendar $calendar

    * The calendar object, on the procedural style interface. *

    - * @param string $dayOfWeek

    + * @param int $dayOfWeek

    * One of the constants IntlCalendar::DOW_SUNDAY, * IntlCalendar::DOW_MONDAY, ..., * IntlCalendar::DOW_SATURDAY. @@ -6457,7 +6457,7 @@ function intlgregcal_is_leap_year(IntlGregorianCalendar $calendar, int $year): b * @param bool $fallback [optional]

    * Whether locale should match exactly or fallback to parent locale is allowed. *

    - * @return ResourceBundle|false|null ResourceBundle object or FALSE on error. + * @return ResourceBundle|null ResourceBundle object or NULL on error. */ #[Pure] function resourcebundle_create(?string $locale, ?string $bundle, bool $fallback = true): ?ResourceBundle {} @@ -6505,7 +6505,7 @@ function resourcebundle_locales(string $bundle): array|false {} * (PHP >= 5.3.2, PECL intl >= 2.0.0)
    * Get bundle's last error code. * @link https://php.net/manual/en/resourcebundle.geterrorcode.php - * @param $bundle + * @param ResourceBundle $bundle * @return int error code from last bundle object call. */ #[Pure(true)] @@ -6515,7 +6515,7 @@ function resourcebundle_get_error_code(ResourceBundle $bundle): int {} * (PHP >= 5.3.2, PECL intl >= 2.0.0)
    * Get bundle's last error message. * @link https://php.net/manual/en/resourcebundle.geterrormessage.php - * @param $bundle + * @param ResourceBundle $bundle * @return string error message from last bundle object's call. */ #[Pure(true)] @@ -6754,8 +6754,8 @@ function intltz_get_id_for_windows_id(string $timezoneId, ?string $region = null * @link https://php.net/manual/en/intl.constants.php */ define('INTL_MAX_LOCALE_LEN', 156); -define('INTL_ICU_VERSION', "71.1"); -define('INTL_ICU_DATA_VERSION', "71.1"); +define('INTL_ICU_VERSION', "73.2"); +define('INTL_ICU_DATA_VERSION', "73.2"); define('ULOC_ACTUAL_LOCALE', 0); define('ULOC_VALID_LOCALE', 1); define('GRAPHEME_EXTR_COUNT', 0); @@ -7073,7 +7073,7 @@ private function __construct() {} * Create break iterator for boundaries of combining character sequences * @link https://secure.php.net/manual/en/intlbreakiterator.createcharacterinstance.php * @param string $locale - * @return IntlBreakIterator + * @return IntlBreakIterator|null */ #[TentativeType] public static function createCharacterInstance(#[TypeAware(['8.0' => 'string|null'], default: '')] $locale = null): ?IntlBreakIterator {} @@ -7208,7 +7208,11 @@ public function getLocale(#[TypeAware(['8.0' => 'int'], default: '')] $type): st */ #[Pure] #[TentativeType] - public function getPartsIterator(#[TypeAware(['8.0' => 'string'], default: '')] $type = IntlPartsIterator::KEY_SEQUENTIAL): IntlPartsIterator {} + public function getPartsIterator( + #[TypeAware(['8.0' => 'int'], default: '')] + #[EV([IntlPartsIterator::KEY_SEQUENTIAL, IntlPartsIterator::KEY_LEFT, IntlPartsIterator::KEY_RIGHT])] + $type = IntlPartsIterator::KEY_SEQUENTIAL + ): IntlPartsIterator {} /** * (PHP 5 >=5.5.0)
    @@ -7353,7 +7357,7 @@ public static function createWordInstance($locale) {} * (PHP 5 >=5.5.0)
    * @link https://secure.php.net/manual/en/intlrulebasedbreakiterator.getbinaryrules.php * Get the binary form of compiled rules - * @return string + * @return string|false */ #[Pure] #[TentativeType] @@ -7690,7 +7694,7 @@ public function toUCallback( * @param string $str * @param string $toEncoding * @param string $fromEncoding - * @param array $options + * @param array|null $options * @return string|false */ #[TentativeType] diff --git a/mailparse/mailparse.php b/mailparse/mailparse.php index ff643a98f..736fa49de 100644 --- a/mailparse/mailparse.php +++ b/mailparse/mailparse.php @@ -111,7 +111,7 @@ function mailparse_msg_get_part_data($mimemail) {} * A valid MIME resource. *

    * @param string $mimesection - * @return resource + * @return resource|false */ function mailparse_msg_get_part($mimemail, $mimesection) {} diff --git a/memcached/memcached.php b/memcached/memcached.php index 1edb4408a..385fe6e50 100644 --- a/memcached/memcached.php +++ b/memcached/memcached.php @@ -1493,6 +1493,14 @@ public function isPersistent() {} */ public function isPristine() {} + /** + * (PECL memcached >= 3.2.0)
    + * Check if the given key is valid. + * @param string $key + * @return bool + */ + public function checkKey($key) {} + /** * Flush and send buffered commands * @link https://github.com/php-memcached-dev/php-memcached/blob/v3.1.5/php_memcached.c diff --git a/meta/.phpstorm.meta.php b/meta/.phpstorm.meta.php index 013be309c..ede319ab1 100644 --- a/meta/.phpstorm.meta.php +++ b/meta/.phpstorm.meta.php @@ -187,10 +187,6 @@ function argumentsSet($setName) { expectedArguments(\ftp_put(), 3, FTP_ASCII,FTP_BINARY); expectedArguments(\ftp_fput(), 3, FTP_ASCII,FTP_BINARY); - expectedArguments(\fopen(), 1, 'r', 'r+', 'w', 'w+', 'a', 'a+', 'x', 'x+', 'c', 'c+', 'e'); - expectedArguments(\popen(), 1, 'r', 'r+', 'w', 'w+', 'a', 'a+', 'x', 'x+', 'c', 'c+', 'e'); - expectedArguments(\SplFileInfo::openFile(), 0, 'r', 'r+', 'w', 'w+', 'a', 'a+', 'x', 'x+', 'c', 'c+', 'e'); - expectedArguments(\htmlentities(), 1, ENT_COMPAT | ENT_QUOTES | ENT_NOQUOTES | ENT_IGNORE | ENT_SUBSTITUTE | ENT_DISALLOWED | ENT_HTML401 | ENT_XML1 | ENT_XHTML | ENT_HTML5); expectedArguments(\htmlspecialchars(), 1, ENT_COMPAT | ENT_QUOTES | ENT_NOQUOTES | ENT_IGNORE | ENT_SUBSTITUTE | ENT_DISALLOWED | ENT_HTML401 | ENT_XML1 | ENT_XHTML | ENT_HTML5); expectedArguments(\html_entity_decode(), 1, ENT_COMPAT | ENT_QUOTES | ENT_NOQUOTES | ENT_HTML401 | ENT_XML1 | ENT_XHTML | ENT_HTML5); @@ -671,6 +667,12 @@ function expectedReturnValues($functionReference, $values) { expectedArguments(\array_unique(), 1, SORT_REGULAR, SORT_NUMERIC, SORT_STRING, SORT_LOCALE_STRING); + expectedReturnValues(\PHP_OS_FAMILY, 'Windows', 'Linux', 'Darwin', 'BSD', 'Solaris', 'Unknown'); + expectedReturnValues(\PHP_OS, 'Darwin', 'Linux', 'Windows', 'WIN32', 'WINNT', 'FreeBSD', 'CYGWIN_NT-5.1', 'HP-UX', 'IRIX64', 'NetBSD', 'OpenBSD', 'OpenBSD'); + expectedReturnValues(\PHP_SAPI, 'cli', 'phpdbg', 'embed', 'apache', 'apache2handler', 'cgi-fcgi', 'cli-server', 'fpm-fcgi', 'litespeed'); + expectedReturnValues(\PHP_VERSION, '5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'); + expectedReturnValues(\PHP_VERSION_ID, 50300, 50400, 50500, 50600, 70000, 70100, 70200, 70300, 70400, 80000, 80100, 80200); + /** * Use this constant to mark the function with an argument on the specified position as an exit point * diff --git a/meta/attributes/ObjectShape.php b/meta/attributes/ObjectShape.php new file mode 100644 index 000000000..dd9dd04b7 --- /dev/null +++ b/meta/attributes/ObjectShape.php @@ -0,0 +1,21 @@ +#[ObjectShape(["age" => "int", "name" => "string"])] + * + * This usage applied on an element effectively means that the object has 2 fields, the names are "age" and "name", and the corresponding types are "int" and "string". + */ +#[Attribute(Attribute::TARGET_FUNCTION|Attribute::TARGET_METHOD|Attribute::TARGET_PARAMETER|Attribute::TARGET_PROPERTY)] +class ObjectShape +{ + public function __construct(array $shape) {} +} diff --git a/meta/guzzle/.phpstorm.meta.php b/meta/guzzle/.phpstorm.meta.php new file mode 100644 index 000000000..2118db218 --- /dev/null +++ b/meta/guzzle/.phpstorm.meta.php @@ -0,0 +1,24 @@ + - * options - * - * - * - * Option - * Type - * Description - * - * - * - * - * - * - * - * readPreference - * MongoDB\Driver\ReadPreference - * - *

    - * A read preference to use for selecting a server for the operation. - *

    - * - * - * - * session - * MongoDB\Driver\Session - * - *

    - * A session to associate with the operation. - *

    - * - * - * - * - * The third parameter is now an options array. For backwards compatibility, this parameter will still accept a MongoDB\Driver\ReadPreference object. - * @throws InvalidArgumentException on argument parsing errors. - * @throws ConnectionException if connection to the server fails (for reasons other than authentication). - * @throws AuthenticationException if authentication is needed and fails. - * @throws RuntimeException on other errors (e.g. invalid command, issuing a write command to a secondary). - * @return Cursor - */ - final public function executeQuery($namespace, Query $zquery, $options = []) {} - - /** - * Returns the hostname of this server - * @link https://php.net/manual/en/mongodb-driver-server.gethost.php - * @throws InvalidArgumentException on argument parsing errors. - * @return string - */ - final public function getHost() {} - - /** - * Returns an array of information about this server - * @link https://php.net/manual/en/mongodb-driver-server.getinfo.php - * @throws InvalidArgumentException on argument parsing errors. - * @return array - */ - final public function getInfo() {} - - /** - * Returns the latency of this server - * @link https://php.net/manual/en/mongodb-driver-server.getlatency.php - * @throws InvalidArgumentException on argument parsing errors. - * @return int - */ - final public function getLatency() {} - - /** - * Returns the port on which this server is listening - * @link https://php.net/manual/en/mongodb-driver-server.getport.php - * @throws InvalidArgumentException on argument parsing errors. - * @return int - */ - final public function getPort() {} - - /** - * Returns an array of tags describing this server in a replica set - * @link https://php.net/manual/en/mongodb-driver-server.gettags.php - * @throws InvalidArgumentException on argument parsing errors. - * @return array An array of tags used to describe this server in a replica set. The array will contain zero or more string key and value pairs. - */ - final public function getTags() {} - - /** - * Returns an integer denoting the type of this server - * @link https://php.net/manual/en/mongodb-driver-server.gettype.php - * @throws InvalidArgumentException on argument parsing errors. - * @return int denoting the type of this server - */ - final public function getType() {} - - /** - * Checks if this server is an arbiter member of a replica set - * @link https://php.net/manual/en/mongodb-driver-server.isarbiter.php - * @throws InvalidArgumentException on argument parsing errors. - * @return bool - */ - final public function isArbiter() {} - - /** - * Checks if this server is a hidden member of a replica set - * @link https://php.net/manual/en/mongodb-driver-server.ishidden.php - * @throws InvalidArgumentException on argument parsing errors. - * @return bool - */ - final public function isHidden() {} - - /** - * Checks if this server is a passive member of a replica set - * @link https://php.net/manual/en/mongodb-driver-server.ispassive.php - * @throws InvalidArgumentException on argument parsing errors. - * @return bool - */ - final public function isPassive() {} - - /** - * Checks if this server is a primary member of a replica set - * @link https://php.net/manual/en/mongodb-driver-server.isprimary.php - * @throws InvalidArgumentException on argument parsing errors. - * @return bool - */ - final public function isPrimary() {} - - /** - * Checks if this server is a secondary member of a replica set - * @link https://php.net/manual/en/mongodb-driver-server.issecondary.php - * @throws InvalidArgumentException on argument parsing errors. - * @return bool - */ - final public function isSecondary() {} - } - - /** - * The MongoDB\Driver\Query class is a value object that represents a database query. - * @link https://php.net/manual/en/class.mongodb-driver-query.php - */ - final class Query - { - /** - * Construct new Query - * @link https://php.net/manual/en/mongodb-driver-query.construct.php - * @param array|object $filter The search filter. - * @param array $options - * @throws InvalidArgumentException on argument parsing errors. - */ - final public function __construct($filter, ?array $options = []) {} - - final public function __wakeup() {} - } - - /** - * The MongoDB\Driver\Command class is a value object that represents a database command. - * To provide "Command Helpers" the MongoDB\Driver\Command object should be composed. - * @link https://php.net/manual/en/class.mongodb-driver-command.php - * @since 1.0.0 - */ - final class Command - { - /** - * Construct new Command - * @param array|object $document The complete command to construct - * @param array $options Do not use this parameter to specify options described in the command's reference in the MongoDB manual. - * @throws InvalidArgumentException on argument parsing errors. - * @link https://secure.php.net/manual/en/mongodb-driver-command.construct.php - * @since 1.0.0 - */ - final public function __construct($document, ?array $options = []) {} - - final public function __wakeup() {} - } - - /** - * Class ReadPreference - * @link https://php.net/manual/en/class.mongodb-driver-readpreference.php - */ - final class ReadPreference implements Serializable, \Serializable - { - public const RP_PRIMARY = 1; - public const RP_PRIMARY_PREFERRED = 5; - public const RP_SECONDARY = 2; - public const RP_SECONDARY_PREFERRED = 6; - public const RP_NEAREST = 10; - - /** - * @since 1.7.0 - */ - public const PRIMARY = 'primary'; - - /** - * @since 1.7.0 - */ - public const PRIMARY_PREFERRED = 'primaryPreferred'; - - /** - * @since 1.7.0 - */ - public const SECONDARY = 'secondary'; - - /** - * @since 1.7.0 - */ - public const SECONDARY_PREFERRED = 'secondaryPreferred'; - - /** - * @since 1.7.0 - */ - public const NEAREST = 'nearest'; - - /** - * @since 1.2.0 - */ - public const NO_MAX_STALENESS = -1; - - /** - * @since 1.2.0 - */ - public const SMALLEST_MAX_STALENESS_SECONDS = 90; - - /** - * Construct immutable ReadPreference - * @link https://php.net/manual/en/mongodb-driver-readpreference.construct.php - * @param string|int $mode - * @param array|null $tagSets - * @param array $options - * @throws InvalidArgumentException if mode is invalid or if tagSets is provided for a primary read preference. - */ - final public function __construct($mode, ?array $tagSets = null, ?array $options = []) {} - - public static function __set_state(array $properties) {} - - /** - * Returns the ReadPreference's "hedge" option - * @since 1.8.0 - * @link https://www.php.net/manual/en/mongodb-driver-readpreference.gethedge.php - * @return object|null - */ - final public function getHedge() {} - - /** - * Returns the ReadPreference's "mode" option - * @link https://php.net/manual/en/mongodb-driver-readpreference.getmode.php - * @return int - */ - final public function getMode() {} - - /** - * Returns the ReadPreference's "mode" option as a string - * @since 1.7.0 - * @link https://php.net/manual/en/mongodb-driver-readpreference.getmodestring.php - * @return string - * @throws InvalidArgumentException - */ - final public function getModeString() {} - - /** - * Returns the ReadPreference's "tagSets" option - * @link https://php.net/manual/en/mongodb-driver-readpreference.gettagsets.php - * @return array - */ - final public function getTagSets() {} - - /** - * Returns an object for BSON serialization - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-driver-readpreference.bsonserialize.php - * @return object Returns an object for serializing the WriteConcern as BSON. - * @throws InvalidArgumentException - */ - final public function bsonSerialize() {} - - /** - * Serialize a ReadPreference - * @since 1.7.0 - * @link https://php.net/manual/en/mongodb-driver-readpreference.serialize.php - * @return string - * @throws InvalidArgumentException - */ - final public function serialize() {} - - /** - * Unserialize a ReadPreference - * @since 1.7.0 - * @link https://php.net/manual/en/mongodb-driver-readpreference.unserialize.php - * @param string $serialized - * @return void - * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid - * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) - */ - final public function unserialize($serialized) {} - - final public function getMaxStalenessSeconds() {} - } - - /** - * MongoDB\Driver\ReadConcern controls the level of isolation for read operations for replica sets and replica set shards. This option requires the WiredTiger storage engine and MongoDB 3.2 or later. - * @link https://php.net/manual/en/class.mongodb-driver-readconcern.php - * @since 1.1.0 - */ - final class ReadConcern implements Serializable, \Serializable - { - /** - * @since 1.2.0 - */ - public const LINEARIZABLE = 'linearizable'; - public const LOCAL = 'local'; - public const MAJORITY = 'majority'; - - /** - * @since 1.4.0 - */ - public const AVAILABLE = 'available'; - - /** - * Construct immutable ReadConcern - * @link https://php.net/manual/en/mongodb-driver-readconcern.construct.php - * @param string $level - */ - final public function __construct($level = null) {} - - public static function __set_state(array $properties) {} - - /** - * Returns the ReadConcern's "level" option - * @link https://php.net/manual/en/mongodb-driver-readconcern.getlevel.php - * @return string|null - * @since 1.0.0 - */ - final public function getLevel() {} - - /** - * Returns an object for BSON serialization - * @link https://php.net/manual/en/mongodb-driver-readconcern.bsonserialize.php - * @return object - * @since 1.2.0 - */ - final public function bsonSerialize() {} - - /** - * Checks if this is the default read concern - * @link https://secure.php.net/manual/en/mongodb-driver-readconcern.isdefault.php - * @return bool - * @since 1.3.0 - * @throws \MongoDB\Driver\Exception\InvalidArgumentException On argument parsing errors. - */ - final public function isDefault() {} - - /** - * Serialize a ReadConcern - * @since 1.7.0 - * @link https://php.net/manual/en/mongodb-driver-readconcern.serialize.php - * @return string - * @throws InvalidArgumentException - */ - final public function serialize() {} - - /** - * Unserialize a ReadConcern - * @since 1.7.0 - * @link https://php.net/manual/en/mongodb-driver-readconcern.unserialize.php - * @param string $serialized - * @return void - * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid - * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) - */ - final public function unserialize($serialized) {} - } - - /** - * The MongoDB\Driver\Cursor class encapsulates the results of a MongoDB command or query and may be returned by MongoDB\Driver\Manager::executeCommand() or MongoDB\Driver\Manager::executeQuery(), respectively. - * @link https://php.net/manual/en/class.mongodb-driver-cursor.php - */ - final class Cursor implements CursorInterface, \Iterator - { - /** - * Create a new Cursor - * MongoDB\Driver\Cursor objects are returned as the result of an executed command or query and cannot be constructed directly. - * @link https://php.net/manual/en/mongodb-driver-cursor.construct.php - */ - final private function __construct() {} - - final public function __wakeup() {} - - /** - * Returns the current element. - * @link https://www.php.net/manual/en/mongodb-driver-cursor.current.php - * @return array|object - */ - public function current() {} - - /** - * Returns the MongoDB\Driver\CursorId associated with this cursor. A cursor ID cursor uniquely identifies the cursor on the server. - * @link https://php.net/manual/en/mongodb-driver-cursor.getid.php - * @return CursorId for this Cursor - * @throws InvalidArgumentException on argument parsing errors. - */ - final public function getId() {} - - /** - * Returns the MongoDB\Driver\Server associated with this cursor. This is the server that executed the query or command. - * @link https://php.net/manual/en/mongodb-driver-cursor.getserver.php - * @return Server for this Cursor - * @throws InvalidArgumentException on argument parsing errors. - */ - final public function getServer() {} - - /** - * Checks if a cursor is still alive - * @link https://php.net/manual/en/mongodb-driver-cursor.isdead.php - * @return bool - * @throws InvalidArgumentException On argument parsing errors - */ - final public function isDead() {} - - /** - * Returns the current result's index within the cursor. - * @link https://www.php.net/manual/en/mongodb-driver-cursor.key.php - * @return int - */ - public function key() {} - - /** - * Advances the cursor to the next result. - * @link https://www.php.net/manual/en/mongodb-driver-cursor.next.php - * @return void - * @throws \MongoDB\Driver\Exception\InvalidArgumentException on argument parsing errors. - * @throws \MongoDB\Driver\Exception\ConnectionException if connection to the server fails (for reasons other than authentication). - * @throws \MongoDB\Driver\Exception\AuthenticationException if authentication is needed and fails. - */ - public function next() {} - - /** - * Rewind the cursor to the first result. - * @link https://www.php.net/manual/en/mongodb-driver-cursor.rewind.php - * @return void - * @throws \MongoDB\Driver\Exception\InvalidArgumentException on argument parsing errors. - * @throws \MongoDB\Driver\Exception\ConnectionException if connection to the server fails (for reasons other than authentication). - * @throws \MongoDB\Driver\Exception\AuthenticationException if authentication is needed and fails. - * @throws \MongoDB\Driver\Exception\LogicException if this method is called after the cursor has advanced beyond its first position. - */ - public function rewind() {} - - /** - * Sets a type map to use for BSON unserialization - * - * @link https://php.net/manual/en/mongodb-driver-cursor.settypemap.php - * - * @param array $typemap - * @return void - * @throws InvalidArgumentException On argument parsing errors or if a class in the type map cannot - * be instantiated or does not implement MongoDB\BSON\Unserializable - */ - final public function setTypeMap(array $typemap) {} - - /** - * Returns an array of all result documents for this cursor - * @link https://php.net/manual/en/mongodb-driver-cursor.toarray.php - * @return array - * @throws InvalidArgumentException On argument parsing errors - */ - final public function toArray() {} - - /** - * Checks if the current position in the cursor is valid. - * @link https://www.php.net/manual/en/mongodb-driver-cursor.valid.php - * @return bool - */ - public function valid() {} - } - - /** - * Class CursorId - * @link https://php.net/manual/en/class.mongodb-driver-cursorid.php - */ - final class CursorId implements \Serializable - { - /** - * Create a new CursorId (not used) - * CursorId objects are returned from Cursor::getId() and cannot be constructed directly. - * @link https://php.net/manual/en/mongodb-driver-cursorid.construct.php - * @see Cursor::getId() - */ - final private function __construct() {} - - /** - * String representation of the cursor ID - * @link https://php.net/manual/en/mongodb-driver-cursorid.tostring.php - * @return string representation of the cursor ID. - * @throws InvalidArgumentException on argument parsing errors. - */ - final public function __toString() {} - - final public function __wakeup() {} - - public static function __set_state(array $properties) {} - - /** - * Serialize a CursorId - * @since 1.7.0 - * @link https://php.net/manual/en/mongodb-driver-cursorid.serialize.php - * @return string - * @throws InvalidArgumentException - */ - final public function serialize() {} - - /** - * Unserialize a CursorId - * @since 1.7.0 - * @link https://php.net/manual/en/mongodb-driver-cursorid.unserialize.php - * @param string $serialized - * @return void - * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid - * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) - */ - final public function unserialize($serialized) {} - } - - /** - * The BulkWrite collects one or more write operations that should be sent to the server. - * After adding any number of insert, update, and delete operations, the collection may be executed via Manager::executeBulkWrite(). - * Write operations may either be ordered (default) or unordered. - * Ordered write operations are sent to the server, in the order provided, for serial execution. - * If a write fails, any remaining operations will be aborted. - * Unordered operations are sent to the server in an arbitrary order where they may be executed in parallel. - * Any errors that occur are reported after all operations have been attempted. - */ - final class BulkWrite implements \Countable - { - /** - * Create a new BulkWrite - * Constructs a new ordered (default) or unordered BulkWrite. - * @link https://php.net/manual/en/mongodb-driver-bulkwrite.construct.php - * @param array $options - * @throws InvalidArgumentException on argument parsing errors. - */ - final public function __construct(?array $options = []) {} - - final public function __wakeup() {} - - /** - * Count expected roundtrips for executing the bulk - * Returns the expected number of client-to-server roundtrips required to execute all write operations in the BulkWrite. - * @link https://php.net/manual/en/mongodb-driver-bulkwrite.count.php - * @return int number of expected roundtrips to execute the BulkWrite. - * @throws InvalidArgumentException on argument parsing errors. - */ - final public function count() {} - - /** - * Add a delete operation to the bulk - * @link https://php.net/manual/en/mongodb-driver-bulkwrite.delete.php - * @param array|object $query The search filter - * @param array $deleteOptions - * @throws InvalidArgumentException on argument parsing errors. - */ - final public function delete($query, ?array $deleteOptions = []) {} - - /** - * Add an insert operation to the bulk - * If the document did not have an _id, a MongoDB\BSON\ObjectId will be generated and returned; otherwise, no value is returned. - * @link https://php.net/manual/en/mongodb-driver-bulkwrite.insert.php - * @param array|object $document - * @return mixed - * @throws InvalidArgumentException on argument parsing errors. - */ - final public function insert($document) {} - - /** - * Add an update operation to the bulk - * @link https://php.net/manual/en/mongodb-driver-bulkwrite.update.php - * @param array|object $query The search filter - * @param array|object $newObj A document containing either update operators (e.g. $set) or a replacement document (i.e. only field:value expressions) - * @param array $updateOptions - * @throws InvalidArgumentException on argument parsing errors. - */ - final public function update($query, $newObj, ?array $updateOptions = []) {} - } - - /** - * WriteConcern controls the acknowledgment of a write operation, specifies the level of write guarantee for Replica Sets. - */ - final class WriteConcern implements Serializable, \Serializable - { - /** - * Majority of all the members in the set; arbiters, non-voting members, passive members, hidden members and delayed members are all included in the definition of majority write concern. - */ - public const MAJORITY = 'majority'; - - /** - * Construct immutable WriteConcern - * @link https://php.net/manual/en/mongodb-driver-writeconcern.construct.php - * @param string|int $w - * @param int $wtimeout How long to wait (in milliseconds) for secondaries before failing. - * @param bool $journal Wait until mongod has applied the write to the journal. - * @throws InvalidArgumentException on argument parsing errors. - */ - final public function __construct($w, $wtimeout = 0, $journal = false) {} - - public static function __set_state(array $properties) {} - - /** - * Returns the WriteConcern's "journal" option - * @link https://php.net/manual/en/mongodb-driver-writeconcern.getjournal.php - * @return bool|null - */ - final public function getJournal() {} - - /** - * Returns the WriteConcern's "w" option - * @link https://php.net/manual/en/mongodb-driver-writeconcern.getw.php - * @return string|int|null - */ - final public function getW() {} - - /** - * Returns the WriteConcern's "wtimeout" option - * @link https://php.net/manual/en/mongodb-driver-writeconcern.getwtimeout.php - * @return int - */ - final public function getWtimeout() {} - - /** - * Returns an object for BSON serialization - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-driver-writeconcern.bsonserialize.php - * @return object Returns an object for serializing the WriteConcern as BSON. - * @throws InvalidArgumentException - */ - final public function bsonSerialize() {} - - /** - * Serialize a WriteConcern - * @since 1.7.0 - * @link https://php.net/manual/en/mongodb-driver-writeconcern.serialize.php - * @return string - * @throws InvalidArgumentException - */ - final public function serialize() {} - - /** - * Unserialize a WriteConcern - * @since 1.7.0 - * @link https://php.net/manual/en/mongodb-driver-writeconcern.unserialize.php - * @param string $serialized - * @return void - * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid - * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) - */ - final public function unserialize($serialized) {} - - final public function isDefault() {} - } - - /** - * The MongoDB\Driver\WriteResult class encapsulates information about an executed MongoDB\Driver\BulkWrite and may be returned by MongoDB\Driver\Manager::executeBulkWrite(). - * @link https://php.net/manual/en/class.mongodb-driver-writeresult.php - */ - final class WriteResult - { - final private function __construct() {} - - final public function __wakeup() {} - - /** - * Returns the number of documents deleted - * @link https://php.net/manual/en/mongodb-driver-writeresult.getdeletedcount.php - * @return int|null - */ - final public function getDeletedCount() {} - - /** - * Returns the number of documents inserted (excluding upserts) - * @link https://php.net/manual/en/mongodb-driver-writeresult.getinsertedcount.php - * @return int|null - */ - final public function getInsertedCount() {} - - /** - * Returns the number of documents selected for update - * @link https://php.net/manual/en/mongodb-driver-writeresult.getmatchedcount.php - * @return int|null - */ - final public function getMatchedCount() {} - - /** - * Returns the number of existing documents updated - * @link https://php.net/manual/en/mongodb-driver-writeresult.getmodifiedcount.php - * @return int|null - */ - final public function getModifiedCount() {} - - /** - * Returns the server associated with this write result - * @link https://php.net/manual/en/mongodb-driver-writeresult.getserver.php - * @return Server - */ - final public function getServer() {} - - /** - * Returns the number of documents inserted by an upsert - * @link https://php.net/manual/en/mongodb-driver-writeresult.getupsertedcount.php - * @return int|null - */ - final public function getUpsertedCount() {} - - /** - * Returns an array of identifiers for upserted documents - * @link https://php.net/manual/en/mongodb-driver-writeresult.getupsertedids.php - * @return array - */ - final public function getUpsertedIds() {} - - /** - * Returns any write concern error that occurred - * @link https://php.net/manual/en/mongodb-driver-writeresult.getwriteconcernerror.php - * @return WriteConcernError|null - */ - final public function getWriteConcernError() {} - - /** - * Returns any write errors that occurred - * @link https://php.net/manual/en/mongodb-driver-writeresult.getwriteerrors.php - * @return WriteError[] - */ - final public function getWriteErrors() {} - - /** - * Returns whether the write was acknowledged - * @link https://php.net/manual/en/mongodb-driver-writeresult.isacknowledged.php - * @return bool - */ - final public function isAcknowledged() {} - } - - /** - * The MongoDB\Driver\WriteError class encapsulates information about a write error and may be returned as an array element from MongoDB\Driver\WriteResult::getWriteErrors(). - */ - final class WriteError - { - final private function __construct() {} - - final public function __wakeup() {} - - /** - * Returns the WriteError's error code - * @link https://php.net/manual/en/mongodb-driver-writeerror.getcode.php - * @return int - */ - final public function getCode() {} - - /** - * Returns the index of the write operation corresponding to this WriteError - * @link https://php.net/manual/en/mongodb-driver-writeerror.getindex.php - * @return int - */ - final public function getIndex() {} - - /** - * Returns additional metadata for the WriteError - * @link https://php.net/manual/en/mongodb-driver-writeerror.getinfo.php - * @return mixed - */ - final public function getInfo() {} - - /** - * Returns the WriteError's error message - * @link https://php.net/manual/en/mongodb-driver-writeerror.getmessage.php - * @return string - */ - final public function getMessage() {} - } - - /** - * The MongoDB\Driver\WriteConcernError class encapsulates information about a write concern error and may be returned by MongoDB\Driver\WriteResult::getWriteConcernError(). - * @link https://php.net/manual/en/class.mongodb-driver-writeconcernerror.php - */ - final class WriteConcernError - { - final private function __construct() {} - - final public function __wakeup() {} - - /** - * Returns the WriteConcernError's error code - * @link https://php.net/manual/en/mongodb-driver-writeconcernerror.getcode.php - * @return int - */ - final public function getCode() {} - - /** - * Returns additional metadata for the WriteConcernError - * @link https://php.net/manual/en/mongodb-driver-writeconcernerror.getinfo.php - * @return mixed - */ - final public function getInfo() {} - - /** - * Returns the WriteConcernError's error message - * @link https://php.net/manual/en/mongodb-driver-writeconcernerror.getmessage.php - * @return string - */ - final public function getMessage() {} - } - - /** - * Class Session - * - * @link https://secure.php.net/manual/en/class.mongodb-driver-session.php - * @since 1.4.0 - */ - final class Session - { - /** - * @since 1.7.0 - */ - public const TRANSACTION_NONE = 'none'; - - /** - * @since 1.7.0 - */ - public const TRANSACTION_STARTING = 'starting'; - - /** - * @since 1.7.0 - */ - public const TRANSACTION_IN_PROGRESS = 'in_progress'; - - /** - * @since 1.7.0 - */ - public const TRANSACTION_COMMITTED = 'committed'; - - /** - * @since 1.7.0 - */ - public const TRANSACTION_ABORTED = 'aborted'; - - /** - * Create a new Session (not used) - * @link https://secure.php.net/manual/en/mongodb-driver-session.construct.php - * @since 1.4.0 - */ - final private function __construct() {} - - final public function __wakeup() {} - - /** - * Aborts a transaction - * @link https://secure.php.net/manual/en/mongodb-driver-session.aborttransaction.php - * @return void - * @since 1.5.0 - */ - final public function abortTransaction() {} - - /** - * Advances the cluster time for this session - * @link https://secure.php.net/manual/en/mongodb-driver-session.advanceclustertime.php - * @param array|object $clusterTime The cluster time is a document containing a logical timestamp and server signature - * @return void - * @throws \MongoDB\Driver\Exception\InvalidArgumentException On argument parsing errors - * @since 1.4.0 - */ - final public function advanceClusterTime($clusterTime) {} - - /** - * Advances the operation time for this session - * @link https://secure.php.net/manual/en/mongodb-driver-session.advanceoperationtime.php - * @param \MongoDB\BSON\TimestampInterface $timestamp - * @return void - * @throws \MongoDB\Driver\Exception\InvalidArgumentException On argument parsing errors - * @since 1.4.0 - */ - final public function advanceOperationTime($timestamp) {} - - /** - * @link https://secure.php.net/manual/en/mongodb-driver-session.committransaction.php - * @return void - * @throws InvalidArgumentException On argument parsing errors - * @throws CommandException If the server could not commit the transaction (e.g. due to conflicts, - * network issues). In case the exception's MongoDB\Driver\Exception\CommandException::getResultDocument() has a "errorLabels" - * element, and this array contains a "TransientTransactionError" or "UnUnknownTransactionCommitResult" value, it is safe to - * re-try the whole transaction. In newer versions of the driver, MongoDB\Driver\Exception\RuntimeException::hasErrorLabel() - * should be used to test for this situation instead. - * @throws \MongoDB\Driver\Exception\RuntimeException If the transaction could not be committed (e.g. a transaction was not started) - * @since 1.5.0 - */ - final public function commitTransaction() {} - - /** - * This method closes an existing session. If a transaction was associated with this session, this transaction is also aborted, - * and all its operations are rolled back. - * - * @link https://secure.php.net/manual/en/mongodb-driver-session.endsession.php - * @return void - * @throws \MongoDB\Driver\Exception\InvalidArgumentException On argument parsing errors - * @since 1.5.0 - */ - final public function endSession() {} - - /** - * Returns the cluster time for this session - * @link https://secure.php.net/manual/en/mongodb-driver-session.getclustertime.php - * @return object|null - * @throws \MongoDB\Driver\Exception\InvalidArgumentException - * @since 1.4.0 - */ - final public function getClusterTime() {} - - /** - * Returns the logical session ID for this session - * @link https://secure.php.net/manual/en/mongodb-driver-session.getlogicalsessionid.php - * @return object Returns the logical session ID for this session - * @throws \MongoDB\Driver\Exception\InvalidArgumentException - * @since 1.4.0 - */ - final public function getLogicalSessionId() {} - - /** - * Returns the operation time for this session, or NULL if the session has no operation time - * @link https://secure.php.net/manual/en/mongodb-driver-session.getoperationtime.php - * @return \MongoDB\BSON\Timestamp|null - * @throws \MongoDB\Driver\Exception\InvalidArgumentException - * @since 1.4.0 - */ - final public function getOperationTime() {} - - /** - * Returns the server to which this session is pinned, or NULL if the session is not pinned to any server. - * @link https://secure.php.net/manual/en/mongodb-driver-session.getserver.php - * @return \MongoDB\Driver\Server|null - * @throws \MongoDB\Driver\Exception\InvalidArgumentException - * @since 1.6.0 - */ - final public function getServer() {} - - /** - * Returns options for the current transactions, or NULL if no transaction is running. - * @link https://secure.php.net/manual/en/mongodb-driver-session.gettransactionoptions.php - * @return array|null - * @throws \MongoDB\Driver\Exception\InvalidArgumentException - * @since 1.7.0 - */ - final public function getTransactionOptions() {} - - /** - * Returns the current transaction state - * @link https://secure.php.net/manual/en/mongodb-driver-session.gettransactionstate.php - * @return string - * @throws \MongoDB\Driver\Exception\InvalidArgumentException - * @since 1.7.0 - */ - final public function getTransactionState() {} - - /** - * Returns whether a multi-document transaction is in progress. - * @link https://secure.php.net/manual/en/mongodb-driver-session.isintransaction.php - * @return bool - * @throws \MongoDB\Driver\Exception\InvalidArgumentException - * @since 1.6.0 - */ - final public function isInTransaction() {} - - /** - * Starts a transaction - * @link https://secure.php.net/manual/en/mongodb-driver-session.starttransaction.php - * @param array|object $options - * @return void - * @throws \MongoDB\Driver\Exception\InvalidArgumentException On argument parsing errors - * @throws \MongoDB\Driver\Exception\CommandException If the the transaction could not be started because of a server-side problem (e.g. a lock could not be obtained). - * @throws \MongoDB\Driver\Exception\RuntimeException If the the transaction could not be started (e.g. a transaction was already started). - * @since 1.4.0 - */ - final public function startTransaction(?array $options = []) {} - } - - /** - * This interface is implemented by MongoDB\Driver\Cursor but may also be used for type-hinting and userland classes. - * @link https://www.php.net/manual/en/class.mongodb-driver-cursorinterface.php - * @since 1.6.0 - */ - interface CursorInterface extends Traversable - { - /** - * Returns the MongoDB\Driver\CursorId associated with this cursor. A cursor ID uniquely identifies the cursor on the server. - * @return CursorId Returns the MongoDB\Driver\CursorId for this cursor. - * @throws InvalidArgumentException - * @link https://www.php.net/manual/en/mongodb-driver-cursorinterface.getid.php - */ - public function getId(); - - /** - * Returns the MongoDB\Driver\Server associated with this cursor. - * This is the server that executed the MongoDB\Driver\Query or MongoDB\Driver\Command. - * @link https://www.php.net/manual/en/mongodb-driver-cursorinterface.getserver.php - * @return Server Returns the MongoDB\Driver\Server associated with this cursor. - * @throws InvalidArgumentException - */ - public function getServer(); - - /** - * Checks whether the cursor may have additional results available to read. - * @link https://www.php.net/manual/en/mongodb-driver-cursorinterface.isdead.php - * @return bool Returns TRUE if additional results are not available, and FALSE otherwise. - * @throws InvalidArgumentException - */ - public function isDead(); - - /** - * Sets a type map to use for BSON unserialization - * @link https://www.php.net/manual/en/mongodb-driver-cursorinterface.settypemap.php - * @param array $typemap Type map configuration. - * @return mixed - * @throws InvalidArgumentException - */ - public function setTypeMap(array $typemap); - - /** - * Iterates the cursor and returns its results in an array. - * MongoDB\Driver\CursorInterface::setTypeMap() may be used to control how documents are unserialized into PHP values. - * @return array Returns an array containing all results for this cursor. - * @throws InvalidArgumentException - */ - public function toArray(); - } - - /** - * The MongoDB\Driver\ClientEncryption class handles creation of data keys for client-side encryption, as well as manually encrypting and decrypting values. - * @link https://www.php.net/manual/en/class.mongodb-driver-clientencryption.php - * @since 1.7.0 - */ - final class ClientEncryption - { - public const AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC = 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'; - public const AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM = 'AEAD_AES_256_CBC_HMAC_SHA_512-Random'; - - final private function __construct() {} - - final public function __wakeup() {} - - /** - * Creates a new key document and inserts into the key vault collection. - * @link https://www.php.net/manual/en/mongodb-driver-clientencryption.createdatakey.php - * @param string $kmsProvider The KMS provider ("local" or "aws") that will be used to encrypt the new encryption key. - * @param array $options [optional] - * @return \MongoDB\BSON\Binary Returns the identifier of the new key as a MongoDB\BSON\Binary object with subtype 4 (UUID). - * @throws InvalidArgumentException On argument parsing errors. - * @throws EncryptionException If an error occurs while creating the data key. - */ - final public function createDataKey($kmsProvider, ?array $options = []) {} - - /** - * Decrypts an encrypted value (BSON binary of subtype 6). - * @link https://www.php.net/manual/en/mongodb-driver-clientencryption.decrypt.php - * @param \MongoDB\BSON\BinaryInterface $keyVaultClient A MongoDB\BSON\Binary instance with subtype 6 containing the encrypted value. - * @return mixed Returns the decrypted value - * @throws InvalidArgumentException On argument parsing errors. - * @throws EncryptionException If an error occurs while decrypting the value. - */ - final public function decrypt(\MongoDB\BSON\BinaryInterface $keyVaultClient) {} - - /** - * Encrypts a value with a given key and algorithm. - * @link https://www.php.net/manual/en/mongodb-driver-clientencryption.encrypt.php - * @param mixed $value The value to be encrypted. Any value that can be inserted into MongoDB can be encrypted using this method. - * @param array $options [optional] - * @return \MongoDB\BSON\Binary Returns the encrypted value as MongoDB\BSON\Binary object with subtype 6. - * @throws InvalidArgumentException On argument parsing errors. - * @throws EncryptionException If an error occurs while encrypting the value. - */ - final public function encrypt($value, ?array $options = []) {} - } - } - -namespace MongoDB\Driver\Exception { - use MongoDB\Driver\WriteResult; - use Throwable; - - /** - * Thrown when the driver encounters a runtime error (e.g. internal error from » libmongoc). - * @link https://php.net/manual/en/class.mongodb-driver-exception-runtimeexception.php - * @since 1.0.0 - */ - class RuntimeException extends \RuntimeException implements Exception - { - /** - * @var bool - * @since 1.6.0 - */ - protected $errorLabels; - - /** - * Whether the given errorLabel is associated with this exception - * - * @param string $label - * @return bool - *@since 1.6.0 - */ - final public function hasErrorLabel($label) {} - } - - /** - * Common interface for all driver exceptions. This may be used to catch only exceptions originating from the driver itself. - * @link https://php.net/manual/en/class.mongodb-driver-exception-exception.php - */ - interface Exception extends Throwable {} - - /** - * Thrown when the driver fails to authenticate with the server. - * @link https://php.net/manual/en/class.mongodb-driver-exception-authenticationexception.php - * @since 1.0.0 - */ - class AuthenticationException extends ConnectionException implements Exception {} - - /** - * Base class for exceptions thrown when the driver fails to establish a database connection. - * @link https://php.net/manual/en/class.mongodb-driver-exception-connectionexception.php - * @since 1.0.0 - */ - class ConnectionException extends RuntimeException implements Exception {} - - /** - * Thrown when a driver method is given invalid arguments (e.g. invalid option types). - * @link https://php.net/manual/en/class.mongodb-driver-exception-invalidargumentexception.php - * @since 1.0.0 - */ - class InvalidArgumentException extends \InvalidArgumentException implements Exception {} - - /** - * Thrown when a command fails - * - * @link https://php.net/manual/en/class.mongodb-driver-exception-commandexception.php - * @since 1.5.0 - */ - class CommandException extends ServerException - { - protected $resultDocument; - - /** - * Returns the result document for the failed command - * @link https://secure.php.net/manual/en/mongodb-driver-commandexception.getresultdocument.php - * @return object - * @since 1.5.0 - */ - final public function getResultDocument() {} - } - - /** - * Base class for exceptions thrown by the server. The code of this exception and its subclasses will correspond to the original - * error code from the server. - * - * @link https://secure.php.net/manual/en/class.mongodb-driver-exception-serverexception.php - * @since 1.5.0 - */ - class ServerException extends RuntimeException implements Exception {} - - /** - * Base class for exceptions thrown by a failed write operation. - * The exception encapsulates a MongoDB\Driver\WriteResult object. - * @link https://php.net/manual/en/class.mongodb-driver-exception-writeexception.php - * @since 1.0.0 - */ - abstract class WriteException extends ServerException implements Exception - { - /** - * @var WriteResult associated with the failed write operation. - */ - protected $writeResult; - - /** - * @return WriteResult for the failed write operation - * @since 1.0.0 - */ - final public function getWriteResult() {} - } - - class WriteConcernException extends RuntimeException implements Exception {} - - /** - * Thrown when the driver encounters an unexpected value (e.g. during BSON serialization or deserialization). - * @link https://php.net/manual/en/class.mongodb-driver-exception-unexpectedvalueexception.php - * @since 1.0.0 - */ - class UnexpectedValueException extends \UnexpectedValueException implements Exception {} - - /** - * Thrown when a bulk write operation fails. - * @link https://php.net/manual/en/class.mongodb-driver-exception-bulkwriteexception.php - * @since 1.0.0 - */ - class BulkWriteException extends WriteException implements Exception {} - - /** - * Thrown when the driver fails to establish a database connection within a specified time limit (e.g. connectTimeoutMS). - * @link https://php.net/manual/en/class.mongodb-driver-exception-connectiontimeoutexception.php - */ - class ConnectionTimeoutException extends ConnectionException implements Exception {} - - /** - * Thrown when a query or command fails to complete within a specified time limit (e.g. maxTimeMS). - * @link https://php.net/manual/en/class.mongodb-driver-exception-executiontimeoutexception.php - */ - class ExecutionTimeoutException extends ServerException implements Exception {} - - /** - * Thrown when the driver is incorrectly used (e.g. rewinding a cursor). - * @link https://php.net/manual/en/class.mongodb-driver-exception-logicexception.php - */ - class LogicException extends \LogicException implements Exception {} - - /** - * Thrown when the driver fails to establish an SSL connection with the server. - * @link https://php.net/manual/en/class.mongodb-driver-exception-sslconnectionexception.php - */ - class SSLConnectionException extends ConnectionException implements Exception {} - - /** - * Base class for exceptions thrown during client-side encryption. - * @link https://php.net/manual/en/class.mongodb-driver-exception-encryptionexception.php - * @since 1.7.0 - */ - class EncryptionException extends RuntimeException implements Exception {} - } - -/** - * @link https://secure.php.net/manual/en/mongodb.monitoring.php - */ - -namespace MongoDB\Driver\Monitoring { - /** - * Registers a new monitoring event subscriber with the driver. - * Registered subscribers will be notified of monitoring events through specific methods. - * Note: If the object is already registered, this function is a no-op. - * @link https://secure.php.net/manual/en/function.mongodb.driver.monitoring.addsubscriber.php - * @param Subscriber $subscriber A monitoring event subscriber object to register. - * @return void - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - function addSubscriber(Subscriber $subscriber) {} - - /** - * Unregisters an existing monitoring event subscriber from the driver. - * Unregistered subscribers will no longer be notified of monitoring events. - * Note: If the object is not registered, this function is a no-op. - * @link https://secure.php.net/manual/en/function.mongodb.driver.monitoring.removesubscriber.php - * @param Subscriber $subscriber A monitoring event subscriber object to register. - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - function removeSubscriber(Subscriber $subscriber) {} - - /** - * Base interface for event subscribers. - * This is used for type-hinting MongoDB\Driver\Monitoring\addSubscriber() and MongoDB\Driver\Monitoring\removeSubscriber() and should not be implemented directly. - * This interface has no methods. Its only purpose is to be the base interface for all event subscribers. - * @link https://secure.php.net/manual/en/class.mongodb-driver-monitoring-subscriber.php - * @since 1.3.0 - */ - interface Subscriber {} - - /** - * Classes may implement this interface to register an event subscriber that is notified for each started, successful, and failed command event. - * @see https://secure.php.net/manual/en/mongodb.tutorial.apm.php - * @link https://secure.php.net/manual/en/class.mongodb-driver-monitoring-commandsubscriber.php - * @since 1.3.0 - */ - interface CommandSubscriber extends Subscriber - { - /** - * Notification method for a failed command. - * If the subscriber has been registered with MongoDB\Driver\Monitoring\addSubscriber(), the driver will call this method when a command has failed. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandsubscriber.commandfailed.php - * @param CommandFailedEvent $event An event object encapsulating information about the failed command. - * @return void - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - public function commandFailed(CommandFailedEvent $event); - - /** - * Notification method for a started command. - * If the subscriber has been registered with MongoDB\Driver\Monitoring\addSubscriber(), the driver will call this method when a command has started. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandsubscriber.commandstarted.php - * @param CommandStartedEvent $event An event object encapsulating information about the started command. - * @return void - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - public function commandStarted(CommandStartedEvent $event); - - /** - * Notification method for a successful command. - * If the subscriber has been registered with MongoDB\Driver\Monitoring\addSubscriber(), the driver will call this method when a command has succeeded. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandsubscriber.commandsucceeded.php - * @param CommandSucceededEvent $event An event object encapsulating information about the successful command. - * @return void - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - public function commandSucceeded(CommandSucceededEvent $event); - } - - /** - * Encapsulates information about a successful command. - * @link https://secure.php.net/manual/en/class.mongodb-driver-monitoring-commandsucceededevent.php - * @since 1.3.0 - */ - class CommandSucceededEvent - { - final private function __construct() {} - - final public function __wakeup() {} - - /** - * Returns the command name. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandsucceededevent.getcommandname.php - * @return string The command name (e.g. "find", "aggregate"). - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - final public function getCommandName() {} - - /** - * Returns the command's duration in microseconds - * The command's duration is a calculated value that includes the time to send the message and receive the reply from the server. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandsucceededevent.getdurationmicros.php - * @return int the command's duration in microseconds. - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - final public function getDurationMicros() {} - - /** - * Returns the command's operation ID. - * The operation ID is generated by the driver and may be used to link events together such as bulk write operations, which may have been split across several commands at the protocol level. - * Note: Since multiple commands may share the same operation ID, it is not reliable to use this value to associate event objects with each other. The request ID returned by MongoDB\Driver\Monitoring\CommandSucceededEvent::getRequestId() should be used instead. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandsucceededevent.getoperationid.php - * @return string the command's operation ID. - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - final public function getOperationId() {} - - /** - * Returns the command reply document. - * The reply document will be converted from BSON to PHP using the default deserialization rules (e.g. BSON documents will be converted to stdClass). - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandsucceededevent.getreply.php - * @return object the command reply document as a stdClass object. - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - final public function getReply() {} - - /** - * Returns the command's request ID. - * The request ID is generated by the driver and may be used to associate this CommandSucceededEvent with a previous CommandStartedEvent. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandsucceededevent.getrequestid.php - * @return string the command's request ID. - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - final public function getRequestId() {} - - /** - * Returns the Server on which the command was executed. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandsucceededevent.getserver.php - * @return \MongoDB\Driver\Server on which the command was executed. - * @since 1.3.0 - */ - final public function getServer() {} - } - - /** - * Encapsulates information about a failed command. - * @link https://secure.php.net/manual/en/class.mongodb-driver-monitoring-commandfailedevent.php - * @since 1.3.0 - */ - class CommandFailedEvent - { - final private function __construct() {} - - final public function __wakeup() {} - - /** - * Returns the command name. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandfailedevent.getcommandname.php - * @return string The command name (e.g. "find", "aggregate"). - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - final public function getCommandName() {} - - /** - * Returns the command's duration in microseconds - * The command's duration is a calculated value that includes the time to send the message and receive the reply from the server. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandfailedevent.getdurationmicros.php - * @return int the command's duration in microseconds. - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - final public function getDurationMicros() {} - - /** - * Returns the Exception associated with the failed command - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandfailedevent.geterror.php - * @return \Exception - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - final public function getError() {} - - /** - * Returns the command's operation ID. - * The operation ID is generated by the driver and may be used to link events together such as bulk write operations, which may have been split across several commands at the protocol level. - * Note: Since multiple commands may share the same operation ID, it is not reliable to use this value to associate event objects with each other. The request ID returned by MongoDB\Driver\Monitoring\CommandSucceededEvent::getRequestId() should be used instead. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandfailedevent.getoperationid.php - * @return string the command's operation ID. - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - final public function getOperationId() {} - - /** - * Returns the command reply document. - * The reply document will be converted from BSON to PHP using the default deserialization rules (e.g. BSON documents will be converted to stdClass). - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandfailedevent.getreply.php - * @return object the command reply document as a stdClass object. - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - final public function getReply() {} - - /** - * Returns the command's request ID. - * The request ID is generated by the driver and may be used to associate this CommandSucceededEvent with a previous CommandStartedEvent. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandfailedevent.getrequestid.php - * @return string the command's request ID. - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - final public function getRequestId() {} - - /** - * Returns the Server on which the command was executed. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandfailedevent.getserver.php - * @return \MongoDB\Driver\Server on which the command was executed. - * @since 1.3.0 - */ - final public function getServer() {} - } - - /** - * Encapsulates information about a failed command. - * @link https://secure.php.net/manual/en/class.mongodb-driver-monitoring-commandstartedevent.php - * @since 1.3.0 - */ - class CommandStartedEvent - { - final private function __construct() {} - - final public function __wakeup() {} - - /** - * Returns the command document - * The reply document will be converted from BSON to PHP using the default deserialization rules (e.g. BSON documents will be converted to stdClass). - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandstartedevent.getcommand.php - * @return object the command document as a stdClass object. - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - final public function getCommand() {} - - /** - * Returns the command name. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandstartedevent.getcommandname.php - * @return string The command name (e.g. "find", "aggregate"). - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - final public function getCommandName() {} - - /** - * Returns the database on which the command was executed. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandstartedevent.getdatabasename.php - * @return string the database on which the command was executed. - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - final public function getDatabaseName() {} - - /** - * Returns the command's operation ID. - * The operation ID is generated by the driver and may be used to link events together such as bulk write operations, which may have been split across several commands at the protocol level. - * Note: Since multiple commands may share the same operation ID, it is not reliable to use this value to associate event objects with each other. The request ID returned by MongoDB\Driver\Monitoring\CommandSucceededEvent::getRequestId() should be used instead. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandstartedevent.getoperationid.php - * @return string the command's operation ID. - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - final public function getOperationId() {} - - /** - * Returns the command's request ID. - * The request ID is generated by the driver and may be used to associate this CommandSucceededEvent with a previous CommandStartedEvent. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandstartedevent.getrequestid.php - * @return string the command's request ID. - * @throws \InvalidArgumentException on argument parsing errors. - * @since 1.3.0 - */ - final public function getRequestId() {} - - /** - * Returns the Server on which the command was executed. - * @link https://secure.php.net/manual/en/mongodb-driver-monitoring-commandstartedevent.getserver.php - * @return \MongoDB\Driver\Server on which the command was executed. - * @since 1.3.0 - */ - final public function getServer() {} - } - } - -/** - * @link https://php.net/manual/en/book.bson.php - */ - -namespace MongoDB\BSON { - use DateTime; - use DateTimeInterface; - use JetBrains\PhpStorm\Deprecated; - use JsonSerializable; - use MongoDB\Driver\Exception\InvalidArgumentException; - use MongoDB\Driver\Exception\UnexpectedValueException; - - /** - * Converts a BSON string to its Canonical Extended JSON representation. - * The canonical format prefers type fidelity at the expense of concise output and is most suited for producing - * output that can be converted back to BSON without any loss of type information - * (e.g. numeric types will remain differentiated). - * @link https://www.php.net/manual/en/function.mongodb.bson-tocanonicalextendedjson.php - * @param string $bson BSON value to be converted - * @return string The converted JSON value - * @throws UnexpectedValueException - */ - function toCanonicalExtendedJSON($bson) {} - - /** - * Converts a BSON string to its » Relaxed Extended JSON representation. - * The relaxed format prefers use of JSON type primitives at the expense of type fidelity and is most suited for - * producing output that can be easily consumed by web APIs and humans. - * @link https://www.php.net/manual/en/function.mongodb.bson-torelaxedextendedjson.php - * @param string $bson BSON value to be converted - * @return string The converted JSON value - * @throws UnexpectedValueException - */ - function toRelaxedExtendedJSON($bson) {} - - /** - * Returns the BSON representation of a JSON value - * Converts an extended JSON string to its BSON representation. - * @link https://php.net/manual/en/function.mongodb.bson-fromjson.php - * @param string $json JSON value to be converted. - * @return string The serialized BSON document as a binary string. - * @throws UnexpectedValueException if the JSON value cannot be converted to BSON (e.g. due to a syntax error). - */ - function fromJSON($json) {} - - /** - * Returns the BSON representation of a PHP value - * Serializes a PHP array or object (e.g. document) to its BSON representation. The returned binary string will describe a BSON document. - * @link https://php.net/manual/en/function.mongodb.bson-fromphp.php - * @param array|object $value PHP value to be serialized. - * @return string The serialized BSON document as a binary string - * @throws UnexpectedValueException if the PHP value cannot be converted to BSON. - */ - function fromPHP($value) {} - - /** - * Returns the JSON representation of a BSON value - * Converts a BSON string to its extended JSON representation. - * @link https://php.net/manual/en/function.mongodb.bson-tojson.php - * @param string $bson BSON value to be converted - * @return string The converted JSON value. - * @see https://docs.mongodb.org/manual/reference/mongodb-extended-json/ - * @throws UnexpectedValueException if the input did not contain exactly one BSON document - */ - function toJSON($bson) {} - - /** - * Returns the PHP representation of a BSON value - * Unserializes a BSON document (i.e. binary string) to its PHP representation. - * The typeMap parameter may be used to control the PHP types used for converting BSON arrays and documents (both root and embedded). - * @link https://php.net/manual/en/function.mongodb.bson-tophp.php - * @param string $bson BSON value to be unserialized. - * @param array $typemap - * @return object The unserialized PHP value - * @throws UnexpectedValueException if the input did not contain exactly one BSON document. - * @throws InvalidArgumentException if a class in the type map cannot be instantiated or does not implement MongoDB\BSON\Unserializable. - */ - function toPHP($bson, array $typemap = []) {} - - /** - * Class Binary - * @link https://php.net/manual/en/class.mongodb-bson-binary.php - */ - final class Binary implements Type, BinaryInterface, \Serializable, JsonSerializable - { - public const TYPE_GENERIC = 0; - public const TYPE_FUNCTION = 1; - public const TYPE_OLD_BINARY = 2; - public const TYPE_OLD_UUID = 3; - public const TYPE_UUID = 4; - public const TYPE_MD5 = 5; - - /** - * @since 1.7.0 - */ - public const TYPE_ENCRYPTED = 6; - public const TYPE_USER_DEFINED = 128; - - /** - * Binary constructor. - * @link https://php.net/manual/en/mongodb-bson-binary.construct.php - * @param string $data - * @param int $type - */ - final public function __construct($data, $type) {} - - /** - * Returns the Binary's data - * @link https://php.net/manual/en/mongodb-bson-binary.getdata.php - * @return string - */ - final public function getData() {} - - /** - * Returns the Binary's type - * @link https://php.net/manual/en/mongodb-bson-binary.gettype.php - * @return int - */ - final public function getType() {} - - public static function __set_state(array $properties) {} - - /** - * Returns the Binary's data - * @link https://www.php.net/manual/en/mongodb-bson-binary.tostring.php - * @return string - */ - final public function __toString() {} - - /** - * Serialize a Binary - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-binary.serialize.php - * @return string - * @throws InvalidArgumentException - */ - final public function serialize() {} - - /** - * Unserialize a Binary - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-binary.unserialize.php - * @param string $serialized - * @return void - * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid - * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) - */ - final public function unserialize($serialized) {} - - /** - * Returns a representation that can be converted to JSON - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-binary.jsonserialize.php - * @return mixed data which can be serialized by json_encode() - * @throws InvalidArgumentException on argument parsing errors - */ - final public function jsonSerialize() {} - } - - /** - * 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. - * @link https://php.net/manual/en/class.mongodb-bson-decimal128.php - */ - final class Decimal128 implements Type, Decimal128Interface, \Serializable, JsonSerializable - { - /** - * Construct a new Decimal128 - * @link https://php.net/manual/en/mongodb-bson-decimal128.construct.php - * @param string $value A decimal string. - */ - final public function __construct($value = '') {} - - /** - * Returns the string representation of this Decimal128 - * @link https://php.net/manual/en/mongodb-bson-decimal128.tostring.php - * @return string - */ - final public function __toString() {} - - public static function __set_state(array $properties) {} - - /** - * Serialize a Decimal128 - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-decimal128.serialize.php - * @return string - * @throws InvalidArgumentException - */ - final public function serialize() {} - - /** - * Unserialize a Decimal128 - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-decimal128.unserialize.php - * @param string $serialized - * @return void - * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid - * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) - */ - final public function unserialize($serialized) {} - - /** - * Returns a representation that can be converted to JSON - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-decimal128.jsonserialize.php - * @return mixed data which can be serialized by json_encode() - * @throws InvalidArgumentException on argument parsing errors - */ - final public function jsonSerialize() {} - } - - /** - * Class Javascript - * @link https://php.net/manual/en/class.mongodb-bson-javascript.php - */ - final class Javascript implements Type, JavascriptInterface, \Serializable, JsonSerializable - { - /** - * Construct a new Javascript - * @link https://php.net/manual/en/mongodb-bson-javascript.construct.php - * @param string $javascript - * @param array|object $scope - */ - final public function __construct($javascript, $scope = []) {} - - public static function __set_state(array $properties) {} - - /** - * Returns the Javascript's code - * @return string - * @link https://secure.php.net/manual/en/mongodb-bson-javascript.getcode.php - */ - final public function getCode() {} - - /** - * Returns the Javascript's scope document - * @return object|null - * @link https://secure.php.net/manual/en/mongodb-bson-javascript.getscope.php - */ - final public function getScope() {} - - /** - * Returns the Javascript's code - * @return string - * @link https://secure.php.net/manual/en/mongodb-bson-javascript.tostring.php - */ - final public function __toString() {} - - /** - * Serialize a Javascript - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-javascript.serialize.php - * @return string - * @throws InvalidArgumentException - */ - final public function serialize() {} - - /** - * Unserialize a Javascript - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-javascript.unserialize.php - * @param string $serialized - * @return void - * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid - * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) - */ - final public function unserialize($serialized) {} - - /** - * Returns a representation that can be converted to JSON - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-javascript.jsonserialize.php - * @return mixed data which can be serialized by json_encode() - * @throws InvalidArgumentException on argument parsing errors - */ - final public function jsonSerialize() {} - } - - /** - * Class MaxKey - * @link https://php.net/manual/en/class.mongodb-bson-maxkey.php - */ - final class MaxKey implements Type, MaxKeyInterface, \Serializable, JsonSerializable - { - public static function __set_state(array $properties) {} - - /** - * Serialize a MaxKey - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-maxkey.serialize.php - * @return string - * @throws InvalidArgumentException - */ - final public function serialize() {} - - /** - * Unserialize a MaxKey - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-maxkey.unserialize.php - * @param string $serialized - * @return void - * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid - * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) - */ - final public function unserialize($serialized) {} - - /** - * Returns a representation that can be converted to JSON - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-maxkey.jsonserialize.php - * @return mixed data which can be serialized by json_encode() - * @throws InvalidArgumentException on argument parsing errors - */ - final public function jsonSerialize() {} - } - - /** - * Class MinKey - * @link https://php.net/manual/en/class.mongodb-bson-minkey.php - */ - final class MinKey implements Type, MinKeyInterface, \Serializable, JsonSerializable - { - public static function __set_state(array $properties) {} - - /** - * Serialize a MinKey - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-minkey.serialize.php - * @return string - * @throws InvalidArgumentException - */ - final public function serialize() {} - - /** - * Unserialize a MinKey - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-minkey.unserialize.php - * @param string $serialized - * @return void - * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid - * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) - */ - final public function unserialize($serialized) {} - - /** - * Returns a representation that can be converted to JSON - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-minkey.jsonserialize.php - * @return mixed data which can be serialized by json_encode() - * @throws InvalidArgumentException on argument parsing errors - */ - final public function jsonSerialize() {} - } - - /** - * Class ObjectId - * @link https://php.net/manual/en/class.mongodb-bson-objectid.php - */ - final class ObjectId implements Type, ObjectIdInterface, \Serializable, JsonSerializable - { - /** - * Construct a new ObjectId - * @link https://php.net/manual/en/mongodb-bson-objectid.construct.php - * @param string|null $id A 24-character hexadecimal string. If not provided, the driver will generate an ObjectId. - * @throws InvalidArgumentException if id is not a 24-character hexadecimal string. - */ - final public function __construct($id = null) {} - - /** - * Returns the hexadecimal representation of this ObjectId - * @link https://php.net/manual/en/mongodb-bson-objectid.tostring.php - * @return string - */ - final public function __toString() {} - - public static function __set_state(array $properties) {} - - /** - * Returns the timestamp component of this ObjectId - * @since 1.2.0 - * @link https://secure.php.net/manual/en/mongodb-bson-objectid.gettimestamp.php - * @return int the timestamp component of this ObjectId - */ - final public function getTimestamp() {} - - /** - * Returns a representation that can be converted to JSON - * @since 1.2.0 - * @link https://secure.php.net/manual/en/mongodb-bson-objectid.jsonserialize.php - * @return mixed data which can be serialized by json_encode() - */ - final public function jsonSerialize() {} - - /** - * Serialize an ObjectId - * @since 1.2.0 - * @link https://secure.php.net/manual/en/mongodb-bson-objectid.serialize.php - * @return string the serialized representation of the object - */ - final public function serialize() {} - - /** - * Unserialize an ObjectId - * @since 1.2.0 - * @link https://secure.php.net/manual/en/mongodb-bson-objectid.unserialize.php - * @return void - */ - final public function unserialize($serialized) {} - } - - /** - * Class Regex - * @link https://php.net/manual/en/class.mongodb-bson-regex.php - */ - final class Regex implements Type, RegexInterface, \Serializable, JsonSerializable - { - /** - * Construct a new Regex - * @link https://php.net/manual/en/mongodb-bson-regex.construct.php - * @param string $pattern - * @param string $flags [optional] - */ - final public function __construct($pattern, $flags = "") {} - - /** - * Returns the Regex's flags - * @link https://php.net/manual/en/mongodb-bson-regex.getflags.php - */ - final public function getFlags() {} - - /** - * Returns the Regex's pattern - * @link https://php.net/manual/en/mongodb-bson-regex.getpattern.php - * @return string - */ - final public function getPattern() {} - - /** - * Returns the string representation of this Regex - * @link https://php.net/manual/en/mongodb-bson-regex.tostring.php - * @return string - */ - final public function __toString() {} - - public static function __set_state(array $properties) {} - - /** - * Serialize a Regex - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-regex.serialize.php - * @return string - * @throws InvalidArgumentException - */ - final public function serialize() {} - - /** - * Unserialize a Regex - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-regex.unserialize.php - * @param string $serialized - * @return void - * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid - * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) - */ - final public function unserialize($serialized) {} - - /** - * Returns a representation that can be converted to JSON - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-regex.jsonserialize.php - * @return mixed data which can be serialized by json_encode() - * @throws InvalidArgumentException on argument parsing errors - */ - final public function jsonSerialize() {} - } - - /** - * Represents a BSON timestamp, which is an internal MongoDB type not intended for general date storage. - * @link https://php.net/manual/en/class.mongodb-bson-timestamp.php - */ - final class Timestamp implements TimestampInterface, Type, \Serializable, JsonSerializable - { - /** - * Construct a new Timestamp - * @link https://php.net/manual/en/mongodb-bson-timestamp.construct.php - * @param int $increment - * @param int $timestamp - */ - final public function __construct($increment, $timestamp) {} - - /** - * Returns the string representation of this Timestamp - * @link https://php.net/manual/en/mongodb-bson-timestamp.tostring.php - * @return string - */ - final public function __toString() {} - - public static function __set_state(array $properties) {} - - /** - * Returns the increment component of this TimestampInterface - * @link https://secure.php.net/manual/en/mongodb-bson-timestampinterface.getincrement.php - * @return int - * @since 1.3.0 - */ - final public function getIncrement() {} - - /** - * Returns the timestamp component of this TimestampInterface - * @link https://secure.php.net/manual/en/mongodb-bson-timestampinterface.gettimestamp.php - * @return int - * @since 1.3.0 - */ - final public function getTimestamp() {} - - /** - * Serialize a Timestamp - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-timestamp.serialize.php - * @return string - * @throws InvalidArgumentException - */ - final public function serialize() {} - - /** - * Unserialize a Timestamp - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-timestamp.unserialize.php - * @param string $serialized - * @return void - * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid - * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) - */ - final public function unserialize($serialized) {} - - /** - * Returns a representation that can be converted to JSON - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-timestamp.jsonserialize.php - * @return mixed data which can be serialized by json_encode() - * @throws InvalidArgumentException on argument parsing errors - */ - final public function jsonSerialize() {} - } - - /** - * Represents a BSON date. - * @link https://php.net/manual/en/class.mongodb-bson-utcdatetime.php - */ - final class UTCDateTime implements Type, UTCDateTimeInterface, \Serializable, \JsonSerializable - { - /** - * Construct a new UTCDateTime - * @link https://php.net/manual/en/mongodb-bson-utcdatetime.construct.php - * @param int|float|string|DateTimeInterface $milliseconds - */ - final public function __construct($milliseconds = null) {} - - public static function __set_state(array $properties) {} - - /** - * Returns the DateTime representation of this UTCDateTime - * @link https://php.net/manual/en/mongodb-bson-utcdatetime.todatetime.php - * @return \DateTime - */ - final public function toDateTime() {} - - /** - * Returns the string representation of this UTCDateTime - * @link https://php.net/manual/en/mongodb-bson-utcdatetime.tostring.php - * @return string - */ - final public function __toString() {} - - /** - * Serialize a UTCDateTime - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-utcdatetime.serialize.php - * @return string - * @throws InvalidArgumentException - */ - final public function serialize() {} - - /** - * Unserialize a UTCDateTime - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-utcdatetime.unserialize.php - * @param string $serialized - * @return void - * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid - * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) - */ - final public function unserialize($serialized) {} - - /** - * Returns a representation that can be converted to JSON - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-utcdatetime.jsonserialize.php - * @return mixed data which can be serialized by json_encode() - * @throws InvalidArgumentException on argument parsing errors - */ - final public function jsonSerialize() {} - } - - /** - * BSON type for the "Undefined" type. This BSON type is deprecated, and this class can not be instantiated. It will be created - * from a BSON undefined type while converting BSON to PHP, and can also be converted back into BSON while storing documents in the database. - * - * @link https://secure.php.net/manual/en/class.mongodb-bson-undefined.php - */ - #[Deprecated] - final class Undefined implements Type, \Serializable, \JsonSerializable - { - final private function __construct() {} - - /** - * Serialize an Undefined - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-undefined.serialize.php - * @return string - * @throws InvalidArgumentException - */ - final public function serialize() {} - - /** - * Unserialize an Undefined - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-undefined.unserialize.php - * @param string $serialized - * @return void - * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid - * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) - */ - final public function unserialize($serialized) {} - - /** - * Returns a representation that can be converted to JSON - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-undefined.jsonserialize.php - * @return mixed data which can be serialized by json_encode() - * @throws InvalidArgumentException on argument parsing errors - */ - final public function jsonSerialize() {} - - /** - * Returns the Undefined as a string - * @return string Returns the string representation of this Symbol. - */ - final public function __toString() {} - } - - /** - * BSON type for the "Symbol" type. This BSON type is deprecated, and this class can not be instantiated. It will be created from a - * BSON symbol type while converting BSON to PHP, and can also be converted back into BSON while storing documents in the database. - * - * @link https://secure.php.net/manual/en/class.mongodb-bson-symbol.php - */ - #[Deprecated] - final class Symbol implements Type, \Serializable, \JsonSerializable - { - final private function __construct() {} - - /** - * Serialize a Symbol - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-symbol.serialize.php - * @return string - * @throws InvalidArgumentException - */ - final public function serialize() {} - - /** - * Unserialize a Symbol - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-symbol.unserialize.php - * @param string $serialized - * @return void - * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid - * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) - */ - final public function unserialize($serialized) {} - - /** - * Returns a representation that can be converted to JSON - * @since 1.2.0 - * @link https://www.php.net/manual/en/mongodb-bson-symbol.jsonserialize.php - * @return mixed data which can be serialized by json_encode() - * @throws InvalidArgumentException on argument parsing errors - */ - final public function jsonSerialize() {} - - /** - * Returns the Symbol as a string - * @return string Returns the string representation of this Symbol. - */ - final public function __toString() {} - } - - /** - * BSON type for the "DbPointer" type. This BSON type is deprecated, and this class can not be instantiated. It will be created from a - * BSON symbol type while converting BSON to PHP, and can also be converted back into BSON while storing documents in the database. - * - * @since 1.4.0 - * @link https://secure.php.net/manual/en/class.mongodb-bson-dbpointer.php - */ - #[Deprecated] - final class DBPointer implements Type, \Serializable, \JsonSerializable - { - final private function __construct() {} - - /** - * Serialize a DBPointer - * - * @link https://www.php.net/manual/en/mongodb-bson-dbpointer.serialize.php - * @return string - * @throws InvalidArgumentException - */ - final public function serialize() {} - - /** - * Unserialize a DBPointer - * - * @link https://www.php.net/manual/en/mongodb-bson-dbpointer.unserialize.php - * - * @param string $serialized - * - * @return void - * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid - * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) - */ - final public function unserialize($serialized) {} - - /** - * Returns a representation that can be converted to JSON - * - * @link https://www.php.net/manual/en/mongodb-bson-dbpointer.jsonserialize.php - * @return mixed data which can be serialized by json_encode() - * @throws InvalidArgumentException on argument parsing errors - */ - final public function jsonSerialize() {} - - /** - * Returns the Symbol as a string - * - * @return string Returns the string representation of this Symbol. - */ - final public function __toString() {} - } - - /** - * BSON type for a 64-bit integer. This class cannot be instantiated and is only created during BSON decoding when a 64-bit - * integer cannot be represented as a PHP integer on a 32-bit platform. Versions of the driver before 1.5.0 would throw an - * exception when attempting to decode a 64-bit integer on a 32-bit platform. - * During BSON encoding, objects of this class will convert back to a 64-bit integer type. This allows 64-bit integers to be - * roundtripped through a 32-bit PHP environment without any loss of precision. The __toString() method allows the 64-bit integer - * value to be accessed as a string. - * - * @since 1.5.0 - * @link https://secure.php.net/manual/en/class.mongodb-bson-int64.php - */ - #[Deprecated] - final class Int64 implements Type, \Serializable, \JsonSerializable - { - final private function __construct() {} - - /** - * Serialize an Int64 - * @link https://www.php.net/manual/en/mongodb-bson-int64.serialize.php - * @return string - * @throws InvalidArgumentException - */ - final public function serialize() {} - - /** - * Unserialize an Int64 - * @link https://www.php.net/manual/en/mongodb-bson-int64.unserialize.php - * @param string $serialized - * @return void - * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid - * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) - */ - final public function unserialize($serialized) {} - - /** - * Returns a representation that can be converted to JSON - * @link https://www.php.net/manual/en/mongodb-bson-int64.jsonserialize.php - * @return mixed data which can be serialized by json_encode() - * @throws InvalidArgumentException on argument parsing errors - */ - final public function jsonSerialize() {} - - /** - * Returns the Symbol as a string - * @return string Returns the string representation of this Symbol. - */ - final public function __toString() {} - } - - /** - * This interface is implemented by MongoDB\BSON\Binary but may also be used for type-hinting and userland classes. - * @link https://www.php.net/manual/en/class.mongodb-bson-binaryinterface.php - */ - interface BinaryInterface - { - /** - * @link https://www.php.net/manual/en/mongodb-bson-binaryinterface.getdata.php - * @return string Returns the BinaryInterface's data - */ - public function getData(); - - /** - * @link https://www.php.net/manual/en/mongodb-bson-binaryinterface.gettype.php - * @return int Returns the BinaryInterface's type. - */ - public function getType(); - - /** - * This method is an alias of: MongoDB\BSON\BinaryInterface::getData(). - * @link https://www.php.net/manual/en/mongodb-bson-binaryinterface.tostring.php - * @return string Returns the BinaryInterface's data. - */ - public function __toString(); - } - - /** - * This interface is implemented by MongoDB\BSON\ObjectId but may also be used for type-hinting and userland classes. - * @link https://www.php.net/manual/en/class.mongodb-bson-objectidinterface.php - */ - interface ObjectIdInterface - { - /** - * @link https://www.php.net/manual/en/mongodb-bson-objectidinterface.gettimestamp.php - * @return int Returns the timestamp component of this ObjectIdInterface. - */ - public function getTimestamp(); - - /** - * Returns the hexadecimal representation of this ObjectId - * @link https://www.php.net/manual/en/mongodb-bson-objectid.tostring.php - * @return string Returns the hexadecimal representation of this ObjectId - */ - public function __toString(); - } - - /** - * @link https://www.php.net/manual/en/class.mongodb-bson-regexinterface.php - * This interface is implemented by MongoDB\BSON\Regex but may also be used for type-hinting and userland classes. - */ - interface RegexInterface - { - /** - * @link https://www.php.net/manual/en/mongodb-bson-regexinterface.getflags.php - * @return string Returns the RegexInterface's flags. - */ - public function getFlags(); - - /** - * @link https://www.php.net/manual/en/mongodb-bson-regexinterface.getpattern.php - * @return string Returns the RegexInterface's pattern. - */ - public function getPattern(); - - /** - * Returns the string representation of this RegexInterface - * @link https://www.php.net/manual/en/mongodb-bson-regexinterface.tostring.php - * @return string - */ - public function __toString(); - } - - /** - * This interface is implemented by MongoDB\BSON\UTCDateTime but may also be used for type-hinting and userland classes. - * @link https://www.php.net/manual/en/class.mongodb-bson-utcdatetimeinterface.php - */ - interface UTCDateTimeInterface - { - /** - * @link https://www.php.net/manual/en/mongodb-bson-utcdatetimeinterface.todatetime.php - * @return DateTime Returns the DateTime representation of this UTCDateTimeInterface. The returned DateTime should use the UTC time zone. - */ - public function toDateTime(); - - /** - * Returns the string representation of this UTCDateTimeInterface - * @link https://www.php.net/manual/en/mongodb-bson-utcdatetimeinterface.tostring.php - * @return string - */ - public function __toString(); - } - - /** - * This interface is implemented by MongoDB\BSON\MaxKey but may also be used for type-hinting and userland classes. - * @link https://www.php.net/manual/en/class.mongodb-bson-maxkeyinterface.php - */ - interface MaxKeyInterface {} - - /** - * This interface is implemented by MongoDB\BSON\MinKey but may also be used for type-hinting and userland classes. - * @link https://www.php.net/manual/en/class.mongodb-bson-minkeyinterface.php - */ - interface MinKeyInterface {} - - /** - * This interface is implemented by MongoDB\BSON\Decimal128 but may also be used for type-hinting and userland classes. - * @link https://www.php.net/manual/en/class.mongodb-bson-decimal128interface.php - */ - interface Decimal128Interface - { - /** - * Returns the string representation of this Decimal128Interface - * @link https://www.php.net/manual/en/mongodb-bson-decimal128interface.tostring.php - * @return string Returns the string representation of this Decimal128Interface - */ - public function __toString(); - } - - /** - * Classes may implement this interface to take advantage of automatic ODM (object document mapping) behavior in the driver. - * @link https://php.net/manual/en/class.mongodb-bson-persistable.php - */ - interface Persistable extends Unserializable, Serializable {} - - /** - * Classes that implement this interface may return data to be serialized as a BSON array or document in lieu of the object's public properties - * @link https://php.net/manual/en/class.mongodb-bson-serializable.php - */ - interface Serializable extends Type - { - /** - * Provides an array or document to serialize as BSON - * Called during serialization of the object to BSON. The method must return an array or stdClass. - * Root documents (e.g. a MongoDB\BSON\Serializable passed to MongoDB\BSON\fromPHP()) will always be serialized as a BSON document. - * For field values, associative arrays and stdClass instances will be serialized as a BSON document and sequential arrays (i.e. sequential, numeric indexes starting at 0) will be serialized as a BSON array. - * @link https://php.net/manual/en/mongodb-bson-serializable.bsonserialize.php - * @return array|object An array or stdClass to be serialized as a BSON array or document. - */ - public function bsonSerialize(); - } - - /** - * Classes that implement this interface may be specified in a type map for unserializing BSON arrays and documents (both root and embedded). - * @link https://php.net/manual/en/class.mongodb-bson-unserializable.php - */ - interface Unserializable extends Type - { - /** - * Constructs the object from a BSON array or document - * Called during unserialization of the object from BSON. - * The properties of the BSON array or document will be passed to the method as an array. - * @link https://php.net/manual/en/mongodb-bson-unserializable.bsonunserialize.php - * @param array $data Properties within the BSON array or document. - */ - public function bsonUnserialize(array $data); - } - - /** - * Interface Type - * @link https://php.net/manual/en/class.mongodb-bson-type.php - */ - interface Type {} - - /** - * Interface TimestampInterface - * - * @link https://secure.php.net/manual/en/class.mongodb-bson-timestampinterface.php - * @since 1.3.0 - */ - interface TimestampInterface - { - /** - * Returns the increment component of this TimestampInterface - * @link https://secure.php.net/manual/en/mongodb-bson-timestampinterface.getincrement.php - * @return int - * @since 1.3.0 - */ - public function getIncrement(); - - /** - * Returns the timestamp component of this TimestampInterface - * @link https://secure.php.net/manual/en/mongodb-bson-timestampinterface.gettimestamp.php - * @return int - * @since 1.3.0 - */ - public function getTimestamp(); - - /** - * Returns the string representation of this TimestampInterface - * @link https://secure.php.net/manual/en/mongodb-bson-timestampinterface.tostring.php - * @return string - * @since 1.3.0 - */ - public function __toString(); - } - - /** - * Interface JavascriptInterface - * - * @link https://secure.php.net/manual/en/class.mongodb-bson-javascriptinterface.php - * @since 1.3.0 - */ - interface JavascriptInterface - { - /** - * Returns the JavascriptInterface's code - * @return string - * @link https://secure.php.net/manual/en/mongodb-bson-javascriptinterface.getcode.php - * @since 1.3.0 - */ - public function getCode(); - - /** - * Returns the JavascriptInterface's scope document - * @return object|null - * @link https://secure.php.net/manual/en/mongodb-bson-javascriptinterface.getscope.php - * @since 1.3.0 - */ - public function getScope(); - - /** - * Returns the JavascriptInterface's code - * @return string - * @link https://secure.php.net/manual/en/mongodb-bson-javascriptinterface.tostring.php - * @since 1.3.0 - */ - public function __toString(); - } - } - -namespace { - define('MONGODB_VERSION', '1.10.0'); - define('MONGODB_STABILITY', 'stable'); -} +define('MONGODB_VERSION', '1.16.0'); +define('MONGODB_STABILITY', 'stable'); diff --git a/openssl/openssl.php b/openssl/openssl.php index c3f0ed4fb..7dc000984 100644 --- a/openssl/openssl.php +++ b/openssl/openssl.php @@ -991,7 +991,7 @@ function openssl_pkcs7_sign( * @link https://php.net/manual/en/function.openssl-pkcs7-encrypt.php * @param string $input_filename * @param string $output_filename - * @param OpenSSLCertificate|string|resource $certificate

    + * @param OpenSSLCertificate|array|string|resource $certificate

    * Either a lone X.509 certificate, or an array of X.509 certificates. *

    * @param array|null $headers

    @@ -1013,7 +1013,14 @@ function openssl_pkcs7_sign( *

    * @return bool true on success or false on failure. */ -function openssl_pkcs7_encrypt(string $input_filename, string $output_filename, $certificate, ?array $headers, int $flags = 0, int $cipher_algo = OPENSSL_CIPHER_AES_128_CBC): bool {} +function openssl_pkcs7_encrypt( + string $input_filename, + string $output_filename, + #[LanguageLevelTypeAware(["8.0" => "OpenSSLCertificate|array|string"], default: "resource|array|string")] $certificate, + ?array $headers, + int $flags = 0, + int $cipher_algo = OPENSSL_CIPHER_AES_128_CBC +): bool {} /** * Encrypts data with private key @@ -1174,7 +1181,7 @@ function openssl_pkey_derive( *

    * @return string|false the generated string of bytes on success, or false on failure. */ -#[LanguageLevelTypeAware(["8.0" => "string"], default: "string|false")] +#[LanguageLevelTypeAware(["7.4" => "string"], default: "string|false")] function openssl_random_pseudo_bytes(int $length, &$strong_result) {} /** diff --git a/pam/pam.php b/pam/pam.php new file mode 100644 index 000000000..deef9dc6a --- /dev/null +++ b/pam/pam.php @@ -0,0 +1,49 @@ + + * The username to check. + *

    + * @param string $password

    + * The user-supplied password to check. + *

    + * @param string $error

    + * Output parameter to put any error messages in. + *

    + * @param bool $check_account_management

    + * Call pam_acct_mgmt() to check account expiration and access. (Requires root access!) + *

    + * @param string $service_name

    + * PAM service name to use. (Defaults to "php") + *

    + * @return bool Returns a bool when complete. If false, $error contains any error messages generated. + */ +#[Pure] +function pam_auth(string $username, string $password, string $error, bool $check_account_management = true, string $service_name = 'php') {} + +/** + * Change a password for a PAM unix account. + * + * @param string $username

    + * The username to check. + *

    + * @param string $old_password

    + * The current password for the account. + *

    + * @param string $new_password

    + * The new password for the account. + *

    + * @param string $error

    + * Output parameter to put any error messages in. + *

    + * @param string $service_name

    + * PAM service name to use. (Defaults to "php") + *

    + * @return bool Returns a bool when complete. If false, $error contains any error messages generated. + */ +#[Pure] +function pam_chpass(string $username, string $old_password, string $new_password, string $error, string $service_name = 'php') {} diff --git a/pgsql/pgsql.php b/pgsql/pgsql.php index 90d8ad290..91f899c0a 100644 --- a/pgsql/pgsql.php +++ b/pgsql/pgsql.php @@ -723,14 +723,15 @@ function pg_fetch_object( * while PGSQL_BOTH, the default, will return both * numerical and associative indices. *

    - * @return array An array with all rows in the result. Each row is an array + * @return array|false An array with all rows in the result. Each row is an array * of field values indexed by field name. *

    *

    * FALSE is returned if there are no rows in the result, or on any * other error. */ -function pg_fetch_all(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Result'], default: 'resource')] $result, int $mode = PGSQL_ASSOC): array {} +#[LanguageLevelTypeAware(['8.0' => 'array'], default: 'array|false')] +function pg_fetch_all(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Result'], default: 'resource')] $result, int $mode = PGSQL_ASSOC) {} /** * Fetches all rows in a particular result column as an array @@ -2065,8 +2066,8 @@ function pg_consume_input(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Connection'] */ function pg_flush(#[LanguageLevelTypeAware(['8.1' => 'PgSql\Connection'], default: 'resource')] $connection): int|bool {} -define('PGSQL_LIBPQ_VERSION', "14.5"); -define('PGSQL_LIBPQ_VERSION_STR', "14.5"); +define('PGSQL_LIBPQ_VERSION', "15.3"); +define('PGSQL_LIBPQ_VERSION_STR', "15.3"); /** * Passed to pg_connect to force the creation of a new connection, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 58866f106..2f1b27673 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,7 +7,6 @@ tests/BaseFunctionsTest.php tests/StubsMetaExpectedArgumentsTest.php tests/StubsMetaInternalTagTest.php - tests/StubsPhpDocTest.php tests/BaseClassesTest.php @@ -15,7 +14,6 @@ tests/BaseFunctionsTest.php tests/StubsMetaExpectedArgumentsTest.php tests/StubsMetaInternalTagTest.php - tests/StubsPhpDocTest.php tests/BaseClassesTest.php @@ -23,7 +21,6 @@ tests/BaseFunctionsTest.php tests/StubsMetaExpectedArgumentsTest.php tests/StubsMetaInternalTagTest.php - tests/StubsPhpDocTest.php tests/StubsForbiddenTypeHintsTest.php @@ -32,7 +29,6 @@ tests/BaseFunctionsTest.php tests/StubsMetaExpectedArgumentsTest.php tests/StubsMetaInternalTagTest.php - tests/StubsPhpDocTest.php tests/StubsForbiddenTypeHintsTest.php @@ -41,7 +37,6 @@ tests/BaseFunctionsTest.php tests/StubsMetaExpectedArgumentsTest.php tests/StubsMetaInternalTagTest.php - tests/StubsPhpDocTest.php tests/StubsForbiddenTypeHintsTest.php @@ -50,7 +45,6 @@ tests/BaseFunctionsTest.php tests/StubsMetaExpectedArgumentsTest.php tests/StubsMetaInternalTagTest.php - tests/StubsPhpDocTest.php tests/StubsForbiddenTypeHintsTest.php @@ -60,7 +54,6 @@ tests/StubsMetaExpectedArgumentsTest.php tests/StubsMetaInternalTagTest.php tests/StubsParameterNamesTest.php - tests/StubsPhpDocTest.php tests/StubsTypeHintsTest.php tests/StubsForbiddenTypeHintsTest.php @@ -71,7 +64,6 @@ tests/StubsMetaExpectedArgumentsTest.php tests/StubsMetaInternalTagTest.php tests/StubsParameterNamesTest.php - tests/StubsPhpDocTest.php tests/StubsTypeHintsTest.php tests/StubsForbiddenTypeHintsTest.php tests/StubsPhp81Tests.php @@ -84,7 +76,6 @@ tests/StubsMetaExpectedArgumentsTest.php tests/StubsMetaInternalTagTest.php tests/StubsParameterNamesTest.php - tests/StubsPhpDocTest.php tests/StubsTypeHintsTest.php tests/StubsForbiddenTypeHintsTest.php tests/StubsPhp81Tests.php diff --git a/random/random.php b/random/random.php index 0c1381119..d4201eb78 100644 --- a/random/random.php +++ b/random/random.php @@ -23,7 +23,7 @@ function lcg_value(): float {} * @return void */ function mt_srand( - int $seed = 0, + int $seed = null, #[PhpStormStubsElementAvailable(from: '7.1')] int $mode = MT_RAND_MT19937 ): void {} @@ -42,7 +42,7 @@ function mt_srand( * @return void */ function srand( - int $seed = 0, + int $seed = null, #[PhpStormStubsElementAvailable(from: '7.1')] int $mode = MT_RAND_MT19937 ): void {} diff --git a/redis/Redis.php b/redis/Redis.php index caabec813..f6146b689 100644 --- a/redis/Redis.php +++ b/redis/Redis.php @@ -5,13 +5,14 @@ /** * Helper autocomplete for php redis extension * - * @author Max Kamashev - * @link https://github.com/ukko/phpredis-phpdoc + * @link https://github.com/phpredis/phpredis/blob/develop/redis.stub.php */ class Redis { public const AFTER = 'after'; public const BEFORE = 'before'; + public const LEFT = 'left'; + public const RIGHT = 'right'; /** * Options @@ -25,6 +26,7 @@ class Redis public const OPT_COMPRESSION = 7; public const OPT_REPLY_LITERAL = 8; public const OPT_COMPRESSION_LEVEL = 9; + public const OPT_NULL_MULTIBULK_AS_NULL = 10; public const OPT_MAX_RETRIES = 11; public const OPT_BACKOFF_ALGORITHM = 12; public const OPT_BACKOFF_BASE = 13; @@ -86,7 +88,7 @@ class Redis public const PIPELINE = 2; /** - * Type + * Types */ public const REDIS_NOT_FOUND = 0; public const REDIS_STRING = 1; @@ -120,13 +122,26 @@ class Redis * // Starting from version 6.0.0 it's possible to specify configuration options. * // This allows to connect to the server without explicitly invoking connect command. * $redis = new Redis([ + * // If you do wish to connect via the constructor, only 'host' is strictly required, + * // which will cause PhpRedis to connect to that host on Redis' default port (6379). * 'host' => '127.0.0.1', * 'port' => 6379, + * 'readTimeout' => 2.5, * 'connectTimeout' => 2.5, + * 'persistent' => true, + * // Valid formats: NULL, ['user', 'pass'], 'pass', or ['pass'] * 'auth' => ['phpredis', 'phpredis'], + * // See PHP stream options for valid SSL configuration settings. * 'ssl' => ['verify_peer' => false], + * // How quickly to retry a connection after we time out or it closes. + * // Note that this setting is overridden by 'backoff' strategies. + * 'retryInterval' => 100, + * // Which backoff algorithm to use. 'decorrelated jitter' is likely the + * // bestone for most solution, but there are many to choose from * 'backoff' => [ * 'algorithm' => Redis::BACKOFF_ALGORITHM_DECORRELATED_JITTER, + * // 'base', and 'cap' are in milliseconds and represent the first delay redis will + * // use when reconnecting, and the maximum delay we will reach while retrying. * 'base' => 500, * 'cap' => 750, * ], @@ -140,10 +155,10 @@ public function __construct($options = null) {} * @param string $host can be a host, or the path to a unix domain socket * @param int $port optional * @param float $timeout value in seconds (optional, default is 0.0 meaning unlimited) - * @param string $persistent_id identity for the requested persistent connection + * @param string|null $persistent_id identity for the requested persistent connection * @param int $retry_interval retry interval in milliseconds. * @param float $read_timeout value in seconds (optional, default is 0 meaning unlimited) - * @param array $context since PhpRedis >= 5.3.0 can specify authentication and stream information on connect + * @param array|null $context since PhpRedis >= 5.3.0 can specify authentication and stream information on connect * * @return bool TRUE on success, FALSE on error * @@ -216,6 +231,8 @@ public function getHost() {} /** * Get the port we're connected to * + * This number will be zero if we are connected to a unix socket. + * * @return int|false Returns the port we're connected to or FALSE if we're not connected * * @throws RedisException @@ -264,11 +281,9 @@ public function getReadTimeout() {} public function getPersistentID() {} /** - * Get the password used to authenticate the phpredis connection + * Get the authentication information on the connection, if any. * - * @return string|array|null Returns NULL if no username/password are set, - * the password string if a password is set, - * and a [username, password] array if authenticated with a username and password. + * @return mixed The authentication information used to authenticate the connection. * * @throws RedisException */ @@ -290,12 +305,12 @@ public function getAuth() {} * @param string $host can be a host, or the path to a unix domain socket * @param int $port optional * @param float $timeout value in seconds (optional, default is 0.0 meaning unlimited) - * @param string $persistent_id identity for the requested persistent connection + * @param string|null $persistent_id identity for the requested persistent connection * @param int $retry_interval retry interval in milliseconds. * @param float $read_timeout value in seconds (optional, default is 0 meaning unlimited) - * @param array $context since PhpRedis >= 5.3.0 can specify authentication and stream information on connect + * @param array|null $context since PhpRedis >= 5.3.0 can specify authentication and stream information on connect * - * @return bool TRUE on success, FALSE on ertcnror. + * @return bool TRUE on success, FALSE on error. * * @throws RedisException * @@ -330,10 +345,10 @@ public function pconnect( * @param string $host * @param int $port * @param float $timeout - * @param string $persistent_id + * @param string|null $persistent_id * @param int $retry_interval * @param float $read_timeout - * @param array $context + * @param array|null $context * * @return bool * @@ -386,10 +401,10 @@ public function close() {} public function swapdb(int $db1, int $db2) {} /** - * Set client option + * Set a configurable option on the Redis object. * - * @param int $option option name - * @param mixed $value option value + * @param int $option The option constant. + * @param mixed $value The option value. * * @return bool TRUE on success, FALSE on error * @@ -417,11 +432,11 @@ public function swapdb(int $db1, int $db2) {} public function setOption($option, $value) {} /** - * Get client option + * Retrieve the value of a configuration setting as set by Redis::setOption() * * @param int $option parameter name * - * @return mixed|null Parameter value + * @return mixed|null The setting itself or false on failure. * * @throws RedisException * @@ -435,7 +450,7 @@ public function getOption($option) {} /** * Check the current connection status * - * @param string $message [optional] + * @param string $message An optional string message that Redis will reply with, if passed. * * @return bool|string TRUE if the command is successful or returns message * Throws a RedisException object on connectivity error, as described above. @@ -456,11 +471,13 @@ public function ping($message = null) {} * * @param string $message * - * @return string|Redis Returns message or Redis if in multimode + * @return string|Redis The string sent to Redis or false on failure or Redis if in multimode * * @throws RedisException * * @link https://redis.io/commands/echo + * + * @example $redis->echo('Hello, World'); */ public function echo($message) {} @@ -500,14 +517,22 @@ public function get($key) {} * * @since If you're using Redis >= 2.6.12, you can pass extended options as explained in example * - * @param string $key - * @param string|mixed $value string if not used serializer - * @param int|array|mixed $timeout [optional] Calling setex() is preferred if you want a timeout.
    - * Since 2.6.12 it also supports different flags inside an array. Example ['NX', 'EX' => 60]
    - * - EX seconds -- Set the specified expire time, in seconds.
    - * - PX milliseconds -- Set the specified expire time, in milliseconds.
    - * - NX -- Only set the key if it does not already exist.
    - * - XX -- Only set the key if it already exist.
    + * @param string $key The key name to set. + * @param mixed $value The value to set the key to. + * @param mixed $options Either an array with options for how to perform the set or an integer with an expiration. + * If an expiration is set PhpRedis will actually send the `SETEX` command. + * Since 2.6.12 it also supports different flags inside an array. + * OPTION DESCRIPTION + * ------------ -------------------------------------------------------------- + * ['EX' => 60] expire 60 seconds. + * ['PX' => 6000] expire in 6000 milliseconds. + * ['EXAT' => time() + 10] expire in 10 seconds. + * ['PXAT' => time()*1000 + 1000] expire in 1 second. + * ['KEEPTTL' => true] Redis will not update the key's current TTL. + * ['XX'] Only set the key if it already exists. + * ['NX'] Only set the key if it doesn't exist. + * ['GET'] Instead of returning `+OK` return the previous value of the + * key or NULL if the key didn't exist. * * @example *

    @@ -530,14 +555,14 @@ public function get($key) {}
          *
          * @link     https://redis.io/commands/set
          */
    -    public function set($key, string $value, mixed $timeout = null) {}
    +    public function set($key, $value, $options = null) {}
     
         /**
          * Set the string value in argument as value of the key, with a time to live.
          *
    -     * @param string       $key
    -     * @param int          $expire
    -     * @param string|mixed $value
    +     * @param string $key    The name of the key to set.
    +     * @param int    $expire The key's expiration in seconds.
    +     * @param mixed  $value  The value to set the key.
          *
          * @return bool|Redis returns Redis if in multimode
          *
    @@ -546,15 +571,15 @@ public function set($key, string $value, mixed $timeout = null) {}
          * @link    https://redis.io/commands/setex
          * @example $redis->setex('key', 3600, 'value'); // sets key → value, with 1h TTL.
          */
    -    public function setex($key, $expire, string $value) {}
    +    public function setex($key, $expire, $value) {}
     
         /**
          * Set the value and expiration in milliseconds of a key.
          *
          * @see     setex()
    -     * @param   string       $key
    -     * @param   int          $expire in milliseconds.
    -     * @param   string|mixed $value
    +     * @param string $key    The key to set
    +     * @param int    $expire The TTL to set, in milliseconds.
    +     * @param mixed  $value  The value to set the key to.
          *
          * @return bool|Redis returns Redis if in multimode
          *
    @@ -563,7 +588,7 @@ public function setex($key, $expire, string $value) {}
          * @link    https://redis.io/commands/psetex
          * @example $redis->psetex('key', 1000, 'value'); // sets key → value, with 1sec TTL.
          */
    -    public function psetex($key, $expire, string $value) {}
    +    public function psetex($key, $expire, $value) {}
     
         /**
          * Set the string value in argument as value of the key if the key doesn't already exist in the database.
    @@ -582,13 +607,13 @@ public function psetex($key, $expire, string $value) {}
          * $redis->setnx('key', 'value');   // return FALSE
          * 
    */ - public function setnx(string $key, string $value) {} + public function setnx(string $key, $value) {} /** * Remove specified keys. * - * @param int|string|array $key1 An array of keys, or an undefined number of parameters, each a key: key1 key2 key3 ... keyN - * @param int|string ...$otherKeys + * @param string|array $key1 Either an array with one or more key names or a string with the name of a key. + * @param string ...$otherKeys One or more additional keys passed in a variadic fashion. * * @return false|int|Redis Number of keys deleted or Redis if in multimode * @@ -710,24 +735,41 @@ public function multi($mode = Redis::MULTI) {} public function pipeline() {} /** - * @return void|array|Redis returns Redis if in multimode + * Execute either a MULTI or PIPELINE block and return the array of replies. + * + * @return array|false|Redis The array of pipeline'd or multi replies or false on failure or Redis if in multimode * * @throws RedisException * * @see multi() * @link https://redis.io/commands/exec + * @link https://redis.io/commands/multi + * + * @example + * $res = $redis->multi() + * ->set('foo', 'bar') + * ->get('foo') + * ->del('list') + * ->rpush('list', 'one', 'two', 'three') + * ->exec(); */ public function exec() {} /** * Flushes all previously queued commands in a transaction and restores the connection state to normal. * - * @return bool + * @return bool|Redis True if we could discard the transaction or Redis if in multimode * * @throws RedisException * * @see multi() * @link https://redis.io/commands/discard + * + * @example + * $redis->getMode(); + * $redis->set('foo', 'bar'); + * $redis->discard(); + * $redis->getMode(); */ public function discard() {} @@ -735,8 +777,9 @@ public function discard() {} * Watches a key for modifications by another client. If the key is modified between WATCH and EXEC, * the MULTI/EXEC transaction will fail (return FALSE). unwatch cancels all the watching of all keys by this client. * - * @param string|array $key An array of keys, or an undefined number of parameters, each a key: key1 key2 key3 ... keyN - * @param string ...$other_keys + * @param string|array $key Either an array with one or more key names, or a string key name + * @param string ...$other_keys If the first argument was passed as a string, any number of + * additional string key names may be passed variadically. * * @return bool|Redis returns Redis if in multimode * @@ -756,6 +799,8 @@ public function discard() {} public function watch($key, ...$other_keys) {} /** + * Remove any previously WATCH'ed keys in a transaction. + * * @throws RedisException * * @see watch() @@ -769,17 +814,31 @@ public function unwatch() {} * * Once the client enters the subscribed state it is not supposed to issue any other commands, except for additional SUBSCRIBE, SSUBSCRIBE, PSUBSCRIBE, UNSUBSCRIBE, SUNSUBSCRIBE, PUNSUBSCRIBE, PING, RESET and QUIT commands. * - * @param string $channel - * @param string ...$other_channels + * @param array|string $channels One or more channel names. + * @param callable $callback The callback PhpRedis will invoke when we receive a message from one of the subscribed channels. * - * @return false|array|Redis + * @return false|array|Redis False on faiilure. Note that this command will block the client in a subscribe loop, waiting for messages to arrive * * @throws RedisException * * @link https://redis.io/commands/subscribe * @since 2.0 + * + * @example + * $redis->subscribe(['channel-1', 'channel-2'], function ($redis, $channel, $message) { + * echo "[$channel]: $message\n"; + * + * // Unsubscribe from the message channel when we read 'quit' + * if ($message == 'quit') { + * echo "Unsubscribing from '$channel'\n"; + * $redis->unsubscribe([$channel]); + * } + * }); + * + * // Once we read 'quit' from both channel-1 and channel-2 the subscribe loop will be broken and this command will execute. + * echo "Subscribe loop ended\n"; */ - public function subscribe(string $channel, string ...$other_channels) {} + public function subscribe($channels, $callback) {} /** * Subscribe to channels by pattern @@ -810,8 +869,8 @@ public function psubscribe($patterns, $callback) {} * * Warning: this function will probably change in the future. * - * @param string $channel a channel to publish to - * @param string $message string + * @param string $channel The channel to publish to. + * @param string $message The message itself. * * @return false|int|Redis Number of clients that received the message or Redis if in multimode * @@ -826,11 +885,11 @@ public function publish($channel, $message) {} * A command allowing you to get information on the Redis pub/sub system * * @param string $keyword String, which can be: "channels", "numsub", or "numpat" - * @param string|array $argument Optional, variant. + * @param mixed $argument Optional, variant. * For the "channels" subcommand, you can pass a string pattern. * For "numsub" an array of channel names * - * @return array|int|Redis Either an integer or an array or Redis if in multimode + * @return mixed|Redis Either an integer or an array or Redis if in multimode * - channels Returns an array where the members are the matching channels. * - numsub Returns a key/value array where the keys are channel names and * values are their counts. @@ -852,16 +911,25 @@ public function pubsub($keyword, $argument = null) {} /** * Stop listening for messages posted to the given channels. * - * @param string $channel - * @param string ...$other_channels + * @param array $channels One or more channels to unsubscribe from. * - * @return bool|array + * @return bool|array|Redis The array of unsubscribed channels. * * @throws RedisException * * @link https://redis.io/commands/unsubscribe + * + * @example + * $redis->subscribe(['channel-1', 'channel-2'], function ($redis, $channel, $message) { + * if ($message == 'quit') { + * echo "$channel => 'quit' detected, unsubscribing!\n"; + * $redis->unsubscribe([$channel]); + * } else { + * echo "$channel => $message\n"; + * } + * }); */ - public function unsubscribe(string $channel, string ...$other_channels) {} + public function unsubscribe(array $channels) {} /** * Stop listening for messages posted to the given channels. @@ -883,7 +951,8 @@ public function punsubscribe(array $patterns) {} * * @since >= 4.0 Returned int, if < 4.0 returned bool * - * @param string|string[] $key + * @param mixed $key Either an array of keys or a string key + * @param mixed ...$other_keys If the previous argument was a string, you may send any number of additional keys to test. * * @return int|bool|Redis The number of keys tested that do exist or Redis if in multimode * @@ -901,12 +970,13 @@ public function punsubscribe(array $patterns) {} * $redis->exists('foo', 'bar', 'baz'); // 3 * */ - public function exists($key) {} + public function exists($key, ...$other_keys) {} /** * Increment the number stored at key by one. * - * @param string $key + * @param string $key The key to increment + * @param int $by An optional amount to increment by. * * @return false|int|Redis the new value or Redis if in multimode * @@ -919,9 +989,10 @@ public function exists($key) {} * $redis->incr('key1'); // 2 * $redis->incr('key1'); // 3 * $redis->incr('key1'); // 4 + * $redis->incr('key1', 2); // 6 * */ - public function incr($key) {} + public function incr($key, $by = 1) {} /** * Increment the float value of a key by the given amount @@ -929,7 +1000,7 @@ public function incr($key) {} * @param string $key * @param float $increment * - * @return float|Redis returns Redis if in multimode + * @return float|false|Redis returns Redis if in multimode * * @throws RedisException * @@ -939,16 +1010,16 @@ public function incr($key) {} * $redis->set('x', 3); * $redis->incrByFloat('x', 1.5); // float(4.5) * $redis->get('x'); // float(4.5) + * $redis->incrByFloat('x', 3.1415926); * */ public function incrByFloat($key, $increment) {} /** * Increment the number stored at key by one. - * If the second argument is filled, it will be used as the integer value of the increment. * - * @param string $key key - * @param int $value value that will be added to key (only for incrBy) + * @param string $key The key to increment. + * @param int $value The amount to increment. * * @return false|int|Redis the new value or Redis if in multimode * @@ -969,9 +1040,10 @@ public function incrBy($key, $value) {} /** * Decrement the number stored at key by one. * - * @param string $key + * @param string $key The key to decrement + * @param int $by How much to decrement the key. Note that if this value is not sent or is set to `1` * - * @return false|int|Redis the new value or Redis if in multimode + * @return false|int|Redis The new value of the key or false on failure or Redis if in multimode * * @throws RedisException * @@ -981,18 +1053,18 @@ public function incrBy($key, $value) {} * $redis->decr('key1'); // key1 didn't exists, set to 0 before the increment and now has the value -1 * $redis->decr('key1'); // -2 * $redis->decr('key1'); // -3 + * $redis->decr('key1', 2); // -5 * */ - public function decr($key) {} + public function decr($key, $by = 1) {} /** * Decrement the number stored at key by one. - * If the second argument is filled, it will be used as the integer value of the decrement. * - * @param string $key - * @param int $value that will be subtracted to key (only for decrBy) + * @param string $key The integer key to decrement. + * @param int $value How much to decrement the key. * - * @return false|int|Redis the new value or Redis if in multimode + * @return false|int|Redis The new value of the key or false on failure or Redis if in multimode * * @throws RedisException * @@ -1012,8 +1084,8 @@ public function decrBy($key, $value) {} * Creates the list if the key didn't exist. * If the key exists and is not a list, FALSE is returned. * - * @param string $key - * @param string|mixed ...$value1 Variadic list of values to push in key, if dont used serialized, used string + * @param string $key The list to prepend. + * @param mixed ...$value1 One or more elements to prepend. * * @return int|false|Redis The new length of the list in case of success, FALSE in case of Failure or Redis if in multimode * @@ -1040,8 +1112,8 @@ public function lPush($key, ...$value1) {} * Creates the list if the key didn't exist. * If the key exists and is not a list, FALSE is returned. * - * @param string $key - * @param string|mixed ...$value1 Variadic list of values to push in key, if dont used serialized, used string + * @param string $key The list to append to. + * @param mixed ...$value1 one or more elements to append. * * @return int|false|Redis The new length of the list in case of success, FALSE in case of Failure or Redis if in multimode * @@ -1066,8 +1138,8 @@ public function rPush($key, ...$value1) {} /** * Adds the string value to the head (left) of the list if the list exists. * - * @param string $key - * @param string|mixed $value String, value to push in key + * @param string $key The key to prepend to. + * @param mixed $value The value to prepend. * * @return int|false|Redis The new length of the list in case of success, FALSE in case of Failure or Redis if in multimode * @@ -1084,13 +1156,13 @@ public function rPush($key, ...$value1) {} * // key1 now points to the following list: [ 'A', 'B', 'C' ] * */ - public function lPushx($key, string $value) {} + public function lPushx($key, $value) {} /** * Adds the string value to the tail (right) of the list if the ist exists. FALSE in case of Failure. * - * @param string $key - * @param string|mixed $value String, value to push in key + * @param string $key The key to prepend to. + * @param mixed $value The value to prepend. * * @return int|false|Redis The new length of the list in case of success, FALSE in case of Failure or Redis if in multimode * @@ -1107,13 +1179,13 @@ public function lPushx($key, string $value) {} * // key1 now points to the following list: [ 'A', 'B', 'C' ] * */ - public function rPushx($key, string $value) {} + public function rPushx($key, $value) {} /** * Returns and removes the first element of the list. * - * @param string $key - * @param int $count + * @param string $key The list to pop from. + * @param int $count Optional number of elements to remove. By default one element is popped. * * @return mixed|bool|Redis if command executed successfully BOOL FALSE in case of failure (empty list) or Redis if in multimode * @@ -1133,10 +1205,10 @@ public function lPop($key, $count = 0) {} /** * Returns and removes the last element of the list. * - * @param string $key - * @param int $count + * @param string $key A redis LIST key name. + * @param int $count The maximum number of elements to pop at once. NOTE: The `count` argument requires Redis >= 6.2.0 * - * @return mixed|bool|Redis if command executed successfully BOOL FALSE in case of failure (empty list) or Redis if in multimode + * @return mixed|array|string|bool|Redis if command executed successfully BOOL FALSE in case of failure (empty list) or Redis if in multimode * * @throws RedisException * @@ -1157,11 +1229,11 @@ public function rPop($key, $count = 0) {} * Il all the list identified by the keys passed in arguments are empty, blPop will block * during the specified timeout until an element is pushed to one of those lists. This element will be popped. * - * @param string|string[] $key String array containing the keys of the lists OR variadic list of strings - * @param int $timeout_or_key Timeout is always the required final parameter + * @param string|string[] $key_or_keys String array containing the keys of the lists OR variadic list of strings + * @param string|float|int $timeout_or_key Timeout is always the required final parameter * @param mixed ...$extra_args * - * @return array|Redis ['listName', 'element'] or Redis if in multimode + * @return array|null|false|Redis Can return various things depending on command and data or Redis if in multimode * * @throws RedisException * @@ -1176,9 +1248,9 @@ public function rPop($key, $count = 0) {} * // OR * $redis->blPop(['key1', 'key2'], 10); // array('key1', 'A') * - * $redis->brPop('key1', 'key2', 10); // array('key1', 'A') + * $redis->blPop('key1', 'key2', 10); // array('key1', 'A') * // OR - * $redis->brPop(['key1', 'key2'], 10); // array('key1', 'A') + * $redis->blPop(['key1', 'key2'], 10); // array('key1', 'A') * * // Blocking feature * @@ -1194,7 +1266,7 @@ public function rPop($key, $count = 0) {} * // array('key1', 'A') is returned * */ - public function blPop($key, $timeout_or_key, ...$extra_args) {} + public function blPop($key_or_keys, $timeout_or_key, ...$extra_args) {} /** * Is a blocking rPop primitive. If at least one of the lists contains at least one element, @@ -1203,11 +1275,11 @@ public function blPop($key, $timeout_or_key, ...$extra_args) {} * block during the specified timeout until an element is pushed to one of those lists. * This element will be popped. * - * @param string|string[] $key String array containing the keys of the lists OR variadic list of strings - * @param int $timeout_or_key Timeout is always the required final parameter + * @param string|string[] $key_or_keys String array containing the keys of the lists OR variadic list of strings + * @param string|float|int $timeout_or_key Timeout is always the required final parameter * @param mixed ...$extra_args * - * @return array|Redis ['listName', 'element'] or Redis if in multimode + * @return array|null|true|Redis Can return various things depending on command and data or Redis if in multimode * * @throws RedisException * @@ -1215,12 +1287,12 @@ public function blPop($key, $timeout_or_key, ...$extra_args) {} * @example *
          * // Non blocking feature
    -     * $redis->lPush('key1', 'A');
    +     * $redis->rPush('key1', 'A');
          * $redis->del('key2');
          *
    -     * $redis->blPop('key1', 'key2', 10); // array('key1', 'A')
    +     * $redis->brPop('key1', 'key2', 10); // array('key1', 'A')
          * // OR
    -     * $redis->blPop(array('key1', 'key2'), 10); // array('key1', 'A')
    +     * $redis->brPop(array('key1', 'key2'), 10); // array('key1', 'A')
          *
          * $redis->brPop('key1', 'key2', 10); // array('key1', 'A')
          * // OR
    @@ -1230,7 +1302,7 @@ public function blPop($key, $timeout_or_key, ...$extra_args) {}
          *
          * // process 1
          * $redis->del('key1');
    -     * $redis->blPop('key1', 10);
    +     * $redis->brPop('key1', 10);
          * // blocking for 10 seconds
          *
          * // process 2
    @@ -1240,7 +1312,7 @@ public function blPop($key, $timeout_or_key, ...$extra_args) {}
          * // array('key1', 'A') is returned
          * 
    */ - public function brPop($key, $timeout_or_key, ...$extra_args) {} + public function brPop($key_or_keys, $timeout_or_key, ...$extra_args) {} /** * Returns the size of a list identified by Key. If the list didn't exist or is empty, @@ -1320,9 +1392,9 @@ public function lGet($key, $index) {} /** * Set the list at index with the new value. * - * @param string $key - * @param int $index - * @param string $value + * @param string $key The list to modify. + * @param int $index The position of the element to change. + * @param mixed $value The new value. * * @return bool|Redis TRUE if the new value is setted or Redis if in multimode * FALSE if the index is out of range, or data type identified by key is not a list. @@ -1340,16 +1412,16 @@ public function lGet($key, $index) {} * $redis->lIndex('key1', 0); // 'X' * */ - public function lSet($key, $index, string $value) {} + public function lSet($key, $index, $value) {} /** * Returns the specified elements of the list stored at the specified key in * the range [start, end]. start and stop are interpretated as indices: 0 the first element, * 1 the second ... -1 the last element, -2 the penultimate ... * - * @param string $key - * @param int $start - * @param int $end + * @param string $key The list to query. + * @param int $start The beginning index to retrieve. This number can be negative meaning start from the end of the list. + * @param int $end The end index to retrieve. This can also be negative to start from the end of the list. * * @return array|Redis containing the values in specified range or Redis if in multimode * @@ -1382,9 +1454,9 @@ public function lGetRange($key, $start, $end) {} /** * Trims an existing list so that it will contain only a specified range of elements. * - * @param string $key - * @param int $start - * @param int $stop + * @param string $key The list to trim + * @param int $start The starting index to keep + * @param int $end The ending index to keep. * * @return array|false|Redis Bool return FALSE if the key identify a non-list value or Redis if in multimode * @@ -1401,7 +1473,7 @@ public function lGetRange($key, $start, $end) {} * $redis->lRange('key1', 0, -1); // array('A', 'B') * */ - public function lTrim($key, $start, $stop) {} + public function lTrim($key, $start, $end) {} /** * @link https://redis.io/commands/ltrim @@ -1420,9 +1492,9 @@ public function listTrim($key, $start, $stop) {} * If count is zero, all the matching elements are removed. If count is negative, * elements are removed from tail to head. * - * @param string $key - * @param string $value - * @param int $count + * @param string $key The list to truncate. + * @param mixed $value The value to remove. + * @param int $count How many elements matching the value to remove. * * @return int|bool|Redis the number of elements to remove or Redis if in multimode * bool FALSE if the value identified by key is not a list. @@ -1443,7 +1515,7 @@ public function listTrim($key, $start, $stop) {} * $redis->lRange('key1', 0, -1); // array('C', 'B', 'A') * */ - public function lRem($key, $value, $count) {} + public function lRem($key, $value, $count = 0) {} /** * @link https://redis.io/commands/lremove @@ -1465,7 +1537,7 @@ public function lRemove($key, $value, $count) {} * @param string $key * @param string $position Redis::BEFORE | Redis::AFTER * @param mixed $pivot - * @param string|mixed $value + * @param mixed $value * * @return false|int|Redis The number of the elements in the list, -1 if the pivot didn't exists or Redis if in multimode * @@ -1496,7 +1568,7 @@ public function lInsert($key, $position, $pivot, $value) {} * Adds a values to the set value stored at key. * * @param string $key Required key - * @param string $value + * @param mixed $value * @param mixed ...$other_values Variadic list of values * * @return int|bool|Redis The number of elements added to the set or Redis if in multimode @@ -1509,14 +1581,14 @@ public function lInsert($key, $position, $pivot, $value) {} * $redis->sAdd('k', 'v1', 'v2', 'v3'); // int(2) * */ - public function sAdd(string $key, string $value, mixed ...$other_values) {} + public function sAdd(string $key, $value, ...$other_values) {} /** * Removes the specified members from the set value stored at key. * * @param string $key - * @param string $value - * @param string|mixed ...$other_values Variadic list of members + * @param mixed $value + * @param mixed ...$other_values Variadic list of members * * @return false|int|Redis The number of elements removed from the set or Redis if in multimode * @@ -1532,7 +1604,7 @@ public function sAdd(string $key, string $value, mixed ...$other_values) {} * // } * */ - public function sRem(string $key, string $value, ...$other_values) {} + public function sRem(string $key, $value, ...$other_values) {} /** * @link https://redis.io/commands/srem @@ -1550,7 +1622,7 @@ public function sRemove($key, ...$member1) {} * * @param string $srcKey * @param string $dstKey - * @param string $member + * @param mixed $member * * @return bool|Redis If the operation is successful, return TRUE or Redis if in multimode * If the srcKey and/or dstKey didn't exist, and/or the member didn't exist in srcKey, FALSE is returned. @@ -1569,13 +1641,13 @@ public function sRemove($key, ...$member1) {} * // 'key2' => {'set21', 'set22', 'set13'} * */ - public function sMove($srcKey, $dstKey, string $member) {} + public function sMove($srcKey, $dstKey, $member) {} /** * Checks if value is a member of the set stored at the key key. * * @param string $key - * @param string|mixed $value + * @param mixed $value * * @return bool|Redis TRUE if value is a member of the set at key key, FALSE otherwise or Redis if in multimode * @@ -1592,7 +1664,7 @@ public function sMove($srcKey, $dstKey, string $member) {} * $redis->sIsMember('key1', 'setX'); // FALSE * */ - public function sIsMember(string $key, string $value) {} + public function sIsMember(string $key, $value) {} /** * @link https://redis.io/commands/sismember @@ -1629,8 +1701,8 @@ public function sCard($key) {} /** * Removes and returns a random element from the set value at Key. * - * @param string $key - * @param int $count [optional] + * @param string $key The set in question. + * @param int $count An optional number of members to pop. This defaults to removing one element. * * @return string|mixed|array|bool|Redis "popped" values or Redis if in multimode * bool FALSE if set identified by key is empty or doesn't exist. @@ -1662,8 +1734,15 @@ public function sPop($key, $count = 0) {} /** * Returns a random element(s) from the set value at Key, without removing it. * - * @param string $key - * @param int $count [optional] + * @param string $key The set to query. + * @param int $count An optional count of members to return. + * + * If this value is positive, Redis will return *up to* the requested + * number but with unique elements that will never repeat. This means + * you may recieve fewer then `$count` replies. + * + * If the number is negative, Redis will return the exact number requested + * but the result may contain duplicate elements. * * @return string|mixed|array|bool|Redis value(s) from the set or Redis if in multimode * bool FALSE if set identified by key is empty or doesn't exist and count argument isn't passed. @@ -1733,9 +1812,9 @@ public function sInter($key1, ...$otherKeys) {} /** * Performs a sInter command and stores the result in a new set. * - * @param string $dstKey the key to store the diff into. - * @param string $key1 keys identifying the different sets on which we will apply the intersection. - * @param string ...$otherKeys variadic list of keys + * @param array|string $key Either a string key, or an array of keys (with at least two elements, + * consisting of the destination key name and one or more source keys names. + * @param string ...$otherKeys If the first argument was a string, subsequent arguments should be source key names. * * @return int|false|Redis The cardinality of the resulting set, or FALSE in case of a missing key or Redis if in multimode * @@ -1768,7 +1847,7 @@ public function sInter($key1, ...$otherKeys) {} * //} * */ - public function sInterStore($dstKey, $key1, ...$otherKeys) {} + public function sInterStore(string $key, ...$otherKeys) {} /** * Performs the union between N sets and returns it. @@ -1776,7 +1855,7 @@ public function sInterStore($dstKey, $key1, ...$otherKeys) {} * @param string $key1 first key for union * @param string ...$otherKeys variadic list of keys corresponding to sets in redis * - * @return array|Redis string[] The union of all these sets or Redis if in multimode + * @return array|false|Redis The union of all these sets or Redis if in multimode * * @throws RedisException * @@ -1809,9 +1888,9 @@ public function sUnion($key1, ...$otherKeys) {} /** * Performs the same action as sUnion, but stores the result in the first key * - * @param string $dstKey the key to store the diff into. - * @param string $key1 first key for union - * @param string ...$otherKeys variadic list of keys corresponding to sets in redis + * @param string $dstKey The destination key + * @param string $key1 The first source key + * @param string ...$otherKeys One or more additional source keys * * @return false|int|Redis Any number of keys corresponding to sets in redis or Redis if in multimode * @@ -1853,7 +1932,7 @@ public function sUnionStore($dstKey, $key1, ...$otherKeys) {} * @param string $key1 first key for diff * @param string ...$otherKeys variadic list of keys corresponding to sets in redis * - * @return array|Redis string[] The difference of the first set will all the others or Redis if in multimode + * @return array|false|Redis string[] The difference of the first set will all the others or Redis if in multimode * * @throws RedisException * @@ -1925,7 +2004,7 @@ public function sDiffStore($dstKey, $key1, ...$otherKeys) {} * * @param string $key * - * @return array|Redis An array of elements, the contents of the set or Redis if in multimode + * @return array|false|Redis An array of elements, the contents of the set or Redis if in multimode * * @throws RedisException * @@ -1952,6 +2031,22 @@ public function sDiffStore($dstKey, $key1, ...$otherKeys) {} */ public function sMembers($key) {} + /** + * Check if one or more values are members of a set. + * + * @link https://redis.io/commands/smismember + * @see smember() + * + * @param string $key The set to query. + * @param string $member The first value to test if exists in the set. + * @param string ...$other_members Any number of additional values to check. + * + * @return Redis|array|false An array of integers representing whether each passed value was a member of the set. + * + * @example + * $redis->sAdd('ds9-crew', ...["Sisko", "Kira", "Dax", "Worf", "Bashir", "O'Brien"]); + * $members = $redis->sMIsMember('ds9-crew', ...['Sisko', 'Picard', 'Data', 'Worf']); + */ public function sMisMember(string $key, string $member, string ...$other_members): array|false {} /** @@ -1968,10 +2063,15 @@ public function sGetMembers($key) {} /** * Scan a set for members * - * @param string $key The set to search. - * @param int &$iterator LONG (reference) to the iterator as we go. - * @param string $pattern String, optional pattern to match against. - * @param int $count How many members to return at a time (Redis might return a different amount) + * @param string $key The Redis SET key in question. + * @param int|null &$iterator A reference to an iterator which should be initialized to NULL that + * PhpRedis will update with the value returned from Redis after each + * subsequent call to SSCAN. Once this cursor is zero you know all + * members have been traversed. + * @param string $pattern An optional glob style pattern to match against, so Redis only + * returns the subset of members matching this pattern. + * @param int $count A hint to Redis as to how many members it should scan in one command + * before returning members for that iteration. * * @return array|false|Redis PHPRedis will return an array of keys or FALSE when we're done iterating or Redis if in multimode * @@ -1980,10 +2080,40 @@ public function sGetMembers($key) {} * @link https://redis.io/commands/sscan * @example *
    -     * $iterator = null;
    -     * while ($members = $redis->sScan('set', $iterator)) {
    +     * $redis->del('myset');
    +     * for ($i = 0; $i < 10000; $i++) {
    +     *     $redis->sAdd('myset', "member:$i");
    +     * }
    +     * $redis->sadd('myset', 'foofoo');
    +     *
    +     * $redis->setOption(Redis::OPT_SCAN, Redis::SCAN_NORETRY);
    +     *
    +     * $scanned = 0;
    +     * $it = null;
    +     *
    +     * // Without Redis::SCAN_RETRY we may receive empty results and
    +     * // a nonzero iterator.
    +     * do {
    +     *     // Scan members containing '5'
    +     *     $members = $redis->sscan('myset', $it, '*5*');
    +     *     foreach ($members as $member) {
    +     *          echo "NORETRY: $member\n";
    +     *          $scanned++;
    +     *     }
    +     * } while ($it != 0);
    +     * echo "TOTAL: $scanned\n";
    +     *
    +     * $redis->setOption(Redis::OPT_SCAN, Redis::SCAN_RETRY);
    +     *
    +     * $scanned = 0;
    +     * $it = null;
    +     *
    +     * // With Redis::SCAN_RETRY PhpRedis will never return an empty array
    +     * // when the cursor is non-zero
    +     * while (($members = $redis->sScan('set', $it, '*5*'))) {
          *     foreach ($members as $member) {
    -     *         echo $member . PHP_EOL;
    +     *         echo "RETRY: $member\n";
    +     *         $scanned++;
          *     }
          * }
          * 
    @@ -1994,9 +2124,9 @@ public function sScan($key, &$iterator, $pattern = null, $count = 0) {} * Sets a value and returns the previous entry at that key. * * @param string $key - * @param string|mixed $value + * @param mixed $value * - * @return string|mixed|Redis A string (mixed, if used serializer), the previous value located at this key or Redis if in multimode + * @return string|mixed|false|Redis A string (mixed, if used serializer), the previous value located at this key or false if it didn't exist or Redis if in multimode * * @throws RedisException * @@ -2008,12 +2138,12 @@ public function sScan($key, &$iterator, $pattern = null, $count = 0) {} * $newValue = $redis->get('x')' // return 'lol' * */ - public function getSet($key, string $value) {} + public function getSet($key, $value) {} /** * Returns a random key * - * @return string|Redis an existing key in redis or Redis if in multimode + * @return string|false|Redis an existing key in redis or Redis if in multimode * * @throws RedisException * @@ -2126,10 +2256,17 @@ public function renameKey($srcKey, $dstKey) {} public function renameNx($srcKey, $dstKey) {} /** - * Sets an expiration date (a timeout) on an item + * Sets an expiration in seconds on the key in question. If connected to + * redis-server >= 7.0.0 you may send an additional "mode" argument which + * modifies how the command will execute. * - * @param string $key The key that will disappear + * @param string $key The key to set an expiration on. * @param int $ttl The key's remaining Time To Live, in seconds + * @param string|null $mode A two character modifier that changes how the command works. + * NX - Set expiry only if key has no expiry + * XX - Set expiry only if key has an expiry + * LT - Set expiry only when new expiry is < current expiry + * GT - Set expiry only when new expiry is > current expiry * * @return bool|Redis TRUE in case of success, FALSE in case of failure or Redis if in multimode * @@ -2144,13 +2281,16 @@ public function renameNx($srcKey, $dstKey) {} * $redis->get('x'); // will return `FALSE`, as 'x' has expired. * */ - public function expire($key, $ttl) {} + public function expire($key, $ttl, $mode = null) {} /** * Sets an expiration date (a timeout in milliseconds) on an item * - * @param string $key The key that will disappear. - * @param int $ttl The key's remaining Time To Live, in milliseconds + * If connected to Redis >= 7.0.0 you can pass an optional mode argument that modifies how the command will execute. + * + * @param string $key The key to set an expiration on. + * @param int $ttl The key's remaining Time To Live, in milliseconds + * @param string|null $mode A two character modifier that changes how the command works. * * @return bool|Redis TRUE in case of success, FALSE in case of failure or Redis if in multimode * @@ -2165,7 +2305,7 @@ public function expire($key, $ttl) {} * $redis->pttl('x'); // 11500 * */ - public function pExpire($key, $ttl) {} + public function pExpire($key, $ttl, $mode = null) {} /** * @link https://redis.io/commands/expire @@ -2182,8 +2322,12 @@ public function setTimeout($key, $ttl) {} /** * Sets an expiration date (a timestamp) on an item. * - * @param string $key The key that will disappear. - * @param int $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time. + * If connected to Redis >= 7.0.0 you can pass an optional 'mode' argument. + * @see expire() For a description of the mode argument. + * + * @param string $key The key to set an expiration on. + * @param int $timestamp The unix timestamp to expire at. + * @param string|null $mode An option 'mode' that modifies how the command acts * * @return bool|Redis TRUE in case of success, FALSE in case of failure or Redis if in multimode * @@ -2199,13 +2343,16 @@ public function setTimeout($key, $ttl) {} * $redis->get('x'); // will return `FALSE`, as 'x' has expired. * */ - public function expireAt($key, $timestamp) {} + public function expireAt($key, $timestamp, $mode = null) {} /** * Sets an expiration date (a timestamp) on an item. Requires a timestamp in milliseconds * - * @param string $key The key that will disappear + * If connected to Redis >= 7.0.0 you can pass an optional 'mode' argument. + * + * @param string $key The key to set an expiration on. * @param int $timestamp Unix timestamp. The key's date of death, in seconds from Epoch time + * @param string|null $mode A two character modifier that changes how the command works. * * @return bool|Redis TRUE in case of success, FALSE in case of failure or Redis if in multimode * @@ -2220,14 +2367,14 @@ public function expireAt($key, $timestamp) {} * echo $redis->pttl('x'); // 218270120575 * */ - public function pExpireAt($key, $timestamp) {} + public function pExpireAt($key, $timestamp, $mode = null) {} /** * Returns the keys that match a certain pattern. * * @param string $pattern pattern, using '*' as a wildcard * - * @return array|Redis string[] The keys that match a certain pattern or Redis if in multimode + * @return array|false|Redis The keys that match a certain pattern or Redis if in multimode * * @throws RedisException * @@ -2266,17 +2413,21 @@ public function getKeys($pattern) {} public function dbSize() {} /** - * Authenticate the connection using a password. + * Authenticate a Redis connection after its been established. * Warning: The password is sent in plain-text over the network. * - * @param mixed $credentials + * @param mixed $credentials A string password, or an array with one or two string elements. * * @return bool|Redis TRUE if the connection is authenticated, FALSE otherwise or Redis if in multimode * * @throws RedisException * * @link https://redis.io/commands/auth - * @example $redis->auth('foobared'); + * + * @example + * $redis->auth('password'); + * $redis->auth(['password']); + * $redis->auth(['username', 'password']); */ public function auth($credentials) {} @@ -2296,6 +2447,9 @@ public function bgrewriteaof() {} * Changes the slave status * Either host and port, or no parameter to stop being a slave. * + * This method and the corresponding command in Redis has been marked deprecated + * and users should instead use replicaof() if connecting to redis-server >= 5.0.0. + * * @param string $host [optional] * @param int $port [optional] * @@ -2311,13 +2465,22 @@ public function bgrewriteaof() {} * $redis->slaveof(); * */ + #[Deprecated(replacement: '%class%->replicaof(%parametersList%)')] public function slaveof($host = '127.0.0.1', $port = 6379) {} /** * Access the Redis slowLog * - * @param string $operation This can be either GET, LEN, or RESET - * @param int|null $length If executing a SLOWLOG GET command, you can pass an optional length. + * @param string $operation The operation you wish to perform. This can be one of the following values: + * 'GET' - Retrieve the Redis slowlog as an array. + * 'LEN' - Retrieve the length of the slowlog. + * 'RESET' - Remove all slowlog entries. + * @param int $length This optional argument can be passed when operation + * is 'get' and will specify how many elements to retrieve. + * If omitted Redis will send up to a default number of + * entries, which is configurable. + * + * Note: With Redis >= 7.0.0 you can send -1 to mean "all". * * @return mixed|Redis The return value of SLOWLOG will depend on which operation was performed or Redis if in multimode * - SLOWLOG GET: Array of slowLog entries, as provided by Redis @@ -2342,7 +2505,7 @@ public function slaveof($host = '127.0.0.1', $port = 6379) {} * * @link https://redis.io/commands/slowlog */ - public function slowLog(string $operation, int $length = null) {} + public function slowLog(string $operation, int $length = 0) {} /** * Describes the object pointed to by a key. @@ -2394,7 +2557,7 @@ public function save() {} * @link https://redis.io/commands/bgsave * @example $redis->bgSave(); */ - public function bgsave() {} + public function bgSave() {} /** * Returns the timestamp of the last disk save. @@ -2412,10 +2575,10 @@ public function lastSave() {} * Blocks the current client until all the previous write commands are successfully transferred and * acknowledged by at least the specified number of slaves. * - * @param int $numSlaves Number of slaves that need to acknowledge previous write commands. - * @param int $timeout Timeout in milliseconds. + * @param int $numreplicas The number of replicas we want to confirm write operaions + * @param int $timeout How long to wait (zero meaning forever). * - * @return int|Redis The command returns the number of slaves reached by all the writes performed in the or Redis if in multimode + * @return int|false|Redis The command returns the number of slaves reached by all the writes performed in the or Redis if in multimode * context of the current connection * * @throws RedisException @@ -2423,7 +2586,7 @@ public function lastSave() {} * @link https://redis.io/commands/wait * @example $redis->wait(2, 1000); */ - public function wait($numSlaves, $timeout) {} + public function wait($numreplicas, $timeout) {} /** * Returns the type of data pointed by a given key. @@ -2452,7 +2615,7 @@ public function type(string $key) {} * Append specified string to the string stored in specified key. * * @param string $key - * @param string|mixed $value + * @param mixed $value * * @return false|int|Redis Size of the value after the append or Redis if in multimode * @@ -2466,7 +2629,7 @@ public function type(string $key) {} * $redis->get('key'); // 'value1value2' * */ - public function append($key, string $value) {} + public function append($key, $value) {} /** * Return a substring of a larger string @@ -2526,7 +2689,7 @@ public function setRange($key, $offset, $value) {} * Get the length of a string value. * * @param string $key - * @return false|int|Redis returns Redis if in multimode + * @return false|int|Redis The length of the string key if it exists, zero if it does not, and false on failure. * * @throws RedisException * @@ -2544,10 +2707,11 @@ public function strlen($key) {} * string as an array of bits from left to right, where the first byte's most significant bit is at position 0, * the second byte's most significant bit is at position 8, and so forth. * - * @param string $key - * @param int $bit - * @param int $start - * @param int $end + * @param string $key The key to check (must be a string) + * @param bool $bit Whether to look for an unset (0) or set (1) bit. + * @param int $start Where in the string to start looking. + * @param int $end Where in the string to stop looking. + * @param bool $bybit If true, Redis will treat $start and $end as BIT values and not bytes, so if start was 0 and end was 2, Redis would only search the first two bits. * * @return false|int|Redis The command returns the position of the first bit set to 1 or 0 according to the request or Redis if in multimode * If we look for set bits (the bit argument is 1) and the string is empty or composed of just @@ -2574,7 +2738,7 @@ public function strlen($key) {} * $redis->bitpos('key', 0, 1, 5); // int(-1) * */ - public function bitpos($key, $bit, $start = 0, $end = -1) {} + public function bitpos($key, $bit, $start = 0, $end = -1, $bybit = false) {} /** * Return a single bit out of a larger string @@ -2621,9 +2785,10 @@ public function setBit($key, $offset, $value) {} /** * Count bits in a string * - * @param string $key - * @param int $start - * @param int $end + * @param string $key The key in question (must be a string key) + * @param int $start The index where Redis should start counting. If omitted it defaults to zero, which means the start of the string. + * @param int $end The index where Redis should stop counting. If omitted it defaults to -1, meaning the very end of the string. + * @param bool $bybit Whether or not Redis should treat $start and $end as bit positions, rather than bytes. * * @return false|int|Redis The number of bits set to 1 in the value behind the input key or Redis if in multimode * @@ -2639,7 +2804,7 @@ public function setBit($key, $offset, $value) {} * var_dump( $redis->bitCount('bit', 0, 2) ); // int(11) * */ - public function bitCount($key, $start = 0, $end = -1) {} + public function bitCount($key, $start = 0, $end = -1, $bybit = false) {} /** * Bitwise operation on multiple keys. @@ -2670,7 +2835,7 @@ public function bitOp($operation, $retKey, $key1, ...$otherKeys) {} /** * Removes all entries from the current database. * - * @param bool $async requires server version 4.0.0 or greater + * @param bool|null $async Whether to perform the task in a blocking or non-blocking way. Requires server version 4.0.0 or greater * * @return bool|Redis Always TRUE or Redis if in multimode * @throws RedisException @@ -2682,7 +2847,7 @@ public function flushDB($async = null) {} /** * Removes all entries from all databases. * - * @param bool $async requires server version 4.0.0 or greater + * @param bool|null $async Whether to perform the task in a blocking or non-blocking way. Requires server version 4.0.0 or greater * * @return bool|Redis Always TRUE or Redis if in multimode * @@ -2694,19 +2859,23 @@ public function flushDB($async = null) {} public function flushAll($async = null) {} /** - * Sort + * Sort the contents of a Redis key in various ways. * - * @param string $key - * @param array $option array(key => value, ...) - optional, with the following keys and values: - * - 'by' => 'some_pattern_*', - * - 'limit' => array(0, 1), - * - 'get' => 'some_other_pattern_*' or an array of patterns, - * - 'sort' => 'asc' or 'desc', - * - 'alpha' => TRUE, - * - 'store' => 'external-key' + * @param string $key The key you wish to sort + * @param array|null $options Various options controlling how you would like the data sorted. + * See blow for a detailed description of this options array. + * 'SORT' => 'ASC'|| 'DESC' // Sort in descending or descending order. + * 'ALPHA' => true || false // Whether to sort alphanumerically. + * 'LIMIT' => [0, 10] // Return a subset of the data at offset, count + * 'BY' => 'weight_*' // For each element in the key, read data from the + * external key weight_* and sort based on that value. + * 'GET' => 'weight_*' // For each element in the source key, retrieve the + * data from key weight_* and return that in the result + * rather than the source keys' element. This can + * be used in combination with 'BY' * - * @return array|Redis returns Redis if in multimode - * An array of values, or a number corresponding to the number of elements stored if that was used + * @return mixed This command can either return an array with the sorted data or the + * number of elements placed in a destination set when using the STORE option. * * @throws RedisException * @@ -2725,12 +2894,14 @@ public function flushAll($async = null) {} * var_dump($redis->sort('s', array('sort' => 'desc', 'store' => 'out'))); // (int)5 * */ - public function sort($key, $option = null) {} + public function sort($key, $options = null) {} /** * Returns an associative array of strings and integers * - * @param string $option Optional. The option to provide redis. + * If connected to Redis server >= 7.0.0 you may pass multiple optional sections. + * + * @param string ...$sections Optional section(s) you wish Redis server to return. * SERVER | CLIENTS | MEMORY | PERSISTENCE | STATS | REPLICATION | CPU | CLUSTER | KEYSPACE | COMMANDSTATS * * Returns an associative array of strings and integers, with the following keys: @@ -2777,7 +2948,7 @@ public function sort($key, $option = null) {} * - vm_enabled * - role * - * @return array|Redis returns Redis if in multimode + * @return array|false|Redis returns Redis if in multimode * * @throws RedisException * @@ -2792,12 +2963,12 @@ public function sort($key, $option = null) {} * $redis->info("CPU"); // just CPU information from Redis INFO * */ - public function info($option = null) {} + public function info(...$sections) {} /** * Returns an indexed array whose first element is the role * - * @return array|Redis returns Redis if in multimode + * @return mixed|Redis Will return an array with the role of the connected instance unless there is an error. returns Redis if in multimode * * @throws RedisException * @@ -2825,7 +2996,7 @@ public function role() {} * @example $redis->resetStat(); * @link https://redis.io/commands/config-resetstat */ - #[Deprecated(replacement: '%class%->rawCommand(\'CONFIG\', \'RESETSTAT\');')] + #[Deprecated(replacement: "%class%->rawCommand('CONFIG', 'RESETSTAT')")] public function resetStat() {} /** @@ -2956,13 +3127,17 @@ public function getMultiple(array $keys) {} public function mGet(array $array) {} /** - * @see mset() + * Set one ore more string keys but only if none of the key exist. + * + * @see mSet() + * * @param array $array * @return false|int|Redis 1 (if the keys were set) or 0 (no key was set) or Redis if in multimode * * @throws RedisException * * @link https://redis.io/commands/msetnx + * @example $redis->msetnx(['foo' => 'bar', 'baz' => 'bop']); */ public function msetnx(array $array) {} @@ -3018,7 +3193,7 @@ public function rPopLPush($srcKey, $dstKey) {} * * @param string $srcKey * @param string $dstKey - * @param int $timeout + * @param int|float $timeout The number of seconds to wait. Note that you must be connected to Redis >= 6.0.0 to send a floating point timeout. * * @return string|mixed|bool|Redis The element that was moved in case of success, FALSE in case of timeout or Redis if in multimode * @@ -3031,14 +3206,26 @@ public function bRPopLPush($srcKey, $dstKey, $timeout) {} /** * Adds the specified member with a given score to the sorted set stored at key * - * @param string $key Required key - * @param array|float $options Options if needed or score if omitted - * @param float|string|mixed $score1 Required score or value if options omitted - * @param string|float|mixed $value1 Required value or optional score if options omitted - * @param float|string|mixed $score2 Optional score or value if options omitted - * @param string|float|mixed $value2 Optional value or score if options omitted - * @param float|string|mixed $scoreN Optional score or value if options omitted - * @param string|float|mixed $valueN Optional value or score if options omitted + * @param string $key The sorted set in question. + * @param array|float $score_or_options Either the score for the first element, or an array of options. + * 'NX', # Only update elements that already exist + * 'NX', # Only add new elements but don't update existing ones. + * 'LT' # Only update existing elements if the new score is + * # less than the existing one. + * 'GT' # Only update existing elements if the new score is + * # greater than the existing one. + * 'CH' # Instead of returning the number of elements added, + * # Redis will return the number Of elements that were + * # changed in the operation. + * 'INCR' # Instead of setting each element to the provide score, + * # increment the element by the + * # provided score, much like ZINCRBY. When this option + * # is passed, you may only send a single score and member. + * + * Note: 'GX', 'LT', and 'NX' cannot be passed together, and PhpRedis + * will send whichever one is last in the options array. + * + * @param mixed $more_scores_and_mems A variadic number of additional scores and members. * * @return false|int|Redis Number of values added or Redis if in multimode * @@ -3072,7 +3259,7 @@ public function bRPopLPush($srcKey, $dstKey, $timeout) {} * // ["v6"]=> float(8) * */ - public function zAdd($key, $options, $score1, $value1 = null, $score2 = null, $value2 = null, $scoreN = null, $valueN = null) {} + public function zAdd($key, $score_or_options, ...$more_scores_and_mems) {} /** * Returns a range of elements from the ordered set stored at the specified key, @@ -3082,10 +3269,20 @@ public function zAdd($key, $options, $score1, $value1 = null, $score2 = null, $v * -1 the last element, * -2 the penultimate ... * - * @param string $key - * @param int $start - * @param int $end - * @param mixed $withscores + * @param string $key The sorted set in question. + * @param string|int $start The starting index we want to return. + * @param string|int $end The final index we want to return. + * + * @param array|bool|null $options This value may either be an array of options to pass to + * the command, or for historical purposes a boolean which + * controls just the 'WITHSCORES' option. + * 'WITHSCORES' => true, # Return both scores and members. + * 'LIMIT' => [10, 10], # Start at offset 10 and return 10 elements. + * 'REV' # Return the elements in reverse order + * 'BYSCORE', # Treat `start` and `end` as scores instead + * 'BYLEX' # Treat `start` and `end` as lexicographical values. + + * Note: 'BYLEX' and 'BYSCORE' are mutually exclusive. * * @return array|Redis Array containing the values in specified range or Redis if in multimode * @@ -3102,7 +3299,7 @@ public function zAdd($key, $options, $score1, $value1 = null, $score2 = null, $v * $redis->zRange('key1', 0, -1, true); // array('val0' => 0, 'val2' => 2, 'val10' => 10) * */ - public function zRange($key, $start, $end, $withscores = null) {} + public function zRange($key, $start, $end, $options = null) {} /** * Deletes a specified member from the ordered set. @@ -3152,10 +3349,10 @@ public function zDelete($key, $member1, ...$otherMembers) {} * -1 the last element, * -2 the penultimate ... * - * @param string $key - * @param int $start - * @param int $end - * @param mixed $withscore + * @param string $key The sorted set in question. + * @param int $start The index to start listing elements + * @param int $end The index to stop listing elements. + * @param mixed $scores Whether or not Redis should also return each members score. * * @return array|Redis Array containing the values in specified range or Redis if in multimode * @@ -3171,9 +3368,10 @@ public function zDelete($key, $member1, ...$otherMembers) {} * * // with scores * $redis->zRevRange('key', 0, -1, true); // array('val10' => 10, 'val2' => 2, 'val0' => 0) + * $redis->zRevRange('key', 0, -1, ['withscores' => true]); * */ - public function zRevRange($key, $start, $end, $withscore = null) {} + public function zRevRange($key, $start, $end, $scores = null) {} /** * Returns the elements of the sorted set stored at the specified key which have scores in the @@ -3182,14 +3380,16 @@ public function zRevRange($key, $start, $end, $withscore = null) {} * * zRevRangeByScore returns the same items in reverse order, when the start and end parameters are swapped. * - * @param string $key - * @param int $start - * @param int $end - * @param array $options Two options are available: - * - withscores => TRUE, - * - and limit => array($offset, $count) + * @param string $key The sorted set to query. + * @param string $start The minimum score of elements that Redis should return. + * @param string $end The maximum score of elements that Redis should return. + * @param array $options Options that change how Redis will execute the command. * - * @return array|Redis Array containing the values in specified range or Redis if in multimode + * OPTION TYPE MEANING + * 'WITHSCORES' bool Whether to also return scores. + * 'LIMIT' [offset, count] Limit the reply to a subset of elements. + * + * @return array|false|Redis Array containing the values in specified range or Redis if in multimode * * @throws RedisException * @@ -3208,15 +3408,37 @@ public function zRevRange($key, $start, $end, $withscore = null) {} public function zRangeByScore($key, $start, $end, array $options = []) {} /** - * @param string $key - * @param string $start - * @param string $end - * @param array $options + * List elements from a Redis sorted set by score, highest to lowest * - * @return array|Redis returns Redis if in multimode + * @param string $key The sorted set to query. + * @param string $start The highest score to include in the results. + * @param string $end The lowest score to include in the results. + * @param array $options An options array that modifies how the command executes. + * + * $options = [ + * 'WITHSCORES' => true|false # Whether or not to return scores + * 'LIMIT' => [offset, count] # Return a subset of the matching members + * ]; + * + * + * NOTE: For legacy reason, you may also simply pass `true` for the + * options argument, to mean `WITHSCORES`. + * + * @return array|false|Redis returns Redis if in multimode * * @throws RedisException * @see zRangeByScore() + * + * @example + * $redis->zadd('oldest-people', 122.4493, 'Jeanne Calment', 119.2932, 'Kane Tanaka', + * 119.2658, 'Sarah Knauss', 118.7205, 'Lucile Randon', + * 117.7123, 'Nabi Tajima', 117.6301, 'Marie-Louise Meilleur', + * 117.5178, 'Violet Brown', 117.3753, 'Emma Morano', + * 117.2219, 'Chiyo Miyako', 117.0740, 'Misao Okawa'); + * + * $redis->zRevRangeByScore('oldest-people', 122, 119); + * $redis->zRevRangeByScore('oldest-people', 'inf', 118); + * $redis->zRevRangeByScore('oldest-people', '117.5', '-inf', ['LIMIT' => [0, 1]]); */ public function zRevRangeByScore(string $key, string $start, string $end, array $options = []) {} @@ -3230,7 +3452,7 @@ public function zRevRangeByScore(string $key, string $start, string $end, array * @param string $min The minimum alphanumeric value you wish to get. * @param string $max The maximum alphanumeric value you wish to get. * @param int $offset Optional argument if you wish to start somewhere other than the first element. - * @param int $limit Optional argument if you wish to limit the number of elements returned. + * @param int $count An optional count to limit the replies to (used in conjunction with offset) * * @return array|false|Redis Array containing the values in the specified range or Redis if in multimode * @@ -3250,20 +3472,87 @@ public function zRevRangeByScore(string $key, string $start, string $end, array */ public function zRangeByLex(string $key, string $min, string $max, int $offset = -1, int $count = -1) {} + /** + * Retrieve the score of one or more members in a sorted set. + * + * @link https://redis.io/commands/zmscore + * + * @param string $key The sorted set + * @param mixed $member The first member to return the score from + * @param mixed $other_members One or more additional members to return the scores of. + * + * @return Redis|array|false An array of the scores of the requested elements. + * + * @example + * $redis->zAdd('zs', 0, 'zero', 1, 'one', 2, 'two', 3, 'three'); + * + * $redis->zMScore('zs', 'zero', 'two'); + * $redis->zMScore('zs', 'one', 'not-a-member'); + */ public function zMscore(string $key, string $member, string ...$other_members): array|false {} - public function zPopMax(string $key, int $value = null): array|false {} + /** + * Pop one or more of the highest scoring elements from a sorted set. + * + * @param string $key The sorted set to pop elements from. + * @param int|null $count An optional count of elements to pop. + * + * @return Redis|array|false All of the popped elements with scores or false on fialure. + * + * @link https://redis.io/commands/zpopmax + * + * @example + * $redis->zAdd('zs', 0, 'zero', 1, 'one', 2, 'two', 3, 'three'); + * + * $redis->zPopMax('zs'); + * $redis->zPopMax('zs', 2);. + */ + public function zPopMax(string $key, int $count = null): array|false {} - public function zPopMin(string $key, int $value = null): array|false {} + /** + * Pop one or more of the lowest scoring elements from a sorted set. + * + * @param string $key The sorted set to pop elements from. + * @param int|null $count An optional count of elements to pop. + * + * @return Redis|array|false The popped elements with their scores or false on failure. + * + * @link https://redis.io/commands/zpopmin + * + * @example + * $redis->zAdd('zs', 0, 'zero', 1, 'one', 2, 'two', 3, 'three'); + * + * $redis->zPopMin('zs'); + * $redis->zPopMin('zs', 2); + */ + public function zPopMin(string $key, int $count = null): array|false {} + /** + * Retrieve one or more random members from a Redis sorted set. + * + * @param string $key The sorted set to pull random members from. + * @param array|null $options One or more options that determine exactly how the command operates. + * + * OPTION TYPE MEANING + * 'COUNT' int The number of random members to return. + * 'WITHSCORES' bool Whether to return scores and members instead of + * + * @return Redis|string|array One ore more random elements. + * + * @see https://redis.io/commands/zrandmember + * + * @example $redis->zRandMember('zs', ['COUNT' => 2, 'WITHSCORES' => true]); + */ public function zRandMember(string $key, array $options = null): string|array|false {} /** - * @param string $key - * @param string $min - * @param string $max - * @param int $offset - * @param int $limit + * List members of a Redis sorted set within a legographical range, in reverse order. + * + * @param string $key The sorted set to list + * @param string $min The maximum legographical element to include in the result. + * @param string $min The minimum lexographical element to include in the result. + * @param int $offset An option offset within the matching elements to start at. + * @param int $count An optional count to limit the replies to. * * @return false|array|Redis returns Redis if in multimode * @@ -3271,6 +3560,10 @@ public function zRandMember(string $key, array $options = null): string|array|fa * * @see zRangeByLex() * @link https://redis.io/commands/zrevrangebylex + * + * @example + * $redis->zRevRangeByLex('captains', '[Q', '[J'); + * $redis->zRevRangeByLex('captains', '[Q', '[J', 1, 2); */ public function zRevRangeByLex(string $key, string $min, string $max, int $offset = -1, int $count = -1) {} @@ -3278,12 +3571,17 @@ public function zRevRangeByLex(string $key, string $min, string $max, int $offse * Removes all elements in the sorted set stored at key between the lexicographical range specified by min and max. * Applies when all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering. * - * @param string $key The ZSET you wish to run against. - * @param string $min The minimum alphanumeric value you wish to get. - * @param string $max The maximum alphanumeric value you wish to get. + * @param string $key The sorted set to remove elements from. + * @param string $min The start of the lexographical range to remove. + * @param string $max The end of the lexographical range to remove + * + * @return int|false|Redis The number of elements removed * - * @return int|false the number of elements removed. * @link https://redis.io/commands/zremrangebylex + * + * @example + * $redis->zRemRangeByLex('zs', '[a', '(b'); + * $redis->zRemRangeByLex('zs', '(banana', '(eggplant'); */ public function zRemRangeByLex(string $key, string $min, string $max) {} @@ -3398,6 +3696,24 @@ public function zDeleteRangeByRank($key, $start, $end) {} */ public function zCard($key) {} + /** + * Given one or more sorted set key names, return every element that is in the first + * set but not any of the others. + * + * @param array $keys One ore more sorted sets. + * @param array|null $options An array which can contain ['WITHSCORES' => true] if you want Redis to return members and scores. + * + * @return Redis|array|false An array of members or false on failure. + * + * @link https://redis.io/commands/zdiff + * + * @example + * $redis->zAdd('primes', 1, 'one', 3, 'three', 5, 'five'); + * $redis->zAdd('evens', 2, 'two', 4, 'four'); + * $redis->zAdd('mod3', 3, 'three', 6, 'six'); + * + * $redis->zDiff(['primes', 'evens', 'mod3']); + */ public function zdiff(array $keys, array $options = null): array|false {} /** @@ -3412,8 +3728,8 @@ public function zSize($key) {} /** * Returns the score of a given member in the specified sorted set. * - * @param string $key - * @param string|mixed $member + * @param string $key The sorted set to query. + * @param mixed $member The member we wish to query. * * @return float|bool|Redis false if member or key not exists or Redis if in multimode * @@ -3433,7 +3749,7 @@ public function zScore($key, $member) {} * with the smallest score. zRevRank starts at 0 for the item with the largest score. * * @param string $key - * @param string|mixed $member + * @param mixed $member * * @return int|false|Redis the item's score, or false if key or member is not exists or Redis if in multimode * @@ -3471,7 +3787,7 @@ public function zRevRank($key, $member) {} * * @param string $key * @param float $value (double) value that will be added to the member's score - * @param string|mixed $member + * @param mixed $member * * @return float|Redis the new value or Redis if in multimode * @@ -3499,7 +3815,7 @@ public function zIncrBy($key, $value, $member) {} * @param string $output * @param array $zSetKeys * @param null|array $weights - * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": defines the behaviour to use on + * @param string|null $aggregateFunction Either "SUM", "MIN", or "MAX": defines the behaviour to use on * duplicate entries during the zUnionStore * * @return false|int|Redis The number of values in the new sorted set or Redis if in multimode @@ -3553,7 +3869,7 @@ public function zUnion($Output, $ZSetKeys, array $Weights = null, $aggregateFunc * @param string $output * @param array $zSetKeys * @param null|array $weights - * @param string $aggregateFunction Either "SUM", "MIN", or "MAX": + * @param string|null $aggregateFunction Either "SUM", "MIN", or "MAX": * defines the behaviour to use on duplicate entries during the zInterStore. * * @return false|int|Redis The number of values in the new sorted set or Redis if in multimode @@ -3603,7 +3919,7 @@ public function zInter($Output, $ZSetKeys, array $Weights = null, $aggregateFunc * Scan a sorted set for members, with optional pattern and count * * @param string $key String, the set to scan. - * @param int &$iterator Long (reference), initialized to NULL. + * @param int|null &$iterator Long (reference), initialized to NULL. * @param string $pattern String (optional), the pattern to match. * @param int $count How many keys to return per iteration (Redis might return a different number). * @@ -3628,9 +3944,9 @@ public function zScan($key, &$iterator, $pattern = null, $count = 0) {} * Block until Redis can pop the highest or lowest scoring members from one or more ZSETs. * There are two commands (BZPOPMIN and BZPOPMAX for popping the lowest and highest scoring elements respectively.) * - * @param string|array $key - * @param string|int|array $timeout_or_key ... - * @param mixed ...$extra_args + * @param string|array $key_or_keys Either a string key or an array of one or more keys. + * @param string|int|array $timeout_or_key If the previous argument was an array, this argument must be a timeout value. Otherwise it could also be another key. + * @param mixed ...$extra_args Can consist of additional keys, until the last argument which needs to be a timeout. * * @return false|array|Redis Either an array with the key member and score of the highest or lowest element or an empty array or Redis if in multimode * if the timeout was reached without an element to pop. @@ -3641,21 +3957,19 @@ public function zScan($key, &$iterator, $pattern = null, $count = 0) {} * @link https://redis.io/commands/bzpopmax * @example *
    -     * // Wait up to 5 seconds to pop the *lowest* scoring member from sets `zs1` and `zs2`.
    -     * $redis->bzPopMin(['zs1', 'zs2'], 5);
    -     * $redis->bzPopMin('zs1', 'zs2', 5);
    -     *
          * // Wait up to 5 seconds to pop the *highest* scoring member from sets `zs1` and `zs2`
          * $redis->bzPopMax(['zs1', 'zs2'], 5);
          * $redis->bzPopMax('zs1', 'zs2', 5);
          * 
    */ - public function bzPopMax($key, $timeout_or_key, ...$extra_args) {} + public function bzPopMax($key_or_keys, $timeout_or_key, ...$extra_args) {} /** - * @param string|array $key - * @param string|int|array $timeout_or_key ... - * @param mixed ...$extra_args + * POP the minimum scoring element off of one or more sorted sets, blocking up to a specified timeout if no elements are available. + * + * @param string|array $key_or_keys Either a string key or an array of one or more keys. + * @param string|int|array $timeout_or_key If the previous argument was an array, this argument must be a timeout value. Otherwise it could also be another key. + * @param mixed ...$extra_args Can consist of additional keys, until the last argument which needs to be a timeout. * * @return false|array|Redis Either an array with the key member and score of the highest or lowest element or an empty array or Redis if in multimode * if the timeout was reached without an element to pop. @@ -3665,61 +3979,22 @@ public function bzPopMax($key, $timeout_or_key, ...$extra_args) {} * @see bzPopMax * @since >= 5.0 * @link https://redis.io/commands/bzpopmin - */ - public function bzPopMin($key, $timeout_or_key, ...$extra_args) {} - - /** - * Can pop the highest scoring members from one ZSET. - * - * @param string $key - * @param int $count - * - * @return array|Redis Either an array with the key member and score of the highest element or an empty array or Redis if in multimode - * if there is no element to pop. - * - * @throws RedisException * - * @since >= 5.0 - * @link https://redis.io/commands/zpopmax - * @example - *
    -     * // Pop the *lowest* scoring member from set `zs1`.
    -     * $redis->zPopMax('zs1');
    -     * // Pop the *lowest* 3 scoring member from set `zs1`.
    -     * $redis->zPopMax('zs1', 3);
    -     * 
    - */ - public function zPopMax($key, $count = null) {} - - /** - * Can pop the lowest scoring members from one ZSET. - * - * @param string $key - * @param int $count - * - * @return array|Redis Either an array with the key member and score of the lowest element or an empty array or Redis if in multimode - * if there is no element to pop. - * - * @throws RedisException - * - * @since >= 5.0 - * @link https://redis.io/commands/zpopmin * @example *
    -     * // Pop the *lowest* scoring member from set `zs1`.
    -     * $redis->zPopMin('zs1');
    -     * // Pop the *lowest* 3 scoring member from set `zs1`.
    -     * $redis->zPopMin('zs1', 3);
    +     * // Wait up to 5 seconds to pop the *lowest* scoring member from sets `zs1` and `zs2`.
    +     * $redis->bzPopMin(['zs1', 'zs2'], 5);
    +     * $redis->bzPopMin('zs1', 'zs2', 5);
          * 
    */ - public function zPopMin($key, $count = null) {} + public function bzPopMin($key_or_keys, $timeout_or_key, ...$extra_args) {} /** * Adds a value to the hash stored at key. If this value is already in the hash, FALSE is returned. * * @param string $key * @param string $hashKey - * @param string $value + * @param mixed $value * * @return int|bool|Redis returns Redis if in multimode * - 1 if value didn't exist and was added successfully, @@ -3738,7 +4013,7 @@ public function zPopMin($key, $count = null) {} * $redis->hGet('h', 'key1'); // returns "plop" * */ - public function hSet($key, $hashKey, string $value) {} + public function hSet($key, $hashKey, $value) {} /** * Adds a value to the hash stored at key only if this field isn't already in the hash. @@ -3837,7 +4112,7 @@ public function hDel($key, $hashKey1, ...$otherHashKeys) {} * * @param string $key * - * @return array|Redis An array of elements, the keys of the hash. This works like PHP's array_keys() or Redis if in multimode + * @return array|false|Redis An array of elements, the keys of the hash. This works like PHP's array_keys() or Redis if in multimode * * @throws RedisException * @@ -3872,7 +4147,7 @@ public function hKeys($key) {} * * @param string $key * - * @return array|Redis An array of elements, the values of the hash. This works like PHP's array_values() or Redis if in multimode + * @return array|false|Redis An array of elements, the values of the hash. This works like PHP's array_values() or Redis if in multimode * * @throws RedisException * @@ -3907,7 +4182,7 @@ public function hVals($key) {} * * @param string $key * - * @return array|Redis An array of elements, the contents of the hash or Redis if in multimode + * @return array|false|Redis An array of elements, the contents of the hash or Redis if in multimode * * @throws RedisException * @@ -3985,7 +4260,7 @@ public function hIncrBy($key, $hashKey, $value) {} * @param string $field * @param float $increment * - * @return float|Redis returns Redis if in multimode + * @return float|false|Redis returns Redis if in multimode * * @throws RedisException * @@ -4038,7 +4313,7 @@ public function hMSet($key, $hashKeys) {} * @param string $key * @param array $hashKeys * - * @return array|Redis Array An array of elements, the values of the specified fields in the hash, or Redis if in multimode + * @return array|false|Redis Array An array of elements, the values of the specified fields in the hash, or Redis if in multimode * with the hash keys as array keys. * * @throws RedisException @@ -4058,7 +4333,7 @@ public function hMGet($key, $hashKeys) {} * Scan a HASH value for members, with an optional pattern and count. * * @param string $key - * @param int &$iterator + * @param int|null ?$iterator The scan iterator, which should be initialized to NULL before the first call. * @param string $pattern Optional pattern to match against. * @param int $count How many keys to return in a go (only a sugestion to Redis). * @@ -4069,12 +4344,24 @@ public function hMGet($key, $hashKeys) {} * @link https://redis.io/commands/hscan * @example *
    -     * // $iterator = null;
    -     * // while($elements = $redis->hscan('hash', $iterator)) {
    -     * //     foreach($elements as $key => $value) {
    -     * //         echo $key . ' => ' . $value . PHP_EOL;
    -     * //     }
    -     * // }
    +     * $redis->del('big-hash');
    +     *
    +     * for ($i = 0; $i < 1000; $i++) {
    +     *     $fields["field:$i"] = "value:$i";
    +     * }
    +     *
    +     * $redis->hMSet('big-hash', $fields);
    +     *
    +     * $it = NULL;
    +     *
    +     * do {
    +     *     // Scan the hash but limit it to fields that match '*:1?3'
    +     *     $fields = $redis->hScan('big-hash', $it, '*:1?3');
    +     *
    +     *     foreach ($fields as $field => $value) {
    +     *         echo "[$field] => $value\n";
    +     *     }
    +     * } while ($it != 0);
          * 
    */ public function hScan($key, &$iterator, $pattern = null, $count = 0) {} @@ -4092,6 +4379,11 @@ public function hScan($key, &$iterator, $pattern = null, $count = 0) {} * * @link https://redis.io/commands/hstrlen * @since >= 3.2 + * + * @example + * $redis->del('hash'); + * $redis->hMSet('hash', ['50bytes' => str_repeat('a', 50)]); + * $redis->hStrLen('hash', '50bytes'); */ public function hStrLen(string $key, string $field) {} @@ -4103,7 +4395,8 @@ public function hStrLen(string $key, string $field) {} * @param float $longitude * @param float $latitude * @param string $member - * @param mixed ...$other_triples + * @param mixed $other_triples_and_options You can continue to pass longitude, lattitude, and member arguments to add as many members + * as you wish. Optionally, the final argument may be a string with options for the command * * @return false|int|Redis The number of elements added to the geospatial key or Redis if in multimode * @@ -4122,13 +4415,16 @@ public function hStrLen(string $key, string $field) {} * -122.431, 37.773, "San Francisco", * -157.858, 21.315, "Honolulu" * ); // 2 + * + * $redis->geoAdd('cities', -121.837478, 39.728494, 'Chico', ['XX', 'CH']); + * $redis->geoAdd('cities', -121.8374, 39.7284, 'Chico', -122.03218, 37.322, 'Cupertino'); * */ - public function geoAdd($key, $longitude, $latitude, $member, ...$other_triples) {} + public function geoAdd($key, $longitude, $latitude, $member, ...$other_triples_and_options) {} /** * Retrieve Geohash strings for one or more elements of a geospatial index. - + * * @param string $key * @param string ...$member variadic list of members * @@ -4187,8 +4483,43 @@ public function geoHash($key, ...$member) {} */ public function geoPos(string $key, string ...$member) {} + /** + * Search a geospacial sorted set for members in various ways. + * + * @param string $key The set to query. + * @param array|string $position Either a two element array with longitude and lattitude, or a string representing a member of the set. + * @param array|int|float $shape Either a number representine the radius of a circle to search, or + * a two element array representing the width and height of a box to search. + * @param string $unit The unit of our shape. See geodist() for possible units. + * @param array $options See georadius() for options. Note that the `STORE` options are not allowed for this command. + * + * @return mixed[] + */ public function geosearch(string $key, array|string $position, array|int|float $shape, string $unit, array $options = []): array|false {} + /** + * Search a geospacial sorted set for members within a given area or range, storing the results into + * a new set. + * + * @param string $dst The destination where results will be stored. + * @param string $src The key to query. + * @param array|string $position Either a two element array with longitude and lattitude, or a string representing a member of the set. + * @param array|int|float $shape Either a number representine the radius of a circle to search, or + * a two element array representing the width and height of a box to search. + * @param string $unit The unit of our shape. See geoDist for possible units. + * @param array $options + * + * $options = [ + * 'ASC' | 'DESC', # The sort order of returned members + * 'WITHDIST' # Also store distances. + * # Limit to N returned members. Optionally a two element array may be + * # passed as the `LIMIT` argument, and the `ANY` argument. + * 'COUNT' => [], or [, ] + * ]; + * + * + * @return mixed[]|int|true|Redis + */ public function geosearchstore(string $dst, string $src, array|string $position, array|int|float $shape, string $unit, array $options = []): array|false {} /** @@ -4203,7 +4534,7 @@ public function geosearchstore(string $dst, string $src, array|string $position, * @param string $key * @param string $member1 * @param string $member2 - * @param string|null $unit + * @param string|null $unit Which unit to use when computing distance, defaulting to meters. M - meters, KM - kilometers, FT - feet, MI - miles * * @return float|Redis The distance between the two passed members in the units requested (meters by default) or Redis if in multimode * @@ -4356,7 +4687,7 @@ public function geoRadius($key, $longitude, $latitude, $radius, $unit, array $op * @param $units * @param array|null $options see georadius * - * @return array|Redis The zero or more entries that are close enough to the member given the distance and radius specified or Redis if in multimode + * @return mixed|Redis The zero or more entries that are close enough to the member given the distance and radius specified or Redis if in multimode * * @throws RedisException * @@ -4389,24 +4720,26 @@ public function geoRadius($key, $longitude, $latitude, $radius, $unit, array $op public function geoRadiusByMember($key, $member, $radius, $units, array $options = []) {} /** - * Get or Set the redis config keys. + * Execute the Redis CONFIG command in a variety of ways. * - * @param string $operation either `GET` or `SET` - * @param string $key for `SET`, glob-pattern for `GET` - * @param string|mixed $value optional string (only for `SET`) + * @param string $operation Operations that PhpRedis supports: RESETSTAT, REWRITE, GET, and SET. + * @param array|string|null $key_or_settings One or more keys or values. + * @param string|null $value The value if this is a `CONFIG SET` operation. * - * @return array|Redis Associative array for `GET`, key -> value or Redis if in multimode + * @return mixed|Redis Associative array for `GET`, key -> value or Redis if in multimode * * @throws RedisException * * @link https://redis.io/commands/config-get * @example *
    -     * $redis->config("GET", "*max-*-entries*");
    -     * $redis->config("SET", "dir", "/var/run/redis/dumps/");
    +     * $redis->config('GET', 'timeout');
    +     * $redis->config('GET', ['timeout', 'databases']);
    +     * $redis->config('SET', 'timeout', 30);
    +     * $redis->config('SET', ['timeout' => 30, 'loglevel' => 'warning']);
          * 
    */ - public function config($operation, $key, $value = null) {} + public function config($operation, $key_or_settings = null, $value = null) {} /** * Evaluate a LUA script serverside @@ -4487,7 +4820,7 @@ public function evaluateSha($scriptSha, $args = [], $numKeys = 0) {} * @param string $command load | flush | kill | exists * @param mixed ...$script * - * @return mixed|Redis returns Redis if in multimode + * @return mixed|Redis This command returns various things depending on the specific operation executed. Redis if in multimode * * @throws RedisException * @@ -4529,7 +4862,7 @@ public function getLastError() {} /** * Clear the last error message * - * @return bool true + * @return bool This should always return true or throw an exception if we're not connected. * * @throws RedisException * @@ -4555,7 +4888,7 @@ public function clearLastError() {} * - CLIENT KILL [ip:port] * * @param string $command - * @param string $value + * @param mixed ...$args * @return mixed This will vary depending on which client command was executed: * - CLIENT LIST will return an array of arrays with client information. * - CLIENT GETNAME will return the client name or false if none has been set @@ -4579,7 +4912,7 @@ public function clearLastError() {} * $redis->client('kill', ); // Kill the process at ip:port * */ - public function client($command, $value = null) {} + public function client($command, ...$args) {} /** * A utility method to prefix the value with the prefix setting for phpredis. @@ -4624,7 +4957,7 @@ public function _unserialize($value) {} * * @param mixed $value The value to be serialized. * - * @return mixed + * @return string * @example *
          * $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);
    @@ -4643,7 +4976,7 @@ public function _serialize($value) {}
          * The data that comes out of DUMP is a binary representation of the key as Redis stores it.
          * @param string $key
          *
    -     * @return string|false The Redis encoded value of the key, or FALSE if the key doesn't exist
    +     * @return string|false|Redis A binary string representing the key's value or FALSE if the key doesn't exist or Redis if in multimode
          *
          * @throws RedisException
          *
    @@ -4659,11 +4992,25 @@ public function dump($key) {}
         /**
          * Restore a key from the result of a DUMP operation.
          *
    -     * @param string $key   The key name
    -     * @param int    $ttl   How long the key should live (if zero, no expire will be set on the key)
    -     * @param string $value (binary).  The Redis encoded key value (from DUMP)
    +     * @param string $key     The name of the key you wish to create.
    +     * @param int    $ttl     What Redis should set the key's TTL (in milliseconds) to once it is created.Zero means no TTL at all.
    +     * @param string $value   The serialized binary value of the string (generated by DUMP).
    +     * @param array|null $options An array of additional options that modifies how the command operates.
    +     *                        
    +     *                        $options = [
    +     *                            'ABSTTL'          # If this is present, the `$ttl` provided by the user should
    +     *                                              # be an absolute timestamp, in milliseconds()
          *
    -     * @return bool
    +     *                            'REPLACE'         # This flag instructs Redis to store the key even if a key with
    +     *                                              # that name already exists.
    +     *
    +     *                            'IDLETIME' => int # Tells Redis to set the keys internal 'idletime' value to a
    +     *                                              # specific number (see the Redis command OBJECT for more info).
    +     *                            'FREQ'     => int # Tells Redis to set the keys internal 'FREQ' value to a specific
    +     *                                              # number (this relates to Redis' LFU eviction algorithm).
    +     *                        ];
    +     *                        
    +     * @return bool|Redis True if the key was stored, false if not.
          *
          * @throws RedisException
          *
    @@ -4675,20 +5022,21 @@ public function dump($key) {}
          * $redis->restore('bar', 0, $val); // The key 'bar', will now be equal to the key 'foo'
          * 
    */ - public function restore($key, $ttl, $value) {} + public function restore($key, $ttl, $value, $options = null) {} /** * Migrates a key to a different Redis instance. * * @param string $host The destination host * @param int $port The TCP port to connect to. - * @param string $key The key to migrate. + * @param string|array $key The key to migrate. * @param int $db The target DB. * @param int $timeout The maximum amount of time given to this transfer. * @param bool $copy Should we send the COPY flag to redis. * @param bool $replace Should we send the REPLACE flag to redis. + * @param mixed $credentials * - * @return bool + * @return bool|Redis * * @throws RedisException * @@ -4698,10 +5046,10 @@ public function restore($key, $ttl, $value) {} * $redis->migrate('backup', 6379, 'foo', 0, 3600); * */ - public function migrate($host, $port, $key, $db, $timeout, $copy = false, $replace = false) {} + public function migrate($host, $port, $key, $dstdb, $timeout, $copy = false, $replace = false, $credentials = null) {} /** - * Return the current Redis server time. + * Retrieve the server time from the connected Redis instance. * * @return false|array If successful, the time will come back as an associative array with element zero being the * unix timestamp, and element one being microseconds. @@ -4723,9 +5071,20 @@ public function time() {} /** * Scan the keyspace for keys * - * @param int &$iterator Iterator, initialized to NULL. - * @param string $pattern Pattern to match. - * @param int $count Count of keys per iteration (only a suggestion to Redis). + * @param int|null ?$iterator The cursor returned by Redis for every subsequent call to SCAN. On + * the initial invocation of the call, it should be initialized by the + * caller to NULL. Each time SCAN is invoked, the iterator will be + * updated to a new number, until finally Redis will set the value to + * zero, indicating that the scan is complete. + * + * @param string $pattern An optional glob-style pattern for matching key names. If passed as + * NULL, it is the equivalent of sending '*' (match every key). + * + * @param int $count A hint to redis that tells it how many keys to return in a single + * call to SCAN. The larger the number, the longer Redis may block + * clients while iterating the key space. + * + * @param string|null $type An optional argument to specify which key types to scan (e.g. 'STRING', 'LIST', 'SET') * * @return array|false|Redis This function will return an array of keys or FALSE if there are no more keys or Redis if in multimode * @@ -4734,15 +5093,31 @@ public function time() {} * @link https://redis.io/commands/scan * @example *
    -     * $iterator = null;
    -     * while(false !== ($keys = $redis->scan($iterator))) {
    -     *     foreach($keys as $key) {
    -     *         echo $key . PHP_EOL;
    +     * $redis->setOption(Redis::OPT_SCAN, Redis::SCAN_NORETRY);
    +     *
    +     * $it = null;
    +     *
    +     * do {
    +     *     $keys = $redis->scan($it, '*zorg*');
    +     *     foreach ($keys as $key) {
    +     *         echo "KEY: $key\n";
    +     *     }
    +     * } while ($it != 0);
    +     *
    +     * $redis->setOption(Redis::OPT_SCAN, Redis::SCAN_RETRY);
    +     *
    +     * $it = null;
    +     *
    +     * // When Redis::SCAN_RETRY is enabled, we can use simpler logic, as we will never receive an
    +     * // empty array of keys when the iterator is nonzero.
    +     * while ($keys = $redis->scan($it, '*zorg*')) {
    +     *     foreach ($keys as $key) {
    +     *         echo "KEY: $key\n";
          *     }
          * }
          * 
    */ - public function scan(&$iterator, $pattern = null, $count = 0) {} + public function scan(&$iterator, $pattern = null, $count = 0, $type = null) {} /** * Adds all the element arguments to the HyperLogLog data structure stored at the key. @@ -4750,7 +5125,7 @@ public function scan(&$iterator, $pattern = null, $count = 0) {} * @param string $key * @param array $elements * - * @return bool|Redis returns Redis if in multimode + * @return bool|int|Redis Returns 1 if the set was altered, and zero if not. Redis if in multimode * * @throws RedisException * @@ -4763,7 +5138,7 @@ public function pfAdd($key, array $elements) {} * When called with a single key, returns the approximated cardinality computed by the HyperLogLog data * structure stored at the specified variable, which is 0 if the variable does not exist. * - * @param string|array $key + * @param string|array $key_or_keys Either one key or an array of keys * * @return false|int|Redis returns Redis if in multimode * @@ -4778,7 +5153,7 @@ public function pfAdd($key, array $elements) {} * $redis->pfCount(array('key1', 'key2')); // int(3) * */ - public function pfCount($key) {} + public function pfCount($key_or_keys) {} /** * Merge multiple HyperLogLog values into an unique value that will approximate the cardinality @@ -4851,16 +5226,21 @@ public function getMode() {} public function xAck($stream, $group, $messages) {} /** - * Add a message to a stream + * Append a message to a stream. * * @param string $key - * @param string $id - * @param array $messages - * @param int $maxLen - * @param bool $isApproximate - * @param bool $nomkstream + * @param string $id The ID for the message we want to add. This can be the special value '*' + * which means Redis will generate the ID that appends the message to the + * end of the stream. It can also be a value in the form -* which will + * generate an ID that appends to the end ot entries with the same value (if any exist). + * @param array $messages + * @param int $maxlen If specified Redis will append the new message but trim any number of the + * oldest messages in the stream until the length is <= $maxlen. + * @param bool $isApproximate Used in conjunction with `$maxlen`, this flag tells Redis to trim the stream + * but in a more efficient way, meaning the trimming may not be exactly to `$maxlen` values. + * @param bool $nomkstream If passed as `TRUE`, the stream must exist for Redis to append the message. * - * @return string|Redis The added message ID or Redis if in multimode + * @return string|true|Redis The added message ID or Redis if in multimode * * @throws RedisException * @@ -4875,14 +5255,33 @@ public function xAck($stream, $group, $messages) {} public function xAdd($key, $id, $messages, $maxLen = 0, $isApproximate = false, $nomkstream = false) {} /** - * Claim ownership of one or more pending messages - * - * @param string $key - * @param string $group - * @param string $consumer - * @param int $min_iddle - * @param array $ids - * @param array $options ['IDLE' => $value, 'TIME' => $value, 'RETRYCOUNT' => $value, 'FORCE', 'JUSTID'] + * This method allows a consumer to take ownership of pending stream entries, by ID. Another + * command that does much the same thing but does not require passing specific IDs is `Redis::xAutoClaim`. + * + * @param string $key The stream we wish to claim messages for. + * @param string $group Our consumer group. + * @param string $consumer Our consumer. + * @param int $min_idle The minimum idle-time in milliseconds a message must have for ownership to be transferred. + * @param array $ids + * @param array $options An options array that modifies how the command operates. + * + * + * # Following is an options array describing every option you can pass. Note that + * # 'IDLE', and 'TIME' are mutually exclusive. + * $options = [ + * 'IDLE' => 3 # Set the idle time of the message to a 3. By default + * # the idle time is set to zero. + * 'TIME' => 1000*time() # Same as IDLE except it takes a unix timestamp in + * # milliseconds. + * 'RETRYCOUNT' => 0 # Set the retry counter to zero. By default XCLAIM + * # doesn't modify the counter. + * 'FORCE' # Creates the pending message entry even if IDs are + * # not already + * # in the PEL with another client. + * 'JUSTID' # Return only an array of IDs rather than the messages + * # themselves. + * ]; + * * * @return false|array|Redis Either an array of message IDs along with corresponding data, or just an array of IDs or Redis if in multimode * (if the 'JUSTID' option was passed). @@ -4930,11 +5329,34 @@ public function xClaim(string $key, string $group, string $consumer, int $min_id public function xDel($key, $ids) {} /** - * @param string $operation e.g.: 'HELP', 'SETID', 'DELGROUP', 'CREATE', 'DELCONSUMER' - * @param string $key - * @param string $group - * @param string $msgId - * @param bool $mkStream + * Perform various operation on consumer groups for a particular Redis STREAM. What the command does + * is primarily based on which operation is passed. + * + * @param string $operation The subcommand you intend to execute. Valid options are as follows + * 'HELP' - Redis will return information about the command + * Requires: none + * 'CREATE' - Create a consumer group. + * Requires: Key, group, consumer. + * 'SETID' - Set the ID of an existing consumer group for the stream. + * Requires: Key, group, id. + * 'CREATECONSUMER' - Create a new consumer group for the stream. You must + * also pass key, group, and the consumer name you wish to + * create. + * Requires: Key, group, consumer. + * 'DELCONSUMER' - Delete a consumer from group attached to the stream. + * Requires: Key, group, consumer. + * 'DESTROY' - Delete a consumer group from a stream. + * Requires: Key, group. + * @param string|null $key The STREAM we're operating on. + * @param string|null $group The consumer group we want to create/modify/delete. + * @param string|null $id_or_consumer The STREAM id (e.g. '$') or consumer group. See the operation section + * for information about which to send. + * @param bool $mkstream This flag may be sent in combination with the 'CREATE' operation, and + * cause Redis to also create the STREAM if it doesn't currently exist. + * + * @param int $entries_read Allows you to set Redis' 'entries-read' STREAM value. This argument is + * only relevant to the 'CREATE' and 'SETID' operations. + * Note: Requires Redis >= 7.0.0. * * @return mixed|Redis This command returns different types depending on the specific XGROUP command executed or Redis if in multimode * @@ -4948,14 +5370,15 @@ public function xDel($key, $ids) {} * $redis->xGroup('DESTROY', 'mystream', 'mygroup'); * */ - public function xGroup($operation, $key = null, $group = null, $msgId = null, $mkStream = false) {} + public function xGroup($operation, $key = null, $group = null, $id_or_consumer = null, $mkstream = false, $entries_read = -2) {} /** * Get information about a stream or consumer groups * - * @param string $operation e.g.: 'CONSUMERS', 'GROUPS', 'STREAM', 'HELP' - * @param string $stream - * @param string $group + * @param string $operation The specific info operation to perform. e.g.: 'CONSUMERS', 'GROUPS', 'STREAM', 'HELP' + * @param string|null $arg1 The first argument (depends on operation) + * @param string|null $arg2 The second argument + * @param int $count The COUNT argument to `XINFO STREAM` * * @return mixed|Redis This command returns different types depending on which subcommand is used or Redis if in multimode * @@ -4967,7 +5390,7 @@ public function xGroup($operation, $key = null, $group = null, $msgId = null, $m * $redis->xInfo('STREAM', 'mystream'); * */ - public function xInfo($operation, $stream = null, $group = null) {} + public function xInfo($operation, $arg1 = null, $arg2 = null, $count = -1) {} /** * Get the length of a given stream. @@ -4989,14 +5412,14 @@ public function xLen($stream) {} /** * Get information about pending messages in a given stream * - * @param string $stream - * @param string $group - * @param string $start - * @param string $end - * @param int $count - * @param string $consumer + * @param string $stream The stream to inspect. + * @param string $group The user group we want to see pending messages from. + * @param string|null $start The minimum ID to consider. + * @param string|null $end The maximum ID to consider. + * @param int $count Optional maximum number of messages to return. + * @param string|null $consumer If provided, limit the returned messages to a specific consumer. * - * @return array|string|Redis Information about the pending messages, in various forms depending on or Redis if in multimode + * @return array|string|false|Redis Information about the pending messages, in various forms depending on or Redis if in multimode * the specific invocation of XPENDING. * * @throws RedisException @@ -5013,10 +5436,10 @@ public function xPending($stream, $group, $start = null, $end = null, $count = - /** * Get a range of messages from a given stream * - * @param string $stream - * @param string $start - * @param string $end - * @param int $count + * @param string $stream The stream key name to list. + * @param string $start The minimum ID to return. + * @param string $end The maximum ID to return. + * @param int $count An optional maximum number of entries to return. * * @return array|bool|Redis The messages in the stream within the requested range or Redis if in multimode * @@ -5036,9 +5459,9 @@ public function xRange($stream, $start, $end, $count = -1) {} /** * Read data from one or more streams and only return IDs greater than sent in the command. * - * @param array $streams - * @param int|string $count - * @param int|string $block + * @param array $streams An associative array with stream name keys and minimum id values. + * @param int $count An optional limit to how many entries are returnd *per stream* + * @param int $block An optional maximum number of milliseconds to block the caller if no data is available on any of the provided streams. * * @return array|bool|Redis The messages in the stream newer than the IDs passed to Redis (if any) or Redis if in multimode * @@ -5055,13 +5478,13 @@ public function xRead($streams, $count = -1, $block = -1) {} /** * This method is similar to xRead except that it supports reading messages for a specific consumer group. * - * @param string $group - * @param string $consumer - * @param array $streams - * @param int|null $count - * @param int|null $block + * @param string $group The consumer group to use. + * @param string $consumer The consumer to use. + * @param array $streams An array of stream names and message IDs + * @param int|null $count Optional maximum number of messages to return + * @param int|null $block How long to block if there are no messages available. * - * @return array|Redis The messages delivered to this consumer group (if any) or Redis if in multimode + * @return array|bool|Redis The messages delivered to this consumer group (if any) or Redis if in multimode * * @throws RedisException * @@ -5080,10 +5503,10 @@ public function xReadGroup($group, $consumer, $streams, $count = 1, $block = 1) * This is identical to xRange except the results come back in reverse order. * Also note that Redis reverses the order of "start" and "end". * - * @param string $stream - * @param string $end - * @param string $start - * @param int $count + * @param string $stream The stream key to query. + * @param string $end The maximum message ID to include. + * @param string $start The minimum message ID to include. + * @param int $count An optional maximum number of messages to include. * * @return array|bool|Redis The messages in the range specified or Redis if in multimode * @@ -5093,6 +5516,7 @@ public function xReadGroup($group, $consumer, $streams, $count = 1, $block = 1) * @example *
          * $redis->xRevRange('mystream', '+', '-');
    +     * $redis->xRevRange('mystream', '0-2', '0-1');
          * 
    */ public function xRevRange($stream, $end, $start, $count = -1) {} @@ -5102,9 +5526,15 @@ public function xRevRange($stream, $end, $start, $count = -1) {} * If the "approximate" flag is pasesed, Redis will use your size as a hint but only trim trees in whole nodes * (this is more efficient) * - * @param string $stream - * @param int $maxLen - * @param bool $isApproximate + * @param string $stream The STREAM key to trim. + * @param string $threshold This can either be a maximum length, or a minimum id. + * MAXLEN - An integer describing the maximum desired length of the stream after the command. + * MINID - An ID that will become the new minimum ID in the stream, as Redis will trim all + * messages older than this ID. + * @param bool $approx Whether redis is allowed to do an approximate trimming of the stream. This is + * more efficient for Redis given how streams are stored internally. + * @param bool $minid When set to `true`, users should pass a minimum ID to the `$threshold` argument. + * @param int $limit An optional upper bound on how many entries to trim during the command. * * @return false|int|Redis The number of messages trimed from the stream or Redis if in multimode * @@ -5119,7 +5549,7 @@ public function xRevRange($stream, $end, $start, $count = -1) {} * $redis->xTrim('mystream', 100, true); * */ - public function xTrim($stream, $maxLen, $isApproximate) {} + public function xTrim($stream, $threshold, $approx = false, $minid = false, $limit = -1) {} /** * Adds a values to the set value stored at key. @@ -5142,6 +5572,721 @@ public function xTrim($stream, $maxLen, $isApproximate) {} * */ public function sAddArray($key, array $values) {} + + public function __destruct() {} + + /** + * Compress a value with the currently configured compressor as set with Redis::setOption(). + * + * @param string $value The value to be compressed + * + * @return string The compressed result + */ + public function _compress($value) {} + + /** + * Uncompress the provided argument that has been compressed with the + * currently configured compressor as set with Redis::setOption(). + * + * @param string $value The compressed value to uncompress. + * + * @return string The uncompressed result. + */ + public function _uncompress($value) {} + + /** + * Pack the provided value with the configured serializer and compressor as set with Redis::setOption(). + * + * @param mixed $value The value to pack + * + * @return string The packed result having been serialized and compressed. + */ + public function _pack($value) {} + + /** + * Unpack the provided value with the configured compressor and serializer as set with Redis::setOption(). + * + * @param string $value The value which has been serialized and compressed. + * + * @return mixed The uncompressed and eserialized value. + */ + public function _unpack($value) {} + + /** + * Execute the Redis ACL command. + * + * @param string $subcmd Minumum of one argument for Redis and two for RedisCluster. + * @param string ...$args + * + * @return mixed + * + * @example + * + * $redis->acl('USERS'); // Get a list of users + * $redis->acl('LOG'); // See log of Redis' ACL subsystem + */ + public function acl($subcmd, ...$args) {} + + /** + * POP one or more elements from one or more sorted sets, blocking up to a specified amount of time when no elements are available. + * + * @param float $timeout How long to block if there are no element available + * @param array $keys The sorted sets to pop from + * @param string $from The string 'MIN' or 'MAX' (case insensitive) telling Redis whether you wish to pop the lowest or highest scoring members from the set(s). + * @param int $count Pop up to how many elements. + * + * @return array|null|false|Redis This function will return an array of popped elements, or false + * depending on whether any elements could be popped within the specified timeout. + * + * NOTE: If Redis::OPT_NULL_MULTIBULK_AS_NULL is set to true via Redis::setOption(), this method will instead return NULL when Redis doesn't pop any elements. + * @since phpredis 6.0 + */ + public function bzmpop($timeout, $keys, $from, $count = 1) {} + + /** + * POP one or more of the highest or lowest scoring elements from one or more sorted sets. + * + * @link https://redis.io/commands/zmpop + * + * @param array $keys One or more sorted sets + * @param string $from The string 'MIN' or 'MAX' (case insensitive) telling Redis whether you want to pop the lowest or highest scoring elements. + * @param int $count Pop up to how many elements at once. + * + * @return array|null|false|Redis An array of popped elements or false if none could be popped. + * @since phpredis 6.0 + */ + public function zmpop($keys, $from, $count = 1) {} + + /** + * Pop one or more elements from one or more Redis LISTs, blocking up to a specified timeout when no elements are available. + * + * @link https://redis.io/commands/blmpop + * + * @param float $timeout The number of seconds Redis will block when no elements are available. + * @param array $keys One or more Redis LISTs to pop from. + * @param string $from The string 'LEFT' or 'RIGHT' (case insensitive), telling Redis whether to pop elements from the beginning or end of the LISTs. + * @param int $count Pop up to how many elements at once. + * + * @return array|null|false|Redis One or more elements popped from the list(s) or false if all LISTs were empty. + * @since phpredis 6.0 + */ + public function blmpop($timeout, $keys, $from, $count = 1) {} + + /** + * Pop one or more elements off of one or more Redis LISTs. + * + * @link https://redis.io/commands/lmpop + * + * @param array $keys An array with one or more Redis LIST key names. + * @param string $from The string 'LEFT' or 'RIGHT' (case insensitive), telling Redis whether to pop elements from the beginning or end of the LISTs. + * @param int $count The maximum number of elements to pop at once. + * + * @return array|null|false|Redis One or more elements popped from the LIST(s) or false if all the LISTs were empty. + * + * @since phpredis 6.0 + */ + public function lmpop($keys, $from, $count = 1) {} + + /** + * @param string|null $opt + * @param mixed ...$args + * + * @return mixed + */ + public function command($opt = null, ...$args) {} + + /** + * Make a copy of a key. + * + * $redis = new Redis(['host' => 'localhost']); + * + * @param string $src The key to copy + * @param string $dst The name of the new key created from the source key. + * @param array|null $options An array with modifiers on how COPY should operate. + * 'REPLACE' => true|false # Whether to replace an existing key. + * 'DB' => int # Copy key to specific db. + * + * @return bool|Redis True if the copy was completed and false if not. + * + * @link https://redis.io/commands/copy + * @since phpredis 6.0 + * + * @example + * $redis->pipeline() + * ->select(1) + * ->del('newkey') + * ->select(0) + * ->del('newkey') + * ->mset(['source1' => 'value1', 'exists' => 'old_value']) + * ->exec(); + * + * var_dump($redis->copy('source1', 'newkey')); + * var_dump($redis->copy('source1', 'newkey', ['db' => 1])); + * var_dump($redis->copy('source1', 'exists')); + * var_dump($redis->copy('source1', 'exists', ['REPLACE' => true])); + */ + public function copy($src, $dst, $options = null) {} + + /** + * @param string $key + * + * @return string|Redis + */ + public function debug($key) {} + + /** + * This is simply the read-only variant of eval, meaning the underlying script may not modify data in redis. + * + * @param string $script_sha + * @param mixed[] $args + * @param int $num_keys + * + * @return mixed + * + * @see eval() + * @since phpredis 6.0 + */ + public function eval_ro($script_sha, $args = [], $num_keys = 0) {} + + /** + * This is simply the read-only variant of evalsha, meaning the underlying script may not modify data in redis. + * + * @param string $sha1 + * @param mixed[] $args + * @param int $num_keys + * + * @return mixed + * @see evalsha() + * @since phpredis 6.0 + */ + public function evalsha_ro($sha1, $args = [], $num_keys = 0) {} + + /** + * @param array|null $to + * @param bool $abort + * @param int $timeout + * + * @return bool|Redis + * @since phpredis 6.0 + */ + public function failover($to = null, $abort = false, $timeout = 0) {} + + /** + * Get the expiration of a given key as a unix timestamp + * + * @param string $key The key to check. + * + * @return int|false|Redis The timestamp when the key expires, or -1 if the key has no expiry and -2 if the key doesn't exist. + * + * @link https://redis.io/commands/expiretime + * @since phpredis 6.0 + * + * @example + * $redis->setEx('mykey', 60, 'myval'); + * $redis->expiretime('mykey'); + */ + public function expiretime($key) {} + + /** + * Get the expriation timestamp of a given Redis key but in milliseconds. + * + * @param string $key The key to check + * + * @link https://redis.io/commands/pexpiretime + * @see expiretime() + * @since phpredis 6.0 + * + * @return int|false|Redis The expiration timestamp of this key (in milliseconds) or -1 if the key has no expiration, and -2 if it does not exist. + */ + public function pexpiretime($key) {} + + /** + * Invoke a function. + * + * @param string $fn The name of the function + * @param array $keys Optional list of keys + * @param array $args Optional list of args + * + * @return mixed Function may return arbitrary data so this method can return strings, arrays, nested arrays, etc. + * + * @link https://redis.io/commands/fcall + * @since phpredis 6.0 + */ + public function fcall($fn, $keys = [], $args = []) {} + + /** + * This is a read-only variant of the FCALL command that cannot execute commands that modify data. + * + * @param string $fn The name of the function + * @param array $keys Optional list of keys + * @param array $args Optional list of args + * + * @return mixed Function may return arbitrary data so this method can return strings, arrays, nested arrays, etc. + * + * @link https://redis.io/commands/fcall_ro + * @since phpredis 6.0 + */ + public function fcall_ro($fn, $keys = [], $args = []) {} + + /** + * Functions is an API for managing code to be executed on the server. + * + * @param string $operation The subcommand you intend to execute. Valid options are as follows + * 'LOAD' - Create a new library with the given library name and code. + * 'DELETE' - Delete the given library. + * 'LIST' - Return general information on all the libraries + * 'STATS' - Return information about the current function running + * 'KILL' - Kill the current running function + * 'FLUSH' - Delete all the libraries + * 'DUMP' - Return a serialized payload representing the current libraries + * 'RESTORE' - Restore the libraries represented by the given payload + * @param mixed $args Additional arguments + * + * @return Redis|bool|string|array Depends on subcommand. + * + * @link https://redis.io/commands/function + * @since phpredis 6.0 + */ + public function function($operation, ...$args) {} + + /** + * A readonly variant of `GEORADIUS` that may be executed on replicas. + * + * @param string $key + * @param float $lng + * @param float $lat + * @param float $radius + * @param string $unit + * @param mixed[] $options + * + * @return mixed + * @see georadius() + */ + public function georadius_ro($key, $lng, $lat, $radius, $unit, $options = []) {} + + /** + * This is the read-only variant of `GEORADIUSBYMEMBER` that can be run on replicas. + * + * @param string $key + * @param string $member + * @param float $radius + * @param string $unit + * @param mixed[] $options + * + * @return mixed + * + * @see georadiusbymember() + */ + public function georadiusbymember_ro($key, $member, $radius, $unit, $options = []) {} + + /** + * Get the value of a key and optionally set it's expiration. + * + * @param string $key The key to query + * @param array $options Options to modify how the command works. + * 'EX' => # Expire in N seconds + * 'PX' => # Expire in N milliseconds + * 'EXAT' => # Expire at a unix timestamp (in seconds) + * 'PXAT' => # Expire at a unix timestamp (in milliseconds); + * 'PERSIST' # Remove any configured expiration on the key. + * + * @return string|bool|Redis The key's value or false if it didn't exist. + * + * @see https://redis.io/comands/getex + * @since phpredis 6.0 + * + * @example $redis->getEx('mykey', ['EX' => 60]); + */ + public function getEx($key, $options = []) {} + + /** + * Get a key from Redis and delete it in an atomic operation. + * + * @param string $key The key to get/delete. + * + * @return Redis|string|bool The value of the key or false if it didn't exist. + * + * @see https://redis.io/commands/getdel + * @since phpredis 6.0 + * + * @example $redis->getDel('token:123'); + */ + public function getDel($key) {} + + /** + * Get the longest common subsequence between two string keys. + * + * @param string $key1 The first key to check + * @param string $key2 The second key to check + * @param array|null $options An optional array of modifiers for the comand. + * 'MINMATCHLEN' => int # Exclude matching substrings that are less than this value + * 'WITHMATCHLEN' => bool # Whether each match should also include its length. + * 'LEN' # Return the length of the longest subsequence + * 'IDX' # Each returned match will include the indexes where the + * # match occurs in each string. + * NOTE: 'LEN' cannot be used with 'IDX'. + * + * @return Redis|string|array|int|false Various reply types depending on options. + * + * @link https://redis.io/commands/lcs + * @since phpredis 6.0 + * + * @example + * $redis->set('seq1', 'gtaggcccgcacggtctttaatgtatccctgtttaccatgccatacctgagcgcatacgc'); + * $redis->set('seq2', 'aactcggcgcgagtaccaggccaaggtcgttccagagcaaagactcgtgccccgctgagc'); + * echo $redis->lcs('seq1', 'seq2') . "\n"; + */ + public function lcs($key1, $key2, $options = null) {} + + /** + * Get the number of bytes sent and received on the socket. + * + * @return array An array in the form [$sent_bytes, $received_bytes] + * @since phpredis 6.0 + */ + public function getTransferredBytes() {} + + /** + * Reset the number of bytes sent and received on the socket. + * @since phpredis 6.0 + * + * @return void + */ + public function clearTransferredBytes() {} + + /** + * Get one or more random field from a hash. + * + * @param string $key The hash to query. + * @param array|null $options An array of options to modify how the command behaves. + * 'COUNT' => int # An optional number of fields to return. + * 'WITHVALUES' => bool # Also return the field values. + * + * @return Redis|array|string One or more random fields (and possibly values). + * + * @see https://redis.io/commands/hrandfield + * @since phpredis 6.0 + * + * @example + * $redis->hRandField('settings'); + * $redis->hRandField('settings', ['count' => 2, 'withvalues' => true]); + */ + public function hRandField($key, $options = null) {} + + /** + * Move an element from one list into another. + * + * @param string $src The source list. + * @param string $dst The destination list + * @param string $wherefrom Where in the source list to retrieve the element. This can be either + * - `Redis::LEFT`, or `Redis::RIGHT`. + * @param string $whereto Where in the destination list to put the element. This can be either + * - `Redis::LEFT`, or `Redis::RIGHT`. + * + * @return Redis|string|false The element removed from the source list. + * @since phpredis 6.0 + * + * @example + * $redis->rPush('numbers', 'one', 'two', 'three'); + * $redis->lMove('numbers', 'odds', Redis::LEFT, Redis::LEFT); + */ + public function lMove($src, $dst, $wherefrom, $whereto) {} + + /** + * Move an element from one list to another, blocking up to a timeout until an element is available. + * + * @param string $src The source list + * @param string $dst The destination list + * @param string $wherefrom Where in the source list to extract the element. - `Redis::LEFT`, or `Redis::RIGHT`. + * @param string $whereto Where in the destination list to put the element.- `Redis::LEFT`, or `Redis::RIGHT`. + * @param float $timeout How long to block for an element. + * + * @return Redis|string|false; + * @since phpredis 6.0 + * + * @example + * $redis->lPush('numbers', 'one'); + * $redis->blmove('numbers', 'odds', Redis::LEFT, Redis::LEFT 1.0); + * // This call will block, if no additional elements are in 'numbers' + * $redis->blmove('numbers', 'odds', Redis::LEFT, Redis::LEFT, 1.0); + */ + public function blmove($src, $dst, $wherefrom, $whereto, $timeout) {} + + /** + * Retrieve the index of an element in a list. + * + * @param string $key The list to query. + * @param mixed $value The value to search for. + * @param array|null $options Options to configure how the command operates + * # How many matches to return. By default a single match is returned. + * # If count is set to zero, it means unlimited. + * 'COUNT' => + * + * # Specify which match you want returned. `RANK` 1 means "the first match" + * # 2 means the second, and so on. If passed as a negative number the + * # RANK is computed right to left, so a `RANK` of -1 means "the last match". + * 'RANK' => + * + * # This argument allows you to limit how many elements Redis will search before + * # returning. This is useful to prevent Redis searching very long lists while + * # blocking the client. + * 'MAXLEN => + * + * @return Redis|null|bool|int|array Returns one or more of the matching indexes, or null/false if none were found. + * @since phpredis 6.0 + */ + public function lPos($key, $value, $options = null) {} + + /** + * Reset the state of the connection. + * + * @return Redis|bool Should always return true unless there is an error. + * @since phpredis 6.0 + */ + public function reset() {} + + /** + * Compute the intersection of one or more sets and return the cardinality of the result. + * + * @param array $keys One or more set key names. + * @param int $limit A maximum cardinality to return. This is useful to put an upper bound on the amount of work Redis will do. + * + * @return Redis|int|false + * + * @link https://redis.io/commands/sintercard + * @since phpredis 6.0 + * + * @example + * $redis->sAdd('set1', 'apple', 'pear', 'banana', 'carrot'); + * $redis->sAdd('set2', 'apple', 'banana'); + * $redis->sAdd('set3', 'pear', 'banana'); + * + * $redis->sInterCard(['set1', 'set2', 'set3']); + */ + public function sInterCard($keys, $limit = -1) {} + + /** + * Used to turn a Redis instance into a replica of another, or to remove + * replica status promoting the instance to a primary. + * + * @link https://redis.io/commands/replicaof + * @link https://redis.io/commands/slaveof + * @see slaveof() + * @since phpredis 6.0 + * + * @param string|null $host The host of the primary to start replicating. + * @param int $port The port of the primary to start replicating. + * + * @return Redis|bool Success if we were successfully able to start replicating a primary or + * were able to promote teh replicat to a primary. + * + * @example + * $redis = new Redis(['host' => 'localhost']); + * + * // Attempt to become a replica of a Redis instance at 127.0.0.1:9999 + * $redis->replicaof('127.0.0.1', 9999); + * + * // When passed no arguments, PhpRedis will deliver the command `REPLICAOF NO ONE` + * // attempting to promote the instance to a primary. + * $redis->replicaof(); + */ + public function replicaof($host = null, $port = 6379) {} + + /** + * Update one or more keys last modified metadata. + * + * @link https://redis.io/commands/touch/ + * + * @param array|string $key_or_array Either the first key or if passed as the only argument an array of keys. + * @param string ...$more_keys One or more keys to send to the command. + * + * @return Redis|int|false This command returns the number of keys that exist and had their last modified time reset + * @since phpredis 6.0 + */ + public function touch($key_or_array, ...$more_keys) {} + + /** + * This is simply a read-only variant of the sort command + * + * @param string $key + * @param mixed[]|null $options + * + * @return mixed + * @see sort() + * @since phpredis 6.0 + */ + public function sort_ro($key, $options = null) {} + + /** + * Subscribes the client to the specified shard channels. + * + * @param array $channels One or more channel names. + * @param callable $cb The callback PhpRedis will invoke when we receive a message from one of the subscribed channels. + * + * @return bool True on success, false on faiilure. Note that this command will block the + * client in a subscribe loop, waiting for messages to arrive. + * + * @link https://redis.io/commands/ssubscribe + * @since phpredis 6.0 + * + * @example + * $redis = new Redis(['host' => 'localhost']); + * + * $redis->ssubscribe(['channel-1', 'channel-2'], function ($redis, $channel, $message) { + * echo "[$channel]: $message\n"; + * + * // Unsubscribe from the message channel when we read 'quit' + * if ($message == 'quit') { + * echo "Unsubscribing from '$channel'\n"; + * $redis->sunsubscribe([$channel]); + * } + * }); + * + * // Once we read 'quit' from both channel-1 and channel-2 the subscribe loop will be + * // broken and this command will execute. + * echo "Subscribe loop ended\n"; + */ + public function ssubscribe($channels, $cb) {} + + /** + * Unsubscribes the client from the given shard channels, + * or from all of them if none is given. + * + * @param array $channels One or more channels to unsubscribe from. + * + * @return Redis|array|bool The array of unsubscribed channels. + * + * @link https://redis.io/commands/sunsubscribe + * @see ssubscribe() + * @since phpredis 6.0 + * + * @example + * $redis->ssubscribe(['channel-1', 'channel-2'], function ($redis, $channel, $message) { + * if ($message == 'quit') { + * echo "$channel => 'quit' detected, unsubscribing!\n"; + * $redis->sunsubscribe([$channel]); + * } else { + * echo "$channel => $message\n"; + * } + * }); + * + * echo "We've unsubscribed from both channels, exiting\n"; + */ + public function sunsubscribe($channels) {} + + /** + * This command allows a consumer to claim pending messages that have been idle for a specified period of time. + * Its purpose is to provide a mechanism for picking up messages that may have had a failed consumer. + * + * @link https://redis.io/commands/xautoclaim + * @link https://redis.io/commands/xclaim + * @link https://redis.io/docs/data-types/streams-tutorial/ + * @since phpredis 6.0 + * + * @param string $key The stream to check. + * @param string $group The consumer group to query. + * @param string $consumer Which consumer to check. + * @param int $min_idle The minimum time in milliseconds for the message to have been pending. + * @param string $start The minimum message id to check. + * @param int $count An optional limit on how many messages are returned. + * @param bool $justid If the client only wants message IDs and not all of their data. + * + * @return Redis|array|bool An array of pending IDs or false if there are none, or on failure. + * + * @example + * $redis->xGroup('CREATE', 'ships', 'combatants', '0-0', true); + * + * $redis->xAdd('ships', '1424-74205', ['name' => 'Defiant']); + * + * // Consume the ['name' => 'Defiant'] message + * $msgs = $redis->xReadGroup('combatants', "Jem'Hadar", ['ships' => '>'], 1); + * + * // The "Jem'Hadar" consumer has the message presently + * $pending = $redis->xPending('ships', 'combatants'); + * var_dump($pending); + * + * // Asssume control of the pending message with a different consumer. + * $res = $redis->xAutoClaim('ships', 'combatants', 'Sisko', 0, '0-0'); + * + * // Now the 'Sisko' consumer owns the message + * $pending = $redis->xPending('ships', 'combatants'); + * var_dump($pending); + */ + public function xAutoClaim($key, $group, $consumer, $min_idle, $start, $count = -1, $justid = false) {} + + /** + * Count the number of elements in a sorted set whos members fall within the provided + * lexographical range. + * + * @param string $key The sorted set to check. + * @param string $min The minimum matching lexographical string + * @param string $max The maximum matching lexographical string + * + * @return Redis|int|false The number of members that fall within the range or false on failure. + * + * @link https://redis.io/commands/zlexcount + * + * @example + * $redis->zAdd('captains', 0, 'Janeway', 0, 'Kirk', 0, 'Picard', 0, 'Sisko', 0, 'Archer'); + * $redis->zLexCount('captains', '[A', '[S'); + */ + public function zLexCount($key, $min, $max) {} + + /** + * This command is similar to ZRANGE except that instead of returning the values directly + * it will store them in a destination key provided by the user + * + * @param string $dstkey The key to store the resulting element(s) + * @param string $srckey The source key with element(s) to retrieve + * @param string $start The starting index to store + * @param string $end The ending index to store + * @param array|bool|null $options Our options array that controls how the command will function. + * + * @return Redis|int|false The number of elements stored in $dstkey or false on failure. + * + * @see https://redis.io/commands/zrange/ + * @see Redis::zRange for a full description of the possible options. + * @since phpredis 6.0 + */ + public function zRangeStore($dstkey, $srckey, $start, $end, $options = null) {} + + /** + * Store the difference of one or more sorted sets in a destination sorted set. + * + * @param string $dst The destination set name. + * @param array $keys One or more source key names + * + * @return Redis|int|false The number of elements stored in the destination set or false on failure. + * + * @see zDiff() + * @link https://redis.io/commands/zdiff + * @since phpredis 6.0 + */ + public function zDiffStore($dst, $keys) {} + + /** + * Similar to ZINTER but instead of returning the intersected values, this command returns the + * cardinality of the intersected set. + * + * @link https://redis.io/commands/zintercard + * @link https://redis.io/commands/zinter + * @see zInter() + * + * @param array $keys One ore more sorted set key names. + * @param int $limit An optional upper bound on the returned cardinality. If set to a value + * greater than zero, Redis will stop processing the intersection once the + * resulting cardinality reaches this limit. + * + * @return Redis|int|false The cardinality of the intersection or false on failure. + * @since phpredis 6.0 + * + * @example + * $redis->zAdd('zs1', 1, 'one', 2, 'two', 3, 'three', 4, 'four'); + * $redis->zAdd('zs2', 2, 'two', 4, 'four'); + * + * $redis->zInterCard(['zs1', 'zs2']); + */ + public function zInterCard($keys, $limit = -1) {} } class RedisException extends Exception {} diff --git a/redis/RedisCluster.php b/redis/RedisCluster.php index 6ba8a6a7f..3fb316e14 100644 --- a/redis/RedisCluster.php +++ b/redis/RedisCluster.php @@ -649,7 +649,7 @@ public function lPushx($key, $value) {} * or the pivot didn't exists, the value is not inserted. * * @param string $key - * @param int $position RedisCluster::BEFORE | RedisCluster::AFTER + * @param string $position RedisCluster::BEFORE | RedisCluster::AFTER * @param string $pivot * @param string $value * diff --git a/relay/Event.php b/relay/Event.php new file mode 100644 index 000000000..7a37e2b86 --- /dev/null +++ b/relay/Event.php @@ -0,0 +1,59 @@ +) constants. Otherwise it will + * return the string that Redis returns. + * + * @param mixed $key + * @return Relay|int|string|false + */ + #[\Relay\Attributes\RedisCommand] + public function type(mixed $key): Relay|int|string|bool {} + + /** + * Atomically returns and removes the first/last element of the list + * stored at source, and pushes the element at the first/last + * element of the list stored at destination. + * + * @param mixed $srckey + * @param mixed $dstkey + * @param string $srcpos + * @param string $dstpos + * @return Relay|string|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function lmove(mixed $srckey, mixed $dstkey, string $srcpos, string $dstpos): Relay|string|null|false {} + + /** + * BLMOVE is the blocking variant of LMOVE. When source contains elements, + * this command behaves exactly like LMOVE. When used inside a + * MULTI/EXEC block, this command behaves exactly like LMOVE. + * + * @param mixed $srckey + * @param mixed $dstkey + * @param string $srcpos + * @param string $dstpos + * @param float $timeout + * @return Relay|string|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function blmove(mixed $srckey, mixed $dstkey, string $srcpos, string $dstpos, float $timeout): Relay|string|null|false {} + + /** + * Returns the specified elements of the list stored at key. + * + * @param mixed $key + * @param int $start + * @param int $stop + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function lrange(mixed $key, int $start, int $stop): Relay|array|false {} + + /** + * Insert all the specified values at the head of the list stored at key. + * + * @param mixed $key + * @param mixed $mem + * @param mixed $mems,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function lpush(mixed $key, mixed $mem, mixed ...$mems): Relay|int|false {} + + /** + * Insert all the specified values at the tail of the list stored at key. + * + * @param mixed $key + * @param mixed $mem + * @param mixed $mems,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function rpush(mixed $key, mixed $mem, mixed ...$mems): Relay|int|false {} + + /** + * Inserts specified values at the head of the list stored at key, + * only if key already exists and holds a list. + * + * @param mixed $key + * @param mixed $mem + * @param mixed $mems,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function lpushx(mixed $key, mixed $mem, mixed ...$mems): Relay|int|false {} + + /** + * Inserts specified values at the tail of the list stored at key, + * only if key already exists and holds a list. + * + * @param mixed $key + * @param mixed $mem + * @param mixed $mems,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function rpushx(mixed $key, mixed $mem, mixed ...$mems): Relay|int|false {} + + /** + * Sets the list element at index to element. + * + * @param mixed $key + * @param int $index + * @param mixed $mem + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand] + public function lset(mixed $key, int $index, mixed $mem): Relay|bool {} + + /** + * Removes and returns the first elements of the list stored at key. + * + * @param mixed $key + * @param int $count + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function lpop(mixed $key, int $count = 1): mixed {} + + /** + * The command returns the index of matching elements inside a Redis list. + * + * @param mixed $key + * @param mixed $value + * @param array $options + * @return Relay|int|array|false|null + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function lpos(mixed $key, mixed $value, ?array $options = null): Relay|int|array|false|null {} + + /** + * Removes and returns the last elements of the list stored at key. + * + * @param mixed $key + * @param int $count + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function rpop(mixed $key, int $count = 1): mixed {} + + /** + * Atomically returns and removes the last element (tail) of the list stored at source, + * and pushes the element at the first element (head) of the list stored at destination. + * + * @param mixed $source + * @param mixed $dest + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function rpoplpush(mixed $source, mixed $dest): mixed {} + + /** + * Atomically returns and removes the last element (tail) of the list stored at source, + * and pushes the element at the first element (head) of the list stored at destination. + * This command will block for an element up to the provided timeout. + * + * @param mixed $source + * @param mixed $dest + * @param float $timeout + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function brpoplpush(mixed $source, mixed $dest, float $timeout): mixed {} + + /** + * BLPOP is a blocking list pop primitive. It is the blocking version of LPOP because + * it blocks the connection when there are no elements to pop from any of the given lists. + * + * @param string|array $key + * @param string|float $timeout_or_key + * @param array $extra_args,... + * @return Relay|array|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function blpop(string|array $key, string|float $timeout_or_key, mixed ...$extra_args): Relay|array|null|false {} + + /** + * Pop elements from a list, or block until one is available + * + * @param float $timeout + * @param array $keys + * @param string $from + * @param int $count + * @return Relay|array|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function blmpop(float $timeout, array $keys, string $from, int $count = 1): Relay|array|null|false {} + + /** + * Remove and return members with scores in a sorted set or block until one is available + * + * @param float $timeout + * @param array $keys + * @param string $from + * @param int $count + * @return Relay|array|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function bzmpop(float $timeout, array $keys, string $from, int $count = 1): Relay|array|null|false {} + + /** + * Pops one or more elements from the first non-empty list key from the list of provided key names. + * + * @param array $keys + * @param string $from + * @param int $count + * @return Relay|array|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function lmpop(array $keys, string $from, int $count = 1): Relay|array|null|false {} + + /** + * Pops one or more elements, that are member-score pairs, from the + * first non-empty sorted set in the provided list of key names. + * + * @param array $keys + * @param string $from + * @param int $count + * @return Relay|array|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function zmpop(array $keys, string $from, int $count = 1): Relay|array|null|false {} + + /** + * BRPOP is a blocking list pop primitive. It is the blocking version of RPOP because + * it blocks the connection when there are no elements to pop from any of the given lists. + * + * @param string|array $key + * @param string|float $timeout_or_key + * @param array $extra_args,... + * @return Relay|array|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function brpop(string|array $key, string|float $timeout_or_key, mixed ...$extra_args): Relay|array|null|false {} + + /** + * BZPOPMAX is the blocking variant of the sorted set ZPOPMAX primitive. + * + * @param string|array $key + * @param string|float $timeout_or_key + * @param array $extra_args,... + * @return Relay|array|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function bzpopmax(string|array $key, string|float $timeout_or_key, mixed ...$extra_args): Relay|array|null|false {} + + /** + * BZPOPMIN is the blocking variant of the sorted set ZPOPMIN primitive. + * + * @param string|array $key + * @param string|float $timeout_or_key + * @param array $extra_args,... + * @return Relay|array|null|false + */ + #[\Relay\Attributes\RedisCommand] + public function bzpopmin(string|array $key, string|float $timeout_or_key, mixed ...$extra_args): Relay|array|null|false {} + + /** + * This is a container command for object introspection commands. + * + * @param string $op + * @param mixed $key + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function object(string $op, mixed $key): mixed {} + + /** + * Return the positions (longitude,latitude) of all the specified members + * of the geospatial index represented by the sorted set at key. + * + * @param mixed $key + * @param mixed $members,... + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function geopos(mixed $key, mixed ...$members): Relay|array|false {} + + /** + * Removes the first count occurrences of elements equal to element from the list stored at key. + * + * @param mixed $key + * @param mixed $mem + * @param int $count + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function lrem(mixed $key, mixed $mem, int $count = 0): Relay|int|false {} + + /** + * Returns the element at index index in the list stored at key. + * + * @param mixed $key + * @param int $index + * @return mixed + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function lindex(mixed $key, int $index): mixed {} + + /** + * Inserts element in the list stored at key either before or after the reference value pivot. + * + * @param mixed $key + * @param string $op + * @param mixed $pivot + * @param mixed $element + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function linsert(mixed $key, string $op, mixed $pivot, mixed $element): Relay|int|false {} + + /** + * Trim an existing list so that it will contain only the specified range of elements specified. + * + * @param mixed $key + * @param int $start + * @param int $end + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand] + public function ltrim(mixed $key, int $start, int $end): Relay|bool {} + + /** + * Returns the value associated with field in the hash stored at key. + * + * @param mixed $hash + * @param mixed $member + * @return mixed + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hget(mixed $hash, mixed $member): mixed {} + + /** + * Returns the string length of the value associated with field in the hash stored at key. + * + * @param mixed $hash + * @param mixed $member + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hstrlen(mixed $hash, mixed $member): Relay|int|false {} + + /** + * Returns all fields and values of the hash stored at key. + * + * @param mixed $hash + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hgetall(mixed $hash): Relay|array|false {} + + /** + * Returns all field names in the hash stored at key. + * + * @param mixed $hash + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hkeys(mixed $hash): Relay|array|false {} + + /** + * Returns all values in the hash stored at key. + * + * @param mixed $hash + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hvals(mixed $hash): Relay|array|false {} + + /** + * Returns the values associated with the specified fields in the hash stored at key. + * + * @param mixed $hash + * @param array $members + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hmget(mixed $hash, array $members): Relay|array|false {} + + /** + * When called with just the key argument, return a random field from the hash value stored at key. + * + * @param mixed $hash + * @param array $options + * @return Relay|array|string|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hrandfield(mixed $hash, ?array $options = null): Relay|array|string|false {} + + /** + * Sets the specified fields to their respective values in the hash stored at key. + * + * @param mixed $hash + * @param array $members + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand] + public function hmset(mixed $hash, array $members): Relay|bool {} + + /** + * Returns if field is an existing field in the hash stored at key. + * + * @param mixed $hash + * @param mixed $member + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hexists(mixed $hash, mixed $member): Relay|bool {} + + /** + * Sets field in the hash stored at key to value, only if field does not yet exist. + * + * @param mixed $hash + * @param mixed $member + * @param mixed $value + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand] + public function hsetnx(mixed $hash, mixed $member, mixed $value): Relay|bool {} + + /** + * Sets field in the hash stored at key to value. + * + * @param mixed $key + * @param mixed $mem + * @param mixed $val + * @param mixed $kvals,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function hset(mixed $key, mixed $mem, mixed $val, mixed ...$kvals): Relay|int|false {} + + /** + * Removes the specified fields from the hash stored at key. + * + * @param mixed $key + * @param mixed $mem + * @param string $mems,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function hdel(mixed $key, mixed $mem, string ...$mems): Relay|int|false {} + + /** + * Increments the number stored at field in the hash stored at key by increment. + * + * @param mixed $key + * @param mixed $mem + * @param int $value + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function hincrby(mixed $key, mixed $mem, int $value): Relay|int|false {} + + /** + * Increment the specified field of a hash stored at key, and representing + * a floating point number, by the specified increment. + * + * @param mixed $key + * @param mixed $mem + * @param float $value + * @return Relay|float|bool + */ + #[\Relay\Attributes\RedisCommand] + public function hincrbyfloat(mixed $key, mixed $mem, float $value): Relay|float|bool {} + + /** + * Increments the number stored at key by one. + * + * @param mixed $key + * @param int $by + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function incr(mixed $key, int $by = 1): Relay|int|false {} + + /** + * Decrements the number stored at key by one. + * + * @param mixed $key + * @param int $by + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function decr(mixed $key, int $by = 1): Relay|int|false {} + + /** + * Increments the number stored at key by increment. + * + * @param mixed $key + * @param int $value + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function incrby(mixed $key, int $value): Relay|int|false {} + + /** + * Decrements the number stored at key by decrement. + * + * @param mixed $key + * @param int $value + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function decrby(mixed $key, int $value): Relay|int|false {} + + /** + * Increment the string representing a floating point number stored at key by the specified increment. + * + * @param mixed $key + * @param float $value + * @return Relay|float|false + */ + #[\Relay\Attributes\RedisCommand] + public function incrbyfloat(mixed $key, float $value): Relay|float|false {} + + /** + * Returns the members of the set resulting from the difference between the first set and all the successive sets. + * + * @param mixed $key + * @param mixed $other_keys,... + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function sdiff(mixed $key, mixed ...$other_keys): Relay|array|false {} + + /** + * This command is equal to SDIFF, but instead of returning the resulting set, it is stored in destination. + * If destination already exists, it is overwritten. + * + * @param mixed $key + * @param mixed $other_keys,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function sdiffstore(mixed $key, mixed ...$other_keys): Relay|int|false {} + + /** + * Returns the members of the set resulting from the intersection of all the given sets. + * + * @param mixed $key + * @param mixed $other_keys,... + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function sinter(mixed $key, mixed ...$other_keys): Relay|array|false {} + + /** + * Intersect multiple sets and return the cardinality of the result. + * + * @param array $keys + * @param int $limit + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function sintercard(array $keys, int $limit = -1): Relay|int|false {} + + /** + * This command is equal to SINTER, but instead of returning the resulting set, it is stored in destination. + * If destination already exists, it is overwritten. + * + * @param mixed $key + * @param mixed $other_keys,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function sinterstore(mixed $key, mixed ...$other_keys): Relay|int|false {} + + /** + * Returns the members of the set resulting from the union of all the given sets. + * + * @param mixed $key + * @param mixed $other_keys,... + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function sunion(mixed $key, mixed ...$other_keys): Relay|array|false {} + + /** + * This command is equal to SUNION, but instead of returning the resulting set, it is stored in destination. + * If destination already exists, it is overwritten. + * + * @param mixed $key + * @param mixed $other_keys,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function sunionstore(mixed $key, mixed ...$other_keys): Relay|int|false {} + + /** + * Alters the last access time of a key(s). + * + * @param array|string $key_or_array + * @param mixed $more_keys,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function touch(array|string $key_or_array, mixed ...$more_keys): Relay|int|false {} + + /** + * A pipeline block is simply transmitted faster to the server (like `MULTI`), but without any guarantee of atomicity. + * + * @return Relay|bool + */ + #[\Relay\Attributes\Local] + public function pipeline(): Relay|bool {} + + /** + * Marks the start of a transaction block. Subsequent commands will be queued for atomic execution using EXEC. + * + * Accepts `Relay::MULTI` and `Relay::PIPELINE` modes. + * + * @param int $mode + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand] + public function multi(int $mode = 0): Relay|bool {} + + /** + * Executes all previously queued commands in a transaction and restores the connection state to normal. + * + * @return Relay|array|bool + */ + #[\Relay\Attributes\RedisCommand] + public function exec(): Relay|array|bool {} + + /** + * Wait for the synchronous replication of all the write + * commands sent in the context of the current connection. + * + * @param int $replicas + * @param int $timeout + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function wait(int $replicas, $timeout): Relay|int|false {} + + /** + * Marks the given keys to be watched for conditional execution of a transaction. + * + * @param mixed $key + * @param mixed $other_keys,... + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand] + public function watch(mixed $key, mixed ...$other_keys): Relay|bool {} + + /** + * Flushes all the previously watched keys for a transaction. + * If you call EXEC or DISCARD, there's no need to manually call UNWATCH. + * + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand] + public function unwatch(): Relay|bool {} + + /** + * Flushes all previously queued commands in a transaction and restores the connection state to normal. + * If WATCH was used, DISCARD unwatches all keys watched by the connection. + * + * @return bool + */ + #[\Relay\Attributes\RedisCommand] + public function discard(): bool {} + + /** + * Get the mode Relay is currently in. + * `Relay::ATOMIC`, `Relay::PIPELINE` or `Relay::MULTI`. + * + * @param bool $masked + * @return int + */ + #[\Relay\Attributes\Local] + public function getMode(bool $masked = false): int {} + + /** + * Clear the accumulated sent and received bytes. + * + * @return void + */ + #[\Relay\Attributes\Local] + public function clearBytes(): void {} + + /** + * Scan the keyspace for matching keys. + * + * @param mixed $iterator + * @param mixed $match + * @param int $count + * @param string|null $type + * @return array|false + */ + #[\Relay\Attributes\RedisCommand] + public function scan(mixed &$iterator, mixed $match = null, int $count = 0, ?string $type = null): array|false {} + + /** + * Iterates fields of Hash types and their associated values. + * + * @param mixed $key + * @param mixed $iterator + * @param mixed $match + * @param int $count + * @return array|false + */ + #[\Relay\Attributes\RedisCommand] + public function hscan(mixed $key, mixed &$iterator, mixed $match = null, int $count = 0): array|false {} + + /** + * Iterates elements of Sets types. + * + * @param mixed $key + * @param mixed $iterator + * @param mixed $match + * @param int $count + * @return array|false + */ + #[\Relay\Attributes\RedisCommand] + public function sscan(mixed $key, mixed &$iterator, mixed $match = null, int $count = 0): array|false {} + + /** + * Iterates elements of Sorted Set types and their associated scores. + * + * @param mixed $key + * @param mixed $iterator + * @param mixed $match + * @param int $count + * @return array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zscan(mixed $key, mixed &$iterator, mixed $match = null, int $count = 0): array|false {} + + /** + * Returns all keys matching pattern. + * + * @param mixed $pattern + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function keys(mixed $pattern): Relay|array|false {} + + /** + * Interact with the Redis slowlog. + * + * @param string $operation + * @param string $extra_args,... + * @return Relay|array|int|bool + */ + #[\Relay\Attributes\RedisCommand] + public function slowlog(string $operation, string ...$extra_args): Relay|array|int|bool {} + + /** + * Returns all the members of the set value stored at `$key`. + * + * @param mixed $set + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function smembers(mixed $set): Relay|array|false {} + + /** + * Returns if `$member` is a member of the set stored at `$key`. + * + * @param mixed $set + * @param mixed $member + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function sismember(mixed $set, mixed $member): Relay|bool {} + + /** + * Returns whether each member is a member of the set stored at `$key`. + * + * @param mixed $set + * @param mixed $members,... + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function smismember(mixed $set, mixed ...$members): Relay|array|false {} + + /** + * Remove the specified members from the set stored at `$key`. + * + * @param mixed $set + * @param mixed $member + * @param mixed $members,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function srem(mixed $set, mixed $member, mixed ...$members): Relay|int|false {} + + /** + * Add the specified members to the set stored at `$key`. + * + * @param mixed $set + * @param mixed $member + * @param mixed $members,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function sadd(mixed $set, mixed $member, mixed ...$members): Relay|int|false {} + + /** + * Sort the elements in a list, set or sorted set. + * + * @param mixed $key + * @param array $options + * @return Relay|array|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function sort(mixed $key, array $options = []): Relay|array|int|false {} + + /** + * Sort the elements in a list, set or sorted set. Read-only variant of SORT. + * + * @param mixed $key + * @param array $options + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function sort_ro(mixed $key, array $options = []): Relay|array|false {} + + /** + * Move member from the set at source to the set at destination. + * + * @param mixed $srcset + * @param mixed $dstset + * @param mixed $member + * @return Relay|bool + */ + #[\Relay\Attributes\RedisCommand] + public function smove(mixed $srcset, mixed $dstset, mixed $member): Relay|bool {} + + /** + * Removes and returns one or more random members from the set value store at `$key`. + * + * @param mixed $set + * @param int $count + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function spop(mixed $set, int $count = 1): mixed {} + + /** + * Returns one or multiple random members from a set. + * + * @param mixed $set + * @param int $count + * @return mixed + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function srandmember(mixed $set, int $count = 1): mixed {} + + /** + * Returns the set cardinality (number of elements) of the set stored at `$key`. + * + * @param mixed $key + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function scard(mixed $key): Relay|int|false {} + + /** + * Execute a script management command. + * + * @param string $command + * @param string $args,... + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function script(string $command, string ...$args): mixed {} + + /** + * Returns the length of the string value stored at `$key`. + * + * @param mixed $key + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function strlen(mixed $key): Relay|int|false {} + + /** + * Returns the number of fields contained in the hash stored at `$key`. + * + * @param mixed $key + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function hlen(mixed $key): Relay|int|false {} + + /** + * Returns the length of the list stored at `$key`. + * + * @param mixed $key + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function llen(mixed $key): Relay|int|false {} + + /** + * Acknowledge one or more IDs as having been processed by the consumer group. + * + * @param mixed $key + * @param string $group + * @param array $ids + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function xack(mixed $key, string $group, array $ids): Relay|int|false {} + + /** + * Append a message to a stream. + * + * @param string $key + * @param string $id + * @param int $maxlen + * @param bool $approx + * @param bool $nomkstream + * @return Relay|string|false + */ + public function xadd( + string $key, + string $id, + array $values, + int $maxlen = 0, + bool $approx = false, + bool $nomkstream = false + ): Relay|string|false {} + + /** + * Claim ownership of stream message(s). + * + * @param string $key + * @param string $group + * @param string $consumer + * @param int $min_idle + * @param array $ids + * @param array $options + * @return Relay|array|bool + */ + #[\Relay\Attributes\RedisCommand] + public function xclaim( + string $key, + string $group, + string $consumer, + int $min_idle, + array $ids, + array $options + ): Relay|array|bool {} + + /** + * Automatically take ownership of stream message(s) by metrics + * + * @param string $key + * @param string $group + * @param string $consumer + * @param int $min_idle + * @param string $start + * @param int $count + * @param bool $justid + * @return Relay|array|bool + */ + #[\Relay\Attributes\RedisCommand] + public function xautoclaim( + string $key, + string $group, + string $consumer, + int $min_idle, + string $start, + int $count = -1, + bool $justid = false + ): Relay|bool|array {} + + /** + * Get the length of a stream. + * + * @param string $key + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function xlen(string $key): Relay|int|false {} + + /** + * Perform utility operations having to do with consumer groups + * + * @param string $operation + * @param mixed $key + * @param string $group + * @param string $id_or_consumer + * @param bool $mkstream + * @param int $entries_read + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function xgroup( + string $operation, + mixed $key = null, + string $group = null, + string $id_or_consumer = null, + bool $mkstream = false, + int $entries_read = -2 + ): mixed {} + + /** + * Remove one or more specific IDs from a stream. + * + * @param string $key + * @param array $ids + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function xdel(string $key, array $ids): Relay|int|false {} + + /** + * Retrieve information about a stream key. + * + * @param string $operation + * @param string|null $arg1 + * @param string|null $arg2 + * @param int $count + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function xinfo(string $operation, ?string $arg1 = null, ?string $arg2 = null, int $count = -1): mixed {} + + /** + * Query pending entries in a stream. + * + * @param string $key + * @param string $group + * @param string|null $start + * @param string|null $end + * @param int $count + * @param string|null $consumer + * @param int $idle + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function xpending( + string $key, + string $group, + ?string $start = null, + ?string $end = null, + int $count = -1, + ?string $consumer = null, + int $idle = 0 + ): Relay|array|false {} + + /** + * Lists elements in a stream. + * + * @param mixed $key + * @param string $start + * @param string $end + * @param int $count = -1 + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function xrange(mixed $key, string $start, string $end, int $count = -1): Relay|array|false {} + + /** + * Get a range of entries from a STREAM ke in reverse chronological order. + * + * @param string $key + * @param string $end + * @param string $start + * @param int $count + * @return Relay|array|bool + */ + #[\Relay\Attributes\RedisCommand] + public function xrevrange(string $key, string $end, string $start, int $count = -1): Relay|array|bool {} + + /** + * Read messages from a stream. + * + * @param array $streams + * @param int $count + * @param int $block + * @return Relay|array|bool|null + */ + #[\Relay\Attributes\RedisCommand] + public function xread(array $streams, int $count = -1, int $block = -1): Relay|array|bool|null {} + + /** + * Read messages from a stream using a consumer group. + * + * @param string $group + * @param string $consumer + * @param array $streams + * @param int $count + * @param int $block + * @return Relay|array|bool|null + */ + #[\Relay\Attributes\RedisCommand] + public function xreadgroup( + string $group, + string $consumer, + array $streams, + int $count = 1, + int $block = 1 + ): Relay|array|bool|null {} + + /** + * Truncate a STREAM key in various ways. + * + * @param string $key + * @param string $threshold + * @param bool $approx + * @param bool $minid + * @param int $limit + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function xtrim( + string $key, + string $threshold, + bool $approx = false, + bool $minid = false, + int $limit = -1 + ): Relay|int|false {} + + /** + * Adds all the specified members with the specified scores to the sorted set stored at key. + * + * @param mixed $key + * @param mixed $args,... + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function zadd(mixed $key, mixed ...$args): mixed {} + + /** + * When called with just the key argument, return a random element from the sorted set value stored at key. + * If the provided count argument is positive, return an array of distinct elements. + * + * @param mixed $key + * @param array|null $options + * @return mixed + */ + #[\Relay\Attributes\RedisCommand] + public function zrandmember(mixed $key, ?array $options = null): mixed {} + + /** + * Returns the specified range of elements in the sorted set stored at key. + * + * @param mixed $key + * @param string $start + * @param string $end + * @param mixed $options + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrange(mixed $key, string $start, string $end, mixed $options = null): Relay|array|false {} + + /** + * Returns the specified range of elements in the sorted set stored at key. + * + * @param mixed $key + * @param int $start + * @param int $end + * @param mixed $options + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrevrange(mixed $key, int $start, int $end, mixed $options = null): Relay|array|false {} + + /** + * Returns all the elements in the sorted set at key with a score between + * min and max (including elements with score equal to min or max). + * + * @param mixed $key + * @param mixed $start + * @param mixed $end + * @param mixed $options + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrangebyscore(mixed $key, mixed $start, mixed $end, mixed $options = null): Relay|array|false {} + + /** + * Returns all the elements in the sorted set at key with a score between + * max and min (including elements with score equal to max or min). + * + * @param mixed $key + * @param mixed $start + * @param mixed $end + * @param mixed $options + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrevrangebyscore(mixed $key, mixed $start, mixed $end, mixed $options = null): Relay|array|false {} + + /** + * Returns all the elements in the sorted set at key with a score between + * max and min (including elements with score equal to max or min). + * + * @param mixed $dst + * @param mixed $src + * @param mixed $start + * @param mixed $end + * @param mixed $options + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrangestore(mixed $dst, mixed $src, mixed $start, mixed $end, mixed $options = null): Relay|int|false {} + + /** + * When all the elements in a sorted set are inserted with the same score, + * in order to force lexicographical ordering, this command returns all + * the elements in the sorted set at key with a value between min and max. + * + * @param mixed $key + * @param mixed $min + * @param mixed $max + * @param int $offset + * @param int $count + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrangebylex(mixed $key, mixed $min, mixed $max, int $offset = -1, int $count = -1): Relay|array|false {} + + /** + * When all the elements in a sorted set are inserted with the same score, + * in order to force lexicographical ordering, this command returns all + * the elements in the sorted set at key with a value between max and min. + * + * @param mixed $key + * @param mixed $max + * @param mixed $min + * @param int $offset + * @param int $count + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrevrangebylex(mixed $key, mixed $max, mixed $min, int $offset = -1, int $count = -1): Relay|array|false {} + + /** + * Returns the rank of member in the sorted set stored at key, with the scores + * ordered from low to high. The rank (or index) is 0-based, which means + * that the member with the lowest score has rank 0. + * + * @param mixed $key + * @param mixed $rank + * @param bool $withscore + * @return Relay|array|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrank(mixed $key, mixed $rank, bool $withscore = false): Relay|array|int|false {} + + /** + * Returns the rank of member in the sorted set stored at key, with the scores + * ordered from high to low. The rank (or index) is 0-based, which means + * that the member with the highest score has rank 0. + * + * @param mixed $key + * @param mixed $rank + * @param bool $withscore + * @return Relay|array|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrevrank(mixed $key, mixed $rank, bool $withscore = false): Relay|array|int|false {} + + /** + * Removes the specified members from the sorted set stored at key. + * Non existing members are ignored. + * + * @param mixed $key + * @param mixed $args,... + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zrem(mixed $key, mixed ...$args): Relay|int|false {} + + /** + * When all the elements in a sorted set are inserted with the same score, + * in order to force lexicographical ordering, this command removes all + * elements in the sorted set stored at key between the + * lexicographical range specified by min and max. + * + * @param mixed $key + * @param mixed $min + * @param mixed $max + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zremrangebylex(mixed $key, mixed $min, mixed $max): Relay|int|false {} + + /** + * Removes all elements in the sorted set stored at key with rank between + * start and stop. Both start and stop are 0 -based indexes with 0 being + * the element with the lowest score. + * + * @param mixed $key + * @param int $start + * @param int $end + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zremrangebyrank(mixed $key, int $start, int $end): Relay|int|false {} + + /** + * Removes all elements in the sorted set stored at key with + * a score between min and max (inclusive). + * + * @param mixed $key + * @param mixed $min + * @param mixed $max + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zremrangebyscore(mixed $key, mixed $min, mixed $max): Relay|int|false {} + + /** + * Returns the sorted set cardinality (number of elements) of the sorted set stored at key. + * + * @param mixed $key + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand, \Relay\Attributes\Cached] + public function zcard(mixed $key): Relay|int|false {} + + /** + * Returns the number of elements in the sorted set at key with a score between min and max. + * + * @param mixed $key + * @param mixed $min + * @param mixed $max + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zcount(mixed $key, mixed $min, mixed $max): Relay|int|false {} + + /** + * This command is similar to ZDIFFSTORE, but instead of storing the + * resulting sorted set, it is returned to the client. + * + * @param array $keys + * @param array $options + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zdiff(array $keys, ?array $options = null): Relay|array|false {} + + /** + * Computes the difference between the first and all successive + * input sorted sets and stores the result in destination. + * + * @param mixed $dst + * @param array $keys + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zdiffstore(mixed $dst, array $keys): Relay|int|false {} + + /** + * Increments the score of member in the sorted set stored at key by increment. + * + * @param mixed $key + * @param float $score + * @param mixed $mem + * @return Relay|float|false + */ + #[\Relay\Attributes\RedisCommand] + public function zincrby(mixed $key, float $score, mixed $mem): Relay|float|false {} + + /** + * When all the elements in a sorted set are inserted with the same score, + * in order to force lexicographical ordering, this command returns the + * number of elements in the sorted set at key with a value between min and max. + * + * @param mixed $key + * @param mixed $min + * @param mixed $max + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zlexcount(mixed $key, mixed $min, mixed $max): Relay|int|false {} + + /** + * Returns the scores associated with the specified members in the sorted set stored at key. + * + * @param mixed $key + * @param mixed $mems,... + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zmscore(mixed $key, mixed ...$mems): Relay|array|false {} + + /** + * Returns the score of member in the sorted set at key. + * + * @param mixed $key + * @param mixed $member + * @return Relay|float|false + */ + #[\Relay\Attributes\RedisCommand] + public function zscore(mixed $key, mixed $member): Relay|float|false {} + + /** + * This command is similar to ZINTERSTORE, but instead of storing + * the resulting sorted set, it is returned to the client. + * + * @param array $keys + * @param array $weights + * @param mixed $options + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zinter(array $keys, ?array $weights = null, mixed $options = null): Relay|array|false {} + + /** + * Intersect multiple sorted sets and return the cardinality of the result. + * + * @param array $keys + * @param int $limit + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zintercard(array $keys, int $limit = -1): Relay|int|false {} + + /** + * Computes the intersection of numkeys sorted sets given by the + * specified keys, and stores the result in destination. + * + * @param mixed $dst + * @param array $keys + * @param array $weights + * @param mixed $options + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zinterstore(mixed $dst, array $keys, ?array $weights = null, mixed $options = null): Relay|int|false {} + + /** + * This command is similar to ZUNIONSTORE, but instead of storing + * the resulting sorted set, it is returned to the client. + * + * @param array $keys + * @param array $weights + * @param mixed $options + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zunion(array $keys, ?array $weights = null, mixed $options = null): Relay|array|false {} + + /** + * Computes the union of numkeys sorted sets given by the + * specified keys, and stores the result in destination. + * + * @param mixed $dst + * @param array $keys + * @param array $weights + * @param mixed $options + * @return Relay|int|false + */ + #[\Relay\Attributes\RedisCommand] + public function zunionstore(mixed $dst, array $keys, ?array $weights = null, mixed $options = null): Relay|int|false {} + + /** + * Removes and returns up to count members with the lowest + * scores in the sorted set stored at key. + * + * @param mixed $key + * @param int $count + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zpopmin(mixed $key, int $count = 1): Relay|array|false {} + + /** + * Removes and returns up to count members with the highest + * scores in the sorted set stored at key. + * + * @param mixed $key + * @param int $count + * @return Relay|array|false + */ + #[\Relay\Attributes\RedisCommand] + public function zpopmax(mixed $key, int $count = 1): Relay|array|false {} + + /** + * Returns keys cached in runtime memory. + * + * @internal Temporary debug helper. Do not use. + * @return mixed + */ + #[\Relay\Attributes\Local] + public function _getKeys() {} +} diff --git a/relay/Sentinel.php b/relay/Sentinel.php new file mode 100644 index 000000000..e2a14c4df --- /dev/null +++ b/relay/Sentinel.php @@ -0,0 +1,174 @@ + *

    * On error, if the SoapClient object was constructed with the exceptions - * option set to FALSE, a SoapFault object will be returned. + * option set to FALSE, a SoapFault object will be returned. If this + * option is not set, or is set to TRUE, then a SoapFault object will + * be thrown as an exception. + * @throws SoapFault A SoapFault exception will be thrown if an error occurs + * and the SoapClient was constructed with the exceptions option not set, or + * set to TRUE. * @since 5.0.1 */ #[TentativeType] diff --git a/sockets/sockets.php b/sockets/sockets.php index c0344c00b..7fa20c9f4 100644 --- a/sockets/sockets.php +++ b/sockets/sockets.php @@ -1679,7 +1679,7 @@ function socket_wsaprotocol_info_release($info_id) {} * File table overflow. * @link https://php.net/manual/en/sockets.constants.php */ -define('SOCKET_ENFILE', 24); +define('SOCKET_ENFILE', 23); /** * Too many open files. @@ -2059,7 +2059,7 @@ function socket_wsaprotocol_info_release($info_id) {} * Connection reset by peer. * @link https://php.net/manual/en/sockets.constants.php */ -define('SOCKET_ECONNRESET', 103); +define('SOCKET_ECONNRESET', 104); /** * No buffer space available. diff --git a/sqlite3/sqlite3.php b/sqlite3/sqlite3.php index c69b1da9f..b26210e46 100644 --- a/sqlite3/sqlite3.php +++ b/sqlite3/sqlite3.php @@ -682,4 +682,12 @@ private function __construct() {} */ define('SQLITE3_OPEN_CREATE', 4); +/** + * Specifies that a function created with {@see SQLite3::createFunction()} is deterministic, + * i.e. it always returns the same result given the same inputs within a single SQL statement. + * @since 7.1.4 + * @link https://php.net/manual/en/sqlite.constants.php + */ +define('SQLITE3_DETERMINISTIC', 2048); + // End of sqlite3 v.0.7-dev diff --git a/standard/_types.php b/standard/_types.php index 13cb3741c..17a399f2c 100644 --- a/standard/_types.php +++ b/standard/_types.php @@ -149,15 +149,15 @@ function PS_UNRESERVE_PREFIX_unset($var, ...$_) {} function PS_UNRESERVE_PREFIX_eval($code) {} /** - * @template TKey of array-key - * @template TSend - * @template TReturn - * @template TYield - * * Generator objects are returned from generators, cannot be instantiated via new. * @link https://secure.php.net/manual/en/class.generator.php * @link https://wiki.php.net/rfc/generators * + * @template-covariant TKey + * @template-covariant TYield + * @template TSend + * @template-covariant TReturn + * * @template-implements Iterator */ final class Generator implements Iterator diff --git a/standard/standard_0.php b/standard/standard_0.php index d2a003ff7..62c05f4cb 100644 --- a/standard/standard_0.php +++ b/standard/standard_0.php @@ -166,7 +166,7 @@ function constant(string $name): mixed {} * Convert binary data into hexadecimal representation * @link https://php.net/manual/en/function.bin2hex.php * @param string $string

    - * A character. + * A string. *

    * @return string the hexadecimal representation of the given string. */ @@ -176,7 +176,7 @@ function bin2hex(string $string): string {} /** * Delay execution * @link https://php.net/manual/en/function.sleep.php - * @param int $seconds

    + * @param int<0,max> $seconds

    * Halt time in seconds. *

    * @return int|false zero on success, or false on errors. If the call was interrupted @@ -189,7 +189,7 @@ function sleep(int $seconds) {} /** * Delay execution in microseconds * @link https://php.net/manual/en/function.usleep.php - * @param int $microseconds

    + * @param int<0,max> $microseconds

    * Halt time in micro seconds. A micro second is one millionth of a * second. *

    @@ -308,7 +308,7 @@ function time_sleep_until(float $timestamp): bool {} function strptime(string $timestamp, string $format): array|false {} /** - * Flush the output buffer + * Flush system output buffer * @link https://php.net/manual/en/function.flush.php * @return void */ @@ -321,7 +321,7 @@ function flush(): void {} * The input string. *

    * @param int $width [optional]

    - * The column width. + * The number of characters at which the string will be wrapped. *

    * @param string $break [optional]

    * The line is broken using the optional @@ -333,7 +333,7 @@ function flush(): void {} * a word that is larger than the given width, it is broken apart. * (See second example). *

    - * @return string the given string wrapped at the specified column. + * @return string the given string wrapped at the specified length. */ #[Pure] function wordwrap(string $string, int $width = 75, string $break = "\n", bool $cut_long_words = false): string {} @@ -765,7 +765,7 @@ function get_html_translation_table( * The input string. *

    * @param bool $binary [optional]

    - * If the optional raw_output is set to true, + * If the optional binary is set to true, * then the sha1 digest is instead returned in raw binary format with a * length of 20, otherwise the returned value is a 40-character * hexadecimal number. @@ -856,11 +856,12 @@ function iptcparse(string $iptc_block): array|false {} * Path to the JPEG image. *

    * @param int $spool

    - * Spool flag. If the spool flag is over 2 then the JPEG will be - * returned as a string. + * Spool flag. If the spool flag is less than 2 then the JPEG will + * be returned as a string. Otherwise the JPEG will be printed to + * STDOUT. *

    - * @return string|bool If success and spool flag is lower than 2 then the JPEG will not be - * returned as a string, false on errors. + * @return string|bool If spool is less than 2, the JPEG will be returned, or false on + * failure. Otherwise returns true on success or false on failure. */ function iptcembed(string $iptc_data, string $filename, int $spool = 0): string|bool {} @@ -1026,7 +1027,7 @@ function image_type_to_mime_type(int $image_type): string {} * Removed since 8.0. * Whether to prepend a dot to the extension or not. Default to true. *

    - * @return string|false A string with the extension corresponding to the given image type. + * @return string|false A string with the extension corresponding to the given image type, or false on failure. */ #[Pure] function image_type_to_extension(int $image_type, bool $include_dot = true): string|false {} @@ -1137,7 +1138,7 @@ function phpversion(?string $extension): string|false {} * @link https://php.net/manual/en/function.phpcredits.php * @param int $flags [optional]

    * To generate a custom credits page, you may want to use the - * flag parameter. + * flags parameter. *

    *

    * @@ -1228,7 +1229,7 @@ function zend_logo_guid(): string {} /** * Returns the type of interface between web server and PHP * @link https://php.net/manual/en/function.php-sapi-name.php - * @return string|false the interface type, as a lowercase string. + * @return string|false the interface type, as a lowercase string, or false on failure. *

    * Although not exhaustive, the possible return values include * aolserver, apache, @@ -1243,6 +1244,7 @@ function zend_logo_guid(): string {} *

    */ #[Pure] +#[ExpectedValues(['cli', 'phpdbg', 'embed', 'apache', 'apache2handler', 'cgi-fcgi', 'cli-server', 'fpm-fcgi', 'litespeed'])] function php_sapi_name(): string|false {} /** @@ -1325,12 +1327,14 @@ function strnatcasecmp(string $string1, string $string2): int {} * The substring to search for *

    * @param int $offset

    - * The offset where to start counting + * The offset where to start counting. If the offset is negative, + * counting starts from the end of the string. *

    * @param int|null $length [optional]

    * The maximum length after the specified offset to search for the * substring. It outputs a warning if the offset plus the length is - * greater than the haystack length. + * greater than the haystack length. A negative length counts from + * the end of haystack. *

    * @return int<0,max> This functions returns an integer. */ diff --git a/standard/standard_1.php b/standard/standard_1.php index 1fd53aeef..79b579cfe 100644 --- a/standard/standard_1.php +++ b/standard/standard_1.php @@ -44,7 +44,7 @@ function strtolower(string $string): string {} * the beginning of the string. Unlike {@see strrpos()} and {@see strripos()}, the offset cannot be negative. *

    * @return int<0,max>|false

    - * Returns the position where the needle exists relative to the beginnning of + * Returns the position where the needle exists relative to the beginning of * the haystack string (independent of search direction * or offset). * Also note that string positions start at 0, and not 1. @@ -185,7 +185,7 @@ function hebrevc(string $hebrew_text, $max_chars_per_line): string {} * The input string. *

    * @param bool $use_xhtml [optional]

    - * Whenever to use XHTML compatible line breaks or not. + * Whether to use XHTML compatible line breaks or not. *

    * @return string the altered string. */ @@ -1070,7 +1070,7 @@ function join(array|string $separator = "", ?array $array): string {} * * * - * @param string|array|int $locales

    + * @param string|string[]|int $locales

    * If locale is null or the empty string * "", the locale names will be set from the * values of environment variables with the same names as the above @@ -1087,7 +1087,7 @@ function join(array|string $separator = "", ?array $array): string {} * different names on different systems or for providing a fallback * for a possibly not available locale. *

    - * @param string ...$rest + * @param string|string[] ...$rest * @return string|false

    the new current locale, or false if the locale functionality is * not implemented on your platform, the specified locale does not exist or * the category name is invalid. diff --git a/standard/standard_4.php b/standard/standard_4.php index 6a2b04041..0c5e43fe2 100644 --- a/standard/standard_4.php +++ b/standard/standard_4.php @@ -383,10 +383,7 @@ function highlight_string(string $string, bool $return = false): string|bool {} * Otherwise the nanoseconds are returned as integer (64bit platforms) or float (32bit platforms). */ #[Pure(true)] -function hrtime( - #[PhpStormStubsElementAvailable(from: '7.3', to: '7.4')] bool $as_number, - #[PhpStormStubsElementAvailable(from: '8.0')] bool $as_number = false -): array|int|float|false {} +function hrtime(bool $as_number = false): array|int|float|false {} /** * Return source with stripped comments and whitespace diff --git a/standard/standard_7.php b/standard/standard_7.php index b8b6dc83a..680ba315e 100644 --- a/standard/standard_7.php +++ b/standard/standard_7.php @@ -368,10 +368,9 @@ function getcwd(): string|false {} * not specified, the last link opened by opendir * is assumed. *

    - * @return null|false * @see https://bugs.php.net/bug.php?id=75485 */ -function rewinddir($dir_handle): null|false {} +function rewinddir($dir_handle): void {} /** * Read entry from directory handle diff --git a/standard/standard_defines.php b/standard/standard_defines.php index ed759df0e..d08e6d4ad 100644 --- a/standard/standard_defines.php +++ b/standard/standard_defines.php @@ -878,7 +878,7 @@ * not be bound to the actual resource you requested. * If the requested resource is network based, this flag will cause the * opener to block until the whole contents have been downloaded. - * @link https://php.net/manual/en/internals2.ze1.streams.constants.php + * @link https://www.php.net/manual/en/stream.constants.php */ define('STREAM_MUST_SEEK', 16); define('STREAM_URL_STAT_LINK', 1); diff --git a/tests/DockerImages/8.1/Dockerfile b/tests/DockerImages/8.1/Dockerfile index 649b01f27..d6b728277 100644 --- a/tests/DockerImages/8.1/Dockerfile +++ b/tests/DockerImages/8.1/Dockerfile @@ -1,10 +1,10 @@ FROM php:8.1-alpine RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ + apk add --repository http://dl-cdn.alpinelinux.org/alpine/edge/community --no-cache --virtual .build-deps \ bash gcc g++ make autoconf pkgconfig git \ - libmcrypt-dev imap-dev php8-imap enchant2 php8-enchant bzip2-dev gettext-dev libxml2-dev php8-dev php8-gd icu-dev \ - php8-zip php8-tidy php8-intl libffi-dev openssl-dev php8-pear rabbitmq-c rabbitmq-c-dev librrd \ + libmcrypt-dev imap-dev php-imap enchant2 php-enchant bzip2-dev gettext-dev libxml2-dev php81-dev php-gd icu-dev \ + php-zip php-tidy php-intl libffi-dev openssl-dev php81-pear rabbitmq-c rabbitmq-c-dev librrd \ libzip-dev rrdtool-dev gmp-dev yaml yaml-dev fann fann-dev openldap-dev librdkafka librdkafka-dev libcurl curl-dev \ libpng-dev gpgme gpgme-dev libpq-dev aspell-dev diff --git a/tests/DockerImages/8.2/Dockerfile b/tests/DockerImages/8.2/Dockerfile index 03792e9a3..9d60d7554 100644 --- a/tests/DockerImages/8.2/Dockerfile +++ b/tests/DockerImages/8.2/Dockerfile @@ -1,10 +1,10 @@ -FROM php:8.2.0RC1-alpine +FROM php:8.2-alpine RUN set -eux; \ - apk add --no-cache --virtual .build-deps \ + apk add --repository http://dl-cdn.alpinelinux.org/alpine/edge/community --no-cache --virtual .build-deps \ bash gcc g++ make autoconf pkgconfig git \ - libmcrypt-dev imap-dev php8-imap enchant2 php8-enchant bzip2-dev gettext-dev libxml2-dev php8-dev php8-gd icu-dev \ - php8-zip php8-tidy php8-intl libffi-dev openssl-dev php8-pear rabbitmq-c rabbitmq-c-dev librrd \ + libmcrypt-dev imap-dev php-imap enchant2 php-enchant bzip2-dev gettext-dev libxml2-dev php82-dev php-gd icu-dev \ + php-zip php-tidy php-intl libffi-dev openssl-dev php82-pear rabbitmq-c rabbitmq-c-dev librrd \ libzip-dev rrdtool-dev gmp-dev yaml yaml-dev fann fann-dev openldap-dev librdkafka librdkafka-dev libcurl curl-dev \ libpng-dev gpgme gpgme-dev libpq-dev aspell-dev diff --git a/tests/DockerImages/peclExtensions/Dockerfile b/tests/DockerImages/peclExtensions/Dockerfile index 6447eea06..fd19b84c2 100644 --- a/tests/DockerImages/peclExtensions/Dockerfile +++ b/tests/DockerImages/peclExtensions/Dockerfile @@ -6,7 +6,7 @@ RUN set -eux; \ libmcrypt-dev imap-dev php8-imap enchant2 php8-enchant bzip2-dev gettext-dev libxml2-dev php8-dev php8-gd icu-dev \ php8-zip php8-tidy php8-intl libffi-dev openssl-dev php8-pear rabbitmq-c rabbitmq-c-dev librrd \ libzip-dev rrdtool-dev gmp-dev yaml yaml-dev fann fann-dev openldap-dev librdkafka librdkafka-dev libcurl curl-dev \ - libpng-dev gpgme gpgme-dev + libpng-dev gpgme gpgme-dev linux-pam-dev RUN pecl install xdebug RUN docker-php-ext-enable xdebug @@ -48,5 +48,7 @@ RUN pecl install gnupg RUN docker-php-ext-enable gnupg RUN pecl install uopz RUN docker-php-ext-enable uopz +RUN pecl install pam +RUN docker-php-ext-enable pam WORKDIR /opt/project/phpstorm-stubs diff --git a/tests/Model/PHPClass.php b/tests/Model/PHPClass.php index b99314f2e..0947c23ab 100644 --- a/tests/Model/PHPClass.php +++ b/tests/Model/PHPClass.php @@ -95,10 +95,6 @@ public function readObjectFromStubNode($node) $this->interfaces[] = ltrim($interfaceFQN, "\\"); } } - foreach ($node->getProperties() as $property) { - $parsedProperty = (new PHPProperty($this->name))->readObjectFromStubNode($property); - $this->addProperty($parsedProperty); - } if ($node->getDocComment() !== null) { $docBlock = DocBlockFactory::createInstance()->create($node->getDocComment()->getText()); /** @var PropertyRead[] $properties */ diff --git a/tests/Model/PHPDocElement.php b/tests/Model/PHPDocElement.php index 336772a82..f8a3528c1 100644 --- a/tests/Model/PHPDocElement.php +++ b/tests/Model/PHPDocElement.php @@ -76,7 +76,7 @@ trait PHPDocElement * @var bool */ public $hasInternalMetaTag = false; - public $templateTypes = null; + public $templateTypes = []; protected function collectTags(Node $node) { @@ -84,6 +84,7 @@ protected function collectTags(Node $node) try { $text = $node->getDocComment()->getText(); $text = preg_replace("/int\<\w+,\s*\w+\>/", "int", $text); + $text = preg_replace("/callable\(\w+(,\s*\w+)*\)(:\s*\w*)?/", "callable", $text); $this->phpdoc = $text; $phpDoc = DocFactoryProvider::getDocFactory()->create($text); $tags = $phpDoc->getTags(); @@ -101,7 +102,7 @@ protected function collectTags(Node $node) $this->hasInternalMetaTag = $phpDoc->hasTag('meta'); $this->hasInheritDocTag = $phpDoc->hasTag('inheritdoc') || $phpDoc->hasTag('inheritDoc') || stripos($phpDoc->getSummary(), 'inheritdoc') > 0; - $this->templateTypes = array_map( + $this->templateTypes += array_map( function (Generic $tag) { return preg_split("/\W/", $tag->getDescription()->getBodyTemplate())[0]; }, diff --git a/tests/Model/PHPFunction.php b/tests/Model/PHPFunction.php index aaacf1324..5a8219e28 100644 --- a/tests/Model/PHPFunction.php +++ b/tests/Model/PHPFunction.php @@ -4,8 +4,11 @@ use Exception; use JetBrains\PhpStorm\Deprecated; +use JetBrains\PhpStorm\Internal\TentativeType; use phpDocumentor\Reflection\DocBlock\Tags\Param; use phpDocumentor\Reflection\DocBlock\Tags\Return_; +use phpDocumentor\Reflection\Types\Array_; +use phpDocumentor\Reflection\Types\Collection; use phpDocumentor\Reflection\Types\Compound; use PhpParser\Comment\Doc; use PhpParser\Node\FunctionLike; @@ -36,6 +39,7 @@ class PHPFunction extends BasePHPElement /** @var string[] */ public $returnTypesFromSignature = []; + public $hasTentativeReturnType = false; /** * @param ReflectionFunction|ReflectionFunctionAbstract $reflectionObject @@ -102,11 +106,16 @@ public function readObjectFromStubNode($node) } } + $this->checkIfReturnTypeIsTentative($node); $this->checkDeprecationTag($node); $this->checkReturnTag(); return $this; } + protected function checkIfReturnTypeIsTentative(FunctionLike $node) { + $this->hasTentativeReturnType = self::hasTentativeReturnTypeAttribute($node); + } + protected function checkDeprecationTag(FunctionLike $node) { $this->isDeprecated = self::hasDeprecatedAttribute($node) || !empty($this->deprecatedTags); @@ -115,7 +124,14 @@ protected function checkDeprecationTag(FunctionLike $node) protected function checkReturnTag() { if (!empty($this->returnTags) && $this->returnTags[0] instanceof Return_) { - $returnType = $this->returnTags[0]->getType(); + $type = $this->returnTags[0]->getType(); + if ($type instanceof Collection) { + $returnType = $type->getFqsen(); + } elseif ($type instanceof Array_ && $type->getValueType() instanceof Collection) { + $returnType = "array"; + } else { + $returnType = $type; + } if ($returnType instanceof Compound) { foreach ($returnType as $nextType) { $this->returnTypesFromPhpDoc[] = (string)$nextType; @@ -191,6 +207,22 @@ private static function hasDeprecatedAttribute(FunctionLike $node) return false; } + /** + * @param FunctionLike $node + * @return bool + */ + public static function hasTentativeReturnTypeAttribute(FunctionLike $node) + { + foreach ($node->getAttrGroups() as $group) { + foreach ($group->attrs as $attr) { + if ((string)$attr->name === TentativeType::class) { + return true; + } + } + } + return false; + } + /** * @param Doc|null $docComment * @return bool diff --git a/tests/Model/PHPMethod.php b/tests/Model/PHPMethod.php index 228ff76e9..4526da3a2 100644 --- a/tests/Model/PHPMethod.php +++ b/tests/Model/PHPMethod.php @@ -84,6 +84,7 @@ public function readObjectFromStubNode($node) $this->returnTypesFromAttribute = $typesFromAttribute; array_push($this->returnTypesFromSignature, ...self::convertParsedTypeToArray($node->getReturnType())); $this->collectTags($node); + $this->checkIfReturnTypeIsTentative($node); $this->checkDeprecationTag($node); $this->checkReturnTag(); diff --git a/tests/Parsers/StubParser.php b/tests/Parsers/StubParser.php index 0528bb37b..7ee3d893e 100644 --- a/tests/Parsers/StubParser.php +++ b/tests/Parsers/StubParser.php @@ -54,6 +54,9 @@ public static function getPhpStormStubs(): StubsContainer foreach (self::$stubs->getClasses() as $class) { $class->readMutedProblems($jsonData->classes); $class->interfaces = CommonUtils::flattenArray($visitor->combineImplementedInterfaces($class), false); + foreach ($class->methods as $method) { + $method->templateTypes += $class->templateTypes; + } } foreach (self::$stubs->getFunctions() as $function) { $function->readMutedProblems($jsonData->functions); diff --git a/tests/StubsMetaExpectedArgumentsTest.php b/tests/StubsMetaExpectedArgumentsTest.php index cbe9dd6fa..53adf125e 100644 --- a/tests/StubsMetaExpectedArgumentsTest.php +++ b/tests/StubsMetaExpectedArgumentsTest.php @@ -31,6 +31,8 @@ class StubsMetaExpectedArgumentsTest extends AbstractBaseStubsTestCase { private const PSR_LOG_LOGGER_NAMESPACE_PREFIX = "Psr\\Log\\"; + private const GUZZLE_HTTP_NAMESPACE_PREFIX = "GuzzleHttp\\"; + private const ILLUMINATE_NAMESPACE_PREFIX = "Illuminate\\"; /** * @var ExpectedFunctionArgumentsInfo[] @@ -106,17 +108,29 @@ public function testFunctionReferencesExists() $expr = $argument->getFunctionReference(); if ($expr instanceof FuncCall) { $fqn = self::toPresentableFqn($expr->name->toCodeString()); - if (!str_starts_with($fqn, self::PSR_LOG_LOGGER_NAMESPACE_PREFIX)) { + if (!str_starts_with($fqn, self::PSR_LOG_LOGGER_NAMESPACE_PREFIX) && + !str_starts_with($fqn, self::GUZZLE_HTTP_NAMESPACE_PREFIX) && + !str_starts_with($fqn, self::ILLUMINATE_NAMESPACE_PREFIX)) { self::assertArrayHasKey($fqn, self::$functionsFqns, "Can't resolve function " . $fqn); } } elseif ($expr instanceof StaticCall) { if ((string)$expr->name !== '__construct') { $fqn = self::getClassMemberFqn($expr->class->toCodeString(), (string)$expr->name); - if (!str_starts_with($fqn, self::PSR_LOG_LOGGER_NAMESPACE_PREFIX)) { + if (!str_starts_with($fqn, self::PSR_LOG_LOGGER_NAMESPACE_PREFIX) && + !str_starts_with($fqn, self::GUZZLE_HTTP_NAMESPACE_PREFIX) && + !str_starts_with($fqn, self::ILLUMINATE_NAMESPACE_PREFIX)) { self::assertArrayHasKey($fqn, self::$methodsFqns, "Can't resolve method " . $fqn); } } - } elseif ($expr !== null) { + } elseif ($expr instanceof ConstFetch) { + $fqn = self::toPresentableFqn($expr->name->toCodeString()); + if (!str_starts_with($fqn, self::PSR_LOG_LOGGER_NAMESPACE_PREFIX) && + !str_starts_with($fqn, self::GUZZLE_HTTP_NAMESPACE_PREFIX) && + !str_starts_with($fqn, self::ILLUMINATE_NAMESPACE_PREFIX)) { + self::assertArrayHasKey($fqn, self::$constantsFqns, "Can't resolve constant " . $fqn); + } + } + elseif ($expr !== null) { self::fail('First argument should be function reference or method reference, got: ' . $expr::class); } } diff --git a/tests/StubsPhpDocTest.php b/tests/StubsPhpDocTest.php index 3aa45189f..e9541b6c5 100644 --- a/tests/StubsPhpDocTest.php +++ b/tests/StubsPhpDocTest.php @@ -187,6 +187,7 @@ private static function checkContainsOnlyValidTags(BasePHPElement $element, stri 'copyright', 'deprecated', 'example', //temporary addition due to the number of existing cases + 'extends', 'inheritdoc', 'inheritDoc', 'internal', @@ -233,7 +234,7 @@ private static function checkContainsOnlyValidTags(BasePHPElement $element, stri private static function checkPHPDocCorrectness(BasePHPElement $element, string $elementName): void { self::checkLinks($element, $elementName); - self::checkHtmlTags($element, $elementName); + //self::checkHtmlTags($element, $elementName); if ($element->stubBelongsToCore) { self::checkDeprecatedRemovedSinceVersionsMajor($element, $elementName); } diff --git a/tests/StubsTypeHintsTest.php b/tests/StubsTypeHintsTest.php index ee1d07d63..9b152a395 100644 --- a/tests/StubsTypeHintsTest.php +++ b/tests/StubsTypeHintsTest.php @@ -121,7 +121,7 @@ public function testMethodsReturnTypeHints(PHPClass|PHPInterface $class, PHPMeth } /** - * @dataProvider \StubTests\TestData\Providers\Reflection\ReflectionParametersProvider::methodParametersProvider + * @dataProvider \StubTests\TestData\Providers\Reflection\ReflectionParametersProvider::methodParametersWithTypeHintProvider * @throws RuntimeException */ public function testMethodsParametersTypeHints(PHPClass|PHPInterface $reflectionClass, PHPMethod $reflectionMethod, PHPParameter $reflectionParameter) @@ -208,10 +208,13 @@ public static function testSignatureTypeHintsConformPhpDocInMethods(PHPFunction| } } - // replace array notations like int[] or array to match the array type - return preg_replace(['/\w+\[]/', '/array<[a-z,\s]+>/'], 'array', $typeName); + // replace array notations like int[] or array or array{name:type} to match the array type + return preg_replace(['/\w+\[]/', '/array[{<][a-z,\s:|_]+[>}]/'], 'array', $typeName); }, $method->returnTypesFromPhpDoc); - $unifiedSignatureTypes = $method->returnTypesFromSignature; + $unifiedSignatureTypes = array_map(function (string $type) { + $typeParts = explode('\\', $type); + return end($typeParts); + }, $method->returnTypesFromSignature); if (count($unifiedSignatureTypes) === 1) { $type = array_pop($unifiedSignatureTypes); if (str_contains($type, '?')) { @@ -222,13 +225,12 @@ public static function testSignatureTypeHintsConformPhpDocInMethods(PHPFunction| $unifiedSignatureTypes[] = $typeName; } $typesIntersection = array_intersect($unifiedSignatureTypes, $unifiedPhpDocTypes); + $name = $method instanceof PHPMethod ? "Method $method->parentName::" : 'Function '; self::assertSameSize( $unifiedSignatureTypes, $typesIntersection, - $method instanceof PHPMethod ? "Method $method->parentName::" : 'Function ' . - "$functionName has mismatch in phpdoc return type and signature return type\n - signature has " . implode('|', $unifiedSignatureTypes) . "\n - but phpdoc has " . implode('|', $unifiedPhpDocTypes) + $name . "$functionName has mismatch in phpdoc return type and signature return type. + Signature has " . implode('|', $unifiedSignatureTypes) . " but phpdoc has " . implode('|', $unifiedPhpDocTypes) ); } diff --git a/tests/TestData/Providers/Reflection/ReflectionParametersProvider.php b/tests/TestData/Providers/Reflection/ReflectionParametersProvider.php index c873bff04..751563825 100644 --- a/tests/TestData/Providers/Reflection/ReflectionParametersProvider.php +++ b/tests/TestData/Providers/Reflection/ReflectionParametersProvider.php @@ -79,6 +79,26 @@ public static function methodParametersProvider(): ?Generator } } + public static function methodParametersWithTypeHintProvider(): ?Generator + { + $classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() + + ReflectionStubsSingleton::getReflectionStubs()->getInterfaces(); + foreach (EntitiesFilter::getFiltered($classesAndInterfaces) as $class) { + //exclude classes from PHPReflectionParser + if (strncmp($class->name, 'PHP', 3) !== 0) { + foreach (EntitiesFilter::getFilteredFunctions($class) as $method) { + foreach (EntitiesFilter::getFilteredParameters( + $method, + null, + StubProblemType::PARAMETER_TYPE_MISMATCH + ) as $parameter) { + yield "$class->name::$method->name($parameter->name)" => [$class, $method, $parameter]; + } + } + } + } + } + public static function methodOptionalParametersProvider(): ?Generator { $classesAndInterfaces = ReflectionStubsSingleton::getReflectionStubs()->getClasses() + diff --git a/tests/TestData/Providers/Stubs/PhpCoreStubsProvider.php b/tests/TestData/Providers/Stubs/PhpCoreStubsProvider.php index b8e2cb27d..061498195 100644 --- a/tests/TestData/Providers/Stubs/PhpCoreStubsProvider.php +++ b/tests/TestData/Providers/Stubs/PhpCoreStubsProvider.php @@ -61,7 +61,6 @@ class PhpCoreStubsProvider 'gettext', 'gmp', 'imap', - 'interbase', 'ldap', 'libxml', 'mcrypt', @@ -110,6 +109,7 @@ class PhpCoreStubsProvider 'ibm_db2', 'imagick', 'inotify', + 'interbase', 'leveldb', 'libevent', 'LuaSandbox', @@ -124,6 +124,7 @@ class PhpCoreStubsProvider 'mysql_xdevapi', 'ncurses', 'oauth', + 'pam', 'parallel', 'Parle', 'pcov', @@ -193,6 +194,7 @@ class PhpCoreStubsProvider 'phpdbg', 'rar', 'redis', + 'relay', 'rrd', 'SaxonC', 'snappy', diff --git a/tests/TestData/Providers/Stubs/StubMethodsProvider.php b/tests/TestData/Providers/Stubs/StubMethodsProvider.php index a1bd1e6f1..3845e16b4 100644 --- a/tests/TestData/Providers/Stubs/StubMethodsProvider.php +++ b/tests/TestData/Providers/Stubs/StubMethodsProvider.php @@ -13,6 +13,7 @@ use StubTests\Parsers\ParserUtils; use StubTests\TestData\Providers\EntitiesFilter; use StubTests\TestData\Providers\PhpStormStubsSingleton; +use function in_array; class StubMethodsProvider { @@ -29,21 +30,23 @@ public static function allMethodsProvider(): ?Generator public static function allFunctionAndMethodsWithReturnTypeHintsProvider(): ?Generator { - $coreClassesAndInterfaces = PhpStormStubsSingleton::getPhpStormStubs()->getClasses() + - PhpStormStubsSingleton::getPhpStormStubs()->getInterfaces(); + $coreClassesAndInterfaces = PhpStormStubsSingleton::getPhpStormStubs()->getCoreClasses() + + PhpStormStubsSingleton::getPhpStormStubs()->getCoreInterfaces(); $allFunctions = PhpStormStubsSingleton::getPhpStormStubs()->getFunctions(); $filteredMethods = []; foreach (EntitiesFilter::getFiltered($coreClassesAndInterfaces) as $class) { - $filteredMethods = EntitiesFilter::getFiltered( + $filteredMethods += EntitiesFilter::getFiltered( $class->methods, fn (PHPMethod $method) => empty($method->returnTypesFromSignature) || empty($method->returnTypesFromPhpDoc) - || $method->parentName === '___PHPSTORM_HELPERS\object', + || $method->parentName === '___PHPSTORM_HELPERS\object' || $method->hasTentativeReturnType + || in_array('mixed', $method->returnTypesFromSignature), StubProblemType::TYPE_IN_PHPDOC_DIFFERS_FROM_SIGNATURE ); } $filteredMethods += EntitiesFilter::getFiltered( $allFunctions, - fn (PHPFunction $function) => empty($function->returnTypesFromSignature) || empty($function->returnTypesFromPhpDoc), + fn (PHPFunction $function) => empty($function->returnTypesFromSignature) || empty($function->returnTypesFromPhpDoc) + || $function->hasTentativeReturnType || in_array('mixed', $function->returnTypesFromSignature), StubProblemType::TYPE_IN_PHPDOC_DIFFERS_FROM_SIGNATURE ); foreach ($filteredMethods as $methodName => $method) { diff --git a/tests/TestData/mutedProblems.json b/tests/TestData/mutedProblems.json index e04804c68..afb9962a4 100644 --- a/tests/TestData/mutedProblems.json +++ b/tests/TestData/mutedProblems.json @@ -574,6 +574,17 @@ } ], "functions": [ + { + "name": "imagefilledpolygon", + "problems": [ + { + "description": "has duplicate in stubs", + "versions": [ + "ALL" + ] + } + ] + }, { "name": "session_set_save_handler", "problems": [ @@ -1024,6 +1035,23 @@ ] } ] + }, + { + "name": "hrtime", + "parameters": [ + { + "name": "get_as_number", + "problems": [ + { + "description": "wrong optionallity", + "versions": [ + 7.3, + 7.4 + ] + } + ] + } + ] } ], "classes": [ @@ -3016,6 +3044,29 @@ } ] }, + { + "name": "IntlBreakIterator", + "methods": [ + { + "name": "getPartsIterator", + "parameters": [ + { + "name": "type", + "problems": [ + { + "description": "parameter type mismatch", + "versions": [ + 8.0, + 8.1, + 8.2 + ] + } + ] + } + ] + } + ] + }, { "name": "ParseError", "problems": [ diff --git a/xml/xml.php b/xml/xml.php index fad725b4f..5d22a2a91 100644 --- a/xml/xml.php +++ b/xml/xml.php @@ -62,7 +62,8 @@ function xml_parser_create_ns(?string $encoding, string $separator = ':') {} *

    * @return bool TRUE on success or FALSE on failure. */ -function xml_set_object(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, object $object): bool {} +#[LanguageLevelTypeAware(["8.2" => "true"], default: "bool")] +function xml_set_object(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, object $object) {} /** * Set up start and end element handlers @@ -91,7 +92,8 @@ function xml_set_object(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default * reference to the XML parser calling the handler.

    * @return bool TRUE on success or FALSE on failure. */ -function xml_set_element_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $start_handler, $end_handler): bool {} +#[LanguageLevelTypeAware(["8.2" => "true"], default: "bool")] +function xml_set_element_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $start_handler, $end_handler) {} /** * Set up character data handler @@ -115,7 +117,8 @@ function xml_set_element_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"] * reference to the XML parser calling the handler.

    * @return bool TRUE on success or FALSE on failure. */ -function xml_set_character_data_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $handler): bool {} +#[LanguageLevelTypeAware(["8.2" => "true"], default: "bool")] +function xml_set_character_data_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $handler) {} /** * Set up processing instruction (PI) handler @@ -140,7 +143,8 @@ function xml_set_character_data_handler(#[LanguageLevelTypeAware(["8.0" => "XMLP * reference to the XML parser calling the handler.

    * @return bool TRUE on success or FALSE on failure. */ -function xml_set_processing_instruction_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $handler): bool {} +#[LanguageLevelTypeAware(["8.2" => "true"], default: "bool")] +function xml_set_processing_instruction_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $handler) {} /** * Set up default handler @@ -164,7 +168,8 @@ function xml_set_processing_instruction_handler(#[LanguageLevelTypeAware(["8.0" * reference to the XML parser calling the handler.

    * @return bool TRUE on success or FALSE on failure. */ -function xml_set_default_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $handler): bool {} +#[LanguageLevelTypeAware(["8.2" => "true"], default: "bool")] +function xml_set_default_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $handler) {} /** * Set up unparsed entity declaration handler @@ -193,7 +198,8 @@ function xml_set_default_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"] * handler.

    * @return bool TRUE on success or FALSE on failure. */ -function xml_set_unparsed_entity_decl_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $handler): bool {} +#[LanguageLevelTypeAware(["8.2" => "true"], default: "bool")] +function xml_set_unparsed_entity_decl_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $handler) {} /** * Set up notation declaration handler @@ -220,7 +226,8 @@ function xml_set_unparsed_entity_decl_handler(#[LanguageLevelTypeAware(["8.0" => * reference to the XML parser calling the handler.

    * @return bool TRUE on success or FALSE on failure. */ -function xml_set_notation_decl_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $handler): bool {} +#[LanguageLevelTypeAware(["8.2" => "true"], default: "bool")] +function xml_set_notation_decl_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $handler) {} /** * Set up external entity reference handler @@ -251,7 +258,8 @@ function xml_set_notation_decl_handler(#[LanguageLevelTypeAware(["8.0" => "XMLPa * reference to the XML parser calling the handler.

    * @return bool TRUE on success or FALSE on failure. */ -function xml_set_external_entity_ref_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $handler): bool {} +#[LanguageLevelTypeAware(["8.2" => "true"], default: "bool")] +function xml_set_external_entity_ref_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $handler) {} /** * Set up start namespace declaration handler @@ -280,7 +288,8 @@ function xml_set_external_entity_ref_handler(#[LanguageLevelTypeAware(["8.0" => * reference to the XML parser calling the handler.

    * @return bool TRUE on success or FALSE on failure. */ -function xml_set_start_namespace_decl_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $handler): bool {} +#[LanguageLevelTypeAware(["8.2" => "true"], default: "bool")] +function xml_set_start_namespace_decl_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $handler) {} /** * Set up end namespace declaration handler @@ -308,7 +317,8 @@ function xml_set_start_namespace_decl_handler(#[LanguageLevelTypeAware(["8.0" => * reference to the XML parser calling the handler.

    * @return bool TRUE on success or FALSE on failure. */ -function xml_set_end_namespace_decl_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $handler): bool {} +#[LanguageLevelTypeAware(["8.2" => "true"], default: "bool")] +function xml_set_end_namespace_decl_handler(#[LanguageLevelTypeAware(["8.0" => "XMLParser"], default: "resource")] $parser, $handler) {} /** * Start parsing an XML document diff --git a/xmlreader/xmlreader.php b/xmlreader/xmlreader.php index 651559147..d895cab07 100644 --- a/xmlreader/xmlreader.php +++ b/xmlreader/xmlreader.php @@ -309,7 +309,7 @@ public function moveToNextAttribute(): bool {} * A bitmask of the LIBXML_* * constants. *

    - * @return bool TRUE on success or FALSE on failure. If called statically, returns an + * @return XMLReader|bool TRUE on success or FALSE on failure. If called statically, returns an * XMLReader or FALSE on failure. * @since 5.1.2 */ diff --git a/zip/zip.php b/zip/zip.php index 48ceae7a7..c3e492c32 100644 --- a/zip/zip.php +++ b/zip/zip.php @@ -630,9 +630,9 @@ class ZipArchive implements Countable * ZipArchive::OVERWRITE *

    * - * @return int|true Error codes + * @return int|bool Error codes *

    - * Returns TRUE on success or the error code. + * Returns TRUE on success, FALSE or the error code on error. *

    *

    * ZipArchive::ER_EXISTS @@ -1046,7 +1046,7 @@ public function deleteName(#[LanguageLevelTypeAware(['8.0' => 'string'], default * ignoring any changes made. * ZipArchive::FL_NOCASE *

    - * @return array|false an array containing the entry details or FALSE on failure. + * @return array{name: string, index: int, crc: int, size: int, mtime: int, comp_size: int, comp_method: int, encryption_method: int}|false an array containing the entry details or FALSE on failure. */ public function statName( #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $name, @@ -1065,7 +1065,7 @@ public function statName( * information about the original file in the archive, * ignoring any changes made. *

    - * @return array|false an array containing the entry details or FALSE on failure. + * @return array{name: string, index: int, crc: int, size: int, mtime: int, comp_size: int, comp_method: int, encryption_method: int}|false an array containing the entry details or FALSE on failure. */ public function statIndex( #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $index,