Review main Merged

78209[TASK] Avoid protected & private data providers

Christian Kuhn CR +2 V +2 Normal +14 −74 updated 03/22/23, 11:58

Commit message

phpunit test data providers had to be public ever
since [1]. phpunit calls them using reflection.

With PHP 8.1, setAccessible() does not need
to be called anymore, methods are always
considered accessible via Reflection [2], so
they can be technically set to protected or
private with phpunit ^9.

phpunit ^10 however actively deprecates
non-public (and non-static) data providers.

In main, a couple of test data providers were
set to protected or private during v12 development,
using the PHP 8.1 'always accessible' feature.

The patch declares affected data providers public,
and adds the static keyword along the way. This also
makes phpstan a bit more happy.

[1] https://docs.phpunit.de/en/9.6/writing-tests-for-phpunit.html#data-providers
[2] https://www.php.net/manual/en/migration81.other-changes.php#migration81.other-changes.functions.reflection

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Torben Hansen +1
    • Benni Mack +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Torben Hansen +1
    • Benni Mack +1

Issues 2

Files 5

Review log 56

  1. Christian Kuhn uploaded patch set 1 03/22/23, 11:28

  2. Benni Mack voted on patch set 1 V +1 CR +1 03/22/23, 11:30

  3. Torben Hansen voted on patch set 1 V +1 CR +1 03/22/23, 11:35

  4. Christian Kuhn voted on patch set 1 V +2 CR +2 03/22/23, 11:57

  5. Christian Kuhn merged patch set 2 03/22/23, 11:57

  6. core-ci voted on patch set 1 V +1 03/22/23, 11:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39378