@@ -314,31 +314,30 @@ foreach ($parsedRoutes as $key => $value) {
314
314
}
315
315
316
316
$ methodFunction = null ;
317
- $ isOCS = false ;
318
- $ isCORS = false ;
319
- $ isPublic = false ;
320
- $ isAdmin = true ;
321
- $ isDeprecated = false ;
322
- $ isIgnored = false ;
323
317
/** @var ClassMethod $classMethod */
324
318
foreach ($ nodeFinder ->findInstanceOf ($ controllerClass ->stmts , ClassMethod::class) as $ classMethod ) {
325
319
if ($ classMethod ->name == $ methodName ) {
326
- $ isCSRFRequired = !Helpers::classMethodHasAnnotationOrAttribute ($ classMethod , "NoCSRFRequired " );
327
- $ isOCS = $ controllerClass ->extends != "Controller " && $ controllerClass ->extends != "ApiController " ;
328
- if (!$ isCSRFRequired || $ isOCS ) {
329
- $ methodFunction = $ classMethod ;
330
- $ isCORS = Helpers::classMethodHasAnnotationOrAttribute ($ classMethod , "CORS " );
331
- $ isPublic = Helpers::classMethodHasAnnotationOrAttribute ($ classMethod , "PublicPage " );
332
- $ isAdmin = !Helpers::classMethodHasAnnotationOrAttribute ($ classMethod , "NoAdminRequired " ) && !$ isPublic ;
333
- $ isDeprecated = Helpers::classMethodHasAnnotationOrAttribute ($ classMethod , "deprecated " );
334
- $ isIgnored = Helpers::classMethodHasAnnotationOrAttribute ($ classMethod , "IgnoreOpenAPI " );
335
- break ;
336
- }
320
+ $ methodFunction = $ classMethod ;
321
+ break ;
337
322
}
338
323
}
339
324
if ($ methodFunction == null ) {
340
325
Logger::panic ($ routeName , 'Missing controller method ' );
341
326
}
327
+
328
+ $ isCSRFRequired = !Helpers::classMethodHasAnnotationOrAttribute ($ classMethod , "NoCSRFRequired " );
329
+ $ isOCS = $ controllerClass ->extends != "Controller " && $ controllerClass ->extends != "ApiController " ;
330
+ if ($ isCSRFRequired && !$ isOCS ) {
331
+ Logger::info ($ routeName , "Route ignored because of required CSRF in a non-OCS controller " );
332
+ continue ;
333
+ }
334
+
335
+ $ isCORS = Helpers::classMethodHasAnnotationOrAttribute ($ classMethod , "CORS " );
336
+ $ isPublic = Helpers::classMethodHasAnnotationOrAttribute ($ classMethod , "PublicPage " );
337
+ $ isAdmin = !Helpers::classMethodHasAnnotationOrAttribute ($ classMethod , "NoAdminRequired " ) && !$ isPublic ;
338
+ $ isDeprecated = Helpers::classMethodHasAnnotationOrAttribute ($ classMethod , "deprecated " );
339
+ $ isIgnored = Helpers::classMethodHasAnnotationOrAttribute ($ classMethod , "IgnoreOpenAPI " );
340
+
342
341
if ($ isIgnored ) {
343
342
Logger::info ($ routeName , "Route ignored because of IgnoreOpenAPI attribute " );
344
343
continue ;
0 commit comments