mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TitleBlacklist
synced 2024-11-30 16:54:21 +00:00
Merge "Fix and enable 1 PHPCS exclusion"
This commit is contained in:
commit
6e24f2d1b7
|
@ -4,7 +4,6 @@
|
||||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
|
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
|
||||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected" />
|
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected" />
|
||||||
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic" />
|
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic" />
|
||||||
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment"/>
|
|
||||||
</rule>
|
</rule>
|
||||||
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
|
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
|
||||||
<exclude-pattern>Scribunto_LuaTitleBlacklistLibrary\.php</exclude-pattern>
|
<exclude-pattern>Scribunto_LuaTitleBlacklistLibrary\.php</exclude-pattern>
|
||||||
|
|
|
@ -125,7 +125,8 @@ class TitleBlacklist {
|
||||||
*/
|
*/
|
||||||
private static function getBlacklistText( $source ) {
|
private static function getBlacklistText( $source ) {
|
||||||
if ( !is_array( $source ) || count( $source ) <= 0 ) {
|
if ( !is_array( $source ) || count( $source ) <= 0 ) {
|
||||||
return ''; // Return empty string in error case
|
// Return empty string in error case
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $source['type'] == 'message' ) {
|
if ( $source['type'] == 'message' ) {
|
||||||
|
|
|
@ -172,7 +172,8 @@ class TitleBlacklistEntry {
|
||||||
* @return TitleBlacklistEntry|null
|
* @return TitleBlacklistEntry|null
|
||||||
*/
|
*/
|
||||||
public static function newFromString( $line, $source ) {
|
public static function newFromString( $line, $source ) {
|
||||||
$raw = $line; // Keep line for raw data
|
// Keep line for raw data
|
||||||
|
$raw = $line;
|
||||||
$options = [];
|
$options = [];
|
||||||
// Strip comments
|
// Strip comments
|
||||||
$line = preg_replace( "/^\\s*([^#]*)\\s*((.*)?)$/", "\\1", $line );
|
$line = preg_replace( "/^\\s*([^#]*)\\s*((.*)?)$/", "\\1", $line );
|
||||||
|
@ -187,7 +188,8 @@ class TitleBlacklistEntry {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$regex = trim( $pockets[1] );
|
$regex = trim( $pockets[1] );
|
||||||
$regex = str_replace( '_', ' ', $regex ); // We'll be matching against text form
|
// We'll be matching against text form
|
||||||
|
$regex = str_replace( '_', ' ', $regex );
|
||||||
$opts_str = isset( $pockets[3] ) ? trim( $pockets[3] ) : '';
|
$opts_str = isset( $pockets[3] ) ? trim( $pockets[3] ) : '';
|
||||||
// Parse opts
|
// Parse opts
|
||||||
$opts = preg_split( '/\s*\|\s*/', $opts_str );
|
$opts = preg_split( '/\s*\|\s*/', $opts_str );
|
||||||
|
|
Loading…
Reference in a new issue