1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Add method that reflection doesn’t know exists

This commit is contained in:
Brown 2019-01-28 17:09:23 -05:00
parent 3e4c63eb9a
commit 819489e68d
2 changed files with 23 additions and 0 deletions

View File

@ -750,6 +750,8 @@ class DOMNodeList implements Traversable, Countable {
*/ */
class SplDoublyLinkedList implements Iterator, Countable, ArrayAccess, Serializable class SplDoublyLinkedList implements Iterator, Countable, ArrayAccess, Serializable
{ {
public function __construct() {}
/** /**
* Add/insert a new value at the specified index * Add/insert a new value at the specified index
* @param TKey $index The index where the new value is to be inserted. * @param TKey $index The index where the new value is to be inserted.

View File

@ -1479,6 +1479,20 @@ class TemplateTest extends TestCase
return a($type); return a($type);
}', }',
], ],
'doublyLinkedListConstructor' => [
'<?php
$list = new SplDoublyLinkedList();
$list->add(5, "hello");
$list->add("hello", 5);
/** @var SplDoublyLinkedList<int, string> */
$templated_list = new SplDoublyLinkedList();
$templated_list->add(5, "hello");
$a = $templated_list->bottom();',
[
'$a' => 'string',
]
],
]; ];
} }
@ -1931,6 +1945,13 @@ class TemplateTest extends TestCase
function violate($p) {}', function violate($p) {}',
'error_message' => 'InvalidTemplateParam', 'error_message' => 'InvalidTemplateParam',
], ],
'doublyLinkedListBadParam' => [
'<?php
/** @var SplDoublyLinkedList<int, string> */
$templated_list = new SplDoublyLinkedList();
$templated_list->add(5, []);',
'error_message' => 'InvalidArgument',
],
]; ];
} }
} }