Skip to content
Snippets Groups Projects
Commit 43179ad5 authored by Christian Kuhn's avatar Christian Kuhn
Browse files

[TASK] Avoid protected & private data providers

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

Resolves: #100248
Related: #100249
Releases: main
Change-Id: I1f646bc90a95ba993618a81e03ecd38d2a179f7a
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78209


Reviewed-by: default avatarTorben Hansen <derhansen@gmail.com>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarTorben Hansen <derhansen@gmail.com>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarBenni Mack <benni@typo3.org>
parent 4f141428
Branches
Tags
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment