-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sniffs for global variables skip dynamic names
The actual names could be pretty much everything, especially for a tool like PHPCS that really doesn't understand the program flow. Therefore, just avoid emitting any warning, and just skip ahead whenever a dynamic identifier is detected. Also: - Make a conditional explicitly check for T_VARIABLE, instead of checking that the token is not whitespace or comma and then proceeding to assume that it must be a variable. - Avoid overwriting a function parameter with a loop variable. Bug: T341393 Change-Id: If3555e448b7ae1785835b788785466d6f5d64a92
- Loading branch information
Showing
6 changed files
with
20 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
MediaWiki/Tests/files/NamingConventions/case_global_name.php.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
11 | ERROR | Global variable "$wgsomething" should use CamelCase: "$wgWgsomething" | ||
| | (MediaWiki.NamingConventions.ValidGlobalName.CamelCase) | ||
11 | ERROR | Global variable "$LocalInterwikis" is lacking an allowed prefix ('wg'). Should be | ||
| | "$wgLocalInterwikis". (MediaWiki.NamingConventions.ValidGlobalName.allowedPrefix) | ||
| | "$wgLocalInterwikis". (MediaWiki.NamingConventions.ValidGlobalName.allowedPrefix) | ||
12 | ERROR | Global variable "$thisIsWrong" is lacking an allowed prefix ('wg'). Should be | ||
| | "$wgThisIsWrong". (MediaWiki.NamingConventions.ValidGlobalName.allowedPrefix) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters