Allow single #[Examples] attribute#6812
Conversation
There was a problem hiding this comment.
As already mentioned in #6752 (comment) this is a slight BC break introduced by this PR.
However, the behavior doesn't seem to be documented and from DX perspective I would prefer the new behavior.
Any thoughts about this are welcome.
There was a problem hiding this comment.
The first syntax allows for dereferencing from arrays using .... also what about generators? They can't use the 2nd Syntax
There was a problem hiding this comment.
The first syntax allows for dereferencing from arrays using
....
Shouldn't this still be possible by just passing an array as example, f.e. #[Examples(['foo' => 'bar'])]? Please correct me if I misunderstood the problem.
what about generators? They can't use the 2nd Syntax
Do you mean that the new syntax breaks generators? Can you provide an example?
There was a problem hiding this comment.
I dont remember exactly.
But I'll say this: to me having a different behaviour depending on the type of argument given to the attribute is bad design, both from a code quality as well as a DX perspective.
I don't remember this PR (it's been a while, so feel free to ignore this comment and merge if you like it.
4ecaaad to
c2a260f
Compare

Fixes #6726
The current implementation of the
#[Examples]attribute differs from what is documented at https://codeception.com/docs/AdvancedUsage#Examples-Attribute (reported in Codeception/codeception.github.com#870).Futhermore, it is currently not possible to use a single
#[Examples]attribute in a test.This PR is based on #6752 which was closed automatically a few months ago and fixed the behavior.
This PR replaces #6789 which is about the same issue.