Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/58879
Change subject: Removed ValueParsers Error interface ...................................................................... Removed ValueParsers Error interface Change-Id: Ic3e8180aba9ced293bca4102ebd0c82d045771f3 --- M ValueParsers/ValueParsers.classes.php M ValueParsers/ValueParsers.mw.php D ValueParsers/includes/Error.php D ValueParsers/tests/includes/ErrorTest.php 4 files changed, 0 insertions(+), 188 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataValues refs/changes/79/58879/1 diff --git a/ValueParsers/ValueParsers.classes.php b/ValueParsers/ValueParsers.classes.php index 7094f54..d526498 100644 --- a/ValueParsers/ValueParsers.classes.php +++ b/ValueParsers/ValueParsers.classes.php @@ -27,9 +27,7 @@ * @author Jeroen De Dauw < jeroended...@gmail.com > */ return array( - 'ValueParsers\Error' => 'includes/Error.php', 'ValueParsers\ParseException' => 'includes/ParseException.php', - 'ValueParsers\ErrorObject' => 'includes/Error.php', 'ValueParsers\ParserOptions' => 'includes/ParserOptions.php', 'ValueParsers\ValueParser' => 'includes/ValueParser.php', 'ValueParsers\ValueParserFactory' => 'includes/ValueParserFactory.php', diff --git a/ValueParsers/ValueParsers.mw.php b/ValueParsers/ValueParsers.mw.php index 9d91a75..406559c 100644 --- a/ValueParsers/ValueParsers.mw.php +++ b/ValueParsers/ValueParsers.mw.php @@ -75,7 +75,6 @@ 'includes/parsers/NullParser', 'includes/parsers/TitleParser', - 'includes/Error', 'includes/ParserOptions', 'includes/ValueParserFactory', ); diff --git a/ValueParsers/includes/Error.php b/ValueParsers/includes/Error.php deleted file mode 100644 index 96e4c6e..0000000 --- a/ValueParsers/includes/Error.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php - -namespace ValueParsers; - -/** - * Interface for ValueParser errors. - * - * 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 Error implements \Immutable { - - const SEVERITY_ERROR = 9; - const SEVERITY_WARNING = 4; - - protected $text; - protected $severity; - protected $property; - - /** - * Create a new error. - * - * @since 0.1 - * - * @param string $text - * @param string|null $property - * - * @return Error - */ - public static function newError( $text = '', $property = null ) { - return new static( $text, Error::SEVERITY_ERROR, $property ); - } - - /** - * @since 0.1 - * - * @param string $text - * @param integer $severity - * @param string|null $property - */ - protected function __construct( $text, $severity, $property ) { - $this->text = $text; - $this->severity = $severity; - $this->property = $property; - } - - /** - * Returns the error text. - * - * @since 0.1 - * - * @return string - */ - public function getText() { - return $this->text; - } - - /** - * Returns the severity of the error - * - * @since 0.1 - * - * @return integer, element of the ValueParserError::SEVERITY_ enum - */ - public function getSeverity() { - return $this->severity; - } - - /** - * Returns the property of the value for which the error occurred, or null if it occurred for the value itself. - * - * @since 0.1 - * - * @return string|null - */ - public function getProperty() { - return $this->property; - } - -} - -/** - * @deprecated - */ -class ErrorObject extends Error {} \ No newline at end of file diff --git a/ValueParsers/tests/includes/ErrorTest.php b/ValueParsers/tests/includes/ErrorTest.php deleted file mode 100644 index 9f1a7b7..0000000 --- a/ValueParsers/tests/includes/ErrorTest.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php - -namespace ValueParsers\Test; - -use ValueParsers\Error; - -/** - * Unit tests for the ValueParsers\Error class. - * - * 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 - * - * @file - * @since 0.1 - * - * @ingroup ValueParsersTest - * - * @group ValueParsers - * @group DataValueExtensions - * - * @licence GNU GPL v2+ - * @author Jeroen De Dauw < jeroended...@gmail.com > - */ -class ErrorTest extends \MediaWikiTestCase { - - public function newErrorProvider() { - $argLists = array(); - - $argLists[] = array(); - - $argLists[] = array( '' ); - $argLists[] = array( 'foo' ); - $argLists[] = array( ' foo bar baz.' ); - - $argLists[] = array( ' foo bar ', null ); - $argLists[] = array( ' foo bar ', 'length' ); - - return $argLists; - } - - /** - * @dataProvider newErrorProvider - */ - public function testNewError() { - $args = func_get_args(); - - $error = call_user_func_array( 'ValueParsers\Error::newError', $args ); - - /** - * @var Error $error - */ - $this->assertInstanceOf( 'ValueParsers\Error', $error ); - - $this->assertInternalType( 'string', $error->getText() ); - $this->assertInternalType( 'integer', $error->getSeverity() ); - $this->assertTypeOrValue( 'string', $error->getProperty(), null ); - - if ( count( $args ) > 0 ) { - $this->assertEquals( $args[0], $error->getText() ); - } - - if ( count( $args ) > 1 ) { - $this->assertEquals( $args[1], $error->getProperty() ); - } - } - -} -- To view, visit https://gerrit.wikimedia.org/r/58879 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic3e8180aba9ced293bca4102ebd0c82d045771f3 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