0
0
mirror of https://github.com/pmmp/PocketMine-MP.git synced 2025-10-07 21:46:46 +00:00
Files
PocketMine-MP/tests/phpstan/stubs/JsonMapper.stub
Dylan K. Taylor 1c92d66ca4 LoginPacketHandler: stop bailing on unexpected JSON properties
the intent of this was noble (to make sure nothing was missed), but in practice throwing
errors on this stuff is just a pain in the ass. We don't actually need to care if the
properties are not used, since it doesn't affect the decoding (like it would for
a missing packet field), so the only reasons to complain are for BedrockProtocol to
have a complete picture of the protocol, and to make sure we're not discarding useful
information.

Log a warning in these cases instead, which should be noticed by developers without
being an unnecessary problem for users.

closes #6816
2025-09-26 23:04:23 +01:00

23 lines
450 B
Plaintext

<?php
//possible bug in phpstan requires this to be defined here
class JsonMapper_Exception extends \Exception{}
class JsonMapper{
/** @var ?\Closure(object, string, mixed) : void */
public $undefinedPropertyHandler = null;
/**
* @template TModel of object
*
* @param mixed[]|object $json
* @param TModel $object
*
* @return TModel
*
* @throws JsonMapper_Exception
*/
public function map($json, object $object) : object{}
}