Addshore has uploaded a new change for review. https://gerrit.wikimedia.org/r/154412
Change subject: Add GenericPass test for MediaWikiBreaks standard ...................................................................... Add GenericPass test for MediaWikiBreaks standard Change-Id: Ied8fd51f6eab452de2be8b0fdf7485181e3e07e3 --- A MediaWikiBreaks/Tests/GenericPass.php M MediaWikiBreaks/Tests/MediaWikiBreaksStandardTest.php 2 files changed, 104 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/codesniffer refs/changes/12/154412/1 diff --git a/MediaWikiBreaks/Tests/GenericPass.php b/MediaWikiBreaks/Tests/GenericPass.php new file mode 100644 index 0000000..e56b7a5 --- /dev/null +++ b/MediaWikiBreaks/Tests/GenericPass.php @@ -0,0 +1,103 @@ +<?php + +// Many of these code snippets are taken from: +// https://www.mediawiki.org/wiki/Manual:Coding_conventions + +/** + * @param $outputtype + * @param null $ts + * @return null + */ +function wfTimestampOrNull( $outputtype = TS_UNIX, $ts = null ) { + if ( is_null( $ts ) ) { + return null; + } else { + return wfTimestamp( $outputtype, $ts ); + } +} + +$wgAutopromote = array( + 'autoconfirmed' => array( '&', + array( APCOND_EDITCOUNT, &$wgAutoConfirmCount ), + array( APCOND_AGE, &$wgAutoConfirmAge ), + ), +); + +$namespaceNames = array( + NS_MEDIA => 'Media', + NS_SPECIAL => 'Special', + NS_MAIN => '', +); + +class FooBar extends BarBaz implements SomethingSomewhere { + + private $foo = 'halalalalalaa'; + + public $var; + + public function iDoCaseStuff( $word ) { + switch ( $word ) { + case 'lorem': + case 'ipsum': + $bar = 2; + break; + case 'dolor': + $bar = 3; + break; + default: + $bar = 0; + } + return strtolower( $bar ) == 'on' + || strtolower( $bar ) == 'true' + || strtolower( $bar ) == 'yes' + || preg_match( "/^\s*[+-]?0*[1-9]/", $bar ); + } + + public function iDoCaseStuffTwo( $word ) { + switch ( $word ) { + case 'lorem': + case 'ipsum': + $bar = 2; + break; + case 'dolor': + $bar = 3; + break; + default: + $bar = 0; + } + return $bar; + } + + public function fooBarBaz( $par ) { + global $wgBarBarBar, $wgUser; + + if ( $par ) { + return; + } + + $wgBarBarBar->dobar( + Xml::fieldset( wfMessage( 'importinterwiki' )->text() ) . + Xml::openElement( 'form', array( 'method' => 'post', 'action' => $par, + 'id' => 'mw-import-interwiki-form' ) ) . + wfMessage( 'import-interwiki-text' )->parse() . + Xml::hidden( 'action', 'submit' ) . + Xml::hidden( 'source', 'interwiki' ) . + Xml::hidden( 'editToken', $wgUser->editToken() ), + 'secondArgument' + ); + + $foo = $par; + return $foo + $wgBarBarBar + $this->foo; + } + + private function someFunction( FooBar $baz ) { + $foo = array( + $baz, + 'memememememememee', + ); + $cat = array_merge( $foo, array( 'barn', 'door' ) ); + return $cat; + } +} + +// This file has a new line at the end! diff --git a/MediaWikiBreaks/Tests/MediaWikiBreaksStandardTest.php b/MediaWikiBreaks/Tests/MediaWikiBreaksStandardTest.php index 0a3d4c7..e9f5e77 100644 --- a/MediaWikiBreaks/Tests/MediaWikiBreaksStandardTest.php +++ b/MediaWikiBreaks/Tests/MediaWikiBreaksStandardTest.php @@ -22,6 +22,7 @@ */ protected function getExpectedResults() { return array( + 'GenericPass.php' => array(), 'RemovedStuff/Class.php' => array( 'error' => array( 4 => 1, -- To view, visit https://gerrit.wikimedia.org/r/154412 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ied8fd51f6eab452de2be8b0fdf7485181e3e07e3 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/tools/codesniffer Gerrit-Branch: master Gerrit-Owner: Addshore <addshorew...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits