We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 67c1243 commit 68eb458Copy full SHA for 68eb458
custom-standards/Flyeralarm/Sniffs/Docblock/ReturnTypeSniff.php
@@ -143,9 +143,9 @@ private function isStartingWithUppercaseLetter($singleCharacter)
143
*/
144
private function checkReturnTypeShape(string $subject)
145
{
146
- preg_match_all('#(?<separator>\s*\|\s*)?(?<atom>[^<>\|]+)(?<generic><(?<nested>.*)>)?#', $subject, $matches);
+ $matched = preg_match_all('#(?<separator>\s*\|\s*)?(?<atom>[^<>\|]+)(?<generic><(?<nested>.*)>)?#', $subject, $matches);
147
148
- if (implode('', $matches[0]) !== $subject) {
+ if (!$matched || implode('', $matches[0]) !== $subject) {
149
throw new \InvalidArgumentException('Invalid structure in return type "' . $subject . '"');
150
}
151
0 commit comments