PHPLIB-1679 Call DocumentCodec::encode() only on objects#1687
PHPLIB-1679 Call DocumentCodec::encode() only on objects#1687GromNaN wants to merge 3 commits intomongodb:v2.0from
DocumentCodec::encode() only on objects#1687Conversation
DocumentCodec::encode() only on objects
|
I should add tests, probably in |
| // $args[0] was already validated above. Since DocumentCodec::encode will always return a Document | ||
| // instance, there is no need to re-validate the returned value here. | ||
| if ($codec) { | ||
| if (! is_object($args[0])) { |
Check notice
Code scanning / Psalm
MixedArrayAccess Note
| // instance, there is no need to re-validate the returned value here. | ||
| if ($codec) { | ||
| if (! is_object($args[0])) { | ||
| throw UnsupportedValueException::invalidEncodableValue($args[0]); |
Check notice
Code scanning / Psalm
MixedArrayAccess Note
| } | ||
|
|
||
| if ($codec) { | ||
| if (! is_object($args[1])) { |
Check notice
Code scanning / Psalm
MixedArrayAccess Note
|
|
||
| if ($codec) { | ||
| if (! is_object($args[1])) { | ||
| throw UnsupportedValueException::invalidEncodableValue($args[1]); |
Check notice
Code scanning / Psalm
MixedArrayAccess Note
|
I don't think we should add the error checks here. The template annotation on the I wonder if we should instead document the parameter as |
|
What I understand is that calling
The Throwing the error before or inside |
Fix PHPLIB-1679
DocumentCodec::encode()DocumentCodec::encode()as the typeMongoDB\BSON\Documentis enforced.