Skip to content

Commit 39f2600

Browse files
committed
Fixed bug #1656 : Using the --sniffs argument has a problem with case sensitivity
1 parent 8677199 commit 39f2600

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

package.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
2828
<notes>
2929
- Fixed bug #1604 : File::isReference has problems with some bitwise operators and class property references
3030
-- Thanks to Juliette Reinders Folmer for the patch
31-
- Fixed bug #1657: Uninitialized string offset: 0 when sniffing CSS
31+
- Fixed bug #1656 : Using the --sniffs argument has a problem with case sensitivity
32+
- Fixed bug #1657 : Uninitialized string offset: 0 when sniffing CSS
3233
- Fixed bug #1669 : Temporary expression proceeded by curly brace is detected as function call
3334
</notes>
3435
<contents>

src/Files/File.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ public function __construct($path, Ruleset $ruleset, Config $config)
224224
}
225225

226226
$this->configCache['cache'] = $this->config->cache;
227-
$this->configCache['sniffs'] = $this->config->sniffs;
228-
$this->configCache['exclude'] = $this->config->exclude;
227+
$this->configCache['sniffs'] = array_map('strtolower', $this->config->sniffs);
228+
$this->configCache['exclude'] = array_map('strtolower', $this->config->exclude);
229229
$this->configCache['errorSeverity'] = $this->config->errorSeverity;
230230
$this->configCache['warningSeverity'] = $this->config->warningSeverity;
231231
$this->configCache['recordErrors'] = $this->config->recordErrors;
@@ -815,9 +815,9 @@ protected function addMessage($error, $message, $line, $column, $code, $data, $s
815815
// due to the use of the --sniffs command line argument.
816816
if ($includeAll === false
817817
&& ((empty($this->configCache['sniffs']) === false
818-
&& in_array($listenerCode, $this->configCache['sniffs']) === false)
818+
&& in_array(strtolower($listenerCode), $this->configCache['sniffs']) === false)
819819
|| (empty($this->configCache['exclude']) === false
820-
&& in_array($listenerCode, $this->configCache['exclude']) === true))
820+
&& in_array(strtolower($listenerCode), $this->configCache['exclude']) === true))
821821
) {
822822
return false;
823823
}

0 commit comments

Comments
 (0)