Skip to content

Commit

Permalink
Cleanup: eliminate redundant optionalTypesPattern in preg_match_all f…
Browse files Browse the repository at this point in the history
…or collections
  • Loading branch information
clementbirkle committed Jul 3, 2024
1 parent 5741440 commit 478c669
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Support/Annotations/DataIterableAnnotationReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ protected function get(
$kindPattern = '(?:@property|@var|@param)\s*';
$fqsenPattern = '[\\\\a-z0-9_\|]+';
$typesPattern = '[\\\\a-z0-9_\\|\\[\\]]+';
$optionalTypesPattern = '(?:'.$typesPattern.')*';
$keyPattern = '(?<key>int|string|int\|string|string\|int|array-key)';
$parameterPattern = '\s*\$?(?<parameter>[a-z0-9_]+)?';

Expand All @@ -62,7 +61,7 @@ protected function get(
);

preg_match_all(
"/{$kindPattern}(?<collectionClass>{$fqsenPattern})<(?:{$keyPattern}\s*?,\s*?)?(?<dataClass>{$fqsenPattern})>{$optionalTypesPattern}{$parameterPattern}/i",
"/{$kindPattern}(?<collectionClass>{$fqsenPattern})<(?:{$keyPattern}\s*?,\s*?)?(?<dataClass>{$fqsenPattern})>(?:{$typesPattern})*{$parameterPattern}/i",
$comment,
$collectionMatches,
);
Expand Down

0 comments on commit 478c669

Please sign in to comment.