Is there a way for phpDoc to document an array of objects as a parameter?

后端 未结 5 2068
礼貌的吻别
礼貌的吻别 2020-12-17 09:20

In phpDoc-generated documentation I can cause phpDoc to generate a link to a custom type definition for a given param using

@param CustomType $variablename
         


        
5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-17 10:00

    See the following examples from: https://code.google.com/p/google-api-php-client/source/checkout where is described the array structure of input parameters.

    /**
      * Set the OAuth 2.0 access token using the string that resulted from calling authenticate()
      * or Google_Client#getAccessToken().
      * @param string $accessToken JSON encoded string containing in the following format:
      * {"access_token":"TOKEN", "refresh_token":"TOKEN", "token_type":"Bearer",
      *  "expires_in":3600, "id_token":"TOKEN", "created":1320790426}
      */
    
    
    /**
      * Insert a new file. (files.insert)
      *
      * @param Google_DriveFile $postBody
      * @param array $optParams Optional parameters.
      *
      * @opt_param bool convert Whether to convert this file to the corresponding Google Docs format.
      * @opt_param string targetLanguage Target language to translate the file to. If no sourceLanguage is provided, the API will attempt to detect the language.
      * @opt_param string sourceLanguage The language of the original file to be translated.
      * @opt_param string ocrLanguage If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes.
      * @opt_param bool pinned Whether to pin the head revision of the uploaded file.
      * @opt_param bool ocr Whether to attempt OCR on .jpg, .png, or .gif uploads.
      * @opt_param string timedTextTrackName The timed text track name.
      * @opt_param string timedTextLanguage The language of the timed text.
      * @return Google_DriveFile
      */
    

提交回复
热议问题