Skip to content

Commit

Permalink
docs: address suggestions from docfx review (#5767)
Browse files Browse the repository at this point in the history
* ensure parameter descriptions are also decoded

* strip generated from protobuf field

* typo fix

* fix RetrySettings references in VisionClient

* fix two more bad references

* chore(docs): fidx newlines, add template overrides

* chore(docs): use HEAD for phpDocumentor for unreleased bug fixes
  • Loading branch information
bshaffer authored Jan 11, 2023
1 parent 672fb77 commit 16f914e
Show file tree
Hide file tree
Showing 114 changed files with 3,508 additions and 6,852 deletions.
13 changes: 11 additions & 2 deletions .kokoro/docs/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,18 @@ RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" &&
php -r "if (hash_file('SHA384', 'composer-setup.php') === rtrim(file_get_contents('https://composer.github.io/installer.sig'))) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
php composer-setup.php --filename=composer --install-dir=/usr/local/bin

# Build phpDocumentor from HEAD until they create a new release
# TODO: Remove once phpDocumentor tags a new release
# @see https://github.com/phpDocumentor/phpDocumentor/issues/3434
RUN wget -O phpDocumentor.tar.gz "https://github.com/phpDocumentor/phpDocumentor/archive/master.tar.gz" \
&& tar -xzf phpDocumentor.tar.gz \
&& composer require -d phpDocumentor-master \
&& ln -s ${pwd}/phpDocumentor-master/bin/phpdoc /usr/local/bin/phpdoc

# Install phpdoc
RUN wget -O /usr/local/bin/phpdoc "https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.3.1/phpDocumentor.phar" \
&& chmod +x /usr/local/bin/phpdoc
# TODO: uncomment once phpDocumentor creates a new release
# RUN wget -O /usr/local/bin/phpdoc "https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.3.1/phpDocumentor.phar" \
# && chmod +x /usr/local/bin/phpdoc

# Install Python3
RUN wget https://www.python.org/ftp/python/3.9.14/Python-3.9.14.tgz \
Expand Down
56 changes: 28 additions & 28 deletions Vision/src/V1/ImageAnnotatorClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ public function createImageObject($imageInput)
* @type ImageContext $imageContext Additional context that may accompany the image.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a
* {@see Google\ApiCore\RetrySettings} object, or an associative array
* {@see RetrySettings} object, or an associative array
* of retry settings parameters. See the documentation on
* {@see Google\ApiCore\RetrySettings} for example usage.
* {@see RetrySettings} for example usage.
* }
*
* @return AnnotateImageResponse
Expand Down Expand Up @@ -134,9 +134,9 @@ public function annotateImage($image, $features, $optionalArgs = [])
* @type ImageContext $imageContext Additional context that may accompany the image.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a
* {@see Google\ApiCore\RetrySettings} object, or an associative array
* {@see RetrySettings} object, or an associative array
* of retry settings parameters. See the documentation on
* {@see Google\ApiCore\RetrySettings} for example usage.
* {@see RetrySettings} for example usage.
* }
*
* @return AnnotateImageResponse
Expand Down Expand Up @@ -168,9 +168,9 @@ public function faceDetection($image, $optionalArgs = [])
* @type ImageContext $imageContext Additional context that may accompany the image.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a
* {@see Google\ApiCore\RetrySettings} object, or an associative array
* {@see RetrySettings} object, or an associative array
* of retry settings parameters. See the documentation on
* {@see Google\ApiCore\RetrySettings} for example usage.
* {@see RetrySettings} for example usage.
* }
*
* @return AnnotateImageResponse
Expand Down Expand Up @@ -202,9 +202,9 @@ public function landmarkDetection($image, $optionalArgs = [])
* @type ImageContext $imageContext Additional context that may accompany the image.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a
* {@see Google\ApiCore\RetrySettings} object, or an associative array
* {@see RetrySettings} object, or an associative array
* of retry settings parameters. See the documentation on
* {@see Google\ApiCore\RetrySettings} for example usage.
* {@see RetrySettings} for example usage.
* }
*
* @return AnnotateImageResponse
Expand Down Expand Up @@ -236,9 +236,9 @@ public function logoDetection($image, $optionalArgs = [])
* @type ImageContext $imageContext Additional context that may accompany the image.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a
* {@see Google\ApiCore\RetrySettings} object, or an associative array
* {@see RetrySettings} object, or an associative array
* of retry settings parameters. See the documentation on
* {@see Google\ApiCore\RetrySettings} for example usage.
* {@see RetrySettings} for example usage.
* }
*
* @return AnnotateImageResponse
Expand Down Expand Up @@ -270,9 +270,9 @@ public function labelDetection($image, $optionalArgs = [])
* @type ImageContext $imageContext Additional context that may accompany the image.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a
* {@see Google\ApiCore\RetrySettings} object, or an associative array
* {@see RetrySettings} object, or an associative array
* of retry settings parameters. See the documentation on
* {@see Google\ApiCore\RetrySettings} for example usage.
* {@see RetrySettings} for example usage.
* }
*
* @return AnnotateImageResponse
Expand Down Expand Up @@ -304,9 +304,9 @@ public function textDetection($image, $optionalArgs = [])
* @type ImageContext $imageContext Additional context that may accompany the image.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a
* {@see Google\ApiCore\RetrySettings} object, or an associative array
* {@see RetrySettings} object, or an associative array
* of retry settings parameters. See the documentation on
* {@see Google\ApiCore\RetrySettings} for example usage.
* {@see RetrySettings} for example usage.
* }
*
* @return AnnotateImageResponse
Expand Down Expand Up @@ -338,9 +338,9 @@ public function documentTextDetection($image, $optionalArgs = [])
* @type ImageContext $imageContext Additional context that may accompany the image.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a
* {@see Google\ApiCore\RetrySettings} object, or an associative array
* {@see RetrySettings} object, or an associative array
* of retry settings parameters. See the documentation on
* {@see Google\ApiCore\RetrySettings} for example usage.
* {@see RetrySettings} for example usage.
* }
*
* @return AnnotateImageResponse
Expand Down Expand Up @@ -372,9 +372,9 @@ public function safeSearchDetection($image, $optionalArgs = [])
* @type ImageContext $imageContext Additional context that may accompany the image.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a
* {@see Google\ApiCore\RetrySettings} object, or an associative array
* {@see RetrySettings} object, or an associative array
* of retry settings parameters. See the documentation on
* {@see Google\ApiCore\RetrySettings} for example usage.
* {@see RetrySettings} for example usage.
* }
*
* @return AnnotateImageResponse
Expand Down Expand Up @@ -406,9 +406,9 @@ public function imagePropertiesDetection($image, $optionalArgs = [])
* @type ImageContext $imageContext Additional context that may accompany the image.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a
* {@see Google\ApiCore\RetrySettings} object, or an associative array
* {@see RetrySettings} object, or an associative array
* of retry settings parameters. See the documentation on
* {@see Google\ApiCore\RetrySettings} for example usage.
* {@see RetrySettings} for example usage.
* }
*
* @return AnnotateImageResponse
Expand Down Expand Up @@ -440,9 +440,9 @@ public function cropHintsDetection($image, $optionalArgs = [])
* @type ImageContext $imageContext Additional context that may accompany the image.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a
* {@see Google\ApiCore\RetrySettings} object, or an associative array
* {@see RetrySettings} object, or an associative array
* of retry settings parameters. See the documentation on
* {@see Google\ApiCore\RetrySettings} for example usage.
* {@see RetrySettings} for example usage.
* }
*
* @return AnnotateImageResponse
Expand Down Expand Up @@ -474,9 +474,9 @@ public function webDetection($image, $optionalArgs = [])
* @type ImageContext $imageContext Additional context that may accompany the image.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a
* {@see Google\ApiCore\RetrySettings} object, or an associative array
* {@see RetrySettings} object, or an associative array
* of retry settings parameters. See the documentation on
* {@see Google\ApiCore\RetrySettings} for example usage.
* {@see RetrySettings} for example usage.
* }
*
* @return AnnotateImageResponse
Expand Down Expand Up @@ -512,17 +512,17 @@ public function objectLocalization($image, $optionalArgs = [])
*
* @param resource|string|Image $image The image to be processed.
* @param ProductSearchParams $productSearchParams Parameters for a product search request. Please note, this
* value will override the {@see Google\Cloud\Vision\V1\ProductSearchParams} in the
* {@see Google\Cloud\Vision\V1\ImageContext} instance if provided.
* value will override the {@see ProductSearchParams} in the
* {@see ImageContext} instance if provided.
* @param array $optionalArgs {
* Configuration Options.
*
* @type ImageContext $imageContext Additional context that may accompany the image.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a
* {@see Google\ApiCore\RetrySettings} object, or an associative array
* {@see RetrySettings} object, or an associative array
* of retry settings parameters. See the documentation on
* {@see Google\ApiCore\RetrySettings} for example usage.
* {@see RetrySettings} for example usage.
* }
*
* @return AnnotateImageResponse
Expand Down
6 changes: 6 additions & 0 deletions dev/data/templates/xml/argument.xml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{# @var argument \phpDocumentor\Descriptor\ArgumentDescriptor #}
<argument line="{{ argument.line }}" by_reference="{{ argument.byReference | export }}">
<name>{{ argument.name }}</name>
<default>{{ argument.default }}</default>
<type>{{ argument.type }}</type>
</argument>
8 changes: 8 additions & 0 deletions dev/data/templates/xml/constant.xml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{# @var constant phpDocumentor\Descriptor\ConstantDescriptor #}
<constant namespace="{{ constant.namespace }}" line="{{ constant.line }}" visibility="{{ constant.visibility }}">
<name>{{ constant.name }}</name>
<full_name>{{ constant.fullyQualifiedStructuralElementName }}</full_name>
<value>{{ constant.value }}</value>
{% if inherited_from %}<inherited_from>{{ inherited_from }}</inherited_from>{% endif %}
{{ include('docblock.xml.twig', {descriptor: constant}) }}
</constant>
21 changes: 21 additions & 0 deletions dev/data/templates/xml/docblock.xml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{# @var descriptor \phpDocumentor\Descriptor\DescriptorAbstract #}
<docblock line="{{ descriptor.line }}">
<description>{{ descriptor.summary }}</description>
<long-description>{{ descriptor.description }}</long-description>
{% for tags in descriptor.tags %}
{% for tag in tags %}
{% apply spaceless %}
<tag
name="{{ tag.name }}"
description="{{ tag.description|e|replace({"\n": "&#10;"})|raw }}"
{% if tag.link %} link="{{ tag.link }}"{% endif %}
{% if tag.version %} version="{{ tag.version }}"{% endif %}
{% if tag.reference %} link="{{ tag.reference }}"{% endif %}
{% if tag.variableName %} variable="{{ tag.variableName }}"{% endif %}
{% if tag.methodName %} method_name="{{ tag.methodName }}"{% endif %}
{% if tag.type %} type="{{ tag.type }}"{% endif %}/>
{% endapply %}

{% endfor %}
{% endfor %}
</docblock>
11 changes: 11 additions & 0 deletions dev/data/templates/xml/method.xml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{# @var method phpDocumentor\Descriptor\MethodDescriptor #}
<method final="{{ method.final | export }}" abstract="{{ method.abstract | export }}" static="{{ method.static | export }}" namespace="{{ method.namespace }}" line="{{ method.line }}" visibility="{{ method.visibility }}" returnByReference="{{ method.hasReturnByReference | export }}">
<name>{{ method.name }}</name>
<full_name>{{ method.fullyQualifiedStructuralElementName }}</full_name>
<value>{{ method.value }}</value>
{% if inherited_from %}<inherited_from>{{ inherited_from }}</inherited_from>{% endif %}
{% for argument in method.arguments %}
{{ include('argument.xml.twig', {descriptor: argument}) }}
{% endfor %}
{{ include('docblock.xml.twig', {descriptor: method}) }}
</method>
10 changes: 10 additions & 0 deletions dev/data/templates/xml/namespace_tree.xml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{# @var namespace \phpDocumentor\Descriptor\NamespaceDescriptor #}
{% if namespace.children.count > 0 %}
<namespace name="{{ namespace.name }}" full_name="{{ namespace.fullyQualifiedStructuralElementName }}">
{% for child in namespace.children %}
{{ include('namespace_tree.xml.twig', {namespace: child}) }}
{% endfor %}
</namespace>
{% else %}
<namespace name="{{ namespace.name }}" full_name="{{ namespace.fullyQualifiedStructuralElementName }}" />
{% endif %}
8 changes: 8 additions & 0 deletions dev/data/templates/xml/property.xml.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{# @var property phpDocumentor\Descriptor\PropertyDescriptor #}
<property namespace="{{ property.namespace }}" line="{{ property.line }}" visibility="{{ property.visibility }}">
<name>{{ property.name }}</name>
<full_name>{{ property.fullyQualifiedStructuralElementName }}</full_name>
<default>{{ property.default }}</default>
{% if inherited_from %}<inherited_from>{{ inherited_from }}</inherited_from>{% endif %}
{{ include('docblock.xml.twig', {descriptor: property}) }}
</property>
Loading

0 comments on commit 16f914e

Please sign in to comment.