uuid: - value: a4efc095-f78d-45ae-854d-fc52c8afa41b langcode: - value: en type: - target_id: daily_email target_type: node_type target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7 revision_timestamp: - value: '2025-05-11T09:00:08+00:00' revision_uid: - target_type: user target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849 revision_log: { } status: - value: true uid: - target_type: user target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849 title: - value: 'Docblocks or attributes?' created: - value: '2024-08-15T00:00:00+00:00' changed: - value: '2025-05-11T09:00:08+00:00' promote: - value: false sticky: - value: false default_langcode: - value: true revision_translation_affected: - value: true path: - alias: /daily/2024/08/15/docblocks-or-attributes langcode: en body: - value: |

As Drupal 11 uses PHPUnit 10, we can now use the #[Test] attribute instead of the /** @test */ annotation for our test methods.

For example:

// Before.

      /** @test */
      public function it_returns_the_endpoint()

      // After.

      #[Test]
      public function it_returns_the_endpoint()
      

Annotations have started to be replaced in parts of Drupal since 10.2, so it's nice to be able to do it with tests, too.

Which do you prefer?

format: full_html processed: |

As Drupal 11 uses PHPUnit 10, we can now use the #[Test] attribute instead of the /** @test */ annotation for our test methods.

For example:

// Before.

      /** @test */
      public function it_returns_the_endpoint()

      // After.

      #[Test]
      public function it_returns_the_endpoint()
      

Annotations have started to be replaced in parts of Drupal since 10.2, so it's nice to be able to do it with tests, too.

Which do you prefer?

summary: null field_daily_email_cta: { }