jsonSerialize(); } /** * @param class-string $className * @param array $json * @return never */ public function newFromJsonArray( string $className, array $json ) { // We can't use the core JsonUnserializable interface // (even blindly) because we can't make a non-null // JsonUnserializer which is required as the first argument // T346829, T327439#8634426 // That's ok, though, we can still *serialize* objects for // test cases even if we can't unserialize them. throw new \InvalidArgumentException( "Unserialization of this $className not possible" ); } /** @inheritDoc */ public function jsonClassHintFor( string $className, string $keyName ) { return null; } }; // Cache this for future use $this->addCodecFor( $className, $codec ); } return $codec; } }