Commit graph

1 commit

Author SHA1 Message Date
Máté Szabó
97bb70de85 Introduce and use DynamicPropertyTestHelper
PHP 8.2 has deprecated dynamic property creation on classes that do not
explicitly allow it via the #[AllowDynamicProperties] annotation. The
recommended migration path for associating arbitrary data with objects
is the WeakMap class, but it is only available on PHP 8.0 and above.

Since MediaWiki still supports PHP 7.4, and the test framework needs to
be able to associate some state with objects it does not own, like DB
connection handles, introduce and use a new DynamicPropertyTestHelper
shim class that uses WeakMap if available and falls back to regular
dynamic property creation otherwise. Convert the DB setup-related
dynamic property usage in MediaWikiIntegrationTestCase to use this
class.

Bug: T326466
Change-Id: I1054f6f944d491b536949cada33e2ac670e026f8
2023-11-03 13:50:53 -04:00