Re-enable MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic sniff

Bug: T168384
Change-Id: I4d4681121df974a8471d7c4c8df8a6158f8df22a
This commit is contained in:
Piotr Miazga 2017-07-12 22:41:53 +02:00
parent 8ea2211719
commit c0052fcb08
6 changed files with 37 additions and 3 deletions

View file

@ -27,6 +27,11 @@ interface EventLogger {
*/
const PREVIEWS_SCHEMA_NAME = 'Popups';
/**
* Log event
*
* @param array $event An associative array containing event data
*/
public function log( array $event );
}

View file

@ -31,16 +31,24 @@ class EventLoggerFactory {
private $registry;
/**
* @var \Config
* @var Config
*/
private $config;
/**
* EventLoggerFactory constructor
*
* @param Config $config MediaWiki config
* @param ExtensionRegistry $registry MediaWiki extension registry
*/
public function __construct( Config $config, ExtensionRegistry $registry ) {
$this->registry = $registry;
$this->config = $config;
}
/**
* Get the EventLogger instance
*
* @return EventLogger
*/
public function get() {

View file

@ -58,9 +58,14 @@ class MWEventLogger implements EventLogger {
return (float)wfRandom() <= (float)$samplingRate;
}
/**
* Log event
*
* @param array $event An associative array containing event data
*/
public function log( array $event ) {
if ( !$this->shouldLog() ) {
return false;
return;
}
$eventLoggingSchemas = $this->registry->getAttribute( 'EventLoggingSchemas' );

View file

@ -22,6 +22,11 @@ namespace Popups\EventLogging;
class NullLogger implements EventLogger {
/**
* Log event
*
* @param array $event An associative array containing event data
*/
public function log( array $event ) {
// just do nothing
}

View file

@ -33,6 +33,11 @@ use ResourceLoader;
class PopupsHooks {
const PREVIEWS_PREFERENCES_SECTION = 'rendering/reading';
/**
* Hook executed on retrieving User beta preferences
* @param User $user User whose beta preferences are retrieved
* @param array &$prefs An associative array of all beta preferences
*/
static function onGetBetaPreferences( User $user, array &$prefs ) {
global $wgExtensionAssetsPath;
if ( PopupsContext::getInstance()->isBetaFeatureEnabled() !== true ) {
@ -95,6 +100,13 @@ class PopupsHooks {
}
}
/**
* Allows last minute changes to the output page, e.g. adding of CSS or JavaScript by extensions.
*
* @param OutputPage &$out The Output page object
* @param Skin &$skin &Skin object that will be used to generate the page
* @return bool
*/
public static function onBeforePageDisplay( OutputPage &$out, Skin &$skin ) {
$module = PopupsContext::getInstance();
$user = $out->getUser();

View file

@ -1,7 +1,6 @@
<?xml version="1.0"?>
<ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
</rule>
<file>.</file>
<arg name="extensions" value="php,php5,inc" />