Skip to content

Commit da91726

Browse files
committed
Optimize QueryResult and QueryResultInterface stubs
* Add null as possible return type for QueryResult::getFirst() * Add annotations for \ArrayAccess and \Iterator
1 parent 582a3b0 commit da91726

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

stubs/QueryResult.stub

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
<?php
22
namespace TYPO3\CMS\Extbase\Persistence\Generic;
33

4+
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
5+
46
/**
57
* @template ModelType
8+
* @implements QueryResultInterface<ModelType>
69
*/
7-
class QueryResult
10+
class QueryResult implements QueryResultInterface
811
{
912
/**
10-
* @return ModelType
13+
* @return null|ModelType
1114
*/
1215
public function getFirst();
1316
}

stubs/QueryResultInterface.stub

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@ namespace TYPO3\CMS\Extbase\Persistence;
33

44
/**
55
* @template ModelType
6+
* @extends \ArrayAccess<string, ModelType>
7+
* @extends \Iterator<string, ModelType>
68
*/
7-
interface QueryResultInterface
9+
interface QueryResultInterface extends \Countable, \Iterator, \ArrayAccess
810
{
911
/**
10-
* @return ModelType
12+
* @return null|ModelType
1113
*/
1214
public function getFirst();
15+
16+
/**
17+
* @return ModelType[]
18+
*/
19+
public function toArray();
1320
}

0 commit comments

Comments
 (0)