Skip to content

Commit

Permalink
Fix stringifier bug
Browse files Browse the repository at this point in the history
  • Loading branch information
murtukov committed Jul 4, 2020
1 parent 14c4921 commit 56e53d1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private static function stringifyValue($value, bool $topLevel = false): string
return "''";
}

return var_export($value, true);
return self::filterString($value);
case 'array':
if (empty($value)) {
return '[]';
Expand Down Expand Up @@ -190,6 +190,18 @@ private static function stringifyNumericArray(array $items, ?bool $multiline = f
return "[$code]";
}

private static function filterString(string $string): string
{
switch ($string[0]) {
case Config::$suppressSymbol:
return substr($string, 1);
case '$':
return $string;
default:
return var_export($string, true);
}
}

public static function indent(string $code, bool $leadingIndent = true): string
{
$indent = Config::$indent;
Expand Down

0 comments on commit 56e53d1

Please sign in to comment.