Skip to content

Commit ce0a25c

Browse files
committed
Use PropertyIdProvider in ByPropertyIdArray
1 parent 2ab1194 commit ce0a25c

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

src/ByPropertyIdArray.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use ArrayObject;
66
use OutOfBoundsException;
77
use RuntimeException;
8+
use Traversable;
89
use Wikibase\DataModel\Entity\PropertyId;
910

1011
/**
@@ -52,7 +53,7 @@ class ByPropertyIdArray extends ArrayObject {
5253
/**
5354
* @see ArrayObject::__construct
5455
*
55-
* @param array|object|null $input
56+
* @param PropertyIdProvider[]|Traversable|null $input
5657
*/
5758
public function __construct( $input = null ) {
5859
parent::__construct( (array)$input );
@@ -66,6 +67,7 @@ public function __construct( $input = null ) {
6667
public function buildIndex() {
6768
$this->byId = array();
6869

70+
/** @var PropertyIdProvider $object */
6971
foreach ( $this as $object ) {
7072
$propertyId = $object->getPropertyId()->getSerialization();
7173

@@ -116,7 +118,7 @@ function( $serializedPropertyId ) {
116118
*
117119
* @throws OutOfBoundsException
118120
* @throws RuntimeException
119-
* @return object[]
121+
* @return PropertyIdProvider[]
120122
*/
121123
public function getByPropertyId( PropertyId $propertyId ) {
122124
$this->assertIndexIsBuild();
@@ -132,7 +134,7 @@ public function getByPropertyId( PropertyId $propertyId ) {
132134
* Returns the absolute index of an object or false if the object could not be found.
133135
* @since 0.5
134136
*
135-
* @param object $object
137+
* @param PropertyIdProvider $object
136138
*
137139
* @return bool|int
138140
* @throws RuntimeException
@@ -154,7 +156,7 @@ public function getFlatArrayIndexOfObject( $object ) {
154156
* Returns the objects in a flat array (using the indexed form for generating the array).
155157
* @since 0.5
156158
*
157-
* @return object[]
159+
* @return PropertyIdProvider[]
158160
* @throws RuntimeException
159161
*/
160162
public function toFlatArray() {
@@ -196,7 +198,7 @@ private function getFlatArrayIndices( PropertyId $propertyId ) {
196198
/**
197199
* Moves an object within its "property group".
198200
*
199-
* @param object $object
201+
* @param PropertyIdProvider $object
200202
* @param int $toIndex Absolute index within a "property group".
201203
*
202204
* @throws OutOfBoundsException
@@ -235,12 +237,11 @@ private function moveObjectInPropertyGroup( $object, $toIndex ) {
235237
/**
236238
* Moves an object to the end of its "property group".
237239
*
238-
* @param object $object
240+
* @param PropertyIdProvider $object
239241
*/
240242
private function moveObjectToEndOfPropertyGroup( $object ) {
241243
$this->removeObject( $object );
242244

243-
/** @var PropertyId $propertyId */
244245
$propertyId = $object->getPropertyId();
245246
$propertyIdSerialization = $propertyId->getSerialization();
246247

@@ -257,7 +258,7 @@ private function moveObjectToEndOfPropertyGroup( $object ) {
257258
/**
258259
* Removes an object from the array structures.
259260
*
260-
* @param object $object
261+
* @param PropertyIdProvider $object
261262
*/
262263
private function removeObject( $object ) {
263264
$flatArray = $this->toFlatArray();
@@ -269,7 +270,7 @@ private function removeObject( $object ) {
269270
/**
270271
* Inserts an object at a specific index.
271272
*
272-
* @param object $object
273+
* @param PropertyIdProvider $object
273274
* @param int $index Absolute index within the flat list of objects.
274275
*/
275276
private function insertObjectAtIndex( $object, $index ) {
@@ -364,7 +365,7 @@ private function getPropertyGroupIndex( PropertyId $propertyId ) {
364365
* to achieve the designated index for the object to move.
365366
* @since 0.5
366367
*
367-
* @param object $object
368+
* @param PropertyIdProvider $object
368369
* @param int $toIndex Absolute index where to move the object to.
369370
*
370371
* @throws OutOfBoundsException
@@ -407,7 +408,7 @@ public function moveObjectToIndex( $object, $toIndex ) {
407408
*
408409
* @since 0.5
409410
*
410-
* @param object $object
411+
* @param PropertyIdProvider $object
411412
* @param int|null $index Absolute index where to place the new object.
412413
*
413414
* @throws RuntimeException
@@ -441,13 +442,12 @@ public function addObjectAtIndex( $object, $index = null ) {
441442
/**
442443
* Adds an object to an existing property group at the specified absolute index.
443444
*
444-
* @param object $object
445+
* @param PropertyIdProvider $object
445446
* @param int|null $index
446447
*
447448
* @throws OutOfBoundsException
448449
*/
449450
private function addObjectToPropertyGroup( $object, $index = null ) {
450-
/** @var PropertyId $propertyId */
451451
$propertyId = $object->getPropertyId();
452452
$validIndices = $this->getFlatArrayIndices( $propertyId );
453453

0 commit comments

Comments
 (0)