From 50d342a094e72786fb8386932cbd571931021442 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Fri, 8 Aug 2025 12:53:11 +0200 Subject: [PATCH 1/2] Simplify Ds stubs --- resources/functionMap.php | 170 -------------------------------------- 1 file changed, 170 deletions(-) diff --git a/resources/functionMap.php b/resources/functionMap.php index 087c2aa660..97e5324861 100644 --- a/resources/functionMap.php +++ b/resources/functionMap.php @@ -1725,214 +1725,44 @@ 'DOTNET::__construct' => ['void', 'assembly_name'=>'string', 'class_name'=>'string', 'codepage='=>'int'], 'dotnet_load' => ['int', 'assembly_name'=>'string', 'datatype_name='=>'string', 'codepage='=>'int'], 'doubleval' => ['float', 'var'=>'scalar|array|resource|null'], -'Ds\Collection::clear' => ['void'], -'Ds\Collection::copy' => ['Ds\Collection'], -'Ds\Collection::isEmpty' => ['bool'], -'Ds\Collection::toArray' => ['array'], 'Ds\Deque::__construct' => ['void', 'values='=>'mixed'], -'Ds\Deque::allocate' => ['void', 'capacity'=>'int'], -'Ds\Deque::apply' => ['void', 'callback'=>'callable'], -'Ds\Deque::capacity' => ['int'], -'Ds\Deque::clear' => ['void'], -'Ds\Deque::contains' => ['bool', '...values='=>'mixed'], -'Ds\Deque::copy' => ['Ds\Deque'], 'Ds\Deque::count' => ['0|positive-int'], -'Ds\Deque::filter' => ['Ds\Deque', 'callback='=>'callable'], -'Ds\Deque::find' => ['mixed', 'value'=>'mixed'], -'Ds\Deque::first' => ['mixed'], -'Ds\Deque::get' => ['void', 'index'=>'int'], -'Ds\Deque::insert' => ['void', 'index'=>'int', '...values='=>'mixed'], -'Ds\Deque::isEmpty' => ['bool'], -'Ds\Deque::join' => ['string', 'glue='=>'string'], 'Ds\Deque::jsonSerialize' => ['array'], -'Ds\Deque::last' => ['mixed'], -'Ds\Deque::map' => ['Ds\Deque', 'callback'=>'callable'], -'Ds\Deque::merge' => ['Ds\Deque', 'values'=>'mixed'], -'Ds\Deque::pop' => ['mixed'], -'Ds\Deque::push' => ['void', '...values='=>'mixed'], -'Ds\Deque::reduce' => ['mixed', 'callback'=>'callable', 'initial='=>'mixed'], -'Ds\Deque::remove' => ['mixed', 'index'=>'int'], -'Ds\Deque::reverse' => ['void'], -'Ds\Deque::reversed' => ['Ds\Deque'], -'Ds\Deque::rotate' => ['void', 'rotations'=>'int'], -'Ds\Deque::set' => ['void', 'index'=>'int', 'value'=>'mixed'], -'Ds\Deque::shift' => ['mixed'], -'Ds\Deque::slice' => ['Ds\Deque', 'index'=>'int', 'length='=>'?int'], -'Ds\Deque::sort' => ['void', 'comparator='=>'callable'], -'Ds\Deque::sorted' => ['Ds\Deque', 'comparator='=>'callable'], -'Ds\Deque::sum' => ['int|float'], -'Ds\Deque::toArray' => ['array'], -'Ds\Deque::unshift' => ['void', '...values='=>'mixed'], -'Ds\Hashable::equals' => ['bool', 'obj'=>'mixed'], -'Ds\Hashable::hash' => ['mixed'], 'Ds\Map::__construct' => ['void', 'values='=>'mixed'], 'Ds\Map::allocate' => ['void', 'capacity'=>'int'], 'Ds\Map::apply' => ['void', 'callback'=>'callable'], -'Ds\Map::capacity' => ['int'], -'Ds\Map::clear' => ['void'], -'Ds\Map::copy' => ['Ds\Map'], 'Ds\Map::count' => ['0|positive-int'], -'Ds\Map::diff' => ['Ds\Map', 'map'=>'Ds\Map'], -'Ds\Map::filter' => ['Ds\Map', 'callback='=>'callable'], -'Ds\Map::first' => ['Ds\Pair'], -'Ds\Map::get' => ['mixed', 'key'=>'mixed', 'default='=>'mixed'], -'Ds\Map::hasKey' => ['bool', 'key'=>'mixed'], -'Ds\Map::hasValue' => ['bool', 'value'=>'mixed'], -'Ds\Map::intersect' => ['Ds\Map', 'map'=>'Ds\Map'], -'Ds\Map::isEmpty' => ['bool'], 'Ds\Map::jsonSerialize' => ['array'], -'Ds\Map::keys' => ['Ds\Set'], 'Ds\Map::ksort' => ['void', 'comparator='=>'callable'], -'Ds\Map::ksorted' => ['Ds\Map', 'comparator='=>'callable'], -'Ds\Map::last' => ['Ds\Pair'], -'Ds\Map::map' => ['Ds\Map', 'callback'=>'callable'], -'Ds\Map::merge' => ['Ds\Map', 'values'=>'mixed'], -'Ds\Map::pairs' => ['Ds\Sequence'], 'Ds\Map::put' => ['void', 'key'=>'mixed', 'value'=>'mixed'], 'Ds\Map::putAll' => ['void', 'values'=>'mixed'], -'Ds\Map::reduce' => ['mixed', 'callback'=>'callable', 'initial='=>'mixed'], -'Ds\Map::remove' => ['mixed', 'key'=>'mixed', 'default='=>'mixed'], 'Ds\Map::reverse' => ['void'], -'Ds\Map::reversed' => ['Ds\Map'], -'Ds\Map::skip' => ['Ds\Pair', 'position'=>'int'], -'Ds\Map::slice' => ['Ds\Map', 'index'=>'int', 'length='=>'?int'], 'Ds\Map::sort' => ['void', 'comparator='=>'callable'], -'Ds\Map::sorted' => ['Ds\Map', 'comparator='=>'callable'], -'Ds\Map::sum' => ['int|float'], -'Ds\Map::toArray' => ['array'], -'Ds\Map::union' => ['Ds\Map', 'map'=>'Ds\Map'], -'Ds\Map::values' => ['Ds\Sequence'], -'Ds\Map::xor' => ['Ds\Map', 'map'=>'Ds\Map'], -'Ds\Pair::__construct' => ['void', 'key='=>'mixed', 'value='=>'mixed'], -'Ds\Pair::copy' => ['Ds\Pair'], 'Ds\Pair::jsonSerialize' => ['array'], -'Ds\Pair::toArray' => ['array'], -'Ds\PriorityQueue::__construct' => ['void'], -'Ds\PriorityQueue::allocate' => ['void', 'capacity'=>'int'], -'Ds\PriorityQueue::capacity' => ['int'], -'Ds\PriorityQueue::clear' => ['void'], -'Ds\PriorityQueue::copy' => ['Ds\PriorityQueue'], 'Ds\PriorityQueue::count' => ['0|positive-int'], -'Ds\PriorityQueue::isEmpty' => ['bool'], 'Ds\PriorityQueue::jsonSerialize' => ['array'], -'Ds\PriorityQueue::peek' => ['mixed'], -'Ds\PriorityQueue::pop' => ['mixed'], 'Ds\PriorityQueue::push' => ['void', 'value'=>'mixed', 'priority'=>'int'], -'Ds\PriorityQueue::toArray' => ['array'], -'Ds\Queue::__construct' => ['void', 'values='=>'mixed'], 'Ds\Queue::allocate' => ['void', 'capacity'=>'int'], -'Ds\Queue::capacity' => ['int'], -'Ds\Queue::clear' => ['void'], -'Ds\Queue::copy' => ['Ds\Queue'], 'Ds\Queue::count' => ['0|positive-int'], -'Ds\Queue::isEmpty' => ['bool'], 'Ds\Queue::jsonSerialize' => ['array'], -'Ds\Queue::peek' => ['mixed'], -'Ds\Queue::pop' => ['mixed'], 'Ds\Queue::push' => ['void', '...values='=>'mixed'], -'Ds\Queue::toArray' => ['array'], -'Ds\Sequence::allocate' => ['void', 'capacity'=>'int'], -'Ds\Sequence::apply' => ['void', 'callback'=>'callable'], -'Ds\Sequence::capacity' => ['int'], -'Ds\Sequence::contains' => ['bool', '...values='=>'mixed'], -'Ds\Sequence::filter' => ['Ds\Sequence', 'callback='=>'callable'], -'Ds\Sequence::find' => ['mixed', 'value'=>'mixed'], -'Ds\Sequence::first' => ['mixed'], -'Ds\Sequence::get' => ['mixed', 'index'=>'int'], -'Ds\Sequence::insert' => ['void', 'index'=>'int', '...values='=>'mixed'], -'Ds\Sequence::join' => ['string', 'glue='=>'string'], -'Ds\Sequence::last' => ['void'], -'Ds\Sequence::map' => ['Ds\Sequence', 'callback'=>'callable'], -'Ds\Sequence::merge' => ['Ds\Sequence', 'values'=>'mixed'], -'Ds\Sequence::pop' => ['mixed'], -'Ds\Sequence::push' => ['void', '...values='=>'mixed'], -'Ds\Sequence::reduce' => ['mixed', 'callback'=>'callable', 'initial='=>'mixed'], -'Ds\Sequence::remove' => ['mixed', 'index'=>'int'], -'Ds\Sequence::reverse' => ['void'], -'Ds\Sequence::reversed' => ['Ds\Sequence'], -'Ds\Sequence::rotate' => ['void', 'rotations'=>'int'], -'Ds\Sequence::set' => ['void', 'index'=>'int', 'value'=>'mixed'], -'Ds\Sequence::shift' => ['mixed'], -'Ds\Sequence::slice' => ['Ds\Sequence', 'index'=>'int', 'length='=>'?int'], -'Ds\Sequence::sort' => ['void', 'comparator='=>'callable'], -'Ds\Sequence::sorted' => ['Ds\Sequence', 'comparator='=>'callable'], -'Ds\Sequence::sum' => ['int|float'], -'Ds\Sequence::unshift' => ['void', '...values='=>'mixed'], -'Ds\Set::__construct' => ['void', 'values='=>'mixed'], 'Ds\Set::add' => ['void', '...values='=>'mixed'], 'Ds\Set::allocate' => ['void', 'capacity'=>'int'], -'Ds\Set::capacity' => ['int'], 'Ds\Set::clear' => ['void'], -'Ds\Set::contains' => ['bool', '...values='=>'mixed'], -'Ds\Set::copy' => ['Ds\Set'], 'Ds\Set::count' => ['0|positive-int'], -'Ds\Set::diff' => ['Ds\Set', 'set'=>'Ds\Set'], -'Ds\Set::filter' => ['Ds\Set', 'callback='=>'callable'], -'Ds\Set::first' => ['mixed'], -'Ds\Set::get' => ['mixed', 'index'=>'int'], -'Ds\Set::intersect' => ['Ds\Set', 'set'=>'Ds\Set'], -'Ds\Set::isEmpty' => ['bool'], 'Ds\Set::join' => ['string', 'glue='=>'string'], 'Ds\Set::jsonSerialize' => ['array'], -'Ds\Set::last' => ['mixed'], -'Ds\Set::map' => ['Ds\Set', 'callback='=>'callable'], -'Ds\Set::merge' => ['Ds\Set', 'values'=>'mixed'], -'Ds\Set::reduce' => ['mixed', 'callback'=>'callable', 'initial='=>'mixed'], 'Ds\Set::remove' => ['void', '...values='=>'mixed'], 'Ds\Set::reverse' => ['void'], -'Ds\Set::reversed' => ['Ds\Set'], -'Ds\Set::slice' => ['Ds\Set', 'index'=>'int', 'length='=>'?int'], 'Ds\Set::sort' => ['void', 'comparator='=>'callable'], -'Ds\Set::sorted' => ['Ds\Set', 'comparator='=>'callable'], -'Ds\Set::sum' => ['int|float'], -'Ds\Set::toArray' => ['array'], -'Ds\Set::union' => ['Ds\Set', 'set'=>'Ds\Set'], -'Ds\Set::xor' => ['Ds\Set', 'set'=>'Ds\Set'], -'Ds\Stack::__construct' => ['void', 'values='=>'mixed'], 'Ds\Stack::allocate' => ['void', 'capacity'=>'int'], -'Ds\Stack::capacity' => ['int'], -'Ds\Stack::clear' => ['void'], -'Ds\Stack::copy' => ['Ds\Stack'], 'Ds\Stack::count' => ['0|positive-int'], -'Ds\Stack::isEmpty' => ['bool'], 'Ds\Stack::jsonSerialize' => ['array'], -'Ds\Stack::peek' => ['mixed'], -'Ds\Stack::pop' => ['mixed'], -'Ds\Stack::push' => ['void', '...values='=>'mixed'], -'Ds\Stack::toArray' => ['array'], 'Ds\Vector::__construct' => ['void', 'values='=>'mixed'], -'Ds\Vector::allocate' => ['void', 'capacity'=>'int'], -'Ds\Vector::apply' => ['void', 'callback'=>'callable'], -'Ds\Vector::capacity' => ['int'], -'Ds\Vector::clear' => ['void'], -'Ds\Vector::contains' => ['bool', '...values='=>'mixed'], -'Ds\Vector::copy' => ['Ds\Vector'], 'Ds\Vector::count' => ['0|positive-int'], -'Ds\Vector::filter' => ['Ds\Vector', 'callback='=>'callable'], -'Ds\Vector::find' => ['mixed', 'value'=>'mixed'], -'Ds\Vector::first' => ['mixed'], -'Ds\Vector::get' => ['mixed', 'index'=>'int'], -'Ds\Vector::insert' => ['void', 'index'=>'int', '...values='=>'mixed'], -'Ds\Vector::isEmpty' => ['bool'], 'Ds\Vector::join' => ['string', 'glue='=>'string'], 'Ds\Vector::jsonSerialize' => ['array'], -'Ds\Vector::last' => ['mixed'], -'Ds\Vector::map' => ['Ds\Vector', 'callback'=>'callable'], -'Ds\Vector::merge' => ['Ds\Vector', 'values'=>'mixed'], -'Ds\Vector::pop' => ['mixed'], -'Ds\Vector::push' => ['void', '...values='=>'mixed'], -'Ds\Vector::reduce' => ['mixed', 'callback'=>'callable', 'initial='=>'mixed'], -'Ds\Vector::remove' => ['mixed', 'index'=>'int'], -'Ds\Vector::reverse' => ['void'], -'Ds\Vector::reversed' => ['Ds\Vector'], -'Ds\Vector::rotate' => ['void', 'rotations'=>'int'], -'Ds\Vector::set' => ['void', 'index'=>'int', 'value'=>'mixed'], -'Ds\Vector::shift' => ['mixed'], -'Ds\Vector::slice' => ['Ds\Vector', 'index'=>'int', 'length='=>'?int'], -'Ds\Vector::sort' => ['void', 'comparator='=>'callable'], -'Ds\Vector::sorted' => ['Ds\Vector', 'comparator='=>'callable'], 'Ds\Vector::sum' => ['int|float'], -'Ds\Vector::toArray' => ['array'], 'Ds\Vector::unshift' => ['void', '...values='=>'mixed'], 'each' => ['array', '&rw_arr'=>'array'], 'easter_date' => ['int', 'year='=>'int'], From 57b7dcfc859dd012fc062bf79536b9dd31a04571 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Fri, 8 Aug 2025 14:16:58 +0200 Subject: [PATCH 2/2] Fix --- stubs/ext-ds.stub | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/stubs/ext-ds.stub b/stubs/ext-ds.stub index e05628d968..03acd69af5 100644 --- a/stubs/ext-ds.stub +++ b/stubs/ext-ds.stub @@ -81,6 +81,14 @@ final class Deque implements Sequence { } + /** + * @param (callable(TValue, TValue): int)|null $comparator + * @return Deque + */ + public function sorted(?callable $comparator = null): Deque + { + } + /** * @return Deque */