Merge "Fix and enable 1 PHPCS exclusion"

This commit is contained in:
jenkins-bot 2022-04-28 16:00:36 +00:00 committed by Gerrit Code Review
commit 6e24f2d1b7
3 changed files with 6 additions and 4 deletions

View file

@ -4,7 +4,6 @@
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic" />
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment"/>
</rule>
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
<exclude-pattern>Scribunto_LuaTitleBlacklistLibrary\.php</exclude-pattern>

View file

@ -125,7 +125,8 @@ class TitleBlacklist {
*/
private static function getBlacklistText( $source ) {
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' ) {

View file

@ -172,7 +172,8 @@ class TitleBlacklistEntry {
* @return TitleBlacklistEntry|null
*/
public static function newFromString( $line, $source ) {
$raw = $line; // Keep line for raw data
// Keep line for raw data
$raw = $line;
$options = [];
// Strip comments
$line = preg_replace( "/^\\s*([^#]*)\\s*((.*)?)$/", "\\1", $line );
@ -187,7 +188,8 @@ class TitleBlacklistEntry {
return null;
}
$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] ) : '';
// Parse opts
$opts = preg_split( '/\s*\|\s*/', $opts_str );