Behat / docs

Behat documentation repository
http://behat.org
28 stars 69 forks source link

Attributes in documentation #177

Open carlos-granados opened 5 days ago

carlos-granados commented 5 days ago

Currently there is no mention at all about PHP Attributes in the documentation but you should be able to use them everywhere that Behat uses annotations. We should include documentation about Attributes. There are two options:

Given the global trend in the PHP world to use attributes everywhere, I lean towards the second option but would like to hear the opinion of others.

As a reference, PHPUnit documentation now uses attributes everywhere and just provides a section on annotations

stof commented 5 days ago

As a reference, PHPUnit documentation now uses attributes everywhere and just provides a section on annotations

The difference here is that PHPUnit 11 has deprecated annotations and PHPUnit 12 will drop them.

However, I'm in favor of using annotations by default in examples.

carlos-granados commented 5 days ago

As a reference, PHPUnit documentation now uses attributes everywhere and just provides a section on annotations

The difference here is that PHPUnit 11 has deprecated annotations and PHPUnit 12 will drop them.

However, I'm in favor of using annotations by default in examples.

annotations or attributes?

stof commented 5 days ago

Sorry, I meant using attributes by default, not annotations.

acoulton commented 5 days ago

:+1: to updating the docs to use attributes.

I'd also be in favour of eventually at least deprecating the annotations (maybe with an opt-in standalone package to parse them into attributes at runtime, or a tool/script/Rector to convert existing feature files). In a future major, obviously.

carlos-granados commented 4 days ago

Before we can work on this I believe there should be an easy way to update all existing annotations to attributes in a project. I tried to use the AnnotationToAttributeRector Rector rule but found out that it did not work as required (it discarded the text of the step) so I have create a PR to fix this, hopefully this will be merged into Rector and released in the next release https://github.com/rectorphp/rector-src/pull/6468

carlos-granados commented 1 day ago

My Rector pull request has been merged, so this should be part of the Rector 2.0 release that should happen soon 🎉