@@ -88,6 +88,37 @@ public static function getNewInstanceFrom(?IgnoreList $ignoreList)
88
88
}//end getNewInstanceFrom()
89
89
90
90
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
+
91
122
/**
92
123
* Check whether a sniff code is ignored.
93
124
*
@@ -120,37 +151,6 @@ public function isIgnored($code)
120
151
}//end isIgnored()
121
152
122
153
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
-
154
154
/**
155
155
* Check if the list ignores nothing.
156
156
*
0 commit comments