Skip to content

Commit fadd350

Browse files
gzioloclaude
andcommitted
Connectors: Refine PHPDoc consistency across connector shape documentation.
- Simplify get_all_registered() @return to a one-liner, keeping @phpstan-return for static analysis — avoids maintaining a duplicate expanded shape on an internal method marked "do not use directly" - Order $authentication before $plugin consistently across all PHPDoc blocks, matching the actual construction order in register() - Fix @return array|null typo on get_all_registered() which never returns null Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b2ccef5 commit fadd350

File tree

2 files changed

+12
-35
lines changed

2 files changed

+12
-35
lines changed

src/wp-includes/class-wp-connector-registry.php

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ final class WP_Connector_Registry {
7070
* @type string $method Required. The authentication method: 'api_key' or 'none'.
7171
* @type string $credentials_url Optional. URL where users can obtain API credentials.
7272
* }
73-
* @type array $plugin {
73+
* @type array $plugin {
7474
* Optional. Plugin data for install/activate UI.
7575
*
7676
* @type string $slug The WordPress.org plugin slug.
@@ -208,31 +208,8 @@ public function unregister( string $id ): ?array {
208208
*
209209
* @see wp_get_connectors()
210210
*
211-
* @return array {
212-
* Connector settings keyed by connector ID.
211+
* @return array Connector settings keyed by connector ID.
213212
*
214-
* @type array ...$0 {
215-
* Data for a single connector.
216-
*
217-
* @type string $name The connector's display name.
218-
* @type string $description The connector's description.
219-
* @type string $logo_url Optional. URL to the connector's logo image.
220-
* @type string $type The connector type. Currently, only 'ai_provider' is supported.
221-
* @type array $plugin {
222-
* Optional. Plugin data for install/activate UI.
223-
*
224-
* @type string $slug The WordPress.org plugin slug.
225-
* }
226-
* @type array $authentication {
227-
* Authentication configuration. When method is 'api_key', includes
228-
* credentials_url and setting_name. When 'none', only method is present.
229-
*
230-
* @type string $method The authentication method: 'api_key' or 'none'.
231-
* @type string $credentials_url Optional. URL where users can obtain API credentials.
232-
* @type string $setting_name Optional. The setting name for the API key.
233-
* }
234-
* }
235-
* }
236213
* @phpstan-return array<string, Connector>
237214
*/
238215
public function get_all_registered(): array {

src/wp-includes/connectors.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ function wp_is_connector_registered( string $id ): bool {
4444
* @type string $description The connector's description.
4545
* @type string $logo_url Optional. URL to the connector's logo image.
4646
* @type string $type The connector type. Currently, only 'ai_provider' is supported.
47-
* @type array $plugin {
48-
* Optional. Plugin data for install/activate UI.
49-
*
50-
* @type string $slug The WordPress.org plugin slug.
51-
* }
5247
* @type array $authentication {
5348
* Authentication configuration. When method is 'api_key', includes
5449
* credentials_url and setting_name. When 'none', only method is present.
@@ -57,6 +52,11 @@ function wp_is_connector_registered( string $id ): bool {
5752
* @type string $credentials_url Optional. URL where users can obtain API credentials.
5853
* @type string $setting_name Optional. The setting name for the API key.
5954
* }
55+
* @type array $plugin {
56+
* Optional. Plugin data for install/activate UI.
57+
*
58+
* @type string $slug The WordPress.org plugin slug.
59+
* }
6060
* }
6161
* @phpstan-return ?array{
6262
* name: non-empty-string,
@@ -99,11 +99,6 @@ function wp_get_connector( string $id ): ?array {
9999
* @type string $description The connector's description.
100100
* @type string $logo_url Optional. URL to the connector's logo image.
101101
* @type string $type The connector type. Currently, only 'ai_provider' is supported.
102-
* @type array $plugin {
103-
* Optional. Plugin data for install/activate UI.
104-
*
105-
* @type string $slug The WordPress.org plugin slug.
106-
* }
107102
* @type array $authentication {
108103
* Authentication configuration. When method is 'api_key', includes
109104
* credentials_url and setting_name. When 'none', only method is present.
@@ -112,6 +107,11 @@ function wp_get_connector( string $id ): ?array {
112107
* @type string $credentials_url Optional. URL where users can obtain API credentials.
113108
* @type string $setting_name Optional. The setting name for the API key.
114109
* }
110+
* @type array $plugin {
111+
* Optional. Plugin data for install/activate UI.
112+
*
113+
* @type string $slug The WordPress.org plugin slug.
114+
* }
115115
* }
116116
* }
117117
* @phpstan-return array<string, array{

0 commit comments

Comments
 (0)