r40315 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40314‎ | r40315 | r40316 >
Date:20:19, 1 September 2008
Author:mkroetzsch
Status:old
Tags:
Comment:
Return error type value instead of NULL in the rare cases of failure, prevents some unexpecting callers from
dying
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValueFactory.php
@@ -221,7 +221,9 @@
222222
223223 /**
224224 * Quickly get the type value of some property without necessarily making another datavalue.
225 - * FIXME not efficient
 225+ * @note The internal error type id is returned if this method failed to find the type.
 226+ * @bug This method is not implemented efficiently.
 227+ * @todo This method is mainly used in the processing of multi-valued properties. Revise all its uses.
226228 */
227229 static public function getPropertyObjectTypeValue(Title $property) {
228230 $propertyname = $property->getText();
@@ -229,7 +231,7 @@
230232 if (array_key_exists($propertyname, SMWDataValueFactory::$m_typebyproperty)) {
231233 return SMWDataValueFactory::$m_typebyproperty[$propertyname];
232234 } else { // no type found
233 - return NULL;
 235+ return new SMWTypesValue('__err');
234236 }
235237 }
236238

Status & tagging log