Thiemo Mättig (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/384689 )
Change subject: Update the used Wikibase CodeSniffer rule set to 0.2.0 ...................................................................... Update the used Wikibase CodeSniffer rule set to 0.2.0 In here I'm also removing all references to something called "DemoData". I don't know what it is, and can not find it anywhere. Change-Id: Id4dd7b70f405ac37221e2805bacf301a476dd22e --- M composer.json M phpcs.xml M src/Api/AddForm.php M src/Api/AddFormSummary.php M src/Api/Error/ApiError.php M src/Api/Error/FormMustHaveAtLeastOneRepresentation.php M src/Api/Error/JsonFieldHasWrongType.php M src/Api/Error/JsonFieldIsNotAnItemId.php M src/Api/Error/JsonFieldIsRequired.php M src/Api/Error/LexemeNotFound.php M src/Api/Error/ParameterIsNotAJsonObject.php M src/Api/Error/ParameterIsNotLexemeId.php M src/Api/Error/ParameterIsRequired.php M src/Api/Error/RepresentationLanguageCanNotBeEmpty.php M src/Api/Error/RepresentationTextCanNotBeEmpty.php M src/Api/Error/RepresentationsMustHaveUniqueLanguage.php M src/Content/LexemeContent.php M src/DataModel/Serialization/ExternalLexemeSerializer.php M src/DataModel/Services/Diff/ChangeFormDiffOp.php M src/DataModel/Services/Diff/FormDiffer.php M src/DataModel/Services/Diff/FormPatcher.php M src/PropertyType/FormIdFormatter.php M src/PropertyType/SenseIdFormatter.php M src/View/LexemeView.php M tests/phpunit/composer/ErisGenerators/CartesianProduct.php M tests/phpunit/composer/ErisGenerators/CartesianProductTest.php M tests/phpunit/composer/ErisGenerators/FormGenerator.php M tests/phpunit/composer/ErisGenerators/FormSetGenerator.php M tests/phpunit/composer/ErisGenerators/PHPUnitTestCaseWrapper.php M tests/phpunit/mediawiki/Api/AddFormRequestParserTest.php M tests/phpunit/mediawiki/Api/AddFormTest.php M tests/phpunit/mediawiki/DevelopmentMaintenance/DatabaseSpy.php M tests/phpunit/mediawiki/Rdf/LexemeRdfBuilderTest.php 33 files changed, 83 insertions(+), 32 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme refs/changes/89/384689/1 diff --git a/composer.json b/composer.json index c9c8bd3..91dee45 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.2", "phpunit/phpunit": "~4.8", - "wikibase/wikibase-codesniffer": "^0.1.0", + "wikibase/wikibase-codesniffer": "^0.2.0", "jakub-onderka/php-console-highlighter": "0.3.2", "hamcrest/hamcrest-php": "^2.0", "giorgiosironi/eris":"dev-master#34ca0178905d476f25bc28cf401d04cd5df09dd1", @@ -46,13 +46,10 @@ ] }, "scripts": { - "cs": [ - "phpcs -p -s" - ], "fix": "phpcbf", "test": [ "parallel-lint . --exclude vendor", - "@cs", + "phpcs -p -s", "phpunit" ] }, diff --git a/phpcs.xml b/phpcs.xml index 68906a1..b6b9e30 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,21 +1,13 @@ <?xml version="1.0"?> <ruleset name="WikibaseLexeme"> - <rule ref="vendor/wikibase/wikibase-codesniffer/Wikibase" /> - - <!-- Exceptions --> + <rule ref="./vendor/wikibase/wikibase-codesniffer/Wikibase" /> <rule ref="Generic.Files.LineLength"> <exclude-pattern>resources/templates\.php</exclude-pattern> </rule> - <!-- Additions --> - - <!-- Metrics are intentionally not part of the base Wikibase CodeSniffer rule set. --> <rule ref="Generic.Metrics.CyclomaticComplexity" /> <rule ref="Generic.Metrics.NestingLevel" /> - - <!-- TODO: Move to the Wikibase CodeSniffer library. --> - <rule ref="Squiz.WhiteSpace.CastSpacing" /> <file>.</file> </ruleset> diff --git a/src/Api/AddForm.php b/src/Api/AddForm.php index aa6efc9..5ecf7a5 100644 --- a/src/Api/AddForm.php +++ b/src/Api/AddForm.php @@ -13,6 +13,9 @@ use Wikibase\Repo\Api\ApiErrorReporter; use Wikibase\SummaryFormatter; +/** + * @license GPL-2.0+ + */ class AddForm extends ApiBase { const LATEST_REVISION = 0; diff --git a/src/Api/AddFormSummary.php b/src/Api/AddFormSummary.php index f83e28f..1a977df 100644 --- a/src/Api/AddFormSummary.php +++ b/src/Api/AddFormSummary.php @@ -6,11 +6,16 @@ use Wikibase\Lexeme\DataModel\LexemeId; use Wikibase\Lib\FormatableSummary; +/** + * @license GPL-2.0+ + */ class AddFormSummary implements FormatableSummary { + /** * @var LexemeId */ private $lexemeId; + /** * @var Form */ diff --git a/src/Api/Error/ApiError.php b/src/Api/Error/ApiError.php index 3ff5af7..b51d087 100644 --- a/src/Api/Error/ApiError.php +++ b/src/Api/Error/ApiError.php @@ -2,6 +2,9 @@ namespace Wikibase\Lexeme\Api\Error; +/** + * @license GPL-2.0+ + */ interface ApiError { /** diff --git a/src/Api/Error/FormMustHaveAtLeastOneRepresentation.php b/src/Api/Error/FormMustHaveAtLeastOneRepresentation.php index bcf935d..e7bd79e 100644 --- a/src/Api/Error/FormMustHaveAtLeastOneRepresentation.php +++ b/src/Api/Error/FormMustHaveAtLeastOneRepresentation.php @@ -2,6 +2,9 @@ namespace Wikibase\Lexeme\Api\Error; +/** + * @license GPL-2.0+ + */ class FormMustHaveAtLeastOneRepresentation implements ApiError { /** diff --git a/src/Api/Error/JsonFieldHasWrongType.php b/src/Api/Error/JsonFieldHasWrongType.php index e09649c..8c0b304 100644 --- a/src/Api/Error/JsonFieldHasWrongType.php +++ b/src/Api/Error/JsonFieldHasWrongType.php @@ -2,19 +2,26 @@ namespace Wikibase\Lexeme\Api\Error; +/** + * @license GPL-2.0+ + */ class JsonFieldHasWrongType implements ApiError { + /** * @var string */ private $parameterName; + /** * @var string[] */ private $fieldPath; + /** * @var string */ private $expectedType; + /** * @var string */ diff --git a/src/Api/Error/JsonFieldIsNotAnItemId.php b/src/Api/Error/JsonFieldIsNotAnItemId.php index b344caa..f58da1e 100644 --- a/src/Api/Error/JsonFieldIsNotAnItemId.php +++ b/src/Api/Error/JsonFieldIsNotAnItemId.php @@ -2,6 +2,9 @@ namespace Wikibase\Lexeme\Api\Error; +/** + * @license GPL-2.0+ + */ class JsonFieldIsNotAnItemId implements ApiError { /** diff --git a/src/Api/Error/JsonFieldIsRequired.php b/src/Api/Error/JsonFieldIsRequired.php index ce625e2..dac422f 100644 --- a/src/Api/Error/JsonFieldIsRequired.php +++ b/src/Api/Error/JsonFieldIsRequired.php @@ -2,11 +2,16 @@ namespace Wikibase\Lexeme\Api\Error; +/** + * @license GPL-2.0+ + */ class JsonFieldIsRequired implements ApiError { + /** * @var */ private $parameterName; + /** * @var string[] */ diff --git a/src/Api/Error/LexemeNotFound.php b/src/Api/Error/LexemeNotFound.php index abf2371..6012851 100644 --- a/src/Api/Error/LexemeNotFound.php +++ b/src/Api/Error/LexemeNotFound.php @@ -4,6 +4,9 @@ use Wikibase\Lexeme\DataModel\LexemeId; +/** + * @license GPL-2.0+ + */ class LexemeNotFound implements ApiError { /** diff --git a/src/Api/Error/ParameterIsNotAJsonObject.php b/src/Api/Error/ParameterIsNotAJsonObject.php index 21f1659..f85b643 100644 --- a/src/Api/Error/ParameterIsNotAJsonObject.php +++ b/src/Api/Error/ParameterIsNotAJsonObject.php @@ -2,6 +2,9 @@ namespace Wikibase\Lexeme\Api\Error; +/** + * @license GPL-2.0+ + */ class ParameterIsNotAJsonObject implements ApiError { /** diff --git a/src/Api/Error/ParameterIsNotLexemeId.php b/src/Api/Error/ParameterIsNotLexemeId.php index 5d5a6e7..2dd022d 100644 --- a/src/Api/Error/ParameterIsNotLexemeId.php +++ b/src/Api/Error/ParameterIsNotLexemeId.php @@ -2,6 +2,9 @@ namespace Wikibase\Lexeme\Api\Error; +/** + * @license GPL-2.0+ + */ class ParameterIsNotLexemeId implements ApiError { /** diff --git a/src/Api/Error/ParameterIsRequired.php b/src/Api/Error/ParameterIsRequired.php index bf63ff7..a1146cf 100644 --- a/src/Api/Error/ParameterIsRequired.php +++ b/src/Api/Error/ParameterIsRequired.php @@ -2,7 +2,11 @@ namespace Wikibase\Lexeme\Api\Error; +/** + * @license GPL-2.0+ + */ class ParameterIsRequired implements ApiError { + /** * @var string */ diff --git a/src/Api/Error/RepresentationLanguageCanNotBeEmpty.php b/src/Api/Error/RepresentationLanguageCanNotBeEmpty.php index 374823d..24d23d5 100644 --- a/src/Api/Error/RepresentationLanguageCanNotBeEmpty.php +++ b/src/Api/Error/RepresentationLanguageCanNotBeEmpty.php @@ -2,6 +2,9 @@ namespace Wikibase\Lexeme\Api\Error; +/** + * @license GPL-2.0+ + */ class RepresentationLanguageCanNotBeEmpty implements ApiError { /** diff --git a/src/Api/Error/RepresentationTextCanNotBeEmpty.php b/src/Api/Error/RepresentationTextCanNotBeEmpty.php index 3cf67fb..fd3821e 100644 --- a/src/Api/Error/RepresentationTextCanNotBeEmpty.php +++ b/src/Api/Error/RepresentationTextCanNotBeEmpty.php @@ -2,6 +2,9 @@ namespace Wikibase\Lexeme\Api\Error; +/** + * @license GPL-2.0+ + */ class RepresentationTextCanNotBeEmpty implements ApiError { /** diff --git a/src/Api/Error/RepresentationsMustHaveUniqueLanguage.php b/src/Api/Error/RepresentationsMustHaveUniqueLanguage.php index 0a4da6f..3d7c6ca 100644 --- a/src/Api/Error/RepresentationsMustHaveUniqueLanguage.php +++ b/src/Api/Error/RepresentationsMustHaveUniqueLanguage.php @@ -2,6 +2,9 @@ namespace Wikibase\Lexeme\Api\Error; +/** + * @license GPL-2.0+ + */ class RepresentationsMustHaveUniqueLanguage implements ApiError { /** diff --git a/src/Content/LexemeContent.php b/src/Content/LexemeContent.php index 2f4649a..5e3e447 100644 --- a/src/Content/LexemeContent.php +++ b/src/Content/LexemeContent.php @@ -7,7 +7,6 @@ use Wikibase\Content\EntityHolder; use Wikibase\EntityContent; use Wikibase\Lexeme\DataModel\Lexeme; -use Wikibase\Lexeme\DemoData; use Wikimedia\Assert\Assert; /** diff --git a/src/DataModel/Serialization/ExternalLexemeSerializer.php b/src/DataModel/Serialization/ExternalLexemeSerializer.php index 2f5d79f..f321b8f 100644 --- a/src/DataModel/Serialization/ExternalLexemeSerializer.php +++ b/src/DataModel/Serialization/ExternalLexemeSerializer.php @@ -5,7 +5,6 @@ use Serializers\DispatchableSerializer; use Serializers\Exceptions\SerializationException; use Serializers\Exceptions\UnsupportedObjectException; -use Wikibase\Lexeme\DataModel\Form; use Wikibase\Lexeme\DataModel\Lexeme; /** diff --git a/src/DataModel/Services/Diff/ChangeFormDiffOp.php b/src/DataModel/Services/Diff/ChangeFormDiffOp.php index 7cdc8fb..52f84b9 100644 --- a/src/DataModel/Services/Diff/ChangeFormDiffOp.php +++ b/src/DataModel/Services/Diff/ChangeFormDiffOp.php @@ -6,6 +6,9 @@ use Diff\DiffOp\DiffOp; use Wikibase\Lexeme\DataModel\FormId; +/** + * @license GPL-2.0+ + */ class ChangeFormDiffOp implements DiffOp { /** diff --git a/src/DataModel/Services/Diff/FormDiffer.php b/src/DataModel/Services/Diff/FormDiffer.php index 58d624a..0367b54 100644 --- a/src/DataModel/Services/Diff/FormDiffer.php +++ b/src/DataModel/Services/Diff/FormDiffer.php @@ -7,6 +7,9 @@ use Wikibase\DataModel\Services\Diff\StatementListDiffer; use Wikibase\Lexeme\DataModel\Form; +/** + * @license GPL-2.0+ + */ class FormDiffer { /** diff --git a/src/DataModel/Services/Diff/FormPatcher.php b/src/DataModel/Services/Diff/FormPatcher.php index 045bdfd..77e1c38 100644 --- a/src/DataModel/Services/Diff/FormPatcher.php +++ b/src/DataModel/Services/Diff/FormPatcher.php @@ -7,6 +7,9 @@ use Wikibase\DataModel\Services\Diff\TermListPatcher; use Wikibase\Lexeme\DataModel\Form; +/** + * @license GPL-2.0+ + */ class FormPatcher { public function __construct() { diff --git a/src/PropertyType/FormIdFormatter.php b/src/PropertyType/FormIdFormatter.php index 0527884..f59079d 100644 --- a/src/PropertyType/FormIdFormatter.php +++ b/src/PropertyType/FormIdFormatter.php @@ -5,6 +5,9 @@ use DataValues\StringValue; use ValueFormatters\ValueFormatter; +/** + * @license GPL-2.0+ + */ class FormIdFormatter implements ValueFormatter { /** @@ -17,9 +20,7 @@ //If you change something here, change also there $this->addForm( 'L13', 'hard English adjective', 'F1', 'hard', [ 'normative' ] ); $this->addForm( 'L13', 'hard English adjective', 'F2', 'harder', [ 'comparative' ] ); - // @see \Wikibase\Lexeme\DemoData\Id::LF_CARD $this->addForm( 'L456', 'card English noun', 'F4', 'card', [ 'normative' ] ); - // @see \Wikibase\Lexeme\DemoData\Id::LF_BARD $this->addForm( 'L888', 'bard English noun', 'F1', 'bard', [ 'normative' ] ); $this->addForm( 'L14', diff --git a/src/PropertyType/SenseIdFormatter.php b/src/PropertyType/SenseIdFormatter.php index db48c62..e050f82 100644 --- a/src/PropertyType/SenseIdFormatter.php +++ b/src/PropertyType/SenseIdFormatter.php @@ -5,6 +5,9 @@ use DataValues\StringValue; use ValueFormatters\ValueFormatter; +/** + * @license GPL-2.0+ + */ class SenseIdFormatter implements ValueFormatter { /** @@ -18,7 +21,6 @@ $this->addSense( 'L13', 'hard', 'English adjective', 'S1', 'presenting difficulty' ); $this->addSense( 'L13', 'hard', 'English adjective', 'S2', 'resisting deformation' ); - // @see \Wikibase\Lexeme\DemoData\Id::LS_DIFFICULT $this->addSense( 'L3627', 'difficult', @@ -26,17 +28,11 @@ 'S4', 'not easy, requiring skill' ); - // @see \Wikibase\Lexeme\DemoData\Id::LS_SCHWIERIG $this->addSense( 'L283', 'schwierig', 'German adjective', 'S2', 'complicated' ); - // @see \Wikibase\Lexeme\DemoData\Id::LS_DUR $this->addSense( 'L465', 'dur', 'French adjective', 'S1', 'hard' ); - // @see \Wikibase\Lexeme\DemoData\Id::LS_EASY $this->addSense( 'L801', 'easy', 'English adjective', 'S1', 'not difficult' ); - // @see \Wikibase\Lexeme\DemoData\Id::LS_SIMPLE $this->addSense( 'L802', 'simple', 'English adjective', 'S1', 'not difficult' ); - // @see \Wikibase\Lexeme\DemoData\Id::LS_SOFT $this->addSense( 'L803', 'soft', 'English adjective', 'S1', 'easy to deform' ); - // @see \Wikibase\Lexeme\DemoData\Id::LS_LEADER $this->addSense( 'L15', 'Leiter', 'German noun', 'S1', 'leader' ); $this->addSense( 'L15', 'Leiter', 'German noun', 'S1', 'electrical conductor' ); $this->addSense( diff --git a/src/View/LexemeView.php b/src/View/LexemeView.php index fd91402..05c9d13 100644 --- a/src/View/LexemeView.php +++ b/src/View/LexemeView.php @@ -323,7 +323,6 @@ </div> </div> HTML; - } private function getRawLemmaVueTemplate() { diff --git a/tests/phpunit/composer/ErisGenerators/CartesianProduct.php b/tests/phpunit/composer/ErisGenerators/CartesianProduct.php index aa6930d..4530cca 100644 --- a/tests/phpunit/composer/ErisGenerators/CartesianProduct.php +++ b/tests/phpunit/composer/ErisGenerators/CartesianProduct.php @@ -5,6 +5,9 @@ use Eris\Generator\GeneratedValueOptions; use Eris\Generator\GeneratedValueSingle; +/** + * @license GPL-2.0+ + */ class CartesianProduct { /** diff --git a/tests/phpunit/composer/ErisGenerators/CartesianProductTest.php b/tests/phpunit/composer/ErisGenerators/CartesianProductTest.php index ec049b1..e32f645 100644 --- a/tests/phpunit/composer/ErisGenerators/CartesianProductTest.php +++ b/tests/phpunit/composer/ErisGenerators/CartesianProductTest.php @@ -2,7 +2,6 @@ namespace Wikibase\Lexeme\Tests\ErisGenerators; -use Eris\Facade; use Eris\Generator\GeneratedValueOptions; use Eris\Generator\GeneratedValueSingle; diff --git a/tests/phpunit/composer/ErisGenerators/FormGenerator.php b/tests/phpunit/composer/ErisGenerators/FormGenerator.php index 44299df..4c76c22 100644 --- a/tests/phpunit/composer/ErisGenerators/FormGenerator.php +++ b/tests/phpunit/composer/ErisGenerators/FormGenerator.php @@ -10,6 +10,9 @@ use Wikibase\Lexeme\DataModel\Form; use Wikibase\Lexeme\DataModel\FormId; +/** + * @license GPL-2.0+ + */ class FormGenerator implements Generator { const MAX_FORM_ID = 100; diff --git a/tests/phpunit/composer/ErisGenerators/FormSetGenerator.php b/tests/phpunit/composer/ErisGenerators/FormSetGenerator.php index 3be31ba..244e915 100644 --- a/tests/phpunit/composer/ErisGenerators/FormSetGenerator.php +++ b/tests/phpunit/composer/ErisGenerators/FormSetGenerator.php @@ -8,6 +8,9 @@ use Wikibase\Lexeme\DataModel\Form; use Wikibase\Lexeme\DataModel\FormSet; +/** + * @license GPL-2.0+ + */ class FormSetGenerator implements Generator { /** diff --git a/tests/phpunit/composer/ErisGenerators/PHPUnitTestCaseWrapper.php b/tests/phpunit/composer/ErisGenerators/PHPUnitTestCaseWrapper.php index 9b76100..198c3ca 100644 --- a/tests/phpunit/composer/ErisGenerators/PHPUnitTestCaseWrapper.php +++ b/tests/phpunit/composer/ErisGenerators/PHPUnitTestCaseWrapper.php @@ -4,6 +4,9 @@ use Eris\TestTrait; +/** + * @license GPL-2.0+ + */ class PHPUnitTestCaseWrapper { use TestTrait { diff --git a/tests/phpunit/mediawiki/Api/AddFormRequestParserTest.php b/tests/phpunit/mediawiki/Api/AddFormRequestParserTest.php index 4c6d2b5..3f463c0 100644 --- a/tests/phpunit/mediawiki/Api/AddFormRequestParserTest.php +++ b/tests/phpunit/mediawiki/Api/AddFormRequestParserTest.php @@ -14,7 +14,6 @@ use Wikibase\Lexeme\Api\Error\JsonFieldHasWrongType; use Wikibase\Lexeme\Api\Error\JsonFieldIsNotAnItemId; use Wikibase\Lexeme\Api\Error\JsonFieldIsRequired; -use Wikibase\Lexeme\Api\Error\JsonFieldMustNotBeEmpty; use Wikibase\Lexeme\Api\Error\ParameterIsNotAJsonObject; use Wikibase\Lexeme\Api\Error\ParameterIsNotLexemeId; use Wikibase\Lexeme\Api\Error\ParameterIsRequired; diff --git a/tests/phpunit/mediawiki/Api/AddFormTest.php b/tests/phpunit/mediawiki/Api/AddFormTest.php index 393b0b1..c708071 100644 --- a/tests/phpunit/mediawiki/Api/AddFormTest.php +++ b/tests/phpunit/mediawiki/Api/AddFormTest.php @@ -2,7 +2,6 @@ namespace Wikibase\Lexeme\Tests\MediaWiki\Api; -use ApiErrorFormatter; use Revision; use Wikibase\DataModel\Entity\ItemId; use Wikibase\Lexeme\DataModel\Lexeme; diff --git a/tests/phpunit/mediawiki/DevelopmentMaintenance/DatabaseSpy.php b/tests/phpunit/mediawiki/DevelopmentMaintenance/DatabaseSpy.php index 67c1521..7975d5e 100644 --- a/tests/phpunit/mediawiki/DevelopmentMaintenance/DatabaseSpy.php +++ b/tests/phpunit/mediawiki/DevelopmentMaintenance/DatabaseSpy.php @@ -6,7 +6,6 @@ use Wikimedia\Rdbms\DBMasterPos; use Wikimedia\Rdbms\IDatabase; use Wikimedia\Rdbms\IResultWrapper; -use Wikimedia\ScopedCallback; /** * A very incomplete and limited spy, used to log update calls. diff --git a/tests/phpunit/mediawiki/Rdf/LexemeRdfBuilderTest.php b/tests/phpunit/mediawiki/Rdf/LexemeRdfBuilderTest.php index 4ca36a2..920992c 100644 --- a/tests/phpunit/mediawiki/Rdf/LexemeRdfBuilderTest.php +++ b/tests/phpunit/mediawiki/Rdf/LexemeRdfBuilderTest.php @@ -69,8 +69,8 @@ if ( $expected === null ) { $this->getTestData()->putTestData( $dataSetName, $actual, '.actual' ); - $this->fail( "Data set $dataSetName not found! Created file with the current data using" - . " the suffix .actual" ); + $this->fail( "Data set $dataSetName not found! Created file with the current data " + . 'using the suffix .actual' ); } $this->helper->assertNTriplesEquals( $expected, $actual, "Data set $dataSetName" ); -- To view, visit https://gerrit.wikimedia.org/r/384689 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id4dd7b70f405ac37221e2805bacf301a476dd22e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseLexeme 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