for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
//For now, this is an example of how a plugin would work with more than one function to a class.
/**
* This file is part of Peachy MediaWiki Bot API
*
* Peachy 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 3 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, see <http://www.gnu.org/licenses/>.
*/
class CheckUser {
public function __construct(Wiki &$wikiclass = null)
$wikiclass
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
{
$extensions = $wikiClass->get_extensions();
$wikiClass
This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.
The variable may have been renamed without also renaming all references.
if( !array_key_exists( 'CheckUser', $extensions ) ) {
throw new DependencyError( "CheckUser", "http://www.mediawiki.org/wiki/Extension:CheckUser" );
'http://www.mediawiki.or...ki/Extension:CheckUser'
string
boolean
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
} elseif( $extensions['CheckUser'] < 3 ) {
throw new DependencyError( "CheckUser version 3.0 or up", "http://www.mediawiki.org/wiki/Extension:CheckUser" );
}
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.