Data providers are even better organized with yield instead of return array. It also gives you the ability to re-use array in items.
I switched with Rector in all my tests and I cannot go back :)
Hi Tomáš, I must admit that I haven't given generators in data providers much thought yet, so it's at least a welcome new perspective.
As of yet, I don't see any real clear advantages of generators over plain old arrays though. Syntax is a bit different and one might argue that a yield looks a bit cleaner, whereas one might also argue that more developers are likely to be familiar with arrays than generators, which might help collaboration. Am I missing some benefits?
Thanks for the Rector hint. I hadn't heard of it before and will give it a chance for sure 👌
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.