Skip to content
Permalink
Browse files

regexp: \z replaced with D modifier

  • Loading branch information...
dg committed Jul 11, 2019
1 parent aea6e81 commit 45fedc4d7c883d0c3231c7be107481f5dc504a9a
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/PhpGenerator/Helpers.php
@@ -64,7 +64,7 @@ private static function _dump(&$var, int $level = 0)
return '"' . strtr($var, $table) . '"';
} elseif (is_string($var)) {
return "'" . preg_replace('#\'|\\\\(?=[\'\\\\]|\z)#', '\\\\$0', $var) . "'";
return "'" . preg_replace('#\'|\\\\(?=[\'\\\\]|$)#D', '\\\\$0', $var) . "'";
} elseif (is_array($var)) {
$space = str_repeat("\t", $level);
@@ -229,13 +229,13 @@ public static function unformatDocComment(string $comment): string
public static function isIdentifier($value): bool
{
return is_string($value) && preg_match('#^' . self::PHP_IDENT . '\z#', $value);
return is_string($value) && preg_match('#^' . self::PHP_IDENT . '$#D', $value);
}
public static function isNamespaceIdentifier($value, bool $allowLeadingSlash = false): bool
{
$re = '#^' . ($allowLeadingSlash ? '\\\\?' : '') . self::PHP_IDENT . '(\\\\' . self::PHP_IDENT . ')*\z#';
$re = '#^' . ($allowLeadingSlash ? '\\\\?' : '') . self::PHP_IDENT . '(\\\\' . self::PHP_IDENT . ')*$#D';
return is_string($value) && preg_match($re, $value);
}

0 comments on commit 45fedc4

Please sign in to comment.
You can’t perform that action at this time.