Review 13.4 Merged

87017[TASK] Add MethodCallArgumentValue PhpScanner analysis

Garvin Hicking CR +2 V +2 Hard +508 −0 updated 11/18/24, 16:44

Commit message

The static code scanner is now able to inspect scalar
value arguments in static or non-static method calls.

This allows for example to inspect calls to:

  TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin()
  TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin()

and see if for example the second argument contains the
value 'list_type'.

Since this is done via static code analysis, this does NOT work
dynamic variable assignments like:

```
$somevar = 'list_type';
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(
    $arg1,
    $somevar
)
```

or other nested method calls:

```
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(
    $arg1,
    Helper::getArgument(),
)
```

Fully qualified static method calls are resolved as a 'strong' match,
non-static method calls as 'weak' matches.

Multiple entries in the 'argumentMatches' configuration allow
to match multiple arguments (AND combined).

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
  • Verified V +2 Done
    • Garvin Hicking +2
    • core-ci +1 CI

Issues 3

Files 5

Review log 34

  1. Garvin Hicking commented on patch set 1 11/18/24, 16:16

    Cherry Picked from branch main.
  2. core-ci voted on patch set 1 V +1 11/18/24, 16:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69607

  3. Garvin Hicking voted on patch set 1 CR +2 V +2 11/18/24, 16:43

  4. Garvin Hicking merged patch set 2 11/18/24, 16:44