Thiemo Mättig (WMDE) has uploaded a new change for review.

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

Change subject: [DNM] Disallow EntityRevision to represent current revision
......................................................................

[DNM] Disallow EntityRevision to represent current revision

As discussed in Ic45c727. As long as this class explicitely allows
the revision id to be 0, the discussion does not make any sense.
First step: Let's see if a test fails.
Next step: Try with your local installation.

Bug: T90893
Change-Id: I50b3f634a9db9366f482cfa4331c8eff0ee77791
---
M lib/includes/store/EntityRevision.php
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/45/203045/1

diff --git a/lib/includes/store/EntityRevision.php 
b/lib/includes/store/EntityRevision.php
index abc2d0d..da38d9d 100644
--- a/lib/includes/store/EntityRevision.php
+++ b/lib/includes/store/EntityRevision.php
@@ -6,7 +6,7 @@
 use Wikibase\DataModel\Entity\Entity;
 
 /**
- * Represents a revision of a Wikibase entity.
+ * Represents a specific revision of a Wikibase entity.
  *
  * @since 0.4
  *
@@ -32,18 +32,18 @@
 
        /**
         * @param Entity $entity
-        * @param int $revisionId Revision ID or 0 for none
+        * @param int $revisionId Non-zero revision number.
         * @param string $mwTimestamp in MediaWiki format or an empty string 
for none
         *
         * @throws InvalidArgumentException
         */
-       public function __construct( Entity $entity, $revisionId = 0, 
$mwTimestamp = '' ) {
-               if ( !is_int( $revisionId ) || $revisionId < 0 ) {
-                       throw new InvalidArgumentException( 'Revision ID must 
be a non-negative integer.' );
+       public function __construct( Entity $entity, $revisionId, $mwTimestamp 
= '' ) {
+               if ( !is_int( $revisionId ) || $revisionId <= 0 ) {
+                       throw new InvalidArgumentException( '$revisionId must 
be a positive integer.' );
                }
 
                if ( $mwTimestamp !== '' && !preg_match( '/^\d{14}$/', 
$mwTimestamp ) ) {
-                       throw new InvalidArgumentException( 'Timestamp must be 
a string of 14 digits or empty.' );
+                       throw new InvalidArgumentException( '$mwTimestamp must 
be a string of 14 digits or empty.' );
                }
 
                $this->entity = $entity;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I50b3f634a9db9366f482cfa4331c8eff0ee77791
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>

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

Reply via email to