Skip to content

Commit 6f78d8c

Browse files
committed
Fixed bug #2992 : Enabling caching using a ruleset produces invalid cache files when using --sniffs and --exclude CLI args
1 parent a5578a2 commit 6f78d8c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Ruleset.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,9 @@ class Ruleset
134134
*/
135135
public function __construct(Config $config)
136136
{
137-
// Ignore sniff restrictions if caching is on.
138-
$restrictions = [];
139-
$exclusions = [];
140-
if ($config->cache === false) {
141-
$restrictions = $config->sniffs;
142-
$exclusions = $config->exclude;
143-
}
144-
145137
$this->config = $config;
138+
$restrictions = $config->sniffs;
139+
$exclusions = $config->exclude;
146140
$sniffs = [];
147141

148142
$standardPaths = [];
@@ -208,6 +202,12 @@ public function __construct(Config $config)
208202
$sniffs = array_merge($sniffs, $this->processRuleset($standard));
209203
}//end foreach
210204

205+
// Ignore sniff restrictions if caching is on.
206+
if ($config->cache === true) {
207+
$restrictions = [];
208+
$exclusions = [];
209+
}
210+
211211
$sniffRestrictions = [];
212212
foreach ($restrictions as $sniffCode) {
213213
$parts = explode('.', strtolower($sniffCode));

0 commit comments

Comments
 (0)