Skip to content

Commit cfe945f

Browse files
committed
IgnoreList: minor change in method order
1 parent 57c222e commit cfe945f

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

src/Util/IgnoreList.php

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,37 @@ public static function getNewInstanceFrom(?IgnoreList $ignoreList)
8888
}//end getNewInstanceFrom()
8989

9090

91+
/**
92+
* Set the ignore status for a sniff.
93+
*
94+
* @param string $code Partial or complete sniff code.
95+
* @param bool $ignore Whether the specified sniff should be ignored.
96+
*
97+
* @return \PHP_CodeSniffer\Util\IgnoreList $this for chaining.
98+
*/
99+
public function set($code, $ignore)
100+
{
101+
$data = &$this->data;
102+
$parts = explode('.', $code);
103+
while (count($parts) > 1) {
104+
$part = array_shift($parts);
105+
if (isset($data[$part]) === false) {
106+
$data[$part] = [];
107+
} else if (is_bool($data[$part]) === true) {
108+
$data[$part] = [ '.default' => $data[$part] ];
109+
}
110+
111+
$data = &$data[$part];
112+
}
113+
114+
$part = array_shift($parts);
115+
$data[$part] = (bool) $ignore;
116+
117+
return $this;
118+
119+
}//end set()
120+
121+
91122
/**
92123
* Check whether a sniff code is ignored.
93124
*
@@ -120,37 +151,6 @@ public function isIgnored($code)
120151
}//end isIgnored()
121152

122153

123-
/**
124-
* Set the ignore status for a sniff.
125-
*
126-
* @param string $code Partial or complete sniff code.
127-
* @param bool $ignore Whether the specified sniff should be ignored.
128-
*
129-
* @return \PHP_CodeSniffer\Util\IgnoreList $this for chaining.
130-
*/
131-
public function set($code, $ignore)
132-
{
133-
$data = &$this->data;
134-
$parts = explode('.', $code);
135-
while (count($parts) > 1) {
136-
$part = array_shift($parts);
137-
if (isset($data[$part]) === false) {
138-
$data[$part] = [];
139-
} else if (is_bool($data[$part]) === true) {
140-
$data[$part] = [ '.default' => $data[$part] ];
141-
}
142-
143-
$data = &$data[$part];
144-
}
145-
146-
$part = array_shift($parts);
147-
$data[$part] = (bool) $ignore;
148-
149-
return $this;
150-
151-
}//end set()
152-
153-
154154
/**
155155
* Check if the list ignores nothing.
156156
*

0 commit comments

Comments
 (0)