Thiemo Mättig (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/328635 )

Change subject: Deprecate unused EntityContent::isStub
......................................................................

Deprecate unused EntityContent::isStub

I'm deprecating this to have a nice migration path. This is implemented
in MediaInfo and Lexeme. Must be removed first in this components.
But this is not possible because it is abstract. So I'm removing the
"abstract" keyword here.

Bug: T146792
Change-Id: I69a2b6e48f0fec6fa12159168765de5991c7ad54
---
M repo/includes/Content/EntityContent.php
M repo/includes/Content/ItemContent.php
M repo/includes/Content/PropertyContent.php
M repo/tests/phpunit/includes/Content/ItemContentTest.php
M repo/tests/phpunit/includes/Content/PropertyContentTest.php
5 files changed, 4 insertions(+), 62 deletions(-)


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

diff --git a/repo/includes/Content/EntityContent.php 
b/repo/includes/Content/EntityContent.php
index c1b53f3..90b395e 100644
--- a/repo/includes/Content/EntityContent.php
+++ b/repo/includes/Content/EntityContent.php
@@ -638,9 +638,11 @@
        }
 
        /**
-        * @return bool
+        * @deprecated
         */
-       abstract public function isStub();
+       public function isStub() {
+               throw new LogicException( 'Do not use, see T146792' );
+       }
 
        /**
         * @see Content::copy
diff --git a/repo/includes/Content/ItemContent.php 
b/repo/includes/Content/ItemContent.php
index f8f94c1..4a046f3 100644
--- a/repo/includes/Content/ItemContent.php
+++ b/repo/includes/Content/ItemContent.php
@@ -221,17 +221,6 @@
        }
 
        /**
-        * @see EntityContent::isStub
-        *
-        * @return bool True if the item is not empty, but does not contain 
statements.
-        */
-       public function isStub() {
-               return !$this->isRedirect()
-                       && !$this->getItem()->isEmpty()
-                       && $this->getItem()->getStatements()->isEmpty();
-       }
-
-       /**
         * @see EntityContent::getEntityPageProperties
         *
         * Records the number of statements in the 'wb-claims' key
diff --git a/repo/includes/Content/PropertyContent.php 
b/repo/includes/Content/PropertyContent.php
index f8227aa..59e2ea2 100644
--- a/repo/includes/Content/PropertyContent.php
+++ b/repo/includes/Content/PropertyContent.php
@@ -139,15 +139,4 @@
                return !$this->isRedirect() && $this->getProperty()->isEmpty();
        }
 
-       /**
-        * @see EntityContent::isStub
-        *
-        * @return bool True if the property is not empty, but does not contain 
statements.
-        */
-       public function isStub() {
-               return !$this->isRedirect()
-                       && !$this->getProperty()->isEmpty()
-                       && $this->getProperty()->getStatements()->isEmpty();
-       }
-
 }
diff --git a/repo/tests/phpunit/includes/Content/ItemContentTest.php 
b/repo/tests/phpunit/includes/Content/ItemContentTest.php
index c313512..0e2ace4 100644
--- a/repo/tests/phpunit/includes/Content/ItemContentTest.php
+++ b/repo/tests/phpunit/includes/Content/ItemContentTest.php
@@ -372,23 +372,4 @@
                $this->assertFalse( $content->isEmpty() );
        }
 
-       public function testIsStub_stubItem() {
-               $item = new Item();
-               $item->setLabel( 'en', '~=[,,_,,]:3' );
-               $content = ItemContent::newFromItem( $item );
-               $this->assertTrue( $content->isStub() );
-       }
-
-       public function testIsStub_emptyItem() {
-               $content = ItemContent::newFromItem( new Item() );
-               $this->assertFalse( $content->isStub() );
-       }
-
-       public function testIsStub_nonStubItem() {
-               $item = new Item();
-               $item->getStatements()->addNewStatement( new 
PropertyNoValueSnak( 42 ) );
-               $content = ItemContent::newFromItem( $item );
-               $this->assertFalse( $content->isStub() );
-       }
-
 }
diff --git a/repo/tests/phpunit/includes/Content/PropertyContentTest.php 
b/repo/tests/phpunit/includes/Content/PropertyContentTest.php
index 66ab513..5eb4222 100644
--- a/repo/tests/phpunit/includes/Content/PropertyContentTest.php
+++ b/repo/tests/phpunit/includes/Content/PropertyContentTest.php
@@ -65,23 +65,4 @@
                $this->assertFalse( $content->isEmpty() );
        }
 
-       public function testIsStub_stubProperty() {
-               $Property = Property::newFromType( 'foo' );
-               $Property->setLabel( 'en', '~=[,,_,,]:3' );
-               $content = PropertyContent::newFromProperty( $Property );
-               $this->assertTrue( $content->isStub() );
-       }
-
-       public function testIsStub_emptyProperty() {
-               $content = PropertyContent::newFromProperty( 
Property::newFromType( 'foo' ) );
-               $this->assertFalse( $content->isStub() );
-       }
-
-       public function testIsStub_nonStubProperty() {
-               $Property = Property::newFromType( 'foo' );
-               $Property->getStatements()->addNewStatement( new 
PropertyNoValueSnak( 42 ) );
-               $content = PropertyContent::newFromProperty( $Property );
-               $this->assertFalse( $content->isStub() );
-       }
-
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I69a2b6e48f0fec6fa12159168765de5991c7ad54
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to