Closed holtkamp closed 4 years ago
Hmm. Yes. It looks like \MethodDocGenerator::generateMethodDocs needs a small bit of work to add []
to the first parameter typehint.
* @method static bool allAlnum(mixed[] $value, string|callable $message = null, string $propertyPath = null) Assert that value is alphanumeric for all values.
Some work may be needed for those that are arrays (or of a type that can be thought of as an array to start with - check the allCount() method).
Hmm. Yes. It looks like \MethodDocGenerator::generateMethodDocs needs a small bit of work
Aah, that part of the documation is generated, nice! So in that case a PR to just change the PHPDoc does not make a lot of sense...
Apologies for the lack of response ... life!
if ($prefix === 'all' && strpos($type, 'null') === false && $parameterIndex === 0) {
$type = str_replace('|', '[]|', $type).'[]';
}
Seems to do the trick.
Released in v3.2.5
The documentation for the "all" helper states:
And gives an example for an array.
Checking an array of UUIDs works properly but results in a warning from my IDE:
This is caused by this PHPDoc:
https://github.com/beberlei/assert/blob/f812ed00763ffa96264496730b2672c744414e98/lib/Assert/Assertion.php#L108
Funny thing is, this also occurs for other "allXYZ" helpers, for example:
https://github.com/beberlei/assert/blob/f812ed00763ffa96264496730b2672c744414e98/lib/Assert/Assertion.php#L55-L57
So my question: is it correct that the PHPDoc for some "allXYZ" helpers is incorrect? I can come up with a PR when this is confirmed.