Skip to content

Commit

Permalink
Regex simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Aug 23, 2021
1 parent 3f79e59 commit 6ab1b6a
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/Composer/Autoload/ClassMapGenerator.php
Expand Up @@ -253,20 +253,13 @@ private static function findClasses($path)
(?:\r\n|\n|\r)
# the meat of it, matching line by line until end delimiter
(?:
# a valid line is either..
(?:
# non-word or non-space char, then anything goes for the rest of the line
[^\s\w][^\r\n]+
# white-space (possessive match) not followed by the end delimiter, then anything goes for the rest of the line
| \s*+(?!\\2 \s*[;,.)])[^\r\n]+
# white-space but no new lines
| [\t\f\v ]+
)
# a valid line is optional white-space (possessive match) not followed by the end delimiter, then anything goes for the rest of the line
[\t ]*+(?!\\2 [\t \r\n]*[;,.)])[^\r\n]*
# end of line(s)
[\r\n]+
)*
# end delimiter
\s* \\2 (?=\s*[;,.)])
[\t ]* \\2 (?=[\t \r\n]*[;,.)])
}x', 'null', $contents);

// strip strings
Expand Down

0 comments on commit 6ab1b6a

Please sign in to comment.