'azjezz/psl', 'type' => 'library', 'description' => 'PHP Standard Library.', 'keywords' => ['php', 'std', 'stdlib', 'utility', 'psl'], 'license' => 'MIT' ], true); $json = <<expectException(Json\Exception\JsonEncodeException::class); $this->expectExceptionMessage('Malformed UTF-8 characters, possibly incorrectly encoded.'); Json\encode(["bad utf\xFF"]); } public function testEncodeThrowsWithNAN(): void { $this->expectException(Json\Exception\JsonEncodeException::class); $this->expectExceptionMessage('Inf and NaN cannot be JSON encoded.'); Json\encode(Math\NaN); } public function testEncodeThrowsWithInf(): void { $this->expectException(Json\Exception\JsonEncodeException::class); $this->expectExceptionMessage('Inf and NaN cannot be JSON encoded.'); Json\encode(Math\INFINITY); } public function testEncodePreserveZeroFraction(): void { self::assertSame('1.0', Json\encode(1.0)); } }