Skip to content

Commit ded7454

Browse files
fjgarlinpmelab
authored andcommitted
Edit twig annotation regex to look for query ending (#367)
* #366 Edit annotation regex to look for query ending. * #366 Make regex non-greedy instead of searching for query end.
1 parent 9f58cd0 commit ded7454

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

modules/graphql_twig/src/GraphQLTwigEnvironment.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class GraphQLTwigEnvironment extends TwigEnvironment {
2121
*
2222
* @var string
2323
*/
24-
public static $GRAPHQL_ANNOTATION_REGEX = '/{#graphql\s+(?<query>.*)\s+#\}/s';
24+
public static $GRAPHQL_ANNOTATION_REGEX = '/{#graphql\s+(?<query>.*?)\s+#\}/s';
2525

2626
public function compileSource($source, $name = NULL) {
2727
if ($source instanceof \Twig_Source) {
@@ -65,4 +65,4 @@ public function replaceAnnotation($code) {
6565
return preg_replace(static::$GRAPHQL_ANNOTATION_REGEX, '{% graphql %}$1{% endgraphql %}', $code);
6666
}
6767

68-
}
68+
}

0 commit comments

Comments
 (0)