I recently updated PHP from 8.1 to 8.2.
This resulted in a bunch of deprecation notices about use of dynamic properties in PHPUnit tests.
So, based on the docs, I added the AllowDynamicProperties class.
/**
* Unit tests for the myModule class (timing).
*
* @group myModuleSuite
*
* @coversDefaultClass \Drupal\myModule\Class
*
* @property \DateTimeZone $timezone_utc
* @property \DateTimeZone $timezone_nyc
*/
#[\AllowDynamicProperties]
class MyModuleTimingTest extends UnitTestCase {
This fixes the deprecation notice for PHP 8.2, but now the Drupal coding standards check complains about a "missing doc comment" for my MyModuleTimingTest class.
How am I supposed to write this so that I can use the attribute and not violate the coding standards?
How I'm checking the coding standards
Using Coder module 8.3.16.
/vendor/bin/phpcs -p --colors --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,txt,md --ignore=node_modules,vendor ./web/modules/custom ./web/themes/custom