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.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>

View file

@ -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' ) {

View file

@ -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 );