Skip to content

Commit f5279b1

Browse files
committed
Merge pull request #594 from wmde/nullTypes
Add missing null type documentations
2 parents 1b66fc8 + f49b845 commit f5279b1

4 files changed

Lines changed: 15 additions & 7 deletions

File tree

src/ByPropertyIdArray.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class ByPropertyIdArray extends ArrayObject {
5151
/**
5252
* @see ArrayObject::__construct
5353
*
54-
* @param array|object $input
54+
* @param array|object|null $input
5555
*/
5656
public function __construct( $input = null ) {
5757
parent::__construct( (array)$input );
@@ -121,7 +121,7 @@ public function getByPropertyId( PropertyId $propertyId ) {
121121
$this->assertIndexIsBuild();
122122

123123
if ( !( array_key_exists( $propertyId->getSerialization(), $this->byId ) ) ) {
124-
throw new OutOfBoundsException( 'Object with propertyId "' . $propertyId->getSerialization() . '" not found' );
124+
throw new OutOfBoundsException( "Object with propertyId \"$propertyId\" not found" );
125125
}
126126

127127
return $this->byId[$propertyId->getSerialization()];
@@ -407,7 +407,7 @@ public function moveObjectToIndex( $object, $toIndex ) {
407407
* @since 0.5
408408
*
409409
* @param object $object
410-
* @param int $index Absolute index where to place the new object.
410+
* @param int|null $index Absolute index where to place the new object.
411411
*
412412
* @throws RuntimeException
413413
*/
@@ -441,7 +441,7 @@ public function addObjectAtIndex( $object, $index = null ) {
441441
* Adds an object to an existing property group at the specified absolute index.
442442
*
443443
* @param object $object
444-
* @param int $index
444+
* @param int|null $index
445445
*
446446
* @throws OutOfBoundsException
447447
*/

src/HashableObjectStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class HashableObjectStorage extends SplObjectStorage implements Comparable {
2525
/**
2626
* @since 0.2
2727
*
28-
* @param array $objects
28+
* @param Hashable[]|null $objects
2929
*/
3030
public function __construct( array $objects = null ) {
3131
if ( $objects !== null ) {

src/Term/AliasGroupFallback.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ class AliasGroupFallback extends AliasGroup {
3636
*
3737
* @throws InvalidArgumentException
3838
*/
39-
public function __construct( $requestedLanguageCode, array $aliases, $actualLanguageCode, $sourceLanguageCode ) {
39+
public function __construct(
40+
$requestedLanguageCode,
41+
array $aliases,
42+
$actualLanguageCode,
43+
$sourceLanguageCode
44+
) {
4045
parent::__construct( $requestedLanguageCode, $aliases );
4146

4247
if ( !is_string( $actualLanguageCode ) || $actualLanguageCode === '' ) {

tests/unit/Snak/PropertyValueSnakTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ public function validConstructorArgumentsProvider() {
4949
* @dataProvider invalidConstructorArgumentsProvider
5050
* @expectedException InvalidArgumentException
5151
*/
52-
public function testGivenInvalidConstructorArguments_constructorThrowsException( $propertyId, DataValue $dataValue ) {
52+
public function testGivenInvalidConstructorArguments_constructorThrowsException(
53+
$propertyId,
54+
DataValue $dataValue
55+
) {
5356
new PropertyValueSnak( $propertyId, $dataValue );
5457
}
5558

0 commit comments

Comments
 (0)