Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestCaseProvider.dataProviderSyntaxMethodInvalidReturnType spits error for \Generator return type #190

Open
PhilippImhof opened this issue Nov 12, 2024 · 0 comments

Comments

@PhilippImhof
Copy link

If we have

namespace foo;

public static function provide_foo(): \Generator {
   yield ['foo', 'bar'];
}

there will be an error message: `Data provider method "provide_foo" must return an array, a Generator or an Iterable.

If we write this instead:

namespace foo;

use Generator;

public static function provide_foo(): Generator {
   yield ['foo', 'bar'];
}

everything works fine. IMHO, it should be possible to use \Generator as well. (And the same is probably true for Iterable and \Iterable.)

@PhilippImhof PhilippImhof changed the title moodle.PHPUnit.TestCaseProvider.dataProviderSyntaxMethodInvalidReturnTyp spits error for \Generator return type TestCaseProvider.dataProviderSyntaxMethodInvalidReturnType spits error for \Generator return type Nov 12, 2024
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

No branches or pull requests

1 participant