php-advanced-json-rpc icon indicating copy to clipboard operation
php-advanced-json-rpc copied to clipboard

Avoid instantation of class with type mixed during mapping

Open danog opened this issue 2 years ago • 2 comments
trafficstars

Some PHP 8+ coding standards require the specification of a typehint in all parameters of all functions, even if it's just a mixed typehint. Unfortunately, the library treats mixed typehints as a concrete class type, trying to automatically map passed objects. This is undesirable for methods like LSP's executeCommand, which takes an LSPAny = LSPObject | LSPArray | string | integer | uinteger | decimal | boolean | null arg, essentially equivalent to a mixed type.

This library already supports skipping by not providing a typehint: this PR allow skipping mapping by also providing a mixed typehint.

danog avatar Aug 25 '23 09:08 danog

Could I also get a tag after the merge please? I need this for Psalm v6.

danog avatar Aug 25 '23 09:08 danog

Maybe good to know this repo is kind of dead. The sole maintainer doesn’t seem to be active anymore. Also see https://github.com/felixfbecker/php-advanced-json-rpc/pull/59#issuecomment-1581253698

DannyvdSluijs avatar Aug 25 '23 10:08 DannyvdSluijs