File tree Expand file tree Collapse file tree 3 files changed +35
-8
lines changed Expand file tree Collapse file tree 3 files changed +35
-8
lines changed Original file line number Diff line number Diff line change @@ -330,7 +330,7 @@ public static function isHookClosure(
330330 }
331331
332332 $ lookForComma = $ file ->findPrevious (
333- [T_WHITESPACE ],
333+ [T_WHITESPACE , T_STATIC ],
334334 $ closurePosition - 1 ,
335335 null ,
336336 true ,
Original file line number Diff line number Diff line change @@ -60,6 +60,13 @@ function ($foo) {
6060 }
6161);
6262
63+ add_filter (
64+ 'foo ' ,
65+ static function ($ foo ) {
66+ return true ;
67+ }
68+ );
69+
6370array_map (
6471 function ($ foo ) { // @phpcsWarningOnThisLine
6572
@@ -173,15 +180,31 @@ function (PHPUnit\Exception $meh = null) use ($baz)
173180class ArgumentTypeDeclarationSniffTestFixture
174181{
175182 // @phpcsWarningOnNextLine
176- function a ($ bar )
183+ public function a ($ bar )
177184 {
178185 function (array $ baz ) use ($ bar )
179186 {
180187
181188 }
182189 }
183190
184- function b(array $ bar )
191+ // @phpcsWarningOnNextLine
192+ private function ap ($ bar )
193+ {
194+ function (array $ baz ) use ($ bar )
195+ {
196+
197+ }
198+ }
199+
200+ /**
201+ * @wp-hook foo
202+ */
203+ private function theHook ($ param )
204+ {
205+ }
206+
207+ protected function b(array $ bar )
185208 {
186209 function (array $ baz ) use ($ bar )
187210 {
@@ -193,7 +216,7 @@ function ($meh) use ($baz)
193216 }
194217 }
195218
196- function c(array $ bar )
219+ private function c(array $ bar )
197220 {
198221
199222 function (array $ baz ) use ($ bar )
Original file line number Diff line number Diff line change @@ -184,6 +184,10 @@ function genMultiReturn(): \Generator
184184 return '' ;
185185});
186186
187+ add_filter ('x ' , static function () {
188+ return '' ;
189+ });
190+
187191// @phpcsErrorCodeOnNextLine IncorrectVoidReturnType
188192add_filter ('x ' , function (): void {
189193 return '0 ' ;
@@ -243,7 +247,7 @@ function noHookCallback() // @phpcsWarningCodeOnThisLine NoReturnType
243247class WrapperHookWrapper
244248{
245249
246- function filterWrapper (string $ x , int $ y ): bool
250+ public function filterWrapper (string $ x , int $ y ): bool
247251 {
248252
249253 // @phpcsWarningCodeOnNextLine NoReturnType
@@ -275,7 +279,7 @@ function ($x, $y) {
275279 }
276280
277281 // @phpcsWarningCodeOnNextLine NoReturnType
278- function problematicMethod ()
282+ protected function problematicMethod ()
279283 {
280284 return 'x ' ;
281285 }
@@ -284,13 +288,13 @@ function problematicMethod()
284288 * @return string
285289 * @wp-hook Meh
286290 */
287- function hookMethod ()
291+ private function hookMethod ()
288292 {
289293 return 'x ' ;
290294 }
291295
292296 // @phpcsErrorCodeOnNextLine IncorrectVoidReturn
293- function problematicMethodTwo (): bool
297+ protected function problematicMethodTwo (): bool
294298 {
295299 if (true ) {
296300 return true ;
You can’t perform that action at this time.
0 commit comments