diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index def17ee..cc0b1c4 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -18,15 +18,15 @@ __DIR__ . '/LICENSE.md', License\Range::since( License\Year::fromString('2018'), - new \DateTimeZone('UTC') + new \DateTimeZone('UTC'), ), License\Holder::fromString('Andreas Möller'), - License\Url::fromString('https://github.com/ergebnis/json-printer') + License\Url::fromString('https://github.com/ergebnis/json-printer'), ); $license->save(); -$config = PhpCsFixer\Config\Factory::fromRuleSet(new PhpCsFixer\Config\RuleSet\Php72($license->header()), [ +$config = PhpCsFixer\Config\Factory::fromRuleSet(new PhpCsFixer\Config\RuleSet\Php73($license->header()), [ 'escape_implicit_backslashes' => false, 'mb_str_functions' => false, ]); diff --git a/src/Printer.php b/src/Printer.php index 5b856ba..897aac0 100644 --- a/src/Printer.php +++ b/src/Printer.php @@ -41,21 +41,21 @@ public function print(string $json, string $indent = ' ', string $newLine = \ if (null === \json_decode($json) && \JSON_ERROR_NONE !== \json_last_error()) { throw new \InvalidArgumentException(\sprintf( '"%s" is not valid JSON.', - $json + $json, )); } if (1 !== \preg_match('/^( +|\t+)$/', $indent)) { throw new \InvalidArgumentException(\sprintf( '"%s" is not a valid indent.', - $indent + $indent, )); } if (1 !== \preg_match('/^(?>\r\n|\n|\r)$/', $newLine)) { throw new \InvalidArgumentException(\sprintf( '"%s" is not a valid new-line character sequence.', - $newLine + $newLine, )); } diff --git a/test/Unit/PrinterTest.php b/test/Unit/PrinterTest.php index 82f5e0e..1607442 100644 --- a/test/Unit/PrinterTest.php +++ b/test/Unit/PrinterTest.php @@ -41,7 +41,7 @@ public function testPrintRejectsInvalidJson(): void $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage(\sprintf( '"%s" is not valid JSON.', - $json + $json, )); $printer->print($json); @@ -61,12 +61,12 @@ public function testPrintRejectsInvalidIndent(string $indent): void $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage(\sprintf( '"%s" is not a valid indent.', - $indent + $indent, )); $printer->print( $json, - $indent + $indent, ); } @@ -103,13 +103,13 @@ public function testPrintRejectsInvalidNewLine(string $newLine): void $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage(\sprintf( '"%s" is not a valid new-line character sequence.', - $newLine + $newLine, )); $printer->print( $json, $indent, - $newLine + $newLine, ); } @@ -184,7 +184,7 @@ public function testPrintPrintsPrettyWithIndent(): void $printed = $printer->print( $json, - $indent + $indent, ); self::assertSame($expected, $printed); @@ -215,7 +215,7 @@ public function testPrintPrintsPrettyWithIndentAndNewLine(string $newLine): void $expectedWithNewLine = \str_replace( \PHP_EOL, $newLine, - $expected + $expected, ); $printer = new Printer(); @@ -223,7 +223,7 @@ public function testPrintPrintsPrettyWithIndentAndNewLine(string $newLine): void $printed = $printer->print( $json, $indent, - $newLine + $newLine, ); self::assertSame($expectedWithNewLine, $printed);