Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/58876
Change subject: Remove Result interface ...................................................................... Remove Result interface Change-Id: Icd82ef6d18cbb512168fed9b458e1aa15a3b27fa --- M ValueParsers/ValueParsers.classes.php D ValueParsers/includes/Result.php 2 files changed, 0 insertions(+), 159 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataValues refs/changes/76/58876/1 diff --git a/ValueParsers/ValueParsers.classes.php b/ValueParsers/ValueParsers.classes.php index 03b9d31..7094f54 100644 --- a/ValueParsers/ValueParsers.classes.php +++ b/ValueParsers/ValueParsers.classes.php @@ -31,8 +31,6 @@ 'ValueParsers\ParseException' => 'includes/ParseException.php', 'ValueParsers\ErrorObject' => 'includes/Error.php', 'ValueParsers\ParserOptions' => 'includes/ParserOptions.php', - 'ValueParsers\Result' => 'includes/Result.php', - 'ValueParsers\ResultObject' => 'includes/Result.php', 'ValueParsers\ValueParser' => 'includes/ValueParser.php', 'ValueParsers\ValueParserFactory' => 'includes/ValueParserFactory.php', diff --git a/ValueParsers/includes/Result.php b/ValueParsers/includes/Result.php deleted file mode 100644 index ab7621b..0000000 --- a/ValueParsers/includes/Result.php +++ /dev/null @@ -1,157 +0,0 @@ -<?php - -namespace ValueParsers; - -use Exception; -use Immutable; - -/** - * Result of a parsing process. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @since 0.1 - * @deprecated - * - * @file - * @ingroup ValueParsers - * - * @licence GNU GPL v2+ - * @author Jeroen De Dauw < jeroended...@gmail.com > - */ -class Result implements Immutable { - - /** - * Indicates if the parsing process was successful. - * - * @since 0.1 - * - * @var boolean - */ - protected $isValid; - - /** - * The parsed value, - * or null if the parsing process failed. - * - * @since 0.1 - * - * @var mixed - */ - protected $value; - - /** - * @since 0.1 - * - * @var Error|null - */ - protected $error; - - /** - * @since 0.1 - * - * @param mixed $value - * - * @return Result - */ - public static function newSuccess( $value ) { - return new static( true, $value ); - } - - /** - * @since 0.1 - * - * @param Error $error - * - * @return Result - */ - public static function newError( Error $error ) { - return new static( false, null, $error ); - } - - /** - * @since 0.1 - * - * @param string $error - * - * @return Result - */ - public static function newErrorText( $error ) { - return static::newError( Error::newError( $error ) ); - } - - /** - * @since 0.1 - * - * @param boolean $isValid - * @param mixed $value - * @param Error|null $error - */ - protected function __construct( $isValid, $value = null, Error $error = null ) { - $this->isValid = $isValid; - $this->value = $value; - $this->error = $error; - } - - /** - * Returns the parsed value. - * If the parsing process failed, this method will throw an - * exception when called. You can check for failure using - * the @see isValid method first. - * - * @since 0.1 - * - * @return mixed - * @throws Exception - */ - public function getValue() { - if ( $this->isValid() ) { - return $this->value; - } - else { - throw new Exception( 'The parsing process failed, so the result value cannot be obtained' ); - } - } - - /** - * Returns if the parsing was successful. - * If it was, you can obtain the resulting value via @see getValue - * - * @since 0.1 - * - * @return boolean - */ - public function isValid() { - return $this->isValid; - } - - /** - * Returns error in case the value is invalid or null otherwise. - * - * @since 0.1 - * - * @return Error|null - */ - public function getError() { - return $this->error; - } - -} - -/** - * @deprecated - */ -class ResultObject extends Result {} \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/58876 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icd82ef6d18cbb512168fed9b458e1aa15a3b27fa Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DataValues Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw <jeroended...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits