Jeroen De Dauw has submitted this change and it was merged. Change subject: Enable PHPCS sniff Generic.Functions.OpeningFunctionBraceKernighanRitchie ......................................................................
Enable PHPCS sniff Generic.Functions.OpeningFunctionBraceKernighanRitchie Change-Id: I7a21f551d9515b5e22eb338f6d715d0ecbe450cb --- M phpcs.xml M repo/includes/actions/EditEntityAction.php M repo/includes/api/GetEntities.php M repo/includes/api/SetClaim.php M repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php M repo/tests/phpunit/includes/Diff/DifferencesSnakVisualizerTest.php M repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php M repo/tests/phpunit/includes/actions/ActionTestCase.php M repo/tests/phpunit/includes/api/EditEntityTest.php M repo/tests/phpunit/includes/api/LinkTitlesTest.php M repo/tests/phpunit/includes/api/MergeItemsTest.php M repo/tests/phpunit/includes/api/ModifyTermTestCase.php M repo/tests/phpunit/includes/api/ResultBuilderTest.php M repo/tests/phpunit/includes/api/SetAliasesTest.php M repo/tests/phpunit/includes/api/SetDescriptionTest.php M repo/tests/phpunit/includes/api/SetLabelTest.php M repo/tests/phpunit/includes/rdf/RdfBuilderTest.php 17 files changed, 46 insertions(+), 43 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/phpcs.xml b/phpcs.xml index 7630c09..16bb93e 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -15,6 +15,8 @@ <rule ref="Generic.Formatting.DisallowMultipleStatements" /> + <rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie" /> + <rule ref="Generic.PHP.CharacterBeforePHPOpeningTag" /> <rule ref="Generic.PHP.DeprecatedFunctions" /> <rule ref="Generic.PHP.DisallowShortOpenTag" /> diff --git a/repo/includes/actions/EditEntityAction.php b/repo/includes/actions/EditEntityAction.php index dada202..313122d 100644 --- a/repo/includes/actions/EditEntityAction.php +++ b/repo/includes/actions/EditEntityAction.php @@ -159,7 +159,7 @@ * * @return Status */ - private function getStatus( WebRequest $req, Revision $latestRevision ){ + private function getStatus( WebRequest $req, Revision $latestRevision ) { if ( $req->getCheck( 'restore' ) ) { // nearly the same as undoafter without undo $olderRevision = Revision::newFromId( $req->getInt( 'restore' ) ); diff --git a/repo/includes/api/GetEntities.php b/repo/includes/api/GetEntities.php index 0bce353..bd63c3d 100644 --- a/repo/includes/api/GetEntities.php +++ b/repo/includes/api/GetEntities.php @@ -168,7 +168,7 @@ /** * @param array $missingItems Array of arrays, Each internal array has a key 'site' and 'title' */ - private function addMissingItemsToResult( $missingItems ){ + private function addMissingItemsToResult( $missingItems ) { foreach( $missingItems as $missingItem ) { $this->getResultBuilder()->addMissingEntity( null, $missingItem ); } @@ -256,7 +256,7 @@ * * @return SerializationOptions */ - private function getSerializationOptions( $params, $props ){ + private function getSerializationOptions( $params, $props ) { $fallbackMode = ( LanguageFallbackChainFactory::FALLBACK_VARIANTS | LanguageFallbackChainFactory::FALLBACK_OTHERS diff --git a/repo/includes/api/SetClaim.php b/repo/includes/api/SetClaim.php index 45bd7cb..e061eac 100644 --- a/repo/includes/api/SetClaim.php +++ b/repo/includes/api/SetClaim.php @@ -99,7 +99,7 @@ * * @todo this summary builder is ugly and summary stuff needs to be refactored */ - private function getSummary( array $params, Claim $claim, Entity $entity ){ + private function getSummary( array $params, Claim $claim, Entity $entity ) { $claimSummaryBuilder = new ClaimSummaryBuilder( $this->getModuleName(), new ClaimDiffer( new OrderedListDiffer( new ComparableComparer() ) ) diff --git a/repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php b/repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php index 8e99c67..8f3dc10 100644 --- a/repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php +++ b/repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php @@ -238,13 +238,13 @@ /** * @dataProvider provideDifferenceAndClaim */ - public function testVisualizeClaimChange( $difference, $baseClaim, $expectedHtml ){ + public function testVisualizeClaimChange( $difference, $baseClaim, $expectedHtml ) { $visualizer = $this->newClaimDifferenceVisualizer(); $html = $visualizer->visualizeClaimChange( $difference, $baseClaim ); $this->assertHtmlEquals( $expectedHtml, $html ); } - public function testVisualizeNewClaim(){ + public function testVisualizeNewClaim() { $expect = // main snak '<tr><td colspan="2" class="diff-lineno"></td>'. @@ -286,7 +286,7 @@ $this->assertHtmlEquals( $expect, $html ); } - public function testVisualizeRemovedClaim(){ + public function testVisualizeRemovedClaim() { $expect = // main snak '<tr><td colspan="2" class="diff-lineno">property / P12</td>'. diff --git a/repo/tests/phpunit/includes/Diff/DifferencesSnakVisualizerTest.php b/repo/tests/phpunit/includes/Diff/DifferencesSnakVisualizerTest.php index 33a6df6..6396003 100644 --- a/repo/tests/phpunit/includes/Diff/DifferencesSnakVisualizerTest.php +++ b/repo/tests/phpunit/includes/Diff/DifferencesSnakVisualizerTest.php @@ -47,7 +47,7 @@ return $instance; } - public function newDifferencesSnakVisualizer(){ + public function newDifferencesSnakVisualizer() { return new DifferencesSnakVisualizer( $this->newEntityIdLabelFormatter(), $this->newSnakFormatter( '<i>DETAILED SNAK</i>' ), @@ -56,7 +56,7 @@ ); } - public function testConstruction(){ + public function testConstruction() { $instance = $this->newDifferencesSnakVisualizer(); $this->assertInstanceOf( 'Wikibase\Repo\Diff\DifferencesSnakVisualizer', $instance ); } diff --git a/repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php b/repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php index 6fe1c1a..da036ba 100644 --- a/repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php +++ b/repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php @@ -261,7 +261,7 @@ /** * @dataProvider mergeProvider */ - public function testMergeItems( $fromData, $toData, $expectedFrom, $expectedTo, $ignoreConflicts = array() ){ + public function testMergeItems( $fromData, $toData, $expectedFrom, $expectedTo, $ignoreConflicts = array() ) { $interactor = $this->newInteractor(); $fromId = new ItemId( 'Q1' ); @@ -305,7 +305,7 @@ /** * @dataProvider mergeFailureProvider */ - public function testMergeItems_failure( $fromId, $toId, $ignoreConflicts, $expectedErrorCode ){ + public function testMergeItems_failure( $fromId, $toId, $ignoreConflicts, $expectedErrorCode ) { try { $interactor = $this->newInteractor(); $interactor->mergeItems( $fromId, $toId, $ignoreConflicts ); @@ -334,7 +334,7 @@ /** * @dataProvider mergeConflictsProvider */ - public function testMergeItems_conflict( $fromData, $toData, $ignoreConflicts ){ + public function testMergeItems_conflict( $fromData, $toData, $ignoreConflicts ) { $fromId = new ItemId( 'Q1' ); $toId = new ItemId( 'Q2' ); diff --git a/repo/tests/phpunit/includes/actions/ActionTestCase.php b/repo/tests/phpunit/includes/actions/ActionTestCase.php index acdacd1..7e81dd7 100644 --- a/repo/tests/phpunit/includes/actions/ActionTestCase.php +++ b/repo/tests/phpunit/includes/actions/ActionTestCase.php @@ -276,6 +276,8 @@ /** * Creates a test item defined by $revisions. * + * @todo Provide this for all kinds of entities. + * * @param string $handle * @param array $revisions List of Entity or string. String values represent redirects. * @@ -283,7 +285,7 @@ * @throws MWException * @throws RuntimeException */ - private function createTestContent( $handle, array $revisions ) { //@todo: provide this for all kinds of entities. + private function createTestContent( $handle, array $revisions ) { global $wgUser; /** @var EntityRevision $rev */ diff --git a/repo/tests/phpunit/includes/api/EditEntityTest.php b/repo/tests/phpunit/includes/api/EditEntityTest.php index 0306bbf..48000c9 100644 --- a/repo/tests/phpunit/includes/api/EditEntityTest.php +++ b/repo/tests/phpunit/includes/api/EditEntityTest.php @@ -526,7 +526,7 @@ /** * @dataProvider provideExceptionData */ - public function testEditEntityExceptions( $params, $expected ){ + public function testEditEntityExceptions( $params, $expected ) { $this->injectIds( $params ); $this->injectIds( $expected ); diff --git a/repo/tests/phpunit/includes/api/LinkTitlesTest.php b/repo/tests/phpunit/includes/api/LinkTitlesTest.php index 8bb6962..db8eb0c 100644 --- a/repo/tests/phpunit/includes/api/LinkTitlesTest.php +++ b/repo/tests/phpunit/includes/api/LinkTitlesTest.php @@ -120,7 +120,7 @@ /** * @dataProvider provideLinkTitleExceptions */ - public function testLinkTitlesExceptions( $params, $expected ){ + public function testLinkTitlesExceptions( $params, $expected ) { // -- set any defaults ------------------------------------ $params['action'] = 'wblinktitles'; $this->doTestQueryExceptions( $params, $expected['exception'] ); diff --git a/repo/tests/phpunit/includes/api/MergeItemsTest.php b/repo/tests/phpunit/includes/api/MergeItemsTest.php index 2d631eb..4b29b40 100644 --- a/repo/tests/phpunit/includes/api/MergeItemsTest.php +++ b/repo/tests/phpunit/includes/api/MergeItemsTest.php @@ -165,7 +165,7 @@ /** * @dataProvider provideData */ - public function testMergeRequest( $pre1, $pre2, $expectedFrom, $expectedTo, $ignoreConflicts = null ){ + public function testMergeRequest( $pre1, $pre2, $expectedFrom, $expectedTo, $ignoreConflicts = null ) { // -- set up params --------------------------------- $params = array( 'action' => 'wbmergeitems', @@ -249,7 +249,7 @@ /** * @dataProvider provideExceptionParamsData */ - public function testMergeItemsParamsExceptions( $params, $expected ){ + public function testMergeItemsParamsExceptions( $params, $expected ) { // -- set any defaults ------------------------------------ $params['action'] = 'wbmergeitems'; @@ -277,7 +277,7 @@ /** * @dataProvider provideExceptionConflictsData */ - public function testMergeItemsConflictsExceptions( $pre1, $pre2 ){ + public function testMergeItemsConflictsExceptions( $pre1, $pre2 ) { $expected = array( 'exception' => array( 'type' => 'UsageException', 'code' => 'failed-save' ) ); // -- prefill the entities -------------------------------------------- diff --git a/repo/tests/phpunit/includes/api/ModifyTermTestCase.php b/repo/tests/phpunit/includes/api/ModifyTermTestCase.php index fd8cf0b..8d44c55 100644 --- a/repo/tests/phpunit/includes/api/ModifyTermTestCase.php +++ b/repo/tests/phpunit/includes/api/ModifyTermTestCase.php @@ -58,7 +58,7 @@ ); } - public function doTestSetTerm( $attribute ,$params, $expected ){ + public function doTestSetTerm( $attribute ,$params, $expected ) { // -- set any defaults ------------------------------------ $params['action'] = self::$testAction; if( !array_key_exists( 'id', $params ) ){ @@ -158,7 +158,7 @@ ); } - public function doTestSetTermExceptions( $params, $expected ){ + public function doTestSetTermExceptions( $params, $expected ) { // -- set any defaults ------------------------------------ $params['action'] = self::$testAction; diff --git a/repo/tests/phpunit/includes/api/ResultBuilderTest.php b/repo/tests/phpunit/includes/api/ResultBuilderTest.php index 183766c..d1f1fc6 100644 --- a/repo/tests/phpunit/includes/api/ResultBuilderTest.php +++ b/repo/tests/phpunit/includes/api/ResultBuilderTest.php @@ -33,7 +33,7 @@ */ class ResultBuilderTest extends \PHPUnit_Framework_TestCase { - protected function getDefaultResult( $indexedMode = false ){ + protected function getDefaultResult( $indexedMode = false ) { $result = new ApiResult( false ); if ( $indexedMode ) { @@ -43,7 +43,7 @@ return $result; } - protected function getResultBuilder( $result, $options = null ){ + protected function getResultBuilder( $result, $options = null ) { $mockTitle = $this->getMockBuilder( '\Title' ) ->disableOriginalConstructor() ->getMock(); @@ -90,7 +90,7 @@ return $builder; } - public function testCanConstruct(){ + public function testCanConstruct() { $result = $this->getDefaultResult(); $resultBuilder = $this->getResultBuilder( $result ); $this->assertInstanceOf( '\Wikibase\Api\ResultBuilder', $resultBuilder ); @@ -99,7 +99,7 @@ /** * @dataProvider provideBadConstructionData */ - public function testBadConstruction( $result ){ + public function testBadConstruction( $result ) { $this->setExpectedException( 'InvalidArgumentException' ); $this->getResultBuilder( $result ); } @@ -116,7 +116,7 @@ /** * @dataProvider provideMarkResultSuccess */ - public function testMarkResultSuccess( $param, $expected ){ + public function testMarkResultSuccess( $param, $expected ) { $result = $this->getDefaultResult(); $resultBuilder = $this->getResultBuilder( $result ); $resultBuilder->markSuccess( $param ); @@ -135,7 +135,7 @@ /** * @dataProvider provideMarkResultSuccessExceptions */ - public function testMarkResultSuccessExceptions( $param ){ + public function testMarkResultSuccessExceptions( $param ) { $this->setExpectedException( 'InvalidArgumentException' ); $result = $this->getDefaultResult(); $resultBuilder = $this->getResultBuilder( $result ); @@ -446,7 +446,7 @@ $this->assertEquals( $expected, $data ); } - public function testAddLabels(){ + public function testAddLabels() { $result = $this->getDefaultResult(); $labels = array( 'en' => 'foo', 'de' => 'bar' ); $path = array( 'entities', 'Q1' ); @@ -478,7 +478,7 @@ $this->assertEquals( $expected, $data ); } - public function testAddDescriptions(){ + public function testAddDescriptions() { $result = $this->getDefaultResult(); $descriptions = array( 'en' => 'foo', 'de' => 'bar' ); $path = array( 'entities', 'Q1' ); @@ -510,7 +510,7 @@ $this->assertEquals( $expected, $data ); } - public function testAddAliases(){ + public function testAddAliases() { $result = $this->getDefaultResult(); $aliases = array( 'en' => array( 'boo', 'hoo' ), 'de' => array( 'ham', 'cheese' ) ); $path = array( 'entities', 'Q1' ); @@ -554,7 +554,7 @@ $this->assertEquals( $expected, $data ); } - public function testAddSiteLinks(){ + public function testAddSiteLinks() { $result = $this->getDefaultResult(); $siteLinks = array( new SiteLink( 'enwiki', 'User:Addshore' ), @@ -591,7 +591,7 @@ $this->assertEquals( $expected, $data ); } - public function testAddClaims(){ + public function testAddClaims() { $result = $this->getDefaultResult(); $claim1 = new Claim( new PropertyValueSnak( new PropertyId( 'P12' ), new StringValue( 'stringVal' ) ) ); $claim1->setGuid( 'fooguidbar' ); @@ -632,7 +632,7 @@ $this->assertEquals( $expected, $data ); } - public function testAddClaim(){ + public function testAddClaim() { $result = $this->getDefaultResult(); $claim = new Claim( new PropertyValueSnak( new PropertyId( 'P12' ), new StringValue( 'stringVal' ) ) ); $claim->setGuid( 'fooguidbar' ); @@ -663,7 +663,7 @@ $this->assertEquals( $expected, $data ); } - public function testAddReference(){ + public function testAddReference() { $result = $this->getDefaultResult(); $reference = new Reference( new SnakList( array( new PropertyValueSnak( new PropertyId( 'P12' ), new StringValue( 'stringVal' ) ) ) ) ); $hash = $reference->getHash(); @@ -701,7 +701,7 @@ /** * @dataProvider provideMissingEntity */ - public function testAddMissingEntity( $missingEntities, $expected ){ + public function testAddMissingEntity( $missingEntities, $expected ) { $result = $this->getDefaultResult(); $resultBuilder = $this->getResultBuilder( $result ); @@ -787,7 +787,7 @@ ); } - public function testAddNormalizedTitle(){ + public function testAddNormalizedTitle() { $result = $this->getDefaultResult(); $from = 'berlin'; $to = 'Berlin'; diff --git a/repo/tests/phpunit/includes/api/SetAliasesTest.php b/repo/tests/phpunit/includes/api/SetAliasesTest.php index 4d75f81..8715a9e 100644 --- a/repo/tests/phpunit/includes/api/SetAliasesTest.php +++ b/repo/tests/phpunit/includes/api/SetAliasesTest.php @@ -85,7 +85,7 @@ /** * @dataProvider provideData */ - public function testSetAliases( $params, $expected ){ + public function testSetAliases( $params, $expected ) { // -- set any defaults ------------------------------------ $params['action'] = self::$testAction; if( !array_key_exists( 'id', $params ) ){ @@ -175,7 +175,7 @@ /** * @dataProvider provideExceptionData */ - public function testSetAliasesExceptions( $params, $expected ){ + public function testSetAliasesExceptions( $params, $expected ) { self::doTestSetTermExceptions( $params, $expected ); } } diff --git a/repo/tests/phpunit/includes/api/SetDescriptionTest.php b/repo/tests/phpunit/includes/api/SetDescriptionTest.php index 817c879..3b954d2 100644 --- a/repo/tests/phpunit/includes/api/SetDescriptionTest.php +++ b/repo/tests/phpunit/includes/api/SetDescriptionTest.php @@ -37,14 +37,14 @@ /** * @dataProvider provideData */ - public function testSetDescription( $params, $expected ){ + public function testSetDescription( $params, $expected ) { self::doTestSetTerm( 'descriptions' ,$params, $expected ); } /** * @dataProvider provideExceptionData */ - public function testSetDescriptionExceptions( $params, $expected ){ + public function testSetDescriptionExceptions( $params, $expected ) { self::doTestSetTermExceptions( $params, $expected ); } } diff --git a/repo/tests/phpunit/includes/api/SetLabelTest.php b/repo/tests/phpunit/includes/api/SetLabelTest.php index c7a118f..12a88fb 100644 --- a/repo/tests/phpunit/includes/api/SetLabelTest.php +++ b/repo/tests/phpunit/includes/api/SetLabelTest.php @@ -37,14 +37,14 @@ /** * @dataProvider provideData */ - public function testSetLabel( $params, $expected ){ + public function testSetLabel( $params, $expected ) { self::doTestSetTerm( 'labels' ,$params, $expected ); } /** * @dataProvider provideExceptionData */ - public function testSetLabelExceptions( $params, $expected ){ + public function testSetLabelExceptions( $params, $expected ) { self::doTestSetTermExceptions( $params, $expected ); } } diff --git a/repo/tests/phpunit/includes/rdf/RdfBuilderTest.php b/repo/tests/phpunit/includes/rdf/RdfBuilderTest.php index 0d82cba..e183766 100644 --- a/repo/tests/phpunit/includes/rdf/RdfBuilderTest.php +++ b/repo/tests/phpunit/includes/rdf/RdfBuilderTest.php @@ -30,8 +30,7 @@ * * @return RdfBuilderTestData */ - private function getTestData() - { + private function getTestData() { if ( empty( $this->testData ) ) { $this->testData = new RdfBuilderTestData( __DIR__ . "/../../data/rdf", __DIR__ . "/../../data/rdf" ); } -- To view, visit https://gerrit.wikimedia.org/r/215886 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7a21f551d9515b5e22eb338f6d715d0ecbe450cb Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> Gerrit-Reviewer: Addshore <addshorew...@gmail.com> Gerrit-Reviewer: JanZerebecki <jan.wikime...@zerebecki.de> Gerrit-Reviewer: Jeroen De Dauw <jeroended...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits