sdk-php
sdk-php copied to clipboard
Improve PHP files generated from proto
Is your feature request related to a problem? Please describe.
There are a lot of Psalm issues related with usage of PHP files generated from proto (messages). For example:
$details = $info->hasDetails()
// psalm: PossiblyNullArgument: Argument 1 of EncodedValues::fromPayloads cannot be null, possibly null value provided
? EncodedValues::fromPayloads($info->getDetails(), $converter)
: EncodedValues::empty();
Describe the solution you'd like
That case will be fixed if we add additional annotations in generated files fike this:
/**
* ...
* @psalm-mutation-free
*/
public function getDetails() { ... }
/**
* @psalm-assert-if-true !null $this->getDetails()
* @psalm-mutation-free
*/
public function hasDetails() { ... }