Skip to content

docs: Document the DataTable and DocString step argument types - #231

Merged
acoulton merged 1 commit into
Behat:v3.xfrom
Amoifr:feat-1864-docs
Sep 3, 2026
Merged

docs: Document the DataTable and DocString step argument types#231
acoulton merged 1 commit into
Behat:v3.xfrom
Amoifr:feat-1864-docs

Conversation

@Amoifr

@Amoifr Amoifr commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Documents the DataTable and DocString step argument types added in Behat/Behat#1864, which @acoulton asked for as a follow-up.

The two sidebars of "Multiline step arguments" now show the new types, since they are what a reader should reach for:

-use Behat\Gherkin\Node\TableNode;
+use Behat\Step\DataTable;

 #[Given('the following people exist:')]
-public function thePeopleExist(TableNode $table)
+public function thePeopleExist(DataTable $table)
 {
-    foreach ($table as $row) {
+    foreach ($table->asMaps() as $row) {

For tables the accessors are worth listing, because which one to use depends on the shape of the table and that is not obvious from the type name: asMaps() for a table with a header row, asLists() for one without, asMap() for the two-column case, then cell(), row(), column(), height(), width(), isEmpty() and transpose().

Both sidebars say plainly that TableNode and PyStringNode still work and are not deprecated, so nobody reads this as a migration they have to do.

Two things I checked rather than assumed: the version is 3.33, since 3.32.0 is the latest release and the feature is merged on 3.x; and I dropped two :ref: links I had first written to a TableNode and a PyStringNode section, because no such anchors exist and they would have broken the build. The class names are written out instead.

Built locally with docker compose run --rm read-the-docs-builder build: build succeeded, and the rendered page carries the new sections.

The snippet generation half of the follow-up is Behat/Behat#1878.

@acoulton acoulton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Brilliant, thanks @Amoifr

@acoulton
acoulton merged commit 6be107b into Behat:v3.x Sep 3, 2026
4 checks passed
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.

3 participants