cranetm / yii2-json-rpc-2.0

Other
26 stars 18 forks source link

@return PHPDoc section fires -32603 error #17

Closed Gn0ume closed 6 years ago

Gn0ume commented 6 years ago

/**

Such action bring out the response: {"jsonrpc":"2.0","id":2,"error":{"code":-32603,"message":"Parameter type 'array' is deprecated. Use square brackets with simply types or DTO based classes instead.","data":null}}

cranetm commented 6 years ago

Parameter type 'array' is deprecated. Use square brackets with simply types or DTO based classes instead Too bad if this explanation isn't helpful for you.

For your case its better to create DTO class like:

class GetDuckResponse {
 /** @var string */
  public $say;
}

and specify it in action's phpdocs:

/**
* Returns array of ducks
* @return GetDuckResponse;
*/
cranetm commented 6 years ago

If your purpose is returning ducks, create DuckDto(with all needed properties) and mention it in action's comment like @return DuckDTO[]