77 */
88final class Parser
99{
10+ public const IS_SUBEXP_SEARCH = '/^\(.+\)$/s ' ;
11+
1012 // Compile time error handling flags
1113 public const BLOCKPARAM = 9999 ;
1214 public const PARTIALBLOCK = 9998 ;
@@ -179,7 +181,7 @@ public static function parse(array $token, Context $context): array
179181 */
180182 public static function getPartialName (array $ vars , int $ pos = 0 ): ?array
181183 {
182- if (!isset ($ vars [$ pos ]) || preg_match (SafeString ::IS_SUBEXP_SEARCH , $ vars [$ pos ])) {
184+ if (!isset ($ vars [$ pos ]) || preg_match (static ::IS_SUBEXP_SEARCH , $ vars [$ pos ])) {
183185 return null ;
184186 }
185187 assert (is_string ($ vars [$ pos ]));
@@ -229,14 +231,14 @@ protected static function advancedVariable(array $vars, Context $context, string
229231 $ i = 0 ;
230232 foreach ($ vars as $ idx => $ var ) {
231233 // handle (...)
232- if (preg_match (SafeString ::IS_SUBEXP_SEARCH , $ var )) {
234+ if (preg_match (static ::IS_SUBEXP_SEARCH , $ var )) {
233235 $ ret [$ i ] = static ::subexpression ($ var , $ context );
234236 $ i ++;
235237 continue ;
236238 }
237239
238240 // handle |...|
239- if (preg_match (SafeString:: IS_BLOCKPARAM_SEARCH , $ var , $ matched )) {
241+ if (preg_match (' /^ +\|(.+)\|$/s ' , $ var , $ matched )) {
240242 $ ret [static ::BLOCKPARAM ] = preg_split ('/\s+/ ' , trim ($ matched [1 ]));
241243 continue ;
242244 }
@@ -245,7 +247,7 @@ protected static function advancedVariable(array $vars, Context $context, string
245247 $ idx = $ m [3 ] ?: $ m [4 ];
246248 $ var = $ m [5 ];
247249 // handle foo=(...)
248- if (preg_match (SafeString ::IS_SUBEXP_SEARCH , $ var )) {
250+ if (preg_match (static ::IS_SUBEXP_SEARCH , $ var )) {
249251 $ ret [$ idx ] = static ::subexpression ($ var , $ context );
250252 continue ;
251253 }
0 commit comments