Skip to content

Convert Behat annotations to PHP attributes in CLI contexts#18820

Merged
TheMilek merged 1 commit intoSylius:2.3from
loic425:behat-annotations-to-attributes/cli
Feb 12, 2026
Merged

Convert Behat annotations to PHP attributes in CLI contexts#18820
TheMilek merged 1 commit intoSylius:2.3from
loic425:behat-annotations-to-attributes/cli

Conversation

@loic425
Copy link
Copy Markdown
Member

@loic425 loic425 commented Feb 12, 2026

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

Summary by CodeRabbit

  • Refactor
    • Modernized test step definitions across multiple CLI testing contexts to leverage PHP 8 language features, improving code clarity and maintainability of the testing infrastructure. All existing test behavior and functionality remain unchanged.

@loic425 loic425 requested review from a team as code owners February 12, 2026 07:48
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

Three Behat CLI context files are migrated from docblock-style step annotations (@When, @Then, @Given) to PHP 8 attributes (#[When], #[Then], #[Given]). Required use statements for Behat\Step are added. No functional behavior or method signatures change; only annotation syntax is modernized.

Changes

Cohort / File(s) Summary
Behat CLI Context Attribute Migration
src/Sylius/Behat/Context/Cli/CancelUnpaidOrdersContext.php, src/Sylius/Behat/Context/Cli/ChangeAdminPasswordContext.php, src/Sylius/Behat/Context/Cli/InstallerContext.php
Step definitions converted from docblock annotations (@When, @Then, @Given) to PHP 8 attributes (#[When], #[Then], #[Given]). Corresponding use statements added for Behat\Step components. Method implementations remain unchanged; purely syntactical modernization of step declaration mechanism.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • GSadee
  • TheMilek

Poem

🐰 Attributes now bloom where docblocks once lay,
PHP 8 wisdom lights the Behat way,
Three contexts refined with modern flair,
Steps declare themselves with attributes to share!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.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 directly describes the main change: converting Behat annotations to PHP attributes in CLI contexts, which matches the core purpose shown in all three modified 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

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
src/Sylius/Behat/Context/Cli/CancelUnpaidOrdersContext.php (1)

16-18: Imports are not sorted alphabetically.

Per coding guidelines, use imports should be sorted alphabetically. Behat\Behat\Context\Context should precede Behat\Step\*, and Then should precede When.

Proposed fix
-use Behat\Step\When;
-use Behat\Step\Then;
 use Behat\Behat\Context\Context;
+use Behat\Step\Then;
+use Behat\Step\When;

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

src/Sylius/Behat/Context/Cli/InstallerContext.php (1)

16-19: Same import ordering issue — Behat\Behat\* should come first.

Proposed fix
-use Behat\Step\When;
-use Behat\Step\Given;
-use Behat\Step\Then;
 use Behat\Behat\Context\Context;
+use Behat\Step\Given;
+use Behat\Step\Then;
+use Behat\Step\When;

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

src/Sylius/Behat/Context/Cli/ChangeAdminPasswordContext.php (1)

16-18: Same import ordering issue — Behat\Behat\* should come first.

Proposed fix
-use Behat\Step\When;
-use Behat\Step\Then;
 use Behat\Behat\Context\Context;
+use Behat\Step\Then;
+use Behat\Step\When;

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

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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 12, 2026

❌ Preview Environment deleted from Bunnyshell

Available commands:

  • 🚀 /bns:deploy to redeploy the environment

@TheMilek TheMilek merged commit f78dac1 into Sylius:2.3 Feb 12, 2026
36 checks passed
@loic425 loic425 deleted the behat-annotations-to-attributes/cli branch February 12, 2026 08:21
@loic425 loic425 mentioned this pull request Feb 12, 2026
27 tasks
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