Jeroen De Dauw has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/85529


Change subject: Adding dataTypeId field to PropertyValueSnak [DNM]
......................................................................

Adding dataTypeId field to PropertyValueSnak [DNM]

Change-Id: I7e5b81f0482ecf8872c11f6e2b74cf62e178e1e3
---
M DataModel/Snak/PropertyValueSnak.php
1 file changed, 26 insertions(+), 4 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseDataModel 
refs/changes/29/85529/1

diff --git a/DataModel/Snak/PropertyValueSnak.php 
b/DataModel/Snak/PropertyValueSnak.php
index 8399a23..cc33c9b 100644
--- a/DataModel/Snak/PropertyValueSnak.php
+++ b/DataModel/Snak/PropertyValueSnak.php
@@ -4,6 +4,7 @@
 
 use DataValues\UnDeserializableValue;
 use DataValues\DataValue;
+use InvalidArgumentException;
 use Wikibase\DataModel\Entity\PropertyId;
 
 /**
@@ -23,23 +24,35 @@
 
        /**
         * @since 0.1
-        *
         * @var DataValue
         */
        protected $dataValue;
 
        /**
+        * @since 0.5
+        * @var string|null
+        */
+       protected $dataTypeId;
+
+       /**
         * Support for passing in an EntityId instance that is not a PropertyId 
instance has
         * been deprecated since 0.5.
         *
-        * @since 0.1
-        *
         * @param PropertyId|EntityId|integer $propertyId
         * @param DataValue $dataValue
+        * @param string $dataTypeId Since 0.5. Not providing this has been 
deprecated since introduction.
+        *
+        * @throws InvalidArgumentException
         */
-       public function __construct( $propertyId, DataValue $dataValue ) {
+       public function __construct( $propertyId, DataValue $dataValue, 
$dataTypeId = null ) {
                parent::__construct( $propertyId );
+
+               if ( $dataTypeId !== null && !is_string( $dataTypeId ) ) {
+                       throw new InvalidArgumentException( '$dataTypeId should 
be a string' );
+               }
+
                $this->dataValue = $dataValue;
+               $this->dataTypeId = $dataTypeId;
        }
 
        /**
@@ -54,6 +67,15 @@
        }
 
        /**
+        * @since 0.5
+        *
+        * @return string|null
+        */
+       public function getDataTypeId() {
+               return $this->dataTypeId;
+       }
+
+       /**
         * @see Serializable::serialize
         *
         * @since 0.1

-- 
To view, visit https://gerrit.wikimedia.org/r/85529
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e5b81f0482ecf8872c11f6e2b74cf62e178e1e3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseDataModel
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to