Skip to content

Convert Behat annotations to PHP attributes in Api common contexts#18834

Merged
TheMilek merged 1 commit intoSylius:2.3from
loic425:behat-annotations-to-attributes/api-common
Feb 18, 2026
Merged

Convert Behat annotations to PHP attributes in Api common contexts#18834
TheMilek merged 1 commit intoSylius:2.3from
loic425:behat-annotations-to-attributes/api-common

Conversation

@loic425
Copy link
Copy Markdown
Member

@loic425 loic425 commented Feb 17, 2026

Q A
Branch? 2.3
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Related tickets partially #18822
License MIT

Summary by CodeRabbit

  • Refactor
    • Updated test context annotations from docblock format to PHP 8 attributes. Multiple test assertion methods have been systematically converted to use the new attribute syntax throughout the testing framework. All existing functionality and test behavior remain completely unchanged by these updates. These structural code changes represent a modernization effort.

@loic425 loic425 requested review from a team as code owners February 17, 2026 12:49
@loic425 loic425 mentioned this pull request Feb 17, 2026
27 tasks
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 17, 2026

📝 Walkthrough

Walkthrough

Three Behat test step methods in the ResponseContext class were modernized to use PHP 8 attributes instead of docblock annotations, with the corresponding import statement added. No functional or control flow changes were made.

Changes

Cohort / File(s) Summary
PHP 8 Attribute Migration
src/Sylius/Behat/Context/Api/Common/ResponseContext.php
Converted three docblock @Then annotations to PHP 8 #[Then(...)] attributes for methods iShouldBeNotifiedThatItHasBeenSuccessfullyEdited(), iShouldBeNotifiedThatItHasBeenSuccessfullyUploaded(), and iShouldBeNotifiedThatICanNoLongerChangePaymentMethodOfThisOrder(). Added use Behat\Step\Then; import.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Suggested labels

Maintenance

Suggested reviewers

  • TheMilek
  • GSadee

Poem

🐰 Modern times call for modern ways,
PHP 8 attributes shine so bright,
Docblocks fade to yesterday's craze,
Behat steps now sparkle with attribute light,
Cleaner syntax, crystal and right! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: converting Behat docblock annotations to PHP 8 attributes in API common context files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 17, 2026

❗ Preview Environment delete from Bunnyshell failed

Check https://github.com/Sylius/Sylius/actions/runs/22131501580 for details.

See: Environment Details

Available commands:

  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/Sylius/Behat/Context/Api/Common/ResponseContext.php (1)

16-17: Import order: use statements are not sorted alphabetically.

Behat\Step\Then (line 16) is placed before Behat\Behat\Context\Context (line 17), but alphabetically Behat\Behat\… should precede Behat\Step\….

Suggested fix
-use Behat\Step\Then;
 use Behat\Behat\Context\Context;
+use Behat\Step\Then;
 use Sylius\Behat\Client\ApiClientInterface;

As per coding guidelines: "Sort PHP use imports alphabetically and group by type (classes, functions, constants)".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Sylius/Behat/Context/Api/Common/ResponseContext.php` around lines 16 -
17, Import order is incorrect: swap and alphabetize the use statements so
Behat\Behat\Context\Context comes before Behat\Step\Then (and ensure all other
imports are sorted alphabetically and grouped by type); update the use block in
ResponseContext.php to list classes in alphabetical order (e.g.,
Behat\Behat\Context\Context then Behat\Step\Then) to comply with the project's
import ordering guideline.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/Sylius/Behat/Context/Api/Common/ResponseContext.php`:
- Around line 16-17: Import order is incorrect: swap and alphabetize the use
statements so Behat\Behat\Context\Context comes before Behat\Step\Then (and
ensure all other imports are sorted alphabetically and grouped by type); update
the use block in ResponseContext.php to list classes in alphabetical order
(e.g., Behat\Behat\Context\Context then Behat\Step\Then) to comply with the
project's import ordering guideline.

@TheMilek TheMilek merged commit 4753088 into Sylius:2.3 Feb 18, 2026
36 checks passed
@loic425 loic425 deleted the behat-annotations-to-attributes/api-common branch February 18, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants