Skip to content

Commit caf0348

Browse files
committed
MC-24057: Implement static dependency analysis for wildcard and API urls
- Cylomatic complexity fix
1 parent fc1599e commit caf0348

File tree

1 file changed

+5
-2
lines changed
  • dev/tests/static/framework/Magento/TestFramework/Dependency

1 file changed

+5
-2
lines changed

dev/tests/static/framework/Magento/TestFramework/Dependency/PhpRule.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ protected function _caseGetUrl(string $currentModule, string &$contents, string
352352
* @param string $filePath
353353
* @return string[]
354354
* @throws NoSuchActionException
355+
* @SuppressWarnings(PMD.CyclomaticComplexity)
355356
*/
356357
private function processWildcardUrl(string $urlPath, string $filePath)
357358
{
@@ -377,8 +378,10 @@ private function processWildcardUrl(string $urlPath, string $filePath)
377378
) {
378379
return [];
379380
}
380-
$fileControllerIndex = array_search('adminhtml', $filePathPieces) ?:
381-
array_search('controller', $filePathPieces);
381+
$fileControllerIndex = array_search('adminhtml', $filePathPieces, true);
382+
if ($fileControllerIndex === false) {
383+
$fileControllerIndex = array_search('controller', $filePathPieces, true);
384+
}
382385

383386
$controllerName = array_shift($urlRoutePieces);
384387
if ('*' === $controllerName) {

0 commit comments

Comments
 (0)