From b42fc3dcbd04bdf5b1512e2f4f7d29645261bae8 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Sun, 30 May 2021 09:43:12 +0200 Subject: [PATCH] AnnotationExtractor: fix tests on windows (#111) Co-authored-by: Markus Staab --- .../ChangesReporting/Annotation/AnnotationExtractor.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/ChangesReporting/Annotation/AnnotationExtractor.php b/packages/ChangesReporting/Annotation/AnnotationExtractor.php index 418b163014f..013e32c82c8 100644 --- a/packages/ChangesReporting/Annotation/AnnotationExtractor.php +++ b/packages/ChangesReporting/Annotation/AnnotationExtractor.php @@ -25,9 +25,11 @@ public function extractAnnotationFromClass(string $className, string $annotation return null; } - // @see https://regex101.com/r/oYGaWU/1 - $pattern = '#' . preg_quote($annotation, '#') . '\s+(?.*?)$#m'; + // @see https://3v4l.org/ouYfB + // uses '\r?\n' instead of '$' because windows compat + $pattern = '#' . preg_quote($annotation, '#') . '\s+(?.*?)\r?\n#m'; $matches = Strings::match($docComment, $pattern); + return $matches['content'] ?? null; } }