mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Merge branch 'master' into merge_4.x
This commit is contained in:
commit
cbd1a27ea7
@ -448,5 +448,5 @@ Psalm has support for a number of builtin classes and interfaces that you can ex
|
||||
- `class ArrayObject<TKey, TValue> implements IteratorAggregate<TKey, TValue>, ArrayAccess<TKey, TValue>`
|
||||
- `class ArrayIterator<TKey of array-key, TValue> implements SeekableIterator<TKey, TValue>, ArrayAccess<TKey, TValue>`
|
||||
- `class DOMNodeList<TNode of DOMNode> implements Traversable<int, TNode>`
|
||||
- `class SplDoublyLinkedList<TKey, TValue> implements Iterator<TKey, TValue>, ArrayAccess<TKey, TValue>`
|
||||
- `class SplQueue<TValue> extends SplDoublyLinkedList<int, TValue>`
|
||||
- `class SplDoublyLinkedList<TValue> implements Iterator<TKey, TValue>, ArrayAccess<TKey, TValue>`
|
||||
- `class SplQueue<TValue> extends SplDoublyLinkedList<TValue>`
|
||||
|
@ -4,10 +4,9 @@
|
||||
* The SplDoublyLinkedList class provides the main functionalities of a doubly linked list.
|
||||
* @link https://php.net/manual/en/class.spldoublylinkedlist.php
|
||||
*
|
||||
* @template TKey
|
||||
* @template TValue
|
||||
* @template-implements Iterator<TKey, TValue>
|
||||
* @template-implements ArrayAccess<TKey, TValue>
|
||||
* @template-implements Iterator<int, TValue>
|
||||
* @template-implements ArrayAccess<int, TValue>
|
||||
*/
|
||||
class SplDoublyLinkedList implements Iterator, Countable, ArrayAccess, Serializable
|
||||
{
|
||||
@ -16,7 +15,7 @@ class SplDoublyLinkedList implements Iterator, Countable, ArrayAccess, Serializa
|
||||
/**
|
||||
* Add/insert a new value at the specified index
|
||||
*
|
||||
* @param TKey $index The index where the new value is to be inserted.
|
||||
* @param int $index The index where the new value is to be inserted.
|
||||
* @param TValue $newval The new value for the index.
|
||||
* @return void
|
||||
*
|
||||
@ -111,7 +110,7 @@ class SplDoublyLinkedList implements Iterator, Countable, ArrayAccess, Serializa
|
||||
* Returns whether the requested $index exists
|
||||
* @link https://php.net/manual/en/spldoublylinkedlist.offsetexists.php
|
||||
*
|
||||
* @param TKey $index The index being checked.
|
||||
* @param int $index The index being checked.
|
||||
* @return bool true if the requested index exists, otherwise false
|
||||
*
|
||||
* @since 5.3.0
|
||||
@ -122,7 +121,7 @@ class SplDoublyLinkedList implements Iterator, Countable, ArrayAccess, Serializa
|
||||
* Returns the value at the specified $index
|
||||
* @link https://php.net/manual/en/spldoublylinkedlist.offsetget.php
|
||||
*
|
||||
* @param TKey $index The index with the value.
|
||||
* @param int $index The index with the value.
|
||||
* @return TValue The value at the specified index.
|
||||
*
|
||||
* @since 5.3.0
|
||||
@ -133,7 +132,7 @@ class SplDoublyLinkedList implements Iterator, Countable, ArrayAccess, Serializa
|
||||
* Sets the value at the specified $index to $newval
|
||||
* @link https://php.net/manual/en/spldoublylinkedlist.offsetset.php
|
||||
*
|
||||
* @param TKey $index The index being set.
|
||||
* @param int $index The index being set.
|
||||
* @param TValue $newval The new value for the index.
|
||||
* @return void
|
||||
*
|
||||
@ -145,7 +144,7 @@ class SplDoublyLinkedList implements Iterator, Countable, ArrayAccess, Serializa
|
||||
* Unsets the value at the specified $index
|
||||
* @link https://php.net/manual/en/spldoublylinkedlist.offsetunset.php
|
||||
*
|
||||
* @param TKey $index The index being unset.
|
||||
* @param int $index The index being unset.
|
||||
* @return void
|
||||
*
|
||||
* @since 5.3.0
|
||||
@ -166,7 +165,7 @@ class SplDoublyLinkedList implements Iterator, Countable, ArrayAccess, Serializa
|
||||
* Return current node index
|
||||
* @link https://php.net/manual/en/spldoublylinkedlist.key.php
|
||||
*
|
||||
* @return TKey The current node index.
|
||||
* @return int The current node index.
|
||||
*
|
||||
* @since 5.3.0
|
||||
*/
|
||||
@ -346,7 +345,7 @@ class SplFixedArray implements Iterator, ArrayAccess, Countable {
|
||||
* @link https://php.net/manual/en/class.splstack.php
|
||||
*
|
||||
* @template TValue
|
||||
* @template-extends SplDoublyLinkedList<int, TValue>
|
||||
* @template-extends SplDoublyLinkedList<TValue>
|
||||
*/
|
||||
class SplStack extends SplDoublyLinkedList {
|
||||
}
|
||||
@ -356,7 +355,7 @@ class SplStack extends SplDoublyLinkedList {
|
||||
* @link https://php.net/manual/en/class.splqueue.php
|
||||
*
|
||||
* @template TValue
|
||||
* @template-extends SplDoublyLinkedList<int, TValue>
|
||||
* @template-extends SplDoublyLinkedList<TValue>
|
||||
*/
|
||||
class SplQueue extends SplDoublyLinkedList {
|
||||
/**
|
||||
|
@ -1039,9 +1039,9 @@ class ClassTemplateTest extends TestCase
|
||||
'code' => '<?php
|
||||
$list = new SplDoublyLinkedList();
|
||||
$list->add(5, "hello");
|
||||
$list->add("hello", 5);
|
||||
$list->add(5, 1);
|
||||
|
||||
/** @var SplDoublyLinkedList<int, string> */
|
||||
/** @var SplDoublyLinkedList<string> */
|
||||
$templated_list = new SplDoublyLinkedList();
|
||||
$templated_list->add(5, "hello");
|
||||
$a = $templated_list->bottom();',
|
||||
@ -4085,7 +4085,7 @@ class ClassTemplateTest extends TestCase
|
||||
],
|
||||
'doublyLinkedListBadParam' => [
|
||||
'code' => '<?php
|
||||
/** @var SplDoublyLinkedList<int, string> */
|
||||
/** @var SplDoublyLinkedList<string> */
|
||||
$templated_list = new SplDoublyLinkedList();
|
||||
$templated_list->add(5, []);',
|
||||
'error_message' => 'InvalidArgument',
|
||||
|
Loading…
Reference in New Issue
Block a user