1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00
psalm/src/Psalm/Internal/Stubs/ext-ds.php

872 lines
15 KiB
PHP
Raw Normal View History

2019-10-18 17:35:24 +02:00
<?php
namespace Ds;
use Countable;
use JsonSerializable;
use OutOfBoundsException;
use OutOfRangeException;
use Traversable;
use UnderflowException;
/**
* @template-covariant TKey
* @template-covariant TValue
* @extends Traversable<TKey, TValue>
2019-10-18 17:35:24 +02:00
*/
interface Collection extends Traversable, Countable, JsonSerializable
{
/**
* @return Collection<TKey, TValue>
2019-10-18 17:35:24 +02:00
*/
public function copy(): Collection;
/**
* @return array<TKey, TValue>
2019-10-18 17:35:24 +02:00
*/
public function toArray(): array;
}
/**
* @template TValue
* @implements Sequence<TValue>
2019-10-18 17:35:24 +02:00
*/
final class Deque implements Sequence
2019-10-18 17:35:24 +02:00
{
/**
2020-04-15 13:31:17 +02:00
* @param iterable<TValue> $values
2019-10-18 17:35:24 +02:00
*/
2020-04-15 13:31:17 +02:00
public function __construct(iterable $values = [])
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Deque<TValue>
2019-10-18 17:35:24 +02:00
*/
public function copy(): Deque
2019-10-18 17:35:24 +02:00
{
}
/**
* @template TValue2
* @param iterable<TValue2> $values
* @return Deque<TValue|TValue2>
2019-10-18 17:35:24 +02:00
*/
public function merge(iterable $values): Deque
2019-10-18 17:35:24 +02:00
{
}
/**
* @param (callable(TValue): bool)|null $callback
* @return Deque<TValue>
2019-10-18 17:35:24 +02:00
*/
public function filter(callable $callback = null): Deque
2019-10-18 17:35:24 +02:00
{
}
/**
* @template TNewValue
* @param callable(TValue): TNewValue $callback
* @return Deque<TNewValue>
2019-10-18 17:35:24 +02:00
*/
public function map(callable $callback): Deque
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Deque<TValue>
2019-10-18 17:35:24 +02:00
*/
public function reversed(): Deque
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Deque<TValue>
2019-10-18 17:35:24 +02:00
*/
public function slice(int $offset, ?int $length = null): Deque
2019-10-18 17:35:24 +02:00
{
}
}
2019-10-18 17:35:24 +02:00
/**
* @template TKey
* @template TValue
* @implements Collection<TKey, TValue>
*/
final class Map implements Collection
{
2019-10-18 17:35:24 +02:00
/**
2020-04-15 13:31:17 +02:00
* @param iterable<TKey, TValue> $values
2019-10-18 17:35:24 +02:00
*/
2020-04-15 13:31:17 +02:00
public function __construct(iterable $values = [])
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Map<TKey, TValue>
2019-10-18 17:35:24 +02:00
*/
public function copy(): Map
2019-10-18 17:35:24 +02:00
{
}
/**
* @param callable(TKey, TValue): TValue $callback
2019-10-18 17:35:24 +02:00
*/
public function apply(callable $callback)
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Pair<TKey, TValue>
* @throws UnderflowException
2019-10-18 17:35:24 +02:00
*/
public function first(): Pair
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Pair<TKey, TValue>
* @throws UnderflowException
2019-10-18 17:35:24 +02:00
*/
public function last(): Pair
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Pair<TKey, TValue>
* @throws OutOfRangeException
2019-10-18 17:35:24 +02:00
*/
public function skip(int $position): Pair
2019-10-18 17:35:24 +02:00
{
}
/**
* @template TKey2
* @template TValue2
* @param iterable<TKey2, TValue2> $values
* @return Map<TKey|TKey2, TValue|TValue2>
2019-10-18 17:35:24 +02:00
*/
public function merge(iterable $values): Map
2019-10-18 17:35:24 +02:00
{
}
/**
* @template TKey2
* @template TValue2
* @param Map<TKey2, TValue2> $map
* @return Map<TKey&TKey2, TValue>
2019-10-18 17:35:24 +02:00
*/
public function intersect(Map $map): Map
2019-10-18 17:35:24 +02:00
{
}
/**
* @template TValue2
* @param Map<TKey, TValue2> $map
* @return Map<TKey, TValue>
2019-10-18 17:35:24 +02:00
*/
public function diff(Map $map): Map
2019-10-18 17:35:24 +02:00
{
}
/**
* @param TKey $key
2019-10-18 17:35:24 +02:00
*/
public function hasKey($key): bool
2019-10-18 17:35:24 +02:00
{
}
/**
* @param TValue $value
2019-10-18 17:35:24 +02:00
*/
public function hasValue($value): bool
2019-10-18 17:35:24 +02:00
{
}
/**
* @param (callable(TKey, TValue): bool)|null $callback
* @return Map<TKey, TValue>
2019-10-18 17:35:24 +02:00
*/
public function filter(callable $callback = null): Map
2019-10-18 17:35:24 +02:00
{
}
/**
* @template TDefault
* @param TKey $key
* @param TDefault $default
* @return TValue|TDefault
* @throws OutOfBoundsException
2019-10-18 17:35:24 +02:00
*/
public function get($key, $default = null)
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Set<TKey>
2019-10-18 17:35:24 +02:00
*/
public function keys(): Set
2019-10-18 17:35:24 +02:00
{
}
/**
* @template TNewValue
* @param callable(TKey, TValue): TNewValue $callback
* @return Map<TKey, TNewValue>
2019-10-18 17:35:24 +02:00
*/
public function map(callable $callback): Map
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Sequence<Pair<TKey, TValue>>
2019-10-18 17:35:24 +02:00
*/
public function pairs(): Sequence
2019-10-18 17:35:24 +02:00
{
}
/**
* @param TKey $key
* @param TValue $value
2019-10-18 17:35:24 +02:00
*/
public function put($key, $value)
2019-10-18 17:35:24 +02:00
{
}
/**
* @param iterable<TKey, TValue> $values
2019-10-18 17:35:24 +02:00
*/
public function putAll(iterable $values)
2019-10-18 17:35:24 +02:00
{
}
/**
* @template TCarry
* @param callable(TCarry, TKey, TValue): TCarry $callback
* @param TCarry $initial
* @return TCarry
2019-10-18 17:35:24 +02:00
*/
public function reduce(callable $callback, $initial = null)
2019-10-18 17:35:24 +02:00
{
}
/**
* @template TDefault
* @param TKey $key
* @param TDefault $default
* @return TValue|TDefault
* @throws \OutOfBoundsException
2019-10-18 17:35:24 +02:00
*/
public function remove($key, $default = null)
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Map<TKey, TValue>
2019-10-18 17:35:24 +02:00
*/
public function reversed(): Map
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Map<TKey, TValue>
2019-10-18 17:35:24 +02:00
*/
public function slice(int $offset, ?int $length = null): Map
2019-10-18 17:35:24 +02:00
{
}
/**
* @param (callable(TValue, TValue): int)|null $comparator
2019-10-18 17:35:24 +02:00
*/
public function sort(callable $comparator = null)
{
}
/**
* @param (callable(TValue, TValue): int)|null $comparator
* @return Map<TKey, TValue>
2019-10-18 17:35:24 +02:00
*/
public function sorted(callable $comparator = null): Map
2019-10-18 17:35:24 +02:00
{
}
/**
* @param (callable(TKey, TKey): int)|null $comparator
2019-10-18 17:35:24 +02:00
*/
public function ksort(callable $comparator = null)
2019-10-18 17:35:24 +02:00
{
}
/**
* @param (callable(TKey, TKey): int)|null $comparator
* @return Map<TKey, TValue>
2019-10-18 17:35:24 +02:00
*/
public function ksorted(callable $comparator = null): Map
2019-10-18 17:35:24 +02:00
{
}
/**
* @return array<TKey, TValue>
2019-10-18 17:35:24 +02:00
*/
public function toArray(): array
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Sequence<TValue>
2019-10-18 17:35:24 +02:00
*/
public function values(): Sequence
2019-10-18 17:35:24 +02:00
{
}
/**
* @template TKey2
* @template TValue2
* @param Map<TKey2, TValue2> $map
* @return Map<TKey|TKey2, TValue|TValue2>
2019-10-18 17:35:24 +02:00
*/
public function union(Map $map): Map
2019-10-18 17:35:24 +02:00
{
}
/**
* @template TKey2
* @template TValue2
* @param Map<TKey2, TValue2> $map
* @return Map<TKey|TKey2, TValue|TValue2>
2019-10-18 17:35:24 +02:00
*/
public function xor(Map $map): Map
2019-10-18 17:35:24 +02:00
{
}
}
2019-10-18 17:35:24 +02:00
/**
* @template-covariant TKey
* @template-covariant TValue
*/
final class Pair implements JsonSerializable
{
2019-10-18 17:35:24 +02:00
/**
* @var TKey
2019-10-18 17:35:24 +02:00
*/
public $key;
2019-10-18 17:35:24 +02:00
/**
* @var TValue
2019-10-18 17:35:24 +02:00
*/
public $value;
2019-10-18 17:35:24 +02:00
/**
* @param TKey $key
* @param TValue $value
2019-10-18 17:35:24 +02:00
*/
public function __construct($key = null, $value = null)
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Pair<TKey, TValue>
2019-10-18 17:35:24 +02:00
*/
public function copy(): Pair
2019-10-18 17:35:24 +02:00
{
}
}
2019-10-18 17:35:24 +02:00
/**
* @template TValue
* @extends Collection<int, TValue>
*/
interface Sequence extends Collection
{
2019-10-18 17:35:24 +02:00
/**
* @param callable(TValue): TValue $callback
2019-10-18 17:35:24 +02:00
*/
public function apply(callable $callback);
2019-10-18 17:35:24 +02:00
/**
* @param TValue ...$values
2019-10-18 17:35:24 +02:00
*/
public function contains(...$values): bool;
2019-10-18 17:35:24 +02:00
/**
* @param (callable(TValue): bool)|null $callback
* @return Sequence<TValue>
2019-10-18 17:35:24 +02:00
*/
public function filter(callable $callback = null): Sequence;
2019-10-18 17:35:24 +02:00
/**
* @param TValue $value
* @return int|false
2019-10-18 17:35:24 +02:00
*/
public function find($value);
2019-10-18 17:35:24 +02:00
/**
* @return TValue
* @throws \UnderflowException
2019-10-18 17:35:24 +02:00
*/
public function first();
2019-10-18 17:35:24 +02:00
/**
* @return TValue
* @throws \OutOfRangeException
2019-10-18 17:35:24 +02:00
*/
public function get(int $index);
2019-10-18 17:35:24 +02:00
/**
* @param TValue ...$values
* @throws \OutOfRangeException
2019-10-18 17:35:24 +02:00
*/
public function insert(int $index, ...$values);
/**
* @param string $glue
* @return string
*/
public function join(string $glue = null): string;
/**
* @return TValue
* @throws \UnderflowException
*/
public function last();
/**
* @template TNewValue
* @param callable(TValue): TNewValue $callback
* @return Sequence<TNewValue>
*/
public function map(callable $callback): Sequence;
/**
* @template TValue2
* @param iterable<TValue2> $values
* @return Sequence<TValue|TValue2>
*/
public function merge(iterable $values): Sequence;
/**
* @return TValue
* @throws \UnderflowException
*/
public function pop();
/**
* @param TValue ...$values
*/
public function push(...$values);
/**
* @template TCarry
* @param callable(TCarry, TValue): TCarry $callback
* @param TCarry $initial
* @return TCarry
*/
public function reduce(callable $callback, $initial = null);
/**
* @return TValue
* @throws \OutOfRangeException
*/
public function remove(int $index);
/**
* @return Sequence<TValue>
*/
public function reversed(): Sequence;
/**
* @param TValue $value
* @throws \OutOfRangeException
*/
public function set(int $index, $value);
/**
* @return TValue
* @throws \UnderflowException
*/
public function shift();
/**
* @return Sequence<TValue>
*/
public function slice(int $index, ?int $length = null): Sequence;
/**
* @param (callable(TValue, TValue): int)|null $comparator
*/
public function sort(callable $comparator = null);
2019-10-18 17:35:24 +02:00
/**
* @param (callable(TValue, TValue): int)|null $comparator
* @return Sequence<TValue>
2019-10-18 17:35:24 +02:00
*/
public function sorted(callable $comparator = null): Sequence;
2019-10-18 17:35:24 +02:00
/**
* @param TValue ...$values
2019-10-18 17:35:24 +02:00
*/
public function unshift(...$values);
2019-10-18 17:35:24 +02:00
}
2019-10-18 17:35:24 +02:00
/**
* @template TValue
* @implements Sequence<TValue>
2019-10-18 17:35:24 +02:00
*/
final class Vector implements Sequence
2019-10-18 17:35:24 +02:00
{
/**
2020-04-17 21:07:16 +02:00
* @param iterable<TValue> $values
2019-10-18 17:35:24 +02:00
*/
2020-04-17 21:07:16 +02:00
public function __construct(iterable $values = [])
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Vector<TValue>
2019-10-18 17:35:24 +02:00
*/
public function copy(): Vector
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Vector<TValue>
2019-10-18 17:35:24 +02:00
*/
public function reversed(): Vector
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Vector<TValue>
2019-10-18 17:35:24 +02:00
*/
public function slice(int $offset, ?int $length = null): Vector
2019-10-18 17:35:24 +02:00
{
}
/**
* @param (callable(TValue, TValue): int)|null $comparator
* @return Vector<TValue>
2019-10-18 17:35:24 +02:00
*/
public function sorted(callable $comparator = null): Vector
2019-10-18 17:35:24 +02:00
{
}
/**
* @param (callable(TValue): bool)|null $callback
* @return Vector<TValue>
2019-10-18 17:35:24 +02:00
*/
public function filter(callable $callback = null): Vector
2019-10-18 17:35:24 +02:00
{
}
2020-02-11 03:09:07 +01:00
/**
* @template TNewValue
* @param callable(TValue): TNewValue $callback
* @return Vector<TNewValue>
*/
public function map(callable $callback): Vector
{
}
}
2019-10-18 17:35:24 +02:00
/**
* @template TValue
* @implements Collection<int, TValue>
*/
final class Set implements Collection
{
2019-10-18 17:35:24 +02:00
/**
2020-04-17 21:07:16 +02:00
* @param iterable<TValue> $values
2019-10-18 17:35:24 +02:00
*/
2020-04-17 21:07:16 +02:00
public function __construct(iterable $values = [])
2019-10-18 17:35:24 +02:00
{
}
/**
* @param TValue ...$values
2019-10-18 17:35:24 +02:00
*/
public function add(...$values): void
2019-10-18 17:35:24 +02:00
{
}
/**
* @param TValue ...$values
2019-10-18 17:35:24 +02:00
*/
public function contains(...$values): bool
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Set<TValue>
2019-10-18 17:35:24 +02:00
*/
public function copy(): Set
2019-10-18 17:35:24 +02:00
{
}
/**
* @template TValue2
* @param Set<TValue2> $set
* @return Set<TValue>
2019-10-18 17:35:24 +02:00
*/
public function diff(Set $set): Set
2019-10-18 17:35:24 +02:00
{
}
/**
* @param (callable(TValue): bool)|null $callback
* @return Set<TValue>
2019-10-18 17:35:24 +02:00
*/
public function filter(callable $callback = null): Set
2019-10-18 17:35:24 +02:00
{
}
/**
* @return TValue
* @throws \UnderflowException
2019-10-18 17:35:24 +02:00
*/
public function first()
2019-10-18 17:35:24 +02:00
{
}
/**
* @return TValue
* @throws \OutOfRangeException
2019-10-18 17:35:24 +02:00
*/
public function get(int $index)
2019-10-18 17:35:24 +02:00
{
}
/**
* @template TValue2
* @param Set<TValue2> $set
* @return Set<TValue&TValue2>
2019-10-18 17:35:24 +02:00
*/
public function intersect(Set $set): Set
2019-10-18 17:35:24 +02:00
{
}
/**
* @return TValue
* @throws \UnderflowException
2019-10-18 17:35:24 +02:00
*/
public function last()
2019-10-18 17:35:24 +02:00
{
}
/**
* @template TValue2
* @param iterable<TValue2> $values
* @return Set<TValue|TValue2>
2019-10-18 17:35:24 +02:00
*/
public function merge(iterable $values): Set
2019-10-18 17:35:24 +02:00
{
}
/**
* @param TValue ...$values
2019-10-18 17:35:24 +02:00
*/
public function remove(...$values): void
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Set<TValue>
2019-10-18 17:35:24 +02:00
*/
public function reversed(): Set
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Set<TValue>
2019-10-18 17:35:24 +02:00
*/
public function slice(int $index, ?int $length = null): Set
2019-10-18 17:35:24 +02:00
{
}
/**
* @param (callable(TValue, TValue): int)|null $comparator
2019-10-18 17:35:24 +02:00
*/
public function sort(callable $comparator = null): void
2019-10-18 17:35:24 +02:00
{
}
/**
* @param (callable(TValue, TValue): int)|null $comparator
* @return Set<TValue>
2019-10-18 17:35:24 +02:00
*/
public function sorted(callable $comparator = null): Set
2019-10-18 17:35:24 +02:00
{
}
/**
* @return array<TValue>
2019-10-18 17:35:24 +02:00
*/
public function toArray(): array
2019-10-18 17:35:24 +02:00
{
}
/**
* @template TValue2
* @param Set<TValue2> $set
* @return Set<TValue|TValue2>
2019-10-18 17:35:24 +02:00
*/
public function union(Set $set): Set
2019-10-18 17:35:24 +02:00
{
}
/**
* @template TValue2
* @param Set<TValue2> $set
* @return Set<TValue|TValue2>
2019-10-18 17:35:24 +02:00
*/
public function xor(Set $set): Set
2019-10-18 17:35:24 +02:00
{
}
}
2019-10-18 17:35:24 +02:00
/**
* @template TValue
* @implements Collection<int, TValue>
*/
final class Stack implements Collection
{
2019-10-18 17:35:24 +02:00
/**
2020-04-15 13:31:17 +02:00
* @param iterable<TValue> $values
2019-10-18 17:35:24 +02:00
*/
2020-04-15 13:31:17 +02:00
public function __construct(iterable $values = [])
2019-10-18 17:35:24 +02:00
{
}
/**
* @return Stack<TValue>
2019-10-18 17:35:24 +02:00
*/
public function copy(): Stack
2019-10-18 17:35:24 +02:00
{
}
/**
* @return TValue
* @throws UnderflowException
2019-10-18 17:35:24 +02:00
*/
public function peek()
2019-10-18 17:35:24 +02:00
{
}
/**
* @return TValue
* @throws UnderflowException
2019-10-18 17:35:24 +02:00
*/
public function pop()
{
}
/**
* @param TValue ...$values
2019-10-18 17:35:24 +02:00
*/
public function push(...$values): void
2019-10-18 17:35:24 +02:00
{
}
/**
* @return array<TValue>
2019-10-18 17:35:24 +02:00
*/
public function toArray(): array
2019-10-18 17:35:24 +02:00
{
}
}
/**
* @template TValue
* @implements Collection<int, TValue>
*/
final class Queue implements Collection
{
/**
2020-04-15 13:31:17 +02:00
* @param iterable<TValue> $values
*/
2020-04-15 13:31:17 +02:00
public function __construct(iterable $values = [])
{
}
/**
* @return Queue<TValue>
*/
public function copy(): Queue
{
}
/**
* @return TValue
* @throws UnderflowException
*/
public function peek()
{
}
/**
* @return TValue
* @throws UnderflowException
*/
public function pop()
{
}
/**
* @param TValue ...$values
*/
public function push(...$values): void
{
}
/**
* @return array<TValue>
*/
public function toArray(): array
{
}
}
/**
* @template TValue
* @implements Collection<int, TValue>
*/
final class PriorityQueue implements Collection
{
/**
* @return PriorityQueue<TValue>
*/
public function copy(): PriorityQueue
{
}
/**
* @return TValue
* @throws UnderflowException
*/
public function peek()
{
}
/**
* @return TValue
* @throws UnderflowException
*/
public function pop()
{
}
/**
* @param TValue $value
*/
public function push($value, int $priority): void
{
}
/**
* @return array<TValue>
*/
public function toArray(): array
{
}
}