Thiemo Mättig (WMDE) has uploaded a new change for review.
https://gerrit.wikimedia.org/r/250998
Change subject: Simplify existing regular expressions
......................................................................
Simplify existing regular expressions
This does not change any semantics.
Change-Id: I1f9509248b3d25901e1593e422e117c36186f7c2
---
M MediaWiki/Sniffs/VariableAnalysis/UnusedGlobalVariablesSniff.php
M MediaWiki/Sniffs/WhiteSpace/SpaceBeforeSingleLineCommentSniff.php
2 files changed, 2 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/codesniffer
refs/changes/98/250998/1
diff --git a/MediaWiki/Sniffs/VariableAnalysis/UnusedGlobalVariablesSniff.php
b/MediaWiki/Sniffs/VariableAnalysis/UnusedGlobalVariablesSniff.php
index 33a3405..03421aa 100644
--- a/MediaWiki/Sniffs/VariableAnalysis/UnusedGlobalVariablesSniff.php
+++ b/MediaWiki/Sniffs/VariableAnalysis/UnusedGlobalVariablesSniff.php
@@ -40,7 +40,7 @@
$otherVariables[] = $tokens[$i]['content'];
}
if ( $tokens[$i]['type'] === 'T_DOUBLE_QUOTED_STRING'
|| $tokens[$i]['type'] === "T_HEREDOC" ) {
- preg_match_all( '/[$]\w+/',
$tokens[$i]['content'], $matches );
+ preg_match_all( '/\$\w+/',
$tokens[$i]['content'], $matches );
$strVariables = array_merge_recursive(
$strVariables, $matches );
}
}
diff --git a/MediaWiki/Sniffs/WhiteSpace/SpaceBeforeSingleLineCommentSniff.php
b/MediaWiki/Sniffs/WhiteSpace/SpaceBeforeSingleLineCommentSniff.php
index 0fc373f..a1bea4a 100644
--- a/MediaWiki/Sniffs/WhiteSpace/SpaceBeforeSingleLineCommentSniff.php
+++ b/MediaWiki/Sniffs/WhiteSpace/SpaceBeforeSingleLineCommentSniff.php
@@ -50,11 +50,7 @@
);
if ( $fix === true ) {
$content = $currToken['content'];
- if ( substr( $content, 2, 1 ) === '\t'
) {
- $newContent = preg_replace(
'/^\/\/\t/', '// ', $content );
- } else {
- $newContent = preg_replace(
'/^\/\//', '// ', $content );
- }
+ $newContent = preg_replace(
'/^\/\/\t?/', '// ', $content );
$phpcsFile->fixer->replaceToken(
$stackPtr, $newContent );
}
// Finding what the comment delimiter is and checking
whether there is a space
--
To view, visit https://gerrit.wikimedia.org/r/250998
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f9509248b3d25901e1593e422e117c36186f7c2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/codesniffer
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits