Skip to content

Support array shape return documentation - #27

Open
Levdbas wants to merge 2 commits into
mainfrom
return-type
Open

Levdbas wants to merge 2 commits into
mainfrom
return-type

Conversation

@Levdbas

@Levdbas Levdbas commented Sep 15, 2026

Copy link
Copy Markdown
Member

Adds support for PHPDoc array-shape return types such as array{address?: string, lat?: string}|false in generated reference docs.

What changed:

  • Extracted shared array definition rendering so return tags can reuse the same nested field-list formatting as array @param descriptions.
  • Rendered array-shape return types as a concise union type, for example array|false, while expanding the shape fields in the detailed return documentation.
  • Normalized method overview tables so array shapes do not produce unwieldy inline return types.
  • Added coverage for a business location return shape including location_link and route_link.

Generated Markdown

For the business location return shape, Teak now generates:

**Returns:** `array|false` The business location, or false when none is configured.

<ul>
<li>**address**<br>`string`</li>
<li>**lat**<br>`string`</li>
<li>**lng**<br>`string`</li>
<li>**zoom**<br>`int`</li>
<li>**place_id**<br>`string`</li>
<li>**name**<br>`string`</li>
<li>**street_number**<br>`string`</li>
<li>**street_name**<br>`string`</li>
<li>**street_name_short**<br>`string`</li>
<li>**city**<br>`string`</li>
<li>**state**<br>`string`</li>
<li>**state_short**<br>`string`</li>
<li>**post_code**<br>`string`</li>
<li>**country**<br>`string`</li>
<li>**country_short**<br>`string`</li>
<li>**location_link**<br>`string`</li>
<li>**route_link**<br>`string`</li>
</ul>

The methods overview shows the same return type concisely as `array` or `false`.

Validation:

  • vendor/bin/phpunit passes all assertions. PHPUnit still reports the existing risky ClassCompilerTest::testDefault because it has no assertions.

@Levdbas
Levdbas requested a review from gchtr as a code owner September 15, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant