Skip to content

Commit 431d891

Browse files
gziolowestonruter
andauthored
Apply suggestions from code review
Co-authored-by: Weston Ruter <[email protected]>
1 parent d4a1ab1 commit 431d891

2 files changed

Lines changed: 30 additions & 5 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public function unregister( string $id ): ?array {
214214
*
215215
* @type string $name The connector's display name.
216216
* @type string $description The connector's description.
217-
* @type string|null $logo_url Optional. URL to the connector's logo image.
217+
* @type string|null $logo_url Optional. URL to the connector's logo image.
218218
* @type string $type The connector type. Currently, only 'ai_provider' is supported.
219219
* @type array $plugin Optional. Plugin data for install/activate UI.
220220
* @type string $slug The WordPress.org plugin slug.

src/wp-includes/connectors.php

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ function wp_is_connector_registered( string $id ): bool {
3838
*
3939
* @param string $id The connector identifier.
4040
* @return array|null The registered connector data, or null if not registered.
41+
* @phpstan-return ?array{
42+
* name: string,
43+
* description: string,
44+
* logo_url?: string|null,
45+
* type: string,
46+
* authentication: array{
47+
* method: string,
48+
* credentials_url?: string|null,
49+
* setting_name?: string
50+
* },
51+
* plugin?: array{
52+
* slug: string
53+
* }
54+
* }
4155
*/
4256
function wp_get_connector( string $id ): ?array {
4357
$registry = WP_Connector_Registry::get_instance();
@@ -55,8 +69,6 @@ function wp_get_connector( string $id ): ?array {
5569
*
5670
* @see WP_Connector_Registry::get_all_registered()
5771
*
58-
* @phpstan-import-type Connector from WP_Connector_Registry
59-
*
6072
* @return array {
6173
* Connector settings keyed by connector ID.
6274
*
@@ -65,7 +77,7 @@ function wp_get_connector( string $id ): ?array {
6577
*
6678
* @type string $name The connector's display name.
6779
* @type string $description The connector's description.
68-
* @type string|null $logo_url Optional. URL to the connector's logo image.
80+
* @type string|null $logo_url Optional. URL to the connector's logo image.
6981
* @type string $type The connector type. Currently, only 'ai_provider' is supported.
7082
* @type array $plugin Optional. Plugin data for install/activate UI.
7183
* @type string $slug The WordPress.org plugin slug.
@@ -80,7 +92,20 @@ function wp_get_connector( string $id ): ?array {
8092
* }
8193
* }
8294
* }
83-
* @phpstan-return array<string, Connector>
95+
* @phpstan-return array<string, array{
96+
* name: string,
97+
* description: string,
98+
* logo_url?: string|null,
99+
* type: string,
100+
* authentication: array{
101+
* method: string,
102+
* credentials_url?: string|null,
103+
* setting_name?: string
104+
* },
105+
* plugin?: array{
106+
* slug: string
107+
* }
108+
* }>
84109
*/
85110
function wp_get_connectors(): array {
86111
$registry = WP_Connector_Registry::get_instance();

0 commit comments

Comments
 (0)