cada função da classe deve ser acompanhada da anotação senão lança ArgumentoCountError; podemos identificar melhor os data sets que estamos provendo identificando-os com nomes:
Tip #3: Add type definitions
I always add type hints to the method definitions when possible. When using data providers, it means adding parameter type hints to the method that accepts data sets and adding a return type (and phpdoc) to data provider method:
<?php
/**
* @dataProvider provideTrimData
*/
public function testTrimTrims(
string $expectedOutput, // <-- added typehint here
string $input // <-- added typehint here
): void
{
self::assertSame($expectedOutput, trim($input));
}
/**
* @return string[][] // <-- added typehint here
*/
public function provideTrimData(): array // <-- added typehint here
{
return [
'leading space is trimmed' => [
'Hello World',
' Hello World',
],
'trailing space and newline are trimmed' => [
'Hello World',
"Hello World \n",
],
];
}
https://blog.martinhujer.cz/how-to-use-data-providers-in-phpunit/;