Jeroen De Dauw has submitted this change and it was merged.
Change subject: Remove ValueParsers Result interface
......................................................................
Remove ValueParsers Result interface
Change-Id: Icd82ef6d18cbb512168fed9b458e1aa15a3b27fa
---
M ValueParsers/ValueParsers.classes.php
D ValueParsers/includes/Result.php
M ValueParsers/includes/parsers/StringValueParser.php
3 files changed, 0 insertions(+), 171 deletions(-)
Approvals:
Jeroen De Dauw: Verified; Looks good to me, approved
jenkins-bot: Verified
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 < [email protected] >
- */
-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
diff --git a/ValueParsers/includes/parsers/StringValueParser.php
b/ValueParsers/includes/parsers/StringValueParser.php
index ec2899d..940c06a 100644
--- a/ValueParsers/includes/parsers/StringValueParser.php
+++ b/ValueParsers/includes/parsers/StringValueParser.php
@@ -84,18 +84,6 @@
protected abstract function stringParse( $value );
/**
- * @since 0.1
- * @deprecated
- *
- * @param string $errorMessage
- *
- * @return Result
- */
- protected function newErrorResult( $errorMessage ) {
- return Result::newErrorText( $errorMessage );
- }
-
- /**
* @see ValueParser::setOptions
*
* @since 0.1
--
To view, visit https://gerrit.wikimedia.org/r/58876
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Icd82ef6d18cbb512168fed9b458e1aa15a3b27fa
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Denny Vrandecic <[email protected]>
Gerrit-Reviewer: Henning Snater <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits