Skip to content

Commit 815a414

Browse files
committed
regexp: \z replaced with D modifier
1 parent 3926b3f commit 815a414

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/PhpGenerator/Helpers.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private static function _dump(&$var, int $level = 0)
6464
return '"' . strtr($var, $table) . '"';
6565

6666
} elseif (is_string($var)) {
67-
return "'" . preg_replace('#\'|\\\\(?=[\'\\\\]|\z)#', '\\\\$0', $var) . "'";
67+
return "'" . preg_replace('#\'|\\\\(?=[\'\\\\]|$)#D', '\\\\$0', $var) . "'";
6868

6969
} elseif (is_array($var)) {
7070
$space = str_repeat("\t", $level);
@@ -229,13 +229,13 @@ public static function unformatDocComment(string $comment): string
229229

230230
public static function isIdentifier($value): bool
231231
{
232-
return is_string($value) && preg_match('#^' . self::PHP_IDENT . '\z#', $value);
232+
return is_string($value) && preg_match('#^' . self::PHP_IDENT . '$#D', $value);
233233
}
234234

235235

236236
public static function isNamespaceIdentifier($value, bool $allowLeadingSlash = false): bool
237237
{
238-
$re = '#^' . ($allowLeadingSlash ? '\\\\?' : '') . self::PHP_IDENT . '(\\\\' . self::PHP_IDENT . ')*\z#';
238+
$re = '#^' . ($allowLeadingSlash ? '\\\\?' : '') . self::PHP_IDENT . '(\\\\' . self::PHP_IDENT . ')*$#D';
239239
return is_string($value) && preg_match($re, $value);
240240
}
241241

0 commit comments

Comments
 (0)