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

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 2

Files 5