Use true as return types for SplHeap (#13147)

This commit is contained in:
Gina Peter Banyard 2024-01-15 10:09:38 +00:00 committed by GitHub
parent 474edd6eb5
commit f7b498b02e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 11 deletions

View file

@ -311,6 +311,12 @@ PDO_SQLITE:
- PGSQL:
. pg_select, the conditions arguments accepts an empty array and is optional.
- SPL:
. SplPriorityQueue::insert() and SplPriorityQueue::recoverFromCorruption()
now has a tentative return type of true
. SplHeap::insert() and SplHeap::recoverFromCorruption()
now has a tentative return type of true instead of bool
- Standard:
. The internal implementation for rounding to integers has been rewritten
to be easier to verify for correctness and to be easier to maintain.

View file

@ -14,8 +14,8 @@ class SplPriorityQueue implements Iterator, Countable
/** @tentative-return-type */
public function compare(mixed $priority1, mixed $priority2): int {}
/** @return true */
public function insert(mixed $value, mixed $priority) {} // TODO make return type void
/** @tentative-return-type */
public function insert(mixed $value, mixed $priority): true {}
/** @tentative-return-type */
public function setExtractFlags(int $flags): int {}
@ -66,10 +66,10 @@ class SplPriorityQueue implements Iterator, Countable
public function valid(): bool {}
/**
* @return bool
* @tentative-return-type
* @implementation-alias SplHeap::recoverFromCorruption
*/
public function recoverFromCorruption() {} // TODO make return type void
public function recoverFromCorruption(): true {}
/**
* @tentative-return-type
@ -90,7 +90,7 @@ abstract class SplHeap implements Iterator, Countable
public function extract(): mixed {}
/** @tentative-return-type */
public function insert(mixed $value): bool {}
public function insert(mixed $value): true {}
/** @tentative-return-type */
public function top(): mixed {}
@ -117,7 +117,7 @@ abstract class SplHeap implements Iterator, Countable
public function valid(): bool {}
/** @tentative-return-type */
public function recoverFromCorruption(): bool {}
public function recoverFromCorruption(): true {}
/** @tentative-return-type */
abstract protected function compare(mixed $value1, mixed $value2): int;

View file

@ -1,12 +1,12 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 627bf1f09cfb444f90e0dba6d2b7341312d723cf */
* Stub hash: 47273e114c9c7089bf708a2f18f2e9e522abceb6 */
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_SplPriorityQueue_compare, 0, 2, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, priority1, IS_MIXED, 0)
ZEND_ARG_TYPE_INFO(0, priority2, IS_MIXED, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplPriorityQueue_insert, 0, 0, 2)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_SplPriorityQueue_insert, 0, 2, IS_TRUE, 0)
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
ZEND_ARG_TYPE_INFO(0, priority, IS_MIXED, 0)
ZEND_END_ARG_INFO()
@ -37,7 +37,7 @@ ZEND_END_ARG_INFO()
#define arginfo_class_SplPriorityQueue_valid arginfo_class_SplPriorityQueue_isEmpty
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplPriorityQueue_recoverFromCorruption, 0, 0, 0)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_SplPriorityQueue_recoverFromCorruption, 0, 0, IS_TRUE, 0)
ZEND_END_ARG_INFO()
#define arginfo_class_SplPriorityQueue_isCorrupted arginfo_class_SplPriorityQueue_isEmpty
@ -49,7 +49,7 @@ ZEND_END_ARG_INFO()
#define arginfo_class_SplHeap_extract arginfo_class_SplPriorityQueue_top
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_SplHeap_insert, 0, 1, _IS_BOOL, 0)
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_SplHeap_insert, 0, 1, IS_TRUE, 0)
ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0)
ZEND_END_ARG_INFO()
@ -69,7 +69,7 @@ ZEND_END_ARG_INFO()
#define arginfo_class_SplHeap_valid arginfo_class_SplPriorityQueue_isEmpty
#define arginfo_class_SplHeap_recoverFromCorruption arginfo_class_SplPriorityQueue_isEmpty
#define arginfo_class_SplHeap_recoverFromCorruption arginfo_class_SplPriorityQueue_recoverFromCorruption
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_SplHeap_compare, 0, 2, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, value1, IS_MIXED, 0)