[TASK] Document php:method signature parser limitations - #541
Conversation
The php:method signature parser rejects modern PHP type syntax (?string, union types) with build warnings or wrong output; the page does not mention it. Document the limitation and the :returntype: / :param: workaround. Assisted-by: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
e44ddfe to
fd8e8a6
Compare
|
I feel like we should maybe fix the parser to also accept modern PHP syntax and open an issue in https://github.com/TYPO3-Documentation/guides-php-domain |
The first version blamed nullable and union types "in the signature", which is not what the parser does. METHOD_SIGNATURE_REGEX in MethodNameService matches the return type as (\w+) while the parameter list is unrestricted, so retrieve(?string $id) and retrieve(string|null $id) are accepted and only the part after the colon is not. Measured against the regex: ?string, string|null and \Vendor\Thing as a return type are rejected; the same types as parameter types pass. Correct the text accordingly and drop the advice to give a nullable parameter a null default, which was never needed. Assisted-by: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
|
Agreed on fixing the parser — and going through The restriction is not "nullable and union types in the signature".
So parameters were never the problem, and the advice to give a nullable parameter a Happy to open the issue in guides-php-domain with those cases — a fully qualified return type failing is arguably the more annoying half. Say the word and I will file it there. |
Rendered every variant through the real container instead of reasoning about the regex. A rejected signature is not just a warning: the whole text becomes the method name, so the parameters vanish, an empty () is rendered, and the anchor is built from the entire signature, which breaks cross references to that method. Also add intersection types to the rejected list and name the accepted return types, both measured rather than assumed. Assisted-by: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
|
Closing this in favour of fixing the parser, as you suggested: TYPO3-Documentation/guides-php-domain#54. Going through One detail worth having here: the lexer is used without If the fix lands, this page has nothing left to warn about. If you would rather document the limitation in the meantime, say so and I will reopen it with the corrected text — the version on the branch already names the return type as the restriction and describes what a rejected signature actually does. |
The php:method signature parser rejects modern PHP type syntax (
?string, union types) with build warnings or wrong output, and the page currently does not mention it. This documents the limitation and the:returntype:/:param:workaround, plus a short note that array-based configuration (TCA, FlexForm, YAML) belongs in confval rather than the PHP domain.