Make WordPress Core


Ignore:
Timestamp:
05/08/2026 02:23:54 PM (5 months ago)
Author:
ellatrix
Message:

Connectors: Refine plugin install check and PHPStan types.

Replace file_exists() with validate_plugin() in the connectors script module data, and refine PHPStan type definitions in the connectors code to better reflect the actual shape of registered connector data.

Follow-up to [62288].

Reviewed by ellatrix.
Merges [62332] to the 7.0 branch.

Props jorgefilipecosta, mukesh27, peterwilsoncc, westonruter, wildworks.
See #65020.

Location:
branches/7.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/7.0

  • branches/7.0/src/wp-includes/class-wp-connector-registry.php

    r62309 r62336  
    3030 * @phpstan-type Connector array{
    3131 *     name: non-empty-string,
    32  *     description: non-empty-string,
     32 *     description: string,
    3333 *     logo_url?: non-empty-string,
    3434 *     type: non-empty-string,
    … …  
    4040 *         env_var_name?: non-empty-string
    4141 *     },
    42  *     plugin?: array{
    43  *         file: non-empty-string,
    44  *         is_active?: callable(): bool
     42 *     plugin: array{
     43 *         file?: non-empty-string,
     44 *         is_active: callable(): bool
    4545 *     }
    4646 * }
    … …  
    121121         * @return array|null The registered connector data on success, null on failure.
    122122         *
    123          * @phpstan-param Connector $args
     123         * @phpstan-param array{
     124         *     name: non-empty-string,
     125         *     description?: string,
     126         *     logo_url?: non-empty-string,
     127         *     type: non-empty-string,
     128         *     authentication: array{
     129         *         method: 'api_key'|'none',
     130         *         credentials_url?: non-empty-string,
     131         *         setting_name?: non-empty-string,
     132         *         constant_name?: non-empty-string,
     133         *         env_var_name?: non-empty-string
     134         *     },
     135         *     plugin?: array{
     136         *         file?: non-empty-string,
     137         *         is_active?: callable(): bool
     138         *     }
     139         * } $args
    124140         * @phpstan-return Connector|null
    125141         */
Note: See TracChangeset for help on using the changeset viewer.