Review main Merged

96215[TASK] Extract the extension scanner into a service

Olivier Dobberkau CR +2 V +2 Expert +1380 −189 updated 10/07/26, 15:32

Commit message

The extension scanner was only reachable through the install tool: the
scan loop lived inline in
UpgradeController::extensionScannerScanFileAction() and the 23 matchers
were a hardcoded property of the same controller, so no other caller,
such as a console command, could reuse them.

The matcher registry now lives in its own class, and scanning a file is
done by the new ExtensionScannerService, which returns typed results:
ScanResult per file, ScanMatch per finding and the Indicator enum,
backed by the existing values "strong" and "weak". The service also
finds the files to scan below a path. All of them are internal to
EXT:install.

UpgradeController delegates to the service, so the output of the
"Scan Extension Files" card is unchanged.

Review

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

Issues 2

Files 17

Review log 2126

Show 1 earlier messages
  1. Olivier Dobberkau uploaded patch set 1 09/30/26, 11:53

  1. core-ci voted on patch set 1 V -1 09/30/26, 12:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109619

  2. Garvin Hicking commented on patch set 1 09/30/26, 13:59

    MatcherRegistry.php:60

    I think if we extract this as public API, we need a public API to provide additional matches. We should take the extra time to do a tagged service and service locator for these matchers IMO.
  3. Benni Mack commented on patch set 1 09/30/26, 15:06

    I don't consider this a Feature yet, but rather a pre-patch and refactoring, which could also go into v14 as well.
  4. Benni Mack commented on patch set 1 09/30/26, 15:07

    RemovedFixtureClass.php:3

    please add our standard header for PHP files. also below for all new PHP files
  5. Olivier Dobberkau uploaded patch set 2 V -1 09/30/26, 15:41

  6. core-ci voted on patch set 2 V -1 09/30/26, 15:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109665

  7. Mathias Brodala commented on patch set 2 10/01/26, 07:15

    ExtensionScannerService.php:47

    Tiny nitpick: why not simply "ExtensionScanner"?
  8. Olivier Dobberkau uploaded patch set 3 V -1 10/01/26, 21:10

  9. core-ci voted on patch set 3 V +1 10/01/26, 21:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109842

  10. Olivier Dobberkau commented on patch set 3 10/01/26, 21:36

    AI-assisted contribution: prepared with Claude Code under my supervision. I reviewed every line of the diff, ran unit, functional, phpstan and cgl locally and take responsibility for this change. Patch set 3 addresses the review: it is now a [TASK] with its own issue #110877, all new classes are @internal and the Feature rst is gone. Releases: main, 14.3. As 14.3 requires PHP 8.2, the backport will be an adapted patch once main is merged. #110859 stays with the console command in https://review.typo3.org/c/Packages/TYPO3.CMS/+/96216.
  11. Olivier Dobberkau commented on patch set 3 10/01/26, 21:43

    Reply

    Agreed, thanks. Turned into a [TASK] (#110877), internal only, with Releases: main, 14.3. See the patch set comment for the backport.

    ExtensionScannerService.php:47 Reply

    ExtensionScanner is already the namespace, so the class would be ExtensionScanner\ExtensionScanner. The Service suffix avoids that and matches the neighbouring …Service classes of EXT:install (ClearCacheService, CoreVersionService, LateBootService, …).

    MatcherRegistry.php:60 Reply

    Good point. With patch set 3 the service and MatcherRegistry are @internal, so no public API is created here. A tagged service plus service locator, so that extensions can contribute matchers, deserves its own change; I'd do it as a follow-up and keep this one a pure refactoring that can be backported.

    RemovedFixtureClass.php:3 Reply

    Done in patch set 2: all new PHP files, fixtures included, carry the standard header.
  12. Olivier Dobberkau commented on patch set 3 10/01/26, 21:48

    Reply

    Acknowledged

    ExtensionScannerService.php:47 Reply

    Acknowledged

    RemovedFixtureClass.php:3 Reply

    Acknowledged
  13. Olivier Dobberkau commented on patch set 3 10/01/26, 21:50

    Reply

    Acknowledged
  14. Simon Schaufelberger commented on patch set 3 10/01/26, 23:57

    ScanMatch.php:33

    the indentation doesn't look right. I guess one less white space so that it aligns well with Opaque?

    ExtensionScannerServiceTest.php:36

    i would move private methods all the way to the end of the file
  15. Garvin Hicking commented on patch set 3 10/02/26, 05:29

    MatcherRegistry.php:60 Reply

    Agreed, thanks!
  16. Olivier Dobberkau uploaded patch set 4 V +1 10/02/26, 07:42

  17. core-ci voted on patch set 4 V +1 10/02/26, 07:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109886

  18. Simon Schaufelberger commented on patch set 4 CR +1 V +1 10/02/26, 09:57

    ScanMatch.php:33 Reply

    Done

    ExtensionScannerServiceTest.php:36 Reply

    Done
  19. Garvin Hicking uploaded patch set 5 CR +1 V +1 10/02/26, 11:03

  20. Garvin Hicking commented on patch set 5 CR +1 V +1 10/02/26, 11:03

    Reply

    Done
  21. Olivier Dobberkau commented on patch set 5 10/02/26, 11:07

    Reply

    Thanks for patch set 5, Garvin, especially for fixing the misplaced @internal docblock.
  22. core-ci voted on patch set 5 V +1 10/02/26, 11:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109919

  23. Garvin Hicking commented on patch set 5 10/02/26, 11:23

    Reply

    Thanks for pushing this forward. This was something I had on my wishlist for a long time, to be able to re-use these component. Hope it carries. 😊
  24. Benni Mack voted on patch set 5 CR +2 V +2 10/07/26, 15:32

  25. Benni Mack merged patch set 6 10/07/26, 15:32