Skip to content

Commit

Permalink
Merge pull request #2 from localheinz/feature/type
Browse files Browse the repository at this point in the history
Enhancement: Add type declarations
  • Loading branch information
localheinz authored Jan 4, 2018
2 parents 2edb55f + a13569e commit f06f9e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/JsonFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class JsonFormatter
*
* @return string
*/
public static function format($json, $unescapeUnicode, $unescapeSlashes)
public static function format(string $json, bool $unescapeUnicode, bool $unescapeSlashes): string
{
$result = '';
$pos = 0;
Expand Down Expand Up @@ -63,7 +63,7 @@ public static function format($json, $unescapeUnicode, $unescapeSlashes)

if ($unescapeUnicode && \function_exists('mb_convert_encoding')) {
// https://stackoverflow.com/questions/2934563/how-to-decode-unicode-escape-sequences-like-u00ed-to-proper-utf-8-encoded-cha
$buffer = \preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
$buffer = \preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function (array $match) {
$l = \strlen($match[1]);

if ($l % 2) {
Expand Down

0 comments on commit f06f9e8

Please sign in to comment.