Skip to content

Commit 9f29578

Browse files
committed
Avoid full qualified class names
1 parent 5e6fc0f commit 9f29578

16 files changed

Lines changed: 45 additions & 29 deletions

src/ByPropertyIdArray.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Wikibase\DataModel;
44

5+
use ArrayObject;
56
use OutOfBoundsException;
67
use RuntimeException;
78
use Wikibase\DataModel\Entity\PropertyId;
@@ -40,15 +41,15 @@
4041
* @licence GNU GPL v2+
4142
* @author H. Snater < mediawiki@snater.com >
4243
*/
43-
class ByPropertyIdArray extends \ArrayObject {
44+
class ByPropertyIdArray extends ArrayObject {
4445

4546
/**
4647
* @var array[]|null
4748
*/
4849
private $byId = null;
4950

5051
/**
51-
* @see \ArrayObject::__construct
52+
* @see ArrayObject::__construct
5253
*
5354
* @param array|object $input
5455
*/

src/Entity/Entity.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Wikibase\DataModel\Entity;
44

5+
use Comparable;
56
use Wikibase\DataModel\Statement\Statement;
67
use Wikibase\DataModel\Term\AliasGroup;
78
use Wikibase\DataModel\Term\AliasGroupList;
@@ -18,7 +19,7 @@
1819
* @licence GNU GPL v2+
1920
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
2021
*/
21-
abstract class Entity implements \Comparable, FingerprintHolder, EntityDocument {
22+
abstract class Entity implements Comparable, FingerprintHolder, EntityDocument {
2223

2324
/**
2425
* Sets the value for the label in a certain value.

src/Entity/EntityId.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace Wikibase\DataModel\Entity;
44

5+
use Comparable;
6+
use Serializable;
7+
58
/**
69
* @since 0.5
710
* Constructor non-public since 1.0
@@ -10,7 +13,7 @@
1013
* @licence GNU GPL v2+
1114
* @author Jeroen De Dauw < jeroendedauw@gmail.com
1215
*/
13-
abstract class EntityId implements \Comparable, \Serializable {
16+
abstract class EntityId implements Comparable, Serializable {
1417

1518
protected $serialization;
1619

src/Entity/EntityIdParsingException.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
namespace Wikibase\DataModel\Entity;
44

5+
use RuntimeException;
6+
57
/**
68
* @since 4.2
79
*
810
* @licence GNU GPL v2+
911
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
1012
*/
11-
class EntityIdParsingException extends \RuntimeException {
13+
class EntityIdParsingException extends RuntimeException {
1214

1315
}

src/Entity/EntityIdValue.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ public static function newFromArray( $data ) {
155155
$data['entity-type'],
156156
$data['numeric-id']
157157
);
158-
}
159-
catch ( \InvalidArgumentException $ex ) {
158+
} catch ( InvalidArgumentException $ex ) {
160159
throw new IllegalValueException( $ex->getMessage(), 0, $ex );
161160
}
162161

src/Entity/Item.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,11 @@ public function getId() {
8888
public function setId( $id ) {
8989
if ( $id === null || $id instanceof ItemId ) {
9090
$this->id = $id;
91-
}
92-
elseif ( is_integer( $id ) ) {
91+
} elseif ( is_int( $id ) ) {
9392
$this->id = ItemId::newFromNumber( $id );
94-
}
95-
else {
96-
throw new InvalidArgumentException( '$id must be an instance of ItemId, an integer, or null' );
93+
} else {
94+
throw new InvalidArgumentException( '$id must be an instance of ItemId, an integer,'
95+
. ' or null' );
9796
}
9897
}
9998

src/Entity/Property.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,11 @@ public function getId() {
8585
public function setId( $id ) {
8686
if ( $id === null || $id instanceof PropertyId ) {
8787
$this->id = $id;
88-
}
89-
elseif ( is_integer( $id ) ) {
88+
} elseif ( is_int( $id ) ) {
9089
$this->id = PropertyId::newFromNumber( $id );
91-
}
92-
else {
93-
throw new InvalidArgumentException( '$id must be an instance of PropertyId, an integer, or null' );
90+
} else {
91+
throw new InvalidArgumentException( '$id must be an instance of PropertyId, an integer,'
92+
. ' or null' );
9493
}
9594
}
9695

src/HashArray.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Wikibase\DataModel;
44

5+
use ArrayObject;
6+
use Comparable;
57
use Hashable;
68
use InvalidArgumentException;
79
use Traversable;
@@ -31,7 +33,7 @@
3133
* @licence GNU GPL v2+
3234
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
3335
*/
34-
abstract class HashArray extends \ArrayObject implements \Hashable, \Comparable {
36+
abstract class HashArray extends ArrayObject implements Hashable, Comparable {
3537

3638
/**
3739
* Maps element hashes to their offsets.

src/HashableObjectStorage.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace Wikibase\DataModel;
44

5+
use Comparable;
56
use Hashable;
7+
use SplObjectStorage;
68
use Wikibase\DataModel\Internal\MapValueHasher;
79

810
/**
@@ -18,7 +20,7 @@
1820
* @licence GNU GPL v2+
1921
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
2022
*/
21-
class HashableObjectStorage extends \SplObjectStorage implements \Comparable {
23+
class HashableObjectStorage extends SplObjectStorage implements Comparable {
2224

2325
/**
2426
* @since 0.2

src/Reference.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
namespace Wikibase\DataModel;
44

5+
use Comparable;
6+
use Countable;
7+
use Hashable;
8+
use Immutable;
59
use InvalidArgumentException;
610
use Wikibase\DataModel\Snak\Snak;
711
use Wikibase\DataModel\Snak\SnakList;
@@ -15,7 +19,7 @@
1519
* @licence GNU GPL v2+
1620
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
1721
*/
18-
class Reference implements \Hashable, \Comparable, \Immutable, \Countable {
22+
class Reference implements Hashable, Comparable, Immutable, Countable {
1923

2024
/**
2125
* @var SnakList

0 commit comments

Comments
 (0)