Review main Merged Breaking

90459[!!!][TASK] Introduce strict typing for Cache BE and FE

Sascha Nowak CR +2 V +2 Nightmare +684 −1861 updated 04/23/26, 01:48

Commit message

This change modernizes the Cache component by introducing
comprehensive native type declarations across all Backend and
Frontend interfaces and implementations, ensuring type safety
and improved developer experience.

Changes include:

* Strict typing to BackendInterface methods
* Strict typing to FrontendInterface methods
* Strict typing to PhpCapableBackendInterface methods
* Strict typing to TransientBackendInterface methods
* Remove backward compatibility parameter in the constructor of
  AbstractBackend, new: __construct(array $options = [])
* Remove methods in AbstractBackend: calculateExpiryTime(),
  flushByTags()
* Update Backend implementations to match interface signatures
* Update Frontend implementations to match interface signatures
* Utilize PHP 8.0+ mixed type for flexible data handling
* Ensure consistent parameter and return type declarations

The migration maintains backward compatibility for typical usage
patterns while enforcing stricter type contracts for implementors.
All existing core cache backends and frontends have been updated
accordingly.

This change aligns the Cache component with modern PHP typing
standards and provides better IDE support, static analysis
capabilities, and runtime type safety.

Breaking: Extension authors who implement custom cache backends
or frontends must update their method signatures to match the
new strict type declarations.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Christian Kuhn +1
    • Sascha Nowak +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Christian Kuhn +1
    • Sascha Nowak +1
    • core-ci +1 CI

Issues 1

Files 51

Show 31 more files

Review log 6796

Show 4771 earlier messages
  1. Sascha Nowak uploaded patch set 1 08/19/25, 17:40

  2. Sascha Nowak marked it work in progress 08/19/25, 17:40

  3. core-ci voted on patch set 1 V -1 08/19/25, 17:44 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83622

  4. Sascha Nowak uploaded patch set 2 V -1 08/19/25, 18:10

  5. core-ci voted on patch set 2 V -1 08/19/25, 18:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83623

  6. Sascha Nowak uploaded patch set 3 V -1 08/19/25, 18:42

  7. Sascha Nowak uploaded patch set 4 08/19/25, 18:52

  8. core-ci voted on patch set 3 V -1 08/19/25, 18:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83625

  9. core-ci voted on patch set 4 V -1 08/19/25, 19:02 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83626

  10. Sascha Nowak uploaded patch set 5 V -1 08/19/25, 19:06

  11. core-ci voted on patch set 5 V -1 08/19/25, 19:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83627

  12. Sascha Nowak uploaded patch set 6 V -1 08/19/25, 19:17

  13. core-ci voted on patch set 6 V +1 08/19/25, 19:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83628

  14. Sascha Nowak uploaded patch set 7 V +1 08/19/25, 19:35

  15. Sascha Nowak commented on patch set 7 08/19/25, 19:39

    This change is ready for review.
  16. Sascha Nowak uploaded patch set 8 08/19/25, 19:41

  17. core-ci voted on patch set 7 V +1 08/19/25, 19:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83629

  18. Garvin Hicking commented on patch set 8 08/19/25, 19:46

    Could we addd declare(strict_types) lines to some of these files (all?) (thanks so much for your work!)
  19. core-ci voted on patch set 8 V +1 08/19/25, 19:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83630

  20. Garvin Hicking commented on patch set 8 08/19/25, 20:05

    Reply

    (unresolving) Example: PhpFrontend.php
  21. Sascha Nowak uploaded patch set 9 V +1 08/19/25, 20:10

  22. Sascha Nowak commented on patch set 9 08/19/25, 20:12

    Reply

    declare(strict_types) is now added to all files.
  23. core-ci voted on patch set 9 V -1 08/19/25, 20:20 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83632

  24. Sascha Nowak uploaded patch set 10 V -1 08/19/25, 20:31

  25. Sascha Nowak commented on patch set 10 08/19/25, 20:32

    Reply

    Done
  26. Benni Mack commented on patch set 10 08/19/25, 20:36

    AbstractBackend.php:49

    we can drop the context now as well, if we're breaking here, let's do this as well IMHO
  27. core-ci voted on patch set 10 V -1 08/19/25, 20:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83633

  28. Sascha Nowak uploaded patch set 11 V -1 08/19/25, 21:10

  29. Sascha Nowak commented on patch set 11 08/19/25, 21:11

    AbstractBackend.php:49 Reply

    Done
  30. Sascha Nowak uploaded patch set 12 08/19/25, 21:13

  31. Sascha Nowak uploaded patch set 13 08/19/25, 21:16

  32. core-ci voted on patch set 11 V -1 08/19/25, 21:23 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83635

  33. core-ci voted on patch set 12 V -1 08/19/25, 21:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83636

  34. core-ci voted on patch set 13 V -1 08/19/25, 21:26 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83637

  35. Sascha Nowak uploaded patch set 14 V -1 08/19/25, 21:27

  36. Sascha Nowak uploaded patch set 15 08/19/25, 21:33

  37. core-ci voted on patch set 14 V -1 08/19/25, 21:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83638

  38. core-ci voted on patch set 15 V +1 08/19/25, 21:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83639

  39. Andreas Kienast commented on patch set 15 08/20/25, 04:41

    Breaking-107315-CacheBackendAndFrontendRelatedChanges.rst:44

    You need a blank line between the "header" and the first bullet list point, otherwise the rendering gets borked.
  40. Sascha Nowak uploaded patch set 16 V +1 08/20/25, 06:17

  41. Sascha Nowak commented on patch set 15 08/20/25, 06:18

    Breaking-107315-CacheBackendAndFrontendRelatedChanges.rst:44 Reply

    Thanks for the hint. Done
  42. core-ci voted on patch set 16 V +1 08/20/25, 06:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83656

  43. Stefan Froemken updated the commit message in patch set 17 V +1 08/22/25, 08:38

  44. core-ci voted on patch set 17 V +1 08/22/25, 08:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83748

  45. Stefan Froemken commented on patch set 17 08/22/25, 08:45

    You also have removed the calculateExpiryTime method. It was not used by core itself, but may be used by other backends. Should be mentioned in your rst file.
  46. Sascha Nowak uploaded patch set 18 V +1 08/25/25, 07:30

  47. Sascha Nowak commented on patch set 18 08/25/25, 07:31

    Reply

    Done
  48. core-ci voted on patch set 18 V +1 08/25/25, 07:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83841

  49. Benni Mack commented on patch set 18 09/12/25, 14:40

    Hey Sascha, I'm ready for this one ;). Can you rebase? Also, we should evaluate if we can work with PSR-16 (Simple Cache) to streamline our interfaces towards that?
  50. Sascha Nowak uploaded patch set 19 V +1 09/12/25, 16:11

  51. core-ci voted on patch set 19 V -1 09/12/25, 16:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84926

  52. Sascha Nowak uploaded patch set 20 V -1 09/12/25, 16:25

  53. core-ci voted on patch set 20 V -1 09/12/25, 16:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84927

  54. Sascha Nowak uploaded patch set 21 V -1 09/12/25, 16:35

  55. core-ci voted on patch set 21 V +1 09/12/25, 16:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/84928

  56. Sascha Nowak commented on patch set 21 09/12/25, 16:50

    Reply

    Hey Benni, the change is now rebased. Regarding the PSR-16 streamlining: since PSR-16 doesn’t support cache tags, alignment is tricky—do you have any suggestions?
  57. Benni Mack commented on patch set 21 09/12/25, 18:00

    Reply

    Thanks, I thought about this - but I'm not sure if this is useful / DX improvements to strive towards https://github.com/php-fig/simple-cache/blob/master/src/CacheInterface.php - last time I checked, symfony adds their own taggableInterface etc. on top of PSR-16, so they're also kind of "doing their own". Well, might as well be that PSR-6/16 has failed. So yes, let's keep it this way.
  58. Benni Mack uploaded patch set 22 V +1 09/23/25, 15:05

  59. Benni Mack voted on patch set 22 CR +1 09/23/25, 15:05

  60. core-ci voted on patch set 22 V +1 09/23/25, 15:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/85394

  61. Benni Mack voted on patch set 22 V +1 09/23/25, 15:32

  62. Sven Liebert commented on patch set 22 CR -1 V -1 10/18/25, 17:03

    RedisBackend.php:99

    This is breaking the current workaround to set username and password for redis authentication. https://review.typo3.org/c/Packages/TYPO3.CMS/+/91151 is handling that while adding a new property. Within deprecation property we can not cast that right now to string. We need to cast it to array|string.
  63. Sven Liebert commented on patch set 22 10/18/25, 17:04

    RedisBackend.php:99 Reply

    *deprecation policy
  64. Simon Schaufelberger uploaded patch set 23 CR +1 V +1 11/07/25, 18:21

  65. core-ci voted on patch set 23 V +1 11/07/25, 18:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88667

  66. Sascha Nowak commented on patch set 23 11/08/25, 10:24

    RedisBackend.php:99 Reply

    Done
  67. Oliver Klee voted on patch set 23 V +1 11/08/25, 10:56

  68. Christian Kuhn uploaded patch set 24 V +1 11/20/25, 11:52

  69. Christian Kuhn commented on patch set 24 11/20/25, 11:54

    rebased for now.
  70. core-ci voted on patch set 24 V +1 11/20/25, 12:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90274

  71. Oliver Klee voted on patch set 24 V +1 11/20/25, 12:05

  1. Lina Wolf commented on patch set 24 11/20/25, 12:21

    NullBackend.php:26

    Can the information that these parameters are being ignored really be omitted?

    NullBackend.php:89

    And if so, this one can probably also be removed
  2. Lina Wolf commented on patch set 24 11/20/25, 12:28

    AbstractBackend.php:138

    How is removing this method from the Abstract backend related to hardening types?
  3. Christian Kuhn commented on patch set 24 11/20/25, 13:41

    ApcuBackend.php:153

    in the end, there is not good reason to have this back-reference from backend to frontend at all, as far as i can see. we should consider getting rid of it entirely.

    NullBackend.php:26 Reply

    its obvious
  4. Christian Kuhn uploaded patch set 25 V +1 11/20/25, 15:07

  5. core-ci voted on patch set 25 V -1 11/20/25, 15:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90302

  6. Christian Kuhn uploaded patch set 26 V -1 11/20/25, 16:05

  7. core-ci voted on patch set 26 V +1 11/20/25, 16:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90314

  8. Oliver Klee voted on patch set 26 V +1 11/20/25, 16:27

  9. Christian Kuhn uploaded patch set 27 V +1 11/20/25, 17:27

  10. core-ci voted on patch set 27 V +1 11/20/25, 17:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90334

  11. Oliver Klee voted on patch set 27 V +1 11/20/25, 17:40

  12. Christian Kuhn uploaded patch set 28 V +1 11/20/25, 17:42

  13. core-ci voted on patch set 28 V +1 11/20/25, 17:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90339

  14. Oliver Klee voted on patch set 28 V +1 11/20/25, 17:52

  15. Christian Kuhn commented on patch set 28 11/20/25, 18:22

    AbstractBackend.php:138 Reply

    Done

    ApcuBackend.php:153 Reply

    i relaxed that now by still having and calling setCache(), but no longer setting the frontend instance as property. the loop dependency itself (create backend, create frontend with handing over backend instance, then call backend to give it the frontend) can not be resolved easily especially due to the file backends which derive storage details from the frontend type.

    NullBackend.php:89 Reply

    Done
  16. Sascha Nowak voted on patch set 28 CR +1 V +1 11/20/25, 18:31

  17. Christian Kuhn uploaded patch set 29 CR +1 V +1 11/20/25, 18:33

  18. Christian Kuhn voted on patch set 29 CR +1 V +1 11/20/25, 18:34

  19. Sascha Nowak voted on patch set 29 CR +1 V +1 11/20/25, 18:36

  20. Oliver Klee voted on patch set 29 V +1 11/20/25, 18:39

  21. core-ci voted on patch set 29 V +1 11/20/25, 18:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90348

  22. Benni Mack voted on patch set 29 CR +2 V +2 11/20/25, 20:08

  23. Benni Mack merged patch set 30 11/20/25, 20:08

  24. Benjamin Franzke commented on patch set 30 04/21/26, 10:24

    Typo3DatabaseBackend.php:326

    I think this caused a configuration-regression, see https://forge.typo3.org/issues/109664 for more details
  25. Christian Kuhn commented on patch set 30 04/23/26, 01:48

    Typo3DatabaseBackend.php:326 Reply